PageRenderTime 16ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/library/Zend/View/Helper/Layout.php

https://bitbucket.org/hamidrezas/melobit
PHP | 81 lines | 26 code | 6 blank | 49 comment | 2 complexity | 4c432a908482b1d1088a3749496854db MD5 | raw file
Possible License(s): AGPL-1.0
  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_View
  17. * @subpackage Helper
  18. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  19. * @version $Id: Layout.php 24594 2012-01-05 21:27:01Z matthew $
  20. * @license http://framework.zend.com/license/new-bsd New BSD License
  21. */
  22. /** Zend_View_Helper_Abstract.php */
  23. require_once 'Zend/View/Helper/Abstract.php';
  24. /**
  25. * View helper for retrieving layout object
  26. *
  27. * @package Zend_View
  28. * @subpackage Helper
  29. * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
  30. * @license http://framework.zend.com/license/new-bsd New BSD License
  31. */
  32. class Zend_View_Helper_Layout extends Zend_View_Helper_Abstract
  33. {
  34. /** @var Zend_Layout */
  35. protected $_layout;
  36. /**
  37. * Get layout object
  38. *
  39. * @return Zend_Layout
  40. */
  41. public function getLayout()
  42. {
  43. if (null === $this->_layout) {
  44. require_once 'Zend/Layout.php';
  45. $this->_layout = Zend_Layout::getMvcInstance();
  46. if (null === $this->_layout) {
  47. // Implicitly creates layout object
  48. $this->_layout = new Zend_Layout();
  49. }
  50. }
  51. return $this->_layout;
  52. }
  53. /**
  54. * Set layout object
  55. *
  56. * @param Zend_Layout $layout
  57. * @return Zend_Layout_Controller_Action_Helper_Layout
  58. */
  59. public function setLayout(Zend_Layout $layout)
  60. {
  61. $this->_layout = $layout;
  62. return $this;
  63. }
  64. /**
  65. * Return layout object
  66. *
  67. * Usage: $this->layout()->setLayout('alternate');
  68. *
  69. * @return Zend_Layout
  70. */
  71. public function layout()
  72. {
  73. return $this->getLayout();
  74. }
  75. }