*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
/**
* Class helper_plugin_extension_extension represents a single extension (plugin or template)
*/
class helper_plugin_extension_list extends DokuWiki_Plugin {
protected $form = '';
function start_form() {
$this->form .= '
';
}
/**
* Print the form
*/
function render() {
echo $this->form;
}
/**
* Start the HTML for the row for the extension
*
* @param helper_plugin_extension_extension $extension The extension
*/
private function start_row(helper_plugin_extension_extension $extension) {
$this->form .= '
';
}
/**
* Add a column with the given class and content
* @param string $class The class name
* @param string $html The content
*/
private function populate_column($class, $html) {
$this->form .= '
'.$html.'
';
}
/**
* End the row
*/
private function end_row() {
$this->form .= '
'.DOKU_LF;
}
/**
* Generate the link to the plugin homepage
*
* @param helper_plugin_extension_extension $extension The extension
* @return string The HTML code
*/
function make_homepagelink(helper_plugin_extension_extension $extension) {
$text = $this->getLang('homepage_link');
$url = hsc($extension->getURL());
return ''.$text.' ';
}
/**
* Generate the class name for the row of the extensio
*
* @param helper_plugin_extension_extension $extension The extension object
* @return string The class name
*/
function make_class(helper_plugin_extension_extension $extension) {
$class = ($extension->isTemplate()) ? 'template' : 'plugin';
if($extension->isInstalled()) {
$class.=' installed';
$class.= ($extension->isEnabled()) ? ' enabled':' disabled';
}
if(!$extension->canModify()) $class.= ' notselect';
if($extension->isProtected()) $class.= ' protected';
//if($this->showinfo) $class.= ' showinfo';
return $class;
}
/**
* Generate a link to the author of the extension
*
* @param helper_plugin_extension_extension $extension The extension object
* @return string The HTML code of the link
*/
function make_author(helper_plugin_extension_extension $extension) {
global $ID;
if($extension->getAuthor()) {
$params = array(
'do'=>'admin',
'page'=>'extension',
'tab'=>'search',
'q'=>'author:'.$extension->getAuthor()
);
$url = wl($ID, $params);
return ''.hsc($extension->getAuthor()).'';
}
return "".$this->getLang('unknown_author')."";
}
/**
* Get the link and image tag for the screenshot/thumbnail
*
* @param helper_plugin_extension_extension $extension The extension object
* @return string The HTML code
*/
function make_screenshot(helper_plugin_extension_extension $extension) {
if($extension->getScreenshotURL()) {
$img = ''.
''.
'';
} elseif($extension->isTemplate()) {
$img = '';
} else {
$img = '';
}
return '
'.$img.'
';
}
/**
* Extension main description
*
* @param helper_plugin_extension_extension $extension The extension object
* @param bool $showinfo Show the info section
* @return string The HTML code
*/
function make_legend(helper_plugin_extension_extension $extension, $showinfo = false) {
$return = '