| @@ -13,9 +13,8 @@ | ||
| 13 | 13 | const QUERY_STRING_PARAM_NAME = 'render_mode'; |
| 14 | 14 | const QUERY_STRING_POST_ID = 'post_id'; |
| 15 | 15 | |
| 16 | 16 | const QUERY_STRING_TEMPLATE_ID = 'template_id'; |
| 17 | - | |
| 18 | 17 | const QUERY_STRING_NONCE_PARAM_NAME = 'render_mode_nonce'; |
| 19 | 18 | const NONCE_ACTION_PATTERN = 'render_mode_{post_id}'; |
| 20 | 19 | |
| 21 | 20 | /** |
| @@ -99,9 +98,8 @@ | ||
| 99 | 98 | $post_id = null; |
| 100 | 99 | $template_id = null; |
| 101 | 100 | $key = null; |
| 102 | 101 | $nonce = null; |
| 103 | - $kit_preview = null; | |
| 104 | 102 | |
| 105 | 103 | if ( isset( $_GET[ self::QUERY_STRING_POST_ID ] ) ) { |
| 106 | 104 | $post_id = $_GET[ self::QUERY_STRING_POST_ID ]; // phpcs:ignore -- Nonce will be checked next line. |
| 107 | 105 | } |
| @@ -125,9 +123,9 @@ | ||
| 125 | 123 | $key && |
| 126 | 124 | array_key_exists( $key, $this->render_modes ) |
| 127 | 125 | ) { |
| 128 | 126 | $this->set_current( new $this->render_modes[ $key ]( $post_id ) ); |
| 129 | - } elseif ( $this->is_template_preview_mode( $template_id, $key, $nonce ) ) { | |
| 127 | + } else if ( $this->is_preview_mode( $template_id, $key, $nonce ) ) { | |
| 130 | 128 | $this->set_current( new $this->render_modes[ $key ]( $template_id ) ); |
| 131 | 129 | } else { |
| 132 | 130 | $this->set_current( new Render_Mode_Normal( $post_id ) ); |
| 133 | 131 | } |
| @@ -134,9 +132,9 @@ | ||
| 134 | 132 | |
| 135 | 133 | return $this; |
| 136 | 134 | } |
| 137 | 135 | |
| 138 | - private function is_template_preview_mode( $template_id, $render_mode, $nonce ) { | |
| 136 | + private function is_preview_mode( $template_id, $render_mode, $nonce ) { | |
| 139 | 137 | if ( empty( $template_id ) ) { |
| 140 | 138 | return false; |
| 141 | 139 | } |
| 142 | 140 | |
| @@ -158,9 +156,9 @@ | ||
| 158 | 156 | /** |
| 159 | 157 | * Add actions base on the current render. |
| 160 | 158 | * |
| 161 | 159 | * @throws \Requests_Exception_HTTP_403 If the current render mode does not have the required permissions. |
| 162 | - * @throws \WpOrg\Requests\Exception\Http\Status403 If the current render mode does not have the required permissions. | |
| 160 | + * @throws Status403 If the current render mode does not have the required permissions. | |
| 163 | 161 | */ |
| 164 | 162 | private function add_current_actions() { |
| 165 | 163 | if ( ! $this->current->get_permissions_callback() ) { |
| 166 | 164 | // WP >= 6.2-alpha |