This commit is contained in:
2026-04-26 23:47:49 +02:00
parent 1b95f03d1e
commit b073e009d8
5288 changed files with 1112699 additions and 55536 deletions

View File

@@ -0,0 +1,16 @@
<?php
/**
* Password Protect Child Pages
*/
?>
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label>
<?php echo esc_html__( 'Password Protect Child Pages', PPW_Constants::DOMAIN ); ?>
</label>
<?php echo esc_html__( 'Automatically protect all child pages once their parent is protected. Available in Pro version.', PPW_Constants::DOMAIN ); ?>
</p>
</td>
</tr>

View File

@@ -0,0 +1,22 @@
<?php
$post_types = ppw_core_get_all_post_types();
unset( $post_types['post'] );
unset( $post_types['page'] );
?>
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label>
<?php echo esc_html__( 'Post Type Protection', PPW_Constants::DOMAIN ); ?>
</label>
<?php echo _e( '<a target="_blank" rel="noopener noreferrer" href="https://passwordprotectwp.com/docs/settings/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free#cpt">Select which custom post types</a> you want to password protect. Default: Pages & Posts.', PPW_Constants::DOMAIN ); // phpcs:ignore -- there is no value to escape. ?>
</p>
<div class="ppw_wrap_select_protection_selected">
<div class="ppw_wrap_protection_selected">
<span class="ppw_protection_selected">Pages</span>
<span class="ppw_protection_selected">Posts</span>
</div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,13 @@
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label><?php echo esc_html__( 'Error Message', PPW_Constants::DOMAIN ) ?></label>
<?php echo _e( 'Customize the error message when users enter wrong passwords.<em> Available in Pro version only.</em>', PPW_Constants::DOMAIN ) ?>
</p>
<span>
<input type="text"
value="<?php echo esc_html( PPW_Constants::DEFAULT_WRONG_PASSWORD_MESSAGE ); ?>"/>
</span>
</td>
</tr>

View File

@@ -0,0 +1,55 @@
<?php
$password_cookie_expired = ppw_core_get_setting_type_string( PPW_Constants::COOKIE_EXPIRED );
$time = 7;
$units = 'days';
$one_year = 365;
$max = $one_year;
if ( ! empty( $password_cookie_expired ) ) {
$tmp = explode( ' ', $password_cookie_expired );
if ( count( $tmp ) === 2 ) {
$time = (int) $tmp[0];
$units = $tmp[1];
switch ( $units ) {
case 'hours':
$max = $one_year * 24;
break;
case 'minutes':
$max = $one_year * 24 * 60;
break;
case 'seconds':
$max = $one_year * 24 * 60 * 60;
break;
default:
$max = $one_year;
}
}
}
?>
<tr>
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label><?php echo esc_html__( 'Cookie Expiration Time', PPW_Constants::DOMAIN ); ?></label>
<?php echo _e( 'By default, users wont have to re-enter passwords until its cookie expires. You can also <a target="_blank" href="https://passwordprotectwp.com/docs/settings/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free#cookies">use session cookies</a> to log users out right after they close the browser.', PPW_Constants::DOMAIN ); // phpcs:ignore -- there is no value to escape. ?>
</p>
<input required value="<?php echo esc_attr( $time ); ?>" class="wpp_time_number" type="number"
id="wpp_password_cookie_times" min="1" max="<?php echo esc_attr( $max ); ?>"/>
<select id="wpp_password_cookie_units" class="wpp_password_cookie_units">
<option value="days" <?php if ( 'days' === $units ) {
echo 'selected';
} ?>><?php echo esc_html__( 'Days', PPW_Constants::DOMAIN ); ?></option>
<option value="hours" <?php if ( 'hours' === $units ) {
echo 'selected';
} ?> ><?php echo esc_html__( 'Hours', PPW_Constants::DOMAIN ) ?>
</option>
<option value="minutes" <?php if ( 'minutes' === $units ) {
echo 'selected';
} ?> ><?php echo esc_html__( 'Minutes', PPW_Constants::DOMAIN ) ?>
</option>
<option value="seconds" <?php if ( 'seconds' === $units ) {
echo 'selected';
} ?> ><?php echo esc_html__( 'Seconds', PPW_Constants::DOMAIN ) ?>
</option>
</select>
</td>
</tr>

View File

@@ -0,0 +1,10 @@
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label><?php echo esc_html__( 'Form Message', PPW_Constants::DOMAIN ) ?></label>
<?php echo _e( 'Customize the message which displays above the password field.<em> Available in Pro version only.</em>', PPW_Constants::DOMAIN ) ?>
</p>
<input type="text" value="<?php echo esc_html( PPW_Constants::DEFAULT_FORM_MESSAGE ); ?>"/>
</td>
</tr>

View File

@@ -0,0 +1,77 @@
<form class="ppw_main_container" id="wp_protect_password_general_form">
<input type="hidden" id="ppw_general_form_nonce"
value="<?php echo esc_attr( wp_create_nonce( PPW_Constants::GENERAL_FORM_NONCE ) ); ?>"/>
<table class="ppwp_settings_table" cellpadding="4">
<tr id="pda-password-protection">
<td colspan="2">
<h3><?php echo esc_html__( 'PASSWORD PROTECTION', 'password-protect-page' ); ?></h3>
</td>
</tr>
<?php
include PPW_DIR_PATH . 'includes/views/general/view-ppw-custom-column-permission.php';
include PPW_DIR_PATH . 'includes/views/general/view-ppw-expired-cookie.php';
include PPW_DIR_PATH . 'includes/views/general/view-ppw-whitelist-roles.php';
include PPW_DIR_PATH . 'includes/views/general/view-ppw-auto-protect-child-page.php';
// include PPW_DIR_PATH . 'includes/views/general/view-ppw-protect-private-pages.php';
include PPW_DIR_PATH . 'includes/views/general/view-ppw-hide-protected-post.php';
?>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<tr id="wpp-password-form">
<td colspan="2">
<h3><?php echo esc_html__( 'PASSWORD FORM CUSTOMIZATION', 'password-protect-page' ); ?></h3>
</td>
</tr>
<tr>
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<?php
$link_error_message = sprintf(
'<a target="_blank" rel="noopener" href="%s">error message & password form</a>',
'https://passwordprotectwp.com/customize-password-form-wordpress-customizer/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free'
);
$link_customizer = sprintf(
'<a target="_blank" rel="noopener" href="%s">WordPress Customizer</a>',
'customize.php?autofocus[panel]=ppwp'
);
$form_message = sprintf(
// translators: %s: Link to documentation.
esc_html__( 'Customize the default %1$s including headline, description and button under %2$s.', 'password-protect-page' ),
$link_error_message,
$link_customizer
);
?>
<?php echo wp_kses_post( $form_message ); ?>
</td>
</tr>
<?php
// include PPW_DIR_PATH . 'includes/views/general/view-ppw-form-message.php';
// include PPW_DIR_PATH . 'includes/views/general/view-ppw-error-message.php';
?>
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<tr id="wpp-password-form">
<td colspan="2">
<h3><?php echo esc_html__( 'ADVANCED OPTIONS', 'password-protect-page' ); ?></h3>
</td>
</tr>
<?php
include PPW_DIR_PATH . 'includes/views/general/view-ppw-remove-search-engine.php';
include PPW_DIR_PATH . 'includes/views/general/view-ppw-remove-data.php';
?>
</table>
<?php
submit_button();
?>
<table class="ppwp_settings_table" cellpadding="4">
<?php
include PPW_DIR_PATH . 'includes/views/general/view-ppw-notices-cache.php';
?>
</table>
</form>

View File

@@ -0,0 +1,32 @@
<?php
$ppw_post_types = ppw_core_get_post_type_for_hide_protect_content();
$link_description = sprintf( '<a target="_blank" rel="noopener" href="%s">Hide your password protected content</a>', 'https://passwordprotectwp.com/docs/how-to-hide-password-protected-wordpress-content/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free' );
// translators: %s: Link to documentation.
$link_description_rss = sprintf( '<a target="_blank" rel="noopener" href="%s">show protected content in RSS feeds</a>', 'https://passwordprotectwp.com/docs/display-protected-content-rss-feed/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free' );
$description = sprintf( esc_html__( '%s from selected views. Learn how to %s.', 'password-protect-page' ), $link_description, $link_description_rss );
?>
<tr>
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label><?php echo esc_html__( 'Protected Content Visibility', 'password-protect-page' ); ?></label>
<?php echo $description; // phpcs:ignore -- could not escape html ?>
<p>Switch post types to customize their own visibility. Only Pages & Posts are available on Free version.</p>
<select class="ppw_select_custom_post_type_edit" id="ppw_select_custom_post_type_edit">
<?php
foreach ( $ppw_post_types as $ppw_type ) {
$ppw_disabled = apply_filters( PPW_Constants::HOOK_CUSTOM_OPTION_HIDE_PROTECT_CONTENT, 'page_post' === $ppw_type['value'] ? '' : 'disabled', $ppw_type['value'] );
?>
<option <?php echo esc_attr( $ppw_disabled ); ?>
value="<?php echo esc_attr( $ppw_type['value'] ); ?>"><?php echo esc_attr( $ppw_type['label'] ); ?></option>
<?php
}
?>
</select>
</p>
</td>
</tr>
<?php
ppw_core_check_logic_before_render_ui( $ppw_post_types );
?>

View File

@@ -0,0 +1,14 @@
<tr>
<td colspan="2">
<hr>
</td>
</tr>
<tr>
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label><?php echo esc_html__( 'Caching Plugins & Server-side Caching', PPW_Constants::DOMAIN ); ?></label>
<?php _e( 'If youre using a caching plugin or server-side caching, youll need to <a rel="noopener noreferrer" target="_blank" href="https://passwordprotectwp.com/docs/caching-plugins-cache-servers-integration/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free">update your caching configurations</a> for our Password Protect Wordpress plugin to work properly.', PPW_Constants::DOMAIN ); ?>
</p>
</td>
</tr>

View File

@@ -0,0 +1,31 @@
<?php
$all_page_post = ppw_free_get_all_page_post();
?>
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label>
<?php echo esc_html__( 'Password Protect Private Pages', PPW_Constants::DOMAIN ) ?>
</label>
<?php echo _e( 'Set the same password to protect the following pages and posts. Available in Pro version.', PPW_Constants::DOMAIN ) ?>
</p>
</td>
</tr>
<tr class="ppwp-free-pages-posts-set-password ppwp-hidden-password ppwp_free_version">
<td></td>
<td><p><?php echo esc_html__( 'Select your private pages or posts', PPW_Constants::DOMAIN ) ?></p>
<select multiple="multiple" class="ppwp_select2">
<?php foreach ( $all_page_post as $page ): ?>
<option disabled="disabled"><?php echo esc_html( $page->post_title ) ?></option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr class="ppwp-free-pages-posts-set-password ppwp-hidden-password ppwp_free_version">
<td></td>
<td class="ppwp_wrap_set_new_password_for_pages_posts">
<p><?php echo esc_html__( 'Set a password', PPW_Constants::DOMAIN ) ?></p>
<input type="text" placeholder="Enter a password"/>
</td>
</tr>

View File

@@ -0,0 +1,22 @@
<?php
$remove_checked = ppw_core_get_setting_type_bool( PPW_Constants::REMOVE_DATA ) ? 'checked' : '';
$message = apply_filters( PPW_Constants::HOOK_CUSTOM_TEXT_FEATURE_REMOVE_DATA, array(
'label' => 'Remove Data Upon Uninstall',
'description' => 'Remove all your data created by Password Protect WordPress upon uninstall. You should <b>NOT</b> remove our Free when upgrading to our Pro version.'
) );
?>
<tr>
<td>
<label class="pda_switch" for="<?php echo esc_attr( PPW_Constants::REMOVE_DATA ); ?>">
<input type="checkbox"
id="<?php echo esc_attr( PPW_Constants::REMOVE_DATA ); ?>" <?php echo esc_attr( $remove_checked ); ?>/>
<span class="pda-slider round"></span>
</label>
</td>
<td>
<p>
<label><?php echo esc_html__( $message['label'], PPW_Constants::DOMAIN ) ?></label>
<?php echo _e( $message['description'], PPW_Constants::DOMAIN ) ?>
</p>
</td>
</tr>

View File

@@ -0,0 +1,12 @@
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label>
<?php echo esc_html__( 'Block Search Indexing', PPW_Constants::DOMAIN ); ?>
</label>
<?php echo _e( '<a target="_blank" rel="noopener noreferrer" href="https://passwordprotectwp.com/docs/settings/?utm_source=user-website&utm_medium=settings-general-tab&utm_campaign=ppwp-free#block-indexing">Prevent search engines from indexing</a> your password protected content. Available in Pro version.', PPW_Constants::DOMAIN ); ?>
</p>
</td>
</tr>

View File

@@ -0,0 +1,31 @@
<?php
$roles = get_editable_roles();
?>
<tr class="ppwp_free_version">
<td class="feature-input"><span class="feature-input"></span></td>
<td>
<p>
<label>
<?php echo esc_html__( 'Whitelisted Roles', PPW_Constants::DOMAIN ) ?>
</label>
<?php echo _e( 'Select user roles who can access all protected content without having to enter passwords.', PPW_Constants::DOMAIN ) ?>
</p>
<select id="wpp_free_whitelist_roles">
<option value="blank"><?php echo esc_html__( 'No one', PPW_Constants::DOMAIN ) ?></option>
<option disabled value="admin_users"><?php echo esc_html__( 'Admin users', PPW_Constants::DOMAIN ) ?></option>
<option disabled value="author"><?php echo esc_html__( 'The post\'s author', PPW_Constants::DOMAIN ) ?></option>
<option disabled value="logged_users"><?php echo esc_html__( 'Logged-in users', PPW_Constants::DOMAIN ) ?></option>
<option disabled value="custom_roles"><?php echo esc_html__( 'Choose custom roles', PPW_Constants::DOMAIN ) ?></option>
</select>
</td>
</tr>
<tr id="wpp_free_roles_access" class="wpp_hide_role_access ppwp_free_version">
<td></td>
<td><p><?php echo esc_html__( 'Grant access to these user roles only', PPW_Constants::DOMAIN ); ?></p>
<select multiple="multiple" class="wpp_roles_select ppwp_select2">
<?php foreach ( $roles as $role_name => $role_info ) { ?>
<option><?php echo esc_html( $role_name ); ?></option>
<?php } ?>
</select>
</td>
</tr>