// it seems kinda dead.
// Not tested.
-// don't raise unnecessary warnings
-if (is_file(PluginManager::$PLUGINS_PATH . '/readityourself/config.php')) {
- include PluginManager::$PLUGINS_PATH . '/readityourself/config.php';
-}
-
-if (empty($GLOBALS['plugins']['READITYOUSELF_URL'])) {
+$conf = ConfigManager::getInstance();
+$riyUrl = $conf->get('plugins.READITYOUSELF_URL');
+if (empty($riyUrl)) {
$GLOBALS['plugin_errors'][] = 'Readityourself plugin error: '.
'Please define "$GLOBALS[\'plugins\'][\'READITYOUSELF_URL\']" '.
'in "plugins/readityourself/config.php" or in your Shaarli config.php file.';
*/
function hook_readityourself_render_linklist($data)
{
- if (!isset($GLOBALS['plugins']['READITYOUSELF_URL'])) {
+ $conf = ConfigManager::getInstance();
+ $riyUrl = $conf->get('plugins.READITYOUSELF_URL');
+ if (empty($riyUrl)) {
return $data;
}
$readityourself_html = file_get_contents(PluginManager::$PLUGINS_PATH . '/readityourself/readityourself.html');
foreach ($data['links'] as &$value) {
- $readityourself = sprintf($readityourself_html, $GLOBALS['plugins']['READITYOUSELF_URL'], $value['url'], PluginManager::$PLUGINS_PATH);
+ $readityourself = sprintf($readityourself_html, $riyUrl, $value['url'], PluginManager::$PLUGINS_PATH);
$value['link_plugin'][] = $readityourself;
}
require_once 'WallabagInstance.php';
-// don't raise unnecessary warnings
-if (is_file(PluginManager::$PLUGINS_PATH . '/wallabag/config.php')) {
- include PluginManager::$PLUGINS_PATH . '/wallabag/config.php';
-}
-
-if (empty($GLOBALS['plugins']['WALLABAG_URL'])) {
+$conf = ConfigManager::getInstance();
+$wallabagUrl = $conf->get('plugins.WALLABAG_URL');
+if (empty($wallabagUrl)) {
$GLOBALS['plugin_errors'][] = 'Wallabag plugin error: '.
'Please define "$GLOBALS[\'plugins\'][\'WALLABAG_URL\']" '.
'in "plugins/wallabag/config.php" or in your Shaarli config.php file.';
*/
function hook_wallabag_render_linklist($data)
{
- if (!isset($GLOBALS['plugins']['WALLABAG_URL'])) {
+ $conf = ConfigManager::getInstance();
+ $wallabagUrl = $conf->get('plugins.WALLABAG_URL');
+ if (empty($wallabagUrl)) {
return $data;
}
- $version = isset($GLOBALS['plugins']['WALLABAG_VERSION'])
- ? $GLOBALS['plugins']['WALLABAG_VERSION']
- : '';
- $wallabagInstance = new WallabagInstance($GLOBALS['plugins']['WALLABAG_URL'], $version);
+ $version = $conf->get('plugins.WALLABAG_VERSION');
+ $wallabagInstance = new WallabagInstance($wallabagUrl, $version);
$wallabagHtml = file_get_contents(PluginManager::$PLUGINS_PATH . '/wallabag/wallabag.html');
*/
function testReadityourselfLinklist()
{
- $GLOBALS['plugins']['READITYOUSELF_URL'] = 'value';
+ $conf = ConfigManager::getInstance();
+ $conf->set('plugins.READITYOUSELF_URL', 'value');
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
*/
function testReadityourselfLinklistWithoutConfig()
{
- unset($GLOBALS['plugins']['READITYOUSELF_URL']);
+ $conf = ConfigManager::getInstance();
+ $conf->set('plugins.READITYOUSELF_URL', null);
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
*/
function testWallabagLinklist()
{
- $GLOBALS['plugins']['WALLABAG_URL'] = 'value';
+ $conf = ConfigManager::getInstance();
+ $conf->set('plugins.WALLABAG_URL', 'value');
$str = 'http://randomstr.com/test';
$data = array(
'title' => $str,
// plugin data
$this->assertEquals(1, count($link['link_plugin']));
$this->assertNotFalse(strpos($link['link_plugin'][0], urlencode($str)));
- $this->assertNotFalse(strpos($link['link_plugin'][0], $GLOBALS['plugins']['WALLABAG_URL']));
+ $this->assertNotFalse(strpos($link['link_plugin'][0], $conf->get('plugins.WALLABAG_URL')));
}
}