text:
define([], function() {
    /*  dommer.js - a (mostly) compliant subset of DOM level 2 for JS
    (c) Guido Wesdorp 2004-2008
    email johnny@debris.demon.nl

    This software is distributed under the terms of the Dommer
    License. See LICENSE.txt for license text.

    dommer.js

    This library provides a mostly compliant subset of the DOM API in core
    JavaScript. A number of methods aren't implemented, and there are a few
    semantic differences between the standard and this implementations, but
    it provides most of DOM level 2's features and is usable in almost all JS
    environments (also stand-alone ones).

    I started writing this mainly because of IE's lack of proper namespace
    support, and to have a portable, reliable DOM implementation.

    Non-standard are:

    - Whitespace is never ignored.

    - Because of JS doesn't (by default) allow computing attributes on request,
      this API doesn't create Element.nodeName on setting element.prefix,
      therefore a new method was added: Element.setPrefix (note that this
      is not required if the library is not used on browsers that don't
      support __defineGetter__ and __defineSetter__ (such as IE)).

    $Id: minisax.js,v 1.5 2004/07/31 00:10:15 johnny Exp $

*/

    // give this a namespace...

    var global = this;

    global.dommer = new function() {
        /* Exceptions */

        // If the following switch is set to true, setting Element.prefix
        // will result in an exception. This serves to make sure scripts work
        // cross-browser: IE does not support __defineSetter__, which is used
        // to ensure Element.nodeName is updated if Element.prefix
        // is changed (and also to ensure Element.nodeName and
        // Element.localName can't be changed directly). The lack of this
        // method on IE means that on that platform it is possible to break
        // integrity (by setting .prefix directly, .nodeName will be out-of-date).
        // Note that this means that if you intend to use this lib only on Mozilla
        // (or other browsers that support dynamic properties), you can safely
        // set this to false and set .prefix without breaking integrity.
        this.WARN_ON_PREFIX = true;

        function DOMException(errorcode, message) {
            this.code = null;
            this.error = null;
            this.message = message
            for (var attr in DOMException) {
                if (DOMException[attr] == errorcode) {
                    this.error = attr;
                    break;
                };
            };
            this.code = errorcode;
            if (!this.error) {
                this.error = 'Unknown';
            };
            this.stack = stack = createStack();
            this.lineNumber = getLineNo(stack);
            this.fileName = getFileName(stack);
        };

        this.DOMException = DOMException;

        // error codes
        // XXX should we make these global, like in the specs?
        DOMException.INDEX_SIZE_ERR = 1,
            DOMException.DOMSTRING_SIZE_ERR = 2;
        DOMException.HIERARCHY_REQUEST_ERR = 3;
        DOMException.WRONG_DOCUMENT_ERR = 4;
        DOMException.INVALID_CHARACTER_ERR = 5;
        DOMException.NO_DATA_ALLOWED_ERR = 6;
        DOMException.NO_MODIFICATION_ALLOWED_ERR = 7;
        DOMException.NOT_FOUND_ERR = 8;
        DOMException.NOT_SUPPORTED_ERR = 9;
        DOMException.INUSE_ATTRIBUTE_ERR = 10;
        DOMException.INVALID_STATE_ERR = 11;
        DOMException.SYNTAX_ERR = 12;
        DOMException.INVALID_MODIFICATION_ERR = 13;
        DOMException.NAMESPACE_ERR = 14;
        DOMException.INVALID_ACCESS_ERR = 15;

        DOMException.prototype.toString = function() {
            var ret = 'DOMException: ' + this.error + ' (' + this.code + ')';
            if (this.message) {
                ret += ' - ' + this.message;
            };
            return ret;
        };

        /* Node interface */
        function Node() {
            // These are defined in-line rather than on .prototype to allow using
            // them below, too. This way we don't have to check whether attributes
            // are already protected while this constructor is ran or not (in JS,
            // when you set 'Foo.prototype = new Bar;', the Bar constructor is
            // actually ran, in our case this means that the state of the
            // superclass changes).
            this._protectAttribute = function _protectAttribute(attr) {
                /* make an attribute read-only */
                this.__defineSetter__(attr,
                    function(value) {
                        throw (
                            (new DOMException(
                                DOMException.NO_MODIFICATION_ALLOWED_ERR, attr))
                        );
                    }
                );
                this.__defineGetter__(attr,
                    function() {
                        return this['_' + attr];
                    }
                );
            };

            this._setProtected = function _setProtected(name, value) {
                /* set a read-only attribute

                    THIS IS AN INTERNAL METHOD that should not get used as part
                    of the API
                */
                this['_' + name] = value;
                if (!this.__defineSetter__) {
                    this[name] = value;
                };
            };

            this.nodeValue = null;
            if (this.__defineSetter__) {
                // on browsers that support __define[GS]etter__, perform integrity
                // checks
                // nodeValue should be settable on certain nodeTypes
                this.__defineSetter__('nodeValue',
                    function(nodeValue) {
                        if (this.nodeType != this.TEXT_NODE &&
                            this.nodeType != this.ATTRIBUTE_NODE &&
                            this.nodeType != this.COMMENT_NODE) {
                            throw (
                                (new DOMException(
                                    DOMException.NO_DATA_ALLOWED_ERR,
                                    'nodeValue'))
                            );
                        };
                        // XXX should check on allowed chars here, but not
                        // sure which?
                        this._nodeValue = nodeValue;
                    }
                );
                // XXX not sure if we should protect reading .nodeValue
                this.__defineGetter__('nodeValue',
                    function() {
                        if (this.nodeType != this.TEXT_NODE &&
                            this.nodeType != this.ATTRIBUTE_NODE &&
                            this.nodeType != this.COMMENT_NODE) {
                            throw (
                                (new DOMException(
                                    DOMException.NO_DATA_ALLOWED_ERR,
                                    'nodeValue'))
                            );
                        };
                        return this._nodeValue;
                    }
                );
                var toprotect = ['nodeType', 'nodeName', 'parentNode',
                    'childNodes', 'firstChild', 'lastChild',
                    'previousSibling', 'nextSibling',
                    'attributes', 'ownerDocument', 'namespaceURI',
                    'localName'
                ];
                for (var i = 0; i < toprotect.length; i++) {
                    this._protectAttribute(toprotect[i]);
                };
            };

            this._setProtected('namespaceURI', null);
            this._setProtected('prefix', null);
            this._setProtected('nodeName', null);
            this._setProtected('localName', null);
            this._setProtected('parentNode', null);
            // note that this is shared between subclass instances, so should be
            // re-set in every .initialize() (so below is just for show)
            this._setProtected('childNodes', []);
            this._setProtected('firstChild', null);
            this._setProtected('lastChild', null);
            this._setProtected('previousSibling', null);
            this._setProtected('nextSibling', null);
            this._setProtected('ownerDocument', null);
        };

        this.Node = Node;

        Node.ELEMENT_NODE = Node.prototype.ELEMENT_NODE = 1;
        Node.ATTRIBUTE_NODE = Node.prototype.ATTRIBUTE_NODE = 2;
        Node.TEXT_NODE = Node.prototype.TEXT_NODE = 3;
        Node.CDATA_SECTION_NODE = Node.prototype.CDATA_SECTION_NODE = 4;
        Node.ENTITY_REFERENCE_NODE = Node.prototype.ENTITY_REFERENCE_NODE = 5;
        Node.ENTITY_NODE = Node.prototype.ENTITY_NODE = 6;
        Node.PROCESSING_INSTRUCTION_NODE =
            Node.prototype.PROCESSING_INSTRUCTION_NODE = 7;
        Node.COMMENT_NODE = Node.prototype.COMMENT_NODE = 8;
        Node.DOCUMENT_NODE = Node.prototype.DOCUMENT_NODE = 9;
        Node.DOCUMENT_TYPE_NODE = Node.prototype.DOCUMENT_TYPE_NODE = 10;
        Node.DOCUMENT_FRAGMENT_NODE = Node.prototype.DOCUMENT_FRAGMENT_NODE = 11;
        Node.NOTATION_NODE = Node.prototype.NOTATION_NODE = 12;

        var thrownotsupported = function() {
            throw ('not supported');
        };

        // XXX these should be implemented at some point...
        Node.prototype.normalize = thrownotsupported;
        Node.prototype.isSupported = thrownotsupported; // hehehe...

        // non-standard method, use this always instead of setting .prefix
        // yourself, as this will update the .nodeName property too
        Node.prototype.setPrefix = function setPrefix(prefix) {
            if (this.__defineSetter__) {
                this._prefix = prefix;
                this._nodeName = prefix + ':' + this.localName;
            } else {
                this.prefix = prefix;
                this.nodeName = prefix + ':' + this.localName;
            };
        };

        Node.prototype.cloneNode = function cloneNode() {
            throw (
                (new DOMException(DOMException.NOT_SUPPORTED_ERR))
            );
        };

        Node.prototype.hasChildNodes = function hasChildNodes() {
            return (this.childNodes && this.childNodes.length > 0);
        };

        Node.prototype.hasAttributes = function hasAttributes() {
            return (this.attributes !== undefined && this.attributes.length);
        };

        Node.prototype.appendChild = function appendChild(newChild) {
            this._checkModificationAllowed();
            this._attach(newChild);
        };

        Node.prototype.removeChild = function removeChild(oldChild) {
            this._checkModificationAllowed();
            this._checkIsChild(oldChild);
            var newChildren = new NodeList();
            var found = false;
            for (var i = 0; i < this.childNodes.length; i++) {
                if (this.childNodes[i] === oldChild) {
                    oldChild._setProtected('parentNode', null);
                    var previous = oldChild.previousSibling;
                    if (previous) {
                        oldChild._setProtected('previousSibling', null);
                        previous._setProtected('nextSibling',
                            oldChild.nextSibling);
                    };
                    var next = oldChild.nextSibling;
                    if (next) {
                        next._setProtected('previousSibling', previous);
                        oldChild._setProtected('nextSibling', null);
                    };
                    continue;
                };
                newChildren.push(this.childNodes[i]);
            };
            this._setProtected('childNodes', newChildren);
            this._setProtected('firstChild', (this.childNodes.length > 0 ? this.childNodes[0] : null));
            this._setProtected('lastChild', (
                this.childNodes.length > 0 ?
                this.childNodes[this.childNodes.length - 1] : null));
        };

        Node.prototype.replaceChild = function replaceChild(newChild, refChild) {
            this._checkModificationAllowed();
            this._checkIsChild(refChild);
            this._attach(newChild, refChild, true);
        };

        Node.prototype.insertBefore = function insertBefore(newChild, refChild) {
            this._checkModificationAllowed();
            this._checkIsChild(refChild);
            this._attach(newChild, refChild);
        };

        Node.prototype._attach = function _attach(newChild, refChild, replace) {
            // see if the child is in the same document
            if (newChild.ownerDocument != this.ownerDocument &&
                newChild.ownerDocument != this) {
                throw (
                    (new DOMException(DOMException.WRONG_DOCUMENT_ERR))
                );
            };
            // see if the child is of an allowed type
            if (newChild.nodeType != newChild.ELEMENT_NODE &&
                newChild.nodeType != newChild.TEXT_NODE &&
                newChild.nodeType != newChild.CDATA_SECTION_NODE &&
                newChild.nodeType != newChild.COMMENT_NODE) {
                throw (
                    (new DOMException(DOMException.HIERARCHY_REQUEST_ERR))
                );
            };
            // see if the child isn't a (grand)parent of ourselves
            var currparent = this;
            while (currparent && currparent.nodeType != newChild.DOCUMENT_NODE) {
                if (currparent === newChild) {
                    throw (
                        (new DOMException(DOMException.HIERARCHY_REQUEST_ERR))
                    );
                };
                currparent = currparent.parentNode;
            };
            // seems to be okay, add it
            if (newChild.parentNode) {
                newChild.parentNode.removeChild(newChild);
            };
            newChild._setProtected('parentNode', this);
            if (!refChild) {
                if (this.childNodes.length) {
                    this.childNodes[this.childNodes.length - 1]._setProtected(
                        'nextSibling', newChild);
                    newChild._setProtected('previousSibling',
                        this.childNodes[this.childNodes.length - 1]);
                };
                this.childNodes.push(newChild);
            } else {
                var newchildren = [];
                var found = false;
                for (var i = 0; i < this.childNodes.length; i++) {
                    var currChild = this.childNodes[i];
                    if (currChild === refChild) {
                        newchildren.push(newChild);
                        var previous = this.childNodes[i - 1];
                        if (previous) {
                            newChild._setProtected('previousSibling', previous);
                            previous._setProtected('nextSibling', newChild);
                        };
                        if (!replace) {
                            newchildren.push(currChild);
                            currChild._setProtected('previousSibling', newChild);
                            newChild._setProtected('nextSibling', currChild);
                        } else {
                            currChild._setProtected('parentNode', null);
                            currChild._setProtected('previousSibling', null);
                            currChild._setProtected('nextSibling', null);
                            var next = this.childNodes[i + 1];
                            if (next) {
                                newChild._setProtected('nextSibling', next);
                                next._setProtected('previousSibling', newChild);
                            };
                        };
                        found = true;
                    } else {
                        newchildren.push(currChild);
                    };
                };
                if (!found) {
                    throw (
                        (new DOMException(DOMException.NOT_FOUND_ERR))
                    );
                };
                this._setProtected('childNodes', newchildren);
            };
            this._setProtected('firstChild', this.childNodes[0]);
            this._setProtected('lastChild',
                this.childNodes[this.childNodes.length - 1]);
        };

        Node.prototype._checkModificationAllowed =
            function _checkModificationAllowed() {
                if (this.nodeType != this.ELEMENT_NODE &&
                    this.nodeType != this.DOCUMENT_NODE &&
                    this.nodeType != this.DOCUMENT_FRAGMENT_NODE) {
                    throw (
                        (new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR))
                    );
                };
            };

        Node.prototype._checkIsChild = function _checkIsChild(refChild) {
            if (refChild.parentNode !== this) {
                throw (
                    (new DOMException(DOMException.NOT_FOUND_ERR))
                );
            };
        };

        function DocumentFragment() {
            this._setProtected('nodeType', 11);
        };

        DocumentFragment.prototype = new Node;
        this.DocumentFragment = DocumentFragment;

        function Element() {
            this._setProtected('nodeType', 1);
        };

        Element.prototype = new Node;
        this.Element = Element;

        Element.prototype.initialize = function initialize(namespaceURI, qname,
            ownerDocument) {
            // XXX the specs are very vague about an id, it says the DOM
            // implementation must have info about which attributes are of the id
            // type, I'll just use the property here for now...
            this.id = ''; // empty string like in Mozilla, seems weird to me though

            this._setProtected('attributes', []);
            this._setProtected('childNodes', []);
            this._setProtected('ownerDocument', ownerDocument);

            // try to ensure integrity by defining getters and setters for certain
            // properties, since this only works in certain browsers it makes sense to
            // test your applications on one of those platforms, see also
            // WARN_ON_PREFIX in the top of the document
            if (this.__defineSetter__) {
                this._nodeName = this.nodeName;
                this.__defineSetter__('nodeName', function() {
                    throw (
                        (new DOMException(
                            DOMException.NO_MODIFICATION_ALLOWED_ERR)))
                });
                this.__defineGetter__('nodeName',
                    function() {
                        return this._nodeName
                    });
                this.__defineSetter__('prefix',
                    function(value) {
                        if (dommer.WARN_ON_PREFIX) {
                            throw ('Setting prefix directly ' +
                                'breaks integrity of the ' +
                                'XML DOM in Internet ' +
                                'Explorer browsers!');
                        };
                        this._prefix = value;
                        this._nodeName = this._prefix + ':' +
                            this._localName;
                    });
                this.__defineGetter__('prefix', function() {
                    return this._prefix
                });
            };
            // XXX both the ns and qname need integrity checks
            this._setProtected('namespaceURI', namespaceURI);
            if (qname.indexOf(':') > -1) {
                var tup = qname.split(':');
                this.setPrefix(tup.shift());
                this._setProtected('localName', tup.join(':'));
            } else {
                this.setPrefix(null);
                this._setProtected('localName', qname);
            };
            if (this.prefix) {
                this._setProtected('nodeName', this.prefix + ':' + this.localName);
            } else {
                this._setProtected('nodeName', this.localName);
            };
        };

        Element.prototype.toString = function toString() {
            return '<Element "' + this.nodeName + '" (type ' +
                this.nodeType + ')>';
        };

        Element.prototype.toXML = function toXML(context) {
            // context is used when toXML is called recursively
            // marker
            var no_prefix_id = '::no_prefix::';
            if (!context) {
                context = {
                    namespace_stack: []
                };
            };
            var new_namespaces = {}; // any namespaces that weren't declared yet
            var current_namespaces = {};
            var last_namespaces = context.namespace_stack[
                context.namespace_stack.length - 1];
            context.namespace_stack.push(current_namespaces);
            if (last_namespaces) {
                for (var prefix in last_namespaces) {
                    current_namespaces[prefix] = last_namespaces[prefix];
                };
            };
            var xml = '<' + this.nodeName;
            var prefix = this.prefix || no_prefix_id;
            if (this.namespaceURI &&
                (current_namespaces[prefix] != this.namespaceURI)) {
                current_namespaces[prefix] = this.namespaceURI;
                new_namespaces[prefix] = this.namespaceURI;
            };
            for (var i = 0; i < this.attributes.length; i++) {
                var attr = this.attributes[i];
                if (attr.nodeName == 'xmlns' || attr.prefix == 'xmlns') {
                    continue;
                }
                var aprefix = attr.prefix || no_prefix_id;
                if (attr.namespaceURI &&
                    current_namespaces[aprefix] != attr.namespaceURI) {
                    current_namespaces[aprefix] = attr.namespaceURI;
                    new_namespaces[aprefix] = attr.namespaceURI;
                };
                xml += ' ' + attr.nodeName + '="' +
                    string.entitize(attr.nodeValue) + '"';
            };

            // take care of any new namespaces
            for (var prefix in new_namespaces) {
                xml += ' xmlns';
                if (prefix != no_prefix_id) {
                    xml += ':' + prefix;
                };
                xml += '="' + string.entitize(new_namespaces[prefix]) + '"';
            };

            if (this.childNodes.length) {
                xml += '>';
                for (var i = 0; i < this.childNodes.length; i++) {
                    xml += this.childNodes[i].toXML(context);
                };
                xml += '</' + this.nodeName + '>';
            } else {
                xml += ' />';
            };
            context.namespace_stack.pop();
            return xml;
        };

        Element.prototype.cloneNode = function cloneNode(deep) {
            var el = new Element();
            el.initialize(this.namespaceURI, this.nodeName, this.ownerDocument);
            for (var i = 0; i < this.attributes.length; i++) {
                var clone = this.attributes[i].cloneNode();
                clone._setProtected('ownerElement', el);
                el.attributes.push(clone);
            };
            if (deep) {
                for (var i = 0; i < this.childNodes.length; i++) {
                    var clone = this.childNodes[i].cloneNode(true);
                    clone._setProtected('parentNode', el);
                    clone._setProtected('ownerDocument', el.ownerDocument);
                    el.appendChild(clone);
                };
            };
            return el;
        };

        Element.prototype.getAttributeNodeNS =
            function getAttributeNodeNS(namespaceURI, qname) {
                for (var i = 0; i < this.attributes.length; i++) {
                    var attr = this.attributes[i];
                    if (attr.namespaceURI == namespaceURI && attr.localName == qname) {
                        return attr;
                    };
                };
            };

        Element.prototype.getAttributeNode = function getAttributeNode(name) {
            if (!this.attributes) {
                this._setProtected('attributes', []);
            };
            for (var i = 0; i < this.attributes.length; i++) {
                var attr = this.attributes[i];
                if (attr.nodeName == name) {
                    return attr;
                };
            };
        };

        Element.prototype.getAttribute = function getAttribute(name) {
            var attr = this.getAttributeNode(name)
            return (attr ? attr.nodeValue : null);
        };

        Element.prototype.getAttributeNS =
            function getAttributeNS(namespaceURI, name) {
                var attr = this.getAttributeNodeNS(namespaceURI, name);
                return (attr ? attr.nodeValue : null);
            };

        Element.prototype.hasAttributeNS =
            function hasAttributeNS(namespaceURI, name) {
                return !!(this.getAttributeNS(namespaceURI, name));
            };

        Element.prototype.hasAttribute = function hasAttribute(name) {
            return this.hasAttributeNS(this.namespaceURI, name);
        };

        Element.prototype.setAttributeNS =
            function setAttributeNS(namespaceURI, name, value) {
                if (!namespaceURI) {
                    namespaceURI = null;
                };
                if (!this.attributes) {
                    this._setProtected('attributes', []);
                };
                for (var i = 0; i < this.attributes.length; i++) {
                    var attr = this.attributes[i];
                    if (attr.namespaceURI == namespaceURI && attr.nodeName == name) {
                        attr.nodeValue = value;
                        return;
                    };
                };
                var attr = new Attribute();
                attr.initialize(namespaceURI, name, value, this.ownerDocument);
                attr._setProtected('ownerElement', this);
                this.attributes.push(attr);
            };

        Element.prototype.setAttribute = function setAttribute(name, value) {
            this.setAttributeNS(undefined, name, value);
        };

        Element.prototype.setAttributeNodeNS =
            function setAttributeNodeNS(newAttr) {
                for (var i = 0; i < this.attributes.length; i++) {
                    var attr = this.attributes[i];
                    if (attr.namespaceURI == newAttr.namespaceURI &&
                        attr.nodeName == newAttr.nodeName) {
                        throw (
                            (new DOMException(DOMException.INUSE_ATTRIBUTE_ERR))
                        );
                    };
                };
                this.attributes.push(newAttr);
            };

        Element.prototype.setAttributeNode = function setAttributeNode(newAttr) {
            // XXX should this fail if no namespaceURI is available or something?
            this.setAttributeNodeNS(newAttr);
        };

        Element.prototype.removeAttributeNS =
            function removeAttributeNS(namespaceURI, name) {
                var newattrs = [];
                var removed = false;
                for (var i = 0; i < this.attributes.length; i++) {
                    var attr = this.attributes[i];
                    if (attr.namespaceURI == namespaceURI && attr.localName == name) {
                        removed = true;
                    } else {
                        newattrs.push(attr);
                    };
                };
                if (removed) {
                    this._setProtected('attributes', newattrs);
                    return true;
                };
            };

        Element.prototype.removeAttribute = function removeAttribute(name) {
            var newattrs = [];
            var removed = false;
            for (var i = 0; i < this.attributes.length; i++) {
                var attr = this.attributes[i];
                if (attr.nodeName == name) {
                    removed = true;
                } else {
                    newattrs.push(attr);
                };
            };
            if (removed) {
                this._setProtected('attributes', newattrs);
                return true;
            };
        };

        Element.prototype.getElementsByTagNameNS =
            function getElementsByTagNameNS(namespaceURI, name, ret) {
                // XXX *very* slow!!!
                // needs to be optimized later on (probably by using some mapping)
                if (!ret) {
                    ret = [];
                };
                for (var i = 0; i < this.childNodes.length; i++) {
                    var child = this.childNodes[i];
                    if (name == child.nodeName || name == '*') {
                        if ((!namespaceURI && !child.namespaceURI) ||
                            (namespaceURI == child.namespaceURI)) {
                            ret.push(child);
                        };
                    };
                    if (child.nodeType == 1) {
                        child.getElementsByTagNameNS(namespaceURI, name, ret);
                    };
                };
                return ret;
            };

        Element.prototype.getElementsByTagName =
            function getElementsByTagName(name) {
                return this.getElementsByTagNameNS(this.namespaceURI, name);
            };

        Element.prototype.getElementById = function getElementById(id, attrname) {
            var attrname = attrname || 'id'; // XXX xml:id?
            // XXX *very* slow!!!
            // needs to be optimized later on (probably by using some mapping)
            if (this.id == id ||
                (this.attributes && this.getAttribute(attrname) == id)) {
                return this;
            };
            for (var i = 0; i < this.childNodes.length; i++) {
                var child = this.childNodes[i];
                if (child.id == id ||
                    (child.attributes && child.getAttribute(attrname) == id)) {
                    return child;
                };
                if (child.nodeType == 1) {
                    var found = this.childNodes[i].getElementById(id, attrname);
                    if (found) {
                        return found;
                    };
                };
            };
        };

        function TextNode() {
            this._setProtected('nodeType', 3);
            this._setProtected('nodeName', '#text');
        };

        TextNode.prototype = new Node;
        this.TextNode = TextNode;

        TextNode.prototype.initialize = function initialize(data, ownerDocument) {
            this._setProtected('ownerDocument', ownerDocument);
            this._setProtected('childNodes', new NodeList());
            // nodeValue is not protected
            this.nodeValue = data;
        };

        TextNode.prototype.toXML = function toXML() {
            return string.entitize(this.nodeValue);
        };

        TextNode.prototype.cloneNode = function cloneNode() {
            var node = new TextNode();
            node.initialize(this.nodeValue, this.ownerDocument);
            return node;
        };

        function CommentNode() {
            /* a comment node */
            this._setProtected('nodeType', 8);
            this._setProtected('nodeName', '#comment');
        };

        CommentNode.prototype = new TextNode;
        this.CommentNode = CommentNode;

        CommentNode.prototype.initialize =
            function initialize(data, ownerDocument) {
                this._setProtected('ownerDocument', ownerDocument);
                this._setProtected('childNodes', []);
                this._setProtected('nodeValue', data);
            };

        CommentNode.prototype.toXML = function toXML() {
            return "<!--" + this.nodeValue + "-->";
        };

        // Attribute, subclass of TextNode because of the nice implementation
        function Attribute() {
            /* an attribute node */
            this._setProtected('nodeType', 2);
        };

        Attribute.prototype = new Node;
        this.Attribute = Attribute;

        Attribute.prototype.initialize =
            function initialize(namespaceURI, qname, value,
                ownerDocument) {
                // XXX some code duplication here...
                if (qname.match(/[^a-zA-Z0-9_\-:]/g)) {
                    throw (
                        (new DOMException(DOMException.INVALID_CHARACTER_ERR))
                    );
                };
                this._setProtected('ownerDocument', ownerDocument);
                this._setProtected('namespaceURI', namespaceURI);
                this._setProtected('nodeValue', value);
                this._setProtected('childNodes', []);

                // try to ensure integrity by defining getters and setters for certain
                // properties, since this only works in certain browsers it makes sense to
                // test your applications on one of those platforms, see also
                // WARN_ON_PREFIX in the top of the document
                if (this.__defineSetter__) {
                    this._nodeName = this.nodeName;
                    this.__defineSetter__('nodeName', function() {
                        throw (
                            (new DOMException(
                                DOMException.NO_MODIFICATION_ALLOWED_ERR)))
                    });
                    this.__defineGetter__('nodeName',
                        function() {
                            return this._nodeName
                        });
                    this.__defineSetter__('prefix',
                        function(value) {
                            if (dommer.WARN_ON_PREFIX) {
                                throw ('Setting prefix directly ' +
                                    'breaks integrity of the ' +
                                    'XML DOM in Internet ' +
                                    'Explorer browsers!');
                            };
                            this._prefix = value;
                            this._nodeName = this._prefix +
                                this._localName;
                        });
                    this.__defineGetter__('prefix', function() {
                        return this._prefix
                    });
                    this._protectAttribute('ownerElement');
                };
                this._setProtected('ownerElement', null);
                if (qname.indexOf(':') > -1) {
                    var tup = qname.split(':');
                    this.setPrefix(tup.shift());
                    this._setProtected('localName', tup.join(':'));
                } else {
                    this.setPrefix(null);
                    this._setProtected('localName', qname);
                };
                if (this.prefix) {
                    this._setProtected('nodeName', this.prefix + ':' + this.localName);
                } else {
                    this._setProtected('nodeName', this.localName);
                };
            };

        Attribute.prototype.toXML = function toXML() {
            ret = this.nodeName + '="' + string.entitize(this.nodeValue) + '"';
            return ret;
        };

        Attribute.prototype.cloneNode = function cloneNode() {
            var attr = new Attribute();
            attr.initialize(this.namespaceURI, this.nodeName, this.nodeValue,
                this.ownerDocument);
            return attr;
        };

        Attribute.prototype.toString = function toString() {
            return this.nodeValue;
        };

        function Document() {
            /* the document node */
            this._setProtected('nodeType', 9);
            this._setProtected('nodeName', '#document');
        };

        Document.prototype = new Element;
        this.Document = Document;

        Document.prototype.initialize = function initialize() {
            this._setProtected('ownerDocument', this);
            this._setProtected('childNodes', []);
            this.documentElement = null;
            this.namespaceToPrefix = {};
        };

        Document.prototype.toXML = function toXML() {
            return this.documentElement.toXML();
        };

        Document.prototype.appendChild = function appendChild(newChild) {
            if (this.documentElement) {
                throw (
                    (new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
                        'document already has a document element'))
                );
            };
            this._checkModificationAllowed();
            this._attach(newChild);
            this.documentElement = newChild;
        };

        Document.prototype.cloneNode = function cloneNode(deep) {
            var d = new Document();
            d.initialize();
            if (deep) {
                var clone = this.documentElement.cloneNode(true);
                clone = d.importNode(clone, true);
                d.appendChild(clone);
            };
            return d;
        };

        Document.prototype.createElement = function createElement(nodeName) {
            return this.createElementNS(this.namespaceURI, nodeName);
        };

        Document.prototype.createElementNS =
            function createElementNS(namespaceURI, nodeName) {
                var el = new Element();
                el.initialize(namespaceURI, nodeName, this);
                return el;
            };

        Document.prototype.createTextNode = function createTextNode(data) {
            var el = new TextNode();
            el.initialize(string.deentitize(data), this);
            return el;
        };

        Document.prototype.createAttributeNS =
            function createAttributeNS(namespaceURI, nodeName) {
                var el = new Attribute();
                el.initialize(namespaceURI, nodeName, null, this);
                return el;
            };

        Document.prototype.createAttribute = function createAttribute(nodeName) {
            return this.createAttributeNS(undefined, nodeName);
        };

        Document.prototype.createComment = function createComment(data) {
            var el = new CommentNode();
            el.initialize(data, this);
            return el;
        };

        Document.prototype.importNode = function importNode(node, deep) {
            var newnode = node.cloneNode(deep);
            newnode._setProtected('parentNode', null);
            newnode._setProtected('ownerDocument', this);
            if (newnode.getElementsByTagName) {
                var allchildren = newnode.getElementsByTagName('*');
                for (var i = 0; i < allchildren.length; i++) {
                    allchildren[i]._setProtected('ownerDocument', this);
                };
            };
            return newnode;
        };

        Document.prototype.importForeignNode = function importForeignNode(node) {
            if (node.nodeType == 1) {
                var newnode = new dommer.Element();
                newnode.initialize(node.namespaceURI, node.localName, this);
            } else if (node.nodeType == 3) {
                var newnode = new dommer.TextNode();
                newnode.initialize(node.nodeValue, this);
            } else if (node.nodeType == 8) {
                var newnode = new dommer.CommentNode();
                newnode.initialize(node.nodeValue, this);
            } else {
                throw ('unsupported node type ' + node.nodeType);
            };
            newnode.setPrefix(node.prefix);
            if (node.nodeType == 1) {
                for (var i = 0; i < node.attributes.length; i++) {
                    var attr = node.attributes[i];
                    newnode.setAttributeNS(attr.namespaceURI, attr.nodeName,
                        attr.nodeValue);
                };
                for (var i = 0; i < node.childNodes.length; i++) {
                    newnode.appendChild(this.importForeignNode(
                        node.childNodes[i]));
                };
            };
            return newnode;
        };

        function DOMHandler() {
            /* SAX handler to convert a piece of XML to a DOM */
        };

        this.DOMHandler = DOMHandler;

        DOMHandler.prototype.startDocument = function startDocument() {
            this.document = new Document();
            this.document.initialize();
            this.current = null;
            this.namespaces = new Array();
            this.namespaceToPrefix = {};
        };

        DOMHandler.prototype.startElement =
            function startElement(namespaceURI, nodename, attrs) {
                if (namespaceURI && !array.contains(this.namespaces, namespaceURI)) {
                    this.namespaces.push(namespaceURI);
                    // update the mapping on the document just to be sure,
                    // that one and the one on this handler should always be in
                    // sync if a start tag is encountered, since instantiating a
                    // Element will set the prefix on that element
                    // XXX ??
                    this.document.namespaceToPrefix = this.namespaceToPrefix;
                };
                var node = this.document.createElementNS(namespaceURI, nodename);
                var prefix = undefined;
                if (namespaceURI) {
                    prefix = this.namespaceToPrefix[namespaceURI];
                    if (prefix) {
                        node.setPrefix(prefix);
                    };
                };
                for (var ans in attrs) {
                    // XXX can be optimized by using a dict and just setting the key
                    if (ans && ans != '' && !array.contains(this.namespaces, ans)) {
                        this.namespaces.push(ans);
                    };
                    var nsattrs = attrs[ans];
                    for (var aname in nsattrs) {
                        if (aname == 'prefix') {
                            continue;
                        };
                        if (ans) {
                            var attr = this.document.createAttributeNS(ans, aname);
                            attr.setPrefix(this.namespaceToPrefix[ans]);
                            attr.nodeValue = nsattrs[aname];
                            node.setAttributeNodeNS(attr);
                        } else {
                            var attr = this.document.createAttribute(aname);
                            attr.nodeValue = nsattrs[aname];
                            node.setAttributeNode(attr);
                        };
                    };
                };
                if (!this.current) {
                    this.document.documentElement = node;
                    this.document._setProtected('childNodes', [node]);
                    this.current = node;
                    this.current._setProtected('parentNode', this.document);
                    this.current._setProtected('ownerDocument', this.document);
                } else {
                    this.current.appendChild(node);
                    this.current = node;
                };
            };

        DOMHandler.prototype.characters = function characters(data) {
            if (!this.current && string.strip(data) == '') {
                return;
            };
            var node = this.document.createTextNode(data);
            this.current.appendChild(node);
        };

        DOMHandler.prototype.comment = function comment(data) {
            if (!this.current && string.strip(data) == '') {
                return;
            };
            var node = this.document.createComment(data);
            if (this.current) {
                this.current.appendChild(node);
            } else {
                this.document.comment = node;
            };
        };

        DOMHandler.prototype.endElement =
            function endElement(namespaceURI, nodename) {
                var prefix = this.namespaceToPrefix[namespaceURI];
                if (nodename != this.current.localName ||
                    namespaceURI != this.current.namespaceURI) {
                    throw ('non-matching end tag ' + namespaceURI + ':' +
                        prefix + ':' + nodename + ' for start tag ' +
                        this.current.namespaceURI + ':' + this.current.nodeName);
                };
                this.current = this.current.parentNode;
            };

        DOMHandler.prototype.endDocument = function endDocument() {};

        function DOM() {
            /* The DOM API

                Uses regular expressions to convert <xml> to a simple DOM

                Provides:

                    DOM.parseXML(xml)
                    - parse the XML, return a document element

                    DOM.createDocument()
                    - returns the document node of the DOM (which in contains
                        the documentElement)

                    DOM.toXML()
                    - returns a serialized XML string

                    DOM.buildFromHandler(handler)
                    - build and return a DOM document built from a MiniSAX handler
            */
        };

        this.DOM = DOM;

        DOM.prototype.createDocument = function createDocument() {
            var document = new Document();
            document.initialize();
            this.document = document;
            return document;
        };

        DOM.prototype.toXML = function toXML(docOrEl, encoding) {
            /* serialize to XML */
            var xml = '<?xml version="1.0"';
            if (encoding) {
                xml += ' encoding="' + encoding + '"';
            };
            xml += '?>\n';
            return xml + docOrEl.toXML();
        };

        DOM.prototype.parseXML = function parseXML(xml) {
            /* parse XML into a DOM

                returns a Document node
            */
            var handler = new DOMHandler();
            var parser = new minisax.SAXParser();
            parser.initialize(xml, handler);
            parser.parse();
            var document = handler.document;
            this._copyNamespaceMapping(document, handler.namespaceToPrefix);
            this.document = document;
            return document;
        };

        DOM.prototype.buildFromHandler = function buildFromHandler(handler) {
            /* create a DOM from a SAX handler */
            var document = handler.document;
            this._copyNamespaceMapping(document, handler.namespaceToPrefix);
            return document;
        };

        DOM.prototype._copyNamespaceMapping =
            function _copyNamespaceMapping(document, namespaces) {
                document.namespaceToPrefix = namespaces;
            };

        // an implementation of an array, exactly the same as the one in JS
        // (although incomplete) itself, this because friggin' IE has problems
        // using Array as prototype (it won't update .length on mutations)
        function BaseArray() {
            for (var i = 0; i < arguments.length; i++) {
                this[i] = arguments[i];
            };
            this.length = arguments.length;
        };

        BaseArray.prototype.concat = function concat() {
            throw ('Not supported');
        };

        BaseArray.prototype.join = function join() {
            throw ('Not supported');
        };

        BaseArray.prototype.pop = function pop() {
            var item = this[this.length - 1];
            delete this[this.length - 1];
            this.length = this.length - 1;
            return item;
        };

        BaseArray.prototype.push = function push(item) {
            this[this.length] = item;
            this.length = this.length + 1;
            return item;
        };

        BaseArray.prototype.reverse = function reverse() {
            throw ('Not supported');
        };

        BaseArray.prototype.shift = function shift() {
            var item = this[0];
            for (var i = 1; i < this.length; i++) {
                this[i - 1] = this[i];
            };
            delete this[length - 1];
            this.length = this.length - 1;
            return item;
        };

        BaseArray.prototype.unshift = function unshift(item) {
            for (var i = 0; i < this.length; i++) {
                this[this.length - i] = this[(this.length - i) - 1];
            };
            this[0] = item;
            this.length = this.length + 1;
            return;
        };

        BaseArray.prototype.splice = function splice() {
            // XXX we may want to support this later
            throw ('Not supported');
        };

        BaseArray.prototype.toString = function toString() {
            var ret = [];
            for (var i = 1; i < this.length; i++) {
                ret.push(this[i].toString());
            };
            return ret.join(', ');
        };

        // for subclassing and such...
        this.BaseArray = BaseArray;

        function NodeList() {};

        NodeList.prototype = new BaseArray;
        this.NodeList = NodeList;

        NodeList.prototype.item = function item(index) {
            return this[index];
        };

        function NamedNodeMap() {};

        NamedNodeMap.prototype = new BaseArray;
        this.NamedNodeMap = NamedNodeMap;

        NamedNodeMap.prototype.item = function item(index) {
            return this[index];
        };

        NamedNodeMap.prototype.getNamedItem = function getNamedItem(name) {
            for (var i = 0; i < this.length; i++) {
                if (this[i].nodeName == name) {
                    return this[i];
                };
            };
            return undefined;
        };

        NamedNodeMap.prototype.setNamedItem = function setNamedItem(arg) {
            // this should generate exceptions, but I'm not sure when...
            // XXX how 'bout when arg is not the proper type?!?
            for (var i = 0; i < this.length; i++) {
                if (this[i].nodeName == arg.nodeName) {
                    this[i] = arg;
                    return;
                };
            };
            this.push(arg);
        };

        NamedNodeMap.prototype.removeNamedItem = function removeNamedItem(name) {
            // a bit nasty: deleting an element from an array will not actually
            // free the index, instead something like undefined or null will end
            // up in its place, so we walk the array here, move every element
            // behind the item to remove one up, and pop the last item when
            // we're done
            var delete_mode = false;
            for (var i = 0; i < this.length; i++) {
                if (this[i] === name) {
                    delete_mode = true;
                };
                if (delete_mode) {
                    this[i] = this[i + 1];
                };
            };
            if (!delete_mode) {
                throw (
                    (new DOMException(DOMException.NOT_FOUND_ERR))
                );
            };
            // the last element is now in the array twice
            this.pop();
        };
    }();

    // XXX shouldn't we make these local?
    function createStack() {
        // somewhat nasty trick to get a stack trace in Moz
        var stack = undefined;
        try {
            notdefined()
        } catch (e) {
            stack = e.stack
        };
        if (stack) {
            stack = stack.split('\n');
            stack.shift();
            stack.shift();
        };
        return stack ? stack.join('\n') : '';
    };

    function getLineNo(stack) {
        /* tries to get the line no in Moz */
        if (!stack) {
            return;
        };
        stack = stack.toString().split('\n');
        var chunks = stack[0].split(':');
        var lineno = chunks[chunks.length - 1];
        if (lineno != '0') {
            return lineno;
        };
    };

    function getFileName(stack) {
        /* tries to get the filename in Moz */
        if (!stack) {
            return;
        };
        stack = stack.toString().split('\n');
        var chunks = stack[0].split(':');
        var filename = chunks[chunks.length - 2];
        return filename;
    };

    return this.dommer
})


text:
<?php

	class RevSliderSettingsProduct extends UniteSettingsRevProductRev{

		/**
		 *
		 * set custom values to settings
		 */
		public static function setSettingsCustomValues(UniteSettingsRev $settings, $arrValues, $postTypesWithCats = false){
			$arrSettings = $settings->getArrSettings();

			foreach($arrSettings as $key=>$setting){
				$type = UniteFunctionsRev::getVal($setting, "type");
				if($type != UniteSettingsRev::TYPE_CUSTOM)
					continue;
				$customType = UniteFunctionsRev::getVal($setting, "custom_type");

				switch($customType){
					case "slider_size":
						$setting["width"] = UniteFunctionsRev::getVal($arrValues, "width",UniteFunctionsRev::getVal($setting,"width"));
						$setting["height"] = UniteFunctionsRev::getVal($arrValues, "height",UniteFunctionsRev::getVal($setting,"height"));
						$arrSettings[$key] = $setting;
					break;
					case "responsitive_settings":
						$id = $setting["id"];
						$setting["w1"] = UniteFunctionsRev::getVal($arrValues, $id."_w1",UniteFunctionsRev::getVal($setting,"w1"));
						$setting["w2"] = UniteFunctionsRev::getVal($arrValues, $id."_w2",UniteFunctionsRev::getVal($setting,"w2"));
						$setting["w3"] = UniteFunctionsRev::getVal($arrValues, $id."_w3",UniteFunctionsRev::getVal($setting,"w3"));
						$setting["w4"] = UniteFunctionsRev::getVal($arrValues, $id."_w4",UniteFunctionsRev::getVal($setting,"w4"));
						$setting["w5"] = UniteFunctionsRev::getVal($arrValues, $id."_w5",UniteFunctionsRev::getVal($setting,"w5"));
						$setting["w6"] = UniteFunctionsRev::getVal($arrValues, $id."_w6",UniteFunctionsRev::getVal($setting,"w6"));

						$setting["sw1"] = UniteFunctionsRev::getVal($arrValues, $id."_sw1",UniteFunctionsRev::getVal($setting,"sw1"));
						$setting["sw2"] = UniteFunctionsRev::getVal($arrValues, $id."_sw2",UniteFunctionsRev::getVal($setting,"sw2"));
						$setting["sw3"] = UniteFunctionsRev::getVal($arrValues, $id."_sw3",UniteFunctionsRev::getVal($setting,"sw3"));
						$setting["sw4"] = UniteFunctionsRev::getVal($arrValues, $id."_sw4",UniteFunctionsRev::getVal($setting,"sw4"));
						$setting["sw5"] = UniteFunctionsRev::getVal($arrValues, $id."_sw5",UniteFunctionsRev::getVal($setting,"sw5"));
						$setting["sw6"] = UniteFunctionsRev::getVal($arrValues, $id."_sw6",UniteFunctionsRev::getVal($setting,"sw6"));
						$arrSettings[$key] = $setting;
					break;
				}
			}

			$settings->setArrSettings($arrSettings);

			//disable settings by slider type:
			$sliderType = $settings->getSettingValue("slider_type");

			switch($sliderType){
				case "fixed":
				case "fullwidth":
				case "fullscreen":
					//hide responsive
					$settingRes = $settings->getSettingByName("responsitive");
					$settingRes["disabled"] = true;
					$settings->updateArrSettingByName("responsitive", $settingRes);
				break;
			}

			switch($sliderType){
				case "fixed":
				case "responsitive":
				case "fullscreen":
					//hide autoheight
					$settingRes = $settings->getSettingByName("auto_height");
					$settingRes["disabled"] = true;
					$settings->updateArrSettingByName("auto_height", $settingRes);

					$settingRes = $settings->getSettingByName("force_full_width");
					$settingRes["disabled"] = true;
					$settings->updateArrSettingByName("force_full_width", $settingRes);
				break;
			}
			//change height to max height
			$settingSize = $settings->getSettingByName("slider_size");
			$settingSize["slider_type"] = $sliderType;
			$settings->updateArrSettingByName("slider_size", $settingSize);

			//$settings = self::setCategoryByPostTypes($settings, $arrValues, $postTypesWithCats, "post_types", "post_category","post");

			return($settings);
		}

		/**
		 *
		 * draw responsitive settings value
		 */
		protected function drawResponsitiveSettings($setting){
			$id = $setting["id"];

			$w1 = UniteFunctionsRev::getVal($setting, "w1");
			$w2 = UniteFunctionsRev::getVal($setting, "w2");
			$w3 = UniteFunctionsRev::getVal($setting, "w3");
			$w4 = UniteFunctionsRev::getVal($setting, "w4");
			$w5 = UniteFunctionsRev::getVal($setting, "w5");
			$w6 = UniteFunctionsRev::getVal($setting, "w6");

			$sw1 = UniteFunctionsRev::getVal($setting, "sw1");
			$sw2 = UniteFunctionsRev::getVal($setting, "sw2");
			$sw3 = UniteFunctionsRev::getVal($setting, "sw3");
			$sw4 = UniteFunctionsRev::getVal($setting, "sw4");
			$sw5 = UniteFunctionsRev::getVal($setting, "sw5");
			$sw6 = UniteFunctionsRev::getVal($setting, "sw6");

			$disabled = (UniteFunctionsRev::getVal($setting, "disabled") == true);

			$strDisabled = "";
			if($disabled == true)
				$strDisabled = "disabled='disabled'";

			?>

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>1:

						<input id="<?php echo $id?>_w1" name="<?php echo $id?>_w1" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w1?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>1:

						<input id="<?php echo $id?>_sw1" name="<?php echo $id?>_sw1" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw1?>">

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>2:

						<input id="<?php echo $id?>_w2" name="<?php echo $id?>_w2" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w2?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>2:

						<input id="<?php echo $id?>_sw2" name="<?php echo $id?>_sw2" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw2?>">

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>3:

						<input id="<?php echo $id?>_w3" name="<?php echo $id?>_w3" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w3?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>3:

						<input id="<?php echo $id?>_sw3" name="<?php echo $id?>_sw3" type="text" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw3?>">

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>4:

						<input type="text" id="<?php echo $id?>_w4" name="<?php echo $id?>_w4" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w4?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>4:

						<input type="text" id="<?php echo $id?>_sw4" name="<?php echo $id?>_sw4" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw4?>">

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>5:

						<input type="text" id="<?php echo $id?>_w5" name="<?php echo $id?>_w5" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w5?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>5:

						<input type="text" id="<?php echo $id?>_sw5" name="<?php echo $id?>_sw5" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw5?>">

						<?php _e("Screen Width",REVSLIDER_TEXTDOMAIN)?>6:

						<input type="text" id="<?php echo $id?>_w6" name="<?php echo $id?>_w6" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $w6?>">

						<?php _e("Slider Width",REVSLIDER_TEXTDOMAIN)?>6:

						<input type="text" id="<?php echo $id?>_sw6" name="<?php echo $id?>_sw6" class="textbox-small" <?php echo $strDisabled?> value="<?php echo $sw6?>">

			<?php
		}

		/**
		 *
		 * draw slider size
		 */
		protected function drawSliderSize($setting){

			$width = UniteFunctionsRev::getVal($setting, "width");
			$height = UniteFunctionsRev::getVal($setting, "height");

			$sliderType = UniteFunctionsRev::getVal($setting, "slider_type");

			$textNormalW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
			$textNormalH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);

			$textFullWidthW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
			$textFullWidthH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);

			$textFullScreenW = __("Grid Width:",REVSLIDER_TEXTDOMAIN);
			$textFullScreenH = __("Grid Height:",REVSLIDER_TEXTDOMAIN);

			//set default text (fixed, responsive)
			switch($sliderType){
				default:
					$textDefaultW = $textNormalW;
					$textDefaultH = $textNormalH;
				break;
				case "fullwidth":
					$textDefaultW = $textFullWidthW;
					$textDefaultH = $textFullWidthH;
				break;
				case "fullscreen":
					$textDefaultW = $textFullScreenW;
					$textDefaultH = $textFullScreenH;
				break;
			}

			?>

					<td id="cellWidth" data-textnormal="<?php echo $textNormalW?>" data-textfull="<?php echo $textFullWidthW?>" data-textscreen="<?php echo $textFullScreenW?>">
						<?php echo $textDefaultW ?>

						<input id="width" name="width" type="text" class="textbox-small" value="<?php echo $width?>">

					<td id="cellHeight" data-textnormal="<?php echo $textNormalH?>" data-textfull="<?php echo $textFullWidthH?>" data-textscreen="<?php echo $textFullScreenH?>">
						<?php echo $textDefaultH ?>

						<input id="height" name="height" type="text" class="textbox-small" value="<?php echo $height?>">

			<?php
		}

		/**
		 *
		 * draw custom inputs for rev slider
		 * @param $setting
		 */
		protected function drawCustomInputs($setting){

			$customType = UniteFunctionsRev::getVal($setting, "custom_type");
			switch($customType){
				case "slider_size":
					$this->drawSliderSize($setting);
				break;
				case "responsitive_settings":
					$this->drawResponsitiveSettings($setting);
				break;
				default:
					UniteFunctionsRev::throwError("No handler function for type: $customType");
				break;
			}
		}

		/**
		 *
		 * get first category from categories list
		 */
		private static function getFirstCategory($cats){

			foreach($cats as $key=>$value){
				if(strpos($key,"option_disabled") === false)
					return($key);
			}
			return("");
		}

		/**
		 * set category by post type, with specific name (can be regular or woocommerce)
		 */
		public static function setCategoryByPostTypes(UniteSettingsRev $settings,$arrValues, $postTypesWithCats,$nameType,$nameCat,$defaultType){

			//update the categories list by the post types
			$postTypes = UniteFunctionsRev::getVal($arrValues, $nameType ,$defaultType);
			if(strpos($postTypes, ",") !== false)
				$postTypes = explode(",",$postTypes);
			else
				$postTypes = array($postTypes);

			$arrCats = array();
			$globalCounter = 0;

			$arrCats = array();
			$isFirst = true;
			foreach($postTypes as $postType){
				$cats = UniteFunctionsRev::getVal($postTypesWithCats, $postType,array());
				if($isFirst == true){
					$firstValue = self::getFirstCategory($cats);
					$isFirst = false;
				}

				$arrCats = array_merge($arrCats,$cats);
			}

			$settingCategory = $settings->getSettingByName($nameCat);
			$settingCategory["items"] = $arrCats;
			$settings->updateArrSettingByName($nameCat, $settingCategory);

			//update value to first category
			$value = $settings->getSettingValue($nameCat);
			if(empty($value)){

				$settings->updateSettingValue($nameCat, $firstValue);
			}

			return($settings);
		}

	}

?>

redpajama_set_name: RedPajamaGithub


text:
#import <MTProtoKit/MTDatacenterTransferAuthAction.h>

#import <MTProtoKit/MTContext.h>
#import <MTProtoKit/MTSerialization.h>
#import <MTProtoKit/MTProto.h>
#import <MTProtoKit/MTRequestMessageService.h>
#import <MTProtoKit/MTRequest.h>

@interface MTDatacenterTransferAuthAction () <MTContextChangeListener>
{
    id _authToken;

    MTProto *_sourceDatacenterMtProto;

    NSInteger _destinationDatacenterId;
    MTProto *_destinationDatacenterMtProto;

    __weak MTContext *_context;
}

@end

@implementation MTDatacenterTransferAuthAction

- (void)dealloc
{
    [self cleanup];
}

- (void)cleanup
{
    MTContext *context = _context;
    [context removeChangeListener:self];

    [_sourceDatacenterMtProto stop];
    _sourceDatacenterMtProto = nil;

    [_destinationDatacenterMtProto stop];
    _destinationDatacenterMtProto = nil;
}

- (void)execute:(MTContext *)context masterDatacenterId:(NSInteger)masterDatacenterId destinationDatacenterId:(NSInteger)destinationDatacenterId authToken:(id)authToken
{
    _destinationDatacenterId = destinationDatacenterId;
    _context = context;
    _authToken = authToken;

    if (_destinationDatacenterId != 0 && context != nil && _authToken != nil)
    {
        if ([_authToken isEqual:[context authTokenForDatacenterWithId:_destinationDatacenterId]])
            [self complete];
        else
            [self beginTransferFromDatacenterId:masterDatacenterId];
    }
    else
        [self fail];
}

- (void)contextDatacenterAuthTokenUpdated:(MTContext *)context datacenterId:(NSInteger)datacenterId authToken:(id)authToken
{
    MTContext *currentContext = _context;
    if (currentContext == nil || context != currentContext)
        return;

    if (authToken != nil && [_authToken isEqual:authToken])
    {
        if (datacenterId == _destinationDatacenterId)
            [self complete];
        else
            [self beginTransferFromDatacenterId:datacenterId];
    }
}

- (void)beginTransferFromDatacenterId:(NSInteger)sourceDatacenterId
{
    MTContext *context = _context;
    if (context == nil)
    {
        [self fail];

        return;
    }

    _sourceDatacenterMtProto = [[MTProto alloc] initWithContext:context datacenterId:sourceDatacenterId];

    MTRequestMessageService *requestService = [[MTRequestMessageService alloc] initWithContext:context];
    [_sourceDatacenterMtProto addMessageService:requestService];

    MTRequest *request = [[MTRequest alloc] init];

    request.body = [context.serialization exportAuthorization:(int32_t)_destinationDatacenterId];

    __weak MTDatacenterTransferAuthAction *weakSelf = self;
    [request setCompleted:^(id result, __unused NSTimeInterval timestamp, id error)
    {
        __strong MTDatacenterTransferAuthAction *strongSelf = weakSelf;
        if (strongSelf == nil)
            return;

        if (error == nil)
            [strongSelf beginTransferWithId:[context.serialization exportedAuthorizationId:result] data:[context.serialization exportedAuthorizationBytes:result]];
        else
            [strongSelf fail];
    }];

    [requestService addRequest:request];
}

- (void)beginTransferWithId:(int32_t)dataId data:(NSData *)authData
{
    [_sourceDatacenterMtProto stop];
    _sourceDatacenterMtProto = nil;

    MTContext *context = _context;
    _destinationDatacenterMtProto = [[MTProto alloc] initWithContext:context datacenterId:_destinationDatacenterId];

    MTRequestMessageService *requestService = [[MTRequestMessageService alloc] initWithContext:context];
    [_destinationDatacenterMtProto addMessageService:requestService];

    MTRequest *request = [[MTRequest alloc] init];

    request.body = [context.serialization importAuthorization:dataId bytes:authData];

    NSInteger destinationDatacenterId = _destinationDatacenterId;
    id authToken = _authToken;

    __weak MTDatacenterTransferAuthAction *weakSelf = self;
    [request setCompleted:^(__unused id result, __unused NSTimeInterval timestamp, id error)
    {
        __strong MTDatacenterTransferAuthAction *strongSelf = weakSelf;
        if (strongSelf == nil)
            return;

        if (error == nil)
        {
            [context updateAuthTokenForDatacenterWithId:destinationDatacenterId authToken:authToken];

            [strongSelf complete];
        }
        else
            [strongSelf fail];
    }];

    [requestService addRequest:request];
}

- (void)cancel
{
    [self cleanup];

    [self fail];
}

- (void)complete
{
    id<MTDatacenterTransferAuthActionDelegate> delegate = _delegate;
    if ([delegate respondsToSelector:@selector(datacenterTransferAuthActionCompleted:)])
        [delegate datacenterTransferAuthActionCompleted:self];
}

- (void)fail
{
    id<MTDatacenterTransferAuthActionDelegate> delegate = _delegate;
    if ([delegate respondsToSelector:@selector(datacenterTransferAuthActionCompleted:)])
        [delegate datacenterTransferAuthActionCompleted:self];
}

@end


text:
local SpatialFullConvolution, parent = torch.class('nn.SpatialFullConvolution','nn.Module')

function SpatialFullConvolution:__init(nInputPlane, nOutputPlane,
                                       kW, kH, dW, dH, padW, padH, adjW, adjH)
   parent.__init(self)

   dW = dW or 1
   dH = dH or 1

   self.nInputPlane = nInputPlane
   self.nOutputPlane = nOutputPlane
   self.kW = kW
   self.kH = kH
   self.dW = dW
   self.dH = dH
   self.padW = padW or 0
   self.padH = padH or 0
   self.adjW = adjW or 0
   self.adjH = adjH or 0

   if self.adjW > self.dW - 1 or self.adjH > self.dH - 1 then
      error('adjW and adjH must be smaller than self.dW - 1' ..
            ' and self.dH - 1 respectively')
   end

   self.weight = torch.Tensor(nInputPlane, nOutputPlane, kH, kW)
   self.gradWeight = torch.Tensor(nInputPlane, nOutputPlane, kH, kW)
   self.bias = torch.Tensor(self.nOutputPlane)
   self.gradBias = torch.Tensor(self.nOutputPlane)

   self:reset()
end

function SpatialFullConvolution:reset(stdv)
   if stdv then
      stdv = stdv * math.sqrt(3)
   else
      local nInputPlane = self.nInputPlane
      local kH = self.kH
      local kW = self.kW
      stdv = 1/math.sqrt(kW*kH*nInputPlane)
   end
   self.weight:uniform(-stdv, stdv)
   self.bias:uniform(-stdv, stdv)
end

local function makeContiguous(self, input, gradOutput)
  if not input:isContiguous() then
    self._input = self._input or input.new()
    self._input:resizeAs(input):copy(input)
    input = self._input
  end
  if gradOutput then
    if not gradOutput:isContiguous() then
      self._gradOutput = self._gradOutput or gradOutput.new()
      self._gradOutput:resizeAs(gradOutput):copy(gradOutput)
      gradOutput = self._gradOutput
    end
  end
  return input, gradOutput
end

function SpatialFullConvolution:backCompatibility()
  self.adjW = self.adjW or 0
  self.adjH = self.adjH or 0
end

function SpatialFullConvolution:updateOutput(input)
  self.finput = self.finput or input.new()
  self.fgradInput = self.fgradInput or input.new()
  self:backCompatibility()

  input = makeContiguous(self, input)
  input.THNN.SpatialFullConvolution_updateOutput(
    input:cdata(),
    self.output:cdata(),
    self.weight:cdata(),
    self.bias:cdata(),
    self.finput:cdata(),
    self.fgradInput:cdata(),
    self.kW, self.kH,
    self.dW, self.dH,
    self.padW, self.padH,
    self.adjW, self.adjH
  )

  return self.output
end

function SpatialFullConvolution:updateGradInput(input, gradOutput)
  self:backCompatibility()

  if self.gradInput then
    input, gradOutput = makeContiguous(self, input, gradOutput)
    input.THNN.SpatialFullConvolution_updateGradInput(
      input:cdata(),
      gradOutput:cdata(),
      self.gradInput:cdata(),
      self.weight:cdata(),
      self.finput:cdata(),
      self.kW, self.kH,
      self.dW, self.dH,
      self.padW, self.padH,
      self.adjW, self.adjH
    )

    return self.gradInput
  end
end

function SpatialFullConvolution:accGradParameters(input, gradOutput, scale)
  scale = scale or 1
  self:backCompatibility()

  input, gradOutput = makeContiguous(self, input, gradOutput)
  input.THNN.SpatialFullConvolution_accGradParameters(
    input:cdata(),
    gradOutput:cdata(),
    self.gradWeight:cdata(),
    self.gradBias:cdata(),
    self.finput:cdata(),
    self.fgradInput:cdata(),
    self.kW, self.kH,
    self.dW, self.dH,
    self.padW, self.padH,
    self.adjW, self.adjH,
    scale
  )
end

function SpatialFullConvolution:type(type, tensorCache)
  self.finput = self.finput and torch.Tensor()
  self.fgradInput = self.fgradInput and torch.Tensor()
  return parent.type(self, type, tensorCache)
end

function SpatialFullConvolution:__tostring__()
  local s = string.format('%s(%d -> %d, %dx%d', torch.type(self),
  self.nInputPlane, self.nOutputPlane, self.kW, self.kH)
  if self.dW ~= 1 or self.dH ~= 1 or self.padW ~= 0 or self.padH ~= 0 then
    s = s .. string.format(', %d,%d', self.dW, self.dH)
  end
  if (self.padW or self.padH) and (self.padW ~= 0 or self.padH ~= 0) then
    s = s .. ', ' .. self.padW .. ',' .. self.padH
  end
  if (self.adjW or self.adjH) and (self.adjW ~= 0 or self.adjH ~= 0) then
    s = s .. ', ' .. self.adjW .. ',' .. self.adjH
  end
  return s .. ')'
end

function SpatialFullConvolution:clearState()
   nn.utils.clear(self, 'finput', 'fgradInput', '_input', '_gradOutput')
   return parent.clearState(self)
end


text:
Search

            With the Search utility you can find existing registered resources that match a wide set of criteria.

String Matching

            You can search based on PCRE (Perl-Compatible Regular Expressions). For example, you can search System Name like '^[rR]'.

Search Fields

            MAC addresses can be formatted in any notation (Windows, UNIX, Cisco, etc). They just have to be valid.

            The owner field searches both the DNS A record owner and the System owner.

View Fields

            You can specify which fields you want to see in your search results. These come in a default configuration. There are also links to select all or none fields so you can have full control over what you see.
            You can search based on PCRE (Perl-Compatible Regular Expressions). For example, you can search System Name like '^[rR]'.

Common Errors

Syntax

            This is usually because you entered an invalid IP or MAC address. Read the error message to see what happened.

ObjectNotFound

            This occurs when no results match what you searched for. Maybe alter your search criteria?


text:
"""
  Purpose:
  This script will generate a list of discovered nodes and identifiers
  using the RackHD API calls.
"""

#pylint: disable=relative-import

import os
import sys
import subprocess
import json
import pprint
from nosedep import depends

# set path to common libraries
sys.path.append(subprocess.check_output("git rev-parse --show-toplevel", shell=True).rstrip("\n") + "/test/common")
import fit_common
import test_api_utils

class display_rackhd_node_list(fit_common.unittest.TestCase):
    def test_display_node_list(self):
        # This test displays a list of the nodes, type and name
        mondata = fit_common.rackhdapi("/api/1.1/nodes")
        nodes = mondata['json']
        result = mondata['status']
        if result == 200:
            # display nodes
            print '\n{:4s} {:26s} {:15s} {:132s}'.format(" ", "NodeId", "Node Type", "Node Name")
            i = 0
            if not nodes:
                print "No Nodes found on ORA server "
            else:
                for node in nodes:
                    i += 1
                    print '{:4s} {:26s} {:15s} {:132s}'.format(str(i), node['id'], node['type'], node['name'])
        else:
            print "Cannot get RackHD nodes from stack, http response code: ", result

    @depends(after='test_display_node_list')
    def test_display_node_list_discovery_data(self):
        # This test displays a list of the nodes along with
        # the associated BMC, RMM, and OBM settings for the discovered compute nodes
        mondata = fit_common.rackhdapi("/api/1.1/nodes")
        nodes = mondata['json']
        result = mondata['status']

        if result == 200:
            #print "result" + str(result)
            # Display node info
            print "\nNumber of nodes found: "+str(len(nodes))+"\n"
            i = 0
            for node in nodes:
                i += 1
                print ""
                nn = node["id"]
                print "Node {0}: {1}".format(str(i), nn)
                # Check type of node and display info
                nodetype = node['type']
                if nodetype != "compute":
                    print "Node Type: ", nodetype
                    if nodetype == "enclosure":
                        print "Node Name: ", node['name']
                        nodelist = test_api_utils.get_relations_for_node(nn)
                        if nodelist:
                            print "Nodes contained in this enclosure: ", nodelist
                        else:
                            print "No Nodes found in this enclosure"
                else:
                    # If compute node, display BMC, RMM and IP info
                    nodetype = test_api_utils.get_rackhd_nodetype(nn)
                    print "Compute Node Type: ", nodetype
                    enclosure = test_api_utils.get_relations_for_node(nn)
                    if enclosure:
                        print "In Enclosure: ", enclosure[0]
                    else:
                        print "Not associated with a monorail enclosure"
                    # try to get the BMC info from the catalog
                    monurl = "/api/1.1/nodes/"+nn+"/catalogs/bmc"
                    mondata = fit_common.rackhdapi(monurl, action="get")
                    catalog = mondata['json']
                    bmcresult = mondata['status']
                    print "BMC MAC Address",
                    print "\tBMC IP Address",
                    print "\tBMC IP Source",
                    print "\tRMM MAC Address",
                    print "\tRMM IP Address",
                    print "\tRMM IP Source",
                    print "\tOBM Host",
                    print "\t\tOBM User"
                    if bmcresult != 200:
                        print "Error on catalog/bmc command",
                    else:
                        print catalog["data"]["MAC Address"],
                        print "\t" + catalog["data"]["IP Address"],
                        print "\t" + catalog["data"]["IP Address Source"],
                    # Get RMM info from the catalog, if present
                    rmmurl = "/api/1.1/nodes/"+nn+"/catalogs/rmm"
                    rmmdata = fit_common.rackhdapi(rmmurl, action="get")
                    rmmcatalog = rmmdata['json']
                    rmmresult = rmmdata['status']
                    if rmmresult != 200:
                        print "\tNo RMM catalog entry.\t\t\t\t\t",
                    else:
                        print "\t" + rmmcatalog["data"].get("MAC Address", "-"),
                        print "\t" + rmmcatalog["data"].get("IP Address", "-"),
                        print "\t" + rmmcatalog["data"].get("IP Address Source", "-") + "\t",

                    nodeurl = "/api/1.1/nodes/"+nn
                    nodedata = fit_common.rackhdapi(nodeurl, action="get")
                    nodeinfo = nodedata['json']
                    result = nodedata['status']
                    if result != 200:
                        print "Error on node command" + nodeurl + ", http response:  " + result
                    else:
                        # Check BMC IP vs OBM IP setting
                        try:
                            obmlist = nodeinfo["obmSettings"]
                        except:
                            print "ERROR: Node has no OBM settings configured"
                        else:
                            try:
                                obmhost = obmlist[0]["config"]["host"]
                            except:
                                print "Invalid or empty OBM setting"
                            else:
                                print obmhost,
                                print "\t" + obmlist[0]["config"].get("user","Error: No User defined!")
        else:
            print "Cannot get RackHD nodes from stack, http response code: ", result

if __name__ == '__main__':
    fit_common.unittest.main()


text:
<?php
class State_model extends CI_Model {
	protected $_table_name = 'state';
	protected $_order_by = 'id';
	protected static $db_fields = array('id', 'name', 'country_id','state_code');

	public $id;
	public $name;
	public $state_code;
	public $country_id;

	public function __construct()	{
		$this->load->database();
	}

	public function getStateByCountryId($id)

    {

        $this->db->select('id,name')->from('state');

        $this->db->where(array('country_id'=>$id));

        $query = $this->db->get();
		//print_r($query->result());die('test');
        return $query->result();

    }

	public function save($id=NULL,$table='state')
	{

		$data 					= $this->array_from_post(self::$db_fields);

		if($id)
		{
			$this->db->where('id', $id);
			$last_id = $this->db->update($table ,$data);
			if($last_id !== 0){
				return true;
			}else{
				return false;
			}
			//$this->save($data, $id);

		} else {
			$this->db->insert($table ,$data);
			$last_id = $this->db->insert_id();

		}

	}
	public function getState($start=0,$limit=0,$status=1)
	{
		if($status)
			$this->db->where("status = {$status}");

		//$this->db->order_by("created_date","desc");

		if($limit)
			$state = $this->get3($limit,$start);
		else
			$state = $this->get2();
		return $state;
	}

	public function deleteState($id)
	{
		$result = $this->delete($id);
		return $result;

	}
	public function statedrop($id=null){
		$state = $this->State_model->get();
		$option = '';
		foreach($state as $state_row){
			$select = '';
			if($id == $state_row->id)
				$select = 'selected';
			$option .= "<option id='state' {$select} value='{$state_row->id}'>{$state_row->name}</option>";

		}
		return $option;
	}

	public function get_state($id) {
		if($id != FALSE) {
			$query = $this->db->get_where($this->_table_name, array('id' => $id));
			$state = $query->result();
			return $state[0]->name;
		}
		else {
			return FALSE;
		}
	}

	public function getStateCode($id) {
		if($id != FALSE) {
			$query = $this->db->get_where($this->_table_name, array('id' => $id));
			$state = $query->result();
			return $state[0]->state_code;
		}
		else {
			return FALSE;
		}
	}
	public function stateCode($id=null){
		$state = $this->State_model->get();
		$option = '';
		foreach($state as $state_row){
			$select = '';
			if($id == $state_row->id)
				$select = 'selected';
			$option .= "<option id='state' {$select} value='{$state_row->id}'>{$state_row->state_code}</option>";

		}
		return $option;
	}

}
?>


text:
/**
 * @title UploadResponse.java
 * @description TODO(这里用一句话描述这个文件的作用)
 * @package lm.cloud.storage.server.model
 * @author mrluo735
 * @since JDK1.7
 * @date 2017年6月9日上午11:56:22
 * @version v1.0.0
 */
package lm.cloud.storage.server.model;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: UploadResponse
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author mrluo735
 * @date 2017年6月9日 上午11:56:22
 *
 */
public class UploadResponse implements Serializable {
	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = -5085387794968296736L;

	/**
	 * 文件唯一id
	 */
	private Long id;

	/**
	 * 文件原名称
	 */
	private String originalName = "";

	/**
	 * 文件名称
	 */
	private String name = "";

	/**
	 * 文件名称无扩展名
	 */
	private String nameWithoutExtension = "";

	/**
	 * 扩展名
	 */
	private String extension = "";

	/**
	 * Mime类型
	 */
	private String mimetype = "";

	/**
	 * 域名
	 */
	private String domain = "";

	/**
	 * url
	 */
	private String url = "";

	/**
	 * url无域名
	 */
	private String urlWithoutDomain = "";

	/**
	 * 文件大小
	 */
	private long size = 0L;

	/**
	 * 宽度
	 */
	private int width = 0;

	/**
	 * 高度
	 */
	private int height = 0;

	/**
	 * 持续时间
	 */
	private BigDecimal duration = BigDecimal.ZERO;

	/**
	 * 文件hash
	 */
	private String hash = "";

	/**
	 * 存储类型(1:自定义;2:Fastdfs;3七牛)
	 */
	private int storageType;

	/**
	 * 空间名
	 */
	private String bucketName = "";

	/**
	 * 上传时间
	 */
	private long uploadOn = 0L;

	/**
	 * 补充信息
	 */
	private Map<String, String> extra = new HashMap<String, String>();

	/**
	 *
	 * @return
	 */
	public Long getId() {
		return id;
	}

	/**
	 *
	 * @param id
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @return the originalName
	 */
	public String getOriginalName() {
		return originalName;
	}

	/**
	 * @param originalName
	 *            the originalName to set
	 */
	public void setOriginalName(String originalName) {
		this.originalName = originalName;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the nameWithoutExtension
	 */
	public String getNameWithoutExtension() {
		return nameWithoutExtension;
	}

	/**
	 * @param nameWithoutExtension
	 *            the nameWithoutExtension to set
	 */
	public void setNameWithoutExtension(String nameWithoutExtension) {
		this.nameWithoutExtension = nameWithoutExtension;
	}

	/**
	 * @return the extension
	 */
	public String getExtension() {
		return extension;
	}

	/**
	 * @param extension
	 *            the extension to set
	 */
	public void setExtension(String extension) {
		this.extension = extension;
	}

	/**
	 * @return the mimetype
	 */
	public String getMimetype() {
		return mimetype;
	}

	/**
	 * @param mimetype
	 *            the mimetype to set
	 */
	public void setMimetype(String mimetype) {
		this.mimetype = mimetype;
	}

	/**
	 * @return the domain
	 */
	public String getDomain() {
		return domain;
	}

	/**
	 * @param domain
	 *            the domain to set
	 */
	public void setDomain(String domain) {
		this.domain = domain;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url
	 *            the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the urlWithoutDomain
	 */
	public String getUrlWithoutDomain() {
		return urlWithoutDomain;
	}

	/**
	 * @param urlWithoutDomain
	 *            the urlWithoutDomain to set
	 */
	public void setUrlWithoutDomain(String urlWithoutDomain) {
		this.urlWithoutDomain = urlWithoutDomain;
	}

	/**
	 * @return the size
	 */
	public long getSize() {
		return size;
	}

	/**
	 * @param size
	 *            the size to set
	 */
	public void setSize(long size) {
		this.size = size;
	}

	/**
	 * @return the width
	 */
	public int getWidth() {
		return width;
	}

	/**
	 * @param width
	 *            the width to set
	 */
	public void setWidth(int width) {
		this.width = width;
	}

	/**
	 * @return the height
	 */
	public int getHeight() {
		return height;
	}

	/**
	 * @param height
	 *            the height to set
	 */
	public void setHeight(int height) {
		this.height = height;
	}

	/**
	 * @return the duration
	 */
	public BigDecimal getDuration() {
		return duration;
	}

	/**
	 * @param duration
	 *            the duration to set
	 */
	public void setDuration(BigDecimal duration) {
		this.duration = duration;
	}

	/**
	 * @return the hash
	 */
	public String getHash() {
		return hash;
	}

	/**
	 * @param hash
	 *            the hash to set
	 */
	public void setHash(String hash) {
		this.hash = hash;
	}

	/**
	 *
	 * @return
	 */
	public int getStorageType() {
		return storageType;
	}

	/**
	 *
	 * @param storageType
	 *            the storageType to set
	 */
	public void setStorageType(int storageType) {
		this.storageType = storageType;
	}

	/**
	 * @return the bucketName
	 */
	public String getBucketName() {
		return bucketName;
	}

	/**
	 * @param bucketName
	 *            the bucketName to set
	 */
	public void setBucketName(String bucketName) {
		this.bucketName = bucketName;
	}

	/**
	 * @return the uploadOn
	 */
	public long getUploadOn() {
		return uploadOn;
	}

	/**
	 * @param uploadOn
	 *            the uploadOn to set
	 */
	public void setUploadOn(long uploadOn) {
		this.uploadOn = uploadOn;
	}

	/**
	 * @return the extra
	 */
	public Map<String, String> getExtra() {
		return extra;
	}

	/**
	 * @param extra
	 *            the extra to set
	 */
	public void setExtra(Map<String, String> extra) {
		this.extra = extra;
	}
}


text:
class EnrollmentCvProxy

  NAMESPACES = { ns1: 'http://openhbx.org/api/terms/1.0'}

  def initialize(enrollment_cv)
    @xml_doc = Nokogiri::XML(enrollment_cv)
  end

  def enrollees
    enrollees_list = []
    enrollee_nodes = @xml_doc.xpath('//ns1:enrollee', NAMESPACES)
    enrollee_nodes.each do |enrollee_node|
      enrolle_parser = Parsers::Cv::Enrollee.new(enrollee_node)
      enrolle_parser_hash = enrolle_parser.to_hash
      enrolle_parser_hash[:m_id] = enrolle_parser.to_hash[:m_id].split("hbx_id=").last if enrolle_parser.to_hash[:m_id].include?('hbx_id=')
      enrollee = Enrollee.new(enrolle_parser_hash)
      enrollees_list << enrollee
    end
    enrollees_list
  end

  def policy
    policy_node = @xml_doc.xpath('//ns1:policy', NAMESPACES).first
    policy_hash = Parsers::Cv::NewPolicy.new(policy_node).to_hash
    policy = Policy.new(policy_hash)
    policy.enrollees = enrollees
    policy.plan = plan
    policy
  end

  def plan
    plan_hash = Parsers::Xml::Cv::PlanParser.parse(@xml_doc).first.to_hash
    Plan.find_by_hios_id_and_year(plan_hash[:id], plan_hash[:active_year])
  end

  def policy_pre_amt_tot=(value)
    @xml_doc.xpath('//ns1:enrollment/ns1:policy/ns1:enrollment/ns1:premium_total_amount', NAMESPACES).first.content = value
  end

  def policy_tot_res_amt=(value)
    @xml_doc.xpath('//ns1:enrollment/ns1:policy/ns1:enrollment/ns1:total_responsible_amount', NAMESPACES).first.content = value
  end

  def policy_emp_res_amt=(value)
    @xml_doc.xpath('//ns1:enrollment/ns1:policy/ns1:enrollment/ns1:shop_market/ns1:total_employer_responsible_amount', NAMESPACES).first.content = value
  end

  def enrollees_pre_amt=(enrollees)
    enrollees_node = @xml_doc.xpath('//ns1:enrollment/ns1:policy/ns1:enrollees', NAMESPACES)

    enrollees_and_nodes = enrollees_node.zip enrollees

    enrollees_and_nodes.each do |enrollee_node, enrollee|
      @xml_doc.xpath('//ns1:enrollee/ns1:benefit/ns1:premium_amount', NAMESPACES).first.content = enrollee.premium_amount
    end
  end

  def to_xml
    @xml_doc.to_xml
  end
end


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	package="com.rartworks.ChangeMe.android"
	android:versionCode="1"
	android:versionName="1.0" >

	<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="23" />

	<uses-permission android:name="android.permission.VIBRATE"/>
	<uses-permission android:name="android.permission.INTERNET"/>
	<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
	<uses-permission android:name="com.android.vending.BILLING" />

	<application
		android:name ="ChangeMeAndroidApp"
		android:allowBackup="true"
		android:icon="@drawable/ic_launcher"
		android:label="@string/app_name"
		android:theme="@style/GdxTheme" >

		<meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" />
		<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

		<activity
			android:name="com.rartworks.ChangeMe.android.AndroidLauncher"
			android:label="@string/app_name"
			android:screenOrientation="landscape"
			android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
			<intent-filter>
				<action android:name="android.intent.action.MAIN" />
				<category android:name="android.intent.category.LAUNCHER" />
			</intent-filter>
		</activity>

		<activity android:name="com.google.android.gms.ads.AdActivity"
				  android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
				  android:theme="@android:style/Theme.Translucent" />
	</application>
</manifest>


text:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.EntityFramework;
using Microsoft.AspNet.Identity.Owin;
using Microsoft.Owin.Security;
using Microsoft.Owin.Security.OAuth;
using OwinAuthenticationApi.Models;

namespace OwinAuthenticationApi
{
    public class AuthorizationServerProvider : OAuthAuthorizationServerProvider
    {
        public override Task ValidateClientAuthentication(OAuthValidateClientAuthenticationContext context)
        {
            //string clientId;
            //string clientSecret;

            //if (context.TryGetBasicCredentials(out clientId, out clientSecret))
            //{
            //    // validate the client Id and secret against database or from configuration file.
            //    context.Validated();
            //}
            //else
            //{
            //    context.SetError("invalid_client", "Client credentials could not be retrieved from the Authorization header");
            //    context.Rejected();
            //}
            context.Validated();
            return Task.FromResult<object>(null);

        }
        public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwnerCredentialsContext context)
        {
            var userManager = context.OwinContext.GetUserManager<UserManager<AppUser>>();
            try
            {
                var user = await userManager.FindAsync(context.UserName, context.Password);
                if (user != null)
                {
                    var identity = await userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ExternalBearer);
                    context.Validated(identity);
                }
                else
                {
                    context.SetError("invalid_grant", "Invalid User Id or password'");
                    context.Rejected();
                }
            }
            catch(Exception ex)
            {
                var mensaje = ex.Message;
                // Could not retrieve the user due to error.
                context.SetError("server_error");
                context.Rejected();
            }
        }
    }
}