diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/elgglib.php | 125 |
1 files changed, 64 insertions, 61 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index e7501c0d3..125411cdb 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -397,61 +397,61 @@ return false; - }
-
- /**
- * Registers a view to be simply cached
- *
- * Views cached in this manner must take no parameters and be login agnostic -
- * that is to say, they look the same no matter who is logged in (or logged out).
- *
- * CSS and the basic jS views are automatically cached like this.
- *
- * @param string $viewname View name
- */
- function elgg_view_register_simplecache($viewname) {
-
- global $CONFIG;
-
- if (!isset($CONFIG->views->simplecache))
- $CONFIG->views->simplecache = array();
-
- //if (elgg_view_exists($viewname))
- $CONFIG->views->simplecache[] = $viewname;
-
- }
-
- /**
- * Regenerates the simple cache.
- *
- * @see elgg_view_register_simplecache
- *
- */
- function elgg_view_regenerate_simplecache() {
-
- global $CONFIG;
-
- if (isset($CONFIG->views->simplecache)) {
-
- if (!file_exists($CONFIG->dataroot . 'views_simplecache')) {
- @mkdir($CONFIG->dataroot . 'views_simplecache');
- }
-
- if (!empty($CONFIG->views->simplecache) && is_array($CONFIG->views->simplecache)) {
- foreach($CONFIG->views->simplecache as $view) {
- $viewcontents = elgg_view($view);
- $viewname = md5(elgg_get_viewtype() . $view);
- if ($handle = fopen($CONFIG->dataroot . 'views_simplecache/' . $viewname, 'w')) {
- fwrite($handle, $viewcontents);
- fclose($handle);
- }
- }
- }
-
- datalist_set('simplecache_lastupdate',0);
-
- }
-
+ } + + /** + * Registers a view to be simply cached + * + * Views cached in this manner must take no parameters and be login agnostic - + * that is to say, they look the same no matter who is logged in (or logged out). + * + * CSS and the basic jS views are automatically cached like this. + * + * @param string $viewname View name + */ + function elgg_view_register_simplecache($viewname) { + + global $CONFIG; + + if (!isset($CONFIG->views->simplecache)) + $CONFIG->views->simplecache = array(); + + //if (elgg_view_exists($viewname)) + $CONFIG->views->simplecache[] = $viewname; + + } + + /** + * Regenerates the simple cache. + * + * @see elgg_view_register_simplecache + * + */ + function elgg_view_regenerate_simplecache() { + + global $CONFIG; + + if (isset($CONFIG->views->simplecache)) { + + if (!file_exists($CONFIG->dataroot . 'views_simplecache')) { + @mkdir($CONFIG->dataroot . 'views_simplecache'); + } + + if (!empty($CONFIG->views->simplecache) && is_array($CONFIG->views->simplecache)) { + foreach($CONFIG->views->simplecache as $view) { + $viewcontents = elgg_view($view); + $viewname = md5(elgg_get_viewtype() . $view); + if ($handle = fopen($CONFIG->dataroot . 'views_simplecache/' . $viewname, 'w')) { + fwrite($handle, $viewcontents); + fclose($handle); + } + } + } + + datalist_set('simplecache_lastupdate',0); + + } + } /** @@ -768,8 +768,9 @@ * * @param string $label The human-readable label * @param string $link The URL of the submenu item + * @param boolean $onclick Used to provide a JS popup to confirm delete */ - function add_submenu_item($label, $link, $group = 'a') { + function add_submenu_item($label, $link, $group = 'a', $onclick = false) { global $CONFIG; if (!isset($CONFIG->submenu)) $CONFIG->submenu = array(); @@ -777,6 +778,7 @@ $item = new stdClass; $item->value = $link; $item->name = $label; + $item->onclick = $onclick; $CONFIG->submenu[$group][] = $item; } @@ -841,6 +843,7 @@ array( 'href' => $item->value, 'label' => $item->name, + 'onclick' => $item->onclick, 'selected' => $selected, )); @@ -2184,7 +2187,7 @@ register_page_handler('js','js_page_handler'); extend_view('js/initialise_elgg','embed/js'); // Register an event triggered at system shutdown - register_shutdown_function('__elgg_shutdown_hook');
+ register_shutdown_function('__elgg_shutdown_hook'); } @@ -2192,10 +2195,10 @@ // Actions register_action('comments/add'); - register_action('comments/delete');
-
- elgg_view_register_simplecache('css');
- elgg_view_register_simplecache('js/friendsPickerv1');
+ register_action('comments/delete'); + + elgg_view_register_simplecache('css'); + elgg_view_register_simplecache('js/friendsPickerv1'); elgg_view_register_simplecache('js/initialise_elgg'); } |