PageRenderTime 35ms CodeModel.GetById 8ms RepoModel.GetById 0ms app.codeStats 0ms

/aamenu/code/trunk/administrator/components/com_aamenu/libraries/jxtended.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 68 lines | 39 code | 7 blank | 22 comment | 8 complexity | 83d6c5d6a26e5455955c9267ff5fffb5 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: jxtended.php 255 2010-08-20 09:43:07Z eddieajau $
  4. * @package JXtended.Libraries
  5. * @subpackage plgSystemJXtended
  6. * @copyright Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
  7. * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
  8. * @link http://jxtended.com
  9. */
  10. defined('JPATH_BASE') or die;
  11. if (!defined('JX_LIBRARIES')) {
  12. define('JX_LIBRARIES', '1.0.9');
  13. }
  14. /**
  15. * JXtended intelligent file importer.
  16. *
  17. * @param string $path A dot syntax path.
  18. *
  19. * @return boolean True on success
  20. * @since 1.0.0
  21. */
  22. function jximport($path)
  23. {
  24. static $base;
  25. if (!$base) {
  26. $base = realpath(dirname(__FILE__));
  27. }
  28. if (strpos($path, 'jxtended') === 0) {
  29. return JLoader::import($path, $base, '');
  30. } else {
  31. return JLoader::import($path, null, 'libraries.');
  32. }
  33. }
  34. /**
  35. * JXtended JavaScript language string support function.
  36. *
  37. * @return void
  38. * @since 1.0.5
  39. */
  40. function jxjslanginject()
  41. {
  42. $app = JFactory::getApplication();
  43. $doc = JFactory::getDocument();
  44. if ($doc->getType() == 'html') {
  45. $lang = $app->get('jx.jslang', array());
  46. if (!empty($lang)) {
  47. $txt = '{';
  48. foreach ($lang as $k => $v)
  49. {
  50. $txt .= $k.':"'.$v.'",';
  51. }
  52. if (strlen($txt) > 1) {
  53. $txt = substr($txt, 0, strlen($txt) - 1);
  54. }
  55. $txt .= '}';
  56. $doc->addScriptDeclaration(' JXLang='.$txt.';');
  57. }
  58. }
  59. }
  60. $dispatcher = JDispatcher::getInstance();
  61. $dispatcher->register('onAfterDispatch', 'jxjslanginject');