do not use global variable

This commit is contained in:
Jean-Christian Denis 2022-12-10 22:25:03 +01:00
parent 098c5338e3
commit cfa4bf8119
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
2 changed files with 4 additions and 3 deletions

View file

@ -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');
}

View file

@ -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 {