From 4347f06e36788a8e62d96ab36faa547ff8c98c33 Mon Sep 17 00:00:00 2001 From: kaviththiranga Date: Mon, 30 Jul 2012 09:20:58 +0530 Subject: [PATCH] Implemented getOptions() --- libraries/joomla/media/combiner.php | 15 ++- libraries/joomla/media/compressor.php | 160 ++++++++++++++------------ 2 files changed, 100 insertions(+), 75 deletions(-) diff --git a/libraries/joomla/media/combiner.php b/libraries/joomla/media/combiner.php index a1b2ba577b..d98e4289c0 100644 --- a/libraries/joomla/media/combiner.php +++ b/libraries/joomla/media/combiner.php @@ -130,6 +130,19 @@ public static function getCombiners() return $combiners; } + + /** + * Method to get combiner options + * + * @return array Options for the combinor + * + * @since 12.1 + */ + public function getOptions() + { + return $this->_options; + } + /** * Gives a combiner object for CSS/JS * @@ -170,7 +183,7 @@ public static function getInstance( $options = array()) throw new RuntimeException(JText::sprintf('JLIB_DATABASE_ERROR_CONNECT_DATABASE', $e->getMessage())); } - // Set the new connector to the global instances based on signature. + // Set the new combinerr to the global instances based on signature. self::$instances[$signature] = $instance; } diff --git a/libraries/joomla/media/compressor.php b/libraries/joomla/media/compressor.php index c87663c147..3faccd8622 100644 --- a/libraries/joomla/media/compressor.php +++ b/libraries/joomla/media/compressor.php @@ -25,43 +25,43 @@ abstract class JMediaCompressor public $_uncompressed = null; /** - * @var int size of uncompressed Code. - * @since 12.1 - */ + * @var int size of uncompressed Code. + * @since 12.1 + */ public $_uncompressedSize = null; /** - * @var String To hold compressed Code. - * @since 12.1 - */ + * @var String To hold compressed Code. + * @since 12.1 + */ protected $_compressed = null; /** - * @var int size of compressed Code. - * @since 12.1 - */ + * @var int size of compressed Code. + * @since 12.1 + */ public $_compressedSize = null; /** - * @var Array Compression options for CSS Minifier. - * @since 12.1 - */ + * @var Array Compression options for CSS Minifier. + * @since 12.1 + */ protected $_options = array(); /** - * @var array JMediaCompressor instances container. - * @since 11.1 - */ + * @var array JMediaCompressor instances container. + * @since 11.1 + */ protected static $instances = array(); /** - * Method to set uncompressed code. - * + * Method to set uncompressed code. + * * @param string $uncompressed Uncomressed Code. - * - * @return void - * - * @since 12.1 + * + * @return void + * + * @since 12.1 */ public function setUncompressed($uncompressed) { @@ -70,26 +70,26 @@ public function setUncompressed($uncompressed) } /** - * Method to get uncompressed code. - * - * @return String uncompressed code. - * - * @since 12.1 - */ + * Method to get uncompressed code. + * + * @return String uncompressed code. + * + * @since 12.1 + */ public function getUncompressed() { return $this->_uncompressed; } /** - * Method to set uncompressed code. - * + * Method to set uncompressed code. + * * @param string $compressed compressed Code. - * - * @return void - * - * @since 12.1 - */ + * + * @return void + * + * @since 12.1 + */ public function setCompressed($compressed) { $this->_compressed = $compressed; @@ -97,26 +97,26 @@ public function setCompressed($compressed) } /** - * Method to get compressed code. - * - * @return String compressed code. - * - * @since 12.1 - */ + * Method to get compressed code. + * + * @return String compressed code. + * + * @since 12.1 + */ public function getCompressed() { return $this->_compressed; } /** - * Method to set compression options. - * - * @param Array $options options to compress. - * - * @return void - * - * @since 12.1 - */ + * Method to set compression options. + * + * @param Array $options options to compress. + * + * @return void + * + * @since 12.1 + */ public function setOptions($options) { // Merge user defined options with default options @@ -124,12 +124,12 @@ public function setOptions($options) } /** - * Object Constructor takes two parameters. - * - * @param Array $options Compression options for Minifier. - * - * @since 12.1 - */ + * Object Constructor takes two parameters. + * + * @param Array $options Compression options for Minifier. + * + * @since 12.1 + */ public function __construct($options = array()) { // Merge user defined options with default options @@ -137,24 +137,24 @@ public function __construct($options = array()) } /** - * Method to get compressed ratio. - * - * @return double Compressed ratio. - * - * @since 12.1 - */ + * Method to get compressed ratio. + * + * @return double Compressed ratio. + * + * @since 12.1 + */ public function getRatio() { return round(($this->_compressedSize / $this->_uncompressedSize * 100), 2); } /** - * Get a list of available compressors - * - * @return array An array of available compressors - * - * @since 11.1 - */ + * Get a list of available compressors + * + * @return array An array of available compressors + * + * @since 11.1 + */ public static function getCompressors() { // Instantiate variables. @@ -193,15 +193,27 @@ public static function getCompressors() } /** - * Compress a CSS/JS file with given options - * + * Method to get compressor options + * + * @return array Options for the compressor + * + * @since 12.1 + */ + public function getOptions() + { + return $this->_options; + } + + /** + * Compress a CSS/JS file with given options + * * @param string $uncompressed The String to be compressed - * @param array $options An asssociative array with options. Eg: type, force overwirte, prefix for minified files - * - * @return string compressed string - * - * @since 12.1 - */ + * @param array $options An asssociative array with options. Eg: type, force overwirte, prefix for minified files + * + * @return string compressed string + * + * @since 12.1 + */ public static function compressString( $uncompressed, $options) { if (!array_key_exists('type', $options))