From c66cdff52268916bca067f73327d512b3671558e Mon Sep 17 00:00:00 2001
From: Marc Bernard <59966492+mbtools@users.noreply.github.com>
Date: Tue, 26 Dec 2023 14:11:23 -0500
Subject: [PATCH] PHP8.3 upport
---
code/admin/suffusion-options-page.php | 2 ++
code/admin/theme-options-layouts.php | 1 -
code/admin/theme-options-renderer.php | 4 ++--
code/featured-posts.php | 8 ++++----
code/functions.php | 2 +-
code/functions/admin.php | 2 +-
code/functions/magazine-functions.php | 6 +++---
code/magazine.php | 2 +-
code/suffusion-featured-posts.php | 10 +++++-----
code/theme-options-renderer.php | 4 ++--
code/widgets/suffusion-featured-posts.php | 10 +++++-----
code/widgets/suffusion-query-posts.php | 2 +-
12 files changed, 27 insertions(+), 26 deletions(-)
diff --git a/code/admin/suffusion-options-page.php b/code/admin/suffusion-options-page.php
index ae19ea9..0ffb13b 100644
--- a/code/admin/suffusion-options-page.php
+++ b/code/admin/suffusion-options-page.php
@@ -166,6 +166,8 @@ function suffusion_save_css_to_file($custom_css = array()) {
echo "
Failed to save file $filename. Please check your folder permissions.
";
}
}
+
+ return true;
}
/**
diff --git a/code/admin/theme-options-layouts.php b/code/admin/theme-options-layouts.php
index ea63d6a..09b75b4 100644
--- a/code/admin/theme-options-layouts.php
+++ b/code/admin/theme-options-layouts.php
@@ -1556,7 +1556,6 @@
"id" => "suf_tile_layout_bylines_post_date",
"grouping" => "tile-layout-bylines",
"parent" => "excerpt-settings",
- "grouping" => "layout-tiles",
"type" => "radio",
"options" => array("show" => "Show", "hide" => "Hide"),
"std" => "show"),
diff --git a/code/admin/theme-options-renderer.php b/code/admin/theme-options-renderer.php
index 6726a34..2a9475b 100644
--- a/code/admin/theme-options-renderer.php
+++ b/code/admin/theme-options-renderer.php
@@ -1444,7 +1444,7 @@ function get_options_html($option_structure = null) {
function initialize_settings($structure = null) {
$options = $this->options;
if (is_null($structure)) {
- $structure = $this->get_option_structure($options);
+ $structure = $this->get_option_structure();
}
foreach ($structure as $option_entity) {
@@ -1697,7 +1697,7 @@ function create_settings_section($section) {
* the user is migrating from 3.0.2 or lower.
*
* @param $options
- * @return void
+ * @return array
*/
function migrate_from_v302($options) {
global $suffusion_inbuilt_options;
diff --git a/code/featured-posts.php b/code/featured-posts.php
index 3d04248..f94cbae 100644
--- a/code/featured-posts.php
+++ b/code/featured-posts.php
@@ -83,7 +83,7 @@ function suffusion_display_featured_posts($echo = true) {
$featured_pages = suffusion_get_allowed_pages('suf_featured_selected_pages');
$count_so_far = 0;
if (is_array($stickies) && count($stickies) > 0 && $suf_featured_allow_sticky == "show") {
- $sticky_query = new WP_query(array('post__in' => $stickies));
+ $sticky_query = new WP_Query(array('post__in' => $stickies));
$count_so_far += $sticky_query->post_count;
}
@@ -94,7 +94,7 @@ function suffusion_display_featured_posts($echo = true) {
else {
$number_of_latest_posts = $suf_featured_num_latest_posts;
}
- $latest_query = new WP_query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
+ $latest_query = new WP_Query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
$count_so_far += $latest_query->post_count;
}
@@ -156,14 +156,14 @@ function suffusion_display_featured_posts($echo = true) {
foreach ($featured_pages as $featured_page) {
$query_pages[count($query_pages)] = $featured_page->ID;
}
- $page_query = new WP_query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $suf_featured_num_posts, 'ignore_sticky_posts' => 1, 'orderby' => 'menu_order', 'order' => 'ASC'));
+ $page_query = new WP_Query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $suf_featured_num_posts, 'ignore_sticky_posts' => 1, 'orderby' => 'menu_order', 'order' => 'ASC'));
$count_so_far += $page_query->post_count;
}
if (isset($suf_featured_selected_posts) && trim($suf_featured_selected_posts) != '' && $count_so_far < $suf_featured_num_posts) {
$trim_featured_posts = str_replace(' ', '', $suf_featured_selected_posts);
$query_posts = explode(',', $trim_featured_posts);
- $post_query = new WP_query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $suf_featured_num_posts, 'ignore_sticky_posts' => 1));
+ $post_query = new WP_Query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $suf_featured_num_posts, 'ignore_sticky_posts' => 1));
$count_so_far += $post_query->post_count;
}
diff --git a/code/functions.php b/code/functions.php
index 0954d8e..52f9632 100644
--- a/code/functions.php
+++ b/code/functions.php
@@ -827,7 +827,7 @@ function suffusion_flatten_option($option) {
/**
* Returns an indented array of pages, based on parent and child pages. This is used in the admin menus.
*
- * @return array
+ * @return array|null
*/
function suffusion_get_formatted_page_array() {
global $suffusion_pages_array;
diff --git a/code/functions/admin.php b/code/functions/admin.php
index 9babe16..e9d4793 100644
--- a/code/functions/admin.php
+++ b/code/functions/admin.php
@@ -568,7 +568,7 @@ function suffusion_admin_upload_file() {
$data = $_POST['data'];
$image_id = substr($data, 6);
if (isset($suffusion_options_renderer) && isset($suffusion_options_renderer->options)) {
- if (isset($suffusion_options_renderer->options[$image_id])) unset($this->options[$image_id]);
+ if (isset($suffusion_options_renderer->options[$image_id])) unset($suffusion_options_renderer->options[$image_id]);
}
}
die();
diff --git a/code/functions/magazine-functions.php b/code/functions/magazine-functions.php
index 26eacb9..950532b 100644
--- a/code/functions/magazine-functions.php
+++ b/code/functions/magazine-functions.php
@@ -44,7 +44,7 @@ function suffusion_get_headlines() {
$query_cats[] = $headline_category->cat_ID;
}
$query_posts = implode(",", array_values($query_cats));
- $cat_query = new WP_query(array('cat' => $query_posts, 'post__not_in' => $solos));
+ $cat_query = new WP_Query(array('cat' => $query_posts, 'post__not_in' => $solos));
}
if (isset($cat_query->posts) && is_array($cat_query->posts)) {
@@ -91,7 +91,7 @@ function suffusion_get_mag_section_queries($args = array()) {
}
}
if (count($solos) > 0) {
- $solo_query = new WP_query(array('post__in' => $solos, 'ignore_sticky_posts' => 1));
+ $solo_query = new WP_Query(array('post__in' => $solos, 'ignore_sticky_posts' => 1));
$queries[] = $solo_query;
}
@@ -104,7 +104,7 @@ function suffusion_get_mag_section_queries($args = array()) {
$query_cats[] = $category->cat_ID;
}
$query_posts = implode(",", array_values($query_cats));
- $cat_query = new WP_query(array('cat' => $query_posts, 'post__not_in' => $solos, 'posts_per_page' => (int)$suf_mag_total_excerpts));
+ $cat_query = new WP_Query(array('cat' => $query_posts, 'post__not_in' => $solos, 'posts_per_page' => (int)$suf_mag_total_excerpts));
$queries[] = $cat_query;
}
}
diff --git a/code/magazine.php b/code/magazine.php
index 420377a..6d9d3f8 100644
--- a/code/magazine.php
+++ b/code/magazine.php
@@ -232,7 +232,7 @@
$cat_args['orderby'] = 'order';
}
- $query = new WP_query($cat_args);
+ $query = new WP_Query($cat_args);
if (isset($query->posts) && is_array($query->posts) && count($query->posts) > 0) {
$ul_class = '';
$li_class = '';
diff --git a/code/suffusion-featured-posts.php b/code/suffusion-featured-posts.php
index d063982..f962d5c 100644
--- a/code/suffusion-featured-posts.php
+++ b/code/suffusion-featured-posts.php
@@ -532,24 +532,24 @@ function get_widget_featured_content($widget_id, $number_of_posts, $show_sticky,
$stickies = get_option('sticky_posts');
if (is_array($stickies) && count($stickies) > 0 && $show_sticky) {
- $sticky_query = new WP_query(array('post__in' => $stickies));
+ $sticky_query = new WP_Query(array('post__in' => $stickies));
}
if ($latest_posts) {
- $latest_query = new WP_query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
+ $latest_query = new WP_Query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
}
if ($featured_categories && trim($featured_categories) != '') {
- $cat_query = new WP_query(array('cat' => $featured_categories, 'post__not_in' => $stickies, 'posts_per_page' => $number_of_posts));
+ $cat_query = new WP_Query(array('cat' => $featured_categories, 'post__not_in' => $stickies, 'posts_per_page' => $number_of_posts));
}
if ($featured_posts && trim($featured_posts) != '') {
$query_posts = explode(',', $featured_posts);
if ($query_posts) {
- $post_query = new WP_query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
+ $post_query = new WP_Query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
}
}
if ($featured_pages && trim($featured_pages) != '') {
$query_pages = explode(',', $featured_pages);
if ($query_pages) {
- $page_query = new WP_query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
+ $page_query = new WP_Query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
}
}
diff --git a/code/theme-options-renderer.php b/code/theme-options-renderer.php
index 05f137e..d354a46 100644
--- a/code/theme-options-renderer.php
+++ b/code/theme-options-renderer.php
@@ -1444,7 +1444,7 @@ function get_options_html($option_structure = null) {
function initialize_settings($structure = null) {
$options = $this->options;
if (is_null($structure)) {
- $structure = $this->get_option_structure($options);
+ $structure = $this->get_option_structure();
}
foreach ($structure as $option_entity) {
@@ -1697,7 +1697,7 @@ function create_settings_section($section) {
* the user is migrating from 3.0.2 or lower.
*
* @param $options
- * @return void
+ * @return array
*/
function migrate_from_v302($options) {
global $suffusion_inbuilt_options;
diff --git a/code/widgets/suffusion-featured-posts.php b/code/widgets/suffusion-featured-posts.php
index 8db2876..41339fb 100644
--- a/code/widgets/suffusion-featured-posts.php
+++ b/code/widgets/suffusion-featured-posts.php
@@ -532,24 +532,24 @@ function get_widget_featured_content($widget_id, $number_of_posts, $show_sticky,
$stickies = get_option('sticky_posts');
if (is_array($stickies) && count($stickies) > 0 && $show_sticky) {
- $sticky_query = new WP_query(array('post__in' => $stickies));
+ $sticky_query = new WP_Query(array('post__in' => $stickies));
}
if ($latest_posts) {
- $latest_query = new WP_query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
+ $latest_query = new WP_Query(array('post__not_in' => $stickies, 'posts_per_page' => $number_of_latest_posts, 'order' => 'DESC', 'ignore_sticky_posts' => 1));
}
if ($featured_categories && trim($featured_categories) != '') {
- $cat_query = new WP_query(array('cat' => $featured_categories, 'post__not_in' => $stickies, 'posts_per_page' => $number_of_posts));
+ $cat_query = new WP_Query(array('cat' => $featured_categories, 'post__not_in' => $stickies, 'posts_per_page' => $number_of_posts));
}
if ($featured_posts && trim($featured_posts) != '') {
$query_posts = explode(',', $featured_posts);
if ($query_posts) {
- $post_query = new WP_query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
+ $post_query = new WP_Query(array('post_type' => 'post', 'post__in' => $query_posts, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
}
}
if ($featured_pages && trim($featured_pages) != '') {
$query_pages = explode(',', $featured_pages);
if ($query_pages) {
- $page_query = new WP_query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
+ $page_query = new WP_Query(array('post_type' => 'page', 'post__in' => $query_pages, 'posts_per_page' => $number_of_posts, 'ignore_sticky_posts' => 1));
}
}
diff --git a/code/widgets/suffusion-query-posts.php b/code/widgets/suffusion-query-posts.php
index 7750005..9da77ae 100644
--- a/code/widgets/suffusion-query-posts.php
+++ b/code/widgets/suffusion-query-posts.php
@@ -141,7 +141,7 @@ function widget($args, $instance) {
$query_args['post_type'] = 'any';
}
- $query = new WP_query($query_args);
+ $query = new WP_Query($query_args);
if (isset($query->posts) && is_array($query->posts) && count($query->posts) > 0 && !($separate_widgets && ($post_style == 'thumbnail-full' || $post_style == 'thumbnail-excerpt'))) {
if ($post_style == 'magazine') {