From 36226d3b15f72d4cb2d156eb573e4ac81d015a8a Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 9 Mar 2012 19:18:20 +0000 Subject: [PATCH] normalised source display --- ext/tag_edit/test.php | 4 ++-- ext/tag_edit/theme.php | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ext/tag_edit/test.php b/ext/tag_edit/test.php index 44eb1e2f..37fe714e 100644 --- a/ext/tag_edit/test.php +++ b/ext/tag_edit/test.php @@ -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(); diff --git a/ext/tag_edit/theme.php b/ext/tag_edit/theme.php index 419afee6..5ad429e4 100644 --- a/ext/tag_edit/theme.php +++ b/ext/tag_edit/theme.php @@ -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 "$h_source"; - } - else { - return "$h_source"; + 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 "$h_source"; } return "Unknown"; }