WordPress.org

Plugin Directory

Changeset 606684


Ignore:
Timestamp:
10/01/12 19:45:56 (19 months ago)
Author:
husobj
Message:

WordPress Settings API compatibility changes for WordPress 3.5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • password-protected/trunk/admin/admin.php

    r606681 r606684  
    22 
    33class Password_Protected_Admin { 
     4     
     5    var $options_group = 'reading'; 
    46     
    57    /** 
     
    79     */ 
    810    function Password_Protected_Admin() { 
     11        global $wp_version; 
    912        add_action( 'admin_init', array( $this, 'privacy_settings' ) ); 
    1013        add_action( 'admin_notices', array( $this, 'password_protected_admin_notices' ) ); 
    1114        add_filter( 'pre_update_option_password_protected_password', array( $this, 'pre_update_option_password_protected_password' ), 10, 2 ); 
     15         
     16        // Pre WordPress 3.5 settings group compatibility 
     17        if ( version_compare( $wp_version, '3.5.dev', '<' ) ) { 
     18            $this->options_group = 'privacy'; 
     19        } 
    1220    } 
    1321     
     
    2028            'Password Protected Settings', 
    2129            array( $this, 'password_protected_settings_section' ), 
    22             'privacy' 
     30            $this->options_group 
    2331        ); 
    2432        add_settings_field( 
     
    2634            'Password Protection Status', 
    2735            array( $this, 'password_protected_status_field' ), 
    28             'privacy', 
     36            $this->options_group, 
    2937            'password_protected' 
    3038        ); 
     
    3341            'New Password', 
    3442            array( $this, 'password_protected_password_field' ), 
    35             'privacy', 
     43            $this->options_group, 
    3644            'password_protected' 
    3745        ); 
    38         register_setting( 'privacy', 'password_protected_status', 'intval' ); 
    39         register_setting( 'privacy', 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) ); 
     46        register_setting( $this->options_group, 'password_protected_status', 'intval' ); 
     47        register_setting( $this->options_group, 'password_protected_password', array( $this, 'sanitize_password_protected_password' ) ); 
    4048    } 
    4149     
     
    109117    function password_protected_admin_notices(){ 
    110118        global $current_screen; 
    111         if ( $current_screen->id == 'options-privacy' ) { 
     119        if ( $current_screen->id == 'options-' . $this->options_group ) { 
    112120            $status = get_option( 'password_protected_status' ); 
    113121            $pwd = get_option( 'password_protected_password' ); 
Note: See TracChangeset for help on using the changeset viewer.