From dff32c364b99e57db5ea891ce93f7ab5df9b3258 Mon Sep 17 00:00:00 2001 From: Evan Winslow Date: Fri, 18 Mar 2011 21:28:05 -0700 Subject: Removed custom html5 function in favor of core function --- manifest.xml | 12 +++--- start.php | 69 ++-------------------------------- views/default/html/img.php | 2 +- views/default/input/button.php | 1 - views/default/input/checkbox.php | 1 - views/default/input/checkboxes.php | 51 ------------------------- views/default/input/color.php | 2 +- views/default/input/date.php | 6 --- views/default/input/datetime-local.php | 2 +- views/default/input/datetime.php | 2 +- views/default/input/email.php | 2 +- views/default/input/file.php | 1 - views/default/input/form.php | 33 ---------------- views/default/input/hidden.php | 1 - views/default/input/image.php | 2 +- views/default/input/longtext.php | 26 ------------- views/default/input/month.php | 2 +- views/default/input/number.php | 2 +- views/default/input/option.php | 2 +- views/default/input/password.php | 1 - views/default/input/plaintext.php | 22 ----------- views/default/input/pulldown.php | 52 ------------------------- views/default/input/range.php | 2 +- views/default/input/reset.php | 10 ----- views/default/input/search.php | 2 +- views/default/input/submit.php | 10 ----- views/default/input/tags.php | 23 ------------ views/default/input/tel.php | 2 +- views/default/input/text.php | 1 - views/default/input/time.php | 2 +- views/default/input/url.php | 2 +- views/default/input/week.php | 2 +- views/default/js/html5.php | 12 ------ views/default/output/url.php | 2 +- 34 files changed, 26 insertions(+), 338 deletions(-) delete mode 100644 views/default/input/button.php delete mode 100644 views/default/input/checkbox.php delete mode 100644 views/default/input/checkboxes.php delete mode 100644 views/default/input/date.php delete mode 100644 views/default/input/file.php delete mode 100644 views/default/input/form.php delete mode 100644 views/default/input/hidden.php delete mode 100644 views/default/input/longtext.php delete mode 100644 views/default/input/password.php delete mode 100644 views/default/input/plaintext.php delete mode 100644 views/default/input/pulldown.php delete mode 100644 views/default/input/reset.php delete mode 100644 views/default/input/submit.php delete mode 100644 views/default/input/tags.php delete mode 100644 views/default/input/text.php delete mode 100644 views/default/js/html5.php diff --git a/manifest.xml b/manifest.xml index c48ca01a3..a5399845a 100644 --- a/manifest.xml +++ b/manifest.xml @@ -1,8 +1,8 @@ - - - - - - + + Evan Winslow + 1.0 + Provides HTML5 support for Elgg + (C) Evan Winslow 2010 + http://code.google.com/p/elgg-ewinslow \ 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 @@ $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 ""; \ 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 @@ - /> \ 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 @@ - /> \ 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 @@ - 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 "
"; - } -} \ 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 @@ - /> \ No newline at end of file + /> \ 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 @@ - - /> 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']); } ?> - /> \ No newline at end of file + /> \ 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']); } ?> - /> + /> 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 @@ - /> \ No newline at end of file + /> \ 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 @@ - /> \ 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 @@ - '', - '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 "
$body
"; 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 @@ - /> \ 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 @@ - /> \ No newline at end of file + /> \ 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 @@ - 'input-richtext', -); - -$value = $vars['value']; -unset($vars['value']); - -$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); - -echo ""; \ 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'])) { } ?> - /> \ No newline at end of file + /> \ 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 @@ - /> \ No newline at end of file + /> \ 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 ""; \ 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 @@ - /> \ 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 @@ - 'input-plaintext', -); - -$value = $vars['value']; -unset($vars['value']); - -$attributes = html5_get_html_attributes(array_merge($defaults, $vars)); - -echo ""; \ 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 @@ - "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']); -?> - - \ 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); ?> - /> \ No newline at end of file + /> \ 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 @@ - elgg_echo('reset'), -); - -$vars = array_merge($defaults, $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); ?> - /> \ No newline at end of file + /> \ 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 @@ - elgg_echo('submit'), -); - -$vars = array_merge($defaults, $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 @@ - '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); ?> - /> \ No newline at end of file + /> \ 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 @@ - /> \ 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); ?> - /> \ No newline at end of file + /> \ 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); ?> - /> \ No newline at end of file + /> \ 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); ?> - /> \ No newline at end of file + /> \ 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 @@ -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(''); -} 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 "$body"; -- cgit v1.2.3