Definition:
function wp_explain_nonce( $action ) {}
Retrieve nonce action "Are you sure" message.
The action is split by verb and noun. The action format is as follows: verb-action_extra. The verb is before the first dash and has the format of letters and no spaces and numbers. The noun is after the dash and before the underscore, if an underscore exists. The noun is also only letters.
Parameters
- string $action: Nonce action.
Return values
returns:Are you sure message.
Defined filters
- explain_nonce_$verb-$noun
apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' )
- explain_nonce_$action
apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' )
Source code
function wp_explain_nonce( $action ) { if ( $action !== -1 && preg_match( '/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches ) ) { $verb = $matches[1]; $noun = $matches[2]; $trans = array(); $trans['update']['attachment'] = array( __( 'Your attempt to edit this attachment: “%s” has failed.' ), 'get_the_title' ); $trans['add']['category'] = array( __( 'Your attempt to add this category has failed.' ), false ); $trans['delete']['category'] = array( __( 'Your attempt to delete this category: “%s” has failed.' ), 'get_cat_name' ); $trans['update']['category'] = array( __( 'Your attempt to edit this category: “%s” has failed.' ), 'get_cat_name' ); $trans['delete']['comment'] = array( __( 'Your attempt to delete this comment: “%s” has failed.' ), 'use_id' ); $trans['unapprove']['comment'] = array( __( 'Your attempt to unapprove this comment: “%s” has failed.' ), 'use_id' ); $trans['approve']['comment'] = array( __( 'Your attempt to approve this comment: “%s” has failed.' ), 'use_id' ); $trans['update']['comment'] = array( __( 'Your attempt to edit this comment: “%s” has failed.' ), 'use_id' ); $trans['bulk']['comments'] = array( __( 'Your attempt to bulk modify comments has failed.' ), false ); $trans['moderate']['comments'] = array( __( 'Your attempt to moderate comments has failed.' ), false ); $trans['add']['bookmark'] = array( __( 'Your attempt to add this link has failed.' ), false ); $trans['delete']['bookmark'] = array( __( 'Your attempt to delete this link: “%s” has failed.' ), 'use_id' ); $trans['update']['bookmark'] = array( __( 'Your attempt to edit this link: “%s” has failed.' ), 'use_id' ); $trans['bulk']['bookmarks'] = array( __( 'Your attempt to bulk modify links has failed.' ), false ); $trans['add']['page'] = array( __( 'Your attempt to add this page has failed.' ), false ); $trans['delete']['page'] = array( __( 'Your attempt to delete this page: “%s” has failed.' ), 'get_the_title' ); $trans['update']['page'] = array( __( 'Your attempt to edit this page: “%s” has failed.' ), 'get_the_title' ); $trans['edit']['plugin'] = array( __( 'Your attempt to edit this plugin file: “%s” has failed.' ), 'use_id' ); $trans['activate']['plugin'] = array( __( 'Your attempt to activate this plugin: “%s” has failed.' ), 'use_id' ); $trans['deactivate']['plugin'] = array( __( 'Your attempt to deactivate this plugin: “%s” has failed.' ), 'use_id' ); $trans['upgrade']['plugin'] = array( __( 'Your attempt to update this plugin: “%s” has failed.' ), 'use_id' ); $trans['add']['post'] = array( __( 'Your attempt to add this post has failed.' ), false ); $trans['delete']['post'] = array( __( 'Your attempt to delete this post: “%s” has failed.' ), 'get_the_title' ); $trans['update']['post'] = array( __( 'Your attempt to edit this post: “%s” has failed.' ), 'get_the_title' ); $trans['add']['user'] = array( __( 'Your attempt to add this user has failed.' ), false ); $trans['delete']['users'] = array( __( 'Your attempt to delete users has failed.' ), false ); $trans['bulk']['users'] = array( __( 'Your attempt to bulk modify users has failed.' ), false ); $trans['update']['user'] = array( __( 'Your attempt to edit this user: “%s” has failed.' ), 'get_the_author_meta', 'display_name' ); $trans['update']['profile'] = array( __( 'Your attempt to modify the profile for: “%s” has failed.' ), 'get_the_author_meta', 'display_name' ); $trans['update']['options'] = array( __( 'Your attempt to edit your settings has failed.' ), false ); $trans['update']['permalink'] = array( __( 'Your attempt to change your permalink structure to: %s has failed.' ), 'use_id' ); $trans['edit']['file'] = array( __( 'Your attempt to edit this file: “%s” has failed.' ), 'use_id' ); $trans['edit']['theme'] = array( __( 'Your attempt to edit this theme file: “%s” has failed.' ), 'use_id' ); $trans['switch']['theme'] = array( __( 'Your attempt to switch to this theme: “%s” has failed.' ), 'use_id' ); $trans['log']['out'] = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false ); if ( isset( $trans[$verb][$noun] ) ) { if ( !empty( $trans[$verb][$noun][1] ) ) { $lookup = $trans[$verb][$noun][1]; if ( isset($trans[$verb][$noun][2]) ) $lookup_value = $trans[$verb][$noun][2]; $object = $matches[4]; if ( 'use_id' != $lookup ) { if ( isset( $lookup_value ) ) $object = call_user_func( $lookup, $lookup_value, $object ); else $object = call_user_func( $lookup, $object ); } return sprintf( $trans[$verb][$noun][0], esc_html($object) ); } else { return $trans[$verb][$noun][0]; } } return apply_filters( 'explain_nonce_' . $verb . '-' . $noun, __( 'Are you sure you want to do this?' ), isset($matches[4]) ? $matches[4] : '' ); } else { return apply_filters( 'explain_nonce_' . $action, __( 'Are you sure you want to do this?' ) ); } }
3645
No comments yet... Be the first to leave a reply!