WordPress.org

Plugin Directory

Changeset 615363


Ignore:
Timestamp:
10/21/12 20:18:31 (18 months ago)
Author:
scribu
Message:

make 0.1.4 tag actually contain the same files as trunk

Location:
network-privacy/tags/0.1.4
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • network-privacy/tags/0.1.4/ra-network-privacy.php

    r615355 r615363  
    77Author URI:    http://ronandandrea.com/ 
    88Plugin URI:    http://wpmututorials.com/plugins/network-privacy/ 
     9Text Domain:   network-privacy 
    910 
    1011Original plugin by D Sader (http://www.snowotherway.org/) 
     
    2526 
    2627*/ 
     28 
    2729class RA_Network_Privacy { 
    2830 
    29     var $settings = false; 
    30  
    31     var $meta = array( 
    32         1 => array( 
    33             'settings_label' => __( 'Open to search engines' ), 
    34             'sites_label' => __( 'Public (%d)' ), 
    35         ), 
    36         0 => array( 
    37             'settings_label' => __( 'Block search engines' ), 
    38             'network_label' => __( 'Managed per site' ), 
    39             'sites_label' => __( 'No Search (%d)' ), 
    40         ), 
    41         -1 => apply_filters( 'ra-network-privacy-caps', array( 
    42             'login_message' => __( ' can be viewed by registered users of this network only.' ), 
    43             'settings_label' => __( 'Registered network users' ), 
    44             'network_label' => __( 'Must be registered users' ), 
    45             'sites_label' => __( 'Users only (%d)' ) 
    46         ), -1 ), 
    47         -2 => apply_filters( 'ra-network-privacy-caps', array( 
    48             'login_message' => __( ' can be viewed by registered users of this site only.' ), 
    49             'settings_label' => __( 'Site subscribers' ), 
    50             'sites_label' => __( 'Subscribers only (%d)' ), 
    51             'network_label' => __( 'Must be site subscribers' ), 
    52             'cap' => 'read' 
    53         ), -2 ), 
    54         -3 => apply_filters( 'ra-network-privacy-caps', array( 
    55             'login_message' => __( ' can be viewed by site administrators only.' ), 
    56             'settings_label' => __( 'Site administrators' ), 
    57             'sites_label' => __( 'Administrators only (%d)' ), 
    58             'network_label' => __( 'Must be site administrators' ), 
    59             'cap' => 'promote_users' 
    60         ), -3 ), 
    61         -4 => apply_filters( 'ra-network-privacy-caps', array( 
    62             'login_message' => __( ' can be viewed only by contributors and above. Subscribers and logged-out users are not able to view this site.' ), 
    63             'settings_label' => __( 'Site contributors' ), 
    64             'sites_label' => __( 'Contributors only (%d)' ), 
    65             'network_label' => __( 'Must be contributors or above' ), 
    66             'cap' => 'edit_posts' 
    67         ), -4 ), 
    68     ); 
     31    private $settings = false; 
     32    private $meta; 
    6933 
    7034    function __construct() { 
     35        $this->init_meta(); 
    7136 
    7237        $net_settings = get_site_option( 'ra_network_privacy', false ); 
     
    8853    } 
    8954 
     55    private function init_meta() { 
     56        $options = array( 
     57            -1 => array( 
     58                'login_message' => __( ' can be viewed by registered users of this network only.', 'network-privacy' ), 
     59                'settings_label' => __( 'Registered network users', 'network-privacy' ), 
     60                'network_label' => __( 'Must be registered users', 'network-privacy' ), 
     61                'sites_label' => __( 'Users only (%d)', 'network-privacy' ) 
     62            ), 
     63            -2 => array( 
     64                'login_message' => __( ' can be viewed by registered users of this site only.', 'network-privacy' ), 
     65                'settings_label' => __( 'Site subscribers', 'network-privacy' ), 
     66                'sites_label' => __( 'Subscribers only (%d)', 'network-privacy' ), 
     67                'network_label' => __( 'Must be site subscribers', 'network-privacy' ), 
     68                'cap' => 'read' 
     69            ), 
     70            -3 => array( 
     71                'login_message' => __( ' can be viewed by site administrators only.', 'network-privacy' ), 
     72                'settings_label' => __( 'Site administrators', 'network-privacy' ), 
     73                'sites_label' => __( 'Administrators only (%d)', 'network-privacy' ), 
     74                'network_label' => __( 'Must be site administrators', 'network-privacy' ), 
     75                'cap' => 'promote_users' 
     76            ), 
     77            -4 => array( 
     78                'login_message' => __( ' can be viewed only by contributors and above. Subscribers and logged-out users are not able to view this site.', 'network-privacy' ), 
     79                'settings_label' => __( 'Site contributors', 'network-privacy' ), 
     80                'sites_label' => __( 'Contributors only (%d)', 'network-privacy' ), 
     81                'network_label' => __( 'Must be contributors or above', 'network-privacy' ), 
     82                'cap' => 'edit_posts' 
     83            ), 
     84        ); 
     85 
     86        $this->meta = apply_filters( 'ra_network_privacy_caps', $options ); 
     87    } 
     88 
    9089    function do_robots() { 
    91  
    9290        remove_action( 'do_robots', 'do_robots' ); 
    9391 
     
    111109        } 
    112110    } 
     111 
    113112    function noindex() { 
    114  
    115113        remove_action( 'login_head', 'noindex' ); 
    116114        remove_action( 'wp_head', 'noindex', 1 ); 
     
    119117        if ( '1' != get_option( 'blog_public' ) ) 
    120118            echo "<meta name='robots' content='noindex,nofollow' />\n"; 
    121  
    122     } 
     119    } 
     120 
    123121    function privacy_ping_filter( $sites ) { 
    124  
    125122        remove_filter( 'option_ping_sites', 'privacy_ping_filter' ); 
     123 
    126124        if ( '1' == get_option( 'blog_public' ) ) 
    127125            return $sites; 
    128126 
    129127        return ''; 
    130  
    131     } 
    132     function sites_add_privacy_options() { 
    133  
    134         global $details; 
    135 ?> 
    136         <h4><?php _e( 'Additional Privacy Options' ) ?></h4> 
    137 <?php       for( $i = 1; $i > -5; $i-- ) { ?> 
    138             <input type='radio' name='blog[public]' value='<?php echo $i; ?>' <?php checked( $details->public == $i ); ?> /> <?php _e( $this->meta[$i]['settings_label'] ); ?><br /> 
    139 <?php       } 
    140  
    141     } 
     128    } 
     129 
    142130    // hook into blog privacy selector(options-privacy.php) 
    143131    function add_privacy_options($options) { 
     
    148136            <br /> 
    149137            <input id="privacy-<?php echo $i; ?>" type="radio" name="blog_public" value="<?php echo $i; ?>" <?php checked( $i, $privacy ); ?> /> 
    150             <label for="privacy-<?php echo $i; ?>"><?php printf( __( 'I would like my site to be visible only to %s.'), $this->meta[$i]['settings_label'] ); ?></label> 
     138            <label for="privacy-<?php echo $i; ?>"><?php printf( __( 'I would like my site to be visible only to %s.', 'network-privacy'), $this->meta[$i]['settings_label'] ); ?></label> 
    151139<?php 
    152140        } 
     
    157145        $privacy = get_option( 'blog_public' ); 
    158146        if( !empty( $this->meta[$privacy]['login_message'] ) ) 
    159             echo '<p>' . bloginfo( 'name' ) . __( $this->meta[$privacy]['login_message'] ) . '</p>'; 
     147            echo '<p>' . bloginfo( 'name' ) . __( $this->meta[$privacy]['login_message'], 'network-privacy' ) . '</p>'; 
    160148    } 
    161149 
     
    168156        <html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists('language_attributes') ) language_attributes(); ?>> 
    169157            <head> 
    170                 <title><?php _e("Private Blog Message"); ?></title> 
     158                <title><?php _e("Private Blog Message", 'network-privacy'); ?></title> 
    171159                <meta http-equiv="refresh" content="5;URL=<?php echo get_settings('siteurl'); ?>/wp-login.php" /> 
    172160                <?php wp_admin_css( 'css/login' ); 
     
    182170 
    183171    function authenticator () { 
    184  
    185172        $privacy = get_option( 'blog_public' ); 
    186173        if( $privacy > -1 ) 
     174            return; 
     175 
     176        // See if we're not already on the login page 
     177        if ( did_action( 'login_init' ) ) 
    187178            return; 
    188179 
     
    196187                    <form name="loginform" id="loginform"> 
    197188                        <p><?php printf( __( 'Wait 5 seconds or 
    198                             <a href="%s/wp-login.php">click</a> to continue.' ), get_settings('siteurl') ) ?></p> 
     189                            <a href="%s/wp-login.php">click</a> to continue.', 'network-privacy' ), get_settings('siteurl') ) ?></p> 
    199190                            <?php $this->privacy_login_message (); ?> 
    200191                    </form> 
     
    206197        } 
    207198 
    208         nocache_headers(); 
    209         header( 'HTTP/1.1 302 Moved Temporarily' ); 
    210         header( 'Location: ' . get_settings( 'siteurl' ) . '/wp-login.php?redirect_to=' . urlencode( $_SERVER['REQUEST_URI'] ) ); 
    211             header( 'Status: 302 Moved Temporarily' ); 
    212         exit; 
    213  
     199        wp_redirect( wp_login_url( $_SERVER['REQUEST_URI'] ) ); 
    214200    } 
    215201 
    216202    function network_privacy_options_page() { ?> 
    217         <h3><?php _e( 'Network Privacy Selector' ); ?></h3> 
     203        <h3><?php _e( 'Network Privacy Selector', 'network-privacy' ); ?></h3> 
    218204        <table class="form-table"> 
    219205        <tr valign="top"> 
    220             <th scope="row"><?php _e('Network Privacy'); ?></th> 
     206            <th scope="row"><?php _e('Network Privacy', 'network-privacy'); ?></th> 
    221207            <td><select name="ra_network_privacy" id="ra_network_privacy"> 
    222208<?php       for( $i = 0; $i > -4; $i-- ) { ?> 
    223                 <option value="<?php echo $i; ?>" <?php selected( $i == $this->settings['privacy'] ); ?>><?php _e( $this->meta[$i]['network_label'] ); ?></option> 
     209                <option value="<?php echo $i; ?>" <?php selected( $i == $this->settings['privacy'] ); ?>><?php echo $this->meta[$i]['network_label']; ?></option> 
    224210<?php       } ?> 
    225211            </select></td> 
    226212        </tr> 
    227213        </table> 
    228 <?php   } 
     214<?php 
     215    } 
     216 
    229217    function network_privacy_update() { 
    230  
    231218        $this->settings['privacy'] = (int) $_POST['ra_network_privacy']; 
    232219        update_site_option( 'ra_network_privacy', $this->settings ); 
    233  
    234     } 
     220    } 
     221 
    235222    function admin_init() { 
    236  
    237223        if( !is_plugin_active( plugin_basename( __FILE__ ) ) ) 
    238224            $this->settings['network'] = 1; 
     
    263249} 
    264250register_activation_hook( __FILE__, 'ra_network_privacy_activate' ); 
     251 
    265252function ra_network_privacy_deactivate() { 
    266253    delete_site_option( 'ra_network_privacy' ); 
    267254} 
    268255register_deactivation_hook( __FILE__, 'ra_network_privacy_deactivate' ); 
     256 
  • network-privacy/tags/0.1.4/readme.txt

    r615355 r615363  
    11=== Network Privacy === 
    2 Contributors: wpmuguru, cgrymala 
     2Contributors: wpmuguru, cgrymala, scribu 
    33Tags: privacy, plugin, wordpress, network  
    44Requires at least: 3.3 
    5 Tested up to: 3.3.1 
    6 Stable tag: 0.1.4 
     5Tested up to: 3.5 
     6Stable tag: 0.1.3 
    77 
    88Adds more privacy options to both single Wordpress sites and WordPress networks. 
     
    3232Support can be obtained through: 
    3333 
    34 [Try the Wordpress Forums first](http://wordpress.org/tags/network-privacy?forum_id=10#postform) 
     34[Try the Wordpress Forums first](http://wordpress.org/support/plugin/network-privacy) 
    3535 
    3636[Twitter](http://twitter.com/wpmuguru) 
    3737 
    38 [WPMU Tutorials](http://wpmututorials.com/contact/) 
     38[Ron & Andrea](http://ronandandrea.com/contact/) 
    3939 
    4040== Installation == 
     
    4747 
    4848= 0.1.4 = 
    49 * add filter for privacy settings 
     49* add 'ra_network_privacy_caps' filter 
    5050* change default cap for administrators from add_users to promote_users 
    5151* insert fix for BuddyPress [thanks to Simon Wheatley](http://wordpress.org/support/topic/plugin-network-privacy-problem-with-buddypress) 
     
    6363= 0.1 = 
    6464* Original version. 
    65  
    66 == Upgrade Notice == 
    67  
    68 = 0.1.3 = 
    69 This update should repair the bug in the "Network Users Only" privacy option 
Note: See TracChangeset for help on using the changeset viewer.