/*
Theme Name: iTCHYROBOT Parent Theme V 7.0.3
Author: iTCHYROBOT
Author URI: http://www.itchyrobot.co.uk
Description: Custom Parent Framework for iTCHYROBOT based on the Foundation Design Model (HTML 5, CSS3 and JQuery)
GitHub Theme URI: https://github.com/itchyrobot/itchyrobot_parent
Version: 7.0.3

Read Me
Version: 7.0.3

Read Me
7.0.3    -      Secure Policies fix for IE and Edge displaying documents.
7.0.2    -      School Alerts moved to wp_footer and javascript implementation
7.0.1    -      Schoolinfo outside locked school IF and adding image onto Events Loop
7.0.0    -      Customiser optional style loading
                Creation of Letters home table
                Letters home questions
                Parents evening booking report
6.3      - tidy Up
6.2      - PARENT DASHBOARD Appearing on commercial sites with logged in.  Now wrapped in is School
6.1      - Update system message
         - Error in Foundation tree walker.  the menu was erroring out in Wordpress 5.2.  The problem is that the if statement in the wordpress core is 
         - overriding itself on a hyperlink target and object parameter XFN.  I have set both of these object parameters to an empty string.
         - //Introduced In Wordpress 5.2 to stop errors in wp-includes/class-walker-nav-menu.php on lines 175 and 178 see includes/foundation-menu-walker.php in parent
6.0      - Major Gutenburg update including
         - removal of the Mobile App
         - Clean up of old files
         - Testing on WP 5.2
         - Mobile app removed from School Alerts and from the Itchyrobot Menu in Wordpress core
         - School Dictionary Removed as not compatible with Gutenburg
5.7.9.9 - Security Update on WP-API to disable account enumeration
        - False positive 404 on any page
5.7.9.8 - Bug Fix User role
5.7.9.7 - Bug Fix
5.7.9.6 - Major release of the parents evening system.
            Updating of CMB2 to the latest verions
            Inclusion of the parents dashboard
            Bug fixes and standardisation of language around the parents evening system
            Improvement of Interfaces
            Integration with Scholar Pack
5.7.9.5 - Reduction of if statement for testing
5.7.9.4 - Ternary Operater for post variable
5.7.9.3 - Addition of Crypt Key for scholarpack
5.7.9.2 - Extension of the scholarpack update
5.7.9.1 - Addition of manage categories button to the staff archive
5.7.9.0 - Fileref Update
5.7.8.9 - Fileref Update
5.7.8.7 - Update of document embed viewer
5.7.8.6 - Update of document embed viewer
5.7.8.5 - Update of document embed viewer
5.7.8.4 - Update of document embed viewer
5.7.8.3 - Calendar repeats
5.7.8.2 - Calendar repeats
5.7.8.1 - Homepage calendar function updated to incorporate tribe functions
5.7.8.0 - Addition of pdf js for viewing policies and letters
5.7.7.9 - Initial launch of the letters home functionality for testing by Sean Cottingham
5.7.7.8 - Updated the users call in the parents evening for multisite.
5.7.7.7 - remove close button from cookie popup as it must be an accept or decline explicit consent
5.7.7.6 - Fix to the string build on the cookie policy javascript for the setcookie call.  The escaping of the 365 side was incorrectly escaped. Minifested when you click the X to close the modal popup rather than using the Agree of Cancel
5.7.7.5 - Change of function for the gutenberg release
5.7.7.4 - Addition of Flush Rules to functionality page.
5.7.7.3 - Remove comments from header management
5.7.7.2 - Header image management for the archives for calendar
5.7.7.1 - Header image management for the archives
5.7.7.0 - Secure document upload directory call conflicts
5.7.6.9 - Ofsted removal of untagged section
5.7.6.8 - Media Library Filter for secure policies
5.7.6.7 - Multi-site path fix
5.7.6.6 - Initial load of the secure policies has no ID but has post type we can check against
5.7.6.5 - Media gallery security updates
5.7.6.4 - Secure document exists validation added
5.7.6.3 - Create HTACCESS files for secure areas if they do not exist
5.7.6.2 - Gutenburg Updates
5.7.6.1 - Update to remove the code that removes version numbers from styles and scripts
5.7.6.0 - Admin Style Update
5.7.5.9 - Admin Style Update
5.7.5.8 - Security Key and all security direct access to php updated
5.7.5.7 - Re add the eol email sending after testing
5.7.5.6 - Tweak to end of life policy array to int conversion.
5.7.5.5 - Parents Evening add an event closed option.  The event closed requires a page to be selected that will redirect the user to a page.  
        This is defended in Single with a URL rewrite at the top and also on the archive with a template rewrite
5.7.5.4 - Parents Evening change of text Foundation to Reception
5.7.5.3 - Ofsted Data removed from menu for business sites
5.7.5.2 - Update for App EOL
5.7.5.1 - Add linkedin option is School Details and updated school details to remove reference to school on the business sites
        - Mobile App End of Life Message
5.7.5.0 - Addition of print functionality on the View bookings page
5.7.4.9 - CSS Caching
5.7.4.8 - CSS Caching
5.7.4.7 - Updated parents evening non attendance report and admin style caching
5.7.4.6 - Parents Evening Dashboard Overhaul 
                1. Manual Booking of parents from the dashboard.
                2. Visual Upgrade of the UI and navigation
                3. All dates fixed to UK format
                4. Front end fix for parent names
                5. Email fix for date formats
                6. Reporting page Teacher name fixed
                7. Reporting graph dimension changes.
5.7.4.5 - Parents Evening - Update locking variable to not regnerate sessions if an admin has blocked out bookings
5.7.4.4 - Parents evening trim function to ensure data length for EFL column
5.7.4.3 - Policy manager performance improvement
                1. Move download code from init to a url_rewrite
                2. Security code review and sanitize variables
5.7.4.2 - Policy manager
                1. Optional omittence from signing a policy.  Does not alert users and removes the admin features and reports
                2. Admin ability to download a signed PDF
                3. Installing of FDPF and FPDFI http://fpdf.org to read and generate PDFs
5.7.4.1 - IS bypass policy signing and email generation
5.7.4.0 - Sean Cottingham fix to add teachers to a year group.  This is for the parents evening system.
5.7.3.9 - Sean Cottingham fix for reported redirect on parents evening.  
5.7.3.8 - Multi-site database Key Change.
5.7.3.7 - Multi-site database Key Change.
5.7.3.6 - Multi-site option key upgrade.
5.7.3.5 - Parents Evening Multisite check.
5.7.3.4 - Added a popup to the parents evening system on the forgot code button.
5.7.3.3 - Parents Child Upload extra line in DB for updCol and Cookie suppression on disabled devices
5.7.3.2 - CSV Upload defensive and auto pop policy selector and parents evening
5.7.3.1 - Username and email validation before updating or creating account
5.7.3.0 - SYSLOG USERID
5.7.2.9 - SYSLOG USERID
5.7.2.8 - Staff upload defensive coding - Test required on multisite
5.7.2.7 - Upload users via CSV for the website.
5.7.2.6 - Version key updating
5.7.2.5 - Theme Auto Update trial
5.7.2.3 - Theme Auto Update test
5.7.2.2 - Added 3 new videos to the Dashboard - Policy Manager / Ofsted Checker / Logo Slider
5.7.2.1 - Theme Update Test
5.7.1.8 - Theme Update Test
5.7.1.7 - Theme Update Test
5.7.1.6 - Theme Update Test
5.7.1.5 - Introduce Auto parent Theme update
5.7.1.4 - Removed untagged option from the Ofsted Checker
5.7.1.3 - Dictionary bug fix on null line 122
          Moved surveys admin file into the schoolsite if statement so it wont appear for businesses
          Added the wayward cmb onto ofsted data.
          Updated policy loop to output in alphaetical order.
          Commented out the auto update for the theme
          Update to the ofsted checker to include secondary.

5.7.1.2 - Table Header Fix for Surveys

5.7.1.1 - DB Fix

5.7.1.0 - Dashboard updates for survey processing
          Update survey reports
          New viewed features
          SIMS CSV example updated
          SIMS Headings updated 
          

5.7.0.9 - Updated database table prefix to fix survey graph

5.7.0.8 - Random header added to survey single

5.7.0.7 - Key Update on DB creation for the handling of Survey tables

5.7.0.6 - Bug fix on the GITHUB Update - Remove error handling

5.7.0.5 - Bug fix on the GITHUB Update

5.7.0.4 - Bug fix on the GITHUB Update

5.7.0.3 - Finalise DB Creation

5.7.0.2 - Bug fix on the GITHUB Update

5.7.0.1 - Bug fix on the GITHUB Update

5.7.0.0 - Release of survey questionaire system inc Pupil Premium

5.6.0.4x - Fix for teacher list on the Parents Evening system

5.6.0.3 - Clean out old db script

5.6.0.2 - Testing the auto updating code

5.6.0.1 - Rewrote the Parents evening loaddataintodb function.  Original used load ini model but proved 
unreliable depending on user data.  Changed to a loop.Current dataset tests the system with 445 users which is a
reasonable size primary school

5.6.0.0 - Removed the document viewer to a straight iframe and only allow PDF

5.5.9.9 - Parents Evening conditional logic update

5.5.9.8 - CSS Change for Mobile App Dash board and reorder of messages
Backwards compatibility for policy manager 

5.5.9.7 - Spelling mistake change in Policy Email

5.5.9.6 - Removed Google Document Viewer

5.5.9.5 - 17th May 2018 - ofsted javascript update.  Fixed an issue with updating and resaving the ofsted data. Line changes
in admin_ofsted.js    var htmlcontent = jQuery('#collapse'+id+' .ofstedcontent'+id).html();  Move from picking up the first UL to
saving the whole content box.

5.5.9.4 - 17th May 2018 - ofsted change.

5.5.9.3 - 17th May 2018 - ofsted updater changed to SSL connections.

5.5.9.2 - 15th May 2018 - Admin footer link update.

5.5.9.1 - 10th May 2018 - Policy footer CSS update

5.5.9.0 - 10th May 2018 - Policy footer design update

5.5.8.9 - 10th May 2018 - Updated the Policies/Cookie bar to use the correct grid framework.

5.5.8.8 - 10th May 2018 - Added admin link  

5.5.8.7 - 10th May 2018 - Added transients to the policies  

5.5.8.6 - 10th May 2018 - Bug fix for Twitter and addition of Policies/Cookie bar in the footer. 
                          Added the newsletters categories and shortcode to pull them out onto the page.
                          Removed Privacy button from the Login popup

5.5.8.5 - 8th May 2018 - Bug fix in updater code.

5.5.8.4 - 17th April 2018 - Added a school/business switch into the wp-config for the removal of the dashboard and some features on business sites.

5.5.8.3 - 3rd April 2018 - Tweak to the page builder output loop

5.5.8.2 - 3rd April 2018 - Added slick fonts to parent so they are available, updated the random header function logic.
Parents Evening Booking Updates

5.5.8.1 - 29th March 2018 - Header Image Mgr Bug Fix - Reorder filter calls

5.5.8.0 - 28th March 2018 - Header Image Mgr Bug Fix

5.5.7.9 - 28th March 2018 - Header Image Upload Management

5.5.7.8 - 27th March 2018 - Hide policies from main menu

5.5.7.7 - 27th March 2018 - Reorder capabilities assignment for admin

5.5.7.6 - 27th March 2018 - Capabilities bug fix

5.5.7.5 - 27th March 2018 - Sub menu recode for capabilities

5.5.7.4 - 27th March 2018 - Capabilities Update for custom dashboard

5.5.7.3 - 27th March 2018 - Capabilities Update for custom dashboard

5.5.7.2 - 27th March 2018 - Capabilities Update for admin pages

5.5.7.1 - 26th March 2018 - Blog Permissions auto assign to admin

5.5.7.0 - 26th March 2018 - Blog Permissions Change

5.5.6.9 - 26th March 2018 - Change to document embedder code

5.5.6.8 - 26th March 2018 - Cookie Policy update to check cookie to prevent display repeatedly on the front end
Update the dynamic grid framework page builder to utilise either the xy grid or the default

5.5.6.7 - Push Notification limit increased. New Push notification link box added. Old dash board rewrite rules added to the system.  Caching rules conditional logic changed

5.5.6.6 - Android Push Message Fix.

5.5.6.5 - Addtion of new letters home help video to the dashboard.

5.5.6.4 - Addtion of new help videos to the dashboard.

5.5.6.3 - rewrite of the clearing of iOS obsolete records

5.5.6.2 - IOS Push Notifications blocking script fix

5.5.6.1 - IOS Push Notifications delete phone registrations that error on sending to minimise future issues
        - Path to child Tweets updated
        - To do - sort referential integrity for deleting phoneIDs

5.5.6.0 - Custom page builder integrated into pages, news, blog. Affects single pages and hooks into content filter for output

5.5.5.9 - Add Insert document in google document viewer rather than open the document in the browser

5.5.5.8 - Footer Update core locked to admin roles only

5.5.5.7 - GDPR CSS Change
          Footer Update core locked to admin roles only
          

5.5.5.6 - GDPR Policy Update

5.5.5.5 - Added the user profile fields from edit to add users.  
        - On the add user page we also added the option to auto generate the teacher for use in the parents evening system.
          This methodology of separating teachers actual login accounts and the CPT allows us to have flexibility.  i.e. Teachers do
          not require a login to be included as part of the parents evening system and all teachers/staff do not need to be added to the 
          parents evening teachers list.

5.5.5.4 - Auto generate the role caps for teacher and school admin to retain Policy access

5.5.5.3 - Override caching of dash style sheet

5.5.5.2 - Override caching of admin style sheet

5.5.5.1 - New dashboard and the start of the video help file integration
        - bug fix to the Ofsted checker dashboard stats.  If a school deselects a section the stats now take that into account when calculating the numbers
        - Begin of the new role manager functionality
        - Removal of the dashboard locks
        - Dashboard Chart Responsiveness
        - Mobile Statistics introduced to the dashboard

5.5.5.0 - Update messages revised

5.5.4.9 - Update messages added

5.5.4.8 - Updates

5.5.4.7 - Bug Fix

5.5.4.6 - Live client update test

5.5.4.5 - Live client update test

5.5.4.4 - Live client update test

5.5.4.3 - Give clients the ability to update the core

5.5.4.2 - Parents Evening MIS Upload Changes

5.5.4.1 - Android Push Message upgrade.

5.5.4.0 - Parents Evening Updates.

5.5.3.9 - Parents Evening Testing System.

5.5.3.8 - Update to policies to improve the table output.

5.5.3.7 - Create pupildata table for parents evening system

5.5.3.6 - Create pupildata table for parents evening system

5.5.3.5 - Policy Selector Icon for TinyMCE

5.5.3.4 - Policy Selector for pages

5.5.3.3 - Dictionary query update

5.5.3.2 - Update to the policy email url to make it more resiliant, added tooltip to accassibility view, updated signature css
        - Governor Policy add and update alert

5.5.3.1 - GDPR Style sheet loading update

5.5.3.0 - GDPR login message.  Provides a modal popup screen alerting people on the data we hold.
This will be enhanced at a later date to ask them to accept the policy on the dashboard so we can track
actual acceptance on a per user basis.

5.5.2.9 - Multisite Agregated Ofsted Report - styling

5.5.2.8 - Multisite Agregated Ofsted Report - title and text added

5.5.2.7 - Multisite Agregated Ofsted Report - title and text added

5.5.2.6 - Multisite Agregated Ofsted Report - remove root site dashboard layout

5.5.2.5 - Multisite Agregated Ofsted Report

5.5.2.4 - Cookie Responsive Layout and Mobile Menu Updates

5.5.2.3 - Update to cookie policy z-index

5.5.2.2 - Update to cookie policy.

5.5.2.1 - Update to cookie policy.

5.5.2.0 - Update to cookie policy.

5.5.1.9 - Permalink Update action using options

5.5.1.8 - Permalink Update action using options

5.5.1.7 - Permalink Update action using options

5.5.1.6 - Permalink Update action using options

5.5.1.5 - Permalink Update action using options

5.5.1.4 - Permalink Update action testing

5.5.1.3 - Refresh permalinks on theme update

5.5.1.2 - Remove accessible page for contact form template

5.5.1.1 - Strip short codes from accessible text

5.5.1 - Remove Cookie Alert

5.5.0 - Inclusion of Accessible pages opened on each Wordpress loop via the Eye Icon.  Bug fix for policies add new - Missing post variables.  New cookie bar acceptance bar added to the site.

5.4.9 - Add welcome message selector to the School Info Settings Page.  Will be used to populate the home page message

5.4.8 - Update to statistics widget to move with updates

5.4.7 - Ofsted Email Syslog event to check which sites are sending

5.4.6 - Updated Foundation CSS to work with new framework

5.4.5 - SQL Fix for Policy Graph on Multisite

5.4.4 - Policy graph fix

5.4.3 - Defined constant removed from functions.php that removes the online editor.
        Emails for Policies added
        Emails for Osted reports updated
        Moved Ofsted report to every 2 weeks rather than every minute

5.4.2 - Update to defined constant

5.4.1 - Security update for policies, Drop down menu for subpages. 

5.4.0 - Document Signing for Policies.  Short code for dictionary.  Users policy management. Ofsted Email.

5.3.9 - Update School Admin and teacher roles to permit deleting of pages and posts that belong to others updating.

5.3.8 - Update School Admin and teacher roles to permit NextGen Gallery updating.

5.3.7 - Update to init_theme function to better provide backwards compability for the meta box manager.

5.3.5 - Updated user roles for teacher and school admin. Updated the mobile class to kill extra headers.

5.3.4 - Second run of auto update

5.3.3 - Test run of auto update

5.3.2. Cumulative Push of changes

5.3.1 - Update to school alert stripslashes to handle apostrophe in the messages. and dashboard class fix for policy admin file.

5.3.0 - Update to ofsted page template to fix jQuery bug
Ofsted manual content refresh button added to the Ofsted dashboard page to loaded new help information from robot primary 

5.2.9 - OfSted Checker dropdowns updated to pull pages as well as policies
VIP Widgets base functionality. No dashboard design as yet
Add scrolling marquee to school alerts

*/
