$v) { if($i > 1) { $pre = '&'; } $str .= $pre . $k . '=$' . $i; $i++; self::$config['link_key'][] = $k; self::$config['link_value'][] = $v; } self::$config['link_index'] = 0; $result = ''; if($key = array_search($value . '?' . $str, Config::$global['route'])) { $result = preg_replace_callback('/\(.*?\)/', 'self::link', $key); } if(!$result || $result == $value) { $value = $value . '?' . $arg[1]; } else { $value = $result; } } else { $index = strpos($value, '?'); if($index === false) { $value = preg_replace('/&/', '?', $value, 1); } } } if(!$host) { Config::get('host', $project); $host = Config::$global['host']['base']; } /* if(defined('MAZE_FRONT_HOST')) { $host = MAZE_FRONT_HOST; } elseif($project) { $host = $project; } else { $host = Config::$global['host']['base']; } */ return self::$config['url'][$key] = $host . Uri::$type . $value; } static private function link($param) { if(isset($param[0]) && $param[0] && isset(self::$config['link_value']) && isset(self::$config['link_value'][self::$config['link_index']])) { /* link encode $config = Helper::config('link_encode'); if($config && is_numeric(self::$config['link_value'][self::$config['link_index']]) && in_array(self::$config['link_key'][self::$config['link_index']], $config)) { self::$config['link_value'][self::$config['link_index']] = link_encode(self::$config['link_value'][self::$config['link_index']]); } */ $param[0] = self::$config['link_value'][self::$config['link_index']]; } self::$config['link_index']++; return $param[0]; } /** * location * @param string $value * * @return mixed */ static public function location($value, $type = 1) { if(strpos($value, 'http://') === false && strpos($value, 'https://') === false) { $value = self::get($value); } switch($type) { case 2 : $html = ''; Output::abert($html); die; break; default : header('HTTP/1.1 301 Moved Permanently'); header('Location: ' . $value); die; break; } } }