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