Skip to content

Commit

Permalink
Merge branch 'release/5.5.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
mahagr committed Apr 29, 2022
2 parents 9bba2c8 + 2e13040 commit ac05488
Show file tree
Hide file tree
Showing 86 changed files with 552 additions and 315 deletions.
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
# 5.5.13
## mm/dd/2022
## 04/29/2022

1. [Common](#common)
1. [](#new)
- Nothing yet!
1. [](#bugfix)
- Fixed fatal error if menu item child cannot be accessed from the menu (#3025)
- Fixed missing translation for Prev/Next in Content Array particle (#3023)
2. [Joomla](#joomla)
1. [](#bugfix)
- Fixed broken Fontawesome version override (#2969)
3. [WordPress](#wordpress)
1. [](#improved)
- Improved Helium and Hydrogen themes
- Added `textdomain` variable to theme context
2. [](#bugfix)
- Fixed incorrect language code (#3029)
- Fixed loading default language file for nucleus
- Fixed CSS not to include schema and domain name

# 5.5.12
## 03/29/2022
Expand Down
6 changes: 3 additions & 3 deletions bin/language-convert
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,11 @@ $parameters = array(
);
$options = getopt(implode('', array_keys($parameters)), $parameters);

$input_file = $options['input'];
$output_file = $options['output'];
$input_file = isset($options['input']) ? $options['input'] : null;
$output_file = isset($options['output']) ? $options['output'] : null;
$compile = isset($options['compile']);

if (!file_exists($input_file) || !is_file($input_file)) {
if (!is_file($input_file)) {
echo sprintf("No file %s exists\n", $input_file);
die;
}
Expand Down
2 changes: 1 addition & 1 deletion engines/common/nucleus/templates/page_head.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{%- do gantry.theme.loadAtoms() -%}

{% set faEnabled = gantry.config.page.fontawesome.enable|default(1) %}
{% set faVersion = gantry.config.page.fontawesome.version|default('fa4') %}
{% set faVersion = gantry.config.page.fontawesome.version ?? gantry.config.page.fontawesome.default_version ?? 'fa4' %}
{% assets with { priority: 10 } %}
{% block head_stylesheets -%}
<link rel="stylesheet" href="gantry-engine://css-compiled/nucleus.css" type="text/css"/>
Expand Down
4 changes: 2 additions & 2 deletions engines/grav/nucleus/particles/contentarray.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@

{% if total > limit.total and display.pagination_buttons %}
<div class="g-content-array-pagination">
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>Prev</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>Next</button>
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>{{ 'GANTRY5_ENGINE_PREV'|trans }}</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>{{ 'GANTRY5_ENGINE_NEXT'|trans }}</button>
<div class="clearfix"></div>
</div>
{% endif %}
Expand Down
4 changes: 2 additions & 2 deletions engines/joomla/nucleus/particles/contentarray.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@

{% if total > limit.total and display.pagination_buttons %}
<div class="g-content-array-pagination">
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>Prev</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>Next</button>
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>{{ 'GANTRY5_ENGINE_PREV'|trans }}</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>{{ 'GANTRY5_ENGINE_NEXT'|trans }}</button>
<div class="clearfix"></div>
</div>
{% endif %}
Expand Down
Binary file modified engines/wordpress/nucleus/languages/nucleus-en_US.mo
Binary file not shown.
6 changes: 6 additions & 0 deletions engines/wordpress/nucleus/languages/nucleus-en_US.po
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,9 @@ msgstr "yrs"

msgid "GANTRY5_ENGINE_NICETIME_DEC_PLURAL"
msgstr "decs"

msgid "GANTRY5_ENGINE_PREV"
msgstr "Prev"

msgid "GANTRY5_ENGINE_NEXT"
msgstr "Next"
4 changes: 2 additions & 2 deletions engines/wordpress/nucleus/particles/contentarray.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@

{% if total > limit.total and display.pagination_buttons %}
<div class="g-content-array-pagination">
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>Prev</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>Next</button>
<button class="button float-left contentarray-button pagination-button pagination-button-prev" data-id="{{ id }}" data-start="{{ max(0, start - limit.total) }}"{{ start - limit.total < 0 ? ' disabled' }}>{{ 'GANTRY5_ENGINE_PREV'|trans }}</button>
<button class="button float-right contentarray-button pagination-button pagination-button-next" data-id="{{ id }}" data-start="{{ start + limit.total }}"{{ start + limit.total >= total ? ' disabled' }}>{{ 'GANTRY5_ENGINE_NEXT'|trans }}</button>
<div class="clearfix"></div>
</div>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion platforms/common/templates/ajax/icons.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</ul>
</div>

{% set faVersion = gantry.config.page.fontawesome.version|default('fa4')|substr(0, 3)|upper %}
{% set faVersion = (gantry.config.page.fontawesome.version ?? gantry.config.page.fontawesome.default_version ?? 'fa4')|substr(0, 3)|upper %}

<div class="alert alert-info">{{ 'Displaying %s icons (see <strong>Base Outline</strong> &gt; <strong>Page Settings</strong> &gt; <strong>Font Awesome</strong>).'|trans(faVersion)|raw }}</div>

Expand Down
3 changes: 3 additions & 0 deletions platforms/common/translations/en/nucleus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ GANTRY5_ENGINE_NICETIME_MO_PLURAL: mos
GANTRY5_ENGINE_NICETIME_YR_PLURAL: yrs
GANTRY5_ENGINE_NICETIME_DEC_PLURAL: decs

GANTRY5_ENGINE_PREV: "Prev"
GANTRY5_ENGINE_NEXT: "Next"

# Grav

GANTRY5_ENGINE_FORM_SUMMARY: "Here is the summary of what you wrote to us:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,7 @@ GANTRY5_ENGINE_NICETIME_MO_PLURAL="mos"
GANTRY5_ENGINE_NICETIME_YR_PLURAL="yrs"
GANTRY5_ENGINE_NICETIME_DEC_PLURAL="decs"

GANTRY5_ENGINE_PREV="Prev"
GANTRY5_ENGINE_NEXT="Next"

GANTRY5_X_DAYS="%s days"
4 changes: 2 additions & 2 deletions platforms/joomla/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ class Pkg_Gantry5InstallerScript
protected $versions = array(
'PHP' => array (
'5.6' => '5.6.20',
'0' => '7.4.16' // Preferred version
'0' => '7.4.28' // Preferred version
),
'Joomla!' => array (
'3.9' => '3.9.0',
'0' => '3.9.25' // Preferred version
'0' => '3.10.8' // Preferred version
)
);
/**
Expand Down
6 changes: 3 additions & 3 deletions platforms/wordpress/gantry5/gantry5.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ function add_gantry5_streams_to_kses($protocols)

if (load_plugin_textdomain($domain, false, $languages_path) === false) {
add_filter('plugin_locale', 'modify_gantry5_locale', 10, 2);
load_plugin_textdomain($domain, false, $languages_path);
remove_filter('plugin_locale', 'modify_gantry5_locale', 10);
}

load_plugin_textdomain($domain, false, $languages_path);

function modify_gantry5_locale($locale, $domain = null)
{
// Revert the gantry5 domain locale to en_US
if (isset($domain) && $domain === 'gantry5') {
if ($domain === 'gantry5' || $domain === 'nucleus') {
$locale = 'en_US';
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/Gantry/Admin/Controller/Json/Icons.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function index()
/** @var Config $config */
$config = $this->container['config'];

$version = $config->get('page.fontawesome.version');
$version = $config->get('page.fontawesome.version', $config->get('page.fontawesome.default_version', 'fa4'));
if ($version === 'fa4') {
$list = include __DIR__ . '/Icons/FontAwesome4.php';
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/classes/Gantry/Component/Content/Block/HtmlBlock.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function getStyles($location = 'head')
$url = $theme->css(Gantry::basename($url, '.scss'));
}
// Deal with streams and relative paths.
$url = $document::url($url, false, null, false);
$url = $document::url($url, null, null, false);

$styles[$key]['href'] = $url;
}
Expand Down Expand Up @@ -116,7 +116,7 @@ public function getScripts($location = 'head')
foreach ($scripts as $key => $script) {
if (isset($script['src'])) {
// Deal with streams and relative paths.
$scripts[$key]['src'] = $document::url($script['src'], false, null, false);
$scripts[$key]['src'] = $document::url($script['src'], null, null, false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,10 +412,10 @@ public static function rootUri()
/**
* NOTE: In PHP this function can be called either from Gantry DI container or statically.
*
* @param bool $addDomain
* @param bool|null $addDomain
* @return string
*/
public static function domain($addDomain = false)
public static function domain($addDomain = null)
{
return '';
}
Expand All @@ -428,13 +428,13 @@ public static function domain($addDomain = false)
* NOTE: In PHP this function can be called either from Gantry DI container or statically.
*
* @param string $url Resource to be located.
* @param bool $domain True to include domain name.
* @param bool|null $domain True to include domain name, false to not, null to use default.
* @param int $timestamp_age Append timestamp to files that are less than x seconds old. Defaults to a week.
* Use value <= 0 to disable the feature.
* @param bool $allowNull True if non-existing files should return null.
* @return string|null Returns url to the resource or null if resource was not found.
*/
public static function url($url, $domain = false, $timestamp_age = null, $allowNull = true)
public static function url($url, $domain = null, $timestamp_age = null, $allowNull = true)
{
if (!is_string($url) || $url === '') {
// Return null on invalid input.
Expand Down
10 changes: 7 additions & 3 deletions src/classes/Gantry/Component/Menu/Item.php
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ public function columnWidth($column)
*/
public function groups()
{
$menu = $this->menu();

// Grouped by column counts.
if ($this->items['columns_count']) {
$children = $this->children;
Expand All @@ -276,7 +278,7 @@ public function groups()

foreach ($list as &$items) {
foreach ($items as $id => &$item) {
$item = $this->menu()[$id];
$item = $menu[$id];
}
unset($item);

Expand All @@ -293,7 +295,7 @@ public function groups()
foreach ($this->groups as $i => $group) {
$list[$i] = [];
foreach ($group as $id => $value) {
$item = $this->menu()[$id];
$item = $menu[$id];
if ($item) {
$list[$i][] = $item;
}
Expand Down Expand Up @@ -449,7 +451,9 @@ public function groupChildren(array $groups)

// Assign each menu items to the group.
$item = $menu[$key];
$item->group = $i;
if ($item) {
$item->group = $i;
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/classes/Gantry/Component/Stylesheet/ScssCompiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ public function compileLegacyFile($in)
$document = $gantry['document'];

foreach ($map['sources'] as &$source) {
$source = $document->url($source, null, -1);
$source = $document->url($source, false, -1);
}
unset($source);

Expand Down
4 changes: 2 additions & 2 deletions src/classes/Gantry/Component/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,12 +468,12 @@ public function nestedFunc($items, $name, $default = null, $separator = '.')
* @example {{ url('theme://images/logo.png')|default('http://www.placehold.it/150x100/f4f4f4') }}
*
* @param string $input Resource to be located.
* @param bool $domain True to include domain name.
* @param bool|null $domain True to include domain name.
* @param int $timestamp_age Append timestamp to files that are less than x seconds old. Defaults to a week.
* Use value <= 0 to disable the feature.
* @return string|null Returns url to the resource or null if resource was not found.
*/
public function urlFunc($input, $domain = false, $timestamp_age = null)
public function urlFunc($input, $domain = null, $timestamp_age = null)
{
$gantry = Gantry::instance();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ public static function load(Container $container, $name = 'default', $combine =

// Set FA default in Joomla
if (class_exists(Version::class)) {
$config->def('page.fontawesome.version', Version::MAJOR_VERSION < 4 ? 'fa4' : 'fa5css');
$config->def('page.fontawesome.default_version', Version::MAJOR_VERSION < 4 ? 'fa4' : 'fa5css');
} else {
$config->def('page.fontawesome.default_version', 'fa4');
}

return $config;
Expand Down
4 changes: 2 additions & 2 deletions src/platforms/grav/classes/Gantry/Framework/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ public static function registerAssets()
/**
* NOTE: In PHP this function can be called either from Gantry DI container or statically.
*
* @param bool $addDomain
* @param bool|false $addDomain
* @return string
*/
public static function domain($addDomain = false)
public static function domain($addDomain = null)
{
if (!$addDomain) {
return '';
Expand Down
4 changes: 2 additions & 2 deletions src/platforms/joomla/classes/Gantry/Framework/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ public static function registerAssets()
/**
* NOTE: In PHP this function can be called either from Gantry DI container or statically.
*
* @param bool $addDomain
* @param bool|null $addDomain
* @return string
*/
public static function domain($addDomain = false)
public static function domain($addDomain = null)
{
if (!$addDomain) {
return '';
Expand Down
1 change: 1 addition & 0 deletions src/platforms/joomla/classes/Gantry/Framework/Exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ protected function dumpInstallSql(array $export)
}

protected $installSql = <<<EOS
# Install Gantry package
INSERT INTO `#__extensions` (`package_id`, `name`, `type`, `element`, `folder`, `client_id`, `enabled`, `access`, `protected`, `manifest_cache`, `params`, `custom_data`) VALUES
Expand Down
18 changes: 18 additions & 0 deletions src/platforms/joomla/classes/Gantry/Joomla/Contact/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
namespace Gantry\Joomla\Contact;

use Gantry\Joomla\Object\AbstractObject;
use Joomla\CMS\Table\Table;

/**
* Class Contact
Expand All @@ -31,4 +32,21 @@ public function exportSql()
{
return $this->getCreateSql(['asset_id', 'checked_out', 'checked_out_time', 'created_by', 'modified_by', 'publish_up', 'publish_down', 'version', 'hits']) . ';';
}

/**
* Method to get the table object.
*
* @return Table The table object.
*/
protected static function getTable()
{
if (\JVersion::MAJOR_VERSION === 3) {
require_once JPATH_ADMINISTRATOR . '/components/com_contact/tables/contact.php';

static::$table = 'Contact';
static::$tablePrefix = 'ContactTable';
}

return parent::getTable();
}
}
8 changes: 4 additions & 4 deletions src/platforms/wordpress/classes/Gantry/Framework/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ public static function registerScripts($pos)
}

/**
* @param bool $addDomain
* @param bool|null $addDomain
* @return string
*/
public static function domain($addDomain = false)
public static function domain($addDomain = null)
{
static $domain;

Expand All @@ -135,8 +135,8 @@ public static function domain($addDomain = false)
$domain = $scheme . $user . $pass . $host . $port;
}

// Always append domain in WP.
return $addDomain !== null ? $domain : '';
// Always append domain in WP (unless told otherwise).
return $addDomain !== false ? $domain : '';
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/wordpress/classes/Gantry/Framework/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function __construct($container)

$this->home = \is_front_page();
$this->outline = $container['configuration'];
$this->language = (string) $site->language;
$this->language = str_replace('_', '-', (string)$site->language);
$this->direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
}

Expand Down
9 changes: 8 additions & 1 deletion src/platforms/wordpress/classes/Gantry/Framework/Theme.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function getContext(array $context)

$context['site'] = $gantry['site'];
$context['wordpress'] = $gantry['platform'];
$context['textdomain'] = $this->details()->get('configuration.theme.textdomain');

if (!$this->user) {
$this->user = new User;
Expand Down Expand Up @@ -560,7 +561,13 @@ protected function init()
if (!file_exists(GANTRY5_PATH . $lookup)) {
$lookup = '/engines/wordpress/' . $domain . '/languages';
}
\load_plugin_textdomain($domain, false, basename(GANTRY5_PATH) . $lookup);
$lookup = basename(GANTRY5_PATH) . $lookup;

if (\load_plugin_textdomain($domain, false, $lookup) === false) {
\add_filter('plugin_locale', 'modify_gantry5_locale', 10, 2);
\load_plugin_textdomain($domain, false, $lookup);
\remove_filter('plugin_locale', 'modify_gantry5_locale', 10);
}

$domain = $this->details()->get('configuration.theme.textdomain', $this->name);
\load_theme_textdomain($domain, $this->path . '/languages');
Expand Down

0 comments on commit ac05488

Please sign in to comment.