| @@ -40,20 +40,21 @@ | ||
| 40 | 40 | * @param mixed $path |
| 41 | 41 | * @param mixed $node |
| 42 | 42 | */ |
| 43 | 43 | public function create($current, $path, $node) { |
| 44 | + // Get loader. | |
| 45 | + $loader = CJT_Framework_Autoload_Loader::autoLoad('CJT'); | |
| 44 | 46 | // Get object element class name |
| 45 | 47 | $classPath = "{$this->basePath}/{$path}"; |
| 46 | 48 | $className = 'CJT_' . str_replace(' ', '_', ucwords(str_replace('/', ' ', $classPath))); |
| 47 | 49 | // Instantiate class. |
| 48 | 50 | $object = new $className($node, $current, $this); |
| 49 | - $objectPath = $object->virtualPath(); | |
| 50 | 51 | // Cache all instantiated objects so it can be accessed |
| 51 | 52 | // anywhere inside! |
| 52 | - if (!isset($this->yields[$objectPath])) { | |
| 53 | - $this->yields[$objectPath] = array(); | |
| 53 | + if (!isset($this->yields[$path])) { | |
| 54 | + $this->yields[$path] = array(); | |
| 54 | 55 | } |
| 55 | - $this->yields[$objectPath][] = $object; | |
| 56 | + $this->yields[$path][] = $object; | |
| 56 | 57 | // Return new object. |
| 57 | 58 | return $object; |
| 58 | 59 | } |
| 59 | 60 | |
| @@ -67,25 +68,11 @@ | ||
| 67 | 68 | |
| 68 | 69 | /** |
| 69 | 70 | * put your comment there... |
| 70 | 71 | * |
| 71 | - * @param mixed $class | |
| 72 | - */ | |
| 73 | - public function getClassRelativePath($class) { | |
| 74 | - // Get class path. | |
| 75 | - $classPath = strtolower(str_replace('_', '/', $class)); | |
| 76 | - // Remove base path from the class path. | |
| 77 | - $classRelativePath = str_replace("cjt/{$this->basePath}/", '', $classPath); | |
| 78 | - // returns | |
| 79 | - return $classRelativePath; | |
| 80 | - } | |
| 81 | - | |
| 82 | - /** | |
| 83 | - * put your comment there... | |
| 84 | - * | |
| 85 | 72 | * @param mixed $path |
| 86 | 73 | */ |
| 87 | - public function & getCreatedObjects($path) { | |
| 74 | + public function getCreatedObjects($path) { | |
| 88 | 75 | // Initialize. |
| 89 | 76 | $objects = array(); |
| 90 | 77 | /// E_ALL complans |
| 91 | 78 | if (isset($this->yields[$path])) { |
| @@ -93,9 +80,8 @@ | ||
| 93 | 80 | } |
| 94 | 81 | // Return objects. |
| 95 | 82 | return $objects; |
| 96 | 83 | } |
| 97 | - | |
| 98 | 84 | /** |
| 99 | 85 | * put your comment there... |
| 100 | 86 | * |
| 101 | 87 | * @param mixed $class |
| @@ -101,10 +87,12 @@ | ||
| 101 | 87 | * @param mixed $class |
| 102 | 88 | * @param mixed $path |
| 103 | 89 | */ |
| 104 | 90 | public function obtainRelativePath($class, $innerPath) { |
| 105 | - // Get class path relative to the package doc. | |
| 106 | - $classRelativePath = $this->getClassRelativePath($class); | |
| 91 | + // Get class path. | |
| 92 | + $classPath = strtolower(str_replace('_', '/', $class)); | |
| 93 | + // Remove base path from the class path. | |
| 94 | + $classRelativePath = str_replace("cjt/{$this->basePath}/", '', $classPath); | |
| 107 | 95 | // Build child relatoive path. |
| 108 | 96 | $path = "{$classRelativePath}/{$innerPath}"; |
| 109 | 97 | return $path; |
| 110 | 98 | } |