|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_Tool |
|
17 * @subpackage Framework |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
20 * @version $Id: Engine.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * @see Zend_Tool_Project_Context_Content_Engine_CodeGenerator |
|
25 */ |
|
26 require_once 'Zend/Tool/Project/Context/Content/Engine/CodeGenerator.php'; |
|
27 |
|
28 /** |
|
29 * @see Zend_Tool_Project_Context_Content_Engine_Phtml |
|
30 */ |
|
31 require_once 'Zend/Tool/Project/Context/Content/Engine/Phtml.php'; |
|
32 |
|
33 /** |
|
34 * This class is the front most class for utilizing Zend_Tool_Project |
|
35 * |
|
36 * A profile is a hierarchical set of resources that keep track of |
|
37 * items within a specific project. |
|
38 * |
|
39 * @category Zend |
|
40 * @package Zend_Tool |
|
41 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
42 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
43 */ |
|
44 class Zend_Tool_Project_Context_Content_Engine |
|
45 { |
|
46 /** |
|
47 * @var Zend_Tool_Framework_Client_Storage |
|
48 */ |
|
49 protected $_storage = null; |
|
50 |
|
51 /** |
|
52 * @var string |
|
53 */ |
|
54 protected $_keyInStorage = 'project/content'; |
|
55 |
|
56 /** |
|
57 * @var array |
|
58 */ |
|
59 protected $_engines = array(); |
|
60 |
|
61 /** |
|
62 * __construct() |
|
63 * |
|
64 * @param Zend_Tool_Framework_Client_Storage $storage |
|
65 */ |
|
66 public function __construct(Zend_Tool_Framework_Client_Storage $storage) |
|
67 { |
|
68 $this->_storage = $storage; |
|
69 $this->_engines = array( |
|
70 new Zend_Tool_Project_Context_Content_Engine_CodeGenerator($storage, $this->_keyInStorage), |
|
71 new Zend_Tool_Project_Context_Content_Engine_Phtml($storage, $this->_keyInStorage), |
|
72 ); |
|
73 } |
|
74 |
|
75 /** |
|
76 * getContent() |
|
77 * |
|
78 * @param Zend_Tool_Project_Context_Interface $context |
|
79 * @param string $methodName |
|
80 * @param mixed $parameters |
|
81 * @return string |
|
82 */ |
|
83 public function getContent(Zend_Tool_Project_Context_Interface $context, $methodName, $parameters) |
|
84 { |
|
85 $content = null; |
|
86 |
|
87 foreach ($this->_engines as $engine) { |
|
88 if ($engine->hasContent($context, $methodName, $parameters)) { |
|
89 $content = $engine->getContent($context, $methodName, $parameters); |
|
90 |
|
91 if ($content != null) { |
|
92 break; |
|
93 } |
|
94 |
|
95 } |
|
96 |
|
97 } |
|
98 |
|
99 if ($content == null) { |
|
100 return false; |
|
101 } |
|
102 |
|
103 return $content; |
|
104 } |
|
105 |
|
106 } |