Hallo,
ich würde mir auf ilch.de eine Spoiler Funktion wünschen um ellenlangen code auszublenden.
Eure Meinung?
Hier kann eine Notiz zum Merk-Eintrag hinzugefügt werden (optional)
Geschlossen |
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 | //> Code Dropdown! if($boolButton['fnFormatCode'] == 1 || $boolButton['fnFormatPhp'] == 1 || $boolButton['fnFormatHtml'] == 1 || $boolButton['fnFormatCss'] == 1) { $BBCodeButtons .= "<select onChange=\"javascript:bbcode_code_insert_codes(this.value); javascript:this.value='0';\" style=\"font-family:Verdana;font-size:10px; margin-bottom:6px; z-index:0;\" name=\"code\"><option value=\"0\">Code einfügen</option>"; } if($boolButton['fnFormatPhp'] == 1) { $BBCodeButtons .= "<option value=\"php\">PHP</option>"; } if($boolButton['fnFormatHtml'] == 1) { $BBCodeButtons .= "<option value=\"html\">HTML</option>"; } if($boolButton['fnFormatCss'] == 1) { $BBCodeButtons .= "<option value=\"css\">CSS</option>"; } if($boolButton['fnFormatCode'] == 1) { $BBCodeButtons .= "<option value=\"code\">Sonstiger Code</option>"; } if($boolButton['fnFormatCode'] == 1 || $boolButton['fnFormatPhp'] == 1 || $boolButton['fnFormatHtml'] == 1 || $boolButton['fnFormatCss'] == 1) { $BBCodeButtons .= "</select>"; } return $BBCodeButtons; } |
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 | <?php # Copyright by Manuel Staechele # Support www.ilch.de defined ( 'main' ) or die ( 'no direct access' ); //Klasse laden require_once ( 'include/includes/class/bbcode.php' ); require_once ( 'include/includes/bbcode_config.php' ); $ILCH_HEADER_ADDITIONS .= "<script type=\"text/javascript\" src=\"include/includes/js/BBCodeGlobal.js\"></script>\n<script type=\"text/javascript\">\nvar bbcodemaximagewidth = {$info['ImgMaxBreite']};\nvar bbcodemaximageheight = {$info['ImgMaxHoehe']};\n</script>" ; //Farbliste erstellen function colorliste ( $ar ) { $l = '' ; foreach ( $ar as $k => $v ) { $l .= '<td width="10" style="background-color: ' . $k . ';"><a href="javascript:bbcode_code_insert(\'color\',\'' . $k . '\'); hide_color();"><img src="include/images/icons/bbcode/transparent.gif" border="0" height="10" width="10" alt="' . $v . '" title="' . $v . '"></td>' ; } return ( $l ); } function getBBCodeButtons(){ //> Buttons Informationen. $ButtonSql = db_query( "SELECT * FROM prefix_bbcode_buttons WHERE fnButtonNr='1'" ); $boolButton = db_fetch_assoc( $ButtonSql ); $cfgBBCsql = db_query( "SELECT * FROM prefix_bbcode_config WHERE fnConfigNr='1'" ); $cfgInfo = db_fetch_assoc( $cfgBBCsql ); $BBCodeButtons = '<script type="text/javascript" src="include/includes/js/interface.js"></script>' ; //> Fett Button! if ( $boolButton [ 'fnFormatB' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('b','Gib hier den Text an der fett formatiert werden soll.')\"><img src=\"include/images/icons/bbcode/bbcode_bold.png\" alt=\"Fett formatieren\" title=\"Fett formatieren\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Kursiv Button! if ( $boolButton [ 'fnFormatI' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('i','Gib hier den Text an der kursiv formatiert werden soll.')\"><img src=\"include/images/icons/bbcode/bbcode_italic.png\" alt=\"Kursiv formatieren\" title=\"Kursiv formatieren\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Unterschrieben Button! if ( $boolButton [ 'fnFormatU' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('u','Gib hier den Text an der unterstrichen formatiert werden soll.')\"><img src=\"include/images/icons/bbcode/bbcode_underline.png\" alt=\"Unterstrichen formatieren\" title=\"Unterstrichen formatieren\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Durchgestrichener Button! if ( $boolButton [ 'fnFormatS' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('s','Gib hier den Text an der durchgestrichen formatiert werden soll..')\"><img src=\"include/images/icons/bbcode/bbcode_strike.png\" alt=\"Durchgestrichen formatieren\" title=\"Durchgestrichen formatieren\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Leerzeichen? if ( $boolButton [ 'fnFormatB' ] == 1 || $boolButton [ 'fnFormatI' ] == 1 || $boolButton [ 'fnFormatU' ] == 1 || $boolButton [ 'fnFormatS' ] == 1) { $BBCodeButtons .= " " ; } //> Links Button! if ( $boolButton [ 'fnFormatLeft' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_code_insert('left','0')\"><img src=\"include/images/icons/bbcode/bbcode_left.png\" alt=\"Links ausrichten\" title=\"Links ausrichten\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Zentriert Button! if ( $boolButton [ 'fnFormatCenter' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_code_insert('center','0')\"><img src=\"include/images/icons/bbcode/bbcode_center.png\" alt=\"Mittig ausrichten\" title=\"Mittig ausrichten\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Rechts Button! if ( $boolButton [ 'fnFormatRight' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_code_insert('right','0')\"><img src=\"include/images/icons/bbcode/bbcode_right.png\" alt=\"Rechts ausrichten\" title=\"Rechts ausrichten\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Leerzeichen? if ( $boolButton [ 'fnFormatLeft' ] == 1 || $boolButton [ 'fnFormatCenter' ] == 1 || $boolButton [ 'fnFormatRight' ] == 1) { $BBCodeButtons .= " " ; } //> Listen Button! if ( $boolButton [ 'fnFormatList' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('list','Gib hier den Text ein der aufgelistet werden soll.\\nUm die liste zu beenden einfach auf Abbrechen klicken.')\"><img src=\"include/images/icons/bbcode/bbcode_list.png\" alt=\"Liste erzeugen\" title=\"Liste erzeugen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Hervorheben Button! if ( $boolButton [ 'fnFormatEmph' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_code_insert('emph','0')\"><img src=\"include/images/icons/bbcode/bbcode_emph.png\" alt=\"Text hervorheben\" title=\"Text hervorheben\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Schriftfarbeauswahlcontainer if ( $boolButton [ 'fnFormatColor' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:hide_color();\"><img id=\"bbcode_color_button\" src=\"include/images/icons/bbcode/bbcode_color.png\" alt=\"Text färben\" title=\"Text färben\" width=\"23\" height=\"22\" border=\"0\"></a> " ; $colorar = array ( '#FF0000' => 'red' , '#FFFF00' => 'yellow' , '#008000' => 'green' , '#00FF00' => 'lime' , '#008080' => 'teal' , '#808000' => 'olive' , '#0000FF' => 'blue' , '#00FFFF' => 'aqua' , '#000080' => 'navy' , '#800080' => 'purple' , '#FF00FF' => 'fuchsia' , '#800000' => 'maroon' , '#C0C0C0' => 'grey' , '#808080' => 'silver' , '#000000' => 'black' , '#FFFFFF' => 'white' ,); $BBCodeButtons .= '<div style= "position:absolute;" ><div style= "display:none; position:relative; top:-30px; left:100px; width:200px; z-index:100;" id= "colorinput" > <table width= "100%" class = "border" border= "0" cellspacing= "1" cellpadding= "0" > <tr class = "Chead" onclick= "javascript:hide_color();" ><td colspan= "16" ><b>Farbe wählen</b></td></tr> <tr class = "Cmite" height= "15" > '.colorliste($colorar).' </tr></table> </div></div>'; } //> Schriftgröße Button! if ( $boolButton [ 'fnFormatSize' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value('size','Gib hier den Text an, der in einer anderen Schriftgröße formatiert werden soll.','Gib hier die Größe des textes in Pixel an. \\n Pixellimit liegt bei " . $cfgInfo ['fnSizeMax ']."px !!!' )\"><img src=\" include /images/icons/bbcode/bbcode_size.png\" alt=\"Textgröße verändern\" title=\"Textgröße verändern\" width=\"23\" height=\"22\" border=\"0\"></a> "; } //> Leerzeichen? if ( $boolButton [ 'fnFormatList' ] == 1 || $boolButton [ 'fnFormatEmph' ] == 1 || $boolButton [ 'fnFormatColor' ] == 1 || $boolButton [ 'fnFormatSize' ] == 1) { $BBCodeButtons .= " " ; } //> Url Button! if ( $boolButton [ 'fnFormatUrl' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value('url','Gib hier die Beschreibung für den Link an.','Gib hier die Adresse zu welcher verlinkt werden soll an.')\"><img src=\"include/images/icons/bbcode/bbcode_url.png\" alt=\"Hyperlink einfügen\" title=\"Hyperlink einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> E-Mail Button! if ( $boolButton [ 'fnFormatEmail' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value('mail','Gib hier den namen des links an.','Gib hier die eMail - Adresse an.')\"><img src=\"include/images/icons/bbcode/bbcode_email.png\" alt=\"eMail hinzufügen\" title=\"eMail hinzufügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Leerzeichen? if ( $boolButton [ 'fnFormatUrl' ] == 1 || $boolButton [ 'fnFormatEmail' ] == 1) { $BBCodeButtons .= " " ; } //> Bild Button! if ( $boolButton [ 'fnFormatImg' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('img','Gib hier die Adresse des Bildes an.\\nHinweise: Die Breite und Höhe des Bildes ist auf " . $cfgInfo ['fnImgMaxBreite ']."x".$cfgInfo[' fnImgMaxHoehe ']." eingeschränkt und würde verkleinert dargstellt werden.\\nEs ist möglich ein Bild rechts oder links von anderen Elementen darzustellen, indem man [img=left] oder [img=right] benutzt.' )\"><img src=\" include /images/icons/bbcode/bbcode_image.png\" alt=\"Bild einfügen\" title=\"Bild einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> "; } //> Screenshot Button! if ( $boolButton [ 'fnFormatScreen' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert('shot','Gib hier die Adresse des Screens an.\\nDie Breite und Höhe des Bildes ist auf " . $cfgInfo ['fnScreenMaxBreite ']."x".$cfgInfo[' fnScreenMaxHoehe ']." eingeschränkt und wird verkleinert dargstellt.\\nEs ist möglich ein Screenshot rechts oder links von anderen Elementen darzustellen, indem man [shot=left] oder [shot=right] benutzt.' )\"><img src=\" include /images/icons/bbcode/bbcode_screenshot.png\" alt=\"Bild einfügen\" title=\"Screen einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> "; } //> Leerzeichen? if ( $boolButton [ 'fnFormatImg' ] == 1 || $boolButton [ 'fnFormatScreen' ] == 1) { $BBCodeButtons .= " " ; } //> Quote Button! if ( $boolButton [ 'fnFormatQuote' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_code_insert('quote','0')\"><img src=\"include/images/icons/bbcode/bbcode_quote.png\" alt=\"Zitat einfügen\" title=\"Zitat einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Klapptext Button! if ( $boolButton [ 'fnFormatKtext' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value('ktext','Gib hier den zu verbergenden Text ein.','Gib hier einen Titel für den Klapptext an.')\"><img src=\"include/images/icons/bbcode/bbcode_ktext.png\" alt=\"Klappfunktion hinzufügen\" title=\"Klappfunktion hinzufügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Video Button! if ( $boolButton [ 'fnFormatVideo' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value_2('video','Gib hier die Video ID vom Anbieter an.','Bitte Anbieter auswählen.\\nAkzeptiert werden: Google, YouTube, MyVideo und GameTrailers')\"><img src=\"include/images/icons/bbcode/bbcode_video.png\" alt=\"Video einfügen\" title=\"Video einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Flash Button! if ( $boolButton [ 'fnFormatFlash' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_multiple_values('flash',{tag:['Gib hier den Link zur Flashdatei an',''],width:['Gib hier die Breite für die Flashdatei an','400'],height:['Gib hier die Höhe für die Flashdatei an','300']})\"><img src=\"include/images/icons/bbcode/bbcode_flash.png\" alt=\"Flash einfügen\" title=\"Flash einfügen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Countdown Button! if ( $boolButton [ 'fnFormatCountdown' ] == 1) { $BBCodeButtons .= "<a href=\"javascript:bbcode_insert_with_value('countdown','Gib hier das Datum an wann das Ereignis beginnt.\\n Format: TT.MM.JJJJ Bsp: 24.12." . date ( "Y" ). "','Gib hier eine Zeit an, wann das Ergeinis am Ereignis- Tag beginnt.\\nFormat: Std:Min:Sek Bsp: 20:15:00')\"><img src=\"include/images/icons/bbcode/bbcode_countdown.png\" alt=\"Countdown festlegen\" title=\"Countdown festlegen\" width=\"23\" height=\"22\" border=\"0\"></a> " ; } //> Leerzeichen? if ( $boolButton [ 'fnFormatQuote' ] == 1|| $boolButton [ 'fnFormatKtext' ] == 1 || $boolButton [ 'fnFormatVideo' ] == 1 || $boolButton [ 'fnFormatFlash' ] == 1 || $boolButton [ 'fnFormatCountdown' ] == 1) { $BBCodeButtons .= " " ; } //> Code Dropdown! if ( $boolButton [ 'fnFormatCode' ] == 1 || $boolButton [ 'fnFormatPhp' ] == 1 || $boolButton [ 'fnFormatHtml' ] == 1 || $boolButton [ 'fnFormatCss' ] == 1) { $BBCodeButtons .= "<select onChange=\"javascript:bbcode_code_insert_codes(this.value); javascript:this.value='0';\" style=\"font-family:Verdana;font-size:10px; margin-bottom:6px; z-index:0;\" name=\"code\"><option value=\"0\">Code einfügen</option>" ; } if ( $boolButton [ 'fnFormatPhp' ] == 1) { $BBCodeButtons .= "<option value=\"php\">PHP</option>" ; } if ( $boolButton [ 'fnFormatHtml' ] == 1) { $BBCodeButtons .= "<option value=\"html\">HTML</option>" ; } if ( $boolButton [ 'fnFormatCss' ] == 1) { $BBCodeButtons .= "<option value=\"css\">CSS</option>" ; } if ( $boolButton [ 'fnFormatCode' ] == 1) { $BBCodeButtons .= "<option value=\"code\">Sonstiger Code</option>" ; } if ( $boolButton [ 'fnFormatCode' ] == 1 || $boolButton [ 'fnFormatPhp' ] == 1 || $boolButton [ 'fnFormatHtml' ] == 1 || $boolButton [ 'fnFormatCss' ] == 1) { $BBCodeButtons .= "</select>" ; } return $BBCodeButtons ; } function BBcode( $s , $maxLength =0, $maxImgWidth =0, $maxImgHeight =0) { global $permitted , $info , $global_smiles_array ; //> Smilies in array abspeichern. if (!isset( $global_smiles_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; } } $bbcode = new bbcode(); $bbcode ->smileys = $global_smiles_array ; $bbcode ->permitted = $permitted ; $bbcode ->info = $info ; if ( $maxLength != 0) { $bbcode ->info[ 'fnWortMaxLaenge' ] = $maxLength ; } if ( $maxImgWidth != 0) { $bbcode ->info[ 'fnImgMaxBreite' ] = $maxImgWidth ; } if ( $maxImgHeight != 0) { $bbcode ->info[ 'fnImgMaxBreite' ] = $maxImgHeight ; } return $bbcode ->parse( $s ); } ?> |
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 | function _addcodecontainer( $code , $type , $file =null, $firstline =1) { //> Datei pfad mit angegeben? $file = ( $file == NULL) ? "" : " von Datei <em>" . $this ->_shortwords( $file ). "</em>" ; //> Zeilen zählen. $linescount = substr_count( $code , "\n" ) + $firstline + 1; if ( $type == 'Php' ) { $linescount = substr_count( $code , "\r" ) + $firstline + 1; } $line = '' ; for ( $no = $firstline ; $no < $linescount ; $no ++) { $line .= $no . ":<br />" ; } //> Hier könnt ihr den Header und Footer für HTML editieren. $breite = trim( $this ->info[ 'BlockTabelleBreite' ]); $breite = ( strpos ( $breite , '%' ) !== false) ? '450px' : $breite . 'px' ; $header = "<div style=\"overflow: auto; width: {$breite};\">" . "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"BORDER: 1px SOLID " . $this ->info[ 'BlockRandFarbe' ]. ";\" width=\"100%\">" . "<tr><td colspan=\"3\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bold; color:" . $this ->info[ 'BlockSchriftfarbe' ]. ";background-color:" . $this ->info[ 'BlockHintergrundfarbe' ]. ";\"> " . $type . $file . "</td></tr>" . "<tr bgcolor=\"" . $this ->info[ 'BlockHintergrundfarbeIT' ]. "\"><td style=\"width:20px; color:" . $this ->info[ 'BlockSchriftfarbe' ]. ";padding-left:2px;padding-right:2px;border-right:1px solid " . $this ->info[ 'BlockHintergrundfarbe' ]. ";font-family:Arial, Helvetica, sans-serif;\" align=\"right\" valign=\"top\"><code style=\"width:20px;\">" . $line . "</code></td><td width=\"5\"> </td><td valign=\"top\" style=\"background-color:" . $this ->info[ 'BlockHintergrundfarbe' ]. "; color:" . $this ->info[ 'BlockSchriftfarbe' ]. ";\" nowrap width=\"95%\"><code>" ; $footer = "</code></td></tr></table></div>" ; return $header . $code . $footer ; } |
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 | function _addcodecontainer( $code , $type , $file =null, $firstline =1) { //> Datei pfad mit angegeben? $file = ( $file == NULL) ? "" : " von Datei <em>" . $this ->_shortwords( $file ). "</em>" ; //> Zeilen zählen. $linescount = substr_count( $code , "\n" ) + $firstline + 1; if ( $type == 'Php' ) { $linescount = substr_count( $code , "\r" ) + $firstline + 1; } $line = '' ; for ( $no = $firstline ; $no < $linescount ; $no ++) { $line .= $no . ":<br />" ; } //> Hier könnt ihr den Header und Footer für HTML editieren. $breite = trim( $this ->info[ 'BlockTabelleBreite' ]); $breite = ( strpos ( $breite , '%' ) !== false) ? '450px' : $breite . 'px' ; // $header = "<div style=\"overflow: auto; width: {$breite};\">" // ."<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"BORDER: 1px SOLID ".$this->info['BlockRandFarbe'].";\" width=\"100%\">" // ."<tr><td colspan=\"3\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bold; color:".$this->info['BlockSchriftfarbe'].";background-color:".$this->info['BlockHintergrundfarbe'].";\"> ".$type.$file."</td></tr>" // ."<tr bgcolor=\"".$this->info['BlockHintergrundfarbeIT']."\"><td style=\"width:20px; color:".$this->info['BlockSchriftfarbe'].";padding-left:2px;padding-right:2px;border-right:1px solid ".$this->info['BlockHintergrundfarbe'].";font-family:Arial, Helvetica, sans-serif;\" align=\"right\" valign=\"top\"><code style=\"width:20px;\">" // .$line // ."</code></td><td width=\"5\"> </td><td valign=\"top\" style=\"background-color:".$this->info['BlockHintergrundfarbe']."; color:".$this->info['BlockSchriftfarbe'].";\" nowrap width=\"95%\"><code>"; // $footer = "</code></td></tr></table></div>"; $header = "<div style=\"overflow: auto; width: {$breite};\">" . "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" style=\"BORDER: 1px SOLID " . $this ->info[ 'BlockRandFarbe' ]. ";\" width=\"100%\">" . "<tr><td colspan=\"3\" style=\"font-family:Arial, Helvetica, sans-serif;font-size:12px; font-weight:bold; color:" . $this ->info[ 'BlockSchriftfarbe' ]. ";background-color:" . $this ->info[ 'BlockHintergrundfarbe' ]. ";\">" . "<pre class=\"brush: php;\">" ; $footer = "</pre></td></tr></table></div>" ; return $header . $code . $footer ; } |
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 | 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' ); $count = count ( $result [3]); for ( $i = 0; $i < $count ; $i ++) { if ( $result [3][ $i ]) { $code = rtrim( $result [3][ $i ]); //Parameter $paramstr = trim( $result [1][ $i ]); $opts = array ( 'start' => 1, 'type' => '' ); if ( strlen ( $paramstr )) { preg_match_all( '/(\w+)=\'([^\']+)\'/i' , $paramstr , $params ); debug( $params ); foreach ( $params [1] as $key => $value ) { $opts [ $value ] = $params [2][ $key ]; } } $opts [ 'start' ] = intval ( $opts [ 'start' ]); /* Syntaxhighliger / Javascript */ $addopts = '' ; if (substr_count( $code , "\n" ) > 20) { $addopts .= 'collapse: true;' ; } if (isset( $opts [ 'title' ])) { $addopts .= 'title: \'' . $opts [ 'title' ] . '\';' ; } if (isset( $opts [ 'highlight' ])) { $lines = explode ( ';' , trim( $opts [ 'highlight' ])); $linesAr = array (); foreach ( $lines as $line ) { $tmp = explode ( '-' , trim( $line )); array_map ( 'intval' , $tmp ); if ( $tmp [0] > 0) { if ( count ( $tmp ) == 1) { $linesAr [] = $tmp [0]; } elseif ( $tmp [0] <= $tmp [1]) { for ( $j = $tmp [0]; $j <= $tmp [1]; $j ++) $linesAr [] = $j ; } } } $addopts .= 'highlight: [' . implode( ',' , $linesAr ) . '];' ; } //Check Parameter switch ( $opts [ 'type' ]) { case 'php' : case 'css' : case 'js' : case 'text' : case 'diff' : case 'sql' : break ; case 'html' : case 'htm' : $opts [ 'type' ] = 'xml' ; break ; default : if (preg_match( '%<\?php.*\?>%s' , $code ) > 0) { $opts [ 'type' ] = 'php' ; break ; } elseif (preg_match( '%<html>.*</html>%s' , $code ) > 0) { $opts [ 'type' ] = 'xml' ; break ; } $opts [ 'type' ] = 'text' ; } if ( $opts [ 'start' ] <= 0) { $addopts .= 'gutter: false;' ; } elseif ( $opts [ 'start' ] > 1) { $addopts .= 'first-line: ' . $opts [ 'start' ] . ';' ; } $newstring = '<pre class="brush: ' . $opts [ 'type' ] . ';' . $addopts . '">' . htmlspecialchars( $code ) . '</pre>' ; $s = str_replace ( '#' . $coTime . '#' . $i . '#' . $coTime . '#' , $newstring , $s ); } } unset( $tpl ); return ( $s ); } |
1 | <pre class = "brush: php;" >...</pre> |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | //> Zum schluss die blöcke die verschlüsselt wurden wieder entschlüsseln und Parsen. if ( $this ->permitted[ 'php' ] == true) { $string = preg_replace( "%\[php\](.+)\[\/php\]%esiU" , '$this->_phpblock("$1")' , $string ); $string = preg_replace( "%\[php=([^;]*);(\d+)\](.+)\[\/php\]%esiU" , 'this->_phpblock("$3","$1","$2")' , $string ); $string = preg_replace( "%\[php=(.*)\](.+)\[\/php\]%esiU" , '$this->_phpblock("$2","$1")' , $string ); } if ( $this ->permitted[ 'html' ] == true) { $string = preg_replace( "%\[html\](.+)\[\/html\]%esiU" , "\$this->_htmlblock('\$1')" , $string ); $string = preg_replace( "%\[html=([^;]*);(\d+)\](.+)\[\/html\]%esiU" , "\$this->_htmlblock('\$3','\$1','\$2')" , $string ); $string = preg_replace( "%\[html=(.*)\](.+)\[\/html\]%esiU" , "\$this->_htmlblock('\$2','\$1')" , $string ); } if ( $this ->permitted[ 'css' ] == true) { $string = preg_replace( "%\[css\](.+)\[\/css\]%esiU" , "\$this->_cssblock('\$1')" , $string ); $string = preg_replace( "%\[css=([^;]*);(\d+)\](.+)\[\/css\]%esiU" , "\$this->_cssblock('\$3','\$1','\$2')" , $string ); $string = preg_replace( "%\[css=(.*)\](.+)\[\/css\]%esiU" , "\$this->_cssblock('\$2','\$1')" , $string ); } if ( $this ->permitted[ 'code' ] == true) { $string = preg_replace( "%\[code\](.+)\[\/code\]%esiU" , "\$this->_codeblock('\$1')" , $string ); $string = preg_replace( "%\[code=([^;]*);(\d+)\](.+)\[\/code\]%esiU" , "\$this->_codeblock('\$3','\$1','\$2')" , $string ); $string = preg_replace( "%\[code=(.*)\](.+)\[\/code\]%esiU" , "\$this->_codeblock('\$2','\$1')" , $string ); } |
Geschlossen | ||
![]() |
Zurück zu Kritik und Verbesserungen |