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


PHP sanitizeHTML函数代码示例

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


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

示例1: feedAction

 /**
  * This action handles the feed configuration page.
  *
  * It displays the feed configuration page.
  * If this action is reached through a POST request, it stores all new
  * configuraiton values then sends a notification to the user.
  *
  * The options available on the page are:
  *   - name
  *   - description
  *   - website URL
  *   - feed URL
  *   - category id (default: default category id)
  *   - CSS path to article on website
  *   - display in main stream (default: 0)
  *   - HTTP authentication
  *   - number of article to retain (default: -2)
  *   - refresh frequency (default: -2)
  * Default values are empty strings unless specified.
  */
 public function feedAction()
 {
     if (Minz_Request::param('ajax')) {
         $this->view->_useLayout(false);
     }
     $feedDAO = FreshRSS_Factory::createFeedDao();
     $this->view->feeds = $feedDAO->listFeeds();
     $id = Minz_Request::param('id');
     if ($id === false || !isset($this->view->feeds[$id])) {
         Minz_Error::error(404);
         return;
     }
     $this->view->feed = $this->view->feeds[$id];
     Minz_View::prependTitle(_t('sub.title.feed_management') . ' · ' . $this->view->feed->name() . ' · ');
     if (Minz_Request::isPost()) {
         $user = Minz_Request::param('http_user', '');
         $pass = Minz_Request::param('http_pass', '');
         $httpAuth = '';
         if ($user != '' || $pass != '') {
             $httpAuth = $user . ':' . $pass;
         }
         $cat = intval(Minz_Request::param('category', 0));
         $values = array('name' => Minz_Request::param('name', ''), 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), 'website' => Minz_Request::param('website', ''), 'url' => Minz_Request::param('url', ''), 'category' => $cat, 'pathEntries' => Minz_Request::param('path_entries', ''), 'priority' => intval(Minz_Request::param('priority', 0)), 'httpAuth' => $httpAuth, 'keep_history' => intval(Minz_Request::param('keep_history', -2)), 'ttl' => intval(Minz_Request::param('ttl', -2)));
         invalidateHttpCache();
         $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id));
         if ($feedDAO->updateFeed($id, $values) !== false) {
             $this->view->feed->_category($cat);
             $this->view->feed->faviconPrepare();
             Minz_Request::good(_t('feedback.sub.feed.updated'), $url_redirect);
         } else {
             Minz_Request::bad(_t('feedback.sub.feed.error'), $url_redirect);
         }
     }
 }
开发者ID:krisfremen,项目名称:FreshRSS,代码行数:54,代码来源:subscriptionController.php

示例2: index

 public function index($pageSlug = false)
 {
     list($pageId, $slug) = explode('-', trim($pageSlug));
     if (!is_numeric($pageId)) {
         $this->redirect(URL(""));
     }
     $page = $this->model()->getById((int) $pageId);
     // Stop here with a 404 header if the page wasn't found.
     if (!$page) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     } elseif (!ET::$session->userId and $page['hideFromGuests']) {
         $this->render404(T("message.pageNotFound"), true);
         return false;
     }
     $this->title = $page["title"];
     if (strlen($page['content']) > 155) {
         $description = substr($page['content'], 0, 155) . " ...";
         $description = str_replace(array("\n\n", "\n"), " ", $description);
     } else {
         $description = $page["content"];
     }
     $this->addToHead("<meta name='description' content='" . sanitizeHTML($description) . "'>");
     $this->data("page", $page);
     $this->render($this->plugin()->getView("page"));
 }
开发者ID:ZerGabriel,项目名称:Pages,代码行数:26,代码来源:PagesController.class.php

示例3: 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

示例4: init

 /**
  * Initialize the formatter with a content string on which all subsequent operations will be performed.
  *
  * @param string $content The content string.
  * @param bool $sanitize Whether or not to sanitize HTML in the content.
  * @return ETFormat
  */
 public function init($content, $sanitize = true)
 {
     // Clean up newline characters - make sure the only ones we are using are \n!
     $content = strtr($content, array("\r\n" => "\n", "\r" => "\n")) . "\n";
     // Set the content, and sanitize if necessary.
     $this->content = $sanitize ? sanitizeHTML($content) : $content;
     return $this;
 }
开发者ID:davchezt,项目名称:fireside,代码行数:15,代码来源:ETFormat.class.php

示例5: processRecaptchaField

 function processRecaptchaField($form, $key, &$data)
 {
     // Declare the response var.
     $resp = null;
     // Sanatize the $_POST data.
     $gRecaptchaResponse = sanitizeHTML($_POST["g-recaptcha-response"]);
     // Check for reCaptcha.
     $recaptcha = new \ReCaptcha\ReCaptcha(C('plugin.reCAPTCHA.secretkey'));
     $resp = $recaptcha->verify($gRecaptchaResponse, $_SERVER["REMOTE_ADDR"]);
     // If no valid captcha is submitted, show them an error.
     if (!$resp->isSuccess()) {
         $form->error("recaptcha", T("message.invalidCAPTCHA"));
     }
 }
开发者ID:jgknight,项目名称:reCAPTCHA,代码行数:14,代码来源:plugin.php

示例6: feedAction

 public function feedAction()
 {
     $catDAO = new FreshRSS_CategoryDAO();
     $this->view->categories = $catDAO->listCategories(false);
     $feedDAO = new FreshRSS_FeedDAO();
     $this->view->feeds = $feedDAO->listFeeds();
     $id = Minz_Request::param('id');
     if ($id == false && !empty($this->view->feeds)) {
         $id = current($this->view->feeds)->id();
     }
     $this->view->flux = false;
     if ($id != false) {
         $this->view->flux = $this->view->feeds[$id];
         if (!$this->view->flux) {
             Minz_Error::error(404, array('error' => array(Minz_Translate::t('page_not_found'))));
         } else {
             if (Minz_Request::isPost() && $this->view->flux) {
                 $user = Minz_Request::param('http_user', '');
                 $pass = Minz_Request::param('http_pass', '');
                 $httpAuth = '';
                 if ($user != '' || $pass != '') {
                     $httpAuth = $user . ':' . $pass;
                 }
                 $cat = intval(Minz_Request::param('category', 0));
                 $values = array('name' => Minz_Request::param('name', ''), 'description' => sanitizeHTML(Minz_Request::param('description', '', true)), 'website' => Minz_Request::param('website', ''), 'url' => Minz_Request::param('url', ''), 'category' => $cat, 'pathEntries' => Minz_Request::param('path_entries', ''), 'priority' => intval(Minz_Request::param('priority', 0)), 'httpAuth' => $httpAuth, 'keep_history' => intval(Minz_Request::param('keep_history', -2)));
                 if ($feedDAO->updateFeed($id, $values)) {
                     $this->view->flux->_category($cat);
                     $this->view->flux->faviconPrepare();
                     $notif = array('type' => 'good', 'content' => Minz_Translate::t('feed_updated'));
                 } else {
                     $notif = array('type' => 'bad', 'content' => Minz_Translate::t('error_occurred_update'));
                 }
                 invalidateHttpCache();
                 Minz_Session::_param('notification', $notif);
                 Minz_Request::forward(array('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true);
             }
             Minz_View::prependTitle(Minz_Translate::t('rss_feed_management') . ' — ' . $this->view->flux->name() . ' · ');
         }
     } else {
         Minz_View::prependTitle(Minz_Translate::t('rss_feed_management') . ' · ');
     }
 }
开发者ID:woshilapin,项目名称:FreshRSS,代码行数:42,代码来源:configureController.php

示例7: T

}
/**
 * Default master view. Displays a HTML template with a header and footer.
 *
 * @package esoTalk
 */
?>
<!DOCTYPE html>
<html>
<head>
<meta charset='<?php 
echo T("charset", "utf-8");
?>
'>
<title><?php 
echo sanitizeHTML($data["pageTitle"]);
?>
</title>
<?php 
echo $data["head"];
?>
<link rel="icon" type="image/png" href="<?php 
echo getResource("core/skin/favicon.png");
?>
">		+v<link rel="apple-touch-icon" href="<?php 
echo getResource("core/skin/apple-touch-icon.png");
?>
">
<link rel="apple-touch-icon" href="<?php 
echo getResource("core/skin/apple-touch-icon.png");
?>
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:31,代码来源:default.master.php

示例8: formatPostForTemplate

 /**
  * Format post data into an array which can be used to display the post template view (conversation/post).
  *
  * @param array $post The post data.
  * @param array $conversation The details of the conversation which the post is in.
  * @return array A formatted array which can be used in the post template view.
  */
 public function formatPostForTemplate($post, $conversation)
 {
     $canEdit = ET::postModel()->canEditPost($post, $conversation);
     $avatar = avatar($post);
     // Construct the post array for use in the post view (conversation/post).
     $formatted = array("id" => "p" . $post["postId"], "title" => memberLink($post["memberId"], $post["username"]), "avatar" => (!$post["deleteTime"] and $avatar) ? "<a href='" . URL(memberURL($post["memberId"], $post["username"])) . "'>{$avatar}</a>" : false, "class" => $post["deleteTime"] ? array("deleted") : array(), "info" => array(), "controls" => array(), "body" => !$post["deleteTime"] ? $this->displayPost($post["content"]) : false, "footer" => array(), "data" => array("id" => $post["postId"], "memberid" => $post["memberId"]));
     $date = smartTime($post["time"], true);
     // Add the date/time to the post info as a permalink.
     $formatted["info"][] = "<a href='" . URL(postURL($post["postId"])) . "' class='time' title='" . _strftime(T("date.full"), $post["time"]) . "' data-timestamp='" . $post["time"] . "'>" . (!empty($conversation["searching"]) ? T("Show in context") : $date) . "</a>";
     // If the post isn't deleted, add a lot of stuff!
     if (!$post["deleteTime"]) {
         // Add the user's online status / last action next to their name.
         if (empty($post["preferences"]["hideOnline"])) {
             $lastAction = ET::memberModel()->getLastActionInfo($post["lastActionTime"], $post["lastActionDetail"]);
             if ($lastAction[0]) {
                 $lastAction[0] = " (" . sanitizeHTML($lastAction[0]) . ")";
             }
             if ($lastAction) {
                 array_unshift($formatted["info"], "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . "{$lastAction[0]}'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">");
             }
         }
         // Show the user's group type.
         $formatted["info"][] = "<span class='group'>" . memberGroup($post["account"], $post["groups"]) . "</span>";
         $formatted["class"][] = "group-" . $post["account"];
         foreach ($post["groups"] as $k => $v) {
             if ($k) {
                 $formatted["class"][] = "group-" . $k;
             }
         }
         // If the post has been edited, show the time and by whom next to the controls.
         if ($post["editMemberId"]) {
             $formatted["controls"][] = "<span class='editedBy'>" . sprintf(T("Edited %s by %s"), "<span title='" . _strftime(T("date.full"), $post["editTime"]) . "' data-timestamp='" . $post["editTime"] . "'>" . relativeTime($post["editTime"], true) . "</span>", memberLink($post["editMemberId"], $post["editMemberName"])) . "</span>";
         }
         // If the user can reply, add a quote control.
         if ($conversation["canReply"]) {
             $formatted["controls"][] = "<a href='" . URL(conversationURL($conversation["conversationId"], $conversation["title"]) . "/?quote=" . $post["postId"] . "#reply") . "' title='" . T("Quote") . "' class='control-quote'><i class='icon-quote-left'></i></a>";
         }
         // If the user can edit the post, add edit/delete controls.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/editPost/" . $post["postId"]) . "' title='" . T("Edit") . "' class='control-edit'><i class='icon-edit'></i></a>";
             $formatted["controls"][] = "<a href='" . URL("conversation/deletePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Delete") . "' class='control-delete'><i class='icon-remove'></i></a>";
         } elseif (!$conversation["locked"] && !ET::$session->isSuspended() && $post["memberId"] == ET::$session->userId && (!$post["deleteMemberId"] || $post["deleteMemberId"] == ET::$session->userId) && C("esoTalk.conversation.editPostTimeLimit") == "reply") {
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-edit disabled'><i class='icon-edit'></i></span>";
             $formatted["controls"][] = "<span title='" . sanitizeHTML(T("message.cannotEditSinceReply")) . "' class='control-delete disabled'><i class='icon-remove'></i></span>";
         }
     } else {
         // Add the "deleted by" information.
         if ($post["deleteMemberId"]) {
             $formatted["controls"][] = "<span>" . sprintf(T("Deleted %s by %s"), "<span title='" . _strftime(T("date.full"), $post["deleteTime"]) . "' data-timestamp='" . $post["deleteTime"] . "'>" . relativeTime($post["deleteTime"], true) . "</span>", memberLink($post["deleteMemberId"], $post["deleteMemberName"])) . "</span>";
         }
         // If the user can edit the post, add a restore control.
         if ($canEdit) {
             $formatted["controls"][] = "<a href='" . URL("conversation/restorePost/" . $post["postId"] . "?token=" . ET::$session->token) . "' title='" . T("Restore") . "' class='control-restore'><i class='icon-reply'></i></a>";
         }
     }
     $this->trigger("formatPostForTemplate", array(&$formatted, $post, $conversation));
     return $formatted;
 }
开发者ID:xiaolvmu,项目名称:Techllage,代码行数:65,代码来源:ETConversationController.class.php

示例9: URL

 * Displays the conversation list, including the filter area (search form, gambits, and channel breadcrumb.)
 *
 * @package esoTalk
 */
?>

<div id='conversationsFilter' class='bodyHeader'>

<form class='search big' id='search' action='<?php 
echo URL("conversations/" . $data["channelSlug"]);
?>
' method='get'>
<fieldset>
<i class='icon-search'></i>
<input name='search' type='text' class='text' value='<?php 
echo sanitizeHTML($data["searchString"]);
?>
' spellcheck='false' placeholder='<?php 
echo T("Search conversations...");
?>
' style="margin-bottom: 3px;"/>
<a class='control-reset' href='<?php 
echo URL("conversations/" . $data["channelSlug"]);
?>
' style="visibility: hidden;"><i class='icon-remove'></i></a>
</fieldset>
</form>

<ul id='channels' class='channels tabs'>
<li class='channelListItem'><a href='<?php 
echo URL("channels");
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:31,代码来源:index.php

示例10: sanitizeHTML

)"><?php 
print $_LANG['send_pm'];
?>
</a></td>
</tr>

<tr>
	<td class="userinfoentry">.</td>
	<td class="userinfoentry" style="text-align: right">
		<a href="<?php 
print BASEDIR;
?>
messagesByUser.<?php 
print PHPEXT;
?>
?user_id=<?php 
print $id;
?>
"><?php 
print $_LANG['messages_by_user'] . sanitizeHTML($user[0]['username']);
?>
</a></td>
</tr>

</table>

<?php 
require_once ABSOLUTE_BASEPATH . '/footer.' . PHPEXT;
?>

开发者ID:BlackLight,项目名称:nullBB,代码行数:29,代码来源:viewuser.php

示例11: handler_format_format

 public function handler_format_format($sender)
 {
     $from = $to = array();
     foreach ($this->icons as $k => $v) {
         $quoted = preg_quote(sanitizeHTML($k), "/");
         $from[] = "/(?<=^|[\\s.,!<>]){$quoted}(?=[\\s.,!<>)]|\$)/i";
         $to[] = "<span class='emoticon' style='{$v}'>{$k}</span>";
     }
     $sender->content = preg_replace($from, $to, $sender->content);
 }
开发者ID:ky0ncheng,项目名称:esotalk-for-sae,代码行数:10,代码来源:plugin.php

示例12: avatar

<div class='col-member'>
<?php 
echo avatar($member, "thumb");
?>
<strong><?php 
echo memberLink($member["memberId"], $member["username"]);
?>
</strong>

<?php 
// Online indicator.
if (empty($member["preferences"]["hideOnline"])) {
    $lastAction = ET::memberModel()->getLastActionInfo($member["lastActionTime"], $member["lastActionDetail"]);
    if ($lastAction) {
        echo "<" . (!empty($lastAction[1]) ? "a href='{$lastAction[1]}'" : "span") . " class='online' title='" . T("Online") . ($lastAction[0] ? " (" . sanitizeHTML($lastAction[0]) . ")" : "") . "'><i class='icon-circle'></i></" . (!empty($lastAction[1]) ? "a" : "span") . ">";
    }
}
?>

<span class='group subText'><?php 
echo memberGroup($member["account"], $member["groups"]);
?>
</span>

</div>

<div class='col-lastActive'>
<span class='subText'><?php 
printf(T("Last active %s"), empty($member["preferences"]["hideOnline"]) ? "<span title='" . date(T("date.full"), $member["lastActionTime"]) . "'>" . relativeTime($member["lastActionTime"], true) . "</span>" : "[" . T("hidden") . "]");
?>
开发者ID:19eighties,项目名称:esoTalk,代码行数:30,代码来源:member.php

示例13: foreach

 * @package esoTalk
 */
$conversation = $data["conversation"];
?>
<ul class='channels tabs'>
<li class='pathItem selected pathEnd'>
<?php 
foreach ($conversation["channelPath"] as $channel) {
    ?>
<a href='<?php 
    echo URL("conversations/" . $channel["slug"]);
    ?>
' data-channel='<?php 
    echo $channel["slug"];
    ?>
' title='<?php 
    echo sanitizeHTML(strip_tags($channel["description"]));
    ?>
' class='channel channel-<?php 
    echo $channel["channelId"];
    ?>
'><?php 
    echo $channel["title"];
    ?>
</a>
<?php 
}
?>
</li>
</ul>
开发者ID:19eighties,项目名称:esoTalk,代码行数:30,代码来源:channelPath.php

示例14: action_index


//.........这里部分代码省略.........
     foreach ($currentChannels as $channel) {
         $slugs[] = $channelInfo[$channel]["slug"];
     }
     $url = "conversations/" . urlencode(($k = implode(" ", $slugs)) ? $k : "all") . ($searchString ? "?search=" . urlencode($searchString) : "");
     $this->pushNavigation("conversations", "search", URL($url));
     $this->canonicalURL = URL($url, true);
     // If we're loading the page in full...
     if ($this->responseType === RESPONSE_TYPE_DEFAULT) {
         // Update the user's last action.
         ET::memberModel()->updateLastAction("search");
         // Add a link to the RSS feed in the bar.
         // $this->addToMenu("meta", "feed", "<a href='".URL(str_replace("conversations/", "conversations/index.atom/", $url))."' id='feed'>".T("Feed")."</a>");
         $controls = ETFactory::make("menu");
         // Mark as read controls
         if (ET::$session->user) {
             $controls->add("markAllAsRead", "<a href='" . URL("conversations/markAllAsRead/?token=" . ET::$session->token . "' id='control-markAllAsRead'><i class='icon-check'></i> " . T("Mark all as read") . "</a>"));
             $controls->add("markListedAsRead", "<a href='" . URL("conversations/{$channelSlug}/?search=" . urlencode($searchString) . "&markAsRead=1&token=" . ET::$session->token . "' id='control-markListedAsRead'><i class='icon-list'></i> " . T("Mark listed as read") . "</a>"));
         }
         // Add the default gambits to the gambit cloud: gambit text => css class to apply.
         $gambits = array("main" => array(T("gambit.sticky") => array("gambit-sticky", "icon-pushpin")), "time" => array(T("gambit.order by newest") => array("gambit-orderByNewest", "icon-list-ol"), T("gambit.active last ? hours") => array("gambit-activeLastHours", "icon-time"), T("gambit.active last ? days") => array("gambit-activeLastDays", "icon-calendar"), T("gambit.active today") => array("gambit-activeToday", "icon-asterisk"), T("gambit.dead") => array("gambit-dead", "icon-remove"), T("gambit.locked") => array("gambit-locked", "icon-lock")), "member" => array(T("gambit.author:") . T("gambit.member") => array("gambit-author", "icon-user"), T("gambit.contributor:") . T("gambit.member") => array("gambit-contributor", "icon-user")), "replies" => array(T("gambit.has replies") => array("gambit-hasReplies", "icon-comment"), T("gambit.has >10 replies") => array("gambit-replies", "icon-comments"), T("gambit.order by replies") => array("gambit-orderByReplies", "icon-list-ol")), "text" => array(T("gambit.title:") . " ?" => array("gambit-title", "icon-font")), "misc" => array(T("gambit.random") => array("gambit-random", "icon-random"), T("gambit.reverse") => array("gambit-reverse", "icon-exchange")));
         // Add some more personal gambits if there is a user logged in.
         if (ET::$session->user) {
             addToArrayString($gambits["main"], T("gambit.private"), array("gambit-private", "icon-envelope-alt"), 1);
             addToArrayString($gambits["main"], T("gambit.starred"), array("gambit-starred", "icon-star"), 2);
             addToArrayString($gambits["main"], T("gambit.draft"), array("gambit-draft", "icon-pencil"), 3);
             addToArrayString($gambits["main"], T("gambit.ignored"), array("gambit-ignored", "icon-eye-close"), 4);
             addToArrayString($gambits["time"], T("gambit.unread"), array("gambit-unread", "icon-inbox"), 0);
             addToArrayString($gambits["member"], T("gambit.author:") . T("gambit.myself"), array("gambit-authorMyself", "icon-smile"), 0);
             addToArrayString($gambits["member"], T("gambit.contributor:") . T("gambit.myself"), array("gambit-contributorMyself", "icon-smile"), 2);
         }
         $this->trigger("constructGambitsMenu", array(&$gambits));
         // Construct the gambits menu based on the above arrays.
         $gambitsMenu = ETFactory::make("menu");
         $linkPrefix = "conversations/" . $channelSlug . "/?search=" . urlencode(!empty($searchString) ? $searchString . " + " : "");
         foreach ($gambits as $section => $items) {
             foreach ($items as $gambit => $classes) {
                 $gambitsMenu->add($classes[0], "<a href='" . URL($linkPrefix . urlencode("#" . $gambit)) . "' class='{$classes[0]}' data-gambit='{$gambit}'>" . (!empty($classes[1]) ? "<i class='{$classes[1]}'></i> " : "") . "{$gambit}</a>");
             }
             end($gambits);
             if ($section !== key($gambits)) {
                 $gambitsMenu->separator();
             }
         }
         $this->data("controlsMenu", $controls);
         $this->data("gambitsMenu", $gambitsMenu);
         // Construct a list of keywords to use in the meta tags.
         $keywords = array();
         foreach ($channelInfo as $c) {
             if ($c["depth"] == 0) {
                 $keywords[] = strtolower($c["title"]);
             }
         }
         // Add meta tags to the header.
         $this->addToHead("<meta name='keywords' content='" . sanitizeHTML(($k = C("esoTalk.meta.keywords")) ? $k : implode(",", $keywords)) . "'>");
         $lastKeyword = reset(array_splice($keywords, count($keywords) - 1, 1));
         $this->addToHead("<meta name='description' content='" . sanitizeHTML(($d = C("esoTalk.meta.description")) ? $d : sprintf(T("forumDescription"), C("esoTalk.forumTitle"), implode(", ", $keywords), $lastKeyword)) . "'>");
         // If this is not technically the homepage (if it's a search page) the we don't want it to be indexed.
         if ($searchString) {
             $this->addToHead("<meta name='robots' content='noindex, noarchive'>");
         }
         // Add JavaScript language definitions and variables.
         $this->addJSLanguage("Starred", "Unstarred", "gambit.member", "gambit.more results", "Filter conversations", "Jump to last");
         $this->addJSVar("searchUpdateInterval", C("esoTalk.search.updateInterval"));
         $this->addJSVar("currentSearch", $searchString);
         $this->addJSVar("currentChannels", $currentChannels);
         $this->addJSFile("core/js/lib/jquery.cookie.js");
         $this->addJSFile("core/js/autocomplete.js");
         $this->addJSFile("core/js/search.js");
         // Add an array of channels in the form slug => id for the JavaScript to use.
         $channels = array();
         foreach ($channelInfo as $id => $c) {
             $channels[$id] = $c["slug"];
         }
         $this->addJSVar("channels", $channels);
         // Get a bunch of statistics...
         $queries = array("post" => ET::SQL()->select("COUNT(*)")->from("post")->get(), "conversation" => ET::SQL()->select("COUNT(*)")->from("conversation")->get(), "member" => ET::SQL()->select("COUNT(*)")->from("member")->get());
         $sql = ET::SQL();
         foreach ($queries as $k => $query) {
             $sql->select("({$query}) AS {$k}");
         }
         $stats = $sql->exec()->firstRow();
         // ...and show them in the footer.
         foreach ($stats as $k => $v) {
             $stat = Ts("statistic.{$k}", "statistic.{$k}.plural", number_format($v));
             if ($k == "member" and (C("esoTalk.members.visibleToGuests") or ET::$session->user)) {
                 $stat = "<a href='" . URL("members") . "'>{$stat}</a>";
             }
             $this->addToMenu("statistics", "statistic-{$k}", $stat, array("before" => "statistic-online"));
         }
         $this->render("conversations/index");
     } elseif ($this->responseType === RESPONSE_TYPE_VIEW) {
         $this->render("conversations/results");
     } elseif ($this->responseType === RESPONSE_TYPE_AJAX) {
         $this->json("channels", $this->getViewContents("channels/tabs", $this->data));
         $this->render("conversations/results");
     } elseif ($this->responseType === RESPONSE_TYPE_JSON) {
         $this->json("results", $results);
         $this->render();
     }
 }
开发者ID:davchezt,项目名称:fireside,代码行数:101,代码来源:ETConversationsController.class.php

示例15: conversationURL

?>
<div class='col-conversation'><?php 
$conversationURL = conversationURL($conversation["conversationId"], $conversation["title"]);
// Output the conversation's labels.
echo "<span class='labels'>";
foreach ($conversation["labels"] as $label) {
    echo label($label, $label == "draft" ? URL($conversationURL . "#reply") : "");
}
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>
开发者ID:m-mori,项目名称:forum,代码行数:31,代码来源:conversation.php


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