Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Syncing up with version 0.8 of Options Framework plugin.

  • Loading branch information...
commit c7fdf26b22c1f728543a0543071cca5646b80f40 1 parent cb68442
Devin Price authored
26  admin/css/admin-style.css
@@ -9,18 +9,18 @@
9 9
 	margin: 10px 0;
10 10
 	width: 785px;
11 11
 	position:relative;
12  
-	z-index: 0
  12
+	z-index: 0;
13 13
 }
14 14
 #of_container #header {
15 15
 	height: 60px;
16 16
 	background:#dfdfdf url("../../../../wp-admin/images/gray-grad.png") repeat-x left top;
17 17
 	border: 1px solid #ccc;
18  
-	border-top-left-radius: 6px;
19  
-	-moz-border-radius-topleft: 6px;
20  
-	-webkit-border-top-left-radius: 6px;
21  
-	-webkit-border-top-right-radius: 6px;
22  
-	border-top-right-radius: 6px;
23  
-	-moz-border-radius-topright: 6px;
  18
+	border-top-left-radius: 3px;
  19
+	-moz-border-radius-topleft: 3px;
  20
+	-webkit-border-top-left-radius: 3px;
  21
+	-webkit-border-top-right-radius: 3px;
  22
+	border-top-right-radius: 3px;
  23
+	-moz-border-radius-topright: 3px;
24 24
 }
25 25
 #of_container #header .logo {
26 26
 	float: left;
@@ -307,10 +307,10 @@
307 307
 	padding: 10px 20px 0px 20px;
308 308
 	height: 35px;
309 309
 	text-align: right;
310  
-	-moz-border-radius-bottomright: 6px;
311  
-	-moz-border-radius-bottomleft: 6px;
312  
-	-webkit-border-bottom-right-radius: 6px;
313  
-	-webkit-border-bottom-left-radius: 6px;
314  
-	border-bottom-right-radius: 6px;
315  
-	border-bottom-left-radius: 6px;
  310
+	-moz-border-radius-bottomright: 3px;
  311
+	-moz-border-radius-bottomleft: 3px;
  312
+	-webkit-border-bottom-right-radius: 3px;
  313
+	-webkit-border-bottom-left-radius: 3px;
  314
+	border-bottom-right-radius: 3px;
  315
+	border-bottom-left-radius: 3px;
316 316
 }
39  admin/js/options-custom.js
@@ -31,7 +31,15 @@ jQuery(document).ready(function($) {
31 31
 	
32 32
 	// Switches option sections
33 33
 	$('.group').hide();
34  
-	$('.group:first').fadeIn();
  34
+	var activetab = '';
  35
+	if (typeof(localStorage) != 'undefined' ) {
  36
+		activetab = localStorage.getItem("activetab");
  37
+	}
  38
+	if (activetab != '' && $(activetab).length ) {
  39
+		$(activetab).fadeIn();
  40
+	} else {
  41
+		$('.group:first').fadeIn();
  42
+	}
35 43
 	$('.group .collapsed').each(function(){
36 44
 		$(this).find('input:checked').parent().parent().parent().nextAll().each( 
37 45
 			function(){
@@ -42,6 +50,24 @@ jQuery(document).ready(function($) {
42 50
 				$(this).filter('.hidden').removeClass('hidden');
43 51
 			});
44 52
 	});
  53
+	
  54
+	if (activetab != '' && $(activetab + '-tab').length ) {
  55
+		$(activetab + '-tab').parent('li').addClass('current');
  56
+	}
  57
+	else {
  58
+		$('#of-nav li:first').addClass('current');
  59
+	}
  60
+	$('#of-nav li a').click(function(evt) {
  61
+		$('#of-nav li').removeClass('current');
  62
+		$(this).parent().addClass('current');
  63
+		var clicked_group = $(this).attr('href');
  64
+		if (typeof(localStorage) != 'undefined' ) {
  65
+			localStorage.setItem("activetab", $(this).attr('href'));
  66
+		}
  67
+		$('.group').hide();
  68
+		$(clicked_group).fadeIn();
  69
+		evt.preventDefault();
  70
+	});
45 71
            					
46 72
 	$('.group .collapsed input:checkbox').click(unhideHidden);
47 73
 				
@@ -71,14 +97,5 @@ jQuery(document).ready(function($) {
71 97
 	$('.of-radio-img-label').hide();
72 98
 	$('.of-radio-img-img').show();
73 99
 	$('.of-radio-img-radio').hide();
74  
-	
75  
-	$('#of-nav li:first').addClass('current');
76  
-	$('#of-nav li a').click(function(evt) {
77  
-		$('#of-nav li').removeClass('current');
78  
-		$(this).parent().addClass('current');
79  
-		var clicked_group = $(this).attr('href');
80  
-		$('.group').hide();
81  
-		$(clicked_group).fadeIn();
82  
-		evt.preventDefault();
83  
-	}); 	 		
  100
+		 		
84 101
 });	
290  admin/options-framework.php
@@ -3,7 +3,7 @@
3 3
 Plugin Name: Options Framework
4 4
 Plugin URI: http://www.wptheming.com
5 5
 Description: A framework for building theme options.
6  
-Version: 0.6
  6
+Version: 0.8
7 7
 Author: Devin Price
8 8
 Author URI: http://www.wptheming.com
9 9
 License: GPLv2
@@ -27,7 +27,7 @@
27 27
 
28 28
 /* Basic plugin definitions */
29 29
 
30  
-define('OPTIONS_FRAMEWORK_VERSION', '0.6');
  30
+define('OPTIONS_FRAMEWORK_VERSION', '0.8');
31 31
 
32 32
 /* Make sure we don't expose any info if called directly */
33 33
 
@@ -41,19 +41,44 @@
41 41
 add_action('init', 'optionsframework_rolescheck' );
42 42
 
43 43
 function optionsframework_rolescheck () {
44  
-	if ( current_user_can('edit_theme_options') ) {
  44
+	if ( current_user_can( 'edit_theme_options' ) ) {
45 45
 		// If the user can edit theme options, let the fun begin!
46  
-		add_action('admin_menu', 'optionsframework_add_page');
47  
-		add_action('admin_init', 'optionsframework_init' );
  46
+		add_action( 'admin_menu', 'optionsframework_add_page');
  47
+		add_action( 'admin_init', 'optionsframework_init' );
48 48
 		add_action( 'admin_init', 'optionsframework_mlu_init' );
49 49
 	}
50 50
 }
51 51
 
  52
+/* Register plugin activation hooks */
  53
+
  54
+register_activation_hook(__FILE__,'optionsframework_activation_hook');
  55
+
  56
+function optionsframework_activation_hook() {
  57
+	register_uninstall_hook( __FILE__, 'optionsframework_delete_options' );
  58
+}
  59
+
  60
+/* When uninstalled, deletes options */
  61
+
  62
+register_uninstall_hook( __FILE__, 'optionsframework_delete_options' );
  63
+
  64
+function optionsframework_delete_options() {
  65
+
  66
+	$optionsframework_settings = get_option('optionsframework');
  67
+	
  68
+	// Each theme saves its data in a seperate option, which all gets deleted
  69
+	$knownoptions = $optionsframework_settings['knownoptions'];
  70
+	if ($knownoptions) {
  71
+		foreach ($knownoptions as $key) {
  72
+			delete_option($key);
  73
+		}
  74
+	}
  75
+	delete_option('optionsframework');
  76
+}
  77
+
52 78
 /* 
53 79
  * Creates the settings in the database by looping through the array
54 80
  * we supplied in options.php.  This is a neat way to do it since
55  
- * we won't have to save settings for headers, descriptions, or arguments-
56  
- * and it makes it a little easier to change and set up in my opinion.
  81
+ * we won't have to save settings for headers, descriptions, or arguments.
57 82
  *
58 83
  * Read more about the Settings API in the WordPress codex:
59 84
  * http://codex.wordpress.org/Settings_API
@@ -75,19 +100,26 @@ function optionsframework_init() {
75 100
 		require_once dirname( __FILE__ ) . '/options.php';
76 101
 	}
77 102
 	
78  
-	$optionsframework_settings = get_option('optionsframework');
  103
+	$optionsframework_settings = get_option('optionsframework' );
79 104
 	
80 105
 	// Updates the unique option id in the database if it has changed
81 106
 	optionsframework_option_name();
82 107
 	
83 108
 	// Gets the unique id, returning a default if it isn't defined
84  
-	$option_name = $optionsframework_settings['id'];
  109
+	if ( isset($optionsframework_settings['id']) ) {
  110
+		$option_name = $optionsframework_settings['id'];
  111
+	}
  112
+	else {
  113
+		$option_name = 'optionsframework';
  114
+	}
85 115
 	
86  
-	// Set the option defaults in case they have changed
87  
-	optionsframework_setdefaults();
  116
+	// If the option has no saved data, load the defaults
  117
+	if ( ! get_option($option_name) ) {
  118
+		optionsframework_setdefaults();
  119
+	}
88 120
 	
89 121
 	// Registers the settings fields and callback
90  
-	register_setting('optionsframework', $option_name, 'optionsframework_validate' );
  122
+	register_setting( 'optionsframework', $option_name, 'optionsframework_validate' );
91 123
 }
92 124
 
93 125
 /* 
@@ -101,7 +133,7 @@ function optionsframework_init() {
101 133
  */
102 134
 
103 135
 function optionsframework_setdefaults() {
104  
-
  136
+	
105 137
 	$optionsframework_settings = get_option('optionsframework');
106 138
 
107 139
 	// Gets the unique option id
@@ -114,7 +146,7 @@ function optionsframework_setdefaults() {
114 146
 	 * its associated data.  No need to clutter the database.  
115 147
 	 *
116 148
 	 */
117  
-	 
  149
+	
118 150
 	if ( isset($optionsframework_settings['knownoptions']) ) {
119 151
 		$knownoptions =  $optionsframework_settings['knownoptions'];
120 152
 		if ( !in_array($option_name, $knownoptions) ) {
@@ -130,32 +162,12 @@ function optionsframework_setdefaults() {
130 162
 	
131 163
 	// Gets the default options data from the array in options.php
132 164
 	$options = optionsframework_options();
133  
-		
134  
-	// If the options haven't been added to the database yet, they are added now
135  
-	foreach ($options as $option) {
136 165
 	
137  
-		if ( ($option['type'] != 'heading') && ($option['type'] != 'info') ) {
138  
-			$option_id = preg_replace('/\W/', '', strtolower($option['id']) );
139  
-			
140  
-			// wp_filter_post_kses for strings
141  
-			if (isset($option['std' ]) ) {
142  
-				if ( !is_array($option['std' ]) ) {
143  
-					$values[$option_id] = wp_filter_post_kses($option['std']);
144  
-				} else {
145  
-					foreach ($option['std' ] as $key => $value) {
146  
-						$optionarray[$key] = wp_filter_post_kses($value);
147  
-					}
148  
-					$values[$option_id] = $optionarray;
149  
-					unset($optionarray);
150  
-				}
151  
-			} else {
152  
-				$value = '';
153  
-			}
154  
-		}
155  
-	}
  166
+	// If the options haven't been added to the database yet, they are added now
  167
+	$values = of_get_default_values();
156 168
 	
157 169
 	if ( isset($values) ) {
158  
-		add_option($option_name, $values);
  170
+		add_option( $option_name, $values ); // Add option with default settings
159 171
 	}
160 172
 }
161 173
 
@@ -176,8 +188,8 @@ function optionsframework_add_page() {
176 188
 /* Loads the CSS */
177 189
 
178 190
 function optionsframework_load_styles() {
179  
-	wp_enqueue_style('admin-style', OPTIONS_FRAMEWORK_DIRECTORY .'css/admin-style.css');
180  
-	wp_enqueue_style('color-picker', OPTIONS_FRAMEWORK_DIRECTORY .'css/colorpicker.css');
  191
+	wp_enqueue_style('admin-style', OPTIONS_FRAMEWORK_DIRECTORY.'css/admin-style.css');
  192
+	wp_enqueue_style('color-picker', OPTIONS_FRAMEWORK_DIRECTORY.'css/colorpicker.css');
181 193
 }	
182 194
 
183 195
 /* Loads the javascript */
@@ -189,8 +201,8 @@ function optionsframework_load_scripts() {
189 201
 	
190 202
 	// Enqueued scripts
191 203
 	wp_enqueue_script('jquery-ui-core');
192  
-	wp_enqueue_script('color-picker', OPTIONS_FRAMEWORK_DIRECTORY . 'js/colorpicker.js', array('jquery'));
193  
-	wp_enqueue_script('options-custom', OPTIONS_FRAMEWORK_DIRECTORY . 'js/options-custom.js', array('jquery'));
  204
+	wp_enqueue_script('color-picker', OPTIONS_FRAMEWORK_DIRECTORY.'js/colorpicker.js', array('jquery'));
  205
+	wp_enqueue_script('options-custom', OPTIONS_FRAMEWORK_DIRECTORY.'js/options-custom.js', array('jquery'));
194 206
 }
195 207
 
196 208
 function of_admin_head() {
@@ -260,105 +272,110 @@ function optionsframework_page() {
260 272
 }
261 273
 }
262 274
 
263  
-/* 
264  
- * Data sanitization!
  275
+/** 
  276
+ * Validate Options.
265 277
  *
266 278
  * This runs after the submit/reset button has been clicked and
267 279
  * validates the inputs.
268 280
  *
  281
+ * @uses $_POST['reset']
  282
+ * @uses $_POST['update']
269 283
  */
  284
+function optionsframework_validate( $input ) {
270 285
 
271  
-function optionsframework_validate($input) {
272  
-
273  
-	$optionsframework_settings = get_option('optionsframework');
274  
-	
275  
-	// Gets the unique option id
276  
-	$option_name = $optionsframework_settings['id'];
277  
-	
278  
-	// If the reset button was clicked
279  
-	if (!empty($_POST['reset'])) {
280  
-		// If options are deleted sucessfully update the error message
281  
-		if (delete_option($option_name) ) {
282  
-			add_settings_error('options-framework', 'restore_defaults', __('Default options restored.'), 'updated fade');
283  
-		}
  286
+	/*
  287
+	 * Restore Defaults.
  288
+	 *
  289
+	 * In the event that the user clicked the "Restore Defaults"
  290
+	 * button, the options defined in the theme's options.php
  291
+	 * file will be added to the option for the active theme.
  292
+	 */
  293
+	 
  294
+	if ( isset( $_POST['reset'] ) ) {
  295
+		add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'optionsframework' ), 'updated fade' );
  296
+		return of_get_default_values();
284 297
 	}
285  
-	
286  
-	else
287  
-	
288  
-	{
289  
-	
290  
-	if (!empty($_POST['update'])) {
291  
-	
292  
-		$clean = array();
293 298
 
294  
-		// Get the options array we have defined in options.php
  299
+	/*
  300
+	 * Udpdate Settings.
  301
+	 */
  302
+	 
  303
+	if ( isset( $_POST['update'] ) ) {
  304
+		$clean = array();
295 305
 		$options = optionsframework_options();
296  
-		
297  
-		foreach ($options as $option) {
298  
-			
299  
-			// Verify that the option has an id
300  
-			if ( isset ($option['id']) ) {
301  
-			
302  
-				// Keep all ids lowercase with no spaces
303  
-				$id = preg_replace( '/\W/', '', strtolower( $option['id'] ) );
304  
-			
305  
-				// Set checkbox to false if it wasn't sent in the $_POST
306  
-				if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
307  
-					$input[$id] = "0";
308  
-				}
309  
-				
310  
-				// Set each item in the multicheck to false if it wasn't sent in the $_POST
311  
-				if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
312  
-					foreach ( $option['options'] as $key => $value ) {
313  
-						$input[$id][$key] = "0";
314  
-					} 
315  
-				}
316  
-				
317  
-				// For a value to be submitted to database it must pass through a sanitization filter
318  
-				if ( isset ( $input[$id] ) && has_filter('of_sanitize_' . $option['type']) ) {
319  
-					$clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
  306
+		foreach ( $options as $option ) {
  307
+
  308
+			if ( ! isset( $option['id'] ) ) {
  309
+				continue;
  310
+			}
  311
+
  312
+			if ( ! isset( $option['type'] ) ) {
  313
+				continue;
  314
+			}
  315
+
  316
+			$id = preg_replace( '/\W/', '', strtolower( $option['id'] ) );
  317
+
  318
+			// Set checkbox to false if it wasn't sent in the $_POST
  319
+			if ( 'checkbox' == $option['type'] && ! isset( $input[$id] ) ) {
  320
+				$input[$id] = '0';
  321
+			}
  322
+
  323
+			// Set each item in the multicheck to false if it wasn't sent in the $_POST
  324
+			if ( 'multicheck' == $option['type'] && ! isset( $input[$id] ) ) {
  325
+				foreach ( $option['options'] as $key => $value ) {
  326
+					$input[$id][$key] = '0';
320 327
 				}
321  
-				
322  
-			} // end isset $input
323  
-			
324  
-		} // end isset $id
325  
-		
326  
-	} // end foreach
327  
-	
328  
-	if ( isset($clean) ) {
329  
-		add_settings_error('options-framework', 'save_options', __('Options saved.'), 'updated fade');
330  
-		return $clean; // Return validated input
  328
+			}
  329
+
  330
+			// For a value to be submitted to database it must pass through a sanitization filter
  331
+			if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
  332
+				$clean[$id] = apply_filters( 'of_sanitize_' . $option['type'], $input[$id], $option );
  333
+			}
  334
+		}
  335
+
  336
+		add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'optionsframework' ), 'updated fade' );
  337
+		return $clean;
331 338
 	}
  339
+
  340
+	/*
  341
+	 * Request Not Recognized.
  342
+	 */
332 343
 	
333  
-	} // end $_POST['update']
334  
-	
  344
+	return of_get_default_values();
335 345
 }
336 346
 
337  
-
338  
-/* 
339  
- * Helper function to return the theme option value. If no value has been saved, it returns $default.
340  
- * Needed because options are saved as serialized strings.
  347
+/**
  348
+ * Format Configuration Array.
  349
+ *
  350
+ * Get an array of all default values as set in
  351
+ * options.php. The 'id','std' and 'type' keys need
  352
+ * to be defined in the configuration array. In the
  353
+ * event that these keys are not present the option
  354
+ * will not be included in this function's output.
  355
+ *
  356
+ * @return    array     Rey-keyed options configuration array.
341 357
  *
  358
+ * @access    private
342 359
  */
343  
-	
344  
-if ( !function_exists( 'of_get_option' ) ) {
345  
-function of_get_option($name, $default = false) {
346  
-	
347  
-	$optionsframework_settings = get_option('optionsframework');
348  
-	
349  
-	// Gets the unique option id
350  
-	$option_name = $optionsframework_settings['id'];
351  
-
352  
-	if ( get_option($option_name) ) {
353  
-		$options = get_option($option_name);
354  
-	}
355  
-	
356  
-	if ( !empty($options[$name]) ) {
357  
-		return $options[$name];
358  
-	} else {
359  
-		return $default;
  360
+ 
  361
+function of_get_default_values() {
  362
+	$output = array();
  363
+	$config = optionsframework_options();
  364
+	foreach ( (array) $config as $option ) {
  365
+		if ( ! isset( $option['id'] ) ) {
  366
+			continue;
  367
+		}
  368
+		if ( ! isset( $option['std'] ) ) {
  369
+			continue;
  370
+		}
  371
+		if ( ! isset( $option['type'] ) ) {
  372
+			continue;
  373
+		}
  374
+		if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {
  375
+			$output[$option['id']] = apply_filters( 'of_sanitize_' . $option['type'], $option['std'], $option );
  376
+		}
360 377
 	}
361  
-}
  378
+	return $output;
362 379
 }
363 380
 
364 381
 /**
@@ -377,4 +394,31 @@ function optionsframework_adminbar() {
377 394
 		'title' => __( 'Theme Options' ),
378 395
 		'href' => admin_url( 'themes.php?page=options-framework' )
379 396
   ));
  397
+}
  398
+
  399
+if ( ! function_exists( 'of_get_option' ) ) {
  400
+
  401
+	/**
  402
+	 * Get Option.
  403
+	 *
  404
+	 * Helper function to return the theme option value.
  405
+	 * If no value has been saved, it returns $default.
  406
+	 * Needed because options are saved as serialized strings.
  407
+	 */
  408
+	 
  409
+	function of_get_option( $name, $default = false ) {
  410
+		$config = get_option( 'optionsframework' );
  411
+
  412
+		if ( ! isset( $config['id'] ) ) {
  413
+			return $default;
  414
+		}
  415
+
  416
+		$options = get_option( $config['id'] );
  417
+
  418
+		if ( isset( $options[$name] ) ) {
  419
+			return $options[$name];
  420
+		}
  421
+
  422
+		return $default;
  423
+	}
380 424
 }
13  admin/options-interface.php
@@ -194,12 +194,9 @@ function optionsframework_fields() {
194 194
 			// Font Weight
195 195
 			$output .= '<select class="of-typography of-typography-style" name="'.$option_name.'['.$value['id'].'][style]" id="'. $value['id'].'_style">';
196 196
 
197  
-			$styles = array('normal'=>'Normal',
198  
-							'italic'=>'Italic',
199  
-							'bold'=>'Bold',
200  
-							'bold italic'=>'Bold Italic');
201  
-
202  
-			foreach ($styles as $key => $style) {
  197
+			/* Font Style */
  198
+			$styles = of_recognized_font_styles();
  199
+			foreach ( $styles as $key => $style ) {
203 200
 				$output .= '<option value="' . esc_attr( $key ) . '" ' . selected( $typography_stored['style'], $key, false ) . '>'. $style .'</option>';
204 201
 			}
205 202
 			$output .= '</select>';
@@ -276,7 +273,7 @@ function optionsframework_fields() {
276 273
 				$output .= '<h3 class="heading">' . esc_html( $value['name'] ) . '</h3>' . "\n";
277 274
 			}
278 275
 			if ( $value['desc'] ) {
279  
-				$output .= '<p>'. wp_kses( $value['desc'], $allowedtags) . '</p>' . "\n";
  276
+				$output .= wpautop( wp_kses( $value['desc'], $allowedtags) ) . "\n";
280 277
 			}
281 278
 			$output .= '<div class="clear"></div></div>' . "\n";
282 279
 		break;                       
@@ -288,7 +285,7 @@ function optionsframework_fields() {
288 285
 			}
289 286
 			$jquery_click_hook = preg_replace('/\W/', '', strtolower($value['name']) );
290 287
 			$jquery_click_hook = "of-option-" . $jquery_click_hook;
291  
-			$menu .= '<li><a title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#'.  $jquery_click_hook ) . '">' . esc_html( $value['name'] ) . '</a></li>';
  288
+			$menu .= '<li><a id="'.  esc_attr( $jquery_click_hook ) . '-tab" title="' . esc_attr( $value['name'] ) . '" href="' . esc_attr( '#'.  $jquery_click_hook ) . '">' . esc_html( $value['name'] ) . '</a></li>';
292 289
 			$output .= '<div class="group" id="' . esc_attr( $jquery_click_hook ) . '"><h2>' . esc_html( $value['name'] ) . '</h2>' . "\n";
293 290
 			break;
294 291
 		}
40  admin/options-sanitize.php
@@ -153,6 +153,7 @@ function of_sanitize_typography( $input ) {
153 153
 
154 154
 function of_sanitize_font_size( $value ) {
155 155
 	$recognized = of_recognized_font_sizes();
  156
+	$value = preg_replace('/px/','', $value);
156 157
 	if ( in_array( (int) $value, $recognized ) ) {
157 158
 		return (int) $value;
158 159
 	}
@@ -187,12 +188,13 @@ function of_sanitize_font_face( $value ) {
187 188
  *
188 189
  */
189 190
 function of_recognized_background_repeat() {
190  
-	return array(
191  
-		'none'     => 'No Repeat',
192  
-		'repeat-x' => 'Repeat Horizontally',
193  
-		'repeat-y' => 'Repeat Vertically',
194  
-		'repeat'   => 'Repeat All',
  191
+	$default = array(
  192
+		'no-repeat' => 'No Repeat',
  193
+		'repeat-x'  => 'Repeat Horizontally',
  194
+		'repeat-y'  => 'Repeat Vertically',
  195
+		'repeat'    => 'Repeat All',
195 196
 		);
  197
+	return apply_filters( 'of_recognized_background_repeat', $default );
196 198
 }
197 199
 
198 200
 /**
@@ -202,17 +204,18 @@ function of_recognized_background_repeat() {
202 204
  *
203 205
  */
204 206
 function of_recognized_background_position() {
205  
-	return array(
206  
-		'top left' => 'Top Left',
207  
-		'top center' => 'Top Center',
208  
-		'top right' => 'Top Right',
209  
-		'center left' => 'Middle Left',
  207
+	$default = array(
  208
+		'top left'      => 'Top Left',
  209
+		'top center'    => 'Top Center',
  210
+		'top right'     => 'Top Right',
  211
+		'center left'   => 'Middle Left',
210 212
 		'center center' => 'Middle Center',
211  
-		'center right' => 'Middle Right',
212  
-		'bottom left' => 'Bottom Left',
  213
+		'center right'  => 'Middle Right',
  214
+		'bottom left'   => 'Bottom Left',
213 215
 		'bottom center' => 'Bottom Center',
214  
-		'bottom right' => 'Bottom Right'
  216
+		'bottom right'  => 'Bottom Right'
215 217
 		);
  218
+	return apply_filters( 'of_recognized_background_position', $default );
216 219
 }
217 220
 
218 221
 /**
@@ -222,10 +225,11 @@ function of_recognized_background_position() {
222 225
  *
223 226
  */
224 227
 function of_recognized_background_attachment() {
225  
-	return array(
  228
+	$default = array(
226 229
 		'scroll' => 'Scroll Normally',
227  
-		'fixed' => 'Fixed in Place'
  230
+		'fixed'  => 'Fixed in Place'
228 231
 		);
  232
+	return apply_filters( 'of_recognized_background_attachment', $default );
229 233
 }
230 234
 
231 235
 /**
@@ -272,7 +276,7 @@ function of_recognized_font_sizes() {
272 276
  *
273 277
  */
274 278
 function of_recognized_font_faces() {
275  
-	return array(
  279
+	$default = array(
276 280
 		'arial'     => 'Arial',
277 281
 		'verdana'   => 'Verdana, Geneva',
278 282
 		'trebuchet' => 'Trebuchet',
@@ -282,6 +286,7 @@ function of_recognized_font_faces() {
282 286
 		'palatino'  => 'Palatino',
283 287
 		'helvetica' => 'Helvetica*'
284 288
 		);
  289
+	return apply_filters( 'of_recognized_font_faces', $default );
285 290
 }
286 291
 
287 292
 /**
@@ -295,12 +300,13 @@ function of_recognized_font_faces() {
295 300
  *
296 301
  */
297 302
 function of_recognized_font_styles() {
298  
-	return array(
  303
+	$default = array(
299 304
 		'normal'      => 'Normal',
300 305
 		'italic'      => 'Italic',
301 306
 		'bold'        => 'Bold',
302 307
 		'bold italic' => 'Bold Italic'
303 308
 		);
  309
+	return apply_filters( 'of_recognized_font_styles', $default );
304 310
 }
305 311
 
306 312
 /**
49  changelog.txt
... ...
@@ -1,17 +1,46 @@
1  
-Options Theme 0.3
  1
+== Changelog ==
2 2
 
3  
-- Complete rewrite based on the Options Framework plugin
  3
+= 0.8 =
4 4
 
5  
-Options Theme 0.2.1
  5
+* Saves tab states using local storage
  6
+* Minor style updates for WordPress 3.2 release
6 7
 
7  
--Updated js in admin-interface so that ajax upload works in Chrome.
8  
--Updated the admin stylesheet so rounded corners work in webkit.
  8
+= 0.7 =
9 9
 
10  
-Options Theme 0.2
  10
+* Added filtering for recognized arrays (like Font Face)
  11
+* Using isset rather than !empty to return of_get_option
  12
+* Significant updates for setting and restoring defaults
  13
+* Background option outputs no-repeat rather than none
11 14
 
12  
-- Fixed some minor css bugs.
13  
-- Changed layouts to be set through body classes rather than stylesheets.
  15
+= 0.6 =
14 16
 
15  
-Options Theme 0.1
  17
+* Introduces validation filters
  18
+* Better data sanitization and escaping
  19
+* Updates labels in options-interface.php
  20
+* Changes how checkboxes saved in database ("0" or "1")
  21
+* Stores typography, backgrounds and multichecks directly as arrays
  22
+* For full description, see: http://wptheming.com/2011/05/options-framework-0-6/
16 23
 
17  
-Initial Release
  24
+= 0.5 =
  25
+
  26
+* Fixed errors when more than one multicheck options is used
  27
+* Updated optionsframework_setdefaults so defaults actually save on first run
  28
+* Require that all options have lowercase alphanumeric ids
  29
+* Added link to options from the WordPress admin bar
  30
+
  31
+= 0.4 =
  32
+
  33
+* Updated multicheck option to save keys rather than values
  34
+* Unset default array options after each output in optionsframework_setdefaults
  35
+
  36
+= 0.3 =
  37
+
  38
+* White listed options for increased security
  39
+* Fixed errors with checkbox and select boxes
  40
+* Improved the multicheck option and changed format
  41
+
  42
+= 0.2 =
  43
+
  44
+* Uploaded to the WordPress repository
  45
+
  46
+= 0.1 =
26  functions.php
@@ -18,4 +18,30 @@
18 18
 
19 19
 require_once (OPTIONS_FRAMEWORK_URL . 'options-framework.php');
20 20
 
  21
+}
  22
+
  23
+/* 
  24
+ * This is an example of how to add custom scripts to the options panel.
  25
+ * This one shows/hides the an option when a checkbox is clicked.
  26
+ */
  27
+
  28
+add_action('optionsframework_custom_scripts', 'optionsframework_custom_scripts');
  29
+
  30
+function optionsframework_custom_scripts() { ?>
  31
+
  32
+<script type="text/javascript">
  33
+jQuery(document).ready(function() {
  34
+
  35
+	jQuery('#example_showhidden').click(function() {
  36
+  		jQuery('#section-example_text_hidden').fadeToggle(400);
  37
+	});
  38
+	
  39
+	if (jQuery('#example_showhidden:checked').val() !== undefined) {
  40
+		jQuery('#section-example_text_hidden').show();
  41
+	}
  42
+	
  43
+});
  44
+</script>
  45
+
  46
+<?php
21 47
 }
102  readme.txt
... ...
@@ -1,11 +1,101 @@
1  
-I am in the process of a complete rewrite of this code based on the Options Framework plugin.  Download the 0.2.1 tag if you want the latest stable version.
  1
+=== Options Framework ===
  2
+Contributors: Devin Price
  3
+Tags: options, theme options
  4
+Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X238BDP4QGTV2
  5
+Requires at least: 3.0
  6
+Tested up to: 3.2
  7
+Stable tag: 0.8
  8
+License: GPLv2
2 9
 
3  
---
  10
+== Description ==
4 11
 
5  
-The Options Frameworks was created to help developers build options into their themes.  This one was built as an example using a child theme of TwentyTen.  To view a video demo of how it works and read the documentation, please visit: http://wptheming.com/options-framework.
  12
+This is the adapted theme version of the Options Framework plugin.
6 13
 
7  
-Version 0.1 of this theme was coded using WooThemes Canvas as a base (http://www.woothemes.com/2010/02/canvas/).  The Options Framework is actually a slimmed down version of their version in Canvas, and I'd encourage you to check out and support WooThemes if you find this project helpful.
  14
+The Options Framework Plugin makes it easy to include an options panel in any WordPress theme.  It was built so that theme developers can concentrate on making the actual theme rather than spending a ton of time on creating an options panel from scratch.  It's free to use in both commercial and personal projects, just like WordPress itself.
8 15
 
9  
-If you want to set up the theme options for your own theme, drag the functions folder from the options-framework into your own theme.  Then copy the text inside functions.php and paste that into the functions.php file of your own theme (or just drag it in if you don't have a functions.php file yet in your theme.  That's it, basically.
  16
+Please visit [http://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin) for a full description of how to define and use the theme options.
10 17
 
11  
-If you want to use additional stylesheets or layouts, copy those folders into your theme as well.  If you don't, make sure the functions and options associated with them are removed from the theme functions.
  18
+The code is heavily based on the [WooFramework](http://www.woothemes.com/) and their option styles.
  19
+
  20
+== Installation ==
  21
+
  22
+If your theme already has options enabled, they will show up under the apperance menu.
  23
+
  24
+If your theme doesn't have options, you can define them to options.php of your theme and they will instantly show up.  For more on how to do this, visit [http://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).
  25
+
  26
+== Frequently Asked Questions ==
  27
+
  28
+= How do I build options for my own theme? =
  29
+
  30
+Download the development version from GitHub [https://github.com/devinsays/options-framework-plugin](https://github.com/devinsays/options-framework-plugin) and copy the "options-check" folder into your themes directory.
  31
+
  32
+The "Options Check" theme is a blueprint for how to work with options.  It includes an example of every option available in the panel and sample output in the theme.
  33
+
  34
+You can also watch the video screencast I have at [http://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).
  35
+
  36
+= What options are available to use? =
  37
+
  38
+* text
  39
+* textarea
  40
+* checkbox
  41
+* select
  42
+* radio
  43
+* upload (an image uploader)
  44
+* images (use images instead of radio buttons)
  45
+* background (a set of options to define a background)
  46
+* multicheck
  47
+* color (a jquery color picker)
  48
+* typography (a set of options to define typography)
  49
+
  50
+== Screenshots ==
  51
+
  52
+1. An example of the "Advanced Options" tag in the "Options Check" theme using this plugin.
  53
+
  54
+== Changelog ==
  55
+
  56
+= 0.8 =
  57
+
  58
+* Saves tab states using local storage
  59
+* Minor style updates for WordPress 3.2 release
  60
+
  61
+= 0.7 =
  62
+
  63
+* Added filtering for recognized arrays (like Font Face)
  64
+* Using isset rather than !empty to return of_get_option
  65
+* Significant updates for setting and restoring defaults
  66
+* Background option outputs no-repeat rather than none
  67
+
  68
+= 0.6 =
  69
+
  70
+* Introduces validation filters
  71
+* Better data sanitization and escaping
  72
+* Updates labels in options-interface.php
  73
+* Changes how checkboxes saved in database ("0" or "1")
  74
+* Stores typography, backgrounds and multichecks directly as arrays
  75
+* For full description, see: http://wptheming.com/2011/05/options-framework-0-6/
  76
+
  77
+= 0.5 =
  78
+
  79
+* Fixed errors when more than one multicheck options is used
  80
+* Updated optionsframework_setdefaults so defaults actually save on first run
  81
+* Require that all options have lowercase alphanumeric ids
  82
+* Added link to options from the WordPress admin bar
  83
+
  84
+= 0.4 =
  85
+
  86
+* Updated multicheck option to save keys rather than values
  87
+* Unset default array options after each output in optionsframework_setdefaults
  88
+
  89
+= 0.3 =
  90
+
  91
+* White listed options for increased security
  92
+* Fixed errors with checkbox and select boxes
  93
+* Improved the multicheck option and changed format
  94
+
  95
+= 0.2 =
  96
+
  97
+* Uploaded to the WordPress repository
  98
+
  99
+= 0.1 =
  100
+
  101
+* Initial release
2  style.css
@@ -4,7 +4,7 @@ Theme URI: http://wptheming.com
4 4
 Description: An example/test theme with a complete theme options panel.
5 5
 Author: Devin Price
6 6
 Author URI: http://wptheming.com
7  
-Version: 0.3
  7
+Version: 0.8
8 8
 Template: twentyten
9 9
 */
10 10
 

0 notes on commit c7fdf26

Please sign in to comment.
Something went wrong with that request. Please try again.