]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Removed custom html5 function in favor of core function
authorEvan Winslow <evan@elgg.org>
Sat, 19 Mar 2011 04:28:05 +0000 (21:28 -0700)
committerEvan Winslow <evan@elgg.org>
Sat, 19 Mar 2011 04:28:05 +0000 (21:28 -0700)
34 files changed:
manifest.xml
start.php
views/default/html/img.php
views/default/input/button.php [deleted file]
views/default/input/checkbox.php [deleted file]
views/default/input/checkboxes.php [deleted file]
views/default/input/color.php
views/default/input/date.php [deleted file]
views/default/input/datetime-local.php
views/default/input/datetime.php
views/default/input/email.php
views/default/input/file.php [deleted file]
views/default/input/form.php [deleted file]
views/default/input/hidden.php [deleted file]
views/default/input/image.php
views/default/input/longtext.php [deleted file]
views/default/input/month.php
views/default/input/number.php
views/default/input/option.php
views/default/input/password.php [deleted file]
views/default/input/plaintext.php [deleted file]
views/default/input/pulldown.php [deleted file]
views/default/input/range.php
views/default/input/reset.php [deleted file]
views/default/input/search.php
views/default/input/submit.php [deleted file]
views/default/input/tags.php [deleted file]
views/default/input/tel.php
views/default/input/text.php [deleted file]
views/default/input/time.php
views/default/input/url.php
views/default/input/week.php
views/default/js/html5.php [deleted file]
views/default/output/url.php

index c48ca01a3b2caa9f4eeca251b85b186c339fe8f1..a5399845abc53b6b670b45d357499d59d7bb651c 100644 (file)
@@ -1,8 +1,8 @@
 <?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
index d83e75bcdd49d6c88d5a3d3780f1bbff0529c89b..848190933d71c258e4d7bdf04b75d6c652bd9d5d 100644 (file)
--- a/start.php
+++ b/start.php
@@ -1,71 +1,10 @@
 <?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
index 734e59a55a614138efc6417d22cb60279af9b125..10fcbe0d1b114e1b68ae7f0f16b4a2be2e198c27 100644 (file)
@@ -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 (file)
index ddf4325..0000000
+++ /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 (file)
index 5ba04a8..0000000
+++ /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 (file)
index 1e13b06..0000000
+++ /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
index 76dd5060327a562c99069c9c44df7d40406b145c..8bc4ad2a3ebd9ea2c6595789612e7fb2fab8a018 100644 (file)
@@ -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 (file)
index c408ea3..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?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
index e0ab4b171497931071053c6311b8842f29456928..52902f54357bc4d6872a00c3f9cea45b20c53a99 100644 (file)
@@ -3,4 +3,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
        $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
index eaa32634e87d1b85e501a25c6540d345335c94fc..61262f234eb0ba3a780dc96e1c8ceaef571a3884 100644 (file)
@@ -3,4 +3,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
        $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
index 797fa582fc3cf672d39ac58d2c48bc64aea24d26..15e36f1459e66a29a1c738b590be8ec894dc42cc 100644 (file)
@@ -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 (file)
index 9df2868..0000000
+++ /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 (file)
index 364e13f..0000000
+++ /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 (file)
index 9443826..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<input type="hidden" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
index ae65d86ca508e7eefc0c6dae74ce96e0d02a4844..bb6a44045fd2de30524730dc052c8cb8e9df3923 100644 (file)
@@ -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 (file)
index 1020ef6..0000000
+++ /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
index 4bd3200462d2e1ce70b77996b62e3b0ada2ed944..4eaf910486126067ad9f31a241d723f7a93185a4 100644 (file)
@@ -4,4 +4,4 @@ if (isset($vars['value']) && is_int($vars['value'])) {
 }\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
index ccfb72641a98f33482a27c2c627a4934ce056066..908e9382e09b667210e5b63f11723c4ffe604a51 100644 (file)
@@ -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
index f420c9be4baae8c1d54000d8b8e69ed4afa9797e..05d5d649fcebd92c0f52dae554eba7a9e8d6ce85 100644 (file)
@@ -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 (file)
index 8c97cf0..0000000
+++ /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 (file)
index cd0a7d6..0000000
+++ /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 (file)
index 8a30838..0000000
+++ /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
index 588b835d106752511f2064e02da6ba854d85aa91..8d4d7f13dadf28ea0f67ed23438e960aa6a645f0 100644 (file)
@@ -7,4 +7,4 @@ $defaults = array(
 $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
diff --git a/views/default/input/reset.php b/views/default/input/reset.php
deleted file mode 100644 (file)
index b1c7c06..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?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
index 47988be51efe3d83918d183ce8ed43d0477b8358..29adba5fc43eeb35ee366617a3f530366d8471db 100644 (file)
@@ -7,4 +7,4 @@ $defaults = array(
 $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
diff --git a/views/default/input/submit.php b/views/default/input/submit.php
deleted file mode 100644 (file)
index 4c86f6c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-<?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
diff --git a/views/default/input/tags.php b/views/default/input/tags.php
deleted file mode 100644 (file)
index 3f5e248..0000000
+++ /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
index 441e85bf0736a5382142838ab83e0992edf3ac5a..3295545012ec79de544ba7a2c24020a65960d800 100644 (file)
@@ -6,4 +6,4 @@ $defaults = array(
 $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
diff --git a/views/default/input/text.php b/views/default/input/text.php
deleted file mode 100644 (file)
index 7bc22d0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<input type="text" <?php echo html5_get_html_attributes($vars); ?> />
\ No newline at end of file
index 641dd524401a61b593f823709a291ca85ed6dfa2..58c8b092843d44f6d4c771cdba452dabf87fec10 100644 (file)
@@ -7,4 +7,4 @@ $defaults = array(
 $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
index a0851f4d9486c7a5c8336db4cd17a5e236d16adf..d42d7c05696151773202beb38d7f3b89942c1dcc 100644 (file)
@@ -7,4 +7,4 @@ $defaults = array(
 $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
index d921755a9d889dc8b44b8e00a08584f1fa2aae7a..59cf5d7f1021e00981e26cdd804a30c0a2d71d93 100644 (file)
@@ -7,4 +7,4 @@ $defauts = array(
 $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
diff --git a/views/default/js/html5.php b/views/default/js/html5.php
deleted file mode 100644 (file)
index ba2a517..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<?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
index 274221a1b22cf3592380d413efa6e4f8789fd42d..31db9e928d3867365fda5e29d5eda8d6af8a5a64 100644 (file)
@@ -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>";