mirror of
https://github.com/e107inc/e107.git
synced 2025-08-05 14:17:49 +02:00
Merge pull request #1949 from lonalore/library-manager-fix
Fix for Library Manager's variant handler.
This commit is contained in:
@@ -204,7 +204,7 @@ class e_library_manager
|
|||||||
foreach($library['variants'] as $variant_name => &$variant)
|
foreach($library['variants'] as $variant_name => &$variant)
|
||||||
{
|
{
|
||||||
// If no variant callback has been set, assume the variant to be installed.
|
// If no variant callback has been set, assume the variant to be installed.
|
||||||
if(!isset($variant['variant callback']))
|
if(!isset($variant['variant_callback']))
|
||||||
{
|
{
|
||||||
$variant['installed'] = true;
|
$variant['installed'] = true;
|
||||||
}
|
}
|
||||||
@@ -231,12 +231,12 @@ class e_library_manager
|
|||||||
|
|
||||||
// We support both a single parameter, which is an associative array, and an indexed array of
|
// We support both a single parameter, which is an associative array, and an indexed array of
|
||||||
// multiple parameters.
|
// multiple parameters.
|
||||||
if(isset($variant['variant arguments'][0]))
|
if(isset($variant['variant_arguments'][0]))
|
||||||
{
|
{
|
||||||
if($class)
|
if($class)
|
||||||
{
|
{
|
||||||
$params = array_merge(array($library, $variant_name), $variant['variant arguments']);
|
$params = array_merge(array($library, $variant_name), $variant['variant_arguments']);
|
||||||
$variant['installed'] = e107::callMethod($class, $library['variant callback'], $params);
|
$variant['installed'] = e107::callMethod($class, $library['variant_callback'], $params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -244,11 +244,11 @@ class e_library_manager
|
|||||||
if($class)
|
if($class)
|
||||||
{
|
{
|
||||||
// Can't use e107::callMethod(), because it only supports 2 params.
|
// Can't use e107::callMethod(), because it only supports 2 params.
|
||||||
if(method_exists($class, $variant['variant callback']))
|
if(method_exists($class, $variant['variant_callback']))
|
||||||
{
|
{
|
||||||
// Call PLUGIN/THEME_library::VARIANT_CALLBACK().
|
// Call PLUGIN/THEME_library::VARIANT_CALLBACK().
|
||||||
$method = $variant['variant callback'];
|
$method = $variant['variant_callback'];
|
||||||
$variant['installed'] = $class->$method($library, $variant_name, $variant['variant arguments']);
|
$variant['installed'] = $class->$method($library, $variant_name, $variant['variant_arguments']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -283,7 +283,7 @@ class e_library_manager
|
|||||||
* request. The variant that has been passed first is used; different variant names in subsequent calls are
|
* request. The variant that has been passed first is used; different variant names in subsequent calls are
|
||||||
* ignored.
|
* ignored.
|
||||||
*
|
*
|
||||||
* @return
|
* @return mixed
|
||||||
* An associative array of the library information as returned from config(). The top-level properties
|
* An associative array of the library information as returned from config(). The top-level properties
|
||||||
* contain the effective definition of the library (variant) that has been loaded. Additionally:
|
* contain the effective definition of the library (variant) that has been loaded. Additionally:
|
||||||
* - installed: Whether the library is installed, as determined by detect().
|
* - installed: Whether the library is installed, as determined by detect().
|
||||||
@@ -974,7 +974,7 @@ class e_library_manager
|
|||||||
* minified or compressed files, this prevents reading the entire file into memory.
|
* minified or compressed files, this prevents reading the entire file into memory.
|
||||||
*
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
* A string containing the version of the library.
|
* A string containing the version of the library. Or null.
|
||||||
*/
|
*/
|
||||||
private function getVersion($library, $options)
|
private function getVersion($library, $options)
|
||||||
{
|
{
|
||||||
@@ -1037,6 +1037,8 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1111,7 +1113,7 @@ class e_library_manager
|
|||||||
* @param $current_version
|
* @param $current_version
|
||||||
* The version to check against (like 4.2).
|
* The version to check against (like 4.2).
|
||||||
*
|
*
|
||||||
* @return
|
* @return mixed
|
||||||
* NULL if compatible, otherwise the original dependency version string that caused the incompatibility.
|
* NULL if compatible, otherwise the original dependency version string that caused the incompatibility.
|
||||||
*
|
*
|
||||||
* @see parseDependency()
|
* @see parseDependency()
|
||||||
|
Reference in New Issue
Block a user