本文整理汇总了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);
}
}
示例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;
}
示例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 '';
}
示例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;
}
示例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);
}
}
示例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);
}
示例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;
}
示例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 ' ';
}
}
示例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;
}
}
示例10: testValidRenderer
public function testValidRenderer()
{
$renderer = MUtil_Html::getRenderer();
$this->assertInstanceOf('MUtil_Html_Renderer', $renderer);
}
示例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);
}