Ich bin absoluter Anfänger und habe nun ein großes Problem.
Ich habe nun zwar schon einiges gelesen, jedoch ist das allermeiste für mich absolut chinesisch.
Seit neuesten bekomme ich ddiesen fehler:
Warning: preg_replace_callback(): Requires argument 2, 'Array', to be a valid callback in /mnt/web215/e1/76/53639476/htdocs/cgi-data/ilch/include/includes/func/bbcode.php on line 236
Im Vorfeld habe ich "preg_replace" durch "Preg_replace_callback" im BBCode ersetzt.
Hier nun der Gesamte BBCODE:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | <?php # Copyright by Manuel # Support www.ilch.de defined ( 'main' ) or die ( 'no direct access' ); function BBcode( $s , $maxLength =40) { # $s = unescape( $s ); $coTime = str_replace ( ' ' , '' , microtime()); preg_match_all( '/\[code\](.+)\[\/code\]/Uis' , $s , $result ); $s = bbcode_code_start ( $s , $coTime , $result ); # bbcode einheitlicher machen zum bessern pruefen. $s = bbcode_simple_prev ( $s ); # $s = preg_replace_callback ( "/(\015\012|\015|\012)/" , " \\1" , $s ); # autoumbruch nach x zeichen # $s = bbcode_autonewline( $s , $coTime , $maxLength ); $s = htmlentities( $s ); # speziell bilder $s = bbcode_images ( $s ); # speziell zitate ersetzten. $s = bbcode_quote ( $s ); # replace simple $s = bbcode_simple ( $s ); # smilies umwandeln $s = bbcode_smiles ( $s ); $s = preg_replace_callback ( "/\015\012|\015|\012/" , "\n<br />" , $s ); # code zurueck ersetzten $s = bbcode_code_end ( $s , $coTime , $result ); return ( $s ); } # diese funktion ist etwas komplizierter. und zwar wird hier versucht # dem problem beizukommen das immer irgendwelche spassvoegel sehr lange # texte schreiben die dann das design verzerren. dagegen hilft nur der # automatische umbruch. ich habe mir dafuer ausgedacht es gibt # bestimmte zeichen ab dennen die kontrolle total aus ist (url, img) # und es gibt zeichen ab dennen die kontrolle wieder eingeschaltet wird # ausserdem gibt es zeichen ab dennen wieder von vorn angefangen wird # zu zahlen, wird der counter erreicht wird ein leerzeichen eingefueght. function bbcode_autonewline ( $s , $coTime , $maxLength ) { $neu_s = '' ; $ar_start = array ( '[img]' ); $ar_ende = array ( ']' , '[/img]' ); $ar_neu = array ( ' ' , ); $ar_next = array ( ' ' , "\n" , "\r" , '[/url]' , '[b]' , '[/b]' , '[i]' , '[/i]' , '[u]' , '[/u]' , $coTime , '[list]' , '[/list]' , '[*]' ); $count = TRUE; $countgr = null; $counter = -1; $a = strlen ( $s ); for ( $i =0; $i < $a ; $i ++) { # counter raus / rein if ( $count == TRUE) { foreach ( $ar_start as $sk => $sv ) { if ( $s { $i } == substr ( $sv , 0, 1) AND preg_match( "/^" .preg_quote( $sv , '/' ). "/" , substr ( $s , $i ))) { $count = FALSE; $countgr = $sk ; $counter = 0; # echo '<h1>ON</h1>' ; break ; } } } elseif ( $count == FALSE AND $s { $i } == substr ( $ar_ende [ $countgr ], 0, 1) AND preg_match( "/^" .preg_quote( $ar_ende [ $countgr ], '/' ). "/" , substr ( $s , $i ))) { # echo '<h1>||' . $s { $i } . '||<br>||' . substr ( $s , $i , 10). '||<br>' ; # echo 'OFF</h1>' ; $count = TRUE; $counter = -2; $countgr = null; } if ( $count == TRUE) { $counter ++; # ar neu? foreach ( $ar_neu as $v ) { if ( $count == TRUE AND $s { $i } == substr ( $v , 0, 1) AND preg_match ( "/^" .preg_quote( $v ). "/" , substr ( $s , $i ))) { $counter = -3; break ; } } # springen foreach ( $ar_next as $v ) { if ( $s { $i } == substr ( $v , 0, 1) AND preg_match( "/^" .preg_quote( $v , '/' ). "/" , substr ( $s , $i ))) { $i = $i + strlen ( $v ) - 1; $springen = true; $valSprin = $v ; break ; } } if (isset( $springen ) AND $springen === true) { $neu_s .= $valSprin ; $springen = false; $valSprin = null; continue ; } if ( $counter >= $maxLength ) { $neu_s .= ' ' ; $counter = 0; } } $neu_s .= $s { $i }; } /* $s = str_replace('</a>', ' </a>', $s); $lines = explode(' ',$s); $ntxt = ''; foreach ($lines as $v) { if ( strpos($v,$coTime) === FALSE AND strpos ($v, 'src="') === FALSE AND strpos ($v, 'href="') === FALSE AND strpos ($v, '</table>') === FALSE) { $ntxt .= chunk_split($v, $maxLength, ' ').' '; } else { $ntxt .= $v.' '; } } $s = $ntxt; $s = str_replace(' </a>', '</a>', $s); */ return ( $neu_s ); } function bbcode_images ( $s ) { global $allgAr ; preg_match_all( '/\[img\](http|https):\/\/([^\ \?&=\#\"\n\r\t<>]+)\.(gif|jpeg|jpg|png)\[\/img\]/Ui' , $s , $imgRs ); $max_breite = 0; if (isset( $allgAr [ 'allg_bbcode_max_img_width' ])) { $max_breite = $allgAr [ 'allg_bbcode_max_img_width' ]; } $endung = array (1 => 'gif' , 2 => 'jpg' , 3 => 'png' ); if ( isset ( $imgRs [0][0]) ) { for ( $i =0; $i < count ( $imgRs [0]); $i ++) { $imgstr = $imgRs [1][ $i ]. '://' . $imgRs [2][ $i ]. '.' . $imgRs [3][ $i ]; $size = @ getimagesize ( $imgstr ); $breite = $neueBreite = $size [0]; $hoehe = $neueHoehe = $size [1]; $er = '' ; if (isset( $endung [ $size [2]]) OR ! is_array ( $size )) { $er = '<img style="border: none;" src="' . $imgstr . '" />' ; if ( $breite > $max_breite ) { $neueHoehe = intval ( $hoehe * $max_breite / $breite ); $neueBreite = $max_breite ; $er = '<a href="' . $imgstr . '" target="_blank"><img height="' . $neueHoehe . '" width="' . $neueBreite . '" style="border: none;" src="' . $imgstr . '" /></a>' ; } } $s = str_replace ( $imgRs [0][ $i ], $er , $s ); } } return ( $s ); } function bbcode_quote ( $s ) { $tpl = new tpl ( 'zitatreplace.htm' ); $header1_quote = $tpl ->get(0); $header2_quote = $tpl ->get(1); $footer1_quote = $tpl ->get(2); unset( $tpl ); $i =0; while ( strpos ( $s , "[/quote]" )!==FALSE AND $i < 5 ) { $i ++; $s = preg_replace_callback ( "#\[quote\=([^\]]*)\](.*)\[\/quote\]#Uis" , $header1_quote . "geschrieben von \\1" . $header2_quote . "\\2" . $footer1_quote , $s ); $s = preg_replace_callback ( "/\[quote\](.*)\[\/quote\]/Usi" , $header1_quote . $header2_quote . "\\1" . $footer1_quote , $s ); } return ( $s ); } function bbcode_simple_prev ( $s ) { $search = array ( "/(^|[^=\]\>\"])http:\/\/(www\.)?([^\s\"\<\[]*)/i" , "/\[url\]http:\/\/(www\.)?(.*?)\[\/url\]/si" , ); $replace = array ( ); $s = preg_replace_callback ( $search , $replace , $s ); return ( $s ); } function bbcode_simple ( $s ) { $page = preg_quote(dirname( str_replace ( 'www.' , '' , $_SERVER [ "HTTP_HOST" ]). $_SERVER [ "SCRIPT_NAME" ]), '/' ); $search = array ( "/\[b\](.*?)\[\/b\]/si" , "/\[i\](.*?)\[\/i\]/si" , "/\[u\](.*?)\[\/u\]/si" , "/\[url=http:\/\/(www\.)?(" . $page . ")(.*?)](.*?)\[\/url\]/si" , "/\[url=http:\/\/(www\.)?(.*?)\](.*?)\[\/url\]/si" , "/\[list(=1)?\](.+)\[\/list\]/Usie" , "/(script|about|applet|activex|chrome):/is" , ); $replace = array ( "<b>\\1</b>" , "<i>\\1</i>" , "<u>\\1</u>" , "bbcode_simple_list ('\\1', '\\2')" , "\\1:" , ); $s = preg_replace_callback( $search , $replace , $s ); return ( $s ); } function bbcode_simple_list ( $w , $s ) { # $s = preg_replace_callback ("\015\012 $s = preg_replace_callback( "/\[\*\]([^\[]+)/ies" , "'<li>'.trim('\\1').'</li>'" , trim( $s )); if ( $w == '=1' ) { return ( '<ol>' .trim( $s ). '</ol>' ); } return ( '<ul>' .trim( $s ). '</ul>' ); } function bbcode_smiles ( $s ) { global $global_smiles_array ; if (!isset( $global_smiles_array )) { $global_smiles_array = array (); $erg = db_query( "SELECT ent, url, emo FROM `prefix_smilies`" ); while ( $row = db_fetch_object( $erg ) ) { $global_smiles_array [ $row ->ent] = $row ->emo. '#@#-_-_-#@#' . $row ->url; } } foreach ( $global_smiles_array as $k => $v ) { list( $emo , $url ) = explode ( '#@#-_-_-#@#' , $v ); $s = str_replace ( $k , '<img src="include/images/smiles/' . $url . '" border="0" alt="' . $emo . '" title="' . $emo . '" />' , $s ); } return ( $s ); } function bbcode_code_start ( $s , $coTime , $result ) { for ( $i =0; $i < count ( $result [1]); $i ++) { if ( $result [0][ $i ]) { $s = str_replace ( $result [0][ $i ], '#' . $coTime . '#' . $i . '#' . $coTime . '#' , $s ); } } return ( $s ); } function bbcode_code_end ( $s , $coTime , $result ) { $tpl = new tpl ( 'codereplace.htm' ); for ( $i =0; $i < count ( $result [1]); $i ++) { if ( $result [1][ $i ]) { ob_start(); # $result [1][ $i ] = str_replace ( '<' , '<' , str_replace ( '>' , '>' , $result [1][ $i ])); # $codereplace = highlight_string(trim( $result [1][ $i ]), 1); highlight_string(trim( $result [1][ $i ])); $codereplace = ob_get_contents(); ob_end_clean(); $newstring = $tpl ->set_get ( 'CODEREPLACE' , $codereplace , 0); $s = str_replace ( '#' . $coTime . '#' . $i . '#' . $coTime . '#' , $newstring , $s ); } } unset( $tpl ); return ( $s ); } ?> |
Wäre Weltklasse, wenn mir hier jemand weiterhlefen könnte.
Vielen Dank vorab
betroffene Homepage: externer Link[/url]
Zuletzt modifiziert von Nex4T am 05.03.2018 - 12:39:51