👁 查看:opEmojiFilter.class.php
路径:/virtual/bigbrother/sns/lib/filter/opEmojiFilter.class.php
大小:1.17 KB · 修改:2010-08-10 13:59:42 · 权限:0644 · 可写
<?php
/**
* This file is part of the OpenPNE package.
* (c) OpenPNE Project (http://www.openpne.jp/)
*
* For the full copyright and license information, please view the LICENSE
* file and the NOTICE file that were distributed with this source code.
*/
/**
* opEmojiFilter converts Emoji symbols in the response text
*
* Emoji is the picture characters or emoticons used in Japan.
*
* @package OpenPNE
* @subpackage filter
* @author Kousuke Ebihara <ebihara@tejimaya.com>
*/
class opEmojiFilter extends sfFilter
{
/**
* Executes this filter.
*
* @param sfFilterChain $filterChain A sfFilterChain instance
*/
public function execute($filterChain)
{
$filterChain->execute();
$response = $this->getContext()->getResponse();
$request = $this->getContext()->getRequest();
$content = $response->getContent();
if (!$request->isMobile())
{
list($list, $content) = opToolkit::replacePatternsToMarker($content);
}
$content = OpenPNE_KtaiEmoji::convertEmoji($content);
if (!$request->isMobile())
{
$content = str_replace(array_keys($list), array_values($list), $content);
}
$response->setContent($content);
}
}