aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--manifest.xml12
-rw-r--r--start.php69
-rw-r--r--views/default/html/img.php2
-rw-r--r--views/default/input/button.php1
-rw-r--r--views/default/input/checkbox.php1
-rw-r--r--views/default/input/checkboxes.php51
-rw-r--r--views/default/input/color.php2
-rw-r--r--views/default/input/date.php6
-rw-r--r--views/default/input/datetime-local.php2
-rw-r--r--views/default/input/datetime.php2
-rw-r--r--views/default/input/email.php2
-rw-r--r--views/default/input/file.php1
-rw-r--r--views/default/input/form.php33
-rw-r--r--views/default/input/hidden.php1
-rw-r--r--views/default/input/image.php2
-rw-r--r--views/default/input/longtext.php26
-rw-r--r--views/default/input/month.php2
-rw-r--r--views/default/input/number.php2
-rw-r--r--views/default/input/option.php2
-rw-r--r--views/default/input/password.php1
-rw-r--r--views/default/input/plaintext.php22
-rw-r--r--views/default/input/pulldown.php52
-rw-r--r--views/default/input/range.php2
-rw-r--r--views/default/input/reset.php10
-rw-r--r--views/default/input/search.php2
-rw-r--r--views/default/input/submit.php10
-rw-r--r--views/default/input/tags.php23
-rw-r--r--views/default/input/tel.php2
-rw-r--r--views/default/input/text.php1
-rw-r--r--views/default/input/time.php2
-rw-r--r--views/default/input/url.php2
-rw-r--r--views/default/input/week.php2
-rw-r--r--views/default/js/html5.php12
-rw-r--r--views/default/output/url.php2
34 files changed, 26 insertions, 338 deletions
diff --git a/manifest.xml b/manifest.xml
index c48ca01a3..a5399845a 100644
--- a/manifest.xml
+++ b/manifest.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<plugin_manifest>
- <field key="author" value="Evan Winslow" />
- <field key="version" value="1.0" />
- <field key="description" value="Provides HTML5 support for Elgg" />
- <field key="copyright" value="(C) Evan Winslow 2010" />
- <field key="website" value="http://code.google.com/p/elgg-ewinslow" />
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <author>Evan Winslow</author>
+ <version>1.0</version>
+ <description>Provides HTML5 support for Elgg</description>
+ <copyright>(C) Evan Winslow 2010</copyright>
+ <website>http://code.google.com/p/elgg-ewinslow</website>
</plugin_manifest> \ No newline at end of file
diff --git a/start.php b/start.php
index d83e75bcd..848190933 100644
--- a/start.php
+++ b/start.php
@@ -1,71 +1,10 @@
<?php
function html5_init() {
- elgg_extend_view('css', 'html5/css');
-
- elgg_extend_view('js/initialise_elgg', 'js/html5');
-}
-
-function html5_get_html_attributes(array $attrs = array(), $quote_style = ENT_COMPAT, $charset = 'UTF-8', $double_encode = TRUE) {
- $attrs = html5_clean_vars($attrs);
- $attributes = array();
-
- if (isset($attrs['js'])) {
- elgg_deprecated_notice("Use of the 'js' attribute was deprecated in 1.8. You can now use the js attributes directly.", '1.8');
-
- if (!empty($attrs['js'])) {
- $attributes[] = $attrs['js'];
- }
-
- unset($attrs['js']);
- }
-
- foreach ($attrs as $attr => $val) {
- $attr = strtolower($attr);
-
- if ($val === TRUE) {
- $attributes[] = $attr;
- } elseif (!empty($val)) {
- //allow multi-value attributes to be passed as array
- if (is_array($val)) {
- sort($val); //gzip?
-
- $val = implode(' ', $val);
- }
-
- $val = htmlspecialchars($val, $quote_style, $charset, $double_encode);
- $attributes[] = "$attr=\"$val\"";
- }
- }
-
- sort($attributes); //gzip?
-
- return implode(' ', $attributes);
-}
+ elgg_extend_view('css/screen', 'html5/css');
-// remove all the junk that elgg_view throws into $vars
-function html5_clean_vars(array $vars = array()) {
- unset($vars['config']);
- unset($vars['url']);
- unset($vars['page_owner']);
- unset($vars['page_owner_user']);
-
- foreach ($_SESSION as $key => $value) {
- unset($vars[$key]);
- }
-
- // backwards compatibility code
- if (isset($vars['internalname'])) {
- $vars['name'] = $vars['internalname'];
- unset($vars['internalname']);
- }
-
- if (isset($vars['internalid'])) {
- $vars['id'] = $vars['internalid'];
- unset($vars['internalid']);
- }
-
- return $vars;
+ elgg_register_js('Modernizr', 'mod/html5/js/Modernizr-1.5.js', 'head', 1);
+ elgg_register_js('jquery.placeholder', 'mod/html5/js/jquery.placeholder-1.0.1.js', 'footer');
}
-register_elgg_event_handler('init', 'system', 'html5_init');
+elgg_register_event_handler('init', 'system', 'html5_init');
diff --git a/views/default/html/img.php b/views/default/html/img.php
index 734e59a55..10fcbe0d1 100644
--- a/views/default/html/img.php
+++ b/views/default/html/img.php
@@ -6,6 +6,6 @@ $defaults = array(
'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
diff --git a/views/default/input/button.php b/views/default/input/button.php
deleted file mode 100644
index ddf432562..000000000
--- a/views/default/input/button.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="button" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/checkbox.php b/views/default/input/checkbox.php
deleted file mode 100644
index 5ba04a8cd..000000000
--- a/views/default/input/checkbox.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="checkbox" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/checkboxes.php b/views/default/input/checkboxes.php
deleted file mode 100644
index 1e13b0687..000000000
--- a/views/default/input/checkboxes.php
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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
diff --git a/views/default/input/color.php b/views/default/input/color.php
index 76dd50603..8bc4ad2a3 100644
--- a/views/default/input/color.php
+++ b/views/default/input/color.php
@@ -1 +1 @@
-<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
diff --git a/views/default/input/date.php b/views/default/input/date.php
deleted file mode 100644
index c408ea3a7..000000000
--- a/views/default/input/date.php
+++ /dev/null
@@ -1,6 +0,0 @@
-<?php
-if (isset($vars['value']) && is_int($vars['value'])) {
- $vars['value'] = date("Y-m-d", $vars['value']);
-}
-?>
-<input type="date" <?php echo html5_get_html_attributes($vars); ?> />
diff --git a/views/default/input/datetime-local.php b/views/default/input/datetime-local.php
index e0ab4b171..52902f543 100644
--- a/views/default/input/datetime-local.php
+++ b/views/default/input/datetime-local.php
@@ -3,4 +3,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("Y-m-d\TH:i:s", $vars['value']);
}
?>
-<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
diff --git a/views/default/input/datetime.php b/views/default/input/datetime.php
index eaa32634e..61262f234 100644
--- a/views/default/input/datetime.php
+++ b/views/default/input/datetime.php
@@ -3,4 +3,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
$vars['value'] = date("c", $vars['value']);
}
?>
-<input type="datetime" <?php echo html5_get_html_attributes($vars); ?> />
+<input type="datetime" <?php echo elgg_format_attributes($vars); ?> />
diff --git a/views/default/input/email.php b/views/default/input/email.php
index 797fa582f..15e36f145 100644
--- a/views/default/input/email.php
+++ b/views/default/input/email.php
@@ -1 +1 @@
-<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
diff --git a/views/default/input/file.php b/views/default/input/file.php
deleted file mode 100644
index 9df286890..000000000
--- a/views/default/input/file.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="file" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/form.php b/views/default/input/form.php
deleted file mode 100644
index 364e13f86..000000000
--- a/views/default/input/form.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?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>";
diff --git a/views/default/input/hidden.php b/views/default/input/hidden.php
deleted file mode 100644
index 944382616..000000000
--- a/views/default/input/hidden.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="hidden" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/image.php b/views/default/input/image.php
index ae65d86ca..bb6a44045 100644
--- a/views/default/input/image.php
+++ b/views/default/input/image.php
@@ -1 +1 @@
-<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
diff --git a/views/default/input/longtext.php b/views/default/input/longtext.php
deleted file mode 100644
index 1020ef640..000000000
--- a/views/default/input/longtext.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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
diff --git a/views/default/input/month.php b/views/default/input/month.php
index 4bd320046..4eaf91048 100644
--- a/views/default/input/month.php
+++ b/views/default/input/month.php
@@ -4,4 +4,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
}
?>
-<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
diff --git a/views/default/input/number.php b/views/default/input/number.php
index ccfb72641..908e9382e 100644
--- a/views/default/input/number.php
+++ b/views/default/input/number.php
@@ -1 +1 @@
-<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
diff --git a/views/default/input/option.php b/views/default/input/option.php
index f420c9be4..05d5d649f 100644
--- a/views/default/input/option.php
+++ b/views/default/input/option.php
@@ -8,6 +8,6 @@ if (!isset($text)) {
}
$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
diff --git a/views/default/input/password.php b/views/default/input/password.php
deleted file mode 100644
index 8c97cf020..000000000
--- a/views/default/input/password.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="password" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/plaintext.php b/views/default/input/plaintext.php
deleted file mode 100644
index cd0a7d6b5..000000000
--- a/views/default/input/plaintext.php
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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
diff --git a/views/default/input/pulldown.php b/views/default/input/pulldown.php
deleted file mode 100644
index 8a30838d4..000000000
--- a/views/default/input/pulldown.php
+++ /dev/null
@@ -1,52 +0,0 @@
-<?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
diff --git a/views/default/input/range.php b/views/default/input/range.php
index 588b835d1..8d4d7f13d 100644
--- a/views/default/input/range.php
+++ b/views/default/input/range.php
@@ -7,4 +7,4 @@ $defaults = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/input/reset.php b/views/default/input/reset.php
deleted file mode 100644
index b1c7c06ed..000000000
--- a/views/default/input/reset.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-$defaults = array(
- 'value' => elgg_echo('reset'),
-);
-
-$vars = array_merge($defaults, $vars);
-?>
-
-<input type="reset" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/search.php b/views/default/input/search.php
index 47988be51..29adba5fc 100644
--- a/views/default/input/search.php
+++ b/views/default/input/search.php
@@ -7,4 +7,4 @@ $defaults = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/input/submit.php b/views/default/input/submit.php
deleted file mode 100644
index 4c86f6c66..000000000
--- a/views/default/input/submit.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-$defaults = array(
- 'value' => elgg_echo('submit'),
-);
-
-$vars = array_merge($defaults, $vars);
-?>
-
-<input type="submit" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/tags.php b/views/default/input/tags.php
deleted file mode 100644
index 3f5e2481a..000000000
--- a/views/default/input/tags.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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
diff --git a/views/default/input/tel.php b/views/default/input/tel.php
index 441e85bf0..329554501 100644
--- a/views/default/input/tel.php
+++ b/views/default/input/tel.php
@@ -6,4 +6,4 @@ $defaults = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/input/text.php b/views/default/input/text.php
deleted file mode 100644
index 7bc22d04a..000000000
--- a/views/default/input/text.php
+++ /dev/null
@@ -1 +0,0 @@
-<input type="text" <?php echo html5_get_html_attributes($vars); ?> /> \ No newline at end of file
diff --git a/views/default/input/time.php b/views/default/input/time.php
index 641dd5244..58c8b0928 100644
--- a/views/default/input/time.php
+++ b/views/default/input/time.php
@@ -7,4 +7,4 @@ $defaults = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/input/url.php b/views/default/input/url.php
index a0851f4d9..d42d7c056 100644
--- a/views/default/input/url.php
+++ b/views/default/input/url.php
@@ -7,4 +7,4 @@ $defaults = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/input/week.php b/views/default/input/week.php
index d921755a9..59cf5d7f1 100644
--- a/views/default/input/week.php
+++ b/views/default/input/week.php
@@ -7,4 +7,4 @@ $defauts = array(
$vars = array_merge($defaults, $vars);
?>
-<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
diff --git a/views/default/js/html5.php b/views/default/js/html5.php
deleted file mode 100644
index ba2a517d9..000000000
--- a/views/default/js/html5.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-global $CONFIG;
-
-include $CONFIG->pluginspath.'html5/js/Modernizr-1.5.min.js';
-
-$placeholder_script = $vars['url'].'mod/html5/js/jquery.placeholder-1.0.1.js';
-?>
-
-if (!Modernizr.input.placeholder) {
- $(function() { $('[placeholder]').placeholder({className:'html5-placeholder'}); });
- document.write('<script src="<?php echo $placeholder_script; ?>"></script>');
-}
diff --git a/views/default/output/url.php b/views/default/output/url.php
index 274221a1b..31db9e928 100644
--- a/views/default/output/url.php
+++ b/views/default/output/url.php
@@ -43,5 +43,5 @@ if (!isset($body)) {
}
$vars['href'] = $url;
-$attributes = html5_get_html_attributes($vars);
+$attributes = elgg_format_attributes($vars);
echo "<a $attributes>$body</a>";