PageRenderTime 826ms CodeModel.GetById 35ms RepoModel.GetById 1ms app.codeStats 0ms

/exchange/code/trunk/administrator/components/com_exchange/helpers/catalog.php

https://bitbucket.org/eddieajau/the-art-of-joomla-archive
PHP | 38 lines | 23 code | 2 blank | 13 comment | 5 complexity | 8f1072d98288dcef136cbd02c7353454 MD5 | raw file
  1. <?php
  2. /**
  3. * @version $Id: catalog.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. /**
  13. * @package NewLifeInIT
  14. * @subpackage com_exchange
  15. */
  16. function lookupTaxonId($value, $typeId, $log = false)
  17. {
  18. if (($value != '') and ($typeId != ''))
  19. {
  20. $db = JFactory::getDBO();
  21. $clean = trim(strtolower($value));
  22. $query = 'SELECT id' .
  23. ' FROM #__jxcatalog_taxa' .
  24. ' WHERE title = '.$db->Quote($clean) .
  25. ' AND type_id = '.(int) $typeId;
  26. $db->setQuery($query);
  27. $data = $db->loadResult();
  28. if ($log) {
  29. ExchangeLog::add(200, $db->getQuery());
  30. }
  31. return $data;
  32. }
  33. else {
  34. return null;
  35. }
  36. }