@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | |
| 28 | 28 | class Plugins { |
| 29 | 29 | |
| 30 | - public static function listAvailablePluginNames () : array { |
|
| 30 | + public static function listAvailablePluginNames() : array { |
|
| 31 | 31 | $names = array(); |
| 32 | 32 | |
| 33 | 33 | //use directory iterator |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | return $names; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - public static function listInstalledPluginNames () : array { |
|
| 45 | + public static function listInstalledPluginNames() : array { |
|
| 46 | 46 | if (Cache::contains("plugins", "installed_plugin_names")) { |
| 47 | 47 | return Cache::get("plugins", "installed_plugin_names"); |
| 48 | 48 | } else { |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | - public static function listInstalledPlugins () : array { |
|
| 64 | + public static function listInstalledPlugins() : array { |
|
| 65 | 65 | if (Cache::contains("plugins", "installed_plugins")) { |
| 66 | 66 | return Cache::get("plugins", "installed_plugins"); |
| 67 | 67 | } else { |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | } |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - public static function listUninstalledPlugins () : array { |
|
| 90 | + public static function listUninstalledPlugins() : array { |
|
| 91 | 91 | $installed_plugin_names = self::listInstalledPluginNames(); |
| 92 | 92 | |
| 93 | 93 | //create new empty list |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | return $list; |
| 126 | 126 | } |
| 127 | 127 | |
| 128 | - public static function clearCache () { |
|
| 128 | + public static function clearCache() { |
|
| 129 | 129 | Cache::clear("plugins"); |
| 130 | 130 | } |
| 131 | 131 | |
@@ -27,107 +27,107 @@ |
||
| 27 | 27 | |
| 28 | 28 | class Plugins { |
| 29 | 29 | |
| 30 | - public static function listAvailablePluginNames () : array { |
|
| 31 | - $names = array(); |
|
| 30 | + public static function listAvailablePluginNames () : array { |
|
| 31 | + $names = array(); |
|
| 32 | 32 | |
| 33 | - //use directory iterator |
|
| 34 | - $dir = new DirectoryIterator(PLUGIN_PATH); |
|
| 33 | + //use directory iterator |
|
| 34 | + $dir = new DirectoryIterator(PLUGIN_PATH); |
|
| 35 | 35 | |
| 36 | - foreach ($dir as $fileinfo) { |
|
| 37 | - if ($fileinfo->isDir() && !$fileinfo->isDot()) { |
|
| 38 | - $names[] = $fileinfo->getFilename(); |
|
| 39 | - } |
|
| 40 | - } |
|
| 36 | + foreach ($dir as $fileinfo) { |
|
| 37 | + if ($fileinfo->isDir() && !$fileinfo->isDot()) { |
|
| 38 | + $names[] = $fileinfo->getFilename(); |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - return $names; |
|
| 43 | - } |
|
| 42 | + return $names; |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - public static function listInstalledPluginNames () : array { |
|
| 46 | - if (Cache::contains("plugins", "installed_plugin_names")) { |
|
| 47 | - return Cache::get("plugins", "installed_plugin_names"); |
|
| 48 | - } else { |
|
| 49 | - $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugins` WHERE `installed` = '1'; "); |
|
| 45 | + public static function listInstalledPluginNames () : array { |
|
| 46 | + if (Cache::contains("plugins", "installed_plugin_names")) { |
|
| 47 | + return Cache::get("plugins", "installed_plugin_names"); |
|
| 48 | + } else { |
|
| 49 | + $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugins` WHERE `installed` = '1'; "); |
|
| 50 | 50 | |
| 51 | - $array = array(); |
|
| 51 | + $array = array(); |
|
| 52 | 52 | |
| 53 | - foreach ($rows as $row) { |
|
| 54 | - $array[] = $row['name']; |
|
| 55 | - } |
|
| 53 | + foreach ($rows as $row) { |
|
| 54 | + $array[] = $row['name']; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - //cache rows |
|
| 58 | - Cache::put("plugins", "installed_plugin_names", $array); |
|
| 57 | + //cache rows |
|
| 58 | + Cache::put("plugins", "installed_plugin_names", $array); |
|
| 59 | 59 | |
| 60 | - return $array; |
|
| 61 | - } |
|
| 62 | - } |
|
| 60 | + return $array; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - public static function listInstalledPlugins () : array { |
|
| 65 | - if (Cache::contains("plugins", "installed_plugins")) { |
|
| 66 | - return Cache::get("plugins", "installed_plugins"); |
|
| 67 | - } else { |
|
| 68 | - //read installed plugins from database |
|
| 69 | - $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugins` WHERE `installed` = '1'; "); |
|
| 64 | + public static function listInstalledPlugins () : array { |
|
| 65 | + if (Cache::contains("plugins", "installed_plugins")) { |
|
| 66 | + return Cache::get("plugins", "installed_plugins"); |
|
| 67 | + } else { |
|
| 68 | + //read installed plugins from database |
|
| 69 | + $rows = Database::getInstance()->listRows("SELECT * FROM `{praefix}plugins` WHERE `installed` = '1'; "); |
|
| 70 | 70 | |
| 71 | - $plugins = array(); |
|
| 71 | + $plugins = array(); |
|
| 72 | 72 | |
| 73 | - foreach ($rows as $row) { |
|
| 74 | - //create new plugin instance |
|
| 75 | - $plugin = new Plugin($row['name'], $row); |
|
| 73 | + foreach ($rows as $row) { |
|
| 74 | + //create new plugin instance |
|
| 75 | + $plugin = new Plugin($row['name'], $row); |
|
| 76 | 76 | |
| 77 | - //load plugin |
|
| 78 | - $plugin->load(); |
|
| 77 | + //load plugin |
|
| 78 | + $plugin->load(); |
|
| 79 | 79 | |
| 80 | - $plugins[$plugin->getName()] = $plugin; |
|
| 81 | - } |
|
| 80 | + $plugins[$plugin->getName()] = $plugin; |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | - //cache plugins |
|
| 84 | - Cache::put("plugins", "installed_plugins", $plugins); |
|
| 83 | + //cache plugins |
|
| 84 | + Cache::put("plugins", "installed_plugins", $plugins); |
|
| 85 | 85 | |
| 86 | - return $plugins; |
|
| 87 | - } |
|
| 88 | - } |
|
| 86 | + return $plugins; |
|
| 87 | + } |
|
| 88 | + } |
|
| 89 | 89 | |
| 90 | - public static function listUninstalledPlugins () : array { |
|
| 91 | - $installed_plugin_names = self::listInstalledPluginNames(); |
|
| 90 | + public static function listUninstalledPlugins () : array { |
|
| 91 | + $installed_plugin_names = self::listInstalledPluginNames(); |
|
| 92 | 92 | |
| 93 | - //create new empty list |
|
| 94 | - $list = array(); |
|
| 93 | + //create new empty list |
|
| 94 | + $list = array(); |
|
| 95 | 95 | |
| 96 | - $dir = new DirectoryIterator(PLUGIN_PATH); |
|
| 96 | + $dir = new DirectoryIterator(PLUGIN_PATH); |
|
| 97 | 97 | |
| 98 | - foreach ($dir as $fileInfo) { |
|
| 99 | - if ($fileInfo->isDot()) { |
|
| 100 | - //dont parse directory "." |
|
| 101 | - continue; |
|
| 102 | - } |
|
| 98 | + foreach ($dir as $fileInfo) { |
|
| 99 | + if ($fileInfo->isDot()) { |
|
| 100 | + //dont parse directory "." |
|
| 101 | + continue; |
|
| 102 | + } |
|
| 103 | 103 | |
| 104 | - if (!$fileInfo->isDir()) { |
|
| 105 | - //we only search for directories |
|
| 106 | - continue; |
|
| 107 | - } |
|
| 104 | + if (!$fileInfo->isDir()) { |
|
| 105 | + //we only search for directories |
|
| 106 | + continue; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - //get directory name |
|
| 110 | - $name = $fileInfo->getFilename(); |
|
| 109 | + //get directory name |
|
| 110 | + $name = $fileInfo->getFilename(); |
|
| 111 | 111 | |
| 112 | - //check, if plugin is already installed |
|
| 113 | - if (in_array($name, $installed_plugin_names)) { |
|
| 114 | - continue; |
|
| 115 | - } |
|
| 112 | + //check, if plugin is already installed |
|
| 113 | + if (in_array($name, $installed_plugin_names)) { |
|
| 114 | + continue; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - //create and load new plugin |
|
| 118 | - $plugin = new Plugin($name); |
|
| 119 | - $plugin->load(); |
|
| 117 | + //create and load new plugin |
|
| 118 | + $plugin = new Plugin($name); |
|
| 119 | + $plugin->load(); |
|
| 120 | 120 | |
| 121 | - //add plugin to list |
|
| 122 | - $list[] = $plugin; |
|
| 123 | - } |
|
| 121 | + //add plugin to list |
|
| 122 | + $list[] = $plugin; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - return $list; |
|
| 126 | - } |
|
| 125 | + return $list; |
|
| 126 | + } |
|
| 127 | 127 | |
| 128 | - public static function clearCache () { |
|
| 129 | - Cache::clear("plugins"); |
|
| 130 | - } |
|
| 128 | + public static function clearCache () { |
|
| 129 | + Cache::clear("plugins"); |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | } |
| 133 | 133 | |