1. <?php
    2. /**
    3. * Description of ElasticaAutoLoader
    4. *
    5. * @author Owner
    6. */
    7. //extends CApplicationComponent
    8. class ElasticaAutoLoader {
    9. /**
    10. * @var array class prefixes
    11. */
    12. static $prefixes = array(
    13. 'Elastica'
    14. );
    15. /**
    16. * @var string path to where Zend classes root is located
    17. */
    18. static $basePath = null;
    19. /**
    20. * Class autoload loader.
    21. *
    22. * @static
    23. * @param string $className
    24. * @return boolean
    25. */
    26. static function loadClass($className) {
    27. foreach (self::$prefixes as $prefix) {
    28. if (strpos($className, $prefix . '\\') !== false) {
    29. if (!self::$basePath)
    30. self::$basePath =
    31. Yii::getPathOfAlias("application.vendor") . '/';
    32. include self::$basePath . str_replace('_', '/', $className) . '.php';
    33. return class_exists($className, false) ||
    34. interface_exists($className, false);
    35. }
    36. }
    37. return false;
    38. }
    39. }
    40. ?>