本文整理汇总了PHP中Html::attributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Html::attributes方法的具体用法?PHP Html::attributes怎么用?PHP Html::attributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Html
的用法示例。
在下文中一共展示了Html::attributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register($attr, $content = null, $name = null)
{
$attr = array_map(function ($value) {
return str_replace('"', '', $value);
}, $attr);
return '<iframe ' . \Html::attributes($attr) . '></iframe>';
}
示例2: renderOptions
static function renderOptions($options, $default = null, $multiple = False)
{
$output = '';
$last_group = NULL;
foreach ($options as $key => $option) {
if ($option->group && $option->group != $last_group) {
if ($last_group) {
$output .= '</optgroup>' . "\n";
}
$output .= '<optgroup label="' . Html::encode($option->group) . '">' . "\n";
$last_group = $option->group;
}
// is this option selected?
$selected = NULL;
if ($multiple) {
// Do not use type sensitive in_array, due to php int=>str in array keys
$selected = $default && in_array($option->value, $default);
} else {
$selected = $default == $option->value;
}
$output .= '<option' . Html::attributes(array('value' => $option->value, 'selected' => $selected ? 'selected' : NULL)) . '>' . Html::encode($option->caption) . '</option>' . "\n";
}
if ($last_group) {
$output .= '</optgroup>' . "\n";
}
return $output;
}
示例3: open
public static function open($action, $method = 'POST', $attributes = array())
{
$attributes['method'] = static::method(strtoupper($method));
$attributes['action'] = static::action($action);
if (!array_key_exists('accept-charset', $attributes)) {
$attributes['accept-charset'] = Config::app('encoding');
}
return '<form' . Html::attributes($attributes) . '>';
}
示例4: render
/**
* Renders the Searchbox object to a string.
*
* @return string
*/
public function render()
{
$elements[] = '<div ' . Html::attributes($this->get_option('attributes')) . '>';
$elements[] = Form::input($this->_name . '_searchbox_string', $this->_search_string, $this->get_option('search_field_attributes'));
$elements[] = Form::button($this->_name . '_searchbox_string', $this->get_option('search_button_label', __('Search')), $this->get_option('search_button_attributes'));
$elements[] = '<div ' . Html::attributes($this->get_option('result_box_attributes')) . '>';
$elements[] = '</div>';
return "\n" . implode("\n", $elements) . "\n";
}
示例5: register
public function register($attr, $content = null, $name = null)
{
$content = \Shortcode::compile($content);
$attr['class'] = 'section ' . str_replace('"', '', isset($attr['class']) ? $attr['class'] : '');
$hr = isset($attr['hr']) ? $attr['hr'] : null;
if ($hr) {
unset($attr['hr']);
$content .= '<hr class="half-rule">';
}
return '<div ' . \Html::attributes($attr) . '>' . $content . '</div>';
}
示例6: render
public function render()
{
$elements[] = '<div ' . Html::attributes($this->get_option('attributes')) . '>';
$col_count = 0;
foreach ($this->_data as $key => $item) {
$col_count++;
$elements[] = View::factory($this->_renderer, $item)->render();
if ($col_count == $this->cols) {
$elements[] = '<div style="clear:both;"></div>';
$col_count = 0;
}
}
$elements[] = '</div>';
$elements[] = '<div style="clear:both;"></div>';
return "\n" . implode("\n", $elements) . "\n";
}
示例7: select
public function select($name = '', $options = array(), $selected = '', $_attributes = '', $multiple = false)
{
if (!is_string($name)) {
$name = '';
}
if (!isValue($selected)) {
$selected = '';
}
// Herhangi bir id değeri tanımlanmamışsa
// Id değeri olarak isim bilgisini kullan.
$id = isset($_attributes["id"]) ? $_attributes["id"] : $name;
// Id değer tanımlanmışsa
// Id değeri olarak tanımalanan değeri kullan.
$id_txt = isset($_attributes["id"]) ? '' : "id=\"{$id}\"";
// Son parametrenin durumuna multiple olması belirleniyor.
// Ancak bu parametrenin kullanımı gerekmez.
// Bunun için multiple() yöntemi oluşturulmuştur.
if ($multiple === true) {
$multiple = 'multiple="multiple"';
} else {
$multiple = '';
}
$selectbox = '<select ' . $multiple . ' name="' . $name . '" ' . $id_txt . Html::attributes($_attributes) . '>';
if (is_array($options)) {
foreach ($options as $key => $value) {
if ($selected == $key) {
$select = 'selected="selected"';
} else {
$select = "";
}
$selectbox .= '<option value="' . $key . '" ' . $select . '>' . $value . '</option>' . eol();
}
}
$selectbox .= '</select>' . eol();
return $selectbox;
}
示例8: video
/**
* Generate a Youtube video iframe
*
* @param null $mixWidth
* @param null $height
* @return string
*/
public static function video($mixWidth = null, $height = null)
{
$defParam = array('width' => 560, 'height' => 315, 'src' => '//www.youtube.com/embed/0af00UcTO-c', 'frameborder' => 0, 'allowfullscreen' => 'true');
$param = array();
if (is_integer($mixWidth)) {
$param['width'] = $mixWidth;
}
if (!$height && is_integer($height)) {
$param['height'] = $height;
}
$param = array_merge($defParam, $param);
return '<iframe ' . Html::attributes($param) . '></iframe>';
}
示例9:
<span><i class="fa fa-spinner fa-lg fa-pulse"></i> Loading..</span>
</div>
<div class="text-center alert alert-success hide" id="table_success"></div>
<script type="text/ng-template" id="exportModal">
<div class="modal-header">
<h3 class="modal-title">[[params.title]]</h3>
</div>
<div class="modal-body">
<p class="indent">
<em>The data exceed the maximum limit of [[params.limit]] records. Please choose the appropriate range of data to export below.</em>
</p>
<ul class="list-inline list-unstyled">
<li ng-repeat="item in params.chunks">
<div class="radio">
<label>
<input type="radio" name="exportdoc" ng-click="selectItem([[item.from]])"> [[item.from]] - [[item.to]]
</label>
</div>
</li>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-success" type="button" ng-click="download()">Download</button>
<button class="btn btn-warning" type="button" ng-click="cancel()">Cancel</button>
</div>
</script>
</div>
<div class="wrapper">
<table class="table table-striped table-condensed table-bordered"' . Html::attributes($options) . '>';
return $html;
});
示例10: _document
protected function _document($xml = '', $tab = '', $start = 0)
{
static $start;
$eof = eol();
$output = '';
$tab = str_repeat("\t", $start);
if (!isset($xml[0])) {
$xml = array($xml);
$start = 0;
}
foreach ($xml as $data) {
$name = isset($data['name']) ? $data['name'] : '';
$attr = isset($data['attr']) ? $data['attr'] : '';
$content = isset($data['content']) ? $data['content'] : '';
$child = isset($data['child']) ? $data['child'] : '';
$output .= "{$tab}<{$name}" . Html::attributes($attr) . ">";
if (!empty($content)) {
$output .= $content;
} else {
if (!empty($child)) {
$output .= $eof . $this->_document($child, $tab, $start++) . $tab;
} else {
$output .= $content;
}
}
$output .= "</" . $name . ">" . $eof;
}
return $output;
}
示例11: button
public static function button($value = null, $attributes = array())
{
return '<button' . Html::attributes($attributes) . '>' . Html::entities($value) . '</button>';
}
示例12: use
public function use(array $randomDataVariable = NULL, array $head = NULL)
{
if (!empty(Properties::$parameters['headData'])) {
$head = Properties::$parameters['headData'];
}
if (!empty(Properties::$parameters['data'])) {
$randomDataVariable = Properties::$parameters['data'];
}
Properties::$parameters = [];
$eol = EOL;
$masterPageSet = Config::get('Masterpage');
$randomPageVariable = $head['bodyPage'] ?? $masterPageSet['bodyPage'];
$headPage = $head['headPage'] ?? $masterPageSet['headPage'];
$docType = $head['docType'] ?? $masterPageSet["docType"];
$header = Config::get('ViewObjects', 'doctype')[$docType] . $eol;
$htmlAttributes = $head['attributes']['html'] ?? $masterPageSet['attributes']['html'];
$header .= '<html xmlns="http://www.w3.org/1999/xhtml"' . Html::attributes($htmlAttributes) . '>' . $eol;
$headAttributes = $head['attributes']['head'] ?? $masterPageSet['attributes']['head'];
$header .= '<head' . Html::attributes($headAttributes) . '>' . $eol;
$contentCharset = $head['content']['charset'] ?? $masterPageSet['content']['charset'];
if (is_array($contentCharset)) {
foreach ($contentCharset as $v) {
$header .= "<meta http-equiv=\"Content-Type\" content=\"text/html; charset={$v}\">" . $eol;
}
} else {
$header .= '<meta http-equiv="Content-Type" content="text/html; charset=' . $contentCharset . '">' . $eol;
}
$contentLanguage = $head['content']['language'] ?? $masterPageSet['content']['language'];
$header .= '<meta http-equiv="Content-Language" content="' . $contentLanguage . '">' . $eol;
$datas = $masterPageSet['data'];
$metas = $masterPageSet['meta'];
$title = $head['title'] ?? $masterPageSet["title"];
if (!empty($title)) {
$header .= '<title>' . $title . '</title>' . $eol;
}
if (isset($head['meta'])) {
$metas = array_merge($metas, $head['meta']);
}
if (!empty($metas)) {
foreach ($metas as $name => $content) {
if (isset($head['meta'][$name])) {
$content = $head['meta'][$name];
}
if (!stristr($name, 'http:') && !stristr($name, 'name:')) {
$name = 'name:' . $name;
}
if (!empty($content)) {
$nameEx = explode(":", $name);
$httpOrName = $nameEx[0] === 'http' ? 'http-equiv' : 'name';
$name = isset($nameEx[1]) ? $nameEx[1] : $nameEx[0];
if (!is_array($content)) {
$header .= "<meta {$httpOrName}=\"{$name}\" content=\"{$content}\">" . $eol;
} else {
foreach ($content as $key => $val) {
$header .= "<meta {$httpOrName}=\"{$name}\" content=\"{$val}\">" . $eol;
}
}
}
}
}
$header .= $this->_links($masterPageSet, $head, 'font');
$header .= $this->_links($masterPageSet, $head, 'script');
$header .= $this->_links($masterPageSet, $head, 'style');
$browserIcon = $head['browserIcon'] ?? $masterPageSet["browserIcon"];
if (!empty($browserIcon) && is_file($browserIcon)) {
$header .= '<link rel="shortcut icon" href="' . baseUrl($browserIcon) . '" />' . $eol;
}
$theme = $head['theme']['name'] ?? $masterPageSet['theme']['name'];
$themeRecursive = $head['theme']['recursive'] ?? $masterPageSet['theme']['recursive'];
if (!empty($theme)) {
$header .= Import::theme($theme, $themeRecursive, true);
}
$plugin = $head['plugin']['name'] ?? $masterPageSet['plugin']['name'];
$pluginRecursive = $head['plugin']['recursive'] ?? $masterPageSet['plugin']['recursive'];
if (!empty($plugin)) {
$header .= Import::plugin($plugin, $pluginRecursive, true);
}
if (isset($head['data'])) {
$datas = array_merge($datas, $head['data']);
}
if (!empty($datas)) {
if (!is_array($datas)) {
$header .= $datas . $eol;
} else {
foreach ($datas as $v) {
$header .= $v . $eol;
}
}
}
$header .= $this->_setpage($headPage);
$header .= '</head>' . $eol;
$backgroundImage = $head['backgroundImage'] ?? $masterPageSet["backgroundImage"];
$bgImage = !empty($backgroundImage) && is_file($backgroundImage) ? ' background="' . baseUrl($backgroundImage) . '" bgproperties="fixed"' : '';
$bodyAttributes = $head['attributes']['body'] ?? $masterPageSet['attributes']['body'];
$header .= '<body' . Html::attributes($bodyAttributes) . $bgImage . '>' . $eol;
echo $header;
if (!empty($randomPageVariable)) {
Import::page($randomPageVariable, $randomDataVariable);
}
$randomFooterVariable = $eol . '</body>' . $eol;
//.........这里部分代码省略.........
示例13: input_html
public static function input_html($type = "submit", $name = null, $value = null, $attrs = array())
{
return '<input type="' . $type . '"' . Html::attributes($attrs) . ' name="' . $name . '" value="' . Html::encode($value) . '" />' . PHP_EOL;
}
示例14: link
/**
* Create a HTML page link.
*
* @param int $page
* @param string $text
* @param string $class
* @return string
*/
protected function link($page, $text, $class)
{
$query = '?page=' . $page . $this->appendage($this->appends);
return '<li' . Html::attributes(array('class' => $class)) . '><a href="#" onclick="paginationGoPage(' . $page . '); return false;">' . Inflector::utf8($text) . '</a></li>';
}
示例15: masterPage
//.........这里部分代码省略.........
//-----------------------------------------------------------------------------------------------------
// Stiller dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
if (is_array($masterPageSet['style'])) {
$masterPageSet['style'][] = true;
$header .= $this->style($masterPageSet['style']);
}
if (isset($head['style'])) {
$head['style'][] = true;
$header .= $this->style($head['style']);
}
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// Browser Icon dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
$browserIcon = isset($head['browserIcon']) ? $head['browserIcon'] : $masterPageSet["browserIcon"];
if (!empty($browserIcon)) {
$header .= '<link rel="shortcut icon" href="' . baseUrl($browserIcon) . '" />' . $eol;
}
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// Tema dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
$theme = isset($head['theme']['name']) ? $head['theme']['name'] : $masterPageSet['theme']['name'];
$themeRecursive = isset($head['theme']['recursive']) ? $head['theme']['recursive'] : $masterPageSet['theme']['recursive'];
if (!empty($theme)) {
$header .= $this->theme($theme, $themeRecursive, true);
}
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// Eklenti dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
$plugin = isset($head['plugin']['name']) ? $head['plugin']['name'] : $masterPageSet['plugin']['name'];
$pluginRecursive = isset($head['plugin']['recursive']) ? $head['plugin']['recursive'] : $masterPageSet['plugin']['recursive'];
if (!empty($plugin)) {
$header .= $this->plugin($plugin, $pluginRecursive, true);
}
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// Farklı veriler dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
if (isset($head['data'])) {
$datas = array_merge($datas, $head['data']);
}
if (!empty($datas)) {
if (!is_array($datas)) {
$header .= $datas . $eol;
} else {
foreach ($datas as $v) {
$header .= $v . $eol;
}
}
}
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
//-----------------------------------------------------------------------------------------------------
// Başlık sayfası dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
$header .= $this->_setpage($headPage);
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
$header .= '</head>' . $eol;
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>HEAD END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>BODY START<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
//-----------------------------------------------------------------------------------------------------
// Arkaplan resmi dahil ediliyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
$backgroundImage = isset($head['backgroundImage']) ? $head['backgroundImage'] : $masterPageSet["backgroundImage"];
$bgImage = !empty($backgroundImage) ? ' background="' . baseUrl($backgroundImage) . '" bgproperties="fixed"' : '';
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
$bodyAttributes = isset($head['bodyAttributes']) ? $head['bodyAttributes'] : $masterPageSet["bodyAttributes"];
$header .= '<body' . Html::attributes($bodyAttributes) . $bgImage . '>' . $eol;
echo $header;
if (!empty($randomPageVariable)) {
$this->page($randomPageVariable, $randomDataVariable);
}
$randomFooterVariable = $eol . '</body>' . $eol;
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>BODY END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
$randomFooterVariable .= '</html>';
/*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>HTML END<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<*/
//-----------------------------------------------------------------------------------------------------
// Masterpage oluşturuluyor. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
//-----------------------------------------------------------------------------------------------------
echo $randomFooterVariable;
//-----------------------------------------------------------------------------------------------------
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
//-----------------------------------------------------------------------------------------------------
}