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


PHP TextHelper::htmlspecialchars_decode方法代码示例

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


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

示例1: execute

 public function execute(HTTPRequestCustom $request)
 {
     if ($this->check_authorizations()) {
         $pseudo = TextHelper::strprotect(utf8_decode($request->get_string('pseudo', '')));
         $contents = TextHelper::htmlentities($request->get_string('contents', ''), ENT_COMPAT, 'UTF-8');
         $contents = TextHelper::htmlspecialchars_decode(TextHelper::html_entity_decode($contents, ENT_COMPAT, 'windows-1252'));
         if ($pseudo && $contents) {
             //Mod anti-flood, autorisé aux membres qui bénificie de l'autorisation de flooder.
             $check_time = AppContext::get_current_user()->get_id() !== -1 && ContentManagementConfig::load()->is_anti_flood_enabled() ? PersistenceContext::get_querier()->get_column_value(PREFIX . "shoutbox", 'MAX(timestamp)', 'WHERE user_id = :id', array('id' => AppContext::get_current_user()->get_id())) : '';
             if (!empty($check_time) && !AppContext::get_current_user()->check_max_value(AUTH_FLOOD)) {
                 if ($check_time >= time() - ContentManagementConfig::load()->get_anti_flood_duration()) {
                     $code = -1;
                 }
             }
             //Vérifie que le message ne contient pas du flood de lien.
             $config_shoutbox = ShoutboxConfig::load();
             $contents = FormatingHelper::strparse($contents, $config_shoutbox->get_forbidden_formatting_tags());
             if (!TextHelper::check_nbr_links($contents, $config_shoutbox->get_max_links_number_per_message(), true)) {
                 //Nombre de liens max dans le message.
                 $code = -2;
             }
             $shoutbox_message = new ShoutboxMessage();
             $shoutbox_message->init_default_properties();
             $shoutbox_message->set_login($pseudo);
             $shoutbox_message->set_user_id(AppContext::get_current_user()->get_id());
             $shoutbox_message->set_contents($contents);
             $shoutbox_message->set_creation_date(new Date());
             $code = ShoutboxService::add($shoutbox_message);
         } else {
             $code = -3;
         }
     } else {
         $code = -4;
     }
     return new JSONResponse(array('code' => $code));
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:36,代码来源:ShoutboxAjaxAddMessageController.class.php

示例2: define

 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 *
 ###################################################*/
define('PATH_TO_ROOT', '../../..');
include_once PATH_TO_ROOT . '/kernel/begin.php';
AppContext::get_session()->no_session_location();
//Permet de ne pas mettre jour la page dans la session.
include_once PATH_TO_ROOT . '/kernel/header_no_display.php';
$page_path_to_root = retrieve(REQUEST, 'path_to_root', '');
$page_path = retrieve(REQUEST, 'page_path', '');
//Quel éditeur utiliser ? Si ce n'est pas précisé on prend celui par défaut de l'utilisateur
$editor = retrieve(REQUEST, 'editor', ContentFormattingConfig::load()->get_default_editor());
$contents = TextHelper::htmlentities(retrieve(POST, 'contents', ''), ENT_COMPAT, 'UTF-8');
$contents = TextHelper::htmlspecialchars_decode(stripslashes(TextHelper::html_entity_decode($contents)));
$ftags = retrieve(POST, 'ftags', TSTRING_UNCHANGE);
$forbidden_tags = explode(',', $ftags);
$formatting_factory = AppContext::get_content_formatting_service()->create_factory($editor);
//On prend le bon parseur avec la bonne configuration
$parser = $formatting_factory->get_parser();
$parser->set_content($contents);
$parser->set_path_to_root($page_path_to_root);
$parser->set_page_path($page_path);
if (!empty($forbidden_tags)) {
    $parser->set_forbidden_tags($forbidden_tags);
}
$parser->parse();
//On parse la deuxième couche (code, math etc) pour afficher
$second_parser = $formatting_factory->get_second_parser();
$second_parser->set_content($parser->get_content());
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:31,代码来源:content_xmlhttprequest.php

示例3: html

 public function html($string)
 {
     return TextHelper::htmlspecialchars_decode($string);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:TemplateFunctions.class.php

示例4: highlight_code

 /**
  * @desc Highlights a content in a supported language using the appropriate syntax highlighter.
  * The highlighted languages are numerous: actionscript, asm, asp, bash, c, cpp, csharp, css, d, delphi, fortran, html,
  * java, javascript, latex, lua, matlab, mysql, pascal, perl, php, python, rails, ruby, sql, text, vb, xml,
  * PHPBoost templates and PHPBoost BBCode.
  * @param string $contents Content to highlight
  * @param string $language Language name
  * @param bool $line_number Indicate whether or not the line number must be added to the code.
  * @param bool $inline_code Indicate if the code is multi line.
  */
 private static function highlight_code($contents, $language, $line_number, $inline_code)
 {
     $contents = TextHelper::htmlspecialchars_decode($contents);
     //BBCode PHPBoost
     if (strtolower($language) == 'bbcode') {
         $bbcode_highlighter = new BBCodeHighlighter();
         $bbcode_highlighter->set_content($contents);
         $bbcode_highlighter->parse($inline_code);
         $contents = $bbcode_highlighter->get_content();
     } elseif (strtolower($language) == 'tpl' || strtolower($language) == 'template') {
         require_once PATH_TO_ROOT . '/kernel/lib/php/geshi/geshi.php';
         $template_highlighter = new TemplateHighlighter();
         $template_highlighter->set_content($contents);
         $template_highlighter->parse($line_number ? GESHI_NORMAL_LINE_NUMBERS : GESHI_NO_LINE_NUMBERS, $inline_code);
         $contents = $template_highlighter->get_content();
     } elseif (strtolower($language) == 'plain') {
         $plain_code_highlighter = new PlainCodeHighlighter();
         $plain_code_highlighter->set_content($contents);
         $plain_code_highlighter->parse();
         $contents = $plain_code_highlighter->get_content();
     } elseif ($language != '') {
         require_once PATH_TO_ROOT . '/kernel/lib/php/geshi/geshi.php';
         $Geshi = new GeSHi($contents, $language);
         if ($line_number) {
             $Geshi->enable_line_numbers(GESHI_NORMAL_LINE_NUMBERS);
         }
         //No container if we are in an inline tag
         if ($inline_code) {
             $Geshi->set_header_type(GESHI_HEADER_NONE);
         }
         $contents = '<pre style="display:inline;">' . $Geshi->parse_code() . '</pre>';
     } else {
         $highlight = highlight_string($contents, true);
         $font_replace = str_replace(array('<font ', '</font>'), array('<span ', '</span>'), $highlight);
         $contents = preg_replace('`color="(.*?)"`', 'style="color:$1"', $font_replace);
     }
     return $contents;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:48,代码来源:ContentSecondParser.class.php


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