Changeset 6514 for trunk/wp-includes/functions.php
- Timestamp:
- 12/28/2007 09:17:42 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/wp-includes/functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r6447 r6514 1606 1606 } 1607 1607 1608 /** 1609 * _deprecated_function() - Marks a function as deprecated and informs when it has been used. 1610 * 1611 * There is a hook deprecated_function_run that will be called that can be used to get the backtrace 1612 * up to what file and function called the deprecated function. 1613 * 1614 * The current behavior is to trigger an user error if WP_DEBUG is defined and is true. 1615 * 1616 * This function is to be used in every function in depreceated.php 1617 * 1618 * @package WordPress 1619 * @package Debug 1620 * @since 2.4 1621 * @access private 1622 * 1623 * @uses do_action() Calls 'deprecated_function_run' and passes the function name and what to use instead. 1624 * @uses apply_filters() Calls 'deprecated_function_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 1625 * 1626 * @param string $function The function that was called 1627 * @param string $version The version of WordPress that depreceated the function 1628 * @param string $replacement Optional. The function that should have been called 1629 */ 1630 function _deprecated_function($function, $version, $replacement=null) { 1631 1632 do_action('deprecated_function_run', $function, $replacement); 1633 1634 // Allow plugin to filter the output error trigger 1635 if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_function_trigger_error', true )) { 1636 if( !is_null($replacement) ) 1637 trigger_error( printf( __("%s is <strong>deprecated</strong> since version %s! Use %s instead."), $function, $version, $replacement ) ); 1638 else 1639 trigger_error( printf( __("%s is <strong>deprecated</strong since version %s with no alternative available."), $function, $version ) ); 1640 } 1641 } 1642 1643 /** 1644 * _deprecated_file() - Marks a file as deprecated and informs when it has been used. 1645 * 1646 * There is a hook deprecated_file_included that will be called that can be used to get the backtrace 1647 * up to what file and function included the deprecated file. 1648 * 1649 * The current behavior is to trigger an user error if WP_DEBUG is defined and is true. 1650 * 1651 * This function is to be used in every file that is depreceated 1652 * 1653 * @package WordPress 1654 * @package Debug 1655 * @since 2.4 1656 * @access private 1657 * 1658 * @uses do_action() Calls 'deprecated_file_included' and passes the file name and what to use instead. 1659 * @uses apply_filters() Calls 'deprecated_file_trigger_error' and expects boolean value of true to do trigger or false to not trigger error. 1660 * 1661 * @param string $file The file that was included 1662 * @param string $version The version of WordPress that depreceated the function 1663 * @param string $replacement Optional. The function that should have been called 1664 */ 1665 function _deprecated_file($file, $version, $replacement=null) { 1666 1667 do_action('deprecated_file_included', $file, $replacement); 1668 1669 // Allow plugin to filter the output error trigger 1670 if( defined('WP_DEBUG') && ( true === WP_DEBUG ) && apply_filters( 'deprecated_file_trigger_error', true )) { 1671 if( !is_null($replacement) ) 1672 trigger_error( printf( __("%s is <strong>deprecated</strong> since version %s! Use %s instead."), $file, $version, $replacement ) ); 1673 else 1674 trigger_error( printf( __("%s is <strong>deprecated</strong since version %s with no alternative available."), $file, $version ) ); 1675 } 1676 } 1608 1677 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)