<?php
// --------------------
// Entry Format Parsing
// --------------------
function blog_to_html( $str, $comment_mode=false, $strip_all_tags=false, $add_no_follow = true ) {
global $site;
$str = stripslashes($str);
// Convert Simple Blog tags to HTML.
//
// Search and replace simple tags. These tags don't have any
// special attributes so we can do a str_replace() on them.
//
// ( Could use str_ireplace() but it's only supported in PHP 5. )
$tag_arr = array('i', 'b', 'blockquote', 'strong', 'em', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'del', 'ins', 'strike', 'pre', 'code' );
// Build search and replace arrays.
$search_arr = array();
$replace_arr = array();
for ( $i = 0; $i < count( $tag_arr ); $i++ ) {
$tag = $tag_arr[$i];
array_push( $search_arr, '[' . strtolower( $tag ) . ']', '[' . strtoupper( $tag ) . ']' );
if ( $strip_all_tags ) {
array_push( $replace_arr, '', '' );
} else {
array_push( $replace_arr, '<' . strtolower( $tag ) . '>', '<' . strtoupper( $tag ) . '>' );
}
array_push( $search_arr, '[/' . strtolower( $tag ) . ']', '[/' . strtoupper( $tag ) . ']' );
if ( $strip_all_tags ) {
array_push( $replace_arr, '', '' );
} else {
array_push( $replace_arr, '</' . strtolower( $tag ) . '>', '</' . strtoupper( $tag ) . '>' );
}
}
// Do str_replace() replacement.
$str = str_replace( $search_arr, $replace_arr, $str);
/*//oneoo
$handle=opendir('smiles/');
while ($file = readdir($handle)) {
if(substr($file,-4)=='.gif' || substr($file,-4)=='.jpg' || substr($file,-4)=='.png'){
$fs = substr($file,0,strlen($file)-4);
$str = str_replace( '['.$fs.']', ' <img src="smiles/'.$file.'" align=absMiddle> ', $str);
// echo "<A href=\"javascript:paste_smiles('[".substr($file,0,strlen($file)-4)."]','text')\"><IMG class=ib title=rolleyes alt=rolleyes src=\"smiles/".$file."\" align=absMiddle></A>\n";
}
}
closedir($handle);
// Do str_replace() replacement.
$str = str_replace( $search_arr, $replace_arr, $str);
*/
// Replace [url] Tags:
// The [url] tag has an optional "new" attribute. The "new"
// attribute determines whether to open the link in the
// same window or a new window.
// new - (true/false)
//
// [url=http://xxx]xxx[/url]
// [url=http://xxx new=true]xxx[/url]
if ( $strip_all_tags ) {
$str = replace_url_tag( $str, '[url=', ']', '[/url]', true, $add_no_follow );
$str = replace_url_tag( $str, '[URL=', ']', '[/URL]', true, $add_no_follow );
} else {
$str = replace_url_tag( $str, '[url=', ']', '[/url]', false, $add_no_follow );
$str = replace_url_tag( $str, '[URL=', ']', '[/URL]', false, $add_no_follow );
}
// Replace [img] Tags:
// The [img] tag has an number of optional attributes -
// width - width of image in pixels
// height - height of image in pixels
// popup - (true/false)
// float - (left/right)
//
// [img=http://xxx]
// [img=http://xxx width=xxx height=xxx popup=true float=left]
$str = replaceImgTag($str);
// Selectively replace line breaks and/or decode html entities.
if ( $comment_mode ) {
{
$str = replace_html_tag( $str, true );
}
} else {
if ( $strip_all_tags ) {
$str = replace_html_tag( $str, true );
} else {
$str = replace_html_tag( $str, false );
}
}
// Emoticons
$smile_arr = array();
array_push( $smile_arr, array( ':)', 'smile_regular.gif') );
array_push( $smile_arr, array( ':-)', 'smile_regular.gif') );
array_push( $smile_arr, array( ':(', 'smile_sad.gif') );
array_push( $smile_arr, array( ':-(', 'smile_sad.gif') );
// array_push( $smile_arr, array( ':o', 'smile_omg.gif') );
array_push( $smile_arr, array( ':-o', 'smile_omg.gif') );
array_push( $smile_arr, array( ':O', 'smile_omg.gif') );
array_push( $smile_arr, array( ':-O', 'smile_omg.gif') );
array_push( $smile_arr, array( ':p', 'smile_tongue.gif') );
array_push( $smile_arr, array( ':-p', 'smile_tongue.gif') );
array_push( $smile_arr, array( ':P', 'smile_tongue.gif') );
array_push( $smile_arr, array( ':-P', 'smile_tongue.gif') );
array_push( $smile_arr, array( ':D', 'smile_teeth.gif') );
array_push( $smile_arr, array( ':-D', 'smile_teeth.gif') );
array_push( $smile_arr, array( '(ci)', 'smoking.gif') );
array_push( $smile_arr, array( '(ci)', 'smoking.gif') );
array_push( $smile_arr, array( '(ci)', 'smoking.gif') );
array_push( $smile_arr, array( ':-@', 'smile_angry.gif') );
array_push( $smile_arr, array( ':@', 'smile_angry.gif') );
array_push( $smile_arr, array( ':-S', 'smile_confused.gif') );
array_push( $smile_arr, array( ':S', 'smile_confused.gif') );
array_push( $smile_arr, array( '8-)', 'smile_shades.gif') );
for ( $i = 0; $i < count( $smile_arr ); $i++ ) {
$str = str_replace( $smile_arr[$i][0], '<img src="'.$site['link'].'/images/smiles/'.$smile_arr[$i][1].'" alt="'.$smile_arr[$i][0].'" align="absMiddle">', $str );
}
return autolink(replace_poll_tag(replace_song_tag( $str )));
}
function replace_html_tag( $str, $strip_tags ) {
// Replacements for HTML tags. Sub-function of blog_to_html.
//
// This function decodes HTML entities that are located between
// HTML tags. Also, inserts <br />'s for new lines only if blocks
// are outside the HTML tags.
global $lang_string;
$str_out = NULL;
$tag_begin = '[html]';
$tag_end = '[/html]';
// Search for the openning HTML tag. Tag could be either upper or
// lower case so we want to find the nearest one.
//
// Get initial $str_offset value.
$temp_lower = strpos( $str, strtolower( $tag_begin ) );
$temp_upper = strpos( $str, strtoupper( $tag_begin ) );
if ( $temp_lower === false ) {
if ( $temp_upper === false ) {
$str_offset = false;
} else {
$str_offset = $temp_upper;
}
} else {
if ( $temp_upper === false ) {
$str_offset = $temp_lower;
} else {
$str_offset = min( $temp_upper, $temp_lower );
}
}
while ( $str_offset !== false ) {
// Store all the text BEFORE the openning HTML tag.
//
// Also, replace hard returns with '<br />' tags.
$temp_str = substr( $str, 0, $str_offset );
$temp_str = str_replace( chr(10), '<br />', $temp_str );
$str_out = $str_out . $temp_str;
// Store all text AFTER the tag
$str = substr( $str, $str_offset + strlen( $tag_begin ) );
// Search for the closing HTML tag. Find the nearest one.
$temp_lower = strpos( $str, strtolower( $tag_end ) );
$temp_upper = strpos( $str, strtoupper( $tag_end ) );
if ( $temp_lower === false ) {
if ( $temp_upper === false ) {
$str_offset = false;
} else {
$str_offset = $temp_upper;
}
} else {
if ( $temp_upper === false ) {
$str_offset = $temp_lower;
} else {
$str_offset = min( $temp_upper, $temp_lower );
}
}
if ( $str_offset !== false ) {
// Store all the text BETWEEN the HTML tags.
//
// Also, decode HTML entities between the tags.
$temp_str = substr( $str, 0, $str_offset );
if ( $strip_tags === false ) {
$temp_str = html_entity_decode( $temp_str, ENT_QUOTES, $lang_string[ 'php_charset' ] );
}
$str_out = $str_out . $temp_str;
// Store sub_string after the tag.
$str = substr( $str, $str_offset + strlen( $tag_end ) );
// Search for openning HTML tag again.
$temp_lower = strpos( $str, strtolower( $tag_begin ) );
$temp_upper = strpos( $str, strtoupper( $tag_begin ) );
if ( $temp_lower === false ) {
if ( $temp_upper === false ) {
$str_offset = false;
} else {
$str_offset = $temp_upper;
}
} else {
if ( $temp_upper === false ) {
$str_offset = $temp_lower;
} else {
$str_offset = min( $temp_upper, $temp_lower );
}
没有合适的资源?快使用搜索试试~ 我知道了~
[博客空间]yo2blog v0.9.1_yo2blog091.rar
![preview](https://csdnimg.cn/release/downloadcmsfe/public/img/white-bg.ca8570fa.png)
共37个文件
gif:20个
php:11个
png:3个
![preview-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/scale.ab9e0183.png)
0 下载量 175 浏览量
2024-04-03
10:10:00
上传
评论
收藏 50KB RAR 举报
温馨提示
【项目资源】:包含前端、后端、移动开发、操作系统、人工智能、物联网、信息化管理、数据库、硬件开发、大数据、课程资源、音视频、网站开发等各种技术项目的源码。包括STM32、ESP8266、PHP、QT、Linux、iOS、C++、Java、python、web、C#、EDA、proteus、RTOS等项目的源码。【项目质量】:所有源码都经过严格测试,可以直接运行。功能在确认正常工作后才上传。【适用人群】:适用于希望学习不同技术领域的小白或进阶学习者。可作为毕设项目、课程设计、大作业、工程实训或初期项目立项。【附加价值】:项目具有较高的学习借鉴价值,也可直接拿来修改复刻。对于有一定基础或热衷于研究的人来说,可以在这些基础代码上进行修改和扩展,实现其他功能。【沟通交流】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。鼓励下载和使用,并欢迎大家互相学习,共同进步。
资源推荐
资源详情
资源评论
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
![folder](https://csdnimg.cn/release/downloadcmsfe/public/img/folder.005fa2e5.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/PNG.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/GIF.png)
共 37 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/6ba19994c6c3461f8cf75ff80f635020_qq_34910341.jpg!1)
CyMylive.
- 粉丝: 7214
- 资源: 4万+
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)