Skip to content

Commit

Permalink
add checks for ajax tidy & render args existence
Browse files Browse the repository at this point in the history
  • Loading branch information
godbone committed Nov 10, 2017
1 parent fc83103 commit f2d37c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dustpress.php
Expand Up @@ -980,8 +980,9 @@ public function create_ajax_instance() {
elseif ( isset( $_POST['dustpress_data'] ) ) {
$request_data = (object) $_POST['dustpress_data'];

$request_data->tidy = $request_data->tidy === 'true' ? true : false;
$request_data->render = $request_data->render === 'true' ? true : false;
// Parse old data to correct format and assume it to be false if it isn't defined
$request_data->tidy = ( isset( $request_data->tidy ) && $request_data->tidy === 'true' ) ? true : false;
$request_data->render = ( isset( $request_data->render ) && $request_data->render === 'true' ) ? true : false;
}
else {
die( json_encode( [ "error" => "Something went wrong. There was no dustpress_data present at the request." ] ) );
Expand Down

0 comments on commit f2d37c9

Please sign in to comment.