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() { |
||
57 | |||
58 | /** |
||
59 | * Conditionally add a hook on posts_results if this is the main query, a preview, and singular. |
||
60 | * |
||
61 | * @since 4.3.0 |
||
62 | * |
||
63 | * @param WP_Query $query |
||
64 | * |
||
65 | * @return WP_Query |
||
66 | */ |
||
67 | public function maybe_display_post( $query ) { |
||
78 | |||
79 | /** |
||
80 | * Conditionally set the first post to 'publish' if the frame nonce is valid and there is a post. |
||
81 | * |
||
82 | * @since 4.3.0 |
||
83 | * |
||
84 | * @param array $posts |
||
85 | * |
||
86 | * @return array |
||
87 | */ |
||
88 | public function set_post_to_publish( $posts ) { |
||
103 | |||
104 | /** |
||
105 | * Handle validation for autosave preview request |
||
106 | * |
||
107 | * @since 4.7.0 |
||
108 | */ |
||
109 | public function handle_autosave_nonce_validation() { |
||
115 | } |
||
116 | |||
118 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.
In this case you can add the
@ignore
PhpDoc annotation to the duplicate definition and it will be ignored.