Changeset 24718 for trunk/wp-includes/wp-db.php
- Timestamp:
- 07/16/2013 05:44:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/wp-db.php
r24712 r24718 847 847 848 848 /** 849 * Weak escape, using addslashes() 850 * 851 * @see addslashes() 849 * Do not use, deprecated. 850 * 851 * Use esc_sql() or wpdb::prepare() instead. 852 * 852 853 * @since 2.8.0 854 * @deprecated 3.6.0 855 * @see wpdb::prepare 856 * @see esc_sql() 853 857 * @access private 854 858 * … … 857 861 */ 858 862 function _weak_escape( $string ) { 863 if ( func_num_args() === 1 ) 864 _deprecated_function( __METHOD__, '3.6', 'wpdb::prepare() or esc_sql()' ); 859 865 return addslashes( $string ); 860 866 } … … 877 883 * Escape data. Works on arrays. 878 884 * 879 * @uses wpdb::_escape()880 885 * @uses wpdb::_real_escape() 881 886 * @since 2.8.0 … … 887 892 function _escape( $data ) { 888 893 if ( is_array( $data ) ) { 889 foreach ( (array)$data as $k => $v ) {894 foreach ( $data as $k => $v ) { 890 895 if ( is_array($v) ) 891 896 $data[$k] = $this->_escape( $v ); … … 901 906 902 907 /** 903 * Escapes content for insertion into the database using addslashes(), for security. 904 * 905 * Works on arrays. 906 * 907 * @since 0.71 908 * @param string|array $data to escape 909 * @return string|array escaped as query safe string 908 * Do not use, deprecated. 909 * 910 * Use esc_sql() or wpdb::prepare() instead. 911 * 912 * @since 0.71 913 * @deprecated 3.6.0 914 * @see wpdb::prepare() 915 * @see esc_sql() 916 * 917 * @param mixed $data 918 * @return mixed 910 919 */ 911 920 function escape( $data ) { 921 if ( func_num_args() === 1 ) 922 _deprecated_function( __METHOD__, '3.6', 'wpdb::prepare() or esc_sql()' ); 912 923 if ( is_array( $data ) ) { 913 foreach ( (array)$data as $k => $v ) {924 foreach ( $data as $k => $v ) { 914 925 if ( is_array( $v ) ) 915 $data[$k] = $this->escape( $v );926 $data[$k] = $this->escape( $v, 'recursive' ); 916 927 else 917 $data[$k] = $this->_weak_escape( $v );928 $data[$k] = $this->_weak_escape( $v, 'internal' ); 918 929 } 919 930 } else { 920 $data = $this->_weak_escape( $data );931 $data = $this->_weak_escape( $data, 'internal' ); 921 932 } 922 933
Note: See TracChangeset
for help on using the changeset viewer.