1 | <?php |
||
6 | class Jetpack_Frame_Nonce_Preview { |
||
7 | static $instance = null; |
||
|
|||
8 | |||
9 | /** |
||
10 | * Returns the single instance of the Jetpack_Frame_Nonce_Preview object |
||
11 | * |
||
12 | * @since 4.3.0 |
||
13 | * |
||
14 | * @return Jetpack_Frame_Nonce_Preview |
||
15 | **/ |
||
16 | public static function get_instance() { |
||
23 | |||
24 | function __construct() { |
||
35 | |||
36 | /** |
||
37 | * Verify that frame nonce exists, and if so, validate the nonce by calling WP.com. |
||
38 | * |
||
39 | * @since 4.3.0 |
||
40 | * |
||
41 | * @return bool |
||
42 | */ |
||
43 | public function is_frame_nonce_valid() { |
||
58 | |||
59 | /** |
||
60 | * Conditionally add a hook on posts_results if this is the main query, a preview, and singular. |
||
61 | * |
||
62 | * @since 4.3.0 |
||
63 | * |
||
64 | * @param WP_Query $query |
||
65 | * |
||
66 | * @return WP_Query |
||
67 | */ |
||
68 | public function maybe_display_post( $query ) { |
||
79 | |||
80 | /** |
||
81 | * Conditionally set the first post to 'publish' if the frame nonce is valid and there is a post. |
||
82 | * |
||
83 | * @since 4.3.0 |
||
84 | * |
||
85 | * @param array $posts |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function set_post_to_publish( $posts ) { |
||
104 | |||
105 | /** |
||
106 | * Handle validation for autosave preview request |
||
107 | * |
||
108 | * @since 4.7.0 |
||
109 | * |
||
110 | */ |
||
111 | public function handle_autosave_nonce_validation() { |
||
117 | } |
||
118 | |||
120 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.