Ticket #21297: 21297.2.diff
| File 21297.2.diff, 2.8 KB (added by obenland, 11 months ago) |
|---|
-
wp-content/themes/twentytwelve/inc/theme-options.php
12 12 * The option value in the database will be based on get_stylesheet() 13 13 * so child themes don't share the parent theme's option value. 14 14 */ 15 var$option_key = 'twentytwelve_theme_options';15 public $option_key = 'twentytwelve_theme_options'; 16 16 17 17 /** 18 18 * Initialize our options. 19 19 */ 20 var$options = array();20 public $options = array(); 21 21 22 function Twenty_Twelve_Options() {22 public function __construct() { 23 23 // Set option key based on get_stylesheet() 24 24 if ( 'twentytwelve' != get_stylesheet() ) 25 25 $this->option_key = get_stylesheet() . '_theme_options'; … … 38 38 * which is used when the option is saved, to ensure that our option values are properly 39 39 * formatted, and safe. 40 40 */ 41 function options_init() {41 public function options_init() { 42 42 // Load our options for use in any method. 43 43 $this->options = $this->get_theme_options(); 44 44 … … 72 72 * 73 73 * This function is attached to the admin_menu action hook. 74 74 */ 75 function add_page() {75 public function add_page() { 76 76 $theme_page = add_theme_page( 77 77 __( 'Theme Options', 'twentytwelve' ), // Name of page 78 78 __( 'Theme Options', 'twentytwelve' ), // Label in menu … … 85 85 /** 86 86 * Returns the default options. 87 87 */ 88 function get_default_theme_options() {88 public function get_default_theme_options() { 89 89 $default_theme_options = array( 90 90 'enable_fonts' => false, 91 91 ); … … 96 96 /** 97 97 * Returns the options array. 98 98 */ 99 function get_theme_options() {99 public function get_theme_options() { 100 100 return get_option( $this->option_key, $this->get_default_theme_options() ); 101 101 } 102 102 103 103 /** 104 104 * Renders the enable fonts checkbox setting field. 105 105 */ 106 function settings_field_enable_fonts() {106 public function settings_field_enable_fonts() { 107 107 $options = $this->options; 108 108 ?> 109 109 <label for="enable-fonts"> … … 118 118 * 119 119 * @uses get_current_theme() for back compat, fallback for < 3.4 120 120 */ 121 function render_page() {121 public function render_page() { 122 122 ?> 123 123 <div class="wrap"> 124 124 <?php screen_icon(); ?> … … 142 142 * 143 143 * @see options_init() 144 144 */ 145 function validate( $input ) {145 public function validate( $input ) { 146 146 $output = $defaults = $this->get_default_theme_options(); 147 147 148 148 // The enable fonts checkbox should boolean true or false … … 161 161 * 162 162 * @since Twenty Twelve 1.0 163 163 */ 164 function customize_register( $wp_customize ) {164 public function customize_register( $wp_customize ) { 165 165 // Enable Web Fonts 166 166 $wp_customize->add_section( $this->option_key . '_enable_fonts', array( 167 167 'title' => __( 'Fonts', 'twentytwelve' ),