Changes from branches/3.4/wp-includes/functions.php at r21146 to trunk/wp-includes/functions.php at r20715
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/functions.php
r21146 r20715 1836 1836 * Retrieve nonce action "Are you sure" message. 1837 1837 * 1838 * Deprecated in 3.4.1 and 3.5.0. Backported to 3.3.3. 1839 * 1840 * @since 2.0.4 1841 * @deprecated 3.4.1 1842 * @deprecated Use wp_nonce_ays() 1843 * @see wp_nonce_ays() 1844 * 1845 * @param string $action Nonce action. 1846 * @return string Are you sure message. 1847 */ 1848 function wp_explain_nonce( $action ) { 1849 _deprecated_function( __FUNCTION__, '3.4.1', 'wp_nonce_ays()' ); 1850 return __( 'Are you sure you want to do this?' ); 1851 } 1852 1853 /** 1854 * Display "Are You Sure" message to confirm the action being taken. 1855 * 1856 * If the action has the nonce explain message, then it will be displayed along 1857 * with the "Are you sure?" message. 1838 * The action is split by verb and noun. The action format is as follows: 1839 * verb-action_extra. The verb is before the first dash and has the format of 1840 * letters and no spaces and numbers. The noun is after the dash and before the 1841 * underscore, if an underscore exists. The noun is also only letters. 1842 * 1843 * The filter will be called for any action, which is not defined by WordPress. 1844 * You may use the filter for your plugin to explain nonce actions to the user, 1845 * when they get the "Are you sure?" message. The filter is in the format of 1846 * 'explain_nonce_$verb-$noun' with the $verb replaced by the found verb and the 1847 * $noun replaced by the found noun. The two parameters that are given to the 1848 * hook are the localized "Are you sure you want to do this?" message with the 1849 * extra text (the text after the underscore). 1858 1850 * 1859 1851 * @package WordPress … … 1861 1853 * @since 2.0.4 1862 1854 * 1855 * @param string $action Nonce action. 1856 * @return string Are you sure message. 1857 */ 1858 function wp_explain_nonce( $action ) { 1859 if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) { 1860 $verb = $matches[1]; 1861 $noun = $matches[2]; 1862 1863 $trans = array(); 1864 $trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: “%s” has failed.' ), 'get_the_title' ); 1865 1866 $trans['add']['category'] = array( __( 'Your attempt to add this category has failed.' ), false ); 1867 $trans['delete']['category'] = array( __( 'Your attempt to delete this category: “%s” has failed.' ), 'get_cat_name' ); 1868 $trans['update']['category'] = array( __( 'Your attempt to edit this category: “%s” has failed.' ), 'get_cat_name' ); 1869 1870 $trans['delete']['comment'] = array( __( 'Your attempt to delete this comment: “%s” has failed.' ), 'use_id' ); 1871 $trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: “%s” has failed.' ), 'use_id' ); 1872 $trans['approve']['comment'] = array( __( 'Your attempt to approve this comment: “%s” has failed.' ), 'use_id' ); 1873 $trans['update']['comment'] = array( __( 'Your attempt to edit this comment: “%s” has failed.' ), 'use_id' ); 1874 $trans['bulk']['comments'] = array( __( 'Your attempt to bulk modify comments has failed.' ), false ); 1875 $trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false ); 1876 1877 $trans['add']['bookmark'] = array( __( 'Your attempt to add this link has failed.' ), false ); 1878 $trans['delete']['bookmark'] = array( __( 'Your attempt to delete this link: “%s” has failed.' ), 'use_id' ); 1879 $trans['update']['bookmark'] = array( __( 'Your attempt to edit this link: “%s” has failed.' ), 'use_id' ); 1880 $trans['bulk']['bookmarks'] = array( __( 'Your attempt to bulk modify links has failed.' ), false ); 1881 1882 $trans['add']['page'] = array( __( 'Your attempt to add this page has failed.' ), false ); 1883 $trans['delete']['page'] = array( __( 'Your attempt to delete this page: “%s” has failed.' ), 'get_the_title' ); 1884 $trans['update']['page'] = array( __( 'Your attempt to edit this page: “%s” has failed.' ), 'get_the_title' ); 1885 1886 $trans['edit']['plugin'] = array( __( 'Your attempt to edit this plugin file: “%s” has failed.' ), 'use_id' ); 1887 $trans['activate']['plugin'] = array( __( 'Your attempt to activate this plugin: “%s” has failed.' ), 'use_id' ); 1888 $trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: “%s” has failed.' ), 'use_id' ); 1889 $trans['upgrade']['plugin'] = array( __( 'Your attempt to update this plugin: “%s” has failed.' ), 'use_id' ); 1890 1891 $trans['add']['post'] = array( __( 'Your attempt to add this post has failed.' ), false ); 1892 $trans['delete']['post'] = array( __( 'Your attempt to delete this post: “%s” has failed.' ), 'get_the_title' ); 1893 $trans['update']['post'] = array( __( 'Your attempt to edit this post: “%s” has failed.' ), 'get_the_title' ); 1894 1895 $trans['add']['user'] = array( __( 'Your attempt to add this user has failed.' ), false ); 1896 $trans['delete']['users'] = array( __( 'Your attempt to delete users has failed.' ), false ); 1897 $trans['bulk']['users'] = array( __( 'Your attempt to bulk modify users has failed.' ), false ); 1898 $trans['update']['user'] = array( __( 'Your attempt to edit this user: “%s” has failed.' ), 'get_the_author_meta', 'display_name' ); 1899 $trans['update']['profile'] = array( __( 'Your attempt to modify the profile for: “%s” has failed.' ), 'get_the_author_meta', 'display_name' ); 1900 1901 $trans['update']['options'] = array( __( 'Your attempt to edit your settings has failed.' ), false ); 1902 $trans['update']['permalink'] = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' ); 1903 $trans['edit']['file'] = array( __( 'Your attempt to edit this file: “%s” has failed.' ), 'use_id' ); 1904 $trans['edit']['theme'] = array( __( 'Your attempt to edit this theme file: “%s” has failed.' ), 'use_id' ); 1905 $trans['switch']['theme'] = array( __( 'Your attempt to switch to this theme: “%s” has failed.' ), 'use_id' ); 1906 1907 $trans['log']['out'] = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false ); 1908 1909 if ( isset( $trans[$verb][$noun] ) ) { 1910 if ( !empty( $trans[$verb][$noun][1] ) ) { 1911 $lookup = $trans[$verb][$noun][1]; 1912 if ( isset($trans[$verb][$noun][2]) ) 1913 $lookup_value = $trans[$verb][$noun][2]; 1914 $object = $matches[4]; 1915 if ( 'use_id' != $lookup ) { 1916 if ( isset( $lookup_value ) ) 1917 $object = call_user_func( $lookup, $lookup_value, $object ); 1918 else 1919 $object = call_user_func( $lookup, $object ); 1920 } 1921 return sprintf( $trans[$verb][$noun][0], esc_html($object) ); 1922 } else { 1923 return $trans[$verb][$noun][0]; 1924 } 1925 } 1926 1927 return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), isset($matches[4]) ? $matches[4] : '' ); 1928 } else { 1929 return apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' ) ); 1930 } 1931 } 1932 1933 /** 1934 * Display "Are You Sure" message to confirm the action being taken. 1935 * 1936 * If the action has the nonce explain message, then it will be displayed along 1937 * with the "Are you sure?" message. 1938 * 1939 * @package WordPress 1940 * @subpackage Security 1941 * @since 2.0.4 1942 * 1863 1943 * @param string $action The nonce action. 1864 1944 */ 1865 1945 function wp_nonce_ays( $action ) { 1866 1946 $title = __( 'WordPress Failure Notice' ); 1867 if ( 'log-out' == $action ) { 1868 $html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>'; 1869 $html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() ); 1870 } else { 1871 $html = __( 'Are you sure you want to do this?' ); 1872 if ( wp_get_referer() ) 1873 $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>"; 1874 } 1947 $html = esc_html( wp_explain_nonce( $action ) ); 1948 if ( 'log-out' == $action ) 1949 $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url() ); 1950 elseif ( wp_get_referer() ) 1951 $html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>"; 1875 1952 1876 1953 wp_die( $html, $title, array('response' => 403) ); … … 3546 3623 */ 3547 3624 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) { 3548 if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) 3549 $trace = debug_backtrace( false ); 3550 else 3551 $trace = debug_backtrace(); 3552 3625 $trace = debug_backtrace( false ); 3553 3626 $caller = array(); 3554 3627 $check_class = ! is_null( $ignore_class ); … … 3618 3691 || strpos($ua, 'iPad') !== false 3619 3692 || strpos($ua, 'iPod') !== false ) { 3620 return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );3693 return false; 3621 3694 } else { 3622 3695 return true;
Note: See TracChangeset
for help on using the changeset viewer.