diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-01 07:01:03 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-01 07:01:03 +0000 |
commit | 754fc3c3ea92084559d98a7e73b98dacce7fe9a1 (patch) | |
tree | 6d5b01828242a1276071ff789b1d777d28776bc7 /engine | |
parent | beaaf5c3bdc700a872df2b7a39e268ce36cc0012 (diff) | |
download | elgg-754fc3c3ea92084559d98a7e73b98dacce7fe9a1.tar.gz elgg-754fc3c3ea92084559d98a7e73b98dacce7fe9a1.tar.bz2 |
Moving deprecated functions out of files access.php - entities.php. This time into two files based on version deprecated and maintaining documentation
git-svn-id: http://code.elgg.org/elgg/trunk@7979 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/access.php | 98 | ||||
-rw-r--r-- | engine/lib/actions.php | 17 | ||||
-rw-r--r-- | engine/lib/admin.php | 24 | ||||
-rw-r--r-- | engine/lib/annotations.php | 350 | ||||
-rw-r--r-- | engine/lib/deprecated-1.7.php | 490 | ||||
-rw-r--r-- | engine/lib/deprecated-1.8.php | 643 | ||||
-rw-r--r-- | engine/lib/elgglib.php | 386 | ||||
-rw-r--r-- | engine/lib/entities.php | 260 | ||||
-rw-r--r-- | engine/start.php | 3 |
9 files changed, 1135 insertions, 1136 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index de246ee20..ae95982e6 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -744,83 +744,6 @@ function elgg_view_access_collections($owner_guid) { } /** - * Get entities with the specified access collection id. - * - * @deprecated 1.7. Use elgg_get_entities_from_access_id() - * - * @param int $collection_id ID of collection - * @param string $entity_type Type of entities - * @param string $entity_subtype Subtype of entities - * @param int $owner_guid Guid of owner - * @param int $limit Limit of number of entities to return - * @param int $offset Skip this many entities - * @param string $order_by Column to order by - * @param int $site_guid The site guid - * @param bool $count Return a count or entities - * - * @return array - */ -function get_entities_from_access_id($collection_id, $entity_type = "", $entity_subtype = "", - $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { - // log deprecated warning - elgg_deprecated_notice('get_entities_from_access_id() was deprecated by elgg_get_entities()', 1.7); - - if (!$collection_id) { - return FALSE; - } - - // build the options using given parameters - $options = array(); - $options['limit'] = $limit; - $options['offset'] = $offset; - $options['count'] = $count; - - if ($entity_type) { - $options['type'] = sanitise_string($entity_type); - } - - if ($entity_subtype) { - $options['subtype'] = $entity_subtype; - } - - if ($site_guid) { - $options['site_guid'] = $site_guid; - } - - if ($order_by) { - $options['order_by'] = sanitise_string("e.time_created, $order_by"); - } - - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['owner_guids'] = $owner_guid; - } else { - $options['owner_guid'] = $owner_guid; - } - } - - if ($site_guid) { - $options['site_guid'] = $site_guid; - } - - $options['access_id'] = $collection_id; - - return elgg_get_entities_from_access_id($options); -} - -/** - * @deprecated 1.7 - */ -function get_entities_from_access_collection($collection_id, $entity_type = "", $entity_subtype = "", - $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { - - elgg_deprecated_notice('get_entities_from_access_collection() was deprecated by elgg_get_entities()', 1.7); - - return get_entities_from_access_id($collection_id, $entity_type, $entity_subtype, - $owner_guid, $limit, $offset, $order_by, $site_guid, $count); -} - -/** * Return entities based upon access id. * * @param array $options Any options accepted by {@link elgg_get_entities()} and: @@ -867,27 +790,6 @@ function elgg_list_entities_from_access_id(array $options = array()) { } /** - * @return str - * @deprecated 1.8 Use elgg_list_entities_from_access_id() - */ -function list_entities_from_access_id($access_id, $entity_type = "", $entity_subtype = "", - $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) { - - elgg_deprecated_notice("All list_entities* functions were deprecated in 1.8. Use elgg_list_entities* instead.", 1.8); - - echo elgg_list_entities_from_access_id(array( - 'access_id' => $access_id, - 'types' => $entity_type, - 'subtypes' => $entity_subtype, - 'owner_guids' => $owner_guid, - 'limit' => $limit, - 'full_view' => $fullview, - 'list_type_toggle' => $listtypetoggle, - 'pagination' => $pagination, - )); -} - -/** * Return the name of an ACCESS_* constant or a access collection, * but only if the user has write access on that ACL. * diff --git a/engine/lib/actions.php b/engine/lib/actions.php index d95fe0435..0691e306a 100644 --- a/engine/lib/actions.php +++ b/engine/lib/actions.php @@ -181,23 +181,6 @@ function elgg_register_action($action, $filename = "", $access = 'logged_in') { } /** - * @deprecated 1.8 Use {@link elgg_register_action()} instead - */ -function register_action($action, $public = false, $filename = "", $admin_only = false) { - elgg_deprecated_notice("register_action() was deprecated by elgg_register_action()", 1.8); - - if ($admin_only) { - $access = 'admin'; - } elseif ($public) { - $access = 'public'; - } else { - $access = 'logged_in'; - } - - return elgg_register_action($action, $filename, $access); -} - -/** * Validate an action token. * * Calls to actions will automatically validate tokens. diff --git a/engine/lib/admin.php b/engine/lib/admin.php index c8254a0ff..c3dfb7b84 100644 --- a/engine/lib/admin.php +++ b/engine/lib/admin.php @@ -8,30 +8,6 @@ */ /** - * Register an admin page with the admin panel. - * This function extends the view "admin/main" with the provided view. - * This view should provide a description and either a control or a link to. - * - * Usage: - * - To add a control to the main admin panel then extend admin/main - * - To add a control to a new page create a page which renders a view admin/subpage - * (where subpage is your new page - - * nb. some pages already exist that you can extend), extend the main view to point to it, - * and add controls to your new view. - * - * At the moment this is essentially a wrapper around elgg_extend_view(). - * - * @param string $new_admin_view The view associated with the control you're adding - * @param string $view The view to extend, by default this is 'admin/main'. - * @param int $priority Optional priority to govern the appearance in the list. - * - * @return void - */ -function extend_elgg_admin_page($new_admin_view, $view = 'admin/main', $priority = 500) { - elgg_deprecated_notice('extend_elgg_admin_page() does nothing. Extend admin views manually.', 1.8); -} - -/** * Create the plugin settings submenu. * * This is done in a separate function called from the admin diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php index f069e1d05..035c5e705 100644 --- a/engine/lib/annotations.php +++ b/engine/lib/annotations.php @@ -408,160 +408,6 @@ function elgg_get_entities_from_annotations(array $options = array()) { } /** - * Get entities from annotations - * - * No longer used. - * - * @deprecated 1.7 Use elgg_get_entities_from_annotations() - * - * @param mixed $entity_type Type of entity - * @param mixed $entity_subtype Subtype of entity - * @param string $name Name of annotation - * @param string $value Value of annotation - * @param int $owner_guid Guid of owner of annotation - * @param int $group_guid Guid of group - * @param int $limit Limit - * @param int $offset Offset - * @param string $order_by SQL order by string - * @param bool $count Count or return entities - * @param int $timelower Lower time limit - * @param int $timeupper Upper time limit - * - * @return unknown_type - */ -function get_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", -$value = "", $owner_guid = 0, $group_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", -$count = false, $timelower = 0, $timeupper = 0) { - $msg = 'get_entities_from_annotations() is deprecated by elgg_get_entities_from_annotations().'; - elgg_deprecated_notice($msg, 1.7); - - $options = array(); - - if ($entity_type) { - $options['types'] = $entity_type; - } - - if ($entity_subtype) { - $options['subtypes'] = $entity_subtype; - } - - $options['annotation_names'] = $name; - - if ($value) { - $options['annotation_values'] = $value; - } - - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['annotation_owner_guids'] = $owner_guid; - } else { - $options['annotation_owner_guid'] = $owner_guid; - } - } - - if ($group_guid) { - $options['container_guid'] = $group_guid; - } - - if ($limit) { - $options['limit'] = $limit; - } - - if ($offset) { - $options['offset'] = $offset; - } - - if ($order_by) { - $options['order_by'] = "maxtime $order_by"; - } - - if ($count) { - $options['count'] = $count; - } - - if ($timelower) { - $options['annotation_created_time_lower'] = $timelower; - } - - if ($timeupper) { - $options['annotation_created_time_upper'] = $timeupper; - } - - return elgg_get_entities_from_annotations($options); -} - -/** - * Lists entities - * - * @see elgg_view_entity_list - * - * @param string $entity_type Type of entity. - * @param string $entity_subtype Subtype of entity. - * @param string $name Name of annotation. - * @param string $value Value of annotation. - * @param int $limit Maximum number of results to return. - * @param int $owner_guid Owner. - * @param int $group_guid Group container. Currently only supported if entity_type is object - * @param boolean $asc Whether to list in ascending or descending order (default: desc) - * @param boolean $fullview Whether to display the entities in full - * @param boolean $listtypetoggle Can 'gallery' view can be displayed (default: no) - * - * @deprecated 1.7 Use elgg_list_entities_from_annotations() - * @return string Formatted entity list - */ -function list_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", -$value = "", $limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true, -$listtypetoggle = false) { - - $msg = 'list_entities_from_annotations is deprecated by elgg_list_entities_from_annotations'; - elgg_deprecated_notice($msg, 1.8); - - $options = array(); - - if ($entity_type) { - $options['types'] = $entity_type; - } - - if ($entity_subtype) { - $options['subtypes'] = $entity_subtype; - } - - if ($name) { - $options['annotation_names'] = $name; - } - - if ($value) { - $options['annotation_values'] = $value; - } - - if ($limit) { - $options['limit'] = $limit; - } - - if ($owner_guid) { - $options['annotation_owner_guid'] = $owner_guid; - } - - if ($group_guid) { - $options['container_guid'] = $group_guid; - } - - if ($asc) { - $options['order_by'] = 'maxtime desc'; - } - - if ($offset = sanitise_int(get_input('offset', null))) { - $options['offset'] = $offset; - } - - $options['full_view'] = $fullview; - $options['list_type_toggle'] = $listtypetoggle; - $options['pagination'] = $pagination; - - return elgg_list_entities_from_annotations($options); -} - -/** * Returns a viewable list of entities from annotations. * * @param array $options Options array @@ -850,140 +696,6 @@ function elgg_get_entities_from_annotation_calculation($options) { } /** - * Get entities ordered by a mathematical calculation - * - * @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation() - * - * @param string $sum What sort of calculation to perform - * @param string $entity_type Type of Entity - * @param string $entity_subtype Subtype of Entity - * @param string $name Name of annotation - * @param string $mdname Metadata name - * @param string $mdvalue Metadata value - * @param int $owner_guid GUID of owner of annotation - * @param int $limit Limit of results - * @param int $offset Offset of results - * @param string $orderdir Order of results - * @param bool $count Return count or entities - * - * @return mixed - */ -function get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", -$entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, -$limit = 10, $offset = 0, $orderdir = 'desc', $count = false) { - - $msg = 'get_entities_from_annotations_calculate_x() is deprecated by elgg_get_entities_from_annotation_calculation().'; - - elgg_deprecated_notice($msg, 1.8); - - $options = array(); - - $options['calculation'] = $sum; - - if ($entity_type) { - $options['types'] = $entity_type; - } - - if ($entity_subtype) { - $options['subtypes'] = $entity_subtype; - } - - $options['annotation_names'] = $name; - - if ($mdname) { - $options['metadata_names'] = $mdname; - } - - if ($mdvalue) { - $options['metadata_values'] = $mdvalue; - } - - // original function rewrote this to container guid. - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['container_guids'] = $owner_guid; - } else { - $options['container_guid'] = $owner_guid; - } - } - - $options['limit'] = $limit; - $options['offset'] = $offset; - - $options['order_by'] = "calculated $orderdir"; - - $options['count'] = $count; - - return elgg_get_entities_from_annotation_calculation($options); -} - -/** - * Returns entities ordered by the sum of an annotation - * - * @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation() - * - * @param string $entity_type Type of Entity - * @param string $entity_subtype Subtype of Entity - * @param string $name Name of annotation - * @param string $mdname Metadata name - * @param string $mdvalue Metadata value - * @param int $owner_guid GUID of owner of annotation - * @param int $limit Limit of results - * @param int $offset Offset of results - * @param string $orderdir Order of results - * @param bool $count Return count or entities - * - * @return unknown - */ -function get_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", -$mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', -$count = false) { - - $msg = 'get_entities_from_annotation_count() is deprecated by elgg_get_entities_from_annotation_calculation().'; - - elgg_deprecated_notice($msg, 1.8); - - $options = array(); - - $options['calculation'] = 'sum'; - - if ($entity_type) { - $options['types'] = $entity_type; - } - - if ($entity_subtype) { - $options['subtypes'] = $entity_subtype; - } - - $options['annotation_names'] = $name; - - if ($mdname) { - $options['metadata_names'] = $mdname; - } - - if ($mdvalue) { - $options['metadata_values'] = $mdvalue; - } - - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['owner_guids'] = $owner_guid; - } else { - $options['owner_guid'] = $owner_guid; - } - } - - $options['limit'] = $limit; - $options['offset'] = $offset; - - $options['order_by'] = "calculated $orderdir"; - - $options['count'] = $count; - - return elgg_get_entities_from_annotation_calculation($options); -} - -/** * List entities from an annotation calculation. * * @see elgg_get_entities_from_annotation_calculation() @@ -997,68 +709,6 @@ function elgg_list_entities_from_annotation_calculation($options) { } /** - * Lists entities by the totals of a particular kind of annotation - * - * @deprecated 1.8 Use elgg_list_entities_from_annotation_calculation() - * - * @param string $entity_type Type of entity. - * @param string $entity_subtype Subtype of entity. - * @param string $name Name of annotation. - * @param int $limit Maximum number of results to return. - * @param int $owner_guid Owner. - * @param int $group_guid Group container. Currently only supported if entity_type is object - * @param boolean $asc Whether to list in ascending or descending order (default: desc) - * @param boolean $fullview Whether to display the entities in full - * @param boolean $listtypetoggle Can the 'gallery' view can be displayed (default: no) - * @param boolean $pagination Add pagination - * @param string $orderdir Order desc or asc - * - * @return string Formatted entity list - */ -function list_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", -$limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true, -$listtypetoggle = false, $pagination = true, $orderdir = 'desc') { - - $msg = 'list_entities_from_annotation_count() is deprecated by elgg_list_entities_from_annotation_calculation().'; - - elgg_deprecated_notice($msg, 1.8); - - $options = array(); - - $options['calculation'] = 'sum'; - - if ($entity_type) { - $options['types'] = $entity_type; - } - - if ($entity_subtype) { - $options['subtypes'] = $entity_subtype; - } - - $options['annotation_names'] = $name; - - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['owner_guids'] = $owner_guid; - } else { - $options['owner_guid'] = $owner_guid; - } - } - - $options['full_view'] = $fullview; - - $options['list_type_toggle'] = $listtypetoggle; - - $options['pagination'] = $pagination; - - $options['limit'] = $limit; - - $options['order_by'] = "calculated $orderdir"; - - return elgg_get_entities_from_annotation_calculation($options); -} - -/** * Lists entities by the totals of a particular kind of annotation AND * the value of a piece of metadata * diff --git a/engine/lib/deprecated-1.7.php b/engine/lib/deprecated-1.7.php new file mode 100644 index 000000000..3c9ad0d25 --- /dev/null +++ b/engine/lib/deprecated-1.7.php @@ -0,0 +1,490 @@ +<?php +/** + * Get entities with the specified access collection id. + * + * @deprecated 1.7. Use elgg_get_entities_from_access_id() + * + * @param int $collection_id ID of collection + * @param string $entity_type Type of entities + * @param string $entity_subtype Subtype of entities + * @param int $owner_guid Guid of owner + * @param int $limit Limit of number of entities to return + * @param int $offset Skip this many entities + * @param string $order_by Column to order by + * @param int $site_guid The site guid + * @param bool $count Return a count or entities + * + * @return array + */ +function get_entities_from_access_id($collection_id, $entity_type = "", $entity_subtype = "", + $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { + // log deprecated warning + elgg_deprecated_notice('get_entities_from_access_id() was deprecated by elgg_get_entities()', 1.7); + + if (!$collection_id) { + return FALSE; + } + + // build the options using given parameters + $options = array(); + $options['limit'] = $limit; + $options['offset'] = $offset; + $options['count'] = $count; + + if ($entity_type) { + $options['type'] = sanitise_string($entity_type); + } + + if ($entity_subtype) { + $options['subtype'] = $entity_subtype; + } + + if ($site_guid) { + $options['site_guid'] = $site_guid; + } + + if ($order_by) { + $options['order_by'] = sanitise_string("e.time_created, $order_by"); + } + + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['owner_guids'] = $owner_guid; + } else { + $options['owner_guid'] = $owner_guid; + } + } + + if ($site_guid) { + $options['site_guid'] = $site_guid; + } + + $options['access_id'] = $collection_id; + + return elgg_get_entities_from_access_id($options); +} + +/** + * @deprecated 1.7 + */ +function get_entities_from_access_collection($collection_id, $entity_type = "", $entity_subtype = "", + $owner_guid = 0, $limit = 10, $offset = 0, $order_by = "", $site_guid = 0, $count = false) { + + elgg_deprecated_notice('get_entities_from_access_collection() was deprecated by elgg_get_entities()', 1.7); + + return get_entities_from_access_id($collection_id, $entity_type, $entity_subtype, + $owner_guid, $limit, $offset, $order_by, $site_guid, $count); +} + +/** + * Get entities from annotations + * + * No longer used. + * + * @deprecated 1.7 Use elgg_get_entities_from_annotations() + * + * @param mixed $entity_type Type of entity + * @param mixed $entity_subtype Subtype of entity + * @param string $name Name of annotation + * @param string $value Value of annotation + * @param int $owner_guid Guid of owner of annotation + * @param int $group_guid Guid of group + * @param int $limit Limit + * @param int $offset Offset + * @param string $order_by SQL order by string + * @param bool $count Count or return entities + * @param int $timelower Lower time limit + * @param int $timeupper Upper time limit + * + * @return unknown_type + */ +function get_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", +$value = "", $owner_guid = 0, $group_guid = 0, $limit = 10, $offset = 0, $order_by = "asc", +$count = false, $timelower = 0, $timeupper = 0) { + $msg = 'get_entities_from_annotations() is deprecated by elgg_get_entities_from_annotations().'; + elgg_deprecated_notice($msg, 1.7); + + $options = array(); + + if ($entity_type) { + $options['types'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtypes'] = $entity_subtype; + } + + $options['annotation_names'] = $name; + + if ($value) { + $options['annotation_values'] = $value; + } + + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['annotation_owner_guids'] = $owner_guid; + } else { + $options['annotation_owner_guid'] = $owner_guid; + } + } + + if ($group_guid) { + $options['container_guid'] = $group_guid; + } + + if ($limit) { + $options['limit'] = $limit; + } + + if ($offset) { + $options['offset'] = $offset; + } + + if ($order_by) { + $options['order_by'] = "maxtime $order_by"; + } + + if ($count) { + $options['count'] = $count; + } + + if ($timelower) { + $options['annotation_created_time_lower'] = $timelower; + } + + if ($timeupper) { + $options['annotation_created_time_upper'] = $timeupper; + } + + return elgg_get_entities_from_annotations($options); +} + +/** + * Lists entities + * + * @see elgg_view_entity_list + * + * @param string $entity_type Type of entity. + * @param string $entity_subtype Subtype of entity. + * @param string $name Name of annotation. + * @param string $value Value of annotation. + * @param int $limit Maximum number of results to return. + * @param int $owner_guid Owner. + * @param int $group_guid Group container. Currently only supported if entity_type is object + * @param boolean $asc Whether to list in ascending or descending order (default: desc) + * @param boolean $fullview Whether to display the entities in full + * @param boolean $listtypetoggle Can 'gallery' view can be displayed (default: no) + * + * @deprecated 1.7 Use elgg_list_entities_from_annotations() + * @return string Formatted entity list + */ +function list_entities_from_annotations($entity_type = "", $entity_subtype = "", $name = "", +$value = "", $limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true, +$listtypetoggle = false) { + + $msg = 'list_entities_from_annotations is deprecated by elgg_list_entities_from_annotations'; + elgg_deprecated_notice($msg, 1.8); + + $options = array(); + + if ($entity_type) { + $options['types'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtypes'] = $entity_subtype; + } + + if ($name) { + $options['annotation_names'] = $name; + } + + if ($value) { + $options['annotation_values'] = $value; + } + + if ($limit) { + $options['limit'] = $limit; + } + + if ($owner_guid) { + $options['annotation_owner_guid'] = $owner_guid; + } + + if ($group_guid) { + $options['container_guid'] = $group_guid; + } + + if ($asc) { + $options['order_by'] = 'maxtime desc'; + } + + if ($offset = sanitise_int(get_input('offset', null))) { + $options['offset'] = $offset; + } + + $options['full_view'] = $fullview; + $options['list_type_toggle'] = $listtypetoggle; + $options['pagination'] = $pagination; + + return elgg_list_entities_from_annotations($options); +} + +/** + * Returns all php files in a directory. + * + * @deprecated 1.7 Use elgg_get_file_list() instead + * + * @param string $directory Directory to look in + * @param array $exceptions Array of extensions (with .!) to ignore + * @param array $list A list files to include in the return + * + * @return array + */ +function get_library_files($directory, $exceptions = array(), $list = array()) { + elgg_deprecated_notice('get_library_files() deprecated by elgg_get_file_list()', 1.7); + return elgg_get_file_list($directory, $exceptions, $list, array('.php')); +} + +/** + * Add action tokens to URL. + * + * @param string $url URL + * + * @return string + * + * @deprecated 1.7 final + */ +function elgg_validate_action_url($url) { + elgg_deprecated_notice('elgg_validate_action_url() deprecated by elgg_add_action_tokens_to_url().', + '1.7b'); + + return elgg_add_action_tokens_to_url($url); +} + +/** + * Does nothing. + * + * @deprecated 1.7 + * @return 0 + */ +function test_ip() { + elgg_deprecated_notice('test_ip() was removed because of licensing issues.', 1.7); + + return 0; +} + +/** + * Does nothing. + * + * @return bool + * @deprecated 1.7 + */ +function is_ip_in_array() { + elgg_deprecated_notice('is_ip_in_array() was removed because of licensing issues.', 1.7); + + return false; +} + +/** + * Returns entities. + * + * @deprecated 1.7. Use elgg_get_entities(). + * + * @param string $type Entity type + * @param string $subtype Entity subtype + * @param int $owner_guid Owner GUID + * @param string $order_by Order by clause + * @param int $limit Limit + * @param int $offset Offset + * @param bool $count Return a count or an array of entities + * @param int $site_guid Site GUID + * @param int $container_guid Container GUID + * @param int $timelower Lower time limit + * @param int $timeupper Upper time limit + * + * @return array + */ +function get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, +$offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, +$timeupper = 0) { + + elgg_deprecated_notice('get_entities() was deprecated by elgg_get_entities().', 1.7); + + // rewrite owner_guid to container_guid to emulate old functionality + if ($owner_guid != "") { + if (is_null($container_guid)) { + $container_guid = $owner_guid; + $owner_guid = NULL; + } + } + + $options = array(); + if ($type) { + if (is_array($type)) { + $options['types'] = $type; + } else { + $options['type'] = $type; + } + } + + if ($subtype) { + if (is_array($subtype)) { + $options['subtypes'] = $subtype; + } else { + $options['subtype'] = $subtype; + } + } + + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['owner_guids'] = $owner_guid; + } else { + $options['owner_guid'] = $owner_guid; + } + } + + if ($order_by) { + $options['order_by'] = $order_by; + } + + // need to pass 0 for all option + $options['limit'] = $limit; + + if ($offset) { + $options['offset'] = $offset; + } + + if ($count) { + $options['count'] = $count; + } + + if ($site_guid) { + $options['site_guids'] = $site_guid; + } + + if ($container_guid) { + $options['container_guids'] = $container_guid; + } + + if ($timeupper) { + $options['created_time_upper'] = $timeupper; + } + + if ($timelower) { + $options['created_time_lower'] = $timelower; + } + + $r = elgg_get_entities($options); + return $r; +} + +/** + * Delete multiple entities that match a given query. + * This function iterates through and calls delete_entity on + * each one, this is somewhat inefficient but lets + * the 'delete' event be called for each entity. + * + * @deprecated 1.7. This is a dangerous function as it defaults to deleting everything. + * + * @param string $type The type of entity (eg "user", "object" etc) + * @param string $subtype The arbitrary subtype of the entity + * @param int $owner_guid The GUID of the owning user + * + * @return false + */ +function delete_entities($type = "", $subtype = "", $owner_guid = 0) { + elgg_deprecated_notice('delete_entities() was deprecated because no one should use it.', 1.7); + return false; +} + +/** + * Lists entities. + * + * @param int $owner_guid Owner GUID + * @param int $limit Limit + * @param bool $fullview Show entity full views + * @param bool $listtypetoggle Show list type toggle + * @param bool $allowedtypes A string of the allowed types + * + * @return string + * @deprecated 1.7. Use elgg_list_registered_entities(). + */ +function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, +$listtypetoggle = false, $allowedtypes = true) { + + elgg_deprecated_notice('list_registered_entities() was deprecated by elgg_list_registered_entities().', 1.7); + + $options = array(); + + // don't want to send anything if not being used. + if ($owner_guid) { + $options['owner_guid'] = $owner_guid; + } + + if ($limit) { + $options['limit'] = $limit; + } + + if ($allowedtypes) { + $options['allowed_types'] = $allowedtypes; + } + + // need to send because might be BOOL + $options['full_view'] = $fullview; + $options['list_type_toggle'] = $listtypetoggle; + + $options['offset'] = get_input('offset', 0); + + return elgg_list_registered_entities($options); +} + +/** + * Lists entities + * + * @deprecated 1.7. Use elgg_list_entities(). + * + * @param string $type Entity type + * @param string $subtype Entity subtype + * @param int $owner_guid Owner GUID + * @param int $limit Limit + * @param bool $fullview Display entity full views? + * @param bool $listtypetoggle Allow switching to gallery mode? + * @param bool $pagination Show pagination? + * + * @return string + */ +function list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, +$listtypetoggle = false, $pagination = true) { + + elgg_deprecated_notice('list_entities() was deprecated by elgg_list_entities()!', 1.7); + + $options = array(); + + // rewrite owner_guid to container_guid to emulate old functionality + if ($owner_guid) { + $options['container_guids'] = $owner_guid; + } + + if ($type) { + $options['types'] = $type; + } + + if ($subtype) { + $options['subtypes'] = $subtype; + } + + if ($limit) { + $options['limit'] = $limit; + } + + if ($offset = sanitise_int(get_input('offset', null))) { + $options['offset'] = $offset; + } + + $options['full_view'] = $fullview; + $options['list_type_toggle'] = $listtypetoggle; + $options['pagination'] = $pagination; + + return elgg_list_entities($options); +} diff --git a/engine/lib/deprecated-1.8.php b/engine/lib/deprecated-1.8.php new file mode 100644 index 000000000..bc92c1bd5 --- /dev/null +++ b/engine/lib/deprecated-1.8.php @@ -0,0 +1,643 @@ +<?php +/** + * @return str + * @deprecated 1.8 Use elgg_list_entities_from_access_id() + */ +function list_entities_from_access_id($access_id, $entity_type = "", $entity_subtype = "", + $owner_guid = 0, $limit = 10, $fullview = true, $listtypetoggle = true, $pagination = true) { + + elgg_deprecated_notice("All list_entities* functions were deprecated in 1.8. Use elgg_list_entities* instead.", 1.8); + + echo elgg_list_entities_from_access_id(array( + 'access_id' => $access_id, + 'types' => $entity_type, + 'subtypes' => $entity_subtype, + 'owner_guids' => $owner_guid, + 'limit' => $limit, + 'full_view' => $fullview, + 'list_type_toggle' => $listtypetoggle, + 'pagination' => $pagination, + )); +} + +/** + * @deprecated 1.8 Use {@link elgg_register_action()} instead + */ +function register_action($action, $public = false, $filename = "", $admin_only = false) { + elgg_deprecated_notice("register_action() was deprecated by elgg_register_action()", 1.8); + + if ($admin_only) { + $access = 'admin'; + } elseif ($public) { + $access = 'public'; + } else { + $access = 'logged_in'; + } + + return elgg_register_action($action, $filename, $access); +} + +/** + * Register an admin page with the admin panel. + * This function extends the view "admin/main" with the provided view. + * This view should provide a description and either a control or a link to. + * + * Usage: + * - To add a control to the main admin panel then extend admin/main + * - To add a control to a new page create a page which renders a view admin/subpage + * (where subpage is your new page - + * nb. some pages already exist that you can extend), extend the main view to point to it, + * and add controls to your new view. + * + * At the moment this is essentially a wrapper around elgg_extend_view(). + * + * @param string $new_admin_view The view associated with the control you're adding + * @param string $view The view to extend, by default this is 'admin/main'. + * @param int $priority Optional priority to govern the appearance in the list. + * + * @deprecated 1.8 Extend admin views manually + * + * @return void + */ +function extend_elgg_admin_page($new_admin_view, $view = 'admin/main', $priority = 500) { + elgg_deprecated_notice('extend_elgg_admin_page() does nothing. Extend admin views manually.', 1.8); +} + +/** + * Get entities ordered by a mathematical calculation + * + * @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation() + * + * @param string $sum What sort of calculation to perform + * @param string $entity_type Type of Entity + * @param string $entity_subtype Subtype of Entity + * @param string $name Name of annotation + * @param string $mdname Metadata name + * @param string $mdvalue Metadata value + * @param int $owner_guid GUID of owner of annotation + * @param int $limit Limit of results + * @param int $offset Offset of results + * @param string $orderdir Order of results + * @param bool $count Return count or entities + * + * @return mixed + */ +function get_entities_from_annotations_calculate_x($sum = "sum", $entity_type = "", +$entity_subtype = "", $name = "", $mdname = '', $mdvalue = '', $owner_guid = 0, +$limit = 10, $offset = 0, $orderdir = 'desc', $count = false) { + + $msg = 'get_entities_from_annotations_calculate_x() is deprecated by elgg_get_entities_from_annotation_calculation().'; + + elgg_deprecated_notice($msg, 1.8); + + $options = array(); + + $options['calculation'] = $sum; + + if ($entity_type) { + $options['types'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtypes'] = $entity_subtype; + } + + $options['annotation_names'] = $name; + + if ($mdname) { + $options['metadata_names'] = $mdname; + } + + if ($mdvalue) { + $options['metadata_values'] = $mdvalue; + } + + // original function rewrote this to container guid. + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['container_guids'] = $owner_guid; + } else { + $options['container_guid'] = $owner_guid; + } + } + + $options['limit'] = $limit; + $options['offset'] = $offset; + + $options['order_by'] = "calculated $orderdir"; + + $options['count'] = $count; + + return elgg_get_entities_from_annotation_calculation($options); +} + +/** + * Returns entities ordered by the sum of an annotation + * + * @deprecated 1.8 Use elgg_get_entities_from_annotation_calculation() + * + * @param string $entity_type Type of Entity + * @param string $entity_subtype Subtype of Entity + * @param string $name Name of annotation + * @param string $mdname Metadata name + * @param string $mdvalue Metadata value + * @param int $owner_guid GUID of owner of annotation + * @param int $limit Limit of results + * @param int $offset Offset of results + * @param string $orderdir Order of results + * @param bool $count Return count or entities + * + * @return unknown + */ +function get_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", +$mdname = '', $mdvalue = '', $owner_guid = 0, $limit = 10, $offset = 0, $orderdir = 'desc', +$count = false) { + + $msg = 'get_entities_from_annotation_count() is deprecated by elgg_get_entities_from_annotation_calculation().'; + + elgg_deprecated_notice($msg, 1.8); + + $options = array(); + + $options['calculation'] = 'sum'; + + if ($entity_type) { + $options['types'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtypes'] = $entity_subtype; + } + + $options['annotation_names'] = $name; + + if ($mdname) { + $options['metadata_names'] = $mdname; + } + + if ($mdvalue) { + $options['metadata_values'] = $mdvalue; + } + + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['owner_guids'] = $owner_guid; + } else { + $options['owner_guid'] = $owner_guid; + } + } + + $options['limit'] = $limit; + $options['offset'] = $offset; + + $options['order_by'] = "calculated $orderdir"; + + $options['count'] = $count; + + return elgg_get_entities_from_annotation_calculation($options); +} + +/** + * Lists entities by the totals of a particular kind of annotation + * + * @deprecated 1.8 Use elgg_list_entities_from_annotation_calculation() + * + * @param string $entity_type Type of entity. + * @param string $entity_subtype Subtype of entity. + * @param string $name Name of annotation. + * @param int $limit Maximum number of results to return. + * @param int $owner_guid Owner. + * @param int $group_guid Group container. Currently only supported if entity_type is object + * @param boolean $asc Whether to list in ascending or descending order (default: desc) + * @param boolean $fullview Whether to display the entities in full + * @param boolean $listtypetoggle Can the 'gallery' view can be displayed (default: no) + * @param boolean $pagination Add pagination + * @param string $orderdir Order desc or asc + * + * @return string Formatted entity list + */ +function list_entities_from_annotation_count($entity_type = "", $entity_subtype = "", $name = "", +$limit = 10, $owner_guid = 0, $group_guid = 0, $asc = false, $fullview = true, +$listtypetoggle = false, $pagination = true, $orderdir = 'desc') { + + $msg = 'list_entities_from_annotation_count() is deprecated by elgg_list_entities_from_annotation_calculation().'; + + elgg_deprecated_notice($msg, 1.8); + + $options = array(); + + $options['calculation'] = 'sum'; + + if ($entity_type) { + $options['types'] = $entity_type; + } + + if ($entity_subtype) { + $options['subtypes'] = $entity_subtype; + } + + $options['annotation_names'] = $name; + + if ($owner_guid) { + if (is_array($owner_guid)) { + $options['owner_guids'] = $owner_guid; + } else { + $options['owner_guid'] = $owner_guid; + } + } + + $options['full_view'] = $fullview; + + $options['list_type_toggle'] = $listtypetoggle; + + $options['pagination'] = $pagination; + + $options['limit'] = $limit; + + $options['order_by'] = "calculated $orderdir"; + + return elgg_get_entities_from_annotation_calculation($options); +} + +/** + * Adds an entry in $CONFIG[$register_name][$subregister_name]. + * + * This is only used for the site-wide menu. See {@link add_menu()}. + * + * @param string $register_name The name of the top-level register + * @param string $subregister_name The name of the subregister + * @param mixed $subregister_value The value of the subregister + * @param array $children_array Optionally, an array of children + * + * @return true|false Depending on success + * @deprecated 1.8 + */ +function add_to_register($register_name, $subregister_name, $subregister_value, +$children_array = array()) { + elgg_deprecated_notice("add_to_register() has been deprecated", 1.8); + global $CONFIG; + + if (empty($register_name) || empty($subregister_name)) { + return false; + } + + if (!isset($CONFIG->registers)) { + $CONFIG->registers = array(); + } + + if (!isset($CONFIG->registers[$register_name])) { + $CONFIG->registers[$register_name] = array(); + } + + $subregister = new stdClass; + $subregister->name = $subregister_name; + $subregister->value = $subregister_value; + + if (is_array($children_array)) { + $subregister->children = $children_array; + } + + $CONFIG->registers[$register_name][$subregister_name] = $subregister; + return true; +} + +/** + * Removes a register entry from $CONFIG[register_name][subregister_name] + * + * This is used to by {@link remove_menu()} to remove site-wide menu items. + * + * @param string $register_name The name of the top-level register + * @param string $subregister_name The name of the subregister + * + * @return true|false Depending on success + * @since 1.7.0 + * @deprecated 1.8 + */ +function remove_from_register($register_name, $subregister_name) { + elgg_deprecated_notice("remove_from_register() has been deprecated", 1.8); + global $CONFIG; + + if (empty($register_name) || empty($subregister_name)) { + return false; + } + + if (!isset($CONFIG->registers)) { + return false; + } + + if (!isset($CONFIG->registers[$register_name])) { + return false; + } + + if (isset($CONFIG->registers[$register_name][$subregister_name])) { + unset($CONFIG->registers[$register_name][$subregister_name]); + return true; + } + + return false; +} + +/** + * If it exists, returns a particular register as an array + * + * @param string $register_name The name of the register + * + * @return array|false Depending on success + * @deprecated 1.8 + */ +function get_register($register_name) { + elgg_deprecated_notice("get_register() has been deprecated", 1.8); + global $CONFIG; + + if (isset($CONFIG->registers[$register_name])) { + return $CONFIG->registers[$register_name]; + } + + return false; +} + +/** + * Deprecated events core function. Code divided between elgg_register_event_handler() + * and trigger_elgg_event(). + * + * @param string $event The type of event (eg 'init', 'update', 'delete') + * @param string $object_type The type of object (eg 'system', 'blog', 'user') + * @param string $function The name of the function that will handle the event + * @param int $priority Priority to call handler. Lower numbers called first (default 500) + * @param boolean $call Set to true to call the event rather than add to it (default false) + * @param mixed $object Optionally, the object the event is being performed on (eg a user) + * + * @return true|false Depending on success + * @deprecated 1.8 Use explicit register/trigger event functions + */ +function events($event = "", $object_type = "", $function = "", $priority = 500, +$call = false, $object = null) { + + elgg_deprecated_notice('events() has been deprecated.', 1.8); + + // leaving this here just in case someone was directly calling this internal function + if (!$call) { + return elgg_register_event_handler($event, $object_type, $function, $priority); + } else { + return trigger_elgg_event($event, $object_type, $object); + } +} + +/** + * @deprecated 1.8 Use elgg_register_event_handler() instead + */ +function register_elgg_event_handler($event, $object_type, $callback, $priority = 500) { + elgg_deprecated_notice("register_elgg_event_handler() was deprecated by elgg_register_event_handler()", 1.8); + return elgg_register_event_handler($event, $object_type, $callback, $priority); +} + +/** + * @deprecated 1.8 Use elgg_unregister_event_handler instead + */ +function unregister_elgg_event_handler($event, $object_type, $callback) { + elgg_deprecated_notice('unregister_elgg_event_handler => elgg_unregister_event_handler', 1.8); + elgg_unregister_event_handler($event, $object_type, $callback); +} + +/** + * @deprecated 1.8 Use elgg_trigger_event() instead + */ +function trigger_elgg_event($event, $object_type, $object = null) { + elgg_deprecated_notice('trigger_elgg_event() was deprecated by elgg_trigger_event()', 1.8); + return elgg_trigger_event($event, $object_type, $object); +} + +/** + * @deprecated 1.8 Use elgg_register_plugin_hook_handler() instead + */ +function register_plugin_hook($hook, $type, $callback, $priority = 500) { + elgg_deprecated_notice("register_plugin_hook() was deprecated by elgg_register_plugin_hook_handler()", 1.8); + return elgg_register_plugin_hook_handler($hook, $type, $callback, $priority); +} + +/** + * @deprecated 1.8 Use elgg_unregister_plugin_hook_handler() instead + */ +function unregister_plugin_hook($hook, $entity_type, $callback) { + elgg_deprecated_notice("unregister_plugin_hook() was deprecated by elgg_unregister_plugin_hook_handler()", 1.8); + elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback); +} + +/** + * @deprecated 1.8 Use elgg_trigger_plugin_hook() instead + */ +function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) { + elgg_deprecated_notice("trigger_plugin_hook() was deprecated by elgg_trigger_plugin_hook()", 1.8); + return elgg_trigger_plugin_hook($hook, $type, $params, $returnvalue); +} + +/** + * Checks if code is being called from a certain function. + * + * To use, call this function with the function name (and optional + * file location) that it has to be called from, it will either + * return true or false. + * + * e.g. + * + * function my_secure_function() + * { + * if (!call_gatekeeper("my_call_function")) + * return false; + * + * ... do secure stuff ... + * } + * + * function my_call_function() + * { + * // will work + * my_secure_function(); + * } + * + * function bad_function() + * { + * // Will not work + * my_secure_function(); + * } + * + * @param mixed $function The function that this function must have in its call stack, + * to test against a method pass an array containing a class and + * method name. + * @param string $file Optional file that the function must reside in. + * + * @return bool + * + * @deprecated 1.8 A neat but pointless function + */ +function call_gatekeeper($function, $file = "") { + elgg_deprecated_notice("call_gatekeeper() is neat but pointless", 1.8); + // Sanity check + if (!$function) { + return false; + } + + // Check against call stack to see if this is being called from the correct location + $callstack = debug_backtrace(); + $stack_element = false; + + foreach ($callstack as $call) { + if (is_array($function)) { + if ( + (strcmp($call['class'], $function[0]) == 0) && + (strcmp($call['function'], $function[1]) == 0) + ) { + $stack_element = $call; + } + } else { + if (strcmp($call['function'], $function) == 0) { + $stack_element = $call; + } + } + } + + if (!$stack_element) { + return false; + } + + // If file then check that this it is being called from this function + if ($file) { + $mirror = null; + + if (is_array($function)) { + $mirror = new ReflectionMethod($function[0], $function[1]); + } else { + $mirror = new ReflectionFunction($function); + } + + if ((!$mirror) || (strcmp($file, $mirror->getFileName()) != 0)) { + return false; + } + } + + return true; +} + +/** + * This function checks to see if it is being called at somepoint by a function defined somewhere + * on a given path (optionally including subdirectories). + * + * This function is similar to call_gatekeeper() but returns true if it is being called + * by a method or function which has been defined on a given path or by a specified file. + * + * @param string $path The full path and filename that this function must have + * in its call stack If a partial path is given and + * $include_subdirs is true, then the function will return + * true if called by any function in or below the specified path. + * @param bool $include_subdirs Are subdirectories of the path ok, or must you specify an + * absolute path and filename. + * @param bool $strict_mode If true then the calling method or function must be directly + * called by something on $path, if false the whole call stack is + * searched. + * + * @return void + * + * @deprecated 1.8 A neat but pointless function + */ +function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = false) { + elgg_deprecated_notice("callpath_gatekeeper() is neat but pointless", 1.8); + + global $CONFIG; + + $path = sanitise_string($path); + + if ($path) { + $callstack = debug_backtrace(); + + foreach ($callstack as $call) { + $call['file'] = str_replace("\\", "/", $call['file']); + + if ($include_subdirs) { + if (strpos($call['file'], $path) === 0) { + + if ($strict_mode) { + $callstack[1]['file'] = str_replace("\\", "/", $callstack[1]['file']); + if ($callstack[1] === $call) { + return true; + } + } else { + return true; + } + } + } else { + if (strcmp($path, $call['file']) == 0) { + if ($strict_mode) { + if ($callstack[1] === $call) { + return true; + } + } else { + return true; + } + } + } + + } + return false; + } + + if (isset($CONFIG->debug)) { + system_message("Gatekeeper'd function called from {$callstack[1]['file']}:" + . "{$callstack[1]['line']}\n\nStack trace:\n\n" . print_r($callstack, true)); + } + + return false; +} + +/** + * Returns SQL where clause for owner and containers. + * + * @deprecated 1.8 Use elgg_get_guid_based_where_sql(); + * + * @param string $table Entity table prefix as defined in SELECT...FROM entities $table + * @param NULL|array $owner_guids Owner GUIDs + * + * @return FALSE|str + * @since 1.7.0 + * @access private + */ +function elgg_get_entity_owner_where_sql($table, $owner_guids) { + elgg_deprecated_notice('elgg_get_entity_owner_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); + + return elgg_get_guid_based_where_sql("{$table}.owner_guid", $owner_guids); +} + +/** + * Returns SQL where clause for containers. + * + * @deprecated 1.8 Use elgg_get_guid_based_where_sql(); + * + * @param string $table Entity table prefix as defined in + * SELECT...FROM entities $table + * @param NULL|array $container_guids Array of container guids + * + * @return FALSE|string + * @since 1.7.0 + * @access private + */ +function elgg_get_entity_container_where_sql($table, $container_guids) { + elgg_deprecated_notice('elgg_get_entity_container_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); + + return elgg_get_guid_based_where_sql("{$table}.container_guid", $container_guids); +} + +/** + * Returns SQL where clause for site entities + * + * @deprecated 1.8 Use elgg_get_guid_based_where_sql() + * + * @param string $table Entity table prefix as defined in SELECT...FROM entities $table + * @param NULL|array $site_guids Array of site guids + * + * @return FALSE|string + * @since 1.7.0 + * @access private + */ +function elgg_get_entity_site_where_sql($table, $site_guids) { + elgg_deprecated_notice('elgg_get_entity_site_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); + + return elgg_get_guid_based_where_sql("{$table}.site_guid", $site_guids); +} diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php index e8d47eaca..3e8b9d43d 100644 --- a/engine/lib/elgglib.php +++ b/engine/lib/elgglib.php @@ -387,22 +387,6 @@ function elgg_count_comments($entity) { } /** - * Returns all php files in a directory. - * - * @deprecated 1.7 Use elgg_get_file_list() instead - * - * @param string $directory Directory to look in - * @param array $exceptions Array of extensions (with .!) to ignore - * @param array $list A list files to include in the return - * - * @return array - */ -function get_library_files($directory, $exceptions = array(), $list = array()) { - elgg_deprecated_notice('get_library_files() deprecated by elgg_get_file_list()', 1.7); - return elgg_get_file_list($directory, $exceptions, $list, array('.php')); -} - -/** * Returns a list of files in $directory. * * Only returns files. Does not recurse into subdirs. @@ -466,84 +450,6 @@ function sanitise_filepath($path, $append_slash = TRUE) { } /** - * Adds an entry in $CONFIG[$register_name][$subregister_name]. - * - * This is only used for the site-wide menu. See {@link add_menu()}. - * - * @param string $register_name The name of the top-level register - * @param string $subregister_name The name of the subregister - * @param mixed $subregister_value The value of the subregister - * @param array $children_array Optionally, an array of children - * - * @return true|false Depending on success - * @deprecated 1.8 - */ -function add_to_register($register_name, $subregister_name, $subregister_value, -$children_array = array()) { - elgg_deprecated_notice("add_to_register() has been deprecated", 1.8); - global $CONFIG; - - if (empty($register_name) || empty($subregister_name)) { - return false; - } - - if (!isset($CONFIG->registers)) { - $CONFIG->registers = array(); - } - - if (!isset($CONFIG->registers[$register_name])) { - $CONFIG->registers[$register_name] = array(); - } - - $subregister = new stdClass; - $subregister->name = $subregister_name; - $subregister->value = $subregister_value; - - if (is_array($children_array)) { - $subregister->children = $children_array; - } - - $CONFIG->registers[$register_name][$subregister_name] = $subregister; - return true; -} - -/** - * Removes a register entry from $CONFIG[register_name][subregister_name] - * - * This is used to by {@link remove_menu()} to remove site-wide menu items. - * - * @param string $register_name The name of the top-level register - * @param string $subregister_name The name of the subregister - * - * @return true|false Depending on success - * @since 1.7.0 - * @deprecated 1.8 - */ -function remove_from_register($register_name, $subregister_name) { - elgg_deprecated_notice("remove_from_register() has been deprecated", 1.8); - global $CONFIG; - - if (empty($register_name) || empty($subregister_name)) { - return false; - } - - if (!isset($CONFIG->registers)) { - return false; - } - - if (!isset($CONFIG->registers[$register_name])) { - return false; - } - - if (isset($CONFIG->registers[$register_name][$subregister_name])) { - unset($CONFIG->registers[$register_name][$subregister_name]); - return true; - } - - return false; -} - -/** * Constructs and returns a register object. * * @param string $register_name The name of the register @@ -568,25 +474,6 @@ function make_register_object($register_name, $register_value, $children_array = } /** - * If it exists, returns a particular register as an array - * - * @param string $register_name The name of the register - * - * @return array|false Depending on success - * @deprecated 1.8 - */ -function get_register($register_name) { - elgg_deprecated_notice("get_register() has been deprecated", 1.8); - global $CONFIG; - - if (isset($CONFIG->registers[$register_name])) { - return $CONFIG->registers[$register_name]; - } - - return false; -} - -/** * Queues a message to be displayed. * * Messages will not be displayed immediately, but are stored in @@ -692,33 +579,6 @@ function register_error($error) { } /** - * Deprecated events core function. Code divided between elgg_register_event_handler() - * and trigger_elgg_event(). - * - * @param string $event The type of event (eg 'init', 'update', 'delete') - * @param string $object_type The type of object (eg 'system', 'blog', 'user') - * @param string $function The name of the function that will handle the event - * @param int $priority Priority to call handler. Lower numbers called first (default 500) - * @param boolean $call Set to true to call the event rather than add to it (default false) - * @param mixed $object Optionally, the object the event is being performed on (eg a user) - * - * @return true|false Depending on success - * @deprecated 1.8 Use explicit register/trigger event functions - */ -function events($event = "", $object_type = "", $function = "", $priority = 500, -$call = false, $object = null) { - - elgg_deprecated_notice('events() has been deprecated.', 1.8); - - // leaving this here just in case someone was directly calling this internal function - if (!$call) { - return elgg_register_event_handler($event, $object_type, $function, $priority); - } else { - return trigger_elgg_event($event, $object_type, $object); - } -} - -/** * Register a callback as an Elgg event handler. * * Events are emitted by Elgg when certain actions occur. Plugins @@ -809,14 +669,6 @@ function elgg_register_event_handler($event, $object_type, $callback, $priority } /** - * @deprecated 1.8 Use elgg_register_event_handler() instead - */ -function register_elgg_event_handler($event, $object_type, $callback, $priority = 500) { - elgg_deprecated_notice("register_elgg_event_handler() was deprecated by elgg_register_event_handler()", 1.8); - return elgg_register_event_handler($event, $object_type, $callback, $priority); -} - -/** * Unregisters a callback for an event. * * @param string $event The event type @@ -836,14 +688,6 @@ function elgg_unregister_event_handler($event, $object_type, $callback) { } /** - * @deprecated 1.8 Use elgg_unregister_event_handler instead - */ -function unregister_elgg_event_handler($event, $object_type, $callback) { - elgg_deprecated_notice('unregister_elgg_event_handler => elgg_unregister_event_handler', 1.8); - elgg_unregister_event_handler($event, $object_type, $callback); -} - -/** * Trigger an Elgg Event and run all handler callbacks registered to that event, type. * * This function runs all handlers registered to $event, $object_type or @@ -907,14 +751,6 @@ function elgg_trigger_event($event, $object_type, $object = null) { } /** - * @deprecated 1.8 Use elgg_trigger_event() instead - */ -function trigger_elgg_event($event, $object_type, $object = null) { - elgg_deprecated_notice('trigger_elgg_event() was deprecated by elgg_trigger_event()', 1.8); - return elgg_trigger_event($event, $object_type, $object); -} - -/** * Register a callback as a plugin hook handler. * * Plugin hooks allow developers to losely couple plugins and features by @@ -1012,14 +848,6 @@ function elgg_register_plugin_hook_handler($hook, $type, $callback, $priority = } /** - * @deprecated 1.8 Use elgg_register_plugin_hook_handler() instead - */ -function register_plugin_hook($hook, $type, $callback, $priority = 500) { - elgg_deprecated_notice("register_plugin_hook() was deprecated by elgg_register_plugin_hook_handler()", 1.8); - return elgg_register_plugin_hook_handler($hook, $type, $callback, $priority); -} - -/** * Unregister a callback as a plugin hook. * * @param string $hook The name of the hook @@ -1039,14 +867,6 @@ function elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback) { } /** - * @deprecated 1.8 Use elgg_unregister_plugin_hook_handler() instead - */ -function unregister_plugin_hook($hook, $entity_type, $callback) { - elgg_deprecated_notice("unregister_plugin_hook() was deprecated by elgg_unregister_plugin_hook_handler()", 1.8); - elgg_unregister_plugin_hook_handler($hook, $entity_type, $callback); -} - -/** * Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. * * This function runs all handlers regsitered to $hook, $type or @@ -1121,14 +941,6 @@ function elgg_trigger_plugin_hook($hook, $type, $params = null, $returnvalue = n } /** - * @deprecated 1.8 Use elgg_trigger_plugin_hook() instead - */ -function trigger_plugin_hook($hook, $type, $params = null, $returnvalue = null) { - elgg_deprecated_notice("trigger_plugin_hook() was deprecated by elgg_trigger_plugin_hook()", 1.8); - return elgg_trigger_plugin_hook($hook, $type, $params, $returnvalue); -} - -/** * Intercepts, logs, and display uncaught exceptions. * * @warning This function should never be called directly. @@ -1369,163 +1181,6 @@ function elgg_deprecated_notice($msg, $dep_version) { return TRUE; } - -/** - * Checks if code is being called from a certain function. - * - * To use, call this function with the function name (and optional - * file location) that it has to be called from, it will either - * return true or false. - * - * e.g. - * - * function my_secure_function() - * { - * if (!call_gatekeeper("my_call_function")) - * return false; - * - * ... do secure stuff ... - * } - * - * function my_call_function() - * { - * // will work - * my_secure_function(); - * } - * - * function bad_function() - * { - * // Will not work - * my_secure_function(); - * } - * - * @param mixed $function The function that this function must have in its call stack, - * to test against a method pass an array containing a class and - * method name. - * @param string $file Optional file that the function must reside in. - * - * @return bool - * - * @deprecated 1.8 A neat but pointless function - */ -function call_gatekeeper($function, $file = "") { - elgg_deprecated_notice("call_gatekeeper() is neat but pointless", 1.8); - // Sanity check - if (!$function) { - return false; - } - - // Check against call stack to see if this is being called from the correct location - $callstack = debug_backtrace(); - $stack_element = false; - - foreach ($callstack as $call) { - if (is_array($function)) { - if ( - (strcmp($call['class'], $function[0]) == 0) && - (strcmp($call['function'], $function[1]) == 0) - ) { - $stack_element = $call; - } - } else { - if (strcmp($call['function'], $function) == 0) { - $stack_element = $call; - } - } - } - - if (!$stack_element) { - return false; - } - - // If file then check that this it is being called from this function - if ($file) { - $mirror = null; - - if (is_array($function)) { - $mirror = new ReflectionMethod($function[0], $function[1]); - } else { - $mirror = new ReflectionFunction($function); - } - - if ((!$mirror) || (strcmp($file, $mirror->getFileName()) != 0)) { - return false; - } - } - - return true; -} - -/** - * This function checks to see if it is being called at somepoint by a function defined somewhere - * on a given path (optionally including subdirectories). - * - * This function is similar to call_gatekeeper() but returns true if it is being called - * by a method or function which has been defined on a given path or by a specified file. - * - * @param string $path The full path and filename that this function must have - * in its call stack If a partial path is given and - * $include_subdirs is true, then the function will return - * true if called by any function in or below the specified path. - * @param bool $include_subdirs Are subdirectories of the path ok, or must you specify an - * absolute path and filename. - * @param bool $strict_mode If true then the calling method or function must be directly - * called by something on $path, if false the whole call stack is - * searched. - * - * @return void - * - * @deprecated 1.8 A neat but pointless function - */ -function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = false) { - elgg_deprecated_notice("callpath_gatekeeper() is neat but pointless", 1.8); - - global $CONFIG; - - $path = sanitise_string($path); - - if ($path) { - $callstack = debug_backtrace(); - - foreach ($callstack as $call) { - $call['file'] = str_replace("\\", "/", $call['file']); - - if ($include_subdirs) { - if (strpos($call['file'], $path) === 0) { - - if ($strict_mode) { - $callstack[1]['file'] = str_replace("\\", "/", $callstack[1]['file']); - if ($callstack[1] === $call) { - return true; - } - } else { - return true; - } - } - } else { - if (strcmp($path, $call['file']) == 0) { - if ($strict_mode) { - if ($callstack[1] === $call) { - return true; - } - } else { - return true; - } - } - } - - } - return false; - } - - if (isset($CONFIG->debug)) { - system_message("Gatekeeper'd function called from {$callstack[1]['file']}:" - . "{$callstack[1]['line']}\n\nStack trace:\n\n" . print_r($callstack, true)); - } - - return false; -} - /** * Returns the current page's complete URL. * @@ -1658,23 +1313,6 @@ function elgg_add_action_tokens_to_url($url, $html_encode = FALSE) { return elgg_http_build_url($components, $html_encode); } - -/** - * Add action tokens to URL. - * - * @param string $url URL - * - * @return string - * - * @deprecated 1.7 final - */ -function elgg_validate_action_url($url) { - elgg_deprecated_notice('elgg_validate_action_url() deprecated by elgg_add_action_tokens_to_url().', - '1.7b'); - - return elgg_add_action_tokens_to_url($url); -} - /** * Removes an element from a URL's query string. * @@ -2118,30 +1756,6 @@ function elgg_normalise_plural_options_array($options, $singulars) { } /** - * Does nothing. - * - * @deprecated 1.7 - * @return 0 - */ -function test_ip() { - elgg_deprecated_notice('test_ip() was removed because of licensing issues.', 1.7); - - return 0; -} - -/** - * Does nothing. - * - * @return bool - * @deprecated 1.7 - */ -function is_ip_in_array() { - elgg_deprecated_notice('is_ip_in_array() was removed because of licensing issues.', 1.7); - - return false; -} - -/** * Emits a shutdown:system event upon PHP shutdown, but before database connections are dropped. * * @tip Register for the shutdown:system event to perform functions at the end of page loads. diff --git a/engine/lib/entities.php b/engine/lib/entities.php index aebaf1724..2a3c6ba91 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -674,7 +674,6 @@ function get_entity($guid) { return entity_row_to_elggstar(get_entity_as_row($guid)); } - /** * Returns an array of entities with optional filtering. * @@ -885,99 +884,6 @@ function elgg_get_entities(array $options = array()) { } /** - * Returns entities. - * - * @deprecated 1.7. Use elgg_get_entities(). - * - * @param string $type Entity type - * @param string $subtype Entity subtype - * @param int $owner_guid Owner GUID - * @param string $order_by Order by clause - * @param int $limit Limit - * @param int $offset Offset - * @param bool $count Return a count or an array of entities - * @param int $site_guid Site GUID - * @param int $container_guid Container GUID - * @param int $timelower Lower time limit - * @param int $timeupper Upper time limit - * - * @return array - */ -function get_entities($type = "", $subtype = "", $owner_guid = 0, $order_by = "", $limit = 10, -$offset = 0, $count = false, $site_guid = 0, $container_guid = null, $timelower = 0, -$timeupper = 0) { - - elgg_deprecated_notice('get_entities() was deprecated by elgg_get_entities().', 1.7); - - // rewrite owner_guid to container_guid to emulate old functionality - if ($owner_guid != "") { - if (is_null($container_guid)) { - $container_guid = $owner_guid; - $owner_guid = NULL; - } - } - - $options = array(); - if ($type) { - if (is_array($type)) { - $options['types'] = $type; - } else { - $options['type'] = $type; - } - } - - if ($subtype) { - if (is_array($subtype)) { - $options['subtypes'] = $subtype; - } else { - $options['subtype'] = $subtype; - } - } - - if ($owner_guid) { - if (is_array($owner_guid)) { - $options['owner_guids'] = $owner_guid; - } else { - $options['owner_guid'] = $owner_guid; - } - } - - if ($order_by) { - $options['order_by'] = $order_by; - } - - // need to pass 0 for all option - $options['limit'] = $limit; - - if ($offset) { - $options['offset'] = $offset; - } - - if ($count) { - $options['count'] = $count; - } - - if ($site_guid) { - $options['site_guids'] = $site_guid; - } - - if ($container_guid) { - $options['container_guids'] = $container_guid; - } - - if ($timeupper) { - $options['created_time_upper'] = $timeupper; - } - - if ($timelower) { - $options['created_time_lower'] = $timelower; - } - - $r = elgg_get_entities($options); - return $r; -} - -/** * Returns SQL where clause for type and subtype on main entity table * * @param string $table Entity table prefix as defined in SELECT...FROM entities $table @@ -1179,43 +1085,6 @@ function elgg_get_guid_based_where_sql($column, $guids) { } /** - * Returns SQL where clause for owner and containers. - * - * @deprecated 1.8 Use elgg_get_guid_based_where_sql(); - * - * @param string $table Entity table prefix as defined in SELECT...FROM entities $table - * @param NULL|array $owner_guids Owner GUIDs - * - * @return FALSE|str - * @since 1.7.0 - * @access private - */ -function elgg_get_entity_owner_where_sql($table, $owner_guids) { - elgg_deprecated_notice('elgg_get_entity_owner_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); - - return elgg_get_guid_based_where_sql("{$table}.owner_guid", $owner_guids); -} - -/** - * Returns SQL where clause for containers. - * - * @deprecated 1.8 Use elgg_get_guid_based_where_sql(); - * - * @param string $table Entity table prefix as defined in - * SELECT...FROM entities $table - * @param NULL|array $container_guids Array of container guids - * - * @return FALSE|string - * @since 1.7.0 - * @access private - */ -function elgg_get_entity_container_where_sql($table, $container_guids) { - elgg_deprecated_notice('elgg_get_entity_container_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); - - return elgg_get_guid_based_where_sql("{$table}.container_guid", $container_guids); -} - -/** * Returns SQL where clause for entity time limits. * * @param string $table Entity table prefix as defined in @@ -1260,24 +1129,6 @@ $time_created_lower = NULL, $time_updated_upper = NULL, $time_updated_lower = NU } /** - * Returns SQL where clause for site entities - * - * @deprecated 1.8 Use elgg_get_guid_based_where_sql() - * - * @param string $table Entity table prefix as defined in SELECT...FROM entities $table - * @param NULL|array $site_guids Array of site guids - * - * @return FALSE|string - * @since 1.7.0 - * @access private - */ -function elgg_get_entity_site_where_sql($table, $site_guids) { - elgg_deprecated_notice('elgg_get_entity_site_where_sql() is deprecated by elgg_get_guid_based_where_sql().', 1.8); - - return elgg_get_guid_based_where_sql("{$table}.site_guid", $site_guids); -} - -/** * Returns a string of parsed entities. * * Displays list of entities with formatting specified @@ -1327,56 +1178,6 @@ function elgg_list_entities(array $options = array(), $getter = 'elgg_get_entiti } /** - * Lists entities - * - * @deprecated 1.7. Use elgg_list_entities(). - * - * @param string $type Entity type - * @param string $subtype Entity subtype - * @param int $owner_guid Owner GUID - * @param int $limit Limit - * @param bool $fullview Display entity full views? - * @param bool $listtypetoggle Allow switching to gallery mode? - * @param bool $pagination Show pagination? - * - * @return string - */ -function list_entities($type= "", $subtype = "", $owner_guid = 0, $limit = 10, $fullview = true, -$listtypetoggle = false, $pagination = true) { - - elgg_deprecated_notice('list_entities() was deprecated by elgg_list_entities()!', 1.7); - - $options = array(); - - // rewrite owner_guid to container_guid to emulate old functionality - if ($owner_guid) { - $options['container_guids'] = $owner_guid; - } - - if ($type) { - $options['types'] = $type; - } - - if ($subtype) { - $options['subtypes'] = $subtype; - } - - if ($limit) { - $options['limit'] = $limit; - } - - if ($offset = sanitise_int(get_input('offset', null))) { - $options['offset'] = $offset; - } - - $options['full_view'] = $fullview; - $options['list_type_toggle'] = $listtypetoggle; - $options['pagination'] = $pagination; - - return elgg_list_entities($options); -} - -/** * Returns a list of months in which entities were updated or created. * * @tip Use this to generate a list of archives by month for when entities were added or updated. @@ -1678,25 +1479,6 @@ function delete_entity($guid, $recursive = true) { } /** - * Delete multiple entities that match a given query. - * This function iterates through and calls delete_entity on - * each one, this is somewhat inefficient but lets - * the 'delete' event be called for each entity. - * - * @deprecated 1.7. This is a dangerous function as it defaults to deleting everything. - * - * @param string $type The type of entity (eg "user", "object" etc) - * @param string $subtype The arbitrary subtype of the entity - * @param int $owner_guid The GUID of the owning user - * - * @return false - */ -function delete_entities($type = "", $subtype = "", $owner_guid = 0) { - elgg_deprecated_notice('delete_entities() was deprecated because no one should use it.', 1.7); - return false; -} - -/** * Exports attributes generated on the fly (volatile) about an entity. * * @param string $hook volatile @@ -2321,47 +2103,6 @@ function entities_page_handler($page) { } /** - * Lists entities. - * - * @param int $owner_guid Owner GUID - * @param int $limit Limit - * @param bool $fullview Show entity full views - * @param bool $listtypetoggle Show list type toggle - * @param bool $allowedtypes A string of the allowed types - * - * @return string - * @deprecated 1.7. Use elgg_list_registered_entities(). - */ -function list_registered_entities($owner_guid = 0, $limit = 10, $fullview = true, -$listtypetoggle = false, $allowedtypes = true) { - - elgg_deprecated_notice('list_registered_entities() was deprecated by elgg_list_registered_entities().', 1.7); - - $options = array(); - - // don't want to send anything if not being used. - if ($owner_guid) { - $options['owner_guid'] = $owner_guid; - } - - if ($limit) { - $options['limit'] = $limit; - } - - if ($allowedtypes) { - $options['allowed_types'] = $allowedtypes; - } - - // need to send because might be BOOL - $options['full_view'] = $fullview; - $options['list_type_toggle'] = $listtypetoggle; - - $options['offset'] = get_input('offset', 0); - - return elgg_list_registered_entities($options); -} - -/** * Returns a viewable list of entities based on the registered types. * * @see elgg_view_entity_list @@ -2474,7 +2215,6 @@ function elgg_instanceof($entity, $type = NULL, $subtype = NULL, $class = NULL) return $return; } - /** * Update the last_action column in the entities table for $guid. * diff --git a/engine/start.php b/engine/start.php index f5b97187e..916464c26 100644 --- a/engine/start.php +++ b/engine/start.php @@ -102,7 +102,8 @@ $lib_files = array( 'statistics.php', 'tags.php', 'usersettings.php', 'users.php', 'version.php', 'web_services.php', 'widgets.php', 'xml.php', 'xml-rpc.php', - 'deprecated.php' + //backwards compatibility + 'deprecated-1.7.php', 'deprecated-1.8.php', ); foreach ($lib_files as $file) { |