screen-attachment.php
7 months ago
screen-options-page.php
7 months ago
screen-post.php
7 months ago
screen-settings.php
7 months ago
screen-taxonomy.php
3 months ago
screen-user.php
7 months ago
screen-options-page.php
74 lines
| 1 | <?php |
| 2 | |
| 3 | if(!defined('ABSPATH')){ |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | if(!class_exists('acfe_screen_options_page')): |
| 8 | |
| 9 | class acfe_screen_options_page{ |
| 10 | |
| 11 | // vars |
| 12 | var $page; |
| 13 | |
| 14 | /** |
| 15 | * construct |
| 16 | */ |
| 17 | function __construct(){ |
| 18 | |
| 19 | /** |
| 20 | * hooks: |
| 21 | * |
| 22 | * acfe/load_option $page |
| 23 | * acfe/add_option_meta_boxes $page |
| 24 | */ |
| 25 | |
| 26 | // load |
| 27 | add_action('admin_init', array($this, 'load')); |
| 28 | |
| 29 | } |
| 30 | |
| 31 | |
| 32 | /** |
| 33 | * load |
| 34 | * |
| 35 | * admin_init |
| 36 | */ |
| 37 | function load(){ |
| 38 | |
| 39 | global $plugin_page; |
| 40 | |
| 41 | if(!isset($plugin_page)){ |
| 42 | return; |
| 43 | } |
| 44 | |
| 45 | $this->page = acf_get_options_page($plugin_page); |
| 46 | |
| 47 | if(!$this->page){ |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | // actions |
| 52 | do_action("acfe/load_option", $this->page); |
| 53 | do_action("acfe/load_option/page={$this->page['menu_slug']}", $this->page); |
| 54 | |
| 55 | // hooks |
| 56 | add_action('admin_head', array($this, 'admin_head')); |
| 57 | |
| 58 | } |
| 59 | |
| 60 | |
| 61 | /** |
| 62 | * admin_head |
| 63 | */ |
| 64 | function admin_head(){ |
| 65 | |
| 66 | do_action('acfe/add_option_meta_boxes', $this->page); |
| 67 | |
| 68 | } |
| 69 | |
| 70 | } |
| 71 | |
| 72 | acf_new_instance('acfe_screen_options_page'); |
| 73 | |
| 74 | endif; |