PageRenderTime 39ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/exchange/code/trunk/administrator/components/com_exchange/models/export.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 66 lines | 41 code | 7 blank | 18 comment | 2 complexity | 351975f2cad8ba0940943fb07e9f909a MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: export.php 280 2010-09-18 02:14:15Z eddieajau $
  4. * @package NewLifeInIT
  5. * @subpackage com_exchange
  6. * @copyright Copyright 2005 - 2010 New Life in IT Pty Ltd. All rights reserved.
  7. * @license GNU General Public License version 2 or later.
  8. * @link http://www.theartofjoomla.com
  9. */
  10. // no direct access
  11. defined('_JEXEC') or die;
  12. jimport('joomla.application.component.model');
  13. jimport('joomla.filesystem.file');
  14. /**
  15. * @package NewLifeInIT
  16. * @subpackage com_exchange
  17. */
  18. class ExchangeModelExport extends JModel
  19. {
  20. /**
  21. * Get a list of the paths to search for definition files
  22. *
  23. * @return array
  24. */
  25. protected function getPaths()
  26. {
  27. $paths = array(
  28. 'builtin' => JPATH_COMPONENT.DS.'adapters'.DS.'export',
  29. 'custom' => JPATH_ADMINISTRATOR.DS.'custom'.DS.'com_exchange'.DS.'export'
  30. );
  31. return $paths;
  32. }
  33. function getTables()
  34. {
  35. $db = &$this->getDBO();
  36. return $db->getTableList();
  37. }
  38. function getAdapters()
  39. {
  40. $result = array();
  41. $paths = self::getPaths();
  42. foreach ($paths as $type => $path) {
  43. if (is_dir($path)) {
  44. $files = JFolder::files($path, '\.php$', false, true);
  45. foreach ($files as $file)
  46. {
  47. require_once($file);
  48. $name = JFile::stripExt(basename($file));
  49. if (file_exists($path.DS.$name.'.xml')) {
  50. $result[$name] = simplexml_load_file($path.DS.$name.'.xml');
  51. } else{
  52. $result[$name] = null;
  53. }
  54. }
  55. }
  56. }
  57. return $result;
  58. }
  59. }