summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2007-02-26 22:35:01 +0000
committerMax Kremmel <xing@synapse.plus.com>2007-02-26 22:35:01 +0000
commit45e47a27482c3663f5451a61a7aa423aa7bbec3b (patch)
tree8bba6ab82a87cddb300f3aa29a4154a684ceede2
parent2b6f5ec592f373a74d4fde4db5530a806f963b5d (diff)
downloadliberty-45e47a27482c3663f5451a61a7aa423aa7bbec3b.tar.gz
liberty-45e47a27482c3663f5451a61a7aa423aa7bbec3b.tar.bz2
liberty-45e47a27482c3663f5451a61a7aa423aa7bbec3b.zip
add option to limit scanned plugins based on prefix
-rwxr-xr-xLibertySystem.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/LibertySystem.php b/LibertySystem.php
index 64b9f63..334de51 100755
--- a/LibertySystem.php
+++ b/LibertySystem.php
@@ -3,7 +3,7 @@
* System class for handling the liberty package
*
* @package liberty
-* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.61 2007/02/23 12:21:03 squareing Exp $
+* @version $Header: /cvsroot/bitweaver/_bit_liberty/LibertySystem.php,v 1.62 2007/02/26 22:35:01 squareing Exp $
* @author spider <spider@steelsun.com>
*/
@@ -135,9 +135,12 @@ class LibertySystem extends LibertyBase {
* Load all plugins found in specified directory
* Use loadActivePlugins to load only the active plugins
*
- * @return none
- **/
- function scanAllPlugins( $pPluginsPath = NULL ) {
+ * @param string $pPluginsPath Set the path where to scan for plugins
+ * @param string $pPrefixPattern Perl regex for filenames can start with to prevent inclusion of unwanted filenames (e.g. (data\.|storage\.)). Final regex: /^{$pPrefixPattern}.*\.php$/
+ * @access public
+ * @return TRUE on success, FALSE on failure - mErrors will contain reason for failure
+ */
+ function scanAllPlugins( $pPluginsPath = NULL, $pPrefixPattern = NULL ) {
global $gBitSystem;
if( empty( $pPluginsPath ) ) {
$pPluginsPath = $this->mPluginPath;
@@ -145,7 +148,8 @@ class LibertySystem extends LibertyBase {
if( $pluginDir = opendir( $pPluginsPath ) ) {
while( FALSE !== ( $plugin = readdir( $pluginDir ) ) ) {
- if( preg_match( '/\.php$/', $plugin ) ) {
+ $pattern = "/^{$pPrefixPattern}.*\.php$/";
+ if( preg_match( $pattern, $plugin ) ) {
$this->mPluginFileName = basename( $plugin );
include_once( $pPluginsPath.$plugin );
}