/** * @param string $path * @return $this */ public function load($path = 'gantry-config://') { $gantry = $this->container; $styles = ThemeList::getStyles($gantry['theme.name']); $configurations = []; foreach ($styles as $style) { $preset = isset($style->params['preset']) ? $style->params['preset'] : null; $configuration = isset($style->params['configuration']) ? $style->params['configuration'] : $preset; if ($configuration && $configuration != $style->id) { // New style generated by Joomla. StyleHelper::copy($style, $configuration, $style->id); } $configurations[$style->id] = $style->style; } asort($configurations); $this->items = $this->addDefaults($configurations); return $this; }
public function updates() { $styles = ThemeList::getThemes(); $extension_ids = array_unique(array_map(function ($item) { return (int) $item->extension_id; }, $styles)); $extension_ids = $extension_ids ? implode(',', $extension_ids) : '-1'; $db = \JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('#__updates')->where("element='pkg_gantry5' OR extension_id IN ({$extension_ids})"); $db->setQuery($query); $updates = $db->loadObjectList(); $list = []; foreach ($updates as $update) { if ($update->element == 'pkg_gantry5') { // Rename Gantry 5 package. $update->name = 'Gantry'; // Ignore git and CI installs. if (version_compare(GANTRY5_VERSION, 0) < 0) { continue; } } else { // Check if templates need to be updated. $version = isset($styles[$update->element]) ? $styles[$update->element]->get('details.version') : null; if (version_compare($version, 0) < 0 || version_compare($update->version, $version) <= 0) { continue; } } $list[] = $update->name . ' ' . $update->version; } return $list; }
public function updates() { if (defined('GANTRY5_VERSION') && (GANTRY5_VERSION == '@version@' || substr(GANTRY5_VERSION, 0, 4) == 'dev-')) { return []; } $styles = ThemeList::getThemes(); $extension_ids = array_unique(array_map(function ($item) { return (int) $item->extension_id; }, $styles)); $extension_ids = $extension_ids ? implode(',', $extension_ids) : '-1'; $db = \JFactory::getDbo(); $query = $db->getQuery(true); $query->select('*')->from('#__updates')->where("element='pkg_gantry5' OR extension_id IN ({$extension_ids})"); $db->setQuery($query); $updates = $db->loadObjectList(); $list = []; foreach ($updates as $update) { // Remove number from Gantry 5. if ($update->element == 'pkg_gantry5') { $update->name = preg_replace('|[\\d\\s]|', '', $update->name); } $list[] = $update->name . ' ' . $update->version; } return $list; }