aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 20:43:14 +0000
committercash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-10-30 20:43:14 +0000
commit26b0603538eb447ab6832d9233e22ba7cf291b45 (patch)
tree5721922f0dc2afe485ce25905dceff1a7be7d4c1 /engine
parentc3f0a32b2bc8d055bfce97e20079cb7840746cd5 (diff)
downloadelgg-26b0603538eb447ab6832d9233e22ba7cf291b45.tar.gz
elgg-26b0603538eb447ab6832d9233e22ba7cf291b45.tar.bz2
organized functions in elgglib by purpose - more or less
git-svn-id: http://code.elgg.org/elgg/trunk@7137 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/elgglib.php679
1 files changed, 338 insertions, 341 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index ff7886561..1b078fde7 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -100,47 +100,6 @@ function forward($location = "") {
}
/**
- * Returns the current page's complete URL.
- *
- * The current URL is assembled using the network's wwwroot and the request URI
- * in $_SERVER as populated by the web server. This function will include
- * any schemes, usernames and passwords, and ports.
- *
- * @return string The current page URL.
- */
-function current_page_url() {
- global $CONFIG;
-
- $url = parse_url($CONFIG->wwwroot);
-
- $page = $url['scheme'] . "://";
-
- // user/pass
- if ((isset($url['user'])) && ($url['user'])) {
- $page .= $url['user'];
- }
- if ((isset($url['pass'])) && ($url['pass'])) {
- $page .= ":" . $url['pass'];
- }
- if ((isset($url['user']) && $url['user']) ||
- (isset($url['pass']) && $url['pass'])) {
- $page .= "@";
- }
-
- $page .= $url['host'];
-
- if ((isset($url['port'])) && ($url['port'])) {
- $page .= ":" . $url['port'];
- }
-
- $page = trim($page, "/");
-
- $page .= $_SERVER['REQUEST_URI'];
-
- return $page;
-}
-
-/**
* Returns the HTML for "likes" and "like this" on entities.
*
* @param ElggEntity $entity The entity to like
@@ -1301,100 +1260,44 @@ function callpath_gatekeeper($path, $include_subdirs = true, $strict_mode = fals
}
/**
- * Return the state of a php.ini setting.
- *
- * Normalizes the setting to bool.
+ * Returns the current page's complete URL.
*
- * @param string $ini_get_arg The INI setting
+ * The current URL is assembled using the network's wwwroot and the request URI
+ * in $_SERVER as populated by the web server. This function will include
+ * any schemes, usernames and passwords, and ports.
*
- * @return true|false Depending on whether it's on or off
+ * @return string The current page URL.
*/
-function ini_get_bool($ini_get_arg) {
- $temp = ini_get($ini_get_arg);
+function current_page_url() {
+ global $CONFIG;
- if ($temp == '1' or strtolower($temp) == 'on') {
- return true;
- }
- return false;
-}
+ $url = parse_url($CONFIG->wwwroot);
-/**
- * Returns a PHP INI setting in bytes.
- *
- * @tip Use this for arithmetic when determining if a file can be uploaded.
- *
- * @param str $setting The php.ini setting
- *
- * @return int
- * @since 1.7.0
- * @link http://www.php.net/manual/en/function.ini-get.php
- */
-function elgg_get_ini_setting_in_bytes($setting) {
- // retrieve INI setting
- $val = ini_get($setting);
+ $page = $url['scheme'] . "://";
- // convert INI setting when shorthand notation is used
- $last = strtolower($val[strlen($val) - 1]);
- switch($last) {
- case 'g':
- $val *= 1024;
- case 'm':
- $val *= 1024;
- case 'k':
- $val *= 1024;
+ // user/pass
+ if ((isset($url['user'])) && ($url['user'])) {
+ $page .= $url['user'];
}
-
- // return byte value
- return $val;
-}
-
-/**
- * Returns true is string is not empty, false, or null.
- *
- * Function to be used in array_filter which returns true if $string is not null.
- *
- * @param string $string The string to test
- *
- * @return bool
- * @todo This is used once in metadata.php. Use a lambda function instead.
- */
-function is_not_null($string) {
- if (($string === '') || ($string === false) || ($string === null)) {
- return false;
+ if ((isset($url['pass'])) && ($url['pass'])) {
+ $page .= ":" . $url['pass'];
+ }
+ if ((isset($url['user']) && $url['user']) ||
+ (isset($url['pass']) && $url['pass'])) {
+ $page .= "@";
}
- return true;
-}
-
+ $page .= $url['host'];
-/**
- * Normalise the singular keys in an options array to plural keys.
- *
- * Used in elgg_get_entities*() functions to support shortcutting plural
- * names by singular names.
- *
- * @param array $options The options array. $options['keys'] = 'values';
- * @param array $singulars A list of sinular words to pluralize by adding 's'.
- *
- * @return array
- * @since 1.7.0
- */
-function elgg_normalise_plural_options_array($options, $singulars) {
- foreach ($singulars as $singular) {
- $plural = $singular . 's';
+ if ((isset($url['port'])) && ($url['port'])) {
+ $page .= ":" . $url['port'];
+ }
- if (array_key_exists($singular, $options)) {
- if ($options[$singular] === ELGG_ENTITIES_ANY_VALUE) {
- $options[$plural] = $options[$singular];
- } else {
- $options[$plural] = array($options[$singular]);
- }
- }
+ $page = trim($page, "/");
- unset($options[$singular]);
- }
+ $page .= $_SERVER['REQUEST_URI'];
- return $options;
+ return $page;
}
/**
@@ -1421,30 +1324,6 @@ function full_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;
-}
-
-/**
* Builds a URL from the a parts array like one returned by {@link parse_url()}.
*
* @note If only partial information is passed, a partial URL will be returned.
@@ -1529,7 +1408,6 @@ function elgg_validate_action_url($url) {
return elgg_add_action_tokens_to_url($url);
}
-
/**
* Removes an element from a URL's query string.
*
@@ -1589,6 +1467,104 @@ function elgg_http_add_url_query_elements($url, array $elements) {
}
/**
+ * Test if two URLs are functionally identical.
+ *
+ * @tip If $ignore_params is used, neither the name nor its value will be considered when comparing.
+ *
+ * @tip The order of GET params doesn't matter.
+ *
+ * @param string $url1 First URL
+ * @param string $url2 Second URL
+ * @param array $ignore_params GET params to ignore in the comparison
+ *
+ * @return BOOL
+ * @since 1.8
+ */
+function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset', 'limit')) {
+ global $CONFIG;
+
+ // if the server portion is missing but it starts with / then add the url in.
+ if (elgg_substr($url1, 0, 1) == '/') {
+ $url1 = $CONFIG->url . ltrim($url1, '/');
+ }
+
+ if (elgg_substr($url1, 0, 1) == '/') {
+ $url2 = $CONFIG->url . ltrim($url2, '/');
+ }
+
+ // @todo - should probably do something with relative URLs
+
+ if ($url1 == $url2) {
+ return TRUE;
+ }
+
+ $url1_info = parse_url($url1);
+ $url2_info = parse_url($url2);
+
+ $url1_info['path'] = trim($url1_info['path'], '/');
+ $url2_info['path'] = trim($url2_info['path'], '/');
+
+ // compare basic bits
+ $parts = array('scheme', 'host', 'path');
+
+ foreach ($parts as $part) {
+ if ((isset($url1_info[$part]) && isset($url2_info[$part]))
+ && $url1_info[$part] != $url2_info[$part]) {
+ return FALSE;
+ } elseif (isset($url1_info[$part]) && !isset($url2_info[$part])) {
+ return FALSE;
+ } elseif (!isset($url1_info[$part]) && isset($url2_info[$part])) {
+ return FALSE;
+ }
+ }
+
+ // quick compare of get params
+ if (isset($url1_info['query']) && isset($url2_info['query'])
+ && $url1_info['query'] == $url2_info['query']) {
+ return TRUE;
+ }
+
+ // compare get params that might be out of order
+ $url1_params = array();
+ $url2_params = array();
+
+ if (isset($url1_info['query'])) {
+ if ($url1_info['query'] = html_entity_decode($url1_info['query'])) {
+ $url1_params = elgg_parse_str($url1_info['query']);
+ }
+ }
+
+ if (isset($url2_info['query'])) {
+ if ($url2_info['query'] = html_entity_decode($url2_info['query'])) {
+ $url2_params = elgg_parse_str($url2_info['query']);
+ }
+ }
+
+ // drop ignored params
+ foreach ($ignore_params as $param) {
+ if (isset($url1_params[$param])) {
+ unset($url1_params[$param]);
+ }
+ if (isset($url2_params[$param])) {
+ unset($url2_params[$param]);
+ }
+ }
+
+ // array_diff_assoc only returns the items in arr1 that aren't in arrN
+ // but not the items that ARE in arrN but NOT in arr1
+ // if arr1 is an empty array, this function will return 0 no matter what.
+ // since we only care if they're different and not how different,
+ // add the results together to get a non-zero (ie, different) result
+ $diff_count = count(array_diff_assoc($url1_params, $url2_params));
+ $diff_count += count(array_diff_assoc($url2_params, $url1_params));
+ if ($diff_count > 0) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
+/**
* Load all the REQUEST variables into the sticky form cache
*
* Call this from an action when you want all your submitted variables
@@ -1715,218 +1691,241 @@ function elgg_set_active_sticky_form($form_name) {
}
/**
- * Serve javascript pages.
+ * Checks for $array[$key] and returns its value if it exists, else
+ * returns $default.
*
- * Searches for views under js/ and outputs them with special
- * headers for caching control.
+ * Shorthand for $value = (isset($array['key'])) ? $array['key'] : 'default';
*
- * @param array $page The page array
+ * @param string $key The key to check.
+ * @param array $array The array to check against.
+ * @param mixed $default Default value to return if nothing is found.
*
* @return void
- * @elgg_pagehandler js
+ * @since 1.8
*/
-function js_page_handler($page) {
- if (is_array($page) && sizeof($page)) {
- $js = str_replace('.js', '', $page[0]);
- $return = elgg_view('js/' . $js);
-
- header('Content-type: text/javascript');
- header('Expires: ' . date('r', time() + 864000));
- header("Pragma: public");
- header("Cache-Control: public");
- header("Content-Length: " . strlen($return));
-
- echo $return;
- exit;
- }
+function elgg_get_array_value($key, array $array, $default = NULL) {
+ return (isset($array[$key])) ? $array[$key] : $default;
}
/**
- * Emits a shutdown:system event upon PHP shutdown, but before database connections are dropped.
+ * Sorts a 3d array by specific element.
*
- * @tip Register for the shutdown:system event to perform functions at the end of page loads.
+ * @warning Will re-index numeric indexes.
*
- * @warning Using this event to perform long-running functions is not very
- * useful. Servers will hold pages until processing is done before sending
- * them out to the browser.
+ * @note This operates the same as the built-in sort functions.
+ * It sorts the array and returns a bool for success.
*
- * @return void
- * @see register_shutdown_hook()
+ * Do this: elgg_sort_3d_array_by_value($my_array);
+ * Not this: $my_array = elgg_sort_3d_array_by_value($my_array);
+ *
+ * @param array &$array Array to sort
+ * @param string $element Element to sort by
+ * @param int $sort_order PHP sort order
+ * {@see http://us2.php.net/array_multisort}
+ * @param int $sort_type PHP sort type
+ * {@see http://us2.php.net/sort}
+ *
+ * @return bool
*/
-function _elgg_shutdown_hook() {
- global $START_MICROTIME;
+function elgg_sort_3d_array_by_value(&$array, $element, $sort_order = SORT_ASC,
+$sort_type = SORT_LOCALE_STRING) {
- trigger_elgg_event('shutdown', 'system');
+ $sort = array();
- $time = (float)(microtime(TRUE) - $START_MICROTIME);
- // demoted to NOTICE from DEBUG so javascript is not corrupted
- elgg_log("Page {$_SERVER['REQUEST_URI']} generated in $time seconds", 'NOTICE');
+ foreach ($array as $k => $v) {
+ if (isset($v[$element])) {
+ $sort[] = strtolower($v[$element]);
+ } else {
+ $sort[] = NULL;
+ }
+ };
+
+ return array_multisort($sort, $sort_order, $sort_type, $array);
}
/**
- * Elgg's main init.
+ * Return the state of a php.ini setting.
*
- * Handles core actions for comments and likes, the JS pagehandler, and the shutdown function.
+ * Normalizes the setting to bool.
*
- * @elgg_event_handler init system
- * @return void
+ * @param string $ini_get_arg The INI setting
+ *
+ * @return true|false Depending on whether it's on or off
*/
-function elgg_init() {
- global $CONFIG;
-
- register_action('comments/add');
- register_action('comments/delete');
- register_action('likes/add');
- register_action('likes/delete');
-
- register_page_handler('js', 'js_page_handler');
-
- // Trigger the shutdown:system event upon PHP shutdown.
- register_shutdown_function('_elgg_shutdown_hook');
+function ini_get_bool($ini_get_arg) {
+ $temp = ini_get($ini_get_arg);
- // Sets a blacklist of words in the current language.
- // This is a comma separated list in word:blacklist.
- // @todo possibly deprecate
- $CONFIG->wordblacklist = array();
- $list = explode(',', elgg_echo('word:blacklist'));
- if ($list) {
- foreach ($list as $l) {
- $CONFIG->wordblacklist[] = trim($l);
- }
+ if ($temp == '1' or strtolower($temp) == 'on') {
+ return true;
}
+ return false;
}
/**
- * Intercepts the index page when Walled Garden mode is enabled.
+ * Returns a PHP INI setting in bytes.
*
- * @link http://docs.elgg.org/Tutorials/WalledGarden
- * @elgg_plugin_hook index system
- * @return void
+ * @tip Use this for arithmetic when determining if a file can be uploaded.
+ *
+ * @param str $setting The php.ini setting
+ *
+ * @return int
+ * @since 1.7.0
+ * @link http://www.php.net/manual/en/function.ini-get.php
*/
-function elgg_walled_garden_index() {
- $login = elgg_view('account/forms/login_walled_garden');
+function elgg_get_ini_setting_in_bytes($setting) {
+ // retrieve INI setting
+ $val = ini_get($setting);
- page_draw('', $login, 'page_shells/walled_garden');
+ // convert INI setting when shorthand notation is used
+ $last = strtolower($val[strlen($val) - 1]);
+ switch($last) {
+ case 'g':
+ $val *= 1024;
+ case 'm':
+ $val *= 1024;
+ case 'k':
+ $val *= 1024;
+ }
- // @hack Index must exit to keep plugins from continuing to extend
- exit;
+ // return byte value
+ return $val;
}
/**
- * Adds unit tests for the general API.
+ * Returns true is string is not empty, false, or null.
*
- * @param string $hook unit_test
- * @param string $type system
- * @param array $value array of test files
- * @param array $params empty
+ * Function to be used in array_filter which returns true if $string is not null.
*
- * @elgg_plugin_hook unit_tests system
- * @return void
+ * @param string $string The string to test
+ *
+ * @return bool
+ * @todo This is used once in metadata.php. Use a lambda function instead.
*/
-function elgg_api_test($hook, $type, $value, $params) {
- global $CONFIG;
- $value[] = $CONFIG->path . 'engine/tests/api/entity_getter_functions.php';
- $value[] = $CONFIG->path . 'engine/tests/api/helpers.php';
- $value[] = $CONFIG->path . 'engine/tests/regression/trac_bugs.php';
- return $value;
+function is_not_null($string) {
+ if (($string === '') || ($string === false) || ($string === null)) {
+ return false;
+ }
+
+ return true;
}
/**
- * Test if two URLs are functionally identical.
- *
- * @tip If $ignore_params is used, neither the name nor its value will be considered when comparing.
+ * Normalise the singular keys in an options array to plural keys.
*
- * @tip The order of GET params doesn't matter.
+ * Used in elgg_get_entities*() functions to support shortcutting plural
+ * names by singular names.
*
- * @param string $url1 First URL
- * @param string $url2 Second URL
- * @param array $ignore_params GET params to ignore in the comparison
+ * @param array $options The options array. $options['keys'] = 'values';
+ * @param array $singulars A list of sinular words to pluralize by adding 's'.
*
- * @return BOOL
- * @since 1.8
+ * @return array
+ * @since 1.7.0
*/
-function elgg_http_url_is_identical($url1, $url2, $ignore_params = array('offset', 'limit')) {
- global $CONFIG;
+function elgg_normalise_plural_options_array($options, $singulars) {
+ foreach ($singulars as $singular) {
+ $plural = $singular . 's';
- // if the server portion is missing but it starts with / then add the url in.
- if (elgg_substr($url1, 0, 1) == '/') {
- $url1 = $CONFIG->url . ltrim($url1, '/');
- }
+ if (array_key_exists($singular, $options)) {
+ if ($options[$singular] === ELGG_ENTITIES_ANY_VALUE) {
+ $options[$plural] = $options[$singular];
+ } else {
+ $options[$plural] = array($options[$singular]);
+ }
+ }
- if (elgg_substr($url1, 0, 1) == '/') {
- $url2 = $CONFIG->url . ltrim($url2, '/');
+ unset($options[$singular]);
}
- // @todo - should probably do something with relative URLs
+ return $options;
+}
- if ($url1 == $url2) {
- return TRUE;
- }
+/**
+ * Does nothing.
+ *
+ * @deprecated 1.7
+ * @return 0
+ */
+function test_ip() {
+ elgg_deprecated_notice('test_ip() was removed because of licensing issues.', 1.7);
- $url1_info = parse_url($url1);
- $url2_info = parse_url($url2);
+ return 0;
+}
- $url1_info['path'] = trim($url1_info['path'], '/');
- $url2_info['path'] = trim($url2_info['path'], '/');
+/**
+ * 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);
- // compare basic bits
- $parts = array('scheme', 'host', 'path');
+ return false;
+}
- foreach ($parts as $part) {
- if ((isset($url1_info[$part]) && isset($url2_info[$part]))
- && $url1_info[$part] != $url2_info[$part]) {
- return FALSE;
- } elseif (isset($url1_info[$part]) && !isset($url2_info[$part])) {
- return FALSE;
- } elseif (!isset($url1_info[$part]) && isset($url2_info[$part])) {
- 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.
+ *
+ * @warning Using this event to perform long-running functions is not very
+ * useful. Servers will hold pages until processing is done before sending
+ * them out to the browser.
+ *
+ * @return void
+ * @see register_shutdown_hook()
+ */
+function _elgg_shutdown_hook() {
+ global $START_MICROTIME;
- // quick compare of get params
- if (isset($url1_info['query']) && isset($url2_info['query'])
- && $url1_info['query'] == $url2_info['query']) {
- return TRUE;
- }
+ trigger_elgg_event('shutdown', 'system');
- // compare get params that might be out of order
- $url1_params = array();
- $url2_params = array();
+ $time = (float)(microtime(TRUE) - $START_MICROTIME);
+ // demoted to NOTICE from DEBUG so javascript is not corrupted
+ elgg_log("Page {$_SERVER['REQUEST_URI']} generated in $time seconds", 'NOTICE');
+}
- if (isset($url1_info['query'])) {
- if ($url1_info['query'] = html_entity_decode($url1_info['query'])) {
- $url1_params = elgg_parse_str($url1_info['query']);
- }
- }
+/**
+ * Serve javascript pages.
+ *
+ * Searches for views under js/ and outputs them with special
+ * headers for caching control.
+ *
+ * @param array $page The page array
+ *
+ * @return void
+ * @elgg_pagehandler js
+ */
+function js_page_handler($page) {
+ if (is_array($page) && sizeof($page)) {
+ $js = str_replace('.js', '', $page[0]);
+ $return = elgg_view('js/' . $js);
- if (isset($url2_info['query'])) {
- if ($url2_info['query'] = html_entity_decode($url2_info['query'])) {
- $url2_params = elgg_parse_str($url2_info['query']);
- }
- }
+ header('Content-type: text/javascript');
+ header('Expires: ' . date('r', time() + 864000));
+ header("Pragma: public");
+ header("Cache-Control: public");
+ header("Content-Length: " . strlen($return));
- // drop ignored params
- foreach ($ignore_params as $param) {
- if (isset($url1_params[$param])) {
- unset($url1_params[$param]);
- }
- if (isset($url2_params[$param])) {
- unset($url2_params[$param]);
- }
+ echo $return;
+ exit;
}
+}
- // array_diff_assoc only returns the items in arr1 that aren't in arrN
- // but not the items that ARE in arrN but NOT in arr1
- // if arr1 is an empty array, this function will return 0 no matter what.
- // since we only care if they're different and not how different,
- // add the results together to get a non-zero (ie, different) result
- $diff_count = count(array_diff_assoc($url1_params, $url2_params));
- $diff_count += count(array_diff_assoc($url2_params, $url1_params));
- if ($diff_count > 0) {
- return FALSE;
- }
+/**
+ * Intercepts the index page when Walled Garden mode is enabled.
+ *
+ * @link http://docs.elgg.org/Tutorials/WalledGarden
+ * @elgg_plugin_hook index system
+ * @return void
+ */
+function elgg_walled_garden_index() {
+ $login = elgg_view('account/forms/login_walled_garden');
- return TRUE;
+ page_draw('', $login, 'page_shells/walled_garden');
+
+ // @hack Index must exit to keep plugins from continuing to extend
+ exit;
}
/**
@@ -1952,59 +1951,57 @@ function elgg_walled_garden() {
}
/**
- * Checks for $array[$key] and returns its value if it exists, else
- * returns $default.
- *
- * Shorthand for $value = (isset($array['key'])) ? $array['key'] : 'default';
+ * Elgg's main init.
*
- * @param string $key The key to check.
- * @param array $array The array to check against.
- * @param mixed $default Default value to return if nothing is found.
+ * Handles core actions for comments and likes, the JS pagehandler, and the shutdown function.
*
+ * @elgg_event_handler init system
* @return void
- * @since 1.8
*/
-function elgg_get_array_value($key, array $array, $default = NULL) {
- return (isset($array[$key])) ? $array[$key] : $default;
+function elgg_init() {
+ global $CONFIG;
+
+ register_action('comments/add');
+ register_action('comments/delete');
+ register_action('likes/add');
+ register_action('likes/delete');
+
+ register_page_handler('js', 'js_page_handler');
+
+ // Trigger the shutdown:system event upon PHP shutdown.
+ register_shutdown_function('_elgg_shutdown_hook');
+
+ // Sets a blacklist of words in the current language.
+ // This is a comma separated list in word:blacklist.
+ // @todo possibly deprecate
+ $CONFIG->wordblacklist = array();
+ $list = explode(',', elgg_echo('word:blacklist'));
+ if ($list) {
+ foreach ($list as $l) {
+ $CONFIG->wordblacklist[] = trim($l);
+ }
+ }
}
/**
- * Sorts a 3d array by specific element.
- *
- * @warning Will re-index numeric indexes.
- *
- * @note This operates the same as the built-in sort functions.
- * It sorts the array and returns a bool for success.
- *
- * Do this: elgg_sort_3d_array_by_value($my_array);
- * Not this: $my_array = elgg_sort_3d_array_by_value($my_array);
+ * Adds unit tests for the general API.
*
- * @param array &$array Array to sort
- * @param string $element Element to sort by
- * @param int $sort_order PHP sort order
- * {@see http://us2.php.net/array_multisort}
- * @param int $sort_type PHP sort type
- * {@see http://us2.php.net/sort}
+ * @param string $hook unit_test
+ * @param string $type system
+ * @param array $value array of test files
+ * @param array $params empty
*
- * @return bool
+ * @elgg_plugin_hook unit_tests system
+ * @return void
*/
-function elgg_sort_3d_array_by_value(&$array, $element, $sort_order = SORT_ASC,
-$sort_type = SORT_LOCALE_STRING) {
-
- $sort = array();
-
- foreach ($array as $k => $v) {
- if (isset($v[$element])) {
- $sort[] = strtolower($v[$element]);
- } else {
- $sort[] = NULL;
- }
- };
-
- return array_multisort($sort, $sort_order, $sort_type, $array);
+function elgg_api_test($hook, $type, $value, $params) {
+ global $CONFIG;
+ $value[] = $CONFIG->path . 'engine/tests/api/entity_getter_functions.php';
+ $value[] = $CONFIG->path . 'engine/tests/api/helpers.php';
+ $value[] = $CONFIG->path . 'engine/tests/regression/trac_bugs.php';
+ return $value;
}
-
/**#@+
* Controlls access levels on ElggEntity entities, metadata, and annotations.
*