public function showLicense() { $pluginName = Common::getRequestVar('pluginName', null, 'string'); $metadata = new Plugin\MetadataLoader($pluginName); $license_file = $metadata->getPathToLicenseFile(); $license = 'No license file found for this plugin.'; if (!empty($license_file)) { $license = file_get_contents($license_file); $license = nl2br($license); } $view = $this->configureView('@CorePluginsAdmin/license'); $view->pluginName = $pluginName; $view->license = $license; return $view->render(); }
/** * Constructor. * * @param string|bool $pluginName A plugin name to force. If not supplied, it is set * to the last part of the class name. * @throws \Exception If plugin metadata is defined in both the getInformation() method * and the **plugin.json** file. */ public function __construct($pluginName = false) { if (empty($pluginName)) { $pluginName = explode('\\', get_class($this)); $pluginName = end($pluginName); } $this->pluginName = $pluginName; $metadataLoader = new MetadataLoader($pluginName); $this->pluginInformation = $metadataLoader->load(); if ($this->hasDefinedPluginInformationInPluginClass() && $metadataLoader->hasPluginJson()) { throw new \Exception('Plugin ' . $pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/' . $pluginName); } $this->cache = new PersistentCache('Plugin' . $pluginName); }
public function reloadPluginInformation() { $metadataLoader = new MetadataLoader($this->pluginName); $this->pluginInformation = $metadataLoader->load(); if ($this->hasDefinedPluginInformationInPluginClass() && $metadataLoader->hasPluginJson()) { throw new \Exception('Plugin ' . $this->pluginName . ' has defined the method getInformation() and as well as having a plugin.json file. Please delete the getInformation() method from the plugin class. Alternatively, you may delete the plugin directory from plugins/' . $this->pluginName); } }