Gacha Posted September 16, 2004 Report Share Posted September 16, 2004 sk, tevtomer taisniba, par shito biji piemirsis! Gan kaut ko ar regex var saveidot, bet es tos nerubiju :( Link to comment Share on other sites More sharing options...
Venom Posted September 16, 2004 Report Share Posted September 16, 2004 resp., tas bla bla paliek, bet nu es gribeetu lai vinjs nepaliek, ja jau ir neatljautajos tagos http://paste.php.lv/1245 mēģināji? Link to comment Share on other sites More sharing options...
Analgiins Posted September 16, 2004 Author Report Share Posted September 16, 2004 meegjinaaju Venom, bet tur kaut kas arii neiisti rubii. Ok, u, i, b vinjsh atstaaj, p nodzees - briinishkjiigi, bet teixim <script> tagu vinjsh neizfiltree, tas pats ar tagiem table, tr,td.. nu njez, regulaaraas izteiksmes taa jau maz saprotu.. ;) Link to comment Share on other sites More sharing options...
Analgiins Posted September 16, 2004 Author Report Share Posted September 16, 2004 nu pats uztaisiiju shitaatu scriptu, tjip masiivs ar visiem tagiem: $all_tags = array ( "!DOCTYPE", "a", "abbr", "acronym" ... visus jau neraxtiishu ... "var", "xmp"); atljautie tagi: $allowed_tags = array ( 'b' ,'i' ,'u' ,'img' ,'br' ); filtreejam: foreach ($all_tags as $tag) { if (!in_array($tag, $allowed_tags)) $text = preg_replace("'<".$tag."[^>]*?>.*?</".$tag.">'si", "", $text); } Nu viss straadaa, tachu neracionalitaate pashaa pilniibaa. Izsakiet savus viedokljus. Link to comment Share on other sites More sharing options...
bubu Posted September 16, 2004 Report Share Posted September 16, 2004 un kur bij problēmas to foreach ciklu uzrakstīt šādā veidā: $bad_tags = array_diff($all_tags, $allowed_tags); $all_bad = implode('|', $bad_tags); $text = preg_replace("'<(".$all_bad.")[^>]*>.*</\\1>'si", "", $text); } Link to comment Share on other sites More sharing options...
Analgiins Posted September 16, 2004 Author Report Share Posted September 16, 2004 jaa, shitaa straadaa aatraak Link to comment Share on other sites More sharing options...
Analgiins Posted September 16, 2004 Author Report Share Posted September 16, 2004 aa, un veel kas: peec visiem shiem algoritmiem nevaidzeetu tomeer aizmirst beidzot izmantot strip_tags, lai nonjemtu tagus, kuriem parast nav beigu taga (piem. <meta>) Link to comment Share on other sites More sharing options...
Recommended Posts