normalised source display
This commit is contained in:
parent
5d3d4e8d76
commit
36226d3b15
2 changed files with 8 additions and 8 deletions
|
@ -30,13 +30,13 @@ class TagEditTest extends ShimmieWebTestCase {
|
|||
|
||||
$this->set_field("tag_edit__source", "example.com");
|
||||
$this->click("Set");
|
||||
$this->click("source");
|
||||
$this->click("example.com");
|
||||
$this->assert_title("Example Web Page");
|
||||
$this->back();
|
||||
|
||||
$this->set_field("tag_edit__source", "http://example.com");
|
||||
$this->click("Set");
|
||||
$this->click("source");
|
||||
$this->click("example.com");
|
||||
$this->assert_title("Example Web Page");
|
||||
$this->back();
|
||||
|
||||
|
|
|
@ -66,13 +66,13 @@ class TagEditTheme extends Themelet {
|
|||
|
||||
private function format_source(/*string*/ $source) {
|
||||
if(!empty($source)) {
|
||||
$h_source = html_escape($source);
|
||||
if(startsWith($source, "http://") || startsWith($source, "https://")) {
|
||||
return "<a href='$h_source'>$h_source</a>";
|
||||
}
|
||||
else {
|
||||
return "<a href='http://$h_source'>$h_source</a>";
|
||||
if(!startsWith($source, "http://") && !startsWith($source, "https://")) {
|
||||
$source = "http://" . $source;
|
||||
}
|
||||
$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";
|
||||
}
|
||||
|
|
Reference in a new issue