[2935] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | \**************************************************************************/ |
---|
| 11 | |
---|
| 12 | /** |
---|
| 13 | * Generates warning message of deprecated methods executing PHP function trigger_error |
---|
| 14 | * @author Anderson Tadayuki Saikawa |
---|
| 15 | * @param string $new_class The name of the class that has the method that replaces the deprecated one |
---|
| 16 | * @param string $new_method The name of the method that replaces the deprecated one |
---|
| 17 | * @return boolean |
---|
| 18 | * @license http://www.gnu.org/copyleft/gpl.html GPL |
---|
| 19 | * @package Workflow |
---|
| 20 | * @access public |
---|
| 21 | */ |
---|
| 22 | function wf_warn_deprecated_method($new_class = null, $new_method = null) |
---|
| 23 | { |
---|
| 24 | $caller = next(debug_backtrace()); |
---|
[2953] | 25 | $old_class = !empty($caller['class']) ? " of <strong>" . $caller['class'] . "</strong> object" : ""; |
---|
| 26 | $deprecated_msg = sprintf("Deprecated method <strong>%s</strong>%s was called in <strong>%s</strong> on line <strong>%s</strong>. It MUST be replaced by its equivalent", |
---|
| 27 | $caller['function'], $old_class, $caller['file'], $caller['line']); |
---|
| 28 | if(!empty($new_class) && !empty($new_method)){ |
---|
| 29 | $new_class = !empty($new_class) ? " of <strong>" . $new_class . "</strong> object" : ""; |
---|
| 30 | $deprecated_msg .= sprintf(' <strong>%s</strong>%s', $new_method, $new_class); |
---|
| 31 | } |
---|
[2935] | 32 | $error_msg = $deprecated_msg . ".\n<br>Error handler"; |
---|
| 33 | return trigger_error("[WORKFLOW WARNING]: " . $error_msg, E_USER_WARNING); |
---|
| 34 | } |
---|
| 35 | |
---|
| 36 | ?> |
---|