mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 20:57:26 +02:00
@@ -1657,15 +1657,7 @@ class e107
|
|||||||
*/
|
*/
|
||||||
private static function getLibrary()
|
private static function getLibrary()
|
||||||
{
|
{
|
||||||
/*static $included = false;
|
return self::getSingleton('e_library_manager', true);
|
||||||
if(!$included)
|
|
||||||
{
|
|
||||||
e107_require_once(e_HANDLER . 'library_manager.php');
|
|
||||||
$included = true;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
return self::getSingleton('e_library_manager', true); /* @FIXME Use this instead? */
|
|
||||||
// return e_library_manager::getInstance();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1689,11 +1681,11 @@ class e107
|
|||||||
switch ($action)
|
switch ($action)
|
||||||
{
|
{
|
||||||
case 'detect':
|
case 'detect':
|
||||||
return $libraryHandler->libraryDetect($library);
|
return $libraryHandler->detect($library);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'load':
|
case 'load':
|
||||||
return $libraryHandler->libraryLoad($library);
|
return $libraryHandler->load($library);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,12 +6,12 @@
|
|||||||
*
|
*
|
||||||
* TODO:
|
* TODO:
|
||||||
* - Provide the ability to use third-party callbacks (are defined in e_library.php files) for groups:
|
* - Provide the ability to use third-party callbacks (are defined in e_library.php files) for groups:
|
||||||
* 'info', 'pre-detect', 'post-detect', 'pre-dependencies-load', 'pre-load', 'post-load'
|
* 'info', 'pre_detect', 'post_detect', 'pre_dependencies_load', 'pre_load', 'post_load'
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php
|
// [e_LANGUAGEDIR]/[e_LANGUAGE]/lan_library_manager.php
|
||||||
e107::lan('core', 'library_manager');
|
e107::lan('core', 'library_manager');
|
||||||
/*FIXME Remove 'library' prefix from method names */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class e_library_manager.
|
* Class e_library_manager.
|
||||||
@@ -19,19 +19,11 @@ e107::lan('core', 'library_manager');
|
|||||||
class e_library_manager
|
class e_library_manager
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
|
||||||
* Singleton instance.
|
|
||||||
* Allow class extends - override {@link getInstance()}
|
|
||||||
*
|
|
||||||
* @var e_library_manager
|
|
||||||
*/
|
|
||||||
protected static $_instance = null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* Use {@link getInstance()}, direct instantiating is not possible for signleton objects.
|
* Use {@link getInstance()}, direct instantiating is not possible for signleton objects.
|
||||||
*/
|
*/
|
||||||
protected function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,21 +41,6 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get singleton instance.
|
|
||||||
*
|
|
||||||
* @return e_library_manager
|
|
||||||
*/
|
|
||||||
public static function getInstance() /* FIXME Still Neeeded? */
|
|
||||||
{
|
|
||||||
if(null === self::$_instance)
|
|
||||||
{
|
|
||||||
self::$_instance = new self();
|
|
||||||
self::$_instance->_init();
|
|
||||||
}
|
|
||||||
return self::$_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tries to detect a library and its installed version.
|
* Tries to detect a library and its installed version.
|
||||||
*
|
*
|
||||||
@@ -72,19 +49,19 @@ class e_library_manager
|
|||||||
*
|
*
|
||||||
* @return array|false
|
* @return array|false
|
||||||
* An associative array containing registered information for the library specified by $name, or FALSE if the
|
* An associative array containing registered information for the library specified by $name, or FALSE if the
|
||||||
* library $name is not registered. In addition to the keys returned by libraryInfo(), the following keys are
|
* library $name is not registered. In addition to the keys returned by info(), the following keys are
|
||||||
* contained:
|
* contained:
|
||||||
* - installed: A boolean indicating whether the library is installed. Note that not only the top-level library,
|
* - installed: A boolean indicating whether the library is installed. Note that not only the top-level library,
|
||||||
* but also each variant contains this key.
|
* but also each variant contains this key.
|
||||||
* - version: If the version could be detected, the full version string.
|
* - version: If the version could be detected, the full version string.
|
||||||
* - error: If an error occurred during library detection, one of the following error statuses:
|
* - error: If an error occurred during library detection, one of the following error statuses:
|
||||||
* "not found", "not detected", "not supported".
|
* "not found", "not detected", "not supported".
|
||||||
* - error message: If an error occurred during library detection, a detailed error message.
|
* - error_message: If an error occurred during library detection, a detailed error_message.
|
||||||
*/
|
*/
|
||||||
public function libraryDetect($name)
|
public function detect($name)
|
||||||
{
|
{
|
||||||
// Re-use the statically cached value of libraryInfo() to save memory.
|
// Re-use the statically cached value of info() to save memory.
|
||||||
$library = &$this->libraryInfo($name);
|
$library = &$this->info($name);
|
||||||
|
|
||||||
// Exit early if the library was not found.
|
// Exit early if the library was not found.
|
||||||
if($library === false)
|
if($library === false)
|
||||||
@@ -101,91 +78,84 @@ class e_library_manager
|
|||||||
$library['installed'] = false;
|
$library['installed'] = false;
|
||||||
|
|
||||||
// Check whether the library exists.
|
// Check whether the library exists.
|
||||||
if(!isset($library['library path']))
|
if(!isset($library['library_path']))
|
||||||
{
|
{
|
||||||
$library['library path'] = $this->libraryGetPath($library['machine name']);
|
$library['library_path'] = $this->getPath($library['machine_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($library['library path'] === false || !file_exists($library['library path']))
|
$libraryPath = e107::getParser()->replaceConstants($library['library_path']);
|
||||||
|
if($library['library_path'] === false || !file_exists($libraryPath))
|
||||||
{
|
{
|
||||||
$library['error'] = LAN_LIBRARY_MANAGER_09;
|
$library['error'] = LAN_LIBRARY_MANAGER_09;
|
||||||
|
|
||||||
$replace = array('[x]');
|
|
||||||
$replace_with = array($library['name']);
|
$replace_with = array($library['name']);
|
||||||
|
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_03, $replace_with);
|
||||||
$library['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_03);
|
|
||||||
|
|
||||||
return $library;
|
return $library;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Invoke callbacks in the 'pre-detect' group.
|
// Invoke callbacks in the 'pre_detect' group.
|
||||||
$this->libraryInvoke('pre-detect', $library);
|
$this->invoke('pre_detect', $library);
|
||||||
|
|
||||||
// Detect library version, if not hardcoded.
|
// Detect library version, if not hardcoded.
|
||||||
if(!isset($library['version']))
|
if(!isset($library['version']))
|
||||||
{
|
{
|
||||||
// If version callback is a method in $this class.
|
// If version_callback is a method in $this class.
|
||||||
if(method_exists($this, $library['version callback']))
|
if(method_exists($this, $library['version_callback']))
|
||||||
{
|
{
|
||||||
// We support both a single parameter, which is an associative array, and an indexed array of multiple
|
// We support both a single parameter, which is an associative array, and an indexed array of multiple
|
||||||
// parameters.
|
// parameters.
|
||||||
if(isset($library['version arguments'][0]))
|
if(isset($library['version_arguments'][0]))
|
||||||
{
|
{
|
||||||
// Add the library as the first argument.
|
// Add the library as the first argument.
|
||||||
$classMethod = array($this, $library['version callback']);
|
$classMethod = array($this, $library['version_callback']);
|
||||||
$params = array_merge(array($library), $library['version arguments']);
|
$params = array_merge(array($library), $library['version_arguments']);
|
||||||
$variant['installed'] = call_user_func_array($classMethod, $params);
|
$library['version'] = call_user_func_array($classMethod, $params);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$method = $library['version callback'];
|
$method = $library['version_callback'];
|
||||||
$library['version'] = $this->$method($library, $library['version arguments']);
|
$library['version'] = $this->$method($library, $library['version_arguments']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// If version callback is a method in e_library.php file.
|
// If version_callback is a method in e_library.php file.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$library['version'] = '';
|
||||||
|
$class = false;
|
||||||
|
|
||||||
if(varset($library['plugin'], false))
|
if(varset($library['plugin'], false))
|
||||||
{
|
{
|
||||||
e107_require_once(e_PLUGIN . $library['plugin'] . '/e_library.php');
|
$class = e107::getAddon($library['plugin'], 'e_library');
|
||||||
$addonClass = $library['plugin'] . '_library';
|
|
||||||
}
|
}
|
||||||
elseif(varset($library['theme'], false))
|
elseif(varset($library['theme'], false))
|
||||||
{
|
{
|
||||||
e107_require_once(e_THEME . $library['theme'] . '/e_library.php');
|
// e107::getAddon() does not support theme folders.
|
||||||
|
e107_require_once(e_THEME . $library['theme'] . '/theme_library.php');
|
||||||
$addonClass = $library['theme'] . '_library';
|
$addonClass = $library['theme'] . '_library';
|
||||||
|
|
||||||
|
if(isset($addonClass) && class_exists($addonClass))
|
||||||
|
{
|
||||||
|
$class = new $addonClass();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// We support both a single parameter, which is an associative array, and an
|
// We support both a single parameter, which is an associative array, and an
|
||||||
// indexed array of multiple parameters.
|
// indexed array of multiple parameters.
|
||||||
if(isset($library['version arguments'][0]))
|
if(isset($library['version_arguments'][0]))
|
||||||
{
|
{
|
||||||
|
if($class)
|
||||||
if(isset($addonClass) && class_exists($addonClass)) /* @FIXME Perhaps use e107::callMethod() ? */
|
|
||||||
{
|
{
|
||||||
$class = new $addonClass();
|
$params = array_merge(array($library), $library['version_arguments']);
|
||||||
if(method_exists($class, $library['version callback']))
|
$library['version'] = e107::callMethod($class, $library['version_callback'], $params);
|
||||||
{
|
|
||||||
// Add the library as the first argument.
|
|
||||||
// Call PLUGIN/THEME_library::VERSION_CALLBACK().
|
|
||||||
$classMethod = array($class, $library['version callback']);
|
|
||||||
$params = array_merge(array($library), $library['version arguments']);
|
|
||||||
$variant['installed'] = call_user_func_array($classMethod, $params);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isset($addonClass) && class_exists($addonClass))
|
if($class)
|
||||||
{
|
{
|
||||||
$class = new $addonClass();
|
$library['version'] = e107::callMethod($class, $library['version_callback'], $library, $library['version_arguments']);
|
||||||
if(method_exists($class, $library['version callback']))
|
|
||||||
{
|
|
||||||
// Call PLUGIN/THEME_library::VERSION_CALLBACK().
|
|
||||||
$method = $library['version callback'];
|
|
||||||
$library['version'] = $class->$method($library, $library['version arguments']);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -194,10 +164,8 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
$library['error'] = LAN_LIBRARY_MANAGER_10;
|
$library['error'] = LAN_LIBRARY_MANAGER_10;
|
||||||
|
|
||||||
$replace = array('[x]');
|
|
||||||
$replace_with = array($library['name']);
|
$replace_with = array($library['name']);
|
||||||
|
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_04, $replace_with);
|
||||||
$library['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_04);
|
|
||||||
|
|
||||||
return $library;
|
return $library;
|
||||||
}
|
}
|
||||||
@@ -219,11 +187,8 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
$library['error'] = LAN_LIBRARY_MANAGER_11;
|
$library['error'] = LAN_LIBRARY_MANAGER_11;
|
||||||
|
|
||||||
$replace = array('[x]', '[y]');
|
|
||||||
$replace_with = array($library['version'], $library['name']);
|
$replace_with = array($library['version'], $library['name']);
|
||||||
|
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_05, $replace_with);
|
||||||
/* @XXX - $tp->lanVars() ? */
|
|
||||||
$library['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_05);
|
|
||||||
|
|
||||||
return $library;
|
return $library;
|
||||||
}
|
}
|
||||||
@@ -245,72 +210,55 @@ class e_library_manager
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
$variant['installed'] = false;
|
||||||
|
$class = false;
|
||||||
|
|
||||||
if(varset($library['plugin'], false))
|
if(varset($library['plugin'], false))
|
||||||
{
|
{
|
||||||
// e107::getAddon($library['plugin'],'e_library'); /* @FIXME Use this to avoid additional class_exists and method_exists checking */
|
$class = e107::getAddon($library['plugin'], 'e_library');
|
||||||
e107_require_once(e_PLUGIN . $library['plugin'] . '/e_library.php');
|
|
||||||
$addonClass = $library['plugin'] . '_library';
|
|
||||||
}
|
}
|
||||||
elseif(varset($library['theme'], false))
|
elseif(varset($library['theme'], false))
|
||||||
{
|
{
|
||||||
e107_require_once(e_THEME . $library['theme'] . '/e_library.php');
|
// e107::getAddon() does not support theme folders.
|
||||||
|
e107_require_once(e_THEME . $library['theme'] . '/theme_library.php');
|
||||||
$addonClass = $library['theme'] . '_library';
|
$addonClass = $library['theme'] . '_library';
|
||||||
|
|
||||||
|
if(isset($addonClass) && class_exists($addonClass))
|
||||||
|
{
|
||||||
|
$class = new $addonClass();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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(isset($addonClass) && class_exists($addonClass))
|
if($class)
|
||||||
{
|
{
|
||||||
$class = new $addonClass();
|
$params = array_merge(array($library, $variant_name), $variant['variant arguments']);
|
||||||
if(method_exists($class, $variant['variant callback']))
|
$variant['installed'] = e107::callMethod($class, $library['variant callback'], $params);
|
||||||
{
|
|
||||||
// Add the library as the first argument, and the variant name as the second.
|
|
||||||
// Call PLUGIN/THEME_library::VARIANT_CALLBACK().
|
|
||||||
$classMethod = array($class, $library['variant callback']);
|
|
||||||
$params = array_merge(array($library, $variant_name), $variant['variant arguments']);
|
|
||||||
$variant['installed'] = call_user_func_array($classMethod, $params);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$variant['installed'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$variant['installed'] = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(isset($addonClass) && class_exists($addonClass))
|
if($class)
|
||||||
{
|
{
|
||||||
$class = new $addonClass();
|
// 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']);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$variant['installed'] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$variant['installed'] = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$variant['installed'])
|
if(!$variant['installed'])
|
||||||
{
|
{
|
||||||
$variant['error'] = LAN_LIBRARY_MANAGER_09;
|
$variant['error'] = LAN_LIBRARY_MANAGER_09;
|
||||||
|
|
||||||
$replace = array('[x]', '[y]');
|
|
||||||
$replace_with = array($variant_name, $library['name']);
|
$replace_with = array($variant_name, $library['name']);
|
||||||
|
$variant['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_06, $replace_with);
|
||||||
$variant['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_06);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,8 +267,8 @@ class e_library_manager
|
|||||||
// If we end up here, the library should be usable.
|
// If we end up here, the library should be usable.
|
||||||
$library['installed'] = true;
|
$library['installed'] = true;
|
||||||
|
|
||||||
// Invoke callbacks in the 'post-detect' group.
|
// Invoke callbacks in the 'post_detect' group.
|
||||||
$this->libraryInvoke('post-detect', $library);
|
$this->invoke('post_detect', $library);
|
||||||
|
|
||||||
return $library;
|
return $library;
|
||||||
}
|
}
|
||||||
@@ -336,15 +284,16 @@ class e_library_manager
|
|||||||
* ignored.
|
* ignored.
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* An associative array of the library information as returned from libraryInfo(). The top-level properties
|
* An associative array of the library information as returned from info(). 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 libraryDetectLibrary().
|
* - installed: Whether the library is installed, as determined by detectLibrary().
|
||||||
* - loaded: Either the amount of library files that have been loaded, or FALSE if the library could not be
|
* - loaded: Either the amount of library files that have been loaded, or FALSE if the library could not be
|
||||||
* loaded. See MYPLUGIN_library::libraryInfo() for more information.
|
* loaded. See MYPLUGIN_library::info() for more information.
|
||||||
*/
|
*/
|
||||||
public function libraryLoad($name, $variant = null)
|
public function load($name, $variant = null)
|
||||||
{
|
{
|
||||||
static $loaded; /* @FIXME Still needed? */
|
// Re-use the statically cached value to save memory.
|
||||||
|
static $loaded;
|
||||||
|
|
||||||
if(!isset($loaded[$name]))
|
if(!isset($loaded[$name]))
|
||||||
{
|
{
|
||||||
@@ -359,7 +308,7 @@ class e_library_manager
|
|||||||
|
|
||||||
if(!varset($library, false))
|
if(!varset($library, false))
|
||||||
{
|
{
|
||||||
$library = $this->libraryDetect($name);
|
$library = $this->detect($name);
|
||||||
$cacheData = serialize($library);
|
$cacheData = serialize($library);
|
||||||
$cache->set($cacheID, $cacheData, true, false, true);
|
$cache->set($cacheID, $cacheData, true, false, true);
|
||||||
}
|
}
|
||||||
@@ -384,8 +333,8 @@ class e_library_manager
|
|||||||
unset($library['variants']);
|
unset($library['variants']);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Invoke callbacks in the 'pre-dependencies-load' group.
|
// Invoke callbacks in the 'pre_dependencies_load' group.
|
||||||
$this->libraryInvoke('pre-dependencies-load', $library);
|
$this->invoke('pre_dependencies_load', $library);
|
||||||
|
|
||||||
// If the library (variant) is installed, load it.
|
// If the library (variant) is installed, load it.
|
||||||
$library['loaded'] = false;
|
$library['loaded'] = false;
|
||||||
@@ -396,20 +345,20 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
foreach($library['dependencies'] as $dependency)
|
foreach($library['dependencies'] as $dependency)
|
||||||
{
|
{
|
||||||
$this->libraryLoad($dependency);
|
$this->load($dependency);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Invoke callbacks in the 'pre-load' group.
|
// Invoke callbacks in the 'pre_load' group.
|
||||||
$this->libraryInvoke('pre-load', $library);
|
$this->invoke('pre_load', $library);
|
||||||
|
|
||||||
// Load all the files associated with the library.
|
// Load all the files associated with the library.
|
||||||
$library['loaded'] = $this->libraryLoadFiles($library);
|
$library['loaded'] = $this->loadFiles($library);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// Invoke callbacks in the 'post-load' group.
|
// Invoke callbacks in the 'post_load' group.
|
||||||
$this->libraryInvoke('post-load', $library);
|
$this->invoke('post_load', $library);
|
||||||
}
|
}
|
||||||
$loaded[$name] = $library;
|
$loaded[$name] = $library;
|
||||||
}
|
}
|
||||||
@@ -422,23 +371,20 @@ class e_library_manager
|
|||||||
*
|
*
|
||||||
* @param $name
|
* @param $name
|
||||||
* The machine name of a library to return the path for.
|
* The machine name of a library to return the path for.
|
||||||
* @param $base_path
|
|
||||||
* Whether to prefix the resulting path with base_path().
|
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
* The path to the specified library or FALSE if the library wasn't found.
|
* The path to the specified library or FALSE if the library wasn't found.
|
||||||
*/
|
*/
|
||||||
private function libraryGetPath($name, $base_path = false)
|
private function getPath($name)
|
||||||
{
|
{
|
||||||
static $libraries;
|
static $libraries;
|
||||||
|
|
||||||
if(!isset($libraries))
|
if(!isset($libraries))
|
||||||
{
|
{
|
||||||
$libraries = $this->libraryGetLibraries();
|
$libraries = $this->getLibraries();
|
||||||
}
|
}
|
||||||
|
|
||||||
// e_HTTP will at least default to '/'.
|
$path = '';
|
||||||
$path = ($base_path ? e_HTTP : '');
|
|
||||||
if(!isset($libraries[$name]))
|
if(!isset($libraries[$name]))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -457,27 +403,18 @@ class e_library_manager
|
|||||||
* @return array
|
* @return array
|
||||||
* A list of library directories.
|
* A list of library directories.
|
||||||
*/
|
*/
|
||||||
private function libraryGetLibraries()
|
private function getLibraries()
|
||||||
{
|
{
|
||||||
$dir = e_WEB . 'lib';
|
$dir = e_WEB . 'lib';
|
||||||
|
$directories = array();
|
||||||
|
|
||||||
// Retrieve list of directories.
|
// Retrieve list of directories.
|
||||||
/* FIXME Use e107::getFile() or just scandir() ? */
|
$file = e107::getFile();
|
||||||
$directories = array();
|
$dirs = $file->get_dirs($dir);
|
||||||
$nomask = array('CVS');
|
|
||||||
if(is_dir($dir) && $handle = opendir($dir))
|
foreach($dirs as $dirName)
|
||||||
{
|
{
|
||||||
while(false !== ($file = readdir($handle)))
|
$directories[$dirName] = "{e_WEB}lib/$dirName";
|
||||||
{
|
|
||||||
if(!in_array($file, $nomask) && $file[0] != '.')
|
|
||||||
{
|
|
||||||
if(is_dir("$dir/$file"))
|
|
||||||
{
|
|
||||||
$directories[$file] = "$dir/$file";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
closedir($handle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $directories;
|
return $directories;
|
||||||
@@ -496,9 +433,9 @@ class e_library_manager
|
|||||||
* An associative array containing registered information for all libraries, the registered information for the
|
* An associative array containing registered information for all libraries, the registered information for the
|
||||||
* library specified by $name, or FALSE if the library $name is not registered.
|
* library specified by $name, or FALSE if the library $name is not registered.
|
||||||
*/
|
*/
|
||||||
private function &libraryInfo($library = null)
|
private function &info($library = null)
|
||||||
{
|
{
|
||||||
// This static cache is re-used by libraryDetect() to save memory.
|
// This static cache is re-used by detect() to save memory.
|
||||||
static $libraries;
|
static $libraries;
|
||||||
|
|
||||||
if(!isset($libraries))
|
if(!isset($libraries))
|
||||||
@@ -514,7 +451,7 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
foreach($info as $machine_name => $properties)
|
foreach($info as $machine_name => $properties)
|
||||||
{
|
{
|
||||||
$properties['info type'] = 'plugin';
|
$properties['info_type'] = 'plugin';
|
||||||
$properties['plugin'] = $plugin;
|
$properties['plugin'] = $plugin;
|
||||||
$libraries[$machine_name] = $properties;
|
$libraries[$machine_name] = $properties;
|
||||||
$plugins[] = $plugin; // This plugin has a valid e_library implementation.
|
$plugins[] = $plugin; // This plugin has a valid e_library implementation.
|
||||||
@@ -543,7 +480,7 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
foreach($info as $machine_name => $properties)
|
foreach($info as $machine_name => $properties)
|
||||||
{
|
{
|
||||||
$properties['info type'] = 'theme';
|
$properties['info_type'] = 'theme';
|
||||||
$properties['theme'] = $theme;
|
$properties['theme'] = $theme;
|
||||||
$libraries[$machine_name] = $properties;
|
$libraries[$machine_name] = $properties;
|
||||||
$themes[] = $theme; // This theme has a valid e_library implementation.
|
$themes[] = $theme; // This theme has a valid e_library implementation.
|
||||||
@@ -557,29 +494,21 @@ class e_library_manager
|
|||||||
// Provide defaults.
|
// Provide defaults.
|
||||||
foreach($libraries as $machine_name => &$properties)
|
foreach($libraries as $machine_name => &$properties)
|
||||||
{
|
{
|
||||||
$this->libraryInfoDefaults($properties, $machine_name);
|
$this->infoDefaults($properties, $machine_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow enabled plugins (with e_library.php file) to alter the registered libraries.
|
// Allow enabled plugins (with e_library.php file) to alter the registered libraries.
|
||||||
// e107::getAddon($plugin, 'e_library','config_alter'); /* FIXME Use e107::getAddon() instead? */
|
|
||||||
foreach($plugins as $plugin)
|
foreach($plugins as $plugin)
|
||||||
{
|
{
|
||||||
e107_require_once(e_PLUGIN . $plugin . '/e_library.php');
|
$class = e107::getAddon($plugin, 'e_library');
|
||||||
$addonClass = $plugin . '_library';
|
if($class && method_exists($class, 'config_alter'))
|
||||||
|
|
||||||
if(class_exists($addonClass))
|
|
||||||
{
|
{
|
||||||
$class = new $addonClass();
|
// The library definitions are passed by reference.
|
||||||
if(method_exists($class, 'config_alter'))
|
$class->config_alter($libraries);
|
||||||
{
|
|
||||||
$class->config_alter($libraries);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow enabled themes (with theme_library.php file) to alter the registered libraries.
|
// Allow enabled themes (with theme_library.php file) to alter the registered libraries.
|
||||||
|
|
||||||
|
|
||||||
foreach($themes as $theme)
|
foreach($themes as $theme)
|
||||||
{
|
{
|
||||||
e107_require_once(e_THEME . $theme . '/theme_library.php');
|
e107_require_once(e_THEME . $theme . '/theme_library.php');
|
||||||
@@ -599,7 +528,7 @@ class e_library_manager
|
|||||||
// Invoke callbacks in the 'info' group.
|
// Invoke callbacks in the 'info' group.
|
||||||
foreach($libraries as &$properties)
|
foreach($libraries as &$properties)
|
||||||
{
|
{
|
||||||
$this->libraryInvoke('info', $properties);
|
$this->invoke('info', $properties);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -629,40 +558,37 @@ class e_library_manager
|
|||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
private function libraryInfoDefaults(&$library, $name)
|
private function infoDefaults(&$library, $name)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* FIXME Avoid spaces in keys, use _ underscores */
|
|
||||||
|
|
||||||
$library += array(
|
$library += array(
|
||||||
'machine name' => $name,
|
'machine_name' => $name,
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
'vendor url' => '',
|
'vendor_url' => '',
|
||||||
'download url' => '',
|
'download_url' => '',
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => null,
|
'library_path' => null,
|
||||||
'version callback' => 'libraryGetVersion',
|
'version_callback' => 'getVersion',
|
||||||
'version arguments' => array(),
|
'version_arguments' => array(),
|
||||||
'files' => array(),
|
'files' => array(),
|
||||||
'dependencies' => array(),
|
'dependencies' => array(),
|
||||||
'variants' => array(),
|
'variants' => array(),
|
||||||
'versions' => array(),
|
'versions' => array(),
|
||||||
'integration files' => array(),
|
'integration_files' => array(),
|
||||||
'callbacks' => array(),
|
'callbacks' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$library['callbacks'] += array(
|
$library['callbacks'] += array(
|
||||||
'info' => array(),
|
'info' => array(),
|
||||||
'pre-detect' => array(),
|
'pre_detect' => array(),
|
||||||
'post-detect' => array(),
|
'post_detect' => array(),
|
||||||
'pre-dependencies-load' => array(),
|
'pre_dependencies_load' => array(),
|
||||||
'pre-load' => array(),
|
'pre_load' => array(),
|
||||||
'post-load' => array(),
|
'post_load' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
// Add our own callbacks before any others.
|
// Add our own callbacks before any others.
|
||||||
array_unshift($library['callbacks']['info'], 'libraryPrepareFiles');
|
array_unshift($library['callbacks']['info'], 'prepareFiles');
|
||||||
array_unshift($library['callbacks']['post-detect'], 'libraryDetectDependencies');
|
array_unshift($library['callbacks']['post_detect'], 'detectDependencies');
|
||||||
|
|
||||||
return $library;
|
return $library;
|
||||||
}
|
}
|
||||||
@@ -681,7 +607,7 @@ class e_library_manager
|
|||||||
* 'example_2.js' => array(),
|
* 'example_2.js' => array(),
|
||||||
* );
|
* );
|
||||||
* @endcode
|
* @endcode
|
||||||
* It does the same for the 'integration files' property.
|
* It does the same for the 'integration_files' property.
|
||||||
*
|
*
|
||||||
* @param $library
|
* @param $library
|
||||||
* An associative array of library information or a part of it, passed by reference.
|
* An associative array of library information or a part of it, passed by reference.
|
||||||
@@ -690,19 +616,19 @@ class e_library_manager
|
|||||||
* @param $variant
|
* @param $variant
|
||||||
* If the library information belongs to a specific variant, the variant name. NULL otherwise.
|
* If the library information belongs to a specific variant, the variant name. NULL otherwise.
|
||||||
*/
|
*/
|
||||||
private function libraryPrepareFiles(&$library, $version = null, $variant = null)
|
private function prepareFiles(&$library, $version = null, $variant = null)
|
||||||
{
|
{
|
||||||
// Both the 'files' property and the 'integration files' property contain file declarations, and we want to make
|
// Both the 'files' property and the 'integration_files' property contain file declarations, and we want to make
|
||||||
// both consistent.
|
// both consistent.
|
||||||
$file_types = array();
|
$file_types = array();
|
||||||
if(isset($library['files']))
|
if(isset($library['files']))
|
||||||
{
|
{
|
||||||
$file_types[] = &$library['files'];
|
$file_types[] = &$library['files'];
|
||||||
}
|
}
|
||||||
if(isset($library['integration files']))
|
if(isset($library['integration_files']))
|
||||||
{
|
{
|
||||||
// Integration files are additionally keyed by plugin.
|
// Integration files are additionally keyed by plugin.
|
||||||
foreach($library['integration files'] as &$integration_files)
|
foreach($library['integration_files'] as &$integration_files)
|
||||||
{
|
{
|
||||||
$file_types[] = &$integration_files;
|
$file_types[] = &$integration_files;
|
||||||
}
|
}
|
||||||
@@ -729,7 +655,7 @@ class e_library_manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Library post-detect callback to process and detect dependencies.
|
* Library post detect callback to process and detect dependencies.
|
||||||
*
|
*
|
||||||
* It checks whether each of the dependencies of a library are installed and available in a compatible version.
|
* It checks whether each of the dependencies of a library are installed and available in a compatible version.
|
||||||
*
|
*
|
||||||
@@ -740,36 +666,32 @@ class e_library_manager
|
|||||||
* @param $variant
|
* @param $variant
|
||||||
* If the library information belongs to a specific variant, the variant name. NULL otherwise.
|
* If the library information belongs to a specific variant, the variant name. NULL otherwise.
|
||||||
*/
|
*/
|
||||||
private function libraryDetectDependencies(&$library, $version = null, $variant = null)
|
private function detectDependencies(&$library, $version = null, $variant = null)
|
||||||
{
|
{
|
||||||
if(isset($library['dependencies']))
|
if(isset($library['dependencies']))
|
||||||
{
|
{
|
||||||
foreach($library['dependencies'] as &$dependency_string)
|
foreach($library['dependencies'] as &$dependency_string)
|
||||||
{
|
{
|
||||||
$dependency_info = $this->libraryParseDependency($dependency_string);
|
$dependency_info = $this->parseDependency($dependency_string);
|
||||||
$dependency = $this->libraryDetect($dependency_info['name']);
|
$dependency = $this->detect($dependency_info['name']);
|
||||||
if(!$dependency['installed'])
|
if(!$dependency['installed'])
|
||||||
{
|
{
|
||||||
$library['installed'] = false;
|
$library['installed'] = false;
|
||||||
$library['error'] = LAN_LIBRARY_MANAGER_07;
|
$library['error'] = LAN_LIBRARY_MANAGER_07;
|
||||||
|
|
||||||
$replace = array('[x]', '[y]');
|
|
||||||
$replace_with = array($dependency['name'], $library['name']);
|
$replace_with = array($dependency['name'], $library['name']);
|
||||||
|
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_01, $replace_with);
|
||||||
$library['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_01); /* FIXME $tp->lanVars() */
|
|
||||||
}
|
}
|
||||||
elseif($this->libraryCheckIncompatibility($dependency_info, $dependency['version']))
|
elseif($this->checkIncompatibility($dependency_info, $dependency['version']))
|
||||||
{
|
{
|
||||||
$library['installed'] = false;
|
$library['installed'] = false;
|
||||||
$library['error'] = LAN_LIBRARY_MANAGER_08;
|
$library['error'] = LAN_LIBRARY_MANAGER_08;
|
||||||
|
|
||||||
$replace = array('[x]', '[y]', '[z]');
|
|
||||||
$replace_with = array($dependency['version'], $library['name'], $library['name']);
|
$replace_with = array($dependency['version'], $library['name'], $library['name']);
|
||||||
|
$library['error_message'] = e107::getParser()->lanVars(LAN_LIBRARY_MANAGER_02, $replace_with);
|
||||||
$library['error message'] = str_replace($replace, $replace_with, LAN_LIBRARY_MANAGER_02); /* FIXME $tp->lanVars() */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove the version string from the dependency, so libraryLoad() can load the libraries directly.
|
// Remove the version string from the dependency, so load() can load the libraries directly.
|
||||||
$dependency_string = $dependency_info['name'];
|
$dependency_string = $dependency_info['name'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -779,11 +701,11 @@ class e_library_manager
|
|||||||
* Invokes library callbacks.
|
* Invokes library callbacks.
|
||||||
*
|
*
|
||||||
* @param $group
|
* @param $group
|
||||||
* A string containing the group of callbacks that is to be applied. Should be either 'info', 'post-detect'.
|
* A string containing the group of callbacks that is to be applied. Should be either 'info', 'post_detect'.
|
||||||
* @param $library
|
* @param $library
|
||||||
* An array of library information, passed by reference.
|
* An array of library information, passed by reference.
|
||||||
*/
|
*/
|
||||||
private function libraryInvoke($group, &$library)
|
private function invoke($group, &$library)
|
||||||
{
|
{
|
||||||
// When introducing new callback groups in newer versions, stale cached library information somehow reaches
|
// When introducing new callback groups in newer versions, stale cached library information somehow reaches
|
||||||
// this point during the database update before clearing the library cache.
|
// this point during the database update before clearing the library cache.
|
||||||
@@ -794,7 +716,7 @@ class e_library_manager
|
|||||||
|
|
||||||
foreach($library['callbacks'][$group] as $callback)
|
foreach($library['callbacks'][$group] as $callback)
|
||||||
{
|
{
|
||||||
$this->libraryTraverseLibrary($library, $callback);
|
$this->traverseLibrary($library, $callback);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -810,7 +732,7 @@ class e_library_manager
|
|||||||
* @param $callback
|
* @param $callback
|
||||||
* A string containing the callback to apply to all parts of a library.
|
* A string containing the callback to apply to all parts of a library.
|
||||||
*/
|
*/
|
||||||
private function libraryTraverseLibrary(&$library, $callback)
|
private function traverseLibrary(&$library, $callback)
|
||||||
{
|
{
|
||||||
// If callback belongs to $this class.
|
// If callback belongs to $this class.
|
||||||
if(method_exists($this, $callback))
|
if(method_exists($this, $callback))
|
||||||
@@ -849,7 +771,7 @@ class e_library_manager
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// TODO: Provide the ability to use third-party callbacks (are defined in e_library.php files) for groups:
|
// TODO: Provide the ability to use third-party callbacks (are defined in e_library.php files) for groups:
|
||||||
// 'info', 'pre-detect', 'post-detect', 'pre-dependencies-load', 'pre-load', 'post-load'
|
// 'info', 'pre_detect', 'post_detect', 'pre_dependencies_load', 'pre_load', 'post_load'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -857,56 +779,56 @@ class e_library_manager
|
|||||||
* Loads a library's files.
|
* Loads a library's files.
|
||||||
*
|
*
|
||||||
* @param $library
|
* @param $library
|
||||||
* An array of library information as returned by libraryInfo().
|
* An array of library information as returned by info().
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
* The number of loaded files.
|
* The number of loaded files.
|
||||||
*/
|
*/
|
||||||
private function libraryLoadFiles($library)
|
private function loadFiles($library)
|
||||||
{
|
{
|
||||||
$siteTheme = e107::getPref('sitetheme');
|
$siteTheme = e107::getPref('sitetheme');
|
||||||
$adminTheme = e107::getPref('admintheme');
|
$adminTheme = e107::getPref('admintheme');
|
||||||
|
|
||||||
// Load integration files.
|
// Load integration_files.
|
||||||
if(!$library['post-load integration files'] && !empty($library['integration files']))
|
if(!$library['post_load_integration_files'] && !empty($library['integration_files']))
|
||||||
{
|
{
|
||||||
foreach($library['integration files'] as $provider => $files)
|
foreach($library['integration_files'] as $provider => $files)
|
||||||
{
|
{
|
||||||
// If provider is an installed plugin.
|
// If provider is an installed plugin.
|
||||||
if(e107::isInstalled($provider))
|
if(e107::isInstalled($provider))
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_PLUGIN . $provider,
|
'library_path' => e_PLUGIN . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// If provider is the admin theme, we only allow it for admin pages.
|
// If provider is the admin theme, we only allow it for admin pages.
|
||||||
elseif(e_ADMIN_AREA && $provider == $adminTheme)
|
elseif(e_ADMIN_AREA && $provider == $adminTheme)
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_THEME . $provider,
|
'library_path' => e_THEME . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// If provider is the site theme, we only allow it for on the user area.
|
// If provider is the site theme, we only allow it on user areas.
|
||||||
elseif(!deftrue(e_ADMIN_AREA, false) && $provider == $siteTheme)
|
elseif(!deftrue(e_ADMIN_AREA, false) && $provider == $siteTheme)
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_THEME . $provider,
|
'library_path' => e_THEME . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Construct the full path to the library for later use.
|
// Construct the full path to the library for later use.
|
||||||
$path = $library['library path'];
|
$path = e107::getParser()->replaceConstants($library['library_path']);
|
||||||
$path = ($library['path'] !== '' ? $path . '/' . $library['path'] : $path);
|
$path = ($library['path'] !== '' ? $path . '/' . $library['path'] : $path);
|
||||||
|
|
||||||
// Count the number of loaded files for the return value.
|
// Count the number of loaded files for the return value.
|
||||||
@@ -932,7 +854,7 @@ class e_library_manager
|
|||||||
$data = $options['data'];
|
$data = $options['data'];
|
||||||
unset($options['data']);
|
unset($options['data']);
|
||||||
}
|
}
|
||||||
// Prepend the library path to the file name.
|
// Prepend the library_path to the file name.
|
||||||
$data = "$path/$data";
|
$data = "$path/$data";
|
||||||
// Apply the default zone if the zone isn't explicitly given.
|
// Apply the default zone if the zone isn't explicitly given.
|
||||||
if(!isset($options['zone']))
|
if(!isset($options['zone']))
|
||||||
@@ -962,56 +884,55 @@ class e_library_manager
|
|||||||
{
|
{
|
||||||
foreach($library['files']['php'] as $file => $array)
|
foreach($library['files']['php'] as $file => $array)
|
||||||
{
|
{
|
||||||
// TODO: review these includes.
|
|
||||||
$file_path1 = $path . '/' . $file;
|
$file_path1 = $path . '/' . $file;
|
||||||
$file_path2 = e_ROOT . $path . '/' . $file;
|
$file_path2 = e_ROOT . $path . '/' . $file;
|
||||||
|
|
||||||
if(file_exists($file_path1))
|
if(file_exists($file_path1))
|
||||||
{
|
{
|
||||||
$this->_libraryRequireOnce($file_path1);
|
$this->_requireOnce($file_path1);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
elseif(file_exists($file_path2))
|
elseif(file_exists($file_path2))
|
||||||
{
|
{
|
||||||
$this->_libraryRequireOnce($file_path2);
|
$this->_requireOnce($file_path2);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load integration files.
|
// Load integration_files.
|
||||||
if($library['post-load integration files'] && !empty($library['integration files']))
|
if($library['post_load_integration_files'] && !empty($library['integration_files']))
|
||||||
{
|
{
|
||||||
foreach($library['integration files'] as $provider => $files)
|
foreach($library['integration_files'] as $provider => $files)
|
||||||
{
|
{
|
||||||
// If provider is an installed plugin.
|
// If provider is an installed plugin.
|
||||||
if(e107::isInstalled($provider))
|
if(e107::isInstalled($provider))
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_PLUGIN . $provider,
|
'library_path' => e_PLUGIN . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// If provider is the admin theme, we only allow it for admin pages.
|
// If provider is the admin theme, we only allow it for admin pages.
|
||||||
elseif(e_ADMIN_AREA && $provider == $adminTheme)
|
elseif(e_ADMIN_AREA && $provider == $adminTheme)
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_THEME . $provider,
|
'library_path' => e_THEME . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
// If provider is the site theme, we only allow it for on the user area.
|
// If provider is the site theme, we only allow it on user areas.
|
||||||
elseif(!deftrue(e_ADMIN_AREA, false) && $provider == $siteTheme)
|
elseif(!deftrue(e_ADMIN_AREA, false) && $provider == $siteTheme)
|
||||||
{
|
{
|
||||||
$this->libraryLoadFiles(array(
|
$this->loadFiles(array(
|
||||||
'files' => $files,
|
'files' => $files,
|
||||||
'path' => '',
|
'path' => '',
|
||||||
'library path' => e_THEME . $provider,
|
'library_path' => e_THEME . $provider,
|
||||||
'post-load integration files' => false,
|
'post_load_integration_files' => false,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1023,14 +944,14 @@ class e_library_manager
|
|||||||
/**
|
/**
|
||||||
* Wrapper function for require_once.
|
* Wrapper function for require_once.
|
||||||
*
|
*
|
||||||
* A library file could set a $path variable in file scope. Requiring such a file directly in libraryLoadFiles()
|
* A library file could set a $path variable in file scope. Requiring such a file directly in loadFiles()
|
||||||
* would lead to the local $path variable being overridden after the require_once statement. This would break
|
* would lead to the local $path variable being overridden after the require_once statement. This would break
|
||||||
* loading further files. Therefore we use this trivial wrapper which has no local state that can be tampered with.
|
* loading further files. Therefore we use this trivial wrapper which has no local state that can be tampered with.
|
||||||
*
|
*
|
||||||
* @param $file_path
|
* @param $file_path
|
||||||
* The file path of the file to require.
|
* The file path of the file to require.
|
||||||
*/
|
*/
|
||||||
private function _libraryRequireOnce($file_path)
|
private function _requireOnce($file_path)
|
||||||
{
|
{
|
||||||
// TODO: use e107_require_once() instead?
|
// TODO: use e107_require_once() instead?
|
||||||
require_once $file_path;
|
require_once $file_path;
|
||||||
@@ -1055,7 +976,7 @@ class e_library_manager
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* A string containing the version of the library.
|
* A string containing the version of the library.
|
||||||
*/
|
*/
|
||||||
private function libraryGetVersion($library, $options)
|
private function getVersion($library, $options)
|
||||||
{
|
{
|
||||||
// Provide defaults.
|
// Provide defaults.
|
||||||
$options += array(
|
$options += array(
|
||||||
@@ -1065,7 +986,8 @@ class e_library_manager
|
|||||||
'cols' => 200,
|
'cols' => 200,
|
||||||
);
|
);
|
||||||
|
|
||||||
$file = $library['library path'] . '/' . $options['file'];
|
$libraryPath = e107::getParser()->replaceConstants($library['library_path']);
|
||||||
|
$file = $libraryPath . '/' . $options['file'];
|
||||||
if(empty($options['file']) || !file_exists($file))
|
if(empty($options['file']) || !file_exists($file))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -1085,7 +1007,7 @@ class e_library_manager
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a dependency for comparison by libraryCheckIncompatibility().
|
* Parses a dependency for comparison by checkIncompatibility().
|
||||||
*
|
*
|
||||||
* @param $dependency
|
* @param $dependency
|
||||||
* A dependency string, which specifies a plugin dependency, and versions that are supported. Supported formats
|
* A dependency string, which specifies a plugin dependency, and versions that are supported. Supported formats
|
||||||
@@ -1100,9 +1022,9 @@ class e_library_manager
|
|||||||
* incompatibilities).
|
* incompatibilities).
|
||||||
* - 'versions' is a list of associative arrays, each containing the keys 'op' and 'version'. 'op' can be one of:
|
* - 'versions' is a list of associative arrays, each containing the keys 'op' and 'version'. 'op' can be one of:
|
||||||
* '=', '==', '!=', '<>', '<', '<=', '>', or '>='. 'version' is one piece like '4.5-beta3'.
|
* '=', '==', '!=', '<>', '<', '<=', '>', or '>='. 'version' is one piece like '4.5-beta3'.
|
||||||
* Callers should pass this structure to libraryCheckIncompatibility().
|
* Callers should pass this structure to checkIncompatibility().
|
||||||
*/
|
*/
|
||||||
private function libraryParseDependency($dependency)
|
private function parseDependency($dependency)
|
||||||
{
|
{
|
||||||
$value = array();
|
$value = array();
|
||||||
|
|
||||||
@@ -1152,16 +1074,16 @@ class e_library_manager
|
|||||||
* Checks whether a version is compatible with a given dependency.
|
* Checks whether a version is compatible with a given dependency.
|
||||||
*
|
*
|
||||||
* @param $v
|
* @param $v
|
||||||
* The parsed dependency structure from libraryParseDependency().
|
* The parsed dependency structure from parseDependency().
|
||||||
* @param $current_version
|
* @param $current_version
|
||||||
* The version to check against (like 4.2).
|
* The version to check against (like 4.2).
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
* 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 libraryParseDependency()
|
* @see parseDependency()
|
||||||
*/
|
*/
|
||||||
private function libraryCheckIncompatibility($v, $current_version)
|
private function checkIncompatibility($v, $current_version)
|
||||||
{
|
{
|
||||||
if(!empty($v['versions']))
|
if(!empty($v['versions']))
|
||||||
{
|
{
|
||||||
|
@@ -21,33 +21,33 @@ class PLUGIN_library
|
|||||||
* Each key is the directory name below the '{e_WEB}/lib' directory, in which the library may be found. Each
|
* Each key is the directory name below the '{e_WEB}/lib' directory, in which the library may be found. Each
|
||||||
* value is an associative array containing:
|
* value is an associative array containing:
|
||||||
* - name: The official, human-readable name of the library.
|
* - name: The official, human-readable name of the library.
|
||||||
* - vendor url: The URL of the homepage of the library.
|
* - vendor_url: The URL of the homepage of the library.
|
||||||
* - download url: The URL of a web page on which the library can be obtained.
|
* - download_url: The URL of a web page on which the library can be obtained.
|
||||||
* - path: (optional) A relative path from the directory of the library to the actual library. Only required if
|
* - path: (optional) A relative path from the directory of the library to the actual library. Only required if
|
||||||
* the extracted download package contains the actual library files in a sub-directory.
|
* the extracted download package contains the actual library files in a sub-directory.
|
||||||
* - library path: (optional) The absolute path to the library directory. This should not be declared normally, as
|
* - library_path: (optional) The absolute path to the library directory. This should not be declared normally, as
|
||||||
* it is automatically detected, to allow for multiple possible library locations. A valid use-case is an
|
* it is automatically detected, to allow for multiple possible library locations. A valid use-case is an
|
||||||
* external library, in which case the full URL to the library should be specified here.
|
* external library, in which case the full URL to the library should be specified here.
|
||||||
* - version: (optional) The version of the library. This should not be declared normally, as it is automatically
|
* - version: (optional) The version of the library. This should not be declared normally, as it is automatically
|
||||||
* detected (see 'version callback' below) to allow for version changes of libraries without code changes of
|
* detected (see 'version_callback' below) to allow for version changes of libraries without code changes of
|
||||||
* implementing plugins and to support different versions of a library simultaneously. A valid use-case is an
|
* implementing plugins and to support different versions of a library simultaneously. A valid use-case is an
|
||||||
* external library whose version cannot be determined programmatically. Either 'version' or 'version callback'
|
* external library whose version cannot be determined programmatically. Either 'version' or 'version_callback'
|
||||||
* (or 'version arguments' in case libraryGetVersion() is being used as a version callback) must be declared.
|
* (or 'version_arguments' in case libraryGetVersion() is being used as a version callback) must be declared.
|
||||||
* - version callback: (optional) The name of a function that detects and returns the full version string of the
|
* - version_callback: (optional) The name of a function that detects and returns the full version string of the
|
||||||
* library. The first argument is always $library, an array containing all library information as described here.
|
* library. The first argument is always $library, an array containing all library information as described here.
|
||||||
* There are two ways to declare the version callback's additional arguments, either as a single $options
|
* There are two ways to declare the version callback's additional arguments, either as a single $options
|
||||||
* parameter or as multiple parameters, which correspond to the two ways to specify the argument values (see
|
* parameter or as multiple parameters, which correspond to the two ways to specify the argument values (see
|
||||||
* 'version arguments'). Defaults to libraryGetVersion(). Unless 'version' is declared or libraryGetVersion()
|
* 'version_arguments'). Defaults to libraryGetVersion(). Unless 'version' is declared or libraryGetVersion()
|
||||||
* is being used as a version callback, 'version callback' must be declared. In the latter case, however,
|
* is being used as a version callback, 'version_callback' must be declared. In the latter case, however,
|
||||||
* 'version arguments' must be declared in the specified way.
|
* 'version_arguments' must be declared in the specified way.
|
||||||
* - version arguments: (optional) A list of arguments to pass to the version callback. Version arguments can be
|
* - version_arguments: (optional) A list of arguments to pass to the version callback. Version arguments can be
|
||||||
* declared either as an associative array whose keys are the argument names or as an indexed array without
|
* declared either as an associative array whose keys are the argument names or as an indexed array without
|
||||||
* specifying keys. If declared as an associative array, the arguments get passed to the version callback as a
|
* specifying keys. If declared as an associative array, the arguments get passed to the version callback as a
|
||||||
* single $options parameter whose keys are the argument names (i.e. $options is identical to the specified
|
* single $options parameter whose keys are the argument names (i.e. $options is identical to the specified
|
||||||
* array). If declared as an indexed array, the array values get passed to the version callback as separate
|
* array). If declared as an indexed array, the array values get passed to the version callback as separate
|
||||||
* arguments in the order they were declared. The default version callback libraryGetVersion() expects a
|
* arguments in the order they were declared. The default version callback libraryGetVersion() expects a
|
||||||
* single, associative array with named keys:
|
* single, associative array with named keys:
|
||||||
* - file: The filename to parse for the version, relative to the path specified as the 'library path' property
|
* - file: The filename to parse for the version, relative to the path specified as the 'library_path' property
|
||||||
* (see above). For example: 'docs/changelog.txt'.
|
* (see above). For example: 'docs/changelog.txt'.
|
||||||
* - pattern: A string containing a regular expression (PCRE) to match the library version. For example:
|
* - pattern: A string containing a regular expression (PCRE) to match the library version. For example:
|
||||||
* '@version\s+([0-9a-zA-Z\.-]+)@'. Note that the returned version is not the match of the entire pattern
|
* '@version\s+([0-9a-zA-Z\.-]+)@'. Note that the returned version is not the match of the entire pattern
|
||||||
@@ -56,8 +56,8 @@ class PLUGIN_library
|
|||||||
* - lines: (optional) The maximum number of lines to search the pattern in. Defaults to 20.
|
* - lines: (optional) The maximum number of lines to search the pattern in. Defaults to 20.
|
||||||
* - cols: (optional) The maximum number of characters per line to take into account. Defaults to 200. In case
|
* - cols: (optional) The maximum number of characters per line to take into account. Defaults to 200. In case
|
||||||
* of minified or compressed files, this prevents reading the entire file into memory.
|
* of minified or compressed files, this prevents reading the entire file into memory.
|
||||||
* Defaults to an empty array. 'version arguments' must be specified unless 'version' is declared or the
|
* Defaults to an empty array. 'version_arguments' must be specified unless 'version' is declared or the
|
||||||
* specified 'version callback' does not require any arguments. The latter might be the case with a
|
* specified 'version_callback' does not require any arguments. The latter might be the case with a
|
||||||
* library-specific version callback, for example.
|
* library-specific version callback, for example.
|
||||||
* - files: An associative array of library files to load. Supported keys are:
|
* - files: An associative array of library files to load. Supported keys are:
|
||||||
* - js: A list of JavaScript files to load.
|
* - js: A list of JavaScript files to load.
|
||||||
@@ -89,13 +89,13 @@ class PLUGIN_library
|
|||||||
* 'minified' or 'source'. Each value is an associative array of top-level properties that are entirely
|
* 'minified' or 'source'. Each value is an associative array of top-level properties that are entirely
|
||||||
* overridden by the variant, most often just 'files'. Additionally, each variant can contain following
|
* overridden by the variant, most often just 'files'. Additionally, each variant can contain following
|
||||||
* properties:
|
* properties:
|
||||||
* - variant callback: (optional) The name of a function that detects the variant and returns TRUE or FALSE,
|
* - variant_callback: (optional) The name of a function that detects the variant and returns TRUE or FALSE,
|
||||||
* depending on whether the variant is available or not. The first argument is always $library, an array
|
* depending on whether the variant is available or not. The first argument is always $library, an array
|
||||||
* containing all library information as described here. The second argument is always a string containing the
|
* containing all library information as described here. The second argument is always a string containing the
|
||||||
* variant name. There are two ways to declare the variant callback's additional arguments, either as a single
|
* variant name. There are two ways to declare the variant callback's additional arguments, either as a single
|
||||||
* $options parameter or as multiple parameters, which correspond to the two ways to specify the argument
|
* $options parameter or as multiple parameters, which correspond to the two ways to specify the argument
|
||||||
* values (see 'variant arguments'). If omitted, the variant is expected to always be available.
|
* values (see 'variant_arguments'). If omitted, the variant is expected to always be available.
|
||||||
* - variant arguments: A list of arguments to pass to the variant callback. Variant arguments can be declared
|
* - variant_arguments: A list of arguments to pass to the variant callback. Variant arguments can be declared
|
||||||
* either as an associative array whose keys are the argument names or as an indexed array without specifying
|
* either as an associative array whose keys are the argument names or as an indexed array without specifying
|
||||||
* keys. If declared as an associative array, the arguments get passed to the variant callback as a single
|
* keys. If declared as an associative array, the arguments get passed to the variant callback as a single
|
||||||
* $options parameter whose keys are the argument names (i.e. $options is identical to the specified array).
|
* $options parameter whose keys are the argument names (i.e. $options is identical to the specified array).
|
||||||
@@ -107,7 +107,7 @@ class PLUGIN_library
|
|||||||
* loaded, different 'variants' may become available, or e107 plugins need to load different integration files
|
* loaded, different 'variants' may become available, or e107 plugins need to load different integration files
|
||||||
* adapted to the new version. Each key is a version *string* (PHP does not support floats as keys). Each value
|
* adapted to the new version. Each key is a version *string* (PHP does not support floats as keys). Each value
|
||||||
* is an associative array of top-level properties that are entirely overridden by the version.
|
* is an associative array of top-level properties that are entirely overridden by the version.
|
||||||
* - integration files: (optional) Sets of files to load for the plugin, using the same notion as the top-level
|
* - integration_files: (optional) Sets of files to load for the plugin, using the same notion as the top-level
|
||||||
* 'files' property. Each specified file should contain the path to the file relative to the plugin it belongs
|
* 'files' property. Each specified file should contain the path to the file relative to the plugin it belongs
|
||||||
* to.
|
* to.
|
||||||
* Additional top-level properties can be registered as needed.
|
* Additional top-level properties can be registered as needed.
|
||||||
@@ -120,19 +120,19 @@ class PLUGIN_library
|
|||||||
$libraries['example'] = array(
|
$libraries['example'] = array(
|
||||||
// Only used in administrative UI of Libraries API.
|
// Only used in administrative UI of Libraries API.
|
||||||
'name' => 'Example library',
|
'name' => 'Example library',
|
||||||
'vendor url' => 'http://example.com',
|
'vendor_url' => 'http://example.com',
|
||||||
'download url' => 'http://example.com/download',
|
'download_url' => 'http://example.com/download',
|
||||||
// Override default library location ({e_WEB}/lib).
|
// Override default library location ({e_WEB}/lib).
|
||||||
'library path' => e_PLUGIN . 'example',
|
'library_path' => e_PLUGIN . 'example',
|
||||||
// Optional: If, after extraction, the actual library files are contained in 'e107_web/lib/example/lib',
|
// Optional: If, after extraction, the actual library files are contained in 'e107_web/lib/example/lib',
|
||||||
// specify the relative path here.
|
// specify the relative path here.
|
||||||
'path' => 'lib',
|
'path' => 'lib',
|
||||||
// Optional: Define a custom version detection callback, if required. Need to be in your 'PLUGIN_library'
|
// Optional: Define a custom version detection callback, if required. Need to be in your 'PLUGIN_library'
|
||||||
// class.
|
// class.
|
||||||
'version callback' => 'example_custom_version_callback',
|
'version_callback' => 'example_custom_version_callback',
|
||||||
// Specify arguments for the version callback.
|
// Specify arguments for the version callback.
|
||||||
// By default, libraryGetVersion() takes a named argument array:
|
// By default, libraryGetVersion() takes a named argument array:
|
||||||
'version arguments' => array(
|
'version_arguments' => array(
|
||||||
'file' => 'docs/CHANGELOG.txt',
|
'file' => 'docs/CHANGELOG.txt',
|
||||||
'pattern' => '@version\s+([0-9a-zA-Z\.-]+)@',
|
'pattern' => '@version\s+([0-9a-zA-Z\.-]+)@',
|
||||||
'lines' => 5,
|
'lines' => 5,
|
||||||
@@ -141,7 +141,7 @@ class PLUGIN_library
|
|||||||
// Default list of files of the library to load. Important: Only specify third-party files belonging to the
|
// Default list of files of the library to load. Important: Only specify third-party files belonging to the
|
||||||
// library here, not integration files of your plugin.
|
// library here, not integration files of your plugin.
|
||||||
'files' => array(
|
'files' => array(
|
||||||
// 'js' and 'css' file paths are relative to the library path.
|
// 'js' and 'css' file paths are relative to the library_path.
|
||||||
'js' => array(
|
'js' => array(
|
||||||
'exlib.js' => array(
|
'exlib.js' => array(
|
||||||
'zone' => 3, // If not set, the default: 2. See: e107::js()
|
'zone' => 3, // If not set, the default: 2. See: e107::js()
|
||||||
@@ -155,7 +155,7 @@ class PLUGIN_library
|
|||||||
'lib_style.css',
|
'lib_style.css',
|
||||||
'skin/example.css',
|
'skin/example.css',
|
||||||
),
|
),
|
||||||
// For PHP libraries, specify include files here, still relative to the library path.
|
// For PHP libraries, specify include files here, still relative to the library_path.
|
||||||
'php' => array(
|
'php' => array(
|
||||||
'exlib.php',
|
'exlib.php',
|
||||||
'exlib.inc',
|
'exlib.inc',
|
||||||
@@ -176,8 +176,8 @@ class PLUGIN_library
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Your variant callback needs to be in your 'PLUGIN_library' class.
|
// Your variant callback needs to be in your 'PLUGIN_library' class.
|
||||||
'variant callback' => 'example_custom_variant_callback',
|
'variant_callback' => 'example_custom_variant_callback',
|
||||||
'variant arguments' => array(
|
'variant_arguments' => array(
|
||||||
'variant' => 'minified',
|
'variant' => 'minified',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -187,7 +187,7 @@ class PLUGIN_library
|
|||||||
//
|
//
|
||||||
// Note:
|
// Note:
|
||||||
// - When registering 'versions', it usually does not make sense to register 'files', 'variants', and
|
// - When registering 'versions', it usually does not make sense to register 'files', 'variants', and
|
||||||
// 'integration files' on the top-level, as most of those likely need to be different per version and there
|
// 'integration_files' on the top-level, as most of those likely need to be different per version and there
|
||||||
// are no defaults.
|
// are no defaults.
|
||||||
// - The array keys have to be strings, as PHP does not support floats for array keys.
|
// - The array keys have to be strings, as PHP does not support floats for array keys.
|
||||||
'versions' => array(
|
'versions' => array(
|
||||||
@@ -218,7 +218,7 @@ class PLUGIN_library
|
|||||||
),
|
),
|
||||||
// Optional: Register files to auto-load for your plugin. All files must be keyed by plugin, and follow the
|
// Optional: Register files to auto-load for your plugin. All files must be keyed by plugin, and follow the
|
||||||
// syntax of the 'files' property.
|
// syntax of the 'files' property.
|
||||||
'integration files' => array(
|
'integration_files' => array(
|
||||||
'MYPLUGIN' => array(
|
'MYPLUGIN' => array(
|
||||||
'js' => array('ex_lib.inc'),
|
'js' => array('ex_lib.inc'),
|
||||||
),
|
),
|
||||||
@@ -229,9 +229,9 @@ class PLUGIN_library
|
|||||||
// 'e107_web/lib/simple'.
|
// 'e107_web/lib/simple'.
|
||||||
$libraries['simple'] = array(
|
$libraries['simple'] = array(
|
||||||
'name' => 'Simple library',
|
'name' => 'Simple library',
|
||||||
'vendor url' => 'http://example.com/simple',
|
'vendor_url' => 'http://example.com/simple',
|
||||||
'download url' => 'http://example.com/simple',
|
'download_url' => 'http://example.com/simple',
|
||||||
'version arguments' => array(
|
'version_arguments' => array(
|
||||||
'file' => 'readme.txt',
|
'file' => 'readme.txt',
|
||||||
// Best practice: Document the actual version strings for later reference.
|
// Best practice: Document the actual version strings for later reference.
|
||||||
// 1.x: Version 1.0
|
// 1.x: Version 1.0
|
||||||
@@ -251,13 +251,13 @@ class PLUGIN_library
|
|||||||
// A library that (naturally) evolves over time with API changes.
|
// A library that (naturally) evolves over time with API changes.
|
||||||
$libraries['tinymce'] = array(
|
$libraries['tinymce'] = array(
|
||||||
'name' => 'TinyMCE',
|
'name' => 'TinyMCE',
|
||||||
'vendor url' => 'http://tinymce.moxiecode.com',
|
'vendor_url' => 'http://tinymce.moxiecode.com',
|
||||||
'download url' => 'http://tinymce.moxiecode.com/download.php',
|
'download_url' => 'http://tinymce.moxiecode.com/download.php',
|
||||||
'path' => 'jscripts/tiny_mce',
|
'path' => 'jscripts/tiny_mce',
|
||||||
// The regular expression catches two parts (the major and the minor version), which libraryGetVersion()
|
// The regular expression catches two parts (the major and the minor version), which libraryGetVersion()
|
||||||
// doesn't allow.
|
// doesn't allow.
|
||||||
'version callback' => 'tinymce_get_version',
|
'version_callback' => 'tinymce_get_version',
|
||||||
'version arguments' => array(
|
'version_arguments' => array(
|
||||||
// It can be easier to parse the first characters of a minified file instead of doing a multi-line
|
// It can be easier to parse the first characters of a minified file instead of doing a multi-line
|
||||||
// pattern matching in a source file. See 'lines' and 'cols' below.
|
// pattern matching in a source file. See 'lines' and 'cols' below.
|
||||||
'file' => 'jscripts/tiny_mce/tiny_mce.js',
|
'file' => 'jscripts/tiny_mce/tiny_mce.js',
|
||||||
@@ -280,7 +280,7 @@ class PLUGIN_library
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'integration files' => array(
|
'integration_files' => array(
|
||||||
'wysiwyg' => array(
|
'wysiwyg' => array(
|
||||||
'js' => array('editors/js/tinymce-2.js'),
|
'js' => array('editors/js/tinymce-2.js'),
|
||||||
'css' => array('editors/js/tinymce-2.css'),
|
'css' => array('editors/js/tinymce-2.css'),
|
||||||
@@ -311,7 +311,7 @@ class PLUGIN_library
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
'integration files' => array(
|
'integration_files' => array(
|
||||||
'wysiwyg' => array(
|
'wysiwyg' => array(
|
||||||
'js' => array('editors/js/tinymce-3.js'),
|
'js' => array('editors/js/tinymce-3.js'),
|
||||||
'css' => array('editors/js/tinymce-3.css'),
|
'css' => array('editors/js/tinymce-3.css'),
|
||||||
@@ -324,9 +324,9 @@ class PLUGIN_library
|
|||||||
// Example for Facebook PHP SDK v4.
|
// Example for Facebook PHP SDK v4.
|
||||||
$libraries['facebook-php-sdk-v4'] = array(
|
$libraries['facebook-php-sdk-v4'] = array(
|
||||||
'name' => 'Facebook PHP SDK v4',
|
'name' => 'Facebook PHP SDK v4',
|
||||||
'vendor url' => 'https://github.com/facebook/facebook-php-sdk-v4',
|
'vendor_url' => 'https://github.com/facebook/facebook-php-sdk-v4',
|
||||||
'download url' => 'https://github.com/facebook/facebook-php-sdk-v4/archive/4.0.23.tar.gz',
|
'download_url' => 'https://github.com/facebook/facebook-php-sdk-v4/archive/4.0.23.tar.gz',
|
||||||
'version arguments' => array(
|
'version_arguments' => array(
|
||||||
'file' => 'src/Facebook/FacebookRequest.php',
|
'file' => 'src/Facebook/FacebookRequest.php',
|
||||||
// const VERSION = '4.0.23';
|
// const VERSION = '4.0.23';
|
||||||
'pattern' => '/const\s+VERSION\s+=\s+\'(4\.\d\.\d+)\'/',
|
'pattern' => '/const\s+VERSION\s+=\s+\'(4\.\d\.\d+)\'/',
|
||||||
@@ -342,9 +342,9 @@ class PLUGIN_library
|
|||||||
// Example for Facebook PHP SDK v5.
|
// Example for Facebook PHP SDK v5.
|
||||||
$libraries['facebook-php-sdk-v5'] = array(
|
$libraries['facebook-php-sdk-v5'] = array(
|
||||||
'name' => 'Facebook PHP SDK v5',
|
'name' => 'Facebook PHP SDK v5',
|
||||||
'vendor url' => 'https://github.com/facebook/facebook-php-sdk-v4',
|
'vendor_url' => 'https://github.com/facebook/facebook-php-sdk-v4',
|
||||||
'download url' => 'https://github.com/facebook/facebook-php-sdk-v4/archive/5.1.2.tar.gz',
|
'download_url' => 'https://github.com/facebook/facebook-php-sdk-v4/archive/5.1.2.tar.gz',
|
||||||
'version arguments' => array(
|
'version_arguments' => array(
|
||||||
'file' => 'src/Facebook/Facebook.php',
|
'file' => 'src/Facebook/Facebook.php',
|
||||||
// const VERSION = '5.1.2';
|
// const VERSION = '5.1.2';
|
||||||
'pattern' => '/const\s+VERSION\s+=\s+\'(5\.\d\.\d+)\'/',
|
'pattern' => '/const\s+VERSION\s+=\s+\'(5\.\d\.\d+)\'/',
|
||||||
@@ -373,7 +373,7 @@ class PLUGIN_library
|
|||||||
'php' => array('example_plugin.php_spellchecker.inc'),
|
'php' => array('example_plugin.php_spellchecker.inc'),
|
||||||
);
|
);
|
||||||
|
|
||||||
$libraries['php_spellchecker']['integration files']['example_plugin'] = $files;
|
$libraries['php_spellchecker']['integration_files']['example_plugin'] = $files;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user