PluginProbe
HTML Forms – Simple WordPress Forms Plugin / 1.1.5
HTML Forms – Simple WordPress Forms Plugin v1.1.5
trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.2.0 1.3.0 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 All 66 releases
html-forms / src / TagReplacers.php

TagReplacers.php in HTML Forms – Simple WordPress Forms Plugin 1.1.5, at src/TagReplacers.php

48 lines 706 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace HTML_Forms;
4
5 use WP_Post;
6
7 class TagReplacers {
8
9 /**
10 * @param string $prop
11 * @return mixed
12 */
13 public function user( $prop ) {
14 if( ! is_user_logged_in() ) {
15 return '';
16 }
17
18 $user = wp_get_current_user();
19 return isset( $user->{$prop} ) ? $user->{$prop} : '';
20 }
21
22 /**
23 * @param string $prop
24 * @return mixed
25 */
26 public function post( $prop ) {
27 global $post;
28
29 if( ! $post instanceof WP_Post || ! isset( $post->{$prop} ) ) {
30 return '';
31 }
32
33 return $post->{$prop};
34 }
35
36 /**
37 * @param string $key
38 * @return mixed
39 */
40 public function url_params( $key ) {
41 if( ! isset( $_GET[ $key] ) ) {
42 return '';
43 }
44
45 return esc_attr( strip_tags( $_GET[$key] ) );
46 }
47 }
48