diff options
author | Andreas Gohr <andi@splitbrain.org> | 2013-08-09 14:06:34 +0200 |
---|---|---|
committer | Andreas Gohr <andi@splitbrain.org> | 2013-08-09 14:06:34 +0200 |
commit | 813d7e0910cdbb80dceef4d952adc551987c84e7 (patch) | |
tree | 5f2d9dc48539286729f596bcc504c741c46c57cd /lib/plugins/extension | |
parent | 55332151e03b99bbfd15e0fbaae391aae454d9eb (diff) | |
download | rpg-813d7e0910cdbb80dceef4d952adc551987c84e7.tar.gz rpg-813d7e0910cdbb80dceef4d952adc551987c84e7.tar.bz2 |
fixed some confusion between base, id and name
Diffstat (limited to 'lib/plugins/extension')
-rw-r--r-- | lib/plugins/extension/admin.php | 8 | ||||
-rw-r--r-- | lib/plugins/extension/helper/extension.php | 40 | ||||
-rw-r--r-- | lib/plugins/extension/helper/list.php | 8 | ||||
-rw-r--r-- | lib/plugins/extension/helper/repository.php | 6 |
4 files changed, 29 insertions, 33 deletions
diff --git a/lib/plugins/extension/admin.php b/lib/plugins/extension/admin.php index 51d4a8d1d..7faed142d 100644 --- a/lib/plugins/extension/admin.php +++ b/lib/plugins/extension/admin.php @@ -76,7 +76,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin { if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_update_success'), hsc($extension->getName())), 1); + msg(sprintf($this->getLang('msg_update_success'), hsc($extension->getDisplayName())), 1); } break; case 'uninstall': @@ -85,7 +85,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin { if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_delete_success'), hsc($extension->getName())), 1); + msg(sprintf($this->getLang('msg_delete_success'), hsc($extension->getDisplayName())), 1); } break; case 'enable'; @@ -94,7 +94,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin { if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_enabled'), hsc($extension->getName())), 1); + msg(sprintf($this->getLang('msg_enabled'), hsc($extension->getDisplayName())), 1); } break; case 'disable'; @@ -103,7 +103,7 @@ class admin_plugin_extension extends DokuWiki_Admin_Plugin { if ($status !== true) { msg($status, -1); } else { - msg(sprintf($this->getLang('msg_disabled'), hsc($extension->getName())), 1); + msg(sprintf($this->getLang('msg_disabled'), hsc($extension->getDisplayName())), 1); } break; } diff --git a/lib/plugins/extension/helper/extension.php b/lib/plugins/extension/helper/extension.php index 53753fcc1..6a152b169 100644 --- a/lib/plugins/extension/helper/extension.php +++ b/lib/plugins/extension/helper/extension.php @@ -15,7 +15,7 @@ if(!defined('DOKU_TPLLIB')) define('DOKU_TPLLIB', DOKU_INC.'lib/tpl/'); */ class helper_plugin_extension_extension extends DokuWiki_Plugin { private $id; - private $name; + private $base; private $is_template = false; private $localInfo; private $remoteInfo; @@ -38,10 +38,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function setExtension($id) { $this->id = $id; - $this->name = $id; + $this->base = $id; - if(substr($id, 0 , 9) == 'template'){ - $this->name = substr($id, 10); + if(substr($id, 0 , 9) == 'template:'){ + $this->base = substr($id, 9); $this->is_template = true; } @@ -58,7 +58,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { $this->repository = $this->loadHelper('extension_repository'); } - $this->remoteInfo = $this->repository->getData(($this->isTemplate() ? 'template:' : '').$this->getBase()); + $this->remoteInfo = $this->repository->getData($this->getID()); return ($this->localInfo || $this->remoteInfo); } @@ -79,7 +79,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function isBundled() { if (!empty($this->remoteInfo['bundled'])) return $this->remoteInfo['bundled']; - return in_array($this->name, + return in_array($this->base, array('acl', 'info', 'extension', 'test', 'revert', 'popularity', 'config', 'plugin', 'safefnrecode', 'authplain')); } @@ -89,7 +89,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * @return bool if the extension is protected */ public function isProtected() { - return in_array($this->name, array('acl', 'config', 'info', 'plugin', 'revert', 'usermanager')); + return in_array($this->base, array('acl', 'config', 'info', 'plugin', 'revert', 'usermanager')); } /** @@ -98,7 +98,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * @return bool If the extension is installed in the correct directory */ public function isInWrongFolder() { - return $this->name != $this->getBase(); + return $this->base != $this->getBase(); } /** @@ -109,7 +109,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { public function isEnabled() { /* @var Doku_Plugin_Controller $plugin_controller */ global $plugin_controller; - return !$plugin_controller->isdisabled($this->name); + return !$plugin_controller->isdisabled($this->base); } /** @@ -151,7 +151,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * @return string The name of the installation directory */ public function getInstallName() { - return $this->name; + return $this->base; } // Data from plugin.info.txt/template.info.txt or the repo when not available locally @@ -162,7 +162,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function getBase() { if (!empty($this->localInfo['base'])) return $this->localInfo['base']; - return $this->name; + return $this->base; } /** @@ -170,10 +170,10 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { * * @return string The display name */ - public function getName() { + public function getDisplayName() { if (!empty($this->localInfo['name'])) return $this->localInfo['name']; if (!empty($this->remoteInfo['name'])) return $this->remoteInfo['name']; - return $this->name; + return $this->base; } /** @@ -468,9 +468,9 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { */ public function getInstallDir() { if ($this->isTemplate()) { - return DOKU_TPLLIB.$this->name; + return DOKU_TPLLIB.$this->base; } else { - return DOKU_PLUGIN.$this->name; + return DOKU_PLUGIN.$this->base; } } @@ -518,7 +518,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { if (!isset($installed_extensions[$this->getBase()])) { $status = 'Error, the requested extension hasn\'t been installed or updated'; } - $this->setExtension($this->name, $this->isTemplate()); + $this->setExtension($this->getID()); $this->purgeCache(); } $this->dir_delete(dirname($path)); @@ -547,7 +547,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { global $plugin_controller; if (!$this->isInstalled()) return $this->getLang('notinstalled'); if ($this->isEnabled()) return $this->getLang('alreadyenabled'); - if ($plugin_controller->enable($this->name)) { + if ($plugin_controller->enable($this->base)) { $this->purgeCache(); return true; } else { @@ -567,7 +567,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { global $plugin_controller; if (!$this->isInstalled()) return $this->getLang('notinstalled'); if (!$this->isEnabled()) return $this->getLang('alreadydisabled'); - if ($plugin_controller->disable($this->name)) { + if ($plugin_controller->disable($this->base)) { $this->purgeCache(); return true; } else { @@ -605,7 +605,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { foreach($plugin_types as $type) { if(@file_exists($path.$type.'.php')) { - $plugin = plugin_load($type, $this->name); + $plugin = plugin_load($type, $this->base); if ($plugin) break; } @@ -613,7 +613,7 @@ class helper_plugin_extension_extension extends DokuWiki_Plugin { while(false !== ($cp = readdir($dh))) { if($cp == '.' || $cp == '..' || strtolower(substr($cp, -4)) != '.php') continue; - $plugin = plugin_load($type, $this->name.'_'.substr($cp, 0, -4)); + $plugin = plugin_load($type, $this->base.'_'.substr($cp, 0, -4)); if ($plugin) break; } if ($plugin) break; diff --git a/lib/plugins/extension/helper/list.php b/lib/plugins/extension/helper/list.php index 843697667..12db5ea3c 100644 --- a/lib/plugins/extension/helper/list.php +++ b/lib/plugins/extension/helper/list.php @@ -163,7 +163,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { $mailid = $extension->getEmailID(); if($mailid){ - $url = $this->gui->tabURL('search', array('q' => 'mailid:'.$mailid)); + $url = $this->gui->tabURL('search', array('q' => 'authorid:'.$mailid)); return '<a href="'.$url.'" class="author" title="'.$this->getLang('author_hint').'" ><img src="//www.gravatar.com/avatar/'.$mailid.'?s=20&d=mm" width="20" height="20"> '.hsc($extension->getAuthor()).'</a>'; }else{ @@ -181,8 +181,8 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { */ function make_screenshot(helper_plugin_extension_extension $extension) { if($extension->getScreenshotURL()) { - $img = '<a title="'.hsc($extension->getName()).'" href="'.hsc($extension->getScreenshotURL()).'" target="_blank">'. - '<img alt="'.hsc($extension->getName()).'" width="120" height="70" src="'.hsc($extension->getThumbnailURL()).'" />'. + $img = '<a title="'.hsc($extension->getDisplayName()).'" href="'.hsc($extension->getScreenshotURL()).'" target="_blank">'. + '<img alt="'.hsc($extension->getDisplayName()).'" width="120" height="70" src="'.hsc($extension->getThumbnailURL()).'" />'. '</a>'; } elseif($extension->isTemplate()) { $img = '<img alt="template" width="120" height="70" src="'.DOKU_BASE.'lib/plugins/extension/images/template.png" />'; @@ -203,7 +203,7 @@ class helper_plugin_extension_list extends DokuWiki_Plugin { function make_legend(helper_plugin_extension_extension $extension, $showinfo = false) { $return = '<div>'; $return .= '<h2>'; - $return .= sprintf($this->getLang('extensionby'), hsc($extension->getName()), $this->make_author($extension)); + $return .= sprintf($this->getLang('extensionby'), hsc($extension->getDisplayName()), $this->make_author($extension)); $return .= '</h2>'; $return .= $this->make_screenshot($extension); diff --git a/lib/plugins/extension/helper/repository.php b/lib/plugins/extension/helper/repository.php index 98128a9a3..38e07786e 100644 --- a/lib/plugins/extension/helper/repository.php +++ b/lib/plugins/extension/helper/repository.php @@ -110,10 +110,6 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { return array(); } - protected function cacheData($name, $data){ - - } - /** * Search for plugins or templates using the given query string * @@ -133,7 +129,7 @@ class helper_plugin_extension_repository extends DokuWiki_Plugin { // store cache info for each extension foreach($result as $ext){ - $name = $ext['name']; + $name = $ext['plugin']; $cache = new cache('##extension_manager##'.$name, 'repo'); $cache->storeCache(serialize($ext)); $ids[] = $name; |