1); } $handlerId = $section . '/' . $urlType; if (!isset($this->_link_handlers[$handlerId])) if (!isset($this->_link_handlers[$handlerId])) { $this->_link_handlers[$handlerId] = $this->_initHandler($section, $urlType); } if($link = call_user_func($this->_link_handlers[$handlerId], $urlItems)) { return $link; } return '#url-not-found'; } function _initHandler($section, $urlType) { global $pref; //FIXME pref handler, $e107->prefs instance $core = false; if (strpos($section, ':') !== false) { list($tmp, $section) = explode(':', $section, 2); $core = ($tmp === 'core'); } elseif (isset($this->_link_handlers['plugin:'.$section])) { return $this->_link_handlers['plugin:'.$section]; } $handlerId = $section . '/' . $urlType; $handler = 'url_' . $section . '_' . $urlType; // Check to see if custom code is active and exists if (varsettrue($pref['url_config'][$section])) { // Search the central url config repository - one config to rull them all $fileName = ($core ? e_FILE."url/custom/base/{$handlerId}.php" : e_FILE."url/custom/plugins/{$handlerId}.php"); if (is_readable($fileName)) { include_once ($fileName); } if (function_exists($handler)) { return $handler; } // Search for custom url config released with the plugin if (!$core) { $fileName = e_PLUGIN."{$section}/url/custom/{$urlType}.php"; if (is_readable($fileName)) { include_once ($fileName); } if (function_exists($handler)) { return $handler; } } } // Search the default url config - the last station $fileName = ($core ? e_FILE."url/base/{$handlerId}.php" : e_PLUGIN."{$section}/url/{$urlType}.php"); if (is_readable($fileName)) { include_once ($fileName); } return $handler; } /* Preparing for PHP5 Exmample future calls (after stopping PHP4 support): $e107->url->getForum('post', array('edit' => 10)); $e107->url->getCoreUser('user', array('id' => 10)); function __call($method, $arguments) { if (strpos($method, "getCore") === 0) { $section = strtolower(substr($method, 7)); return $this->getCoreUrl($section, varset($arguments[0]), varset($arguments[1])); } elseif (strpos($method, "get") === 0) { $section = strtolower(substr($method, 3)); return $this->getUrl($section, varset($arguments[0]), varset($arguments[1])); } return ''; } */ }