close
Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions dependency-minification.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Plugin Name: Dependency Minification
Description: Concatenates and minifies scripts and stylesheets.
Description: Concatenates and minifies scripts and stylesheets. Please install and activate <a href="http://scribu.net" target="_blank">scribu</a>'s <a href="http://wordpress.org/plugins/proper-network-activation/" target="_blank">Proper Network Activation</a> plugin <em>before</em> activating this plugin <em>network-wide</em>.
Version: 0.9.5
Author: X-Team
Author URI: http://x-team.com/
Expand Down Expand Up @@ -68,15 +68,25 @@ static function hook_rewrites() {
self::add_rewrite_rule();
}

static function get_rewrite_regex() {
return sprintf( '^%s/%s', self::$options['endpoint'], self::FILENAME_PATTERN );
}

static function add_rewrite_rule() {
$regex = sprintf( '^%s/%s', self::$options['endpoint'], self::FILENAME_PATTERN );
$regex = self::get_rewrite_regex();
$redirect = 'index.php?';
for ( $i = 0; $i < count( self::$query_vars ); $i += 1 ) {
$redirect .= sprintf( '%s=$matches[%d]&', self::$query_vars[$i], $i + 1 );
}
add_rewrite_rule( $regex, $redirect, 'top' );
}

static function remove_rewrite_rule() {
$regex = self::get_rewrite_regex();
global $wp_rewrite;
unset( $wp_rewrite->extra_rules_top[ $regex ] );
}

protected static $is_footer = array(
'scripts' => false,
'styles' => false,
Expand All @@ -95,6 +105,7 @@ static function activate() {
* register_deactivation_hook
*/
static function deactivate() {
self::remove_rewrite_rule();
flush_rewrite_rules();
}

Expand Down