protected function setup_options( $options = [] ) {
		// When a object is sent in, just return it.
		if ( is_object( $options ) ) {
			return $options;
		}

		// Only arrays can be handled.
		if ( ! is_array( $options ) ) {
			$options = [];
		}

		// Merge default options with the given options array.
		$options = array_merge( $this->default_options, $options );
		$options = (object) $options;

		// Setup aliases.
		$option_aliases = apply_filters( 'papi/option_aliases', $this->option_aliases );
		$option_aliases = is_array( $option_aliases ) ? $option_aliases : [];
		$option_aliases = array_merge( $this->option_aliases, $option_aliases );

		foreach ( $option_aliases as $alias => $option ) {
			if ( isset( $options->$alias ) && ! papi_is_empty( $options->$alias ) ) {
				$options->$option = $options->$alias;
				unset( $options->$alias );
			}
		}

		// Capabilities should be a array.
		$options->capabilities = papi_to_array( $options->capabilities );

		// Setup property slug.
		$options->slug = strtolower( $this->setup_options_slug( $options ) );

		// Setup property settings.
		$options->settings = $this->setup_options_settings( $options );

		// Type should always be lowercase.
		$options->type = strtolower( $options->type );

		// Escape all options except those that are send it as second argument.
		return papi_esc_html( $options, ['before_html', 'html', 'after_html'] );
	}
protected function setup_options( $options = [] ) {
		// When a object is sent in, just return it.
		if ( is_object( $options ) ) {
			return $options;
		}

		// Only arrays can be handled.
		if ( ! is_array( $options ) ) {
			$options = [];
		}

		// Merge default options with the given options array.
		$options = array_merge( $this->default_options, $options );
		$options = (object) $options;

		// Setup aliases.
		$option_aliases = apply_filters( 'papi/option_aliases', $this->option_aliases );
		$option_aliases = is_array( $option_aliases ) ? $option_aliases : [];
		$option_aliases = array_merge( $this->option_aliases, $option_aliases );

		foreach ( $option_aliases as $alias => $option ) {
			if ( isset( $options->$alias ) && ! papi_is_empty( $options->$alias ) ) {
				$options->$option = $options->$alias;
				unset( $options->$alias );
			}
		}

		// Capabilities should be a array.
		$options->capabilities = papi_to_array( $options->capabilities );

		// Setup property slug.
		$options->slug = strtolower( $this->setup_options_slug( $options ) );

		// Setup property settings.
		$options->settings = $this->setup_options_settings( $options );

		// Type should always be lowercase.
		$options->type = strtolower( $options->type );

		// Escape all options except those that are send it as second argument.
		return papi_esc_html( $options, ['before_html', 'html', 'after_html'] );
	}
protected function setup_options ( $ options = [ ] ) { // When a object is sent in, just return it. if ( is_object ( $ options ) ) { return $ options ; } // Only arrays can be handled. if ( ! is_array ( $ options ) ) { $ options = [ ] ; } // Merge default options with the given options array. $ options = array_merge ( $ this -> default_options , $ options ) ; $ options = ( object ) $ options ; // Setup aliases. $ option_aliases = apply_filters ( 'papi/option_aliases' , $ this -> option_aliases ) ; $ option_aliases = is_array ( $ option_aliases ) ? $ option_aliases : [ ] ; $ option_aliases = array_merge ( $ this -> option_aliases , $ option_aliases ) ; foreach ( $ option_aliases as $ alias => $ option ) { if ( isset ( $ options -> $ alias ) && ! papi_is_empty ( $ options -> $ alias ) ) { $ options -> $ option = $ options -> $ alias ; unset ( $ options -> $ alias ) ; } } // Capabilities should be a array. $ options -> capabilities = papi_to_array ( $ options -> capabilities ) ; // Setup property slug. $ options -> slug = strtolower ( $ this -> setup_options_slug ( $ options ) ) ; // Setup property settings. $ options -> settings = $ this -> setup_options_settings ( $ options ) ; // Type should always be lowercase. $ options -> type = strtolower ( $ options -> type ) ; // Escape all options except those that are send it as second argument. return papi_esc_html ( $ options , [ 'before_html' , 'html' , 'after_html' ] ) ; }
Setup property options.

@param  mixed $options

@return mixed
Setup property options .