PluginProbe
Passster – Password Protect Pages and Content / 3.5.4
Passster – Password Protect Pages and Content v3.5.4
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 4.2.16 All 47 releases
content-protector / src / class-ps-form.php

class-ps-form.php in Passster – Password Protect Pages and Content 3.5.4, at src/class-ps-form.php

88 lines 2.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace passster;
4
5 class PS_Form
6 {
7 /**
8 * Get instance of PS_Form
9 *
10 * @return void
11 */
12 public static function get_instance()
13 {
14 $form = new PS_Form();
15 return $form;
16 }
17
18 /**
19 * Get password form markup and replace placeholders
20 *
21 * @return string
22 */
23 public static function get_password_form()
24 {
25 ob_start();
26 include apply_filters( 'passster_password_form', PASSSTER_PATH . '/src/templates/password-form.php' );
27 $password_form = ob_get_contents();
28 ob_end_clean();
29 $password_form_placeholders = array(
30 '[PASSSTER_AUTH]' => 'passster_password',
31 '[PASSSTER_CURRENT_URL]' => \get_the_permalink(),
32 '[PS_AJAX_LOADER]' => PASSSTER_URL . '/assets/public/ps-loader.svg',
33 );
34 $show_password = get_theme_mod( 'passster_form_instructions_password_typing', false );
35
36 if ( $show_password ) {
37 $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '<label for="passster-password-hint"><input name="passster-password-hint" id="passster-password-hint" type="checkbox" onclick="showPassword()"/>' . __( 'Show Password', 'content-protector' ) . '</label>';
38 } else {
39 $password_form_placeholders['[PASSSTER_SHOW_PASSWORD]'] = '';
40 }
41
42 foreach ( $password_form_placeholders as $placeholder => $string ) {
43 $password_form = str_replace( $placeholder, $string, $password_form );
44 }
45 return $password_form;
46 }
47
48 /**
49 * Get captcha form markup and replace placeholders
50 *
51 * @return string
52 */
53 public static function get_captcha_form()
54 {
55 ob_start();
56 include apply_filters( 'passster_captcha_form', PASSSTER_PATH . '/src/templates/captcha-form.php' );
57 $captcha_form = ob_get_contents();
58 ob_end_clean();
59 $captcha_form_placeholders = array(
60 '[PASSSTER_AUTH]' => 'passster_captcha',
61 '[PASSSTER_CURRENT_URL]' => \get_the_permalink(),
62 '[PASSSTER_PLACEHOLDER]' => get_theme_mod( 'passster_form_instructions_placeholder', __( 'Enter the solution', 'content-protector' ) ),
63 );
64 foreach ( $captcha_form_placeholders as $placeholder => $string ) {
65 $captcha_form = str_replace( $placeholder, $string, $captcha_form );
66 }
67 return $captcha_form;
68 }
69
70 /**
71 * Get recaptcha form markup and replace placeholders
72 *
73 * @return string
74 */
75 public static function get_recaptcha_form()
76 {
77 }
78
79 /**
80 * Get recaptcha v2 form markup and replace placeholders
81 *
82 * @return string
83 */
84 public static function get_recaptcha_v2_form()
85 {
86 }
87
88 }