gantry changes for native Joomla 5

This commit is contained in:
Monika
2026-02-17 19:00:27 +05:30
parent d5f90082af
commit 57c0149a53
38 changed files with 392 additions and 544 deletions
+2
View File
@@ -17,6 +17,8 @@ CLAUDE.md
# Builds
bin/build/tmp
bin/build/package
bin/builder/tmp
bin/builder/package
dist
# Tester
+51 -4
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
@@ -20,11 +20,17 @@ chdir(__DIR__ . '/builder');
$hasVersion = false;
$isProd = true;
$hasTmpDir = false;
$hasBuildDir = false;
array_shift($argv);
foreach ($argv as $arg) {
if (strpos($arg, '-') === 0) {
if (strpos($arg, '-Dxml.version=') === 0) {
$hasVersion = true;
} elseif (strpos($arg, '-Dtmp_dir=') === 0) {
$hasTmpDir = true;
} elseif (strpos($arg, '-Dbuild_dir=') === 0) {
$hasBuildDir = true;
}
} elseif (strpos($arg, 'dev') !== false) {
$isProd = false;
@@ -32,6 +38,19 @@ foreach ($argv as $arg) {
}
$base = dirname(__DIR__);
if (stripos(PHP_OS, 'WIN') === 0) {
$drive = substr($base, 0, 2);
if (preg_match('/^[A-Za-z]:$/', $drive)) {
// Keep Phing working directories short on Windows to avoid MAX_PATH issues.
if (!$hasTmpDir) {
$argv[] = '-Dtmp_dir=' . $drive . '\\g5build\\tmp';
}
if (!$hasBuildDir) {
$argv[] = '-Dbuild_dir=' . $drive . '\\g5build\\package';
}
}
}
if (false === $hasVersion) {
$file = fopen("{$base}/CHANGELOG.md",'rb');
if (preg_match('/^# (\d\.\d+.\d+(-[a-z0-9.]+)?)\s*$/i', fgets($file), $matches) !== 1) {
@@ -58,9 +77,37 @@ if (false === $hasVersion) {
}
$argv[] = '-Dxml.version=' . $version;
// Pre-flight: note if PHP intl extension is missing. Build can continue because build.xml
// now uses PHP date fallback, but some environments may still expect intl.
if (!extension_loaded('intl')) {
fwrite(STDERR, "\nWARNING: PHP 'intl' extension is not enabled for CLI.\n");
fwrite(STDERR, "The build will attempt a fallback (PHP date). Consider enabling 'intl' for full compatibility.\n");
fwrite(STDERR, "Verify with: php -m | findstr /i intl\n\n");
// continue without exiting
}
}
$command = 'vendor/bin/phing ' . implode(' ', $argv);
// Ensure Phing can create zip archives even if CLI php.ini doesn't load zip by default.
$phpCommand = 'php';
if (!extension_loaded('zip')) {
$extensionDir = ini_get('extension_dir') ?: '';
if ($extensionDir && !preg_match('#^([a-zA-Z]:[\\\\/]|[\\\\/])#', $extensionDir)) {
$extensionDir = dirname(PHP_BINARY) . DIRECTORY_SEPARATOR . $extensionDir;
}
$zipExtension = 'zip.' . PHP_SHLIB_SUFFIX;
if (stripos(PHP_OS, 'WIN') === 0) {
$zipExtension = 'php_zip.' . PHP_SHLIB_SUFFIX;
}
$zipPath = rtrim($extensionDir, '/\\') . DIRECTORY_SEPARATOR . $zipExtension;
if (is_file($zipPath)) {
$phpCommand .= ' -d extension=' . $zipExtension;
}
}
$escapedArgs = array_map('escapeshellarg', $argv);
$command = $phpCommand . ' vendor/bin/phing ' . implode(' ', $escapedArgs);
if (false === system($command, $result) || $result) {
throw new \RuntimeException('Failed to run build script');
}
}
+13 -6
View File
@@ -48,12 +48,19 @@
<property name="path.platforms" value="${project_dir}/platforms" />
<property name="path.src" value="${project_dir}/src" />
<property name="path.themes" value="${project_dir}/themes" />
<tstamp>
<format property="str.datefmt" pattern="MMMM d, yyyy" locale="en"/>
</tstamp>
<tstamp>
<format property="str.datexml" pattern="MMMM d, yyyy" locale="en"/>
</tstamp>
<!-- Use PHP to generate human-readable dates to avoid Intl dependency in Phing TstampTask -->
<exec executable="php" outputproperty="php.datefmt">
<arg value="-r"/>
<arg value="echo date('F j, Y');"/>
</exec>
<property name="str.datefmt" value="${php.datefmt}" />
<exec executable="php" outputproperty="php.datexml">
<arg value="-r"/>
<arg value="echo date('F j, Y');"/>
</exec>
<property name="str.datexml" value="${php.datexml}" />
<property name="version.date" value="${str.datexml}" />
<condition property="str.version" value="_${cfg.versionprefix}${xml.version}">
+22 -1
View File
@@ -28,7 +28,28 @@ function composer_install($folder, $link)
{
chdir($folder);
if ($link && !file_exists('src')) {
symlink('../../../src', 'src');
$projectRoot = realpath(__DIR__ . '/..');
$source = $projectRoot ? $projectRoot . DIRECTORY_SEPARATOR . 'src' : __DIR__ . '/..' . DIRECTORY_SEPARATOR . 'src';
// Try symlink first
try {
@symlink($source, 'src');
} catch (\Throwable $e) {
// ignore
}
// Fallback: copy directory when symlink is not available (Windows)
if (!file_exists('src') && $source && is_dir($source)) {
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
@mkdir('src');
foreach ($iterator as $item) {
$dest = 'src' . DIRECTORY_SEPARATOR . ltrim(str_replace($source, '', $item->getPathname()), DIRECTORY_SEPARATOR);
if ($item->isDir()) {
@mkdir($dest);
} else {
copy($item->getPathname(), $dest);
}
}
}
}
if (false === exec('composer install --no-dev --no-progress --ignore-platform-req=ext-dom --ignore-platform-req=ext-xml --ignore-platform-req=ext-simplexml --ignore-platform-req=ext-xmlwriter', $output, $result) || $result) {
echo implode("\n", $output);
+22 -1
View File
@@ -28,7 +28,28 @@ function composer_update($folder, $link)
{
chdir($folder);
if ($link && !file_exists('src')) {
symlink('../../../src', 'src');
$projectRoot = realpath(__DIR__ . '/..');
$source = $projectRoot ? $projectRoot . DIRECTORY_SEPARATOR . 'src' : __DIR__ . '/..' . DIRECTORY_SEPARATOR . 'src';
// Try symlink first
try {
@symlink($source, 'src');
} catch (\Throwable $e) {
// ignore
}
// Fallback: copy directory when symlink is not available (Windows)
if (!file_exists('src') && $source && is_dir($source)) {
$iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($source, \FilesystemIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST);
@mkdir('src');
foreach ($iterator as $item) {
$dest = 'src' . DIRECTORY_SEPARATOR . ltrim(str_replace($source, '', $item->getPathname()), DIRECTORY_SEPARATOR);
if ($item->isDir()) {
@mkdir($dest);
} else {
copy($item->getPathname(), $dest);
}
}
}
}
if (false === exec('composer update --no-dev --no-progress --ignore-platform-req=ext-dom --ignore-platform-req=ext-xml --ignore-platform-req=ext-simplexml --ignore-platform-req=ext-xmlwriter', $output, $result) || $result) {
echo implode("\n", $output);
+6 -6
View File
@@ -11,15 +11,15 @@
"ext-mbstring": "*"
},
"scripts": {
"install-deps": "bin/composer-install",
"update-deps": "bin/composer-update",
"install-deps": "php bin/composer-install",
"update-deps": "php bin/composer-update",
"build-dev": [
"bin/composer-install",
"bin/build dev"
"php bin/composer-install",
"php bin/build dev"
],
"build-prod": [
"bin/composer-install",
"bin/build prod"
"php bin/composer-install",
"php bin/build prod"
]
}
}
Generated
+7 -6
View File
@@ -4,19 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "308366c84bc6bdaf9cdce33025573f48",
"content-hash": "29d67fd1c354e8484bb98f0adfcbb15e",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "dev",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": ">=5.6.20",
"php": ">=8.1.0 <8.4.0",
"ext-zip": "*",
"ext-json": "*"
"ext-json": "*",
"ext-mbstring": "*"
},
"platform-dev": [],
"plugin-api-version": "2.1.0"
"platform-dev": {},
"plugin-api-version": "2.6.0"
}
+2 -2
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license MIT
*
@@ -24,10 +24,7 @@ use Joomla\CMS\Form\FormField;
/**
* Class JFormFieldParticle
*/
// Compatibility alias for Joomla 4
// if (!class_exists('JFormFieldParticle') && version_compare(JVERSION, '5.0', '<')) {
// class_alias('ParticleField', 'JFormFieldParticle');
// }
class JFormFieldParticle extends FormField
{
+3 -2
View File
@@ -37,8 +37,9 @@ class Pkg_Gantry5InstallerScript
'0' => '8.2.0' // Preferred version
),
'Joomla!' => array (
'4.0' => '4.0.0',
'0' => '4.4.0' // Preferred version
// Require Joomla 5+ (minimum 5.0.0)
'5.0' => '5.0.0',
'0' => '5.0.0' // Preferred version
)
);
/**
@@ -11,8 +11,8 @@ use Joomla\Database\DatabaseInterface;
/**
* @package Gantry 5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -110,7 +110,4 @@ HTML;
}
}
// Compatibility alias for Joomla 4
if (!class_exists('JFormFieldWarning') && version_compare(JVERSION, '5.0', '<')) {
class_alias('WarningField', 'JFormFieldWarning');
}
// Joomla 5 only: no legacy alias required
@@ -3,8 +3,8 @@
/**
* @package Gantry 5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -106,11 +106,6 @@ class plgSystemGantry5 extends CMSPlugin
public function onAfterRoute()
{
if (version_compare(JVERSION, '4.0', '<')) {
// In Joomla 3.9 we need to make sure that user identity has been loaded.
$this->app->loadIdentity();
}
if ($this->app->isClient('site')) {
$this->onAfterRouteSite();
@@ -24,12 +24,6 @@
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"repositories": [
{
"type": "vcs",
"url": "https://github.com/rockettheme/toolbox"
}
],
"autoload": {
"psr-4": {
"Gantry\\": "src/classes/Gantry"
+43 -50
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "d98fe9d763708e0c002213c854a5d552",
"content-hash": "4cae021ed9b5ec2c7b35bd94b74893d6",
"packages": [
{
"name": "altorouter/altorouter",
@@ -384,16 +384,16 @@
},
{
"name": "pimple/pimple",
"version": "v3.5.0",
"version": "v3.6.1",
"source": {
"type": "git",
"url": "https://github.com/silexphp/Pimple.git",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed"
"reference": "020029849cc55ad360066844df8ed880fb20c5bb"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"reference": "a94b3a4db7fb774b3d78dad2315ddc07629e1bed",
"url": "https://api.github.com/repos/silexphp/Pimple/zipball/020029849cc55ad360066844df8ed880fb20c5bb",
"reference": "020029849cc55ad360066844df8ed880fb20c5bb",
"shasum": ""
},
"require": {
@@ -401,7 +401,7 @@
"psr/container": "^1.1 || ^2.0"
},
"require-dev": {
"symfony/phpunit-bridge": "^5.4@dev"
"phpunit/phpunit": "*"
},
"type": "library",
"extra": {
@@ -431,9 +431,9 @@
"dependency injection"
],
"support": {
"source": "https://github.com/silexphp/Pimple/tree/v3.5.0"
"source": "https://github.com/silexphp/Pimple/tree/v3.6.1"
},
"time": "2021-10-28T11:13:42+00:00"
"time": "2025-12-31T08:24:29+00:00"
},
{
"name": "psr/container",
@@ -562,36 +562,21 @@
"type": "library",
"autoload": {
"psr-4": {
"RocketTheme\\Toolbox\\ArrayTraits\\": "ArrayTraits/src",
"RocketTheme\\Toolbox\\Blueprints\\": "Blueprints/src",
"RocketTheme\\Toolbox\\Compat\\": "Compat/src",
"RocketTheme\\Toolbox\\DI\\": "DI/src",
"RocketTheme\\Toolbox\\Event\\": "Event/src",
"RocketTheme\\Toolbox\\File\\": "File/src",
"RocketTheme\\Toolbox\\ResourceLocator\\": "ResourceLocator/src",
"RocketTheme\\Toolbox\\Event\\": "Event/src",
"RocketTheme\\Toolbox\\Compat\\": "Compat/src",
"RocketTheme\\Toolbox\\Session\\": "Session/src",
"RocketTheme\\Toolbox\\StreamWrapper\\": "StreamWrapper/src"
"RocketTheme\\Toolbox\\Blueprints\\": "Blueprints/src",
"RocketTheme\\Toolbox\\ArrayTraits\\": "ArrayTraits/src",
"RocketTheme\\Toolbox\\StreamWrapper\\": "StreamWrapper/src",
"RocketTheme\\Toolbox\\ResourceLocator\\": "ResourceLocator/src"
},
"exclude-from-classmap": [
"**/tests/"
]
},
"archive": {
"exclude": [
"tests"
]
},
"scripts": {
"test": [
"vendor/bin/phpunit run unit"
],
"test-windows": [
"vendor\\bin\\phpunit run unit"
],
"phpstan": [
"vendor/bin/phpstan analyse -l 8 -c ./tests/phpstan/phpstan.neon . --memory-limit=128M --no-progress"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
@@ -602,8 +587,8 @@
"rockettheme"
],
"support": {
"source": "https://github.com/rockettheme/toolbox/tree/1.6.5",
"issues": "https://github.com/rockettheme/toolbox/issues"
"issues": "https://github.com/rockettheme/toolbox/issues",
"source": "https://github.com/rockettheme/toolbox/tree/1.6.5"
},
"time": "2023-05-09T18:11:17+00:00"
},
@@ -689,16 +674,16 @@
},
{
"name": "symfony/deprecation-contracts",
"version": "v3.5.1",
"version": "v3.6.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/deprecation-contracts.git",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6"
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"reference": "74c71c939a79f7d5bf3c1ce9f5ea37ba0114c6f6",
"url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62",
"reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62",
"shasum": ""
},
"require": {
@@ -711,7 +696,7 @@
"name": "symfony/contracts"
},
"branch-alias": {
"dev-main": "3.5-dev"
"dev-main": "3.6-dev"
}
},
"autoload": {
@@ -736,7 +721,7 @@
"description": "A generic function and convention to trigger deprecation notices",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.5.1"
"source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0"
},
"funding": [
{
@@ -752,7 +737,7 @@
"type": "tidelift"
}
],
"time": "2024-09-25T14:20:29+00:00"
"time": "2024-09-25T14:21:43+00:00"
},
{
"name": "symfony/event-dispatcher",
@@ -919,7 +904,7 @@
},
{
"name": "symfony/polyfill-ctype",
"version": "v1.31.0",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
@@ -978,7 +963,7 @@
"portable"
],
"support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.33.0"
},
"funding": [
{
@@ -989,6 +974,10 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
@@ -1143,16 +1132,16 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.31.0",
"version": "v1.33.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"reference": "0cc9dd0f17f61d8131e7df6b84bd344899fe2608",
"shasum": ""
},
"require": {
@@ -1203,7 +1192,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.33.0"
},
"funding": [
{
@@ -1214,12 +1203,16 @@
"url": "https://github.com/fabpot",
"type": "github"
},
{
"url": "https://github.com/nicolas-grekas",
"type": "github"
},
{
"url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
"type": "tidelift"
}
],
"time": "2024-09-09T11:45:10+00:00"
"time": "2025-01-02T08:10:11+00:00"
},
{
"name": "symfony/yaml",
@@ -3322,7 +3315,7 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"stability-flags": {},
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@@ -3333,9 +3326,9 @@
"ext-xml": "*",
"ext-simplexml": "*"
},
"platform-dev": [],
"platform-dev": {},
"platform-overrides": {
"php": "8.1"
},
"plugin-api-version": "2.3.0"
"plugin-api-version": "2.6.0"
}
+12 -7
View File
@@ -93,14 +93,19 @@ function add_gantry5_streams_to_kses($protocols)
return $protocols;
}
// Initialize plugin language and fallback to en_US if the .mo file can't be found
$domain = 'gantry5';
$languages_path = basename(GANTRY5_PATH) . '/admin/languages';
// Initialize plugin language on init to avoid WP 6.7+ early translation notices.
add_action('init', 'gantry5_load_textdomain', 1);
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);
function gantry5_load_textdomain()
{
$domain = 'gantry5';
$languages_path = basename(GANTRY5_PATH) . '/admin/languages';
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);
}
}
function modify_gantry5_locale($locale, $domain = null)
+6 -5
View File
@@ -103,9 +103,10 @@ abstract class RealLoader
throw new \LogicException('Please run composer in Gantry 5 Library!');
}
// In PHP >=7.2.5 we need to use newer version of ctype library.
$useNewLibraries = \PHP_VERSION_ID >= 70205 && GANTRY5_PLATFORM !== 'grav';
if ($useNewLibraries) {
// Load compat libraries only on platforms that still rely on the legacy stack.
// WordPress ships with modern dependencies in vendor/, so prefer those there.
$useCompatLibraries = GANTRY5_PLATFORM !== 'wordpress' && \PHP_VERSION_ID >= 70205 && GANTRY5_PLATFORM !== 'grav';
if ($useCompatLibraries) {
/** @var ClassLoader $loader */
$loader = require "{$lib}/compat/vendor/autoload.php";
$loader->unregister();
@@ -114,8 +115,8 @@ abstract class RealLoader
/** @var ClassLoader $loader */
$loader = require $autoload;
// In PHP >=7.2.5 we need to use newer version of Pimple and Twig.
if ($useNewLibraries) {
// On legacy platforms, map Pimple/Twig to compat vendor.
if ($useCompatLibraries) {
$loader->setPsr4('Twig\\', "{$lib}/compat/vendor/twig/twig/src");
$loader->set('Twig_', "{$lib}/compat/vendor/twig/twig/lib");
$loader->set('Pimple', "{$lib}/compat/vendor/pimple/pimple/src");
+8 -2
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
@@ -25,6 +25,12 @@ use Gantry\Framework\Gantry;
*/
class Event extends \RocketTheme\Toolbox\Event\Event
{
/**
* Permanent fix for PHP 8.2 dynamic property warning:
* Creation of dynamic property Event::$types is deprecated.
*/
public array $types = [];
/** @var Gantry */
public $gantry;
/** @var RestfulControllerInterface */
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
@@ -796,7 +796,14 @@ trait ThemeTrait
}
if ($cached) {
$cacheKey['language'] = $gantry['page']->language;
$language = '';
if (isset($gantry['page']) && isset($gantry['page']->language)) {
$language = $gantry['page']->language;
} elseif (isset($gantry['site']) && isset($gantry['site']->language)) {
$language = $gantry['site']->language;
}
$cacheKey['language'] = $language;
$cacheKey['attributes'] = $particle;
$cacheKey += (array) $item;
+2 -2
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license Dual License: MIT or GNU/GPLv2 and later
*
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -18,7 +18,7 @@ use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Factory;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Uri\Uri;
use Joomla\CMS\Version as JVersion;
// Joomla 5-only: no version switch needed here
use Joomla\CMS\WebAsset\WebAssetManager;
/**
@@ -58,8 +58,7 @@ class Document extends HtmlDocument
// Make sure that if Bootstap framework is loaded, also load CSS.
if (
$framework === 'bootstrap'
|| ($framework === 'bootstrap.2' && JVersion::MAJOR_VERSION === 3)
|| ($framework === 'bootstrap.5' && JVersion::MAJOR_VERSION >= 4)
|| $framework === 'bootstrap.5'
) {
/** @var Theme $theme */
$theme = Gantry::instance()['theme'];
@@ -174,260 +173,102 @@ class Document extends HtmlDocument
protected static function registerJquery()
{
if (version_compare(JVERSION, '4.0', '>')) {
if (!static::errorPage()) {
HTMLHelper::_('jquery.framework');
return;
}
/** @var WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
array_map(
static function ($script) use ($wa) {
$asset = $wa->getAsset('script', $script);
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => $asset->getUri(true)
],
'head',
100
);
},
['jquery', 'jquery-noconflict']
);
return;
}
// Joomla 3:
if (!static::errorPage()) {
HTMLHelper::_('jquery.framework');
return;
}
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/jquery.min.js'
],
'head',
100
);
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/jquery-noconflict.js'
],
'head',
100
);
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/jquery-migrate.min.js'
],
'head',
100
/** @var WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
array_map(
static function ($script) use ($wa) {
$asset = $wa->getAsset('script', $script);
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => $asset->getUri(true)
],
'head',
100
);
},
['jquery', 'jquery-noconflict']
);
}
protected static function registerJqueryUiCore()
{
if (version_compare(JVERSION, '4.0', '>')) {
//user_error('jQuery UI Core is not supported in Joomla 4, please remove the dependency!', E_USER_DEPRECATED);
// Modern Joomla: delegate to parent sortable implementation
parent::registerJqueryUiSortable();
parent::registerJqueryUiSortable();
return;
}
if (!static::errorPage()) {
HTMLHelper::_('jquery.ui', ['core']);
return;
}
// Workaround for error document type.
static::registerJquery();
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/jquery.ui.core.min.js'
],
'head',
100
);
return;
}
protected static function registerJqueryUiSortable()
{
if (version_compare(JVERSION, '4.0', '>')) {
//user_error('jQuery UI Sortable is not supported in Joomla 4, please remove the dependency!', E_USER_DEPRECATED);
parent::registerJqueryUiSortable();
parent::registerJqueryUiSortable();
return;
}
if (!static::errorPage()) {
HTMLHelper::_('jquery.ui', ['sortable']);
return;
}
// Workaround for error document type.
static::registerJqueryUiCore();
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/jquery.ui.sortable.min.js'
],
'head',
100
);
return;
}
protected static function registerBootstrap()
{
if (version_compare(JVERSION, '4.0', '>')) {
static::registerBootstrap5();
} else {
static::registerBootstrap2();
}
// For Joomla 5 use Bootstrap 5 implementation
static::registerBootstrap5();
}
protected static function registerBootstrap2()
{
if (version_compare(JVERSION, '4.0', '>')) {
//user_error('Bootstrap 2 is not supported in Joomla 4, using Bootstrap 5 instead!', E_USER_DEPRECATED);
static::registerBootstrap5();
return;
}
// Deprecated in modern Joomla; route to Bootstrap5 implementation
static::registerBootstrap5();
}
protected static function registerBootstrap5()
{
if (!static::errorPage()) {
HTMLHelper::_('bootstrap.framework');
return;
}
// Workaround for error document type.
static::registerJquery();
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/jui/js/bootstrap.min.js'
],
'head',
100
/** @var WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
array_map(
static function ($script) use ($wa) {
$asset = $wa->getAsset('script', 'bootstrap.' . $script);
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => $asset->getUri(true) . '?' . $asset->getVersion()
],
'head',
100
);
},
['alert', 'button', 'carousel', 'collapse', 'dropdown', 'modal', 'offcanvas', 'popover', 'scrollspy', 'tab', 'toast']
);
}
protected static function registerBootstrap5()
{
if (version_compare(JVERSION, '4.0', '>')) {
if (!static::errorPage()) {
HTMLHelper::_('bootstrap.framework');
return;
}
/** @var WebAssetManager $wa */
$wa = Factory::getApplication()->getDocument()->getWebAssetManager();
array_map(
static function ($script) use ($wa) {
$asset = $wa->getAsset('script', 'bootstrap.' . $script);
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => $asset->getUri(true) . '?' . $asset->getVersion()
],
'head',
100
);
},
['alert', 'button', 'carousel', 'collapse', 'dropdown', 'modal', 'offcanvas', 'popover', 'scrollspy', 'tab', 'toast']
);
return;
}
parent::registerBootstrap5();
}
protected static function registerMootools()
{
if (version_compare(JVERSION, '4.0', '>')) {
//user_error('Mootools is no longer supported in Joomla 4!', E_USER_DEPRECATED);
parent::registerMootools();
parent::registerMootools();
return;
}
if (!static::errorPage()) {
HTMLHelper::_('behavior.framework');
return;
}
// Workaround for error document type.
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/system/js/mootools-core.js'
],
'head',
99
);
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/system/js/core.js'
],
'head',
99
);
return;
}
protected static function registerMootoolsMore()
{
if (version_compare(JVERSION, '4.0', '>')) {
//user_error('Mootools is no longer supported in Joomla 4!', E_USER_DEPRECATED);
parent::registerMootoolsMore();
parent::registerMootoolsMore();
return;
}
if (!static::errorPage()) {
HTMLHelper::_('behavior.framework', true);
return;
}
// Workaround for error document type.
static::registerMootools();
static::addHeaderTag(
[
'tag' => 'script',
'src' => Uri::getInstance()->base(true) . '/media/system/js/mootools-more.js'
],
'head',
99
);
return;
}
/**
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -146,15 +146,10 @@ class Page extends Base\Page
*/
public function bodyAttributes($attributes = [])
{
if ($this->tmpl === 'component') {
if (version_compare(JVERSION, '4.0', '<')) {
$classes = ['contentpane', 'modal'];
}
} else {
$classes = ['site', $this->option, "view-{$this->view}"];
$classes[] = $this->layout ? 'layout-' . $this->layout : 'no-layout';
$classes[] = $this->task ? 'task-' . $this->task : 'no-task';
}
// Use modern Joomla class set for site and component pages (Joomla 5)
$classes = ['site', $this->option, "view-{$this->view}"];
$classes[] = $this->layout ? 'layout-' . $this->layout : 'no-layout';
$classes[] = $this->task ? 'task-' . $this->task : 'no-task';
$classes[] = 'dir-' . $this->direction;
if ($this->class) $classes[] = $this->class;
if ($this->printing) $classes[] = 'print-mode';
@@ -66,12 +66,9 @@ class Platform extends BasePlatform
$this->module_wrapper = '<div class="platform-content">%s</div>';
if (Version::MAJOR_VERSION < 4) {
$this->component_wrapper = '<div class="platform-content row-fluid"><div class="span12">%s</div></div>';
} else {
$this->features['fontawesome'] = true;
$this->component_wrapper = '<div class="platform-content container"><div class="row"><div class="col">%s</div></div></div>';
}
// Joomla 5-only: always use modern container/component wrapper and enable fontawesome
$this->features['fontawesome'] = true;
$this->component_wrapper = '<div class="platform-content container"><div class="row"><div class="col">%s</div></div></div>';
}
/**
@@ -700,7 +697,8 @@ class Platform extends BasePlatform
$db = Factory::getDbo();
$userId = $user->id;
$checked_out_default = Version::MAJOR_VERSION < 4 ? 'checked_out != 0' : 'checked_out IS NOT null';
// Joomla 5: checked_out field is nullable
$checked_out_default = 'checked_out IS NOT null';
// Verify that no items are checked out.
$query = $db->getQuery(true)
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -51,10 +51,7 @@ class Theme extends AbstractTheme
if ($enable && !$this->joomla) {
$this->joomla = true;
// Workaround for Joomla! 3.x not loading bootstrap when it needs it.
if (version_compare(JVERSION, '4', '<')) {
static::gantry()->load('bootstrap');
}
// Joomla 5 only: no Joomla 3 bootstrap workaround needed.
}
return $this->joomla;
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -82,12 +82,7 @@ class Category extends AbstractObject
*/
public function route()
{
if (version_compare(JVERSION, '4.0', '<')) {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
return Route::_(\ContentHelperRoute::getCategoryRoute($this->id . ':' . $this->alias), false);
}
// Joomla 5: use namespaced RouteHelper
require_once JPATH_SITE . '/components/com_content/src/Helper/RouteHelper.php';
return Route::_(RouteHelper::getCategoryRoute($this->id . ':' . $this->alias), false);
@@ -42,13 +42,6 @@ class Contact extends AbstractObject
*/
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();
}
}
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -142,13 +142,7 @@ class Content extends AbstractObject
public function route()
{
$category = $this->category();
if (version_compare(JVERSION, '4.0', '<')) {
require_once JPATH_SITE . '/components/com_content/helpers/route.php';
return htmlspecialchars_decode(Route::_(\ContentHelperRoute::getArticleRoute($this->id . ':' . $this->alias, $category->id . ':' . $category->alias), false), ENT_COMPAT);
}
// Joomla 5: use namespaced RouteHelper
require_once JPATH_SITE . '/components/com_content/src/Helper/RouteHelper.php';
return htmlspecialchars_decode(Route::_(RouteHelper::getArticleRoute($this->id . ':' . $this->alias, $category->id . ':' . $category->alias), false), ENT_COMPAT);
@@ -165,12 +159,9 @@ class Content extends AbstractObject
$asset = "com_content.article.{$this->id}";
if ($user && ($user->authorise('core.edit', $asset) || $user->authorise('core.edit.own', $asset))) {
if (version_compare(JVERSION, '4.0', '<')) {
return "index.php?option=com_content&task=article.edit&a_id={$this->id}&tmpl=component";
}
// Joomla 5: use namespaced RouteHelper and build edit url
$contentUrl = RouteHelper::getArticleRoute($this->id . ':' . $this->alias, $this->catid);
$url = $contentUrl . '&task=article.edit&a_id=' . $this->id;
$url = $contentUrl . '&task=article.edit&a_id=' . $this->id;
return htmlspecialchars_decode(Route::_($url), ENT_COMPAT);
}
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -165,21 +165,15 @@ class ContentFinder extends Finder
}
// Filter by start and end dates.
if (!$user->authorise('core.edit.state', 'com_content') && !$user->authorise('core.edit', 'com_content')) {
// Define null and now dates
if (!$user->authorise('core.edit.state', 'com_content') && !$user->authorise('core.edit', 'com_content')) {
// Define now date and use modern datetime null checks (Joomla 5)
$nowDate = $this->db->quote(Factory::getDate()->toSql());
if (version_compare(JVERSION, '4.0', '<')) {
$nullDate = $this->db->quote($this->db->getNullDate());
$nullDateUp = "a.publish_up = {$nullDate}";
$nullDateDown = "a.publish_down = {$nullDate}";
} else {
$nullDateUp = $this->query->isNullDatetime('a.publish_up');
$nullDateDown = $this->query->isNullDatetime('a.publish_down');
}
$nullDateUp = $this->query->isNullDatetime('a.publish_up');
$nullDateDown = $this->query->isNullDatetime('a.publish_down');
$this->query
->where('(' . $nullDateUp . ' OR a.publish_up <= ' . $nowDate . ')')
->where('(' . $nullDateDown. ' OR a.publish_down >= ' . $nowDate . ')')
->where('(' . $nullDateDown . ' OR a.publish_down >= ' . $nowDate . ')')
->where('a.state >= 1')
;
}
@@ -228,10 +222,10 @@ class ContentFinder extends Finder
$input = $tagIds['id'][0];
$tagIdsArray = [];
$tagNamesArray = [];
// Separate IDs and names
$items = array_map('trim', explode(',', $input));
foreach ($items as $item) {
if (is_numeric($item)) {
$tagIdsArray[] = (int)$item;
@@ -239,7 +233,7 @@ class ContentFinder extends Finder
$tagNamesArray[] = $item;
}
}
// If we have tag names, get their IDs
if (!empty($tagNamesArray)) {
// Use the same database object as other methods in this class
@@ -247,21 +241,21 @@ class ContentFinder extends Finder
->select($this->db->quoteName('id'))
->from($this->db->quoteName('#__tags'))
->where($this->db->quoteName('title') . ' IN (' . implode(',', array_map([$this->db, 'quote'], $tagNamesArray)) . ')');
$this->db->setQuery($query);
$tagIdsFromNames = $this->db->loadColumn();
if (!empty($tagIdsFromNames)) {
$tagIdsArray = array_merge($tagIdsArray, $tagIdsFromNames);
}
}
if (empty($tagIdsArray)) {
return $this;
}
$this->query->join('INNER', '#__contentitem_tag_map AS t ON t.content_item_id = a.id');
return $this->where('t.tag_id', 'IN', $tagIdsArray)->where('t.type_alias', '=', 'com_content.article');
}
}
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -55,10 +55,6 @@ class MenuHelper
{
$model = static::loadModel();
$table = $model->getTable('MenuType');
if (!$table) {
// Joomla 3 support.
$table = Table::getInstance('MenuType');
}
if (null !== $id) {
if (!is_array($id)) {
@@ -80,32 +76,11 @@ class MenuHelper
static $model = [];
if (!isset($model[$name])) {
if (version_compare(JVERSION, '4', '<')) {
// Joomla 3 support.
$path = JPATH_ADMINISTRATOR . '/components/com_menus/';
$filename = strtolower($name);
$className = "\\MenusModel{$name}";
Table::addIncludePath(JPATH_LIBRARIES . '/legacy/table/');
Table::addIncludePath("{$path}/tables");
require_once "{$path}/models/{$filename}.php";
/** @var CMSApplication $application */
$application = Factory::getApplication();
// Load language strings.
$language = $application->getLanguage();
$language->load('com_menus');
// Load the model.
$model[$name] = new $className();
} else {
// Joomla 4 support.
$application = Factory::getApplication();
$model[$name] = $application->bootComponent('com_menus')
->getMVCFactory()
->createModel($name, 'Administrator', ['ignore_request' => true]);
}
// Joomla 5+ (use modern component boot and MVC factory)
$application = Factory::getApplication();
$model[$name] = $application->bootComponent('com_menus')
->getMVCFactory()
->createModel($name, 'Administrator', ['ignore_request' => true]);
}
return $model[$name];
@@ -3,8 +3,8 @@
/**
* @package Gantry5
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2021 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -154,32 +154,11 @@ class StyleHelper
static $model = [];
if (!isset($model[$name])) {
if (version_compare(JVERSION, '4', '<')) {
// Joomla 3 support.
$path = JPATH_ADMINISTRATOR . '/components/com_templates/';
$filename = strtolower($name);
$className = "\\TemplatesModel{$name}";
Table::addIncludePath("{$path}/tables");
require_once "{$path}/models/{$filename}.php";
/** @var CMSApplication $application */
$application = Factory::getApplication();
// Load language strings.
$language = $application->getLanguage();
$language->load('com_templates');
// Load the model.
$model[$name] = new $className();
} else {
// Joomla 4 support.
$application = Factory::getApplication();
$model[$name] = $application->bootComponent('com_templates')
->getMVCFactory()
->createModel($name, 'Administrator', ['ignore_request' => true]);
}
// Joomla 5+ (use modern component boot and MVC factory)
$application = Factory::getApplication();
$model[$name] = $application->bootComponent('com_templates')
->getMVCFactory()
->createModel($name, 'Administrator', ['ignore_request' => true]);
}
return $model[$name];
@@ -557,22 +557,8 @@ class Theme extends AbstractTheme
$this->preset_styles_init();
// Load theme text domains
$domain = $this->details()->get('configuration.gantry.engine', 'nucleus');
$lookup = '/engines/' . $domain . '/languages';
if (!file_exists(GANTRY5_PATH . $lookup)) {
$lookup = '/engines/wordpress/' . $domain . '/languages';
}
$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');
// Load text domains on init or later to avoid WP 6.7+ early translation notices.
$this->loadTextDomains();
$this->url = $gantry['site']->theme->link;
@@ -612,6 +598,36 @@ class Theme extends AbstractTheme
setcookie($name, $value, $expire, $path, $domain);
}
protected function loadTextDomains()
{
$engineDomain = $this->details()->get('configuration.gantry.engine', 'nucleus');
$lookup = '/engines/' . $engineDomain . '/languages';
if (!file_exists(GANTRY5_PATH . $lookup)) {
$lookup = '/engines/wordpress/' . $engineDomain . '/languages';
}
$lookup = basename(GANTRY5_PATH) . $lookup;
$themeDomain = $this->details()->get('configuration.theme.textdomain', $this->name);
$themePath = $this->path . '/languages';
$loader = static function () use ($engineDomain, $lookup, $themeDomain, $themePath) {
if (\load_plugin_textdomain($engineDomain, false, $lookup) === false) {
\add_filter('plugin_locale', 'modify_gantry5_locale', 10, 2);
\load_plugin_textdomain($engineDomain, false, $lookup);
\remove_filter('plugin_locale', 'modify_gantry5_locale', 10);
}
\load_theme_textdomain($themeDomain, $themePath);
};
if (\did_action('init')) {
$loader();
return;
}
\add_action('init', $loader, 1);
}
/**
* Serve particle AJAX requests in '/wp-admin/admin-ajax.php?action=particle'.
*/
@@ -27,6 +27,19 @@ class Translator extends BaseTranslator
*/
public function translate($string)
{
if (!\did_action('init')) {
$translated = parent::translate($string);
if (\func_num_args() === 1) {
return $translated;
}
$args = \func_get_args();
$args[0] = $translated;
return sprintf(...$args);
}
static $textdomain;
static $enginedomain;
+3 -6
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -39,7 +39,4 @@ class WarningField extends \Joomla\CMS\Form\FormField
}
}
// Compatibility alias for Joomla 4
if (!class_exists('JFormFieldWarning') && version_compare(JVERSION, '5.0', '<')) {
class_alias('WarningField', 'JFormFieldWarning');
}
// Joomla 5 only: no legacy alias required
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU/GPLv2 and later
@@ -14,29 +14,6 @@
defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
$msgList = $displayData['msgList'];
?>
<div id="system-message-container">
<?php if (is_array($msgList) && !empty($msgList)) : ?>
<div id="system-message">
<?php foreach ($msgList as $type => $msgs) : ?>
<div class="alert alert-<?php echo $type; ?>">
<?php // This requires JS so we should add it trough JS. Progressive enhancement and stuff. ?>
<a class="close" data-dismiss="alert">×</a>
<?php if (!empty($msgs)) : ?>
<h4 class="alert-heading"><?php echo Text::_($type); ?></h4>
<div>
<?php foreach ($msgs as $msg) : ?>
<p><?php echo $msg; ?></p>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
// Joomla 5: use core system message layout
include JPATH_ROOT . '/layouts/joomla/system/message.php';
return;
+3 -6
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -39,7 +39,4 @@ class WarningField extends \Joomla\CMS\Form\FormField
}
}
// Compatibility alias for Joomla 4
if (!class_exists('JFormFieldWarning') && version_compare(JVERSION, '5.0', '<')) {
class_alias('WarningField', 'JFormFieldWarning');
}
// Joomla 5 only: no legacy alias required
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU/GPLv2 and later
@@ -16,10 +16,9 @@ defined('_JEXEC') or die;
use Joomla\CMS\Language\Text;
if (version_compare(JVERSION, 4.0, '>')) {
include JPATH_ROOT . '/layouts/joomla/system/message.php';
return;
}
// Joomla 5: use core system message layout
include JPATH_ROOT . '/layouts/joomla/system/message.php';
return;
/**
* Joomla 3 version of the system messages.
@@ -57,4 +57,4 @@ form:
.description:
type: textarea.textarea
label: Name
label: Name
+3 -6
View File
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @license GNU/GPLv2 and later
*
@@ -39,7 +39,4 @@ class WarningField extends \Joomla\CMS\Form\FormField
}
}
// Compatibility alias for Joomla 4
if (!class_exists('JFormFieldWarning') && version_compare(JVERSION, '5.0', '<')) {
class_alias('WarningField', 'JFormFieldWarning');
}
// Joomla 5 only: no legacy alias required
@@ -3,8 +3,8 @@
/**
* @package Gantry 5 Theme
* @author Tiger12 http://tiger12.com
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @originalCreator RocketTheme (Gantry Framework)
* @currentDeveloper Tiger12, LLC
* @copyright Copyright (C) 2007 - 2022 Tiger12, LLC
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU/GPLv2 and later
@@ -14,10 +14,9 @@
defined('_JEXEC') or die;
if (version_compare(JVERSION, 4.0, '>')) {
include JPATH_ROOT . '/layouts/joomla/system/message.php';
return;
}
// Joomla 5: use core system message layout
include JPATH_ROOT . '/layouts/joomla/system/message.php';
return;
/**
* Joomla 3 version of the system messages.