public static function get($uri, $a = array()) { $i = new stdClass(); $sURL = self::$config['URL']; $html_dir = self::$config['html_dir']; $router = self::$config['router']; $category = array(); $array = $a; $PRI = $router[$uri]['PRI']; $rule = $router[$uri]['rule']; switch ($rule) { case '0': $i->href = $array['url']; $url = $array['urlRule']; break; case '1': $category = $array; $i->href = $category['url']; $url = $category['mode'] ? $category['categoryRule'] : '{PHP}'; $category['password'] && $category['mode'] == "1" && ($url = '{PHP}'); if ($url == '{PHP}') { $document_uri = $uri . '.php?'; $category['categoryURI'] && ($document_uri = $category['categoryURI'] . '.php?'); $document_uri .= $PRI . '=' . $category[$PRI]; } break; case '2': $array = (array) $a[0]; $category = (array) $a[1]; $i->href = $array['url']; $url = $category['mode'] ? $category['contentRule'] : '{PHP}'; $category['password'] && $category['mode'] == "1" && ($url = '{PHP}'); if ($url == '{PHP}') { $document_uri = $uri . '.php?'; $document_uri .= $PRI . '=' . $array[$PRI]; $i->pageurl = $document_uri . '&p={P}'; strpos($i->pageurl, 'http://') === false && ($i->pageurl = rtrim($sURL, '/') . '/' . $i->pageurl); } break; case '3': $array = (array) $a[0]; $category = (array) $a[1]; $_category = (array) $a[2]; $html_dir = self::$config['tag_dir']; $sURL = self::$config['tag_url']; $i->href = $array['url']; //$a = array_merge_recursive((array)$a[0],$category); $url = $category['urlRule']; $_category['urlRule'] && ($url = $_category['urlRule']); $url or $url = self::$config['tag_rule']; if ($url == '{PHP}') { $document_uri = $uri . '.php?'; $document_uri .= $PRI . '=' . $array[$PRI]; } break; default: $url = $array['urlRule']; } if ($url == '{PHP}') { strpos($document_uri, 'http://') === false && ($document_uri = rtrim($sURL, '/') . '/' . $document_uri); $i->href = $document_uri; } if ($i->href) { return $i; } if (strpos($url, '{PHP}') === false) { self::$uriArray = array($array, $category, (array) $_category); strpos($url, '{') === false or $url = preg_replace_callback("/\\{(.*?)\\}/", '__iurl_rule__', $url); $i->path = rtrim(iFS::path(iPATH . $html_dir . $url), '/'); if (strpos($html_dir, '..') === false) { $i->href = rtrim($sURL, '/') . '/' . ltrim(iFS::path($html_dir . $url), '/'); } else { $i->href = rtrim($sURL, '/') . '/' . ltrim(iFS::path($url), '/'); } $pathA = pathinfo($i->path); // if(in_array($uri,array('article','content'))) { // $i->path = FS::path($Curl->dmdir.'/'.$url); // $i->href = FS::path($Curl->domain.'/'.$url); // } $i->hdir = pathinfo($i->href, PATHINFO_DIRNAME); $i->dir = $pathA['dirname']; $i->file = $pathA['basename']; $i->name = $pathA['filename']; $i->ext = '.' . $pathA['extension']; $i->name or $i->name = $i->file; //var_dump($GLOBALS['page']); //var_dump($i); //var_dump($pathA); if (empty($i->file) || substr($url, -1) == '/' || empty($pathA['extension'])) { $i->name = 'index'; $i->ext = self::$config['html_ext']; $category['htmlext'] && ($i->ext = $category['htmlext']); $i->file = $i->name . $i->ext; $i->path = $i->path . '/' . $i->file; $i->dir = dirname($i->path); $i->hdir = dirname($i->href . '/' . $i->file); } //var_dump($i); if (strpos($i->file, '{P}') === false) { $i->pfile = $i->name . "_{P}" . $i->ext; } else { $i->pfile = $i->file; } if ($rule == '0' || strpos($url, 'http://') !== false) { $hi = new stdClass(); $hi->href = $url; $hi->ext = $i->ext; $hi->pageurl = $hi->href . '/' . $i->pfile; return $hi; } //var_dump($i); //exit; if ($rule == '1') { $m = self::domain($array['cid']); if ($m->domain) { $i->href = str_replace($i->hdir, $m->dmpath, $i->href); $i->hdir = $m->dmpath; $__dir__ = $i->dir . '/' . $m->pdir; $i->path = str_replace($i->dir, $__dir__, $i->path); $i->dir = $__dir__; $i->dmdir = iFS::path(iPATH . $html_dir . '/' . $m->pd); $bits = parse_url($i->href); $i->domain = $bits['scheme'] . '://' . $bits['host']; } else { $i->dmdir = iFS::path(iPATH . $html_dir); $i->domain = $sURL; } if (strpos($array['domain'], 'http://') !== false) { $i->href = $array['domain']; } } $i->pageurl = $i->hdir . '/' . $i->pfile; $i->pagepath = $i->dir . '/' . $i->pfile; $i->href = str_replace('{P}', 1, $i->href); $i->path = str_replace('{P}', 1, $i->path); $i->file = str_replace('{P}', 1, $i->file); $i->name = str_replace('{P}', 1, $i->name); //var_dump($i); //exit; } return $i; }