consolidated changes

Chris,

I couldn't do a pull request from the repo that I ended up doing all of my changes in (https://github.nrel.gov/slaws/perseus) because I had forked into my ShaunLawsNREL account and them transferred ownership into my slaws account - that transfer of ownership severs the ties to your repo from which mine was forked. So, I had to consolidate all my changes into a single commit on this forked repo.

Without the commit history, I'll go through the changes here:

1) Services/Form.class.php

- changed 'state' to protected, so that child classes can determine the state of the form
- correct the action to use $settings['action'] rather than $action - there is no variable $action in scope
- added support for magic quotes - strips out added backlashes that are added if magic quotes are on

2) Services/Form/Item.class.php

- add support for xss filtering
- avoid strict error for a function signature different to the overridden function

3) Services/Form/Item/Html.class.php, theme/templates/form/item/html.html.twig

- provide an element for adding markup to forms

4) Services/Form/Item/Radios.class.php, theme/templates/form/item/radios.html.twig

- provide radios form element

 5) Services/Form/Item/Submit.class.php

- avoid strict error for a function signature different to the overridden function

6) Services/Form/Item/Textarea.class.php

- add the correct element into the build data as the value of the text area

7) Services/MySQL.class.php

- add the port to the database connection settings
- add prepared statement support to select and insert

8)  System/System.class.php

- change the parameters to the select function call to be consistent with those expected by the changed select function
- add setDb to be able to set the db instance - the call to System::db() was failing without being able to explicitly set the db instance
- remove KEY purge (expiration) clause from the flood table instantiation - instantiation was failing with this statement included

9)  includes/util.inc

- add utility functions for getting us state, canadian provinces and ISO countries

10)  init.inc 

I needed to capitalize the 'System' part of the path to match the exact spelling on nreldev - it could not find the includes otherwise

11) theme/templates/form/item/select.html.twig, theme/templates/form/item/text.html.twig, theme/templates/form/item/textarea.html.twig

- add an id attribute to the templates to match the label for. I probably should have done this by adding an $id data member to the Item class and copying the $name to it in the constructor (since $name is used as the value in the label 'for' attribute). IO can refactor the code to do this if you want me to.

12) theme/templates/table.html.twig

- add the table template back in - it had disappeared from the latest 3.x-dev branch

The change that is most likely to affect any existing code which uses the framework is the addition of prepared statements to the select MySql function, since it expects the 3rd parameter (the conditions) in a different format - an array of arrays rather than an array of strings. I could refactor the function to expect an array of condition strings and parse out the 3 elements of each (the field, the comparator and the value), but that might be quite tricky. Let's discuss this one, and talk about any questions you have on the other changes, further.