Php public function list [regular]. Copy the code as follows :? Php *************************************** * ****************************** list of public functions * ubb, getip, GoIn, goback, IsInt, InString * OurHome: iwi
The code is as follows:
/*************************************** ******************************
* List of public functions
* Ubb, getip, GoIn, goback, IsInt, InString
* OurHome: http://iwind.org
* Http: // 10.13.31.90 /~ Coldwind
*
**/
/// // Ubb supports code functions /////////////////// /////////
Function ubb ($ Text ){
$ Text = trim ($ Text );
$ Text = htmlspecialchars ($ Text );
$ Text = ereg_replace ("\ n ","
", $ Text );
$ Text = preg_replace ("// \ t/is", "", $ Text );
$ Text = preg_replace ("/\ [h1 \] (. + ?) \ [\/H1 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [h2 \] (. + ?) \ [\/H2 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [h3 \] (. + ?) \ [\/H3 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [h4 \] (. + ?) \ [\/H4 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [h5 \] (. + ?) \ [\/H5 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [h6 \] (. + ?) \ [\/H6 \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [center \] (. + ?) \ [\/Center \]/is ","
\ 1 ", $ Text );
$ Text = preg_replace ("/\ [url \] (http: \/. + ?) \ [\/Url \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [url \] (. + ?) \ [\/Url \]/is "," http: // \ 1 ", $ Text );
$ Text = preg_replace ("/\ [url = (http: \/. + ?) \] (. *) \ [\/Url \]/is "," \ 2 ", $ Text );
$ Text = preg_replace ("/\ [url = (. + ?) \] (. *) \ [\/Url \]/is "," \ 2 ", $ Text );
$ Text = preg_replace ("/\ [img \] (. + ?) \ [\/Img \]/is "," ", $ Text );
$ Text = preg_replace ("/\ [color = (. + ?) \] (. + ?) \ [\/Color \]/is "," \ 2 ", $ Text );
$ Text = preg_replace ("/\ [size = (. + ?) \] (. + ?) \ [\/Size \]/is "," \ 2 ", $ Text );
$ Text = preg_replace ("/\ [sup \] (. + ?) \ [\/Sup \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [sub \] (. + ?) \ [\/Sub \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [pre \] (. + ?) \ [\/Pre \]/is ","
\\1
", $ Text );
$ Text = preg_replace ("/\ [email \] (. + ?) \ [\/Email \]/is "," \ 1 ", $ Text );
$ Text = preg_replace ("/\ [I \] (. + ?) \ [\/I \]/is ","
\ 1", $ Text );
$ Text = preg_replace ("/\ [B \] (. + ?) \ [\/B \]/is ","
\ 1", $ Text );
$ Text = preg_replace ("/\ [quote \] (. + ?) \ [\/Quote \]/is ","
Quote: \ 1
", $ Text );
$ Text = preg_replace ("/\ [code \] (. + ?) \ [\/Code \]/is ","
Code:
\ 1
", $ Text );
$ Text = preg_replace ("/\ [sig \] (. + ?) \ [\/Sig \]/is ","
--------------------------
\ 1
--------------------------
", $ Text );
Return $ Text;
}
//// // Obtain the IP address of the viewer //////////////////// /////////
Function getip (){
$ IP = getenv ('remote _ ADDR ');
$ IP _ = getenv ('http _ X_FORWARDED_FOR ');
If ($ IP _! = "") & ($ IP _! = "Unknown") $ IP = $ IP _;
Return $ IP;
}
Function goback ($ num, $ saying ){
Echo"
$ Saying "; } //// // Determine whether a string contains a value in array /////////// ////// Function InString ($ array, $ string ){ While (list (, $ value) = each ($ array )){ If (eregi ($ value, $ string )){ Return true; Exit; } } } /// // Link to a page //////////////// /////////////////////// Function GoIn ($ addr, $ saying ){ Echo"
"; } /// // JS return ////////////////// //////////////////////////// Function IsInt ($ string ){ If (ereg ("^ [0-9] {0, }$", $ string )){ Return true; } Else { Return false; } } ?>
The http://www.bkjia.com/PHPjc/317885.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/317885.htmlTechArticle code is as follows :? Php /************************************** * ******************************* list of public functions * ubb, getip, GoIn, goback, IsInt, InString * OurHome: http: // iwi... |