Changeset 6717 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
- Timestamp:
- 02/22/2018 07:43:32 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r6110 r6717 12 12 */ 13 13 public function __construct() { 14 add_action( 'init', array( __CLASS__, 'register_post_statuses' ));15 add_action( 'admin_menu', array( $this, 'register_budgets_menu' ) );16 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_common_assets' ), 11);14 add_action( 'init', array( __CLASS__, 'register_post_statuses' ) ); 15 add_action( 'admin_menu', array( $this, 'register_budgets_menu' ) ); 16 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_common_assets' ), 11 ); 17 17 add_filter( 'user_has_cap', array( __CLASS__, 'user_can_view_payment_details' ), 10, 4 ); 18 add_filter( 'default_title', array( $this, 'set_default_payments_title'), 10, 2 ); 18 19 } 19 20 … … 119 120 30 120 121 ); 122 } 123 124 /** 125 * Set default post title for reimbursements, vendor payments and sponsor invoices. 126 * 127 * @param string $post_title Default post title. 128 * @param WP_Post $post Current post object. 129 * 130 * @return string $post_title Post title. 131 */ 132 public function set_default_payments_title ( $post_title, $post ) { 133 if ( $post instanceof WP_Post && ! empty( $post->post_type ) ) { 134 $new_title = ''; 135 136 // Generate default title for payment CPTs. 137 switch ( $post->post_type ) { 138 case 'wcb_reimbursement': $new_title = __( 'Reimbursement Request', 'wordcamporg' ); break; 139 case 'wcp_payment_request': $new_title = __( 'Vendor Payment', 'wordcamporg' ); break; 140 case 'wcb_sponsor_invoice': $new_title = __( 'Sponsor Invoice', 'wordcamporg' ); break; 141 } 142 143 // Prepend title with post ID to make it unique. 144 if ( $new_title ) { 145 $post_title = sprintf( __( '[%s] Untitled %s', 'wordcamporg' ), $post->ID, $new_title ); 146 } 147 } 148 149 return $post_title; 121 150 } 122 151
Note: See TracChangeset
for help on using the changeset viewer.