|
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: Phtml.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
21 */ |
|
22 |
|
23 /** |
|
24 * This class is the front most class for utilizing Zend_Tool_Project |
|
25 * |
|
26 * A profile is a hierarchical set of resources that keep track of |
|
27 * items within a specific project. |
|
28 * |
|
29 * @category Zend |
|
30 * @package Zend_Tool |
|
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
32 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
33 */ |
|
34 class Zend_Tool_Project_Context_Content_Engine_Phtml |
|
35 { |
|
36 |
|
37 /** |
|
38 * @var Zend_Tool_Framework_Client_Storage |
|
39 */ |
|
40 protected $_storage = null; |
|
41 |
|
42 /** |
|
43 * @var string |
|
44 */ |
|
45 protected $_contentPrefix = null; |
|
46 |
|
47 /** |
|
48 * __construct() |
|
49 * |
|
50 * @param Zend_Tool_Framework_Client_Storage $storage |
|
51 * @param string $contentPrefix |
|
52 */ |
|
53 public function __construct(Zend_Tool_Framework_Client_Storage $storage, $contentPrefix) |
|
54 { |
|
55 $this->_storage = $storage; |
|
56 $this->_contentPrefix = $contentPrefix; |
|
57 } |
|
58 |
|
59 /** |
|
60 * hasContext() |
|
61 * |
|
62 * @param Zend_Tool_Project_Context_Interface $context |
|
63 * @param string $method |
|
64 * @return string |
|
65 */ |
|
66 public function hasContent(Zend_Tool_Project_Context_Interface $context, $method) |
|
67 { |
|
68 return $this->_storage->has($this->_contentPrefix . '/' . $context . '/' . $method . '.phtml'); |
|
69 } |
|
70 |
|
71 /** |
|
72 * getContent() |
|
73 * |
|
74 * @param Zend_Tool_Project_Context_Interface $context |
|
75 * @param string $method |
|
76 * @param mixed $parameters |
|
77 */ |
|
78 public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters) |
|
79 { |
|
80 $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml'); |
|
81 |
|
82 ob_start(); |
|
83 include $streamUri; |
|
84 $content = ob_get_clean(); |
|
85 |
|
86 return $content; |
|
87 } |
|
88 |
|
89 } |