diff options
Diffstat (limited to 'engine/lib')
-rw-r--r-- | engine/lib/elgglib.php | 4 | ||||
-rw-r--r-- | engine/lib/entities.php | 39 | ||||
-rw-r--r-- | engine/lib/search.php | 52 |
3 files changed, 41 insertions, 54 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index 7a10cd809..2b2180532 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -724,7 +724,7 @@ function elgg_view_entity_list($entities, $count, $offset, $limit, $fullview = t $context = get_context(); - $html = elgg_view('search/entity_list',array( + $html = elgg_view('entities/entity_list',array( 'entities' => $entities, 'count' => $count, 'offset' => $offset, @@ -992,7 +992,7 @@ function elgg_count_comments($entity) { * @return string The HTML (etc) representing the listing */ function elgg_view_listing($icon, $info) { - return elgg_view('search/listing',array('icon' => $icon, 'info' => $info)); + return elgg_view('entities/entity_listing',array('icon' => $icon, 'info' => $info)); } /** diff --git a/engine/lib/entities.php b/engine/lib/entities.php index 373654431..7fe849421 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -63,6 +63,13 @@ abstract class ElggEntity implements */ protected $temp_annotations; + + /** + * Volatile data structure for this object, allows for storage of data + * in-memory that isn't sync'd back to the metadata table. + */ + protected $volatile; + /** * Initialise the attributes array. * This is vital to distinguish between metadata and base parameters. @@ -84,6 +91,9 @@ abstract class ElggEntity implements if (!is_array($this->temp_annotations)) { $this->temp_annotations = array(); } + if (!is_array($this->volatile)) { + $this->volatile = array(); + } $this->attributes['guid'] = ""; $this->attributes['type'] = ""; @@ -325,6 +335,35 @@ abstract class ElggEntity implements } } + + /** + * Get a piece of volatile (non-persisted) data on this entity + */ + public function getVolatileData($name) { + if (!is_array($this->volatile)) { + $this->volatile = array(); + } + + if (array_key_exists($name, $this->volatile)) { + return $this->volatile[$name]; + } else { + return NULL; + } + } + + + /** + * Set a piece of volatile (non-persisted) data on this entity + */ + public function setVolatileData($name, $value) { + if (!is_array($this->volatile)) { + $this->volatile = array(); + } + + $this->volatile[$name] = $value; + } + + /** * Remove all entities associated with this entity * diff --git a/engine/lib/search.php b/engine/lib/search.php deleted file mode 100644 index 0f6c0a12d..000000000 --- a/engine/lib/search.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/** - * Elgg search helper functions. - * - * @package Elgg - * @subpackage Core - * @author Curverider Ltd <info@elgg.com> - * @link http://elgg.org/ - */ - -/** - * Initialise search helper functions. - * - */ -function search_init() { - register_page_handler('search','search_page_handler'); -} - -/** - * Page handler for search - * - * @param array $page Page elements from pain page handler - */ -function search_page_handler($page) { - global $CONFIG; - - if(!get_input('tag')) { - set_input('tag', $page[0]); - } - - if (isset($page[0])) { - switch ($page[0]) { - case 'user' : - case 'users' : - include_once($CONFIG->path . "search/users.php"); - break; - - case 'group' : - case 'groups' : - include_once($CONFIG->path . "search/groups.php"); - break; - - default: - include_once($CONFIG->path . "search/index.php"); - } - } else { - include_once($CONFIG->path . "search/index.php"); - } -} - -/** Register init system event **/ -register_elgg_event_handler('init','system','search_init');
\ No newline at end of file |