normalised source display
This commit is contained in:
		
							parent
							
								
									5d3d4e8d76
								
							
						
					
					
						commit
						36226d3b15
					
				| @ -30,13 +30,13 @@ class TagEditTest extends ShimmieWebTestCase { | |||||||
| 
 | 
 | ||||||
| 		$this->set_field("tag_edit__source", "example.com"); | 		$this->set_field("tag_edit__source", "example.com"); | ||||||
| 		$this->click("Set"); | 		$this->click("Set"); | ||||||
| 		$this->click("source"); | 		$this->click("example.com"); | ||||||
| 		$this->assert_title("Example Web Page"); | 		$this->assert_title("Example Web Page"); | ||||||
| 		$this->back(); | 		$this->back(); | ||||||
| 
 | 
 | ||||||
| 		$this->set_field("tag_edit__source", "http://example.com"); | 		$this->set_field("tag_edit__source", "http://example.com"); | ||||||
| 		$this->click("Set"); | 		$this->click("Set"); | ||||||
| 		$this->click("source"); | 		$this->click("example.com"); | ||||||
| 		$this->assert_title("Example Web Page"); | 		$this->assert_title("Example Web Page"); | ||||||
| 		$this->back(); | 		$this->back(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -66,13 +66,13 @@ class TagEditTheme extends Themelet { | |||||||
| 
 | 
 | ||||||
| 	private function format_source(/*string*/ $source) { | 	private function format_source(/*string*/ $source) { | ||||||
| 		if(!empty($source)) { | 		if(!empty($source)) { | ||||||
| 			$h_source = html_escape($source); | 			if(!startsWith($source, "http://") && !startsWith($source, "https://")) { | ||||||
| 			if(startsWith($source, "http://") || startsWith($source, "https://")) { | 				$source = "http://" . $source; | ||||||
| 				return "<a href='$h_source'>$h_source</a>"; |  | ||||||
| 			} |  | ||||||
| 			else { |  | ||||||
| 				return "<a href='http://$h_source'>$h_source</a>"; |  | ||||||
| 			} | 			} | ||||||
|  | 			$proto_domain = explode("://", $source); | ||||||
|  | 			$h_source = html_escape($proto_domain[1]); | ||||||
|  | 			$u_source = html_escape($source); | ||||||
|  | 			return "<a href='$u_source'>$h_source</a>"; | ||||||
| 		} | 		} | ||||||
| 		return "Unknown"; | 		return "Unknown"; | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user