From cfa4bf811942ec593141f413768c01e0819e9f0e Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 10 Dec 2022 22:25:03 +0100 Subject: [PATCH] do not use global variable --- inc/class.zcfspublicbehaviors.php | 2 +- inc/class.zcfsrsextposts.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/class.zcfspublicbehaviors.php b/inc/class.zcfspublicbehaviors.php index a9f11ec..0a4bf10 100644 --- a/inc/class.zcfspublicbehaviors.php +++ b/inc/class.zcfspublicbehaviors.php @@ -28,7 +28,7 @@ class zcfsPublicBehaviors */ public static function coreBlogGetPosts(dcRecord $rs) { - $GLOBALS['beforeZcFeedRsExt'] = $rs->extensions(); + dcCore::app()->__set('beforeZcFeedRsExt', $rs->extensions()); $rs->extend('zcfsRsExtPosts'); } diff --git a/inc/class.zcfsrsextposts.php b/inc/class.zcfsrsextposts.php index 877541a..894952a 100644 --- a/inc/class.zcfsrsextposts.php +++ b/inc/class.zcfsrsextposts.php @@ -53,8 +53,9 @@ class zcfsRsExtPosts extends rsExtPost */ public static function zcFeedBrother($type, $args) { - if (!empty($GLOBALS['beforeZcFeedRsExt'][$type])) { - $func = $GLOBALS['beforeZcFeedRsExt'][$type]; + $ext = dcCore::app()->__get('beforeZcFeedRsExt'); + if (null !== $ext && !empty($ext[$type])) { + $func = $ext[$type]; } elseif (is_callable('rsExtPostPublic', $type)) { $func = ['rsExtPostPublic', $type]; } else {