bb_explain_nonce

The BuddyPress bb explain nonce function.

Description

bb_explain_nonce( $action ); 

Parameters (1)

0. $action
The action.

Usage

  1. if ( !function_exists( 'bb_explain_nonce' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The action. 
  5. $action = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_explain_nonce($action); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_explain_nonce($action) { 
  2. if ( $action !== -1 && preg_match('/([a-z]+)-([a-z]+)(_(.+))?/', $action, $matches) ) { 
  3. $verb = $matches[1]; 
  4. $noun = $matches[2]; 
  5.  
  6. $trans = array(); 
  7. $trans['create']['post'] = array(__('Your attempt to submit this post has failed.'), false); 
  8. $trans['edit']['post'] = array(__('Your attempt to edit this post has failed.'), false); 
  9. $trans['delete']['post'] = array(__('Your attempt to delete this post has failed.'), false); 
  10.  
  11. $trans['create']['topic'] = array(__('Your attempt to create this topic has failed.'), false); 
  12. $trans['resolve']['topic'] = array(__('Your attempt to change the resolution status of this topic has failed.'), false); 
  13. $trans['delete']['topic'] = array(__('Your attempt to delete this topic has failed.'), false); 
  14. $trans['close']['topic'] = array(__('Your attempt to change the status of this topic has failed.'), false); 
  15. $trans['stick']['topic'] = array(__('Your attempt to change the sticky status of this topic has failed.'), false); 
  16. $trans['move']['topic'] = array(__('Your attempt to move this topic has failed.'), false); 
  17.  
  18. $trans['add']['tag'] = array(__('Your attempt to add this tag to this topic has failed.'), false); 
  19. $trans['rename']['tag'] = array(__('Your attempt to rename this tag has failed.'), false); 
  20. $trans['merge']['tag'] = array(__('Your attempt to submit these tags has failed.'), false); 
  21. $trans['destroy']['tag'] = array(__('Your attempt to destroy this tag has failed.'), false); 
  22. $trans['remove']['tag'] = array(__('Your attempt to remove this tag from this topic has failed.'), false); 
  23.  
  24. $trans['toggle']['favorite'] = array(__('Your attempt to toggle your favorite status for this topic has failed.'), false); 
  25.  
  26. $trans['edit']['profile'] = array(__("Your attempt to edit this user's profile has failed."), false); 
  27.  
  28. $trans['add']['forum'] = array(__("Your attempt to add this forum has failed."), false); 
  29. $trans['update']['forums'] = array(__("Your attempt to update your forums has failed."), false); 
  30. $trans['delete']['forums'] = array(__("Your attempt to delete that forum has failed."), false); 
  31.  
  32. $trans['do']['counts'] = array(__("Your attempt to recount these items has failed."), false); 
  33.  
  34. $trans['switch']['theme'] = array(__("Your attempt to switch themes has failed."), false); 
  35.  
  36. if ( isset($trans[$verb][$noun]) ) { 
  37. if ( !empty($trans[$verb][$noun][1]) ) { 
  38. $lookup = $trans[$verb][$noun][1]; 
  39. $object = $matches[4]; 
  40. if ( 'use_id' != $lookup ) 
  41. $object = call_user_func($lookup, $object); 
  42. return sprintf($trans[$verb][$noun][0], esc_html( $object )); 
  43. } else { 
  44. return $trans[$verb][$noun][0]; 
  45.  
  46. return apply_filters( 'bb_explain_nonce_' . $verb . '-' . $noun, __('Your attempt to do this has failed.'), $matches[4] );