本文整理汇总了PHP中elgg_format_attributes函数的典型用法代码示例。如果您正苦于以下问题:PHP elgg_format_attributes函数的具体用法?PHP elgg_format_attributes怎么用?PHP elgg_format_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了elgg_format_attributes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elgg_format_element
function elgg_format_element($tag_name, array $attributes = array(), $text = '', array $options = array())
{
if (!is_string($tag_name)) {
throw new \InvalidArgumentException('$tag_name is required');
}
if (isset($options['is_void'])) {
$is_void = $options['is_void'];
} else {
// from http://www.w3.org/TR/html-markup/syntax.html#syntax-elements
$is_void = in_array(strtolower($tag_name), array('area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr'));
}
if (!empty($options['encode_text'])) {
$double_encode = empty($options['double_encode']) ? false : true;
$text = htmlspecialchars($text, ENT_QUOTES, 'UTF-8', $double_encode);
}
if ($attributes) {
$attrs = elgg_format_attributes($attributes);
if ($attrs !== '') {
$attrs = " {$attrs}";
}
} else {
$attrs = '';
}
if ($is_void) {
return empty($options['is_xml']) ? "<{$tag_name}{$attrs}>" : "<{$tag_name}{$attrs} />";
} else {
return "<{$tag_name}{$attrs}>{$text}</{$tag_name}>";
}
}
示例2: prepare_src_embed
/**
* Replace default src Embed content with an ECML tag
*
* @param string $hook Equals 'prepare:src'
* @param string $type Equals 'embed'
* @param string $content HTML markup to inject into the longtext input
* @param array $params Additional params
* @uses ElggEntity $params['entity']
* @return type
*/
function prepare_src_embed($hook, $type, $content, $params)
{
$allowed_attributes = elgg_trigger_plugin_hook('ecml:attributes:src', 'embed', $params, array());
// src attribute is required
$allowed_attributes[] = 'src';
// strip attributes that are not allowed
$attributes = array();
foreach ($allowed_attributes as $key) {
$attributes[$key] = $params[$key];
}
if (!$attributes['src']) {
return $content;
}
$attrs = elgg_format_attributes($attributes);
$content = "[embed {$attrs}]";
return $content;
}
示例3: elgg_extract
<?php
namespace hypeJunction\Places;
$entity = elgg_extract('entity', $vars);
$container = elgg_extract('container', $vars);
$required = elgg_format_attributes(array('title' => elgg_echo('places:required'), 'class' => 'required'));
?>
<fieldset class="has-legend">
<legend><?php
echo elgg_echo('places:place:about');
?>
</legend>
<div>
<label <?php
echo $required;
?>
><?php
echo elgg_echo('places:place:title');
?>
</label>
<?php
echo elgg_view('input/text', array('name' => 'title', 'value' => elgg_extract('title', $vars, $entity->title), 'required' => true));
?>
</div>
<div>
<label><?php
echo elgg_echo('places:place:icon');
?>
</label>
<?php
示例4: elgg_extract
<?php
/**
* Display an icon from the elgg icons sprite.
*
* @package Elgg
* @subpackage Core
*
* @uses $vars['class'] Class of elgg-icon
*/
$class = (array) elgg_extract("class", $vars);
$class[] = "elgg-icon";
$vars["class"] = $class;
$attributes = elgg_format_attributes($vars);
echo "<span {$attributes}></span>";
示例5: elgg_extract
<?php
$entity = elgg_extract('entity', $vars);
if (!elgg_instanceof($entity, 'object', 'file')) {
return;
}
$url = urlencode(elgg_file_viewer_get_public_url($entity));
$iframe_url = "https://docs.google.com/viewer?url={$url}&embedded=true&overridemobile=true";
$attr = elgg_format_attributes(array('src' => $iframe_url, 'name' => $entity->title, 'height' => 780, 'width' => "100%", 'seamless' => true));
echo '<div class="elgg-col elgg-col-1of1 clearfloat">';
echo "<iframe {$attr}></iframe>";
echo '</div>';
示例6: _elgg_clean_vars
* 'link_id' => string, // ID to pass to the link
* )
*/
$options = _elgg_clean_vars($vars);
$type = elgg_extract('type', $vars, 'horizontal');
if ($type == 'horizontal') {
$options['class'] = "elgg-tabs elgg-htabs elgg-menu elgg-menu-page nav nav-tabs mrgn-bttm-md elgg-menu-page-default";
} else {
$options['class'] = "elgg-tabs elgg-vtabs elgg-menu elgg-menu-page nav nav-tabs mrgn-bttm-md elgg-menu-page-default";
}
if (isset($vars['class'])) {
$options['class'] = "{$options['class']} {$vars['class']}";
}
unset($options['tabs']);
unset($options['type']);
$attributes = elgg_format_attributes($options);
if (isset($vars['tabs']) && is_array($vars['tabs']) && !empty($vars['tabs'])) {
?>
<ul <?php
echo $attributes;
?>
>
<?php
foreach ($vars['tabs'] as $info) {
$class = elgg_extract('class', $info, '');
$id = elgg_extract('id', $info, '');
$selected = elgg_extract('selected', $info, FALSE);
if ($selected) {
$class .= ' elgg-state-selected active';
}
$class_str = $class ? "class=\"{$class}\"" : '';
示例7: elgg_extract
<?php
namespace Events\UI;
use Events\API\Calendar;
$calendar = elgg_extract('entity', $vars);
if (!$calendar instanceof Calendar) {
return;
}
$container = $calendar->getContainerEntity();
$attr = array('id' => "js-events-ui-calendar-{$calendar->guid}", 'class' => 'js-events-ui-fullcalendar', 'data-guid' => $calendar->guid, 'data-editable' => $calendar->canAddEvent() ? 1 : 0);
echo '<div ' . elgg_format_attributes($attr) . '></div>';
$form_attr = array('id' => "js-events-ui-form-{$calendar->guid}", 'class' => 'js-events-ui-form hidden', 'data-guid' => $calendar->guid);
echo '<div ' . elgg_format_attributes($form_attr) . '>';
echo elgg_view_form('events/edit', array('enctype' => 'multipart/form-data', 'class' => 'events-ui-form'), array('calendar' => $calendar, 'container' => $container));
echo '</div>';
示例8: elgg_format_attributes
<?php
$attrs = elgg_format_attributes(array('width' => $vars['width'], 'height' => $vars['height'], 'src' => $vars['src'], 'frameborder' => '0'));
echo "<iframe {$attrs} allowFullScreen webkitallowfullscreen mozallowfullscreen oallowfullscreen msallowfullscreen></iframe>";
示例9: elgg_extract
$value = elgg_extract('value', $vars, false);
$multiple = elgg_extract('multiple', $vars, false);
$class = 'userpicker-glossary';
if (isset($vars['class'])) {
$class = "{$class} {$vars['class']}";
unset($vars['class']);
}
$alphabet = range('a', 'z');
$alphabet[] = '*';
if (!is_array($value)) {
$value = array();
}
foreach ($alphabet as $letter) {
$link = elgg_view('output/url', array('text' => $letter, 'title' => $letter, 'href' => elgg_http_add_url_query_elements($endpoint, array('letter' => $letter)), 'rel' => false, 'data-glossary' => $letter, 'data-limit' => HYPEINBOX_USERPICKER_BATCH_SIZE));
$tabs .= <<<__TAB
<li class="elgg-tab">
\t{$link}
\t<div data-glossary-info="{$letter}" class="elgg-content"></div>
</li>
__TAB;
}
$hidden = elgg_view('input/hidden', array('name' => $name, 'value' => 0));
$attr = elgg_format_attributes(array('class' => $class, 'id' => str_replace(array(' ', '.'), '-', microtime()), 'data-endpoint' => $endpoint, 'data-name' => $name, 'data-value' => $value ? json_encode($value) : '[]', 'data-limit' => HYPEINBOX_USERPICKER_BATCH_SIZE, 'data-multiple' => $multiple));
echo <<<__HTML
{$hidden}
<div {$attr}>
\t<ul data-tabs class="elgg-tabs">{$tabs}</ul>
</div>
__HTML
;
示例10: elgg_extract
* Licence: CC-ByNCSA
* Reference: Microproyecto CEI BioTIC Ref. 11-2015
* Project coordinator: @rosanamontes
* Website: http://lsi.ugr.es/rosana
* Project colaborator: Antonio Moles
*
* Project Derivative:
* TFG: Desarrollo de un sistema de gestión de paquetería para Teranga Go
* Advisor: Rosana Montes
* Student: Ricardo Luzón Fernández
*
*/
$value = elgg_extract("value", $vars);
unset($vars["value"]);
$spacers = array("new_line", "space", "dash", "teranga_car", "teranga_asientos");
$field_selector = "<select " . elgg_format_attributes($vars) . " class='elgg-input-dropdown profile-manager-user-summary-config-options'>";
$field_selector .= "<option></option>";
$profile_fields = elgg_get_config("profile_fields");
if ($profile_fields) {
$field_options = array();
foreach ($profile_fields as $metadata_name => $type) {
$label = $metadata_name;
$translation_key = "profile:" . $metadata_name;
$translated_label = elgg_echo($translation_key);
if ($translated_label !== $translation_key) {
$label = $translated_label;
}
$field_options[$metadata_name] = $label;
}
ksort($field_options);
$field_selector .= "<opttrip label='" . elgg_echo("profiles_go:profile_fields:list:title") . "'>";
示例11: array
/**
* Table output
*
* @package Video
*
* @uses $vars['table_class] The classes for table element
* @uses $vars['headers'] The column headers
* @uses $vars['rows'] Two dimensional array with rows and cells
*
*/
$table_class = array('class' => 'elgg-table');
if (isset($vars['table_class'])) {
$table_class['class'] = $vars['table_class'];
}
$table_class = elgg_format_attributes($table_class);
$header = '';
if (isset($vars['headers'])) {
foreach ($vars['headers'] as $header) {
$headers .= "<th>{$header}</th>";
}
$headers = "<tr>{$headers}</tr>";
}
$rows = '';
if (isset($vars['rows'])) {
foreach ($vars['rows'] as $row) {
$cells = '';
foreach ($row as $value) {
$cells .= "<td>{$value}</td>";
}
$rows .= "<tr>{$cells}</tr>";
示例12: get_input
/**
* Navigation menu for a user's or a group's pages
*
* @uses $vars['page'] Page object if manually setting selected item
*/
$page_guid = (int) get_input("guid");
$page = false;
if (!empty($page_guid)) {
$page = get_entity($page_guid);
}
$selected_page = elgg_extract("page", $vars, $page);
// do we have a selected page
if (pages_tools_is_valid_page($selected_page)) {
// make the navigation tree
if (pages_tools_register_navigation_tree($selected_page)) {
$title = elgg_echo("pages:navigation");
$title .= "<span " . elgg_format_attributes(array("class" => "float-alt", "title" => elgg_echo("pages_tools:navigation:tooltip"))) . ">";
$title .= elgg_view_icon("info");
$title .= "</span>";
// get the navigation menu
$menu = "<div id='pages-tools-navigation' class='hidden'>";
$menu .= elgg_view_menu("pages_nav", array("class" => "pages-nav", "sort_by" => "priority"));
$menu .= "</div>";
$menu .= elgg_view("graphics/ajax_loader", array("hidden" => false));
// load the correct JS/css
elgg_load_js("jquery.tree");
elgg_load_css("jquery.tree");
// draw everything
echo elgg_view_module("aside", $title, $menu);
}
}
示例13: array
$vars['class'] = "elgg-button";
}
$defaults = array('type' => 'button');
$vars = array_merge($defaults, $vars);
switch ($vars['type']) {
case 'button':
case 'reset':
case 'submit':
case 'image':
case 'group_search':
break;
default:
$vars['type'] = 'button';
break;
}
// blank src if trying to access an offsite image. @todo why?
if (isset($vars['src']) && strpos($vars['src'], elgg_get_site_url()) === false) {
$vars['src'] = "";
}
//Nick I modified the button input to test for group search button so I can put the icon in the button.
//Existing buttons should not be affected
if ($vars['type'] == 'group_search') {
$button_input = '<button type="submit" ' . elgg_format_attributes($vars) . '><i class="fa fa-search" aria-hidden="true"></i></button>';
} else {
$button_input = '<input ' . elgg_format_attributes($vars) . '>';
}
echo $button_input;
?>
示例14: unset
unset($vars['options']);
$value = is_array($vars['value']) ? $vars['value'] : array($vars['value']);
$value = array_map('strval', $value);
unset($vars['value']);
$vars['multiple'] = !empty($vars['multiple']);
// Add trailing [] to name if multiple is enabled to allow the form to send multiple values
if ($vars['multiple'] && !empty($vars['name']) && is_string($vars['name'])) {
if (substr($vars['name'], -2) != '[]') {
$vars['name'] = $vars['name'] . '[]';
}
}
?>
<select <?php
echo elgg_format_attributes($vars);
?>
>
<?php
foreach ($optgroups as $groupLabel => $options_values) {
if (!empty($options_values)) {
echo '<optgroup label="' . $groupLabel . '">';
foreach ($options_values as $opt_value => $option) {
$option_attrs = elgg_format_attributes(array('value' => $opt_value, 'selected' => in_array((string) $opt_value, $value)));
echo "<option {$option_attrs}>{$option}</option>";
}
echo '</optgroup>';
}
}
?>
</select>
<?php
}
示例15: array
$excerpt = false;
if ($widget->excerpt == "yes") {
$excerpt = true;
}
$show_item_icon = false;
if ($widget->show_item_icon == "yes") {
$show_item_icon = true;
}
$show_in_lightbox = false;
if ($widget->show_in_lightbox == "yes") {
$show_in_lightbox = true;
}
if ($feed_url) {
$attributes = array("id" => "widget-manager-rss-" . $widget->guid, "data-feed-url" => $feed_url, "data-limit" => $limit, "data-post-date" => $post_date, "data-show-feed-title" => $show_feed_title, "data-show-excerpt" => $excerpt, "data-show-item-icon" => $show_item_icon, "data-show-in-lightbox" => $show_in_lightbox);
?>
<div <?php
echo elgg_format_attributes($attributes);
?>
"></div>
<script>
require(["widget_manager/widgets/rss"], function (rss) {
rss("#widget-manager-rss-<?php
echo $widget->guid;
?>
");
});
</script>
<?php
} else {
echo elgg_echo("widgets:rss:error:notset");
}