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


PHP PhpRenderer::escapeHtml方法代码示例

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


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

示例1: renderSpellingSuggestions

 /**
  * Support function to display spelling suggestions.
  *
  * @param string                          $msg     HTML to display at the top of
  * the spelling section.
  * @param \VuFind\Search\Base\Results     $results Results object
  * @param \Zend\View\Renderer\PhpRenderer $view    View renderer object
  *
  * @return string
  */
 public function renderSpellingSuggestions($msg, $results, $view)
 {
     $spellingSuggestions = $results->getSpellingSuggestions();
     if (empty($spellingSuggestions)) {
         return '';
     }
     $html = '<div class="' . $this->getContainerClass() . '">';
     $html .= $msg;
     foreach ($spellingSuggestions as $term => $details) {
         $html .= '<br/>' . $view->escapeHtml($term) . ' &raquo; ';
         $i = 0;
         foreach ($details['suggestions'] as $word => $data) {
             if ($i++ > 0) {
                 $html .= ', ';
             }
             $html .= '<a href="' . $results->getUrlQuery()->replaceTerm($term, $data['new_term']) . '">' . $view->escapeHtml($word) . '</a>';
             if (isset($data['expand_term']) && !empty($data['expand_term'])) {
                 $url = $results->getUrlQuery()->replaceTerm($term, $data['expand_term']);
                 $html .= $this->renderExpandLink($url, $view);
             }
         }
     }
     $html .= '</div>';
     return $html;
 }
开发者ID:tillk,项目名称:vufind,代码行数:35,代码来源:AbstractSearch.php

示例2: render

 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     $data = $media->mediaData();
     if ($data['type'] == 'photo') {
         $url = $data['url'];
         $width = $data['width'];
         $height = $data['height'];
         if (!empty($data['title'])) {
             $title = $data['title'];
         } else {
             $title = $url;
         }
         return sprintf('<img src="%s" width="%s" height="%s" alt="%s">', $view->escapeHtml($url), $view->escapeHtml($width), $view->escapeHtml($height), $view->escapeHtml($title));
     } else {
         if (!empty($data['html'])) {
             return $data['html'];
         } else {
             $source = $media->source();
             if (!$empty($data['title'])) {
                 $title = $data['title'];
             } else {
                 $title = $source;
             }
             return $view->hyperlink($title, $source);
         }
     }
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:27,代码来源:OEmbed.php

示例3: render

 public function render(PhpRenderer $view, SitePageBlockRepresentation $block)
 {
     $attachments = $block->attachments();
     if (!$attachments) {
         return '';
     }
     $html = '';
     foreach ($attachments as $attachment) {
         $html .= '<div>';
         $item = $attachment->item();
         if ($item) {
             $html .= '<h2>' . $item->link($item->displayTitle()) . '</h2>';
             $media = $attachment->media();
             if (!$media) {
                 $media = $item->primaryMedia();
             }
             if ($media) {
                 $thumbnailType = $this->getData($block->data(), 'thumbnail_type', 'square');
                 $html .= '<h3>' . $media->link($media->displayTitle()) . '</h3>';
                 $html .= '<img src="' . $view->escapeHtml($media->thumbnailUrl($thumbnailType)) . '">';
             }
         }
         $caption = $attachment->caption();
         if ($caption) {
             $html .= '<p>' . $caption . '</p>';
         }
         $html .= '</div>';
     }
     return $html;
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:30,代码来源:ItemList.php

示例4: render

 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     if (!isset($options['width'])) {
         $options['width'] = self::WIDTH;
     }
     if (!isset($options['height'])) {
         $options['height'] = self::HEIGHT;
     }
     if (!isset($options['allowfullscreen'])) {
         $options['allowfullscreen'] = self::ALLOWFULLSCREEN;
     }
     // Compose the YouTube embed URL and build the markup.
     $data = $media->mediaData();
     $url = new HttpUri(sprintf('https://www.youtube.com/embed/%s', $data['id']));
     $url->setQuery(['start' => $data['start'], 'end' => $data['end']]);
     $embed = sprintf('<iframe width="%s" height="%s" src="%s" frameborder="0"%s></iframe>', $view->escapeHtml($options['width']), $view->escapeHtml($options['height']), $view->escapeHtml($url), $options['allowfullscreen'] ? ' allowfullscreen' : '');
     return $embed;
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:18,代码来源:Youtube.php

示例5: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $output = '';
     if ($fieldset->has('Groups')) {
         $groups = $fieldset->get('Groups');
         if ($groups->count()) {
             $output = "<div>\n";
             foreach ($groups as $element) {
                 if ($element instanceof \Zend\Form\Element\Radio) {
                     $label = $view->htmlTag('a', $view->escapeHtml($element->getLabel()), array('href' => $view->consoleUrl('group', 'general', array('name' => $element->getLabel()))));
                     $output .= $view->htmlTag('fieldset', "<legend>{$label}</legend>\n" . $view->formRadio($element));
                 }
             }
             $output .= $view->formRow($fieldset->get('Submit'));
             $output .= "\n</div>\n";
         }
     }
     return $output;
 }
开发者ID:patrickpreuss,项目名称:Braintacle,代码行数:20,代码来源:GroupMemberships.php

示例6: render

 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return sprintf('<audio src="%s" controls>%s</audio>', $view->escapeHtml($media->originalUrl()), $view->hyperlink($media->filename(), $media->originalUrl()));
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:4,代码来源:AudioRenderer.php

示例7: render

 public function render(PhpRenderer $view, MediaRepresentation $media, array $options = [])
 {
     return sprintf('<img src="%s">', $view->escapeHtml($media->originalUrl()));
 }
开发者ID:patrova,项目名称:omeka-s,代码行数:4,代码来源:ImageRenderer.php

示例8: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $name = $fieldset->getName();
     if ($name) {
         $default = $view->translate('Default');
         $effective = $view->translate('Effective');
         $yes = $view->translate('Yes');
         $no = $view->translate('No');
         switch ($name) {
             case 'Agent':
                 $legend = $view->translate('Agent');
                 break;
             case 'Download':
                 $legend = $view->translate('Download');
                 break;
             case 'Scan':
                 $legend = $view->translate('Network scanning');
                 break;
         }
         $output = "<div class='table'>\n";
         foreach ($fieldset as $element) {
             if ($element->getAttribute('disabled')) {
                 continue;
             }
             preg_match('/.*\\[(.*)\\]$/', $element->getName(), $matches);
             $option = $matches[1];
             if ($option == 'scanThisNetwork') {
                 $row = '';
             } else {
                 $defaultValue = $this->_object->getDefaultConfig($option);
                 if ($element instanceof Element\Checkbox) {
                     $defaultValue = $defaultValue ? $yes : $no;
                 }
                 $row = sprintf('%s: %s', $default, $defaultValue);
                 if ($this->_object instanceof \Model\Client\Client) {
                     $effectiveValue = $this->_object->getEffectiveConfig($option);
                     if ($element instanceof Element\Checkbox) {
                         $effectiveValue = $effectiveValue ? $yes : $no;
                     }
                     $row .= sprintf(', %s: %s', $effective, $effectiveValue);
                 }
                 $row = $view->escapeHtml("({$row})");
             }
             if ($element->getMessages()) {
                 $element->setAttribute('class', 'input-error');
             }
             $row = $view->htmlElement('span', $view->formElement($element) . $row, array('class' => 'values'));
             $row = $view->htmlElement('span', $view->translate($element->getLabel()), array('class' => 'label')) . $row;
             $output .= $view->htmlElement('label', $row);
             if ($element->getMessages()) {
                 $output .= $view->htmlElement('span', null, array('class' => 'cell'));
                 $output .= $view->formElementErrors($element, array('class' => 'error'));
             }
         }
         $output .= "</div>\n";
         $output = $view->htmlElement('fieldset', $view->htmlElement('legend', $legend) . $output);
     } else {
         $output = "<div class='table'>\n";
         foreach ($fieldset as $element) {
             if ($element instanceof \Zend\Form\Fieldset) {
                 $output .= $this->renderFieldset($view, $element);
             }
         }
         $output .= $view->formRow($fieldset->get('Submit'));
         $output .= "</div>\n";
     }
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:69,代码来源:ClientConfig.php

示例9: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset = null)
 {
     $output = '';
     $name = $fieldset->getName();
     switch ($name) {
         case 'inspect':
             $output .= "<div class='textcenter'>\n";
             $output .= $view->formRow($fieldset->get('inspect'), 'append') . "\n";
             $output .= "</div>\n";
             break;
         case 'existing':
             $table = '';
             foreach ($this->_definedValues as $value) {
                 $id = $value['Id'];
                 $element = $fieldset->get("value_{$id}_name");
                 $row = $view->htmlElement('td', $view->formElement($element) . $view->formElementErrors($element, array('class' => 'errors')));
                 $row .= $view->htmlElement('td', $view->escapeHtml($element->getLabel()));
                 $row .= $view->htmlElement('td', $view->htmlElement('a', $view->translate('Delete'), array('href' => $view->consoleUrl('preferences', 'deleteregistryvalue', array('name' => $value['Name'])))));
                 $table .= $view->htmlElement('tr', $row);
             }
             $output .= $view->htmlElement('table', $table);
             break;
         case 'new_value':
             $output .= parent::renderFieldset($view, $fieldset);
             break;
         default:
             if ($fieldset == $this) {
                 $output .= $this->renderFieldset($view, $fieldset->get('inspect'));
                 if (count($this->_definedValues)) {
                     $output .= $view->htmlElement('h2', $view->translate('Values'));
                     $output .= $this->renderFieldset($view, $fieldset->get('existing'));
                 }
                 $output .= $view->htmlElement('h2', $view->translate('Add'));
                 $output .= $this->renderFieldset($view, $fieldset->get('new_value'));
             }
             break;
     }
     return $output;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:40,代码来源:ManageRegistryValues.php

示例10: renderFieldset

 /** {@inheritdoc} */
 public function renderFieldset(\Zend\View\Renderer\PhpRenderer $view, \Zend\Form\Fieldset $fieldset)
 {
     $headers = array('Id' => 'ID', 'Name' => $view->translate('Name'), 'NetworkInterface.MacAddress' => $view->translate('MAC address'), 'Serial' => $view->translate('Serial number'), 'AssetTag' => $view->translate('Asset tag'), 'LastContactDate' => $view->translate('Last contact'));
     $renderCriteria = function ($view, $client, $property) {
         $value = $client[$property];
         if ($value === null) {
             // NULL values are never considered for duplicates and cannot be blacklisted.
             return;
         }
         if ($property == 'NetworkInterface.MacAddress') {
             $property = 'MacAddress';
         }
         // Hyperlink to blacklist form
         return $view->htmlElement('a', $view->escapeHtml($value), array('href' => $view->consoleUrl('duplicates', 'allow', array('criteria' => $property, 'value' => $value))), true);
     };
     $renderCallbacks = array('Id' => function ($view, $client) {
         // Display ID and a checkbox. Render checkbox manually because
         // ZF's MultiCheckbox element does not handle duplicate values.
         // $_POST['clients'] will become an array of selected
         // (possibly duplicate) IDs.
         return sprintf('<input type="checkbox" name="clients[]" value="%d">%d', $client['Id'], $client['Id']);
     }, 'Name' => function ($view, $client) {
         // Hyperlink to "customfields" page of given client.
         // This allows for easy review of the information about to be merged.
         return $view->htmlElement('a', $view->escapeHtml($client['Name']), array('href' => $view->consoleUrl('client', 'customfields', array('id' => $client['Id']))), true);
     }, 'NetworkInterface.MacAddress' => $renderCriteria, 'Serial' => $renderCriteria, 'AssetTag' => $renderCriteria);
     $formContent = $view->table($this->getOption('clients'), $headers, array('order' => $this->getOption('order'), 'direction' => $this->getOption('direction')), $renderCallbacks);
     $formContent .= "<div>\n";
     foreach ($this as $element) {
         $formContent .= $view->formRow($element, 'append') . "\n";
     }
     $formContent .= "</div>\n";
     return $formContent;
 }
开发者ID:hschletz,项目名称:braintacle,代码行数:35,代码来源:ShowDuplicates.php


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