Changeset 1968416
- Timestamp:
- 11/04/2018 02:37:00 AM (7 years ago)
- Location:
- loginrequirepress/trunk
- Files:
-
- 3 edited
-
LICENSE (modified) (1 diff)
-
LoginRequirePress.php (modified) (20 diffs)
-
readme.txt (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
loginrequirepress/trunk/LICENSE
r1478400 r1968416 29 29 http://www.maratbn.com/projects/login-require-press 30 30 31 Copyright (C) 2015-201 6Marat Nepomnyashy http://maratbn.com maratbn@gmail31 Copyright (C) 2015-2018 Marat Nepomnyashy http://maratbn.com maratbn@gmail 32 32 33 Version: 1. 3.0-development_unreleased33 Version: 1.4.0-development_unreleased 34 34 35 35 Module: loginrequirepress/LICENSE -
loginrequirepress/trunk/LoginRequirePress.php
r1478400 r1968416 9 9 Author URI: http://www.maratbn.com 10 10 License: GPL3 11 Version: 1. 3.0-development_unreleased11 Version: 1.4.0-development_unreleased 12 12 Text Domain: domain-plugin-LoginRequirePress 13 13 */ … … 44 44 http://www.maratbn.com/projects/login-require-press 45 45 46 Copyright (C) 2015-201 6Marat Nepomnyashy http://maratbn.com maratbn@gmail47 48 Version: 1. 3.0-development_unreleased46 Copyright (C) 2015-2018 Marat Nepomnyashy http://maratbn.com maratbn@gmail 47 48 Version: 1.4.0-development_unreleased 49 49 50 50 Module: LoginRequirePress.php … … 72 72 namespace plugin_LoginRequirePress; 73 73 74 75 const PHP_VERSION_MIN_SUPPORTED = '5.4';74 const DOMAIN_PLUGIN = 'domain-plugin-LoginRequirePress'; 75 const PHP_VERSION_MIN_SUPPORTED = '5.4'; 76 76 77 77 const LOCK_ = 'lock_'; … … 105 105 function action_add_meta_boxes() { 106 106 add_meta_box('plugin_LoginRequirePress_require_login', 107 __('Login Require Press', 'domain-plugin-LoginRequirePress'),107 __('Login Require Press', DOMAIN_PLUGIN), 108 108 '\\plugin_LoginRequirePress\\callbackMetaBox', 109 109 null); … … 111 111 112 112 function action_admin_menu() { 113 \add_options_page(\__('Login Require Press Settings', 'domain-plugin-LoginRequirePress'),114 \__('Login Require Press', 'domain-plugin-LoginRequirePress'),113 \add_options_page(\__('Login Require Press Settings', DOMAIN_PLUGIN), 114 \__('Login Require Press', DOMAIN_PLUGIN), 115 115 'manage_options', 116 116 'plugin_LoginRequirePress_settings', … … 122 122 if (!\current_user_can('manage_options')) { 123 123 \wp_die(\__('Insufficient user permissions to modify options.', 124 'domain-plugin-LoginRequirePress'));124 DOMAIN_PLUGIN)); 125 125 } 126 126 … … 199 199 200 200 ?><p><?=\__('Login protection:', 201 'domain-plugin-LoginRequirePress')?><?php202 ?> <strong><?=$flagLR ? \__('Enabled', 'domain-plugin-LoginRequirePress')203 : \__('Disabled', 'domain-plugin-LoginRequirePress')?></strong></p><?php201 DOMAIN_PLUGIN)?><?php 202 ?> <strong><?=$flagLR ? \__('Enabled', DOMAIN_PLUGIN) 203 : \__('Disabled',DOMAIN_PLUGIN)?></strong></p><?php 204 204 205 205 ?><input type='hidden' name='<?=LOGIN_REQUIRE_PRESS__META?>' value='present'><?php … … 207 207 ?><input type='checkbox' name='<?=LOGIN_REQUIRE_PRESS__LOCK?>'<?php 208 208 ?><?=$flagLR ? 'checked' : "" ?>><?php 209 ?><?=\__('Require login', 'domain-plugin-LoginRequirePress')?><?php209 ?><?=\__('Require login', DOMAIN_PLUGIN)?><?php 210 210 ?></label><?php 211 ?><p><i><?php 212 ?><?=\__('Any changes will not persist until this post is updated via the \'<b>Publish</b>\' box.', 213 DOMAIN_PLUGIN)?><?php 214 ?></i></p><?php 211 215 } 212 216 … … 214 218 \array_push($arrLinks, 215 219 '<a href=\'' . getUrlSettings() . '\'>' 216 . \__('Settings', 'domain-plugin-LoginRequirePress') . '</a>');220 . \__('Settings', DOMAIN_PLUGIN) . '</a>'); 217 221 return $arrLinks; 218 222 } … … 223 227 // page listings when the user is not logged in. 224 228 225 // Busting out if the current query is not for a feed and not for a search result when 226 // the user is not logged in: 227 $flagIsSearchNotLoggedIn = \is_search() && !\is_user_logged_in(); 228 if (!(\is_feed() || $flagIsSearchNotLoggedIn)) return $arrPosts; 229 229 // Busting out if the user is already logged in: 230 if (\is_user_logged_in()) { 231 return $arrPosts; 232 } 233 234 $flagIsFeed = \is_feed(); 230 235 $arrPostsFiltered = []; 231 236 232 237 foreach ($arrPosts as $post) { 233 238 if (isLoginRequiredForPost($post)) { 234 if ($flagIsSearchNotLoggedIn) { 235 $post->post_content = \__('[Post content protected by Login Require Press. Login to see the content.]', 236 'domain-plugin-LoginRequirePress'); 237 $post->post_title = \__('[Post title protected by Login Require Press. Login to see the title.]', 238 'domain-plugin-LoginRequirePress'); 239 } else { 239 if ($flagIsFeed) { 240 // Completely filter login-protected posts from feeds. 240 241 continue; 241 242 } 243 244 $post->post_content = \__('[Post content protected by Login Require Press. Login to see the content.]', 245 DOMAIN_PLUGIN); 246 $post->post_excerpt = \__('[Post excerpt protected by Login Require Press. Login to see the excerpt.]', 247 DOMAIN_PLUGIN); 248 $post->post_title = \__('[Post title protected by Login Require Press. Login to see the title.]', 249 DOMAIN_PLUGIN); 242 250 } 243 251 … … 262 270 \wp_die( 263 271 \sprintf(\__('Login Require Press plugin cannot be activated because the currently active PHP version on this server is %s < %s and not supported. PHP version >= %s is required.', 264 'domain-plugin-LoginRequirePress'),272 DOMAIN_PLUGIN), 265 273 \PHP_VERSION, 266 274 PHP_VERSION_MIN_SUPPORTED, … … 273 281 if (!\current_user_can('manage_options' )) { 274 282 \wp_die(\__('You do not have sufficient permissions to access this page.', 275 'domain-plugin-LoginRequirePress'));283 DOMAIN_PLUGIN)); 276 284 } 277 285 … … 280 288 ?><hr><?php 281 289 ?><h3><?php 282 ?><?=\__($strName, 'domain-plugin-LoginRequirePress')?><?php290 ?><?=\__($strName, DOMAIN_PLUGIN)?><?php 283 291 ?></h3><?php 284 292 ?><i><?php 285 ?><?=\__($strDesc, 'domain-plugin-LoginRequirePress')?><?php293 ?><?=\__($strDesc, DOMAIN_PLUGIN)?><?php 286 294 ?></i><?php 287 295 if (\count($arrPosts) == 0) { … … 295 303 : \sprintf( 296 304 \__('[no name %d]', 297 'domain-plugin-LoginRequirePress'),305 DOMAIN_PLUGIN), 298 306 $objPost->ID) 299 307 ?><?php … … 325 333 'require user login, then submit the form by clicking \'%1$s\' at the top or ' . 326 334 'bottom.', 327 'domain-plugin-LoginRequirePress'),335 DOMAIN_PLUGIN), 328 336 \__('Update LR Settings', 329 'domain-plugin-LoginRequirePress'));337 DOMAIN_PLUGIN)); 330 338 ?></p><?php 331 339 ?><p><?=\sprintf( 332 340 \__('After submitting the form, make sure that any post(s) you want ' . 333 341 'login-protected are listed in the \'%1$s\' section below.', 334 'domain-plugin-LoginRequirePress'),342 DOMAIN_PLUGIN), 335 343 \__('Non-private login-protected post(s)', 336 'domain-plugin-LoginRequirePress'))344 DOMAIN_PLUGIN)) 337 345 ?></p><?php 338 346 ?><form method='post' action='admin-post.php'><?php … … 346 354 $arrPasscodeProtected = []; 347 355 ?><input type='submit' value='<?=\__('Update LR Settings', 348 'domain-plugin-LoginRequirePress')356 DOMAIN_PLUGIN) 349 357 ?>' class='button-primary'/><hr><?php 350 358 ?><table style='border-collapse:collapse'><?php 351 359 ?><tr><?php 352 360 ?><th style='padding-right:15px;text-align:left'><?= 353 \__('LR', 'domain-plugin-LoginRequirePress')354 ?></th><?php 355 ?><th style='padding-right:15px;text-align:left'><?= 356 \__('Current LR', 'domain-plugin-LoginRequirePress')357 ?></th><?php 358 ?><th style='padding-right:15px;text-align:left'><?= 359 \__('ID', 'domain-plugin-LoginRequirePress')360 ?></th><?php 361 ?><th style='padding-right:15px;text-align:left'><?= 362 \__('Post Name', 'domain-plugin-LoginRequirePress')363 ?></th><?php 364 ?><th style='padding-right:15px;text-align:left'><?= 365 \__('Post Type', 'domain-plugin-LoginRequirePress')366 ?></th><?php 367 ?><th style='padding-right:15px;text-align:left'><?= 368 \__('Page Template', 'domain-plugin-LoginRequirePress')369 ?></th><?php 370 ?><th style='padding-right:15px;text-align:left'><?= 371 \__('Post Status', 'domain-plugin-LoginRequirePress')372 ?></th><?php 373 ?><th style='padding-right:15px;text-align:left'><?= 374 \__('Default Visibility', 'domain-plugin-LoginRequirePress')361 \__('LR', DOMAIN_PLUGIN) 362 ?></th><?php 363 ?><th style='padding-right:15px;text-align:left'><?= 364 \__('Current LR', DOMAIN_PLUGIN) 365 ?></th><?php 366 ?><th style='padding-right:15px;text-align:left'><?= 367 \__('ID', DOMAIN_PLUGIN) 368 ?></th><?php 369 ?><th style='padding-right:15px;text-align:left'><?= 370 \__('Post Name', DOMAIN_PLUGIN) 371 ?></th><?php 372 ?><th style='padding-right:15px;text-align:left'><?= 373 \__('Post Type', DOMAIN_PLUGIN) 374 ?></th><?php 375 ?><th style='padding-right:15px;text-align:left'><?= 376 \__('Page Template', DOMAIN_PLUGIN) 377 ?></th><?php 378 ?><th style='padding-right:15px;text-align:left'><?= 379 \__('Post Status', DOMAIN_PLUGIN) 380 ?></th><?php 381 ?><th style='padding-right:15px;text-align:left'><?= 382 \__('Default Visibility', DOMAIN_PLUGIN) 375 383 ?></th><?php 376 384 ?></tr><?php … … 387 395 $isPrivate = ($strPostStatus != 'publish'); 388 396 $strVisibility = $isPrivate ? \__('Private', 389 'domain-plugin-LoginRequirePress')397 DOMAIN_PLUGIN) 390 398 : \__('Public', 391 'domain-plugin-LoginRequirePress');399 DOMAIN_PLUGIN); 392 400 $isPasscodeProtected = ($post->post_password != null); 393 401 if ($isPasscodeProtected) { … … 417 425 if ($isLoginRequired) { 418 426 ?><font color='red'><?php 419 ?><?=\__(YES, 'domain-plugin-LoginRequirePress')?><?php427 ?><?=\__(YES, DOMAIN_PLUGIN)?><?php 420 428 ?></font><?php 421 429 } … … 438 446 ?></table><?php 439 447 ?><hr><input type='submit' value='<?=\__('Update LR Settings', 440 'domain-plugin-LoginRequirePress')448 DOMAIN_PLUGIN) 441 449 ?>' class='button-primary'<?php 442 450 ?> style='margin-bottom:3em'/><?php … … 488 496 $renderRefreshButton(); 489 497 } else { 490 ?><?=\__('No posts', 'domain-plugin-LoginRequirePress')?><?php498 ?><?=\__('No posts', DOMAIN_PLUGIN)?><?php 491 499 } 492 500 ?></div><?php -
loginrequirepress/trunk/readme.txt
r1478400 r1968416 3 3 Tags: require login, password protect, security, limit access, control access, members, visitors, subscribers, require-login, password-protect, login-protect, limit-access 4 4 Requires at least: 3.8.1 5 Tested up to: 4. 66 Stable tag: 1. 2.05 Tested up to: 4.9.8 6 Stable tag: 1.3.0 7 7 License: GPLv3 8 8 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 14 14 Overview: 15 15 16 At the time of this writing, the latest version of WordPress, version 4. 6,16 At the time of this writing, the latest version of WordPress, version 4.9.8, 17 17 has 3 post visibility options, which are 'public', 'password protected', and 18 18 'private'. … … 20 20 The 'password protected' option allows the site administrator to 21 21 individually lock certain posts, even from the logged in users, with an 22 additional password . However, there is currently no built-in way to just23 deny access only to the unauthenticated users.22 additional password / passcode. However, there is currently no built-in way 23 to just deny access only to the unauthenticated users. 24 24 25 25 Login Require Press is a WordPress plugin that allows site administrators to … … 100 100 == Changelog == 101 101 102 = 1.3.0 = 103 * Tested up to WordPress 4.9.8 104 * Added notice that changing settings in the meta box will not persist until the post is updated. 105 * Improved post filtering logic. 106 * Now also masking post excerpts of login-protected posts from search results. 107 102 108 = 1.2.0 = 103 109 * Tested up to WordPress 4.6
Note: See TracChangeset
for help on using the changeset viewer.