han_parse_bbcode.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 460 行 · 第 1/2 页
PHP
460 行
//----------------------------------------- // RTE expects <br /> not \n //----------------------------------------- $t = str_replace( "\n", "<br />", str_replace( "\r\n", "\n", $t ) ); //----------------------------------------- // Okay, convert ready for DB //----------------------------------------- $t = $this->pre_db_parse( $t ); $t = $this->bbclass->clean_ipb_html( $t ); return $t; } /*-------------------------------------------------------------------------*/ // Passthrough function: Clean up IPB HTML /*-------------------------------------------------------------------------*/ function convert_ipb_html_to_html( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); return $this->bbclass->clean_ipb_html( $t ); } /*-------------------------------------------------------------------------*/ // Passthrough function: Strip all tags /*-------------------------------------------------------------------------*/ function strip_all_tags( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); return $this->bbclass->strip_all_tags( $t ); } /*-------------------------------------------------------------------------*/ // Passthrough function: Badwords /*-------------------------------------------------------------------------*/ function bad_words( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); $this->bbclass->bypass_badwords = $this->bypass_badwords ? $this->bypass_badwords : intval($this->ipsclass->member['g_bypass_badwords']); return $this->bbclass->bad_words( $t ); } /*-------------------------------------------------------------------------*/ // Passthrough function: Parse poll tags /*-------------------------------------------------------------------------*/ function parse_poll_tags( $txt ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); //----------------------------------------- // [url]http://www.index.com[/url] // [url=http://www.index.com]ibforums![/url] //----------------------------------------- $txt = preg_replace( "#\[url\](\S+?)\[/url\]#ie" , "\$this->bbclass->regex_build_url(array('html' => '\\1', 'show' => '\\1'))", $txt ); $txt = preg_replace( "#\[url\s*=\s*\"\;\s*(\S+?)\s*\"\;\s*\](.*?)\[\/url\]#ie" , "\$this->bbclass->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt ); $txt = preg_replace( "#\[url\s*=\s*(\S+?)\s*\](.*?)\[\/url\]#ie" , "\$this->bbclass->regex_build_url(array('html' => '\\1', 'show' => '\\2'))", $txt ); if ( $this->ipsclass->vars['allow_images'] ) { $txt = preg_replace( "#\[img\](.+?)\[/img\]#ie", "\$this->bbclass->regex_check_image('\\1')", $txt ); } return $txt; } /*-------------------------------------------------------------------------*/ // Passthrough function: make_quote_safe /*-------------------------------------------------------------------------*/ function make_quote_safe( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); return $this->bbclass->_make_quote_safe( $t ); } /*-------------------------------------------------------------------------*/ // Passthrough function: Strip Quotes /*-------------------------------------------------------------------------*/ function strip_quotes( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); return $this->bbclass->strip_quotes( $t ); } /*-------------------------------------------------------------------------*/ // CHECK (AND LOAD) CACHES // This function loads all the data we'll need. /*-------------------------------------------------------------------------*/ function check_caches() { //----------------------------------------- // Check emoticons //----------------------------------------- if ( ! is_array( $this->ipsclass->cache['emoticons'] ) ) { $this->ipsclass->cache['emoticons'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'typed,image,clickable,emo_set', 'from' => 'emoticons' ) ); $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row() ) { $this->ipsclass->cache['emoticons'][] = $r; } if ( $this->allow_update_caches ) { $this->ipsclass->update_cache( array( 'name' => 'emoticons', 'array' => 1, 'deletefirst' => 1 ) ); } } //----------------------------------------- // Check BBCode //----------------------------------------- if ( ! is_array( $this->ipsclass->cache['bbcode'] ) ) { $this->ipsclass->cache['bbcode'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'bbcode_id, bbcode_tag, bbcode_replace, bbcode_useoption', 'from' => 'custom_bbcode' ) ); $bbcode = $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row($bbcode) ) { $this->ipsclass->cache['bbcode'][] = $r; } if ( $this->allow_update_caches ) { $this->ipsclass->update_cache( array( 'name' => 'bbcode', 'array' => 1, 'deletefirst' => 1 ) ); } } //----------------------------------------- // Check badwords //----------------------------------------- if ( ! is_array( $this->ipsclass->cache['badwords'] ) ) { $this->ipsclass->cache['badwords'] = array(); $this->ipsclass->DB->simple_construct( array( 'select' => 'type,swop,m_exact', 'from' => 'badwords' ) ); $bbcode = $this->ipsclass->DB->simple_exec(); while ( $r = $this->ipsclass->DB->fetch_row($bbcode) ) { $this->ipsclass->cache['badwords'][] = $r; } if ( $this->allow_update_caches ) { $this->ipsclass->update_cache( array( 'name' => 'badwords', 'array' => 1, 'deletefirst' => 1 ) ); } } } /*-------------------------------------------------------------------------*/ // Load classes /*-------------------------------------------------------------------------*/ function _load_classes() { if ( ! $this->classes_loaded ) { require_once( ROOT_PATH . 'sources/classes/bbcode/class_bbcode_core.php' ); switch( $this->pre_db_parse_method ) { case 'legacy': $class = 'class_bbcode_legacy.php'; break; default: $class = 'class_bbcode.php'; break; } require_once ( ROOT_PATH . 'sources/classes/bbcode/' . $class ); $this->bbclass = new class_bbcode(); $this->bbclass->ipsclass =& $this->ipsclass; $this->classes_loaded = 1; $this->error =& $this->bbclass->error; } } }?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?