Skip to content

Commit

Permalink
fixes to media package
Browse files Browse the repository at this point in the history
  • Loading branch information
kaviththiranga committed Jul 29, 2012
1 parent 7deeb69 commit 9b64922
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 24 deletions.
15 changes: 5 additions & 10 deletions libraries/joomla/media/combiner.php
Expand Up @@ -123,12 +123,9 @@ public static function getCombiners()
continue; continue;
} }


// Sweet! Our class exists, so now we just need to know if it passes its test method. // Combiner names should not have file extensions.
if ($class::isSupported()) $combiners[] = $class;
{
// Connector names should not have file extensions.
$combiners[] = $class;
}
} }


return $combiners; return $combiners;
Expand Down Expand Up @@ -257,10 +254,8 @@ public static function isSupported($sourceFile)
{ {
return true; return true;
} }
else
{
return false;
}
} }

return true;
} }
} }
28 changes: 14 additions & 14 deletions libraries/joomla/media/compressor.php
Expand Up @@ -184,12 +184,9 @@ public static function getCompressors()
continue; continue;
} }


// Sweet! Our class exists, so now we just need to know if it passes its test method. // Compressor names should not have file extensions.
if ($class::isSupported()) $compressors[] = $class;
{
// Connector names should not have file extensions.
$compressors[] = $class;
}
} }


return $compressors; return $compressors;
Expand All @@ -198,16 +195,21 @@ public static function getCompressors()
/** /**
* Compress a CSS/JS file with given options * Compress a CSS/JS file with given options
* *
* @param string $uncompressed The full file path of the source file. * @param string $uncompressed The String to be compressed
* @param array $options An asssociative array with options. Eg: force overwirte, prefix for minified files * @param array $options An asssociative array with options. Eg: type, force overwirte, prefix for minified files
* *
* @return string compressed string * @return string compressed string
* *
* @since 12.1 * @since 12.1
*/ */
public static function compressString( $uncompressed, $options = array()) public static function compressString( $uncompressed, $options)
{ {
if (!array_key_exists('type', $options))
{
throw new RuntimeException(JText::sprintf('JMEDIA_ERROR_COMPRESSOR_TYPE_NOT_DEFINED'));
}
$compressor = self::getInstance($options); $compressor = self::getInstance($options);
$compressor->clear();
$compressor->setUncompressed($uncompressed); $compressor->setUncompressed($uncompressed);


try try
Expand All @@ -218,7 +220,7 @@ public static function compressString( $uncompressed, $options = array())
{ {
return false; return false;
} }
return $compressor->getCompressed; return $compressor->getCompressed();
} }


/** /**
Expand Down Expand Up @@ -357,11 +359,9 @@ public static function isSupported($sourceFile)
{ {
return true; return true;
} }
else
{
return false;
}
} }

return false;
} }


/** /**
Expand Down

0 comments on commit 9b64922

Please sign in to comment.