Plugin Directory

Changeset 1823985


Ignore:
Timestamp:
02/17/2018 10:06:02 PM (8 years ago)
Author:
downstairsdev
Message:

Version 1.8.6.

Location:
options-framework
Files:
42 added
7 edited

Legend:

Unmodified
Added
Removed
  • options-framework/trunk/includes/class-options-framework-admin.php

    r1329200 r1823985  
    1111
    1212    /**
    13     * Page hook for the options screen
    14     *
    15     * @since 1.7.0
    16     * @type string
    17     */
    18     protected $options_screen = null;
    19 
    20     /**
    21     * Hook in the scripts and styles
    22     *
    23     * @since 1.7.0
    24     */
    25     public function init() {
     13    * Page hook for the options screen
     14    *
     15    * @since 1.7.0
     16    * @type string
     17    */
     18    protected $options_screen = null;
     19
     20    /**
     21    * Hook in the scripts and styles
     22    *
     23    * @since 1.7.0
     24    */
     25    public function init() {
    2626
    2727        // Gets options to load
    28         $options = & Options_Framework::_optionsframework_options();
     28        $options = & Options_Framework::_optionsframework_options();
    2929
    3030        // Checks if options are available
    31         if ( $options ) {
     31        if ( $options ) {
    3232
    3333            // Add the options page and menu item.
     
    5050        }
    5151
    52     }
    53 
    54     /**
    55     * Let's the user know that options aren't available for their theme
    56     */
    57     function options_notice() {
     52    }
     53
     54    /**
     55    * Let's the user know that options aren't available for their theme
     56    */
     57    function options_notice() {
    5858        global $pagenow;
    59         if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
     59        if ( !is_multisite() && ( $pagenow == 'plugins.php' || $pagenow == 'themes.php' ) ) {
    6060            global $current_user ;
    6161            $user_id = $current_user->ID;
     
    6565                echo "</p></div>";
    6666            }
    67         }
    68     }
    69 
    70     /**
    71     * Allows the user to hide the options notice
    72     */
     67        }
     68    }
     69
     70    /**
     71    * Allows the user to hide the options notice
     72    */
    7373    function options_notice_ignore() {
    7474        global $current_user;
     
    8080
    8181    /**
    82     * Registers the settings
    83     *
    84     * @since 1.7.0
    85     */
    86     function settings_init() {
    87 
    88         // Load Options Framework Settings
    89         $optionsframework_settings = get_option( 'optionsframework' );
     82    * Registers the settings
     83    *
     84    * @since 1.7.0
     85    */
     86    function settings_init() {
     87
     88        // Load Options Framework Settings
     89        $optionsframework_settings = get_option( 'optionsframework' );
    9090
    9191        // Registers the settings fields and callback
     
    9595        add_action( 'optionsframework_after_validate', array( $this, 'save_options_notice' ) );
    9696
    97     }
     97    }
    9898
    9999    /*
     
    116116
    117117            // Modes: submenu, menu
    118             'mode' => 'submenu',
    119 
    120             // Submenu default settings
    121             'page_title' => __( 'Theme Options', 'options-framework'),
     118            'mode' => 'submenu',
     119
     120            // Submenu default settings
     121            'page_title' => __( 'Theme Options', 'options-framework'),
    122122            'menu_title' => __('Theme Options', 'options-framework'),
    123123            'capability' => 'edit_theme_options',
    124124            'menu_slug' => 'options-framework',
    125             'parent_slug' => 'themes.php',
    126 
    127             // Menu default settings
    128             'icon_url' => 'dashicons-admin-generic',
    129             'position' => '61'
     125            'parent_slug' => 'themes.php',
     126
     127            // Menu default settings
     128            'icon_url' => 'dashicons-admin-generic',
     129            'position' => '61'
    130130
    131131        );
     
    135135
    136136    /**
    137     * Add a subpage called "Theme Options" to the appearance menu.
    138     *
    139     * @since 1.7.0
    140     */
     137    * Add a subpage called "Theme Options" to the appearance menu.
     138    *
     139    * @since 1.7.0
     140    */
    141141    function add_custom_options_page() {
    142142
    143143        $menu = $this->menu_settings();
    144144
    145         switch( $menu['mode'] ) {
    146 
    147             case 'menu':
    148                 // http://codex.wordpress.org/Function_Reference/add_menu_page
    149                 $this->options_screen = add_menu_page(
    150                     $menu['page_title'],
    151                     $menu['menu_title'],
    152                     $menu['capability'],
    153                     $menu['menu_slug'],
    154                     array( $this, 'options_page' ),
    155                     $menu['icon_url'],
    156                     $menu['position']
    157                 );
    158                 break;
    159 
    160             default:
    161                 // http://codex.wordpress.org/Function_Reference/add_submenu_page
    162                 $this->options_screen = add_submenu_page(
    163                     $menu['parent_slug'],
    164                     $menu['page_title'],
    165                     $menu['menu_title'],
    166                     $menu['capability'],
    167                     $menu['menu_slug'],
    168                     array( $this, 'options_page' ) );
    169                 break;
    170         }
    171     }
    172 
    173     /**
    174     * Loads the required stylesheets
    175     *
    176     * @since 1.7.0
    177     */
     145        switch( $menu['mode'] ) {
     146
     147            case 'menu':
     148                // http://codex.wordpress.org/Function_Reference/add_menu_page
     149                $this->options_screen = add_menu_page(
     150                    $menu['page_title'],
     151                    $menu['menu_title'],
     152                    $menu['capability'],
     153                    $menu['menu_slug'],
     154                    array( $this, 'options_page' ),
     155                    $menu['icon_url'],
     156                    $menu['position']
     157                );
     158                break;
     159
     160            default:
     161                // http://codex.wordpress.org/Function_Reference/add_submenu_page
     162                $this->options_screen = add_submenu_page(
     163                    $menu['parent_slug'],
     164                    $menu['page_title'],
     165                    $menu['menu_title'],
     166                    $menu['capability'],
     167                    $menu['menu_slug'],
     168                    array( $this, 'options_page' ) );
     169                break;
     170        }
     171    }
     172
     173    /**
     174    * Loads the required stylesheets
     175    *
     176    * @since 1.7.0
     177    */
    178178    function enqueue_admin_styles( $hook ) {
    179179
    180         if ( $this->options_screen != $hook )
    181             return;
    182 
    183         wp_enqueue_style( 'optionsframework', plugin_dir_url( dirname(__FILE__) ) . 'css/optionsframework.css', array(),  Options_Framework::VERSION );
     180        if ( $this->options_screen != $hook ) {
     181            return;
     182        }
     183
     184        wp_enqueue_style(
     185            'optionsframework',
     186            plugin_dir_url( dirname(__FILE__) ) . 'css/optionsframework.css',
     187            array(),
     188            Options_Framework::VERSION
     189        );
    184190        wp_enqueue_style( 'wp-color-picker' );
    185191    }
    186192
    187193    /**
    188     * Loads the required javascript
    189     *
    190     * @since 1.7.0
    191     */
     194    * Loads the required javascript
     195    *
     196    * @since 1.7.0
     197    */
    192198    function enqueue_admin_scripts( $hook ) {
    193199
    194         if ( $this->options_screen != $hook )
    195             return;
     200        if ( $this->options_screen != $hook ) {
     201            return;
     202        }
    196203
    197204        // Enqueue custom option panel JS
    198         wp_enqueue_script( 'options-custom', plugin_dir_url( dirname(__FILE__) ) . 'js/options-custom.js', array( 'jquery','wp-color-picker' ), Options_Framework::VERSION );
     205        wp_enqueue_script(
     206            'options-custom',
     207            plugin_dir_url( dirname(__FILE__) ) . 'js/options-custom.js',
     208            array( 'jquery','wp-color-picker' ),
     209            Options_Framework::VERSION
     210        );
    199211
    200212        // Inline scripts from options-interface.php
     
    208220
    209221    /**
    210     * Builds out the options panel.
    211     *
     222    * Builds out the options panel.
     223    *
    212224     * If we were using the Settings API as it was intended we would use
    213225     * do_settings_sections here.  But as we don't want the settings wrapped in a table,
     
    217229     * Nonces are provided using the settings_fields()
    218230     *
    219     * @since 1.7.0
    220     */
     231    * @since 1.7.0
     232    */
    221233     function options_page() { ?>
    222234
     
    226238        <h2><?php echo esc_html( $menu['page_title'] ); ?></h2>
    227239
    228         <h2 class="nav-tab-wrapper">
    229             <?php echo Options_Framework_Interface::optionsframework_tabs(); ?>
    230         </h2>
    231 
    232         <?php settings_errors( 'options-framework' ); ?>
    233 
    234         <div id="optionsframework-metabox" class="metabox-holder">
    235             <div id="optionsframework" class="postbox">
     240        <h2 class="nav-tab-wrapper">
     241            <?php echo Options_Framework_Interface::optionsframework_tabs(); ?>
     242        </h2>
     243
     244        <?php settings_errors( 'options-framework' ); ?>
     245
     246        <div id="optionsframework-metabox" class="metabox-holder">
     247            <div id="optionsframework" class="postbox">
    236248                <form action="options.php" method="post">
    237249                <?php settings_fields( 'optionsframework' ); ?>
     
    270282
    271283        if ( isset( $_POST['reset'] ) ) {
    272             add_settings_error( 'options-framework', 'restore_defaults', __( 'Default options restored.', 'options-framework' ), 'updated fade' );
     284            add_settings_error(
     285                'options-framework',
     286                'restore_defaults',
     287                __( 'Default options restored.', 'options-framework' ),
     288                'updated fade'
     289            );
    273290            return $this->get_default_values();
    274291        }
     
    324341
    325342    function save_options_notice() {
    326         add_settings_error( 'options-framework', 'save_options', __( 'Options saved.', 'options-framework' ), 'updated fade' );
     343        add_settings_error(
     344            'options-framework',
     345            'save_options',
     346            __( 'Options saved.', 'options-framework' ),
     347            'updated fade'
     348        );
    327349    }
    328350
  • options-framework/trunk/includes/class-options-framework.php

    r1329200 r1823985  
    1616     * @type string
    1717     */
    18     const VERSION = '1.8.5';
     18    const VERSION = '1.8.6';
    1919
    2020    /**
     
    3838
    3939        // Load settings
    40         $optionsframework_settings = get_option( 'optionsframework' );
     40        $optionsframework_settings = get_option( 'optionsframework' );
    4141
    42         // Updates the unique option id in the database if it has changed
    43         if ( function_exists( 'optionsframework_option_name' ) ) {
     42        // Updates the unique option id in the database if it has changed
     43        if ( function_exists( 'optionsframework_option_name' ) ) {
    4444            optionsframework_option_name();
    45         }
    46         elseif ( has_action( 'optionsframework_option_name' ) ) {
     45        }
     46        elseif ( has_action( 'optionsframework_option_name' ) ) {
    4747            do_action( 'optionsframework_option_name' );
    48         }
    49         // If the developer hasn't explicitly set an option id, we'll use a default
    50         else {
    51             $default_themename = get_option( 'stylesheet' );
    52             $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
    53             $default_themename = 'optionsframework_' . $default_themename;
    54             if ( isset( $optionsframework_settings['id'] ) ) {
     48        }
     49        // If the developer hasn't explicitly set an option id, we'll use a default
     50        else {
     51            $default_themename = get_option( 'stylesheet' );
     52            $default_themename = preg_replace( "/\W/", "_", strtolower($default_themename ) );
     53            $default_themename = 'optionsframework_' . $default_themename;
     54            if ( isset( $optionsframework_settings['id'] ) ) {
    5555                if ( $optionsframework_settings['id'] == $default_themename ) {
    5656                    // All good, using default theme id
     
    5959                    update_option( 'optionsframework', $optionsframework_settings );
    6060                }
    61             }
    62             else {
     61            }
     62            else {
    6363                $optionsframework_settings['id'] = $default_themename;
    6464                update_option( 'optionsframework', $optionsframework_settings );
    65             }
    66         }
     65            }
     66        }
    6767
    6868    }
     
    101101        static $options = null;
    102102
    103         if ( !$options ) {
    104             // Load options from options.php file (if it exists)
    105             $location = apply_filters( 'options_framework_location', array('options.php') );
    106             if ( $optionsfile = locate_template( $location ) ) {
    107                 $maybe_options = require_once $optionsfile;
    108                 if ( is_array( $maybe_options ) ) {
     103        if ( ! $options ) {
     104            // Load options from options.php file (if it exists)
     105            $location = apply_filters( 'options_framework_location', array( 'options.php' ) );
     106            if ( $optionsfile = locate_template( $location ) ) {
     107                $maybe_options = require_once $optionsfile;
     108                if ( is_array( $maybe_options ) ) {
    109109                    $options = $maybe_options;
    110                 } else if ( function_exists( 'optionsframework_options' ) ) {
     110                } else if ( function_exists( 'optionsframework_options' ) ) {
    111111                    $options = optionsframework_options();
    112112                }
    113             }
     113            }
    114114
    115             // Allow setting/manipulating options via filters
    116             $options = apply_filters( 'of_options', $options );
     115            // Allow setting/manipulating options via filters
     116            $options = apply_filters( 'of_options', $options );
    117117        }
    118118
  • options-framework/trunk/includes/class-options-interface.php

    r1329200 r1823985  
    9595            // If the option is already saved, override $val
    9696            if ( ( $value['type'] != 'heading' ) && ( $value['type'] != 'info') ) {
    97                 if ( isset( $settings[($value['id'])]) ) {
    98                     $val = $settings[($value['id'])];
     97                if ( isset( $settings[$value['id']]) ) {
     98                    $val = $settings[$value['id']];
    9999                    // Striping slashes of non-array options
    100                     if ( !is_array($val) ) {
     100                    if ( ! is_array( $val ) ) {
    101101                        $val = stripslashes( $val );
    102102                    }
     
    246246                    $font_size = '<select class="of-typography of-typography-size" name="' . esc_attr( $option_name . '[' . $value['id'] . '][size]' ) . '" id="' . esc_attr( $value['id'] . '_size' ) . '">';
    247247                    $sizes = $typography_options['sizes'];
    248                     foreach ( $sizes as $i ) {
    249                         $size = $i . 'px';
     248                    foreach ( $sizes as $size ) {
     249                        $size = $size . 'px';
    250250                        $font_size .= '<option value="' . esc_attr( $size ) . '" ' . selected( $typography_stored['size'], $size, false ) . '>' . esc_html( $size ) . '</option>';
    251251                    }
  • options-framework/trunk/includes/class-options-media-uploader.php

    r1329200 r1823985  
    6161            $class = ' has-file';
    6262        }
     63
    6364        $output .= '<input id="' . $id . '" class="upload' . $class . '" type="text" name="'.$name.'" value="' . $value . '" placeholder="' . __('No file chosen', 'options-framework') .'" />' . "\n";
    6465        if ( function_exists( 'wp_enqueue_media' ) ) {
     
    108109        $menu = Options_Framework_Admin::menu_settings();
    109110
    110         if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] )
    111             return;
     111        if ( substr( $hook, -strlen( $menu['menu_slug'] ) ) !== $menu['menu_slug'] ) {
     112            return;
     113        }
    112114
    113         if ( function_exists( 'wp_enqueue_media' ) )
     115        if ( function_exists( 'wp_enqueue_media' ) ) {
    114116            wp_enqueue_media();
     117        }
    115118
    116         wp_register_script( 'of-media-uploader', plugin_dir_url( dirname(__FILE__) ) .'js/media-uploader.js', array( 'jquery' ), Options_Framework::VERSION );
     119        wp_register_script(
     120            'of-media-uploader',
     121            plugin_dir_url( dirname(__FILE__) ) .'js/media-uploader.js',
     122            array( 'jquery' ),
     123            Options_Framework::VERSION
     124        );
     125
    117126        wp_enqueue_script( 'of-media-uploader' );
    118127        wp_localize_script( 'of-media-uploader', 'optionsframework_l10n', array(
  • options-framework/trunk/includes/class-options-sanitization.php

    r1329200 r1823985  
    6464function of_sanitize_checkbox( $input ) {
    6565    if ( $input ) {
    66         $output = '1';
    67     } else {
    68         $output = false;
    69     }
    70     return $output;
     66        return '1';
     67    }
     68    return false;
    7169}
    7270add_filter( 'of_sanitize_checkbox', 'of_sanitize_checkbox' );
     
    7977 */
    8078function of_sanitize_multicheck( $input, $option ) {
    81     $output = '';
     79    $output = array();
    8280    if ( is_array( $input ) ) {
    8381        foreach( $option['options'] as $key => $value ) {
     
    279277        return $value;
    280278    }
    281     return apply_filters( 'of_default_font_size', $recognized );
     279    return apply_filters( 'of_default_font_size', current( $recognized ) );
    282280}
    283281add_filter( 'of_font_size', 'of_sanitize_font_size' );
  • options-framework/trunk/options-framework.php

    r1329200 r1823985  
    1313 * Plugin URI:  http://wptheming.com
    1414 * Description: A framework for building theme options.
    15  * Version:     1.8.5
     15 * Version:     1.8.6
    1616 * Author:      Devin Price
    1717 * Author URI:  http://wptheming.com
  • options-framework/trunk/readme.txt

    r1756401 r1823985  
    55Donate link: http://bit.ly/options-donate-2
    66Requires at least: 3.6
    7 Tested up to: 4.8.3
     7Tested up to: 4.9.4
    88Stable tag: 1.8.5
    99License: GPLv2
     
    3030= Learn More =
    3131
    32 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.
     32Please visit [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin) for a full description of how to define and use the theme options.
    3333
    3434== Installation ==
     
    3636If your theme already has options enabled, they will show up under the appearance menu.
    3737
    38 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).
     38If 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 [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin).
    3939
    4040== Frequently Asked Questions ==
     
    4646The "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.
    4747
    48 You can also watch the video screencast I have at [http://wptheming.com/options-framework-plugin](http://wptheming.com/options-framework-plugin).
     48You can also watch the video screencast I have at [https://wptheming.com/options-framework-plugin](https://wptheming.com/options-framework-plugin).
    4949
    5050= What options are available to use? =
     
    6969== Changelog ==
    7070
     71= 1.8.6 =
     72
     73* Fix: of_sanitize_multicheck should return an array
     74* Fix: Typography size should returns a string rather than array
     75* Fix: Fix isset notices in custom typography field for Options Check
     76
    7177= 1.8.5 =
    7278
     
    220226* Changes how checkboxes saved in database ("0" or "1")
    221227* Stores typography, backgrounds and multichecks directly as arrays
    222 * For full description, see: http://wptheming.com/2011/05/options-framework-0-6/
     228* For full description, see: https://wptheming.com/2011/05/options-framework-0-6/
    223229
    224230= 0.5.0 =
Note: See TracChangeset for help on using the changeset viewer.