Skip to content

Commit

Permalink
tag v6.6 fix error in sanitization function which was failing in some…
Browse files Browse the repository at this point in the history
… cases
  • Loading branch information
Lwangaman authored and Lwangaman committed Jun 9, 2020
1 parent e7736b5 commit fc91dac
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 17 deletions.
4 changes: 2 additions & 2 deletions bibleget-io.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
* Plugin Name: BibleGet I/O
* Version: 6.5
* Version: 6.6
* Plugin URI: https://www.bibleget.io/
* Description: Easily insert Bible quotes from a choice of Bible versions into your articles or pages with the "Bible quote" block or with the shortcode [bibleget].
* Author: John Romano D'Orazio
Expand All @@ -28,7 +28,7 @@
*/


define("BIBLEGETPLUGINVERSION", "v6_5");
define("BIBLEGETPLUGINVERSION", "v6_6");

if (!defined('ABSPATH')) {
header('Status: 403 Forbidden');
Expand Down
35 changes: 20 additions & 15 deletions options.php
Original file line number Diff line number Diff line change
Expand Up @@ -1580,15 +1580,20 @@ public static function sanitize_boolean($input){
}

public static function sanitize_array($input){
if(!is_array($input) && strpos(",",$input)){
$input = explode(",",$input);
if(!is_array($input)){
if(strpos(",",$input)){
$input = explode(",",$input);
}
else{
$input = [$input];
}
}
$newArr = [];
foreach($input as $key => $value){
$value = wp_filter_nohtml_kses($value);
$newArray[$key] = $value;
}
return $newArray;
foreach($input as $key => $value){
$value = wp_filter_nohtml_kses($value);
$newArr[$key] = $value;
}
return $newArr;
}

public static function sanitize_float( $input ) {
Expand Down Expand Up @@ -2071,7 +2076,7 @@ public function __construct(){
"type" => "integer"
],
"PARAGRAPHSTYLES_BORDERCOLOR" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"PARAGRAPHSTYLES_BORDERCOLOR") ? $this->BGETOPTIONS["PARAGRAPHSTYLES_BORDERCOLOR"] : "#00AA00",
"default" => self::setAndNotNothing($this->BGETOPTIONS,"PARAGRAPHSTYLES_BORDERCOLOR") ? $this->BGETOPTIONS["PARAGRAPHSTYLES_BORDERCOLOR"] : "#0000FF",
"type" => "string"
],
"PARAGRAPHSTYLES_BORDERSTYLE" => [
Expand All @@ -2083,7 +2088,7 @@ public function __construct(){
"type" => "integer"
],
"PARAGRAPHSTYLES_BACKGROUNDCOLOR" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"PARAGRAPHSTYLES_BACKGROUNDCOLOR") ? $this->BGETOPTIONS["PARAGRAPHSTYLES_BACKGROUNDCOLOR"] : '#efe9d5', //unit: px
"default" => self::setAndNotNothing($this->BGETOPTIONS,"PARAGRAPHSTYLES_BACKGROUNDCOLOR") ? $this->BGETOPTIONS["PARAGRAPHSTYLES_BACKGROUNDCOLOR"] : '#efece9',
"type" => "string"
],
"VERSIONSTYLES_BOLD" => [
Expand All @@ -2107,11 +2112,11 @@ public function __construct(){
"type" => "string"
],
"VERSIONSTYLES_FONTSIZE" => [
"default" => self::setAndIsNumber($this->BGETOPTIONS,"VERSIONSTYLES_FONTSIZE") ? intval($this->BGETOPTIONS["VERSIONSTYLES_FONTSIZE"]) : 10,
"default" => self::setAndIsNumber($this->BGETOPTIONS,"VERSIONSTYLES_FONTSIZE") ? intval($this->BGETOPTIONS["VERSIONSTYLES_FONTSIZE"]) : 9,
"type" => "integer"
],
"VERSIONSTYLES_FONTSIZEUNIT" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSIONSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSIONSTYLES_FONTSIZEUNIT"] : 'px',
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSIONSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSIONSTYLES_FONTSIZEUNIT"] : 'em',
"type" => "string"
],
"VERSIONSTYLES_VALIGN" => [
Expand Down Expand Up @@ -2143,7 +2148,7 @@ public function __construct(){
"type" => "integer"
],
"BOOKCHAPTERSTYLES_FONTSIZEUNIT" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"BOOKCHAPTERSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["BOOKCHAPTERSTYLES_FONTSIZEUNIT"] : 'px',
"default" => self::setAndNotNothing($this->BGETOPTIONS,"BOOKCHAPTERSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["BOOKCHAPTERSTYLES_FONTSIZEUNIT"] : 'em',
"type" => "string"
],
"BOOKCHAPTERSTYLES_VALIGN" => [
Expand Down Expand Up @@ -2171,11 +2176,11 @@ public function __construct(){
"type" => "string"
],
"VERSENUMBERSTYLES_FONTSIZE" => [
"default" => self::setAndIsNumber($this->BGETOPTIONS,"VERSENUMBERSTYLES_FONTSIZE") ? intval($this->BGETOPTIONS["VERSENUMBERSTYLES_FONTSIZE"]) : 10,
"default" => self::setAndIsNumber($this->BGETOPTIONS,"VERSENUMBERSTYLES_FONTSIZE") ? intval($this->BGETOPTIONS["VERSENUMBERSTYLES_FONTSIZE"]) : 6,
"type" => "integer"
],
"VERSENUMBERSTYLES_FONTSIZEUNIT" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSENUMBERSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSENUMBERSTYLES_FONTSIZEUNIT"] : 'px',
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSENUMBERSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSENUMBERSTYLES_FONTSIZEUNIT"] : 'em',
"type" => "string"
],
"VERSENUMBERSTYLES_VALIGN" => [
Expand Down Expand Up @@ -2207,7 +2212,7 @@ public function __construct(){
"type" => "integer"
],
"VERSETEXTSTYLES_FONTSIZEUNIT" => [
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSETEXTSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSETEXTSTYLES_FONTSIZEUNIT"] : 'px',
"default" => self::setAndNotNothing($this->BGETOPTIONS,"VERSETEXTSTYLES_FONTSIZEUNIT") ? $this->BGETOPTIONS["VERSETEXTSTYLES_FONTSIZEUNIT"] : 'em',
"type" => "string"
],
"VERSETEXTSTYLES_VALIGN" => [
Expand Down
6 changes: 6 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ There was recently an update to the BibleGet service endpoint which slightly cha

== Changelog ==

= 6.6 =
* Fix sanitization function which was failing in some cases

= 6.5 =
* Fix error message : Illegal string offset 'PARAGRAPHSTYLES_FONTFAMILY' in options.php
* Fix typo in PHP get_option function
Expand Down Expand Up @@ -312,6 +315,9 @@ There was recently an update to the BibleGet service endpoint which slightly cha

== Upgrade Notice ==

= 6.6 =
Versions prior to 5.9 must be updated to maintain compatibility with the BibleGet endpoint

= 6.5 =
Versions prior to 5.9 must be updated to maintain compatibility with the BibleGet endpoint

Expand Down

0 comments on commit fc91dac

Please sign in to comment.