Skip to content

Commit

Permalink
PHP8.3 upport
Browse files Browse the repository at this point in the history
  • Loading branch information
mbtools committed Dec 26, 2023
1 parent a0adaad commit c66cdff
Show file tree
Hide file tree
Showing 12 changed files with 27 additions and 26 deletions.
2 changes: 2 additions & 0 deletions code/admin/suffusion-options-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ function suffusion_save_css_to_file($custom_css = array()) {
echo "<div class='error'><p>Failed to save file $filename. Please check your folder permissions.</p></div>";
}
}

return true;
}

/**
Expand Down
1 change: 0 additions & 1 deletion code/admin/theme-options-layouts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
4 changes: 2 additions & 2 deletions code/admin/theme-options-renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions code/featured-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion code/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion code/functions/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions code/functions/magazine-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion code/magazine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand Down
10 changes: 5 additions & 5 deletions code/suffusion-featured-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
4 changes: 2 additions & 2 deletions code/theme-options-renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions code/widgets/suffusion-featured-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down
2 changes: 1 addition & 1 deletion code/widgets/suffusion-query-posts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down

0 comments on commit c66cdff

Please sign in to comment.