diff options
-rw-r--r-- | engine/lib/elgglib.php | 10 | ||||
-rw-r--r-- | engine/lib/views.php | 2 | ||||
-rw-r--r-- | engine/tests/api/helpers.php | 9 |
3 files changed, 15 insertions, 6 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 198ffe60c..7bdc5972a 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -278,7 +278,7 @@ function elgg_get_loaded_css() { * @return bool * @since 1.8.0 */ -function elgg_register_external_file($type, $name, $url, $location, $priority = null) { +function elgg_register_external_file($type, $name, $url, $location, $priority = 500) { global $CONFIG; if (empty($name) || empty($url)) { @@ -291,7 +291,15 @@ function elgg_register_external_file($type, $name, $url, $location, $priority = elgg_bootstrap_externals_data_structure($type); $name = trim(strtolower($name)); + + // normalize bogus priorities, but allow empty, null, and false to be defaults. + if (!is_numeric($priority)) { + $priority = 500; + } + + // no negative priorities right now. $priority = max((int)$priority, 0); + $item = elgg_extract($name, $CONFIG->externals_map[$type]); if ($item) { diff --git a/engine/lib/views.php b/engine/lib/views.php index 3b9448c71..c31f61e84 100644 --- a/engine/lib/views.php +++ b/engine/lib/views.php @@ -1575,7 +1575,7 @@ function elgg_views_boot() { elgg_register_css('lightbox', $lightbox_css_url); $elgg_css_url = elgg_get_simplecache_url('css', 'elgg'); - elgg_register_css('elgg', $elgg_css_url, 1); + elgg_register_css('elgg', $elgg_css_url); elgg_load_css('elgg'); elgg_register_plugin_hook_handler('output:before', 'layout', 'elgg_views_add_rss_link'); diff --git a/engine/tests/api/helpers.php b/engine/tests/api/helpers.php index ee2e64cfe..36d680d54 100644 --- a/engine/tests/api/helpers.php +++ b/engine/tests/api/helpers.php @@ -204,7 +204,7 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { $this->assertTrue($result); $js_urls = elgg_get_loaded_js('footer'); - $this->assertIdentical(array('http://test1.com'), $js_urls); + $this->assertIdentical(array(500 => 'http://test1.com'), $js_urls); } /** @@ -227,9 +227,10 @@ class ElggCoreHelpersTest extends ElggCoreUnitTest { } $js_urls = elgg_get_loaded_js('head'); - $this->assertIdentical($js_urls[0], $urls['id1']); - $this->assertIdentical($js_urls[1], $urls['id2']); - $this->assertIdentical($js_urls[2], $urls['id3']); + + $this->assertIdentical($js_urls[500], $urls['id1']); + $this->assertIdentical($js_urls[501], $urls['id2']); + $this->assertIdentical($js_urls[502], $urls['id3']); $js_urls = elgg_get_loaded_js('footer'); $this->assertIdentical(array(), $js_urls); |