Library Aware
From LordMattWiki
Library Aware is a subset of Extend Aware.
To share a library has always ben a hope for plugin designers up and down the world or plugins.
To allow a plugin to call a libaray into existance for all use this method (suggested by moraes)
Add a universal include path at the very top.
<?php set_include_path(get_include_path() . PATH_SEPARATOR . $DIR_PLUGINS . 'lib');
However this on it's own is not enough as a plugin needs to be able to detect the presence of required libs. To do this a plugin must respond to the handshake
'REQUIRE' == 'LIBRARY NAME'
with the flag
'LIBRARY NAME' == 'TRUE'
In addition it would be as well to specify auto discovery of installed libraries via the handshake
'SEEK' == 'LIBRARY'
by pushing 'name_of_lib' onto the array $library()
This would allow advanced plugins to select the use of plugins based on thier existance (or lace thereof).
To be fully Extend Aware a plugin must not tie up the handshake event by needlessly chattering and so should attempt to cache the results of
'SEEK' == 'LIBRARY'
untill plugin install/uninstall events are triggered or untill a user prompt to refresh is called.
Summary of Library Aware requiremens
- Use set_include_path
- Respond to 'REQUIRE' == 'LIBRARY NAME'
- Test for needed library(s) with same
- Comply with the 'SEEK' == 'LIBRARY' requirements for request and respond
