1*7d101cc1SGerry Weißbach<?php 2*7d101cc1SGerry Weißbach/** 3*7d101cc1SGerry Weißbach * Translation Plugin: Simple multilanguage plugin 4*7d101cc1SGerry Weißbach * 5*7d101cc1SGerry Weißbach * @license GPL 2 (http://www.gnu.org/licenses/gpl.html) 6*7d101cc1SGerry Weißbach * @author Andreas Gohr <andi@splitbrain.org> 7*7d101cc1SGerry Weißbach */ 8*7d101cc1SGerry Weißbach 9*7d101cc1SGerry Weißbach// must be run within Dokuwiki 10*7d101cc1SGerry Weißbachif(!defined('DOKU_INC')) die(); 11*7d101cc1SGerry Weißbach 12*7d101cc1SGerry Weißbachclass helper_plugin_siteexport extends DokuWiki_Plugin { 13*7d101cc1SGerry Weißbach 14*7d101cc1SGerry Weißbach /** 15*7d101cc1SGerry Weißbach * for backward compatability 16*7d101cc1SGerry Weißbach * @see inc/DokuWiki_Plugin#getInfo() 17*7d101cc1SGerry Weißbach */ 18*7d101cc1SGerry Weißbach function getInfo(){ 19*7d101cc1SGerry Weißbach if ( method_exists(parent, 'getInfo')) { 20*7d101cc1SGerry Weißbach $info = parent::getInfo(); 21*7d101cc1SGerry Weißbach } 22*7d101cc1SGerry Weißbach return is_array($info) ? $info : confToHash(dirname(__FILE__).'/plugin.info.txt'); 23*7d101cc1SGerry Weißbach } 24*7d101cc1SGerry Weißbach 25*7d101cc1SGerry Weißbach /* 26*7d101cc1SGerry Weißbach * return all the templates that this wiki has 27*7d101cc1SGerry Weißbach */ 28*7d101cc1SGerry Weißbach function __getTemplates() { 29*7d101cc1SGerry Weißbach 30*7d101cc1SGerry Weißbach // populate $this->_choices with a list of directories 31*7d101cc1SGerry Weißbach $list = array(); 32*7d101cc1SGerry Weißbach 33*7d101cc1SGerry Weißbach $_dir = DOKU_INC . 'lib/tpl/'; 34*7d101cc1SGerry Weißbach $_pattern = '/^[\w-]+$/'; 35*7d101cc1SGerry Weißbach if ($dh = @opendir($_dir)) { 36*7d101cc1SGerry Weißbach while (false !== ($entry = readdir($dh))) { 37*7d101cc1SGerry Weißbach if ($entry == '.' || $entry == '..') continue; 38*7d101cc1SGerry Weißbach if ($entry == '.' || $entry == '..') continue; 39*7d101cc1SGerry Weißbach if ($_pattern && !preg_match($_pattern,$entry)) continue; 40*7d101cc1SGerry Weißbach 41*7d101cc1SGerry Weißbach $file = (is_link($_dir.$entry)) ? readlink($_dir.$entry) : $entry; 42*7d101cc1SGerry Weißbach if (is_dir($_dir.$file)) $list[] = $entry; 43*7d101cc1SGerry Weißbach } 44*7d101cc1SGerry Weißbach closedir($dh); 45*7d101cc1SGerry Weißbach } 46*7d101cc1SGerry Weißbach 47*7d101cc1SGerry Weißbach 48*7d101cc1SGerry Weißbach sort($list); 49*7d101cc1SGerry Weißbach return $list; 50*7d101cc1SGerry Weißbach } 51*7d101cc1SGerry Weißbach 52*7d101cc1SGerry Weißbach /* 53*7d101cc1SGerry Weißbach * Return array list of plugins that exist 54*7d101cc1SGerry Weißbach */ 55*7d101cc1SGerry Weißbach function __getPluginList() { 56*7d101cc1SGerry Weißbach global $plugin_controller; 57*7d101cc1SGerry Weißbach 58*7d101cc1SGerry Weißbach $allPlugins = array(); 59*7d101cc1SGerry Weißbach foreach($plugin_controller->getList(null,true) as $plugin ) { 60*7d101cc1SGerry Weißbach // check for CSS or JS 61*7d101cc1SGerry Weißbach if ( !file_exists(DOKU_PLUGIN."$plugin/script.js") && !file_exists(DOKU_PLUGIN."$p/style.css") ) { continue; } 62*7d101cc1SGerry Weißbach $allPlugins[] = $plugin; 63*7d101cc1SGerry Weißbach } 64*7d101cc1SGerry Weißbach 65*7d101cc1SGerry Weißbach return array($allPlugins, $plugin_controller->getList()); 66*7d101cc1SGerry Weißbach } 67*7d101cc1SGerry Weißbach} 68