name; } /** * Register a new object. * * @since 2.0.0 * @access public * @param string $name * @param array $args { * @type string $label Internationalized text label. * @type string $icon Dashicon icon in the form of `dashicons-icon-name`. * @type string $callback Callback function for outputting the content for the view. * } * @return void */ public function __construct( $name, $args = array() ) { foreach ( array_keys( get_object_vars( $this ) ) as $key ) { if ( isset( $args[ $key ] ) ) $this->$key = $args[ $key ]; } $this->name = sanitize_key( $name ); } /** * Runs on the `load-{$page}` hook * * @since 2.0.0 * @access public * @return void */ public function load() {} /** * Enqueue scripts/styles for the control. * * @since 2.0.0 * @access public * @return void */ public function enqueue() {} /** * Register settings for the view. * * @since 2.0.0 * @access public * @return void */ public function register_settings() {} /** * Add help tabs for the view. * * @since 2.0.0 * @access public * @return void */ public function add_help_tabs() {} /** * Output the content for the view. * * @since 2.0.0 * @access public * @return void */ public function template() {} /** * Checks if the control should be allowed at all. * * @since 2.0.0 * @access public * @return bool */ public function check_capabilities() { if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) return false; return true; } }