update
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
/**
|
||||
* PPWP Countdown
|
||||
*/
|
||||
$text_above = get_theme_mod('ppwp_sitewide_above_countdown');
|
||||
$text_below = get_theme_mod('ppwp_sitewide_below_countdown');
|
||||
$start_date = get_theme_mod('ppwp_sitewide_start_time');
|
||||
$end_date = get_theme_mod('ppwp_sitewide_end_time');
|
||||
$is_date_countdown = get_theme_mod('ppwp_sitewide_is_show_day');
|
||||
$time_unit = get_theme_mod( 'ppwp_sitewide_time_unit_countdown', 'default');
|
||||
$day_of_countdown = strip_tags(get_theme_mod( 'ppwp_countdown_day_text', 'Days' ));
|
||||
$hour_of_countdown = strip_tags(get_theme_mod( 'ppwp_countdown_hour_text', 'Hours' ));
|
||||
$minute_of_countdown = strip_tags(get_theme_mod( 'ppwp_countdown_minute_text', 'Mimutes' ));
|
||||
$second_of_countdown = strip_tags(get_theme_mod( 'ppwp_countdown_second_text', 'Seconds' ));
|
||||
?>
|
||||
<div class="ppwp-countdown-container">
|
||||
<div id="ppwp_desc_above_countdown"><?php echo wp_kses_post( $text_above ); ?></div>
|
||||
<div id="ppwp_sitewide_countdown" class="ppwp-sitewide-countdown"></div>
|
||||
<div id="ppwp_desc_below_countdown"><?php echo wp_kses_post( $text_below ); ?></div>
|
||||
</div>
|
||||
<script>
|
||||
const getCountdown = () => {
|
||||
const datetime = new Date().toString();
|
||||
const utcTime = (function() {
|
||||
let utc = '';
|
||||
let operator = '';
|
||||
if (datetime.indexOf('+') >= 0) {
|
||||
utc = datetime.split('+');
|
||||
operator = '+';
|
||||
} else {
|
||||
utc = datetime.split('-');
|
||||
operator = '-';
|
||||
}
|
||||
const utcNumber = utc[1].split(' ')[0];
|
||||
const hour = Math.floor(parseInt(utcNumber)/100);
|
||||
const min = (parseInt(utcNumber)%(hour*100))/60*100;
|
||||
return parseFloat(hour + '.' + min) - parseFloat("<?php echo get_option('gmt_offset'); ?>");
|
||||
})();
|
||||
const time_unit = "<?php echo esc_attr( $time_unit ); ?>"
|
||||
const end_date = "<?php echo esc_attr( $end_date ); ?>";
|
||||
const countDownDate = new Date(end_date).getTime();
|
||||
const start_date = "<?php echo esc_attr( $start_date ); ?>";
|
||||
const countDownDateStart = new Date(start_date).getTime();
|
||||
var getNow = new Date().getTime() - utcTime*3600*1000;
|
||||
const isShowCountdown = "<?php echo esc_attr( $is_show_countdown ); ?>";
|
||||
const isShowDateCountdown = "<?php echo esc_attr( $is_date_countdown ); ?>";
|
||||
let checkvalue = false;
|
||||
if (getNow < countDownDateStart) {
|
||||
const x = setInterval(function() {
|
||||
if( getNow < countDownDateStart ) {
|
||||
getNow = new Date().getTime() - utcTime*3600*1000;
|
||||
} else {
|
||||
checkvalue = true;
|
||||
if ( end_date ) {
|
||||
getDay();
|
||||
}
|
||||
clearInterval(x);
|
||||
}
|
||||
}, 1000);
|
||||
} else {
|
||||
if ( end_date ) {
|
||||
getDay();
|
||||
}
|
||||
}
|
||||
|
||||
function getDay() {
|
||||
const x = setInterval(function() {
|
||||
const now = new Date().getTime() - utcTime*3600*1000;
|
||||
const distance = countDownDate - now;
|
||||
|
||||
const { hours, days, minutes, seconds } = (function(distance){
|
||||
const hours = Math.floor(distance % (1000 * 60 * 60 * 24) / (1000 * 60 * 60));
|
||||
const days = Math.floor(distance / (1000 * 60 * 60 *24));
|
||||
const minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
|
||||
const seconds = Math.floor((distance % (1000 * 60)) / 1000);
|
||||
|
||||
return { hours, days, minutes, seconds };
|
||||
})(distance);
|
||||
|
||||
if (isShowCountdown || isShowCountdown === '') {
|
||||
if (distance > 0) {
|
||||
if(days > 0) {
|
||||
document.getElementById("ppwp_sitewide_countdown").innerHTML = '<div class="ppwp_countdown_timer_day"><div class="ppwp_countdown_time">' + days + "</div><div class='ppwp_countdown_timer_unit'> <?php echo esc_attr( $day_of_countdown ); ?></div>" + '</div><div class="ppwp_coundown_colon_spacing">:</div><div class="ppwp_countdown_timer_hour"><div class="ppwp_countdown_time">' + hours + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $hour_of_countdown ); ?></div>"+ '</div><div class="ppwp_coundown_colon_spacing">:</div><div class="ppwp_countdown_timer_minute"><div class="ppwp_countdown_time">' + minutes + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $minute_of_countdown ); ?></div>"+ '</div><div class="ppwp_coundown_colon_spacing">:</div><div class="ppwp_countdown_timer_second"><div class="ppwp_countdown_time">' + seconds + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $second_of_countdown ); ?></div>" + '</div>';
|
||||
} else {
|
||||
const hours = Math.floor(distance / (1000 * 60 * 60));
|
||||
document.getElementById("ppwp_sitewide_countdown").innerHTML = '<div class="ppwp_countdown_timer_hour"><div class="ppwp_countdown_time">' + hours + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $hour_of_countdown ); ?></div>"+ '</div><div class="ppwp_coundown_colon_spacing">:</div><div class="ppwp_countdown_timer_minute"><div class="ppwp_countdown_time">' + minutes + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $minute_of_countdown ); ?></div>"+ '</div><div class="ppwp_coundown_colon_spacing">:</div><div class="ppwp_countdown_timer_second"><div class="ppwp_countdown_time">' + seconds + " </div><div class='ppwp_countdown_timer_unit'><?php echo esc_attr( $second_of_countdown ); ?></div>" + '</div>';
|
||||
}
|
||||
document.getElementById('ppwp_desc_above_countdown').style.display = 'block';
|
||||
document.getElementById('ppwp_desc_below_countdown').style.display = 'block';
|
||||
} else {
|
||||
clearInterval(x);
|
||||
document.getElementById('ppwp_sitewide_countdown').style.display = 'none';
|
||||
document.getElementById('ppwp_desc_above_countdown').style.display = 'none';
|
||||
document.getElementById('ppwp_desc_below_countdown').style.display = 'none';
|
||||
}
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
};
|
||||
getCountdown();
|
||||
</script>
|
||||
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* PPWP Protected Entire Site
|
||||
*/
|
||||
?>
|
||||
<form class="ppw_main_container" id="ppw_entire_site_form">
|
||||
<input type="hidden"
|
||||
value="<?php echo esc_attr( wp_create_nonce( PPW_Constants::ENTIRE_SITE_FORM_NONCE ) ); ?>"
|
||||
id="ppw_entire_site_form_nonce"/>
|
||||
<table class="ppwp_settings_table" cellpadding="4">
|
||||
<?php
|
||||
include PPW_DIR_PATH . 'includes/views/entire-site/view-ppw-set-password.php';
|
||||
include PPW_DIR_PATH . 'includes/views/entire-site/view-ppw-exclude-page.php';
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
submit_button();
|
||||
?>
|
||||
</form>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* PPWP Exclude Protected page
|
||||
*/
|
||||
|
||||
$all_page_post = ppw_free_get_all_page_post();
|
||||
?>
|
||||
<tr class="ppwp_free_version ppwp_logic_show_input_password <?php echo esc_attr( $is_display ); ?>">
|
||||
<td></td>
|
||||
<td class="ppwp_set_height_for_password_entire_site">
|
||||
<div class="ppwp_wrap_new_password">
|
||||
<span class="feature-input"></span>
|
||||
<span class="ppwp-set-new-password-text">
|
||||
Exclude certain pages, posts and custom post types from site-wide protection. Available in Pro version.
|
||||
</span>
|
||||
</div>
|
||||
<div class="ppwp_free_wrap_select_exclude_page ppwp-hidden-password">
|
||||
<select multiple="multiple" class="ppwp_select2">
|
||||
<option value="ppwp_home_page">Home Page</option>
|
||||
<?php foreach ( $all_page_post as $page ) { ?>
|
||||
<option><?php echo esc_html( $page->post_title ); ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
/**
|
||||
* PPWP Form Password
|
||||
*/
|
||||
|
||||
$page_title = ppw_get_page_title();
|
||||
$password_label = _x( 'Password:', PPW_Constants::CONTEXT_SITEWIDE_PASSWORD_FORM, 'password-protect-page' );
|
||||
$password_placehoder = wp_kses_post( get_theme_mod( 'ppwp_pro_form_instructions_placeholder' ) );
|
||||
$btn_label = get_theme_mod( 'ppwp_pro_form_button_label', PPW_Constants::DEFAULT_SHORTCODE_BUTTON );
|
||||
$disable_logo = get_theme_mod( 'ppwp_pro_logo_disable', 0 ) ? 'none' : 'block';
|
||||
$form_transparency = get_theme_mod( 'ppwp_pro_form_enable_transparency' ) ? 'style="background: none!important; box-shadow: initial;"' : '';
|
||||
$is_wrong_password = isset( $_GET['action'] ) && $_GET['action'] === 'ppw_postpass' && isset( $_POST['input_wp_protect_password'] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing, WordPress.Security.NonceVerification.Recommended -- We no need to handle nonce verification for render UI.
|
||||
$internal_css = '<link rel="stylesheet" href="' . PPW_VIEW_URL . 'dist/ppw-form-entire-site.css" type="text/css">' . PHP_EOL;
|
||||
$form_action = apply_filters( 'ppw_sitewide_form_action', '?action=ppw_postpass' );
|
||||
$err_msg = apply_filters( 'ppw_sitewide_error_message', esc_html__( 'Please enter the correct password!', 'password-protect-page' ) );
|
||||
$start_date = get_theme_mod( 'ppwp_sitewide_start_time' );
|
||||
$end_date = get_theme_mod( 'ppwp_sitewide_end_time' );
|
||||
$is_show_form = $end_date ? true : false;
|
||||
|
||||
?>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
|
||||
<meta name="description" content=""/>
|
||||
<meta name="viewport" content="width=device-width"/>
|
||||
<link rel="icon" href="<?php echo esc_attr( get_site_icon_url() ); ?>"/>
|
||||
<?php echo apply_filters( 'ppw_sitewide_external_css', $internal_css ); ?>
|
||||
<title><?php echo esc_attr( $page_title ); ?></title>
|
||||
<?php do_action( PPW_Constants::HOOK_CUSTOM_HEADER_FORM_ENTIRE_SITE ); ?>
|
||||
<style>
|
||||
<?php
|
||||
do_action( 'ppw_sitewide_custom_internal_css' );
|
||||
do_action( PPW_Constants::HOOK_CUSTOM_STYLE_FORM_ENTIRE_SITE );
|
||||
do_action( 'ppwp_sitewide_hide_password_form' );
|
||||
do_action( 'ppwp_countdown_timer_styles' );
|
||||
?>
|
||||
</style>
|
||||
<?php wp_custom_css_cb(); ?>
|
||||
</head>
|
||||
<body class="ppwp-sitewide-protection">
|
||||
<div class="pda-form-login ppw-swp-form-container">
|
||||
<h1>
|
||||
<a style="display: <?php echo esc_attr( $disable_logo ); ?>" title="<?php echo esc_attr__( 'This site is password protected by PPWP plugin', 'password-protect-page') ?>" class="ppw-swp-logo">Password Protect WordPress plugin</a>
|
||||
</h1>
|
||||
<?php
|
||||
do_action( 'ppw_sitewide_above_password_form_container' );
|
||||
?>
|
||||
<form <?php echo wp_kses_post( $form_transparency ); ?> class="ppw-swp-form" action="<?php echo esc_attr( $form_action ); ?>" method="post">
|
||||
<?php do_action( 'ppw_sitewide_above_password_form' ); ?>
|
||||
<label for="input_wp_protect_password"><?php echo esc_html( $password_label ); ?></label>
|
||||
<input class="input_wp_protect_password" type="password" id="input_wp_protect_password"
|
||||
name="input_wp_protect_password" placeholder="<?php echo esc_attr( $password_placehoder ); ?>"/>
|
||||
<?php
|
||||
if ( $is_wrong_password ) {
|
||||
?>
|
||||
<div id="ppw_entire_site_wrong_password" class="ppw-entire-site-password-error">
|
||||
<?php echo wp_kses_post( $err_msg ); ?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
do_action( 'ppw_sitewide_above_submit_button' );
|
||||
?>
|
||||
<input type="submit" class="button button-primary button-login" value="<?php echo esc_html( $btn_label ); ?>">
|
||||
<?php do_action( 'ppw_sitewide_below_password_form' ); ?>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
do_action('ppwp_render_sitewide_countdown');
|
||||
?>
|
||||
<?php do_action( PPW_Constants::HOOK_CUSTOM_FOOTER_FORM_ENTIRE_SITE ); ?>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* PPWP Set Password & Password Protect Entire Site
|
||||
*/
|
||||
$password_for_website = ppw_core_get_setting_entire_site_type_string( PPW_Constants::PASSWORD_ENTIRE_SITE );
|
||||
$is_protected = ppw_core_get_setting_entire_site_type_bool( PPW_Constants::IS_PROTECT_ENTIRE_SITE );
|
||||
$is_display = $is_protected ? '' : 'ppwp-hidden-password';
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php if ( $is_protected ) { ?>
|
||||
<label class="pda_switch" for="ppwp_apply_password_for_entire_site">
|
||||
<input type="checkbox" id="ppwp_apply_password_for_entire_site" checked/>
|
||||
<span class="pda-slider round"></span>
|
||||
</label>
|
||||
<?php } else { ?>
|
||||
<label class="pda_switch" for="ppwp_apply_password_for_entire_site">
|
||||
<input type="checkbox" id="ppwp_apply_password_for_entire_site"/>
|
||||
<span class="pda-slider round"></span>
|
||||
</label>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<td>
|
||||
<p>
|
||||
<label><?php echo esc_html__( 'Password Protect Entire Site', PPW_Constants::DOMAIN ) ?></label>
|
||||
<?php echo esc_html__( 'Set passwords to ', 'password-protect-page' ); ?>
|
||||
<a target="_blank" rel="noopener" href="https://passwordprotectwp.com/docs/password-protect-wordpress-lite/?utm_source=user-website&utm_medium=sitewide-protection-general&utm_campaign=ppwp-free#sitewide">
|
||||
<?php echo esc_html__( 'protect your entire WordPress site', 'password-protect-page' ); ?></a>.
|
||||
<?php echo sprintf('%1$s<a href="%2$s">%3$s</a>', esc_html__('Customize password login form using ', 'password-protect-page' ), admin_url( 'customize.php?autofocus[panel]=ppwp_sitewide' ), __( 'WordPress Customizer', 'password-protect-page' ) ) ?>
|
||||
</p>
|
||||
</td>
|
||||
</tr>
|
||||
<?php if ( ! empty( $password_for_website ) ) { ?>
|
||||
<tr class="ppwp_logic_show_input_password <?php echo esc_attr( $is_display ) ?>">
|
||||
<td></td>
|
||||
<td class="ppwp_set_height_for_password_entire_site">
|
||||
<p><?php esc_html_e( 'You’ve set a password to protect your site.', PPW_Constants::DOMAIN ); ?></p>
|
||||
<div class="ppwp_wrap_new_password_for_entire_site ppwp_wrap_new_password">
|
||||
<label class="pda_switch" for="ppwp_set_new_password_for_entire_site">
|
||||
<input type="checkbox" id="ppwp_set_new_password_for_entire_site"/>
|
||||
<span class="pda-slider round"></span>
|
||||
</label>
|
||||
<span class="ppwp-set-new-password-text">Set a new password</span>
|
||||
</div>
|
||||
<div class="ppwp_hidden_new_password_for_entire_site" id="ppwp_new_password_entire_site">
|
||||
<div class="ppwp_wrap_new_password">
|
||||
<label class="pda_switch"></label>
|
||||
<span class="ppwp-set-new-password-input">
|
||||
<input required type="text" autocomplete="off" placeholder="Enter new password"
|
||||
id="ppwp_password_for_entire_site" name="ppwp_password_for_entire_site">
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } else { ?>
|
||||
<tr class="ppwp_logic_show_input_password <?php echo esc_attr( $is_display ) ?>">
|
||||
<td></td>
|
||||
<td class="ppwp_text_after_enter_password_succes">
|
||||
<p><?php echo esc_html__( 'Set a password', PPW_Constants::DOMAIN ) ?></p>
|
||||
<input required type="text" autocomplete="off" placeholder="Enter a password"
|
||||
id="ppwp_password_for_entire_site" name="ppwp_password_for_entire_site">
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
Reference in New Issue
Block a user