Plugin Directory

Changeset 703481


Ignore:
Timestamp:
04/25/2013 02:09:29 PM (13 years ago)
Author:
ale.carbo
Message:

Updated plugin for version 1.1.1

Location:
assetsminify
Files:
150 added
3 edited

Legend:

Unmodified
Added
Removed
  • assetsminify/trunk/AssetsMinifyInit.php

    r698723 r703481  
    1414use Assetic\Filter\LessphpFilter;
    1515use Assetic\Cache\FilesystemCache;
     16use Assetic\Asset\StringAsset;
    1617
    1718/**
     
    318319
    319320        //Prints <script> inclusion in the page
     321        $this->dumpScriptData( 'header' );
    320322        $this->dumpJs( "head-{$mtime}.js", false );
    321323    }
     
    335337
    336338        //Prints <script> inclusion in the page
     339        $this->dumpScriptData( 'footer' );
    337340        $this->dumpJs( "foot-{$mtime}.js" );
     341    }
     342
     343    /**
     344     * Combines the script data from all minified scripts
     345     */
     346    protected function buildScriptData( $where ) {
     347        global $wp_scripts;
     348        $data = '';
     349
     350        if ( empty($this->scripts[$where] ) )
     351            return '';
     352
     353        foreach ($this->scripts[$where] as $handle => $filepath) {
     354            $data .= $wp_scripts->print_extra_script( $handle, false );
     355        }
     356
     357        $asset = new StringAsset( $data, array(new JSMinFilter) );
     358
     359        return $asset->dump();
    338360    }
    339361
     
    351373        echo "<link href='" . $this->assetsUrl . $filename . "' media='screen, projection' rel='stylesheet' type='text/css'>";
    352374    }
     375
     376    /**
     377     * Prints <script> tags with addtional script data and i10n
     378     */
     379    protected function dumpScriptData( $where ) {
     380        $data = $this->buildScriptData( $where );
     381
     382        if (empty($data))
     383            return false;
     384
     385        echo "<script type='text/javascript'>\n"; // CDATA and type='text/javascript' is not needed for HTML 5
     386        echo "/* <![CDATA[ */\n";
     387        echo "$data\n";
     388        echo "/* ]]> */\n";
     389        echo "</script>\n";
     390    }
    353391}
    354392
  • assetsminify/trunk/plugin.php

    r698723 r703481  
    55Description: WordPress plugin to minify JS and CSS assets.
    66Author: Alessandro Carbone
    7 Version: 1.1.0
     7Version: 1.1.1
    88Author URI: http://www.artera.it
    99*/
  • assetsminify/trunk/readme.txt

    r699316 r703481  
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
    9 Stable tag: 1.1.0
     9Stable tag: 1.1.1
    1010
    1111Use Compass, SASS and LESS to develop your themes and minify your stylesheets and JavaScript simply by installing AssetsMinify.
     
    5252== Changelog ==
    5353
     54= 1.1.1 =
     55
     56* Provided compatibility with wp_localize_script()
     57
    5458= 1.1.0 =
    5559
Note: See TracChangeset for help on using the changeset viewer.