Changeset 3692
- Timestamp:
- 07/17/2016 11:14:42 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-rosetta-roles/wporg-gp-rosetta-roles.php
r3691 r3692 69 69 } 70 70 71 if ( $args['action'] !== 'approve'|| ! in_array( $args['object_type'], array( 'project|locale|set-slug', 'translation-set' ) ) ) {71 if ( 'approve' !== $args['action'] || ! in_array( $args['object_type'], array( 'project|locale|set-slug', 'translation-set' ) ) ) { 72 72 return false; 73 73 } … … 82 82 $current_project_id = $locale_and_project_id->project_id; 83 83 84 // Simple check to see if they're an approver or not 84 // Simple check to see if they're an approver or not. 85 85 if ( ! $this->is_approver_for_locale( $args['user_id'], $locale_slug ) ) { 86 86 return false; 87 87 } 88 88 89 // Grab the list of Projects (or 'all') that the user can approve 89 // Grab the list of Projects (or 'all') that the user can approve. 90 90 $project_access_list = $this->get_project_id_access_list( $args['user_id'], $locale_slug ); 91 91 if ( ! $project_access_list ) { … … 127 127 128 128 /** 129 * Determine if a given user is a Global Admin.129 * Determines if a given user is a Global Admin. 130 130 * 131 131 * Users present as an administrator on global.wordpress.org are treated as a 132 132 * global administrator in GlotPress. 133 133 * 134 * @param int $user A BackPress User object or user ID for the user to check. 135 * 136 * @return bool 134 * @param int $user_id User ID. 135 * @return bool True, if user is an admin, false if not. 137 136 */ 138 137 public function is_global_administrator( $user_id ) { … … 148 147 149 148 /** 150 * Determine if a given user is a Translation Approver for a Locale.151 * 152 * @param int $user A BackPress User object or user ID for the user to check.153 * 154 * @return bool 149 * Determines if a given user is a Translation Approver for a Locale. 150 * 151 * @param int $user_id User ID. 152 * @param string $locale_slug The Locale for which we are checking. 153 * @return bool True, if user is an approver, false if not. 155 154 */ 156 155 public function is_approver_for_locale( $user_id, $locale_slug ) { … … 191 190 192 191 /** 193 * Retrieve a list of Project ID's which the currentuser can approve for.192 * Retrieves a list of project ID's which a user can approve for. 194 193 * 195 194 * This is likely to be incorrrect in the event that the user is a Translation Editor or Global Admin. 196 195 * The array item 'all' is special, which means to allow access to all projects. 197 196 * 198 * @param int $user A BackPress User object or user ID for the user to check. 199 * @param string $locale_slug The Locale for which we are checking 200 * @param int $include_children Whether to include the children project ID's in the return 201 * 197 * @param int $user_id User ID. 198 * @param string $locale_slug The Locale for which we are checking. 199 * @param bool $include_children Whether to include the children project ID's in the return. 202 200 * @return array A list of the Project ID's for which the current user can approve translations for. 203 201 */ … … 227 225 228 226 if ( ! $project_access_list ) { 229 return false;227 return array(); 230 228 } 231 229 … … 382 380 * @param string $object_type Current object type. 383 381 * @param string $object_id Current object ID. 384 * @return array Locale and project ID.382 * @return array|false Locale and project ID, false on failure. 385 383 */ 386 384 public function get_locale_and_project_id( $object_type, $object_id ) {
Note: See TracChangeset
for help on using the changeset viewer.