/** * プラグイン XML から削除 * * @return void */ function lfRemoveFromPluginsXml($path) { $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); for ($i = 0; $i <= count($pluginsXml->plugin) - 1; $i++) { if ((string) $pluginsXml->plugin[$i]->path == $path) { unset($pluginsXml->plugin[$i]); } } SC_Utils_Ex::sfPutPluginsXml($pluginsXml); }
* of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // load plugins /* ----------------------------------------------------------------------------- * TODO PHP4 でも使えるように, XML パーサーをファクトリークラスで実装する * ----------------------------------------------------------------------------*/ define('DEBUG_LOAD_PLUGIN', true); if (version_compare("5", PHP_VERSION, "<")) { $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); foreach ($pluginsXml->plugin as $plugin) { $requireFile = PLUGIN_REALDIR . "{$plugin->path}/require.php"; if (file_exists($requireFile)) { include_once $requireFile; } } // Smarty に引き渡す目的 // FIXME スーパーグローバルを書き換える以外の方法に改める。(グローバル変数にセットして、Smrty 関数で読み出すなど) $_ENV['pluginsXml'] = $pluginsXml; // グローバル変数を掃除 unset($plugin); unset($pluginsXml); }
/** * プラグイン XML に追加 * * @return void */ function lfAddToPluginsXml($path) { $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); $addPluginXml = $pluginsXml->addChild('plugin'); $addPluginXml->addChild('path', $path); $arrPluginInfo = SC_Utils_Ex::sfGetPluginInfoArray($path); $addPluginXml->addChild('name', $arrPluginInfo['name']); SC_Utils_Ex::sfPutPluginsXml($pluginsXml); }
/** * プラグインの一覧を読み込む * * @return void */ function loadPluginsList() { $plugins = array(); $this->arrInstalledPlugin = array(); $this->arrInstallablePlugin = array(); $d = dir(PLUGIN_REALDIR); while (false !== ($entry = $d->read())) { if ($entry == '.') { continue; } if ($entry == '..') { continue; } if (!is_dir($d->path . $entry)) { continue; } $plugins[$entry]['dir_exists'] = true; } $d->close(); $pluginsXml = SC_Utils_Ex::sfGetPluginsXml(); foreach ($pluginsXml->plugin as $plugin) { $plugins[(string) $plugin->path]['installed'] = true; } foreach ($plugins as $path => $plugin) { $plugin['info'] = SC_Utils_Ex::sfGetPluginInfoArray($path); $plugin['path'] = $path; if ($plugin['installed']) { $this->arrInstalledPlugin[] = $plugin; } else { $this->arrInstallablePlugin[] = $plugin; } } }