public function testPrepareLanguagePlaceholderTranslateLanguageNS()
 {
     global $conf;
     global $ID;
     $conf['plugin']['translation']['translations'] = 'de';
     $ID = 'de:bla';
     plugin_enable('translation');
     $translation = plugin_load('helper', 'translation');
     if (null === $translation) {
         return;
     }
     $action = $this->getTemplateClass();
     $action->prepareLanguagePlaceholder();
     $this->assertEquals('en', $action->values['__lang__']);
     $this->assertEquals('/@LANG@/', $action->patterns['__lang__']);
     $this->assertEquals('de', $action->values['__trans__']);
     $this->assertEquals('/@TRANS@/', $action->patterns['__trans__']);
 }
 function process()
 {
     global $plugin_protected;
     global $INPUT;
     $count_enabled = $count_disabled = 0;
     $this->enabled = $INPUT->arr('enabled');
     foreach ($this->manager->plugin_list as $plugin) {
         if (in_array($plugin, $plugin_protected)) {
             continue;
         }
         $new = in_array($plugin, $this->enabled);
         $old = !plugin_isdisabled($plugin);
         if ($new != $old) {
             switch ($new) {
                 // enable plugin
                 case true:
                     if (plugin_enable($plugin)) {
                         msg(sprintf($this->lang['enabled'], $plugin), 1);
                         $count_enabled++;
                     } else {
                         msg(sprintf($this->lang['notenabled'], $plugin), -1);
                     }
                     break;
                 case false:
                     if (plugin_disable($plugin)) {
                         msg(sprintf($this->lang['disabled'], $plugin), 1);
                         $count_disabled++;
                     } else {
                         msg(sprintf($this->lang['notdisabled'], $plugin), -1);
                     }
                     break;
             }
         }
     }
     // refresh plugins, including expiring any dokuwiki cache(s)
     if ($count_enabled || $count_disabled) {
         $this->refresh();
     }
 }
Esempio n. 3
0
 public function testMakeTranslationReplacement()
 {
     $helper = new helper_plugin_data();
     $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
     $this->assertEquals('', $helper->makeTranslationReplacement('%trans%'));
     if (plugin_enable('translation')) {
         global $conf;
         global $ID;
         $conf['plugin']['translation']['translations'] = 'de';
         $ID = 'de:somepage';
         $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
         $this->assertEquals('de', $helper->makeTranslationReplacement('%trans%'));
     }
 }
 public function testMakeTranslationReplacement()
 {
     $helper = new helper_plugin_data();
     $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
     $this->assertEquals('', $helper->makeTranslationReplacement('%trans%'));
     $plugininstalled = in_array('translation', plugin_list('helper', $all = true));
     if (!$plugininstalled) {
         $this->markTestSkipped('Pre-condition not satisfied: translation plugin must be installed');
     }
     if ($plugininstalled && plugin_enable('translation')) {
         global $conf;
         global $ID;
         $conf['plugin']['translation']['translations'] = 'de';
         $ID = 'de:somepage';
         $this->assertEquals('en', $helper->makeTranslationReplacement('%lang%'));
         $this->assertEquals('de', $helper->makeTranslationReplacement('%trans%'));
     }
 }