options = $options; $visibleLists = $this->config->get($options['baseOption'].'_lists'); if (empty($visibleLists)) return false; $visibleLists = explode(',', $visibleLists); acym_arrayToInteger($visibleLists); $listsClass = new ListClass(); $allLists = $listsClass->getAllWithoutManagement(true); $isAdmin = acym_isAdmin(); foreach ($visibleLists as $i => $oneListId) { if (in_array($oneListId, array_keys($allLists)) && $allLists[$oneListId]->active && ($allLists[$oneListId]->visible || $isAdmin)) continue; unset($visibleLists[$i]); } if (empty($visibleLists)) return false; $checkedLists = explode(',', $this->config->get($options['baseOption'].'_checkedlists')); acym_arrayToInteger($checkedLists); $userClass = new UserClass(); if ('wordpress' === ACYM_CMS) { $currentCMSId = acym_getVar('int', 'user_id', 0); if (empty($currentCMSId)) $currentCMSId = acym_currentUserId(); } else { if (acym_isAdmin()) { $currentCMSId = acym_getVar('int', 'id', 0); } else { $currentCMSId = acym_currentUserId(); } } if (!empty($currentCMSId)) { $currentUser = $userClass->getOneByCMSId($currentCMSId); if (!empty($currentUser)) { $checkedLists = []; $currentSubscription = $userClass->getSubscriptionStatus($currentUser->id, $visibleLists); acym_trigger('onRegacyPrepareCheckedLists', [&$currentSubscription]); foreach ($currentSubscription as $listId => $oneSubsciption) { if ($oneSubsciption->status == '1') $checkedLists[] = $listId; } } } $autolist = explode(',', $this->config->get($options['baseOption'].'_autolists')); acym_arrayToInteger($autolist); if (!empty($autolist)) { $visibleLists = array_diff($visibleLists, $autolist); } $this->label = $this->config->get($options['baseOption'].'_text'); if (empty($this->label)) $this->label = 'ACYM_SUBSCRIPTION'; $this->label = acym_translation($this->label); $this->lists = []; foreach ($visibleLists as $oneListId) { $this->lists[$oneListId] = [ 'name' => !empty($allLists[$oneListId]->display_name) ? $allLists[$oneListId]->display_name : $allLists[$oneListId]->name, 'checked' => in_array($oneListId, $checkedLists), ]; } if ('joomla' === ACYM_CMS || !empty($options['formatted'])) { $this->formatResults(); } return true; } private function formatResults(): void { $base = $this->options['baseOption']; $checkedListsOnAjaxUpdate = acym_getVar('array', $base.'_visible_lists_checked', []); $result = '