handle = $handle; $this->args = wp_parse_args( $args, array( 'src' => '', 'dependencies' => array(), 'version' => GOOGLESITEKIT_VERSION, 'fallback' => false, 'before_print' => null, 'load_contexts' => array( self::CONTEXT_ADMIN_SITEKIT ), ) ); } /** * Gets the notice handle. * * @since 1.0.0 * * @return string Unique notice handle. */ public function get_handle() { return $this->handle; } /** * Checks to see if the specified context exists for the current request. * * @since 1.37.0 * * @param string $context Context value (see the `CONTEXT_` variables above). * @return bool TRUE if context exists; FALSE otherwise. */ public function has_context( $context ) { return in_array( $context, $this->args['load_contexts'], true ); } /** * Registers the asset. * * @since 1.0.0 * @since 1.15.0 Adds $context parameter. * * @param Context $context Plugin context. */ abstract public function register( Context $context ); /** * Enqueues the asset. * * @since 1.0.0 */ abstract public function enqueue(); /** * Executes the extra callback if defined before printing the asset. * * @since 1.2.0 */ final public function before_print() { if ( ! is_callable( $this->args['before_print'] ) ) { return; } call_user_func( $this->args['before_print'], $this->handle ); } }