PluginProbe
Passster – Password Protect Pages and Content / 4.3.16
Passster – Password Protect Pages and Content v4.3.16
4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 4.2.15 All 48 releases
← All changes | inc/class-ps-form.php +53 -52 4.2.104.3.16 View file →
@@ -1,52 +1,53 @@
1 -<?php
2 -
3 -namespace passster;
4 -
5 -class PS_Form {
6 - /**
7 - * Contains instance or null
8 - *
9 - * @var object|null
10 - */
11 - private static $instance = null;
12 -
13 - /**
14 - * Returns instance of PS_Form.
15 - *
16 - * @return object
17 - */
18 - public static function get_instance() {
19 - if ( null === self::$instance ) {
20 - self::$instance = new self();
21 - }
22 - return self::$instance;
23 - }
24 -
25 - /**
26 - * Get password form markup and replace placeholders
27 - *
28 - * @return string
29 - */
30 - public static function get_password_form() : string {
31 - $options = get_option( 'passster' );
32 - ob_start();
33 - include apply_filters( 'passster_password_form', PASSSTER_PATH . '/inc/templates/password-form.php' );
34 - $password_form = ob_get_contents();
35 - ob_end_clean();
36 - $password_form_placeholders = array(
37 - '[PASSSTER_AUTH]' => 'passster_password',
38 - '[PS_AJAX_LOADER]' => PASSSTER_URL . '/assets/public/ps-loader.svg',
39 - );
40 - $show_password = $options['show_password'];
41 - if ( $show_password ) {
42 - $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '<label for="passster-password-hint"><input name="passster-password-hint" id="passster-password-hint" type="checkbox" onclick="showPassword()"/> ' . esc_html__( 'Show Password', 'content-protector' ) . '</label>';
43 - } else {
44 - $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '';
45 - }
46 - foreach ( $password_form_placeholders as $placeholder => $string ) {
47 - $password_form = str_replace( $placeholder, $string, $password_form );
48 - }
49 - return $password_form;
50 - }
51 -
52 -}
1 +<?php
2 +
3 +namespace passster;
4 +
5 +class PS_Form {
6 + /**
7 + * Contains instance or null
8 + *
9 + * @var object|null
10 + */
11 + private static $instance = null;
12 +
13 + /**
14 + * Returns instance of PS_Form.
15 + *
16 + * @return object
17 + */
18 + public static function get_instance() {
19 + if ( null === self::$instance ) {
20 + self::$instance = new self();
21 + }
22 + return self::$instance;
23 + }
24 +
25 + /**
26 + * Get password form markup and replace placeholders
27 + *
28 + * @return string
29 + */
30 + public static function get_password_form() : string {
31 + $options = get_option( 'passster' );
32 + ob_start();
33 + include apply_filters( 'passster_password_form', PASSSTER_PATH . '/inc/templates/password-form.php' );
34 + $password_form = ob_get_contents();
35 + ob_end_clean();
36 + $password_form_placeholders = array(
37 + '[PASSSTER_AUTH]' => 'passster_password',
38 + '[PS_AJAX_LOADER]' => PASSSTER_URL . '/assets/public/ps-loader.svg',
39 + );
40 + $show_password = $options['show_password'] ?? false;
41 + $show_password_label = $options['show_password_label'] ?? __( 'Show Password', 'content-protector' );
42 + if ( $show_password ) {
43 + $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '<label for="passster-password-hint"><input name="passster-password-hint" id="passster-password-hint" type="checkbox" onclick="showPassword()"/> ' . esc_html( $show_password_label ) . '</label>';
44 + } else {
45 + $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '';
46 + }
47 + foreach ( $password_form_placeholders as $placeholder => $string ) {
48 + $password_form = str_replace( $placeholder, $string, $password_form );
49 + }
50 + return $password_form;
51 + }
52 +
53 +}