| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 20 | public function __construct() { |
||
| 21 | $this->types = array_merge( |
||
| 22 | [ 'post', 'page' ], // we don't need attachment, revision or nav_menu_item here |
||
| 23 | get_post_types( [ 'public' => true, '_builtin' => false ], 'names', 'and' ) |
||
| 24 | ); |
||
| 25 | |||
| 26 | $_request = $this->get_superglobals( [ 'post_type' ] ); |
||
| 27 | if ( '' != $_request['post_type'] ) { |
||
| 28 | $this->request = esc_attr( $_request['post_type'] ); |
||
| 29 | } |
||
| 30 | else { |
||
| 31 | $this->request = get_post_type(); |
||
| 32 | if ( ! $this->request ) { |
||
| 33 | $this->request = 'post'; |
||
| 34 | } |
||
| 35 | } |
||
| 36 | } |
||
| 37 | |||
| 47 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.