1<?php 2 3class DokuWikiFarmCore { 4 /** 5 * @var array The default config - changed by loadConfig 6 */ 7 protected $config = array ( 8 'notfound' => array( 9 'show' => 'farmer', 10 'url' => '' 11 ), 12 'inherit' => array( 13 'main' => 1, 14 'acronyms' => 1, 15 'entities' => 1, 16 'interwiki' => 1, 17 'license' => 1, 18 'mime' => 1, 19 'scheme' => 1, 20 'smileys' => 1, 21 'wordblock' => 1, 22 'userstyle' => 0, 23 'userscript' => 0 24 ) 25 ); 26 27 /** 28 * DokuWikiFarmCore constructor. 29 * 30 * This initializes the whole farm 31 */ 32 public function __construct() { 33 $this->loadConfig(); 34 } 35 36 /** 37 * @return array the current farm configuration 38 */ 39 public function getConfig() { 40 return $this->config; 41 } 42 43 /** 44 * Loads the farm config 45 */ 46 protected function loadConfig() { 47 $ini = DOKU_INC . 'conf/farm.ini'; 48 if(!file_exists($ini)) return; 49 $config = parse_ini_file($ini, true); 50 foreach(array_keys($this->config) as $section) { 51 if(isset($config[$section])) { 52 $this->config[$section] = array_merge( 53 $this->config[$section], 54 $config[$section] 55 ); 56 } 57 } 58 } 59 60 61} 62 63// initialize it globally 64global $FARMCORE; 65$FARMCORE = new DokuWikiFarmCore(); 66