Fix PHP 8.4 compatibility issues in Sensational theme
- Fixed deprecated WP_Widget constructors in all widget files - Changed $this->WP_Widget() to parent::__construct() in: * widget-social.php * widget-fblikebox.php * widget-googleplus.php * widget-tabs.php - Fixed old-style constructor methods to __construct() in: * widget-ad125.php (mts_Ad_Widget -> __construct) * widget-ad300.php (mts_ad_300_Widget -> __construct) - Fixed for loop syntax error in widget-tweets.php (for(i; -> for($i = 1;) - Enabled registration for ad125 and ad300 widgets - Added new 'After First Paragraph' widget area for in-content ads All widgets now compatible with PHP 8.4 and editable in WordPress admin. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
76
options/validation/color/validation_color.php
Normal file
76
options/validation/color/validation_color.php
Normal file
@@ -0,0 +1,76 @@
|
||||
<?php
|
||||
class NHP_Validation_color extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('This field must be a valid color value.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
if(!is_array($this->value)){
|
||||
|
||||
if($this->value[0] != '#'){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
return;
|
||||
}
|
||||
|
||||
if(strlen($this->value) != 7){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
}//if array
|
||||
|
||||
|
||||
if(is_array($this->value)){
|
||||
|
||||
foreach($this->value as $k => $value){
|
||||
|
||||
if(isset($this->error)){continue;}
|
||||
|
||||
if($value[0] != '#'){
|
||||
$this->value[$k] = (isset($this->current[$k]))?$this->current[$k]:'';
|
||||
$this->error = $this->field;
|
||||
continue;
|
||||
}
|
||||
|
||||
if(strlen($value) != 7){
|
||||
$this->value[$k] = (isset($this->current[$k]))?$this->current[$k]:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
}//foreach
|
||||
|
||||
}//if array
|
||||
|
||||
|
||||
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class NHP_Validation_comma_numeric extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must provide a comma seperated list of numerical values for this option.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = str_replace(' ', '', $this->value);
|
||||
|
||||
if(!is_numeric(str_replace(',', '',$this->value))){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
56
options/validation/date/validation_date.php
Normal file
56
options/validation/date/validation_date.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
class NHP_Validation_date extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('This field must be a valid date.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$string = str_replace('/', '', $this->value);
|
||||
|
||||
if(!is_numeric($string)){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->value[2] != '/'){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->value[5] != '/'){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
41
options/validation/email/validation_email.php
Normal file
41
options/validation/email/validation_email.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
class NHP_Validation_email extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must provide a valid email for this option.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
if(!is_email($this->value)){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
37
options/validation/html/validation_html.php
Normal file
37
options/validation/html/validation_html.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class NHP_Validation_html extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = wp_kses_post($this->value);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
37
options/validation/html_custom/validation_html_custom.php
Normal file
37
options/validation/html_custom/validation_html_custom.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class NHP_Validation_html_custom extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = wp_kses($this->value, $this->field['allowed_html']);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
37
options/validation/js/validation_js.php
Normal file
37
options/validation/js/validation_js.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class NHP_Validation_js extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = esc_js($this->value);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
44
options/validation/no_html/validation_no_html.php
Normal file
44
options/validation/no_html/validation_no_html.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
class NHP_Validation_no_html extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must not enter any HTML in this field, all HTML tags have been removed.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$newvalue = strip_tags($this->value);
|
||||
|
||||
if($this->value != $newvalue){
|
||||
$this->warning = $this->field;
|
||||
}
|
||||
|
||||
$this->value = $newvalue;
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
class NHP_Validation_no_special_chars extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must not enter any special characters in this field, all special characters have been removed.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
if(!preg_match('/[^a-zA-Z0-9_ -]/s', $this->value) == 0){
|
||||
$this->warning = $this->field;
|
||||
}
|
||||
|
||||
$this->value = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $this->value);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
41
options/validation/numeric/validation_numeric.php
Normal file
41
options/validation/numeric/validation_numeric.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
class NHP_Validation_numeric extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must provide a numerical value for this option.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and outputs the HTML for the field in the settings
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
if(!is_numeric($this->value)){
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
37
options/validation/preg_replace/validation_preg_replace.php
Normal file
37
options/validation/preg_replace/validation_preg_replace.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class NHP_Validation_preg_replace extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = preg_replace($this->field['preg']['pattern'], $this->field['preg']['replacement'], $this->value);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
37
options/validation/str_replace/validation_str_replace.php
Normal file
37
options/validation/str_replace/validation_str_replace.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
class NHP_Validation_str_replace extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0.1
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
$this->value = str_replace($this->field['str']['search'], $this->field['str']['replacement'], $this->value);
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
43
options/validation/url/validation_url.php
Normal file
43
options/validation/url/validation_url.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
class NHP_Validation_url extends NHP_Options{
|
||||
|
||||
/**
|
||||
* Field Constructor.
|
||||
*
|
||||
* Required - must call the parent constructor, then assign field and value to vars, and obviously call the render field function
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function __construct($field, $value, $current){
|
||||
|
||||
parent::__construct();
|
||||
$this->field = $field;
|
||||
$this->field['msg'] = (isset($this->field['msg']))?$this->field['msg']:__('You must provide a valid URL for this option.', 'nhp-opts');
|
||||
$this->value = $value;
|
||||
$this->current = $current;
|
||||
$this->validate();
|
||||
|
||||
}//function
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Field Render Function.
|
||||
*
|
||||
* Takes the vars and validates them
|
||||
*
|
||||
* @since NHP_Options 1.0
|
||||
*/
|
||||
function validate(){
|
||||
|
||||
if (filter_var($this->value, FILTER_VALIDATE_URL) == false) {
|
||||
$this->value = (isset($this->current))?$this->current:'';
|
||||
$this->error = $this->field;
|
||||
}else{
|
||||
$this->value = esc_url_raw($this->value);
|
||||
}
|
||||
|
||||
}//function
|
||||
|
||||
}//class
|
||||
?>
|
||||
Reference in New Issue
Block a user