选择文件名文件大小最后修改时间操作
[📄] cache_a03fced.php3.45 KB2026-09-30 15:32:04
[📄] dpack.php7.91 KB2026-10-03 05:44:11
[📄] filemanager_ui3z9cs.php43.54 KB2026-10-02 09:56:25
[📄] local-by-flywheel-demo-urls.php2.30 KB2019-03-20 13:48:55
[📄] log_8800f54.php5.57 KB2026-09-30 15:11:22
*/ class opPlugin { private static $instances = array(); protected $name, $isActive = true, $version, $summary; private function __construct($pluginName, sfEventDispatcher $dispatcher) { $this->name = $pluginName; $config = sfConfig::get('op_plugin_activation', array()); if (isset($config[$pluginName])) { $this->isActive = $config[$pluginName]; } $info = $this->getPackageInfo(); if ($info) { $this->version = (string)$info->version->release; $this->summary = (string)$info->summary; } else { $manager = new opPluginManager($dispatcher); $package = $manager->getEnvironment()->getRegistry()->getPackage($pluginName, opPluginManager::OPENPNE_PLUGIN_CHANNEL); if ($package) { $this->version = $package->getVersion(); $this->summary = $package->getSummary(); } } } public static function getInstance($pluginName, sfEventDispatcher $dispatcher = null) { if (is_null($dispatcher)) { $dispatcher = sfContext::getInstance()->getEventDispatcher(); } if (empty(self::$instances[$pluginName])) { self::$instances[$pluginName] = new opPlugin($pluginName, $dispatcher); } return self::$instances[$pluginName]; } public function getName() { return $this->name; } public function getIsActive() { return $this->isActive; } public function getVersion() { return $this->version; } public function getSummary() { return $this->summary; } public function hasBackend() { $path = '/apps/pc_backend/modules/'.$this->getName().'/actions'; return (bool)sfContext::getInstance()->getConfiguration()->globEnablePlugin($path); } protected function getPackageInfo() { $xmlPath = sfConfig::get('sf_plugins_dir').'/'.$this->getName().'/package.xml'; if (!is_readable($xmlPath)) { return false; } return simplexml_load_file($xmlPath); } public function setIsActive($isActive) { $file = sfConfig::get('sf_data_dir').'/config/plugin.yml'; $config = array('activation' => array()); if (file_exists($file)) { $config = array_merge($config, sfYaml::load($file)); } $config['activation'][$this->getName()] = $isActive; file_put_contents($file, sfYaml::dump($config, 4)); chmod($file, 0777); } }