Changeset 21280
- Timestamp:
- 07/18/2012 06:41:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentytwelve/inc/theme-options.php
r21261 r21280 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 */ 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() { 23 36 // Set option key based on get_stylesheet() 24 37 if ( 'twentytwelve' != get_stylesheet() ) … … 38 51 * which is used when the option is saved, to ensure that our option values are properly 39 52 * formatted, and safe. 40 */ 41 function options_init() { 53 * 54 * @access public 55 * 56 * @return void 57 */ 58 public function options_init() { 42 59 // Load our options for use in any method. 43 60 $this->options = $this->get_theme_options(); … … 72 89 * 73 90 * 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() { 76 97 $theme_page = add_theme_page( 77 98 __( 'Theme Options', 'twentytwelve' ), // Name of page … … 85 106 /** 86 107 * 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() { 89 114 $default_theme_options = array( 90 115 'enable_fonts' => false, … … 96 121 /** 97 122 * 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() { 100 129 return get_option( $this->option_key, $this->get_default_theme_options() ); 101 130 } … … 103 132 /** 104 133 * 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() { 107 140 $options = $this->options; 108 141 ?> … … 118 151 * 119 152 * @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() { 122 158 ?> 123 159 <div class="wrap"> … … 142 178 * 143 179 * @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 ) { 146 186 $output = $defaults = $this->get_default_theme_options(); 147 187 … … 155 195 156 196 /** 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. 161 198 * 162 199 * @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 ) { 165 206 // Enable Web Fonts 166 207 $wp_customize->add_section( $this->option_key . '_enable_fonts', array(
Note: See TracChangeset
for help on using the changeset viewer.