Skip to content

Commit

Permalink
fix #5
Browse files Browse the repository at this point in the history
  • Loading branch information
samiahmedsiddiqui committed Aug 19, 2022
1 parent 7135d9e commit 6378c20
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 15 deletions.
8 changes: 4 additions & 4 deletions admin/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
/**
* Silence is golden
*/
<?php
/**
* Silence is golden
*/
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,11 @@
"phpcs-errors-summary": "@check-cs-summary -n",
"phpcbf": "phpcbf"
},
"prefer-stable": true
"prefer-stable": true,
"config": {
"allow-plugins": {
"composer/installers": true,
"dealerdirect/phpcodesniffer-composer-installer": true
}
}
}
16 changes: 14 additions & 2 deletions includes/class-prevent-xss-vulnerability-frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ public function prevent_reflected_xss() {
'prevent_xss_vulnerability_reflected_settings'
);

if ( ! $reflected_xss ) {
return;
}

if ( is_string( $reflected_xss ) ) {
$reflected_xss = maybe_unserialize( $reflected_xss );
}
Expand Down Expand Up @@ -304,11 +308,15 @@ public function escape_html() {
'prevent_xss_vulnerability_reflected_settings'
);

if ( ! $reflected_xss ) {
return;
}

if ( is_string( $reflected_xss ) ) {
$reflected_xss = maybe_unserialize( $reflected_xss );
}

if ( isset( $reflected_xss ) && isset( $reflected_xss['escape_html'] )
if ( isset( $reflected_xss, $reflected_xss['escape_html'] )
&& 1 === $reflected_xss['escape_html']
) {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
Expand Down Expand Up @@ -339,11 +347,15 @@ public function escape_html() {
public function self_xss_script() {
$self_xss = get_option( 'prevent_xss_vulnerability_self_xss_settings' );

if ( ! $self_xss ) {
return;
}

if ( is_string( $self_xss ) ) {
$self_xss = maybe_unserialize( $self_xss );
}

if ( isset( $self_xss ) && isset( $self_xss['user_warning'] )
if ( isset( $self_xss, $self_xss['user_warning'] )
&& 1 === $self_xss['user_warning']
) {
$message = '';
Expand Down
8 changes: 4 additions & 4 deletions includes/index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
/**
* Silence is golden
*/
<?php
/**
* Silence is golden
*/
8 changes: 4 additions & 4 deletions index.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
/**
* Silence is golden
*/
<?php
/**
* Silence is golden
*/

0 comments on commit 6378c20

Please sign in to comment.