PageRenderTime 42ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/library/Zend/Tool/Project/Context/Content/Engine/Phtml.php

https://bitbucket.org/dbaltas/zend-framework-1.x-on-git
PHP | 89 lines | 23 code | 9 blank | 57 comment | 0 complexity | 59af4da79ecd2760288889e1441788f6 MD5 | raw file
Possible License(s): BSD-3-Clause, LGPL-2.0, MIT
  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-2012 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 24593 2012-01-05 20:35:02Z matthew $
  21. */
  22. /**
  23. * This class is the front most class for utilizing Zend_Tool_Project
  24. *
  25. * A profile is a hierarchical set of resources that keep track of
  26. * items within a specific project.
  27. *
  28. * @category Zend
  29. * @package Zend_Tool
  30. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  31. * @license http://framework.zend.com/license/new-bsd New BSD License
  32. */
  33. class Zend_Tool_Project_Context_Content_Engine_Phtml
  34. {
  35. /**
  36. * @var Zend_Tool_Framework_Client_Storage
  37. */
  38. protected $_storage = null;
  39. /**
  40. * @var string
  41. */
  42. protected $_contentPrefix = null;
  43. /**
  44. * __construct()
  45. *
  46. * @param Zend_Tool_Framework_Client_Storage $storage
  47. * @param string $contentPrefix
  48. */
  49. public function __construct(Zend_Tool_Framework_Client_Storage $storage, $contentPrefix)
  50. {
  51. $this->_storage = $storage;
  52. $this->_contentPrefix = $contentPrefix;
  53. }
  54. /**
  55. * hasContext()
  56. *
  57. * @param Zend_Tool_Project_Context_Interface $context
  58. * @param string $method
  59. * @return string
  60. */
  61. public function hasContent(Zend_Tool_Project_Context_Interface $context, $method)
  62. {
  63. return $this->_storage->has($this->_contentPrefix . '/' . $context . '/' . $method . '.phtml');
  64. }
  65. /**
  66. * getContent()
  67. *
  68. * @param Zend_Tool_Project_Context_Interface $context
  69. * @param string $method
  70. * @param mixed $parameters
  71. */
  72. public function getContent(Zend_Tool_Project_Context_Interface $context, $method, $parameters)
  73. {
  74. $streamUri = $this->_storage->getStreamUri($this->_contentPrefix . '/' . $context->getName() . '/' . $method . '.phtml');
  75. ob_start();
  76. include $streamUri;
  77. $content = ob_get_clean();
  78. return $content;
  79. }
  80. }