function getAvailablePlugins($sFilter = '')
{
    # First list all plugin folders
    $aPlugins = array();
    if ($dh = opendir(PLUGINS_DIR)) {
        while (($sEntry = readdir($dh)) !== false) {
            if (is_dir(PLUGINS_DIR . $sEntry) && substr($sEntry, 0, 1) != '.') {
                $aPlugins[$sEntry] = array();
            }
        }
        closedir($dh);
    }
    # Then get the plugin info's from their plugin.xml files
    $oPlugin = new PluginInfo();
    foreach ($aPlugins as $key => $value) {
        $oPlugin->pluginName($key);
        # If a filter is specified, filter out the plugins without those tags
        if (strlen($sFilter)) {
            if ($oPlugin->checkTags($sFilter)) {
                $aPlugins[$key] = $oPlugin->getInfo();
            } else {
                unset($aPlugins[$key]);
            }
        } else {
            $aPlugins[$key] = $oPlugin->getInfo();
        }
    }
    return $aPlugins;
}
示例#2
0
 function testPluginDescriptor()
 {
     $p = new MockPlugin($this);
     $pi = new PluginInfo($p);
     $pd = $pi->getPluginDescriptor();
     $this->assertIsA($pd, 'PluginDescriptor');
     $this->assertEqual($pd->getFullName(), '');
     $this->assertEqual($pd->getVersion(), '');
     $this->assertEqual($pd->getDescription(), '');
     $pi->setPluginDescriptor(new PluginDescriptor('TestPlugin', 'v1.0', 'A simple plugin, just for unit testing'));
     $pd = $pi->getPluginDescriptor();
     $this->assertEqual($pd->getFullName(), 'TestPlugin');
     $this->assertEqual($pd->getVersion(), 'v1.0');
     $this->assertEqual($pd->getDescription(), 'A simple plugin, just for unit testing');
 }
 /**
  * Constructor
  *
  * @param Plugin $plugin  The plugin on which PluginInfo applies
  * @param String $incname Name of the '.inc' file in plugin 'etc' directory
  */
 function __construct(Plugin $plugin, $incname)
 {
     parent::__construct($plugin);
     $this->conf_path = $plugin->getPluginEtcRoot() . '/' . $incname . '.inc';
     $this->default_conf_path = $this->getDefaultConfPath($plugin, $incname);
     $this->loadProperties();
 }
示例#4
0
 function __construct($plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new ForumMLPluginDescriptor());
     $this->_conf_path = $plugin->getPluginEtcRoot() . '/forumml.inc';
     $this->loadProperties();
 }
 /**
  * Create a new instance of PluginUpdate from its JSON-encoded representation.
  * 
  * @param string $json
  * @param bool $triggerErrors
  * @return PluginUpdate|null
  */
 public static function fromJson($json, $triggerErrors = false)
 {
     //Since update-related information is simply a subset of the full plugin info,
     //we can parse the update JSON as if it was a plugin info string, then copy over
     //the parts that we care about.
     $pluginInfo = PluginInfo::fromJson($json, $triggerErrors);
     if ($pluginInfo != null) {
         return PluginUpdate::fromPluginInfo($pluginInfo);
     } else {
         return null;
     }
 }
 function __construct($plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new AgileDashboardPluginDescriptor());
 }
 public function __construct($plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new OpenIDConnectClientPluginDescriptor());
 }
 function __construct($plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new OpenidPluginDescriptor());
 }
 /**
  * Retrieve plugin info from the configured API endpoint.
  * 
  * @uses wp_remote_get()
  * 
  * @param array $queryArgs Additional query arguments to append to the request. Optional.
  * @return PluginInfo
  */
 function requestInfo($queryArgs = array())
 {
     //Query args to append to the URL. Plugins can add their own by using a filter callback (see addQueryArgFilter()).
     $queryArgs['installed_version'] = $this->getInstalledVersion();
     $queryArgs = apply_filters('puc_request_info_query_args-' . $this->slug, $queryArgs);
     //Various options for the wp_remote_get() call. Plugins can filter these, too.
     $options = array('timeout' => 10, 'headers' => array('Accept' => 'application/json'));
     $options = apply_filters('puc_request_info_options-' . $this->slug, array());
     //The plugin info should be at 'http://your-api.com/url/here/$slug/info.json'
     $url = $this->metadataUrl;
     if (!empty($queryArgs)) {
         $url = add_query_arg($queryArgs, $url);
     }
     $result = wp_remote_get($url, $options);
     //Try to parse the response
     $pluginInfo = null;
     if (!is_wp_error($result) && isset($result['response']['code']) && $result['response']['code'] == 200 && !empty($result['body'])) {
         $pluginInfo = PluginInfo::fromJson($result['body']);
     }
     $pluginInfo = apply_filters('puc_request_info_result-' . $this->slug, $pluginInfo, $result);
     return $pluginInfo;
 }
 public function __construct(Plugin $plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new AdminDelegationPluginDescriptor());
 }
 public function __construct($plugin)
 {
     parent::__construct($plugin);
     $this->setPluginDescriptor(new PHPWikiPluginDescriptor());
 }