han_parse_bbcode.php
来自「sabreipb 2.1.6 utf-8中文版本!」· PHP 代码 · 共 460 行 · 第 1/2 页
PHP
460 行
<?php/*+--------------------------------------------------------------------------| Invision Power Board v2.1.5| =============================================| by Matthew Mecham| (c) 2001 - 2005 Invision Power Services, Inc.| | =============================================| Web: | Time: Wed, 01 Mar 2006 19:11:29 GMT| Release: | Licence Info: +---------------------------------------------------------------------------| > $Date: 2005-10-24 22:17:00 +0100 (Mon, 24 Oct 2005) $| > $Revision: 64 $| > $Author: bfarber $+---------------------------------------------------------------------------|| > Handler for BBCode parsing| > Module written by Matt Mecham| > Date started: Wednesday 9th March 2005 11:03+--------------------------------------------------------------------------*/class parse_bbcode{ # Global var $ipsclass; var $bbclass; # Already loaded classes? var $classes_loaded = 0; # Update caches if not present? var $allow_update_caches = 0; var $pre_db_parse_method = 'new'; # Permissions var $parse_smilies = 0; var $parse_html = 0; var $parse_bbcode = 1; var $strip_quotes = 1; var $parse_n12br = 1; var $bypass_badwords = 0; # Error var $error; /*-------------------------------------------------------------------------*/ // Constructor /*-------------------------------------------------------------------------*/ function parse_bbcode() { //----------------------------------------- // Anything to init? //----------------------------------------- } /*-------------------------------------------------------------------------*/ // This function is called before inserting the post text into the DB // Depending on which method we're using, it will either check for errors // or parse the code into legacy (IPB 2.0<) format. /*-------------------------------------------------------------------------*/ function pre_db_parse( $text ) { //----------------------------------------- // INIT //----------------------------------------- $class = ""; //----------------------------------------- // Check the DB cache //----------------------------------------- $this->check_caches(); //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); //----------------------------------------- // Decide the settings... //----------------------------------------- $this->bbclass->bypass_badwords = $this->bypass_badwords ? $this->bypass_badwords : intval($this->ipsclass->member['g_bypass_badwords']); $this->bbclass->parse_smilies = $this->parse_smilies; $this->bbclass->parse_html = $this->parse_html; $this->bbclass->parse_bbcode = $this->parse_bbcode; $this->bbclass->strip_quotes = $this->ipsclass->vars['strip_quotes']; $this->bbclass->parse_n12br = $this->parse_n12br; $this->bbclass->parse_wordwrap = $this->ipsclass->vars['post_wordwrap']; $this->bbclass->max_embed_quotes = $this->ipsclass->vars['max_quotes_per_post']; //----------------------------------------- // Parse //----------------------------------------- return $this->bbclass->pre_db_parse( $text ); } /*-------------------------------------------------------------------------*/ // This function is called before showing the post for edit /*-------------------------------------------------------------------------*/ function pre_edit_parse( $text ) { //----------------------------------------- // INIT //----------------------------------------- $class = ""; //----------------------------------------- // Check the DB cache //----------------------------------------- $this->check_caches(); //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); //----------------------------------------- // Decide the settings... //----------------------------------------- $this->bbclass->bypass_badwords = $this->bypass_badwords ? $this->bypass_badwords : intval($this->ipsclass->member['g_bypass_badwords']); $this->bbclass->parse_smilies = $this->parse_smilies; $this->bbclass->parse_html = $this->parse_html; $this->bbclass->parse_bbcode = $this->parse_bbcode; $this->bbclass->strip_quotes = $this->ipsclass->vars['strip_quotes']; $this->bbclass->parse_n12br = $this->parse_n12br; $this->bbclass->parse_wordwrap = $this->ipsclass->vars['post_wordwrap']; $this->bbclass->max_embed_quotes = $this->ipsclass->vars['max_quotes_per_post']; //----------------------------------------- // Parse //----------------------------------------- return $this->bbclass->pre_edit_parse( $text ); } /*-------------------------------------------------------------------------*/ // This function is called before displaying the final post in the user's browser /*-------------------------------------------------------------------------*/ function pre_display_parse( $text ) { //----------------------------------------- // INIT //----------------------------------------- $class = ""; //----------------------------------------- // Check the DB cache // { Dont need this, for this } //----------------------------------------- ///$this->check_caches(); //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); //----------------------------------------- // Decide the settings... //----------------------------------------- $this->bbclass->bypass_badwords = $this->bypass_badwords ? $this->bypass_badwords : intval($this->ipsclass->member['g_bypass_badwords']); $this->bbclass->parse_smilies = $this->parse_smilies; $this->bbclass->parse_html = $this->parse_html; $this->bbclass->parse_bbcode = $this->parse_bbcode; $this->bbclass->strip_quotes = $this->ipsclass->vars['strip_quotes']; $this->bbclass->parse_nl2br = $this->parse_nl2br; $this->bbclass->parse_wordwrap = $this->ipsclass->vars['post_wordwrap']; $this->bbclass->max_embed_quotes = $this->ipsclass->vars['max_quotes_per_post']; //----------------------------------------- // Parse //----------------------------------------- return $this->bbclass->pre_display_parse( $text ); } /*-------------------------------------------------------------------------*/ // Function: convert_std_to_rte /*-------------------------------------------------------------------------*/ /** * Convert STD contents TO RTE compatible * * Used when switching between editors or * when using the fast reply and hitting "More..." * * @param string STD text * @return string RTE text */ function convert_std_to_rte( $t ) { //----------------------------------------- // Get the correct class //----------------------------------------- $this->_load_classes(); //----------------------------------------- // Ensure no slashy slashy //----------------------------------------- $t = str_replace( '"','"', $t ); $t = str_replace( "'",''', $t ); //----------------------------------------- // Convert <> //----------------------------------------- $t = str_replace( '<', '<', $t ); $t = str_replace( '>', '>', $t );
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?