BBP_Theme_Compat

Theme Compatibility base class


Description Description

This is only intended to be extended, and is included here as a basic guide for future Template Packs to use. @link bbp_setup_theme_compat()


Source Source

File: includes/core/theme-compat.php

class BBP_Theme_Compat {

	/**
	 * Should be like:
	 *
	 * array(
	 *     'id'      => ID of the theme (should be unique)
	 *     'name'    => Name of the theme (should match style.css)
	 *     'version' => Theme version for cache busting scripts and styling
	 *     'dir'     => Path to theme
	 *     'url'     => URL to theme
	 * );
	 * @var array
	 */
	private $_data = array();

	/**
	 * Pass the $properties to the object on creation.
	 *
	 * @since 2.1.0 bbPress (r3926)
	 *
	 * @param array $properties
	 */
	public function __construct( Array $properties = array() ) {
		$this->_data = $properties;
	}

	/**
	 * Set a theme's property.
	 *
	 * @since 2.1.0 bbPress (r3926)
	 *
	 * @param string $property
	 * @param mixed $value
	 * @return mixed
	 */
	public function __set( $property, $value ) {
		return $this->_data[ $property ] = $value;
	}

	/**
	 * Get a theme's property.
	 *
	 * @since 2.1.0 bbPress (r3926)
	 *
	 * @param string $property
	 * @param mixed $value
	 * @return mixed
	 */
	public function __get( $property ) {
		return array_key_exists( $property, $this->_data )
			? $this->_data[ $property ]
			: '';
	}

	/**
	 * Return the template directory.
	 *
	 * @since 2.6.0 bbPress (r6548)
	 *
	 * @return string
	 */
	public function get_dir() {
		return $this->dir;
	}
}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.


Top ↑

Methods Methods

  • __construct — Pass the $properties to the object on creation.
  • __get — Get a theme's property.
  • __set — Set a theme's property.
  • get_dir — Return the template directory.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.