diff options
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/elgglib.php | 2 | ||||
-rw-r--r-- | engine/tests/api/helpers.php | 26 |
2 files changed, 14 insertions, 14 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index e45b231d4..3f12bd10f 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -168,7 +168,7 @@ function elgg_register_external_file($type, $url, $id, $location) { $id = trim(strtolower($id)); } - $CONFIG->externals[$type][$location][$id] = $url; + $CONFIG->externals[$type][$location][$id] = elgg_normalize_url($url); return true; } diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index 6afcd0ef8..b8c7f048d 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -71,14 +71,14 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { global $CONFIG; // specify id - $result = elgg_register_js('test1', 'key', 'footer'); + $result = elgg_register_js('//test1.com', 'key', 'footer'); $this->assertTrue($result); - $this->assertIdentical('test1', $CONFIG->externals['javascript']['footer']['key']); + $this->assertIdentical('//test1.com', $CONFIG->externals['javascript']['footer']['key']); // let Elgg pick id - $result = elgg_register_js('test2'); + $result = elgg_register_js('//test2.com'); $this->assertTrue($result); - $this->assertIdentical('test2', $CONFIG->externals['javascript']['head'][0]); + $this->assertIdentical('//test2.com', $CONFIG->externals['javascript']['head'][0]); // send a bad url $result = elgg_register_js(); @@ -92,14 +92,14 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { global $CONFIG; // specify id - $result = elgg_register_css('test1', 'key'); + $result = elgg_register_css('//test1.com', 'key'); $this->assertTrue($result); - $this->assertIdentical('test1', $CONFIG->externals['css']['head']['key']); + $this->assertIdentical('//test1.com', $CONFIG->externals['css']['head']['key']); // let Elgg pick id - $result = elgg_register_css('test2'); + $result = elgg_register_css('//test2.com'); $this->assertTrue($result); - $this->assertIdentical('test2', $CONFIG->externals['css']['head'][1]); + $this->assertIdentical('//test2.com', $CONFIG->externals['css']['head'][1]); // send a bad url $result = elgg_register_js(); @@ -112,7 +112,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { public function testElggUnregisterJS() { global $CONFIG; - $urls = array('id1' => 'url1', 'id2' => 'url2', 'id3' => 'url3'); + $urls = array('id1' => '//url1.com', 'id2' => '//url2.com', 'id3' => '//url3.com'); foreach ($urls as $id => $url) { elgg_register_js($url, $id); } @@ -121,16 +121,16 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertTrue($result); $this->assertNULL($CONFIG->externals['javascript']['head']['id1']); - $result = elgg_unregister_js('', 'url2'); + $result = elgg_unregister_js('', '//url2.com'); $this->assertTrue($result); $this->assertNULL($CONFIG->externals['javascript']['head']['id2']); $result = elgg_unregister_js('id1'); $this->assertFalse($result); - $result = elgg_unregister_js('', 'url2'); + $result = elgg_unregister_js('', '//url2.com'); $this->assertFalse($result); - $this->assertIdentical('url3', $CONFIG->externals['javascript']['head']['id3']); + $this->assertIdentical($urls['id3'], $CONFIG->externals['javascript']['head']['id3']); } /** @@ -139,7 +139,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { public function testElggGetJS() { global $CONFIG; - $urls = array('id1' => 'url1', 'id2' => 'url2', 'id3' => 'url3'); + $urls = array('id1' => '//url1.com', 'id2' => '//url2.com', 'id3' => '//url3.com'); foreach ($urls as $id => $url) { elgg_register_js($url, $id); } |