Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@
"patches/berlindb-core-src-database-column-php.patch"
],
"jasny/sso": [
"patches/jasny-sso-src-broker-cookies-php.patch"
"patches/jasny-sso-src-broker-cookies-php.patch",
"patches/jasny-sso-php8-compatibility.patch"
]
},
"installer-paths": {
Expand Down
5 changes: 3 additions & 2 deletions inc/ui/class-account-summary-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,10 @@ public function setup_preview(): void {
*/
public function output($atts, $content = null) {

// Defensive check - setup() may have been called but site can still be null
$this->ensure_setup();

// Return empty if no site available (e.g., during SEO processing)
if ( ! $this->site) {
_doing_it_wrong(__METHOD__, esc_html__('setup() or setup_preview() must be called before output().', 'multisite-ultimate'), wu_get_version());
return '';
}

Expand Down
13 changes: 13 additions & 0 deletions inc/ui/class-base-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,19 @@ public function setup() {}
*/
public function setup_preview() {}

/**
* Ensures setup is called before output to prevent errors.
*
* @since 2.4.3
* @return void
*/
protected function ensure_setup() {
if (!$this->loaded) {
$this->is_preview() ? $this->setup_preview() : $this->setup();
$this->loaded = true;
}
}

/**
* Checks content to see if the current element is present.
*
Expand Down
5 changes: 3 additions & 2 deletions inc/ui/class-billing-info-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,10 @@ public function setup_preview(): void {
*/
public function output($atts, $content = null) {

// Defensive check - setup() may have been called but membership can still be null
$this->ensure_setup();

// Return empty if no membership available (e.g., during SEO processing)
if ( ! $this->membership) {
_doing_it_wrong(__METHOD__, esc_html__('setup() or setup_preview() must be called before output().', 'multisite-ultimate'), wu_get_version());
return '';
}

Expand Down
13 changes: 7 additions & 6 deletions inc/ui/class-current-site-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,10 @@ public function register_scripts(): void {
*/
public function output($atts, $content = null) {

// Defensive check - setup() may have been called but site can still be null
$this->ensure_setup();

// Return empty if no site available (e.g., during SEO processing)
if ( ! $this->site) {
_doing_it_wrong(__METHOD__, esc_html__('setup() or setup_preview() must be called before output().', 'multisite-ultimate'), wu_get_version());
return '';
}

Expand All @@ -363,22 +364,22 @@ public function output($atts, $content = null) {
'label' => __('Visit Site', 'multisite-ultimate'),
'icon_classes' => 'dashicons-wu-browser wu-align-text-bottom',
'classes' => '',
'href' => $this->site->get_active_site_url(),
'href' => $this->site ? $this->site->get_active_site_url() : '',
],
'edit_site' => [
'label' => __('Edit Site', 'multisite-ultimate'),
'icon_classes' => 'dashicons-wu-edit wu-align-text-bottom',
'classes' => 'wubox',
'href' => wu_get_form_url(
'href' => $this->site ? wu_get_form_url(
'edit_site',
[
'site' => $this->site->get_hash(),
]
),
) : '',
],
];

if ($atts['show_admin_link']) {
if ($atts['show_admin_link'] && $this->site) {
$actions['site_admin'] = [
'label' => __('Admin Panel', 'multisite-ultimate'),
'icon_classes' => 'dashicons-wu-grid wu-align-text-bottom',
Expand Down
5 changes: 3 additions & 2 deletions inc/ui/class-invoices-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,10 @@ public function setup_preview(): void {
*/
public function output($atts, $content = null) {

// Defensive check - setup() may have been called but membership can still be null
$this->ensure_setup();

// Return empty if no membership available (e.g., during SEO processing)
if ( ! $this->membership) {
_doing_it_wrong(__METHOD__, esc_html__('setup() or setup_preview() must be called before output().', 'multisite-ultimate'), wu_get_version());
return '';
}

Expand Down
5 changes: 3 additions & 2 deletions inc/ui/class-limits-element.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,9 +240,10 @@ public function setup_preview(): void {
*/
public function output($atts, $content = null) {

// Defensive check - setup() may have been called but site can still be null
$this->ensure_setup();

// Return empty if no site available (e.g., during SEO processing)
if ( ! $this->site) {
_doing_it_wrong(__METHOD__, esc_html__('setup() or setup_preview() must be called before output().', 'multisite-ultimate'), wu_get_version());
return '';
}

Expand Down
26 changes: 26 additions & 0 deletions patches/jasny-sso-php8-compatibility.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--- a/src/Broker/Cookies.php
+++ b/src/Broker/Cookies.php
@@ -43,6 +43,7 @@ class Cookies implements \ArrayAccess
/**
* @inheritDoc
*/
+ #[\ReturnTypeWillChange]
public function offsetSet($name, $value)
{
$success = setcookie($name, $value, time() + $this->ttl, $this->path, $this->domain, $this->secure, true);
@@ -66,6 +67,7 @@ class Cookies implements \ArrayAccess
/**
* @inheritDoc
*/
+ #[\ReturnTypeWillChange]
public function offsetGet($name)
{
return $_COOKIE[$name] ?? null;
@@ -74,6 +76,7 @@ class Cookies implements \ArrayAccess
/**
* @inheritDoc
*/
+ #[\ReturnTypeWillChange]
public function offsetExists($name)
{
return isset($_COOKIE[$name]);
Loading