PageRenderTime 23ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/joomla/meta/customization/rt_quasar_j15/features/fontsizer.php

http://sewebar-cms.googlecode.com/
PHP | 63 lines | 47 code | 6 blank | 10 comment | 4 complexity | 53c8e321e537a517815e941edc74da1f MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * @package Gantry Template Framework - RocketTheme
  4. * @version @VERSION@ @BUILD_DATE@
  5. * @author RocketTheme http://www.rockettheme.com
  6. * @copyright Copyright (C) 2007 - @COPYRIGHT_YEAR@ RocketTheme, LLC
  7. * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 only
  8. *
  9. * Gantry uses the Joomla Framework (http://www.joomla.org), a GNU/GPLv2 content management system
  10. *
  11. */
  12. defined('JPATH_BASE') or die();
  13. gantry_import('core.gantryfeature');
  14. class GantryFeatureFontSizer extends GantryFeature {
  15. var $_feature_name = 'fontsizer';
  16. function init() {
  17. global $gantry;
  18. $fontsize = $gantry->get('font-size');
  19. $current_fontsize = $gantry->get('font-size-is');
  20. $font_sizes = array(
  21. 0=>"xsmall",
  22. 1=>"small",
  23. 2=>"default",
  24. 3=>"large",
  25. 4=>"xlarge"
  26. );
  27. $current = array_search($current_fontsize, $font_sizes);
  28. if ($current !== false){
  29. switch ($fontsize){
  30. case 'smaller':
  31. if ($current > 0) $current--;
  32. break;
  33. case 'larger':
  34. if ($current < count($font_sizes)-1) $current++;
  35. break;
  36. }
  37. $gantry->set('font-size-is', $font_sizes[$current]);
  38. }
  39. }
  40. function render($position="") {
  41. global $gantry;
  42. ob_start();
  43. ?>
  44. <div class="rt-block">
  45. <div id="rt-accessibility">
  46. <div class="rt-desc"><?php echo JText::_('TEXT_SIZE'); ?></div>
  47. <div id="rt-buttons">
  48. <a href="<?php echo JROUTE::_($gantry->getCurrentUrl() . "font-size=larger"); ?>" title="<?php echo JText::_('INC_FONT_SIZE'); ?>" class="large"><span class="button"></span></a>
  49. <a href="<?php echo JROUTE::_($gantry->getCurrentUrl() . "font-size=smaller"); ?>" title="<?php echo JText::_('DEC_FONT_SIZE'); ?>" class="small"><span class="button"></span></a>
  50. </div>
  51. </div>
  52. <div class="clear"></div>
  53. </div>
  54. <?php
  55. return ob_get_clean();
  56. }
  57. }