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


PHP TextHelper::htmlspecialchars方法代码示例

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


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

示例1: load_lang

 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', UpdateController::DEFAULT_LOCALE));
     LangLoader::set_locale($locale);
     UpdateUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('update', 'update');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:7,代码来源:UpdateController.class.php

示例2: load_lang

 protected function load_lang(HTTPRequestCustom $request)
 {
     $locale = TextHelper::htmlspecialchars($request->get_string('lang', self::DEFAULT_LOCALE));
     $locale = in_array($locale, InstallationServices::get_available_langs()) ? $locale : self::DEFAULT_LOCALE;
     LangLoader::set_locale($locale);
     InstallUrlBuilder::set_locale($locale);
     $this->lang = LangLoader::get('install', 'install');
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:8,代码来源:InstallController.class.php

示例3: update_extended_field

 public static function update_extended_field(ExtendedField $extended_field)
 {
     self::change_extended_field_to_member($extended_field);
     $data_field = self::select_data_field_by_id($extended_field);
     $former_field_type = $data_field['field_type'];
     $new_field_type = $extended_field->get_field_type();
     self::$db_querier->inject("UPDATE " . DB_TABLE_MEMBER_EXTENDED_FIELDS_LIST . " SET \r\n\t\t\tname = :name, field_name = :field_name, description = :description, field_type = :field_type, possible_values = :possible_values, default_value = :default_value, required = :required, display = :display, regex = :regex, freeze = :freeze, auth = :auth\r\n\t\t\tWHERE id = :id", array('name' => TextHelper::htmlspecialchars($extended_field->get_name()), 'field_name' => $extended_field->get_field_name(), 'description' => TextHelper::htmlspecialchars($extended_field->get_description()), 'field_type' => $extended_field->get_field_type(), 'possible_values' => serialize($extended_field->get_possible_values()), 'default_value' => TextHelper::htmlspecialchars($extended_field->get_default_value()), 'required' => (string) $extended_field->get_required(), 'display' => (string) $extended_field->get_display(), 'regex' => TextHelper::htmlspecialchars($extended_field->get_regex()), 'freeze' => (string) $extended_field->get_is_freeze(), 'auth' => serialize($extended_field->get_authorization()), 'id' => $extended_field->get_id()));
     // If change field type, delete old informations
     if ($former_field_type !== $new_field_type) {
         self::delete_empty_fields_member($extended_field);
     }
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:ExtendedFieldsDatabaseService.class.php

示例4: protect_content

 private function protect_content()
 {
     //Breaking the HTML code
     $this->content = TextHelper::htmlspecialchars($this->content, ENT_NOQUOTES);
     $this->content = strip_tags($this->content);
     //While we aren't in UTF8 encoding, we have to use HTML entities to display some special chars, we accept them.
     $this->content = preg_replace('`&((?:#[0-9]{2,5})|(?:[a-z0-9]{2,8}));`i', "&\$1;", $this->content);
     //Treatment of the Word pasted characters
     $array_str = array('?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?');
     $array_str_replace = array('€', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', 'Ž', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', 'ž', 'Ÿ');
     $this->content = str_replace($array_str, $array_str_replace, $this->content);
 }
开发者ID:DrJoey,项目名称:MarkUp,代码行数:12,代码来源:MarkUpParser.class.php

示例5: retrieve_value

 public function retrieve_value()
 {
     $request = AppContext::get_request();
     $values = array();
     for ($i = 1; $i <= $this->max_input; $i++) {
         $field_label_id = 'field_label_' . $this->get_html_id() . '_' . $i;
         if ($request->has_postparameter($field_label_id)) {
             $field_answers_id = 'field_answers_' . $this->get_html_id() . '_' . $i;
             $field_label = $request->get_poststring($field_label_id);
             $field_answers = $request->get_poststring($field_answers_id);
             if (!empty($field_label) && !empty($field_answers)) {
                 $values[$i] = array('label' => TextHelper::htmlspecialchars($field_label), 'answers' => TextHelper::htmlspecialchars($field_answers));
             }
         }
     }
     $this->set_value($values);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:17,代码来源:QuestionCaptchaFormFieldQuestions.class.php

示例6: add_language_bar

 private function add_language_bar()
 {
     $lang = TextHelper::htmlspecialchars(AppContext::get_request()->get_string('lang', InstallController::DEFAULT_LOCALE));
     $lang = in_array($lang, InstallationServices::get_available_langs()) ? $lang : InstallController::DEFAULT_LOCALE;
     $lang_dir = new Folder(PATH_TO_ROOT . '/lang');
     $langs = array();
     foreach ($lang_dir->get_folders('`^[a-z_-]+$`i') as $folder) {
         $info_lang = load_ini_file(PATH_TO_ROOT . '/lang/', $folder->get_name());
         if (!empty($info_lang['name'])) {
             $langs[] = array('LANG' => $folder->get_name(), 'LANG_NAME' => $info_lang['name'], 'SELECTED' => $folder->get_name() == $lang ? 'selected="selected"' : '');
             if ($folder->get_name() == $lang) {
                 $this->full_view->put('LANG_IDENTIFIER', $info_lang['identifier']);
             }
         }
     }
     $this->full_view->put('lang', $langs);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:17,代码来源:InstallDisplayResponse.class.php

示例7: parse

 /**
  * @desc Highlights the content of the parser.
  * @param bool $inline_code If you want that the code make a new HTML paragraph, use BBCODE_HIGHLIGHTER_BLOCK_CODE
  * (default parameter) and if you want that it would be integrated in a line, use BBCODE_HIGHLIGHTER_INLINE_CODE
  * @return void You can get the result by calling the get_content method
  */
 public function parse($inline_code = self::BBCODE_HIGHLIGHTER_BLOCK_CODE)
 {
     //Protection of html code
     $this->content = TextHelper::htmlspecialchars($this->content);
     //Line tag
     $this->content = str_replace('[line]', '<span style="color:' . self::$bbcode_tag_color . ';">[line]</span>', $this->content);
     $this->content = str_replace('[*]', '<span style="color:' . self::$bbcode_list_item_color . ';">[*]</span>', $this->content);
     //Simple tags (whitout parameter)
     $simple_tags = array('b', 'i', 'u', 's', 'sup', 'sub', 'pre', 'math', 'quote', 'block', 'fieldset', 'sound', 'url', 'img', 'mail', 'code', 'tr', 'html', 'row', 'indent', 'hide', 'mail');
     foreach ($simple_tags as $tag) {
         while (preg_match('`\\[' . $tag . '\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace('`\\[' . $tag . '\\](.*)\\[/' . $tag . '\\]`isU', '<span style="color:' . self::$bbcode_tag_color . ';">/[/' . $tag . '/]/</span>$1<span style="color:' . self::$bbcode_tag_color . ';">/[//' . $tag . '/]/</span>', $this->content);
         }
     }
     //Tags which take a parameter : [tag=parameter]content[/tag]
     $tags_with_simple_property = array('img', 'color', 'bgcolor', 'size', 'font', 'align', 'float', 'anchor', 'acronym', 'title', 'stitle', 'style', 'url', 'mail', 'code', 'quote', 'movie', 'swf', 'mail');
     foreach ($tags_with_simple_property as $tag) {
         while (preg_match('`\\[' . $tag . '=([^\\]]+)\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace('`\\[' . $tag . '=([^\\]]+)\\](.*)\\[/' . $tag . '\\]`isU', '<span style="color:' . self::$bbcode_tag_color . ';">/[/' . $tag . '</span>=<span style="color:' . self::$bbcode_param_color . ';">$1</span><span style="color:' . self::$bbcode_tag_color . ';">/]/</span>$2<span style="color:' . self::$bbcode_tag_color . ';">/[//' . $tag . '/]/</span>', $this->content);
         }
     }
     //Tags which take several parameters. The syntax is the same as XML parameters
     $tags_with_many_parameters = array('table', 'col', 'head', 'list', 'fieldset', 'block', 'wikipedia');
     foreach ($tags_with_many_parameters as $tag) {
         while (preg_match('`\\[(' . $tag . ')([^\\]]*)\\](.*)\\[/' . $tag . '\\]`isU', $this->content)) {
             $this->content = preg_replace_callback('`\\[(' . $tag . ')([^\\]]*)\\](.*)\\[/' . $tag . '\\]`isU', array($this, 'highlight_bbcode_tag_with_many_parameters'), $this->content);
         }
     }
     if ($inline_code == self::BBCODE_HIGHLIGHTER_BLOCK_CODE) {
         $this->content = '<pre>' . $this->content . '</pre>';
     } else {
         $this->content = '<pre style="display:inline;">' . $this->content . '</pre>';
     }
     //Te be able to handle the nested tags, we replaced [ by /[/, we do the reverse replacement now
     $this->content = str_replace(array('/[/', '/]/'), array('[', ']'), $this->content);
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:42,代码来源:BBCodeHighlighter.class.php

示例8: exists

 private function exists($name)
 {
     return $this->db_querier->row_exists(DB_TABLE_KEYWORDS, 'WHERE name=:name OR rewrited_name=:rewrited_name', array('name' => TextHelper::htmlspecialchars($name), 'rewrited_name' => TextHelper::htmlspecialchars(Url::encode_rewrite($name))));
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:KeywordsManager.class.php

示例9: export

 /**
  * @desc Exports a Sitemap. You will be able to use the following variables into the templates used to export:
  * <ul>
  * 	<li>C_SITE_MAP which is a condition indicating if it's a site map (useful if you want to use a sigle template
  * for the whole export configuration)</li>
  * 	<li>SITE_NAME which contains the name of the site</li>
  * 	<li>A loop "element" in which the code of each element is in the variable CODE</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template The exported code of the Sitemap
  */
 public function export(SitemapExportConfig $export_config)
 {
     //We get the stream in which we are going to write
     $template = $export_config->get_site_map_stream();
     $template->put_all(array('C_SITE_MAP' => true, 'SITE_NAME' => TextHelper::htmlspecialchars($this->site_name, ENT_QUOTES)));
     //Let's export all the element it contains
     foreach ($this->elements as $element) {
         $template->assign_block_vars('element', array(), array('ELEMENT' => $element->export($export_config)));
     }
     return $template;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:22,代码来源:Sitemap.class.php

示例10: export

 /**
  * @desc Exports the section according to the given configuration. You will use the following template variables:
  * <ul>
  * 	<li>LOC containing the URL of the link</li>
  * 	<li>TEXT containing the name of the target page</li>
  * 	<li>C_DISPLAY_DATE indicating if the date is not empty</li>
  * 	<li>DATE containing the date of the last modification of the target page, formatted for the sitemap.xml file</li>
  * 	<li>ACTUALIZATION_FREQUENCY corresponding to the code needed in the sitemap.xml file</li>
  * 	<li>PRIORITY corresponding to the code needed in the sitemap.xml file to indicate the priority of the target page.</li>
  * 	<li>C_LINK indicating that we are displaying a link (useful if you want to use a signe template export configuration)</li>
  * </ul>
  * @param SitemapExportConfig $export_config Export configuration
  * @return Template the exported link
  */
 public function export(SitemapExportConfig $export_config)
 {
     $display_date = $this->last_modification_date !== null;
     //We get the stream in which we are going to write
     $template = $export_config->get_link_stream();
     $template->put_all(array('LOC' => $this->get_url(), 'TEXT' => TextHelper::htmlspecialchars($this->name, ENT_QUOTES), 'C_DISPLAY_DATE' => $display_date, 'DATE' => $display_date ? $this->last_modification_date->to_date() : '', 'ACTUALIZATION_FREQUENCY' => $this->change_freq, 'PRIORITY' => $this->priority, 'C_LINK' => true));
     return $template;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:22,代码来源:SitemapLink.class.php

示例11: get_properties

 public function get_properties()
 {
     return array('id' => $this->get_id(), 'name' => TextHelper::htmlspecialchars($this->get_name()), 'rewrited_name' => TextHelper::htmlspecialchars($this->get_rewrited_name()), 'c_order' => $this->get_order(), 'special_authorizations' => (int) $this->has_special_authorizations(), 'auth' => !$this->auth_is_empty() ? serialize($this->get_authorizations()) : '', 'id_parent' => $this->get_id_parent());
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:4,代码来源:Category.class.php

示例12: prepare_controller

 private function prepare_controller()
 {
     $title = LangLoader::get_message('error', 'status-messages-common');
     if ($this->exception !== null && Debug::is_debug_mode_enabled()) {
         $message = TextHelper::htmlspecialchars($this->exception->getMessage()) . '<br /><br /><i>' . $this->exception->getFile() . ':' . $this->exception->getLine() . '</i><div class="spacer"></div>' . Debug::get_stacktrace_as_string(0, $this->exception);
         $title .= ' ' . $this->exception->getCode();
     } else {
         $message = TextHelper::htmlspecialchars(LangLoader::get_message('process.error', 'status-messages-common'));
     }
     $controller = new UserErrorController($title, $message, UserErrorController::FATAL);
     return $controller;
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:12,代码来源:ExceptionHandler.class.php

示例13: wiki_display_menu

function wiki_display_menu($menu_list)
{
    if (count($menu_list) == 0) {
        return '';
    }
    $menu = '';
    $last_level = 0;
    foreach ($menu_list as $title) {
        $current_level = $title[0];
        $title_name = stripslashes($title[1]);
        $title_link = '<a href="#paragraph_' . Url::encode_rewrite($title_name) . '">' . TextHelper::htmlspecialchars($title_name) . '</a>';
        if ($current_level > $last_level) {
            $menu .= '<ol class="wiki_list_' . $current_level . '"><li>' . $title_link;
        } elseif ($current_level == $last_level) {
            $menu .= '</li><li>' . $title_link;
        } else {
            if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
                $menu = substr($menu, 0, strlen($menu) - 4);
            }
            $menu .= str_repeat('</li></ol>', $last_level - $current_level) . '</li><li>' . $title_link;
        }
        $last_level = $title[0];
    }
    //End
    if (substr($menu, strlen($menu) - 4, 4) == '<li>') {
        $menu = substr($menu, 0, strlen($menu) - 4);
    }
    $menu .= str_repeat('</li></ol>', $last_level);
    return $menu;
}
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:30,代码来源:wiki_functions.php

示例14: export

 /**
  * @desc Exports the feed as a string parsed by the <$tpl> template
  * @param mixed $template If false, uses de default tpl. If an associative array,
  * uses the default tpl but assigns it the array vars first.
  * It could also be a Template object
  * @param int $number the number of item to display
  * @param int $begin_at the first item to display
  * @return string The exported feed
  */
 public function export($template = false, $number = 10, $begin_at = 0)
 {
     if ($template === false) {
         // A specific template is used
         $tpl = clone $this->tpl;
     } else {
         $tpl = clone $template;
     }
     if (!empty($this->data)) {
         $desc = TextHelper::htmlspecialchars($this->data->get_desc());
         $tpl->put_all(array('DATE' => $this->data->get_date(), 'DATE_RFC822' => $this->data->get_date_rfc2822(), 'DATE_RFC3339' => $this->data->get_date_iso8601(), 'DATE_TEXT' => $this->data->get_date_text(), 'THIS_YEAR' => date('Y'), 'TITLE' => $this->data->get_title(), 'U_LINK' => $this->data->get_link(), 'HOST' => $this->data->get_host(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'LANG' => $this->data->get_lang()));
         $items = $this->data->subitems($number, $begin_at);
         foreach ($items as $item) {
             $desc = TextHelper::htmlspecialchars($item->get_desc());
             $enclosure = $item->get_enclosure();
             $tpl->assign_block_vars('item', array('TITLE' => $item->get_title(), 'U_LINK' => $item->get_link(), 'U_GUID' => $item->get_guid(), 'DESC' => ContentSecondParser::export_html_text($desc), 'RAW_DESC' => $desc, 'DATE' => $item->get_date(), 'DATE_RFC822' => $item->get_date_rfc2822(), 'DATE_RFC3339' => $item->get_date_iso8601(), 'DATE_TEXT' => $item->get_date_text(), 'C_IMG' => $item->get_image_url() != '' ? true : false, 'U_IMG' => $item->get_image_url(), 'C_ENCLOSURE' => $enclosure !== null, 'ENCLOSURE_LENGHT' => $enclosure !== null ? $enclosure->get_lenght() : '', 'ENCLOSURE_TYPE' => $enclosure !== null ? $enclosure->get_type() : '', 'ENCLOSURE_URL' => $enclosure !== null ? $enclosure->get_url() : ''));
         }
     }
     return $tpl->render();
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:29,代码来源:Feed.class.php

示例15: add_comment

 public static function add_comment($id_topic, $message, $user_id, $pseudo, $user_ip)
 {
     $columns = array('id_topic' => $id_topic, 'user_id' => $user_id, 'pseudo' => TextHelper::htmlspecialchars($pseudo), 'user_ip' => TextHelper::htmlspecialchars($user_ip), 'timestamp' => time(), 'message' => $message);
     $result = self::$db_querier->insert(DB_TABLE_COMMENTS, $columns);
     return $result->get_last_inserted_id();
 }
开发者ID:AroundPBT,项目名称:PHPBoost,代码行数:6,代码来源:CommentsDAO.class.php


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