aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/elgglib.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/elgglib.php')
-rw-r--r--engine/lib/elgglib.php42
1 files changed, 33 insertions, 9 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 6c94133df..e67f8b627 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -202,6 +202,7 @@ function elgg_unregister_js($name) {
*
* @param string $name Identifier of the JavaScript resource
*
+ * @return void
* @since 1.8.0
*/
function elgg_load_js($name) {
@@ -254,6 +255,7 @@ function elgg_unregister_css($name) {
*
* @param string $name Identifier of the CSS file
*
+ * @return void
* @since 1.8.0
*/
function elgg_load_css($name) {
@@ -354,8 +356,9 @@ function elgg_unregister_external_file($type, $name) {
* Load an external resource for use on this page
*
* @param string $type Type of file: js or css
- * @param string $name
+ * @param string $name The identifier for the file
*
+ * @return void
* @since 1.8.0
*/
function elgg_load_external_file($type, $name) {
@@ -1152,13 +1155,16 @@ function elgg_dump($value, $to_screen = TRUE, $level = 'NOTICE') {
*
* @see CODING.txt
*
- * @param str $msg Message to log / display.
- * @param str $dep_version Human-readable *release* version: 1.7, 1.7.3
+ * @param str $msg Message to log / display.
+ * @param str $dep_version Human-readable *release* version: 1.7, 1.7.3
+ * @param int $backtrace_level How many levels back to display the backtrace. Useful if calling from
+ * functions that are called from other places (like elgg_view()). Set
+ * to -1 for a full backtrace.
*
* @return bool
* @since 1.7.0
*/
-function elgg_deprecated_notice($msg, $dep_version) {
+function elgg_deprecated_notice($msg, $dep_version, $backtrace_level = 1) {
// if it's a major release behind, visual and logged
// if it's a 1 minor release behind, visual and logged
// if it's for current minor release, logged.
@@ -1192,9 +1198,26 @@ function elgg_deprecated_notice($msg, $dep_version) {
// Get a file and line number for the log. Never show this in the UI.
// Skip over the function that sent this notice and see who called the deprecated
// function itself.
+ $msg .= " Called from ";
+ $stack = array();
$backtrace = debug_backtrace();
- $caller = $backtrace[1];
- $msg .= " (Called from {$caller['file']}:{$caller['line']})";
+ // never show this call.
+ array_shift($backtrace);
+ $i = count($backtrace);
+
+ foreach ($backtrace as $trace) {
+ $stack[] = "[#$i] {$trace['file']}:{$trace['line']}";
+ $i--;
+
+ if ($backtrace_level > 0) {
+ if ($backtrace_level <= 1) {
+ break;
+ }
+ $backtrace_level--;
+ }
+ }
+
+ $msg .= implode("<br /> -> ", $stack);
elgg_log($msg, 'WARNING');
@@ -1623,8 +1646,9 @@ function is_not_null($string) {
* 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'.
+ * @param array $singulars A list of singular words to pluralize by adding 's'.
*
+ * @access private
* @return array
* @since 1.7.0
*/
@@ -1744,8 +1768,8 @@ function elgg_css_page_handler($page) {
*
* /<css||js>/name/of/view.<last_cache>.<css||js>
*
- * @param array $page The page array
- * @param string $type The type: js or css
+ * @param array $page The page array
+ * @param string $type The type: js or css
*
* @return mixed
*/