Changeset 10752 for sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/handbook.php
- Timestamp:
- 03/04/2021 10:46:49 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/handbook/inc/handbook.php
r10751 r10752 8 8 class WPorg_Handbook { 9 9 10 /** 11 * The handbook post type. 12 * 13 * @var string 14 */ 10 15 public $post_type = ''; 16 17 /** 18 * The name of the setting for the handbook's name. 19 * 20 * @var string 21 */ 11 22 public $setting_name = ''; 12 23 24 /** 25 * The memoized and filtered label text for the handbook. 26 * 27 * @var string 28 */ 13 29 protected $label = ''; 14 30 31 /** 32 * Returns the custom handbook-related capabilities granted to site users. 33 * 34 * @return array 35 */ 15 36 public static function caps() { 16 37 return [ … … 21 42 } 22 43 44 /** 45 * Returns the custom capabilities granted to handbook editors. 46 * 47 * @return array 48 */ 23 49 public static function editor_caps() { 24 50 return [ … … 65 91 } 66 92 93 /** 94 * Constructor 95 */ 67 96 public function __construct( $type ) { 68 97 if ( 'handbook' !== $type ) { … … 154 183 } 155 184 185 /** 186 * Adds the setting for the handbook's name. 187 */ 156 188 public function add_name_setting() { 157 189 register_setting( 'general', $this->setting_name, 'esc_attr' ); … … 169 201 } 170 202 203 /** 204 * Outputs the HTML for the input field for the handbook's name. 205 */ 171 206 public function name_setting_html() { 172 207 $value = get_option( $this->setting_name, '' ); … … 174 209 } 175 210 211 /** 212 * Grants handbook caps to the current user. 213 * 214 * @return array 215 */ 176 216 public function grant_handbook_caps( $caps ) { 177 217 if ( ! is_user_member_of_blog() ) { … … 192 232 } 193 233 234 /** 235 * Registers handbook post types. 236 */ 194 237 public function register_post_type() { 195 238 if ( 'handbook' != $this->post_type ) { … … 345 388 } 346 389 390 /** 391 * Performs query object adjustments for handbook requests prior to querying 392 * for posts. 393 */ 347 394 public function pre_get_posts( $query ) { 348 395 // Bail early if query is not for this handbook's post type. … … 384 431 } 385 432 433 /** 434 * Registers sidebar and widgets for handbook pages. 435 */ 386 436 public function handbook_sidebar() { 387 437 $sidebar_args = [ … … 403 453 } 404 454 455 /** 456 * Amends list of post types for which users can opt into receiving emails 457 * about changes. 458 * 459 * @param array $post_types Post types. 460 * @return array 461 */ 405 462 public function wporg_email_changes_for_post_types( $post_types ) { 406 463 if ( ! in_array( $this->post_type, $post_types ) ) {
Note: See TracChangeset
for help on using the changeset viewer.