Make WordPress Core

Changeset 21280


Ignore:
Timestamp:
07/18/2012 06:41:17 PM (12 years ago)
Author:
lancewillett
Message:

Twenty Twelve: update theme options file to use PHP5 constructor and visibility keywords, and also minor DocBlock cleanup. Props Mamaduka and obenland, closes #21297.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentytwelve/inc/theme-options.php

    r21261 r21280  
    1212     * The option value in the database will be based on get_stylesheet()
    1313     * so child themes don't share the parent theme's option value.
    14      */
    15     var $option_key = 'twentytwelve_theme_options';
    16 
    17     /**
    18      * Initialize our options.
    19      */
    20     var $options = array();
    21 
    22     function Twenty_Twelve_Options() {
     14     *
     15     * @access public
     16     * @var string
     17     */
     18    public $option_key = 'twentytwelve_theme_options';
     19
     20    /**
     21     * Holds our options.
     22     *
     23     * @access public
     24     * @var array
     25     */
     26    public $options = array();
     27
     28    /**
     29     * Constructor
     30     *
     31     * @access public
     32     *
     33     * @return Twenty_Twelve_Options
     34     */
     35    public function __construct() {
    2336        // Set option key based on get_stylesheet()
    2437        if ( 'twentytwelve' != get_stylesheet() )
     
    3851     * which is used when the option is saved, to ensure that our option values are properly
    3952     * formatted, and safe.
    40      */
    41     function options_init() {
     53     *
     54     * @access public
     55     *
     56     * @return void
     57     */
     58    public function options_init() {
    4259        // Load our options for use in any method.
    4360        $this->options = $this->get_theme_options();
     
    7289     *
    7390     * This function is attached to the admin_menu action hook.
    74      */
    75     function add_page() {
     91     *
     92     * @access public
     93     *
     94     * @return void
     95     */
     96    public function add_page() {
    7697        $theme_page = add_theme_page(
    7798            __( 'Theme Options', 'twentytwelve' ), // Name of page
     
    85106    /**
    86107     * Returns the default options.
    87      */
    88     function get_default_theme_options() {
     108     *
     109     * @access public
     110     *
     111     * @return array
     112     */
     113    public function get_default_theme_options() {
    89114        $default_theme_options = array(
    90115            'enable_fonts' => false,
     
    96121    /**
    97122     * Returns the options array.
    98      */
    99     function get_theme_options() {
     123     *
     124     * @access public
     125     *
     126     * @return array
     127     */
     128    public function get_theme_options() {
    100129        return get_option( $this->option_key, $this->get_default_theme_options() );
    101130    }
     
    103132    /**
    104133     * Renders the enable fonts checkbox setting field.
    105      */
    106     function settings_field_enable_fonts() {
     134     *
     135     * @access public
     136     *
     137     * @return void
     138     */
     139    public function settings_field_enable_fonts() {
    107140        $options = $this->options;
    108141        ?>
     
    118151     *
    119152     * @uses get_current_theme() for back compat, fallback for < 3.4
    120      */
    121     function render_page() {
     153     * @access public
     154     *
     155     * @return void
     156     */
     157    public function render_page() {
    122158        ?>
    123159        <div class="wrap">
     
    142178     *
    143179     * @see options_init()
    144      */
    145     function validate( $input ) {
     180     * @access public
     181     * @param array $input
     182     *
     183     * @return array The validated data.
     184     */
     185    public function validate( $input ) {
    146186        $output = $defaults = $this->get_default_theme_options();
    147187
     
    155195
    156196    /**
    157      * Implement Twenty Twelve theme options into Theme Customizer
    158      *
    159      * @param $wp_customize Theme Customizer object
    160      * @return void
     197     * Implement Twenty Twelve theme options into Theme Customizer.
    161198     *
    162199     * @since Twenty Twelve 1.0
    163      */
    164     function customize_register( $wp_customize ) {
     200     * @access public
     201     * @param WP_Customize_Manager $wp_customize Theme Customizer object.
     202     *
     203     * @return void
     204     */
     205    public function customize_register( $wp_customize ) {
    165206        // Enable Web Fonts
    166207        $wp_customize->add_section( $this->option_key . '_enable_fonts', array(
Note: See TracChangeset for help on using the changeset viewer.