/joomla/meta/customization/rt_quasar_j15/features/fontsizer.php
PHP | 63 lines | 47 code | 6 blank | 10 comment | 4 complexity | 53c8e321e537a517815e941edc74da1f MD5 | raw file
Possible License(s): BSD-3-Clause
- <?php
- /**
- * @package Gantry Template Framework - RocketTheme
- * @version @VERSION@ @BUILD_DATE@
- * @author RocketTheme http://www.rockettheme.com
- * @copyright Copyright (C) 2007 - @COPYRIGHT_YEAR@ RocketTheme, LLC
- * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
- *
- * Gantry uses the Joomla Framework (http://www.joomla.org), a GNU/GPLv2 content management system
- *
- */
- defined('JPATH_BASE') or die();
- gantry_import('core.gantryfeature');
- class GantryFeatureFontSizer extends GantryFeature {
- var $_feature_name = 'fontsizer';
-
- function init() {
- global $gantry;
- $fontsize = $gantry->get('font-size');
- $current_fontsize = $gantry->get('font-size-is');
- $font_sizes = array(
- 0=>"xsmall",
- 1=>"small",
- 2=>"default",
- 3=>"large",
- 4=>"xlarge"
- );
- $current = array_search($current_fontsize, $font_sizes);
- if ($current !== false){
- switch ($fontsize){
- case 'smaller':
- if ($current > 0) $current--;
- break;
- case 'larger':
- if ($current < count($font_sizes)-1) $current++;
- break;
- }
- $gantry->set('font-size-is', $font_sizes[$current]);
- }
- }
-
- function render($position="") {
- global $gantry;
- ob_start();
- ?>
- <div class="rt-block">
- <div id="rt-accessibility">
- <div class="rt-desc"><?php echo JText::_('TEXT_SIZE'); ?></div>
- <div id="rt-buttons">
- <a href="<?php echo JROUTE::_($gantry->getCurrentUrl() . "font-size=larger"); ?>" title="<?php echo JText::_('INC_FONT_SIZE'); ?>" class="large"><span class="button"></span></a>
- <a href="<?php echo JROUTE::_($gantry->getCurrentUrl() . "font-size=smaller"); ?>" title="<?php echo JText::_('DEC_FONT_SIZE'); ?>" class="small"><span class="button"></span></a>
- </div>
- </div>
- <div class="clear"></div>
- </div>
- <?php
- return ob_get_clean();
- }
- }