当前位置: 首页>>代码示例>>PHP>>正文


PHP MUtil_Html::getRenderer方法代码示例

本文整理汇总了PHP中MUtil_Html::getRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP MUtil_Html::getRenderer方法的具体用法?PHP MUtil_Html::getRenderer怎么用?PHP MUtil_Html::getRenderer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MUtil_Html的用法示例。


在下文中一共展示了MUtil_Html::getRenderer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

 /**
  * Renders the element into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 public function render(\Zend_View_Abstract $view)
 {
     $results = array();
     $renderer = \MUtil_Html::getRenderer();
     foreach ($this->_array as $item) {
         $result = $renderer->renderAny($view, $item);
         if (null !== $result && strlen($result)) {
             $results[] = $result;
         }
     }
     if ($results) {
         return implode('', $results);
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:22,代码来源:MultiWrapper.php

示例2: _build

 /**
  * Builds the actual <option> tag
  *
  * @param string $value Options Value
  * @param string $label Options Label
  * @param array  $selected The option value(s) to mark as 'selected'
  * @param array|bool $disable Whether the select is disabled, or individual options are
  * @param array $optionClasses The classes to associate with each option value
  * @return string Option Tag XHTML
  */
 protected function _build($value, $label, $selected, $disable, $optionClasses = array())
 {
     if (is_bool($disable)) {
         $disable = array();
     }
     $opt = '<option' . ' value="' . $this->view->escape($value) . '"';
     if ($label instanceof \MUtil_Html_HtmlElement) {
         // Element not allowed, get parts that are allowed
         foreach (array('class', 'dir', 'id', 'label', 'lang', 'style', 'title') as $attr) {
             if (isset($label->{$attr})) {
                 $opt .= ' ' . $attr . '="' . $this->view->escape($label->{$attr}) . '"';
             }
         }
         // Now get the content
         $renderer = \MUtil_Html::getRenderer();
         $content = '';
         foreach ($label->getIterator() as $part) {
             $content .= $renderer->renderAny($this->view, $part);
         }
     } elseif ($label instanceof \MUtil_Html_HtmlInterface) {
         $content = $label->render($this->view);
     } else {
         $content = $this->view->escape($label);
         $opt .= ' label="' . $this->view->escape($label) . '"';
     }
     // selected?
     if (in_array((string) $value, $selected)) {
         $opt .= ' selected="selected"';
     }
     // disabled?
     if (in_array($value, $disable)) {
         $opt .= ' disabled="disabled"';
     }
     $opt .= '>' . $content . "</option>";
     return $opt;
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:46,代码来源:FormSelectHtml.php

示例3: render

 /**
  * Renders the element into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 public function render(\Zend_View_Abstract $view)
 {
     if (null === $view) {
         $view = $this->getView();
     } else {
         $this->setView($view);
     }
     $params = \MUtil_Html::getRenderer()->renderArray($view, $this->getIterator(), false);
     if ($params) {
         return call_user_func_array('sprintf', $params);
     }
     return '';
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:21,代码来源:Sprintf.php

示例4: render

 /**
  * Renders the element into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 public function render(\Zend_View_Abstract $view)
 {
     $renderer = \MUtil_Html::getRenderer();
     if ($this->hasRepeater() && $this->_content) {
         $data = $this->getRepeater();
         if ($data->__start()) {
             $html = array();
             while ($data->__next()) {
                 $html[] = $renderer->renderArray($view, $this->_content);
             }
             if ($html) {
                 return implode($renderer->renderAny($view, $this->_glue), $html);
             }
         }
     }
     if ($this->_emptyContent) {
         return $renderer->renderAny($view, $this->_emptyContent);
     }
     return null;
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:28,代码来源:RepeatRenderer.php

示例5: renderElement

 /**
  * Function to allow overloading  of tag rendering only
  *
  * Renders the element tag with it's content into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderElement(\Zend_View_Abstract $view)
 {
     if (isset($this->_attribs['src'])) {
         if (is_scalar($this->_attribs['src'])) {
             $src = $this->_attribs['src'];
         } else {
             $src = \MUtil_Html::getRenderer()->renderArray($view, array($this->_attribs['src']));
         }
     } else {
         $src = false;
     }
     if ($src || $this->renderWithoutSrc) {
         return parent::renderElement($view);
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:25,代码来源:ImgElement.php

示例6: render

 /**
  * Renders the element into a html string
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 public function render(\Zend_View_Abstract $view)
 {
     //*
     if (null === $view) {
         $view = $this->getView();
     } else {
         $this->setView($view);
     }
     // \MUtil_Echo::r($this->count(), $glue);
     $glue = $this->getGlue();
     if ($glue instanceof \MUtil_Html_HtmlInterface) {
         $glue = $glue->render($view);
     }
     return \MUtil_Html::getRenderer()->renderArray($view, $this->getIterator(), $glue);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:23,代码来源:Sequence.php

示例7: renderContent

 /**
  * Function to allow overloading of content rendering only
  *
  * The $view is used to correctly encode and escape the output
  *
  * @param \Zend_View_Abstract $view
  * @return string Correctly encoded and escaped html output
  */
 protected function renderContent(\Zend_View_Abstract $view)
 {
     $renderer = \MUtil_Html::getRenderer();
     if ($this->_content) {
         if ($this->_repeater && !$this->_repeatTags) {
             if ($this->_repeater->__start()) {
                 $html = '';
                 while ($this->_repeater->__next()) {
                     $html .= $renderer->renderArray($view, $this->_content);
                 }
                 return $html;
             }
         } else {
             $content = $renderer->renderArray($view, $this->_content);
             if (strlen($content)) {
                 return $content;
             }
         }
     }
     if ($this->_onEmptyContent) {
         return $renderer->renderArray($view, $this->_onEmptyContent);
     }
     return null;
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:32,代码来源:HtmlElement.php

示例8: renderContent

 protected function renderContent(\Zend_View_Abstract $view)
 {
     if ($content = \MUtil_Html::getRenderer()->renderAny($view, $this->_currentContent)) {
         return $content;
     } elseif ($this->_onEmptyContent) {
         return \MUtil_Html::getRenderer()->renderAny($view, $this->_onEmptyContent);
     } else {
         return '&nbsp;';
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:10,代码来源:LabelElement.php

示例9: render

 /**
  * Render the element
  *
  * @param  string $content Content to decorate
  * @return string
  */
 public function render($content)
 {
     if (null === ($element = $this->getElement()) || null === ($view = $element->getView()) || null === ($htmlelement = $this->getHtmlElement())) {
         return $content;
     }
     if ($prologue = $this->getPrologue()) {
         if ($prologue instanceof \MUtil_Lazy_RepeatableFormElements) {
             // Not every browser can handle empty divs (e.g. IE 6)
             if ($hidden = $prologue->getHidden()) {
                 $prologue = \MUtil_Html::create()->div($hidden);
             } else {
                 $prologue = null;
             }
         }
         if ($prologue instanceof \MUtil_Html_HtmlInterface) {
             $prologue = $prologue->render($view);
         } else {
             $prologue = \MUtil_Html::getRenderer()->renderAny($view, $prologue);
         }
     } else {
         $prologue = '';
     }
     if ($prependErrors = $this->getPrependErrors()) {
         $form = $this->getElement();
         if ($errors = $form->getMessages()) {
             $errors = \MUtil_Ra::flatten($errors);
             $errors = array_unique($errors);
             if ($prependErrors instanceof \MUtil_Html_ElementInterface) {
                 $html = $prependErrors;
             } else {
                 $html = \MUtil_Html::create('ul');
             }
             foreach ($errors as $error) {
                 $html->append($error);
             }
             $prologue .= $html->render($view);
         }
     }
     $result = $this->renderElement($htmlelement, $view);
     if (parent::APPEND == $this->getPlacement()) {
         return $prologue . $result . $content;
     } else {
         return $content . $prologue . $result;
     }
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:51,代码来源:ElementDecorator.php

示例10: testValidRenderer

 public function testValidRenderer()
 {
     $renderer = MUtil_Html::getRenderer();
     $this->assertInstanceOf('MUtil_Html_Renderer', $renderer);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:5,代码来源:HtmlTest.php

示例11: _getArrayRendered

 /**
  * Returns the rendered values of th earray elements
  *
  * @return array
  */
 protected function _getArrayRendered()
 {
     return \MUtil_Html::getRenderer()->renderArray($this->getView(), $this->getArray(), false);
 }
开发者ID:GemsTracker,项目名称:MUtil,代码行数:9,代码来源:ArrayAttribute.php


注:本文中的MUtil_Html::getRenderer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。