本文整理汇总了PHP中strip_htmltag函数的典型用法代码示例。如果您正苦于以下问题:PHP strip_htmltag函数的具体用法?PHP strip_htmltag怎么用?PHP strip_htmltag使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strip_htmltag函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: plugin_uname_inline
function plugin_uname_inline()
{
$qt = get_qt();
//---- キャッシュのための処理を登録 -----
if ($qt->create_cache) {
$args = func_get_args();
return $qt->get_dynamic_plugin_mark(__FUNCTION__, $args);
}
//------------------------------------
global $vars;
$name = isset($vars['uname']) ? $vars['uname'] : '';
//unameパラメータがセットされていない場合
if ($name == '') {
return 'あなた';
} else {
$name = htmlspecialchars(mb_convert_encoding($name, SOURCE_ENCODING, 'UTF8,EUC-JP,Shift_JIS'));
}
$args = func_get_args();
$num = count($args);
$ntitle = "さん";
if ($num > 1) {
strip_htmltag(array_pop($args), FALSE);
$tmpstr = strip_htmltag(array_pop($args), FALSE);
if ($tmpstr == "none") {
$ntitle = '';
} else {
$ntitle = $tmpstr;
}
}
return $name . $ntitle;
}
示例2: plugin__set_inline
/**
* I18N - 各言語毎のメッセージを一時的に設定するプラグイン
*
* @copyright Copyright © 2005, Katsumi Saito <katsumi@jo1upk.ymt.prug.or.jp>
* @version $Id: _set.inc.php,v 0.1 2005/05/07 23:38:00 upk Exp $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
function plugin__set_inline()
{
global $i18n_temp_msg;
$argc = func_num_args();
$argv = func_get_args();
list($key, $lang, $msg) = i18n_set_param($argc, $argv);
$i18n_temp_msg[$key][$lang] = strip_htmltag($msg);
return '';
}
示例3: plugin_img3_inline
function plugin_img3_inline()
{
global $script;
global $_img3_msg;
static $img_no = 0;
// パラメータ
@(list($src, $title, $ratio, $align) = func_get_args());
if (is_null($src) || empty($src)) {
return '';
}
if (is_null($title) || empty($title)) {
$title = 'image';
}
if (is_null($ratio) || empty($ratio)) {
$ratio = 1;
}
if (is_null($align) || empty($align)) {
$align = '';
}
// ファイルの存在チェック
// $url = rawurldecode($src);
$url_arry = parse_url($src);
if (empty($url_arry['scheme'])) {
if (!file_exists($src)) {
return $_img3_msg['not_found'];
}
} else {
if (!USE_IMAGE_URI) {
return $_img3_msg['not_permitted'];
}
}
$src = htmlspecialchars($src);
$title = strip_htmltag($title);
$title = htmlspecialchars($title);
$ratio = htmlspecialchars($ratio);
$align = htmlspecialchars($align);
$size = img3_set_image_size($src, $ratio);
// width, height の取得
if ($size[4] == 0) {
return $_img3_msg['not_support'];
}
if (!empty($align)) {
$img_no++;
return <<<EOD
<style type="text/css">
img.img3{$img_no} { vertical-align: {$align}; }
</style>
<img src="{$src}" alt="{$title}" title="{$title}" {$size[6]} class="img3{$img_no}" />
EOD;
}
return <<<EOD
<img src="{$src}" alt="{$title}" title="{$title}" {$size[6]} />
EOD;
}
示例4: plugin_ruby_inline
function plugin_ruby_inline()
{
if (func_num_args() != 2) {
return PLUGIN_RUBY_USAGE;
}
list($ruby, $body) = func_get_args();
// strip_htmltag() is just for avoiding AutoLink insertion
$body = strip_htmltag($body);
if ($ruby == '' || $body == '') {
return PLUGIN_RUBY_USAGE;
}
return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' . '<rt>' . htmlsc($ruby) . '</rt>' . '<rp>)</rp>' . '</ruby>';
}
示例5: plugin_aname_inline
function plugin_aname_inline()
{
$convert = FALSE;
if (func_num_args() < 2) {
return plugin_aname_usage($convert);
}
$args = func_get_args();
// ONE or more
$body = strip_htmltag(array_pop($args), FALSE);
// Strip anchor tags only
array_push($args, $body);
return plugin_aname_tag($args, $convert);
}
示例6: plugin_ruby_inline
function plugin_ruby_inline()
{
$qm = get_qm();
if (func_num_args() != 2) {
return $qm->m['plg_ruby']['err_usage'];
}
list($ruby, $body) = func_get_args();
// strip_htmltag() is just for avoiding AutoLink insertion
$body = strip_htmltag($body);
if ($ruby == '' || $body == '') {
return $qm->m['plg_ruby']['err_usage'];
}
return '<ruby><rb>' . $body . '</rb>' . '<rp>(</rp>' . '<rt>' . h($ruby) . '</rt>' . '<rp>)</rp>' . '</ruby>';
}
示例7: plugin__get_inline
/**
* @copyright Copyright © 2006, Katsumi Saito <katsumi@jo1upk.ymt.prug.or.jp>
* @version $Id: _get.inc.php,v 0.2 2006/04/30 16:56:00 upk Exp $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
function plugin__get_inline()
{
switch (func_num_args()) {
case 2:
list($msg) = func_get_args();
return strip_htmltag($msg);
case 3:
list($name, $msg) = func_get_args();
return i18n_gettext($name, $msg);
case 4:
list($name, $lang, $msg) = func_get_args();
return i18n_setlocale($name, $lang, $msg);
}
return '';
}
示例8: plugin_get_title_inline
/**
* Get TITLE: line or the first headline of a page
*
* Usage:
* - &get_title(page,[option])
* Option
* - firsthead Get the first headline instead of title
*
* @package plugin
* @license http://www.gnu.org/licenses/gpl.html GPL v2
* @author sonots
* @link http://lsx.sourceforge.jp/?Plugin%2Fget_title.inc.php
* @version $Id: get_title.inc.php,v 2.0 2008-07-30 16:28:39Z sonots $
*/
function plugin_get_title_inline()
{
$args = func_get_args();
array_pop($args);
$page = array_shift($args);
$conf_options = array('firsthead' => false);
$options = sonots::parse_options($args, $conf_options);
if ($options['firsthead']) {
$str = PluginSonotsMetapage::firsthead($page);
} else {
$str = PluginSonotsMetapage::title($page);
}
if (is_null($str)) {
$str = $page;
}
$str = strip_htmltag(make_link($str));
return $str;
}
示例9: plugin___inline
/**
* Plug-in that achieves gettext in PukiWiki page
* PukiWiki ページ内で gettext を実現するプラグイン
*
* @copyright Copyright © 2005-2006, Katsumi Saito <katsumi@jo1upk.ymt.prug.or.jp>
* @version $Id: _.inc.php,v 0.10 2006/02/04 23:42:00 upk Exp $
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
* o :config/i18n/text/ja/text or :config/i18n/text/ja_JP is acceptable.
* o There are zh_TW etc. ,
* too and the form of language_country can be selected though the language name is appropriate in principle.
* o 原則的には、言語名が適切であるものの、zh_TW などもあり 言語_国 の形式も選択可能。
*
* o &_(ja){掲示板};
* 一度、英語の文字列を得て、表示言語に変換する。
* o &_{BBS};
* 英語表記であることを信じ、表示言語に変換する。
*
* 全てにおいて、未定義語の場合は、指定文字列をそのまま戻す。
* All, a specified character string is returned as it is for an undefined word.
*
*/
function plugin___inline()
{
global $language_considering_setting_level;
global $language;
global $i18n_temp_msg;
switch (func_num_args()) {
case 1:
list($msg) = func_get_args();
// $parm_lang = DEFAULT_LANG;
$parm_lang = 'en_US';
break;
default:
list($parm_lang, $msg) = func_get_args();
}
$msg = strip_htmltag($msg);
// FIXME: level 5
$view_lang = $language_considering_setting_level == 0 ? get_language(5) : $language;
$view_lang_split = accept_language::split_locale_str($view_lang);
// ja_JP なら ja に分割
if ($parm_lang == $view_lang || $parm_lang == $view_lang_split[1]) {
return $msg;
}
// 指定言語と同じ
// 指定文字列が en 以外の場合は、ベース言語に変換後、他言語に変換する
$parm_lang_split = accept_language::split_locale_str($parm_lang);
if (isset($i18n_temp_msg)) {
$temp_msg = i18n_TempMsg($parm_lang_split, $view_lang_split, $msg);
if (!empty($temp_msg)) {
return $temp_msg;
}
}
if ($parm_lang_split[1] !== 'en') {
$msg = i18n_ConfMsgGet($parm_lang_split, $msg, 1);
}
// :config から、単語を検索
return i18n_ConfMsgGet($view_lang_split, $msg);
}
示例10: make_heading
function make_heading(&$str, $strip = TRUE)
{
global $NotePattern;
// Cut fixed-heading anchors
$id = '';
$matches = array();
if (preg_match('/^(\\*{0,3})(.*?)\\[#([A-Za-z][\\w-]+)\\](.*?)$/m', $str, $matches)) {
$str = $matches[2] . $matches[4];
$id =& $matches[3];
} else {
$str = preg_replace('/^\\*{0,3}/', '', $str);
}
// Cut footnotes and tags
if ($strip === TRUE) {
$str = strip_htmltag(make_link(preg_replace($NotePattern, '', $str)));
}
return $id;
}
示例11: plugin_edit_inline
function plugin_edit_inline()
{
static $usage = '&edit(pagename#anchor[[,noicon],nolabel])[{label}];';
global $script, $vars, $fixed_heading_anchor_edit;
if (PKWK_READONLY) {
return '';
}
// Show nothing
// Arguments
$args = func_get_args();
// {label}. Strip anchor tags only
$s_label = strip_htmltag(array_pop($args), FALSE);
$page = array_shift($args);
if ($page == NULL) {
$page = '';
}
$_noicon = $_nolabel = FALSE;
foreach ($args as $arg) {
switch (strtolower($arg)) {
case '':
break;
case 'nolabel':
$_nolabel = TRUE;
break;
case 'noicon':
$_noicon = TRUE;
break;
default:
return $usage;
}
}
// Separate a page-name and a fixed anchor
list($s_page, $id, $editable) = anchor_explode($page, TRUE);
// Default: This one
if ($s_page == '') {
$s_page = isset($vars['page']) ? $vars['page'] : '';
}
// $s_page fixed
$isfreeze = is_freeze($s_page);
$ispage = is_page($s_page);
// Paragraph edit enabled or not
$short = htmlspecialchars('Edit');
if ($fixed_heading_anchor_edit && $editable && $ispage && !$isfreeze) {
// Paragraph editing
$id = rawurlencode($id);
$title = htmlspecialchars(sprintf('Edit %s', $page));
$icon = '<img src="' . IMAGE_DIR . 'paraedit.png' . '" width="9" height="9" alt="' . $short . '" title="' . $title . '" /> ';
$class = ' class="anchor_super"';
} else {
// Normal editing / unfreeze
$id = '';
if ($isfreeze) {
$title = 'Unfreeze %s';
$icon = 'unfreeze.png';
} else {
$title = 'Edit %s';
$icon = 'edit.png';
}
$title = htmlspecialchars(sprintf($title, $s_page));
$icon = '<img src="' . IMAGE_DIR . $icon . '" width="20" height="20" alt="' . $short . '" title="' . $title . '" />';
$class = '';
}
if ($_noicon) {
$icon = '';
}
// No more icon
if ($_nolabel) {
if (!$_noicon) {
$s_label = '';
// No label with an icon
} else {
$s_label = $short;
// Short label without an icon
}
} else {
if ($s_label == '') {
$s_label = $title;
}
// Rich label with an icon
}
// URL
if ($isfreeze) {
$url = $script . '?cmd=unfreeze&page=' . rawurlencode($s_page);
} else {
$s_id = $id == '' ? '' : '&id=' . $id;
$url = $script . '?cmd=edit&page=' . rawurlencode($s_page) . $s_id;
}
$atag = '<a' . $class . ' href="' . $url . '" title="' . $title . '">';
static $atags = '</a>';
if ($ispage) {
// Normal edit link
return $atag . $icon . $s_label . $atags;
} else {
// Dangling edit link
return '<span class="noexists">' . $atag . $icon . $atags . $s_label . $atag . '?' . $atags . '</span>';
}
}
示例12: plugin_tb_output_rsslist
function plugin_tb_output_rsslist($tb_id)
{
global $script, $vars, $entity_pattern;
$page = tb_id2page($tb_id);
if ($page === false) {
return false;
}
$items = '';
foreach (tb_get(tb_get_filename($page)) as $arr) {
// _utime_, title, excerpt, _blog_name_
array_shift($arr);
// Cut utime
list($url, $title, $excerpt) = array_map(create_function('$a', 'return htmlspecialchars($a);'), $arr);
$items .= <<<EOD
<item>
<title>{$title}</title>
<link>{$url}</link>
<description>{$excerpt}</description>
</item>
EOD;
}
$title = htmlspecialchars($page);
$link = $script . '?' . rawurlencode($page);
$vars['page'] = $page;
$excerpt = strip_htmltag(convert_html(get_source($page)));
$excerpt = preg_replace("/&{$entity_pattern};/", '', $excerpt);
$excerpt = mb_strimwidth(preg_replace("/[\r\n]/", ' ', $excerpt), 0, 255, '...');
$lang = PLUGIN_TB_LANGUAGE;
$rc = <<<EOD
<?xml version="1.0" encoding="utf-8" ?>
<response>
<error>0</error>
<rss version="0.91">
<channel>
<title>{$title}</title>
<link>{$link}</link>
<description>{$excerpt}</description>
<language>{$lang}</language>{$items}
</channel>
</rss>
</response>
EOD;
pkwk_common_headers();
header('Content-Type: text/xml');
echo mb_convert_encoding($rc, 'UTF-8', SOURCE_ENCODING);
exit;
}
示例13: tb_send
function tb_send($page, $plus, $minus = '')
{
global $page_title;
$script = get_script_uri();
// Disable 'max execution time' (php.ini: max_execution_time)
if (ini_get('safe_mode') == '0') {
set_time_limit(0);
}
// Get URLs from <a>(anchor) tag from convert_html()
$links = array();
$plus = convert_html($plus);
// WARNING: heavy and may cause side-effect
preg_match_all('#href="(https?://[^"]+)"#', $plus, $links, PREG_PATTERN_ORDER);
$links = array_unique($links[1]);
// Reject from minus list
if ($minus != '') {
$links_m = array();
$minus = convert_html($minus);
// WARNING: heavy and may cause side-effect
preg_match_all('#href="(https?://[^"]+)"#', $minus, $links_m, PREG_PATTERN_ORDER);
$links_m = array_unique($links_m[1]);
$links = array_diff($links, $links_m);
}
// Reject own URL (Pattern _NOT_ started with '$script' and '?')
$links = preg_grep('/^(?!' . preg_quote($script, '/') . '\\?)./', $links);
// No link, END
if (!is_array($links) || empty($links)) {
return;
}
$r_page = rawurlencode($page);
$excerpt = strip_htmltag(convert_html(get_source($page)));
// Sender's information
$putdata = array('title' => $page, 'url' => $script . '?' . $r_page, 'excerpt' => mb_strimwidth(preg_replace("/[\r\n]/", ' ', $excerpt), 0, 255, '...'), 'blog_name' => $page_title . ' (' . PLUGIN_TRACKBACK_VERSION . ')', 'charset' => SOURCE_ENCODING);
foreach ($links as $link) {
$tb_id = tb_get_url($link);
// Get Trackback ID from the URL
if (empty($tb_id)) {
continue;
}
// Trackback is not supported
$result = http_request($tb_id, 'POST', '', $putdata, 2, CONTENT_CHARSET);
// FIXME: Create warning notification space at pukiwiki.skin!
}
}
示例14: plugin_rss_action
//.........这里部分代码省略.........
if ($qblog_mode) {
$page = trim($line);
$time = strtotime(get_qblog_date('Y-m-d 00:00:00', $page));
} else {
list($time, $page) = explode("\t", rtrim($line));
}
//blogモードで、$blog_name/Hogehogeでないなら(つまり、ブログページでないなら、何もしない
if ($blog_mode && !preg_match('/^' . $blog_mode . '\\/.*/', $page)) {
continue;
}
$r_page = rawurlencode($page);
$title = get_page_title($page);
$source = get_source($page);
foreach ($source as $k => $l) {
if (preg_match($ignore_plugin, $l)) {
// リストから省く
$skip_list = TRUE;
break;
}
if (preg_match($strip_plugin, $l)) {
// 説明から省く
unset($source[$k]);
}
}
if ($skip_list) {
continue;
}
//html(noskinを避ける)
if (count($source) > 0) {
$source = str_replace('#html(noskin)', '#html()', $source);
$source = preg_replace($strip_plugin_inline, '', $source);
// 行内のプラグインを説明から省く
}
$contents = mb_strimwidth(strip_htmltag(convert_html($source)), 0, RSS_DESP_LENGTH, '...');
$contents = preg_replace_callback('/(&[^;]+;)/', 'plugin_rss_html_entity_decode', $contents);
$contents = plugin_rss_utf8_for_xml($contents);
switch ($version) {
case '0.91':
/* FALLTHROUGH */
/* FALLTHROUGH */
case '2.0':
$date = get_date('D, d M Y H:i:s T', $time);
$date = $version == '0.91' ? ' <description>' . $date . ' -- ' . $contents . '</description>' : ' <pubDate>' . $date . '</pubDate>' . ' <description>' . $contents . '</description>';
$items .= <<<EOD
<item>
<title>{$title}</title>
<link>{$self}?{$r_page}</link>
{$date}
</item>
EOD;
break;
case '1.0':
// Add <item> into <items>
$rdf_li .= ' <rdf:li rdf:resource="' . $self . '?' . $r_page . '" />' . "\n";
$date = substr_replace(get_date('Y-m-d\\TH:i:sO', $time), ':', -2, 0);
$trackback_ping = '';
if ($trackback) {
$tb_id = md5($r_page);
$trackback_ping = ' <trackback:ping>' . $self . '?tb_id=' . $tb_id . '</trackback:ping>';
}
$items .= <<<EOD
<item rdf:about="{$self}?{$r_page}">
<title>{$title}</title>
<link>{$self}?{$r_page}</link>
<description><![CDATA[{$contents}]]></description>
示例15: plugin_weblog_rss_action
function plugin_weblog_rss_action()
{
global $rss_max, $page_title, $WikiName, $BracketName, $script, $whatsnew, $trackback, $use_static_url, $anon_writable;
global $vars;
global $options, $_weblog_msgs;
//コンフィグの読み込み(指定weblog固有)
$conf_name = $vars['config'];
$options = weblog_get_options($conf_name, $options);
$page = strip_bracket($options['PREFIX']);
$with_content = $vars['content'];
$list_count = $vars['count'];
if ($list_count == 0) {
$list_count = $rss_max;
}
$lines = get_existpages(false, $page, $list_count, " ORDER BY editedtime DESC", true);
header("Content-type: application/xml");
if (is_page($page)) {
$linkpage = $page;
} else {
if (strrchr($page, "/")) {
$_p = substr($page, 0, -strlen(strrchr($page, "/")));
if (is_page($_p)) {
$linkpage = $_p;
}
} else {
$linkpage = $whatsnew;
}
}
if ($use_static_url) {
$linkpage_url = XOOPS_WIKI_URL . "/" . get_pgid_by_name($linkpage) . ".html";
} else {
$linkpage_url = $script . "?" . rawurlencode($linkpage);
}
$page_title_utf8 = $page_title;
if (function_exists("mb_convert_encoding")) {
$page_title_utf8 = mb_convert_encoding($page_title_utf8, "UTF-8", "auto");
// $page_utf8 = mb_convert_encoding($linkpage,"UTF-8","auto");
$page_utf8 = mb_convert_encoding($options['NAME'], "UTF-8", "auto");
$page_add_utf8 = $linkpage ? "-" . $page_utf8 : "";
}
$item = "";
$rdf_li = "";
foreach ($lines as $line) {
$vars['page'] = $line;
$page_name = strip_bracket($line);
if (!preg_match("/^(.*\\/)?[0-9\\-]+\$/", $page_name)) {
continue;
}
$src = @join("", get_source($page_name));
$sources = $src;
if (preg_match("/\\&weblog_field\\(__SUBJECT\\)\\{([^}]+)\\}\\;/m", $sources, $match)) {
$subject = $match[1];
}
if (preg_match("/\\&weblog_field\\(__AUTHOR\\)\\{([^}]+)\\}\\;/m", $sources, $match)) {
$author = $match[1];
}
if (preg_match("/\\&weblog_field\\(__CATEGORY,:([^\\)]+)\\)\\{([^}]+)\\}\\;((\\[ )?\\[\\[.*\\]\\]( \\])?)+/m", $sources, $match)) {
$catpath = $match[1];
$category = $match[2];
}
if (preg_match("/#weblog_field\\(__BODY\\,Start\\)\\s*\n(.*\n)#weblog_field\\(__BODY\\,End\\)\n/ms", $sources, $match)) {
$body = $match[1];
$body = preg_replace("/\\s*((\r\n)|(\r)|(\n))/", "\n", $body);
}
$title = mb_convert_encoding($subject, "UTF-8", "auto");
$url = strip_bracket($line);
// if ($page) $title = preg_replace("/^".preg_quote($page_utf8,"/")."\//","",$title);
$title = htmlspecialchars($title);
$desc = date("D, d M Y H:i:s T", filemtime(get_filename(encode($line))));
$dcdate = substr_replace(date("Y-m-d\\TH:i:sO", filemtime(get_filename(encode($line)))), ':', -2, 0);
if ($use_static_url) {
$link_url = XOOPS_WIKI_URL . "/" . get_pgid_by_name($line) . ".html";
} else {
$link_url = $script . "?" . rawurlencode($url);
}
$items .= "<item rdf:about=\"" . $link_url . "\">\n";
$items .= " <title>{$title}</title>\n";
$items .= " <link>" . $link_url . "</link>\n";
$items .= " <dc:date>{$dcdate}</dc:date>\n";
$_anon_writable = $anon_writable;
$anon_writable = 0;
$desc = convert_html($body, false, false);
$desc = mb_convert_encoding(mb_substr(strip_htmltag($desc), 0, 250, "EUC-JP"), "UTF-8", "auto");
$desc = htmlspecialchars($desc);
$desc = mb_ereg_replace("\n", "", $desc);
$items .= " <description>{$desc}</description>\n";
if ($with_content == "true") {
$src = preg_replace("/\\&weblog_field\\(__EDIT\\,[^\\)]+\\);/m", "", $src);
$content = convert_html($src, false, false);
$content = mb_convert_encoding($content, "UTF-8", "auto");
$content = preg_replace("/\\<input [^\\>]+\\/>(\n)?/ms", "", $content);
$content = preg_replace("/^(\\s*\n)+/mS", "\n", $content);
$content = preg_replace("/\\s*\\<br \\/\\>\\s*/mS", "<br />", $content);
$content = preg_replace("/class\\=\"p\\_right\"/", 'style="text-align:right;"', $content);
$items .= "<content:encoded>\n<![CDATA[\n";
$items .= "{$content}\n";
$items .= "]]>\n</content:encoded>\n";
}
$anon_writable = $anon_writable = 0;
//trackback
//.........这里部分代码省略.........