<?xml version="1.0" encoding="UTF-8"?>\r
-<plugin_manifest>\r
- <field key="author" value="Evan Winslow" />\r
- <field key="version" value="1.0" />\r
- <field key="description" value="Provides HTML5 support for Elgg" />\r
- <field key="copyright" value="(C) Evan Winslow 2010" />\r
- <field key="website" value="http://code.google.com/p/elgg-ewinslow" />\r
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">\r
+ <author>Evan Winslow</author>\r
+ <version>1.0</version>\r
+ <description>Provides HTML5 support for Elgg</description>\r
+ <copyright>(C) Evan Winslow 2010</copyright>\r
+ <website>http://code.google.com/p/elgg-ewinslow</website>\r
</plugin_manifest>
\ No newline at end of file
<?php\r
\r
function html5_init() {\r
- elgg_extend_view('css', 'html5/css');\r
- \r
- elgg_extend_view('js/initialise_elgg', 'js/html5');\r
-}\r
-\r
-function html5_get_html_attributes(array $attrs = array(), $quote_style = ENT_COMPAT, $charset = 'UTF-8', $double_encode = TRUE) {\r
- $attrs = html5_clean_vars($attrs);\r
- $attributes = array();\r
- \r
- if (isset($attrs['js'])) {\r
- elgg_deprecated_notice("Use of the 'js' attribute was deprecated in 1.8. You can now use the js attributes directly.", '1.8');\r
- \r
- if (!empty($attrs['js'])) {\r
- $attributes[] = $attrs['js'];\r
- }\r
- \r
- unset($attrs['js']);\r
- }\r
- \r
- foreach ($attrs as $attr => $val) {\r
- $attr = strtolower($attr);\r
- \r
- if ($val === TRUE) {\r
- $attributes[] = $attr;\r
- } elseif (!empty($val)) {\r
- //allow multi-value attributes to be passed as array\r
- if (is_array($val)) {\r
- sort($val); //gzip?\r
- \r
- $val = implode(' ', $val);\r
- }\r
- \r
- $val = htmlspecialchars($val, $quote_style, $charset, $double_encode);\r
- $attributes[] = "$attr=\"$val\"";\r
- }\r
- }\r
-\r
- sort($attributes); //gzip?\r
- \r
- return implode(' ', $attributes);\r
-}\r
+ elgg_extend_view('css/screen', 'html5/css');\r
\r
-// remove all the junk that elgg_view throws into $vars\r
-function html5_clean_vars(array $vars = array()) {\r
- unset($vars['config']);\r
- unset($vars['url']);\r
- unset($vars['page_owner']);\r
- unset($vars['page_owner_user']);\r
- \r
- foreach ($_SESSION as $key => $value) {\r
- unset($vars[$key]);\r
- }\r
- \r
- // backwards compatibility code\r
- if (isset($vars['internalname'])) {\r
- $vars['name'] = $vars['internalname'];\r
- unset($vars['internalname']);\r
- }\r
- \r
- if (isset($vars['internalid'])) {\r
- $vars['id'] = $vars['internalid'];\r
- unset($vars['internalid']);\r
- }\r
- \r
- return $vars;\r
+ elgg_register_js('Modernizr', 'mod/html5/js/Modernizr-1.5.js', 'head', 1);\r
+ elgg_register_js('jquery.placeholder', 'mod/html5/js/jquery.placeholder-1.0.1.js', 'footer');\r
}\r
\r
-register_elgg_event_handler('init', 'system', 'html5_init');\r
+elgg_register_event_handler('init', 'system', 'html5_init');\r
'border' => 0,
);
-$attributes = html5_get_html_attributes(array_merge($defaults, $vars));
+$attributes = elgg_format_attributes(array_merge($defaults, $vars));
echo "<img $attributes />";
\ No newline at end of file
+++ /dev/null
-<input type="button" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<input type="checkbox" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Elgg checkbox input
- * Displays a checkbox input field
- * NB: This also includes a hidden input with the same name as the checkboxes
- * to make sure something is sent to the server. The default value is 0.
- * If using JS, be specific to avoid selecting the hidden default value:
- * $('input[type=checkbox][name=internalname])
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses string $vars['internalname'] The name of the input fields (Forced to an array by appending [])
- * @uses array $vars['options'] An array of strings representing the label => option for the each checkbox field
- * @uses string $vars['internalid'] The id for each input field. Optional (Only use this with a single value.)
- * @uses string $vars['default'] The default value to send if nothing is checked. Optional, defaults to 0.
- * @uses bool $vars['disabled'] Make all input elements disabled. Optional.
- * @uses string $vars['value'] The current value. Optional.
- * @uses string $vars['class'] The class of each input element. Optional.
- * @uses string $vars['js'] Any Javascript to enter into the input tag. Optional.
- *
- */
-
-$defaults = array(
- 'class' => 'input-checkboxes',
- 'disabled' => FALSE,
-);
-
-$vars = array_merge($defaults, $vars);
-
-$value = $vars['value'];
-unset($vars['value']);
-
-$value_array = (is_array($value)) ? array_map('strtolower', $value) : array(strtolower($value));
-
-$options = $vars['options'];
-unset($vars['options']);
-
-if ($options) {
- foreach($options as $value => $label) {
- echo "<label>";
- echo elgg_view('input/checkbox', array_merge($vars, array(
- 'value' => $value,
- 'internalname' => $vars['internalname'].'[]',
- 'checked' => in_array(strtolower($value), $value_array),
- )));
- echo "$label</label><br />";
- }
-}
\ No newline at end of file
-<input type="color" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="color" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php\r
-if (isset($vars['value']) && is_int($vars['value'])) {\r
- $vars['value'] = date("Y-m-d", $vars['value']);\r
-}\r
-?>\r
-<input type="date" <?php echo html5_get_html_attributes($vars); ?> />\r
$vars['value'] = date("Y-m-d\TH:i:s", $vars['value']);\r
}\r
?>\r
-<input type="datetime-local" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="datetime-local" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
$vars['value'] = date("c", $vars['value']);\r
}\r
?>\r
-<input type="datetime" <?php echo html5_get_html_attributes($vars); ?> />\r
+<input type="datetime" <?php echo elgg_format_attributes($vars); ?> />\r
-<input type="email" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="email" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<input type="file" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Create a form for data submission.
- * Use this view for forms rather than creating a form tag in the wild as it provides
- * extra security which help prevent CSRF attacks.
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses $vars['body'] The body of the form (made up of other input/xxx views and html
- * @uses $vars['disable_security'] Force the securitytokens not to be added to this form (@todo what's the point??)
- *
- */
-$defaults = array(
- 'body' => '',
- 'method' => 'POST',
-);
-
-$vars = array_merge($defaults, $vars);
-
-$body = $vars['body'];
-unset($vars['body']);
-
-if ($vars['disable_security'] != TRUE) {
- $body .= elgg_view('input/securitytoken');
-}
-unset($vars['disable_security']);
-
-$attributes = html5_get_html_attributes($vars);
-
-echo "<form $attributes>$body</form>";
+++ /dev/null
-<input type="hidden" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
-<input type="image" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="image" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Elgg long text input
- * Displays a long text input field
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses $vars['value'] The current value, if any
- * @uses $vars['js'] Any Javascript to enter into the input tag
- * @uses $vars['internalname'] The name of the input field
- *
- */
-
-$defaults = array(
- 'class' => 'input-richtext',
-);
-
-$value = $vars['value'];
-unset($vars['value']);
-
-$attributes = html5_get_html_attributes(array_merge($defaults, $vars));
-
-echo "<textarea $attributes>$value</textarea>";
\ No newline at end of file
}\r
?>\r
\r
-<input type="month" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="month" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
-<input type="number" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="number" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
}
$text = htmlentities($text, ENT_QUOTES, 'UTF-8');
-$attributes = html5_get_html_attributes($vars);
+$attributes = elgg_format_attributes($vars);
echo "<option $attributes>$text</option>";
\ No newline at end of file
+++ /dev/null
-<input type="password" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Elgg long text input
- * Displays a long text input field
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- */
-
-$defaults = array(
- 'class' => 'input-plaintext',
-);
-
-$value = $vars['value'];
-unset($vars['value']);
-
-$attributes = html5_get_html_attributes(array_merge($defaults, $vars));
-
-echo "<textarea $attributes>$value</textarea>";
\ No newline at end of file
+++ /dev/null
-<?php
-
-/**
- * Elgg pulldown input
- * Displays a pulldown input field
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses $vars['options'] An array of strings representing the options for the pulldown field
- * @uses $vars['options_values'] An associative array of "value" => "option" where "value" is an internal name and "option" is
- * the value displayed on the button. Replaces $vars['options'] when defined.
- */
-
-$defaults = array(
- 'class' => 'input-pulldown',
-);
-
-$vars = array_merge($defaults, $vars);
-
-$options_values = $vars['options_values'];
-unset($vars['options_values']);
-
-$options = $vars['options'];
-unset($options);
-
-$value = $vars['value'];
-unset($vars['value']);
-?>
-
-<select <?php echo html5_get_html_attributes($vars); ?>>
-<?php
-if ($options_values) {
- foreach($options_values as $opt_val => $opt_text) {
- echo elgg_view('input/option', array(
- 'value' => $opt_val,
- 'text' => $opt_text,
- 'selected' => ($opt_val == $value),
- ));
- }
-} else {
- foreach($options as $option) {
- echo elgg_view('input/option', array(
- 'text' => $option,
- 'selected' => ($option == $value),
- ));
- }
-}
-?>
-</select>
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="range" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="range" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
-$defaults = array(\r
- 'value' => elgg_echo('reset'),\r
-);\r
-\r
-$vars = array_merge($defaults, $vars);\r
-?>\r
-\r
-<input type="reset" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="search" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="search" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php\r
-\r
-$defaults = array(\r
- 'value' => elgg_echo('submit'),\r
-);\r
-\r
-$vars = array_merge($defaults, $vars); \r
-?>\r
-\r
-<input type="submit" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php
-/**
- * Elgg tag input
- * Displays a tag input field
- *
- * @package Elgg
- * @subpackage Core
- * @author Curverider Ltd
- * @link http://elgg.org/
- *
- * @uses $vars['value'] The current value, if any - string or array - tags will be encoded
- */
-
-$defaults = array(
- 'class' => 'input-tags',
- 'placeholder' => elgg_echo('placeholder:tags'),
-);
-
-if (isset($vars['value']) && is_array($vars['value'])) {
- $vars['value'] = implode(", ", $vars['value']);
-}
-
-echo elgg_view('input/text', array_merge($defaults, $vars));
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="tel" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="tel" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<input type="text" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="time" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="time" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="url" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="url" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
$vars = array_merge($defaults, $vars);\r
?>\r
\r
-<input type="week" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
+<input type="week" <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file
+++ /dev/null
-<?php\r
-global $CONFIG;\r
-\r
-include $CONFIG->pluginspath.'html5/js/Modernizr-1.5.min.js';\r
-\r
-$placeholder_script = $vars['url'].'mod/html5/js/jquery.placeholder-1.0.1.js';\r
-?>\r
-\r
-if (!Modernizr.input.placeholder) {\r
- $(function() { $('[placeholder]').placeholder({className:'html5-placeholder'}); });\r
- document.write('<script src="<?php echo $placeholder_script; ?>"></script>');\r
-}\r
}
$vars['href'] = $url;
-$attributes = html5_get_html_attributes($vars);
+$attributes = elgg_format_attributes($vars);
echo "<a $attributes>$body</a>";