diff --git a/helper.class.php b/helper.class.php index 2962864..8ab70d5 100644 --- a/helper.class.php +++ b/helper.class.php @@ -3,7 +3,46 @@ class ThisTemplateHelper { - static public function isHome() + public function getDocument() + { + return JFactory::getDocument(); + } + + public function adjustHead($template) + { + // Determine the variables + $doc = $this->getDocument(); + $head = $doc->getHeadData(); + $site_title = $template->params->get('sitetitle'); + + // remove deprecated meta-data (html5) + //unset($head['metaTags']['http-equiv']); + //unset($head['metaTags']['standard']['title']); + //unset($head['metaTags']['standard']['rights']); + //unset($head['metaTags']['standard']['language']); + + // Robots if you wish + //unset($head['metaTags']['standard']['robots']); + + $doc->setHeadData($head); + + // New meta + //$doc->setMetadata( 'X-UA-Compatible', 'IE=edge,chrome=1' ); + //$doc->setMetadata( 'viewport', 'width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes' ); + //$doc->setMetadata( 'HandheldFriendly', 'true' ); + //$doc->setMetadata( 'apple-mobile-web-app-capable', 'yes' ); + //$doc->setMetadata( 'copyright', $site_title ); + + //Yandex and Google Webmaster-tools if you wish + //$doc->setMetadata('yandex-verification', 'xxxxxxxxxxxxxxxx'); + //$doc->setMetadata('google-verification', 'xxxxxxxxxxxxxxxx'); + + // Remove or rewrite + //$doc->setGenerator(''); + $doc->setGenerator($site_title); + } + + public function isHome() { // Fetch the active menu-item $menu = JFactory::getApplication()->getMenu(); @@ -13,13 +52,13 @@ static public function isHome() return (boolean)$active->home; } - static public function loadCss($template) + public function loadCss($template) { // Determine the variables + $doc = JFactory::getDocument(); $cssmode = $template->params->get('cssmode', 'css'); $templateUrl = 'templates/'.$template->template; $templateDir = JPATH_SITE.'/templates/'.$template->template.'/'; - $doc = JFactory::getDocument(); $versionLess = '1.6.3'; $versionBootstrap = '3.2.0'; @@ -30,16 +69,14 @@ static public function loadCss($template) unset($doc->_styleSheets['/components/com_rsform/assets/css/front.css']); // Google Fonts - $doc->addStyleSheet('//fonts.googleapis.com/css?family=Roboto:400,300,700'); - $doc->addStyleSheet('//fonts.googleapis.com/css?family=Roboto+Slab:400,300,700'); - $doc->addStyleSheet('//fonts.googleapis.com/css?family=Roboto+Condensed:400,700,300'); + $doc->addStyleSheet('//fonts.googleapis.com/css?family=Open+Sans:400,300,700'); switch($cssmode) { case 'lessjs': // Load LESS.js $doc->addStyleSheet($templateUrl.'/less/template.less','text/less'); - $doc->addScript($templateUrl.'/js/cloudflare/less.compiler.params.js'); // @todo: jisse: Why CloudFlare??? + $doc->addScript($templateUrl.'/js/less.compiler.params.js'); $doc->addScript('//cdnjs.cloudflare.com/ajax/libs/less.js/' . $versionLess . '/less.min.js'); unset($doc->_scripts[JPATH_SITE.'/media/jui/js/bootstrap.min.js']); $doc->addScript('//netdna.bootstrapcdn.com/bootstrap/' . $versionBootstrap . '/js/bootstrap.min.js'); @@ -78,4 +115,138 @@ static public function loadCss($template) $doc->addStyleSheet($templateUrl.'/css/compiled.css'); } } + + public function getAnalytics($template) + { + // Determine the variables + $doc = JFactory::getDocument(); + $analytics = $template->params->get('analytics',0); + $analyticsId = $template->params->get('analyticsid'); + + // Analytics + switch ($analytics) { + case 0: + break; + case 1: + // Google Analytics - load in head + if($analyticsId) { + $analyticsScript = " + + var _gaq = _gaq || []; + _gaq.push(['_setAccount', '" . $analyticsId . "']); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); + "; + $doc->addScriptDeclaration($analyticsScript); + } + break; + case 2: + // Universal Google Universal Analytics - load in head + if($analyticsId) { + $analyticsScript = " + + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', '" . $analyticsId . "', 'auto'); + ga('send', 'pageview'); + "; + $doc->addScriptDeclaration($analyticsScript); + } + break; + case 3: + // Google Analytics - load in head + if($analyticsId) { + $analyticsScript = " + + + + + + "; + return array('script' => $analyticsScript, 'position' => 'after_body_start'); + } + break; + } + } + + public function getLogo($template) + { + // Determine the variables + $sitebrand = $template->params->get('sitebrand',0); + $site_title = $template->params->get('sitetitle'); + $site_tagline = $template->params->get('sitetagline'); + $site_logo = $template->params->get('sitelogo'); + $site_logosvg = $template->params->get('sitelogosvg'); + $site_url = JURI::root(); + + // Site Logo + switch ($sitebrand) { + case 0: + break; + case 1: + // using an image + if ($site_logo AND $site_title) + { + $logo = '' . htmlspecialchars($site_title) . ''; + return $logo; + } + break; + case 2: + // using an SVG image + if ($site_logosvg AND $site_title) + { + $logo = '' . htmlspecialchars($site_title) . ''; + // using SVGInjector to inject the image + $this->getSVGInjector($template); + return $logo; + } + break; + case 3: + // using the title + if ($site_title) + { + $logo .= '' . htmlspecialchars($site_title) . ''; + return $logo; + } + break; + case 4: + // using the title and the tag line + if ($site_title AND $site_tagline) + { + $logo .= '' . htmlspecialchars($site_title) . '' . htmlspecialchars($site_tagline) . ''; + return $logo; + } + break; + case 5: + // using the tag line + if ($site_tagline) + { + $logo .= '' . htmlspecialchars($site_tagline) . ''; + return $logo; + } + break; + } + } + + public function getSVGInjector($template) + { + // Determine the variables + $doc = $this->getDocument(); + $templateUrl = 'templates/'.$template->template; + + $doc->addScript($templateUrl.'js/svg-injector/svg-injector.min.js'); + } } diff --git a/helper.php b/helper.php index d6ef20f..4883b4d 100644 --- a/helper.php +++ b/helper.php @@ -15,36 +15,6 @@ $browser = JBrowser::getInstance(); $config = JFactory::getConfig(); $template = 'templates/' . $this->template; -$logo_image = $this->params->get('logoFile'); -$site_title = $config->get('sitename'); -$site_desc = $this->params->get('sitedescription'); -$analytics = $this->params->get('analytics'); -$analyticsId = $this->params->get('analyticsid'); - -// get html head data -$head = $doc->getHeadData(); -// remove deprecated meta-data (html5) -unset($head['metaTags']['http-equiv']); -unset($head['metaTags']['standard']['title']); -unset($head['metaTags']['standard']['rights']); -unset($head['metaTags']['standard']['language']); -// Robots if you wish -//unset($head['metaTags']['standard']['robots']); -$doc->setHeadData($head); - -// New meta -$doc->setMetadata( 'X-UA-Compatible', 'IE=edge,chrome=1' ); -$doc->setMetadata( 'viewport', 'width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes' ); -$doc->setMetadata( 'HandheldFriendly', 'true' ); -$doc->setMetadata( 'apple-mobile-web-app-capable', 'yes' ); -$doc->setMetadata( 'copyright', $site_title ); -//Yandex and Google Webmaster-tools if you wish -//$doc->setMetadata('yandex-verification', 'xxxxxxxxxxxxxxxx'); -//$doc->setMetadata('google-verification', 'xxxxxxxxxxxxxxxx'); - -// Remove or rewrite -//$doc->setGenerator(''); -$doc->setGenerator($site_title); // Detecting Active Variables $option = $app->input->getCmd('option', ''); @@ -52,27 +22,45 @@ $layout = $app->input->getCmd('layout', ''); $task = $app->input->getCmd('task', ''); $itemid = $app->input->getCmd('Itemid', ''); -$sitename = $app->getCfg('sitename'); $grid = 12; $gridSidebar = 3; $gridSidebarPos = 'left'; $gridSidebarOffset = 1; +// Instantiate the helper class +$helper = new ThisTemplateHelper(); -// To enable use of site configuration -$pageParams = $app->getParams(); +// Include adjust meta tags in HEAD +$helper->adjustHead($this); -// Determine home (@todo: What is this, Hans?) -if(ThisTemplateHelper::isHome()) { +// Include CSS +$helper->loadCss($this); + +// Include Analytics +$analyticsData = $helper->getAnalytics($this); + +// Logo +$logo = $helper->getLogo($this); + +// Load SVG Injection +if ($this->params->get('svginjection')) +{ + $helper->getSVGInjector($this); +} + + + + + + +// Determine home +if($helper->isHome()) { $siteHome = "home"; } else { $siteHome = "sub"; } -// Include CSS -ThisTemplateHelper::loadCss($this); - // Add scripts $doc->addScript($template.'/js/application.js'); if($browser->getBrowser() == 'msie' && $browser->getMajor() < 9 ) { @@ -84,59 +72,15 @@ // Determine whether to show sidebar-A (@todo: Jisse, clean up this mess) $SidebarA = false; -//$SidebarAMageBridgePages = array('customer', 'membership', 'software', 'sales'); -//hideLeftMageBridgePages = array('customer/account/login'); -//$hideLeftMenuItems = array(11, 185, 282, 308, 316, 332, 348, 353, 354, 355, 362, 380); if ($this->countModules('left')) $SidebarA = true; -//if ($this->countModules('left-usermenu') && JFactory::getUser()->guest == 0) $SidebarA = true; -//if (JRequest::getCmd('option') == 'com_magebridge' && $magebridge->isPage($SidebarAMageBridgePages) == false) $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_magebridge' && $magebridge->isPage($hideLeftMageBridgePages)) $SidebarA = false; if (!empty($active) && $active->home == true) $SidebarA = false; -//if (in_array(JRequest::getCmd('Itemid'), $hideLeftMenuItems)) $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_search') $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_kunena') $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_simplelists' && JRequest::getInt('category_id') == 239) $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_products' && JRequest::getCmd('view') == 'extension') $SidebarA = true; -//if (JRequest::getCmd('option') == 'com_products' && JRequest::getCmd('view') == 'extensions') $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_products' && JRequest::getCmd('view') == 'services') $SidebarA = false; -//if (JRequest::getCmd('option') == 'com_products' && JRequest::getCmd('view') == 'platform') $SidebarA = false; + // Check upon the current page layout $pagelayout = $this->params->get('pagelayout', '1column'); if($SidebarA == true) $pagelayout = '2column-left'; - - -// Favicon -if ($this->params->get('templateFavicon')) -{ - $this->addFavicon(JURI::root() . $this->params->get('templateFavicon')); -} - -// Logo -if ($logo_image) -{ - // Custom logo image - $logo = '' . $sitename . ''; -} -elseif (($site_title) && ($site_desc)) -{ - // Title and description - $logo = '' . htmlspecialchars($site_title) . '' . htmlspecialchars($site_desc) . ''; -} -elseif (($site_title) && (!$site_desc)) -{ - // Title only - $logo = '' . htmlspecialchars($site_title) . ''; -} -else -{ - // Load default template logo - $logo = '' . $sitename . ''; -} - - // Width calculations $span = ''; @@ -160,59 +104,3 @@ $span = $grid; } -// Analytics -switch ($analytics) { - case 0: - break; - case 1: - // Google Analytics - load in head - if($analyticsId) { - $analyticsScript = " - - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '" . $analyticsId . "']); - _gaq.push(['_trackPageview']); - - (function() { - var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; - ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; - var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); - })(); -"; - $doc->addScriptDeclaration($analyticsScript); - } - break; - case 2: - // Universal Google Universal Analytics - load in head - if($analyticsId) { - $analyticsScript = " - - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - - ga('create', '" . $analyticsId . "', 'auto'); - ga('send', 'pageview'); -"; - $doc->addScriptDeclaration($analyticsScript); - } - break; - case 3: - // Google Analytics - load in head - $isAnalyticsGTM = true; - if($analyticsId) { - $analyticsScript = " - - - - -"; - } - break; -} \ No newline at end of file diff --git a/index.php b/index.php index 787d958..c6c4ebd 100644 --- a/index.php +++ b/index.php @@ -17,8 +17,8 @@ " itemscope itemtype="http://schema.org/WebPage"> @@ -125,28 +125,52 @@
+
- countModules('footer2')): ?> -
+ + + - Back to Top + countModules('debug')): ?> + + diff --git a/layout/2column-left.php b/layout/2column-left.php index 8285b9b..0bcb7b4 100644 --- a/layout/2column-left.php +++ b/layout/2column-left.php @@ -1,7 +1,7 @@ -
+
countModules('content-top')) : ?> diff --git a/layout/2columns-left.php b/layout/2columns-left.php index c4a2a05..0bcb7b4 100644 --- a/layout/2columns-left.php +++ b/layout/2columns-left.php @@ -1,7 +1,7 @@ -
+
countModules('content-top')) : ?> @@ -18,4 +18,4 @@ \ No newline at end of file + diff --git a/templateDetails.xml b/templateDetails.xml index d3ad1fd..db5d2eb 100644 --- a/templateDetails.xml +++ b/templateDetails.xml @@ -7,7 +7,7 @@ http://www.hkweb.nl HKweb 2014 GNU/GPL - 1.0.3 + 1.0.4 TPL_THISTEMPLATE_XML_DESCRIPTION @@ -41,24 +41,80 @@ content-bottom main-bottom bottom + contact footer + copyright
+ + + + + + + + + + + + + + + + + - - - - - + + + + + - - - - + + + +
+ + + + +