class-abilities.php
2 months ago
class-ability-create-gallery.php
2 months ago
class-ability-get-gallery-layout-schema.php
2 months ago
class-ability-get-gallery.php
2 months ago
class-ability-list-galleries.php
2 months ago
class-ability-list-gallery-layouts.php
2 months ago
class-ability-media-search.php
2 months ago
class-ability-update-gallery-attachments.php
2 months ago
class-ability-update-gallery.php
2 months ago
functions.php
2 months ago
index.php
2 months ago
class-abilities.php
63 lines
| 1 | <?php |
| 2 | /** |
| 3 | * FooGallery abilities bootstrap. |
| 4 | */ |
| 5 | |
| 6 | if ( ! class_exists( 'FooGallery_Abilities' ) ) { |
| 7 | |
| 8 | class FooGallery_Abilities { |
| 9 | |
| 10 | /** |
| 11 | * Main FooGallery ability category slug. |
| 12 | * |
| 13 | * @var string |
| 14 | */ |
| 15 | const CATEGORY = 'foogallery-management'; |
| 16 | |
| 17 | /** |
| 18 | * Wire up the WordPress core abilities hooks. |
| 19 | */ |
| 20 | public function __construct() { |
| 21 | if ( ! foogallery_abilities_wp_api_available() ) { |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | add_action( 'wp_abilities_api_categories_init', array( $this, 'register_main_category' ) ); |
| 26 | add_action( 'wp_abilities_api_init', array( $this, 'register_abilities' ) ); |
| 27 | |
| 28 | new FooGallery_Ability_List_Galleries(); |
| 29 | new FooGallery_Ability_Get_Gallery(); |
| 30 | new FooGallery_Ability_Get_Gallery_Layout_Schema(); |
| 31 | new FooGallery_Ability_List_Gallery_Layouts(); |
| 32 | new FooGallery_Ability_Media_Search(); |
| 33 | new FooGallery_Ability_Create_Gallery(); |
| 34 | new FooGallery_Ability_Update_Gallery(); |
| 35 | new FooGallery_Ability_Update_Gallery_Attachments(); |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Register the main FooGallery ability category. |
| 40 | * |
| 41 | * @return void |
| 42 | */ |
| 43 | public function register_main_category() { |
| 44 | wp_register_ability_category( |
| 45 | self::CATEGORY, |
| 46 | array( |
| 47 | 'label' => __( 'FooGallery Management', 'foogallery' ), |
| 48 | 'description' => __( 'Create, inspect, and update FooGallery galleries using the existing gallery, layout, and attachment APIs.', 'foogallery' ), |
| 49 | ) |
| 50 | ); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * Allow FooGallery code to register abilities. |
| 55 | * |
| 56 | * @return void |
| 57 | */ |
| 58 | public function register_abilities() { |
| 59 | do_action( 'foogallery_register_abilities' ); |
| 60 | } |
| 61 | } |
| 62 | } |
| 63 |