Options_Framework

The Onetone Options Framework class.

Defined (1)

The class is defined in the following location(s).

/admin/includes/class-options-framework.php  
  1. class Options_Framework { 
  2.  
  3. /** 
  4. * Plugin version, used for cache-busting of style and script file references. 
  5. * @since 1.7.0 
  6. * @type string 
  7. */ 
  8. const VERSION = '1.9.1'; 
  9.  
  10. /** 
  11. * Gets option name 
  12. * @since 1.9.0 
  13. */ 
  14. function get_option_name() { 
  15.  
  16. $name = ''; 
  17.  
  18. // Gets option name as defined in the theme 
  19. if ( function_exists( 'optionsframework_option_name' ) ) { 
  20. $name = optionsframework_option_name(); 
  21.  
  22. // Fallback 
  23. if ( '' == $name ) { 
  24. $name = get_option( 'stylesheet' ); 
  25. $name = preg_replace( "/\W/", "_", strtolower( $name ) ); 
  26.  
  27. return apply_filters( 'options_framework_option_name', $name ); 
  28.  
  29.  
  30. /** 
  31. * Wrapper for optionsframework_options() 
  32. * Allows for manipulating or setting options via 'of_options' filter 
  33. * For example: 
  34. * <code> 
  35. * add_filter( 'of_options', function( $options ) { 
  36. * $options[] = array( 
  37. * 'name' => 'Input Text Mini',  
  38. * 'desc' => 'A mini text input field.',  
  39. * 'id' => 'example_text_mini',  
  40. * 'std' => 'Default',  
  41. * 'class' => 'mini',  
  42. * 'type' => 'text' 
  43. * ); 
  44. * return $options; 
  45. * }); 
  46. * </code> 
  47. * Also allows for setting options via a return statement in the 
  48. * options.php file. For example (in options.php): 
  49. * <code> 
  50. * return array(...); 
  51. * </code> 
  52. * @return array (by reference) 
  53. */ 
  54. static function &_optionsframework_options() { 
  55. static $options = null; 
  56.  
  57. if ( !$options ) { 
  58. // Load options from options.php file (if it exists) 
  59. $location = apply_filters( 'options_framework_location', array( 'options.php' ) ); 
  60. if ( $optionsfile = locate_template( $location ) ) { 
  61. $maybe_options = load_template( $optionsfile ); 
  62. if ( is_array( $maybe_options ) ) { 
  63. $options = $maybe_options; 
  64. } else if ( function_exists( 'optionsframework_options' ) ) { 
  65. $options = optionsframework_options(); 
  66.  
  67. // Allow setting/manipulating options via filters 
  68. $options = apply_filters( 'of_options', $options ); 
  69.  
  70. return $options; 
  71.