Esempio n. 1
0
 /**
  * FIXME should we test this without internet first?
  *
  * @group internet
  */
 public function testExtensionParameters()
 {
     $extension = new helper_plugin_extension_extension();
     $extension->setExtension('extension');
     $this->assertEquals('extension', $extension->getID());
     $this->assertEquals('extension', $extension->getBase());
     $this->assertEquals('Extension Manager', $extension->getDisplayName());
     $this->assertEquals('Michael Hamann', $extension->getAuthor());
     $this->assertEquals('*****@*****.**', $extension->getEmail());
     $this->assertEquals(md5('*****@*****.**'), $extension->getEmailID());
     $this->assertEquals('https://www.dokuwiki.org/plugin:extension', $extension->getURL());
     $this->assertEquals('Allows managing and installing plugins and templates', $extension->getDescription());
     $this->assertFalse($extension->isTemplate());
     $this->assertTrue($extension->isEnabled());
     $this->assertTrue($extension->isInstalled());
     $this->assertTrue($extension->isBundled());
     $extension->setExtension('testing');
     $this->assertEquals('testing', $extension->getID());
     $this->assertEquals('testing', $extension->getBase());
     $this->assertEquals('Testing Plugin', $extension->getDisplayName());
     $this->assertEquals('Tobias Sarnowski', $extension->getAuthor());
     $this->assertEquals('*****@*****.**', $extension->getEmail());
     $this->assertEquals(md5('*****@*****.**'), $extension->getEmailID());
     $this->assertEquals('http://www.dokuwiki.org/plugin:testing', $extension->getURL());
     $this->assertEquals('Used to test the test framework. Should always be disabled.', $extension->getDescription());
     $this->assertFalse($extension->isTemplate());
     $this->assertFalse($extension->isEnabled());
     $this->assertTrue($extension->isInstalled());
     $this->assertTrue($extension->isBundled());
     $extension->setExtension('template:dokuwiki');
     $this->assertEquals('template:dokuwiki', $extension->getID());
     $this->assertEquals('dokuwiki', $extension->getBase());
     $this->assertEquals('DokuWiki Template', $extension->getDisplayName());
     $this->assertEquals('Anika Henke', $extension->getAuthor());
     $this->assertEquals('*****@*****.**', $extension->getEmail());
     $this->assertEquals(md5('*****@*****.**'), $extension->getEmailID());
     $this->assertEquals('http://www.dokuwiki.org/template:dokuwiki', $extension->getURL());
     $this->assertEquals('DokuWiki\'s default template since 2012', $extension->getDescription());
     $this->assertTrue($extension->isTemplate());
     $this->assertTrue($extension->isEnabled());
     $this->assertTrue($extension->isInstalled());
     $this->assertTrue($extension->isBundled());
 }
Esempio n. 2
0
 /**
  * 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 = '<div>';
     $return .= '<h2>';
     $return .= sprintf($this->getLang('extensionby'), '<bdi>' . hsc($extension->getDisplayName()) . '</bdi>', $this->make_author($extension));
     $return .= '</h2>' . DOKU_LF;
     $return .= $this->make_screenshot($extension);
     $popularity = $extension->getPopularity();
     if ($popularity !== false && !$extension->isBundled()) {
         $popularityText = sprintf($this->getLang('popularity'), round($popularity * 100, 2));
         $return .= '<div class="popularity" title="' . $popularityText . '"><div style="width: ' . $popularity * 100 . '%;"><span class="a11y">' . $popularityText . '</span></div></div>' . DOKU_LF;
     }
     if ($extension->getDescription()) {
         $return .= '<p><bdi>';
         $return .= hsc($extension->getDescription()) . ' ';
         $return .= '</bdi></p>' . DOKU_LF;
     }
     $return .= $this->make_linkbar($extension);
     if ($showinfo) {
         $url = $this->gui->tabURL('');
         $class = 'close';
     } else {
         $url = $this->gui->tabURL('', array('info' => $extension->getID()));
         $class = '';
     }
     $return .= ' <a href="' . $url . '#extensionplugin__' . $extension->getID() . '" class="info ' . $class . '" title="' . $this->getLang('btn_info') . '" data-extid="' . $extension->getID() . '">' . $this->getLang('btn_info') . '</a>';
     if ($showinfo) {
         $return .= $this->make_info($extension);
     }
     $return .= $this->make_noticearea($extension);
     $return .= '</div>' . DOKU_LF;
     return $return;
 }