diff options
author | Sem <sembrestels@riseup.net> | 2013-11-09 16:30:07 +0100 |
---|---|---|
committer | Sem <sembrestels@riseup.net> | 2013-11-09 16:30:07 +0100 |
commit | e843405646960ffd1918d8191c5eba6219ba38b3 (patch) | |
tree | 968a62c1fac728f5e0efdce5927fb1b79615e6cc | |
parent | dee4ff21a5a5e8b8c5dbeae0a2f89a36a3f1c6cc (diff) | |
parent | b623f64507956f7beee0d8352fd044bdb70f5d23 (diff) | |
download | elgg-e843405646960ffd1918d8191c5eba6219ba38b3.tar.gz elgg-e843405646960ffd1918d8191c5eba6219ba38b3.tar.bz2 |
Add 'mod/html5/' from commit 'b623f64507956f7beee0d8352fd044bdb70f5d23'
git-subtree-dir: mod/html5
git-subtree-mainline: dee4ff21a5a5e8b8c5dbeae0a2f89a36a3f1c6cc
git-subtree-split: b623f64507956f7beee0d8352fd044bdb70f5d23
31 files changed, 875 insertions, 0 deletions
diff --git a/mod/html5/.gitignore b/mod/html5/.gitignore new file mode 100644 index 000000000..336139754 --- /dev/null +++ b/mod/html5/.gitignore @@ -0,0 +1,3 @@ +/.project +/.buildpath +/.settings diff --git a/mod/html5/README b/mod/html5/README new file mode 100644 index 000000000..29e8181b9 --- /dev/null +++ b/mod/html5/README @@ -0,0 +1,7 @@ +# HTML5 Plugin for Elgg #
+Provides several javascript libraries + views that allow developers to start using HTML5 features in Elgg today.
+
+## Features ##
+* HTML5 input views
+* Modernizr javascript library for easy html5 feature detection
+* Javascript shim for the placeholder attribute
\ No newline at end of file diff --git a/mod/html5/manifest.xml b/mod/html5/manifest.xml new file mode 100644 index 000000000..e5a53dda7 --- /dev/null +++ b/mod/html5/manifest.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>HTML5</name>
+ <author>Evan Winslow and Lorea Developers</author>
+ <version>1.8.0</version>
+ <description>
+ Provides several javascript libraries + views that allow developers to start using HTML5 features in Elgg today.
+ </description>
+ <copyright>(C) Evan Winslow 2010</copyright>
+ <website>http://github.com/ewinslow/elgg-html5</website>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+</plugin_manifest>
diff --git a/mod/html5/start.php b/mod/html5/start.php new file mode 100644 index 000000000..462eb88e7 --- /dev/null +++ b/mod/html5/start.php @@ -0,0 +1,11 @@ +<?php
+
+function html5_init() {
+ elgg_extend_view('css/elgg', 'html5/css', 1);
+ elgg_extend_view('theme_preview/forms/inputs', 'html5/theme_preview/forms/inputs');
+
+ elgg_register_js('Modernizr', '/mod/html5/vendors/Modernizr-1.5.js', 'head', 1);
+ elgg_register_js('jquery.placeholder', '/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js', 'footer');
+}
+
+elgg_register_event_handler('init', 'system', 'html5_init');
diff --git a/mod/html5/vendors/Modernizr-1.5.min.js b/mod/html5/vendors/Modernizr-1.5.min.js new file mode 100644 index 000000000..a8dc724e6 --- /dev/null +++ b/mod/html5/vendors/Modernizr-1.5.min.js @@ -0,0 +1,28 @@ +/*!
+ * Modernizr JavaScript library 1.5
+ * http://www.modernizr.com/
+ *
+ * Copyright (c) 2009-2010 Faruk Ates - http://farukat.es/
+ * Dual-licensed under the BSD and MIT licenses.
+ * http://www.modernizr.com/license/
+ *
+ * Featuring major contributions by
+ * Paul Irish - http://paulirish.com
+ */
+ window.Modernizr=function(i,e,I){function C(a,b){for(var c in a)if(m[a[c]]!==I&&(!b||b(a[c],D)))return true}function r(a,b){var c=a.charAt(0).toUpperCase()+a.substr(1);return!!C([a,"Webkit"+c,"Moz"+c,"O"+c,"ms"+c,"Khtml"+c],b)}function P(){j[E]=function(a){for(var b=0,c=a.length;b<c;b++)J[a[b]]=!!(a[b]in n);return J}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" "));j[Q]=function(a){for(var b=0,c,h=a.length;b<h;b++){n.setAttribute("type",a[b]);if(c=n.type!==
+ "text"){n.value=K;/tel|search/.test(n.type)||(c=/url|email/.test(n.type)?n.checkValidity&&n.checkValidity()===false:n.value!=K)}L[a[b]]=!!c}return L}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var j={},s=e.documentElement,D=e.createElement("modernizr"),m=D.style,n=e.createElement("input"),E="input",Q=E+"types",K=":)",M=Object.prototype.toString,y=" -o- -moz- -ms- -webkit- -khtml- ".split(" "),d={},L={},J={},N=[],u=function(){var a={select:"input",
+ change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"},b={};return function(c,h){var t=arguments.length==1;if(t&&b[c])return b[c];h=h||document.createElement(a[c]||"div");c="on"+c;var g=c in h;if(!g&&h.setAttribute){h.setAttribute(c,"return;");g=typeof h[c]=="function"}h=null;return t?(b[c]=g):g}}(),F={}.hasOwnProperty,O;O=typeof F!=="undefined"&&typeof F.call!=="undefined"?function(a,b){return F.call(a,b)}:function(a,b){return b in a&&typeof a.constructor.prototype[b]==="undefined"};
+ d.canvas=function(){return!!e.createElement("canvas").getContext};d.canvastext=function(){return!!(d.canvas()&&typeof e.createElement("canvas").getContext("2d").fillText=="function")};d.geolocation=function(){return!!navigator.geolocation};d.crosswindowmessaging=function(){return!!i.postMessage};d.websqldatabase=function(){var a=!!i.openDatabase;if(a)try{a=!!openDatabase("testdb","1.0","html5 test db",2E5)}catch(b){a=false}return a};d.indexedDB=function(){return!!i.indexedDB};d.hashchange=function(){return u("hashchange",
+ i)&&(document.documentMode===I||document.documentMode>7)};d.historymanagement=function(){return!!(i.history&&history.pushState)};d.draganddrop=function(){return u("drag")&&u("dragstart")&&u("dragenter")&&u("dragover")&&u("dragleave")&&u("dragend")&&u("drop")};d.websockets=function(){return"WebSocket"in i};d.rgba=function(){m.cssText="background-color:rgba(150,255,150,.5)";return(""+m.backgroundColor).indexOf("rgba")!==-1};d.hsla=function(){m.cssText="background-color:hsla(120,40%,100%,.5)";return(""+
+ m.backgroundColor).indexOf("rgba")!==-1};d.multiplebgs=function(){m.cssText="background:url(//:),url(//:),red url(//:)";return/(url\s*\(.*?){3}/.test(m.background)};d.backgroundsize=function(){return r("backgroundSize")};d.borderimage=function(){return r("borderImage")};d.borderradius=function(){return r("borderRadius","",function(a){return(""+a).indexOf("orderRadius")!==-1})};d.boxshadow=function(){return r("boxShadow")};d.opacity=function(){var a=y.join("opacity:.5;")+"";m.cssText=a;return(""+m.opacity).indexOf("0.5")!==
+ -1};d.cssanimations=function(){return r("animationName")};d.csscolumns=function(){return r("columnCount")};d.cssgradients=function(){var a=("background-image:"+y.join("gradient(linear,left top,right bottom,from(#9f9),to(white));background-image:")+y.join("linear-gradient(left top,#9f9, white);background-image:")).slice(0,-17);m.cssText=a;return(""+m.backgroundImage).indexOf("gradient")!==-1};d.cssreflections=function(){return r("boxReflect")};d.csstransforms=function(){return!!C(["transformProperty",
+ "WebkitTransform","MozTransform","OTransform","msTransform"])};d.csstransforms3d=function(){var a=!!C(["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"]);if(a){var b=document.createElement("style"),c=e.createElement("div");b.textContent="@media ("+y.join("transform-3d),(")+"modernizr){#modernizr{height:3px}}";e.getElementsByTagName("head")[0].appendChild(b);c.id="modernizr";s.appendChild(c);a=c.offsetHeight===3;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}return a};
+ d.csstransitions=function(){return r("transitionProperty")};d.fontface=function(){var a;if(/*@cc_on@if(@_jscript_version>=5)!@end@*/0)a=true;else{var b=e.createElement("style"),c=e.createElement("span"),h,t=false,g=e.body,o,w;b.textContent="@font-face{font-family:testfont;src:url('data:font/ttf;base64,AAEAAAAMAIAAAwBAT1MvMliohmwAAADMAAAAVmNtYXCp5qrBAAABJAAAANhjdnQgACICiAAAAfwAAAAEZ2FzcP//AAMAAAIAAAAACGdseWYv5OZoAAACCAAAANxoZWFk69bnvwAAAuQAAAA2aGhlYQUJAt8AAAMcAAAAJGhtdHgGDgC4AAADQAAAABRsb2NhAIQAwgAAA1QAAAAMbWF4cABVANgAAANgAAAAIG5hbWUgXduAAAADgAAABPVwb3N03NkzmgAACHgAAAA4AAECBAEsAAUAAAKZAswAAACPApkCzAAAAesAMwEJAAACAAMDAAAAAAAAgAACbwAAAAoAAAAAAAAAAFBmRWQAAAAgqS8DM/8zAFwDMwDNAAAABQAAAAAAAAAAAAMAAAADAAAAHAABAAAAAABGAAMAAQAAAK4ABAAqAAAABgAEAAEAAgAuqQD//wAAAC6pAP///9ZXAwAAAAAAAAACAAAABgBoAAAAAAAvAAEAAAAAAAAAAAAAAAAAAAABAAIAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABAAEACoAAAAGAAQAAQACAC6pAP//AAAALqkA////1lcDAAAAAAAAAAIAAAAiAogAAAAB//8AAgACACIAAAEyAqoAAwAHAC6xAQAvPLIHBADtMrEGBdw8sgMCAO0yALEDAC88sgUEAO0ysgcGAfw8sgECAO0yMxEhESczESMiARDuzMwCqv1WIgJmAAACAFUAAAIRAc0ADwAfAAATFRQWOwEyNj0BNCYrASIGARQGKwEiJj0BNDY7ATIWFX8aIvAiGhoi8CIaAZIoN/43KCg3/jcoAWD0JB4eJPQkHh7++EY2NkbVRjY2RgAAAAABAEH/+QCdAEEACQAANjQ2MzIWFAYjIkEeEA8fHw8QDxwWFhwWAAAAAQAAAAIAAIuYbWpfDzz1AAsEAAAAAADFn9IuAAAAAMWf0i797/8zA4gDMwAAAAgAAgAAAAAAAAABAAADM/8zAFwDx/3v/98DiAABAAAAAAAAAAAAAAAAAAAABQF2ACIAAAAAAVUAAAJmAFUA3QBBAAAAKgAqACoAWgBuAAEAAAAFAFAABwBUAAQAAgAAAAEAAQAAAEAALgADAAMAAAAQAMYAAQAAAAAAAACLAAAAAQAAAAAAAQAhAIsAAQAAAAAAAgAFAKwAAQAAAAAAAwBDALEAAQAAAAAABAAnAPQAAQAAAAAABQAKARsAAQAAAAAABgAmASUAAQAAAAAADgAaAUsAAwABBAkAAAEWAWUAAwABBAkAAQBCAnsAAwABBAkAAgAKAr0AAwABBAkAAwCGAscAAwABBAkABABOA00AAwABBAkABQAUA5sAAwABBAkABgBMA68AAwABBAkADgA0A/tDb3B5cmlnaHQgMjAwOSBieSBEYW5pZWwgSm9obnNvbi4gIFJlbGVhc2VkIHVuZGVyIHRoZSB0ZXJtcyBvZiB0aGUgT3BlbiBGb250IExpY2Vuc2UuIEtheWFoIExpIGdseXBocyBhcmUgcmVsZWFzZWQgdW5kZXIgdGhlIEdQTCB2ZXJzaW9uIDMuYmFlYzJhOTJiZmZlNTAzMiAtIHN1YnNldCBvZiBKdXJhTGlnaHRiYWVjMmE5MmJmZmU1MDMyIC0gc3Vic2V0IG9mIEZvbnRGb3JnZSAyLjAgOiBKdXJhIExpZ2h0IDogMjMtMS0yMDA5YmFlYzJhOTJiZmZlNTAzMiAtIHN1YnNldCBvZiBKdXJhIExpZ2h0VmVyc2lvbiAyIGJhZWMyYTkyYmZmZTUwMzIgLSBzdWJzZXQgb2YgSnVyYUxpZ2h0aHR0cDovL3NjcmlwdHMuc2lsLm9yZy9PRkwAQwBvAHAAeQByAGkAZwBoAHQAIAAyADAAMAA5ACAAYgB5ACAARABhAG4AaQBlAGwAIABKAG8AaABuAHMAbwBuAC4AIAAgAFIAZQBsAGUAYQBzAGUAZAAgAHUAbgBkAGUAcgAgAHQAaABlACAAdABlAHIAbQBzACAAbwBmACAAdABoAGUAIABPAHAAZQBuACAARgBvAG4AdAAgAEwAaQBjAGUAbgBzAGUALgAgAEsAYQB5AGEAaAAgAEwAaQAgAGcAbAB5AHAAaABzACAAYQByAGUAIAByAGUAbABlAGEAcwBlAGQAIAB1AG4AZABlAHIAIAB0AGgAZQAgAEcAUABMACAAdgBlAHIAcwBpAG8AbgAgADMALgBiAGEAZQBjADIAYQA5ADIAYgBmAGYAZQA1ADAAMwAyACAALQAgAHMAdQBiAHMAZQB0ACAAbwBmACAASgB1AHIAYQBMAGkAZwBoAHQAYgBhAGUAYwAyAGEAOQAyAGIAZgBmAGUANQAwADMAMgAgAC0AIABzAHUAYgBzAGUAdAAgAG8AZgAgAEYAbwBuAHQARgBvAHIAZwBlACAAMgAuADAAIAA6ACAASgB1AHIAYQAgAEwAaQBnAGgAdAAgADoAIAAyADMALQAxAC0AMgAwADAAOQBiAGEAZQBjADIAYQA5ADIAYgBmAGYAZQA1ADAAMwAyACAALQAgAHMAdQBiAHMAZQB0ACAAbwBmACAASgB1AHIAYQAgAEwAaQBnAGgAdABWAGUAcgBzAGkAbwBuACAAMgAgAGIAYQBlAGMAMgBhADkAMgBiAGYAZgBlADUAMAAzADIAIAAtACAAcwB1AGIAcwBlAHQAIABvAGYAIABKAHUAcgBhAEwAaQBnAGgAdABoAHQAdABwADoALwAvAHMAYwByAGkAcAB0AHMALgBzAGkAbAAuAG8AcgBnAC8ATwBGAEwAAAAAAgAAAAAAAP+BADMAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAAQACAQIAEQt6ZXJva2F5YWhsaQ==')}";
+ e.getElementsByTagName("head")[0].appendChild(b);c.setAttribute("style","font:99px _,arial,helvetica;position:absolute;visibility:hidden");if(!g){g=s.appendChild(e.createElement("fontface"));t=true}c.innerHTML="........";c.id="fonttest";g.appendChild(c);h=c.offsetWidth*c.offsetHeight;c.style.font="99px testfont,_,arial,helvetica";a=h!==c.offsetWidth*c.offsetHeight;var v=function(){if(g.parentNode){a=j.fontface=h!==c.offsetWidth*c.offsetHeight;s.className=s.className.replace(/(no-)?fontface\b/,"")+
+ (a?" ":" no-")+"fontface"}};setTimeout(v,75);setTimeout(v,150);addEventListener("load",function(){v();(w=true)&&o&&o(a);setTimeout(function(){t||(g=c);g.parentNode.removeChild(g);b.parentNode.removeChild(b)},50)},false)}j._fontfaceready=function(p){w||a?p(a):(o=p)};return a||h!==c.offsetWidth};d.video=function(){var a=e.createElement("video"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('video/ogg; codecs="theora"');b.h264=a.canPlayType('video/mp4; codecs="avc1.42E01E"');b.webm=a.canPlayType('video/webm; codecs="vp8, vorbis"')}return b};
+ d.audio=function(){var a=e.createElement("audio"),b=!!a.canPlayType;if(b){b=new Boolean(b);b.ogg=a.canPlayType('audio/ogg; codecs="vorbis"');b.mp3=a.canPlayType("audio/mpeg;");b.wav=a.canPlayType('audio/wav; codecs="1"');b.m4a=a.canPlayType("audio/x-m4a;")||a.canPlayType("audio/aac;")}return b};d.localStorage=function(){return"localStorage"in i&&i.localStorage!==null};d.sessionStorage=function(){try{return"sessionStorage"in i&&i.sessionStorage!==null}catch(a){return false}};d.webworkers=function(){return!!i.Worker};
+ d.applicationCache=function(){var a=i.applicationCache;return!!(a&&typeof a.status!="undefined"&&typeof a.update=="function"&&typeof a.swapCache=="function")};d.svg=function(){return!!e.createElementNS&&!!e.createElementNS("http://www.w3.org/2000/svg","svg").createSVGRect};d.smil=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg","animate")))};d.svgclippaths=function(){return!!e.createElementNS&&/SVG/.test(M.call(e.createElementNS("http://www.w3.org/2000/svg",
+ "clipPath")))};for(var z in d)if(O(d,z))N.push(((j[z.toLowerCase()]=d[z]())?"":"no-")+z.toLowerCase());j[E]||P();j.addTest=function(a,b){a=a.toLowerCase();if(!j[a]){b=!!b();s.className+=" "+(b?"":"no-")+a;j[a]=b;return j}};m.cssText="";D=n=null;(function(){var a=e.createElement("div");a.innerHTML="<elem></elem>";return a.childNodes.length!==1})()&&function(a,b){function c(f,k){if(o[f])o[f].styleSheet.cssText+=k;else{var l=t[G],q=b[A]("style");q.media=f;l.insertBefore(q,l[G]);o[f]=q;c(f,k)}}function h(f,
+ k){for(var l=new RegExp("\\b("+w+")\\b(?!.*[;}])","gi"),q=function(B){return".iepp_"+B},x=-1;++x<f.length;){k=f[x].media||k;h(f[x].imports,k);c(k,f[x].cssText.replace(l,q))}}for(var t=b.documentElement,g=b.createDocumentFragment(),o={},w="abbr|article|aside|audio|canvas|command|datalist|details|figure|figcaption|footer|header|hgroup|keygen|mark|meter|nav|output|progress|section|source|summary|time|video",v=w.split("|"),p=[],H=-1,G="firstChild",A="createElement";++H<v.length;){b[A](v[H]);g[A](v[H])}g=
+ g.appendChild(b[A]("div"));a.attachEvent("onbeforeprint",function(){for(var f,k=b.getElementsByTagName("*"),l,q,x=new RegExp("^"+w+"$","i"),B=-1;++B<k.length;)if((f=k[B])&&(q=f.nodeName.match(x))){l=new RegExp("^\\s*<"+q+"(.*)\\/"+q+">\\s*$","i");g.innerHTML=f.outerHTML.replace(/\r|\n/g," ").replace(l,f.currentStyle.display=="block"?"<div$1/div>":"<span$1/span>");l=g.childNodes[0];l.className+=" iepp_"+q;l=p[p.length]=[f,l];f.parentNode.replaceChild(l[1],l[0])}h(b.styleSheets,"all")});a.attachEvent("onafterprint",
+ function(){for(var f=-1,k;++f<p.length;)p[f][1].parentNode.replaceChild(p[f][0],p[f][1]);for(k in o)t[G].removeChild(o[k]);o={};p=[]})}(this,e);j._enableHTML5=true;j._version="1.5";s.className=s.className.replace(/\bno-js\b/,"")+" js";s.className+=" "+N.join(" ");return j}(this,this.document);
\ No newline at end of file diff --git a/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js b/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js new file mode 100644 index 000000000..61dfb87e6 --- /dev/null +++ b/mod/html5/vendors/jquery/jquery.placeholder-1.0.1.js @@ -0,0 +1,58 @@ +/**
+ * jQuery.placeholder - Placeholder plugin for input fields
+ * Written by Blair Mitchelmore (blair DOT mitchelmore AT gmail DOT com)
+ * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
+ * Date: 2008/10/14
+ *
+ * @author Blair Mitchelmore
+ * @version 1.0.1
+ *
+ **/
+new function($) {
+ $.fn.placeholder = function(settings) {
+ settings = settings || {};
+ var key = settings.dataKey || "placeholderValue";
+ var attr = settings.attr || "placeholder";
+ var className = settings.className || "placeholder";
+ var values = settings.values || [];
+ var block = settings.blockSubmit || false;
+ var blank = settings.blankSubmit || false;
+ var submit = settings.onSubmit || false;
+ var value = settings.value || "";
+ var position = settings.cursor_position || 0;
+
+
+ return this.filter(":input").each(function(index) {
+ $.data(this, key, values[index] || $(this).attr(attr));
+ }).each(function() {
+ if ($.trim($(this).val()) === "")
+ $(this).addClass(className).val($.data(this, key));
+ }).focus(function() {
+ if ($.trim($(this).val()) === $.data(this, key))
+ $(this).removeClass(className).val(value)
+ if ($.fn.setCursorPosition) {
+ $(this).setCursorPosition(position);
+ }
+ }).blur(function() {
+ if ($.trim($(this).val()) === value)
+ $(this).addClass(className).val($.data(this, key));
+ }).each(function(index, elem) {
+ if (block)
+ new function(e) {
+ $(e.form).submit(function() {
+ return $.trim($(e).val()) != $.data(e, key)
+ });
+ }(elem);
+ else if (blank)
+ new function(e) {
+ $(e.form).submit(function() {
+ if ($.trim($(e).val()) == $.data(e, key))
+ $(e).removeClass(className).val("");
+ return true;
+ });
+ }(elem);
+ else if (submit)
+ new function(e) { $(e.form).submit(submit); }(elem);
+ });
+ };
+}(jQuery);
diff --git a/mod/html5/views/default/html/img.php b/mod/html5/views/default/html/img.php new file mode 100644 index 000000000..10fcbe0d1 --- /dev/null +++ b/mod/html5/views/default/html/img.php @@ -0,0 +1,11 @@ +<?php + +$defaults = array( + 'alt' => '', + 'title' => '', + 'border' => 0, +); + +$attributes = elgg_format_attributes(array_merge($defaults, $vars)); + +echo "<img $attributes />";
\ No newline at end of file diff --git a/mod/html5/views/default/html5/css.php b/mod/html5/views/default/html5/css.php new file mode 100644 index 000000000..eae9c7d13 --- /dev/null +++ b/mod/html5/views/default/html5/css.php @@ -0,0 +1,2 @@ +article, aside, details, figcaption, figure, footer, header, hgroup,
+menu, nav, section { display: block; }
diff --git a/mod/html5/views/default/html5/theme_preview/forms/inputs.php b/mod/html5/views/default/html5/theme_preview/forms/inputs.php new file mode 100644 index 000000000..de38dc71c --- /dev/null +++ b/mod/html5/views/default/html5/theme_preview/forms/inputs.php @@ -0,0 +1,101 @@ +<form action="#">
+ <fieldset>
+ <legend>HTML5 Inputs</legend>
+ <div>
+ <label for="color">Color input (.elgg-input-color):</label>
+ <?php echo elgg_view('input/color', array(
+ 'name' => 'color',
+ 'id' => 'color',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="datetime-local">Local datetime input (.elgg-input-datetime-local):</label>
+ <?php echo elgg_view('input/datetime-local', array(
+ 'name' => 'datetime-local',
+ 'id' => 'datetime-local',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="datetime">Datetime input (.elgg-input-datetime):</label><br />
+ <?php echo elgg_view('input/datetime', array(
+ 'name' => 'datetime',
+ 'id' => 'datetime',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="email">Email input (.elgg-input-email):</label><br />
+ <?php echo elgg_view('input/email', array(
+ 'name' => 'email',
+ 'id' => 'email',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="image">Image input (.elgg-input-image):</label><br />
+ <?php echo elgg_view('input/image', array(
+ 'name' => 'image',
+ 'id' => 'image',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="month">Month input (.elgg-input-month):</label><br />
+ <?php echo elgg_view('input/month', array(
+ 'name' => 'month',
+ 'id' => 'month',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="number">Number input (.elgg-input-number):</label>
+ <?php echo elgg_view('input/number', array(
+ 'name' => 'number',
+ 'id' => 'number',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="range">Range input (.elgg-input-range):</label>
+ <?php echo elgg_view('input/range', array(
+ 'name' => 'range',
+ 'id' => 'range',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="search">Tags input (.elgg-input-search):</label>
+ <?php echo elgg_view('input/search', array(
+ 'name' => 'search',
+ 'id' => 'search',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="tel">Telephone input (.elgg-input-tel):</label>
+ <?php echo elgg_view('input/tel', array(
+ 'name' => 'tel',
+ 'id' => 'tel',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="time">Time input (.elgg-input-time):</label>
+ <?php echo elgg_view('input/time', array(
+ 'name' => 'time',
+ 'id' => 'time',
+ ));
+ ?>
+ </div>
+ <div>
+ <label for="week">Week input (.elgg-input-week):</label>
+ <?php echo elgg_view('input/week', array(
+ 'name' => 'week',
+ 'id' => 'week',
+ ));
+ ?>
+ </div>
+ </fieldset>
+</form>
\ No newline at end of file diff --git a/mod/html5/views/default/input/color.php b/mod/html5/views/default/input/color.php new file mode 100644 index 000000000..be8154fc9 --- /dev/null +++ b/mod/html5/views/default/input/color.php @@ -0,0 +1,12 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-color',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'color';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/datetime-local.php b/mod/html5/views/default/input/datetime-local.php new file mode 100644 index 000000000..468843901 --- /dev/null +++ b/mod/html5/views/default/input/datetime-local.php @@ -0,0 +1,14 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-datetime-local',
+);
+
+$vars = array_merge($defaults, $vars);
+
+if (isset($vars['value']) && is_int($vars['value'])) {
+ $vars['value'] = date("Y-m-d\TH:i:s", $vars['value']);
+}
+
+$vars['type'] = 'datetime-local';
+?>
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/datetime.php b/mod/html5/views/default/input/datetime.php new file mode 100644 index 000000000..69e4bd7f7 --- /dev/null +++ b/mod/html5/views/default/input/datetime.php @@ -0,0 +1,15 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-datetime',
+);
+
+$vars = array_merge($defaults, $vars);
+
+if (isset($vars['value']) && is_int($vars['value'])) {
+ $vars['value'] = date("c", $vars['value']);
+}
+
+$vars['type'] = 'datetime';
+
+?>
+<input <?php echo elgg_format_attributes($vars); ?> />
diff --git a/mod/html5/views/default/input/image.php b/mod/html5/views/default/input/image.php new file mode 100644 index 000000000..cf740f782 --- /dev/null +++ b/mod/html5/views/default/input/image.php @@ -0,0 +1,11 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-image',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'image';
+
+?>
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/month.php b/mod/html5/views/default/input/month.php new file mode 100644 index 000000000..c99b3f34c --- /dev/null +++ b/mod/html5/views/default/input/month.php @@ -0,0 +1,16 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-month',
+);
+
+$vars = array_merge($defaults, $vars);
+
+if (isset($vars['value']) && is_int($vars['value'])) {
+ $vars['value'] = date("Y-m", $vars['value']);
+}
+
+$vars['type'] = 'month';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/number.php b/mod/html5/views/default/input/number.php new file mode 100644 index 000000000..ec4938734 --- /dev/null +++ b/mod/html5/views/default/input/number.php @@ -0,0 +1,11 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-number',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'number';
+
+?>
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/option.php b/mod/html5/views/default/input/option.php new file mode 100644 index 000000000..05d5d649f --- /dev/null +++ b/mod/html5/views/default/input/option.php @@ -0,0 +1,13 @@ +<?php + +$text = $vars['text']; + +if (!isset($text)) { + $text = $vars['value']; + unset($vars['value']); +} + +$text = htmlentities($text, ENT_QUOTES, 'UTF-8'); +$attributes = elgg_format_attributes($vars); + +echo "<option $attributes>$text</option>";
\ No newline at end of file diff --git a/mod/html5/views/default/input/range.php b/mod/html5/views/default/input/range.php new file mode 100644 index 000000000..235687257 --- /dev/null +++ b/mod/html5/views/default/input/range.php @@ -0,0 +1,13 @@ +<?php
+
+$defaults = array(
+ 'class' => 'elgg-input-range',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'range';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/search.php b/mod/html5/views/default/input/search.php new file mode 100644 index 000000000..becf8a11b --- /dev/null +++ b/mod/html5/views/default/input/search.php @@ -0,0 +1,13 @@ +<?php
+
+$defaults = array(
+ 'class' => 'elgg-input-search',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'search';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/tel.php b/mod/html5/views/default/input/tel.php new file mode 100644 index 000000000..0704344a8 --- /dev/null +++ b/mod/html5/views/default/input/tel.php @@ -0,0 +1,12 @@ +<?php
+$defaults = array(
+ 'class' => 'elgg-input-tel',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'tel';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/time.php b/mod/html5/views/default/input/time.php new file mode 100644 index 000000000..6bb557266 --- /dev/null +++ b/mod/html5/views/default/input/time.php @@ -0,0 +1,13 @@ +<?php
+
+$defaults = array(
+ 'class' => 'elgg-input-time',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'time';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/input/week.php b/mod/html5/views/default/input/week.php new file mode 100644 index 000000000..3d09ba07f --- /dev/null +++ b/mod/html5/views/default/input/week.php @@ -0,0 +1,13 @@ +<?php
+
+$defaults = array(
+ 'class' => 'elgg-input-week',
+);
+
+$vars = array_merge($defaults, $vars);
+
+$vars['type'] = 'week';
+
+?>
+
+<input <?php echo elgg_format_attributes($vars); ?> />
\ No newline at end of file diff --git a/mod/html5/views/default/output/friendlytime.php b/mod/html5/views/default/output/friendlytime.php new file mode 100644 index 000000000..dc9699fba --- /dev/null +++ b/mod/html5/views/default/output/friendlytime.php @@ -0,0 +1,14 @@ +<?php +/** + * Friendly time + * Translates an epoch time into a human-readable time. + * + * @uses string $vars['time'] Unix-style epoch timestamp + * @override views/default/output/friendlytime.php + */ + +$friendly_time = elgg_get_friendly_time($vars['time']); +$timestamp = htmlentities(date(elgg_echo('friendlytime:date_format'), $vars['time'])); +$datetime = htmlentities(date("c", $vars['time'])); + +echo "<time title=\"$timestamp\" datetime=\"$datetime\" class=\"timestamp\">$friendly_time</time>"; diff --git a/mod/html5/views/default/page/admin.php b/mod/html5/views/default/page/admin.php new file mode 100644 index 000000000..e1180e851 --- /dev/null +++ b/mod/html5/views/default/page/admin.php @@ -0,0 +1,68 @@ +<?php +/** + * Elgg pageshell for the admin area + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + * + * @override views/default/page/admin.php + */ + +$notices_html = ''; +$notices = elgg_get_admin_notices(); +if ($notices) { + foreach ($notices as $notice) { + $notices_html .= elgg_view_entity($notice); + } + + $notices_html = "<div class=\"elgg-admin-notices\">$notices_html</div>"; +} + +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('admin/header', $vars); +$body = $vars['body']; +$footer = elgg_view('admin/footer', $vars); + + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); + +?> +<!DOCTYPE html> +<html lang="<?php echo get_current_language(); ?>"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> + <div class="elgg-page elgg-page-admin"> + <div class="elgg-inner"> + <div class="elgg-page-header"> + <div class="elgg-inner clearfix"> + <?php echo $header; ?> + </div> + </div> + <div class="elgg-page-messages"> + <?php echo $messages; ?> + <?php echo $notices_html; ?> + </div> + <div class="elgg-page-body"> + <div class="elgg-inner"> + <?php echo $body; ?> + </div> + </div> + <div class="elgg-page-footer"> + <div class="elgg-inner"> + <?php echo $footer; ?> + </div> + </div> + </div> + </div> + <?php echo elgg_view('page/elements/foot'); ?> +</body> + +</html> diff --git a/mod/html5/views/default/page/default.php b/mod/html5/views/default/page/default.php new file mode 100644 index 000000000..4ff2215da --- /dev/null +++ b/mod/html5/views/default/page/default.php @@ -0,0 +1,78 @@ +<?php +/** + * Elgg pageshell + * The standard HTML page shell that everything else fits into + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['title'] The page title + * @uses $vars['body'] The main content of the page + * @uses $vars['sysmessages'] A 2d array of various message registers, passed from system_messages() + * + * @override views/default/page/default.php + */ + +// backward compatability support for plugins that are not using the new approach +// of routing through admin. See reportedcontent plugin for a simple example. +if (elgg_get_context() == 'admin') { + if (get_input('handler') != 'admin') { + elgg_deprecated_notice("admin plugins should route through 'admin'.", 1.8); + } + elgg_admin_add_plugin_settings_menu(); + elgg_unregister_css('elgg'); + echo elgg_view('page/admin', $vars); + return true; +} + +// render content before head so that JavaScript and CSS can be loaded. See #4032 +$topbar = elgg_view('page/elements/topbar', $vars); +$messages = elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); +$header = elgg_view('page/elements/header', $vars); +$body = elgg_view('page/elements/body', $vars); +$footer = elgg_view('page/elements/footer', $vars); + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); + +$lang = get_current_language(); + +?> +<!DOCTYPE html> +<html lang="<?php echo $lang; ?>"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> +<div class="elgg-page elgg-page-default"> + <div class="elgg-page-messages"> + <?php echo $messages; ?> + </div> + + <?php if (elgg_is_logged_in()){ ?> + <header class="elgg-page-topbar"> + <div class="elgg-inner"> + <?php echo $topbar; ?> + </div> + </header> + <?php } ?> + + <header class="elgg-page-header"> + <div class="elgg-inner"> + <?php echo $header; ?> + </div> + </header> + <div class="elgg-page-body"> + <div class="elgg-inner"> + <?php echo $body; ?> + </div> + </div> + <footer class="elgg-page-footer"> + <div class="elgg-inner"> + <?php echo $footer; ?> + </div> + </footer> +</div> +<?php echo elgg_view('page/elements/foot'); ?> +</body> +</html> diff --git a/mod/html5/views/default/page/elements/footer.php b/mod/html5/views/default/page/elements/footer.php new file mode 100644 index 000000000..c0da2f370 --- /dev/null +++ b/mod/html5/views/default/page/elements/footer.php @@ -0,0 +1,23 @@ +<?php +/** + * Elgg footer + * The standard HTML footer that displays across the site + * + * @package Elgg + * @subpackage Core + * @override views/default/page/elements/footer.php + * + */ + +echo elgg_view_menu('footer', array('sort_by' => 'priority', 'class' => 'elgg-menu-hz')); + +$powered_url = elgg_get_site_url() . "_graphics/powered_by_elgg_badge_drk_bckgnd.gif"; + +echo '<footer class="mts clearfloat float-alt">'; +echo elgg_view('output/url', array( + 'href' => 'http://elgg.org', + 'text' => "<img src=\"$powered_url\" alt=\"Powered by Elgg\" width=\"106\" height=\"15\" />", + 'class' => '', + 'is_trusted' => true, +)); +echo '</footer>'; diff --git a/mod/html5/views/default/page/elements/head.php b/mod/html5/views/default/page/elements/head.php new file mode 100644 index 000000000..47254934e --- /dev/null +++ b/mod/html5/views/default/page/elements/head.php @@ -0,0 +1,78 @@ +<?php +/** + * The standard HTML head + * + * @uses $vars['title'] The page title + * @override views/default/page/elements/head.php + */ + +// Set title +if (empty($vars['title'])) { + $title = elgg_get_config('sitename'); +} else { + $title = elgg_get_config('sitename') . ": " . $vars['title']; +} + +global $autofeed; +if (isset($autofeed) && $autofeed == true) { + $url = current_page_url(); + if (substr_count($url,'?')) { + $url .= "&view=rss"; + } else { + $url .= "?view=rss"; + } + $url = elgg_format_url($url); + $feedref = <<<END + + <link rel="alternate" type="application/rss+xml" title="RSS" href="{$url}" /> + +END; +} else { + $feedref = ""; +} + +$js = elgg_get_loaded_js('head'); +$css = elgg_get_loaded_css(); + +$release = get_version(true); +?> + <meta charset="utf-8" /> + <meta name="generator" content="Elgg <?php echo $release; ?>" /> + <title><?php echo $title; ?></title> + <?php echo elgg_view('page/elements/shortcut_icon', $vars); ?> + +<?php foreach ($css as $link) { ?> + <link rel="stylesheet" href="<?php echo $link; ?>" type="text/css" /> +<?php } ?> + +<?php + $ie_url = elgg_get_simplecache_url('css', 'ie'); + $ie7_url = elgg_get_simplecache_url('css', 'ie7'); + $ie6_url = elgg_get_simplecache_url('css', 'ie6'); +?> + <!--[if gt IE 7]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie_url; ?>" /> + <![endif]--> + <!--[if IE 7]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie7_url; ?>" /> + <![endif]--> + <!--[if IE 6]> + <link rel="stylesheet" type="text/css" href="<?php echo $ie6_url; ?>" /> + <![endif]--> + +<?php foreach ($js as $script) { ?> + <script type="text/javascript" src="<?php echo $script; ?>"></script> +<?php } ?> + +<script type="text/javascript"> + <?php echo elgg_view('js/initialize_elgg'); ?> +</script> + +<?php +echo $feedref; + +$metatags = elgg_view('metatags', $vars); +if ($metatags) { + elgg_deprecated_notice("The metatags view has been deprecated. Extend page/elements/head instead", 1.8); + echo $metatags; +} diff --git a/mod/html5/views/default/page/layouts/admin.php b/mod/html5/views/default/page/layouts/admin.php new file mode 100644 index 000000000..683ba3468 --- /dev/null +++ b/mod/html5/views/default/page/layouts/admin.php @@ -0,0 +1,42 @@ +<?php +/** + * Elgg Admin Area Canvas + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['sidebar'] Optional sidebar content + * @uses $vars['title'] Title string + * + * @override views/default/page/layouts/admin.php + */ + +?> + +<div class="elgg-layout elgg-layout-one-sidebar"> + <aside class="elgg-sidebar clearfix"> + <?php + echo elgg_view('admin/sidebar', $vars); + ?> + </aside> + <div class="elgg-main elgg-body"> + <div class="elgg-head"> + <?php + echo elgg_view_menu('title', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-hz', + )); + + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + ?> + </div> + <?php + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div>
\ No newline at end of file diff --git a/mod/html5/views/default/page/layouts/one_sidebar.php b/mod/html5/views/default/page/layouts/one_sidebar.php new file mode 100644 index 000000000..e5e063b51 --- /dev/null +++ b/mod/html5/views/default/page/layouts/one_sidebar.php @@ -0,0 +1,50 @@ +<?php +/** + * Layout for main column with one sidebar + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content HTML for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['title'] Optional title for main content area + * @uses $vars['class'] Additional class to apply to layout + * @uses $vars['nav'] HTML of the page nav (override) (default: breadcrumbs) + * + * @override views/default/page/layouts/one_sidebar.php + */ + +$class = 'elgg-layout elgg-layout-one-sidebar clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// navigation defaults to breadcrumbs +$nav = elgg_extract('nav', $vars, elgg_view('navigation/breadcrumbs')); + +?> + +<div class="<?php echo $class; ?>"> + <aside class="elgg-sidebar"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </aside> + + <div class="elgg-main elgg-body"> + <?php + echo $nav; + + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> diff --git a/mod/html5/views/default/page/layouts/two_sidebar.php b/mod/html5/views/default/page/layouts/two_sidebar.php new file mode 100644 index 000000000..929547424 --- /dev/null +++ b/mod/html5/views/default/page/layouts/two_sidebar.php @@ -0,0 +1,45 @@ +<?php +/** + * Elgg 2 sidebar layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] The content string for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['sidebar_alt'] Optional content that is displayed in the alternate sidebar + * @uses $vars['class'] Additional class to apply to layout + * + * @override views/default/page/layouts/two_sidebar.php + */ + +$class = 'elgg-layout elgg-layout-two-sidebar clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +?> + +<div class="<?php echo $class; ?>"> + <aside class="elgg-sidebar"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </aside> + <aside class="elgg-sidebar-alt"> + <?php + echo elgg_view('page/elements/sidebar_alt', $vars); + ?> + </aside> + + <div class="elgg-main elgg-body"> + <?php + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> diff --git a/mod/html5/views/default/page/walled_garden.php b/mod/html5/views/default/page/walled_garden.php new file mode 100644 index 000000000..c12a7203d --- /dev/null +++ b/mod/html5/views/default/page/walled_garden.php @@ -0,0 +1,42 @@ +<?php +/** + * Walled garden page shell + * + * Used for the walled garden index page + * + * @override views/default/page/walled_garden.php + */ + +$is_sticky_register = elgg_is_sticky_form('register'); +$wg_body_class = 'elgg-body-walledgarden'; +if ($is_sticky_register) { + $wg_body_class .= ' hidden'; +} + +// Set the content type +header("Content-type: text/html; charset=UTF-8"); +?> +<!DOCTYPE html> +<html lang="<?php echo get_current_language(); ?>"> +<head> +<?php echo elgg_view('page/elements/head', $vars); ?> +</head> +<body> +<div class="elgg-page elgg-page-walledgarden"> + <div class="elgg-page-messages"> + <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?> + </div> + <div class="<?php echo $wg_body_class; ?>"> + <?php echo $vars['body']; ?> + </div> +</div> +<?php if ($is_sticky_register): ?> +<script type="text/javascript"> +elgg.register_hook_handler('init', 'system', function() { + $('.registration_link').trigger('click'); +}); +</script> +<?php endif; ?> +<?php echo elgg_view('page/elements/foot'); ?> +</body> +</html> diff --git a/mod/html5/views/default/search/search_box.php b/mod/html5/views/default/search/search_box.php new file mode 100644 index 000000000..2abc47ca3 --- /dev/null +++ b/mod/html5/views/default/search/search_box.php @@ -0,0 +1,43 @@ +<?php +/** + * Search box + * + * @uses $vars['value'] Current search query + * @uses $vars['class'] Additional class + * + * @override mod/search/views/default/search/search_box.php + */ + +if (array_key_exists('value', $vars)) { + $value = $vars['value']; +} elseif ($value = get_input('q', get_input('tag', NULL))) { + $value = $value; +} + +$class = "elgg-search"; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +// @todo - why the strip slashes? +$value = stripslashes($value); + +// @todo - create function for sanitization of strings for display in 1.8 +// encode <,>,&, quotes and characters above 127 +if (function_exists('mb_convert_encoding')) { + $display_query = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); +} else { + // if no mbstring extension, we just strip characters + $display_query = preg_replace("/[^\x01-\x7F]/", "", $value); +} +$display_query = htmlspecialchars($display_query, ENT_QUOTES, 'UTF-8', false); + +?> + +<form class="<?php echo $class; ?>" action="<?php echo elgg_get_site_url(); ?>search" method="get"> + <fieldset> + <input type="search" class="search-input" size="21" name="q" value="<?php echo $display_query; ?>" placeholder="<?php echo elgg_echo('search'); ?>" /> + <input type="hidden" name="search_type" value="all" /> + <input type="submit" value="<?php echo elgg_echo('search:go'); ?>" class="search-submit-button" /> + </fieldset> +</form> |