# HG changeset patch # User Dan # Date 1191960895 14400 # Node ID 91127e62f38f6ed549c9553381072c41c3b97bfb # Parent 1bc7e849a264616c37d7ee135d4a29f8b20d96d5 Fixed some regular expressions in HTML optimization algorithm; regex page groups can be edited now (oops) diff -r 1bc7e849a264 -r 91127e62f38f includes/functions.php --- a/includes/functions.php Sun Oct 07 17:22:25 2007 -0400 +++ b/includes/functions.php Tue Oct 09 16:14:55 2007 -0400 @@ -2796,7 +2796,7 @@ $strip_tags = implode('|', $strip_tags); // Strip out the tags and replace with placeholders - preg_match_all("#<($strip_tags)(.*?)>(.*?)#is", $html, $matches); + preg_match_all("#<($strip_tags)([ ]+.*?)?>(.*?)#is", $html, $matches); $seed = md5(microtime() . mt_rand()); // Random value used for placeholders for ($i = 0;$i < sizeof($matches[1]); $i++) { @@ -2804,7 +2804,7 @@ } // Optimize (but don't obfuscate) Javascript - preg_match_all('/(.+?)<\/script>/is', $html, $jscript); + preg_match_all('/(.*?)<\/script>/is', $html, $jscript); // list of Javascript reserved words - from about.com $reserved_words = array('abstract', 'as', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'continue', 'const', 'debugger', 'default', 'delete', 'do', @@ -2819,6 +2819,8 @@ { $js =& $jscript[2][$i]; + // echo('
' . "-----------------------------------------------------------------------------\n" . htmlspecialchars($js) . '
'); + // for line optimization, explode it $particles = explode("\n", $js); diff -r 1bc7e849a264 -r 91127e62f38f index.php --- a/index.php Sun Oct 07 17:22:25 2007 -0400 +++ b/index.php Tue Oct 09 16:14:55 2007 -0400 @@ -15,7 +15,7 @@ // Set up gzip encoding before any output is sent - $aggressive_optimize_html = false; + $aggressive_optimize_html = true; global $do_gzip; $do_gzip = true; diff -r 1bc7e849a264 -r 91127e62f38f plugins/SpecialAdmin.php --- a/plugins/SpecialAdmin.php Sun Oct 07 17:22:25 2007 -0400 +++ b/plugins/SpecialAdmin.php Tue Oct 09 16:14:55 2007 -0400 @@ -3158,6 +3158,8 @@ $parser = $template->makeParserText($vars['sidebar_section']); $c = $template->tplWikiFormat($row['block_content'], false, 'sidebar-editor.tpl'); $c = preg_replace('#(.*?)#is', '\\2', $c); + // fix for the "Administration" link that somehow didn't get rendered properly + $c = preg_replace("/(^|\n)([ ]*)(.+)<\/a>()([\r\n]+|$)/isU", '\\1\\2
  • \\4
  • \\7', $c); break; case BLOCK_HTML: $parser = $template->makeParserText($vars['sidebar_section_raw']); diff -r 1bc7e849a264 -r 91127e62f38f plugins/admin/PageGroups.php --- a/plugins/admin/PageGroups.php Sun Oct 07 17:22:25 2007 -0400 +++ b/plugins/admin/PageGroups.php Tue Oct 09 16:14:55 2007 -0400 @@ -602,6 +602,23 @@ echo '
    The affecting tag was updated.
    '; } } + else if ( $_POST['pg_type'] == PAGE_GRP_REGEX ) + { + $target = $_POST['pg_target']; + if ( empty($target) ) + { + echo '
    Please enter an expression to match against..
    '; + } + else + { + $target = $db->escape($target); + $q = $db->sql_query('UPDATE '.table_prefix.'page_groups SET pg_target=\'' . $target . '\' WHERE pg_id=' . $edit_id . ';'); + if ( !$q ) + $db->_die(); + else + echo '
    The expression to match against was updated.
    '; + } + } else if ( $_POST['pg_type'] == PAGE_GRP_CATLINK ) { $target = $_POST['pg_target']; @@ -860,6 +877,22 @@ '; break; + case PAGE_GRP_REGEX: + echo ' + + Regular expression to use:
    + Be sure to include the starting and ending delimiters and any flags you might need.
    + These pages might help: Pattern modifiers • + Pattern syntax
    + Examples: /^(Special|Admin):/i/^Image:([0-9]+)$/
    + Developers, remember that this will be matched against the full page identifier string. This means that /^About_Enano$/ + will NOT match the page Special:About_Enano.
    + + + + + '; + break; case PAGE_GRP_CATLINK: // Build category list