From da9d4ceb9824d9d6df450e15300e10bbe87be72e Mon Sep 17 00:00:00 2001 From: Chris Vaughan Date: Tue, 12 Jul 2022 10:07:25 +0100 Subject: [PATCH] Slight css change and bug fix to code --- css/gantry-custom.css | 4 +- features/styledeclaration.php | 373 ++++++++++++++++++---------------- images/download.png | Bin 0 -> 70 bytes templateDetails.xml | 2 +- 4 files changed, 202 insertions(+), 177 deletions(-) create mode 100644 images/download.png diff --git a/css/gantry-custom.css b/css/gantry-custom.css index af18287..3bff6ce 100644 --- a/css/gantry-custom.css +++ b/css/gantry-custom.css @@ -8,11 +8,11 @@ a[href="javascript:void(0);"] { a[target="_blank"]:hover{ content:' '; background: url(../images/icons/new-win.png) no-repeat right; - padding-right:12px; + padding-right:10px; } a[target="_blank"]{ content:'xx'; - padding-right:12px; + padding-right:10px; } /* start of section to allow mainmenu items to be on the right and/or without text */ ul.gf-menu li.floatright { diff --git a/features/styledeclaration.php b/features/styledeclaration.php index 6797828..b2f3533 100644 --- a/features/styledeclaration.php +++ b/features/styledeclaration.php @@ -1,6 +1,7 @@ get('enabled'); + var $_feature_name = 'styledeclaration'; + + function isEnabled() { + global $gantry; + $menu_enabled = $this->get('enabled'); - if (1 == (int)$menu_enabled) return true; - return false; - } + if (1 == (int) $menu_enabled) + return true; + return false; + } - function init() { - global $gantry; - $browser = $gantry->browser; + function init() { + global $gantry; + $browser = $gantry->browser; // Colors - $lessVariables = array( - 'linkcolor' => $gantry->get('linkcolor', '#2698de'), - 'headerstyle' => $gantry->get('headerstyle', 'dark') - ); + $lessVariables = array( + 'linkcolor' => $gantry->get('linkcolor', '#2698de'), + 'headerstyle' => $gantry->get('headerstyle', 'dark') + ); - $gantry->addLess('global.less', 'master.css', 8, $lessVariables); + $gantry->addLess('global.less', 'master.css', 8, $lessVariables); // Logo - $css = $this->buildLogo(); - - $this->_disableRokBoxForiPhone(); - - $gantry->addInlineStyle($css); - if ($gantry->get('layout-mode')=="responsive") $gantry->addLess('mediaqueries.less'); - if ($gantry->get('layout-mode')=="960fixed") $gantry->addLess('960fixed.less'); - if ($gantry->get('layout-mode')=="1200fixed") $gantry->addLess('1200fixed.less'); - } - - function buildLogo(){ - global $gantry; - - if ($gantry->get('logo-type')!="custom") return ""; - - $source = $width = $height = ""; - - $logo = str_replace(""", '"', str_replace("'", '"', $gantry->get('logo-custom-image'))); - $data = json_decode($logo); - - if (!$data){ - if (strlen($logo)) $source = $logo; - else return ""; - } else { - $source = $data->path; - } - - if (substr($gantry->baseUrl, 0, strlen($gantry->baseUrl)) == substr($source, 0, strlen($gantry->baseUrl))){ - $file = JPATH_ROOT . '/' . substr($source, strlen($gantry->baseUrl)); - } else { - $file = JPATH_ROOT . '/' . $source; - } - - if (isset($data->width) && isset($data->height)){ - $width = $data->width; - $height = $data->height; - } else { - $size = @getimagesize($file); - $width = $size[0]; - $height = $size[1]; - } - - if (!preg_match('/^\//', $source)) - { - $source = JURI::root(true).'/'.$source; - } + $css = $this->buildLogo(); + + $this->_disableRokBoxForiPhone(); + + $gantry->addInlineStyle($css); + if ($gantry->get('layout-mode') == "responsive") { + $gantry->addLess('mediaqueries.less'); + } + if ($gantry->get('layout-mode') == "960fixed") { + $gantry->addLess('960fixed.less'); + } + if ($gantry->get('layout-mode') == "1200fixed") { + $gantry->addLess('1200fixed.less'); + } + } + + function buildLogo() { + global $gantry; + + if ($gantry->get('logo-type') != "custom") + return ""; + + $source = $width = $height = ""; + + $logo = str_replace(""", '"', str_replace("'", '"', $gantry->get('logo-custom-image'))); + $data = json_decode($logo); + + if (!$data) { + if (strlen($logo)) + $source = $logo; + else + return ""; + } else { + $source = $data->path; + } + + if (substr($gantry->baseUrl, 0, strlen($gantry->baseUrl)) == substr($source, 0, strlen($gantry->baseUrl))) { + $file = JPATH_ROOT . '/' . substr($source, strlen($gantry->baseUrl)); + } else { + $file = JPATH_ROOT . '/' . $source; + } + + if (isset($data->width) && isset($data->height)) { + $width = $data->width; + $height = $data->height; + } else { + if (file_exists($file)) { + $size = getimagesize($file); + $width = $size[0]; + $height = $size[1]; + } + } + + if (!preg_match('/^\//', $source)) { + $source = JURI::root(true) . '/' . $source; + } $source = str_replace(' ', '%20', $source); - $output = ""; - $output .= "#rt-logo {background: url(".$source.") 50% 0 no-repeat !important;}"."\n"; - $output .= "#rt-logo {width: ".$width."px;height: ".$height."px;}"."\n"; - - $file = preg_replace('/\//i', DIRECTORY_SEPARATOR, $file); - - return (file_exists($file)) ?$output : ''; - } - - function _createGradient($direction, $from, $fromOpacity, $fromPercent, $to, $toOpacity, $toPercent){ - global $gantry; - $browser = $gantry->browser; - - $fromColor = $this->_RGBA($from, $fromOpacity); - $toColor = $this->_RGBA($to, $toOpacity); - $gradient = $default_gradient = ''; - - $default_gradient = 'background: linear-gradient('.$direction.', '.$fromColor.' '.$fromPercent.', '.$toColor.' '.$toPercent.');'; - - switch ($browser->engine) { - case 'gecko': - $gradient = ' background: -moz-linear-gradient('.$direction.', '.$fromColor.' '.$fromPercent.', '.$toColor.' '.$toPercent.');'; - break; - - case 'webkit': - if ($browser->shortversion < '5.1'){ - - switch ($direction){ - case 'top': - $from_dir = 'left top'; $to_dir = 'left bottom'; break; - case 'bottom': - $from_dir = 'left bottom'; $to_dir = 'left top'; break; - case 'left': - $from_dir = 'left top'; $to_dir = 'right top'; break; - case 'right': - $from_dir = 'right top'; $to_dir = 'left top'; break; - } - $gradient = ' background: -webkit-gradient(linear, '.$from_dir.', '.$to_dir.', color-stop('.$fromPercent.','.$fromColor.'), color-stop('.$toPercent.','.$toColor.'));'; - } else { - $gradient = ' background: -webkit-linear-gradient('.$direction.', '.$fromColor.' '.$fromPercent.', '.$toColor.' '.$toPercent.');'; - } - break; - - case 'presto': - $gradient = ' background: -o-linear-gradient('.$direction.', '.$fromColor.' '.$fromPercent.', '.$toColor.' '.$toPercent.');'; - break; - - case 'trident': - if ($browser->shortversion >= '10'){ - $gradient = ' background: -ms-linear-gradient('.$direction.', '.$fromColor.' '.$fromPercent.', '.$toColor.' '.$toPercent.');'; - } else if ($browser->shortversion <= '6'){ - $gradient = $from; - $default_gradient = ''; - } else { - - $gradient_type = ($direction == 'left' || $direction == 'right') ? 1 : 0; - $from_nohash = str_replace('#', '', $from); - $to_nohash = str_replace('#', '', $to); - - if (strlen($from_nohash) == 3) $from_nohash = str_repeat(substr($from_nohash, 0, 1), 6); - if (strlen($to_nohash) == 3) $to_nohash = str_repeat(substr($to_nohash, 0, 1), 6); - - if ($fromOpacity == 0 || $fromOpacity == '0' || $fromOpacity == '0%') $from_nohash = '00' . $from_nohash; - if ($toOpacity == 0 || $toOpacity == '0' || $toOpacity == '0%') $to_nohash = '00' . $to_nohash; - - $gradient = " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#".$to_nohash."', endColorstr='#".$from_nohash."',GradientType=".$gradient_type." );"; - - $default_gradient = ''; - - } - break; - - default: - $gradient = $from; - $default_gradient = ''; - break; - } - - return $default_gradient . $gradient; - } - - function _HEX2RGB($hexStr, $returnAsString = false, $seperator = ','){ - $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); - $rgbArray = array(); - - if (strlen($hexStr) == 6){ - $colorVal = hexdec($hexStr); - $rgbArray['red'] = 0xFF & ($colorVal >> 0x10); - $rgbArray['green'] = 0xFF & ($colorVal >> 0x8); - $rgbArray['blue'] = 0xFF & $colorVal; - } elseif (strlen($hexStr) == 3){ - $rgbArray['red'] = hexdec(str_repeat(substr($hexStr, 0, 1), 2)); - $rgbArray['green'] = hexdec(str_repeat(substr($hexStr, 1, 1), 2)); - $rgbArray['blue'] = hexdec(str_repeat(substr($hexStr, 2, 1), 2)); - } else { - return false; - } - - return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; - } - - function _RGBA($hex, $opacity){ - return 'rgba(' . $this->_HEX2RGB($hex, true) . ','.$opacity.')'; - } - - function _disableRokBoxForiPhone() { - global $gantry; - - if ($gantry->browser->platform == 'iphone' || $gantry->browser->platform == 'android') { - $gantry->addInlineScript("window.addEvent('domready', function() {\$\$('a[rel^=rokbox]').removeEvents('click');});"); - } - } + $output = ""; + $output .= "#rt-logo {background: url(" . $source . ") 50% 0 no-repeat !important;}" . "\n"; + $output .= "#rt-logo {width: " . $width . "px;height: " . $height . "px;}" . "\n"; + + $file = preg_replace('/\//i', DIRECTORY_SEPARATOR, $file); + + return (file_exists($file)) ? $output : ''; + } + + function _createGradient($direction, $from, $fromOpacity, $fromPercent, $to, $toOpacity, $toPercent) { + global $gantry; + $browser = $gantry->browser; + + $fromColor = $this->_RGBA($from, $fromOpacity); + $toColor = $this->_RGBA($to, $toOpacity); + $gradient = $default_gradient = ''; + + $default_gradient = 'background: linear-gradient(' . $direction . ', ' . $fromColor . ' ' . $fromPercent . ', ' . $toColor . ' ' . $toPercent . ');'; + + switch ($browser->engine) { + case 'gecko': + $gradient = ' background: -moz-linear-gradient(' . $direction . ', ' . $fromColor . ' ' . $fromPercent . ', ' . $toColor . ' ' . $toPercent . ');'; + break; + + case 'webkit': + if ($browser->shortversion < '5.1') { + + switch ($direction) { + case 'top': + $from_dir = 'left top'; + $to_dir = 'left bottom'; + break; + case 'bottom': + $from_dir = 'left bottom'; + $to_dir = 'left top'; + break; + case 'left': + $from_dir = 'left top'; + $to_dir = 'right top'; + break; + case 'right': + $from_dir = 'right top'; + $to_dir = 'left top'; + break; + } + $gradient = ' background: -webkit-gradient(linear, ' . $from_dir . ', ' . $to_dir . ', color-stop(' . $fromPercent . ',' . $fromColor . '), color-stop(' . $toPercent . ',' . $toColor . '));'; + } else { + $gradient = ' background: -webkit-linear-gradient(' . $direction . ', ' . $fromColor . ' ' . $fromPercent . ', ' . $toColor . ' ' . $toPercent . ');'; + } + break; + + case 'presto': + $gradient = ' background: -o-linear-gradient(' . $direction . ', ' . $fromColor . ' ' . $fromPercent . ', ' . $toColor . ' ' . $toPercent . ');'; + break; + + case 'trident': + if ($browser->shortversion >= '10') { + $gradient = ' background: -ms-linear-gradient(' . $direction . ', ' . $fromColor . ' ' . $fromPercent . ', ' . $toColor . ' ' . $toPercent . ');'; + } else if ($browser->shortversion <= '6') { + $gradient = $from; + $default_gradient = ''; + } else { + + $gradient_type = ($direction == 'left' || $direction == 'right') ? 1 : 0; + $from_nohash = str_replace('#', '', $from); + $to_nohash = str_replace('#', '', $to); + + if (strlen($from_nohash) == 3) + $from_nohash = str_repeat(substr($from_nohash, 0, 1), 6); + if (strlen($to_nohash) == 3) + $to_nohash = str_repeat(substr($to_nohash, 0, 1), 6); + + if ($fromOpacity == 0 || $fromOpacity == '0' || $fromOpacity == '0%') + $from_nohash = '00' . $from_nohash; + if ($toOpacity == 0 || $toOpacity == '0' || $toOpacity == '0%') + $to_nohash = '00' . $to_nohash; + + $gradient = " filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#" . $to_nohash . "', endColorstr='#" . $from_nohash . "',GradientType=" . $gradient_type . " );"; + + $default_gradient = ''; + } + break; + + default: + $gradient = $from; + $default_gradient = ''; + break; + } + + return $default_gradient . $gradient; + } + + function _HEX2RGB($hexStr, $returnAsString = false, $seperator = ',') { + $hexStr = preg_replace("/[^0-9A-Fa-f]/", '', $hexStr); + $rgbArray = array(); + + if (strlen($hexStr) == 6) { + $colorVal = hexdec($hexStr); + $rgbArray['red'] = 0xFF & ($colorVal >> 0x10); + $rgbArray['green'] = 0xFF & ($colorVal >> 0x8); + $rgbArray['blue'] = 0xFF & $colorVal; + } elseif (strlen($hexStr) == 3) { + $rgbArray['red'] = hexdec(str_repeat(substr($hexStr, 0, 1), 2)); + $rgbArray['green'] = hexdec(str_repeat(substr($hexStr, 1, 1), 2)); + $rgbArray['blue'] = hexdec(str_repeat(substr($hexStr, 2, 1), 2)); + } else { + return false; + } + + return $returnAsString ? implode($seperator, $rgbArray) : $rgbArray; + } + + function _RGBA($hex, $opacity) { + return 'rgba(' . $this->_HEX2RGB($hex, true) . ',' . $opacity . ')'; + } + + function _disableRokBoxForiPhone() { + global $gantry; + + if ($gantry->browser->platform == 'iphone' || $gantry->browser->platform == 'android') { + $gantry->addInlineScript("window.addEvent('domready', function() {\$\$('a[rel^=rokbox]').removeEvents('click');});"); + } + } + } diff --git a/images/download.png b/images/download.png new file mode 100644 index 0000000000000000000000000000000000000000..3c02d17e1b2104fbda2bfc88f32373bc261a9d89 GIT binary patch literal 70 zcmeAS@N?(olHy`uVBq!ia0vp^AT}2V6Od#IhmdKI;Vst0E9jb6951J literal 0 HcmV?d00001 diff --git a/templateDetails.xml b/templateDetails.xml index a5668db..5e290f0 100644 --- a/templateDetails.xml +++ b/templateDetails.xml @@ -7,7 +7,7 @@ http://www.gnu.org/copyleft/gpl.html GNU/GPL support@rockettheme.com http://www.rockettheme.com - 2.2.10 + 2.2.11 RA 2.2.10 - Based on Gantry 4 Starting Template 4.1.43 false false