Skip to content

Commit

Permalink
Account for case that a jQuery CSS theme gets removed and fallback to…
Browse files Browse the repository at this point in the history
… an existing theme
  • Loading branch information
ggppdk committed Feb 7, 2022
1 parent ebddc00 commit 3855a0e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 26 deletions.
2 changes: 1 addition & 1 deletion admin/defineconstants.php
Expand Up @@ -127,7 +127,7 @@ public static function getInstance()
// Version constants
define('FLEXI_PHP_NEEDED', '5.4.0');
define('FLEXI_PHP_RECOMMENDED', '7.1.0');
define('FLEXI_VERSION', '4.0.1');
define('FLEXI_VERSION', '4.0.2');
define('FLEXI_RELEASE', '');
define('FLEXI_VHASH', md5(filemtime(__FILE__) . filectime(__FILE__) . FLEXI_VERSION));
define('FLEXI_PHP_54GE', version_compare(PHP_VERSION, '5.4.0', '>='));
2 changes: 1 addition & 1 deletion flexicontent.xml
Expand Up @@ -9,7 +9,7 @@
<copyright>(C) 2009-2022 Emmanuel Danan, Georgios Papadakis</copyright>
<license>http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL</license>
<!-- The version string is recorded in the components table -->
<version>4.0.1</version>
<version>4.0.2</version>
<!-- The description is optional and defaults to the name -->
<description>COM_FLEXICONTENT_DESCRIPTION</description>

Expand Down
33 changes: 9 additions & 24 deletions site/classes/helpers/html.php
Expand Up @@ -1150,7 +1150,11 @@ static function loadJQuery( $add_jquery = 1, $add_jquery_ui = 1, $add_jquery_ui_
) : null;

$JQUERY_UI_VER = FLEXI_J40GE ? '1.13.1' : $params->get('jquery_ui_ver', $flexiparams->get('jquery_ui_ver', '1.9.2'));
$JQUERY_UI_THEME = $params->get('jquery_ui_theme', $flexiparams->get('jquery_ui_theme', 'flat')); // FLEXI_JQUERY_UI_CSS_STYLE: 'ui-lightness', 'smoothness', 'flat'
$JQUERY_UI_THEME = $params->get('jquery_ui_theme', $flexiparams->get('jquery_ui_theme', 'ui-lightness')); // FLEXI_JQUERY_UI_CSS_STYLE: 'ui-lightness', 'smoothness'
if (!in_array($JQUERY_UI_THEME, array('ui-lightness', 'smoothness')))
{
$JQUERY_UI_THEME = 'ui-lightness';
}
JText::script("FLEXI_FORM_IS_BEING_SUBMITTED", true);

/*
Expand Down Expand Up @@ -1220,29 +1224,10 @@ static function loadJQuery( $add_jquery = 1, $add_jquery_ui = 1, $add_jquery_ui_
// Add jQuery UI theme, this is included in J3+ when executing jQuery-UI framework is called
if ( $add_jquery_ui_css && !$jquery_ui_css_added )
{
// A custom made theme ...
if ($JQUERY_UI_THEME === 'flat')
{
if (FLEXI_J40GE)
{
// Just load default CSS
$document->addStyleSheet(JUri::root(true).$lib_path.'/jquery/js/jquery-ui-'.$JQUERY_UI_VER.'/jquery-ui.theme.min.css');
$document->addStyleSheet(JUri::root(true).$lib_path.'/jquery/js/jquery-ui-'.$JQUERY_UI_VER.'/jquery-ui.structure.min.css');
}
else
{
// Load custom theme
$document->addStyleSheet(JUri::root(true).$lib_path.'/jquery/css/'.$JQUERY_UI_THEME.'/jquery-ui-'.$JQUERY_UI_VER.'.css');
}
}
else
{
// FLEXI_JQUERY_UI_CSS_STYLE: 'ui-lightness', 'smoothness', ...
$add_remote_forced_jquery_ui
? $document->addStyleSheet('//code.jquery.com/ui/'.$JQUERY_UI_VER.'/themes/'.$JQUERY_UI_THEME.'/jquery-ui.css')
: $document->addStyleSheet(JUri::root(true).$lib_path.'/jquery/css/'.$JQUERY_UI_THEME.'/jquery-ui-'.$JQUERY_UI_VER.'.css');
}

// FLEXI_JQUERY_UI_CSS_STYLE: 'ui-lightness', 'smoothness', ...
$add_remote_forced_jquery_ui
? $document->addStyleSheet('//code.jquery.com/ui/'.$JQUERY_UI_VER.'/themes/'.$JQUERY_UI_THEME.'/jquery-ui.css')
: $document->addStyleSheet(JUri::root(true).$lib_path.'/jquery/css/'.$JQUERY_UI_THEME.'/jquery-ui-'.$JQUERY_UI_VER.'.css');
$jquery_ui_css_added = 1;
}
}
Expand Down

0 comments on commit 3855a0e

Please sign in to comment.