Changeset 2292 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
- Timestamp:
- 01/13/2016 12:33:24 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-payments/includes/wordcamp-budgets.php
r2288 r2292 167 167 168 168 /** 169 * Determines whether we want to perform actions on the given post based on the current context. 170 * 171 * Examples of actions we might perform are saving the meta fields during the `save_post` hook, or send out an 172 * e-mail notification during the `transition_post_status` hook. 173 * 174 * This function is called by several other functions, each of which may require additional checks that are 175 * specific to their circumstances. This function only covers checks that are common to all of its callers. 176 * 177 * @param WP_Post|array $post 178 * @param string $valid_post_type 179 * 180 * @return bool 181 */ 182 public static function post_edit_is_actionable( $post, $valid_post_type ) { 183 if ( is_array( $post ) ) { 184 $post = (object) $post; 185 } 186 187 $is_actionable = true; 188 $ignored_actions = array( 'trash', 'untrash', 'restore', 'bulk_edit' ); // todo ignore bulk deletion too 189 190 // Don't take action on other post types 191 if ( ! $post || $post->post_type != $valid_post_type ) { 192 $is_actionable = false; 193 } 194 195 // Don't take action if the user isn't allowed. The ID will be missing from new posts during `wp_insert_post_data`, though, so skip it then. 196 if ( $is_actionable && isset( $post->ID ) && ! current_user_can( 'edit_post', $post->ID ) ) { 197 $is_actionable = false; 198 } 199 200 // Don't take action while trashing the post, etc 201 if ( $is_actionable && isset( $_GET['action'] ) && in_array( $_GET['action'], $ignored_actions ) ) { 202 $is_actionable = false; 203 } 204 205 // Don't take action during autosaves 206 if ( $is_actionable && ( ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || $post->post_status == 'auto-draft' ) ) { 207 $is_actionable = false; 208 } 209 210 return $is_actionable; 211 } 212 213 /** 169 214 * Insert an entry into a log for one of the custom post types 170 215 *
Note: See TracChangeset
for help on using the changeset viewer.