*/
// must be run within Dokuwiki
if(!defined('DOKU_INC')) die();
/**
* Class helper_plugin_extension_list takes care of creating a HTML list of extensions
*/
class helper_plugin_extension_list extends DokuWiki_Plugin {
protected $form = '';
/** @var helper_plugin_extension_gui */
protected $gui;
/**
* Constructor
*
* loads additional helpers
*/
public function __construct(){
$this->gui = plugin_load('helper', 'extension_gui');
}
function start_form() {
$this->form .= '
'.DOKU_LF;
}
/**
* Show message when no results are found
*/
function nothing_found() {
global $lang;
$this->form .= '
'.$lang['nothingfound'].'
';
}
/**
* 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.'
'.DOKU_LF;
}
/**
* 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->updateAvailable()) $class .= ' updatable';
}
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()) {
$mailid = $extension->getEmailID();
if($mailid){
$url = $this->gui->tabURL('search', array('q' => 'authorid:'.$mailid));
return ' '.hsc($extension->getAuthor()).'';
}else{
return ''.hsc($extension->getAuthor()).'';
}
}
return "".$this->getLang('unknown_author')."".DOKU_LF;
}
/**
* 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) {
$screen = $extension->getScreenshotURL();
$thumb = $extension->getThumbnailURL();
if($screen) {
// use protocol independent URLs for images coming from us #595
$screen = str_replace('http://www.dokuwiki.org', '//www.dokuwiki.org', $screen);
$thumb = str_replace('http://www.dokuwiki.org', '//www.dokuwiki.org', $thumb);
$title = sprintf($this->getLang('screenshot'), hsc($extension->getDisplayName()));
$img = ''.
''.
'';
} elseif($extension->isTemplate()) {
$img = '';
} else {
$img = '';
}
return '
'.$img.'
'.DOKU_LF;
}
/**
* 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 = '
'.DOKU_LF;
return $return;
}
/**
* Generate the link bar HTML code
*
* @param helper_plugin_extension_extension $extension The extension instance
* @return string The HTML code
*/
function make_linkbar(helper_plugin_extension_extension $extension) {
$return = '