Changeset 684598
- Timestamp:
- 03/20/2013 03:53:17 AM (13 years ago)
- Location:
- trusted-only
- Files:
-
- 5 added
- 4 edited
-
tags/1.1 (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/trusted-only.php (added)
-
tags/1.1/trusted-ru_RU.mo (added)
-
tags/1.1/trusted-ru_RU.po (added)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/trusted-only.php (modified) (4 diffs)
-
trunk/trusted-ru_RU.mo (modified) (previous)
-
trunk/trusted-ru_RU.po (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trusted-only/trunk/readme.txt
r520017 r684598 4 4 Tags: user, users, administration, admin, access, authentication, block, community, content, login, members, membership, permissions, register, registration, restriction, security, multisite, multiuser, ban, deny 5 5 Requires at least: 3.0 6 Tested up to: 3. 3.17 Stable tag: 1. 06 Tested up to: 3.5.1 7 Stable tag: 1.1 8 8 Contributors: andreyk 9 License: GPLv2 or later 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html 9 11 10 12 Makes your site content visible only for several users who are in your trusted list. … … 28 30 == Changelog == 29 31 32 = 1.1 = 33 * Now works case insensitively. 34 * Can handle composite usernames (like *John Doe* or *Very Important Person*). 35 30 36 = 1.0 = 31 37 * First version. -
trusted-only/trunk/trusted-only.php
r520017 r684598 4 4 Plugin URI: http://andrey.eto-ya.com/wordpress/my-plugins/trusted-only 5 5 Description: Makes your site content visible only for several users who are in your trusted list. 6 Version: 1. 06 Version: 1.1 7 7 Author: Andrey K. 8 8 Author URI: http://andrey.eto-ya.com/ … … 54 54 $u= (isset($current_user->data->user_login))?$current_user->data->user_login: $current_user->user_login; 55 55 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) ) {} 57 57 else { 58 58 … … 91 91 92 92 function 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); 96 107 $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) ); 98 109 $updated= 1; 99 110 } 100 111 $trusted= get_option('trusted_only'); 101 112 $sep= (int)$trusted['allow_space']? ', ':' '; 102 113 echo empty($updated)?'':'<div id="message" class="updated fade"><p>'.__('Options Saved', 'trusted').'.</p></div>'; 103 114 … … 111 122 <tr> 112 123 <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':''; ?> /> <span class="description"><?php _e('then you should separate usernames by commas', 'trusted'); ?></span></td> 114 129 </tr> 115 130 <tr> -
trusted-only/trunk/trusted-ru_RU.po
r520017 r684598 1 1 msgid "" 2 2 msgstr "" 3 "Project-Id-Version: Trusted Only 1.0\n"3 "Project-Id-Version: Trusted Only v1.1\n" 4 4 "Report-Msgid-Bugs-To: \n" 5 5 "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" 7 7 "Last-Translator: Andrey K. <v5@bk.ru>\n" 8 8 "Language-Team: <v5@bk.ru>\n" … … 20 20 "X-Textdomain-Support: yes" 21 21 22 #: trusted-only.php:6 222 #: trusted-only.php:66 23 23 #@ trusted 24 24 msgid "Trusted Users" 25 25 msgstr "Доверенные участники" 26 26 27 #: trusted-only.php:1 0327 #: trusted-only.php:118 28 28 #@ trusted 29 29 msgid "List users who may read your blog" 30 30 msgstr "Перечислите пользователей, которые могут читать ваш блог" 31 31 32 #: trusted-only.php:1 0832 #: trusted-only.php:123 33 33 #@ trusted 34 34 msgid "Usernames separated by spaces or commas" 35 35 msgstr "Логины пользователей, через запятую или пробел" 36 36 37 #: trusted-only.php:1 1637 #: trusted-only.php:135 38 38 #@ default 39 39 msgid "Save Changes" 40 40 msgstr "" 41 41 42 #: trusted-only.php:6 242 #: trusted-only.php:66 43 43 #@ trusted 44 44 msgid "Trusted Users List" 45 45 msgstr "Список доверенных пользователей" 46 46 47 #: trusted-only.php: 5547 #: trusted-only.php:61 48 48 #, php-format 49 49 #@ trusted … … 51 51 msgstr "Вы не можете смотреть сайт %s, потому что его владелец разрешил доступ только для некоторых пользователей.<br />Вы сейчас залогинены как %s." 52 52 53 #: trusted-only.php: 6953 #: trusted-only.php:73 54 54 #@ trusted 55 55 msgid "Only several authorized users may read this site. If you are one of them please sign in." 56 56 msgstr "Только некоторые пользователи могут читать этот сайт. Если вы один из них, авторизуйтесь." 57 57 58 #: trusted-only.php:1 1258 #: trusted-only.php:131 59 59 #@ trusted 60 60 msgid "A message for display on the login page (optional)" 61 61 msgstr "Сообщение, отображаемое на странице входа (если хотите)" 62 62 63 #: trusted-only.php: 9863 #: trusted-only.php:113 64 64 #@ trusted 65 65 msgid "Options Saved" 66 66 msgstr "Настройки сохранены" 67 67 68 #: trusted-only.php:127 69 #@ trusted 70 msgid "Allow spaces in usernames" 71 msgstr "Разрешить логины, содержащие пробелы" 72 73 #: trusted-only.php:128 74 #@ trusted 75 msgid "then you should separate usernames by commas" 76 msgstr "тогда требуется отделять логины запятыми" 77
Note: See TracChangeset
for help on using the changeset viewer.