Plugin Directory

Changeset 684598


Ignore:
Timestamp:
03/20/2013 03:53:17 AM (13 years ago)
Author:
andreyk
Message:

Adding version 1.1

Location:
trusted-only
Files:
5 added
4 edited

Legend:

Unmodified
Added
Removed
  • trusted-only/trunk/readme.txt

    r520017 r684598  
    44Tags: user, users, administration, admin, access, authentication, block, community, content, login, members, membership, permissions, register, registration, restriction, security, multisite, multiuser, ban, deny
    55Requires at least: 3.0
    6 Tested up to: 3.3.1
    7 Stable tag: 1.0
     6Tested up to: 3.5.1
     7Stable tag: 1.1
    88Contributors: andreyk
     9License: GPLv2 or later
     10License URI: http://www.gnu.org/licenses/gpl-2.0.html
    911
    1012Makes your site content visible only for several users who are in your trusted list.
     
    2830== Changelog ==
    2931
     32= 1.1 =
     33* Now works case insensitively.
     34* Can handle composite usernames (like *John Doe* or *Very Important Person*).
     35
    3036= 1.0 =
    3137* First version.
  • trusted-only/trunk/trusted-only.php

    r520017 r684598  
    44Plugin URI:  http://andrey.eto-ya.com/wordpress/my-plugins/trusted-only
    55Description: Makes your site content visible only for several users who are in your trusted list.
    6 Version: 1.0
     6Version: 1.1
    77Author: Andrey K.
    88Author URI: http://andrey.eto-ya.com/
     
    5454    $u= (isset($current_user->data->user_login))?$current_user->data->user_login: $current_user->user_login;
    5555   
    56     if ( current_user_can('manage_options') || is_super_admin() || in_array($u, $trusted_users) ) {}
     56    if ( current_user_can('manage_options') || is_super_admin() || in_array(strtolower($u), $trusted_users) ) {}
    5757    else {
    5858
     
    9191
    9292function trusted_only_settings_page() {
    93     if ( isset( $_POST['trusted_only'] ) ) {
    94         preg_match_all('/[a-z0-9_-]+/', $_POST['trusted_only']['users'], $res );
    95         $users= array_unique($res[0]);
     93    if (isset($_POST['trusted_only'])) {
     94        $allow_space= empty($_POST['trusted_only']['allow_space'])?0:1;
     95        $_POST['trusted_only']['users']= strtolower($_POST['trusted_only']['users']);
     96        if ($allow_space) {
     97            $res= explode(',', $_POST['trusted_only']['users']);
     98            foreach ($res as $key=>$val) {
     99                $res[$key]= trim(preg_replace('/[^ a-z0-9_-]+/', '', $val));
     100            }
     101        }
     102        else {
     103            preg_match_all('/[a-z0-9_-]+/', $_POST['trusted_only']['users'], $res );
     104            $res= $res[0];
     105        }
     106        $users= array_unique($res);
    96107        $message= trim( htmlspecialchars(strip_tags( mb_substr($_POST['trusted_only']['message'], 0, 200))));
    97         update_option('trusted_only', array('users'=> $users, 'message'=> $message) );
     108        update_option('trusted_only', array('users'=> $users, 'message'=> $message, 'allow_space'=>$allow_space) );
    98109        $updated= 1;
    99110    }
    100111    $trusted= get_option('trusted_only');
    101 
     112    $sep= (int)$trusted['allow_space']? ', ':' ';
    102113    echo empty($updated)?'':'<div id="message" class="updated fade"><p>'.__('Options Saved', 'trusted').'.</p></div>';
    103114
     
    111122<tr>
    112123<th><?php _e('Usernames separated by spaces or commas', 'trusted'); ?>:</th>
    113 <td><textarea name="trusted_only[users]" rows="10" cols="80"><?php echo $trusted['users']?implode($trusted['users'], ' '):''; ?></textarea></td>
     124<td><textarea name="trusted_only[users]" rows="10" cols="80"><?php echo $trusted['users']?implode($trusted['users'], $sep):''; ?></textarea></td>
     125</tr>
     126<tr>
     127<th><?php _e('Allow spaces in usernames', 'trusted'); ?>:</th>
     128<td><input type="checkbox" name="trusted_only[allow_space]" value="1" <?php echo $trusted['allow_space']?'checked':''; ?> /> &nbsp; <span class="description"><?php _e('then you should separate usernames by commas', 'trusted'); ?></span></td>
    114129</tr>
    115130<tr>
  • trusted-only/trunk/trusted-ru_RU.po

    r520017 r684598  
    11msgid ""
    22msgstr ""
    3 "Project-Id-Version: Trusted Only 1.0\n"
     3"Project-Id-Version: Trusted Only v1.1\n"
    44"Report-Msgid-Bugs-To: \n"
    55"POT-Creation-Date: 2012-03-10 05:09+0200\n"
    6 "PO-Revision-Date: \n"
     6"PO-Revision-Date: 2013-03-20 03:28:17+0000\n"
    77"Last-Translator: Andrey K. <v5@bk.ru>\n"
    88"Language-Team: <v5@bk.ru>\n"
     
    2020"X-Textdomain-Support: yes"
    2121
    22 #: trusted-only.php:62
     22#: trusted-only.php:66
    2323#@ trusted
    2424msgid "Trusted Users"
    2525msgstr "Доверенные участники"
    2626
    27 #: trusted-only.php:103
     27#: trusted-only.php:118
    2828#@ trusted
    2929msgid "List users who may read your blog"
    3030msgstr "Перечислите пользователей, которые могут читать ваш блог"
    3131
    32 #: trusted-only.php:108
     32#: trusted-only.php:123
    3333#@ trusted
    3434msgid "Usernames separated by spaces or commas"
    3535msgstr "Логины пользователей, через запятую или пробел"
    3636
    37 #: trusted-only.php:116
     37#: trusted-only.php:135
    3838#@ default
    3939msgid "Save Changes"
    4040msgstr ""
    4141
    42 #: trusted-only.php:62
     42#: trusted-only.php:66
    4343#@ trusted
    4444msgid "Trusted Users List"
    4545msgstr "Список доверенных пользователей"
    4646
    47 #: trusted-only.php:55
     47#: trusted-only.php:61
    4848#, php-format
    4949#@ trusted
     
    5151msgstr "Вы не можете смотреть сайт %s, потому что его владелец разрешил доступ только для некоторых пользователей.<br />Вы сейчас залогинены как %s."
    5252
    53 #: trusted-only.php:69
     53#: trusted-only.php:73
    5454#@ trusted
    5555msgid "Only several authorized users may read this site. If you are one of them please sign in."
    5656msgstr "Только некоторые пользователи могут читать этот сайт. Если вы один из них, авторизуйтесь."
    5757
    58 #: trusted-only.php:112
     58#: trusted-only.php:131
    5959#@ trusted
    6060msgid "A message for display on the login page (optional)"
    6161msgstr "Сообщение, отображаемое на странице входа (если хотите)"
    6262
    63 #: trusted-only.php:98
     63#: trusted-only.php:113
    6464#@ trusted
    6565msgid "Options Saved"
    6666msgstr "Настройки сохранены"
    6767
     68#: trusted-only.php:127
     69#@ trusted
     70msgid "Allow spaces in usernames"
     71msgstr "Разрешить логины, содержащие пробелы"
     72
     73#: trusted-only.php:128
     74#@ trusted
     75msgid "then you should separate usernames by commas"
     76msgstr "тогда требуется отделять логины запятыми"
     77
Note: See TracChangeset for help on using the changeset viewer.