Censorship.php
changeset 1 bfc5494ee70c
parent 0 d7eb80b3c6f6
child 2 c8e6db42385f
equal deleted inserted replaced
0:d7eb80b3c6f6 1:bfc5494ee70c
    12 
    12 
    13 $plugins->attachHook('render_wikiformat_post', 'anti_sopa_censor($text);');
    13 $plugins->attachHook('render_wikiformat_post', 'anti_sopa_censor($text);');
    14 
    14 
    15 function anti_sopa_censor(&$text)
    15 function anti_sopa_censor(&$text)
    16 {
    16 {
       
    17 	// don't censor the stop-sopa page
       
    18 	global $db, $session, $paths, $template, $plugins; // Common objects
       
    19 	if ( $paths->page_id == 'activism/stop-sopa' && $paths->namespace == 'Article' )
       
    20 		return;
       
    21 	
    17 	// save HTML tags
    22 	// save HTML tags
    18 	$text = preg_split('/(<(?:[a-z\/].+?|!--.+?--)>|<script[^>]*>[\w\W]*?<\/script>)/', $text, NULL, PREG_SPLIT_DELIM_CAPTURE);
    23 	$text = preg_split('/(<(?:[a-z\/].+?|!--.+?--)>|<script[^>]*>[\w\W]*?<\/script>)/', $text, NULL, PREG_SPLIT_DELIM_CAPTURE);
    19 	foreach ( $text as &$block )
    24 	foreach ( $text as &$block )
    20 	{
    25 	{
    21 		if ( $block{0} == '<' )
    26 		if ( $block{0} == '<' )