예제 #1
0
파일: router.php 프로젝트: xpd1437/swap
 protected static function build_normal_left_url(target $target, $query_char, $and_char, $target_enable_rewrite)
 {
     $left_url = '';
     $target_controller = $target->get_controller_name();
     $target_action = $target->get_action_name();
     if ($target_controller !== self::default_controller_name || $target_action !== self::default_action_name) {
         $target_path = $target_controller . '/' . $target_action;
         if ($target_enable_rewrite) {
             $left_url .= $target_path;
         } else {
             if ($target->has_module()) {
                 $left_url .= $target_path;
             } else {
                 $left_url .= $query_char . self::$base_target_key . '=' . $target_path;
             }
             $query_char = $and_char;
         }
     }
     $target_params = [];
     foreach ($target->get_params() as $key => $value) {
         $target_params[] = urlencode($key) . '=' . urlencode($value);
     }
     if ($target_params !== []) {
         $left_url .= $query_char . implode($and_char, $target_params);
     }
     return $left_url;
 }