aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/admin.php14
-rw-r--r--engine/lib/elgglib.php27
2 files changed, 39 insertions, 2 deletions
diff --git a/engine/lib/admin.php b/engine/lib/admin.php
index 82351701c..3c070203e 100644
--- a/engine/lib/admin.php
+++ b/engine/lib/admin.php
@@ -157,6 +157,17 @@ function admin_init() {
}
/**
+ * Handles any set up required for administration pages
+ */
+function admin_pagesetup() {
+ if (elgg_in_context('admin')) {
+ $url = elgg_get_site_url() . 'pg/css/admin.css';
+ elgg_register_css($url, 'admin');
+ elgg_unregister_css('elgg');
+ }
+}
+
+/**
* Handle admin pages. Expects corresponding views as admin/section/subsection
*
* @param array $page Array of pages
@@ -310,6 +321,5 @@ function elgg_admin_notice_exists($id) {
return ($notice) ? TRUE : FALSE;
}
-// Register init functions
elgg_register_event_handler('init', 'system', 'admin_init');
-elgg_register_event_handler('pagesetup', 'system', 'admin_pagesetup');
+elgg_register_event_handler('pagesetup', 'system', 'admin_pagesetup', 1000);
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 8a8cecbfa..7bf23df5e 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -2138,6 +2138,32 @@ function js_page_handler($page) {
}
/**
+ * Serve CSS
+ *
+ * Serves CSS from the css views directory with headers for caching control
+ *
+ * @param array $page The page array
+ *
+ * @return void
+ * @elgg_pagehandler css
+ */
+function css_page_handler($page) {
+ if (!isset($page[0])) {
+ // default css
+ }
+
+ $css = str_replace('.css', '', $page[0]);
+ $return = elgg_view("css/$css");
+
+ header("Content-type: text/css", true);
+ header('Expires: ' . date('r', time() + 86400000), true);
+ header("Pragma: public", true);
+ header("Cache-Control: public", true);
+
+ echo $return;
+}
+
+/**
* Intercepts the index page when Walled Garden mode is enabled.
*
* @link http://docs.elgg.org/Tutorials/WalledGarden
@@ -2192,6 +2218,7 @@ function elgg_init() {
elgg_register_action('likes/delete');
register_page_handler('js', 'js_page_handler');
+ register_page_handler('css', 'css_page_handler');
// Trigger the shutdown:system event upon PHP shutdown.
register_shutdown_function('_elgg_shutdown_hook');