From dfc8b2ea53fae58486fdf1a41ad5e05b60b0a36f Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Wed, 14 Jan 2015 21:31:45 -0600 Subject: [PATCH 01/11] Last Quarter --- .dev/Bootstrap.php | 2 +- .dev/CreateClassMap.php | 2 +- .dev/Tests/ResourceTest.php | 4 +- Factories/Resource/Configuration.xml | 2 +- Factories/Resource/ResourceFactoryMethod.php | 4 +- Factories/Resourcecss/Configuration.xml | 2 +- .../Resourcecss/ResourcecssFactoryMethod.php | 4 +- .../Resourcecssdeclarations/Configuration.xml | 2 +- .../ResourcecssdeclarationsFactoryMethod.php | 4 +- Factories/Resourcejs/Configuration.xml | 2 +- .../Resourcejs/ResourcejsFactoryMethod.php | 4 +- .../Resourcejsdeclarations/Configuration.xml | 2 +- .../ResourcejsdeclarationsFactoryMethod.php | 4 +- Factories/Resourcerendering/Configuration.xml | 2 +- .../ResourcerenderingFactoryMethod.php | 4 +- Source/Adapter/AbstractAdapter.php | 4 +- Source/Adapter/Asset.php | 4 +- Source/Adapter/ClassLoader.php | 4 +- Source/Adapter/Css.php | 4 +- Source/Adapter/Cssdeclarations.php | 4 +- Source/Adapter/Extension.php | 4 +- Source/Adapter/File.php | 4 +- Source/Adapter/Folder.php | 4 +- Source/Adapter/Head.php | 4 +- Source/Adapter/Js.php | 4 +- Source/Adapter/Jsdeclarations.php | 4 +- Source/Adapter/Menuitem.php | 4 +- Source/Adapter/Page.php | 4 +- Source/Adapter/Query.php | 4 +- Source/Adapter/Template.php | 4 +- Source/Adapter/Theme.php | 4 +- Source/Adapter/Wrap.php | 4 +- Source/Adapter/Xml.php | 4 +- Source/Api/ConfigurationDataInterface.php | 4 +- Source/Api/ConfigurationInterface.php | 4 +- Source/Api/FactoryInterface.php | 4 +- Source/Api/RegistryInterface.php | 4 +- Source/ClassMap.php | 4 +- Source/ClassMap/Aggregate.php | 4 +- Source/ClassMap/Base.php | 4 +- Source/ClassMap/Events.php | 4 +- Source/ClassMap/Items.php | 4 +- Source/Configuration/AbstractAdapter.php | 6 +- Source/Configuration/Data.php | 4 +- Source/Configuration/Dataobject.php | 4 +- Source/Configuration/Model.php | 4 +- Source/Configuration/Registry.php | 4 +- Source/Driver.php | 4 +- Source/ExtensionMap.php | 752 ++++++++++-------- Source/Factory/ReadControllerFactory.php | 8 +- Source/Factory/ReadModelFactory.php | 4 +- Source/ResourceMap.php | 4 +- Source/ResourceMap/Base.php | 4 +- Source/ResourceMap/Folders.php | 4 +- Source/ResourceMap/Prefixes.php | 12 +- Source/ResourceMap/xxxxCreate.php | 463 ----------- Source/Scheme.php | 4 +- 57 files changed, 543 insertions(+), 890 deletions(-) delete mode 100644 Source/ResourceMap/xxxxCreate.php diff --git a/.dev/Bootstrap.php b/.dev/Bootstrap.php index d1b4d3a..79c51bb 100644 --- a/.dev/Bootstrap.php +++ b/.dev/Bootstrap.php @@ -3,7 +3,7 @@ * Bootstrap for Testing * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ $base = substr(__DIR__, 0, strlen(__DIR__) - 5); diff --git a/.dev/CreateClassMap.php b/.dev/CreateClassMap.php index c7f5513..f14a6b2 100644 --- a/.dev/CreateClassMap.php +++ b/.dev/CreateClassMap.php @@ -3,7 +3,7 @@ * Create Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ diff --git a/.dev/Tests/ResourceTest.php b/.dev/Tests/ResourceTest.php index 1a92244..e495578 100644 --- a/.dev/Tests/ResourceTest.php +++ b/.dev/Tests/ResourceTest.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Render\Test; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class ResourceTest extends \PHPUnit_Framework_TestCase diff --git a/Factories/Resource/Configuration.xml b/Factories/Resource/Configuration.xml index e632989..406779f 100644 --- a/Factories/Resource/Configuration.xml +++ b/Factories/Resource/Configuration.xml @@ -3,7 +3,7 @@ Resource Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resource/ResourceFactoryMethod.php b/Factories/Resource/ResourceFactoryMethod.php index 59fc7b2..a14285c 100644 --- a/Factories/Resource/ResourceFactoryMethod.php +++ b/Factories/Resource/ResourceFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http:/www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resource; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http:/www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0 */ class ResourceFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Factories/Resourcecss/Configuration.xml b/Factories/Resourcecss/Configuration.xml index d0be84c..80845a5 100644 --- a/Factories/Resourcecss/Configuration.xml +++ b/Factories/Resourcecss/Configuration.xml @@ -3,7 +3,7 @@ Resourcecss Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resourcecss/ResourcecssFactoryMethod.php b/Factories/Resourcecss/ResourcecssFactoryMethod.php index 3e4f5ad..1fba980 100644 --- a/Factories/Resourcecss/ResourcecssFactoryMethod.php +++ b/Factories/Resourcecss/ResourcecssFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resourcecss; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0 */ class ResourcecssFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Factories/Resourcecssdeclarations/Configuration.xml b/Factories/Resourcecssdeclarations/Configuration.xml index 7734767..e969044 100644 --- a/Factories/Resourcecssdeclarations/Configuration.xml +++ b/Factories/Resourcecssdeclarations/Configuration.xml @@ -3,7 +3,7 @@ Resourcecssdeclarations Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php index 85f035b..253f71d 100644 --- a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php +++ b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resourcecssdeclarations; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0 */ class ResourcecssdeclarationsFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Factories/Resourcejs/Configuration.xml b/Factories/Resourcejs/Configuration.xml index 401c64f..a66d55a 100644 --- a/Factories/Resourcejs/Configuration.xml +++ b/Factories/Resourcejs/Configuration.xml @@ -3,7 +3,7 @@ Resourcejs Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resourcejs/ResourcejsFactoryMethod.php b/Factories/Resourcejs/ResourcejsFactoryMethod.php index dd07dcb..21bbf2c 100644 --- a/Factories/Resourcejs/ResourcejsFactoryMethod.php +++ b/Factories/Resourcejs/ResourcejsFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resourcejs; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0 */ class ResourcejsFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Factories/Resourcejsdeclarations/Configuration.xml b/Factories/Resourcejsdeclarations/Configuration.xml index 5f0f135..0f3fb08 100644 --- a/Factories/Resourcejsdeclarations/Configuration.xml +++ b/Factories/Resourcejsdeclarations/Configuration.xml @@ -3,7 +3,7 @@ Resourcejsdeclarations Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php index a6043db..16f3c67 100644 --- a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php +++ b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resourcejsdeclarations; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0 */ class ResourcejsdeclarationsFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Factories/Resourcerendering/Configuration.xml b/Factories/Resourcerendering/Configuration.xml index 24c38a8..52391f0 100644 --- a/Factories/Resourcerendering/Configuration.xml +++ b/Factories/Resourcerendering/Configuration.xml @@ -3,7 +3,7 @@ Resourcesrendering Amy Stephen January 2014 - Copyright (C) 2014 Amy Stephen. All rights reserved. + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org http://molajo.org diff --git a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php index 82cd199..3ae64ac 100644 --- a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php +++ b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Factories\Resourcerendering; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class ResourcerenderingFactoryMethod extends FactoryMethodBase implements FactoryInterface, FactoryBatchInterface diff --git a/Source/Adapter/AbstractAdapter.php b/Source/Adapter/AbstractAdapter.php index af8878a..bad42dc 100644 --- a/Source/Adapter/AbstractAdapter.php +++ b/Source/Adapter/AbstractAdapter.php @@ -3,7 +3,7 @@ * Abstract Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * Abstract Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Asset.php b/Source/Adapter/Asset.php index 7e393cd..aacaaf7 100644 --- a/Source/Adapter/Asset.php +++ b/Source/Adapter/Asset.php @@ -3,7 +3,7 @@ * Asset Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * Asset Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/ClassLoader.php b/Source/Adapter/ClassLoader.php index a06a865..318c0e6 100644 --- a/Source/Adapter/ClassLoader.php +++ b/Source/Adapter/ClassLoader.php @@ -3,7 +3,7 @@ * Class Loader Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * Class Loader Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Css.php b/Source/Adapter/Css.php index 6aac163..9b0fa9b 100644 --- a/Source/Adapter/Css.php +++ b/Source/Adapter/Css.php @@ -3,7 +3,7 @@ * Css Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -15,7 +15,7 @@ * Css Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Cssdeclarations.php b/Source/Adapter/Cssdeclarations.php index ff39475..828d0f4 100644 --- a/Source/Adapter/Cssdeclarations.php +++ b/Source/Adapter/Cssdeclarations.php @@ -3,7 +3,7 @@ * Css Declarations Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -15,7 +15,7 @@ * Css Declarations Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Extension.php b/Source/Adapter/Extension.php index 3d86295..3524d7a 100644 --- a/Source/Adapter/Extension.php +++ b/Source/Adapter/Extension.php @@ -3,7 +3,7 @@ * Extension Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -15,7 +15,7 @@ * Extension Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/File.php b/Source/Adapter/File.php index 3eb1604..8c97e18 100644 --- a/Source/Adapter/File.php +++ b/Source/Adapter/File.php @@ -3,7 +3,7 @@ * File Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * File Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Folder.php b/Source/Adapter/Folder.php index f8807e8..c4f6973 100644 --- a/Source/Adapter/Folder.php +++ b/Source/Adapter/Folder.php @@ -3,7 +3,7 @@ * Folder Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Folder Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Head.php b/Source/Adapter/Head.php index fb92bfd..0b9d04f 100644 --- a/Source/Adapter/Head.php +++ b/Source/Adapter/Head.php @@ -3,7 +3,7 @@ * Head Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * Head Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Js.php b/Source/Adapter/Js.php index b16136e..f674281 100644 --- a/Source/Adapter/Js.php +++ b/Source/Adapter/Js.php @@ -3,7 +3,7 @@ * Js Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -15,7 +15,7 @@ * Js Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Jsdeclarations.php b/Source/Adapter/Jsdeclarations.php index 2f84407..cc3bdae 100644 --- a/Source/Adapter/Jsdeclarations.php +++ b/Source/Adapter/Jsdeclarations.php @@ -3,7 +3,7 @@ * Js Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -14,7 +14,7 @@ * Js Resource Adapter * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Adapter/Menuitem.php b/Source/Adapter/Menuitem.php index 88a35b6..1944e7a 100644 --- a/Source/Adapter/Menuitem.php +++ b/Source/Adapter/Menuitem.php @@ -3,7 +3,7 @@ * Menuitem Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Menuitem Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Page.php b/Source/Adapter/Page.php index 2562921..4d22461 100644 --- a/Source/Adapter/Page.php +++ b/Source/Adapter/Page.php @@ -3,7 +3,7 @@ * Page View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Page View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Query.php b/Source/Adapter/Query.php index 81bcf1e..ba5b4b1 100644 --- a/Source/Adapter/Query.php +++ b/Source/Adapter/Query.php @@ -3,7 +3,7 @@ * Query Resource Handler * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -19,7 +19,7 @@ * Query Resource Handler - Instantiates Model and Controller * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Template.php b/Source/Adapter/Template.php index cc270be..a764f15 100644 --- a/Source/Adapter/Template.php +++ b/Source/Adapter/Template.php @@ -3,7 +3,7 @@ * Template View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Template View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Theme.php b/Source/Adapter/Theme.php index 8ee4800..9d6adca 100644 --- a/Source/Adapter/Theme.php +++ b/Source/Adapter/Theme.php @@ -3,7 +3,7 @@ * Theme Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Theme Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Wrap.php b/Source/Adapter/Wrap.php index 9196180..ec53d77 100644 --- a/Source/Adapter/Wrap.php +++ b/Source/Adapter/Wrap.php @@ -3,7 +3,7 @@ * Wrap View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -16,7 +16,7 @@ * Wrap View Resources * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Adapter/Xml.php b/Source/Adapter/Xml.php index 312bad9..aeead6a 100644 --- a/Source/Adapter/Xml.php +++ b/Source/Adapter/Xml.php @@ -3,7 +3,7 @@ * XML Handler * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Adapter; @@ -17,7 +17,7 @@ * XML Handler * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/Api/ConfigurationDataInterface.php b/Source/Api/ConfigurationDataInterface.php index c3295a8..0393a08 100644 --- a/Source/Api/ConfigurationDataInterface.php +++ b/Source/Api/ConfigurationDataInterface.php @@ -3,7 +3,7 @@ * Configuration Data Interface * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Api; @@ -13,7 +13,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ interface ConfigurationDataInterface diff --git a/Source/Api/ConfigurationInterface.php b/Source/Api/ConfigurationInterface.php index e7f2ebe..42047f8 100644 --- a/Source/Api/ConfigurationInterface.php +++ b/Source/Api/ConfigurationInterface.php @@ -3,7 +3,7 @@ * Configuration Interface * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Api; @@ -13,7 +13,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ interface ConfigurationInterface diff --git a/Source/Api/FactoryInterface.php b/Source/Api/FactoryInterface.php index 78e869c..7fa5324 100644 --- a/Source/Api/FactoryInterface.php +++ b/Source/Api/FactoryInterface.php @@ -3,7 +3,7 @@ * Factory Interface * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Api; @@ -13,7 +13,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ interface FactoryInterface diff --git a/Source/Api/RegistryInterface.php b/Source/Api/RegistryInterface.php index 597dc8b..b863644 100644 --- a/Source/Api/RegistryInterface.php +++ b/Source/Api/RegistryInterface.php @@ -3,7 +3,7 @@ * Registry Interface * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Api; @@ -13,7 +13,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ interface RegistryInterface diff --git a/Source/ClassMap.php b/Source/ClassMap.php index 117b2c3..232725e 100644 --- a/Source/ClassMap.php +++ b/Source/ClassMap.php @@ -3,7 +3,7 @@ * Class Map Driver * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource; @@ -15,7 +15,7 @@ * Class Map Driver * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ClassMap/Aggregate.php b/Source/ClassMap/Aggregate.php index 5fc22a1..9106ffa 100644 --- a/Source/ClassMap/Aggregate.php +++ b/Source/ClassMap/Aggregate.php @@ -3,7 +3,7 @@ * Class Map Item Aggregation * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ClassMap; @@ -12,7 +12,7 @@ * Class Map Item Aggregation * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ClassMap/Base.php b/Source/ClassMap/Base.php index 56597f1..c3f243e 100644 --- a/Source/ClassMap/Base.php +++ b/Source/ClassMap/Base.php @@ -3,7 +3,7 @@ * Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ClassMap; @@ -15,7 +15,7 @@ * Class Map Base * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ClassMap/Events.php b/Source/ClassMap/Events.php index b800412..bf6a02f 100644 --- a/Source/ClassMap/Events.php +++ b/Source/ClassMap/Events.php @@ -3,7 +3,7 @@ * Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ClassMap; @@ -14,7 +14,7 @@ * Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ClassMap/Items.php b/Source/ClassMap/Items.php index f6cf1a1..efb2361 100644 --- a/Source/ClassMap/Items.php +++ b/Source/ClassMap/Items.php @@ -3,7 +3,7 @@ * Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ClassMap; @@ -15,7 +15,7 @@ * Class Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/Configuration/AbstractAdapter.php b/Source/Configuration/AbstractAdapter.php index bfb5644..7d6460f 100644 --- a/Source/Configuration/AbstractAdapter.php +++ b/Source/Configuration/AbstractAdapter.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Resource\Configuration; @@ -20,7 +20,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ abstract class AbstractAdapter implements ConfigurationInterface @@ -564,7 +564,7 @@ protected function inheritDefinition($model_registry, $xml) if ($extends_model_type === 'Datasource') { $this->resource->get('xml:///Molajo//Model//Datasource//' . $extends_model_name . '.xml'); } else { - $this->resource->get('xml:///Molajo//' . $extends_model_name . '//Configuration.xml'); + $this->resource->get('xml:///Molajo//' . $extends_model_name . '//Content.xml'); } } diff --git a/Source/Configuration/Data.php b/Source/Configuration/Data.php index 5732c8c..0e994db 100644 --- a/Source/Configuration/Data.php +++ b/Source/Configuration/Data.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Resource\Configuration; @@ -16,7 +16,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class Data implements ConfigurationDataInterface diff --git a/Source/Configuration/Dataobject.php b/Source/Configuration/Dataobject.php index f568047..e53c431 100644 --- a/Source/Configuration/Dataobject.php +++ b/Source/Configuration/Dataobject.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Resource\Configuration; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class Dataobject extends AbstractAdapter implements ConfigurationInterface diff --git a/Source/Configuration/Model.php b/Source/Configuration/Model.php index 187e6de..fc58efc 100644 --- a/Source/Configuration/Model.php +++ b/Source/Configuration/Model.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Resource\Configuration; @@ -19,7 +19,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class Model extends AbstractAdapter implements ConfigurationInterface diff --git a/Source/Configuration/Registry.php b/Source/Configuration/Registry.php index 007aa95..738a226 100644 --- a/Source/Configuration/Registry.php +++ b/Source/Configuration/Registry.php @@ -4,7 +4,7 @@ * * @package Molajo * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. */ namespace Molajo\Resource\Configuration; @@ -16,7 +16,7 @@ * * @author Amy Stephen * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @since 1.0.0 */ class Registry implements RegistryInterface diff --git a/Source/Driver.php b/Source/Driver.php index f87530a..16e3ed5 100644 --- a/Source/Driver.php +++ b/Source/Driver.php @@ -3,7 +3,7 @@ * Resource Driver * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource; @@ -18,7 +18,7 @@ * Resource Driver * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ExtensionMap.php b/Source/ExtensionMap.php index 82f76fe..df896d4 100644 --- a/Source/ExtensionMap.php +++ b/Source/ExtensionMap.php @@ -3,7 +3,7 @@ * Extension Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource; @@ -17,7 +17,7 @@ * Extension Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ @@ -47,6 +47,46 @@ class ExtensionMap implements ExtensionsInterface */ protected $extensions_filename; + /** + * Extensions Filename + * + * @var array + * @since 1.0 + */ + protected $temp_ids = array(); + + /** + * Extensions Filename + * + * @var array + * @since 1.0 + */ + protected $temp_names = array(); + + /** + * Extensions Filename + * + * @var array + * @since 1.0 + */ + protected $temp_extensions = array(); + + /** + * Extensions Filename + * + * @var array + * @since 1.0 + */ + protected $temp_menus = array(); + + /** + * Extensions Filename + * + * @var array + * @since 1.0 + */ + protected $temp_page_types = array(); + /** * Constructor * @@ -70,7 +110,7 @@ public function __construct( * Catalog Types * * @return stdClass - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function createMap() @@ -92,72 +132,39 @@ public function createMap() * Get Catalog Types * * @return stdClass - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @since 1.0.0.0 */ public function getCatalogTypes() { - $catalog_types = $this->resource->get( - 'query:///Molajo//Model//Datasource//CatalogTypes.xml', - array('Parameters' => $this->runtime_data) - ); - - $catalog_types->setModelRegistry('check_view_level_access', 0); - $catalog_types->setModelRegistry('process_events', 0); - $catalog_types->setModelRegistry('query_object', 'list'); - $catalog_types->setModelRegistry('use_pagination', 0); - $catalog_types->setModelRegistry('process_events', 0); + $controller = $this->setCatalogTypesQuery(); + $results = $this->runQuery($controller); - $prefix = $catalog_types->getModelRegistry('prefix', 'a'); - - try { - $catalog_types->select('*'); - $catalog_types->from('#__catalog_types', 'a'); - $catalog_types->where( - 'column', - $prefix . '.id', - 'IN', - 'integer', - (int)$this->runtime_data->reference_data->catalog_type_plugin_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_theme_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_page_view_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_template_view_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_wrap_view_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_menuitem_id . ', ' - . (int)$this->runtime_data->reference_data->catalog_type_resource_id, - 'OR' - ); - $catalog_types->where( - 'column', - $prefix . '.model_type', - '=', - 'string', - 'Resource', - 'OR' - ); - - $results = $catalog_types->getData(); - } catch (Exception $e) { - throw new RuntimeException( - 'ExtensionMap:getCatalogTypes Query Failed' . $e->getMessage() - ); - } + return $this->processCatalogTypes($results); + } + /** + * Process Catalog Types + * + * @param $catalog_types array + * + * @return stdClass + * @since 1.0.0 + */ + protected function processCatalogTypes(array $catalog_types) + { $names = array(); $ids = array(); $model_names = array(); $extensions = array(); - foreach ($results as $catalog_item) { - - $ids[$catalog_item->id] = $catalog_item->title; - $names[$catalog_item->title] = $catalog_item->id; - $model_names[$catalog_item->id] = $catalog_item->model_name; + foreach ($catalog_types as $type) { - $id = $catalog_item->id; - $model = $model_names[$id]; + $ids[$type->id] = $type->title; + $names[$type->title] = $type->id; + $model_names[$type->id] = $type->model_name; + $id = $type->id; - $extensions[$id] = $this->getCatalogExtensions($id, $model, $catalog_item->model_type); + $extensions[$id] = $this->getExtensions($id, $model_names[$id]); } unset($catalog_types); @@ -175,258 +182,208 @@ public function getCatalogTypes() * * @param int $catalog_type_id * @param string $catalog_type_model_name - * @param string $model_type * * @return array|stdClass - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ - protected function getCatalogExtensions($catalog_type_id, $catalog_type_model_name, $model_type) + protected function getExtensions($catalog_type_id, $catalog_type_model_name) { - $items = $this->getCatalogSystemExtensions($catalog_type_id); + $controller = $this->setExtensionsQuery($catalog_type_id); + $items = $this->runQuery($controller); if (is_array($items) && count($items) > 0) { } else { return array(); } - $ids = array(); - $names = array(); - $extensions = array(); - $menus = array(); - $pagetypes = array(); - - foreach ($items as $item) { - - if ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) { - - $menus[] = $item->menu; - - if ($item->path === '') { - $name = $item->alias; - } else { - $name = $item->path . '/' . $item->alias; - } - - $pagetypes[$item->id] = $item->page_type; - } else { - $name = $item->alias; - } - - $ids[$item->id] = $name; - - $names[$name] = $item->id; - } - - $x = array_unique($menus); - $menus = $x; - ksort($ids); + return $this->processExtensions($items, $catalog_type_id, $catalog_type_model_name); + } - $catalog_type_model_name = ucfirst(strtolower($catalog_type_model_name)); + /** + * Process Extensions + * + * @param array $items + * @param integer $catalog_type_id + * @param string $catalog_type_model_name + * + * @return array|stdClass + * @since 1.0.0 + */ + protected function processExtensions($items, $catalog_type_id, $catalog_type_model_name) + { + $this->initialiseExtensions($items, $catalog_type_id); - if ($catalog_type_model_name === 'Views//pages') { - $catalog_type_model_name = 'Views//Pages'; - } elseif ($catalog_type_model_name === 'Views//templates') { - $catalog_type_model_name = 'Views//Templates'; - } elseif ($catalog_type_model_name === 'Views//wraps') { - $catalog_type_model_name = 'Views//Wraps'; - } + $catalog_type_model_name = $this->setCatalogTypeModelName($catalog_type_model_name); - foreach ($ids as $id => $alias) { - $alias = ucfirst(strtolower($alias)); + foreach ($this->temp_ids as $id => $alias) { - if ($catalog_type_model_name === 'Resources' || $catalog_type_model_name === 'System') { + $resource_indicator = false; + $alias = ucfirst(strtolower($alias)); - $model_name = 'Molajo//' . $alias . '//Extension.xml'; + if (in_array($catalog_type_model_name, array('Resources', 'System'))) { $resource_indicator = true; + $model_name = $this->setExtensionModelNameResource($alias, $this->temp_extensions, $id); - if ($alias === 'Groups') { - $extensions[$id] = array(); - } else { - $extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator); - } + } elseif ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) { + $model_name = $this->setExtensionModelNameMenuitem($this->temp_page_types, $id); } else { + $model_name = $this->setExtensionModelNameDefault($catalog_type_model_name, $alias); + } - if ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) { - $pagetype = $pagetypes[$id]; - $pagetype = ucfirst(strtolower($pagetype)); - $model_name = 'Molajo//Model//Menuitem//' . $pagetype . '//Configuration.xml'; - } else { - $model_name = 'Molajo//' . $catalog_type_model_name . '//' . $alias . '//Configuration.xml'; - } - - $resource_indicator = false; - - $extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator); + if ($alias === 'Groups') { + $this->temp_extensions[$id] = array(); + } else { + $this->temp_extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator); } } + return $this->setExtensions(); + } + + /** + * Set Extensions Results + * + * @return stdClass + * @since 1.0.0 + */ + protected function setExtensions() + { $temp = new stdClass(); - $temp->ids = $ids; - $temp->names = $names; - $temp->extensions = $extensions; - $temp->menus = $menus; + $temp->ids = $this->temp_ids; + $temp->names = $this->temp_names; + $temp->extensions = $this->temp_extensions; + $temp->menus = $this->temp_menus; return $temp; } /** - * Retrieve Resource Extensions for a specific Catalog Type + * Initialise Extensions * - * @param int $catalog_type_id + * @param array $items + * @param integer $catalog_type_id * - * @return array|stdClass - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @return $this + * @since 1.0.0 */ - protected function getCatalogResourceExtensions($catalog_type_id) + protected function initialiseExtensions($items, $catalog_type_id) { - $extensions_controller - = $this->resource->get( - 'query:///Molajo//Model//Datasource//ExtensionInstances.xml', - array('Runtimedata' => $this->runtime_data) - ); - - $extensions_controller->setModelRegistry('check_view_level_access', 0); - $extensions_controller->setModelRegistry('process_events', 0); - $extensions_controller->setModelRegistry('get_customfields', 0); - $extensions_controller->setModelRegistry('use_special_joins', 0); - $extensions_controller->setModelRegistry('query_object', 'list'); - $extensions_controller->setModelRegistry('use_pagination', 0); - - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'id' - ); + $this->temp_ids = array(); + $this->temp_names = array(); + $this->temp_extensions = array(); + $this->temp_menus = array(); + $this->temp_page_types = array(); - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'alias' - ); + foreach ($items as $item) { - $extensions_controller->where( - 'column', - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'id', - ' = ', - 'integer', - (int)$catalog_type_id - ); + if ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) { + $name = $this->initialiseExtensionsMenuItem($item); + } else { + $name = $item->alias; + } - $extensions_controller->where( - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'status', - ' > ', - 'integer', - ' 0 ' - ); + $this->temp_ids[$item->id] = $name; + $this->temp_names[$name] = $item->id; + } - $extensions_controller->order( - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'alias', - 'ASC' - ); + $x = array_unique($this->temp_menus); + $this->temp_menus = $x; + ksort($this->temp_ids); - try { - return $extensions_controller->getData(); - } catch (Exception $e) { - throw new RuntimeException($e->getMessage()); - } + return $this; } /** - * Retrieve System Extensions for a specific Catalog Type + * Initialize Extension Name for Menu Item * - * @param int $catalog_type_id + * @param object $item * - * @return array|stdClass - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @return string + * @since 1.0.0 */ - protected function getCatalogSystemExtensions($catalog_type_id) + protected function initialiseExtensionsMenuItem($item) { - $extensions_controller - = $this->resource->get( - 'query:///Molajo//Model//Datasource//ExtensionInstances.xml', - array('Runtimedata' => $this->runtime_data) - ); + $this->temp_menus[] = $item->menu; - $application_id = $this->runtime_data->application->id; - $extensions_controller->setModelRegistry('application_id', $application_id); - $site_id = $this->runtime_data->site->id; - $extensions_controller->setModelRegistry('site_id', $site_id); - - $extensions_controller->setModelRegistry('check_view_level_access', 0); - $extensions_controller->setModelRegistry('process_events', 0); - $extensions_controller->setModelRegistry('get_customfields', 0); - $extensions_controller->setModelRegistry('use_special_joins', 1); - $extensions_controller->setModelRegistry('query_object', 'list'); - $extensions_controller->setModelRegistry('use_pagination', 0); - - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'id' - ); + if ($item->path === '') { + $name = $item->alias; + } else { + $name = $item->path . '/' . $item->alias; + } - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'alias' - ); + $this->temp_page_types[$item->id] = $item->page_type; - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'menu' - ); + return $name; + } - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'path' - ); + /** + * Retrieve specific Extension Information + * + * @param string $catalog_type_model_name + * + * @return string + * @since 1.0.0 + */ + protected function setCatalogTypeModelName($catalog_type_model_name) + { + $catalog_type_model_name = ucfirst(strtolower($catalog_type_model_name)); - $extensions_controller->select( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'page_type' - ); + if ($catalog_type_model_name === 'Views//pages') { + $catalog_type_model_name = 'Views//Pages'; + } elseif ($catalog_type_model_name === 'Views//templates') { + $catalog_type_model_name = 'Views//Templates'; + } elseif ($catalog_type_model_name === 'Views//wraps') { + $catalog_type_model_name = 'Views//Wraps'; + } - $extensions_controller->where( - 'column', - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'catalog_type_id', - '=', - 'integer', - (int)$catalog_type_id - ); + return $catalog_type_model_name; + } - $extensions_controller->where( - 'column', - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'id', - '<>', - 'column', - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'catalog_type_id' - ); + /** + * Set Extension Model Name for Menu Item + * + * @param string $alias + * @param array $extensions + * @param integer $id + * + * @return array + * @since 1.0.0 + */ + protected function setExtensionModelNameResource($alias, $extensions, $id) + { + return 'Molajo//' . $alias . '//Extension.xml'; + } - $extensions_controller->where( - 'column', - $extensions_controller->getModelRegistry('primary_prefix', 'a') . '.' . 'status', - '>', - 'integer', - ' 0 ' - ); + /** + * Set Extension Model Name for Menu Item + * + * @param array $page_types + * @param integer $id + * + * @return string + * @since 1.0.0 + */ + protected function setExtensionModelNameMenuitem($page_types, $id) + { + $pagetype = $page_types[$id]; + $pagetype = ucfirst(strtolower($pagetype)); - $extensions_controller->orderBy( - $extensions_controller->getModelRegistry('primary_prefix', 'a') - . '.' - . 'alias' - ); + return 'Molajo//Model//Menuitem//' . $pagetype . '//Configuration.xml'; + } - try { - return $extensions_controller->getData(); - } catch (Exception $e) { - throw new RuntimeException($e->getMessage()); - } + /** + * Set Extension Model Name (Not Resource or Menuitem) + * + * @param string $catalog_type_model_name + * @param string $alias + * + * @return string + * @since 1.0.0 + */ + protected function setExtensionModelNameDefault($catalog_type_model_name, $alias) + { + return 'Molajo//' . $catalog_type_model_name . '//' . $alias . '//Configuration.xml'; } /** @@ -434,46 +391,30 @@ protected function getCatalogSystemExtensions($catalog_type_id) * * @param int $id * @param string $model_name - * @param bool $resource_indicator * * @return object - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @since 1.0.0 */ - protected function getExtension($id, $model_name, $resource_indicator = false) + protected function getExtension($id, $model_name) { - $item_resource = $this->resource->get( - 'query:///' . $model_name, - array('Runtimedata' => $this->runtime_data) - ); + $controller = $this->setExtensionQuery($id, $model_name); + $data = $this->runQuery($controller); + $model_registry = $controller->getModelRegistry('*'); - $item_resource->setModelRegistry('check_view_level_access', 0); - $item_resource->setModelRegistry('process_events', 0); - $item_resource->setModelRegistry('get_customfields', 1); - $item_resource->setModelRegistry('primary_key_value', $id); - $item_resource->setModelRegistry('query_object', 'item'); - - $application_id = $this->runtime_data->application->id; - $item_resource->setModelRegistry('application_id', $application_id); - $site_id = $this->runtime_data->site->id; - $item_resource->setModelRegistry('site_id', $site_id); - - $item_resource->where( - 'column', - $item_resource->getModelRegistry('primary_prefix', 'a') . '.' . 'id', - '=', - 'integer', - (int)$id - ); - - try { - $data = $item_resource->getData(); - } catch (Exception $e) { - throw new RuntimeException($e->getMessage()); - } - - $model_registry = $item_resource->getModelRegistry('*'); + return $this->processExtension($data, $model_registry); + } + /** + * Retrieve specific Extension Information + * + * @param object $data + * @param array $model_registry + * + * @return object + * @since 1.0.0 + */ + protected function processExtension($data, array $model_registry) + { $custom_field_types = $model_registry['customfieldgroups']; if (is_array($custom_field_types)) { @@ -500,56 +441,231 @@ protected function getExtension($id, $model_name, $resource_indicator = false) * @param object $model_registry * * @return stdClass - * @since 1.0 + * @since 1.0.0 */ protected function processCustomfieldGroup($group, $data, $model_registry) + { + $fields = $this->getCustomfields($group, $data, $model_registry); + + $group_fields = new stdClass(); + + foreach ($fields as $key => $value) { + $group_fields->$key = $value; + } + + return $group_fields; + } + + /** + * Get Custom Group Data + * + * @param string $group + * @param object $data + * @param object $model_registry + * + * @return stdClass + * @since 1.0.0 + */ + protected function getCustomfields($group, $data, $model_registry) + { + $group_data = $this->getCustomfieldGroupData($group, $data); + + $fields = array(); + + foreach ($model_registry[$group] as $customfields) { + $key = $customfields['name']; + $fields[$key] = $this->setCustomfieldValue($key, $group_data, $customfields); + } + ksort($fields); + + return $fields; + } + + /** + * Get Custom Group Data + * + * @param string $group + * @param object $data + * + * @return stdClass + * @since 1.0.0 + */ + protected function getCustomfieldGroupData($group, $data) { if (isset($data->$group)) { - $group_data = json_decode($data->$group); } else { $group_data = new stdClass(); + return $group_data; } - if (isset($this->runtime_data->application->id)) { - $application_id = $this->runtime_data->application->id; - if (isset($group_data->$application_id)) { - $group_data = $group_data->$application_id; - } + $group_data = json_decode($data->$group); + + $application_id = $this->runtime_data->application->id; + + if (isset($group_data->$application_id)) { + $group_data = $group_data->$application_id; } - $temp = array(); + return $group_data; + } - foreach ($model_registry[$group] as $customfields) { + /** + * Set Custom Field Value + * + * @param string $key + * @param object $group_data + * @param array $customfields + * + * @return null|mixed + * @since 1.0.0 + */ + protected function setCustomfieldValue($key, $group_data, $customfields) + { + if (isset($group_data->$key)) { + return $group_data->$key; + } - $key = $customfields['name']; + if (isset($customfields['default'])) { + return $customfields['default']; + } - $value = null; + return null; + } - if (isset($group_data->$key)) { - $value = $group_data->$key; - } + /** + * Set Catalog Types Query + * + * @return object + * @since 1.0.0 + */ + public function setCatalogTypesQuery() + { + $controller = $this->resource->get( + 'query:///Molajo//Model//Datasource//CatalogTypes.xml', + array('Runtime_data' => $this->runtime_data) + ); - if ($value === null || $value === '' || $value === ' ') { + $controller->setModelRegistry('check_view_level_access', 0); + $controller->setModelRegistry('process_events', 0); + $controller->setModelRegistry('query_object', 'list'); + $controller->setModelRegistry('use_pagination', 0); + $controller->setModelRegistry('process_events', 0); - if (isset($customfields['default'])) { - $default = $customfields['default']; - } else { - $default = false; - } + $prefix = $controller->getModelRegistry('prefix', 'a'); - $value = $default; - } + $catalog_id_list = (int)$this->runtime_data->reference_data->catalog_type_plugin_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_theme_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_page_view_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_template_view_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_wrap_view_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_menuitem_id . ', ' + . (int)$this->runtime_data->reference_data->catalog_type_resource_id; - $temp[$key] = $value; - } + $controller->select('*'); + $controller->from('#__catalog_types', 'a'); + $controller->where('column', $prefix . '.id', 'IN', 'integer', $catalog_id_list, 'OR'); + $controller->where('column', $prefix . '.model_type', '=', 'string', 'Resource', 'OR'); - ksort($temp); + return $controller; + } - $group_name = new stdClass(); - foreach ($temp as $key => $value) { - $group_name->$key = $value; - } + /** + * Retrieve System Extensions for a specific Catalog Type + * + * @param int $catalog_type_id + * + * @return array|stdClass + * @since 1.0.0 + */ + protected function setExtensionsQuery($catalog_type_id) + { + $controller + = $this->resource->get( + 'query:///Molajo//Model//Datasource//ExtensionInstances.xml', + array('Runtimedata' => $this->runtime_data) + ); + + $application_id = $this->runtime_data->application->id; + $site_id = $this->runtime_data->site->id; + + $controller->setModelRegistry('application_id', $application_id); + $controller->setModelRegistry('site_id', $site_id); + $controller->setModelRegistry('check_view_level_access', 0); + $controller->setModelRegistry('process_events', 0); + $controller->setModelRegistry('get_customfields', 0); + $controller->setModelRegistry('use_special_joins', 1); + $controller->setModelRegistry('query_object', 'list'); + $controller->setModelRegistry('use_pagination', 0); - return $group_name; + $prefix = $controller->getModelRegistry('primary_prefix', 'a'); + $cat_id = $prefix . '.' . 'catalog_type_id'; + + $controller->select($prefix . '.' . 'id'); + $controller->select($prefix . '.' . 'alias'); + $controller->select($prefix . '.' . 'menu'); + $controller->select($prefix . '.' . 'path'); + $controller->select($prefix . '.' . 'page_type'); + + $controller->where('column', $cat_id, '=', 'integer', $catalog_type_id); + $controller->where('column', $prefix . '.' . 'id', '<>', 'column', $cat_id); + $controller->where('column', $prefix . '.' . 'status', '>', 'integer', ' 0 '); + + $controller->orderBy($prefix . '.' . 'alias'); + + return $controller; + } + + /** + * Set Extension Query + * + * @param int $id + * @param string $model_name + * + * @return object + * @since 1.0.0 + */ + protected function setExtensionQuery($id, $model_name) + { + $controller = $this->resource->get( + 'query:///' . $model_name, + array('Runtimedata' => $this->runtime_data) + ); + + $controller->setModelRegistry('check_view_level_access', 0); + $controller->setModelRegistry('process_events', 0); + $controller->setModelRegistry('get_customfields', 1); + $controller->setModelRegistry('primary_key_value', $id); + $controller->setModelRegistry('query_object', 'item'); + + $application_id = $this->runtime_data->application->id; + $site_id = $this->runtime_data->site->id; + + $controller->setModelRegistry('application_id', $application_id); + $controller->setModelRegistry('site_id', $site_id); + $prefix = $controller->getModelRegistry('primary_prefix', 'a'); + + $controller->where('column', $prefix . '.' . 'id', '=', 'integer', (int)$id); + + return $controller; + } + + /** + * Run Query + * + * @param object $controller + * + * @return mixed + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + * + */ + protected function runQuery($controller) + { + try { + return $controller->getData(); + + } catch (Exception $e) { + throw new RuntimeException($e->getMessage()); + } } } diff --git a/Source/Factory/ReadControllerFactory.php b/Source/Factory/ReadControllerFactory.php index c9f936a..b568352 100644 --- a/Source/Factory/ReadControllerFactory.php +++ b/Source/Factory/ReadControllerFactory.php @@ -3,7 +3,7 @@ * Read Controller Factory * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Factory; @@ -18,7 +18,7 @@ * Read Controller Factory * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ @@ -98,8 +98,6 @@ public function __construct( $this->runtime_data = $runtime_data; $this->schedule_event = $schedule_event; $this->sql = $sql; - - $this->query->clearQuery(); } /** @@ -126,6 +124,8 @@ public function instantiateClass() ); } + $instance->clearQuery(); + $instance->setModelRegistry('*', $this->model_registry); if (trim($this->sql) === '') { diff --git a/Source/Factory/ReadModelFactory.php b/Source/Factory/ReadModelFactory.php index 031b246..5cc4a91 100644 --- a/Source/Factory/ReadModelFactory.php +++ b/Source/Factory/ReadModelFactory.php @@ -3,7 +3,7 @@ * Read Model Factory * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\Factory; @@ -16,7 +16,7 @@ * Read Model Factory * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0.0 */ diff --git a/Source/ResourceMap.php b/Source/ResourceMap.php index 2e2b88c..03cc11e 100644 --- a/Source/ResourceMap.php +++ b/Source/ResourceMap.php @@ -3,7 +3,7 @@ * Resource Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource; @@ -15,7 +15,7 @@ * Resource Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ResourceMap/Base.php b/Source/ResourceMap/Base.php index 4bc61ec..46064dc 100644 --- a/Source/ResourceMap/Base.php +++ b/Source/ResourceMap/Base.php @@ -3,7 +3,7 @@ * Create Resource Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ResourceMap; @@ -15,7 +15,7 @@ * Resource Map Base * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ResourceMap/Folders.php b/Source/ResourceMap/Folders.php index 67c81c1..250cace 100644 --- a/Source/ResourceMap/Folders.php +++ b/Source/ResourceMap/Folders.php @@ -3,7 +3,7 @@ * Resource Namespace Mapping * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ResourceMap; @@ -12,7 +12,7 @@ * Resource Namespace * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 8aacd6e..4f8cc1d 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -3,7 +3,7 @@ * Namespace Prefixes for Resource Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource\ResourceMap; @@ -16,7 +16,7 @@ * Namespace Prefixes for Resource Map * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ @@ -173,7 +173,7 @@ protected function testFileForNamespaceRules( $path = $this->setPath($is_directory, $file_path, $file_name); $class_namespace_path = substr($path, strlen($base_directory), 9999); - $qns = $this->setQNS($class_namespace_path, $namespace_prefix); + $qns = $this->setQNS($class_namespace_path, $namespace_prefix); $nspath = $path; if ($is_directory === true) { @@ -408,8 +408,8 @@ protected function mergeExistingFQNSPath($qns) */ protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath) { - $qns = $this->addSlash($qns); - $qns = $qns . $this->base_name; + $qns = $this->addSlash($qns); + $qns = $qns . $this->base_name; $nspath = $nspath . '/' . $file_name; if ($file_extension === 'php') { @@ -435,7 +435,7 @@ protected function setNamespaceObject($file_name, $nspath, $qns) $temp->file_name = $file_name; $temp->base_name = $this->base_name; $temp->path = $nspath; - $temp->qns = $qns; + $temp->qns = $qns; return $temp; } diff --git a/Source/ResourceMap/xxxxCreate.php b/Source/ResourceMap/xxxxCreate.php deleted file mode 100644 index c5bcfa4..0000000 --- a/Source/ResourceMap/xxxxCreate.php +++ /dev/null @@ -1,463 +0,0 @@ -namespace_prefixes as $namespace_prefix => $namespace_base_folders) { - $this->processNamespaceFolders($namespace_base_folders, $namespace_prefix); - } - - return $this; - } - - /** - * Process Folders for Namespace - * - * @param array $namespace_base_folders - * @param string $namespace_prefix - * - * @return $this - * @since 1.0 - */ - protected function processNamespaceFolders($namespace_base_folders, $namespace_prefix) - { - foreach ($namespace_base_folders as $namespace_base_folder) { - - $this->php_class = 0; - - if (trim($namespace_base_folder) === '') { - } elseif (is_dir($this->base_path . '/' . $namespace_base_folder)) { - $this->processNamespaceFolder($namespace_base_folder, $namespace_prefix); - } - } - - return $this; - } - - /** - * Process Single Directory - * - * @param string $namespace_base_folder - * @param string $namespace_prefix - * - * @return object - * @since 1.0 - */ - protected function processNamespaceFolder($namespace_base_folder, $namespace_prefix) - { - $paths = array(); - $paths[] = $this->base_path . '/' . $namespace_base_folder; - $this->resource_map[strtolower($namespace_prefix)] = array_unique($paths); - - $objects = new RecursiveIteratorIterator - ( - new RecursiveDirectoryIterator($this->base_path . '/' . $namespace_base_folder), - RecursiveIteratorIterator::SELF_FIRST - ); - - if (count($objects) > 0) { - $this->processFilePathObjects($objects, $namespace_prefix, $namespace_base_folder); - } - - return $this; - } - - /** - * Process File Objects - * - * @param object $objects - * @param string $namespace_prefix - * @param string $namespace_base_folder - * - * @return object - * @since 1.0 - */ - protected function processFilePathObjects($objects, $namespace_prefix, $namespace_base_folder) - { - foreach ($objects as $file_path => $file_object) { - - $file_name = $file_object->getFileName(); - $file_extension = $file_object->getExtension(); - $is_directory = $file_object->isDir(); - - $this->testFileForNamespaceRules( - $namespace_prefix, - $namespace_base_folder, - $is_directory, - $file_path, - $file_name, - $file_extension - ); - } - - return $this; - } - - /** - * Test Path for this Namespace Prefix - * - * @param string $namespace_prefix - * @param string $base_directory - * @param int $is_directory - * @param string $file_path - * @param string $file_name - * @param string $file_extension - * - * @return int|object - * @since 1.0 - */ - protected function testFileForNamespaceRules( - $namespace_prefix, - $base_directory, - $is_directory, - $file_path, - $file_name, - $file_extension - ) { - $this->setBase($is_directory, $file_path, $file_name, $file_extension); - - $skip = $this->setFileInclusion($is_directory, $file_name, $file_extension); - if ($skip === 1) { - return $this; - } - - $file_path = substr($file_path, strlen($this->base_path . '/'), 9999); - - $skip = $this->testExcludeFolders($file_path, $this->base_name, $skip); - if ($skip === 1) { - return $this; - } - - $path = $this->setPath($is_directory, $file_path, $file_name); - $class_namespace_path = substr($path, strlen($base_directory), 9999); - $qns = $this->setQNS($class_namespace_path, $namespace_prefix); - $nspath = $path; - - if ($is_directory === true) { - echo 'Folder ' . $nspath . '
'; - } else { - list($qns, $nspath) = $this->setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath); - } - - if ($qns === false) { - } else { - $this->mergeFQNSPaths($nspath, $qns); - } - - return $this; - } - - /** - * Set base for file or folder - * - * @param int $is_directory - * @param string $file_path - * @param string $file_name - * @param string $file_extension - * - * @return $this - * @since 1.0 - */ - protected function setBase($is_directory, $file_path, $file_name, $file_extension) - { - $this->base_name = $file_name; - - if ($is_directory === 1) { - $pathinfo = pathinfo($file_path); - $this->base_name = $pathinfo['basename']; - - } elseif ($file_extension === 'php') { - $this->base_name = substr($file_name, 0, strlen($file_name) - strlen($file_extension) - 1); - } - - return $this; - } - - /** - * Test to determine if the file or folder should be used - * - * @param int $is_directory - * @param string $file_name - * @param string $file_extension - * - * @return boolean - * @since 1.0 - */ - protected function setFileInclusion($is_directory, $file_name, $file_extension) - { - $skip = 0; - - if ($is_directory === 1) { - return $skip; - } - - if ($file_extension === 'php') { - - if ($this->testPHPClassExceptions($file_name) === false) { - $skip = 1; - } - } - - return $skip; - } - - /** - * Set PHP Class - * - * @param string $file_name - * - * @return $this - * @since 1.0 - */ - protected function testPHPClassExceptions($file_name) - { - if (strtolower(substr($file_name, 0, 4)) === 'hold') { - } elseif (strtolower(substr($file_name, 0, 3)) === 'xxx') { - } elseif (strtolower($this->base_name) === 'index') { - } else { - return true; - } - - return false; - } - - /** - * Test Exclude Folders Definitions - * - * @param string $file_path - * @param int $skip - * - * @return int - * @since 1.0 - */ - protected function testExcludeFolders($file_path, $skip = 1) - { - if ($skip === 1) { - return $skip; - } - - if (substr($this->base_name, 0, 1) === '.') { - return 1; - } - - if (count($this->exclude_folders) === 0) { - return $skip; - } - - $skip = 0; - - foreach ($this->exclude_folders as $exclude) { - - if ($this->base_name === $exclude) { - $skip = 1; - break; - } elseif (strpos($file_path, '/' . $exclude) === false) { - } else { - $skip = 1; - break; - } - } - - return $skip; - } - - /** - * Set Path - * - * @param int $is_directory - * @param string $file_path - * @param string $file_name - * - * @return string - * @since 1.0 - */ - protected function setPath($is_directory, $file_path, $file_name) - { - if ($is_directory === true) { - return $file_path; - } - - return substr($file_path, 0, strlen($file_path) - strlen($file_name) - 1); - } - - /** - * Set Qualified Namespace - * - * @param string $class_namespace_path - * @param string $namespace_prefix - * - * @return string - * @since 1.0 - */ - protected function setQNS($class_namespace_path, $namespace_prefix) - { - if ($class_namespace_path === '') { - return $namespace_prefix; - } - - $namespace_prefix = $this->addSlash($namespace_prefix); - - return $namespace_prefix . str_replace('/', '\\', $class_namespace_path); - } - - /** - * Set Namespace Object - * - * @param string $file_name - * @param string $nspath - * @param string $qns - * - * @return object - * @since 1.0 - */ - protected function setNamespaceObject($file_name, $nspath, $qns) - { - $temp = new stdClass(); - $temp->file_name = $file_name; - $temp->base_name = $this->base_name; - $temp->path = $nspath; - $temp->qns = $qns; - - return $temp; - } - - /** - * Get Resource Map Tags - * - * @param string $nspath - * @param string $qns - * - * @return $this - * @since 1.0 - */ - protected function mergeFQNSPaths($nspath, $qns) - { - if ($nspath === '') { - return $this; - } - - $qns = strtolower($qns); - - if (isset($this->resource_map[$qns])) { - $paths = $this->mergeExistingFQNSPath($qns); - } else { - $paths = array(); - } - - $paths[] = $this->base_path . '/' . $nspath; - - $this->resource_map[$qns] = array_unique($paths); - - return $this; - } - - /** - * Merge Existing FQNS Path - * - * @param string $nspath - * @param string $qns - * - * @return array - * @since 1.0 - */ - protected function mergeExistingFQNSPath($qns) - { - $paths = array(); - $existing = $this->resource_map[$qns]; - - if (is_array($existing)) { - $paths = $existing; - if (count($paths) === 0) { - $paths = array(); - return $paths; - } - } - return $paths; - } - - /** - * Set Class File Array Entry - * - * @param string $file_name - * @param string $file_extension - * @param string $nspath - * - * @return array - * @since 1.0 - */ - protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath) - { - $qns = $this->addSlash($qns); - $qns = $qns . $this->base_name; - $nspath = $nspath . '/' . $file_name; - - if ($this->getReflectionObject($qns) === false) { - return array(false, false); - } - - if ($file_extension === 'php') { - $this->class_files[$nspath] = $this->setNamespaceObject($file_name, $nspath, $qns); - } - - return array($qns, $nspath); - } -} diff --git a/Source/Scheme.php b/Source/Scheme.php index 9e18c82..5864ba4 100644 --- a/Source/Scheme.php +++ b/Source/Scheme.php @@ -3,7 +3,7 @@ * Scheme * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License */ namespace Molajo\Resource; @@ -16,7 +16,7 @@ * Scheme * * @package Molajo - * @copyright 2014 Amy Stephen. All rights reserved. + * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ From a579336287b1330c72cd74f4c440cedb562e78f2 Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Tue, 17 Feb 2015 21:51:50 -0600 Subject: [PATCH 02/11] Refactor Configuration --- .dev/Tests/ResourceTest.php | 9 +- Factories/Extensions/Configuration.xml | 13 + .../Extensions/ExtensionsFactoryMethod.php | 154 +++ Factories/Resource/Configuration.xml | 2 +- Factories/Resource/ResourceFactoryMethod.php | 103 +- Factories/Resourcecss/Configuration.xml | 2 +- .../Resourcecss/ResourcecssFactoryMethod.php | 10 +- .../Resourcecssdeclarations/Configuration.xml | 2 +- .../ResourcecssdeclarationsFactoryMethod.php | 10 +- Factories/Resourcedata/Configuration.xml | 13 + .../ResourcedataFactoryMethod.php | 465 +++++++++ Factories/Resourcejs/Configuration.xml | 2 +- .../Resourcejs/ResourcejsFactoryMethod.php | 10 +- .../Resourcejsdeclarations/Configuration.xml | 2 +- .../ResourcejsdeclarationsFactoryMethod.php | 10 +- Factories/Resourcequery/Configuration.xml | 13 + .../ResourcequeryFactoryMethod.php | 164 +++ Factories/Resourcerendering/Configuration.xml | 2 +- .../ResourcerenderingFactoryMethod.php | 16 +- Source/Adapter/AbstractAdapter.php | 207 +++- Source/Adapter/Asset.php | 2 +- Source/Adapter/ClassLoader.php | 2 +- Source/Adapter/ConfigurationFactory.php | 147 +++ Source/Adapter/Css.php | 24 +- Source/Adapter/Cssdeclarations.php | 18 +- Source/Adapter/Extension.php | 24 +- Source/Adapter/Field.php | 115 +++ Source/Adapter/File.php | 2 +- Source/Adapter/Folder.php | 8 +- Source/Adapter/Head.php | 2 +- Source/Adapter/Js.php | 24 +- Source/Adapter/Jsdeclarations.php | 12 +- Source/Adapter/Menuitem.php | 8 +- Source/Adapter/Page.php | 6 +- Source/Adapter/Query.php | 256 ----- Source/Adapter/Template.php | 6 +- Source/Adapter/Theme.php | 6 +- Source/Adapter/Wrap.php | 6 +- Source/Adapter/Xml.php | 306 ++++-- Source/Api/ConfigurationDataInterface.php | 42 - Source/Api/ConfigurationInterface.php | 43 - Source/Api/FactoryInterface.php | 29 - Source/Api/RegistryInterface.php | 284 ----- Source/ClassMap.php | 4 +- Source/ClassMap/Aggregate.php | 10 +- Source/ClassMap/Base.php | 30 +- Source/ClassMap/Events.php | 36 +- Source/ClassMap/Items.php | 18 +- Source/Configuration/AbstractAdapter.php | 578 +++-------- Source/Configuration/Children.php | 72 ++ Source/Configuration/Criteria.php | 70 ++ Source/Configuration/Customfields.php | 107 ++ Source/Configuration/Data.php | 119 +-- Source/Configuration/Dataobject.php | 94 +- Source/Configuration/Fields.php | 83 ++ Source/Configuration/Foreignkeys.php | 242 +++++ Source/Configuration/Includes.php | 94 ++ Source/Configuration/Inherit.php | 236 +++++ Source/Configuration/Joins.php | 88 ++ Source/Configuration/Model.php | 258 ++--- Source/Configuration/Plugins.php | 64 ++ Source/Configuration/Registry.php | 967 ++---------------- Source/Configuration/Values.php | 70 ++ Source/Driver.php | 55 +- Source/ExtensionMap.php | 39 +- Source/Factory/ReadControllerFactory.php | 138 --- Source/Factory/ReadModelFactory.php | 68 -- Source/ResourceMap.php | 8 +- Source/ResourceMap/Base.php | 29 +- Source/ResourceMap/Folders.php | 14 +- Source/ResourceMap/Prefixes.php | 34 +- Source/Scheme.php | 10 +- Source/xxxFields.php | 275 +++++ composer.json | 6 +- 74 files changed, 3631 insertions(+), 2866 deletions(-) create mode 100644 Factories/Extensions/Configuration.xml create mode 100644 Factories/Extensions/ExtensionsFactoryMethod.php create mode 100644 Factories/Resourcedata/Configuration.xml create mode 100644 Factories/Resourcedata/ResourcedataFactoryMethod.php create mode 100644 Factories/Resourcequery/Configuration.xml create mode 100644 Factories/Resourcequery/ResourcequeryFactoryMethod.php create mode 100644 Source/Adapter/ConfigurationFactory.php create mode 100644 Source/Adapter/Field.php delete mode 100644 Source/Adapter/Query.php delete mode 100644 Source/Api/ConfigurationDataInterface.php delete mode 100644 Source/Api/ConfigurationInterface.php delete mode 100644 Source/Api/FactoryInterface.php delete mode 100644 Source/Api/RegistryInterface.php create mode 100644 Source/Configuration/Children.php create mode 100644 Source/Configuration/Criteria.php create mode 100644 Source/Configuration/Customfields.php create mode 100644 Source/Configuration/Fields.php create mode 100644 Source/Configuration/Foreignkeys.php create mode 100644 Source/Configuration/Includes.php create mode 100644 Source/Configuration/Inherit.php create mode 100644 Source/Configuration/Joins.php create mode 100644 Source/Configuration/Plugins.php create mode 100644 Source/Configuration/Values.php delete mode 100644 Source/Factory/ReadControllerFactory.php delete mode 100644 Source/Factory/ReadModelFactory.php create mode 100644 Source/xxxFields.php diff --git a/.dev/Tests/ResourceTest.php b/.dev/Tests/ResourceTest.php index e495578..30e9c75 100644 --- a/.dev/Tests/ResourceTest.php +++ b/.dev/Tests/ResourceTest.php @@ -28,11 +28,10 @@ class ResourceTest extends \PHPUnit_Framework_TestCase * Test Resource Renderer * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function testResource() { - $instance = new Driver(new Resource(new MockRender)); $file = __DIR__ . '/RenderTest.php'; @@ -47,7 +46,7 @@ public function testResource() * Test Mustache Renderer * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function testMustache() { @@ -65,7 +64,7 @@ public function testMustache() * Test Twig Renderer * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function testTwig() { @@ -89,7 +88,7 @@ class MockRender implements RenderInterface * @param array $data * * @return string - * @since 1.0 + * @since 1.0.0 */ public function render($include_file, array $data = array()) { diff --git a/Factories/Extensions/Configuration.xml b/Factories/Extensions/Configuration.xml new file mode 100644 index 0000000..431ba4e --- /dev/null +++ b/Factories/Extensions/Configuration.xml @@ -0,0 +1,13 @@ + + + Extensions + Amy Stephen + January 2015 + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. + MIT + hello@molajo.org + http://molajo.org + 1.0 + Extensions Factory + + diff --git a/Factories/Extensions/ExtensionsFactoryMethod.php b/Factories/Extensions/ExtensionsFactoryMethod.php new file mode 100644 index 0000000..78f65bb --- /dev/null +++ b/Factories/Extensions/ExtensionsFactoryMethod.php @@ -0,0 +1,154 @@ +dependencies['Resource'] = $options; + $this->dependencies['Runtimedata'] = $options; + $this->dependencies['Cache'] = $options; + + return $this->dependencies; + } + + /** + * Set Dependencies for Instantiation + * + * @return array + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function onBeforeInstantiation(array $dependency_values = null) + { + parent::onBeforeInstantiation($dependency_values); + + $this->dependencies['extensions_filename'] + = $this->base_path . '/Bootstrap/Files/Output/Extensions.json'; + + return $this->dependencies; + } + + /** + * Instantiate Class + * + * @return $this + * @since 1.0.0 + */ + public function instantiateClass() + { + $cache_results = $this->dependencies['Cache']->get('Extensions'); + + if ($cache_results === false || $cache_results->value === null) { + } else { + $this->product_result = $cache_results->value; + + return $this; + } + + if (is_file($this->dependencies['extensions_filename'])) { + $this->product_result = $this->readFile($this->dependencies['extensions_filename']); + } else { + $this->createMap(); + } + + $this->dependencies['Cache']->set('Extensions', $this->product_result); + + return $this; + } + + /** + * Create Extensions Map + * + * @return $this + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function createMap() + { + try { + $extension_map = new $this->product_namespace( + $this->dependencies['Resource'], + $this->dependencies['Runtimedata'], + $this->dependencies['extensions_filename'] + ); + } catch (Exception $e) { + throw new RuntimeException( + 'Render: Could not instantiate Handler: ' . $this->product_namespace + ); + } + + $this->product_result = $extension_map->createMap(); + + return $this; + } + + /** + * Factory Method Controller requests any Products (other than the current product) to be saved + * + * @return array + * @since 1.0.0 + */ + public function setContainerEntries() + { + $this->dependencies['Runtimedata']->reference_data->extensions = $this->product_result; + $this->set_container_entries['Runtimedata'] = $this->dependencies['Runtimedata']; + + return $this->set_container_entries; + } +} diff --git a/Factories/Resource/Configuration.xml b/Factories/Resource/Configuration.xml index 406779f..5a555e5 100644 --- a/Factories/Resource/Configuration.xml +++ b/Factories/Resource/Configuration.xml @@ -2,7 +2,7 @@ Resource Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resource/ResourceFactoryMethod.php b/Factories/Resource/ResourceFactoryMethod.php index a14285c..5a2cddc 100644 --- a/Factories/Resource/ResourceFactoryMethod.php +++ b/Factories/Resource/ResourceFactoryMethod.php @@ -29,7 +29,7 @@ class ResourceFactoryMethod extends FactoryMethodBase implements FactoryInterfac * * @param $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -46,7 +46,7 @@ public function __construct(array $options = array()) * @param array $reflection * * @return array|bool - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -65,6 +65,10 @@ public function setDependencies(array $reflection = array()) $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' ); + $fields = $this->readFile( + $this->base_path . '/Bootstrap/Files/Model/Fields.json' + ); + /** * NOTE: * Css, CssDeclarations, JsDeclarations, and Js loaded in Application Factory Method @@ -86,13 +90,23 @@ public function setDependencies(array $reflection = array()) array(), $this->options['Scheme']->getScheme('ClassLoader')->include_file_extensions ); + $adapter_instance['Field'] + = $this->createAdapterField( + 'Field', + $this->base_path, + $resource_map, + array(), + $this->options['Scheme']->getScheme('Field')->include_file_extensions, + $fields + ); $adapter_instance['File'] = $this->createAdapter( 'File', $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('File')->include_file_extensions + $this->options['Scheme']->getScheme('File')->include_file_extensions, + $this->base_path . '' ); $adapter_instance['Folder'] = $this->createAdapter( @@ -132,7 +146,7 @@ public function setDependencies(array $reflection = array()) * @param array $dependency_values (ignored in Service Item Adapter, based in from handler) * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function onBeforeInstantiation(array $dependency_values = null) { @@ -146,7 +160,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * Factory Method Controller triggers the Factory Method to create the Class for the Service * * @return $this - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function instantiateClass() @@ -165,28 +179,22 @@ public function instantiateClass() * Request for array of Factory Methods to be Scheduled * * @return object - * @since 1.0 + * @since 1.0.0 */ public function scheduleFactories() { - $options = array(); - $options['store_instance_indicator'] = true; - $options['product_name'] = 'Fieldhandler'; - $options['base_path'] = $this->base_path; - + $options = array(); + $options['store_instance_indicator'] = true; + $options['product_name'] = 'Fieldhandler'; $this->schedule_factory_methods['Fieldhandler'] = $options; - $options = array(); - $options['Resource'] = $this->product_result; - $options['base_path'] = $this->base_path; - + $options = array(); + $options['Resource'] = $this->product_result; $this->schedule_factory_methods['Resourcedata'] = $options; - $options = array(); - $options['store_instance_indicator'] = true; - $options['product_name'] = 'Exceptionhandling'; - $options['base_path'] = $this->base_path; - + $options = array(); + $options['store_instance_indicator'] = true; + $options['product_name'] = 'Exceptionhandling'; $this->schedule_factory_methods['Exceptionhandling'] = $options; return $this->schedule_factory_methods; @@ -196,7 +204,7 @@ public function scheduleFactories() * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() @@ -227,11 +235,16 @@ protected function createScheme() * @param array $valid_file_extensions * * @return mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ - protected function createAdapter($adapter, $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions) - { + protected function createAdapter( + $adapter, + $base_path, + $resource_map, + $namespace_prefixes, + $valid_file_extensions + ) { $class = 'Molajo\\Resource\\Adapter\\' . $adapter; try { @@ -250,4 +263,46 @@ protected function createAdapter($adapter, $base_path, $resource_map, $namespace return $adapter_instance; } + + /** + * Create Handler Instance + * + * @param string $adapter + * @param string $base_path + * @param array $resource_map + * @param array $namespace_prefixes + * @param array $valid_file_extensions + * @param array $fields + * + * @return mixed + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function createAdapterField( + $adapter, + $base_path, + $resource_map, + $namespace_prefixes, + $valid_file_extensions, + $fields = array() + ) { + $class = 'Molajo\\Resource\\Adapter\\' . $adapter; + + try { + $adapter_instance = new $class ( + $base_path, + $resource_map, + $namespace_prefixes, + $valid_file_extensions, + $fields + ); + } catch (Exception $e) { + throw new RuntimeException( + 'Resource Adapter ' . $adapter + . ' Exception during Instantiation: ' . $e->getMessage() + ); + } + + return $adapter_instance; + } } diff --git a/Factories/Resourcecss/Configuration.xml b/Factories/Resourcecss/Configuration.xml index 80845a5..87e5599 100644 --- a/Factories/Resourcecss/Configuration.xml +++ b/Factories/Resourcecss/Configuration.xml @@ -2,7 +2,7 @@ Resourcecss Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resourcecss/ResourcecssFactoryMethod.php b/Factories/Resourcecss/ResourcecssFactoryMethod.php index 1fba980..2ac90b3 100644 --- a/Factories/Resourcecss/ResourcecssFactoryMethod.php +++ b/Factories/Resourcecss/ResourcecssFactoryMethod.php @@ -29,7 +29,7 @@ class ResourcecssFactoryMethod extends FactoryMethodBase implements FactoryInter * * @param array $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -44,7 +44,7 @@ public function __construct(array $options = array()) * Retrieve a list of Interface dependencies and return the data ot the controller. * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -62,7 +62,7 @@ public function setDependencies(array $reflection = array()) * Set Dependencies for Instantiation * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function onBeforeInstantiation(array $dependency_values = null) @@ -93,7 +93,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * Follows the completion of the instantiate method * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function onAfterInstantiation() { @@ -106,7 +106,7 @@ public function onAfterInstantiation() * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() diff --git a/Factories/Resourcecssdeclarations/Configuration.xml b/Factories/Resourcecssdeclarations/Configuration.xml index e969044..43fbb59 100644 --- a/Factories/Resourcecssdeclarations/Configuration.xml +++ b/Factories/Resourcecssdeclarations/Configuration.xml @@ -2,7 +2,7 @@ Resourcecssdeclarations Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php index 253f71d..897dc85 100644 --- a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php +++ b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php @@ -29,7 +29,7 @@ class ResourcecssdeclarationsFactoryMethod extends FactoryMethodBase implements * * @param array $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -44,7 +44,7 @@ public function __construct(array $options = array()) * Retrieve a list of Interface dependencies and return the data ot the controller. * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -62,7 +62,7 @@ public function setDependencies(array $reflection = array()) * Set Dependencies for Instantiation * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function onBeforeInstantiation(array $dependency_values = null) @@ -92,7 +92,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * Follows the completion of the instantiate method * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function onAfterInstantiation() { @@ -105,7 +105,7 @@ public function onAfterInstantiation() * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() diff --git a/Factories/Resourcedata/Configuration.xml b/Factories/Resourcedata/Configuration.xml new file mode 100644 index 0000000..9efe5eb --- /dev/null +++ b/Factories/Resourcedata/Configuration.xml @@ -0,0 +1,13 @@ + + + Configuration Data + Amy Stephen + January 2015 + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. + MIT + hello@molajo.org + http://molajo.org + 1.0 + Configurationdata Factory + + diff --git a/Factories/Resourcedata/ResourcedataFactoryMethod.php b/Factories/Resourcedata/ResourcedataFactoryMethod.php new file mode 100644 index 0000000..81f251f --- /dev/null +++ b/Factories/Resourcedata/ResourcedataFactoryMethod.php @@ -0,0 +1,465 @@ +options['Resource'] = $options['Resource']; + } + + /** + * Retrieve and load valid properties for fields, data models and data objects + * + * @param array $reflection + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function setDependencies(array $reflection = array()) + { + parent::setDependencies($reflection); + + $options = array(); + $options['product_namespace'] = 'Molajo\\Resource\\Configuration\\Registry'; + $this->dependencies['Registry'] = $options; + + /** Fields Configuration */ + $f = $this->options['Resource']->get('xml:///Molajo//Model//Application//Fields.xml'); + + /** Data Objects */ + $this->loadFieldProperties($f, 'dataobjecttypes', 'dataobjecttype', 'valid_data_object_types'); + $this->loadFieldPropertiesWithAttributes($f, 'dataobjectattributes', 'dataobjectattribute', + 'valid_data_object_attributes'); + + /** Models */ + $this->loadFieldProperties($f, 'modeltypes', 'modeltype', 'valid_model_types'); + $this->loadFieldPropertiesWithAttributes($f, 'modelattributes', 'modelattribute', 'valid_model_attributes'); + + /** Data Types */ + $this->loadFieldPropertiesWithAttributes($f, 'datatypes', 'datatypes', 'valid_data_types'); + $this->loadFieldProperties($f, 'queryelements', 'queryelement', 'valid_queryelements_attributes'); + + $list = $this->valid_queryelements_attributes; + + foreach ($list as $item) { + $field = explode(',', $item); + $this->loadFieldProperties($f, $field[0], $field[1], $field[2]); + } + + $data_lists_array = array(); + $path = $this->base_path . '/vendor/molajo/application/Source/Model/Datalist'; + $data_lists_array = $this->loadDatalists($data_lists_array, $path); + $data_lists_array = array_unique($data_lists_array); + + $this->valid_datalists = $data_lists_array; + + $this->setValidArray(); + + return $this->dependencies; + } + + /** + * Instantiate Class + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function instantiateClass() + { + try { + $class = $this->product_namespace; + $this->product_result = new $class($this->options['valid_array']); + + } catch (Exception $e) { + + throw new RuntimeException( + 'IoC Factory Method Adapter Instance Failed for ' . $this->product_namespace + . ' failed.' . $e->getMessage() + ); + } + + return $this; + } + + /** + * Follows the completion of the instantiate method + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function onAfterInstantiation() + { + $xml = $this->createXml(); + + $this->options['Resource']->setAdapterInstance('Xml', $xml); + + return $this; + } + + /** + * Factory Method Controller requests any Products (other than the current product) to be saved + * + * @return array + * @since 1.0.0 + */ + public function setContainerEntries() + { + $this->set_container_entries['Resource'] = $this->options['Resource']; + + return $this->set_container_entries; + } + + /** + * loadFieldProperties + * + * @param string $xml + * @param string $plural + * @param string $singular + * @param string $parameter_name + * + * @return $this + * @since 1.0.0 + */ + protected function loadFieldProperties($xml, $plural, $singular, $parameter_name) + { + if (isset($xml->$plural->$singular)) { + } else { + return false; + } + + $types = $xml->$plural->$singular; + + if (count($types) === 0) { + return false; + } + + $type_array = array(); + foreach ($types as $type) { + $type_array[] = (string)$type; + } + + $this->$parameter_name = $type_array; + + return $this; + } + + /** + * loadFieldPropertiesWithAttributes + * + * @param string $xml + * @param string $plural + * @param string $singular + * @param string $parameter_name + * + * @return $this + * @since 1.0.0 + */ + protected function loadFieldPropertiesWithAttributes($xml, $plural, $singular, $parameter_name) + { + if (isset($xml->$plural->$singular)) { + } else { + return $this; + } + + $type_array = array(); + $type_default_array = array(); + foreach ($xml->$plural->$singular as $type) { + $type_array[] = (string)$type['name']; + $type_default_array[(string)$type['name']] = (string)$type['default']; + } + + $this->$parameter_name = $type_array; + $temp = $parameter_name . '_defaults'; + $this->$temp = $type_default_array; + + return $this; + } + + /** + * loadDatalists + * + * @param string $data_lists_array + * @param string $folder + * + * @return array + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function loadDatalists($data_lists_array, $folder) + { + try { + $directory_read = dir($folder); + $path = $directory_read->path; + + while (false !== ($entry = $directory_read->read())) { + if (is_dir($path . '/' . $entry)) { + } else { + $data_lists_array[] = substr($entry, 0, strlen($entry) - 4); + } + } + + $directory_read->close(); + + } catch (RuntimeException $e) { + throw new RuntimeException( + 'IoC Factory Method Configuration: loadDatalists cannot find Datalists file for folder: ' . $folder + ); + } + + return $data_lists_array; + } + + /** + * Create Resource Xml Adapter dependent upon configuration information + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function createXml() + { + $scheme = $this->createScheme(); + + $resource_map = $this->readFile( + $this->base_path + . '/Bootstrap/Files/Output/ResourceMap.json' + ); + + $class = 'Molajo\\Resource\\Adapter\\Xml'; + + try { + $xml = new $class ( + $this->base_path, + $resource_map, + array(), + $scheme->getScheme('Xml')->include_file_extensions, + array( + 'resource' => $this->options['Resource'], + 'registry' => $this->dependencies['Registry'], + 'data' => $this->product_result + ) + ); + } catch (Exception $e) { + throw new RuntimeException( + 'Resource Data Factory Method createXml failed: ' + . $e->getMessage() + ); + } + + return $xml; + } + + /** + * Create Scheme Instance + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function createScheme() + { + $class = 'Molajo\\Resource\\Scheme'; + + $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; + + try { + $scheme = new $class ($input); + } catch (Exception $e) { + throw new RuntimeException( + 'Resource Scheme ' . $class + . ' Exception during Instantiation: ' . $e->getMessage() + ); + } + + return $scheme; + } + + /** + * Set Valid Array + * + * @return $this + * @since 1.0.0 + */ + protected function setValidArray() + { + $valid_array = array(); + + $valid_array['valid_data_object_types'] = $this->valid_data_object_types; + $valid_array['valid_data_object_attributes'] = $this->valid_data_object_attributes; + $valid_array['valid_model_types'] = $this->valid_model_types; + $valid_array['valid_model_attributes'] = $this->valid_model_attributes; + $valid_array['valid_data_types'] = $this->valid_data_types; + $valid_array['valid_queryelements_attributes'] = $this->valid_queryelements_attributes; + $valid_array['valid_field_attributes'] = $this->valid_field_attributes; + $valid_array['valid_join_attributes'] = $this->valid_join_attributes; + $valid_array['valid_foreignkey_attributes'] = $this->valid_foreignkey_attributes; + $valid_array['valid_criteria_attributes'] = $this->valid_criteria_attributes; + $valid_array['valid_children_attributes'] = $this->valid_children_attributes; + $valid_array['valid_plugin_attributes'] = $this->valid_plugin_attributes; + $valid_array['valid_value_attributes'] = $this->valid_value_attributes; + $valid_array['valid_field_attributes_default'] = $this->valid_field_attributes_default; + $valid_array['valid_datalists'] = $this->valid_datalists; + + $this->options['valid_array'] = $valid_array; + + return $this; + } +} diff --git a/Factories/Resourcejs/Configuration.xml b/Factories/Resourcejs/Configuration.xml index a66d55a..fd11616 100644 --- a/Factories/Resourcejs/Configuration.xml +++ b/Factories/Resourcejs/Configuration.xml @@ -2,7 +2,7 @@ Resourcejs Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resourcejs/ResourcejsFactoryMethod.php b/Factories/Resourcejs/ResourcejsFactoryMethod.php index 21bbf2c..9fa5a67 100644 --- a/Factories/Resourcejs/ResourcejsFactoryMethod.php +++ b/Factories/Resourcejs/ResourcejsFactoryMethod.php @@ -29,7 +29,7 @@ class ResourcejsFactoryMethod extends FactoryMethodBase implements FactoryInterf * * @param array $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -44,7 +44,7 @@ public function __construct(array $options = array()) * Retrieve a list of Interface dependencies and return the data ot the controller. * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -61,7 +61,7 @@ public function setDependencies(array $reflection = array()) * Set Dependencies for Instantiation * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function onBeforeInstantiation(array $dependency_values = null) @@ -83,7 +83,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * Follows the completion of the instantiate method * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function onAfterInstantiation() { @@ -96,7 +96,7 @@ public function onAfterInstantiation() * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() diff --git a/Factories/Resourcejsdeclarations/Configuration.xml b/Factories/Resourcejsdeclarations/Configuration.xml index 0f3fb08..a6a81f2 100644 --- a/Factories/Resourcejsdeclarations/Configuration.xml +++ b/Factories/Resourcejsdeclarations/Configuration.xml @@ -2,7 +2,7 @@ Resourcejsdeclarations Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php index 16f3c67..acbaf54 100644 --- a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php +++ b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php @@ -29,7 +29,7 @@ class ResourcejsdeclarationsFactoryMethod extends FactoryMethodBase implements F * * @param array $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -44,7 +44,7 @@ public function __construct(array $options = array()) * Retrieve a list of Interface dependencies and return the data ot the controller. * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -61,7 +61,7 @@ public function setDependencies(array $reflection = array()) * Set Dependencies for Instantiation * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function onBeforeInstantiation(array $dependency_values = null) @@ -84,7 +84,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * Follows the completion of the instantiate method * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function onAfterInstantiation() { @@ -97,7 +97,7 @@ public function onAfterInstantiation() * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() diff --git a/Factories/Resourcequery/Configuration.xml b/Factories/Resourcequery/Configuration.xml new file mode 100644 index 0000000..a99428a --- /dev/null +++ b/Factories/Resourcequery/Configuration.xml @@ -0,0 +1,13 @@ + + + Resourcequery + Amy Stephen + January 2015 + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. + MIT + hello@molajo.org + http://molajo.org + 1.0 + Resourcequery Factory + + diff --git a/Factories/Resourcequery/ResourcequeryFactoryMethod.php b/Factories/Resourcequery/ResourcequeryFactoryMethod.php new file mode 100644 index 0000000..2f1b5ea --- /dev/null +++ b/Factories/Resourcequery/ResourcequeryFactoryMethod.php @@ -0,0 +1,164 @@ +dependencies['Resource'] = array(); + $this->dependencies['Database'] = array(); + $this->dependencies['Query'] = array(); + $this->dependencies['Runtimedata'] = array(); + $this->dependencies['Eventcallback'] = array(); + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); + + return $this->dependencies; + } + + /** + * Set Dependencies for Instantiation + * + * @return array + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function onBeforeInstantiation(array $dependency_values = null) + { + parent::onBeforeInstantiation($dependency_values); + + $this->dependencies['base_path'] = $this->base_path; + $this->dependencies['resource_map'] = $this->readFile( + $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' + ); + $this->options['Scheme'] = $this->createScheme(); + $this->dependencies['namespace_prefixes'] = array(); + $this->dependencies['valid_file_extensions'] + = $this->options['Scheme']->getScheme( + 'Query' + )->include_file_extensions; + + $this->dependencies['query'] = $this->dependencies['Query']; + $this->dependencies['schedule_event'] = $this->dependencies['Eventcallback']; + $this->dependencies['get_cache_callback'] = $this->dependencies['Getcachecallback']; + $this->dependencies['set_cache_callback'] = $this->dependencies['Setcachecallback']; + $this->dependencies['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; + + return $this->dependencies; + } + + /** + * Factory Method Controller triggers the Factory Method to create the Class for the Service + * + * @return $this + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function instantiateClass() + { + $class = $this->product_namespace; + + $database = clone $this->dependencies['Database']; + $query = clone $this->dependencies['Query']; + + $this->product_result = new $class( + $this->dependencies['base_path'], + $this->dependencies['resource_map'], + $this->dependencies['namespace_prefixes'], + $this->dependencies['valid_file_extensions'], + $database, + $query, + $this->dependencies['schedule_event'], + $this->dependencies['get_cache_callback'], + $this->dependencies['set_cache_callback'], + $this->dependencies['delete_cache_callback'] + + ); + + return $this; + } + + /** + * Follows the completion of the instantiate method + * + * @return $this + * @since 1.0.0 + */ + public function onAfterInstantiation() + { + $this->dependencies['Resource']->setAdapterInstance('Query', $this->product_result); + + return $this; + } + + /** + * Create Scheme Instance + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function createScheme() + { + $class = 'Molajo\\Resource\\Scheme'; + + $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; + + try { + $scheme = new $class ($input); + } catch (Exception $e) { + throw new RuntimeException( + 'Resource Scheme ' . $class + . ' Exception during Instantiation: ' . $e->getMessage() + ); + } + + return $scheme; + } +} diff --git a/Factories/Resourcerendering/Configuration.xml b/Factories/Resourcerendering/Configuration.xml index 52391f0..18af760 100644 --- a/Factories/Resourcerendering/Configuration.xml +++ b/Factories/Resourcerendering/Configuration.xml @@ -2,7 +2,7 @@ Resourcesrendering Amy Stephen - January 2014 + January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. MIT hello@molajo.org diff --git a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php index 3ae64ac..e1bce84 100644 --- a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php +++ b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php @@ -29,7 +29,7 @@ class ResourcerenderingFactoryMethod extends FactoryMethodBase implements Factor * * @param array $options * - * @since 1.0 + * @since 1.0.0 */ public function __construct(array $options = array()) { @@ -42,7 +42,7 @@ public function __construct(array $options = array()) * Retrieve a list of Interface dependencies and return the data ot the controller. * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setDependencies(array $reflection = array()) @@ -60,7 +60,7 @@ public function setDependencies(array $reflection = array()) * Set Dependencies for Instantiation * * @return array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function onBeforeInstantiation(array $dependency_values = null) @@ -126,7 +126,7 @@ public function onBeforeInstantiation(array $dependency_values = null) * @param bool $extensions * * @return mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createHandler( @@ -163,7 +163,7 @@ protected function createHandler( * Create Scheme Instance * * @return object - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createScheme() @@ -188,13 +188,11 @@ protected function createScheme() * Request for array of Factory Methods to be Scheduled * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function scheduleFactories() { - $options = array(); - $options['base_path'] = $this->base_path; - + $options = array(); $this->schedule_factory_methods['Resourcecss'] = $options; $this->schedule_factory_methods['Resourcecssdeclarations'] = $options; $this->schedule_factory_methods['Resourcejs'] = $options; diff --git a/Source/Adapter/AbstractAdapter.php b/Source/Adapter/AbstractAdapter.php index bad42dc..28d8800 100644 --- a/Source/Adapter/AbstractAdapter.php +++ b/Source/Adapter/AbstractAdapter.php @@ -9,6 +9,8 @@ namespace Molajo\Resource\Adapter; use CommonApi\Resource\AdapterInterface; +use CommonApi\Exception\RuntimeException; +use Exception; /** * Abstract Resource Adapter @@ -24,7 +26,7 @@ class AbstractAdapter implements AdapterInterface * Resource Namespace * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $resource_namespace = null; @@ -32,7 +34,7 @@ class AbstractAdapter implements AdapterInterface * Base Path - root of the website from which paths are defined * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $base_path = null; @@ -40,7 +42,7 @@ class AbstractAdapter implements AdapterInterface * Resource Map * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $resource_map = array(); @@ -48,7 +50,7 @@ class AbstractAdapter implements AdapterInterface * Namespace Prefixes + Path * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $namespace_prefixes = array(); @@ -56,7 +58,7 @@ class AbstractAdapter implements AdapterInterface * Namespace Prefixes + Path * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $valid_file_extensions = array(); @@ -64,7 +66,7 @@ class AbstractAdapter implements AdapterInterface * Located for Multiple = true * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $located_multiple = array(); @@ -76,7 +78,7 @@ class AbstractAdapter implements AdapterInterface * @param array $namespace_prefixes * @param array $valid_file_extensions * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -98,25 +100,12 @@ public function __construct( * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = true) { if (isset($this->namespace_prefixes[$namespace_prefix])) { - - $hold = $this->namespace_prefixes[$namespace_prefix]; - - if ($prepend === false) { - $hold[] = $namespace_base_directory; - $this->namespace_prefixes[$namespace_prefix] = $hold; - } else { - $new = array(); - $new[] = $namespace_base_directory; - foreach ($hold as $h) { - $new[] = $h; - } - $this->namespace_prefixes[$namespace_prefix] = $new; - } + $this->setNamespaceExists($namespace_prefix, $namespace_base_directory, $prepend); } else { $this->namespace_prefixes[$namespace_prefix] = array($namespace_base_directory); } @@ -124,6 +113,70 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep return $this; } + /** + * Set Namespace for secondary location + * + * @param string $namespace_prefix + * @param string $namespace_base_directory + * @param boolean $prepend + * + * @return $this + * @since 1.0.0 + */ + protected function setNamespaceExists($namespace_prefix, $namespace_base_directory, $prepend) + { + if ($prepend === false) { + return $this->appendNamespace($namespace_prefix, $namespace_base_directory); + } + + return $this->prependNamespace($namespace_prefix, $namespace_base_directory); + } + + /** + * Append Namespace for secondary location + * + * @param string $namespace_prefix + * @param string $namespace_base_directory + * @param boolean $prepend + * + * @return $this + * @since 1.0.0 + */ + protected function appendNamespace($namespace_prefix, $namespace_base_directory) + { + $hold = $this->namespace_prefixes[$namespace_prefix]; + + $hold[] = $namespace_base_directory; + $this->namespace_prefixes[$namespace_prefix] = $hold; + + return $this; + } + + /** + * Append Namespace for secondary location + * + * @param string $namespace_prefix + * @param string $namespace_base_directory + * @param boolean $prepend + * + * @return $this + * @since 1.0.0 + */ + protected function prependNamespace($namespace_prefix, $namespace_base_directory) + { + $hold = $this->namespace_prefixes[$namespace_prefix]; + + $new = array(); + $new[] = $namespace_base_directory; + foreach ($hold as $h) { + $new[] = $h; + } + + $this->namespace_prefixes[$namespace_prefix] = $new; + + return $this; + } + /** * Locates folder/file associated with Namespace for Resource * @@ -131,7 +184,7 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep * @param bool $multiple * * @return void|mixed|string|array - * @since 1.0 + * @since 1.0.0 */ public function get($resource_namespace, $multiple = false) { @@ -145,30 +198,7 @@ public function get($resource_namespace, $multiple = false) $this->resource_namespace = $resource_namespace; if (count($this->namespace_prefixes) > 0) { - - foreach ($this->namespace_prefixes as $namespace_prefix => $base_directories) { - - $namespace_prefix = htmlspecialchars(strtolower($namespace_prefix)); - - if (stripos(strtolower($resource_namespace), $namespace_prefix) === false) { - } else { - - $located_path = $this->searchNamespacePrefix( - $resource_namespace, - $namespace_prefix, - $base_directories - ); - - if ($located_path === false) { - } else { - if ($multiple === false) { - break; - } else { - $this->located_multiple[] = $located_path; - } - } - } - } + $located_path = $this->searchNamespacePrefixes($resource_namespace, $multiple); } if ($located_path === false || $multiple === true) { @@ -189,6 +219,43 @@ public function get($resource_namespace, $multiple = false) return $located_path; } + /** + * @param $resource_namespace + * @param $multiple + * + * @return AbstractAdapter + */ + protected function searchNamespacePrefixes($resource_namespace, $multiple) + { + $located_path = false; + + foreach ($this->namespace_prefixes as $namespace_prefix => $base_directories) { + + $namespace_prefix = htmlspecialchars(strtolower($namespace_prefix)); + + if (stripos(strtolower($resource_namespace), $namespace_prefix) === false) { + } else { + + $located_path = $this->searchNamespacePrefix( + $resource_namespace, + $namespace_prefix, + $base_directories + ); + + if ($located_path === false) { + } else { + if ($multiple === false) { + break; + } else { + $this->located_multiple[] = $located_path; + } + } + } + } + + return $located_path; + } + /** * Set a namespace prefix by mapping to the filesystem path * @@ -197,7 +264,7 @@ public function get($resource_namespace, $multiple = false) * @param array $base_directories * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function searchNamespacePrefix( $resource_namespace, @@ -245,7 +312,7 @@ protected function searchNamespacePrefix( * @param bool $multiple * * @return mixed|bool|string - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -297,7 +364,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { @@ -311,10 +378,48 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function getCollection($scheme, array $options = array()) { return null; } + + /** + * Verify Options Entry + * + * @param array $options + * + * @return $this + * @since 1.0.0 + * @throws RuntimeException + */ + protected function verifyNamespace(array $options = array()) + { + if (isset($options['namespace'])) { + } else { + throw new RuntimeException('Resource handlePath options array must have namespace entry.'); + } + + return $this; + } + + /** + * Verify File Exists + * + * @param string $located_path + * + * @return $this + * @since 1.0.0 + * @throws RuntimeException + */ + protected function verifyFileExists($located_path) + { + if (file_exists($located_path)) { + } else { + throw new RuntimeException('Resource located_path not found: ' . $this->resource_namespace); + } + + return $this; + } } diff --git a/Source/Adapter/Asset.php b/Source/Adapter/Asset.php index aacaaf7..f8477f8 100644 --- a/Source/Adapter/Asset.php +++ b/Source/Adapter/Asset.php @@ -28,7 +28,7 @@ class Asset extends AbstractAdapter implements AdapterInterface * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { diff --git a/Source/Adapter/ClassLoader.php b/Source/Adapter/ClassLoader.php index 318c0e6..bf63b5b 100644 --- a/Source/Adapter/ClassLoader.php +++ b/Source/Adapter/ClassLoader.php @@ -28,7 +28,7 @@ class ClassLoader extends AbstractAdapter implements AdapterInterface * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { diff --git a/Source/Adapter/ConfigurationFactory.php b/Source/Adapter/ConfigurationFactory.php new file mode 100644 index 0000000..dc5db0a --- /dev/null +++ b/Source/Adapter/ConfigurationFactory.php @@ -0,0 +1,147 @@ +saveConfigurationDependencies($configuration_dependency_array); + } + + /** + * Save Configuration Dependencies + * + * @param array $configuration_dependency_array + * + * @return $this + * @since 1.0.0 + */ + protected function saveConfigurationDependencies(array $configuration_dependency_array = array()) + { + if (count($configuration_dependency_array) === 0) { + return $this; + } + + $this->data = $configuration_dependency_array['data']; + $this->resource = $configuration_dependency_array['resource']; + $this->registry = $configuration_dependency_array['registry']; + + return $this; + } + + /** + * Create Model Configuration Class + * + * @return object + * @since 1.0.0 + */ + public function instantiateModelConfiguration() + { + $class = 'Molajo\\Resource\\Configuration\\Model'; + + $data = clone $this->data; + $registry = clone $this->registry; + $resource = clone $this->resource; + + try { + return new $class ($data, $registry, $resource); + + } catch (Exception $e) { + throw new RuntimeException( + 'Resource ConfigurationFactory instantiateModelConfiguration failed: ' + . $e->getMessage() + ); + } + } + + /** + * Create data_object Configuration Class + * + * @return object CommonApi\Resource\DataInterface + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + protected function instantiateDataObjectConfiguration() + { + $class = 'Molajo\\Resource\\Configuration\\Dataobject'; + + $data = clone $this->data; + $registry = clone $this->registry; + $resource = clone $this->resource; + + try { + return new $class ($data, $registry, $resource); + + } catch (Exception $e) { + throw new RuntimeException( + 'Resource ConfigurationFactory instantiateDataObjectConfiguration failed: ' + . $e->getMessage() + ); + } + } +} diff --git a/Source/Adapter/Css.php b/Source/Adapter/Css.php index 9b0fa9b..1327cf0 100644 --- a/Source/Adapter/Css.php +++ b/Source/Adapter/Css.php @@ -25,7 +25,7 @@ class Css extends AbstractAdapter implements AdapterInterface * Collect list of CSS Files * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $css_files = array(); @@ -33,7 +33,7 @@ class Css extends AbstractAdapter implements AdapterInterface * Css * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $css = array(); @@ -41,7 +41,7 @@ class Css extends AbstractAdapter implements AdapterInterface * CSS Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $css_priorities = array(); @@ -49,7 +49,7 @@ class Css extends AbstractAdapter implements AdapterInterface * Language Direction * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $language_direction; @@ -57,7 +57,7 @@ class Css extends AbstractAdapter implements AdapterInterface * HTML5 * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $html5; @@ -65,7 +65,7 @@ class Css extends AbstractAdapter implements AdapterInterface * Line End * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $line_end; @@ -73,7 +73,7 @@ class Css extends AbstractAdapter implements AdapterInterface * Mimetype * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $mimetype; @@ -89,7 +89,7 @@ class Css extends AbstractAdapter implements AdapterInterface * @param string $line_end * @param string $mimetype * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -122,7 +122,7 @@ public function __construct( * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { @@ -187,7 +187,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param integer $priority * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function addCssFolder($file_path, $priority = 500) { @@ -250,7 +250,7 @@ public function addCssFolder($file_path, $priority = 500) * @param array $attributes * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function addCss( $file_path, @@ -307,7 +307,7 @@ public function addCss( * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function getCollection($scheme, array $options = array()) { diff --git a/Source/Adapter/Cssdeclarations.php b/Source/Adapter/Cssdeclarations.php index 828d0f4..3a50802 100644 --- a/Source/Adapter/Cssdeclarations.php +++ b/Source/Adapter/Cssdeclarations.php @@ -25,7 +25,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * Css Declarations * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $css = array(); @@ -33,7 +33,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * CSS Declarations Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $css_priorities = array(); @@ -41,7 +41,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * Language Direction * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $language_direction; @@ -49,7 +49,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * HTML5 * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $html5; @@ -57,7 +57,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * Line End * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $line_end; @@ -65,7 +65,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * Mimetype * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $mimetype; @@ -81,7 +81,7 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * @param string $line_end * @param string $mimetype * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -114,7 +114,7 @@ public function __construct( * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { @@ -152,7 +152,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function getCollection($scheme, array $options = array()) { diff --git a/Source/Adapter/Extension.php b/Source/Adapter/Extension.php index 3524d7a..80a935a 100644 --- a/Source/Adapter/Extension.php +++ b/Source/Adapter/Extension.php @@ -25,7 +25,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Rendering Extensions * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $extensions = null; @@ -33,7 +33,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Extension Object * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $extension = null; @@ -41,7 +41,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Extension Path * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $extension_path = null; @@ -49,7 +49,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Parameters * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $parameters = null; @@ -57,7 +57,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Catalog Type ID * * @var int - * @since 1.0 + * @since 1.0.0 */ protected $catalog_type_id; @@ -65,7 +65,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Catalog Type Priority * * @var int - * @since 1.0 + * @since 1.0.0 */ protected $catalog_type_priority; @@ -73,7 +73,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * Resource Instance to retrieve CSS and JS files * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $resource; @@ -87,7 +87,7 @@ class Extension extends AbstractAdapter implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -117,7 +117,7 @@ public function __construct( * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = false) { @@ -131,7 +131,7 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep * @param bool $multiple * * @return void|mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function get($resource_namespace, $multiple = false) @@ -170,7 +170,7 @@ public function get($resource_namespace, $multiple = false) * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function handlePath($scheme, $located_path, array $options = array()) @@ -192,7 +192,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param array $options * * @return Extension - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Field.php b/Source/Adapter/Field.php new file mode 100644 index 0000000..51aa519 --- /dev/null +++ b/Source/Adapter/Field.php @@ -0,0 +1,115 @@ +fields = $fields; + } + + /** + * Locates resource associated with Namespace + * + * @param string $resource_namespace + * @param bool $multiple + * + * @return object + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function get($resource_namespace, $multiple = false) + { + $resource_namespace = strtolower($resource_namespace); + + if (isset($this->fields[$resource_namespace])) { + return $this->buildAttributeArray($this->fields[$resource_namespace]); + } + + $message = ' SCHEME: field' . ' NAMESPACE: ' . $resource_namespace; + throw new RuntimeException('Resource FieldHandler Failure: ' . $message); + } + + /** + * Build Attribute Array for Field + * + * @param object $field + * + * @return array + * @since 1.0.0 + */ + protected function buildAttributeArray($field) + { + $field_attributes = array(); + + foreach ($field as $key => $value) { + $field_attributes[$key] = $value; + } + + return $field_attributes; + } + + /** + * Retrieve a collection of a specific handler + * + * @param string $scheme + * @param array $options + * + * @return mixed + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function getCollection($scheme, array $options = array()) + { + return null; + } +} diff --git a/Source/Adapter/File.php b/Source/Adapter/File.php index 8c97e18..b2bfca7 100644 --- a/Source/Adapter/File.php +++ b/Source/Adapter/File.php @@ -28,7 +28,7 @@ class File extends AbstractAdapter implements AdapterInterface * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { diff --git a/Source/Adapter/Folder.php b/Source/Adapter/Folder.php index c4f6973..db107dd 100644 --- a/Source/Adapter/Folder.php +++ b/Source/Adapter/Folder.php @@ -29,7 +29,7 @@ class Folder extends AbstractAdapter implements AdapterInterface * @param bool $multiple * * @return void|mixed|string|array - * @since 1.0 + * @since 1.0.0 */ public function get($resource_namespace, $multiple = false) { @@ -95,7 +95,7 @@ public function get($resource_namespace, $multiple = false) * @param array $base_directories * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function searchNamespacePrefix( $resource_namespace, @@ -132,7 +132,7 @@ protected function searchNamespacePrefix( * @param bool $multiple * * @return mixed|bool|string - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -170,7 +170,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { diff --git a/Source/Adapter/Head.php b/Source/Adapter/Head.php index 0b9d04f..576eede 100644 --- a/Source/Adapter/Head.php +++ b/Source/Adapter/Head.php @@ -28,7 +28,7 @@ class Head extends AbstractAdapter implements AdapterInterface * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { diff --git a/Source/Adapter/Js.php b/Source/Adapter/Js.php index f674281..d35ae86 100644 --- a/Source/Adapter/Js.php +++ b/Source/Adapter/Js.php @@ -25,7 +25,7 @@ class Js extends AbstractAdapter implements AdapterInterface * Js * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js = array(); @@ -33,7 +33,7 @@ class Js extends AbstractAdapter implements AdapterInterface * Js Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_priorities = array(); @@ -41,7 +41,7 @@ class Js extends AbstractAdapter implements AdapterInterface * Js Defer * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_defer = array(); @@ -49,7 +49,7 @@ class Js extends AbstractAdapter implements AdapterInterface * Js Defer Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_defer_priorities = array(); @@ -57,7 +57,7 @@ class Js extends AbstractAdapter implements AdapterInterface * JS Declarations * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_declarations = array(); @@ -65,7 +65,7 @@ class Js extends AbstractAdapter implements AdapterInterface * JS Declarations Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_declarations_priorities = array(); @@ -73,7 +73,7 @@ class Js extends AbstractAdapter implements AdapterInterface * JS Declarations Defer * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_declarations_defer = array(); @@ -81,7 +81,7 @@ class Js extends AbstractAdapter implements AdapterInterface * JS Declarations Defer Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_declarations_defer_priorities = array(); @@ -93,7 +93,7 @@ class Js extends AbstractAdapter implements AdapterInterface * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = false) { @@ -106,7 +106,7 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep * @param string $resource_namespace * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function get($resource_namespace, $multiple = false) { @@ -121,7 +121,7 @@ public function get($resource_namespace, $multiple = false) * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { @@ -190,7 +190,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param bool $defer * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function addJsFolder($file_path, $priority = 500, $defer) { diff --git a/Source/Adapter/Jsdeclarations.php b/Source/Adapter/Jsdeclarations.php index cc3bdae..4ef947b 100644 --- a/Source/Adapter/Jsdeclarations.php +++ b/Source/Adapter/Jsdeclarations.php @@ -24,7 +24,7 @@ class JsDeclarations extends AbstractAdapter implements AdapterInterface * JS Declarations * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js = array(); @@ -32,7 +32,7 @@ class JsDeclarations extends AbstractAdapter implements AdapterInterface * JS Declarations Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_priorities = array(); @@ -40,7 +40,7 @@ class JsDeclarations extends AbstractAdapter implements AdapterInterface * JS Declarations Defer * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_defer = array(); @@ -48,7 +48,7 @@ class JsDeclarations extends AbstractAdapter implements AdapterInterface * JS Declarations Defer Priorities * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $js_defer_priorities = array(); @@ -60,7 +60,7 @@ class JsDeclarations extends AbstractAdapter implements AdapterInterface * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme, $located_path, array $options = array()) { @@ -83,7 +83,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param string $mimetype * * @return object Asset - * @since 1.0 + * @since 1.0.0 */ public function addJSDeclarations($content, $priority = 500, $defer = 0, $mimetype = 'text/javascript') { diff --git a/Source/Adapter/Menuitem.php b/Source/Adapter/Menuitem.php index 1944e7a..1abb063 100644 --- a/Source/Adapter/Menuitem.php +++ b/Source/Adapter/Menuitem.php @@ -32,7 +32,7 @@ class Menuitem extends Extension implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -61,7 +61,7 @@ public function __construct( * @param string $resource_namespace * * @return string|false - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -101,7 +101,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function handlePath($scheme, $located_path, array $options = array()) @@ -145,7 +145,7 @@ public function handlePath($scheme, $located_path, array $options = array()) * @param array $options * * @return Menuitem - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Page.php b/Source/Adapter/Page.php index 4d22461..6745b4b 100644 --- a/Source/Adapter/Page.php +++ b/Source/Adapter/Page.php @@ -32,7 +32,7 @@ class Page extends Extension implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -61,7 +61,7 @@ public function __construct( * @param string $resource_namespace * * @return string|false - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -100,7 +100,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return Page - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Query.php b/Source/Adapter/Query.php deleted file mode 100644 index ba5b4b1..0000000 --- a/Source/Adapter/Query.php +++ /dev/null @@ -1,256 +0,0 @@ -database = $database; - $this->query = $query; - $this->schedule_event = $schedule_event; - $this->runtime_data = new stdClass(); - } - - /** - * Handle requires located file - * - * @param string $scheme - * @param string $located_path - * @param array $options - * - * @return void|mixed - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function handlePath($scheme, $located_path, array $options = array()) - { - if (isset($options['namespace'])) { - } else { - throw new RuntimeException( - 'Resource XmlHandler handlePath options array must have namespace entry.' - ); - } - - $segments = explode('//', $options['namespace']); - if (count($segments) > 2) { - } else { - throw new RuntimeException( - 'Resource XmlHandler Failure namespace must have at least 3 segments: ' - . $options['namespace'] - ); - } - - $this->model_registry = $options['xml']; - - if (isset($options['sql'])) { - $this->sql = $options['sql']; - } - - if (isset($options['runtime_data'])) { - $this->runtime_data = $options['runtime_data']; - } - - if (isset($this->model_registry['model_offset'])) { - } else { - $this->model_registry['model_offset'] = 0; - } - - if (isset($this->model_registry['model_count'])) { - } else { - $this->model_registry['model_count'] = 20; - } - - if (isset($this->model_registry['use_pagination'])) { - } else { - $this->model_registry['use_pagination'] = 1; - } - - $type = 'read'; - if (isset($options['crud_type'])) { - $type = $options['crud_type']; - } - - $type = ucfirst(strtolower($type)); - if ($type === 'Create' - || $type === 'Read' - || $type === 'Update' - || $type === 'Delete' - ) { - } else { - $type = 'Read'; - } - - $model = $this->createModel($type)->instantiateClass(); - - return $this->createController($type, $model)->instantiateClass(); - } - - /** - * Create Model Instance - * - * @param string $type - * - * @return object - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function createModel($type) - { - $class = 'Molajo\\Resource\\Factory\\' . $type . 'ModelFactory'; - - try { - return new $class ( - $this->database - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Query Handler Failed Instantiating Controller: ' - . $e->getMessage() - ); - } - } - - /** - * Create Controller Instance - * - * @param string $type - * @param object $model - * - * @return object - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function createController($type, $model) - { - $class = 'Molajo\\Resource\\Factory\\' . $type . 'ControllerFactory'; - - try { - return new $class ( - $this->query, - $model, - $this->model_registry, - $this->runtime_data, - $this->schedule_event, - $this->sql - - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Query Handler Failed Instantiating Controller: ' - . $e->getMessage() - ); - } - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return null; - } -} diff --git a/Source/Adapter/Template.php b/Source/Adapter/Template.php index a764f15..5ada8e5 100644 --- a/Source/Adapter/Template.php +++ b/Source/Adapter/Template.php @@ -32,7 +32,7 @@ class Template extends Extension implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -61,7 +61,7 @@ public function __construct( * @param string $resource_namespace * * @return mixed|bool|string - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -100,7 +100,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return Template - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Theme.php b/Source/Adapter/Theme.php index 9d6adca..1f78be1 100644 --- a/Source/Adapter/Theme.php +++ b/Source/Adapter/Theme.php @@ -32,7 +32,7 @@ class Theme extends Extension implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -62,7 +62,7 @@ public function __construct( * @param bool $multiple * * @return string|false - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -95,7 +95,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return Theme - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Wrap.php b/Source/Adapter/Wrap.php index ec53d77..fc9e25a 100644 --- a/Source/Adapter/Wrap.php +++ b/Source/Adapter/Wrap.php @@ -32,7 +32,7 @@ class Wrap extends Extension implements AdapterInterface * @param object $extensions * @param object $resource * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path = null, @@ -61,7 +61,7 @@ public function __construct( * @param string $resource_namespace * * @return mixed|bool|string - * @since 1.0 + * @since 1.0.0 */ protected function searchResourceMap($resource_namespace, $multiple = false) { @@ -100,7 +100,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) * @param array $options * * @return Wrap - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getCollection($scheme, array $options = array()) diff --git a/Source/Adapter/Xml.php b/Source/Adapter/Xml.php index aeead6a..7fe4425 100644 --- a/Source/Adapter/Xml.php +++ b/Source/Adapter/Xml.php @@ -1,6 +1,6 @@ model_handler = $model_handler; - $this->dataobject_handler = $dataobject_handler; - } - /** * Set a namespace prefix by mapping to the filesystem path * @@ -78,7 +29,7 @@ public function __construct( * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = false) { @@ -92,7 +43,7 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep * @param bool $multiple * * @return array|mixed|string|void - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function get($resource_namespace, $multiple = false) @@ -102,41 +53,77 @@ public function get($resource_namespace, $multiple = false) /** * Xml file is located, read, loaded using Simplexml into a string and then sent back - * or processed by the Configuration Dataobject or Model utility + * or processed by the Configuration data_object or Model utility * * @param string $scheme * @param string $located_path * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function handlePath($scheme, $located_path, array $options = array()) { - if (isset($options['namespace'])) { - } else { - throw new RuntimeException - ( - 'Resource XmlHandler handlePath options array must have namespace entry.' - ); - } + $this->verifyNamespace($options); + + $segments = $this->handlePathSegments($options); + + list($model_type, $model_name) = $this->setModelTypeName($segments); + + $this->verifyFileExists($located_path); + $contents = file_get_contents($located_path); + $scheme = strtolower(trim($scheme)); + $model_type = ucfirst(strtolower(trim($model_type))); + + return $this->handlePathResults($scheme, $model_type, $model_name, $located_path, $contents); + } + + /** + * Break Namespace into Segments + * + * @param array $options + * + * @return array + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function handlePathSegments(array $options = array()) + { $segments = explode('//', $options['namespace']); if (count($segments) > 2) { } else { echo '
';
             var_dump($segments);
-            throw new RuntimeException
-            (
-                'Resource XmlHandler Failure namespace must have at least 3 segments:  ' . $options['namespace']
+            throw new RuntimeException(
+                'Resource XmlHandler Failure namespace must have at least 3 segments:  '
+                . $options['namespace']
             );
         }
 
-        if (count($segments) === 3) {
+        return $segments;
+    }
+
+    /**
+     * Derive Model Type and Name from NS Segments
+     *
+     * @param   array $segments
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    public function setModelTypeName(array $segments = array())
+    {
+        if (ucfirst(strtolower($segments[1])) === 'Resources') {
+            $model_type = ucfirst(strtolower($segments[1]));
+            $model_name = ucfirst(strtolower($segments[2] . $segments[3]));
+
+        } elseif (count($segments) === 3) {
             $model_type = ucfirst(strtolower($segments[1]));
             $model_name = ucfirst(strtolower($segments[2]));
+
         } else {
             $model_type = ucfirst(strtolower($segments[2]));
             $model_name = ucfirst(strtolower($segments[3]));
@@ -145,43 +132,160 @@ public function handlePath($scheme, $located_path, array $options = array())
         if (substr($model_name, strlen($model_name) - 4, 4) === '.xml') {
             $model_name = substr($model_name, 0, strlen($model_name) - 4); //remove .xml
         }
+        return array($model_type, $model_name);
+    }
 
-        if (file_exists($located_path)) {
-        } else {
-            throw new RuntimeException
-            (
-                'Resource XmlHandler located_path not found: ' . $this->resource_namespace
-            );
+    /**
+     * Process Request given path
+     *
+     * @param   string $scheme
+     * @param   string $model_type
+     * @param   string $model_name
+     * @param   string $located_path
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathResults(
+        $scheme,
+        $model_type,
+        $model_name,
+        $located_path,
+        $contents
+    ) {
+        if ($scheme === 'query') {
+            return $this->handlePathQuery($model_type, $model_name, $contents);
         }
 
-        try {
-            $contents = file_get_contents($located_path);
-
-            $scheme     = strtolower(trim($scheme));
-            $model_type = ucfirst(strtolower(trim($model_type)));
-
-            if ($scheme === 'query') {
-                $xml = simplexml_load_string($contents);
-                return $this->model_handler->getConfiguration($model_type, $model_name, $xml);
-            } elseif ($model_type === 'Application') {
-                $xml = simplexml_load_string($contents);
-                return $xml;
-            } elseif ($model_type === 'Fields' || $model_type === 'Include') {
-                return $contents;
-            } elseif ($model_type === 'Dataobject') {
-                $xml = simplexml_load_string($contents);
-                return $this->dataobject_handler->getConfiguration($model_type, $model_name, $xml);
-            } else {
-                $xml = simplexml_load_string($contents);
-                return $this->model_handler->getConfiguration($model_type, $model_name, $xml);
-            }
-        } catch (Exception $e) {
-
-            throw new RuntimeException
-            (
-                'Resource XmlHandler Failure:  ' . $located_path . ' ' . $e->getMessage()
-            );
+        if ($model_type === 'Application') {
+            return $this->handlePathApplication($contents);
+        }
+
+        if ($model_type === 'Include') {
+            return $this->handlePathInclude($contents);
+        }
+
+        if ($model_type === 'Dataobject') {
+            return $this->handlePathDataObject($model_name, $contents);
+        }
+
+        if ($model_type === 'Datasource') {
+            return $this->handlePathDatasource($model_name, $contents);
+        }
+
+        if ($model_type === 'Resources') {
+            return $this->handlePathResources($model_type, $model_name, $contents);
         }
+
+        $message = ' SCHEME: ' . $scheme
+            . ' MODEL TYPE: ' . $model_type
+            . ' MODEL NAME: ' . $model_name
+            . ' PATH: ' . $located_path;
+
+        throw new RuntimeException('Resource XmlHandler Failure: ' . $message);
+    }
+
+    /**
+     * Process Application Request
+     *
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathApplication($contents)
+    {
+        $xml = simplexml_load_string($contents);
+
+        return $xml;
+    }
+
+    /**
+     * Process data_object Request
+     *
+     * @param   string $model_name
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathDataObject($model_name, $contents)
+    {
+        $data_object_configuration = $this->instantiateDataObjectConfiguration();
+
+        $xml = simplexml_load_string($contents);
+
+        return $data_object_configuration->getConfiguration('Dataobject', $model_name, $xml);
+    }
+
+    /**
+     * Process Datasource Request
+     *
+     * @param   string $model_name
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathDatasource($model_name, $contents)
+    {
+        $model_configuration = $this->instantiateModelConfiguration();
+
+        $xml = simplexml_load_string($contents);
+
+        return $model_configuration->getConfiguration('Datasource', $model_name, $xml);
+    }
+
+    /**
+     * Process Resources Request
+     *
+     * @param   string $model_type
+     * @param   string $model_name
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathResources($model_type, $model_name, $contents)
+    {
+        $model_configuration = $this->instantiateModelConfiguration();
+
+        $xml = simplexml_load_string($contents);
+
+        return $model_configuration->getConfiguration($model_type, $model_name, $xml);
+    }
+
+    /**
+     * Process Include Request
+     *
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathInclude($contents)
+    {
+        return $contents;
+    }
+
+    /**
+     * Process Query Request
+     *
+     * @param   string $model_type
+     * @param   string $model_name
+     * @param   string $contents
+     *
+     * @return  object
+     * @since   1.0.0
+     */
+    protected function handlePathQuery($model_type, $model_name, $contents)
+    {
+        $model_configuration = $this->instantiateModelConfiguration();
+
+        $xml = simplexml_load_string($contents);
+
+        return $model_configuration->getConfiguration($model_type, $model_name, $xml);
     }
 
     /**
@@ -191,7 +295,7 @@ public function handlePath($scheme, $located_path, array $options = array())
      * @param   array  $options
      *
      * @return  mixed
-     * @since   1.0
+     * @since   1.0.0
      * @throws  \CommonApi\Exception\RuntimeException
      */
     public function getCollection($scheme, array $options = array())
diff --git a/Source/Api/ConfigurationDataInterface.php b/Source/Api/ConfigurationDataInterface.php
deleted file mode 100644
index 0393a08..0000000
--- a/Source/Api/ConfigurationDataInterface.php
+++ /dev/null
@@ -1,42 +0,0 @@
-registry->exists('Namespace');
-     * $this->registry->exists('Namespace', 'NamespaceElement');
-     *
-     * @param   string      $namespace
-     * @param   null|string $key
-     *
-     * @return  bool
-     * @since   1.0
-     */
-    public function exists($namespace, $key = null);
-
-    /**
-     * Lock registry from update
-     *
-     * Usage:
-     * $this->registry->lock('Namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  bool
-     * @since   1.0
-     */
-    public function lock($namespace);
-
-    /**
-     * Returns true if the registry is locked
-     * Returns false if there is no registry and if the registry is locked
-     *
-     * Usage:
-     * $this->registry->checkLock('Namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  bool
-     * @since   1.0
-     */
-    public function checkLock($namespace);
-
-    /**
-     * Create a registry for the specified namespace
-     *
-     * Notes:
-     * - All namespaces are set to lowercase to remove case sensitivity
-     * - Throws exception if namespace is reserved
-     * - Returns namespace if already existing (Note: Use 'exists' to verify prior to creation)
-     * - Called automatically when needed by a set for a namespace or for the member of a namespace
-     *
-     * Usage:
-     *  $this->registry->createRegistry('Namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  mixed|bool|array
-     * @since   1.0
-     */
-    public function createRegistry($namespace);
-
-    /**
-     * Returns Registry Data
-     *
-     * Notes:
-     * - Creates registry member using default if not existing and default provided
-     * - Creates registry if not existing (whether or not a member was created)
-     *
-     * Usage:
-     * $this->registry->get('Namespace', 'key value');
-     *
-     * List names of existing registry namespaces:
-     * echo $this->registry->get('*');
-     *
-     * ... include a formatted dump of namespace contents
-     * echo $this->registry->get('*', '*');
-     *
-     * List all entries in the specified registry namespace
-     * $array = $this->registry->get('Name space');
-     *
-     * List only those namespace entries beginning with the wildcard value:
-     * echo $this->registry->get('Name space', 'theme*');
-     *
-     * @param   string $namespace
-     * @param   string $key
-     * @param   mixed  $default
-     *
-     * @return  array|bool|mixed
-     * @since   1.0
-     */
-    public function get($namespace = null, $key = null, $default = null);
-
-    /**
-     * Sets the value for a specific namespace item
-     *
-     * Use $match to ensure member exists prior to setting value
-     *
-     * Usage:
-     * $this->registry->set('Namespace', 'key_name', $value);
-     *
-     * @param   string  $namespace
-     * @param   string  $key
-     * @param   mixed   $value
-     * @param   boolean $match
-     *
-     * @return  void|bool|RegistryInterface
-     * @since   1.0
-     */
-    public function set($namespace, $key, $value = null, $match = false);
-
-    /**
-     * Copy key values from one namespace registry into another, overwriting existing values in the other registry
-     *
-     * Note:
-     * If target_registry already exists, source_registry values replace existing values for matching keys
-     * Key pairs on target registry remain unchanged if there are no matching pairs. Use Delete first, if desired.
-     * Use merge when target registry values should remain -- not be overwritten.
-     *
-     * Usage:
-     * $this->registry->copy('namespace-x', 'to-namespace-y');
-     *
-     * To copy only certain values:
-     * $this->registry->copy('namespace-x', 'to-namespace-y', 'wildcard*');
-     *
-     * @param   string $source_registry
-     * @param   string $target_registry
-     * @param   null   $filter
-     *
-     * @return  void|$this
-     * @since   1.0
-     */
-    public function copy($source_registry, $target_registry, $filter = null);
-
-    /**
-     * Merge one Namespace into another
-     *
-     *  - When keys match, target value is retained
-     *  - When key does not exist on the target, it is copied in
-     *      In either of the above cases, when "remove_from_source" is 1, the source entry is removed
-     *  - If no entries remain in the source after the merge, the empty source registry is deleted
-     *
-     * Usage:
-     * $this->registry->merge('namespace-x', 'to-namespace-y');
-     *
-     * Merge a subset of source using wildcard:
-     * $this->registry->merge('namespace-x', 'to-namespace-y', 'Only These*');
-     *
-     * Merge a subset of source using wildcard, and then delete the source merged in:
-     * $this->registry->merge('namespace-x', 'to-namespace-y', 'Only These*', 1);
-     *
-     * @param   string $source_registry
-     * @param   string $target_registry
-     * @param   bool   $filter - merge for matching keys
-     * @param   int    $remove_from_source
-     *
-     * @return  array|bool
-     * @since   1.0
-     */
-    public function merge($source_registry, $target_registry, $filter = false, $remove_from_source = 0);
-
-    /**
-     * Sort Namespace
-     *
-     * Usage:
-     * $this->registry->sort('namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  $this
-     * @since   1.0
-     */
-    public function sort($namespace);
-
-    /**
-     * Deletes a registry or registry entry
-     *
-     * Usage:
-     * $this->registry->delete('Namespace', 'key_name');
-     *
-     * @param   string $namespace
-     * @param   string $key
-     *
-     * @return  \Molajo\Resource\Configuration\Registry
-     * @return  \Molajo\Resource\Configuration\Registry
-     * @since   1.0
-     */
-    public function delete($namespace, $key = null);
-
-    /**
-     * Rename a namespace (deletes existing, creates new)
-     *
-     * Usage:
-     * $this->registry->rename($namespace);
-     *
-     * @param   $namespace
-     * @param   $new_namespace
-     *
-     * @return  $this
-     * @since   1.0
-     */
-    public function rename($namespace, $new_namespace);
-
-    /**
-     * Returns an array containing key and name pairs for a namespace registry
-     *
-     * Usage:
-     * $this->registry->getArray('Namespace');
-     *
-     * To retrieve only the key field names, not the values:
-     * $this->registry->getArray('Namespace', true);
-     *
-     * @param string  $namespace
-     * @param boolean $key_only set to true to retrieve key names
-     *
-     * @return array
-     * @since   1.0
-     */
-    public function getArray($namespace, $key_only = false);
-
-    /**
-     * Populates a registry with an array of key and name pairs
-     *
-     * Usage:
-     * $this->registry->loadArray('Namespace', $array);
-     *
-     * @param  string $namespace name of registry to use or create
-     * @param  array  $array     key and value pairs to load
-     *
-     * @return  $this
-     * @since   1.0
-     */
-    public function loadArray($namespace, $array = array());
-
-    /**
-     * Retrieves a list of ALL namespace registries and optionally keys/values
-     *
-     * Specify $expand = true to return the entire list, and the member names and values in each registry
-     *
-     * Usage:
-     * $this->registry->listRegistry();
-     *
-     * @param   boolean $expand
-     *
-     * @return  mixed|boolean|array
-     * @since   1.0
-     */
-    public function listRegistry($expand = false);
-
-    /**
-     * getData - returns Registry (comes from $model_name) as Query Results (array of objects)
-     *
-     * Data can be requested as a result - provide $registry, $element and true for $single result
-     *
-     * Use '*' in the key to retrieve all values starting with a specific phrase (ex. 'model')
-     *
-     * @param   string      $registry     Name of registry, for the MVC this is the $model_name
-     * @param   null|string $key          Key of the named pair
-     * @param   null|string $query_object Result, Item, or List
-     *
-     * @return  array|bool|mixed
-     * @since   1.0
-     */
-    public function getData($registry, $key = null, $query_object = null);
-}
diff --git a/Source/ClassMap.php b/Source/ClassMap.php
index 232725e..ce9a7d8 100644
--- a/Source/ClassMap.php
+++ b/Source/ClassMap.php
@@ -25,7 +25,7 @@ class ClassMap extends Items implements MapInterface
      * Create interface to concrete references
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     public function createMap()
     {
@@ -46,7 +46,7 @@ public function createMap()
      * Save results of processing to files
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function saveOutput()
     {
diff --git a/Source/ClassMap/Aggregate.php b/Source/ClassMap/Aggregate.php
index 9106ffa..339fd3a 100644
--- a/Source/ClassMap/Aggregate.php
+++ b/Source/ClassMap/Aggregate.php
@@ -22,7 +22,7 @@ abstract class Aggregate extends Events
      * Determine Concrete Classes implement the Interface
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function finalizeItems()
     {
@@ -37,7 +37,7 @@ protected function finalizeItems()
      * Determine Concrete Classes implement the Interface
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setInterfaces()
     {
@@ -68,7 +68,7 @@ protected function setInterfaces()
      * @param   string $qns
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setInterfaceValues($interface, $qns)
     {
@@ -87,7 +87,7 @@ protected function setInterfaceValues($interface, $qns)
      * Determine Concrete Classes implement the Interface
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcretes()
     {
@@ -111,7 +111,7 @@ protected function setConcretes()
      * @param   object $parameter
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteConstructorValues($parameter)
     {
diff --git a/Source/ClassMap/Base.php b/Source/ClassMap/Base.php
index c3f243e..77ed494 100644
--- a/Source/ClassMap/Base.php
+++ b/Source/ClassMap/Base.php
@@ -25,7 +25,7 @@ abstract class Base
      * Class Map Array
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $classmap_files = array();
 
@@ -33,7 +33,7 @@ abstract class Base
      * Interfaces Filename
      *
      * @var    string
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $interface_classes_filename;
 
@@ -41,7 +41,7 @@ abstract class Base
      * Class Dependencies
      *
      * @var    string
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $concrete_classes_filename;
 
@@ -49,7 +49,7 @@ abstract class Base
      * Events
      *
      * @var    string
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $events_filename;
 
@@ -57,7 +57,7 @@ abstract class Base
      * Interfaces
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $interfaces = array();
 
@@ -65,7 +65,7 @@ abstract class Base
      * Interface Usage
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $interface_usage = array();
 
@@ -73,7 +73,7 @@ abstract class Base
      * Concretes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $concretes = array();
 
@@ -81,7 +81,7 @@ abstract class Base
      * Events
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $events = array();
 
@@ -89,19 +89,19 @@ abstract class Base
      * Base Path - root of the website from which paths are defined
      *
      * @var    string
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $base_path;
 
     /**
      * Constructor
      *
-     * @param  array   $class_maps
-     * @param  string  $interface_classes_filename
-     * @param  string  $concrete_classes_filename
-     * @param  string  $events_filename
+     * @param  array  $class_maps
+     * @param  string $interface_classes_filename
+     * @param  string $concrete_classes_filename
+     * @param  string $events_filename
      *
-     * @since  1.0
+     * @since  1.0.0
      */
     public function __construct(
         array $classmap_files = array(),
@@ -122,7 +122,7 @@ public function __construct(
      *
      * @param  string $qns
      *
-     * @since  1.0
+     * @since  1.0.0
      * @return object
      */
     protected function getReflectionObject($qns)
diff --git a/Source/ClassMap/Events.php b/Source/ClassMap/Events.php
index bf6a02f..899d36b 100644
--- a/Source/ClassMap/Events.php
+++ b/Source/ClassMap/Events.php
@@ -24,7 +24,7 @@ class Events extends Base
      * Events
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $events = array();
 
@@ -32,7 +32,7 @@ class Events extends Base
      * For each Interface, determine Concrete Classes which Implement the Interface and
      *  Requirements for a Concrete Class expressed by the Interface as a Type Hint in the Method Parameters
      *
-     * @since   1.0
+     * @since   1.0.0
      * @return  $this
      */
     protected function setEvents()
@@ -41,30 +41,30 @@ protected function setEvents()
 
         foreach ($this->concretes as $concrete) {
 
-                if (count($concrete->method) > 0) {
+            if (count($concrete->method) > 0) {
 
-                    foreach ($concrete->method as $method) {
+                foreach ($concrete->method as $method) {
 
-                        if ($this->testMethodForPlugin($concrete, $method) === true) {
+                    if ($this->testMethodForPlugin($concrete, $method) === true) {
 
-                            $class_instance = new \ReflectionClass($concrete->qns);
-                            $abstract       = $class_instance->isAbstract();
+                        $class_instance = new \ReflectionClass($concrete->qns);
+                        $abstract       = $class_instance->isAbstract();
 
-                            $reflectionMethod = new \ReflectionMethod(new $concrete->qns, $method);
-                            $results          = $reflectionMethod->getDeclaringClass();
+                        $reflectionMethod = new \ReflectionMethod(new $concrete->qns, $method);
+                        $results          = $reflectionMethod->getDeclaringClass();
 
-                            if ($results->name === $concrete->qns) {
-                                if (isset($this->events[$method])) {
-                                    $classes = $this->events[$method];
-                                } else {
-                                    $classes = array();
-                                }
-                                $classes[]             = $concrete->qns;
-                                $this->events[$method] = array_unique($classes);
+                        if ($results->name === $concrete->qns) {
+                            if (isset($this->events[$method])) {
+                                $classes = $this->events[$method];
+                            } else {
+                                $classes = array();
                             }
+                            $classes[]             = $concrete->qns;
+                            $this->events[$method] = array_unique($classes);
                         }
                     }
                 }
+            }
 
         }
 
@@ -78,7 +78,7 @@ protected function setEvents()
      * @param   string $method
      *
      * @return  boolean
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function testMethodForPlugin($concrete, $method)
     {
diff --git a/Source/ClassMap/Items.php b/Source/ClassMap/Items.php
index efb2361..6eaf789 100644
--- a/Source/ClassMap/Items.php
+++ b/Source/ClassMap/Items.php
@@ -25,7 +25,7 @@ class Items extends Aggregate
      * Loop through Class Map files and process as Interfaces or Concretes
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function processItems()
     {
@@ -56,7 +56,7 @@ protected function processItems()
      * @param   object $reflection
      *
      * @return  $class_object
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function initialiseObject($path, $reflection)
     {
@@ -86,7 +86,7 @@ protected function initialiseObject($path, $reflection)
      * @param   object $class_object
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setInterfaceClass($qns, $class_object)
     {
@@ -103,7 +103,7 @@ protected function setInterfaceClass($qns, $class_object)
      * @param   object $class_object
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteClass($qns, $reflection, $class_object)
     {
@@ -124,7 +124,7 @@ protected function setConcreteClass($qns, $reflection, $class_object)
      * @param   string $qns
      *
      * @return  $this;
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteInterfaces($reflection, $class_object, $qns)
     {
@@ -147,7 +147,7 @@ protected function setConcreteInterfaces($reflection, $class_object, $qns)
      * @param   string $qns
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteConstructorParameters($reflection, $class_object, $qns)
     {
@@ -187,7 +187,7 @@ protected function setConcreteConstructorParameters($reflection, $class_object,
      * @param   object $parameter
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function processDependencies($class_method_array, $parameter)
     {
@@ -224,7 +224,7 @@ protected function processDependencies($class_method_array, $parameter)
      * @param   array  $concretes
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteDependencyInterfaces($qns, array $dependencies)
     {
@@ -248,7 +248,7 @@ protected function setConcreteDependencyInterfaces($qns, array $dependencies)
      * @param   integer $type
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      */
     protected function setConcreteInterfaceRelationship($interface, $type = 0, $qns = '')
     {
diff --git a/Source/Configuration/AbstractAdapter.php b/Source/Configuration/AbstractAdapter.php
index 7d6460f..96ccb66 100644
--- a/Source/Configuration/AbstractAdapter.php
+++ b/Source/Configuration/AbstractAdapter.php
@@ -1,6 +1,6 @@
 dataobject = $dataobject;
-        $this->registry   = $registry;
-        $this->resource   = $resource;
-    }
+    protected $model_type;
 
     /**
-     * Load registry for requested model resource, returning name of registry collection
+     * Model Name
      *
-     * @param   string $model_type
-     * @param   string $model_name
-     * @param   object $xml
+     * @var    string
+     * @since  1.0.0
+     */
+    protected $model_name;
+
+    /**
+     * Model Registry
      *
-     * @return  string  Name of registry model
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @var    string
+     * @since  1.0.0
      */
-    public function getConfiguration($model_type, $model_name, $xml)
-    {
-        throw new RuntimeException('Configuration Xml Abstract Adapter - use subclass getConfiguration');
-    }
+    protected $model_registry;
 
     /**
-     * Store Configuration Data in Registry
+     * Xml
      *
-     * @param   string $model_registry
-     * @param   object $xml
+     * @var    object
+     * @since  1.0.0
+     */
+    protected $xml;
+
+    /**
+     * Valid Attributes
      *
-     * @return  array
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @var    array
+     * @since  1.0.0
      */
-    public function setModelRegistry($model_registry, $xml)
-    {
-        throw new RuntimeException('Configuration Xml Abstract Adapter - use subclass setModelRegistry');
-    }
+    protected $valid_attributes = array();
 
     /**
-     * Parse xml recursively, processing all include statements
+     * Constructor
      *
-     * @param   string $xml
+     * @param DataInterface     $data_object
+     * @param RegistryInterface $registry
+     * @param ResourceInterface $resource
      *
-     * @return  \SimpleXMLElement
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @since  1.0.0
      */
-    protected function getIncludeCode($xml)
-    {
-        $pre_string = $xml->asXML();
-
-        $done = false;
-
-        while ($done === false) {
-            $post_string = $this->getIncludeCodeLoop($pre_string);
-            if ($post_string === $pre_string) {
-                $done = true;
-            } else {
-                $pre_string = $post_string;
-            }
-        }
-
-        return simplexml_load_string($post_string);
+    public function __construct(
+        DataInterface $data_object,
+        RegistryInterface $registry,
+        ResourceInterface $resource
+    ) {
+        $this->data_object = $data_object;
+        $this->registry    = $registry;
+        $this->resource    = $resource;
     }
 
     /**
-     * Parse xml recursively, processing all include statements
+     * Load registry for requested model resource, returning name of registry collection
      *
+     * @param   string $model_type
+     * @param   string $model_name
+     * @param   object $xml
      *
      * @return  string
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @since   1.0.0
      */
-    protected function getIncludeCodeLoop($xml_string)
-    {
-        $pattern = '//';
-
-        preg_match_all($pattern, $xml_string, $matches);
+    abstract public function getConfiguration($model_type, $model_name, $xml);
 
-        $replace_this_array = $matches[0];
-        $type_array         = $matches[1];
-        $include_name_array = $matches[2];
-
-        if (count($replace_this_array) === 0) {
-            return $xml_string;
-        }
-
-        for ($i = 0; $i < count($replace_this_array); $i ++) {
-
-            $replace_this = $replace_this_array[$i];
-            $name         = $include_name_array[$i];
-
-            if (trim(strtolower($type_array[$i])) === 'field') {
-                $model_name = 'xml:///Molajo//Model//Fields//' . $name . '.xml';
-                $with_this  = $this->resource->get($model_name);
-            } else {
-                $model_name = 'xml:///Molajo//Model//Include//' . $name . '.xml';
-                $with_this  = $this->resource->get($model_name);
-            }
-
-            $xml_string = str_replace($replace_this, $with_this, $xml_string);
-        }
+    /**
+     * Set Model Names
+     *
+     * @param   string $model_type
+     * @param   string $model_name
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setModelNames($model_type, $model_name)
+    {
+        $this->model_type     = $model_type;
+        $this->model_name     = $model_name;
+        $this->model_registry = ucfirst(strtolower($this->model_name))
+            . ucfirst(strtolower($this->model_type));
 
-        return $xml_string;
+        return $this;
     }
 
     /**
-     * Define elements for Data Model to Registry
+     * Set Xml
      *
-     * @param   string $model_registry
      * @param   object $xml
-     * @param   string $plural
-     * @param   string $singular
-     * @param   string $valid_attributes
      *
-     * @return  bool
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  $this
+     * @since   1.0.0
      */
-    protected function setElementsRegistry($model_registry, $xml, $plural, $singular, $valid_attributes)
+    protected function setXml($xml)
     {
-        if (isset($xml->table->$plural->$singular)) {
-        } else {
-            return true;
-        }
-
-        $set = $xml->table->$plural;
-
-        $itemArray = array();
-
-        if (count($set->$singular) > 0) {
-
-            foreach ($set->$singular as $item) {
-
-                $attributes = get_object_vars($item);
-
-                $itemAttributes      = ($attributes["@attributes"]);
-                $itemAttributesArray = array();
-
-                if (count($itemAttributes) > 0) {
-
-                    foreach ($itemAttributes as $key => $value) {
-
-                        if (in_array($key, $valid_attributes)) {
-                        } else {
-                            throw new RuntimeException(
-                                'Configuration: setElementsRegistry encountered Invalid Model Attribute '
-                                . $key . ' for ' . $model_registry
-                            );
-                        }
-
-                        $itemAttributesArray[$key] = $value;
-                    }
-                }
-
-                if ($plural === 'plugins') {
-                    if (count($itemAttributesArray) > 0) {
-                        foreach ($itemAttributesArray as $plugin) {
-                            $itemArray[] = $plugin;
-                        }
-                    }
-                } else {
-                    $itemArray[] = $itemAttributesArray;
-                }
-            }
-        }
-
-        if ($plural === 'joins') {
-            $joins   = array();
-            $selects = array();
-
-            for ($i = 0; $i < count($itemArray); $i ++) {
-                $temp      = $this->setJoinFields($itemArray[$i]);
-                $joins[]   = $temp[0];
-                $selects[] = $temp[1];
-            }
-
-            $this->registry->set($model_registry, $plural, $joins);
-
-            $this->registry->set($model_registry, 'JoinFields', $selects);
-        } elseif ($plural === 'values') {
-
-            $valuesArray = array();
+        $this->xml = $xml;
 
-            if (count($itemArray) > 0) {
-
-                foreach ($itemArray as $value) {
-
-                    if (is_array($value)) {
-                        $temp_row = $value;
-                    } else {
-                        $valueVars = get_object_vars($value);
-                        $temp_row  = ($valueVars["@attributes"]);
-                    }
-
-                    $temp = new stdClass();
-
-                    $temp->id    = $temp_row['id'];
-                    $temp->value = $temp_row['value'];
-
-                    $valuesArray[] = $temp;
-                }
-
-                $this->registry->set($model_registry, 'values', $valuesArray);
-            }
-        } else {
-            $this->registry->set($model_registry, $plural, $itemArray);
-        }
-
-        return true;
+        return $this;
     }
 
     /**
-     * Process join field definitions for registry
-     *
-     * @param   array $modelJoinArray
+     * Create Registry and set model names
      *
-     * @return  array
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  $this
+     * @since   1.0.0
      */
-    protected function setJoinFields($modelJoinArray)
+    protected function createRegistry()
     {
-        $joinArray       = array();
-        $joinSelectArray = array();
-
-        $joinModel    = ucfirst(strtolower($modelJoinArray['model']));
-        $joinRegistry = $joinModel . 'Datasource';
+        $this->registry->createRegistry($this->model_registry);
 
-        if ($this->registry->exists($joinRegistry) === false) {
-            ;
-            $this->resource->get('xml:///Molajo//Model//Datasource//' . $joinModel . '.xml');
-        }
-
-        $fields = $this->registry->get($joinRegistry, 'Fields');
-
-        $table = $this->registry->get($joinRegistry, 'table_name');
+        $this->registry->set($this->model_registry, 'model_name', $this->model_name);
+        $this->registry->set($this->model_registry, 'model_type', $this->model_type);
+        $this->registry->set($this->model_registry, 'model_registry_name', $this->model_registry);
 
-        $joinArray['table_name'] = $table;
-
-        $alias = (string)$modelJoinArray['alias'];
-        if (trim($alias) === '') {
-            $alias = substr($table, 3, strlen($table));
-        }
-        $joinArray['alias'] = trim($alias);
-
-        $select              = (string)$modelJoinArray['select'];
-        $joinArray['select'] = $select;
-
-        $selectArray = explode(',', $select);
-
-        if ((int)count($selectArray) > 0) {
-
-            foreach ($selectArray as $s) {
-
-                foreach ($fields as $joinSelectArray) {
-                    if ($joinSelectArray['name'] === $s) {
-                        $joinSelectArray['as_name']    = trim($alias) . '_' . trim($s);
-                        $joinSelectArray['alias']      = $alias;
-                        $joinSelectArray['table_name'] = $table;
-                    }
-                }
-            }
-        }
-
-        $joinArray['jointo']   = (string)$modelJoinArray['jointo'];
-        $joinArray['joinwith'] = (string)$modelJoinArray['joinwith'];
-
-        return array($joinArray, $joinSelectArray);
+        return $this;
     }
 
     /**
-     * getCustomFields extracts field information for all customfield groups
+     * Set Model Registry for a specific element (ex. fields, joins, join_fields, etc.)
      *
-     * @param   string $model_registry
-     * @param   object $xml
+     * @param   string $key
+     * @param   mixed  $attributes
      *
-     * @return  object
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  $this
+     * @since   1.0.0
      */
-    protected function getCustomFields($model_registry, $xml)
+    protected function setModelRegistryElement($key, $verified)
     {
-        $customFieldsArray = array();
-
-        if (count($xml->customfields->customfield) > 0) {
-
-            foreach ($xml->customfields->customfield as $custom_field) {
-
-                $name    = (string)$custom_field['name'];
-                $results = $this->getCustomFieldsSpecificGroup($model_registry, $custom_field);
-                if ($results === false) {
-                } else {
-
-                    $fieldArray = $results[0];
-                    $fieldNames = $results[1];
-
-                    $this->inheritCustomFieldsSpecificGroup(
-                        $model_registry,
-                        $name,
-                        $fieldArray,
-                        $fieldNames
-                    );
-
-                    $customFieldsArray[] = $name;
-                }
-            }
-        }
+        $this->registry->set($this->model_registry, $key, $verified);
 
-        /** Include Inherited Groups not matching existing groups */
-        $exists = $this->registry->exists($model_registry, 'Customfieldgroups');
-
-        if ($exists === true) {
-            $inherited = $this->registry->get($model_registry, 'Customfieldgroups');
-
-            if (is_array($inherited) && count($inherited) > 0) {
-                foreach ($inherited as $name) {
-
-                    if (in_array($name, $customFieldsArray)) {
-                    } else {
-                        $results = $this->inheritCustomFieldsSpecificGroup($model_registry, $name);
-                        if ($results === false) {
-                        } else {
-                            $customFieldsArray[] = $name;
-                        }
-                    }
-                }
-            }
-        }
-
-        $this->registry->set($model_registry, 'Customfieldgroups', array_unique($customFieldsArray));
-
-        return;
+        return true;
     }
 
     /**
-     * Load Custom Fields for a specific Group -- this is called once for each custom field type for a Model
+     * Get Values for the specified attribute
      *
-     * @param   string $model_registry
-     * @param          $customfield
+     * @param   object $xml_extract
      *
-     * @return  array|bool
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  array
+     * @since   1.0.0
      */
-    protected function getCustomFieldsSpecificGroup($model_registry, $customfield)
+    protected function getAttributeValues($xml_extract)
     {
-        $fieldArray = array();
-        $fieldNames = array();
-
-        if (count($customfield) > 0) {
+        $values = array();
 
-            foreach ($customfield as $key1 => $value1) {
+        foreach ($xml_extract as $item) {
 
-                $attributes           = get_object_vars($value1);
-                $fieldAttributes      = ($attributes["@attributes"]);
-                $fieldAttributesArray = array();
+            $attributes      = get_object_vars($item);
+            $item_attributes = ($attributes["@attributes"]);
 
-                if (count($fieldAttributes) > 0) {
-                    foreach ($fieldAttributes as $key2 => $value2) {
-
-                        if ($key2 === 'fieldset') {
-                        } elseif (in_array($key2, $this->dataobject->get('valid_field_attributes'))) {
-                        } else {
-                            throw new RuntimeException(
-                                'Configuration: getCustomFieldsSpecificGroup Invalid Field attribute '
-                                . $key2 . ':' . $value2 . ' for ' . $model_registry
-                            );
-                        }
-
-                        if ($key2 === 'name') {
-                        } else {
-                            $fieldNames[] = $value2;
-                        }
-
-                        $fieldAttributesArray[$key2] = $value2;
-                    }
-                }
-
-                $fieldAttributesArray['field_inherited'] = 0;
-
-                $fieldArray[] = $fieldAttributesArray;
+            foreach ($item_attributes as $key => $value) {
+                $values[] = (string)$value;
             }
         }
 
-        if (is_array($fieldArray) && count($fieldArray) > 0) {
-        } else {
-            return false;
-        }
-
-        return array($fieldArray, $fieldNames);
+        return $values;
     }
 
     /**
-     * Inherited fields are merged in with those specifically defined in model
+     * Verify Attributes
      *
-     * @param   string $model_registry
-     * @param          $name
-     * @param          $fieldArray
-     * @param          $fieldNames
+     * @param   array $values
+     * @param   array $valid_attributes
      *
-     * @return array
-     * @since   1.0
+     * @return  $field
+     * @since   1.0.0
      */
-    protected function inheritCustomFieldsSpecificGroup(
-        $model_registry,
-        $name,
-        $fieldArray = array(),
-        $fieldNames = array()
-    ) {
-        $available = $this->registry->get($model_registry, $name, array());
-
-        if (count($available) > 0) {
-
-            foreach ($available as $temp_row) {
-
-                foreach ($temp_row as $field => $fieldvalue) {
-
-                    if ($field === 'name') {
+    protected function verifyAttributes($values)
+    {
+        $verified_attributes = array();
 
-                        if (in_array($fieldvalue, $fieldNames)) {
-                        } else {
-                            $temp_row['field_inherited'] = 1;
-                            $fieldArray[]                = $temp_row;
-                            $fieldNames[]                = $fieldvalue;
-                        }
-                    }
-                }
+        foreach ($this->valid_attributes as $attribute) {
+            if (isset($values[$attribute])) {
+                $verified_attributes[$attribute] = $values[$attribute];
             }
         }
 
-        if (is_array($fieldArray) && count($fieldArray) === 0) {
-            $this->registry->set($model_registry, $name, array());
-
-            return false;
-        }
-
-        $this->registry->set($model_registry, $name, $fieldArray);
-
-        return $name;
+        return $verified_attributes;
     }
 
     /**
-     * Inheritance checking and setup  
+     * Merge Field
      *
-     * @param   string $model_registry
-     * @param          $xml
+     * @param   string $key
+     * @param   array  $verified_attributes
      *
      * @return  $this
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @since   1.0.0
      */
-    protected function inheritDefinition($model_registry, $xml)
+    protected function mergeField($key, array $verified_attributes = array())
     {
-//echo 'MODELREGISTRY ' . $model_registry . '
'; -//echo '
';
-//var_dump($xml);
-
-        $extends = false;
-
-        if (count($xml->attributes()) > 0) {
-            foreach ($xml->attributes() as $key => $value) {
-                if ($key === 'extends') {
-                    $extends = (string)$value;
-                }
-            }
-        }
-        if ($extends === false) {
-            return $this;
-        }
-
-        $modelArray = $this->dataobject->get('valid_model_types');
-
-        $extends_model_name = '';
-        $extends_model_type = '';
-        if (count($modelArray) > 0) {
-
-            foreach ($modelArray as $modeltype) {
-                if (ucfirst(
-                        strtolower(substr($extends, strlen($extends) - strlen($modeltype), strlen($modeltype)))
-                    ) === $modeltype
-                ) {
-                    $extends_model_name = ucfirst(
-                        strtolower(substr($extends, 0, strlen($extends) - strlen($modeltype)))
-                    );
-                    $extends_model_type = $modeltype;
-                    break;
-                }
-            }
-        }
+        $existing = $this->registry->get($this->model_registry, $key);
 
-        if ($extends_model_name === '') {
-            $extends_model_name = ucfirst(strtolower($extends));
-            $extends_model_type = 'Datasource';
+        if (is_array($existing) && count($existing) > 0) {
+        } else {
+            return $verified_attributes;
         }
 
-        $inheritModelRegistry = $extends_model_name . $extends_model_type;
+        foreach ($verified_attributes as $key => $value) {
 
-        if ($this->registry->exists($inheritModelRegistry) === true) {
-        } else {
-            if ($extends_model_type === 'Datasource') {
-                $this->resource->get('xml:///Molajo//Model//Datasource//' . $extends_model_name . '.xml');
+            if (isset($existing[$key])) {
             } else {
-                $this->resource->get('xml:///Molajo//' . $extends_model_name . '//Content.xml');
+                $existing[$key] = $value;
             }
         }
 
-        $this->registry->copy($inheritModelRegistry, $model_registry);
-
-        return $this;
+        return $existing;
     }
 }
diff --git a/Source/Configuration/Children.php b/Source/Configuration/Children.php
new file mode 100644
index 0000000..5a2bf21
--- /dev/null
+++ b/Source/Configuration/Children.php
@@ -0,0 +1,72 @@
+valid_attributes = $this->data_object->get('valid_children_attributes');
+
+        if ($this->processChildren() === false) {
+            return $this;
+        }
+
+        $verified_attributes = array();
+
+        foreach ($this->xml->table->children->child as $xml_extract) {
+
+            $children        = array();
+            $attributes      = get_object_vars($xml_extract);
+            $item_attributes = ($attributes["@attributes"]);
+
+            foreach ($this->verifyAttributes($item_attributes) as $key => $value) {
+                $key            = strtolower($key);
+                $value          = strtolower($value);
+                $children[$key] = $value;
+            }
+
+            $verified_attributes[] = $children;
+        }
+
+        $this->setModelRegistryElement('children', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Children
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processChildren()
+    {
+        if (isset($this->xml->table->children->child) > 0) {
+        } else {
+            return false;
+        }
+
+        return true;
+    }
+}
diff --git a/Source/Configuration/Criteria.php b/Source/Configuration/Criteria.php
new file mode 100644
index 0000000..62b847b
--- /dev/null
+++ b/Source/Configuration/Criteria.php
@@ -0,0 +1,70 @@
+valid_attributes = $this->data_object->get('valid_criteria_attributes');
+
+        if ($this->processCriteria() === false) {
+            return $this;
+        }
+
+        $verified_attributes = array();
+
+        foreach ($this->xml->table->criteria->where as $xml_extract) {
+
+            $criteria = array();
+            $attributes      = get_object_vars($xml_extract);
+            $item_attributes = ($attributes["@attributes"]);
+
+            foreach ($this->verifyAttributes($item_attributes) as $key => $value) {
+                $criteria[$key] = $value;
+            }
+
+            $verified_attributes[] = $criteria;
+        }
+
+        $this->setModelRegistryElement('criteria', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Criteria
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processCriteria()
+    {
+        if (isset($this->xml->table->criteria->where) > 0) {
+        } else {
+            return false;
+        }
+
+        return true;
+    }
+}
diff --git a/Source/Configuration/Customfields.php b/Source/Configuration/Customfields.php
new file mode 100644
index 0000000..3d1331d
--- /dev/null
+++ b/Source/Configuration/Customfields.php
@@ -0,0 +1,107 @@
+processCustomfields() === false) {
+            return $this;
+        }
+
+        $this->valid_attributes = $this->data_object->get('valid_field_attributes');
+
+        $customfields = array();
+
+        foreach ($this->xml->customfields->customfield as $item) {
+
+            $attributes                  = get_object_vars($item);
+            $item_attributes             = ($attributes["@attributes"]);
+            $custom_field_group          = (string)$item_attributes['name'];
+            $this->custom_field_groups[] = $custom_field_group;
+            $custom_field_attributes     = ($attributes["field"]);
+
+            foreach ($custom_field_attributes as $field) {
+
+                $attributes          = get_object_vars($field);
+                $field_attributes    = ($attributes["@attributes"]);
+                $name                = $field_attributes['name'];
+                $customfield         = $this->resource->get('field:///' . $name);
+                $verified_attributes = $this->verifyAttributes($customfield);
+
+                $customfields[$name] = $verified_attributes;
+            }
+
+            $customfields = $this->mergeField($custom_field_group, $customfields);
+
+            ksort($customfields);
+
+            $this->setModelRegistryElement($custom_field_group, $customfields);
+        }
+
+        return $this;
+    }
+
+    /**
+     * Process all fields, filtering with valid attributes array
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setCustomfield($field, array $customfields = array())
+    {
+        $attributes          = get_object_vars($field);
+        $field_attributes    = ($attributes["@attributes"]);
+        $name                = $field_attributes['name'];
+        $customfield         = $this->resource->get('field:///' . $name);
+        $verified_attributes = $this->verifyAttributes($customfield);
+
+        $customfields[$name] = $verified_attributes;
+
+        return $this;
+    }
+
+    /**
+     * Process Custom Fields
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processCustomfields()
+    {
+        if (isset($this->xml->customfields->customfield)) {
+            return true;
+        }
+
+        return false;
+    }
+}
diff --git a/Source/Configuration/Data.php b/Source/Configuration/Data.php
index 0e994db..dbbe3b9 100644
--- a/Source/Configuration/Data.php
+++ b/Source/Configuration/Data.php
@@ -9,7 +9,7 @@
 namespace Molajo\Resource\Configuration;
 
 use CommonApi\Exception\RuntimeException;
-use Molajo\Resource\Api\ConfigurationDataInterface;
+use CommonApi\Resource\DataInterface;
 
 /**
  * Configuration Data
@@ -19,29 +19,29 @@
  * @copyright  2014-2015 Amy Stephen. All rights reserved.
  * @since      1.0.0
  */
-class Data implements ConfigurationDataInterface
+class Data implements DataInterface
 {
     /**
      * Valid Data Object Types
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
-    protected $valid_dataobject_types;
+    protected $valid_data_object_types;
 
     /**
      * Valid Data Object Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
-    protected $valid_dataobject_attributes;
+    protected $valid_data_object_attributes;
 
     /**
      * Valid Model Types
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_model_types;
 
@@ -49,7 +49,7 @@ class Data implements ConfigurationDataInterface
      * Valid Model Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_model_attributes;
 
@@ -57,7 +57,7 @@ class Data implements ConfigurationDataInterface
      * Valid Data Types
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_data_types;
 
@@ -65,7 +65,7 @@ class Data implements ConfigurationDataInterface
      * Valid Query Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_queryelements_attributes;
 
@@ -73,7 +73,7 @@ class Data implements ConfigurationDataInterface
      * Valid Field Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_field_attributes;
 
@@ -81,7 +81,7 @@ class Data implements ConfigurationDataInterface
      * Valid Join Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_join_attributes;
 
@@ -89,7 +89,7 @@ class Data implements ConfigurationDataInterface
      * Valid Foreignkey Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_foreignkey_attributes;
 
@@ -97,7 +97,7 @@ class Data implements ConfigurationDataInterface
      * Valid Criteria Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_criteria_attributes;
 
@@ -105,7 +105,7 @@ class Data implements ConfigurationDataInterface
      * Valid Children Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_children_attributes;
 
@@ -113,7 +113,7 @@ class Data implements ConfigurationDataInterface
      * Valid Plugin Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_plugin_attributes;
 
@@ -121,7 +121,7 @@ class Data implements ConfigurationDataInterface
      * Valid Value Attributes
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_value_attributes;
 
@@ -129,7 +129,7 @@ class Data implements ConfigurationDataInterface
      * Datalists
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $valid_datalists;
 
@@ -137,12 +137,12 @@ class Data implements ConfigurationDataInterface
      * List of Properties
      *
      * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $property_array
         = array(
-            'valid_dataobject_types',
-            'valid_dataobject_attributes',
+            'valid_data_object_types',
+            'valid_data_object_attributes',
             'valid_model_types',
             'valid_model_attributes',
             'valid_data_types',
@@ -161,59 +161,36 @@ class Data implements ConfigurationDataInterface
     /**
      * Constructor
      *
-     * @param   string $valid_dataobject_types
-     * @param   string $valid_dataobject_types
-     * @param   string $valid_dataobject_attributes
-     * @param   string $valid_model_types
-     * @param   string $valid_model_attributes
-     * @param   string $valid_data_types
-     * @param   string $valid_queryelements_attributes
-     * @param   string $valid_field_attributes
-     * @param   string $valid_join_attributes
-     * @param   string $valid_foreignkey_attributes
-     * @param   string $valid_criteria_attributes
-     * @param   string $valid_children_attributes
-     * @param   string $valid_plugin_attributes
-     * @param   string $valid_value_attributes
-     * @param   string $valid_field_attributes_default
-     * @param   string $valid_datalists
+     * @param   array $valid_array
      *
-     *
-     * @since   1.0
+     * @since   1.0.0
      */
     public function __construct(
-        $valid_dataobject_types,
-        $valid_dataobject_attributes,
-        $valid_model_types,
-        $valid_model_attributes,
-        $valid_data_types,
-        $valid_queryelements_attributes,
-        $valid_field_attributes,
-        $valid_join_attributes,
-        $valid_foreignkey_attributes,
-        $valid_criteria_attributes,
-        $valid_children_attributes,
-        $valid_plugin_attributes,
-        $valid_value_attributes,
-        $valid_field_attributes_default,
-        $valid_datalists
+        array $valid_array = array()
     ) {
+        $this->setClassProperties($valid_array);
+    }
+
+    /**
+     * Set Class Properties
+     *
+     * @param   array $valid_array
+     *
+     * @return  mixed
+     * @since   1.0.0
+     */
+    protected function setClassProperties(array $valid_array = array())
+    {
+        foreach ($this->property_array as $key) {
+
+            if (isset($valid_array[$key]) && is_array($valid_array[$key])) {
+                $this->$key = $valid_array[$key];
+            } else {
+                $this->$key = array();
+            }
+        }
 
-        $this->valid_dataobject_types         = $valid_dataobject_types;
-        $this->valid_dataobject_attributes    = $valid_dataobject_attributes;
-        $this->valid_model_types              = $valid_model_types;
-        $this->valid_model_attributes         = $valid_model_attributes;
-        $this->valid_data_types               = $valid_data_types;
-        $this->valid_queryelements_attributes = $valid_queryelements_attributes;
-        $this->valid_field_attributes         = $valid_field_attributes;
-        $this->valid_join_attributes          = $valid_join_attributes;
-        $this->valid_foreignkey_attributes    = $valid_foreignkey_attributes;
-        $this->valid_criteria_attributes      = $valid_criteria_attributes;
-        $this->valid_children_attributes      = $valid_children_attributes;
-        $this->valid_plugin_attributes        = $valid_plugin_attributes;
-        $this->valid_value_attributes         = $valid_value_attributes;
-        $this->valid_field_attributes_default = $valid_field_attributes_default;
-        $this->valid_datalists                = $valid_datalists;
+        return $this;
     }
 
     /**
@@ -223,7 +200,7 @@ public function __construct(
      * @param   mixed  $value
      *
      * @return  mixed
-     * @since   1.0
+     * @since   1.0.0
      * @throws  \CommonApi\Exception\RuntimeException
      */
     public function set($key, $value = null)
@@ -247,7 +224,7 @@ public function set($key, $value = null)
      * @param   mixed  $default
      *
      * @return  mixed
-     * @since   1.0
+     * @since   1.0.0
      * @throws  \CommonApi\Exception\RuntimeException
      */
     public function get($key, $default = null)
diff --git a/Source/Configuration/Dataobject.php b/Source/Configuration/Dataobject.php
index e53c431..225071d 100644
--- a/Source/Configuration/Dataobject.php
+++ b/Source/Configuration/Dataobject.php
@@ -1,6 +1,6 @@
 getIncludeCode($xml);
-        if ($xml === false) {
-            throw new RuntimeException(
-                'Configuration: getDataobject cannot process XML file for Model Type: '
-                . $model_type . ' Model Name: ' . $model_name
-            );
-        }
-
-        if (isset($xml->model)) {
-            $xml = $xml->model;
-        }
+        $this->setModelNames($model_type, $model_name);
+        $this->setXml($xml);
+        $this->getIncludeCode();
+        $this->createRegistry();
+        $this->setModelRegistry();
+        $this->registry->sort($this->model_registry);
 
-        $this->registry->createRegistry($model_registry);
+        return $this->registry->get($this->model_registry);
+    }
 
-        $this->setModelRegistry($model_registry, $xml);
+    /**
+     * Store Configuration Data in Registry
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setModelRegistry()
+    {
+        $this->setModelRegistryKeys($this->data_object->get('valid_data_object_attributes'));
 
-        $this->registry->sort($model_registry);
+        $this->registry->set($this->model_registry, 'data_object', 'data_object');
+        $this->registry->set($this->model_registry, 'model_type', 'data_object');
+        $this->registry->set($this->model_registry, 'model_name', $this->registry->get($this->model_registry, 'name'));
 
-        return $this->registry->getArray($model_registry);
+        return $this;
     }
 
     /**
-     * Store Configuration Data in Registry
+     * Set Model Registry Keys
      *
-     * @param   string $model_registry
-     * @param   object $xml
+     * @param   array $valid_array
      *
      * @return  $this
-     * @since   1.0
+     * @since   1.0.0
      * @throws  \CommonApi\Exception\RuntimeException
      */
-    public function setModelRegistry($model_registry, $xml)
+    protected function setModelRegistryKeys(array $valid_array = array())
     {
-        $doArray = $this->dataobject->get('valid_dataobject_attributes');
+        foreach ($this->xml->attributes() as $key => $value) {
+
+            if (in_array((string)$key, $valid_array)) {
+                $this->registry->set($this->model_registry, $key, (string)$value);
 
-        foreach ($xml->attributes() as $key => $value) {
-            if (in_array((string)$key, $doArray)) {
-                $this->registry->set($model_registry, $key, (string)$value);
             } else {
                 throw new RuntimeException(
-                    'Configuration: setDataobjectRegistry encountered Invalid Dataobject Attributes ' . $key
+                    'Configuration: setDataObjectRegistry encountered Invalid data_object Attributes ' . $key
                 );
             }
         }
 
-        $this->registry->set($model_registry, 'data_object', 'Dataobject');
-        $this->registry->set($model_registry, 'model_type', 'Dataobject');
-        $this->registry->set(
-            $model_registry,
-            'model_name',
-            $this->registry->get($model_registry, 'name')
-        );
-
         return $this;
     }
 }
diff --git a/Source/Configuration/Fields.php b/Source/Configuration/Fields.php
new file mode 100644
index 0000000..f3dba75
--- /dev/null
+++ b/Source/Configuration/Fields.php
@@ -0,0 +1,83 @@
+valid_attributes = $this->data_object->get('valid_field_attributes');
+
+        if ($this->processFields() === false) {
+            return $this;
+        }
+
+        $xml_extract         = $this->xml->table->fields->field;
+        $verified_attributes = array();
+
+        foreach ($this->getAttributeValues($xml_extract) as $name) {
+            $verified_attributes = $this->addField($name, $verified_attributes);
+        }
+
+        $verified_attributes = $this->mergeField('fields', $verified_attributes);
+
+        ksort($verified_attributes);
+
+        $this->setModelRegistryElement('fields', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Fields
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processFields()
+    {
+        if (isset($this->xml->table->fields->field)) {
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Add Field Definition
+     *
+     * @param   string $name
+     * @param   array  $verified_attributes
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function addField($name, array $verified_attributes = array())
+    {
+        $field = $this->resource->get('field:///' . $name);
+
+        $verified_attributes[$name] = $this->verifyAttributes($field);
+
+        return $verified_attributes;
+    }
+}
diff --git a/Source/Configuration/Foreignkeys.php b/Source/Configuration/Foreignkeys.php
new file mode 100644
index 0000000..2be482c
--- /dev/null
+++ b/Source/Configuration/Foreignkeys.php
@@ -0,0 +1,242 @@
+processForeignkeys() === false) {
+            return $this;
+        }
+
+        $verified_attributes = array();
+
+        $foreignkeys = $this->getForeignkeys();
+
+        foreach ($foreignkeys as $foreignkey) {
+            $verified_attributes[] = $this->verifyAttributes($foreignkey, $valid_attributes);
+        }
+
+        $this->setModelRegistryElement('Foreignkeys', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Foreignkeys
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processForeignkeys()
+    {
+        if (isset($this->xml->foreignkeys->foreignkey)) {
+        } else {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Get names of standard fields
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function getForeignkeys()
+    {
+        $foreignkeys = array();
+
+        foreach ($this->xml->table->foreignkeys->foreignkey as $item) {
+            $attributes      = get_object_vars($item);
+            $item_attributes = ($attributes["@attributes"]);
+            foreach ($item_attributes as $key => $value) {
+                $foreignkeys[] = (string)$value;
+            }
+        }
+
+        return $foreignkeys;
+    }
+
+    /**
+     * Process foreignkey field definitions for registry
+     *
+     * @param   array $model_foreignkey_array
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function processForeignkey(array $model_foreignkey_array = array())
+    {
+        $this->initialiseForeignkeyFields($model_foreignkey_array);
+
+        $this->foreignkey_registry = $this->registry->get(
+            $this->foreignkey_model_type,
+            $this->foreignkey_model_name
+        );
+
+        $this->setForeignkeyArray($model_foreignkey_array);
+        $this->setForeignkeyFieldsArray($model_foreignkey_array);
+        $this->setForeignkeySelectFieldsArray($model_foreignkey_array);
+
+        $this->setModelRegistryElement('Foreignkeys', $this->foreignkey_array);
+        $this->setModelRegistryElement('ForeignkeyFields', $this->foreignkey_select_array);
+
+        return $this;
+    }
+
+    /**
+     * Initialise Foreignkey Fields
+     *
+     * @param   array $model_foreignkey_array
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function initialiseForeignkeyFields(array $model_foreignkey_array = array())
+    {
+        $this->foreignkey_model_type   = 'Datasource';
+        $this->foreignkey_model_name   = ucfirst(strtolower($model_foreignkey_array['model']));
+        $this->foreignkey_registry     = array();
+        $this->foreignkey_array        = array();
+        $this->foreignkey_select_array = array();
+
+        return $this;
+    }
+
+    /**
+     * Initialise Foreignkey Fields
+     *
+     * @param   array $model_foreignkey_array
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function setForeignkeyArray(array $model_foreignkey_array = array())
+    {
+        $this->foreignkey_array['table_name'] = $this->foreignkey_registry['table_name'];
+
+        $alias = $model_foreignkey_array['alias'];
+        if (trim($alias) === '') {
+            $alias = $this->foreignkey_registry['alias'];
+        }
+        $this->foreignkey_array['alias'] = trim($alias);
+
+        $this->foreignkey_array['select'] = $model_foreignkey_array['select'];
+
+        return $this;
+    }
+
+    /**
+     * Set Foreignkey to and Foreignkey from in Foreignkey Array
+     *
+     * @param   array $model_foreignkey_array
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setForeignkeyFieldsArray(array $model_foreignkey_array = array())
+    {
+        $this->foreignkey_array['foreignkey_to']   = $model_foreignkey_array['foreignkey_to'];
+        $this->foreignkey_array['foreignkey_with'] = $model_foreignkey_array['foreignkey_with'];
+
+        return $this;
+    }
+
+    /**
+     * Set Foreignkey Select Fields Array
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setForeignkeySelectFieldsArray()
+    {
+        $select_array = explode(',', $this->foreignkey_array['select']);
+
+        if ((int)count($select_array) === 0) {
+            return $this;
+        }
+
+        foreach ($select_array as $s) {
+
+            foreach ($this->foreignkey_registry['Fields'] as $field) {
+
+                if ($field['name'] === $s) {
+                    $select_field               = array();
+                    $select_field['name']       = trim($s);
+                    $select_field['as_name']    = trim($this->foreignkey_array['alias'] . '_' . trim($s));
+                    $select_field['alias']      = $this->foreignkey_array['alias'];
+                    $select_field['table_name'] = $this->foreignkey_array['table_name'];
+
+                    $this->foreignkey_select_array[$s] = $select_field;
+                }
+            }
+        }
+
+        return $this;
+    }
+}
diff --git a/Source/Configuration/Includes.php b/Source/Configuration/Includes.php
new file mode 100644
index 0000000..fa39b6d
--- /dev/null
+++ b/Source/Configuration/Includes.php
@@ -0,0 +1,94 @@
+xml->asXML();
+        $post_string = '';
+        $done        = false;
+
+        while ($done === false) {
+
+            $post_string = $this->getIncludeCodeLoop($pre_string);
+
+            if ($post_string === $pre_string) {
+                $done = true;
+            } else {
+                $pre_string = $post_string;
+            }
+        }
+
+        $this->xml = simplexml_load_string($post_string);
+
+        if (isset($this->xml->model)) {
+            $this->xml = $this->xml->model;
+        }
+
+        return $this;
+    }
+
+    /**
+     * Process all include statements currently in XML
+     *
+     * @param   string $xml_string
+     *
+     * @return  string
+     * @since   1.0.0
+     */
+    protected function getIncludeCodeLoop($xml_string)
+    {
+        $pattern = '//';
+
+        preg_match_all($pattern, $xml_string, $matches);
+
+        $replace_this_array = $matches[0];
+        $type_array         = $matches[1];
+        $include_name_array = $matches[2];
+
+        if (count($replace_this_array) === 0) {
+            return $xml_string;
+        }
+
+        for ($i = 0; $i < count($replace_this_array); $i++) {
+
+            $replace_this = $replace_this_array[$i];
+            $name         = $include_name_array[$i];
+
+            if (trim(strtolower($type_array[$i])) === 'field') {
+                $model_name          = $name;
+                $with_this           = '';
+
+            } else {
+                $model_name = 'xml:///Molajo//Model//Include//' . $name . '.xml';
+                $with_this  = $this->resource->get($model_name);
+            }
+
+            $xml_string = str_replace($replace_this, $with_this, $xml_string);
+        }
+
+        return $xml_string;
+    }
+}
diff --git a/Source/Configuration/Inherit.php b/Source/Configuration/Inherit.php
new file mode 100644
index 0000000..d700f96
--- /dev/null
+++ b/Source/Configuration/Inherit.php
@@ -0,0 +1,236 @@
+
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function inheritDefinition()
+    {
+        if ($this->processInheritance() === false) {
+            return $this;
+        };
+
+        $this->extends_model_type = '';
+        $this->extends_model_name = '';
+
+        $model_types = $this->data_object->get('valid_model_types');
+
+        foreach ($model_types as $model_type) {
+
+            $this->processModelType($model_type);
+
+            if ($this->extends_model_name === '') {
+            } else {
+                break;
+            }
+        }
+
+        if ($this->extends_model_name === '') {
+            $this->extends_model_name = ucfirst(strtolower($this->extends));
+            $this->extends_model_type = 'Datasource';
+        }
+
+        $inherited_model = $this->getInheritedModel();
+
+        $this->copyInheritedModel($inherited_model);
+
+        return $this;
+    }
+
+    /**
+     * Was inheritance used?  
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processInheritance()
+    {
+        if (count($this->xml->attributes()) === 0) {
+            return false;
+        }
+
+        foreach ($this->xml->attributes() as $key => $value) {
+            if ($key === 'extends') {
+                $this->extends = (string)$value;
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /**
+     * Match to a valid Model Type
+     *
+     * @param   string $model_type
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function processModelType($model_type)
+    {
+        if (ucfirst(
+                strtolower(substr($this->extends, strlen($this->extends)
+                        - strlen($model_type), strlen($model_type))
+                )
+            ) === $model_type
+        ) {
+            $this->extends_model_name = ucfirst(strtolower(
+                    substr($this->extends,
+                        0,
+                        strlen($this->extends) - strlen($model_type))
+                )
+            );
+            $this->extends_model_type = $model_type;
+        }
+
+        return $this;
+    }
+
+    /**
+     * Get Inherited Model
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function getInheritedModel()
+    {
+        $inherit_model_registry = $this->extends_model_name . $this->extends_model_type;
+
+        if ($this->registry->exists($inherit_model_registry) === true) {
+            $inherited_model = $this->registry->get($inherit_model_registry);
+
+        } else {
+
+            if ($this->extends_model_type === 'Datasource') {
+                $get_namespace = 'Molajo//Model//Datasource//' . $this->extends_model_name . '.xml';
+            } else {
+                $get_namespace = 'Molajo//Resource//' . $this->extends_model_name . '//Content.xml';
+            }
+
+            $inherited_model = $this->resource->get('xml:///' . $get_namespace);
+        }
+
+        return $inherited_model;
+    }
+
+    /**
+     * Copy Inherited Model
+     *
+     * @param   array $inherited_model
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function copyInheritedModel(array $inherited_model = array())
+    {
+        if (count($inherited_model) === 0) {
+            return $this;
+        }
+
+        foreach ($inherited_model as $key => $value) {
+
+            if ($this->registry->exists($this->model_registry, $key) === true) {
+                $this->mergeInheritedModel($key, $value);
+            } else {
+                $this->setModelRegistryElement($key, $value);
+            }
+        }
+
+        $this->copyCustomfieldGroups($inherited_model);
+
+        return $this;
+    }
+
+    /**
+     * Copy Inherited Model
+     *
+     * @param   array $inherited_model
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function copyCustomfieldGroups(array $inherited_model = array())
+    {
+        if (isset($inherited_model['customfieldgroups'])) {
+        } else {
+            return $this;
+        }
+        $customfieldgroups = $inherited_model['customfieldgroups'];
+
+        if (is_array($customfieldgroups) && count($customfieldgroups) > 0) {
+        } else {
+            return $this;
+        }
+
+        foreach ($customfieldgroups as $group) {
+            $this->custom_field_groups[] = $group;
+        }
+
+        return $this;
+    }
+
+    /**
+     * Merge Inherited Model Values into existing for Arrays
+     *
+     * @param   string $key
+     * @param   mixed  $value
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function mergeInheritedModel($key, $value)
+    {
+        $existing_value = $this->registry->get($this->model_registry, $key);
+
+        if (is_array($existing_value)) {
+            $this->mergeField($key, $value);
+        }
+
+        return $this;
+    }
+}
diff --git a/Source/Configuration/Joins.php b/Source/Configuration/Joins.php
new file mode 100644
index 0000000..566dd27
--- /dev/null
+++ b/Source/Configuration/Joins.php
@@ -0,0 +1,88 @@
+valid_attributes = $this->data_object->get('valid_join_attributes');
+
+        if ($this->processJoins() === false) {
+            return $this;
+        }
+
+        $verified_attributes = $this->getJoins();
+
+        $verified_attributes = $this->mergeField('joins', $verified_attributes);
+
+        $this->setModelRegistryElement('Joins', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Joins
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processJoins()
+    {
+        if (isset($this->xml->table->joins)) {
+        } else {
+            return false;
+        }
+
+        if (isset($this->xml->table->joins->join)) {
+        } else {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Get names of standard fields
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function getJoins()
+    {
+        $join  = array();
+        $joins = array();
+
+        foreach ($this->xml->table->joins->join as $item) {
+            $attributes      = get_object_vars($item);
+            $item_attributes = ($attributes["@attributes"]);
+            foreach ($item_attributes as $key => $value) {
+                $join[$key] = (string)$value;
+            }
+            $joins[] = $join;
+            $join    = array();
+        }
+
+        return $joins;
+    }
+}
diff --git a/Source/Configuration/Model.php b/Source/Configuration/Model.php
index fc58efc..6b61016 100644
--- a/Source/Configuration/Model.php
+++ b/Source/Configuration/Model.php
@@ -1,6 +1,6 @@
 getIncludeCode($xml);
-        if ($xml === false) {
-            throw new RuntimeException(
-                'Configuration: getDataobject cannot process XML file for Model Type: '
-                . $model_type . ' Model Name: ' . $model_name
-            );
-        }
-
-        if (isset($xml->model)) {
-            $xml = $xml->model;
+        /** Initialise and create model registry */
+        $this->custom_field_groups = array();
+        $this->setModelNames($model_type, $model_name);
+        $this->setXml($xml);
+        $this->createRegistry();
+        $this->getIncludeCode();
+        $this->setModelRegistry();
+
+        /** Expand, given inheritance and set data object */
+        $this->inheritDefinition();
+        $this->setDataObject();
+
+        /** Define Elements */
+        foreach ($this->set_registry_methods as $method) {
+            $this->$method();
         }
 
-        $this->registry->createRegistry($model_registry);
+        /** Finalize */
+        $this->setCustomfieldsElement();
 
-        $this->inheritDefinition($model_registry, $xml);
+        /** Sort and Return */
+        $this->registry->sort($this->model_registry);
+        $registry = $this->registry->get($this->model_registry);
 
-        $this->setModelRegistry($model_registry, $xml);
+        return $this->unsetFields($registry);
+    }
 
-        $this->registry->set($model_registry, 'model_name', $model_name);
-        $this->registry->set($model_registry, 'model_type', $model_type);
-        $this->registry->set($model_registry, 'model_registry_name', $model_registry);
+    /**
+     * Store Configuration Data in Registry
+     *
+     * @return  array
+     * @since   1.0.0
+     */
+    protected function setModelRegistry()
+    {
+        $model_array = $this->data_object->get('valid_model_attributes');
 
-        $data_object = $this->registry->get($model_registry, 'data_object', '');
+        foreach ($this->xml->attributes() as $key => $value) {
 
-        if ($data_object === '') {
-            $data_object = 'Database';
-            $this->registry->set($model_registry, 'data_object', $data_object);
+            if (in_array($key, $model_array)) {
+                $this->registry->set($this->model_registry, $key, (string)$value);
+            } else {
+                throw new RuntimeException(
+                    'Configuration: setModelRegistry encountered Invalid Model Attribute ' . $key
+                );
+            }
         }
 
-        $dataObjectRegistry = ucfirst(strtolower($data_object)) . 'Dataobject';
+        $name = $this->registry->get($this->model_registry, 'name');
 
-        if ($this->registry->exists($dataObjectRegistry)) {
-        } else {
-            $this->resource->get('xml:///Molajo//Model//Dataobject//' . ucfirst(strtolower($data_object)) . '.xml');
-        }
+        $this->registry->set($this->model_registry, 'model_name', $name);
 
-        foreach ($this->registry->get($dataObjectRegistry) as $key => $value) {
-            $this->registry->set($model_registry, 'data_object_' . $key, (string)$value);
-        }
+        return $this;
+    }
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'fields',
-            'field',
-            $this->dataobject->get('valid_field_attributes')
-        );
+    /**
+     * Set Data Object
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setDataObject()
+    {
+        $data_object = $this->registry->get($this->model_registry, 'data_object', '');
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'joins',
-            'join',
-            $this->dataobject->get('valid_join_attributes')
-        );
+        if ($data_object === '') {
+            return $this;
+        }
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'foreignkeys',
-            'foreignkey',
-            $this->dataobject->get('valid_foreignkey_attributes')
-        );
+        $data_object_registry = ucfirst(strtolower($data_object)) . 'Dataobject';
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'criteria',
-            'where',
-            $this->dataobject->get('valid_criteria_attributes')
-        );
+        if ($this->registry->exists($data_object_registry)) {
+            $results = $this->registry->get($data_object_registry);
+        } else {
+            $results = $this->resource->get('xml:///Molajo//Model//Dataobject//'
+                . ucfirst(strtolower($data_object)) . '.xml');
+        }
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'children',
-            'child',
-            $this->dataobject->get('valid_children_attributes')
-        );
+        foreach ($results as $key => $value) {
+            $this->registry->set($this->model_registry, 'data_object_' . $key, $value);
+        }
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'plugins',
-            'plugin',
-            $this->dataobject->get('valid_plugin_attributes')
-        );
+        return $this;
+    }
 
-        $this->setElementsRegistry(
-            $model_registry,
-            $xml,
-            'values',
-            'value',
-            $this->dataobject->get('valid_value_attributes')
-        );
+    /**
+     * Set Data Object
+     *
+     * @return  string
+     * @since   1.0.0
+     */
+    protected function setDefaultDataobject()
+    {
+        $data_object = 'Database';
 
-        $this->getCustomFields($model_registry, $xml);
+        $this->registry->set($this->model_registry, 'data_object', $data_object);
 
-        return $this->registry->getArray($model_registry);
+        return $data_object;
     }
 
     /**
-     * Store Configuration Data in Registry
+     * Set Data Object
      *
-     * @param   string $model_registry
-     * @param   object $xml
+     * @param   array $registry
      *
-     * @return  null|Model
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  string
+     * @since   1.0.0
      */
-    public function setModelRegistry($model_registry, $xml)
+    protected function unsetFields($registry)
     {
-        $modelArray = $this->dataobject->get('valid_model_attributes');
-
-        foreach ($xml->attributes() as $key => $value) {
-
-            if (in_array($key, $modelArray)) {
-                $this->registry->set($model_registry, $key, (string)$value);
-            } else {
-                echo '
';
-                var_dump($key);
-
-                echo '
';
-                var_dump($xml);
-
-                echo 'Going to throw Exception in ModelHandler setModelRegistry';
-                die;
-                throw new RuntimeException(
-                    'Configuration: setModelRegistry encountered Invalid Model Attribute ' . $key
-                );
-            }
+        if (isset($registry['extends'])) {
+            unset($registry['extends']);
         }
 
-        $this->registry->set(
-            $model_registry,
-            'model_name',
-            $this->registry->get($model_registry, 'name')
-        );
+        return $registry;
+    }
+
+    /**
+     * Set Custom Fields Element
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    protected function setCustomfieldsElement()
+    {
+        $groups = array_unique($this->custom_field_groups);
+        sort($groups);
+        $this->setModelRegistryElement('customfieldgroups', $groups);
 
         return $this;
     }
diff --git a/Source/Configuration/Plugins.php b/Source/Configuration/Plugins.php
new file mode 100644
index 0000000..e4da3cd
--- /dev/null
+++ b/Source/Configuration/Plugins.php
@@ -0,0 +1,64 @@
+valid_attributes = $this->data_object->get('valid_plugin_attributes');
+
+        if ($this->processPlugins() === false) {
+            return $this;
+        }
+
+        $verified_attributes = array();
+
+        foreach ($this->xml->table->plugins->plugin as $xml_extract) {
+            $attributes            = get_object_vars($xml_extract);
+            $item_attributes       = ($attributes["@attributes"]);
+            $plugin                = $this->verifyAttributes($item_attributes);
+            $verified_attributes[] = $plugin['name'];
+        }
+
+        $this->setModelRegistryElement('plugins', $verified_attributes);
+
+        return $this;
+    }
+
+    /**
+     * Process Plugins
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    protected function processPlugins()
+    {
+        if (isset($this->xml->table->plugins->plugin) > 0) {
+        } else {
+            return false;
+        }
+
+        return true;
+    }
+}
diff --git a/Source/Configuration/Registry.php b/Source/Configuration/Registry.php
index 738a226..d2991ca 100644
--- a/Source/Configuration/Registry.php
+++ b/Source/Configuration/Registry.php
@@ -8,11 +8,10 @@
  */
 namespace Molajo\Resource\Configuration;
 
-use CommonApi\Exception\RuntimeException;
-use Molajo\Resource\Api\RegistryInterface;
+use CommonApi\Resource\RegistryInterface;
 
 /**
- * Named pair storage by Namespace with local or global persistence
+ * Registry - case insensitive names named pairs
  *
  * @author     Amy Stephen
  * @license    http://www.opensource.org/licenses/mit-license.html MIT License
@@ -22,54 +21,27 @@
 class Registry implements RegistryInterface
 {
     /**
-     * Array containing namespace registry keys
+     * Array containing registries and data
      *
      * @var    array
-     * @since  1.0
-     */
-    protected $registryKeys = array();
-
-    /**
-     * Array containing namespace locks
-     *
-     * @var    array
-     * @since  1.0
-     */
-    protected $registryLocks = array();
-
-    /**
-     * Array containing all namespace registries and associated data
-     *
-     * @var    array
-     * @since  1.0
+     * @since  1.0.0
      */
     protected $registry = array();
 
     /**
-     * Does it exist? Useful for verifying existence of namespace and/or namespace element.
-     *  Note: Does not create the namespace or member, simply tests if it has already been created.
+     * Verifies if registry, or registry key, exists
      *
-     * Usage:
-     * $this->registry->exists('Namespace', 'Optional member');
+     * @param   string      $name
+     * @param   NULL|string $key
      *
-     * @param   string      $namespace
-     * @param   null|string $key (optional)
-     *
-     * @return  bool
-     * @since   1.0
+     * @return  boolean
+     * @since   1.0.0
      */
-    public function exists($namespace, $key = null)
+    public function exists($name, $key = null)
     {
-        $namespace = $this->editNamespace($namespace);
+        list($name, $key) = $this->initialiseNameKey($name, $key);
 
-        $namespaces = $this->registryKeys;
-        if (is_array($namespaces)) {
-        } else {
-            return false;
-        }
-
-        if (in_array($namespace, $namespaces)) {
-        } else {
+        if ($this->existsName($name) === false) {
             return false;
         }
 
@@ -77,934 +49,167 @@ public function exists($namespace, $key = null)
             return true;
         }
 
-        $thisNamespace = $this->registry[$namespace];
-        if (count($thisNamespace) === 0) {
-            return false;
-        }
-
-        $key = strtolower($key);
-        if (isset($thisNamespace[$key])) {
-            return true;
-        }
-
-        return false;
-    }
-
-    /**
-     * Lock registry from update.
-     *
-     * Usage:
-     * $this->registry->lock('Namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  bool
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
-     */
-    public function lock($namespace)
-    {
-        $namespace = $this->editNamespace($namespace);
-
-        if ($this->exists($namespace)) {
-        } else {
-            throw new RuntimeException(
-                'Registry: Namespace in Lock Request does not exist.'
-            );
-        }
-
-        $this->registryLocks[$namespace] = true;
-
-        return true;
-    }
-
-    /**
-     * Check to see if a registry is locked
-     *
-     * Usage:
-     * $this->registry->checkLock('Namespace');
-     *
-     * @param   string $namespace
-     *
-     * @return  bool    true - lock is on
-     *                  false - there is no lock (and possibly no registry, either)
-     * @since           1.0
-     * @throws  \CommonApi\Exception\RuntimeException
-     */
-    public function checkLock($namespace)
-    {
-        $namespace = $this->editNamespace($namespace);
-        if ($this->exists($namespace)) {
-        } else {
-            return false;
-        }
-
-        if (isset($this->registryLocks[$namespace])) {
-            return true;
-        }
-
-        return false;
+        return $this->existsNameKey($name, $key);
     }
 
     /**
-     * Create a registry for the specified namespace
+     * Create a registry
      *
-     * Notes:
-     * - All namespaces are set to lowercase to remove case sensitivity
-     * - Throws exception if Registry Namespace is reserved
-     * - Returns Namespace if already existing (use 'exists' if verification is needed prior to createRegistry)
-     * - Called automatically when needed by a Set Request
+     * @param   string $name
      *
-     * Usage:
-     *  $this->registry->createRegistry('Name Space');
-     *
-     * @param   string $namespace
-     *
-     * @return  mixed|bool|array
-     * @since   1.0
-     * @throws  \CommonApi\Exception\RuntimeException
+     * @return  array
+     * @since   1.0.0
      */
-    public function createRegistry($namespace)
+    public function createRegistry($name)
     {
-        $namespace = $this->editNamespace($namespace);
+        $name = strtolower($name);
 
-        if ($this->exists($namespace)) {
-
-            if (isset($this->registryKeys[$namespace])) {
-                throw new RuntimeException(
-                    'Registry: Cannot create Namespace ' . $namespace . ' because it already exists.'
-                );
-            } else {
-                return $this->registry[$namespace];
-            }
-        }
+        $this->registry[$name] = array();
 
-        if ($namespace === 'db' || $namespace === '*') {
-            throw new RuntimeException(
-                'Registry: Namespace ' . $namespace . ' is a reserved word.'
-            );
-        }
-
-        if (isset($this->registryKeys[$namespace])) {
-            return $this->registry[$namespace];
-        }
-
-        $this->registryKeys[] = $namespace;
-
-        $this->registry[$namespace] = array();
-
-        /** Returns new registry */
-        return $this->registry[$namespace];
+        return $this->registry[$name];
     }
 
     /**
-     * Returns Registry Data
-     *
-     * Notes:
-     * - Creates registry member using default if not existing and default provided
-     * - Creates registry if not existing (whether or not a member was created)
-     *
-     * Usage:
-     * $this->registry->get('Name Space', 'key value');
-     *
-     * List names of existing registry namespaces:
-     * echo $this->registry->get('*');
+     * Get Registry Data
      *
-     * ... include a formatted dump of namespace contents
-     * echo $this->registry->get('*', '*');
-     *
-     * List all entries in the specified registry namespace
-     * $array = $this->registry->get('Name space');
-     *
-     * List only those namespace entries beginning with the wildcard value:
-     * echo $this->registry->get('Name space', 'theme*');
-     *
-     * @param   string $namespace
+     * @param   string $name
      * @param   string $key
-     * @param   mixed  $default
-     *
-     * @return  array|bool|mixed
-     * @since   1.0
-     */
-    public function get($namespace = null, $key = null, $default = null)
-    {
-        $namespace = $this->editNamespace($namespace);
-        $key       = $this->editNamespaceKey($namespace, $key);
-
-        if ($this->exists($namespace) === true) {
-        } else {
-            if ($namespace === '*') {
-            } else {
-                return false;
-            }
-        }
-
-        if ($namespace === '*') {
-            if ($key === null) {
-                return $this->listRegistry(false);
-            } else {
-                return $this->listRegistry(true);
-            }
-        } elseif ($key === null) {
-            return $this->getRegistry($namespace);
-        } elseif ($key === '*' || strrpos($key, '*')) {
-            $sort = $this->getRegistry($namespace);
-
-            if ($key === '*') {
-                $selected = $sort;
-            } else {
-                //@todo - combine all the wildcard logic
-                if (substr($key, 0, 1) === '*') {
-                    $selected  = array();
-                    $searchfor = substr($key, 1, (strrpos($key, '*') - 1));
-                    foreach ($sort as $key => $value) {
-                        if ($key === $searchfor) {
-                            $match = true;
-                        } else {
-                            $match = strpos($key, $searchfor);
-                        }
-                        if ($match) {
-                            $selected[$key] = $value;
-                        }
-                    }
-                } else {
-                    $selected = array();
-
-                    $searchfor = substr($key, 0, strrpos($key, '*'));
-
-                    foreach ($sort as $key => $value) {
-                        $match = substr($key, 0, strlen($searchfor));
-                        if (strtolower($match) === strtolower($searchfor)) {
-                            $selected[$key] = $value;
-                        }
-                    }
-                }
-            }
-
-            if ($key === '*') {
-                echo '
';
-                var_dump($selected);
-                echo '
'; - } else { - return $selected; - } - - return true; - } - - if (in_array($namespace, $this->registryKeys)) { - $array = $this->registry[$namespace]; - $namespace_exists = true; - } else { - $array = array(); - $namespace_exists = false; - } - - /** Existing named pair returned */ - if (isset($array[$key])) { - return $array[$key]; - } - - /** Not found and no create member requested */ - if ($default === null) { - return false; - } - - /** Create Registry and Member if needed and member default provided */ - if ($namespace_exists) { - } else { - $this->createRegistry($namespace); - } - - $array[$key] = $default; - $this->registry[$namespace] = $array; - - return $array[$key]; - } - - /** - * Sets the value for a specific namespace item - * - * Usage: - * $this->registry->set('Name Space', 'key_name', $value); - * - * @param string $namespace - * @param string $key - * @param mixed $value - * @param boolean $match - used as a security precaution to ensure only named parameters - * are updated via statement overrides - * - * @return void|bool|Registry - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function set($namespace, $key, $value = null, $match = false) - { - $namespace = $this->editNamespace($namespace); - - if ($this->checkLock($namespace)) { - throw new RuntimeException( - 'Registry: Namespace is locked. Updates are not allowed.' - ); - } - - $key = $this->editNamespaceKey($namespace, $key); - - if ($namespace === '') { - throw new RuntimeException( - 'Registry: Namespace is required for Set.' - ); - } - - if ($key === '') { - throw new RuntimeException( - 'Registry: Key is required for Set. Namespace: ' . $namespace - ); - } - - /** Match requirement for security to ensure only named parameters are updated */ - if ($match === true) { - $exists = $this->exists($namespace, $key); - if ($exists === false) { - return false; - } - } - - $array = $this->getRegistry($namespace); - - $array[$key] = $value; - - $this->registry[$namespace] = $array; - - return $this; - } - - /** - * Copy key values from one namespace registry into another, overwriting existing values * - * Note: - * If target_registry already exists, source_registry values replace existing values for matching keys - * Key pairs on target registry remain unchanged if there are no matching pairs. Use Delete first, if desired. - * Use merge when target registry values should remain -- not be overwritten. - * - * Usage: - * $this->registry->copy('namespace-x', 'to-namespace-y'); - * - * To copy only certain values: - * $this->registry->copy('namespace-x', 'to-namespace-y', 'wildcard*'); - * - * @param string $source_registry - * @param string $target_registry - * @param null $filter - * - * @return Registry - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @return mixed + * @since 1.0.0 */ - public function copy($source_registry, $target_registry, $filter = null) + public function get($name, $key = null) { - $source_registry = $this->editNamespace($source_registry); - $target_registry = $this->editNamespace($target_registry); + list($name, $key) = $this->initialiseNameKey($name, $key); - if ($this->checkLock($target_registry)) { - throw new RuntimeException( - 'Registry: Target Namespace: ' . $target_registry . ' is locked. May not copy into it.' - ); + if ($this->exists($name, $key) === false) { + return null; } - if ($this->exists($source_registry)) { - } else { - throw new RuntimeException - ( - 'Registry: Namespace ' . $source_registry . ' requested as source of copy does not exist.' - ); - } - - $copy = $this->getRegistry($source_registry); - - if ($filter === null || $filter === '*') { - if (count($copy) > 0) { - foreach ($copy as $key => $value) { - $this->set($target_registry, $key, $value); - } - } - - return $this; - } + $registry = $this->registry[$name]; - if (strpos($filter, '*')) { - $searchfor = substr($filter, 0, strrpos($filter, '*')); - $exactMatch = false; - } else { - $searchfor = $filter; - $exactMatch = true; - } - - if (count($copy) > 0) { - - foreach ($copy as $key => $value) { - $use = false; - $test = substr($key, 0, strlen($searchfor)); - if (strtolower($test) === strtolower($searchfor)) { - if ($exactMatch === true) { - if (strtolower($key) === strtolower($searchfor)) { - $use = true; - } - } else { - $use = true; - } - } - if ($use === true) { - $this->set($target_registry, $key, $value); - } - } - } - - return $this; - } - - /** - * Merge one Namespace into another. - * - * - When keys match, target value is retained - * - When key does not exist on the target, it is copied in - * In either of the above cases, when "remove_from_source" is 1, the source entry is removed - * - If no entries remain in the source after the merge, the registry is removed, too - * - * Usage: - * $this->registry->merge('namespace-x', 'to-namespace-y'); - * - * Merge a subset of source using wildcard: - * $this->registry->merge('namespace-x', 'to-namespace-y', 'Only These*'); - * - * Merge a subset of source using wildcard, and then delete the source merged in: - * $this->registry->merge('namespace-x', 'to-namespace-y', 'Only These*', 1); - * - * @param string $source_registry - * @param string $target_registry - * @param bool $filter - merge for matching keys - * @param int $remove_from_source - * - * @return array|bool - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function merge($source_registry, $target_registry, $filter = false, $remove_from_source = 0) - { - $source_registry = $this->editNamespace($source_registry); - $target_registry = $this->editNamespace($target_registry); - - if ($this->exists($source_registry)) { - } else { - throw new RuntimeException - ( - 'Registry: Namespace ' . $source_registry . ' requested as a source for merging does not exist.' - ); - } - - if ($this->exists($target_registry)) { - } else { - throw new RuntimeException - ( - 'Registry: Namespace ' . $target_registry . ' does not exist, was requested as target of merge.' - ); - } - - if ($remove_from_source === 1) { - if ($this->checkLock($source_registry)) { - throw new RuntimeException - ( - 'Registry: Source Namespace: ' . $target_registry . ' for Merge is locked. May not remove entries.' - ); - } - } - - $target_registry = $this->editNamespace($target_registry); - if ($this->checkLock($target_registry)) { - throw new RuntimeException - ( - 'Registry: Target Namespace: ' . $target_registry . ' for Merge is locked. May not add entries.' - ); - } - - $searchfor = ''; - if ($filter === null || trim($filter) === '' || $filter === '*') { - } else { - $searchfor = substr($filter, 0, strrpos($filter, '*')); - $searchfor = strtolower(trim($searchfor)); + if ($key === null) { + return $registry; } - $target = $this->getRegistry($target_registry); - $source = $this->getRegistry($source_registry); - foreach ($source as $key => $value) { - - $match = 0; - - if (is_null($value)) { - //skip it. - } elseif ($searchfor === '') { - $match = 1; - } elseif (trim(substr(strtolower($key), 0, strlen(strtolower($searchfor)))) === trim($searchfor)) { - $match = 1; - } - - if ($match === 1) { - if (isset($target[$key])) { - if ($target[$key] === null) { - $this->set($target_registry, $key, $value); - } - } else { - $this->set($target_registry, $key, $value); - } - } - - if ($remove_from_source === 1) { - $this->delete($source_registry, $key); - } + if (isset($registry[$key])) { + return $registry[$key]; } - if (count($this->getRegistry($source_registry)) > 0) { - } else { - return $this->deleteRegistry($source_registry); - } - - return true; + return null; } /** - * Sort Namespace - * - * Usage: - * $this->registry->sort('namespace'); - * - * @param string $namespace + * Sets the value for a specific registry $key $value pair * - * @return Registry - * @throws \CommonApi\Exception\RuntimeException - * @since 1.0 - */ - public function sort($namespace) - { - $namespace = $this->editNamespace($namespace); - - if ($this->exists($namespace)) { - } else { - throw new RuntimeException - ( - 'Registry: Cannot sort Namespace ' . $namespace . ' since it does not exist.' - ); - } - - $sort = $this->getRegistry($namespace); - ksort($sort); - $this->registry[$namespace] = $sort; - - return $this; - } - - /** - * Deletes a registry or registry entry - * - * Usage: - * $this->registry->delete('Name Space', 'key_name'); - * - * @param string $namespace + * @param string $name * @param string $key - * - * @return Registry - * @return Registry - * @throws \CommonApi\Exception\RuntimeException - * @since 1.0 - */ - public function delete($namespace, $key = null) - { - $namespace = $this->editNamespace($namespace); - - if ($this->exists($namespace)) { - } else { - return $this; - } - - if ($this->checkLock($namespace)) { - throw new RuntimeException - ( - 'Registry: Cannot delete an entry from Namespace: ' . $namespace . ' since it has been locked.' - ); - } - - $key = strtolower($key); - if ($key === '') { - return $this->deleteRegistry($namespace); - } - - $searchfor = ''; - if ($key === null || trim($key) === '' || $key === '*') { - } else { - $searchfor = substr($key, 0, strrpos($key, '*')); - $searchfor = strtolower(trim($searchfor)); - } - - $copy = $this->getRegistry($namespace); - if (count($copy) > 0) { - } else { - return $this; //nothing to delete - } - - $new = array(); - foreach ($copy as $key => $value) { - - $match = 0; - - if ($searchfor === '') { - $match = 1; - } elseif (trim(substr(strtolower($key), 0, strlen(strtolower($searchfor)))) === trim($searchfor)) { - $match = 1; - } - - if ($match === 1) { - } else { - $new[$key] = $value; - } - } - - $this->deleteRegistry($namespace); - - if (count($new) > 0) { - } else { - return $this; - } - - $this->createRegistry($namespace); - $this->registry[$namespace] = $new; - - return $this; - } - - /** - * Rename a namespace (deletes existing, creates new) - * - * Usage: - * $this->registry->rename($namespace); - * - * @param $namespace - * @param $new_namespace + * @param mixed $value * * @return $this - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @since 1.0.0 */ - public function rename($namespace, $new_namespace) + public function set($name, $key, $value = null) { - $namespace = $this->editNamespace($namespace); + list($name, $key) = $this->initialiseNameKey($name, $key); - if ($this->exists($namespace)) { + if ($this->exists($name) === false) { + $registry = $this->createRegistry($name); } else { - throw new RuntimeException - ( - 'Registry: Cannot rename Namespace ' . $namespace . ' since it does not exist.' - ); + $registry = $this->registry[$name]; } - if ($this->checkLock($namespace)) { - throw new RuntimeException - ( - 'Registry: Cannot rename Namespace: ' . $namespace . ' since it has been locked.' - ); - } - - if ($this->exists($new_namespace)) { - } else { - throw new RuntimeException - ( - 'Registry: Cannot rename ' . $namespace . ' to an existing registry ' . $new_namespace - ); - } - - $existing = $this->getRegistry($namespace); - ksort($existing); - $this->deleteRegistry($namespace); - $this->createRegistry($new_namespace); - $this->registry[$new_namespace] = $existing; + $registry[$key] = $value; + $this->registry[$name] = $registry; return $this; } /** - * Returns an array containing key and name pairs for a namespace registry - * - * Usage: - * $this->registry->getArray('Name Space'); + * Sort Registry * - * To retrieve only the key field names, not the values: - * $this->registry->getArray('Name Space', true); + * @param string $name * - * @param string $namespace - * @param boolean $key_only set to true to retrieve key names - * - * @return array - * @since 1.0 - */ - public function getArray($namespace, $key_only = false) - { - $namespace = $this->editNamespace($namespace); - - if ($this->exists($namespace)) { - } else { - return array(); - } - - $array = $this->getRegistry($namespace); - - if ($key_only === false) { - return $array; - } - - $keyArray = array(); - foreach ($array as $key => $value) { - $keyArray[] = $key; - } - - return $keyArray; - } - - /** - * Populates a registry with an array of key and name pairs - * - * Usage: - * $this->registry->loadArray('Namespace', $array); - * - * @param string $namespace name of registry to use or create - * @param array $array key and value pairs to load - * - * @return Registry - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException + * @return $this + * @since 1.0.0 */ - public function loadArray($namespace, $array = array()) + public function sort($name) { - if (is_array($array) && count($array) > 0) { - } else { - throw new RuntimeException - ( - 'Registry: Empty or missing input array provided to loadArray.' - ); - } - - $namespace = $this->editNamespace($namespace); + $name = strtolower($name); - //if ($this->exists($namespace)) { - // throw new RuntimeException - // ('Registry: Namespace ' . $namespace . ' already exists. Cannot use existing namespace with loadArray.'); - // } + $registry = $this->registry[$name]; - $this->getRegistry($namespace); + ksort($registry); - $this->registry[$namespace] = $array; + $this->registry[$name] = $registry; return $this; } /** - * Retrieves a list of ALL namespace registries and optionally keys/values + * Verify Registry exists * - * Usage: - * $this->registry->listRegistry(); + * @param string $name * - * @param boolean $expand true - returns the entire list and each registry - * false - returns a list of registry names, only - * - * @return mixed|boolean or array - * @since 1.0 + * @return boolean + * @since 1.0.0 */ - public function listRegistry($expand = false) + protected function existsName($name) { - if ($expand === false) { - echo '
';
-            var_dump($this->registryKeys);
-            echo '
'; - - return; - } - - echo '
';
-        var_dump($this->registry);
-        echo '
'; - - return; - } + $name = strtolower($name); - /** - * getData - returns Registry (comes from $model_name) as Query Results (array of objects) - * - * Data can be requested as a result - provide $registry, $element and true for $single result - * - * Use '*' in the key to retrieve all values starting with a specific phrase (ex. 'model') - * - * @param string $registry Name of registry, for the MVC this is the $model_name - * @param null|string $key Key of the named pair - * @param null|string $query_object Result, Item, or List - * - * @return array|bool|mixed - * @since 1.0 - */ - public function getData($registry, $key = null, $query_object = null) - { - $registry = strtolower($registry); - - $key = strtolower($key); - $query_results = array(); - - if ($key === null || $key === '*') { - $results = $this->get($registry); - } elseif ($query_object === 'result') { - return $this->get($registry, $key); - } else { - $results = $this->get($registry, $key); - } - - if (is_array($results)) { - if (isset($results[0])) { - if (is_object($results[0])) { - return $results; - } - } - } - - $temp_row = new \stdClass(); - if (count($results) > 0) { - foreach ($results as $key => $value) { - $temp_row->$key = $value; - } + if (isset($this->registry[$name])) { + return true; } - $query_results[] = $temp_row; - return $query_results; + return false; } /** - * Returns the registry as an array for the specified namespace - * - * This is a private method used within the registry class, use get to retrieve Registry - * - * $this->registry->get('Name Space'); + * Verify Registry Key exists * - * @param string $namespace + * @param string $name + * @param string $key * - * @return array - * @since 1.0 + * @return boolean + * @since 1.0.0 */ - protected function getRegistry($namespace) + protected function existsNameKey($name, $key) { - $namespace = $this->editNamespace($namespace); + list($name, $key) = $this->initialiseNameKey($name, $key); - if ($this->exists($namespace)) { - } else { - $this->createRegistry($namespace); - } - - return $this->registry[$namespace]; - } - - /** - * Delete a Registry for specified Namespace - * - * @param string $namespace - * - * @return Registry - * @since 1.0 - */ - protected function deleteRegistry($namespace) - { - $namespace = $this->editNamespace($namespace); + $registry = $this->registry[$name]; - if ($this->exists($namespace)) { + if (is_array($registry) && count($registry) > 0) { } else { - return $this; - } - - $namespace = strtolower($namespace); - - $existing = $this->registryKeys; - $keep = array(); - $deleted = false; - foreach ($existing as $key => $value) { - - if ($value === $namespace) { - $deleted = true; - } else { - $keep[] = $value; - } - } - - if ($deleted === false) { - return $this; + return false; } - sort($keep); - - $tempRegistry = $this->registry; - - $this->registry = array(); - $this->registryKeys = array(); - - foreach ($keep as $key => $value) { - $this->registryKeys[] = $value; - $this->registry[$value] = $tempRegistry[$value]; + if (isset($registry[$key])) { + return true; } - return $this; + return false; } /** - * Used internally for data validation of namespace element + * Set Name and Key to lowercase * - * @param string $namespace + * @param string $name + * @param string $key * - * @return string - * @throws \CommonApi\Exception\RuntimeException + * @return array + * @since 1.0.0 */ - private function editNamespace($namespace) + protected function initialiseNameKey($name, $key) { - if ($namespace === null) { - $namespace = '*'; - } elseif (is_string($namespace) || is_numeric($namespace)) { - $namespace = strtolower($namespace); - $namespace = trim($namespace); - } else { - throw new RuntimeException - ( - 'Registry: Namespace: is not a string.' - ); - } + $name = strtolower($name); - return $namespace; - } - - /** - * Used internally for data validation of namespace key element - * - * @param string $namespace - * @param string $key - * - * @return string - * @throws \CommonApi\Exception\RuntimeException - */ - private function editNamespaceKey($namespace, $key = null) - { if ($key === null) { - } elseif (is_string($key) || is_numeric($key)) { - $key = strtolower($key); - $key = trim($key); } else { - echo '
';
-            var_dump($key);
-            echo '
'; - throw new RuntimeException - ( - 'Registry: Key associated with Namespace: ' . $namespace . ' is not a string.' - ); + $key = strtolower($key); } - return $key; + return array($name, $key); } } diff --git a/Source/Configuration/Values.php b/Source/Configuration/Values.php new file mode 100644 index 0000000..19c8ee0 --- /dev/null +++ b/Source/Configuration/Values.php @@ -0,0 +1,70 @@ +valid_attributes = $this->data_object->get('valid_value_attributes'); + + if ($this->processValues() === false) { + return $this; + } + + $verified_attributes = array(); + + foreach ($this->xml->table->values->value as $xml_extract) { + + $values = array(); + $attributes = get_object_vars($xml_extract); + $item_attributes = ($attributes["@attributes"]); + + foreach ($this->verifyAttributes($item_attributes) as $key => $value) { + $values[$key] = $value; + } + + $verified_attributes[] = $values; + } + + $this->setModelRegistryElement('values', $verified_attributes); + + return $this; + } + + /** + * Process Values + * + * @return boolean + * @since 1.0.0 + */ + protected function processValues() + { + if (isset($this->xml->table->values->value) > 0) { + } else { + return false; + } + + return true; + } +} diff --git a/Source/Driver.php b/Source/Driver.php index 16e3ed5..62f492a 100644 --- a/Source/Driver.php +++ b/Source/Driver.php @@ -28,7 +28,7 @@ class Driver implements ResourceInterface * Scheme Instance * * @var object CommonApi\Resource\SchemeInterface - * @since 1.0 + * @since 1.0.0 */ protected $scheme; @@ -36,7 +36,7 @@ class Driver implements ResourceInterface * Adapter Instances * * @var array Contains set of CommonApi\Resource\AdapterInterface instances - * @since 1.0 + * @since 1.0.0 */ protected $adapter_instance_array = array(); @@ -44,7 +44,7 @@ class Driver implements ResourceInterface * Scheme from Request * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $scheme_value; @@ -52,7 +52,7 @@ class Driver implements ResourceInterface * Host * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $host; @@ -60,7 +60,7 @@ class Driver implements ResourceInterface * User * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $user; @@ -68,7 +68,7 @@ class Driver implements ResourceInterface * Password * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $password; @@ -76,7 +76,7 @@ class Driver implements ResourceInterface * Path * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $path; @@ -84,7 +84,7 @@ class Driver implements ResourceInterface * Query * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $query; @@ -92,7 +92,7 @@ class Driver implements ResourceInterface * Fragment * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $fragment; @@ -100,7 +100,7 @@ class Driver implements ResourceInterface * Scheme Properties * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $scheme_properties; @@ -108,7 +108,7 @@ class Driver implements ResourceInterface * Adapter Value * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $adapter_value; @@ -118,7 +118,7 @@ class Driver implements ResourceInterface * @param SchemeInterface $scheme * @param array $adapter_instance_array * - * @since 1.0 + * @since 1.0.0 */ public function __construct( SchemeInterface $scheme, @@ -142,7 +142,7 @@ public function __construct( * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $base_directory, $prepend = true) { @@ -165,7 +165,7 @@ public function setNamespace($namespace_prefix, $base_directory, $prepend = true * @param object $adapter_instance * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setAdapterInstance($adapter = 'File', $adapter_instance) { @@ -182,7 +182,7 @@ public function setAdapterInstance($adapter = 'File', $adapter_instance) * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function register($prepend = true) { @@ -195,7 +195,7 @@ public function register($prepend = true) * Unregister Class Autoloader * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function unregister() { @@ -210,7 +210,7 @@ public function unregister() * @param string $scheme * * @return object|array - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function getScheme($scheme = '') @@ -256,7 +256,7 @@ public function getScheme($scheme = '') * @param bool $replace * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setScheme($scheme_name, $adapter = 'File', array $extensions = array(), $replace = false) { @@ -271,7 +271,7 @@ public function setScheme($scheme_name, $adapter = 'File', array $extensions = a * @param string $uri_namespace * * @return boolean - * @since 1.0 + * @since 1.0.0 */ public function exists($uri_namespace) { @@ -286,6 +286,7 @@ public function exists($uri_namespace) } return true; + } catch (Exception $e) { return false; } @@ -298,12 +299,16 @@ public function exists($uri_namespace) * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function get($uri_namespace, array $options = array()) { $this->parseUri($uri_namespace); + if ($this->scheme_value === 'Field') { + return $this->adapter_instance_array[$this->adapter_value]->get(substr($uri_namespace, 9, 999)); + } + return $this->locateNamespace(str_replace('\\', '/', $this->path), $this->scheme_value, $options); } @@ -315,7 +320,7 @@ public function get($uri_namespace, array $options = array()) * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function locateNamespace($namespace, $scheme = 'ClassLoader', array $options = array()) { @@ -342,14 +347,14 @@ public function locateNamespace($namespace, $scheme = 'ClassLoader', array $opti * @param array $options * * @return void|mixed - * @since 1.0 + * @since 1.0.0 */ public function handlePath($scheme_value, $located_path, array $options = array()) { $this->getScheme($scheme_value); if (strtolower($scheme_value) == 'query') { - $xml = $this->adapter_instance_array['Xml']->handlePath( + $xml = $this->adapter_instance_array['Xml']->handlePath( $scheme_value, $located_path, $options @@ -369,7 +374,7 @@ public function handlePath($scheme_value, $located_path, array $options = array( * @param array $options * * @return mixed - * @since 1.0 + * @since 1.0.0 */ public function getCollection($scheme_value, array $options = array()) { @@ -384,7 +389,7 @@ public function getCollection($scheme_value, array $options = array()) * @param string $uri * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function parseUri($uri) { diff --git a/Source/ExtensionMap.php b/Source/ExtensionMap.php index df896d4..dcf8b02 100644 --- a/Source/ExtensionMap.php +++ b/Source/ExtensionMap.php @@ -27,7 +27,7 @@ class ExtensionMap implements ExtensionsInterface * Stores an array of key/value runtime_data settings * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $runtime_data = null; @@ -35,7 +35,7 @@ class ExtensionMap implements ExtensionsInterface * Resource Instance * * @var object - * @since 1.0 + * @since 1.0.0 */ protected $resource; @@ -43,7 +43,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $extensions_filename; @@ -51,7 +51,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $temp_ids = array(); @@ -59,7 +59,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $temp_names = array(); @@ -67,7 +67,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $temp_extensions = array(); @@ -75,7 +75,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $temp_menus = array(); @@ -83,7 +83,7 @@ class ExtensionMap implements ExtensionsInterface * Extensions Filename * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $temp_page_types = array(); @@ -94,7 +94,7 @@ class ExtensionMap implements ExtensionsInterface * @param object $runtime_data * @param string $extensions_filename * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $resource, @@ -132,7 +132,7 @@ public function createMap() * Get Catalog Types * * @return stdClass - * @since 1.0.0.0 + * @since 1.0.0 */ public function getCatalogTypes() { @@ -227,15 +227,12 @@ protected function processExtensions($items, $catalog_type_id, $catalog_type_mod } elseif ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) { $model_name = $this->setExtensionModelNameMenuitem($this->temp_page_types, $id); + } else { $model_name = $this->setExtensionModelNameDefault($catalog_type_model_name, $alias); } - if ($alias === 'Groups') { - $this->temp_extensions[$id] = array(); - } else { - $this->temp_extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator); - } + $this->temp_extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator); } return $this->setExtensions(); @@ -397,8 +394,11 @@ protected function setExtensionModelNameDefault($catalog_type_model_name, $alias */ protected function getExtension($id, $model_name) { - $controller = $this->setExtensionQuery($id, $model_name); - $data = $this->runQuery($controller); + $controller = $this->setExtensionQuery($id, $model_name); + $data = $this->runQuery($controller); + if ($data === null) { + return new stdClass(); + } $model_registry = $controller->getModelRegistry('*'); return $this->processExtension($data, $model_registry); @@ -542,7 +542,7 @@ public function setCatalogTypesQuery() { $controller = $this->resource->get( 'query:///Molajo//Model//Datasource//CatalogTypes.xml', - array('Runtime_data' => $this->runtime_data) + array('Runtimedata' => $this->runtime_data) ); $controller->setModelRegistry('check_view_level_access', 0); @@ -657,10 +657,11 @@ protected function setExtensionQuery($id, $model_name) * @return mixed * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException - * */ protected function runQuery($controller) { + $controller->setSql(); + try { return $controller->getData(); diff --git a/Source/Factory/ReadControllerFactory.php b/Source/Factory/ReadControllerFactory.php deleted file mode 100644 index b568352..0000000 --- a/Source/Factory/ReadControllerFactory.php +++ /dev/null @@ -1,138 +0,0 @@ -query = $query; - $this->model = $model; - $this->model_registry = $model_registry; - $this->runtime_data = $runtime_data; - $this->schedule_event = $schedule_event; - $this->sql = $sql; - } - - /** - * Instantiate Class, load the Model Registry and SQL - * - * @return object - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function instantiateClass() - { - $class = 'Molajo\\Controller\\ReadController'; - - try { - $instance = new $class ( - $this->model, - $this->runtime_data, - $this->schedule_event, - $this->query - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Factory ReadControllerFactory failed in instantiateClass Method.' . $e->getMessage() - ); - } - - $instance->clearQuery(); - - $instance->setModelRegistry('*', $this->model_registry); - - if (trim($this->sql) === '') { - } else { - $instance->set('sql', $this->sql); - } - - return $instance; - } -} diff --git a/Source/Factory/ReadModelFactory.php b/Source/Factory/ReadModelFactory.php deleted file mode 100644 index 5cc4a91..0000000 --- a/Source/Factory/ReadModelFactory.php +++ /dev/null @@ -1,68 +0,0 @@ -database = $database; - } - - /** - * Create Model Instance - * - * @return object - * @since 1.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function instantiateClass() - { - $class = 'Molajo\\Model\\ReadModel'; - - try { - return new $class ( - $this->database - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Query Handler Failed Instantiating Model: ' - . $e->getMessage() - ); - } - } -} diff --git a/Source/ResourceMap.php b/Source/ResourceMap.php index 03cc11e..01a2286 100644 --- a/Source/ResourceMap.php +++ b/Source/ResourceMap.php @@ -29,7 +29,7 @@ class ResourceMap extends Prefixes implements MapInterface * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = false) { @@ -48,7 +48,7 @@ public function setNamespace($namespace_prefix, $namespace_base_directory, $prep * Create resource map of folder/file locations and Qualified Namespaces * * @return object - * @since 1.0 + * @since 1.0.0 */ public function createMap() { @@ -65,7 +65,7 @@ public function createMap() * Save output to json file * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function saveOutput() { @@ -89,7 +89,7 @@ protected function saveOutput() * Return Resource Map Data * * @return object - * @since 1.0 + * @since 1.0.0 */ public function getResourceMap() { diff --git a/Source/ResourceMap/Base.php b/Source/ResourceMap/Base.php index 46064dc..3b1c4d9 100644 --- a/Source/ResourceMap/Base.php +++ b/Source/ResourceMap/Base.php @@ -25,7 +25,7 @@ abstract class Base * Resource Map Filename * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $resource_map_filename; @@ -33,7 +33,7 @@ abstract class Base * Interface Map Filename * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $classmap_filename; @@ -41,7 +41,7 @@ abstract class Base * Base Path - root of the website from which paths are defined * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $base_path; @@ -49,7 +49,7 @@ abstract class Base * Namespace Prefixes + Path * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $namespace_prefixes = array(); @@ -57,19 +57,19 @@ abstract class Base * List of folders to exclude from resource mapping * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $exclude_folders = array(); /** * Constructor * - * @param string $base_path - * @param array $exclude_folders - * @param string $classmap_filename - * @param string $resource_map_filename + * @param string $base_path + * @param array $exclude_folders + * @param string $classmap_filename + * @param string $resource_map_filename * - * @since 1.0 + * @since 1.0.0 */ public function __construct( $base_path, @@ -92,12 +92,13 @@ public function __construct( $this->resource_map_filename = $resource_map_filename; } } + /** * Get Reflection Object from PHP * * @param string $qns * - * @since 1.0 + * @since 1.0.0 * @return object */ protected function getReflectionObject($qns) @@ -112,14 +113,14 @@ protected function getReflectionObject($qns) /** * Set a namespace prefix by mapping to the filesystem path * - * @param string $namespace + * @param string $namespace * * @return string - * @since 1.0 + * @since 1.0.0 */ protected function addSlash($namespace) { - if (substr($namespace, - 1) === '\\') { + if (substr($namespace, -1) === '\\') { } else { $namespace = $namespace . '\\'; } diff --git a/Source/ResourceMap/Folders.php b/Source/ResourceMap/Folders.php index 250cace..45fdeec 100644 --- a/Source/ResourceMap/Folders.php +++ b/Source/ResourceMap/Folders.php @@ -22,7 +22,7 @@ abstract class Folders extends Base * Base Name * * @var string - * @since 1.0 + * @since 1.0.0 */ protected $base_name = ''; @@ -30,7 +30,7 @@ abstract class Folders extends Base * PHP Class Indicator * * @var boolean - * @since 1.0 + * @since 1.0.0 */ protected $php_class = false; @@ -38,7 +38,7 @@ abstract class Folders extends Base * Temporary Work File to accumulate Resource Map * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $resource_map = array(); @@ -46,7 +46,7 @@ abstract class Folders extends Base * Temporary Work File to accumulate Class Files * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $class_files = array(); @@ -58,7 +58,7 @@ abstract class Folders extends Base * @param boolean $prepend * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function setMultipleNamespaceFolder($namespace_prefix, $namespace_base_directory, $prepend) { @@ -81,7 +81,7 @@ protected function setMultipleNamespaceFolder($namespace_prefix, $namespace_base * @param array $hold * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function appendNamespaceFolder($namespace_prefix, $namespace_base_directory, $hold) { @@ -99,7 +99,7 @@ protected function appendNamespaceFolder($namespace_prefix, $namespace_base_dire * @param array $hold * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function prependNamespaceFolder($namespace_prefix, $namespace_base_directory, $hold) { diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 4f8cc1d..44ba184 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -26,7 +26,7 @@ abstract class Prefixes extends Folders * Folders * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $folders = array(); @@ -34,7 +34,7 @@ abstract class Prefixes extends Folders * Files * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $files = array(); @@ -42,7 +42,7 @@ abstract class Prefixes extends Folders * Process Array of Namespaces/Folder Mapping Pairs * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function processNamespacePrefixes() { @@ -60,7 +60,7 @@ protected function processNamespacePrefixes() * @param string $namespace_prefix * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function processNamespaceFolders($namespace_base_folders, $namespace_prefix) { @@ -86,7 +86,7 @@ protected function processNamespaceFolders($namespace_base_folders, $namespace_p * @param string $namespace_prefix * * @return object - * @since 1.0 + * @since 1.0.0 */ protected function processNamespaceFolder($namespace_base_folder, $namespace_prefix) { @@ -113,7 +113,7 @@ protected function processNamespaceFolder($namespace_base_folder, $namespace_pre * @param string $namespace_base_folder * * @return object - * @since 1.0 + * @since 1.0.0 */ protected function processFilePathObjects($objects, $namespace_prefix, $namespace_base_folder) { @@ -147,7 +147,7 @@ protected function processFilePathObjects($objects, $namespace_prefix, $namespac * @param string $file_extension * * @return int|object - * @since 1.0 + * @since 1.0.0 */ protected function testFileForNamespaceRules( $namespace_prefix, @@ -198,7 +198,7 @@ protected function testFileForNamespaceRules( * @param string $file_extension * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function setBase($is_directory, $file_path, $file_name, $file_extension) { @@ -223,7 +223,7 @@ protected function setBase($is_directory, $file_path, $file_name, $file_extensio * @param string $file_extension * * @return boolean - * @since 1.0 + * @since 1.0.0 */ protected function setFileInclusion($is_directory, $file_name, $file_extension) { @@ -249,7 +249,7 @@ protected function setFileInclusion($is_directory, $file_name, $file_extension) * @param string $file_name * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function testPHPClassExceptions($file_name) { @@ -270,7 +270,7 @@ protected function testPHPClassExceptions($file_name) * @param int $skip * * @return int - * @since 1.0 + * @since 1.0.0 */ protected function testExcludeFolders($file_path, $skip = 1) { @@ -311,7 +311,7 @@ protected function testExcludeFolders($file_path, $skip = 1) * @param string $file_name * * @return string - * @since 1.0 + * @since 1.0.0 */ protected function setPath($is_directory, $file_path, $file_name) { @@ -329,7 +329,7 @@ protected function setPath($is_directory, $file_path, $file_name) * @param string $namespace_prefix * * @return string - * @since 1.0 + * @since 1.0.0 */ protected function setQNS($class_namespace_path, $namespace_prefix) { @@ -349,7 +349,7 @@ protected function setQNS($class_namespace_path, $namespace_prefix) * @param string $qns * * @return $this - * @since 1.0 + * @since 1.0.0 */ protected function mergeFQNSPaths($nspath, $qns) { @@ -379,7 +379,7 @@ protected function mergeFQNSPaths($nspath, $qns) * @param string $qns * * @return array - * @since 1.0 + * @since 1.0.0 */ protected function mergeExistingFQNSPath($qns) { @@ -404,7 +404,7 @@ protected function mergeExistingFQNSPath($qns) * @param string $nspath * * @return array - * @since 1.0 + * @since 1.0.0 */ protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath) { @@ -427,7 +427,7 @@ protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $ns * @param string $qns * * @return object - * @since 1.0 + * @since 1.0.0 */ protected function setNamespaceObject($file_name, $nspath, $qns) { diff --git a/Source/Scheme.php b/Source/Scheme.php index 5864ba4..bb9800b 100644 --- a/Source/Scheme.php +++ b/Source/Scheme.php @@ -29,7 +29,7 @@ class Scheme implements SchemeInterface * Adapter * * @var array - * @since 1.0 + * @since 1.0.0 */ protected $scheme_array = array(); @@ -38,7 +38,7 @@ class Scheme implements SchemeInterface * * @param string $scheme_filename * - * @since 1.0 + * @since 1.0.0 */ public function __construct($scheme_filename) { @@ -51,7 +51,7 @@ public function __construct($scheme_filename) * @param string $scheme * * @return object|array - * @since 1.0 + * @since 1.0.0 */ public function getScheme($scheme = '') { @@ -70,7 +70,7 @@ public function getScheme($scheme = '') * @param string $filename * * @return void - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function readSchemes($filename) @@ -141,7 +141,7 @@ protected function readSchemes($filename) * @param bool $replace * * @return $this - * @since 1.0 + * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ public function setScheme($scheme_name, $adapter = 'File', array $extensions = array(), $replace = false) diff --git a/Source/xxxFields.php b/Source/xxxFields.php new file mode 100644 index 0000000..695b6db --- /dev/null +++ b/Source/xxxFields.php @@ -0,0 +1,275 @@ +resource = $resource; + $this->runtime_data = $runtime_data; + $this->field_path = $field_path; + } + + /** + * Process Fields + * + * @return $this + * @since 1.0.0 + */ + public function processFields() + { + $files = scandir($this->field_path); + + if (count($files) === 0) { + return $this; + } + + foreach ($files as $file_name) { + if ($file_name === '.' || $file_name === '..') { + } else { + $this->readField($file_name); + } + } + + $id = 1; + foreach ($this->fields as $field_name => $field) { + $this->insertField($field, $id++); + } + + return $this; + } + + /** + * Read Field File + * + * @param string $file_name + * + * @return $this + * @since 1.0.0 + */ + public function readField($file_name) + { + if (file_exists(($this->field_path . $file_name))) { + } else { + return $this; + } + + $string = file_get_contents($this->field_path . $file_name); + $xml = simplexml_load_string($string); + + if (count($xml->attributes()) > 0) { + } else { + return $this; + } + + $row = new stdClass(); + foreach ($xml->attributes() as $key => $value) { + $key_name = (string)$key; + $value_string = (string)$value; + $row->$key_name = $value_string; + } + + $this->fields[substr($file_name, 0, strlen($file_name) - 4)] = $row; + + return $this; + } + + /** + * Insert Field + * + * @param object $field + * @param integer $id + * + * @return boolean + * @since 1.0.0 + */ + protected function insertField($field, $id) + { + $this->query = null; + + $this->connect('create'); + + $this->query->setModelRegistry('process_events', 1); + $this->query->setModelRegistry('check_view_level_access', 0); + $this->query->setModelRegistry('get_customfields', 0); + $this->query->setModelRegistry('use_special_joins', 0); + + $row = $this->query->initialiseRow(); + $row = $this->setInsertValues($row, $field, $id); + $this->query->setInsertStatement($row); + $this->query->setSql(); + $this->query->insertData(); + + return $this; + } + + /** + * Set Language Field Values for Insert + * + * @param object $row + * @param object $field + * @param integer $id + * + * @return object + * @since 1.0.0 + */ + protected function setInsertValues($row, $field, $id) + { + unset($row->id); + $row->extension_id = $this->field_catalog_type_id; + $row->catalog_type_id = $this->field_catalog_type_id; + $row->title = ucfirst(strtolower($field->name)); + $row->path = 'fields'; + $row->parent_id = 0; + $row->translation_of_id = 0; + $row->protected = 1; + $row->content_text = ''; + $row->language = 'en-GB'; + $row->ordering = $id; + $row->status = 1; + $row->customfields = $this->setCustomFields($field); + + return $row; + } + + /** + * Set Customfield Elements + * + * @return object + * @since 1.0.0 + */ + protected function setCustomFields($field) + { + $custom_fields = $this->query->getModelRegistry('customfields'); + + $row = new stdClass(); + + foreach ($custom_fields as $custom_field) { + + $key = $custom_field['name']; + $value = null; + + if (isset($field->$key)) { + $value = $field->$key; + + } elseif (isset($custom_field['default'])) { + $value = $custom_field['default']; + } + + $row->$key = $value; + } + + return json_encode($row, JSON_PRETTY_PRINT); + } + + /** + * Get Query Connection + * + * @param string $crud_type + * + * @return boolean + * @since 1.0.0 + */ + protected function connect($crud_type = 'Create') + { + $options = array(); + $crud_type = ucfirst(strtolower($crud_type)); + if ($crud_type === 'Create' + || $crud_type === 'Read' + || $crud_type === 'Update' + || $crud_type === 'Delete' + ) { + } else { + $crud_type = 'Read'; + } + + $options['crud_type'] = $crud_type; + $options['runtime_data'] = $this->runtime_data; + + $this->query = $this->resource->get( + 'query:///Molajo//Model//Datasource//Fields.xml', + $options + ); + + $this->query->clearQuery(); + + return $this; + } +} diff --git a/composer.json b/composer.json index b0762dc..2ef25d3 100644 --- a/composer.json +++ b/composer.json @@ -3,7 +3,11 @@ "description": "Molajo Resource Services for PHP Applications", "version": "1.0.0", "type": "molajo-package", - "keywords": ["resource", "commonapi", "molajo"], + "keywords": [ + "resource", + "commonapi", + "molajo" + ], "homepage": "http://github.com/Molajo/Resource", "license": "MIT", "authors": [ From 8996566cb71059fccd10dfe32195f05484a72174 Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Wed, 18 Feb 2015 21:20:50 -0600 Subject: [PATCH 03/11] Query modifications --- .../Extensions/ExtensionsFactoryMethod.php | 1 - .../Configuration.xml | 6 +- Factories/Registry/RegistryFactoryMethod.php | 41 +++ Factories/Resource/ResourceFactoryMethod.php | 149 ++++------ .../Resourcecss/ResourcecssFactoryMethod.php | 30 +- .../ResourcecssdeclarationsFactoryMethod.php | 30 +- .../ResourcedataFactoryMethod.php | 11 +- .../Resourcejs/ResourcejsFactoryMethod.php | 18 +- .../ResourcejsdeclarationsFactoryMethod.php | 16 +- .../ResourcequeryFactoryMethod.php | 164 ----------- .../ResourcerenderingFactoryMethod.php | 53 +++- Source/Adapter/AbstractAdapter.php | 44 ++- Source/Adapter/Cache.php | 132 +++++++++ Source/Adapter/ConfigurationFactory.php | 23 +- Source/Adapter/Css.php | 30 +- Source/Adapter/Cssdeclarations.php | 19 +- Source/Adapter/Extension.php | 14 +- Source/Adapter/Field.php | 11 +- Source/Adapter/Menuitem.php | 12 +- Source/Adapter/Page.php | 14 +- Source/Adapter/Template.php | 14 +- Source/Adapter/Theme.php | 14 +- Source/Adapter/Wrap.php | 13 +- Source/Adapter/Xml.php | 64 ++-- Source/Configuration/AbstractAdapter.php | 263 ----------------- Source/Configuration/Children.php | 72 ----- Source/Configuration/Criteria.php | 70 ----- Source/Configuration/Customfields.php | 107 ------- Source/Configuration/Data.php | 245 ---------------- Source/Configuration/Dataobject.php | 108 ------- Source/Configuration/Fields.php | 83 ------ Source/Configuration/Foreignkeys.php | 242 --------------- Source/Configuration/Includes.php | 94 ------ Source/Configuration/Inherit.php | 236 --------------- Source/Configuration/Joins.php | 88 ------ Source/Configuration/Model.php | 205 ------------- Source/Configuration/Plugins.php | 64 ---- Source/Configuration/Registry.php | 215 -------------- Source/Configuration/Values.php | 70 ----- Source/xxxFields.php | 275 ------------------ 40 files changed, 516 insertions(+), 2844 deletions(-) rename Factories/{Resourcequery => Registry}/Configuration.xml (78%) create mode 100644 Factories/Registry/RegistryFactoryMethod.php delete mode 100644 Factories/Resourcequery/ResourcequeryFactoryMethod.php create mode 100644 Source/Adapter/Cache.php delete mode 100644 Source/Configuration/AbstractAdapter.php delete mode 100644 Source/Configuration/Children.php delete mode 100644 Source/Configuration/Criteria.php delete mode 100644 Source/Configuration/Customfields.php delete mode 100644 Source/Configuration/Data.php delete mode 100644 Source/Configuration/Dataobject.php delete mode 100644 Source/Configuration/Fields.php delete mode 100644 Source/Configuration/Foreignkeys.php delete mode 100644 Source/Configuration/Includes.php delete mode 100644 Source/Configuration/Inherit.php delete mode 100644 Source/Configuration/Joins.php delete mode 100644 Source/Configuration/Model.php delete mode 100644 Source/Configuration/Plugins.php delete mode 100644 Source/Configuration/Registry.php delete mode 100644 Source/Configuration/Values.php delete mode 100644 Source/xxxFields.php diff --git a/Factories/Extensions/ExtensionsFactoryMethod.php b/Factories/Extensions/ExtensionsFactoryMethod.php index 78f65bb..7eeac1b 100644 --- a/Factories/Extensions/ExtensionsFactoryMethod.php +++ b/Factories/Extensions/ExtensionsFactoryMethod.php @@ -13,7 +13,6 @@ use CommonApi\IoC\FactoryInterface; use CommonApi\IoC\FactoryBatchInterface; use Molajo\IoC\FactoryMethod\Base as FactoryMethodBase; -use stdClass; /** * Extensions Factory Method diff --git a/Factories/Resourcequery/Configuration.xml b/Factories/Registry/Configuration.xml similarity index 78% rename from Factories/Resourcequery/Configuration.xml rename to Factories/Registry/Configuration.xml index a99428a..9db5348 100644 --- a/Factories/Resourcequery/Configuration.xml +++ b/Factories/Registry/Configuration.xml @@ -1,6 +1,6 @@ - Resourcequery + Registry Amy Stephen January 2015 Copyright (C) 2014-2015 Amy Stephen. All rights reserved. @@ -8,6 +8,6 @@ hello@molajo.org http://molajo.org 1.0 - Resourcequery Factory - + Registry Factory + diff --git a/Factories/Registry/RegistryFactoryMethod.php b/Factories/Registry/RegistryFactoryMethod.php new file mode 100644 index 0000000..c2e9d87 --- /dev/null +++ b/Factories/Registry/RegistryFactoryMethod.php @@ -0,0 +1,41 @@ +reflection = array(); - } else { - $this->reflection = $reflection; - } + parent::setDependencies(array()); - $this->options['Scheme'] = $this->createScheme(); + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); + + return $this->dependencies; + } + + /** + * Fulfill Dependencies + * + * @param array $dependency_values (ignored in Service Item Adapter, based in from handler) + * + * @return $this + * @since 1.0.0 + */ + public function onBeforeInstantiation(array $dependency_values = null) + { + $this->dependencies['Scheme'] = $this->createScheme(); $adapter_instance = array(); @@ -69,9 +82,17 @@ public function setDependencies(array $reflection = array()) $this->base_path . '/Bootstrap/Files/Model/Fields.json' ); + $cache_callbacks = array( + 'get_cache_callback' => $this->dependencies['Getcachecallback'], + 'set_cache_callback' => $this->dependencies['Setcachecallback'], + 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] + ); + + $empty_handler_options = array(); + /** * NOTE: - * Css, CssDeclarations, JsDeclarations, and Js loaded in Application Factory Method + * Css, CssDeclarations, JsDeclarations, and Js loaded in Application Factory * QueryHandler loaded following Database Factory Method */ $adapter_instance['Asset'] @@ -80,7 +101,9 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('Asset')->include_file_extensions + $this->dependencies['Scheme']->getScheme('Asset')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); $adapter_instance['ClassLoader'] = $this->createAdapter( @@ -88,16 +111,19 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('ClassLoader')->include_file_extensions + $this->dependencies['Scheme']->getScheme('ClassLoader')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); $adapter_instance['Field'] - = $this->createAdapterField( + = $this->createAdapter( 'Field', $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('Field')->include_file_extensions, - $fields + $this->dependencies['Scheme']->getScheme('Field')->include_file_extensions, + $cache_callbacks, + array('fields' => $fields) ); $adapter_instance['File'] = $this->createAdapter( @@ -105,8 +131,9 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('File')->include_file_extensions, - $this->base_path . '' + $this->dependencies['Scheme']->getScheme('File')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); $adapter_instance['Folder'] = $this->createAdapter( @@ -114,7 +141,9 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('Folder')->include_file_extensions + $this->dependencies['Scheme']->getScheme('Folder')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); $adapter_instance['Head'] = $this->createAdapter( @@ -122,7 +151,9 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('Head')->include_file_extensions + $this->dependencies['Scheme']->getScheme('Head')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); $adapter_instance['Xml'] = $this->createAdapter( @@ -130,28 +161,12 @@ public function setDependencies(array $reflection = array()) $this->base_path, $resource_map, array(), - $this->options['Scheme']->getScheme('Xml')->include_file_extensions + $this->dependencies['Scheme']->getScheme('Xml')->include_file_extensions, + $cache_callbacks, + $empty_handler_options ); - $this->options['adapter_instance_array'] = $adapter_instance; - - $this->dependencies = array(); - - return $this->dependencies; - } - - /** - * Fulfill Dependencies - * - * @param array $dependency_values (ignored in Service Item Adapter, based in from handler) - * - * @return $this - * @since 1.0.0 - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - $this->dependencies['Scheme'] = $this->options['Scheme']; - $this->dependencies['adapter_instance_array'] = $this->options['adapter_instance_array']; + $this->dependencies['adapter_instance_array'] = $adapter_instance; return $this->dependencies; } @@ -228,63 +243,26 @@ protected function createScheme() /** * Create Handler Instance * - * @param string $adapter - * @param string $base_path - * @param array $resource_map - * @param array $namespace_prefixes - * @param array $valid_file_extensions + * @param string $adapter + * @param string $base_path + * @param array $resource_map + * @param array $namespace_prefixes + * @param array $valid_file_extensions + * @param array $cache_callbacks + * @param array $handler_options * * @return mixed * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ protected function createAdapter( - $adapter, - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions - ) { - $class = 'Molajo\\Resource\\Adapter\\' . $adapter; - - try { - $adapter_instance = new $class ( - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Adapter ' . $adapter - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $adapter_instance; - } - - /** - * Create Handler Instance - * - * @param string $adapter - * @param string $base_path - * @param array $resource_map - * @param array $namespace_prefixes - * @param array $valid_file_extensions - * @param array $fields - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createAdapterField( $adapter, $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $fields = array() + array $cache_callbacks = array(), + array $handler_options = array() ) { $class = 'Molajo\\Resource\\Adapter\\' . $adapter; @@ -294,7 +272,8 @@ protected function createAdapterField( $resource_map, $namespace_prefixes, $valid_file_extensions, - $fields + $cache_callbacks, + $handler_options ); } catch (Exception $e) { throw new RuntimeException( diff --git a/Factories/Resourcecss/ResourcecssFactoryMethod.php b/Factories/Resourcecss/ResourcecssFactoryMethod.php index 2ac90b3..b422118 100644 --- a/Factories/Resourcecss/ResourcecssFactoryMethod.php +++ b/Factories/Resourcecss/ResourcecssFactoryMethod.php @@ -51,9 +51,11 @@ public function setDependencies(array $reflection = array()) { parent::setDependencies($reflection); - $options = array(); - $this->dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; + $this->dependencies['Resource'] = array(); + $this->dependencies['Runtimedata'] = array(); + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); return $this->dependencies; } @@ -78,13 +80,21 @@ public function onBeforeInstantiation(array $dependency_values = null) $scheme = $this->options['Scheme']->getScheme('Css'); $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - $this->dependencies['language_direction'] - = $this->dependencies['Runtimedata']->application->parameters->language_direction; - $this->dependencies['html5'] - = $this->dependencies['Runtimedata']->application->parameters->application_html5; - $this->dependencies['line_end'] - = $this->dependencies['Runtimedata']->application->parameters->application_line_end; - //todo: mime type + $cache_callbacks = array(); + $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; + $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; + $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; + $this->dependencies['cache_callbacks'] = $cache_callbacks; + + $handler_options = array(); + $handler_options['language_direction'] + = $this->dependencies['Runtimedata']->application->parameters->language_direction; + $handler_options['html5'] + = $this->dependencies['Runtimedata']->application->parameters->application_html5; + $handler_options['line_end'] + = $this->dependencies['Runtimedata']->application->parameters->application_line_end; + $this->dependencies['handler_options'] + = $handler_options; return $this->dependencies; } diff --git a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php index 897dc85..92b7657 100644 --- a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php +++ b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php @@ -51,9 +51,12 @@ public function setDependencies(array $reflection = array()) { parent::setDependencies($reflection); - $options = array(); - $this->dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; + $options = array(); + $this->dependencies['Resource'] = $options; + $this->dependencies['Runtimedata'] = $options; + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); return $this->dependencies; } @@ -78,12 +81,21 @@ public function onBeforeInstantiation(array $dependency_values = null) $scheme = $this->options['Scheme']->getScheme('cssd'); $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - $this->dependencies['language_direction'] - = $this->dependencies['Runtimedata']->application->parameters->language_direction; - $this->dependencies['html5'] - = $this->dependencies['Runtimedata']->application->parameters->application_html5; - $this->dependencies['line_end'] - = $this->dependencies['Runtimedata']->application->parameters->application_line_end; + $cache_callbacks = array(); + $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; + $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; + $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; + $this->dependencies['cache_callbacks'] = $cache_callbacks; + + $handler_options = array(); + $handler_options['language_direction'] + = $this->dependencies['Runtimedata']->application->parameters->language_direction; + $handler_options['html5'] + = $this->dependencies['Runtimedata']->application->parameters->application_html5; + $handler_options['line_end'] + = $this->dependencies['Runtimedata']->application->parameters->application_line_end; + $this->dependencies['handler_options'] + = $handler_options; return $this->dependencies; } diff --git a/Factories/Resourcedata/ResourcedataFactoryMethod.php b/Factories/Resourcedata/ResourcedataFactoryMethod.php index 81f251f..24ab1ab 100644 --- a/Factories/Resourcedata/ResourcedataFactoryMethod.php +++ b/Factories/Resourcedata/ResourcedataFactoryMethod.php @@ -211,6 +211,10 @@ public function setDependencies(array $reflection = array()) $this->setValidArray(); + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); + return $this->dependencies; } @@ -374,7 +378,7 @@ protected function loadDatalists($data_lists_array, $folder) * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ - public function createXml() + protected function createXml() { $scheme = $this->createScheme(); @@ -391,6 +395,11 @@ public function createXml() $resource_map, array(), $scheme->getScheme('Xml')->include_file_extensions, + array( + 'get_cache_callback' => $this->dependencies['Getcachecallback'], + 'set_cache_callback' => $this->dependencies['Setcachecallback'], + 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] + ), array( 'resource' => $this->options['Resource'], 'registry' => $this->dependencies['Registry'], diff --git a/Factories/Resourcejs/ResourcejsFactoryMethod.php b/Factories/Resourcejs/ResourcejsFactoryMethod.php index 9fa5a67..c9efe24 100644 --- a/Factories/Resourcejs/ResourcejsFactoryMethod.php +++ b/Factories/Resourcejs/ResourcejsFactoryMethod.php @@ -51,8 +51,11 @@ public function setDependencies(array $reflection = array()) { parent::setDependencies($reflection); - $options = array(); - $this->dependencies['Resource'] = $options; + $options = array(); + $this->dependencies['Resource'] = $options; + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); return $this->dependencies; } @@ -76,6 +79,17 @@ public function onBeforeInstantiation(array $dependency_values = null) $this->dependencies['namespace_prefixes'] = array(); $scheme = $this->options['Scheme']->getScheme('js'); $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; + + + $cache_callbacks = array(); + $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; + $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; + $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; + $this->dependencies['cache_callbacks'] = $cache_callbacks; + + $handler_options = array(); + $this->dependencies['handler_options'] = $handler_options; + return $this->dependencies; } diff --git a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php index acbaf54..b786078 100644 --- a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php +++ b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php @@ -51,8 +51,11 @@ public function setDependencies(array $reflection = array()) { parent::setDependencies($reflection); - $options = array(); - $this->dependencies['Resource'] = $options; + $options = array(); + $this->dependencies['Resource'] = $options; + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); return $this->dependencies; } @@ -77,6 +80,15 @@ public function onBeforeInstantiation(array $dependency_values = null) $scheme = $this->options['Scheme']->getScheme('jsd'); $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; + $cache_callbacks = array(); + $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; + $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; + $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; + $this->dependencies['cache_callbacks'] = $cache_callbacks; + + $handler_options = array(); + $this->dependencies['handler_options'] = $handler_options; + return $this->dependencies; } diff --git a/Factories/Resourcequery/ResourcequeryFactoryMethod.php b/Factories/Resourcequery/ResourcequeryFactoryMethod.php deleted file mode 100644 index 2f1b5ea..0000000 --- a/Factories/Resourcequery/ResourcequeryFactoryMethod.php +++ /dev/null @@ -1,164 +0,0 @@ -dependencies['Resource'] = array(); - $this->dependencies['Database'] = array(); - $this->dependencies['Query'] = array(); - $this->dependencies['Runtimedata'] = array(); - $this->dependencies['Eventcallback'] = array(); - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['base_path'] = $this->base_path; - $this->dependencies['resource_map'] = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - $this->options['Scheme'] = $this->createScheme(); - $this->dependencies['namespace_prefixes'] = array(); - $this->dependencies['valid_file_extensions'] - = $this->options['Scheme']->getScheme( - 'Query' - )->include_file_extensions; - - $this->dependencies['query'] = $this->dependencies['Query']; - $this->dependencies['schedule_event'] = $this->dependencies['Eventcallback']; - $this->dependencies['get_cache_callback'] = $this->dependencies['Getcachecallback']; - $this->dependencies['set_cache_callback'] = $this->dependencies['Setcachecallback']; - $this->dependencies['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; - - return $this->dependencies; - } - - /** - * Factory Method Controller triggers the Factory Method to create the Class for the Service - * - * @return $this - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function instantiateClass() - { - $class = $this->product_namespace; - - $database = clone $this->dependencies['Database']; - $query = clone $this->dependencies['Query']; - - $this->product_result = new $class( - $this->dependencies['base_path'], - $this->dependencies['resource_map'], - $this->dependencies['namespace_prefixes'], - $this->dependencies['valid_file_extensions'], - $database, - $query, - $this->dependencies['schedule_event'], - $this->dependencies['get_cache_callback'], - $this->dependencies['set_cache_callback'], - $this->dependencies['delete_cache_callback'] - - ); - - return $this; - } - - /** - * Follows the completion of the instantiate method - * - * @return $this - * @since 1.0.0 - */ - public function onAfterInstantiation() - { - $this->dependencies['Resource']->setAdapterInstance('Query', $this->product_result); - - return $this; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } -} diff --git a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php index e1bce84..396fc27 100644 --- a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php +++ b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php @@ -49,9 +49,13 @@ public function setDependencies(array $reflection = array()) { parent::setDependencies($reflection); - $options = array(); - $this->dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; + $options = array(); + $this->dependencies['Resource'] = $options; + $this->dependencies['Runtimedata'] = $options; + $this->dependencies['Getcachecallback'] = array(); + $this->dependencies['Setcachecallback'] = array(); + $this->dependencies['Deletecachecallback'] = array(); + return $this->dependencies; } @@ -71,13 +75,26 @@ public function onBeforeInstantiation(array $dependency_values = null) $resource_map = $this->readFile($filename); $scheme = $this->createScheme(); + $cache_callbacks = array( + 'get_cache_callback' => $this->dependencies['Getcachecallback'], + 'set_cache_callback' => $this->dependencies['Setcachecallback'], + 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] + ); + + $handler_options = array( + 'extensions' => $this->dependencies['Runtimedata']->reference_data->extensions, + 'resource' => clone $this->dependencies['Resource'] + ); + $adapter_instance['Theme'] = $this->createHandler( 'Theme', $this->base_path, $resource_map, array(), - $scheme->getScheme('Theme')->include_file_extensions + $scheme->getScheme('Theme')->include_file_extensions, + $cache_callbacks, + $handler_options ); $adapter_instance['Page'] = $this->createHandler( @@ -85,7 +102,9 @@ public function onBeforeInstantiation(array $dependency_values = null) $this->base_path, $resource_map, array(), - $scheme->getScheme('Page')->include_file_extensions + $scheme->getScheme('Page')->include_file_extensions, + $cache_callbacks, + $handler_options ); $adapter_instance['Template'] = $this->createHandler( @@ -93,7 +112,9 @@ public function onBeforeInstantiation(array $dependency_values = null) $this->base_path, $resource_map, array(), - $scheme->getScheme('Template')->include_file_extensions + $scheme->getScheme('Template')->include_file_extensions, + $cache_callbacks, + $handler_options ); $adapter_instance['Wrap'] = $this->createHandler( @@ -101,7 +122,9 @@ public function onBeforeInstantiation(array $dependency_values = null) $this->base_path, $resource_map, array(), - $scheme->getScheme('Wrap')->include_file_extensions + $scheme->getScheme('Wrap')->include_file_extensions, + $cache_callbacks, + $handler_options ); $adapter_instance['Menuitem'] = $this->createHandler( @@ -109,7 +132,9 @@ public function onBeforeInstantiation(array $dependency_values = null) $this->base_path, $resource_map, array(), - $scheme->getScheme('Menuitem')->include_file_extensions + $scheme->getScheme('Menuitem')->include_file_extensions, + $cache_callbacks, + $handler_options ); return $this->dependencies; @@ -122,8 +147,8 @@ public function onBeforeInstantiation(array $dependency_values = null) * @param string $base_path * @param array $resource_map * @param array $namespace_prefixes - * @param array $valid_file_extensions - * @param bool $extensions + * @param array $cache_callbacks + * @param array $handler_options * * @return mixed * @since 1.0.0 @@ -134,7 +159,9 @@ protected function createHandler( $base_path, $resource_map, $namespace_prefixes, - $valid_file_extensions + $valid_file_extensions, + array $cache_callbacks = array(), + array $handler_options = array() ) { $class = 'Molajo\\Resource\\Adapter\\' . $adapter; @@ -144,8 +171,8 @@ protected function createHandler( $resource_map, $namespace_prefixes, $valid_file_extensions, - $this->dependencies['Runtimedata']->reference_data->extensions, - $this->dependencies['Resource'] + $cache_callbacks, + $handler_options ); } catch (Exception $e) { throw new RuntimeException( diff --git a/Source/Adapter/AbstractAdapter.php b/Source/Adapter/AbstractAdapter.php index 28d8800..e9402fe 100644 --- a/Source/Adapter/AbstractAdapter.php +++ b/Source/Adapter/AbstractAdapter.php @@ -10,7 +10,6 @@ use CommonApi\Resource\AdapterInterface; use CommonApi\Exception\RuntimeException; -use Exception; /** * Abstract Resource Adapter @@ -20,7 +19,7 @@ * @license http://www.opensource.org/licenses/mit-license.html MIT License * @since 1.0 */ -class AbstractAdapter implements AdapterInterface +class AbstractAdapter extends Cache implements AdapterInterface { /** * Resource Namespace @@ -77,6 +76,7 @@ class AbstractAdapter implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions + * @param array $cache_callbacks * * @since 1.0.0 */ @@ -84,12 +84,48 @@ public function __construct( $base_path = null, array $resource_map = array(), array $namespace_prefixes = array(), - array $valid_file_extensions = array() + array $valid_file_extensions = array(), + array $cache_callbacks = array() ) { $this->base_path = $base_path . '/'; $this->resource_map = $resource_map; $this->namespace_prefixes = $namespace_prefixes; $this->valid_file_extensions = $valid_file_extensions; + + $this->instantiateCache($cache_callbacks); + } + + /** + * Instantiate Cache Class + * + * @param array $cache_callbacks + * + * @return $this + * @since 1.0.0 + */ + public function instantiateCache(array $cache_callbacks = array()) + { + if (isset($cache_callbacks['get_cache_callback'])) { + $get_cache_callback = $cache_callbacks['get_cache_callback']; + } else { + $get_cache_callback = null; + } + + if (isset($cache_callbacks['set_cache_callback'])) { + $set_cache_callback = $cache_callbacks['set_cache_callback']; + } else { + $set_cache_callback = null; + } + + if (isset($cache_callbacks['delete_cache_callback'])) { + $delete_cache_callback = $cache_callbacks['delete_cache_callback']; + } else { + $delete_cache_callback = null; + } + + parent::__construct($get_cache_callback, $set_cache_callback, $delete_cache_callback); + + return $this; } /** @@ -227,7 +263,7 @@ public function get($resource_namespace, $multiple = false) */ protected function searchNamespacePrefixes($resource_namespace, $multiple) { - $located_path = false; + $located_path = false; foreach ($this->namespace_prefixes as $namespace_prefix => $base_directories) { diff --git a/Source/Adapter/Cache.php b/Source/Adapter/Cache.php new file mode 100644 index 0000000..2068a44 --- /dev/null +++ b/Source/Adapter/Cache.php @@ -0,0 +1,132 @@ +get_cache_callback = $get_cache_callback; + $this->set_cache_callback = $set_cache_callback; + $this->delete_cache_callback = $delete_cache_callback; + $this->cache_type = 'Cacheconfiguration'; + } + + /** + * Get Cache Item if it exists + * + * @param string $key + * + * @return mixed + * @since 1.0.0 + */ + protected function getConfigurationCache($key) + { + if ($this->useConfigurationCache() === false) { + return null; + } + + $cache_item = $this->getCache(md5($key)); + + if ($cache_item->isHit() === true) { + $this->cached_result = $cache_item->getValue(); + return true; + } + + $this->cached_result = null; + + return false; + } + + /** + * Set Cache if it is to be used for Model Registry + * + * @param string $key + * @param mixed $value + * + * @return $this + * @since 1.0.0 + */ + protected function setConfigurationCache($key, $value) + { + if ($this->useConfigurationCache() === false) { + return $this; + } + + $this->setCache(md5($key), $value); + + return $this; + } + + /** + * Delete Cache for a specific item or all of this type + * + * @param string $key + * + * @return $this + * @since 1.0.0 + */ + protected function deleteConfigurationCache($key = null) + { + if ($key === null) { + return $this->clearCache(); + } + + $this->deleteCache(md5($key)); + + return $this; + } + + /** + * Determine if Cache should be used + * + * @return boolean + * @since 1.0.0 + */ + protected function useConfigurationCache() + { + return $this->useCache(); + } +} diff --git a/Source/Adapter/ConfigurationFactory.php b/Source/Adapter/ConfigurationFactory.php index dc5db0a..2951af6 100644 --- a/Source/Adapter/ConfigurationFactory.php +++ b/Source/Adapter/ConfigurationFactory.php @@ -52,7 +52,8 @@ class ConfigurationFactory extends AbstractAdapter * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param array $configuration_dependency_array + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -61,35 +62,37 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - array $configuration_dependency_array = array() + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, - $valid_file_extensions + $valid_file_extensions, + $cache_callbacks ); - $this->saveConfigurationDependencies($configuration_dependency_array); + $this->saveConfigurationDependencies($handler_options); } /** * Save Configuration Dependencies * - * @param array $configuration_dependency_array + * @param array $handler_options * * @return $this * @since 1.0.0 */ - protected function saveConfigurationDependencies(array $configuration_dependency_array = array()) + protected function saveConfigurationDependencies(array $handler_options = array()) { - if (count($configuration_dependency_array) === 0) { + if (count($handler_options) === 0) { return $this; } - $this->data = $configuration_dependency_array['data']; - $this->resource = $configuration_dependency_array['resource']; - $this->registry = $configuration_dependency_array['registry']; + $this->data = $handler_options['data']; + $this->resource = $handler_options['resource']; + $this->registry = $handler_options['registry']; return $this; } diff --git a/Source/Adapter/Css.php b/Source/Adapter/Css.php index 1327cf0..62a4d32 100644 --- a/Source/Adapter/Css.php +++ b/Source/Adapter/Css.php @@ -69,14 +69,6 @@ class Css extends AbstractAdapter implements AdapterInterface */ protected $line_end; - /** - * Mimetype - * - * @var string - * @since 1.0.0 - */ - protected $mimetype; - /** * Constructor * @@ -84,10 +76,8 @@ class Css extends AbstractAdapter implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param string $language_direction - * @param string $html5 - * @param string $line_end - * @param string $mimetype + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -96,22 +86,20 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $language_direction, - $html5, - $line_end, - $mimetype + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, - $valid_file_extensions + $valid_file_extensions, + $cache_callbacks ); - $this->language_direction = $language_direction; - $this->html5 = $html5; - $this->line_end = $line_end; - $this->mimetype = $mimetype; + $this->language_direction = $handler_options['language_direction']; + $this->html5 = $handler_options['html5']; + $this->line_end = $handler_options['line_end']; } /** diff --git a/Source/Adapter/Cssdeclarations.php b/Source/Adapter/Cssdeclarations.php index 3a50802..0d387e5 100644 --- a/Source/Adapter/Cssdeclarations.php +++ b/Source/Adapter/Cssdeclarations.php @@ -76,10 +76,8 @@ class CssDeclarations extends AbstractAdapter implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param string $language_direction - * @param string $html5 - * @param string $line_end - * @param string $mimetype + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -88,10 +86,8 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $language_direction, - $html5, - $line_end, - $mimetype + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, @@ -100,10 +96,9 @@ public function __construct( $valid_file_extensions ); - $this->language_direction = $language_direction; - $this->html5 = $html5; - $this->line_end = $line_end; - $this->mimetype = $mimetype; + $this->language_direction = $handler_options['language_direction']; + $this->html5 = $handler_options['html5']; + $this->line_end = $handler_options['line_end']; } /** diff --git a/Source/Adapter/Extension.php b/Source/Adapter/Extension.php index 80a935a..a1bb0fe 100644 --- a/Source/Adapter/Extension.php +++ b/Source/Adapter/Extension.php @@ -84,8 +84,8 @@ class Extension extends AbstractAdapter implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -94,19 +94,19 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $resource + $cache_callbacks ); - $this->extensions = $extensions; - $this->resource = $resource; + $this->extensions = $handler_options['extensions']; + $this->resource = $handler_options['resource']; } /** diff --git a/Source/Adapter/Field.php b/Source/Adapter/Field.php index 51aa519..b1a9264 100644 --- a/Source/Adapter/Field.php +++ b/Source/Adapter/Field.php @@ -36,7 +36,8 @@ class Field extends AbstractAdapter implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param array $fields + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -45,16 +46,18 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - array $fields = array() + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, - $valid_file_extensions + $valid_file_extensions, + $cache_callbacks ); - $this->fields = $fields; + $this->fields = $handler_options['fields']; } /** diff --git a/Source/Adapter/Menuitem.php b/Source/Adapter/Menuitem.php index 1abb063..53cc48c 100644 --- a/Source/Adapter/Menuitem.php +++ b/Source/Adapter/Menuitem.php @@ -29,8 +29,8 @@ class Menuitem extends Extension implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -39,16 +39,16 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $extensions, - $resource + $cache_callbacks, + $handler_options ); $this->catalog_type_id = 11000; diff --git a/Source/Adapter/Page.php b/Source/Adapter/Page.php index 6745b4b..5cd0e58 100644 --- a/Source/Adapter/Page.php +++ b/Source/Adapter/Page.php @@ -8,9 +8,7 @@ */ namespace Molajo\Resource\Adapter; -use Exception; use CommonApi\Resource\AdapterInterface; -use CommonApi\Exception\RuntimeException; /** * Page View Resources @@ -29,8 +27,8 @@ class Page extends Extension implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -39,16 +37,16 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $extensions, - $resource + $cache_callbacks, + $handler_options ); $this->catalog_type_id = 8000; diff --git a/Source/Adapter/Template.php b/Source/Adapter/Template.php index 5ada8e5..a67171b 100644 --- a/Source/Adapter/Template.php +++ b/Source/Adapter/Template.php @@ -8,9 +8,7 @@ */ namespace Molajo\Resource\Adapter; -use Exception; use CommonApi\Resource\AdapterInterface; -use CommonApi\Exception\RuntimeException; /** * Template View Resources @@ -29,8 +27,8 @@ class Template extends Extension implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -39,16 +37,16 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $extensions, - $resource + $cache_callbacks, + $handler_options ); $this->catalog_type_id = 9000; diff --git a/Source/Adapter/Theme.php b/Source/Adapter/Theme.php index 1f78be1..f340cf4 100644 --- a/Source/Adapter/Theme.php +++ b/Source/Adapter/Theme.php @@ -8,9 +8,7 @@ */ namespace Molajo\Resource\Adapter; -use Exception; use CommonApi\Resource\AdapterInterface; -use CommonApi\Exception\RuntimeException; /** * Theme Resources @@ -29,8 +27,8 @@ class Theme extends Extension implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -39,16 +37,16 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $extensions, - $resource + $cache_callbacks, + $handler_options ); $this->catalog_type_id = 7000; diff --git a/Source/Adapter/Wrap.php b/Source/Adapter/Wrap.php index fc9e25a..544218f 100644 --- a/Source/Adapter/Wrap.php +++ b/Source/Adapter/Wrap.php @@ -29,8 +29,8 @@ class Wrap extends Extension implements AdapterInterface * @param array $resource_map * @param array $namespace_prefixes * @param array $valid_file_extensions - * @param object $extensions - * @param object $resource + * @param array $cache_callbacks + * @param array $handler_options * * @since 1.0.0 */ @@ -39,16 +39,16 @@ public function __construct( array $resource_map = array(), array $namespace_prefixes = array(), array $valid_file_extensions = array(), - $extensions, - $resource + array $cache_callbacks = array(), + array $handler_options = array() ) { parent::__construct( $base_path, $resource_map, $namespace_prefixes, $valid_file_extensions, - $extensions, - $resource + $cache_callbacks, + $handler_options ); $this->catalog_type_id = 10000; @@ -74,6 +74,7 @@ protected function searchResourceMap($resource_namespace, $multiple = false) $include_path = $path; $this->extension_path = $include_path; + return $include_path; } diff --git a/Source/Adapter/Xml.php b/Source/Adapter/Xml.php index 7fe4425..d945ea3 100644 --- a/Source/Adapter/Xml.php +++ b/Source/Adapter/Xml.php @@ -52,7 +52,7 @@ public function get($resource_namespace, $multiple = false) } /** - * Xml file is located, read, loaded using Simplexml into a string and then sent back + * Xml file is located, read, loaded using simplexml into a string and then sent back * or processed by the Configuration data_object or Model utility * * @param string $scheme @@ -61,23 +61,54 @@ public function get($resource_namespace, $multiple = false) * * @return void|mixed * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException */ public function handlePath($scheme, $located_path, array $options = array()) { - $this->verifyNamespace($options); - $segments = $this->handlePathSegments($options); list($model_type, $model_name) = $this->setModelTypeName($segments); +echo $model_type . ' ' . $model_name . ' ' . $scheme . ' ' . $located_path . '
'; + + if (in_array($model_type, array('Application', 'Dataobject', 'Include')) + || $model_name === 'Application') { + } else { + if ($this->getConfigurationCache($located_path) === true) { + return $this->cached_result; + } + } + $this->verifyFileExists($located_path); - $contents = file_get_contents($located_path); + $contents = file_get_contents($located_path); + $scheme = strtolower(trim($scheme)); $model_type = ucfirst(strtolower(trim($model_type))); - return $this->handlePathResults($scheme, $model_type, $model_name, $located_path, $contents); + $results = $this->handlePathResults($scheme, $model_type, $model_name, $located_path, $contents); + + if (in_array($model_type, array('Application', 'Dataobject', 'Include')) + || $model_name === 'Application') { + } else { + $this->setConfigurationCache($located_path, $results); + } + + return $results; + } + + /** + * Retrieve a collection of a specific handler + * + * @param string $scheme + * @param array $options + * + * @return mixed + * @since 1.0.0 + * @throws \CommonApi\Exception\RuntimeException + */ + public function getCollection($scheme, array $options = array()) + { + return null; } /** @@ -89,8 +120,10 @@ public function handlePath($scheme, $located_path, array $options = array()) * @since 1.0.0 * @throws \CommonApi\Exception\RuntimeException */ - public function handlePathSegments(array $options = array()) + protected function handlePathSegments(array $options = array()) { + $this->verifyNamespace($options); + $segments = explode('//', $options['namespace']); if (count($segments) > 2) { @@ -114,7 +147,7 @@ public function handlePathSegments(array $options = array()) * @return array * @since 1.0.0 */ - public function setModelTypeName(array $segments = array()) + protected function setModelTypeName(array $segments = array()) { if (ucfirst(strtolower($segments[1])) === 'Resources') { $model_type = ucfirst(strtolower($segments[1])); @@ -287,19 +320,4 @@ protected function handlePathQuery($model_type, $model_name, $contents) return $model_configuration->getConfiguration($model_type, $model_name, $xml); } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return null; - } } diff --git a/Source/Configuration/AbstractAdapter.php b/Source/Configuration/AbstractAdapter.php deleted file mode 100644 index 96ccb66..0000000 --- a/Source/Configuration/AbstractAdapter.php +++ /dev/null @@ -1,263 +0,0 @@ -data_object = $data_object; - $this->registry = $registry; - $this->resource = $resource; - } - - /** - * Load registry for requested model resource, returning name of registry collection - * - * @param string $model_type - * @param string $model_name - * @param object $xml - * - * @return string - * @since 1.0.0 - */ - abstract public function getConfiguration($model_type, $model_name, $xml); - - /** - * Set Model Names - * - * @param string $model_type - * @param string $model_name - * - * @return $this - * @since 1.0.0 - */ - protected function setModelNames($model_type, $model_name) - { - $this->model_type = $model_type; - $this->model_name = $model_name; - $this->model_registry = ucfirst(strtolower($this->model_name)) - . ucfirst(strtolower($this->model_type)); - - return $this; - } - - /** - * Set Xml - * - * @param object $xml - * - * @return $this - * @since 1.0.0 - */ - protected function setXml($xml) - { - $this->xml = $xml; - - return $this; - } - - /** - * Create Registry and set model names - * - * @return $this - * @since 1.0.0 - */ - protected function createRegistry() - { - $this->registry->createRegistry($this->model_registry); - - $this->registry->set($this->model_registry, 'model_name', $this->model_name); - $this->registry->set($this->model_registry, 'model_type', $this->model_type); - $this->registry->set($this->model_registry, 'model_registry_name', $this->model_registry); - - return $this; - } - - /** - * Set Model Registry for a specific element (ex. fields, joins, join_fields, etc.) - * - * @param string $key - * @param mixed $attributes - * - * @return $this - * @since 1.0.0 - */ - protected function setModelRegistryElement($key, $verified) - { - $this->registry->set($this->model_registry, $key, $verified); - - return true; - } - - /** - * Get Values for the specified attribute - * - * @param object $xml_extract - * - * @return array - * @since 1.0.0 - */ - protected function getAttributeValues($xml_extract) - { - $values = array(); - - foreach ($xml_extract as $item) { - - $attributes = get_object_vars($item); - $item_attributes = ($attributes["@attributes"]); - - foreach ($item_attributes as $key => $value) { - $values[] = (string)$value; - } - } - - return $values; - } - - /** - * Verify Attributes - * - * @param array $values - * @param array $valid_attributes - * - * @return $field - * @since 1.0.0 - */ - protected function verifyAttributes($values) - { - $verified_attributes = array(); - - foreach ($this->valid_attributes as $attribute) { - if (isset($values[$attribute])) { - $verified_attributes[$attribute] = $values[$attribute]; - } - } - - return $verified_attributes; - } - - /** - * Merge Field - * - * @param string $key - * @param array $verified_attributes - * - * @return $this - * @since 1.0.0 - */ - protected function mergeField($key, array $verified_attributes = array()) - { - $existing = $this->registry->get($this->model_registry, $key); - - if (is_array($existing) && count($existing) > 0) { - } else { - return $verified_attributes; - } - - foreach ($verified_attributes as $key => $value) { - - if (isset($existing[$key])) { - } else { - $existing[$key] = $value; - } - } - - return $existing; - } -} diff --git a/Source/Configuration/Children.php b/Source/Configuration/Children.php deleted file mode 100644 index 5a2bf21..0000000 --- a/Source/Configuration/Children.php +++ /dev/null @@ -1,72 +0,0 @@ -valid_attributes = $this->data_object->get('valid_children_attributes'); - - if ($this->processChildren() === false) { - return $this; - } - - $verified_attributes = array(); - - foreach ($this->xml->table->children->child as $xml_extract) { - - $children = array(); - $attributes = get_object_vars($xml_extract); - $item_attributes = ($attributes["@attributes"]); - - foreach ($this->verifyAttributes($item_attributes) as $key => $value) { - $key = strtolower($key); - $value = strtolower($value); - $children[$key] = $value; - } - - $verified_attributes[] = $children; - } - - $this->setModelRegistryElement('children', $verified_attributes); - - return $this; - } - - /** - * Process Children - * - * @return boolean - * @since 1.0.0 - */ - protected function processChildren() - { - if (isset($this->xml->table->children->child) > 0) { - } else { - return false; - } - - return true; - } -} diff --git a/Source/Configuration/Criteria.php b/Source/Configuration/Criteria.php deleted file mode 100644 index 62b847b..0000000 --- a/Source/Configuration/Criteria.php +++ /dev/null @@ -1,70 +0,0 @@ -valid_attributes = $this->data_object->get('valid_criteria_attributes'); - - if ($this->processCriteria() === false) { - return $this; - } - - $verified_attributes = array(); - - foreach ($this->xml->table->criteria->where as $xml_extract) { - - $criteria = array(); - $attributes = get_object_vars($xml_extract); - $item_attributes = ($attributes["@attributes"]); - - foreach ($this->verifyAttributes($item_attributes) as $key => $value) { - $criteria[$key] = $value; - } - - $verified_attributes[] = $criteria; - } - - $this->setModelRegistryElement('criteria', $verified_attributes); - - return $this; - } - - /** - * Process Criteria - * - * @return boolean - * @since 1.0.0 - */ - protected function processCriteria() - { - if (isset($this->xml->table->criteria->where) > 0) { - } else { - return false; - } - - return true; - } -} diff --git a/Source/Configuration/Customfields.php b/Source/Configuration/Customfields.php deleted file mode 100644 index 3d1331d..0000000 --- a/Source/Configuration/Customfields.php +++ /dev/null @@ -1,107 +0,0 @@ -processCustomfields() === false) { - return $this; - } - - $this->valid_attributes = $this->data_object->get('valid_field_attributes'); - - $customfields = array(); - - foreach ($this->xml->customfields->customfield as $item) { - - $attributes = get_object_vars($item); - $item_attributes = ($attributes["@attributes"]); - $custom_field_group = (string)$item_attributes['name']; - $this->custom_field_groups[] = $custom_field_group; - $custom_field_attributes = ($attributes["field"]); - - foreach ($custom_field_attributes as $field) { - - $attributes = get_object_vars($field); - $field_attributes = ($attributes["@attributes"]); - $name = $field_attributes['name']; - $customfield = $this->resource->get('field:///' . $name); - $verified_attributes = $this->verifyAttributes($customfield); - - $customfields[$name] = $verified_attributes; - } - - $customfields = $this->mergeField($custom_field_group, $customfields); - - ksort($customfields); - - $this->setModelRegistryElement($custom_field_group, $customfields); - } - - return $this; - } - - /** - * Process all fields, filtering with valid attributes array - * - * @return $this - * @since 1.0.0 - */ - protected function setCustomfield($field, array $customfields = array()) - { - $attributes = get_object_vars($field); - $field_attributes = ($attributes["@attributes"]); - $name = $field_attributes['name']; - $customfield = $this->resource->get('field:///' . $name); - $verified_attributes = $this->verifyAttributes($customfield); - - $customfields[$name] = $verified_attributes; - - return $this; - } - - /** - * Process Custom Fields - * - * @return boolean - * @since 1.0.0 - */ - protected function processCustomfields() - { - if (isset($this->xml->customfields->customfield)) { - return true; - } - - return false; - } -} diff --git a/Source/Configuration/Data.php b/Source/Configuration/Data.php deleted file mode 100644 index dbbe3b9..0000000 --- a/Source/Configuration/Data.php +++ /dev/null @@ -1,245 +0,0 @@ -setClassProperties($valid_array); - } - - /** - * Set Class Properties - * - * @param array $valid_array - * - * @return mixed - * @since 1.0.0 - */ - protected function setClassProperties(array $valid_array = array()) - { - foreach ($this->property_array as $key) { - - if (isset($valid_array[$key]) && is_array($valid_array[$key])) { - $this->$key = $valid_array[$key]; - } else { - $this->$key = array(); - } - } - - return $this; - } - - /** - * Set the value of a specified key - * - * @param string $key - * @param mixed $value - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function set($key, $value = null) - { - $key = strtolower($key); - - if (in_array($key, $this->property_array)) { - } else { - throw new RuntimeException('Configuration Data Object: Set invalid key: ' . $key); - } - - $this->$key = $value; - - return; - } - - /** - * Get the current value (or default) of the specified key - * - * @param string $key - * @param mixed $default - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function get($key, $default = null) - { - $key = strtolower($key); - - if (in_array($key, $this->property_array)) { - } else { - throw new RuntimeException('Configuration Data Object: Set invalid key: ' . $key); - } - - if ($this->$key === null) { - $this->$key = $default; - } - - return $this->$key; - } -} diff --git a/Source/Configuration/Dataobject.php b/Source/Configuration/Dataobject.php deleted file mode 100644 index 225071d..0000000 --- a/Source/Configuration/Dataobject.php +++ /dev/null @@ -1,108 +0,0 @@ -setModelNames($model_type, $model_name); - $this->setXml($xml); - $this->getIncludeCode(); - $this->createRegistry(); - $this->setModelRegistry(); - $this->registry->sort($this->model_registry); - - return $this->registry->get($this->model_registry); - } - - /** - * Store Configuration Data in Registry - * - * @return $this - * @since 1.0.0 - */ - protected function setModelRegistry() - { - $this->setModelRegistryKeys($this->data_object->get('valid_data_object_attributes')); - - $this->registry->set($this->model_registry, 'data_object', 'data_object'); - $this->registry->set($this->model_registry, 'model_type', 'data_object'); - $this->registry->set($this->model_registry, 'model_name', $this->registry->get($this->model_registry, 'name')); - - return $this; - } - - /** - * Set Model Registry Keys - * - * @param array $valid_array - * - * @return $this - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function setModelRegistryKeys(array $valid_array = array()) - { - foreach ($this->xml->attributes() as $key => $value) { - - if (in_array((string)$key, $valid_array)) { - $this->registry->set($this->model_registry, $key, (string)$value); - - } else { - throw new RuntimeException( - 'Configuration: setDataObjectRegistry encountered Invalid data_object Attributes ' . $key - ); - } - } - - return $this; - } -} diff --git a/Source/Configuration/Fields.php b/Source/Configuration/Fields.php deleted file mode 100644 index f3dba75..0000000 --- a/Source/Configuration/Fields.php +++ /dev/null @@ -1,83 +0,0 @@ -valid_attributes = $this->data_object->get('valid_field_attributes'); - - if ($this->processFields() === false) { - return $this; - } - - $xml_extract = $this->xml->table->fields->field; - $verified_attributes = array(); - - foreach ($this->getAttributeValues($xml_extract) as $name) { - $verified_attributes = $this->addField($name, $verified_attributes); - } - - $verified_attributes = $this->mergeField('fields', $verified_attributes); - - ksort($verified_attributes); - - $this->setModelRegistryElement('fields', $verified_attributes); - - return $this; - } - - /** - * Process Fields - * - * @return boolean - * @since 1.0.0 - */ - protected function processFields() - { - if (isset($this->xml->table->fields->field)) { - return true; - } - - return false; - } - - /** - * Add Field Definition - * - * @param string $name - * @param array $verified_attributes - * - * @return array - * @since 1.0.0 - */ - protected function addField($name, array $verified_attributes = array()) - { - $field = $this->resource->get('field:///' . $name); - - $verified_attributes[$name] = $this->verifyAttributes($field); - - return $verified_attributes; - } -} diff --git a/Source/Configuration/Foreignkeys.php b/Source/Configuration/Foreignkeys.php deleted file mode 100644 index 2be482c..0000000 --- a/Source/Configuration/Foreignkeys.php +++ /dev/null @@ -1,242 +0,0 @@ -processForeignkeys() === false) { - return $this; - } - - $verified_attributes = array(); - - $foreignkeys = $this->getForeignkeys(); - - foreach ($foreignkeys as $foreignkey) { - $verified_attributes[] = $this->verifyAttributes($foreignkey, $valid_attributes); - } - - $this->setModelRegistryElement('Foreignkeys', $verified_attributes); - - return $this; - } - - /** - * Process Foreignkeys - * - * @return boolean - * @since 1.0.0 - */ - protected function processForeignkeys() - { - if (isset($this->xml->foreignkeys->foreignkey)) { - } else { - return false; - } - - return true; - } - - /** - * Get names of standard fields - * - * @return array - * @since 1.0.0 - */ - protected function getForeignkeys() - { - $foreignkeys = array(); - - foreach ($this->xml->table->foreignkeys->foreignkey as $item) { - $attributes = get_object_vars($item); - $item_attributes = ($attributes["@attributes"]); - foreach ($item_attributes as $key => $value) { - $foreignkeys[] = (string)$value; - } - } - - return $foreignkeys; - } - - /** - * Process foreignkey field definitions for registry - * - * @param array $model_foreignkey_array - * - * @return array - * @since 1.0.0 - */ - protected function processForeignkey(array $model_foreignkey_array = array()) - { - $this->initialiseForeignkeyFields($model_foreignkey_array); - - $this->foreignkey_registry = $this->registry->get( - $this->foreignkey_model_type, - $this->foreignkey_model_name - ); - - $this->setForeignkeyArray($model_foreignkey_array); - $this->setForeignkeyFieldsArray($model_foreignkey_array); - $this->setForeignkeySelectFieldsArray($model_foreignkey_array); - - $this->setModelRegistryElement('Foreignkeys', $this->foreignkey_array); - $this->setModelRegistryElement('ForeignkeyFields', $this->foreignkey_select_array); - - return $this; - } - - /** - * Initialise Foreignkey Fields - * - * @param array $model_foreignkey_array - * - * @return array - * @since 1.0.0 - */ - protected function initialiseForeignkeyFields(array $model_foreignkey_array = array()) - { - $this->foreignkey_model_type = 'Datasource'; - $this->foreignkey_model_name = ucfirst(strtolower($model_foreignkey_array['model'])); - $this->foreignkey_registry = array(); - $this->foreignkey_array = array(); - $this->foreignkey_select_array = array(); - - return $this; - } - - /** - * Initialise Foreignkey Fields - * - * @param array $model_foreignkey_array - * - * @return array - * @since 1.0.0 - */ - protected function setForeignkeyArray(array $model_foreignkey_array = array()) - { - $this->foreignkey_array['table_name'] = $this->foreignkey_registry['table_name']; - - $alias = $model_foreignkey_array['alias']; - if (trim($alias) === '') { - $alias = $this->foreignkey_registry['alias']; - } - $this->foreignkey_array['alias'] = trim($alias); - - $this->foreignkey_array['select'] = $model_foreignkey_array['select']; - - return $this; - } - - /** - * Set Foreignkey to and Foreignkey from in Foreignkey Array - * - * @param array $model_foreignkey_array - * - * @return $this - * @since 1.0.0 - */ - protected function setForeignkeyFieldsArray(array $model_foreignkey_array = array()) - { - $this->foreignkey_array['foreignkey_to'] = $model_foreignkey_array['foreignkey_to']; - $this->foreignkey_array['foreignkey_with'] = $model_foreignkey_array['foreignkey_with']; - - return $this; - } - - /** - * Set Foreignkey Select Fields Array - * - * @return $this - * @since 1.0.0 - */ - protected function setForeignkeySelectFieldsArray() - { - $select_array = explode(',', $this->foreignkey_array['select']); - - if ((int)count($select_array) === 0) { - return $this; - } - - foreach ($select_array as $s) { - - foreach ($this->foreignkey_registry['Fields'] as $field) { - - if ($field['name'] === $s) { - $select_field = array(); - $select_field['name'] = trim($s); - $select_field['as_name'] = trim($this->foreignkey_array['alias'] . '_' . trim($s)); - $select_field['alias'] = $this->foreignkey_array['alias']; - $select_field['table_name'] = $this->foreignkey_array['table_name']; - - $this->foreignkey_select_array[$s] = $select_field; - } - } - } - - return $this; - } -} diff --git a/Source/Configuration/Includes.php b/Source/Configuration/Includes.php deleted file mode 100644 index fa39b6d..0000000 --- a/Source/Configuration/Includes.php +++ /dev/null @@ -1,94 +0,0 @@ -xml->asXML(); - $post_string = ''; - $done = false; - - while ($done === false) { - - $post_string = $this->getIncludeCodeLoop($pre_string); - - if ($post_string === $pre_string) { - $done = true; - } else { - $pre_string = $post_string; - } - } - - $this->xml = simplexml_load_string($post_string); - - if (isset($this->xml->model)) { - $this->xml = $this->xml->model; - } - - return $this; - } - - /** - * Process all include statements currently in XML - * - * @param string $xml_string - * - * @return string - * @since 1.0.0 - */ - protected function getIncludeCodeLoop($xml_string) - { - $pattern = '//'; - - preg_match_all($pattern, $xml_string, $matches); - - $replace_this_array = $matches[0]; - $type_array = $matches[1]; - $include_name_array = $matches[2]; - - if (count($replace_this_array) === 0) { - return $xml_string; - } - - for ($i = 0; $i < count($replace_this_array); $i++) { - - $replace_this = $replace_this_array[$i]; - $name = $include_name_array[$i]; - - if (trim(strtolower($type_array[$i])) === 'field') { - $model_name = $name; - $with_this = ''; - - } else { - $model_name = 'xml:///Molajo//Model//Include//' . $name . '.xml'; - $with_this = $this->resource->get($model_name); - } - - $xml_string = str_replace($replace_this, $with_this, $xml_string); - } - - return $xml_string; - } -} diff --git a/Source/Configuration/Inherit.php b/Source/Configuration/Inherit.php deleted file mode 100644 index d700f96..0000000 --- a/Source/Configuration/Inherit.php +++ /dev/null @@ -1,236 +0,0 @@ - - * - * @return $this - * @since 1.0.0 - */ - protected function inheritDefinition() - { - if ($this->processInheritance() === false) { - return $this; - }; - - $this->extends_model_type = ''; - $this->extends_model_name = ''; - - $model_types = $this->data_object->get('valid_model_types'); - - foreach ($model_types as $model_type) { - - $this->processModelType($model_type); - - if ($this->extends_model_name === '') { - } else { - break; - } - } - - if ($this->extends_model_name === '') { - $this->extends_model_name = ucfirst(strtolower($this->extends)); - $this->extends_model_type = 'Datasource'; - } - - $inherited_model = $this->getInheritedModel(); - - $this->copyInheritedModel($inherited_model); - - return $this; - } - - /** - * Was inheritance used? - * - * @return boolean - * @since 1.0.0 - */ - protected function processInheritance() - { - if (count($this->xml->attributes()) === 0) { - return false; - } - - foreach ($this->xml->attributes() as $key => $value) { - if ($key === 'extends') { - $this->extends = (string)$value; - return true; - } - } - - return false; - } - - /** - * Match to a valid Model Type - * - * @param string $model_type - * - * @return $this - * @since 1.0.0 - */ - protected function processModelType($model_type) - { - if (ucfirst( - strtolower(substr($this->extends, strlen($this->extends) - - strlen($model_type), strlen($model_type)) - ) - ) === $model_type - ) { - $this->extends_model_name = ucfirst(strtolower( - substr($this->extends, - 0, - strlen($this->extends) - strlen($model_type)) - ) - ); - $this->extends_model_type = $model_type; - } - - return $this; - } - - /** - * Get Inherited Model - * - * @return array - * @since 1.0.0 - */ - protected function getInheritedModel() - { - $inherit_model_registry = $this->extends_model_name . $this->extends_model_type; - - if ($this->registry->exists($inherit_model_registry) === true) { - $inherited_model = $this->registry->get($inherit_model_registry); - - } else { - - if ($this->extends_model_type === 'Datasource') { - $get_namespace = 'Molajo//Model//Datasource//' . $this->extends_model_name . '.xml'; - } else { - $get_namespace = 'Molajo//Resource//' . $this->extends_model_name . '//Content.xml'; - } - - $inherited_model = $this->resource->get('xml:///' . $get_namespace); - } - - return $inherited_model; - } - - /** - * Copy Inherited Model - * - * @param array $inherited_model - * - * @return $this - * @since 1.0.0 - */ - protected function copyInheritedModel(array $inherited_model = array()) - { - if (count($inherited_model) === 0) { - return $this; - } - - foreach ($inherited_model as $key => $value) { - - if ($this->registry->exists($this->model_registry, $key) === true) { - $this->mergeInheritedModel($key, $value); - } else { - $this->setModelRegistryElement($key, $value); - } - } - - $this->copyCustomfieldGroups($inherited_model); - - return $this; - } - - /** - * Copy Inherited Model - * - * @param array $inherited_model - * - * @return $this - * @since 1.0.0 - */ - protected function copyCustomfieldGroups(array $inherited_model = array()) - { - if (isset($inherited_model['customfieldgroups'])) { - } else { - return $this; - } - $customfieldgroups = $inherited_model['customfieldgroups']; - - if (is_array($customfieldgroups) && count($customfieldgroups) > 0) { - } else { - return $this; - } - - foreach ($customfieldgroups as $group) { - $this->custom_field_groups[] = $group; - } - - return $this; - } - - /** - * Merge Inherited Model Values into existing for Arrays - * - * @param string $key - * @param mixed $value - * - * @return array - * @since 1.0.0 - */ - protected function mergeInheritedModel($key, $value) - { - $existing_value = $this->registry->get($this->model_registry, $key); - - if (is_array($existing_value)) { - $this->mergeField($key, $value); - } - - return $this; - } -} diff --git a/Source/Configuration/Joins.php b/Source/Configuration/Joins.php deleted file mode 100644 index 566dd27..0000000 --- a/Source/Configuration/Joins.php +++ /dev/null @@ -1,88 +0,0 @@ -valid_attributes = $this->data_object->get('valid_join_attributes'); - - if ($this->processJoins() === false) { - return $this; - } - - $verified_attributes = $this->getJoins(); - - $verified_attributes = $this->mergeField('joins', $verified_attributes); - - $this->setModelRegistryElement('Joins', $verified_attributes); - - return $this; - } - - /** - * Process Joins - * - * @return boolean - * @since 1.0.0 - */ - protected function processJoins() - { - if (isset($this->xml->table->joins)) { - } else { - return false; - } - - if (isset($this->xml->table->joins->join)) { - } else { - return false; - } - - return true; - } - - /** - * Get names of standard fields - * - * @return array - * @since 1.0.0 - */ - protected function getJoins() - { - $join = array(); - $joins = array(); - - foreach ($this->xml->table->joins->join as $item) { - $attributes = get_object_vars($item); - $item_attributes = ($attributes["@attributes"]); - foreach ($item_attributes as $key => $value) { - $join[$key] = (string)$value; - } - $joins[] = $join; - $join = array(); - } - - return $joins; - } -} diff --git a/Source/Configuration/Model.php b/Source/Configuration/Model.php deleted file mode 100644 index 6b61016..0000000 --- a/Source/Configuration/Model.php +++ /dev/null @@ -1,205 +0,0 @@ -custom_field_groups = array(); - $this->setModelNames($model_type, $model_name); - $this->setXml($xml); - $this->createRegistry(); - $this->getIncludeCode(); - $this->setModelRegistry(); - - /** Expand, given inheritance and set data object */ - $this->inheritDefinition(); - $this->setDataObject(); - - /** Define Elements */ - foreach ($this->set_registry_methods as $method) { - $this->$method(); - } - - /** Finalize */ - $this->setCustomfieldsElement(); - - /** Sort and Return */ - $this->registry->sort($this->model_registry); - $registry = $this->registry->get($this->model_registry); - - return $this->unsetFields($registry); - } - - /** - * Store Configuration Data in Registry - * - * @return array - * @since 1.0.0 - */ - protected function setModelRegistry() - { - $model_array = $this->data_object->get('valid_model_attributes'); - - foreach ($this->xml->attributes() as $key => $value) { - - if (in_array($key, $model_array)) { - $this->registry->set($this->model_registry, $key, (string)$value); - } else { - throw new RuntimeException( - 'Configuration: setModelRegistry encountered Invalid Model Attribute ' . $key - ); - } - } - - $name = $this->registry->get($this->model_registry, 'name'); - - $this->registry->set($this->model_registry, 'model_name', $name); - - return $this; - } - - /** - * Set Data Object - * - * @return $this - * @since 1.0.0 - */ - protected function setDataObject() - { - $data_object = $this->registry->get($this->model_registry, 'data_object', ''); - - if ($data_object === '') { - return $this; - } - - $data_object_registry = ucfirst(strtolower($data_object)) . 'Dataobject'; - - if ($this->registry->exists($data_object_registry)) { - $results = $this->registry->get($data_object_registry); - } else { - $results = $this->resource->get('xml:///Molajo//Model//Dataobject//' - . ucfirst(strtolower($data_object)) . '.xml'); - } - - foreach ($results as $key => $value) { - $this->registry->set($this->model_registry, 'data_object_' . $key, $value); - } - - return $this; - } - - /** - * Set Data Object - * - * @return string - * @since 1.0.0 - */ - protected function setDefaultDataobject() - { - $data_object = 'Database'; - - $this->registry->set($this->model_registry, 'data_object', $data_object); - - return $data_object; - } - - /** - * Set Data Object - * - * @param array $registry - * - * @return string - * @since 1.0.0 - */ - protected function unsetFields($registry) - { - if (isset($registry['extends'])) { - unset($registry['extends']); - } - - return $registry; - } - - /** - * Set Custom Fields Element - * - * @return $this - * @since 1.0.0 - */ - protected function setCustomfieldsElement() - { - $groups = array_unique($this->custom_field_groups); - sort($groups); - $this->setModelRegistryElement('customfieldgroups', $groups); - - return $this; - } -} diff --git a/Source/Configuration/Plugins.php b/Source/Configuration/Plugins.php deleted file mode 100644 index e4da3cd..0000000 --- a/Source/Configuration/Plugins.php +++ /dev/null @@ -1,64 +0,0 @@ -valid_attributes = $this->data_object->get('valid_plugin_attributes'); - - if ($this->processPlugins() === false) { - return $this; - } - - $verified_attributes = array(); - - foreach ($this->xml->table->plugins->plugin as $xml_extract) { - $attributes = get_object_vars($xml_extract); - $item_attributes = ($attributes["@attributes"]); - $plugin = $this->verifyAttributes($item_attributes); - $verified_attributes[] = $plugin['name']; - } - - $this->setModelRegistryElement('plugins', $verified_attributes); - - return $this; - } - - /** - * Process Plugins - * - * @return boolean - * @since 1.0.0 - */ - protected function processPlugins() - { - if (isset($this->xml->table->plugins->plugin) > 0) { - } else { - return false; - } - - return true; - } -} diff --git a/Source/Configuration/Registry.php b/Source/Configuration/Registry.php deleted file mode 100644 index d2991ca..0000000 --- a/Source/Configuration/Registry.php +++ /dev/null @@ -1,215 +0,0 @@ -initialiseNameKey($name, $key); - - if ($this->existsName($name) === false) { - return false; - } - - if ($key === null) { - return true; - } - - return $this->existsNameKey($name, $key); - } - - /** - * Create a registry - * - * @param string $name - * - * @return array - * @since 1.0.0 - */ - public function createRegistry($name) - { - $name = strtolower($name); - - $this->registry[$name] = array(); - - return $this->registry[$name]; - } - - /** - * Get Registry Data - * - * @param string $name - * @param string $key - * - * @return mixed - * @since 1.0.0 - */ - public function get($name, $key = null) - { - list($name, $key) = $this->initialiseNameKey($name, $key); - - if ($this->exists($name, $key) === false) { - return null; - } - - $registry = $this->registry[$name]; - - if ($key === null) { - return $registry; - } - - if (isset($registry[$key])) { - return $registry[$key]; - } - - return null; - } - - /** - * Sets the value for a specific registry $key $value pair - * - * @param string $name - * @param string $key - * @param mixed $value - * - * @return $this - * @since 1.0.0 - */ - public function set($name, $key, $value = null) - { - list($name, $key) = $this->initialiseNameKey($name, $key); - - if ($this->exists($name) === false) { - $registry = $this->createRegistry($name); - } else { - $registry = $this->registry[$name]; - } - - $registry[$key] = $value; - $this->registry[$name] = $registry; - - return $this; - } - - /** - * Sort Registry - * - * @param string $name - * - * @return $this - * @since 1.0.0 - */ - public function sort($name) - { - $name = strtolower($name); - - $registry = $this->registry[$name]; - - ksort($registry); - - $this->registry[$name] = $registry; - - return $this; - } - - /** - * Verify Registry exists - * - * @param string $name - * - * @return boolean - * @since 1.0.0 - */ - protected function existsName($name) - { - $name = strtolower($name); - - if (isset($this->registry[$name])) { - return true; - } - - return false; - } - - /** - * Verify Registry Key exists - * - * @param string $name - * @param string $key - * - * @return boolean - * @since 1.0.0 - */ - protected function existsNameKey($name, $key) - { - list($name, $key) = $this->initialiseNameKey($name, $key); - - $registry = $this->registry[$name]; - - if (is_array($registry) && count($registry) > 0) { - } else { - return false; - } - - if (isset($registry[$key])) { - return true; - } - - return false; - } - - /** - * Set Name and Key to lowercase - * - * @param string $name - * @param string $key - * - * @return array - * @since 1.0.0 - */ - protected function initialiseNameKey($name, $key) - { - $name = strtolower($name); - - if ($key === null) { - } else { - $key = strtolower($key); - } - - return array($name, $key); - } -} diff --git a/Source/Configuration/Values.php b/Source/Configuration/Values.php deleted file mode 100644 index 19c8ee0..0000000 --- a/Source/Configuration/Values.php +++ /dev/null @@ -1,70 +0,0 @@ -valid_attributes = $this->data_object->get('valid_value_attributes'); - - if ($this->processValues() === false) { - return $this; - } - - $verified_attributes = array(); - - foreach ($this->xml->table->values->value as $xml_extract) { - - $values = array(); - $attributes = get_object_vars($xml_extract); - $item_attributes = ($attributes["@attributes"]); - - foreach ($this->verifyAttributes($item_attributes) as $key => $value) { - $values[$key] = $value; - } - - $verified_attributes[] = $values; - } - - $this->setModelRegistryElement('values', $verified_attributes); - - return $this; - } - - /** - * Process Values - * - * @return boolean - * @since 1.0.0 - */ - protected function processValues() - { - if (isset($this->xml->table->values->value) > 0) { - } else { - return false; - } - - return true; - } -} diff --git a/Source/xxxFields.php b/Source/xxxFields.php deleted file mode 100644 index 695b6db..0000000 --- a/Source/xxxFields.php +++ /dev/null @@ -1,275 +0,0 @@ -resource = $resource; - $this->runtime_data = $runtime_data; - $this->field_path = $field_path; - } - - /** - * Process Fields - * - * @return $this - * @since 1.0.0 - */ - public function processFields() - { - $files = scandir($this->field_path); - - if (count($files) === 0) { - return $this; - } - - foreach ($files as $file_name) { - if ($file_name === '.' || $file_name === '..') { - } else { - $this->readField($file_name); - } - } - - $id = 1; - foreach ($this->fields as $field_name => $field) { - $this->insertField($field, $id++); - } - - return $this; - } - - /** - * Read Field File - * - * @param string $file_name - * - * @return $this - * @since 1.0.0 - */ - public function readField($file_name) - { - if (file_exists(($this->field_path . $file_name))) { - } else { - return $this; - } - - $string = file_get_contents($this->field_path . $file_name); - $xml = simplexml_load_string($string); - - if (count($xml->attributes()) > 0) { - } else { - return $this; - } - - $row = new stdClass(); - foreach ($xml->attributes() as $key => $value) { - $key_name = (string)$key; - $value_string = (string)$value; - $row->$key_name = $value_string; - } - - $this->fields[substr($file_name, 0, strlen($file_name) - 4)] = $row; - - return $this; - } - - /** - * Insert Field - * - * @param object $field - * @param integer $id - * - * @return boolean - * @since 1.0.0 - */ - protected function insertField($field, $id) - { - $this->query = null; - - $this->connect('create'); - - $this->query->setModelRegistry('process_events', 1); - $this->query->setModelRegistry('check_view_level_access', 0); - $this->query->setModelRegistry('get_customfields', 0); - $this->query->setModelRegistry('use_special_joins', 0); - - $row = $this->query->initialiseRow(); - $row = $this->setInsertValues($row, $field, $id); - $this->query->setInsertStatement($row); - $this->query->setSql(); - $this->query->insertData(); - - return $this; - } - - /** - * Set Language Field Values for Insert - * - * @param object $row - * @param object $field - * @param integer $id - * - * @return object - * @since 1.0.0 - */ - protected function setInsertValues($row, $field, $id) - { - unset($row->id); - $row->extension_id = $this->field_catalog_type_id; - $row->catalog_type_id = $this->field_catalog_type_id; - $row->title = ucfirst(strtolower($field->name)); - $row->path = 'fields'; - $row->parent_id = 0; - $row->translation_of_id = 0; - $row->protected = 1; - $row->content_text = ''; - $row->language = 'en-GB'; - $row->ordering = $id; - $row->status = 1; - $row->customfields = $this->setCustomFields($field); - - return $row; - } - - /** - * Set Customfield Elements - * - * @return object - * @since 1.0.0 - */ - protected function setCustomFields($field) - { - $custom_fields = $this->query->getModelRegistry('customfields'); - - $row = new stdClass(); - - foreach ($custom_fields as $custom_field) { - - $key = $custom_field['name']; - $value = null; - - if (isset($field->$key)) { - $value = $field->$key; - - } elseif (isset($custom_field['default'])) { - $value = $custom_field['default']; - } - - $row->$key = $value; - } - - return json_encode($row, JSON_PRETTY_PRINT); - } - - /** - * Get Query Connection - * - * @param string $crud_type - * - * @return boolean - * @since 1.0.0 - */ - protected function connect($crud_type = 'Create') - { - $options = array(); - $crud_type = ucfirst(strtolower($crud_type)); - if ($crud_type === 'Create' - || $crud_type === 'Read' - || $crud_type === 'Update' - || $crud_type === 'Delete' - ) { - } else { - $crud_type = 'Read'; - } - - $options['crud_type'] = $crud_type; - $options['runtime_data'] = $this->runtime_data; - - $this->query = $this->resource->get( - 'query:///Molajo//Model//Datasource//Fields.xml', - $options - ); - - $this->query->clearQuery(); - - return $this; - } -} From d79ede585f0112ce9c05c3d8a94224c5587d54ff Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Thu, 19 Feb 2015 20:37:31 -0600 Subject: [PATCH 04/11] Move classes into application and query --- Factories/Extensions/Configuration.xml | 13 - .../Extensions/ExtensionsFactoryMethod.php | 153 ---- Factories/Registry/Configuration.xml | 13 - Factories/Registry/RegistryFactoryMethod.php | 41 -- Factories/Resource/Configuration.xml | 13 - Factories/Resource/ResourceFactoryMethod.php | 287 -------- Factories/Resourcecss/Configuration.xml | 13 - .../Resourcecss/ResourcecssFactoryMethod.php | 139 ---- .../Resourcecssdeclarations/Configuration.xml | 13 - .../ResourcecssdeclarationsFactoryMethod.php | 140 ---- Factories/Resourcedata/Configuration.xml | 13 - .../ResourcedataFactoryMethod.php | 474 ------------ Factories/Resourcejs/Configuration.xml | 13 - .../Resourcejs/ResourcejsFactoryMethod.php | 133 ---- .../Resourcejsdeclarations/Configuration.xml | 13 - .../ResourcejsdeclarationsFactoryMethod.php | 132 ---- Factories/Resourcerendering/Configuration.xml | 13 - .../ResourcerenderingFactoryMethod.php | 230 ------ Source/Adapter/Asset.php | 43 -- Source/Adapter/ConfigurationFactory.php | 150 ---- Source/Adapter/Css.php | 338 --------- Source/Adapter/Cssdeclarations.php | 190 ----- Source/Adapter/Extension.php | 202 ------ Source/Adapter/Field.php | 118 --- Source/Adapter/Head.php | 43 -- Source/Adapter/Js.php | 309 -------- Source/Adapter/Jsdeclarations.php | 143 ---- Source/Adapter/Menuitem.php | 155 ---- Source/Adapter/Page.php | 108 --- Source/Adapter/Template.php | 108 --- Source/Adapter/Theme.php | 103 --- Source/Adapter/Wrap.php | 111 --- Source/Adapter/Xml.php | 323 --------- Source/ClassMap/Items.php | 1 + Source/ExtensionMap.php | 672 ------------------ composer.json | 1 - 36 files changed, 1 insertion(+), 4963 deletions(-) delete mode 100644 Factories/Extensions/Configuration.xml delete mode 100644 Factories/Extensions/ExtensionsFactoryMethod.php delete mode 100644 Factories/Registry/Configuration.xml delete mode 100644 Factories/Registry/RegistryFactoryMethod.php delete mode 100644 Factories/Resource/Configuration.xml delete mode 100644 Factories/Resource/ResourceFactoryMethod.php delete mode 100644 Factories/Resourcecss/Configuration.xml delete mode 100644 Factories/Resourcecss/ResourcecssFactoryMethod.php delete mode 100644 Factories/Resourcecssdeclarations/Configuration.xml delete mode 100644 Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php delete mode 100644 Factories/Resourcedata/Configuration.xml delete mode 100644 Factories/Resourcedata/ResourcedataFactoryMethod.php delete mode 100644 Factories/Resourcejs/Configuration.xml delete mode 100644 Factories/Resourcejs/ResourcejsFactoryMethod.php delete mode 100644 Factories/Resourcejsdeclarations/Configuration.xml delete mode 100644 Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php delete mode 100644 Factories/Resourcerendering/Configuration.xml delete mode 100644 Factories/Resourcerendering/ResourcerenderingFactoryMethod.php delete mode 100644 Source/Adapter/Asset.php delete mode 100644 Source/Adapter/ConfigurationFactory.php delete mode 100644 Source/Adapter/Css.php delete mode 100644 Source/Adapter/Cssdeclarations.php delete mode 100644 Source/Adapter/Extension.php delete mode 100644 Source/Adapter/Field.php delete mode 100644 Source/Adapter/Head.php delete mode 100644 Source/Adapter/Js.php delete mode 100644 Source/Adapter/Jsdeclarations.php delete mode 100644 Source/Adapter/Menuitem.php delete mode 100644 Source/Adapter/Page.php delete mode 100644 Source/Adapter/Template.php delete mode 100644 Source/Adapter/Theme.php delete mode 100644 Source/Adapter/Wrap.php delete mode 100644 Source/Adapter/Xml.php delete mode 100644 Source/ExtensionMap.php diff --git a/Factories/Extensions/Configuration.xml b/Factories/Extensions/Configuration.xml deleted file mode 100644 index 431ba4e..0000000 --- a/Factories/Extensions/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Extensions - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Extensions Factory - - diff --git a/Factories/Extensions/ExtensionsFactoryMethod.php b/Factories/Extensions/ExtensionsFactoryMethod.php deleted file mode 100644 index 7eeac1b..0000000 --- a/Factories/Extensions/ExtensionsFactoryMethod.php +++ /dev/null @@ -1,153 +0,0 @@ -dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; - $this->dependencies['Cache'] = $options; - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['extensions_filename'] - = $this->base_path . '/Bootstrap/Files/Output/Extensions.json'; - - return $this->dependencies; - } - - /** - * Instantiate Class - * - * @return $this - * @since 1.0.0 - */ - public function instantiateClass() - { - $cache_results = $this->dependencies['Cache']->get('Extensions'); - - if ($cache_results === false || $cache_results->value === null) { - } else { - $this->product_result = $cache_results->value; - - return $this; - } - - if (is_file($this->dependencies['extensions_filename'])) { - $this->product_result = $this->readFile($this->dependencies['extensions_filename']); - } else { - $this->createMap(); - } - - $this->dependencies['Cache']->set('Extensions', $this->product_result); - - return $this; - } - - /** - * Create Extensions Map - * - * @return $this - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createMap() - { - try { - $extension_map = new $this->product_namespace( - $this->dependencies['Resource'], - $this->dependencies['Runtimedata'], - $this->dependencies['extensions_filename'] - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Render: Could not instantiate Handler: ' . $this->product_namespace - ); - } - - $this->product_result = $extension_map->createMap(); - - return $this; - } - - /** - * Factory Method Controller requests any Products (other than the current product) to be saved - * - * @return array - * @since 1.0.0 - */ - public function setContainerEntries() - { - $this->dependencies['Runtimedata']->reference_data->extensions = $this->product_result; - $this->set_container_entries['Runtimedata'] = $this->dependencies['Runtimedata']; - - return $this->set_container_entries; - } -} diff --git a/Factories/Registry/Configuration.xml b/Factories/Registry/Configuration.xml deleted file mode 100644 index 9db5348..0000000 --- a/Factories/Registry/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Registry - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Registry Factory - - diff --git a/Factories/Registry/RegistryFactoryMethod.php b/Factories/Registry/RegistryFactoryMethod.php deleted file mode 100644 index c2e9d87..0000000 --- a/Factories/Registry/RegistryFactoryMethod.php +++ /dev/null @@ -1,41 +0,0 @@ - - - Resource - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resource Factory - - diff --git a/Factories/Resource/ResourceFactoryMethod.php b/Factories/Resource/ResourceFactoryMethod.php deleted file mode 100644 index 1eab179..0000000 --- a/Factories/Resource/ResourceFactoryMethod.php +++ /dev/null @@ -1,287 +0,0 @@ -dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Fulfill Dependencies - * - * @param array $dependency_values (ignored in Service Item Adapter, based in from handler) - * - * @return $this - * @since 1.0.0 - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - $this->dependencies['Scheme'] = $this->createScheme(); - - $adapter_instance = array(); - - $resource_map = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - - $fields = $this->readFile( - $this->base_path . '/Bootstrap/Files/Model/Fields.json' - ); - - $cache_callbacks = array( - 'get_cache_callback' => $this->dependencies['Getcachecallback'], - 'set_cache_callback' => $this->dependencies['Setcachecallback'], - 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] - ); - - $empty_handler_options = array(); - - /** - * NOTE: - * Css, CssDeclarations, JsDeclarations, and Js loaded in Application Factory - * QueryHandler loaded following Database Factory Method - */ - $adapter_instance['Asset'] - = $this->createAdapter( - 'Asset', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('Asset')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - $adapter_instance['ClassLoader'] - = $this->createAdapter( - 'ClassLoader', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('ClassLoader')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - $adapter_instance['Field'] - = $this->createAdapter( - 'Field', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('Field')->include_file_extensions, - $cache_callbacks, - array('fields' => $fields) - ); - $adapter_instance['File'] - = $this->createAdapter( - 'File', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('File')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - $adapter_instance['Folder'] - = $this->createAdapter( - 'Folder', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('Folder')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - $adapter_instance['Head'] - = $this->createAdapter( - 'Head', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('Head')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - $adapter_instance['Xml'] - = $this->createAdapter( - 'Xml', - $this->base_path, - $resource_map, - array(), - $this->dependencies['Scheme']->getScheme('Xml')->include_file_extensions, - $cache_callbacks, - $empty_handler_options - ); - - $this->dependencies['adapter_instance_array'] = $adapter_instance; - - return $this->dependencies; - } - - /** - * Factory Method Controller triggers the Factory Method to create the Class for the Service - * - * @return $this - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function instantiateClass() - { - $class = 'Molajo\\Resource\\Driver'; - - $this->product_result = new $class( - $this->dependencies['Scheme'], - $this->dependencies['adapter_instance_array'] - ); - - return $this; - } - - /** - * Request for array of Factory Methods to be Scheduled - * - * @return object - * @since 1.0.0 - */ - public function scheduleFactories() - { - $options = array(); - $options['store_instance_indicator'] = true; - $options['product_name'] = 'Fieldhandler'; - $this->schedule_factory_methods['Fieldhandler'] = $options; - - $options = array(); - $options['Resource'] = $this->product_result; - $this->schedule_factory_methods['Resourcedata'] = $options; - - $options = array(); - $options['store_instance_indicator'] = true; - $options['product_name'] = 'Exceptionhandling'; - $this->schedule_factory_methods['Exceptionhandling'] = $options; - - return $this->schedule_factory_methods; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } - - /** - * Create Handler Instance - * - * @param string $adapter - * @param string $base_path - * @param array $resource_map - * @param array $namespace_prefixes - * @param array $valid_file_extensions - * @param array $cache_callbacks - * @param array $handler_options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createAdapter( - $adapter, - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions, - array $cache_callbacks = array(), - array $handler_options = array() - ) { - $class = 'Molajo\\Resource\\Adapter\\' . $adapter; - - try { - $adapter_instance = new $class ( - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions, - $cache_callbacks, - $handler_options - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Adapter ' . $adapter - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $adapter_instance; - } -} diff --git a/Factories/Resourcecss/Configuration.xml b/Factories/Resourcecss/Configuration.xml deleted file mode 100644 index 87e5599..0000000 --- a/Factories/Resourcecss/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Resourcecss - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resourcecss Factory - - diff --git a/Factories/Resourcecss/ResourcecssFactoryMethod.php b/Factories/Resourcecss/ResourcecssFactoryMethod.php deleted file mode 100644 index b422118..0000000 --- a/Factories/Resourcecss/ResourcecssFactoryMethod.php +++ /dev/null @@ -1,139 +0,0 @@ -dependencies['Resource'] = array(); - $this->dependencies['Runtimedata'] = array(); - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['base_path'] = $this->base_path; - $this->dependencies['resource_map'] = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - $this->options['Scheme'] = $this->createScheme(); - $this->dependencies['namespace_prefixes'] = array(); - $scheme = $this->options['Scheme']->getScheme('Css'); - $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - - $cache_callbacks = array(); - $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; - $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; - $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; - $this->dependencies['cache_callbacks'] = $cache_callbacks; - - $handler_options = array(); - $handler_options['language_direction'] - = $this->dependencies['Runtimedata']->application->parameters->language_direction; - $handler_options['html5'] - = $this->dependencies['Runtimedata']->application->parameters->application_html5; - $handler_options['line_end'] - = $this->dependencies['Runtimedata']->application->parameters->application_line_end; - $this->dependencies['handler_options'] - = $handler_options; - - return $this->dependencies; - } - - /** - * Follows the completion of the instantiate method - * - * @return $this - * @since 1.0.0 - */ - public function onAfterInstantiation() - { - $this->dependencies['Resource']->setAdapterInstance('Css', $this->product_result); - - return $this; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } -} diff --git a/Factories/Resourcecssdeclarations/Configuration.xml b/Factories/Resourcecssdeclarations/Configuration.xml deleted file mode 100644 index 43fbb59..0000000 --- a/Factories/Resourcecssdeclarations/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Resourcecssdeclarations - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resourcecssdeclarations Factory - - diff --git a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php b/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php deleted file mode 100644 index 92b7657..0000000 --- a/Factories/Resourcecssdeclarations/ResourcecssdeclarationsFactoryMethod.php +++ /dev/null @@ -1,140 +0,0 @@ -dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['base_path'] = $this->base_path; - $this->dependencies['resource_map'] = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - $this->options['Scheme'] = $this->createScheme(); - $this->dependencies['namespace_prefixes'] = array(); - $scheme = $this->options['Scheme']->getScheme('cssd'); - $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - - $cache_callbacks = array(); - $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; - $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; - $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; - $this->dependencies['cache_callbacks'] = $cache_callbacks; - - $handler_options = array(); - $handler_options['language_direction'] - = $this->dependencies['Runtimedata']->application->parameters->language_direction; - $handler_options['html5'] - = $this->dependencies['Runtimedata']->application->parameters->application_html5; - $handler_options['line_end'] - = $this->dependencies['Runtimedata']->application->parameters->application_line_end; - $this->dependencies['handler_options'] - = $handler_options; - - return $this->dependencies; - } - - /** - * Follows the completion of the instantiate method - * - * @return $this - * @since 1.0.0 - */ - public function onAfterInstantiation() - { - $this->dependencies['Resource']->setAdapterInstance('CssDeclarations', $this->product_result); - - return $this; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } -} diff --git a/Factories/Resourcedata/Configuration.xml b/Factories/Resourcedata/Configuration.xml deleted file mode 100644 index 9efe5eb..0000000 --- a/Factories/Resourcedata/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Configuration Data - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Configurationdata Factory - - diff --git a/Factories/Resourcedata/ResourcedataFactoryMethod.php b/Factories/Resourcedata/ResourcedataFactoryMethod.php deleted file mode 100644 index 24ab1ab..0000000 --- a/Factories/Resourcedata/ResourcedataFactoryMethod.php +++ /dev/null @@ -1,474 +0,0 @@ -options['Resource'] = $options['Resource']; - } - - /** - * Retrieve and load valid properties for fields, data models and data objects - * - * @param array $reflection - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function setDependencies(array $reflection = array()) - { - parent::setDependencies($reflection); - - $options = array(); - $options['product_namespace'] = 'Molajo\\Resource\\Configuration\\Registry'; - $this->dependencies['Registry'] = $options; - - /** Fields Configuration */ - $f = $this->options['Resource']->get('xml:///Molajo//Model//Application//Fields.xml'); - - /** Data Objects */ - $this->loadFieldProperties($f, 'dataobjecttypes', 'dataobjecttype', 'valid_data_object_types'); - $this->loadFieldPropertiesWithAttributes($f, 'dataobjectattributes', 'dataobjectattribute', - 'valid_data_object_attributes'); - - /** Models */ - $this->loadFieldProperties($f, 'modeltypes', 'modeltype', 'valid_model_types'); - $this->loadFieldPropertiesWithAttributes($f, 'modelattributes', 'modelattribute', 'valid_model_attributes'); - - /** Data Types */ - $this->loadFieldPropertiesWithAttributes($f, 'datatypes', 'datatypes', 'valid_data_types'); - $this->loadFieldProperties($f, 'queryelements', 'queryelement', 'valid_queryelements_attributes'); - - $list = $this->valid_queryelements_attributes; - - foreach ($list as $item) { - $field = explode(',', $item); - $this->loadFieldProperties($f, $field[0], $field[1], $field[2]); - } - - $data_lists_array = array(); - $path = $this->base_path . '/vendor/molajo/application/Source/Model/Datalist'; - $data_lists_array = $this->loadDatalists($data_lists_array, $path); - $data_lists_array = array_unique($data_lists_array); - - $this->valid_datalists = $data_lists_array; - - $this->setValidArray(); - - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Instantiate Class - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function instantiateClass() - { - try { - $class = $this->product_namespace; - $this->product_result = new $class($this->options['valid_array']); - - } catch (Exception $e) { - - throw new RuntimeException( - 'IoC Factory Method Adapter Instance Failed for ' . $this->product_namespace - . ' failed.' . $e->getMessage() - ); - } - - return $this; - } - - /** - * Follows the completion of the instantiate method - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onAfterInstantiation() - { - $xml = $this->createXml(); - - $this->options['Resource']->setAdapterInstance('Xml', $xml); - - return $this; - } - - /** - * Factory Method Controller requests any Products (other than the current product) to be saved - * - * @return array - * @since 1.0.0 - */ - public function setContainerEntries() - { - $this->set_container_entries['Resource'] = $this->options['Resource']; - - return $this->set_container_entries; - } - - /** - * loadFieldProperties - * - * @param string $xml - * @param string $plural - * @param string $singular - * @param string $parameter_name - * - * @return $this - * @since 1.0.0 - */ - protected function loadFieldProperties($xml, $plural, $singular, $parameter_name) - { - if (isset($xml->$plural->$singular)) { - } else { - return false; - } - - $types = $xml->$plural->$singular; - - if (count($types) === 0) { - return false; - } - - $type_array = array(); - foreach ($types as $type) { - $type_array[] = (string)$type; - } - - $this->$parameter_name = $type_array; - - return $this; - } - - /** - * loadFieldPropertiesWithAttributes - * - * @param string $xml - * @param string $plural - * @param string $singular - * @param string $parameter_name - * - * @return $this - * @since 1.0.0 - */ - protected function loadFieldPropertiesWithAttributes($xml, $plural, $singular, $parameter_name) - { - if (isset($xml->$plural->$singular)) { - } else { - return $this; - } - - $type_array = array(); - $type_default_array = array(); - foreach ($xml->$plural->$singular as $type) { - $type_array[] = (string)$type['name']; - $type_default_array[(string)$type['name']] = (string)$type['default']; - } - - $this->$parameter_name = $type_array; - $temp = $parameter_name . '_defaults'; - $this->$temp = $type_default_array; - - return $this; - } - - /** - * loadDatalists - * - * @param string $data_lists_array - * @param string $folder - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function loadDatalists($data_lists_array, $folder) - { - try { - $directory_read = dir($folder); - $path = $directory_read->path; - - while (false !== ($entry = $directory_read->read())) { - if (is_dir($path . '/' . $entry)) { - } else { - $data_lists_array[] = substr($entry, 0, strlen($entry) - 4); - } - } - - $directory_read->close(); - - } catch (RuntimeException $e) { - throw new RuntimeException( - 'IoC Factory Method Configuration: loadDatalists cannot find Datalists file for folder: ' . $folder - ); - } - - return $data_lists_array; - } - - /** - * Create Resource Xml Adapter dependent upon configuration information - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createXml() - { - $scheme = $this->createScheme(); - - $resource_map = $this->readFile( - $this->base_path - . '/Bootstrap/Files/Output/ResourceMap.json' - ); - - $class = 'Molajo\\Resource\\Adapter\\Xml'; - - try { - $xml = new $class ( - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Xml')->include_file_extensions, - array( - 'get_cache_callback' => $this->dependencies['Getcachecallback'], - 'set_cache_callback' => $this->dependencies['Setcachecallback'], - 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] - ), - array( - 'resource' => $this->options['Resource'], - 'registry' => $this->dependencies['Registry'], - 'data' => $this->product_result - ) - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Data Factory Method createXml failed: ' - . $e->getMessage() - ); - } - - return $xml; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } - - /** - * Set Valid Array - * - * @return $this - * @since 1.0.0 - */ - protected function setValidArray() - { - $valid_array = array(); - - $valid_array['valid_data_object_types'] = $this->valid_data_object_types; - $valid_array['valid_data_object_attributes'] = $this->valid_data_object_attributes; - $valid_array['valid_model_types'] = $this->valid_model_types; - $valid_array['valid_model_attributes'] = $this->valid_model_attributes; - $valid_array['valid_data_types'] = $this->valid_data_types; - $valid_array['valid_queryelements_attributes'] = $this->valid_queryelements_attributes; - $valid_array['valid_field_attributes'] = $this->valid_field_attributes; - $valid_array['valid_join_attributes'] = $this->valid_join_attributes; - $valid_array['valid_foreignkey_attributes'] = $this->valid_foreignkey_attributes; - $valid_array['valid_criteria_attributes'] = $this->valid_criteria_attributes; - $valid_array['valid_children_attributes'] = $this->valid_children_attributes; - $valid_array['valid_plugin_attributes'] = $this->valid_plugin_attributes; - $valid_array['valid_value_attributes'] = $this->valid_value_attributes; - $valid_array['valid_field_attributes_default'] = $this->valid_field_attributes_default; - $valid_array['valid_datalists'] = $this->valid_datalists; - - $this->options['valid_array'] = $valid_array; - - return $this; - } -} diff --git a/Factories/Resourcejs/Configuration.xml b/Factories/Resourcejs/Configuration.xml deleted file mode 100644 index fd11616..0000000 --- a/Factories/Resourcejs/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Resourcejs - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resourcejs Factory - - diff --git a/Factories/Resourcejs/ResourcejsFactoryMethod.php b/Factories/Resourcejs/ResourcejsFactoryMethod.php deleted file mode 100644 index c9efe24..0000000 --- a/Factories/Resourcejs/ResourcejsFactoryMethod.php +++ /dev/null @@ -1,133 +0,0 @@ -dependencies['Resource'] = $options; - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['base_path'] = $this->base_path; - $this->dependencies['resource_map'] = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - $this->options['Scheme'] = $this->createScheme(); - $this->dependencies['namespace_prefixes'] = array(); - $scheme = $this->options['Scheme']->getScheme('js'); - $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - - - $cache_callbacks = array(); - $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; - $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; - $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; - $this->dependencies['cache_callbacks'] = $cache_callbacks; - - $handler_options = array(); - $this->dependencies['handler_options'] = $handler_options; - - return $this->dependencies; - } - - /** - * Follows the completion of the instantiate method - * - * @return $this - * @since 1.0.0 - */ - public function onAfterInstantiation() - { - $this->dependencies['Resource']->setAdapterInstance('Js', $this->product_result); - - return $this; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } -} diff --git a/Factories/Resourcejsdeclarations/Configuration.xml b/Factories/Resourcejsdeclarations/Configuration.xml deleted file mode 100644 index a6a81f2..0000000 --- a/Factories/Resourcejsdeclarations/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Resourcejsdeclarations - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resourcejsdeclarations Factory - - diff --git a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php b/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php deleted file mode 100644 index b786078..0000000 --- a/Factories/Resourcejsdeclarations/ResourcejsdeclarationsFactoryMethod.php +++ /dev/null @@ -1,132 +0,0 @@ -dependencies['Resource'] = $options; - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $this->dependencies['base_path'] = $this->base_path; - $this->dependencies['resource_map'] = $this->readFile( - $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json' - ); - $this->options['Scheme'] = $this->createScheme(); - $this->dependencies['namespace_prefixes'] = array(); - $scheme = $this->options['Scheme']->getScheme('jsd'); - $this->dependencies['valid_file_extensions'] = $scheme->include_file_extensions; - - $cache_callbacks = array(); - $cache_callbacks['get_cache_callback'] = $this->dependencies['Getcachecallback']; - $cache_callbacks['set_cache_callback'] = $this->dependencies['Setcachecallback']; - $cache_callbacks['delete_cache_callback'] = $this->dependencies['Deletecachecallback']; - $this->dependencies['cache_callbacks'] = $cache_callbacks; - - $handler_options = array(); - $this->dependencies['handler_options'] = $handler_options; - - return $this->dependencies; - } - - /** - * Follows the completion of the instantiate method - * - * @return $this - * @since 1.0.0 - */ - public function onAfterInstantiation() - { - $this->dependencies['Resource']->setAdapterInstance('JsDeclarations', $this->product_result); - - return $this; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resource Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } -} diff --git a/Factories/Resourcerendering/Configuration.xml b/Factories/Resourcerendering/Configuration.xml deleted file mode 100644 index 18af760..0000000 --- a/Factories/Resourcerendering/Configuration.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - Resourcesrendering - Amy Stephen - January 2015 - Copyright (C) 2014-2015 Amy Stephen. All rights reserved. - MIT - hello@molajo.org - http://molajo.org - 1.0 - Resourcesrendering Factory - - diff --git a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php b/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php deleted file mode 100644 index 396fc27..0000000 --- a/Factories/Resourcerendering/ResourcerenderingFactoryMethod.php +++ /dev/null @@ -1,230 +0,0 @@ -dependencies['Resource'] = $options; - $this->dependencies['Runtimedata'] = $options; - $this->dependencies['Getcachecallback'] = array(); - $this->dependencies['Setcachecallback'] = array(); - $this->dependencies['Deletecachecallback'] = array(); - - - return $this->dependencies; - } - - /** - * Set Dependencies for Instantiation - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function onBeforeInstantiation(array $dependency_values = null) - { - parent::onBeforeInstantiation($dependency_values); - - $filename = $this->base_path . '/Bootstrap/Files/Output/ResourceMap.json'; - $resource_map = $this->readFile($filename); - $scheme = $this->createScheme(); - - $cache_callbacks = array( - 'get_cache_callback' => $this->dependencies['Getcachecallback'], - 'set_cache_callback' => $this->dependencies['Setcachecallback'], - 'delete_cache_callback' => $this->dependencies['Deletecachecallback'] - ); - - $handler_options = array( - 'extensions' => $this->dependencies['Runtimedata']->reference_data->extensions, - 'resource' => clone $this->dependencies['Resource'] - ); - - $adapter_instance['Theme'] - = $this->createHandler( - 'Theme', - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Theme')->include_file_extensions, - $cache_callbacks, - $handler_options - ); - $adapter_instance['Page'] - = $this->createHandler( - 'Page', - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Page')->include_file_extensions, - $cache_callbacks, - $handler_options - ); - $adapter_instance['Template'] - = $this->createHandler( - 'Template', - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Template')->include_file_extensions, - $cache_callbacks, - $handler_options - ); - $adapter_instance['Wrap'] - = $this->createHandler( - 'Wrap', - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Wrap')->include_file_extensions, - $cache_callbacks, - $handler_options - ); - $adapter_instance['Menuitem'] - = $this->createHandler( - 'Menuitem', - $this->base_path, - $resource_map, - array(), - $scheme->getScheme('Menuitem')->include_file_extensions, - $cache_callbacks, - $handler_options - ); - - return $this->dependencies; - } - - /** - * Create Handler Instance - * - * @param string $adapter - * @param string $base_path - * @param array $resource_map - * @param array $namespace_prefixes - * @param array $cache_callbacks - * @param array $handler_options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createHandler( - $adapter, - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions, - array $cache_callbacks = array(), - array $handler_options = array() - ) { - $class = 'Molajo\\Resource\\Adapter\\' . $adapter; - - try { - $adapter_instance = new $class ( - $base_path, - $resource_map, - $namespace_prefixes, - $valid_file_extensions, - $cache_callbacks, - $handler_options - ); - } catch (Exception $e) { - throw new RuntimeException( - 'Resources Handler ' . $adapter - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - $this->dependencies['Resource']->setAdapterInstance($adapter, $adapter_instance); - - return $adapter_instance; - } - - /** - * Create Scheme Instance - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function createScheme() - { - $class = 'Molajo\\Resource\\Scheme'; - - $input = $this->base_path . '/Bootstrap/Files/Input/SchemeArray.json'; - - try { - $scheme = new $class ($input); - } catch (Exception $e) { - throw new RuntimeException( - 'Resources Scheme ' . $class - . ' Exception during Instantiation: ' . $e->getMessage() - ); - } - - return $scheme; - } - - /** - * Request for array of Factory Methods to be Scheduled - * - * @return $this - * @since 1.0.0 - */ - public function scheduleFactories() - { - $options = array(); - $this->schedule_factory_methods['Resourcecss'] = $options; - $this->schedule_factory_methods['Resourcecssdeclarations'] = $options; - $this->schedule_factory_methods['Resourcejs'] = $options; - $this->schedule_factory_methods['Resourcejsdeclarations'] = $options; - - return $this->schedule_factory_methods; - } -} diff --git a/Source/Adapter/Asset.php b/Source/Adapter/Asset.php deleted file mode 100644 index f8477f8..0000000 --- a/Source/Adapter/Asset.php +++ /dev/null @@ -1,43 +0,0 @@ -saveConfigurationDependencies($handler_options); - } - - /** - * Save Configuration Dependencies - * - * @param array $handler_options - * - * @return $this - * @since 1.0.0 - */ - protected function saveConfigurationDependencies(array $handler_options = array()) - { - if (count($handler_options) === 0) { - return $this; - } - - $this->data = $handler_options['data']; - $this->resource = $handler_options['resource']; - $this->registry = $handler_options['registry']; - - return $this; - } - - /** - * Create Model Configuration Class - * - * @return object - * @since 1.0.0 - */ - public function instantiateModelConfiguration() - { - $class = 'Molajo\\Resource\\Configuration\\Model'; - - $data = clone $this->data; - $registry = clone $this->registry; - $resource = clone $this->resource; - - try { - return new $class ($data, $registry, $resource); - - } catch (Exception $e) { - throw new RuntimeException( - 'Resource ConfigurationFactory instantiateModelConfiguration failed: ' - . $e->getMessage() - ); - } - } - - /** - * Create data_object Configuration Class - * - * @return object CommonApi\Resource\DataInterface - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function instantiateDataObjectConfiguration() - { - $class = 'Molajo\\Resource\\Configuration\\Dataobject'; - - $data = clone $this->data; - $registry = clone $this->registry; - $resource = clone $this->resource; - - try { - return new $class ($data, $registry, $resource); - - } catch (Exception $e) { - throw new RuntimeException( - 'Resource ConfigurationFactory instantiateDataObjectConfiguration failed: ' - . $e->getMessage() - ); - } - } -} diff --git a/Source/Adapter/Css.php b/Source/Adapter/Css.php deleted file mode 100644 index 62a4d32..0000000 --- a/Source/Adapter/Css.php +++ /dev/null @@ -1,338 +0,0 @@ -language_direction = $handler_options['language_direction']; - $this->html5 = $handler_options['html5']; - $this->line_end = $handler_options['line_end']; - } - - /** - * Handle located folder/file associated with URI Namespace for Resource - * - * @param string $scheme - * @param string $located_path - * @param array $options - * - * @return mixed - * @since 1.0.0 - */ - public function handlePath($scheme, $located_path, array $options = array()) - { - $located_path = $options['located_path']; - - if (is_dir($located_path)) { - $type = 'folder'; - } elseif (file_exists($located_path)) { - $type = 'file'; - } else { - return null; - } - - $priority = ''; - if (isset($options['priority'])) { - $priority = $options['priority']; - } - - $mimetype = ''; - if (isset($options['mimetype'])) { - $mimetype = $options['mimetype']; - } - - $media = ''; - if (isset($options['media'])) { - $media = $options['media']; - } - - $conditional = ''; - if (isset($options['conditional'])) { - $conditional = $options['conditional']; - } - - $attributes = array(); - if (isset($options['attributes'])) { - $attributes = $options['attributes']; - } - - if ($type == 'folder') { - $this->addCssFolder( - $located_path, - $priority - ); - } else { - $this->addCss( - $located_path, - $priority, - $mimetype, - $media, - $conditional, - $attributes - ); - } - - return $this; - } - - /** - * addCssFolder - Loads the CS located within the folder - * - * @param string $file_path - * @param integer $priority - * - * @return $this - * @since 1.0.0 - */ - public function addCssFolder($file_path, $priority = 500) - { - $files = scandir($file_path); - - if (count($files) > 0) { - - foreach ($files as $file) { - - $add = 1; - - if ($file == 1 || $file == '.' || $file == '..') { - $add = 0; - } - - if (substr($file, 0, 4) == 'ltr_') { - if ($this->language_direction == 'rtl') { - $add = 0; - } - } elseif (substr($file, 0, 4) == 'rtl_') { - if ($this->language_direction == 'rtl') { - } else { - $add = 0; - } - } elseif (strtolower(substr($file, 0, 4)) == 'hold') { - $add = 0; - } - - if (is_file($file)) { - } else { - $add = 0; - } - - if ($add == 1) { - $pathinfo = pathinfo($file); - - if ($pathinfo->extension == 'css') { - } else { - $add = 0; - } - } - - if ($add == 1) { - $this->addCss($file_path . '/' . $file, $priority); - } - } - } - - return $this; - } - - /** - * addCss - Adds a linked stylesheet to the page - * - * @param string $file_path - * @param int $priority - * @param string $mimetype - * @param string $media - * @param string $conditional - * @param array $attributes - * - * @return mixed - * @since 1.0.0 - */ - public function addCss( - $file_path, - $priority = 500, - $mimetype = 'text/css', - $media = '', - $conditional = '', - $attributes = array() - ) { - $css = $this->css; - - foreach ($css as $item) { - - if ($item->path == $file_path - && $item->mimetype == $mimetype - && $item->media == $media - && $item->conditional == $conditional - ) { - return $this; - } - } - - $temp_row = new stdClass(); - - $temp_row->path = $file_path; - $temp_row->priority = $priority; - $temp_row->mimetype = $mimetype; - $temp_row->media = $media; - $temp_row->conditional = $conditional; - $temp_row->attributes = trim(implode(' ', $attributes)); - - $css[] = $temp_row; - - $this->css = $css; - - $priorities = $this->css_priorities; - - if (in_array($priority, $priorities)) { - } else { - $priorities[] = $priority; - } - - sort($priorities); - - $this->css_priorities = $priorities; - - return $this; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0.0 - */ - public function getCollection($scheme, array $options = array()) - { - $temp = $this->css; - - if (is_array($temp) && count($temp) > 0) { - } else { - return array(); - } - - $priorities = $this->css_priorities; - sort($priorities); - - $query_results = array(); - - foreach ($priorities as $priority) { - - foreach ($temp as $temp_row) { - - $include = false; - - if (isset($temp_row->priority)) { - if ($temp_row->priority == $priority) { - $include = true; - } - } - - if ($include === false) { - } else { - $temp_row->application_html5 = $this->html5; - $temp_row->end = $this->line_end; - $temp_row->page_mimetype = $this->mimetype; - $query_results[] = $temp_row; - } - } - } - - return $query_results; - } -} diff --git a/Source/Adapter/Cssdeclarations.php b/Source/Adapter/Cssdeclarations.php deleted file mode 100644 index 0d387e5..0000000 --- a/Source/Adapter/Cssdeclarations.php +++ /dev/null @@ -1,190 +0,0 @@ -language_direction = $handler_options['language_direction']; - $this->html5 = $handler_options['html5']; - $this->line_end = $handler_options['line_end']; - } - - /** - * Handle located folder/file associated with URI Namespace for Resource - * - * @param string $scheme - * @param string $located_path - * @param array $options - * - * @return mixed - * @since 1.0.0 - */ - public function handlePath($scheme, $located_path, array $options = array()) - { - $css = ''; - if (isset($options['css'])) { - $css = $options['css']; - } - $priority = 500; - if (isset($options['priority'])) { - $priority = $options['priority']; - } - $mimetype = 'text/css'; - if (isset($options['mimetype'])) { - $mimetype = $options['mimetype']; - } - - $temp_row = new stdClass(); - - $temp_row->mimetype = $mimetype; - $temp_row->content = $css; - $temp_row->priority = $priority; - - $this->css[] = $temp_row; - - $this->css_priorities[] = $priority; - sort($priorities); - - return; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0.0 - */ - public function getCollection($scheme, array $options = array()) - { - $temp = $this->css; - - if (is_array($temp) && count($temp) > 0) { - } else { - return array(); - } - - $priorities = $this->css_priorities; - sort($priorities); - - $query_results = array(); - - foreach ($priorities as $priority) { - - foreach ($temp as $temp_row) { - - $include = false; - - if (isset($temp_row->priority)) { - if ($temp_row->priority == $priority) { - $include = true; - } - } - - if ($include === false) { - } else { - $temp_row->application_html5 = $this->html5; - $temp_row->end = $this->line_end; - $temp_row->page_mimetype = $this->mimetype; - $query_results[] = $temp_row; - } - } - } - - return $query_results; - } -} diff --git a/Source/Adapter/Extension.php b/Source/Adapter/Extension.php deleted file mode 100644 index a1bb0fe..0000000 --- a/Source/Adapter/Extension.php +++ /dev/null @@ -1,202 +0,0 @@ -extensions = $handler_options['extensions']; - $this->resource = $handler_options['resource']; - } - - /** - * Set a namespace prefix by mapping to the filesystem path - * - * @param string $namespace_prefix - * @param string $namespace_base_directory - * @param boolean $prepend - * - * @return $this - * @since 1.0.0 - */ - public function setNamespace($namespace_prefix, $namespace_base_directory, $prepend = false) - { - return parent::setNamespace($namespace_prefix, $namespace_base_directory, $prepend); - } - - /** - * Locates folder/file associated with Namespace for Resource - * - * @param string $resource_namespace - * @param bool $multiple - * - * @return void|mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function get($resource_namespace, $multiple = false) - { - $extension = substr($resource_namespace, strrpos($resource_namespace, '/') + 1, 9999); - - $test = $extension; - if (is_numeric($test) && (int)$test == $extension) { - } else { - $test = strtolower($extension); - if (isset($this->extensions->extensions[$this->catalog_type_id]->names[$test])) { - $extension = $this->extensions->extensions[$this->catalog_type_id]->names[$test]; - } - } - - $temp = substr($resource_namespace, 0, strrpos($resource_namespace, '/') - 1); - - if (isset($this->extensions->extensions[$this->catalog_type_id]->ids[$extension])) { - $alias = $this->extensions->extensions[$this->catalog_type_id]->ids[$extension]; - } else { - $alias = $extension; - } - - $namespace = $temp . '//' . $alias; - - $this->extension = $this->extensions->extensions[$this->catalog_type_id]->extensions[$extension]; - - return parent::get($namespace); - } - - /** - * Handle located folder/file associated with URI Namespace for Resource - * - * @param string $scheme - * @param string $located_path - * @param array $options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function handlePath($scheme, $located_path, array $options = array()) - { - if (file_exists($located_path)) { - } else { - throw new RuntimeException('Resource Extension Adapter: File not found: ' . $located_path); - } - - $this->extension->path = $located_path; - - return $this->extension; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Extension - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Field.php b/Source/Adapter/Field.php deleted file mode 100644 index b1a9264..0000000 --- a/Source/Adapter/Field.php +++ /dev/null @@ -1,118 +0,0 @@ -fields = $handler_options['fields']; - } - - /** - * Locates resource associated with Namespace - * - * @param string $resource_namespace - * @param bool $multiple - * - * @return object - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function get($resource_namespace, $multiple = false) - { - $resource_namespace = strtolower($resource_namespace); - - if (isset($this->fields[$resource_namespace])) { - return $this->buildAttributeArray($this->fields[$resource_namespace]); - } - - $message = ' SCHEME: field' . ' NAMESPACE: ' . $resource_namespace; - throw new RuntimeException('Resource FieldHandler Failure: ' . $message); - } - - /** - * Build Attribute Array for Field - * - * @param object $field - * - * @return array - * @since 1.0.0 - */ - protected function buildAttributeArray($field) - { - $field_attributes = array(); - - foreach ($field as $key => $value) { - $field_attributes[$key] = $value; - } - - return $field_attributes; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return null; - } -} diff --git a/Source/Adapter/Head.php b/Source/Adapter/Head.php deleted file mode 100644 index 576eede..0000000 --- a/Source/Adapter/Head.php +++ /dev/null @@ -1,43 +0,0 @@ -addJsFolder( - $located_path, - $priority, - false - ); - $located_path .= '/Defer'; - if (is_dir($located_path)) { - $this->addJsFolder( - $located_path, - $priority, - true - ); - } - } else { - $this->addJs( - $located_path, - $priority, - $defer, - $mimetype, - $async - ); - } - - return $this; - } - - /** - * addJsFolder - Loads the JS located within the folder - * - * @param string $file_path - * @param integer $priority - * @param bool $defer - * - * @return $this - * @since 1.0.0 - */ - protected function addJsFolder($file_path, $priority = 500, $defer) - { - $files = scandir($file_path); - - if (count($files) > 0) { - - foreach ($files as $file) { - - $add = 1; - - if ($file == 1 || $file == '.' || $file == '..') { - $add = 0; - } - - if (substr($file, 0, 4) == 'ltr_') { - if ($this->language_direction == 'rtl') { - $add = 0; - } - } elseif (substr($file, 0, 4) == 'rtl_') { - if ($this->language_direction == 'rtl') { - } else { - $add = 0; - } - } elseif (strtolower(substr($file, 0, 4)) == 'hold') { - $add = 0; - } - - if (is_file($file)) { - } else { - $add = 0; - } - - if ($add == 1) { - $pathinfo = pathinfo($file); - if (strtolower($pathinfo->extension) == 'js') { - } else { - $add = 0; - } - } - - if ($add == 1) { - $this->addJs($file_path . '/' . $file, $priority, $defer); - } - } - } - - return $this; - } - - /** - * addJs - Adds a linked script to the page - * - * Usage: - * $this->assets->addJs('http://example.com/test.js', 1000, 1); - * - * @param string $file_path - * @param int $priority - * @param int $defer - * @param string $mimetype - * @param bool $async - * - * @return $this - */ - public function addJs($file_path, $priority = 500, $defer = 0, $mimetype = 'text/javascript', $async = false) - { - if ($defer == 1) { - $js = $this->js_defer; - } else { - $js = $this->js; - } - - foreach ($js as $item) { - if ($item->file_path == $file_path) { - return $this; - } - } - - $temp_row = new stdClass(); - - $temp_row->file_path = $file_path; - $temp_row->priority = $priority; - $temp_row->mimetype = $mimetype; - $temp_row->async = $async; - $temp_row->defer = $defer; - - $js[] = $temp_row; - - if ($defer == 1) { - $this->js_defer = $js; - } else { - $this->js = $js; - } - - if ($defer == 1) { - $priorities = $this->js_defer_priorities; - } else { - $priorities = $this->js_priorities; - } - - if (in_array($priority, $priorities)) { - } else { - $priorities[] = $priority; - } - - sort($priorities); - - if ($defer == 1) { - $this->js_defer_priorities = $priorities; - } else { - $this->js_priorities = $priorities; - } - - return $this; - } -} diff --git a/Source/Adapter/Jsdeclarations.php b/Source/Adapter/Jsdeclarations.php deleted file mode 100644 index 4ef947b..0000000 --- a/Source/Adapter/Jsdeclarations.php +++ /dev/null @@ -1,143 +0,0 @@ -assets->addJSDeclarations($fallback, 'text/javascript', 1000); - * - * @param string $content - * @param int $priority - * @param int $defer - * @param string $mimetype - * - * @return object Asset - * @since 1.0.0 - */ - public function addJSDeclarations($content, $priority = 500, $defer = 0, $mimetype = 'text/javascript') - { - if ($defer == 1) { - $js = $this->get('js_defer', array()); - } else { - $js = $this->get('js', array()); - } - - foreach ($js as $item) { - if ($item->content == $content) { - return $this; - } - } - - $temp_row = new stdClass(); - - $temp_row->content = $content; - $temp_row->mimetype = $mimetype; - $temp_row->defer = $defer; - $temp_row->priority = $priority; - - $js[] = $temp_row; - - if ($defer == 1) { - $this->set('js_defer', $js); - } else { - $this->set('js', $js); - } - - if ($defer == 1) { - $priorities = $this->get('js_defer_priorities', array()); - } else { - $priorities = $this->get('js_priorities', array()); - } - - if (is_array($priorities)) { - } else { - $priorities = array(); - } - - if (in_array($priority, $priorities)) { - } else { - $priorities[] = $priority; - } - - sort($priorities); - - if ($defer == 1) { - $this->set('js_defer_priorities', $priorities); - } else { - $this->set('js_priorities', $priorities); - } - - return $this; - } -} diff --git a/Source/Adapter/Menuitem.php b/Source/Adapter/Menuitem.php deleted file mode 100644 index 53cc48c..0000000 --- a/Source/Adapter/Menuitem.php +++ /dev/null @@ -1,155 +0,0 @@ -catalog_type_id = 11000; - $this->catalog_type_priority = 200; - } - - /** - * Search compiled namespace map for resource namespace - * - * @param string $resource_namespace - * - * @return string|false - * @since 1.0.0 - */ - protected function searchResourceMap($resource_namespace, $multiple = false) - { - if (isset($this->resource_map[strtolower($resource_namespace)])) { - } else { - - /** Default location */ - $path = $this->base_path . 'Source/Menuitem' - . ucfirst(strtolower($this->extension->alias)); - $this->extension_path = $path; - $include_path = $path . '/' . 'Configuration.xml'; - - return $include_path; - } - - $paths = $this->resource_map[strtolower($resource_namespace)]; - - if (is_array($paths)) { - } else { - $paths = array($paths); - } - - foreach ($paths as $path) { - $include_path = $path . '/' . 'Configuration.xml'; - $this->extension_path = $path; - return $include_path; - } - - return false; - } - - /** - * Handle located folder/file associated with URI Namespace for Resource - * - * @param string $scheme - * @param string $located_path - * @param array $options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function handlePath($scheme, $located_path, array $options = array()) - { - if (file_exists($located_path)) { - } else { - throw new RuntimeException('Resource: Menuitem not found.'); - } - - try { - $options = array(); - $options['located_path'] = $this->extension_path . '/Css'; - $options['priority'] = $this->catalog_type_priority; - $this->resource->get('Css:///' . $this->extension->resource_namespace, $options); - } catch (Exception $e) { - - throw new RuntimeException( - 'Resource Menuitem Handler: Get Menuitem CSS failed: ' . $this->extension->resource_namespace - ); - } - - try { - $options = array(); - $options['located_path'] = $this->extension_path . '/Js'; - $options['priority'] = $this->catalog_type_priority; - $this->resource->get('Js:///' . $this->extension->resource_namespace, $options); - } catch (Exception $e) { - - throw new RuntimeException( - 'Resource Menuitem Handler: Get Menuitem Js failed: ' . $this->extension->resource_namespace - ); - } - - return $this->extension; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Menuitem - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Page.php b/Source/Adapter/Page.php deleted file mode 100644 index 5cd0e58..0000000 --- a/Source/Adapter/Page.php +++ /dev/null @@ -1,108 +0,0 @@ -catalog_type_id = 8000; - $this->catalog_type_priority = 200; - } - - /** - * Search compiled namespace map for resource namespace - * - * @param string $resource_namespace - * - * @return string|false - * @since 1.0.0 - */ - protected function searchResourceMap($resource_namespace, $multiple = false) - { - if (isset($this->resource_map[strtolower($resource_namespace)])) { - } else { - - /** Default location */ - $path = $this->base_path . 'Source/Views/Pages' - . ucfirst(strtolower($this->extension->alias)); - $this->extension_path = $path; - $include_path = $path . '/' . 'Index.phtml'; - - return $include_path; - } - - $paths = $this->resource_map[strtolower($resource_namespace)]; - - if (is_array($paths)) { - } else { - $paths = array($paths); - } - - foreach ($paths as $path) { - $include_path = $path . '/' . 'Index.phtml'; - $this->extension_path = $path; - return $include_path; - } - - return false; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Page - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Template.php b/Source/Adapter/Template.php deleted file mode 100644 index a67171b..0000000 --- a/Source/Adapter/Template.php +++ /dev/null @@ -1,108 +0,0 @@ -catalog_type_id = 9000; - $this->catalog_type_priority = 200; - } - - /** - * Search compiled namespace map for resource namespace - * - * @param string $resource_namespace - * - * @return mixed|bool|string - * @since 1.0.0 - */ - protected function searchResourceMap($resource_namespace, $multiple = false) - { - if (isset($this->resource_map[strtolower($resource_namespace)])) { - } else { - - /** Default location */ - $path = $this->base_path . 'Source/Views/Templates' - . ucfirst(strtolower($this->extension->alias)); - $this->extension_path = $path; - $include_path = $path; - - return $include_path; - } - - $paths = $this->resource_map[strtolower($resource_namespace)]; - - if (is_array($paths)) { - } else { - $paths = array($paths); - } - - foreach ($paths as $path) { - $include_path = $path; - $this->extension_path = $path; - return $include_path; - } - - return false; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Template - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Theme.php b/Source/Adapter/Theme.php deleted file mode 100644 index f340cf4..0000000 --- a/Source/Adapter/Theme.php +++ /dev/null @@ -1,103 +0,0 @@ -catalog_type_id = 7000; - $this->catalog_type_priority = 100; - } - - /** - * Search compiled namespace map for resource namespace - * - * @param string $resource_namespace - * @param bool $multiple - * - * @return string|false - * @since 1.0.0 - */ - protected function searchResourceMap($resource_namespace, $multiple = false) - { - if (isset($this->resource_map[strtolower($resource_namespace)])) { - } else { - return false; - } - - $paths = $this->resource_map[strtolower($resource_namespace)]; - - if (is_array($paths)) { - } else { - $paths = array($paths); - } - - foreach ($paths as $path) { - $include_path = $path . '/' . 'Index.phtml'; - $this->extension_path = $path; - - return $include_path; - } - - return false; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Theme - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Wrap.php b/Source/Adapter/Wrap.php deleted file mode 100644 index 544218f..0000000 --- a/Source/Adapter/Wrap.php +++ /dev/null @@ -1,111 +0,0 @@ -catalog_type_id = 10000; - $this->catalog_type_priority = 600; - } - - /** - * Search compiled namespace map for resource namespace - * - * @param string $resource_namespace - * - * @return mixed|bool|string - * @since 1.0.0 - */ - protected function searchResourceMap($resource_namespace, $multiple = false) - { - if (isset($this->resource_map[$resource_namespace])) { - } else { - - /** Default location */ - $path = $this->base_path . 'Source/Views/Wraps' - . ucfirst(strtolower($this->extension->alias)); - - $include_path = $path; - $this->extension_path = $include_path; - - return $include_path; - } - - $paths = $this->resource_map[strtolower($resource_namespace)]; - - if (is_array($paths)) { - } else { - $paths = array($paths); - } - - foreach ($paths as $path) { - $include_path = $path; - $this->extension_path = $include_path; - return $include_path; - } - - return false; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return Wrap - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return $this; - } -} diff --git a/Source/Adapter/Xml.php b/Source/Adapter/Xml.php deleted file mode 100644 index d945ea3..0000000 --- a/Source/Adapter/Xml.php +++ /dev/null @@ -1,323 +0,0 @@ -handlePathSegments($options); - - list($model_type, $model_name) = $this->setModelTypeName($segments); - -echo $model_type . ' ' . $model_name . ' ' . $scheme . ' ' . $located_path . '
'; - - if (in_array($model_type, array('Application', 'Dataobject', 'Include')) - || $model_name === 'Application') { - } else { - if ($this->getConfigurationCache($located_path) === true) { - return $this->cached_result; - } - } - - $this->verifyFileExists($located_path); - - $contents = file_get_contents($located_path); - - $scheme = strtolower(trim($scheme)); - $model_type = ucfirst(strtolower(trim($model_type))); - - $results = $this->handlePathResults($scheme, $model_type, $model_name, $located_path, $contents); - - if (in_array($model_type, array('Application', 'Dataobject', 'Include')) - || $model_name === 'Application') { - } else { - $this->setConfigurationCache($located_path, $results); - } - - return $results; - } - - /** - * Retrieve a collection of a specific handler - * - * @param string $scheme - * @param array $options - * - * @return mixed - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getCollection($scheme, array $options = array()) - { - return null; - } - - /** - * Break Namespace into Segments - * - * @param array $options - * - * @return array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - protected function handlePathSegments(array $options = array()) - { - $this->verifyNamespace($options); - - $segments = explode('//', $options['namespace']); - - if (count($segments) > 2) { - } else { - echo '
';
-            var_dump($segments);
-            throw new RuntimeException(
-                'Resource XmlHandler Failure namespace must have at least 3 segments:  '
-                . $options['namespace']
-            );
-        }
-
-        return $segments;
-    }
-
-    /**
-     * Derive Model Type and Name from NS Segments
-     *
-     * @param   array $segments
-     *
-     * @return  array
-     * @since   1.0.0
-     */
-    protected function setModelTypeName(array $segments = array())
-    {
-        if (ucfirst(strtolower($segments[1])) === 'Resources') {
-            $model_type = ucfirst(strtolower($segments[1]));
-            $model_name = ucfirst(strtolower($segments[2] . $segments[3]));
-
-        } elseif (count($segments) === 3) {
-            $model_type = ucfirst(strtolower($segments[1]));
-            $model_name = ucfirst(strtolower($segments[2]));
-
-        } else {
-            $model_type = ucfirst(strtolower($segments[2]));
-            $model_name = ucfirst(strtolower($segments[3]));
-        }
-
-        if (substr($model_name, strlen($model_name) - 4, 4) === '.xml') {
-            $model_name = substr($model_name, 0, strlen($model_name) - 4); //remove .xml
-        }
-        return array($model_type, $model_name);
-    }
-
-    /**
-     * Process Request given path
-     *
-     * @param   string $scheme
-     * @param   string $model_type
-     * @param   string $model_name
-     * @param   string $located_path
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathResults(
-        $scheme,
-        $model_type,
-        $model_name,
-        $located_path,
-        $contents
-    ) {
-        if ($scheme === 'query') {
-            return $this->handlePathQuery($model_type, $model_name, $contents);
-        }
-
-        if ($model_type === 'Application') {
-            return $this->handlePathApplication($contents);
-        }
-
-        if ($model_type === 'Include') {
-            return $this->handlePathInclude($contents);
-        }
-
-        if ($model_type === 'Dataobject') {
-            return $this->handlePathDataObject($model_name, $contents);
-        }
-
-        if ($model_type === 'Datasource') {
-            return $this->handlePathDatasource($model_name, $contents);
-        }
-
-        if ($model_type === 'Resources') {
-            return $this->handlePathResources($model_type, $model_name, $contents);
-        }
-
-        $message = ' SCHEME: ' . $scheme
-            . ' MODEL TYPE: ' . $model_type
-            . ' MODEL NAME: ' . $model_name
-            . ' PATH: ' . $located_path;
-
-        throw new RuntimeException('Resource XmlHandler Failure: ' . $message);
-    }
-
-    /**
-     * Process Application Request
-     *
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathApplication($contents)
-    {
-        $xml = simplexml_load_string($contents);
-
-        return $xml;
-    }
-
-    /**
-     * Process data_object Request
-     *
-     * @param   string $model_name
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathDataObject($model_name, $contents)
-    {
-        $data_object_configuration = $this->instantiateDataObjectConfiguration();
-
-        $xml = simplexml_load_string($contents);
-
-        return $data_object_configuration->getConfiguration('Dataobject', $model_name, $xml);
-    }
-
-    /**
-     * Process Datasource Request
-     *
-     * @param   string $model_name
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathDatasource($model_name, $contents)
-    {
-        $model_configuration = $this->instantiateModelConfiguration();
-
-        $xml = simplexml_load_string($contents);
-
-        return $model_configuration->getConfiguration('Datasource', $model_name, $xml);
-    }
-
-    /**
-     * Process Resources Request
-     *
-     * @param   string $model_type
-     * @param   string $model_name
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathResources($model_type, $model_name, $contents)
-    {
-        $model_configuration = $this->instantiateModelConfiguration();
-
-        $xml = simplexml_load_string($contents);
-
-        return $model_configuration->getConfiguration($model_type, $model_name, $xml);
-    }
-
-    /**
-     * Process Include Request
-     *
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathInclude($contents)
-    {
-        return $contents;
-    }
-
-    /**
-     * Process Query Request
-     *
-     * @param   string $model_type
-     * @param   string $model_name
-     * @param   string $contents
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function handlePathQuery($model_type, $model_name, $contents)
-    {
-        $model_configuration = $this->instantiateModelConfiguration();
-
-        $xml = simplexml_load_string($contents);
-
-        return $model_configuration->getConfiguration($model_type, $model_name, $xml);
-    }
-}
diff --git a/Source/ClassMap/Items.php b/Source/ClassMap/Items.php
index 6eaf789..477e47f 100644
--- a/Source/ClassMap/Items.php
+++ b/Source/ClassMap/Items.php
@@ -34,6 +34,7 @@ protected function processItems()
             $reflection = $this->getReflectionObject($file->qns);
 
             if ($reflection === false) {
+
             } else {
 
                 $class_object = $this->initialiseObject($file->path, $reflection);
diff --git a/Source/ExtensionMap.php b/Source/ExtensionMap.php
deleted file mode 100644
index dcf8b02..0000000
--- a/Source/ExtensionMap.php
+++ /dev/null
@@ -1,672 +0,0 @@
-resource            = $resource;
-        $this->runtime_data        = $runtime_data;
-        $this->extensions_filename = $extensions_filename;
-    }
-
-    /**
-     * Catalog Types
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     * @throws  \CommonApi\Exception\RuntimeException
-     */
-    public function createMap()
-    {
-        $map = $this->getCatalogTypes();
-
-        if (version_compare(PHP_VERSION, '5.4.0', '>=')) {
-            $x = json_encode($map, JSON_PRETTY_PRINT);
-        } else {
-            $x = json_encode($map);
-        }
-
-        file_put_contents($this->extensions_filename, $x);
-
-        return $map;
-    }
-
-    /**
-     * Get Catalog Types
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    public function getCatalogTypes()
-    {
-        $controller = $this->setCatalogTypesQuery();
-        $results    = $this->runQuery($controller);
-
-        return $this->processCatalogTypes($results);
-    }
-
-    /**
-     * Process Catalog Types
-     *
-     * @param   $catalog_types  array
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    protected function processCatalogTypes(array $catalog_types)
-    {
-        $names       = array();
-        $ids         = array();
-        $model_names = array();
-        $extensions  = array();
-
-        foreach ($catalog_types as $type) {
-
-            $ids[$type->id]         = $type->title;
-            $names[$type->title]    = $type->id;
-            $model_names[$type->id] = $type->model_name;
-            $id                     = $type->id;
-
-            $extensions[$id] = $this->getExtensions($id, $model_names[$id]);
-        }
-
-        unset($catalog_types);
-
-        $catalog_type             = new stdClass();
-        $catalog_type->ids        = $ids;
-        $catalog_type->names      = $names;
-        $catalog_type->extensions = $extensions;
-
-        return $catalog_type;
-    }
-
-    /**
-     * Retrieve Extensions for a specific Catalog Type
-     *
-     * @param   int    $catalog_type_id
-     * @param   string $catalog_type_model_name
-     *
-     * @return  array|stdClass
-     * @since   1.0.0
-     * @throws  \CommonApi\Exception\RuntimeException
-     */
-    protected function getExtensions($catalog_type_id, $catalog_type_model_name)
-    {
-        $controller = $this->setExtensionsQuery($catalog_type_id);
-        $items      = $this->runQuery($controller);
-
-        if (is_array($items) && count($items) > 0) {
-        } else {
-            return array();
-        }
-
-        return $this->processExtensions($items, $catalog_type_id, $catalog_type_model_name);
-    }
-
-    /**
-     * Process Extensions
-     *
-     * @param   array   $items
-     * @param   integer $catalog_type_id
-     * @param   string  $catalog_type_model_name
-     *
-     * @return  array|stdClass
-     * @since   1.0.0
-     */
-    protected function processExtensions($items, $catalog_type_id, $catalog_type_model_name)
-    {
-        $this->initialiseExtensions($items, $catalog_type_id);
-
-        $catalog_type_model_name = $this->setCatalogTypeModelName($catalog_type_model_name);
-
-        foreach ($this->temp_ids as $id => $alias) {
-
-            $resource_indicator = false;
-            $alias              = ucfirst(strtolower($alias));
-
-            if (in_array($catalog_type_model_name, array('Resources', 'System'))) {
-                $resource_indicator = true;
-                $model_name         = $this->setExtensionModelNameResource($alias, $this->temp_extensions, $id);
-
-            } elseif ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) {
-                $model_name = $this->setExtensionModelNameMenuitem($this->temp_page_types, $id);
-
-            } else {
-                $model_name = $this->setExtensionModelNameDefault($catalog_type_model_name, $alias);
-            }
-
-            $this->temp_extensions[$id] = $this->getExtension($id, $model_name, $resource_indicator);
-        }
-
-        return $this->setExtensions();
-    }
-
-    /**
-     * Set Extensions Results
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    protected function setExtensions()
-    {
-        $temp             = new stdClass();
-        $temp->ids        = $this->temp_ids;
-        $temp->names      = $this->temp_names;
-        $temp->extensions = $this->temp_extensions;
-        $temp->menus      = $this->temp_menus;
-
-        return $temp;
-    }
-
-    /**
-     * Initialise Extensions
-     *
-     * @param   array   $items
-     * @param   integer $catalog_type_id
-     *
-     * @return  $this
-     * @since   1.0.0
-     */
-    protected function initialiseExtensions($items, $catalog_type_id)
-    {
-        $this->temp_ids        = array();
-        $this->temp_names      = array();
-        $this->temp_extensions = array();
-        $this->temp_menus      = array();
-        $this->temp_page_types = array();
-
-        foreach ($items as $item) {
-
-            if ($catalog_type_id == $this->runtime_data->reference_data->catalog_type_menuitem_id) {
-                $name = $this->initialiseExtensionsMenuItem($item);
-            } else {
-                $name = $item->alias;
-            }
-
-            $this->temp_ids[$item->id] = $name;
-            $this->temp_names[$name]   = $item->id;
-        }
-
-        $x                = array_unique($this->temp_menus);
-        $this->temp_menus = $x;
-        ksort($this->temp_ids);
-
-        return $this;
-    }
-
-    /**
-     * Initialize Extension Name for Menu Item
-     *
-     * @param   object $item
-     *
-     * @return  string
-     * @since   1.0.0
-     */
-    protected function initialiseExtensionsMenuItem($item)
-    {
-        $this->temp_menus[] = $item->menu;
-
-        if ($item->path === '') {
-            $name = $item->alias;
-        } else {
-            $name = $item->path . '/' . $item->alias;
-        }
-
-        $this->temp_page_types[$item->id] = $item->page_type;
-
-        return $name;
-    }
-
-    /**
-     * Retrieve specific Extension Information
-     *
-     * @param   string $catalog_type_model_name
-     *
-     * @return  string
-     * @since   1.0.0
-     */
-    protected function setCatalogTypeModelName($catalog_type_model_name)
-    {
-        $catalog_type_model_name = ucfirst(strtolower($catalog_type_model_name));
-
-        if ($catalog_type_model_name === 'Views//pages') {
-            $catalog_type_model_name = 'Views//Pages';
-        } elseif ($catalog_type_model_name === 'Views//templates') {
-            $catalog_type_model_name = 'Views//Templates';
-        } elseif ($catalog_type_model_name === 'Views//wraps') {
-            $catalog_type_model_name = 'Views//Wraps';
-        }
-
-        return $catalog_type_model_name;
-    }
-
-    /**
-     * Set Extension Model Name for Menu Item
-     *
-     * @param   string  $alias
-     * @param   array   $extensions
-     * @param   integer $id
-     *
-     * @return  array
-     * @since   1.0.0
-     */
-    protected function setExtensionModelNameResource($alias, $extensions, $id)
-    {
-        return 'Molajo//' . $alias . '//Extension.xml';
-    }
-
-    /**
-     * Set Extension Model Name for Menu Item
-     *
-     * @param   array   $page_types
-     * @param   integer $id
-     *
-     * @return  string
-     * @since   1.0.0
-     */
-    protected function setExtensionModelNameMenuitem($page_types, $id)
-    {
-        $pagetype = $page_types[$id];
-        $pagetype = ucfirst(strtolower($pagetype));
-
-        return 'Molajo//Model//Menuitem//' . $pagetype . '//Configuration.xml';
-    }
-
-    /**
-     * Set Extension Model Name (Not Resource or Menuitem)
-     *
-     * @param   string $catalog_type_model_name
-     * @param   string $alias
-     *
-     * @return  string
-     * @since   1.0.0
-     */
-    protected function setExtensionModelNameDefault($catalog_type_model_name, $alias)
-    {
-        return 'Molajo//' . $catalog_type_model_name . '//' . $alias . '//Configuration.xml';
-    }
-
-    /**
-     * Retrieve specific Extension Information
-     *
-     * @param   int    $id
-     * @param   string $model_name
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function getExtension($id, $model_name)
-    {
-        $controller = $this->setExtensionQuery($id, $model_name);
-        $data       = $this->runQuery($controller);
-        if ($data === null) {
-            return new stdClass();
-        }
-        $model_registry = $controller->getModelRegistry('*');
-
-        return $this->processExtension($data, $model_registry);
-    }
-
-    /**
-     * Retrieve specific Extension Information
-     *
-     * @param   object $data
-     * @param   array  $model_registry
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function processExtension($data, array $model_registry)
-    {
-        $custom_field_types = $model_registry['customfieldgroups'];
-
-        if (is_array($custom_field_types)) {
-        } else {
-            $custom_field_types = array();
-        }
-
-        if (count($custom_field_types) > 0) {
-            if (is_array($custom_field_types) && count($custom_field_types) > 0) {
-                foreach ($custom_field_types as $group) {
-                    $data->$group = $this->processCustomfieldGroup($group, $data, $model_registry);
-                }
-            }
-        }
-
-        return $data;
-    }
-
-    /**
-     * Process Customfield Group
-     *
-     * @param   string $group
-     * @param   object $data
-     * @param   object $model_registry
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    protected function processCustomfieldGroup($group, $data, $model_registry)
-    {
-        $fields = $this->getCustomfields($group, $data, $model_registry);
-
-        $group_fields = new stdClass();
-
-        foreach ($fields as $key => $value) {
-            $group_fields->$key = $value;
-        }
-
-        return $group_fields;
-    }
-
-    /**
-     * Get Custom Group Data
-     *
-     * @param   string $group
-     * @param   object $data
-     * @param   object $model_registry
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    protected function getCustomfields($group, $data, $model_registry)
-    {
-        $group_data = $this->getCustomfieldGroupData($group, $data);
-
-        $fields = array();
-
-        foreach ($model_registry[$group] as $customfields) {
-            $key          = $customfields['name'];
-            $fields[$key] = $this->setCustomfieldValue($key, $group_data, $customfields);
-        }
-        ksort($fields);
-
-        return $fields;
-    }
-
-    /**
-     * Get Custom Group Data
-     *
-     * @param   string $group
-     * @param   object $data
-     *
-     * @return  stdClass
-     * @since   1.0.0
-     */
-    protected function getCustomfieldGroupData($group, $data)
-    {
-        if (isset($data->$group)) {
-        } else {
-            $group_data = new stdClass();
-            return $group_data;
-        }
-
-        $group_data = json_decode($data->$group);
-
-        $application_id = $this->runtime_data->application->id;
-
-        if (isset($group_data->$application_id)) {
-            $group_data = $group_data->$application_id;
-        }
-
-        return $group_data;
-    }
-
-    /**
-     * Set Custom Field Value
-     *
-     * @param   string $key
-     * @param   object $group_data
-     * @param   array  $customfields
-     *
-     * @return  null|mixed
-     * @since   1.0.0
-     */
-    protected function setCustomfieldValue($key, $group_data, $customfields)
-    {
-        if (isset($group_data->$key)) {
-            return $group_data->$key;
-        }
-
-        if (isset($customfields['default'])) {
-            return $customfields['default'];
-        }
-
-        return null;
-    }
-
-    /**
-     * Set Catalog Types Query
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    public function setCatalogTypesQuery()
-    {
-        $controller = $this->resource->get(
-            'query:///Molajo//Model//Datasource//CatalogTypes.xml',
-            array('Runtimedata' => $this->runtime_data)
-        );
-
-        $controller->setModelRegistry('check_view_level_access', 0);
-        $controller->setModelRegistry('process_events', 0);
-        $controller->setModelRegistry('query_object', 'list');
-        $controller->setModelRegistry('use_pagination', 0);
-        $controller->setModelRegistry('process_events', 0);
-
-        $prefix = $controller->getModelRegistry('prefix', 'a');
-
-        $catalog_id_list = (int)$this->runtime_data->reference_data->catalog_type_plugin_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_theme_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_page_view_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_template_view_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_wrap_view_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_menuitem_id . ', '
-            . (int)$this->runtime_data->reference_data->catalog_type_resource_id;
-
-        $controller->select('*');
-        $controller->from('#__catalog_types', 'a');
-        $controller->where('column', $prefix . '.id', 'IN', 'integer', $catalog_id_list, 'OR');
-        $controller->where('column', $prefix . '.model_type', '=', 'string', 'Resource', 'OR');
-
-        return $controller;
-    }
-
-    /**
-     * Retrieve System Extensions for a specific Catalog Type
-     *
-     * @param   int $catalog_type_id
-     *
-     * @return  array|stdClass
-     * @since   1.0.0
-     */
-    protected function setExtensionsQuery($catalog_type_id)
-    {
-        $controller
-            = $this->resource->get(
-            'query:///Molajo//Model//Datasource//ExtensionInstances.xml',
-            array('Runtimedata' => $this->runtime_data)
-        );
-
-        $application_id = $this->runtime_data->application->id;
-        $site_id        = $this->runtime_data->site->id;
-
-        $controller->setModelRegistry('application_id', $application_id);
-        $controller->setModelRegistry('site_id', $site_id);
-        $controller->setModelRegistry('check_view_level_access', 0);
-        $controller->setModelRegistry('process_events', 0);
-        $controller->setModelRegistry('get_customfields', 0);
-        $controller->setModelRegistry('use_special_joins', 1);
-        $controller->setModelRegistry('query_object', 'list');
-        $controller->setModelRegistry('use_pagination', 0);
-
-        $prefix = $controller->getModelRegistry('primary_prefix', 'a');
-        $cat_id = $prefix . '.' . 'catalog_type_id';
-
-        $controller->select($prefix . '.' . 'id');
-        $controller->select($prefix . '.' . 'alias');
-        $controller->select($prefix . '.' . 'menu');
-        $controller->select($prefix . '.' . 'path');
-        $controller->select($prefix . '.' . 'page_type');
-
-        $controller->where('column', $cat_id, '=', 'integer', $catalog_type_id);
-        $controller->where('column', $prefix . '.' . 'id', '<>', 'column', $cat_id);
-        $controller->where('column', $prefix . '.' . 'status', '>', 'integer', ' 0 ');
-
-        $controller->orderBy($prefix . '.' . 'alias');
-
-        return $controller;
-    }
-
-    /**
-     * Set Extension Query
-     *
-     * @param   int    $id
-     * @param   string $model_name
-     *
-     * @return  object
-     * @since   1.0.0
-     */
-    protected function setExtensionQuery($id, $model_name)
-    {
-        $controller = $this->resource->get(
-            'query:///' . $model_name,
-            array('Runtimedata' => $this->runtime_data)
-        );
-
-        $controller->setModelRegistry('check_view_level_access', 0);
-        $controller->setModelRegistry('process_events', 0);
-        $controller->setModelRegistry('get_customfields', 1);
-        $controller->setModelRegistry('primary_key_value', $id);
-        $controller->setModelRegistry('query_object', 'item');
-
-        $application_id = $this->runtime_data->application->id;
-        $site_id        = $this->runtime_data->site->id;
-
-        $controller->setModelRegistry('application_id', $application_id);
-        $controller->setModelRegistry('site_id', $site_id);
-        $prefix = $controller->getModelRegistry('primary_prefix', 'a');
-
-        $controller->where('column', $prefix . '.' . 'id', '=', 'integer', (int)$id);
-
-        return $controller;
-    }
-
-    /**
-     * Run Query
-     *
-     * @param   object $controller
-     *
-     * @return  mixed
-     * @since   1.0.0
-     * @throws  \CommonApi\Exception\RuntimeException
-     */
-    protected function runQuery($controller)
-    {
-        $controller->setSql();
-
-        try {
-            return $controller->getData();
-
-        } catch (Exception $e) {
-            throw new RuntimeException($e->getMessage());
-        }
-    }
-}
diff --git a/composer.json b/composer.json
index 2ef25d3..8e2b3b8 100644
--- a/composer.json
+++ b/composer.json
@@ -30,7 +30,6 @@
     },
     "autoload": {
         "psr-4": {
-            "Molajo\\Factories\\": "Factories/",
             "Molajo\\Resource\\": "Source/"
         }
     },

From bc1189bc3c74bd80bde97c534cc3def4f432d08f Mon Sep 17 00:00:00 2001
From: AmyStephen 
Date: Sun, 22 Feb 2015 22:47:22 -0600
Subject: [PATCH 05/11] Restructure Resource frontend

---
 .dev/Bootstrap.php                   |   2 +-
 Source/Adapter/AbstractAdapter.php   |   4 +-
 Source/Adapter/ClassLoader.php       |   4 +-
 Source/Adapter/File.php              |   4 +-
 Source/Adapter/Folder.php            |   4 +-
 Source/Proxy.php                     |  96 ++++++++++
 Source/Proxy/Base.php                | 148 ++++++++++++++
 Source/Proxy/ClassLoader.php         |  69 +++++++
 Source/Proxy/Scheme.php              |  81 ++++++++
 Source/Proxy/Uri.php                 | 275 +++++++++++++++++++++++++++
 Source/{Driver.php => xxxDriver.php} |   2 +-
 11 files changed, 679 insertions(+), 10 deletions(-)
 create mode 100644 Source/Proxy.php
 create mode 100644 Source/Proxy/Base.php
 create mode 100644 Source/Proxy/ClassLoader.php
 create mode 100644 Source/Proxy/Scheme.php
 create mode 100644 Source/Proxy/Uri.php
 rename Source/{Driver.php => xxxDriver.php} (99%)

diff --git a/.dev/Bootstrap.php b/.dev/Bootstrap.php
index 79c51bb..0ee6d90 100644
--- a/.dev/Bootstrap.php
+++ b/.dev/Bootstrap.php
@@ -16,7 +16,7 @@
 $classmap                                  = array();
 $classmap['Molajo\\Resource\\ClassMap']    = $base . '/Source/ClassMap.php';
 $classmap['Molajo\\Resource\\ResourceMap'] = $base . '/Source/ResourceMap.php';
-$classmap['Molajo\\Resource\\Driver']      = $base . '/Source/Driver.php';
+$classmap['Molajo\\Resource\\Proxy']       = $base . '/Source/Proxy.php';
 $classmap['Molajo\\Resource\\Scheme']      = $base . '/Source/Scheme.php';
 $results                                   = createClassMap($base . '/Source/Adapter/', 'Molajo\\Render\\Adapter\\');
 $classmap                                  = array_merge($classmap, $results);
diff --git a/Source/Adapter/AbstractAdapter.php b/Source/Adapter/AbstractAdapter.php
index e9402fe..5afd17f 100644
--- a/Source/Adapter/AbstractAdapter.php
+++ b/Source/Adapter/AbstractAdapter.php
@@ -8,7 +8,7 @@
  */
 namespace Molajo\Resource\Adapter;
 
-use CommonApi\Resource\AdapterInterface;
+use CommonApi\Resource\ResourceInterface;
 use CommonApi\Exception\RuntimeException;
 
 /**
@@ -19,7 +19,7 @@
  * @license    http://www.opensource.org/licenses/mit-license.html MIT License
  * @since      1.0
  */
-class AbstractAdapter extends Cache implements AdapterInterface
+class AbstractAdapter extends Cache implements ResourceInterface
 {
     /**
      * Resource Namespace
diff --git a/Source/Adapter/ClassLoader.php b/Source/Adapter/ClassLoader.php
index bf63b5b..a34cdd0 100644
--- a/Source/Adapter/ClassLoader.php
+++ b/Source/Adapter/ClassLoader.php
@@ -8,7 +8,7 @@
  */
 namespace Molajo\Resource\Adapter;
 
-use CommonApi\Resource\AdapterInterface;
+use CommonApi\Resource\ResourceInterface;
 
 /**
  * Class Loader Resource Adapter
@@ -18,7 +18,7 @@
  * @license    http://www.opensource.org/licenses/mit-license.html MIT License
  * @since      1.0
  */
-class ClassLoader extends AbstractAdapter implements AdapterInterface
+class ClassLoader extends AbstractAdapter implements ResourceInterface
 {
     /**
      * Handle requires located file
diff --git a/Source/Adapter/File.php b/Source/Adapter/File.php
index b2bfca7..9fb0251 100644
--- a/Source/Adapter/File.php
+++ b/Source/Adapter/File.php
@@ -8,7 +8,7 @@
  */
 namespace Molajo\Resource\Adapter;
 
-use CommonApi\Resource\AdapterInterface;
+use CommonApi\Resource\ResourceInterface;
 
 /**
  * File Resource Adapter
@@ -18,7 +18,7 @@
  * @license    http://www.opensource.org/licenses/mit-license.html MIT License
  * @since      1.0
  */
-class File extends AbstractAdapter implements AdapterInterface
+class File extends AbstractAdapter implements ResourceInterface
 {
     /**
      * Handle located folder/file associated with URI Namespace for Resource
diff --git a/Source/Adapter/Folder.php b/Source/Adapter/Folder.php
index db107dd..14c834b 100644
--- a/Source/Adapter/Folder.php
+++ b/Source/Adapter/Folder.php
@@ -8,7 +8,7 @@
  */
 namespace Molajo\Resource\Adapter;
 
-use CommonApi\Resource\AdapterInterface;
+use CommonApi\Resource\ResourceInterface;
 
 //todo: add scoping overrides, etc. and multiple folders returned when needed
 
@@ -20,7 +20,7 @@
  * @license    http://www.opensource.org/licenses/mit-license.html MIT License
  * @since      1.0
  */
-class Folder extends AbstractAdapter implements AdapterInterface
+class Folder extends AbstractAdapter implements ResourceInterface
 {
     /**
      * Locates folder/file associated with Namespace for Resource
diff --git a/Source/Proxy.php b/Source/Proxy.php
new file mode 100644
index 0000000..48f15c9
--- /dev/null
+++ b/Source/Proxy.php
@@ -0,0 +1,96 @@
+adapter_instance_array as $key => $value) {
+
+            $this->adapter_instance_array[$key]->setNamespace(
+                $namespace_prefix,
+                $base_directory,
+                $prepend
+            );
+        }
+
+        return $this;
+    }
+
+    /**
+     * Verify if the resource namespace has been defined
+     *
+     * @param   string $uri_namespace
+     *
+     * @return  boolean
+     * @since   1.0.0
+     */
+    public function exists($uri_namespace)
+    {
+        $located_path = $this->getUriPath($uri_namespace);
+
+        if ($located_path === false) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * Locates folder/file associated with URI Namespace for Resource
+     *
+     * @param   string $uri_namespace
+     * @param   array  $options
+     *
+     * @return  void|mixed
+     * @since   1.0.0
+     */
+    public function get($uri_namespace, array $options = array())
+    {
+        return $this->getUriResource($uri_namespace, $options);
+    }
+
+    /**
+     * Retrieve a collection of a specific adapter
+     *
+     * @param   string $scheme_value
+     * @param   array  $options
+     *
+     * @return  mixed
+     * @since   1.0.0
+     */
+    public function getCollection($scheme_value, array $options = array())
+    {
+        $this->getScheme($scheme_value);
+
+        return $this->adapter_instance_array[$this->adapter_value]->getCollection($scheme_value, $options);
+    }
+}
diff --git a/Source/Proxy/Base.php b/Source/Proxy/Base.php
new file mode 100644
index 0000000..e634149
--- /dev/null
+++ b/Source/Proxy/Base.php
@@ -0,0 +1,148 @@
+scheme                 = $scheme;
+
+        foreach ($adapter_instance_array as $adapter => $adapter_instance) {
+            $this->setAdapterInstance($adapter, $adapter_instance);
+        }
+    }
+
+    /**
+     * Set Adapter Instance
+     *
+     * @param   string  $adapter_name
+     * @param   object  /CommonApi/Resource/ResourceInterface
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    public function setAdapterInstance($adapter_name, ResourceInterface $adapter_instance)
+    {
+        if ($adapter_instance instanceof ResourceInterface) {
+            $this->adapter_instance_array[$adapter_name] = $adapter_instance;
+        }
+
+        return $this;
+    }
+}
diff --git a/Source/Proxy/ClassLoader.php b/Source/Proxy/ClassLoader.php
new file mode 100644
index 0000000..e259bfe
--- /dev/null
+++ b/Source/Proxy/ClassLoader.php
@@ -0,0 +1,69 @@
+register(true);
+    }
+
+    /**
+     * Registers Class Autoloader
+     *
+     * @param   boolean $prepend
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    public function register($prepend = true)
+    {
+        spl_autoload_register(array('Molajo\Resource\Proxy\Uri', 'locateNamespace'), true, $prepend);
+
+        return $this;
+    }
+
+    /**
+     * Unregister Class Autoloader
+     *
+     * @return  $this
+     * @since   1.0.0
+     */
+    public function unregister()
+    {
+        spl_autoload_unregister(array('Molajo\Resource\Proxy\Uri', 'locateNamespace'));
+
+        return $this;
+    }
+}
diff --git a/Source/Proxy/Scheme.php b/Source/Proxy/Scheme.php
new file mode 100644
index 0000000..59bfc1e
--- /dev/null
+++ b/Source/Proxy/Scheme.php
@@ -0,0 +1,81 @@
+scheme->setScheme($scheme_name, $adapter_name, $extensions, $replace);
+
+        return $this;
+    }
+
+    /**
+     * Get Scheme (or all schemes)
+     *
+     * @param   string $scheme
+     *
+     * @return  object|array
+     * @since   1.0.0
+     * @throws  \CommonApi\Exception\RuntimeException
+     */
+    public function getScheme($scheme = '')
+    {
+        if ($scheme == '') {
+            return $this->scheme->getScheme();
+        }
+
+        $scheme = ucfirst(strtolower($scheme));
+
+        $this->scheme_value = $scheme;
+
+        $this->scheme_properties = $this->scheme->getScheme($this->scheme_value);
+
+        if ($this->scheme_properties === false) {
+            throw new RuntimeException('Resource getScheme Scheme not found: ' . $this->scheme_value);
+        }
+
+        $this->adapter_value = $this->scheme_properties->adapter;
+
+        if (isset($this->adapter_instance_array[$this->adapter_value])) {
+        } else {
+            echo 'in Resource Adapter ' . $this->adapter_value . ' 
'; + echo '
';
+            foreach ($this->adapter_instance_array as $key => $value) {
+                echo $key . '
'; + } + throw new RuntimeException('Resource getScheme Adapter not found: ' . $this->adapter_value); + } + + return $this->scheme_properties; + } +} diff --git a/Source/Proxy/Uri.php b/Source/Proxy/Uri.php new file mode 100644 index 0000000..17ea048 --- /dev/null +++ b/Source/Proxy/Uri.php @@ -0,0 +1,275 @@ +getUriPath($uri_namespace); + + if ($this->scheme_value === 'Field') { + return $this->adapter_instance_array[$this->adapter_value]->get(substr($uri_namespace, 9, 999)); + } + + return $this->locateNamespace(str_replace('\\', '/', $this->path), $this->scheme_value, $options); + } + + /** + * Get Path for URI + * + * @param string $uri_namespace + * + * @return string + * @since 1.0.0 + */ + protected function getUriPath($uri_namespace) + { + $this->parseUri($uri_namespace); + + $this->scheme_value = 'file'; + + $this->getScheme($this->scheme_value); + + return $this->adapter_instance_array[$this->adapter_value]->get($uri_namespace); + } + + /** + * Locates a resource using only the namespace + * + * @param string $namespace + * @param string $scheme + * @param array $options + * + * @return void|mixed + * @since 1.0.0 + */ + protected function locateNamespace($namespace, $scheme = 'ClassLoader', array $options = array()) + { + $this->getScheme($scheme); + + $multiple = false; + + if (isset($options['multiple']) && $options['multiple'] === true) { + $multiple = true; + } + + $located_path = $this->adapter_instance_array[$this->adapter_value]->get($namespace, $multiple); + + $options['namespace'] = $namespace; + + return $this->handlePath($this->scheme_value, $located_path, $options); + } + + /** + * Handle located folder/file associated with URI Namespace for Resource + * + * @param string $scheme_value + * @param string $located_path + * @param array $options + * + * @return void|mixed + * @since 1.0.0 + */ + protected function handlePath($scheme_value, $located_path, array $options = array()) + { + $this->getScheme($scheme_value); + + if (strtolower($scheme_value) == 'query') { + $xml = $this->adapter_instance_array['Xml']->handlePath( + $scheme_value, + $located_path, + $options + ); + $options['xml'] = $xml; + + $this->adapter_value = 'Query'; + } + + return $this->adapter_instance_array[$this->adapter_value]->handlePath($scheme_value, $located_path, $options); + } + + /** + * Parse the URL + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function parseUri($uri) + { + $uri = $this->setUriScheme($uri); + + $this->setUriHost($uri); + $this->setUriUser($uri); + $this->setUriPassword($uri); + $this->setUriPath($uri); + $this->setUriQuery($uri); + $this->setUriFragment($uri); + + return $this; + } + + /** + * Set Uri Scheme + * + * @param string $uri + * + * @return string + * @since 1.0.0 + */ + protected function setUriScheme($uri) + { + $scheme = parse_url($uri, PHP_URL_SCHEME); + + if ($scheme === false) { + if (strpos($uri, ':///') === false) { + } else { + $scheme = substr($uri, 0, strpos($uri, ':///')); + $uri = substr($uri, strpos($uri, ':///') + 4, 9999); + } + } + + if ($scheme === false) { + if (strpos($uri, ':/') === false) { + } else { + $scheme = substr($uri, 0, strpos($uri, ':/')); + $uri = substr($uri, strpos($uri, ':/') + 2, 9999); + } + } + + $this->getScheme($scheme); + + return $uri; + } + + /** + * Set Uri Host + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriHost($uri) + { + $this->host = parse_url($uri, PHP_URL_HOST); + + return $this; + } + + /** + * Set Uri User + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriUser($uri) + { + $this->user = parse_url($uri, PHP_URL_USER); + + return $this; + } + + /** + * Set Uri Password + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriPassword($uri) + { + $this->password = parse_url($uri, PHP_URL_PASS); + + return $this; + } + + /** + * Set Uri Path + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriPath($uri) + { + $this->path = parse_url($uri, PHP_URL_PATH); + + return $this; + } + + /** + * Set Uri Query + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriQuery($uri) + { + $this->query = array(); + + $query = parse_url($uri, PHP_URL_QUERY); + if ($query === null || $query === false) { + $query = ''; + } + + $temp = explode(',', $query); + + if (count($temp) > 0) { + foreach ($temp as $item) { + $pair = explode('=', $item); + if (count($pair) == 2) { + $this->query[$pair[0]] = $pair[1]; + } + } + } + + return $this; + } + + /** + * Set Uri Fragment + * + * @param string $uri + * + * @return $this + * @since 1.0.0 + */ + protected function setUriFragment($uri) + { + $this->fragment = parse_url($uri, PHP_URL_FRAGMENT); + + return $this; + } +} diff --git a/Source/Driver.php b/Source/xxxDriver.php similarity index 99% rename from Source/Driver.php rename to Source/xxxDriver.php index 62f492a..037112c 100644 --- a/Source/Driver.php +++ b/Source/xxxDriver.php @@ -10,7 +10,7 @@ use Exception; use CommonApi\Exception\RuntimeException; -use CommonApi\Resource\AdapterInterface; +use CommonApi\Resource\ResourceInterface; use CommonApi\Resource\ResourceInterface; use CommonApi\Resource\SchemeInterface; From 040451ff46c7c94b21e93f7fa2bb08ae4780d796 Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Mon, 23 Feb 2015 20:11:40 -0600 Subject: [PATCH 06/11] Resource Testing Stub --- .dev/Bootstrap.php | 1 + .dev/Reflection.php | 7 + .dev/Tests/ClassMapTest.php | 59 ++++++ .dev/Tests/ResourceTest.php | 97 --------- .dev/Tests/Source/A/Cat.php | 22 ++ .dev/Tests/Source/A/Dog.php | 22 ++ .dev/Tests/Source/A/Mouse.php | 22 ++ .dev/Tests/Source/A/Z/Stripes.txt | 1 + .dev/Tests/Source/A/Z/Zebra.php | 24 +++ .dev/Tests/Source/B/100x100.gif | Bin 0 -> 334 bytes .dev/Tests/Source/B/150x150.gif | Bin 0 -> 514 bytes .dev/Tests/Source/B/50x50.gif | Bin 0 -> 187 bytes .dev/Tests/Source/B/Banana.php | 24 +++ .dev/Tests/Source/B/Bat.php | 22 ++ .dev/Tests/Source/C/Candy.php | 22 ++ .dev/Tests/Source/C/Content.xml | 37 ++++ .dev/Tests/Source/C/Customize.css | 94 +++++++++ .dev/Tests/Source/C/Js/foundation.min.js | 10 + .scrutinizer.yml | 31 +++ .travis.yml | 12 +- Source/Adapter/AbstractAdapter.php | 2 +- Source/Adapter/ClassLoader.php | 2 +- Source/Adapter/File.php | 2 +- Source/Adapter/Folder.php | 2 +- Source/ClassMap.php | 16 +- Source/ClassMap/Aggregate.php | 2 +- Source/ClassMap/Base.php | 5 +- Source/ClassMap/Events.php | 2 +- Source/ClassMap/Items.php | 8 +- Source/Proxy.php | 2 +- Source/Proxy/Base.php | 2 +- Source/Proxy/ClassLoader.php | 2 +- Source/Proxy/Scheme.php | 2 +- Source/Proxy/Uri.php | 2 +- Source/ResourceMap.php | 2 +- Source/ResourceMap/Base.php | 2 +- Source/ResourceMap/Folders.php | 2 +- Source/ResourceMap/Prefixes.php | 2 +- Source/Scheme.php | 2 +- Source/xxxDriver.php | 2 +- coverage.clover | 244 +++++++++++++++++++++++ 41 files changed, 680 insertions(+), 134 deletions(-) create mode 100644 .dev/Reflection.php create mode 100644 .dev/Tests/ClassMapTest.php delete mode 100644 .dev/Tests/ResourceTest.php create mode 100644 .dev/Tests/Source/A/Cat.php create mode 100644 .dev/Tests/Source/A/Dog.php create mode 100644 .dev/Tests/Source/A/Mouse.php create mode 100644 .dev/Tests/Source/A/Z/Stripes.txt create mode 100644 .dev/Tests/Source/A/Z/Zebra.php create mode 100644 .dev/Tests/Source/B/100x100.gif create mode 100644 .dev/Tests/Source/B/150x150.gif create mode 100644 .dev/Tests/Source/B/50x50.gif create mode 100644 .dev/Tests/Source/B/Banana.php create mode 100644 .dev/Tests/Source/B/Bat.php create mode 100644 .dev/Tests/Source/C/Candy.php create mode 100644 .dev/Tests/Source/C/Content.xml create mode 100644 .dev/Tests/Source/C/Customize.css create mode 100644 .dev/Tests/Source/C/Js/foundation.min.js create mode 100644 .scrutinizer.yml create mode 100644 coverage.clover diff --git a/.dev/Bootstrap.php b/.dev/Bootstrap.php index 0ee6d90..f94b426 100644 --- a/.dev/Bootstrap.php +++ b/.dev/Bootstrap.php @@ -15,6 +15,7 @@ $classmap = array(); $classmap['Molajo\\Resource\\ClassMap'] = $base . '/Source/ClassMap.php'; +$classmap['Molajo\\Resource\\ClassMap'] = $base . '/Source/ClassMap.php'; $classmap['Molajo\\Resource\\ResourceMap'] = $base . '/Source/ResourceMap.php'; $classmap['Molajo\\Resource\\Proxy'] = $base . '/Source/Proxy.php'; $classmap['Molajo\\Resource\\Scheme'] = $base . '/Source/Scheme.php'; diff --git a/.dev/Reflection.php b/.dev/Reflection.php new file mode 100644 index 0000000..558b32a --- /dev/null +++ b/.dev/Reflection.php @@ -0,0 +1,7 @@ +getMethods(); +var_dump($methods); +foreach ($methods as $method) { + echo ' * @covers ' . $method->class . '::' . $method->name . PHP_EOL; +} diff --git a/.dev/Tests/ClassMapTest.php b/.dev/Tests/ClassMapTest.php new file mode 100644 index 0000000..f5b3ef2 --- /dev/null +++ b/.dev/Tests/ClassMapTest.php @@ -0,0 +1,59 @@ +render($file, $data); + $this->assertEquals('stuff', $stuff); + + */ + + return $this; + } + + /** + * Test Resource Renderer + * + * @return $this + * @since 1.0.0 + */ + public function testResource() + { + + return $this; + } +} + +class MockClassMap +{ + +} diff --git a/.dev/Tests/ResourceTest.php b/.dev/Tests/ResourceTest.php deleted file mode 100644 index 30e9c75..0000000 --- a/.dev/Tests/ResourceTest.php +++ /dev/null @@ -1,97 +0,0 @@ -render($file, $data); - $this->assertEquals('stuff', $stuff); - - return $this; - } - - /** - * Test Mustache Renderer - * - * @return $this - * @since 1.0.0 - */ - public function testMustache() - { - $instance = new Driver(new Mustache(new MockRender)); - - $file = __DIR__ . '/RenderTest.php'; - $data = array(); - $stuff = $instance->render($file, $data); - $this->assertEquals('stuff', $stuff); - - return $this; - } - - /** - * Test Twig Renderer - * - * @return $this - * @since 1.0.0 - */ - public function testTwig() - { - $instance = new Driver(new Twig(new MockRender)); - - $file = __DIR__ . '/RenderTest.php'; - $data = array(); - $stuff = $instance->render($file, $data); - $this->assertEquals('stuff', $stuff); - - return $this; - } -} - -class MockRender implements RenderInterface -{ - /** - * Render output for specified file and data - * - * @param string $include_file - * @param array $data - * - * @return string - * @since 1.0.0 - */ - public function render($include_file, array $data = array()) - { - return 'stuff'; - } -} diff --git a/.dev/Tests/Source/A/Cat.php b/.dev/Tests/Source/A/Cat.php new file mode 100644 index 0000000..2db6b97 --- /dev/null +++ b/.dev/Tests/Source/A/Cat.php @@ -0,0 +1,22 @@ +b(}P&+h)8pwX9-IWJ??x}4Yh3UtnwWiY;2vf`)6K%U&&D2 z=)uHXBE-zZ&feMGE7{h;(ACp7&5NajjggI&nPJYn1wxE-mzB<*JAdKoC7!dYN;Ynp z%*M=7vuXF%rpX=~_Z`|R%*x0ra&YgF4XfD7)}CL_z|J^f_r(i~E_fYloI2rw@SJ-` z=T3jv@4c*}xvD{!k%NI_@|*X&-WC4-^Y`C>24*f9j|~eBHggDT#hlo%@Nm0;vez7s Zjf;+UOBiR}Ik9o^@qQKsT^9xhYXBQ`m0bV; literal 0 HcmV?d00001 diff --git a/.dev/Tests/Source/B/150x150.gif b/.dev/Tests/Source/B/150x150.gif new file mode 100644 index 0000000000000000000000000000000000000000..7e74eb0ce8c7720145ce0622a2982b95731794da GIT binary patch literal 514 zcmV+d0{#6*Nk%v~VU_@v0OJ4v%*@P|mX^iE#iOI6x3{;kv9X+-oW8!ks;a6000000 z00000000000000000000EC2ui0G0rj000F35XecZy*TU5yZ>M)j$~<`XsWJk>%MR- z&vb3yc&_h!@BhG{a7Zi~kI1BQ$!t2G(5Q4uty-_xtai)odcWYXcuX#v&*-#z&2GEj z@VInWg0fXQg96~0Q-T1DCbh-l#c+ZF0~a%_I|{U*QUFZRSo4<7Re@6Jpmmd0K^p;H z2!JB=+SMCaqs7L`Bx8%#tX~vby%KgRroMZ9dkrgv7uQ}>)y?~x9{J;8$|#B EJN(}H!vFvP literal 0 HcmV?d00001 diff --git a/.dev/Tests/Source/B/50x50.gif b/.dev/Tests/Source/B/50x50.gif new file mode 100644 index 0000000000000000000000000000000000000000..db650233114b7674330cb856ce60d47d00d703f8 GIT binary patch literal 187 zcmZ?wbh9u|G-5Dfc+9|X=FFLC)27XtGiUMQ#oM=U-?wky(W6IKty;Bl<3 + + RESOURCE_ARTICLES_NAME + Amy Stephen + January 2015 + Copyright (C) 2014-2015 Amy Stephen. All rights reserved. + MIT + hello@molajo.org + http://molajo.org + 1.0 + RESOURCE_ARTICLES_DESCRIPTION + + + + + + + + + + + + + + diff --git a/.dev/Tests/Source/C/Customize.css b/.dev/Tests/Source/C/Customize.css new file mode 100644 index 0000000..d29c016 --- /dev/null +++ b/.dev/Tests/Source/C/Customize.css @@ -0,0 +1,94 @@ +/*! Customize.css v 1 | MIT License */ + +/*! Grid row */ +.odd { + background-color: #DBDBDB; + padding-top: .5em +} + +.even { + padding-top: .5em +} + +.edit-title { +} + +.edit-editor { +} + +.edit-foooter { +} + +.edit-sidebar1, .edit-sidebar2, .edit-sidebar3 { +} + +.order-down, .order-up { + padding-right: 5px +} + +.fi-star { + color: gold; + font-weight: bold; + font-size: 1.5rem; + text-align: center +} + +.center { + text-align: center +} + +html, body { + height: 100%; +} + +.page-wrap { + min-height: 100%; +} + +/*! Footer*/ +.site-footer ul.footer-links { + margin: 0; + display: inline-block; + padding-bottom: 0px; + padding-top: 10px; +} + +.site-footer ul.footer-links li { + display: block; + float: left; + margin-left: 6px; + text-transform: uppercase; + font-weight: 700; + font-size: 0.75rem; +} + +.site-footer ul.footer-links li a { + color: #666666; + padding: 3px 6px; +} + +.site-footer ul.footer-links li a:hover { + color: #777777; +} + +.site-footer p.copyright { + margin: 6px 0 0; + font-size: 0.75rem; + color: #666666; +} + +.page-wrap { + min-height: 95%; +} + +.page-wrap:after { + /* .push must be the same height as footer */ + height: 80px; + background: #FFFFFF; +} + +.site-footer { + /* .push must be the same height as footer */ + height: 80px; + background: #333333; +} diff --git a/.dev/Tests/Source/C/Js/foundation.min.js b/.dev/Tests/Source/C/Js/foundation.min.js new file mode 100644 index 0000000..3dfe55f --- /dev/null +++ b/.dev/Tests/Source/C/Js/foundation.min.js @@ -0,0 +1,10 @@ +/* + * Foundation Responsive Library + * http://foundation.zurb.com + * Copyright 2014, ZURB + * Free to use under the MIT license. + * http://www.opensource.org/licenses/mit-license.php +*/ +(function(e,t,n,r){"use strict";function l(e){if(typeof e=="string"||e instanceof String)e=e.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g,"");return e}var i=function(t){var n=t.length,r=e("head");while(n--)r.has("."+t[n]).length===0&&r.append('')};i(["foundation-mq-small","foundation-mq-medium","foundation-mq-large","foundation-mq-xlarge","foundation-mq-xxlarge","foundation-data-attribute-namespace"]),e(function(){typeof FastClick!="undefined"&&typeof n.body!="undefined"&&FastClick.attach(n.body)});var s=function(t,r){if(typeof t=="string"){if(r){var i;if(r.jquery){i=r[0];if(!i)return r}else i=r;return e(i.querySelectorAll(t))}return e(n.querySelectorAll(t))}return e(t,r)},o=function(e){var t=[];return e||t.push("data"),this.namespace.length>0&&t.push(this.namespace),t.push(this.name),t.join("-")},u=function(e){var t=e.split("-"),n=t.length,r=[];while(n--)n!==0?r.push(t[n]):this.namespace.length>0?r.push(this.namespace,t[n]):r.push(t[n]);return r.reverse().join("-")},a=function(t,n){var r=this,i=!s(this).data(this.attr_name(!0));s(this.scope).is("["+this.attr_name()+"]")?(s(this.scope).data(this.attr_name(!0)+"-init",e.extend({},this.settings,n||t,this.data_options(s(this.scope)))),i&&this.events(this.scope)):s("["+this.attr_name()+"]",this.scope).each(function(){var i=!s(this).data(r.attr_name(!0)+"-init");s(this).data(r.attr_name(!0)+"-init",e.extend({},r.settings,n||t,r.data_options(s(this)))),i&&r.events(this)});if(typeof t=="string")return this[t].call(this,n)},f=function(e,t){function n(){t(e[0])}function r(){this.one("load",n);if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var e=this.attr("src"),t=e.match(/\?/)?"&":"?";t+="random="+(new Date).getTime(),this.attr("src",e+t)}}if(!e.attr("src")){n();return}e[0].complete||e[0].readyState===4?n():r.call(e)};t.matchMedia=t.matchMedia||function(e){var t,n=e.documentElement,r=n.firstElementChild||n.firstChild,i=e.createElement("body"),s=e.createElement("div");return s.id="mq-test-1",s.style.cssText="position:absolute;top:-100em",i.style.background="none",i.appendChild(s),function(e){return s.innerHTML='­',n.insertBefore(i,r),t=s.offsetWidth===42,n.removeChild(i),{matches:t,media:e}}}(n),function(e){function a(){n&&(s(a),u&&jQuery.fx.tick())}var n,r=0,i=["webkit","moz"],s=t.requestAnimationFrame,o=t.cancelAnimationFrame,u="undefined"!=typeof jQuery.fx;for(;r").appendTo("head")[0].sheet,global:{namespace:r},init:function(e,n,r,i,o){var u=[e,r,i,o],a=[];this.rtl=/rtl/i.test(s("html").attr("dir")),this.scope=e||this.scope,this.set_namespace();if(n&&typeof n=="string"&&!/reflow/i.test(n))this.libs.hasOwnProperty(n)&&a.push(this.init_lib(n,u));else for(var f in this.libs)a.push(this.init_lib(f,n));return s(t).load(function(){s(t).trigger("resize.fndtn.clearing").trigger("resize.fndtn.dropdown").trigger("resize.fndtn.equalizer").trigger("resize.fndtn.interchange").trigger("resize.fndtn.joyride").trigger("resize.fndtn.magellan").trigger("resize.fndtn.topbar").trigger("resize.fndtn.slider")}),e},init_lib:function(t,n){return this.libs.hasOwnProperty(t)?(this.patch(this.libs[t]),n&&n.hasOwnProperty(t)?(typeof this.libs[t].settings!="undefined"?e.extend(!0,this.libs[t].settings,n[t]):typeof this.libs[t].defaults!="undefined"&&e.extend(!0,this.libs[t].defaults,n[t]),this.libs[t].init.apply(this.libs[t],[this.scope,n[t]])):(n=n instanceof Array?n:new Array(n),this.libs[t].init.apply(this.libs[t],n))):function(){}},patch:function(e){e.scope=this.scope,e.namespace=this.global.namespace,e.rtl=this.rtl,e.data_options=this.utils.data_options,e.attr_name=o,e.add_namespace=u,e.bindings=a,e.S=this.utils.S},inherit:function(e,t){var n=t.split(" "),r=n.length;while(r--)this.utils.hasOwnProperty(n[r])&&(e[n[r]]=this.utils[n[r]])},set_namespace:function(){var t=this.global.namespace===r?e(".foundation-data-attribute-namespace").css("font-family"):this.global.namespace;this.global.namespace=t===r||/false/i.test(t)?"":t},libs:{},utils:{S:s,throttle:function(e,t){var n=null;return function(){var r=this,i=arguments;n==null&&(n=setTimeout(function(){e.apply(r,i),n=null},t))}},debounce:function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},data_options:function(t,n){function f(e){return!isNaN(e-0)&&e!==null&&e!==""&&e!==!1&&e!==!0}function l(t){return typeof t=="string"?e.trim(t):t}n=n||"options";var r={},i,s,o,u=function(e){var t=Foundation.global.namespace;return t.length>0?e.data(t+"-"+n):e.data(n)},a=u(t);if(typeof a=="object")return a;o=(a||":").split(";"),i=o.length;while(i--)s=o[i].split(":"),s=[s[0],s.slice(1).join(":")],/true/i.test(s[1])&&(s[1]=!0),/false/i.test(s[1])&&(s[1]=!1),f(s[1])&&(s[1].indexOf(".")===-1?s[1]=parseInt(s[1],10):s[1]=parseFloat(s[1])),s.length===2&&s[0].length>0&&(r[l(s[0])]=l(s[1]));return r},register_media:function(t,n){Foundation.media_queries[t]===r&&(e("head").append(''),Foundation.media_queries[t]=l(e("."+n).css("font-family")))},add_custom_rule:function(e,t){if(t===r&&Foundation.stylesheet)Foundation.stylesheet.insertRule(e,Foundation.stylesheet.cssRules.length);else{var n=Foundation.media_queries[t];n!==r&&Foundation.stylesheet.insertRule("@media "+Foundation.media_queries[t]+"{ "+e+" }")}},image_loaded:function(e,t){var n=this,r=e.length;r===0&&t(e),e.each(function(){f(n.S(this),function(){r-=1,r===0&&t(e)})})},random_str:function(){return this.fidx||(this.fidx=0),this.prefix=this.prefix||[this.name||"F",(+(new Date)).toString(36)].join("-"),this.prefix+(this.fidx++).toString(36)}}},e.fn.foundation=function(){var e=Array.prototype.slice.call(arguments,0);return this.each(function(){return Foundation.init.apply(Foundation,[this].concat(e)),this})}})(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.abide={name:"abide",version:"5.3.3",settings:{live_validate:!0,focus_on_invalid:!0,error_labels:!0,timeout:1e3,patterns:{alpha:/^[a-zA-Z]+$/,alpha_numeric:/^[a-zA-Z0-9]+$/,integer:/^[-+]?\d+$/,number:/^[-+]?\d*(?:[\.\,]\d+)?$/,card:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,cvv:/^([0-9]){3,4}$/,email:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,url:/^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,domain:/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,datetime:/^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,date:/(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,time:/^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,dateISO:/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,month_day_year:/^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,color:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/},validators:{equalTo:function(e,t,r){var i=n.getElementById(e.getAttribute(this.add_namespace("data-equalto"))).value,s=e.value,o=i===s;return o}}},timer:null,init:function(e,t,n){this.bindings(t,n)},events:function(t){var n=this,r=n.S(t).attr("novalidate","novalidate"),i=r.data(this.attr_name(!0)+"-init")||{};this.invalid_attr=this.add_namespace("data-invalid"),r.off(".abide").on("submit.fndtn.abide validate.fndtn.abide",function(e){var t=/ajax/i.test(n.S(this).attr(n.attr_name()));return n.validate(n.S(this).find("input, textarea, select").get(),e,t)}).on("reset",function(){return n.reset(e(this))}).find("input, textarea, select").off(".abide").on("blur.fndtn.abide change.fndtn.abide",function(e){n.validate([this],e)}).on("keydown.fndtn.abide",function(e){i.live_validate===!0&&(clearTimeout(n.timer),n.timer=setTimeout(function(){n.validate([this],e)}.bind(this),i.timeout))})},reset:function(t){t.removeAttr(this.invalid_attr),e(this.invalid_attr,t).removeAttr(this.invalid_attr),e(".error",t).not("small").removeClass("error")},validate:function(e,t,n){var r=this.parse_patterns(e),i=r.length,s=this.S(e[0]).closest("form"),o=/submit/.test(t.type);for(var u=0;u0?[e,this.settings.patterns[r],n]:r.length>0?[e,new RegExp(r),n]:this.settings.patterns.hasOwnProperty(t)?[e,this.settings.patterns[t],n]:(r=/.*/,[e,r,n])},check_validation_and_apply_styles:function(t){var n=t.length,r=[],i=this.S(t[0][0]).closest("[data-"+this.attr_name(!0)+"]"),s=i.data(this.attr_name(!0)+"-init")||{};while(n--){var o=t[n][0],u=t[n][2],a=o.value.trim(),f=this.S(o).parent(),l=o.getAttribute(this.add_namespace("data-abide-validator")),c=o.type==="radio",h=o.type==="checkbox",p=this.S('label[for="'+o.getAttribute("id")+'"]'),d=u?o.value.length>0:!0,v,m;o.getAttribute(this.add_namespace("data-equalto"))&&(l="equalTo"),f.is("label")?v=f.parent():v=f,c&&u?r.push(this.valid_radio(o,u)):h&&u?r.push(this.valid_checkbox(o,u)):(l&&(m=this.settings.validators[l].apply(this,[o,u,v]),r.push(m)),t[n][1].test(a)&&d||!u&&o.value.length<1||e(o).attr("disabled")?r.push(!0):r.push(!1),r=[r.every(function(e){return e})],r[0]?(this.S(o).removeAttr(this.invalid_attr),v.removeClass("error"),p.length>0&&this.settings.error_labels&&p.removeClass("error"),e(o).triggerHandler("valid")):(v.addClass("error"),this.S(o).attr(this.invalid_attr,""),p.length>0&&this.settings.error_labels&&p.addClass("error"),e(o).triggerHandler("invalid")))}return r},valid_checkbox:function(e,t){var e=this.S(e),n=e.is(":checked")||!t;return n?e.removeAttr(this.invalid_attr).parent().removeClass("error"):e.attr(this.invalid_attr,"").parent().addClass("error"),n},valid_radio:function(e,t){var n=e.getAttribute("name"),r=this.S(e).closest("[data-"+this.attr_name(!0)+"]").find("[name='"+n+"']"),i=r.length,s=!1;for(var o=0;o0;s?e.removeAttr(this.invalid_attr).parent().removeClass("error"):e.attr(this.invalid_attr,"").parent().addClass("error");if(!r){var o=this;i.each(function(){o.valid_oneof.call(o,this,null,null,!0)})}return s}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.equalizer={name:"equalizer",version:"5.3.3",settings:{use_tallest:!0,before_height_change:e.noop,after_height_change:e.noop,equalize_on_stack:!1},init:function(e,t,n){Foundation.inherit(this,"image_loaded"),this.bindings(t,n),this.reflow()},events:function(){this.S(t).off(".equalizer").on("resize.fndtn.equalizer",function(e){this.reflow()}.bind(this))},equalize:function(t){var n=!1,r=t.find("["+this.attr_name()+"-watch]:visible"),i=t.data(this.attr_name(!0)+"-init");if(r.length===0)return;var s=r.first().offset().top;i.before_height_change(),t.trigger("before-height-change").trigger("before-height-change.fndth.equalizer"),r.height("inherit"),r.each(function(){var t=e(this);t.offset().top!==s&&(n=!0)});if(i.equalize_on_stack===!1&&n)return;var o=r.map(function(){return e(this).outerHeight(!1)}).get();if(i.use_tallest){var u=Math.max.apply(null,o);r.css("height",u)}else{var a=Math.min.apply(null,o);r.css("height",a)}i.after_height_change(),t.trigger("after-height-change").trigger("after-height-change.fndtn.equalizer")},reflow:function(){var t=this;this.S("["+this.attr_name()+"]",this.scope).each(function(){var n=e(this);t.image_loaded(t.S("img",this),function(){t.equalize(n)})})}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.interchange={name:"interchange",version:"5.3.3",cache:{},images_loaded:!1,nodes_loaded:!1,settings:{load_attr:"interchange",named_queries:{"default":"only screen",small:Foundation.media_queries.small,medium:Foundation.media_queries.medium,large:Foundation.media_queries.large,xlarge:Foundation.media_queries.xlarge,xxlarge:Foundation.media_queries.xxlarge,landscape:"only screen and (orientation: landscape)",portrait:"only screen and (orientation: portrait)",retina:"only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx)"},directives:{replace:function(t,n,r){if(/IMG/.test(t[0].nodeName)){var i=t[0].src;if((new RegExp(n,"i")).test(i))return;return t[0].src=n,r(t[0].src)}var s=t.data(this.data_attr+"-last-path"),o=this;if(s==n)return;return/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(n)?(e(t).css("background-image","url("+n+")"),t.data("interchange-last-path",n),r(n)):e.get(n,function(e){t.html(e),t.data(o.data_attr+"-last-path",n),r()})}}},init:function(t,n,r){Foundation.inherit(this,"throttle random_str"),this.data_attr=this.set_data_attr(),e.extend(!0,this.settings,n,r),this.bindings(n,r),this.load("images"),this.load("nodes")},get_media_hash:function(){var e="";for(var t in this.settings.named_queries)e+=matchMedia(this.settings.named_queries[t]).matches.toString();return e},events:function(){var n=this,r;return e(t).off(".interchange").on("resize.fndtn.interchange",n.throttle(function(){var e=n.get_media_hash();e!==r&&n.resize(),r=e},50)),this},resize:function(){var t=this.cache;if(!this.images_loaded||!this.nodes_loaded){setTimeout(e.proxy(this.resize,this),50);return}for(var n in t)if(t.hasOwnProperty(n)){var r=this.results(n,t[n]);r&&this.settings.directives[r.scenario[1]].call(this,r.el,r.scenario[0],function(){if(arguments[0]instanceof Array)var e=arguments[0];else var e=Array.prototype.slice.call(arguments,0);r.el.trigger(r.scenario[1],e)})}},results:function(e,t){var n=t.length;if(n>0){var r=this.S("["+this.add_namespace("data-uuid")+'="'+e+'"]');while(n--){var i,s=t[n][2];this.settings.named_queries.hasOwnProperty(s)?i=matchMedia(this.settings.named_queries[s]):i=matchMedia(s);if(i.matches)return{el:r,scenario:t[n]}}}return!1},load:function(e,t){return(typeof this["cached_"+e]=="undefined"||t)&&this["update_"+e](),this["cached_"+e]},update_images:function(){var e=this.S("img["+this.data_attr+"]"),t=e.length,n=t,r=0,i=this.data_attr;this.cache={},this.cached_images=[],this.images_loaded=t===0;while(n--){r++;if(e[n]){var s=e[n].getAttribute(i)||"";s.length>0&&this.cached_images.push(e[n])}r===t&&(this.images_loaded=!0,this.enhance("images"))}return this},update_nodes:function(){var e=this.S("["+this.data_attr+"]").not("img"),t=e.length,n=t,r=0,i=this.data_attr;this.cached_nodes=[],this.nodes_loaded=t===0;while(n--){r++;var s=e[n].getAttribute(i)||"";s.length>0&&this.cached_nodes.push(e[n]),r===t&&(this.nodes_loaded=!0,this.enhance("nodes"))}return this},enhance:function(n){var r=this["cached_"+n].length;while(r--)this.object(e(this["cached_"+n][r]));return e(t).trigger("resize").trigger("resize.fndtn.interchange")},convert_directive:function(e){var t=this.trim(e);return t.length>0?t:"replace"},parse_scenario:function(e){var t=e[0].match(/(.+),\s*(\w+)\s*$/),n=e[1];if(t)var r=t[1],i=t[2];else var s=e[0].split(/,\s*$/),r=s[0],i="";return[this.trim(r),this.convert_directive(i),this.trim(n)]},object:function(e){var t=this.parse_data_attr(e),n=[],r=t.length;if(r>0)while(r--){var i=t[r].split(/\((.*?)(\))$/);if(i.length>1){var s=this.parse_scenario(i);n.push(s)}}return this.store(e,n)},store:function(e,t){var n=this.random_str(),r=e.data(this.add_namespace("uuid",!0));return this.cache[r]?this.cache[r]:(e.attr(this.add_namespace("data-uuid"),n),this.cache[n]=t)},trim:function(t){return typeof t=="string"?e.trim(t):t},set_data_attr:function(e){return e?this.namespace.length>0?this.namespace+"-"+this.settings.load_attr:this.settings.load_attr:this.namespace.length>0?"data-"+this.namespace+"-"+this.settings.load_attr:"data-"+this.settings.load_attr},parse_data_attr:function(e){var t=e.attr(this.attr_name()).split(/\[(.*?)\]/),n=t.length,r=[];while(n--)t[n].replace(/[\W\d]+/,"").length>4&&r.push(t[n]);return r},reflow:function(){this.load("images",!0),this.load("nodes",!0)}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.dropdown={name:"dropdown",version:"5.3.3",settings:{active_class:"open",align:"bottom",is_hover:!1,opened:function(){},closed:function(){}},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n)},events:function(n){var r=this,i=r.S;i(this.scope).off(".dropdown").on("click.fndtn.dropdown","["+this.attr_name()+"]",function(t){var n=i(this).data(r.attr_name(!0)+"-init")||r.settings;if(!n.is_hover||Modernizr.touch)t.preventDefault(),r.toggle(e(this))}).on("mouseenter.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(e){var t=i(this),n,s;clearTimeout(r.timeout),t.data(r.data_attr())?(n=i("#"+t.data(r.data_attr())),s=t):(n=t,s=i("["+r.attr_name()+"='"+n.attr("id")+"']"));var o=s.data(r.attr_name(!0)+"-init")||r.settings;i(e.target).data(r.data_attr())&&o.is_hover&&r.closeall.call(r),o.is_hover&&r.open.apply(r,[n,s])}).on("mouseleave.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(e){var t=i(this);r.timeout=setTimeout(function(){if(t.data(r.data_attr())){var e=t.data(r.data_attr(!0)+"-init")||r.settings;e.is_hover&&r.close.call(r,i("#"+t.data(r.data_attr())))}else{var n=i("["+r.attr_name()+'="'+i(this).attr("id")+'"]'),e=n.data(r.attr_name(!0)+"-init")||r.settings;e.is_hover&&r.close.call(r,t)}}.bind(this),150)}).on("click.fndtn.dropdown",function(t){var n=i(t.target).closest("["+r.attr_name()+"-content]");if(i(t.target).closest("["+r.attr_name()+"]").length>0)return;if(!i(t.target).data("revealId")&&n.length>0&&(i(t.target).is("["+r.attr_name()+"-content]")||e.contains(n.first()[0],t.target))){t.stopPropagation();return}r.close.call(r,i("["+r.attr_name()+"-content]"))}).on("opened.fndtn.dropdown","["+r.attr_name()+"-content]",function(){r.settings.opened.call(this)}).on("closed.fndtn.dropdown","["+r.attr_name()+"-content]",function(){r.settings.closed.call(this)}),i(t).off(".dropdown").on("resize.fndtn.dropdown",r.throttle(function(){r.resize.call(r)},50)),this.resize()},close:function(e){var t=this;e.each(function(){t.S(this).hasClass(t.settings.active_class)&&(t.S(this).css(Foundation.rtl?"right":"left","-99999px").removeClass(t.settings.active_class).prev("["+t.attr_name()+"]").removeClass(t.settings.active_class).removeData("target"),t.S(this).trigger("closed").trigger("closed.fndtn.dropdown",[e]))})},closeall:function(){var t=this;e.each(t.S("["+this.attr_name()+"-content]"),function(){t.close.call(t,t.S(this))})},open:function(e,t){this.css(e.addClass(this.settings.active_class),t),e.prev("["+this.attr_name()+"]").addClass(this.settings.active_class),e.data("target",t.get(0)).trigger("opened").trigger("opened.fndtn.dropdown",[e,t])},data_attr:function(){return this.namespace.length>0?this.namespace+"-"+this.name:this.name},toggle:function(e){var t=this.S("#"+e.data(this.data_attr()));if(t.length===0)return;this.close.call(this,this.S("["+this.attr_name()+"-content]").not(t)),t.hasClass(this.settings.active_class)?(this.close.call(this,t),t.data("target")!==e.get(0)&&this.open.call(this,t,e)):this.open.call(this,t,e)},resize:function(){var e=this.S("["+this.attr_name()+"-content].open"),t=this.S("["+this.attr_name()+"='"+e.attr("id")+"']");e.length&&t.length&&this.css(e,t)},css:function(e,t){var n=Math.max((t.width()-e.width())/2,8);this.clear_idx();if(this.small()){var r=this.dirs.bottom.call(e,t);e.attr("style","").removeClass("drop-left drop-right drop-top").css({position:"absolute",width:"95%","max-width":"none",top:r.top}),e.css(Foundation.rtl?"right":"left",n)}else{var i=t.data(this.attr_name(!0)+"-init")||this.settings;this.style(e,t,i)}return e},style:function(t,n,r){var i=e.extend({position:"absolute"},this.dirs[r.align].call(t,n,r));t.attr("style","").css(i)},dirs:{_base:function(e){var t=this.offsetParent(),n=t.offset(),r=e.offset();return r.top-=n.top,r.left-=n.left,r},top:function(e,t){var n=Foundation.libs.dropdown,r=n.dirs._base.call(this,e),i=8;return this.addClass("drop-top"),(e.outerWidth() dd > a",function(r){var i=n(this).closest("["+t.attr_name()+"]"),s=t.attr_name()+"="+i.attr(t.attr_name()),o=i.data(t.attr_name(!0)+"-init"),u=n("#"+this.href.split("#")[1]),a=e("> dd",i),f=a.children(".content"),l=f.filter("."+o.active_class);r.preventDefault(),i.attr(t.attr_name())&&(f=f.add("["+s+"] dd > .content"),a=a.add("["+s+"] dd"));if(o.toggleable&&u.is(l)){u.parent("dd").toggleClass(o.active_class,!1),u.toggleClass(o.active_class,!1),o.callback(u),u.triggerHandler("toggled",[i]),i.triggerHandler("toggled",[u]);return}o.multi_expand||(f.removeClass(o.active_class),a.removeClass(o.active_class)),u.addClass(o.active_class).parent().addClass(o.active_class),o.callback(u),u.triggerHandler("toggled",[i]),i.triggerHandler("toggled",[u])})},off:function(){},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.alert={name:"alert",version:"5.3.3",settings:{callback:function(){}},init:function(e,t,n){this.bindings(t,n)},events:function(){var t=this,n=this.S;e(this.scope).off(".alert").on("click.fndtn.alert","["+this.attr_name()+"] a.close",function(e){var r=n(this).closest("["+t.attr_name()+"]"),i=r.data(t.attr_name(!0)+"-init")||t.settings;e.preventDefault(),Modernizr.csstransitions?(r.addClass("alert-close"),r.on("transitionend webkitTransitionEnd oTransitionEnd",function(e){n(this).trigger("close").trigger("close.fndtn.alert").remove(),i.callback()})):r.fadeOut(300,function(){n(this).trigger("close").trigger("close.fndtn.alert").remove(),i.callback()})})},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.clearing={name:"clearing",version:"5.3.3",settings:{templates:{viewing:'×'},close_selectors:".clearing-close, div.clearing-blackout",open_selectors:"",skip_selector:"",touch_label:"",init:!1,locked:!1},init:function(e,t,n){var r=this;Foundation.inherit(this,"throttle image_loaded"),this.bindings(t,n),r.S(this.scope).is("["+this.attr_name()+"]")?this.assemble(r.S("li",this.scope)):r.S("["+this.attr_name()+"]",this.scope).each(function(){r.assemble(r.S("li",this))})},events:function(r){var i=this,s=i.S,o=e(".scroll-container");o.length>0&&(this.scope=o),s(this.scope).off(".clearing").on("click.fndtn.clearing","ul["+this.attr_name()+"] li "+this.settings.open_selectors,function(e,t,n){var t=t||s(this),n=n||t,r=t.next("li"),o=t.closest("["+i.attr_name()+"]").data(i.attr_name(!0)+"-init"),u=s(e.target);e.preventDefault(),o||(i.init(),o=t.closest("["+i.attr_name()+"]").data(i.attr_name(!0)+"-init")),n.hasClass("visible")&&t[0]===n[0]&&r.length>0&&i.is_open(t)&&(n=r,u=s("img",n)),i.open(u,t,n),i.update_paddles(n)}).on("click.fndtn.clearing",".clearing-main-next",function(e){i.nav(e,"next")}).on("click.fndtn.clearing",".clearing-main-prev",function(e){i.nav(e,"prev")}).on("click.fndtn.clearing",this.settings.close_selectors,function(e){Foundation.libs.clearing.close(e,this)}),e(n).on("keydown.fndtn.clearing",function(e){i.keydown(e)}),s(t).off(".clearing").on("resize.fndtn.clearing",function(){i.resize()}),this.swipe_events(r)},swipe_events:function(e){var t=this,n=t.S;n(this.scope).on("touchstart.fndtn.clearing",".visible-img",function(e){e.touches||(e=e.originalEvent);var t={start_page_x:e.touches[0].pageX,start_page_y:e.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:r};n(this).data("swipe-transition",t),e.stopPropagation()}).on("touchmove.fndtn.clearing",".visible-img",function(e){e.touches||(e=e.originalEvent);if(e.touches.length>1||e.scale&&e.scale!==1)return;var r=n(this).data("swipe-transition");typeof r=="undefined"&&(r={}),r.delta_x=e.touches[0].pageX-r.start_page_x,Foundation.rtl&&(r.delta_x=-r.delta_x),typeof r.is_scrolling=="undefined"&&(r.is_scrolling=!!(r.is_scrolling||Math.abs(r.delta_x)');var r=n.detach(),i="";if(r[0]==null)return;i=r[0].outerHTML;var s=this.S("#foundationClearingHolder"),o=n.data(this.attr_name(!0)+"-init"),u={grid:'",viewing:o.templates.viewing},a='
'+u.viewing+u.grid+"
",f=this.settings.touch_label;Modernizr.touch&&(a=e(a).find(".clearing-touch-label").html(f).end()),s.after(a).remove()},open:function(t,r,i){function p(){setTimeout(function(){this.image_loaded(l,function(){l.outerWidth()===1&&!h?p.call(this):d.call(this,l)}.bind(this))}.bind(this),100)}function d(t){var n=e(t);n.css("visibility","visible"),o.css("overflow","hidden"),u.addClass("clearing-blackout"),a.addClass("clearing-container"),f.show(),this.fix_height(i).caption(s.S(".clearing-caption",f),s.S("img",i)).center_and_label(t,c).shift(r,i,function(){i.closest("li").siblings().removeClass("visible"),i.closest("li").addClass("visible")}),f.trigger("opened.fndtn.clearing")}var s=this,o=e(n.body),u=i.closest(".clearing-assembled"),a=s.S("div",u).first(),f=s.S(".visible-img",a),l=s.S("img",f).not(t),c=s.S(".clearing-touch-label",a),h=!1;e("body").on("touchmove",function(e){e.preventDefault()}),l.error(function(){h=!0}),this.locked()||(f.trigger("open.fndtn.clearing"),l.attr("src",this.load(t)).css("visibility","hidden"),p.call(this))},close:function(t,r){t.preventDefault();var i=function(e){return/blackout/.test(e.selector)?e:e.closest(".clearing-blackout")}(e(r)),s=e(n.body),o,u;return r===t.target&&i&&(s.css("overflow",""),o=e("div",i).first(),u=e(".visible-img",o),u.trigger("close.fndtn.clearing"),this.settings.prev_index=0,e("ul["+this.attr_name()+"]",i).attr("style","").closest(".clearing-blackout").removeClass("clearing-blackout"),o.removeClass("clearing-container"),u.hide(),u.trigger("closed.fndtn.clearing")),e("body").off("touchmove"),!1},is_open:function(e){return e.parent().prop("style").length>0},keydown:function(t){var n=e(".clearing-blackout ul["+this.attr_name()+"]"),r=this.rtl?37:39,i=this.rtl?39:37,s=27;t.which===r&&this.go(n,"next"),t.which===i&&this.go(n,"prev"),t.which===s&&this.S("a.clearing-close").trigger("click").trigger("click.fndtn.clearing")},nav:function(t,n){var r=e("ul["+this.attr_name()+"]",".clearing-blackout");t.preventDefault(),this.go(r,n)},resize:function(){var t=e("img",".clearing-blackout .visible-img"),n=e(".clearing-touch-label",".clearing-blackout");t.length&&(this.center_and_label(t,n),t.trigger("resized.fndtn.clearing"))},fix_height:function(e){var t=e.parent().children(),n=this;return t.each(function(){var e=n.S(this),t=e.find("img");e.height()>t.outerHeight()&&e.addClass("fix-height")}).closest("ul").width +(t.length*100+"%"),this},update_paddles:function(e){e=e.closest("li");var t=e.closest(".carousel").siblings(".visible-img");e.next().length>0?this.S(".clearing-main-next",t).removeClass("disabled"):this.S(".clearing-main-next",t).addClass("disabled"),e.prev().length>0?this.S(".clearing-main-prev",t).removeClass("disabled"):this.S(".clearing-main-prev",t).addClass("disabled")},center_and_label:function(e,t){return this.rtl?(e.css({marginRight:-(e.outerWidth()/2),marginTop:-(e.outerHeight()/2),left:"auto",right:"50%"}),t.length>0&&t.css({marginRight:-(t.outerWidth()/2),marginTop:-(e.outerHeight()/2)-t.outerHeight()-10,left:"auto",right:"50%"})):(e.css({marginLeft:-(e.outerWidth()/2),marginTop:-(e.outerHeight()/2)}),t.length>0&&t.css({marginLeft:-(t.outerWidth()/2),marginTop:-(e.outerHeight()/2)-t.outerHeight()-10})),this},load:function(e){var t;return e[0].nodeName==="A"?t=e.attr("href"):t=e.parent().attr("href"),this.preload(e),t?t:e.attr("src")},preload:function(e){this.img(e.closest("li").next()).img(e.closest("li").prev())},img:function(e){if(e.length){var t=new Image,n=this.S("a",e);n.length?t.src=n.attr("href"):t.src=this.S("img",e).attr("src")}return this},caption:function(e,t){var n=t.attr("data-caption");return n?e.html(n).show():e.text("").hide(),this},go:function(e,t){var n=this.S(".visible",e),r=n[t]();this.settings.skip_selector&&r.find(this.settings.skip_selector).length!=0&&(r=r[t]()),r.length&&this.S("img",r).trigger("click",[n,r]).trigger("click.fndtn.clearing",[n,r]).trigger("change.fndtn.clearing")},shift:function(e,t,n){var r=t.parent(),i=this.settings.prev_index||t.index(),s=this.direction(r,e,t),o=this.rtl?"right":"left",u=parseInt(r.css("left"),10),a=t.outerWidth(),f,l={};t.index()!==i&&!/skip/.test(s)?/left/.test(s)?(this.lock(),l[o]=u+a,r.animate(l,300,this.unlock())):/right/.test(s)&&(this.lock(),l[o]=u-a,r.animate(l,300,this.unlock())):/skip/.test(s)&&(f=t.index()-this.settings.up_count,this.lock(),f>0?(l[o]=-(f*a),r.animate(l,300,this.unlock())):(l[o]=0,r.animate(l,300,this.unlock()))),n()},direction:function(e,t,n){var r=this.S("li",e),i=r.outerWidth()+r.outerWidth()/4,s=Math.floor(this.S(".clearing-container").outerWidth()/i)-1,o=r.index(n),u;return this.settings.up_count=s,this.adjacent(this.settings.prev_index,o)?o>s&&o>this.settings.prev_index?u="right":o>s-1&&o<=this.settings.prev_index?u="left":u=!1:u="skip",this.settings.prev_index=o,u},adjacent:function(e,t){for(var n=t+1;n>=t-1;n--)if(n===e)return!0;return!1},lock:function(){this.settings.locked=!0},unlock:function(){this.settings.locked=!1},locked:function(){return this.settings.locked},off:function(){this.S(this.scope).off(".fndtn.clearing"),this.S(t).off(".fndtn.clearing")},reflow:function(){this.init()}}}(jQuery,window,window.document),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function t(e){return u.raw?e:encodeURIComponent(e)}function n(e){return u.raw?e:decodeURIComponent(e)}function r(e){return t(u.json?JSON.stringify(e):String(e))}function i(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(o," ")),u.json?JSON.parse(e):e}catch(t){}}function s(t,n){var r=u.raw?t:i(t);return e.isFunction(n)?n(r):r}var o=/\+/g,u=e.cookie=function(i,o,l){if(void 0!==o&&!e.isFunction(o)){if(l=e.extend({},u.defaults,l),"number"==typeof l.expires){var p=l.expires,v=l.expires=new Date;v.setTime(+v+864e5*p)}return document.cookie=[t(i),"=",r(o),l.expires?"; expires="+l.expires.toUTCString():"",l.path?"; path="+l.path:"",l.domain?"; domain="+l.domain:"",l.secure?"; secure":""].join("")}for(var m=i?void 0:{},g=document.cookie?document.cookie.split("; "):[],y=0,w=g.length;w>y;y++){var E=g[y].split("="),S=n(E.shift()),x=E.join("=");if(i&&i===S){m=s(x,o);break}i||void 0===(x=s(x))||(m[S]=x)}return m};u.defaults={},e.removeCookie=function(t,n){return void 0===e.cookie(t)?!1:(e.cookie(t,"",e.extend({},n,{expires:-1})),!e.cookie(t))}}),function(e,t,n,r){"use strict";var i=i||!1;Foundation.libs.joyride={name:"joyride",version:"5.3.3",defaults:{expose:!1,modal:!0,keyboard:!0,tip_location:"bottom",nub_position:"auto",scroll_speed:1500,scroll_animation:"linear",timer:0,start_timer_on_click:!0,start_offset:0,next_button:!0,prev_button:!0,tip_animation:"fade",pause_after:[],exposed:[],tip_animation_fade_speed:300,cookie_monster:!1,cookie_name:"joyride",cookie_domain:!1,cookie_expires:365,tip_container:"body",abort_on_close:!0,tip_location_patterns:{top:["bottom"],bottom:[],left:["right","top","bottom"],right:["left","top","bottom"]},post_ride_callback:function(){},post_step_callback:function(){},pre_step_callback:function(){},pre_ride_callback:function(){},post_expose_callback:function(){},template:{link:'×',timer:'
',tip:'
',wrapper:'
',button:'',prev_button:'',modal:'
',expose:'
',expose_cover:'
'},expose_add_class:""},init:function(t,n,r){Foundation.inherit(this,"throttle random_str"),this.settings=this.settings||e.extend({},this.defaults,r||n),this.bindings(n,r)},go_next:function(){this.settings.$li.next().length<1?this.end():this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(),this.startTimer()):(this.hide(),this.show())},go_prev:function(){this.settings.$li.prev().length<1||(this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(null,!0),this.startTimer()):(this.hide(),this.show(null,!0)))},events:function(){var n=this;e(this.scope).off(".joyride").on("click.fndtn.joyride",".joyride-next-tip, .joyride-modal-bg",function(e){e.preventDefault(),this.go_next()}.bind(this)).on("click.fndtn.joyride",".joyride-prev-tip",function(e){e.preventDefault(),this.go_prev()}.bind(this)).on("click.fndtn.joyride",".joyride-close-tip",function(e){e.preventDefault(),this.end(this.settings.abort_on_close)}.bind(this)).on("keyup.joyride",function(e){if(!this.settings.keyboard)return;switch(e.which){case 39:e.preventDefault(),this.go_next();break;case 37:e.preventDefault(),this.go_prev();break;case 27:e.preventDefault(),this.end(this.settings.abort_on_close)}}.bind(this)),e(t).off(".joyride").on("resize.fndtn.joyride",n.throttle(function(){if(e("["+n.attr_name()+"]").length>0&&n.settings.$next_tip&&n.settings.riding){if(n.settings.exposed.length>0){var t=e(n.settings.exposed);t.each(function(){var t=e(this);n.un_expose(t),n.expose(t)})}n.is_phone()?n.pos_phone():n.pos_default(!1)}},100))},start:function(){var t=this,n=e("["+this.attr_name()+"]",this.scope),r=["timer","scrollSpeed","startOffset","tipAnimationFadeSpeed","cookieExpires"],i=r.length;if(!n.length>0)return;this.settings.init||this.events(),this.settings=n.data(this.attr_name(!0)+"-init"),this.settings.$content_el=n,this.settings.$body=e(this.settings.tip_container),this.settings.body_offset=e(this.settings.tip_container).position(),this.settings.$tip_content=this.settings.$content_el.find("> li"),this.settings.paused=!1,this.settings.attempts=0,this.settings.riding=!0,typeof e.cookie!="function"&&(this.settings.cookie_monster=!1);if(!this.settings.cookie_monster||this.settings.cookie_monster&&!e.cookie(this.settings.cookie_name))this.settings.$tip_content.each(function(n){var s=e(this);this.settings=e.extend({},t.defaults,t.data_options(s));var o=i;while(o--)t.settings[r[o]]=parseInt(t.settings[r[o]],10);t.create({$li:s,index:n})}),!this.settings.start_timer_on_click&&this.settings.timer>0?(this.show("init"),this.startTimer()):this.show("init")},resume:function(){this.set_li(),this.show()},tip_template:function(t){var n,r;return t.tip_class=t.tip_class||"",n=e(this.settings.template.tip).addClass(t.tip_class),r=e.trim(e(t.li).html())+this.prev_button_text(t.prev_button_text,t.index)+this.button_text(t.button_text)+this.settings.template.link+this.timer_instance(t.index),n.append(e(this.settings.template.wrapper)),n.first().attr(this.add_namespace("data-index"),t.index),e(".joyride-content-wrapper",n).append(r),n[0]},timer_instance:function(t){var n;return t===0&&this.settings.start_timer_on_click&&this.settings.timer>0||this.settings.timer===0?n="":n=e(this.settings.template.timer)[0].outerHTML,n},button_text:function(t){return this.settings.tip_settings.next_button?(t=e.trim(t)||"Next",t=e(this.settings.template.button).append(t)[0].outerHTML):t="",t},prev_button_text:function(t,n){return this.settings.tip_settings.prev_button?(t=e.trim(t)||"Previous",n==0?t=e(this.settings.template.prev_button).append(t).addClass("disabled")[0].outerHTML:t=e(this.settings.template.prev_button).append(t)[0].outerHTML):t="",t},create:function(t){this.settings.tip_settings=e.extend({},this.settings,this.data_options(t.$li));var n=t.$li.attr(this.add_namespace("data-button"))||t.$li.attr(this.add_namespace("data-text")),r=t.$li.attr(this.add_namespace("data-button-prev"))||t.$li.attr(this.add_namespace("data-prev-text")),i=t.$li.attr("class"),s=e(this.tip_template({tip_class:i,index:t.index,button_text:n,prev_button_text:r,li:t.$li}));e(this.settings.tip_container).append(s)},show:function(t,n){var i=null;this.settings.$li===r||e.inArray(this.settings.$li.index(),this.settings.pause_after)===-1?(this.settings.paused?this.settings.paused=!1:this.set_li(t,n),this.settings.attempts=0,this.settings.$li.length&&this.settings.$target.length>0?(t&&(this.settings.pre_ride_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.show_modal()),this.settings.pre_step_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.settings.expose&&this.expose(),this.settings.tip_settings=e.extend({},this.settings,this.data_options(this.settings.$li)),this.settings.timer=parseInt(this.settings.timer,10),this.settings.tip_settings.tip_location_pattern=this.settings.tip_location_patterns[this.settings.tip_settings.tip_location],/body/i.test(this.settings.$target.selector)||this.scroll_to(),this.is_phone()?this.pos_phone(!0):this.pos_default(!0),i=this.settings.$next_tip.find(".joyride-timer-indicator"),/pop/i.test(this.settings.tip_animation)?(i.width(0),this.settings.timer>0?(this.settings.$next_tip.show(),setTimeout(function(){i.animate({width:i.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fade_speed)):this.settings.$next_tip.show()):/fade/i.test(this.settings.tip_animation)&&(i.width(0),this.settings.timer>0?(this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed).show(),setTimeout(function(){i.animate({width:i.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fade_speed)):this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed)),this.settings.$current_tip=this.settings.$next_tip):this.settings.$li&&this.settings.$target.length<1?this.show():this.end()):this.settings.paused=!0},is_phone:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},hide:function(){this.settings.modal&&this.settings.expose&&this.un_expose(),this.settings.modal||e(".joyride-modal-bg").hide(),this.settings.$current_tip.css("visibility","hidden"),setTimeout(e.proxy(function(){this.hide(),this.css("visibility","visible")},this.settings.$current_tip),0),this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip)},set_li:function(e,t){e?(this.settings.$li=this.settings.$tip_content.eq(this.settings.start_offset),this.set_next_tip(),this.settings.$current_tip=this.settings.$next_tip):(t?this.settings.$li=this.settings.$li.prev():this.settings.$li=this.settings.$li.next(),this.set_next_tip()),this.set_target()},set_next_tip:function(){this.settings.$next_tip=e(".joyride-tip-guide").eq(this.settings.$li.index()),this.settings.$next_tip.data("closed","")},set_target:function(){var t=this.settings.$li.attr(this.add_namespace("data-class")),r=this.settings.$li.attr(this.add_namespace("data-id")),i=function(){return r?e(n.getElementById(r)):t?e("."+t).first():e("body")};this.settings.$target=i()},scroll_to:function(){var n,r;n=e(t).height()/2,r=Math.ceil(this.settings.$target.offset().top-n+this.settings.$next_tip.outerHeight()),r!=0&&e("html, body").stop().animate({scrollTop:r},this.settings.scroll_speed,"swing")},paused:function(){return e.inArray(this.settings.$li.index()+1,this.settings.pause_after)===-1},restart:function(){this.hide(),this.settings.$li=r,this.show("init")},pos_default:function(e){var t=this.settings.$next_tip.find(".joyride-nub"),n=Math.ceil(t.outerWidth()/2),r=Math.ceil(t.outerHeight()/2),i=e||!1;i&&(this.settings.$next_tip.css("visibility","hidden"),this.settings.$next_tip.show());if(!/body/i.test(this.settings.$target.selector)){var s=this.settings.tip_settings.tipAdjustmentY?parseInt(this.settings.tip_settings.tipAdjustmentY):0,o=this.settings.tip_settings.tipAdjustmentX?parseInt(this.settings.tip_settings.tipAdjustmentX):0;this.bottom()?(this.rtl?this.settings.$next_tip.css({top:this.settings.$target.offset().top+r+this.settings.$target.outerHeight()+s,left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()+o}):this.settings.$next_tip.css({top:this.settings.$target.offset().top+r+this.settings.$target.outerHeight()+s,left:this.settings.$target.offset().left+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"top")):this.top()?(this.rtl?this.settings.$next_tip.css({top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-r+s,left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()}):this.settings.$next_tip.css({top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-r+s,left:this.settings.$target.offset().left+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"bottom")):this.right()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top+s,left:this.settings.$target.outerWidth()+this.settings.$target.offset().left+n+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"left")):this.left()&&(this.settings.$next_tip.css({top:this.settings.$target.offset().top+s,left:this.settings.$target.offset().left-this.settings.$next_tip.outerWidth()-n+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"right")),!this.visible(this.corners(this.settings.$next_tip))&&this.settings.attempts0&&arguments[0]instanceof e)i=arguments[0];else{if(!this.settings.$target||!!/body/i.test(this.settings.$target.selector))return!1;i=this.settings.$target}if(i.length<1)return t.console&&console.error("element not valid",i),!1;n=e(this.settings.template.expose),this.settings.$body.append(n),n.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),r=e(this.settings.template.expose_cover),s={zIndex:i.css("z-index"),position:i.css("position")},o=i.attr("class")==null?"":i.attr("class"),i.css("z-index",parseInt(n.css("z-index"))+1),s.position=="static"&&i.css("position","relative"),i.data("expose-css",s),i.data("orig-class",o),i.attr("class",o+" "+this.settings.expose_add_class),r.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),this.settings.modal&&this.show_modal(),this.settings.$body.append(r),n.addClass(u),r.addClass(u),i.data("expose",u),this.settings.post_expose_callback(this.settings.$li.index(),this.settings.$next_tip,i),this.add_exposed(i)},un_expose:function(){var n,r,i,s,o,u=!1;if(arguments.length>0&&arguments[0]instanceof e)r=arguments[0];else{if(!this.settings.$target||!!/body/i.test(this.settings.$target.selector))return!1;r=this.settings.$target}if(r.length<1)return t.console&&console.error("element not valid",r),!1;n=r.data("expose"),i=e("."+n),arguments.length>1&&(u=arguments[1]),u===!0?e(".joyride-expose-wrapper,.joyride-expose-cover").remove():i.remove(),s=r.data("expose-css"),s.zIndex=="auto"?r.css("z-index",""):r.css("z-index",s.zIndex),s.position!=r.css("position")&&(s.position=="static"?r.css("position",""):r.css("position",s.position)),o=r.data("orig-class"),r.attr("class",o),r.removeData("orig-classes"),r.removeData("expose"),r.removeData("expose-z-index"),this.remove_exposed(r)},add_exposed:function(t){this.settings.exposed=this.settings.exposed||[],t instanceof e||typeof t=="object"?this.settings.exposed.push(t[0]):typeof t=="string"&&this.settings.exposed.push(t)},remove_exposed:function(t){var n,r;t instanceof e?n=t[0]:typeof t=="string"&&(n=t),this.settings.exposed=this.settings.exposed||[],r=this.settings.exposed.length;while(r--)if(this.settings.exposed[r]==n){this.settings.exposed.splice(r,1);return}},center:function(){var n=e(t);return this.settings.$next_tip.css({top:(n.height()-this.settings.$next_tip.outerHeight())/2+n.scrollTop(),left:(n.width()-this.settings.$next_tip.outerWidth())/2+n.scrollLeft()}),!0},bottom:function(){return/bottom/i.test(this.settings.tip_settings.tip_location)},top:function(){return/top/i.test(this.settings.tip_settings.tip_location)},right:function(){return/right/i.test(this.settings.tip_settings.tip_location)},left:function(){return/left/i.test(this.settings.tip_settings.tip_location)},corners:function(n){var r=e(t),i=r.height()/2,s=Math.ceil(this.settings.$target.offset().top-i+this.settings.$next_tip.outerHeight()),o=r.width()+r.scrollLeft(),u=r.height()+s,a=r.height()+r.scrollTop(),f=r.scrollTop();return sa&&(a=u),[n.offset().topn.offset().left]},visible:function(e){var t=e.length;while(t--)if(e[t])return!1;return!0},nub_position:function(e,t,n){t==="auto"?e.addClass(n):e.addClass(t)},startTimer:function(){this.settings.$li.length?this.settings.automate=setTimeout(function(){this.hide(),this.show(),this.startTimer()}.bind(this),this.settings.timer):clearTimeout(this.settings.automate)},end:function(t){this.settings.cookie_monster&&e.cookie(this.settings.cookie_name,"ridden",{expires:this.settings.cookie_expires,domain:this.settings.cookie_domain}),this.settings.timer>0&&clearTimeout(this.settings.automate),this.settings.modal&&this.settings.expose&&this.un_expose(),e(this.scope).off("keyup.joyride"),this.settings.$next_tip.data("closed",!0),this.settings.riding=!1,e(".joyride-modal-bg").hide(),this.settings.$current_tip.hide();if(typeof t=="undefined"||t===!1)this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip),this.settings.post_ride_callback(this.settings.$li.index(),this.settings.$current_tip);e(".joyride-tip-guide").remove()},off:function(){e(this.scope).off(".joyride"),e(t).off(".joyride"),e(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"),e(".joyride-tip-guide, .joyride-modal-bg").remove(),clearTimeout(this.settings.automate),this.settings={}},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs["magellan-expedition"]={name:"magellan-expedition",version:"5.3.3",settings:{active_class:"active",threshold:0,destination_threshold:20,throttle_delay:30,fixed_top:0},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n)},events:function(){var n=this,r=n.S,i=n.settings;n.set_expedition_position(),r(n.scope).off(".magellan").on("click.fndtn.magellan","["+n.add_namespace("data-magellan-arrival")+'] a[href^="#"]',function(t){t.preventDefault();var r=e(this).closest("["+n.attr_name()+"]"),i=r.data("magellan-expedition-init"),s=this.hash.split("#").join(""),o=e("a[name='"+s+"']");o.length===0&&(o=e("#"+s));var u=o.offset().top-i.destination_threshold+1;u-=r.outerHeight(),e("html, body").stop().animate({scrollTop:u},700,"swing",function(){history.pushState?history.pushState(null,null,"#"+s):location.hash="#"+s})}).on("scroll.fndtn.magellan",n.throttle(this.check_for_arrivals.bind(this),i.throttle_delay)),e(t).on("resize.fndtn.magellan",n.throttle(this.set_expedition_position.bind(this),i.throttle_delay))},check_for_arrivals:function(){var e=this;e.update_arrivals(),e.update_expedition_positions()},set_expedition_position:function(){var t=this;e("["+this.attr_name()+"=fixed]",t.scope).each(function(n,r){var i=e(this),s=i.data("magellan-expedition-init"),o=i.attr("styles"),u,a;i.attr("style",""),u=i.offset().top+s.threshold,a=parseInt(i.data("magellan-fixed-top")),isNaN(a)||(t.settings.fixed_top=a),i.data(t.data_attr("magellan-top-offset"),u),i.attr("style",o)})},update_expedition_positions:function(){var n=this,r=e(t).scrollTop();e("["+this.attr_name()+"=fixed]",n.scope).each(function(){var t=e(this),i=t.data("magellan-expedition-init"),s=t.attr("style"),o=t.data("magellan-top-offset");if(r+n.settings.fixed_top>=o){var u=t.prev("["+n.add_namespace("data-magellan-expedition-clone")+"]");u.length===0&&(u=t.clone(),u.removeAttr(n.attr_name()),u.attr(n.add_namespace("data-magellan-expedition-clone"),""),t.before(u)),t.css({position:"fixed",top:i.fixed_top}).addClass("fixed")}else t.prev("["+n.add_namespace("data-magellan-expedition-clone")+"]").remove(),t.attr("style",s).css("position","").css("top","").removeClass("fixed")})},update_arrivals:function(){var n=this,r=e(t).scrollTop();e("["+this.attr_name()+"]",n.scope).each(function(){var t=e(this),i=t.data(n.attr_name(!0)+"-init"),s=n.offsets(t,r),o=t.find("["+n.add_namespace("data-magellan-arrival")+"]"),u=!1;s.each(function(e,r){if(r.viewport_offset>=r.top_offset){var s=t.find("["+n.add_namespace("data-magellan-arrival")+"]");return s.not(r.arrival).removeClass(i.active_class),r.arrival.addClass(i.active_class),u=!0,!0}}),u||o.removeClass(i.active_class)})},offsets:function(t,n){var r=this,i=t.data(r.attr_name(!0)+"-init"),s=n;return t.find("["+r.add_namespace("data-magellan-arrival")+"]").map(function(n,o){var u=e(this).data(r.data_attr("magellan-arrival")),a=e("["+r.add_namespace("data-magellan-destination")+"="+u+"]");if(a.length>0){var f=Math.floor(a.offset().top-i.destination_threshold-t.outerHeight());return{destination:a,arrival:e(this),top_offset:f,viewport_offset:s}}}).sort(function(e,t){return e.top_offsett.top_offset?1:0})},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},off:function(){this.S(this.scope).off(".magellan"),this.S(t).off(".magellan")},reflow:function(){var t=this;e("["+t.add_namespace("data-magellan-expedition-clone")+"]",t.scope).remove()}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.offcanvas={name:"offcanvas",version:"5.3.3",settings:{open_method:"move",close_on_click:!1},init:function(e,t,n){this.bindings(t,n)},events:function(){var e=this,t=e.S,n="",r="",i="";this.settings.open_method==="move"?(n="move-",r="right",i="left"):this.settings.open_method==="overlap_single"?(n="offcanvas-overlap-",r="right",i="left"):this.settings.open_method==="overlap"&&(n="offcanvas-overlap"),t(this.scope).off(".offcanvas").on("click.fndtn.offcanvas",".left-off-canvas-toggle",function(i){e.click_toggle_class(i,n+r),e.settings.open_method!=="overlap"&&t(".left-submenu").removeClass(n+r)}).on("click.fndtn.offcanvas",".left-off-canvas-menu a",function(i){var s=e.get_settings(i),o=t(this).parent();s.close_on_click&&!o.hasClass("has-submenu")&&!o.hasClass("back")?(e.hide.call(e,n+r,e.get_wrapper(i)),o.parent().removeClass(n+r)):t(this).parent().hasClass("has-submenu")?(i.preventDefault(),t(this).siblings(".left-submenu").toggleClass(n+r)):o.hasClass("back")&&(i.preventDefault(),o.parent().removeClass(n+r))}).on("click.fndtn.offcanvas",".right-off-canvas-toggle",function(r){e.click_toggle_class(r,n+i),e.settings.open_method!=="overlap"&&t(".right-submenu").removeClass(n+i)}).on("click.fndtn.offcanvas",".right-off-canvas-menu a",function(r){var s=e.get_settings(r),o=t(this).parent();s.close_on_click&&!o.hasClass("has-submenu")&&!o.hasClass("back")?(e.hide.call(e,n+i,e.get_wrapper(r)),o.parent().removeClass(n+i)):t(this).parent().hasClass("has-submenu")?(r.preventDefault(),t(this).siblings(".right-submenu").toggleClass(n+i)):o.hasClass("back")&&(r.preventDefault(),o.parent().removeClass(n+i))}).on("click.fndtn.offcanvas",".exit-off-canvas",function(s){e.click_remove_class(s,n+i),t(".right-submenu").removeClass(n+i),r&&(e.click_remove_class(s,n+r),t(".left-submenu").removeClass(n+i))})},toggle:function(e,t){t=t||this.get_wrapper(),t.is("."+e)?this.hide(e,t):this.show(e,t)},show:function(e,t){t=t||this.get_wrapper(),t.trigger("open").trigger("open.fndtn.offcanvas"),t.addClass(e)},hide:function(e,t){t=t||this.get_wrapper(),t.trigger("close").trigger("close.fndtn.offcanvas"),t.removeClass(e)},click_toggle_class:function(e,t){e.preventDefault();var n=this.get_wrapper(e);this.toggle(t,n)},click_remove_class:function(e,t){e.preventDefault();var n=this.get_wrapper(e);this.hide(t,n)},get_settings:function(e){var t=this.S(e.target).closest("["+this.attr_name()+"]");return t.data(this.attr_name(!0)+"-init")||this.settings},get_wrapper:function(e){var t=this.S(e?e.target:this.scope).closest(".off-canvas-wrap");return t.length===0&&(t=this.S(".off-canvas-wrap")),t},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";function i(e){var t=/fade/i.test(e),n=/pop/i.test(e);return{animate:t||n,pop:n,fade:t}}Foundation.libs.reveal={name:"reveal",version:"5.3.3",locked:!1,settings:{animation:"fadeAndPop",animation_speed:250,close_on_background_click:!0,close_on_esc:!0,dismiss_modal_class:"close-reveal-modal",bg_class:"reveal-modal-bg",root_element:"body",open:function(){},opened:function(){},close:function(){},closed:function(){},bg:e(".reveal-modal-bg"),css:{open:{opacity:0,visibility:"visible",display:"block"},close:{opacity:1,visibility:"hidden",display:"none"}}},init:function(t,n,r){e.extend(!0,this.settings,n,r),this.bindings(n,r)},events:function(e){var t=this,r=t.S;return r(this.scope).off(".reveal").on("click.fndtn.reveal","["+this.add_namespace("data-reveal-id")+"]:not([disabled])",function(e){e.preventDefault();if(!t.locked){var n=r(this),i=n.data(t.data_attr("reveal-ajax"));t.locked=!0;if(typeof i=="undefined")t.open.call(t,n);else{var s=i===!0?n.attr("href"):i;t.open.call(t,n,{url:s})}}}),r(n).on("click.fndtn.reveal",this.close_targets(),function(e){e.preventDefault();if(!t.locked){var n=r("["+t.attr_name()+"].open").data(t.attr_name(!0)+"-init"),i=r(e.target)[0]===r("."+n.bg_class)[0];if(i){if(!n.close_on_background_click)return;e.stopPropagation()}t.locked=!0,t.close.call(t,i?r("["+t.attr_name()+"].open"):r(this).closest("["+t.attr_name()+"]"))}}),r("["+t.attr_name()+"]",this.scope).length>0?r(this.scope).on("open.fndtn.reveal",this.settings.open).on("opened.fndtn.reveal",this.settings.opened).on("opened.fndtn.reveal",this.open_video).on("close.fndtn.reveal",this.settings.close).on("closed.fndtn.reveal",this.settings.closed).on("closed.fndtn.reveal",this.close_video):r(this.scope).on("open.fndtn.reveal","["+t.attr_name()+"]",this.settings.open).on("opened.fndtn.reveal","["+t.attr_name()+"]",this.settings.opened).on("opened.fndtn.reveal","["+t.attr_name()+"]",this.open_video).on("close.fndtn.reveal","["+t.attr_name()+"]",this.settings.close).on("closed.fndtn.reveal","["+t.attr_name()+"]",this.settings.closed).on("closed.fndtn.reveal","["+t.attr_name()+"]",this.close_video),!0},key_up_on:function(e){var t=this;return t.S("body").off("keyup.fndtn.reveal").on("keyup.fndtn.reveal",function(e){var n=t.S("["+t.attr_name()+"].open"),r=n.data(t.attr_name(!0)+"-init")||t.settings;r&&e.which===27&&r.close_on_esc&&!t.locked&&t.close.call(t,n)}),!0},key_up_off:function(e){return this.S("body").off("keyup.fndtn.reveal"),!0},open:function(t,n){var r=this,i;t?typeof t.selector!="undefined"?i=r.S("#"+t.data(r.data_attr("reveal-id"))).first():(i=r.S(this.scope),n=t):i=r.S(this.scope);var s=i.data(r.attr_name(!0)+"-init");s=s||this.settings;if(i.hasClass("open")&&t.attr("data-reveal-id")==i.attr("id"))return r.close(i);if(!i.hasClass("open")){var o=r.S("["+r.attr_name()+"].open");typeof i.data("css-top")=="undefined"&&i.data("css-top",parseInt(i.css("top"),10)).data("offset",this.cache_offset(i)),this.key_up_on(i),i.trigger("open").trigger("open.fndtn.reveal"),o.length<1&&this.toggle_bg(i,!0),typeof n=="string"&&(n={url:n});if(typeof n=="undefined"||!n.url)o.length>0&&this.hide(o,s.css.close),this.show(i,s.css.open);else{var u=typeof n.success!="undefined"?n.success:null;e.extend(n,{success:function(t,n,a){e.isFunction(u)&&u(t,n,a),i.html(t),r.S(i).foundation("section","reflow"),r.S(i).children().foundation(),o.length>0&&r.hide(o,s.css.close),r.show(i,s.css.open)}}),e.ajax(n)}}},close:function(e){var e=e&&e.length?e:this.S(this.scope),t=this.S("["+this.attr_name()+"].open"),n=e.data(this.attr_name(!0)+"-init")||this.settings;t.length>0&&(this.locked=!0,this.key_up_off(e),e.trigger("close").trigger("close.fndtn.reveal"),this.toggle_bg(e,!1),this.hide(t,n.css.close,n))},close_targets:function(){var e="."+this.settings.dismiss_modal_class;return this.settings.close_on_background_click?e+", ."+this.settings.bg_class:e},toggle_bg:function(t,n){this.S("."+this.settings.bg_class).length===0&&(this.settings.bg=e("
",{"class":this.settings.bg_class}).appendTo("body").hide());var i=this.settings.bg.filter(":visible").length>0;n!=i&&((n==r?i:!n)?this.hide(this.settings.bg):this.show(this.settings.bg))},show:function(n,r){if(r){var s=n.data(this.attr_name(!0)+"-init")||this.settings,o=s.root_element;if(n.parent(o).length===0){var u=n.wrap('
').parent();n.on("closed.fndtn.reveal.wrapped",function(){n.detach().appendTo(u),n.unwrap().unbind("closed.fndtn.reveal.wrapped")}),n.detach().appendTo(o)}var a=i(s.animation);a.animate||(this.locked=!1);if(a.pop){r.top=e(t).scrollTop()-n.data("offset")+"px";var f={top:e(t).scrollTop()+n.data("css-top")+"px",opacity:1};return setTimeout(function(){return n.css(r).animate(f,s.animation_speed,"linear",function(){this.locked=!1,n.trigger("opened").trigger("opened.fndtn.reveal")}.bind(this)).addClass("open")}.bind(this),s.animation_speed/2)}if(a.fade){r.top=e(t).scrollTop()+n.data("css-top")+"px";var f={opacity:1};return setTimeout(function(){return n.css(r).animate(f,s.animation_speed,"linear",function(){this.locked=!1,n.trigger("opened").trigger("opened.fndtn.reveal")}.bind(this)).addClass("open")}.bind(this),s.animation_speed/2)}return n.css(r).show().css({opacity:1}).addClass("open").trigger("opened").trigger("opened.fndtn.reveal")}var s=this.settings;return i(s.animation).fade?n.fadeIn(s.animation_speed/2):(this.locked=!1,n.show())},hide:function(n,r){if(r){var s=n.data(this.attr_name(!0)+"-init");s=s||this.settings;var o=i(s.animation);o.animate||(this.locked=!1);if(o.pop){var u={top +:-e(t).scrollTop()-n.data("offset")+"px",opacity:0};return setTimeout(function(){return n.animate(u,s.animation_speed,"linear",function(){this.locked=!1,n.css(r).trigger("closed").trigger("closed.fndtn.reveal")}.bind(this)).removeClass("open")}.bind(this),s.animation_speed/2)}if(o.fade){var u={opacity:0};return setTimeout(function(){return n.animate(u,s.animation_speed,"linear",function(){this.locked=!1,n.css(r).trigger("closed").trigger("closed.fndtn.reveal")}.bind(this)).removeClass("open")}.bind(this),s.animation_speed/2)}return n.hide().css(r).removeClass("open").trigger("closed").trigger("closed.fndtn.reveal")}var s=this.settings;return i(s.animation).fade?n.fadeOut(s.animation_speed/2):n.hide()},close_video:function(t){var n=e(".flex-video",t.target),r=e("iframe",n);r.length>0&&(r.attr("data-src",r[0].src),r.attr("src",r.attr("src")),n.hide())},open_video:function(t){var n=e(".flex-video",t.target),i=n.find("iframe");if(i.length>0){var s=i.attr("data-src");if(typeof s=="string")i[0].src=i.attr("data-src");else{var o=i[0].src;i[0].src=r,i[0].src=o}n.show()}},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},cache_offset:function(e){var t=e.show().height()+parseInt(e.css("top"),10);return e.hide(),t},off:function(){e(this.scope).off(".fndtn.reveal")},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.slider={name:"slider",version:"5.3.3",settings:{start:0,end:100,step:1,initial:null,display_selector:"",vertical:!1,on_change:function(){}},cache:{},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n),this.reflow()},events:function(){var n=this;e(this.scope).off(".slider").on("mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider","["+n.attr_name()+"]:not(.disabled, [disabled]) .range-slider-handle",function(t){n.cache.active||(t.preventDefault(),n.set_active_slider(e(t.target)))}).on("mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider",function(r){if(!!n.cache.active){r.preventDefault();if(e.data(n.cache.active[0],"settings").vertical){var i=0;r.pageY||(i=t.scrollY),n.calculate_position(n.cache.active,(r.pageY||r.originalEvent.clientY||r.originalEvent.touches[0].clientY||r.currentPoint.y)+i)}else n.calculate_position(n.cache.active,r.pageX||r.originalEvent.clientX||r.originalEvent.touches[0].clientX||r.currentPoint.x)}}).on("mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider",function(e){n.remove_active_slider()}).on("change.fndtn.slider",function(e){n.settings.on_change()}),n.S(t).on("resize.fndtn.slider",n.throttle(function(e){n.reflow()},300))},set_active_slider:function(e){this.cache.active=e},remove_active_slider:function(){this.cache.active=null},calculate_position:function(t,n){var r=this,i=e.data(t[0],"settings"),s=e.data(t[0],"handle_l"),o=e.data(t[0],"handle_o"),u=e.data(t[0],"bar_l"),a=e.data(t[0],"bar_o");requestAnimationFrame(function(){var e;Foundation.rtl&&!i.vertical?e=r.limit_to((a+u-n)/u,0,1):e=r.limit_to((n-a)/u,0,1),e=i.vertical?1-e:e;var s=r.normalized_value(e,i.start,i.end,i.step);r.set_ui(t,s)})},set_ui:function(t,n){var r=e.data(t[0],"settings"),i=e.data(t[0],"handle_l"),s=e.data(t[0],"bar_l"),o=this.normalized_percentage(n,r.start,r.end),u=o*(s-i)-1,a=o*100;Foundation.rtl&&!r.vertical&&(u=-u),u=r.vertical?-u+s-i+1:u,this.set_translate(t,u,r.vertical),r.vertical?t.siblings(".range-slider-active-segment").css("height",a+"%"):t.siblings(".range-slider-active-segment").css("width",a+"%"),t.parent().attr(this.attr_name(),n).trigger("change").trigger("change.fndtn.slider"),t.parent().children("input[type=hidden]").val(n),r.input_id!=""&&e(r.display_selector).each(function(){this.hasOwnProperty("value")?e(this).val(n):e(this).text(n)})},normalized_percentage:function(e,t,n){return Math.min(1,(e-t)/(n-t))},normalized_value:function(e,t,n,r){var i=n-t,s=e*i,o=(s-s%r)/r,u=s%r,a=u>=r*.5?r:0;return o*r+a+t},set_translate:function(t,n,r){r?e(t).css("-webkit-transform","translateY("+n+"px)").css("-moz-transform","translateY("+n+"px)").css("-ms-transform","translateY("+n+"px)").css("-o-transform","translateY("+n+"px)").css("transform","translateY("+n+"px)"):e(t).css("-webkit-transform","translateX("+n+"px)").css("-moz-transform","translateX("+n+"px)").css("-ms-transform","translateX("+n+"px)").css("-o-transform","translateX("+n+"px)").css("transform","translateX("+n+"px)")},limit_to:function(e,t,n){return Math.min(Math.max(e,t),n)},initialize_settings:function(t){var n=e.extend({},this.settings,this.data_options(e(t).parent()));n.vertical?(e.data(t,"bar_o",e(t).parent().offset().top),e.data(t,"bar_l",e(t).parent().outerHeight()),e.data(t,"handle_o",e(t).offset().top),e.data(t,"handle_l",e(t).outerHeight())):(e.data(t,"bar_o",e(t).parent().offset().left),e.data(t,"bar_l",e(t).parent().outerWidth()),e.data(t,"handle_o",e(t).offset().left),e.data(t,"handle_l",e(t).outerWidth())),e.data(t,"bar",e(t).parent()),e.data(t,"settings",n)},set_initial_position:function(t){var n=e.data(t.children(".range-slider-handle")[0],"settings"),r=n.initial?n.initial:Math.floor((n.end-n.start)*.5/n.step)*n.step+n.start,i=t.children(".range-slider-handle");this.set_ui(i,r)},set_value:function(t){var n=this;e("["+n.attr_name()+"]",this.scope).each(function(){e(this).attr(n.attr_name(),t)}),!e(this.scope).attr(n.attr_name())||e(this.scope).attr(n.attr_name(),t),n.reflow()},reflow:function(){var t=this;t.S("["+this.attr_name()+"]").each(function(){var n=e(this).children(".range-slider-handle")[0],r=e(this).attr(t.attr_name());t.initialize_settings(n),r?t.set_ui(e(n),parseFloat(r)):t.set_initial_position(e(this))})}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.tab={name:"tab",version:"5.3.3",settings:{active_class:"active",callback:function(){},deep_linking:!1,scroll_to_content:!0,is_hover:!1},default_tab_hashes:[],init:function(e,t,n){var r=this,i=this.S;this.bindings(t,n),this.handle_location_hash_change(),i("["+this.attr_name()+"] > .active > a",this.scope).each(function(){r.default_tab_hashes.push(this.hash)})},events:function(){var e=this,n=this.S;n(this.scope).off(".tab").on("click.fndtn.tab","["+this.attr_name()+"] > * > a",function(t){var r=n(this).closest("["+e.attr_name()+"]").data(e.attr_name(!0)+"-init");if(!r.is_hover||Modernizr.touch)t.preventDefault(),t.stopPropagation(),e.toggle_active_tab(n(this).parent())}).on("mouseenter.fndtn.tab","["+this.attr_name()+"] > * > a",function(t){var r=n(this).closest("["+e.attr_name()+"]").data(e.attr_name(!0)+"-init");r.is_hover&&e.toggle_active_tab(n(this).parent())}),n(t).on("hashchange.fndtn.tab",function(t){t.preventDefault(),e.handle_location_hash_change()})},handle_location_hash_change:function(){var t=this,n=this.S;n("["+this.attr_name()+"]",this.scope).each(function(){var i=n(this).data(t.attr_name(!0)+"-init");if(i.deep_linking){var s=t.scope.location.hash;if(s!=""){var o=n(s);if(o.hasClass("content")&&o.parent().hasClass("tab-content"))t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href="+s+"]").parent());else{var u=o.closest(".content").attr("id");u!=r&&t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href=#"+u+"]").parent(),s)}}else for(var a in t.default_tab_hashes)t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href="+t.default_tab_hashes[a]+"]").parent())}})},toggle_active_tab:function(n,i){var s=this.S,o=n.closest("["+this.attr_name()+"]"),u=n.children("a").first(),a="#"+u.attr("href").split("#")[1],f=s(a),l=n.siblings(),c=o.data(this.attr_name(!0)+"-init");s(this).data(this.data_attr("tab-content"))&&(a="#"+s(this).data(this.data_attr("tab-content")).split("#")[1],f=s(a));if(c.deep_linking){var h=e("body,html").scrollTop();i!=r?t.location.hash=i:t.location.hash=a,c.scroll_to_content?i==r||i==a?n.parent()[0].scrollIntoView():s(a)[0].scrollIntoView():(i==r||i==a)&&e("body,html").scrollTop(h)}n.addClass(c.active_class).triggerHandler("opened"),l.removeClass(c.active_class),f.siblings().removeClass(c.active_class).end().addClass(c.active_class),c.callback(n),f.triggerHandler("toggled",[n]),o.triggerHandler("toggled",[f])},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},off:function(){},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.tooltip={name:"tooltip",version:"5.3.3",settings:{additional_inheritable_classes:[],tooltip_class:".tooltip",append_to:"body",touch_close_text:"Tap To Close",disable_for_touch:!1,hover_delay:200,show_on:"all",tip_template:function(e,t){return''+t+''}},cache:{},init:function(e,t,n){Foundation.inherit(this,"random_str"),this.bindings(t,n)},should_show:function(t,n){var r=e.extend({},this.settings,this.data_options(t));return r.show_on==="all"?!0:this.small()&&r.show_on==="small"?!0:this.medium()&&r.show_on==="medium"?!0:this.large()&&r.show_on==="large"?!0:!1},medium:function(){return matchMedia(Foundation.media_queries.medium).matches},large:function(){return matchMedia(Foundation.media_queries.large).matches},events:function(t){var n=this,r=n.S;n.create(this.S(t)),e(this.scope).off(".tooltip").on("mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip","["+this.attr_name()+"]",function(t){var i=r(this),s=e.extend({},n.settings,n.data_options(i)),o=!1;if(Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&r(t.target).is("a"))return!1;if(/mouse/i.test(t.type)&&n.ie_touch(t))return!1;if(i.hasClass("open"))Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&t.preventDefault(),n.hide(i);else{if(s.disable_for_touch&&Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type))return;!s.disable_for_touch&&Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&(t.preventDefault(),r(s.tooltip_class+".open").hide(),o=!0),/enter|over/i.test(t.type)?this.timer=setTimeout(function(){var e=n.showTip(i)}.bind(this),n.settings.hover_delay):t.type==="mouseout"||t.type==="mouseleave"?(clearTimeout(this.timer),n.hide(i)):n.showTip(i)}}).on("mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip","["+this.attr_name()+"].open",function(t){if(/mouse/i.test(t.type)&&n.ie_touch(t))return!1;if(e(this).data("tooltip-open-event-type")=="touch"&&t.type=="mouseleave")return;e(this).data("tooltip-open-event-type")=="mouse"&&/MSPointerDown|touchstart/i.test(t.type)?n.convert_to_touch(e(this)):n.hide(e(this))}).on("DOMNodeRemoved DOMAttrModified","["+this.attr_name()+"]:not(a)",function(e){n.hide(r(this))})},ie_touch:function(e){return!1},showTip:function(e){var t=this.getTip(e);if(this.should_show(e,t))return this.show(e);return},getTip:function(t){var n=this.selector(t),r=e.extend({},this.settings,this.data_options(t)),i=null;return n&&(i=this.S('span[data-selector="'+n+'"]'+r.tooltip_class)),typeof i=="object"?i:!1},selector:function(e){var t=e.attr("id"),n=e.attr(this.attr_name())||e.attr("data-selector");return(t&&t.length<1||!t)&&typeof n!="string"&&(n=this.random_str(6),e.attr("data-selector",n)),t&&t.length>0?t:n},create:function(n){var r=this,i=e.extend({},this.settings,this.data_options(n)),s=this.settings.tip_template;typeof i.tip_template=="string"&&t.hasOwnProperty(i.tip_template)&&(s=t[i.tip_template]);var o=e(s(this.selector(n),e("
").html(n.attr("title")).html())),u=this.inheritable_classes(n);o.addClass(u).appendTo(i.append_to),Modernizr.touch&&(o.append(''+i.touch_close_text+""),o.on("touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip",function(e){r.hide(n)})),n.removeAttr("title").attr("title","")},reposition:function(t,n,r){var i,s,o,u,a,f;n.css("visibility","hidden").show(),i=t.data("width"),s=n.children(".nub"),o=s.outerHeight(),u=s.outerHeight(),this.small()?n.css({width:"100%"}):n.css({width:i?i:"auto"}),f=function(e,t,n,r,i,s){return e.css({top:t?t:"auto",bottom:r?r:"auto",left:i?i:"auto",right:n?n:"auto"}).end()},f(n,t.offset().top+t.outerHeight()+10,"auto","auto",t.offset().left);if(this.small())f(n,t.offset().top+t.outerHeight()+10,"auto","auto",12.5,e(this.scope).width()),n.addClass("tip-override"),f(s,-o,"auto","auto",t.offset().left);else{var l=t.offset().left;Foundation.rtl&&(s.addClass("rtl"),l=t.offset().left+t.outerWidth()-n.outerWidth()),f(n,t.offset().top+t.outerHeight()+10,"auto","auto",l),n.removeClass("tip-override"),r&&r.indexOf("tip-top")>-1?(Foundation.rtl&&s.addClass("rtl"),f(n,t.offset().top-n.outerHeight(),"auto","auto",l).removeClass("tip-override")):r&&r.indexOf("tip-left")>-1?(f(n,t.offset().top+t.outerHeight()/2-n.outerHeight()/2,"auto","auto",t.offset().left-n.outerWidth()-o).removeClass("tip-override"),s.removeClass("rtl")):r&&r.indexOf("tip-right")>-1&&(f(n,t.offset().top+t.outerHeight()/2-n.outerHeight()/2,"auto","auto",t.offset().left+t.outerWidth()+o).removeClass("tip-override"),s.removeClass("rtl"))}n.css("visibility","visible").hide()},small:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},inheritable_classes:function(t){var n=e.extend({},this.settings,this.data_options(t)),r=["tip-top","tip-left","tip-bottom","tip-right","radius","round"].concat(n.additional_inheritable_classes),i=t.attr("class"),s=i?e.map(i.split(" "),function(t,n){if(e.inArray(t,r)!==-1)return t}).join(" "):"";return e.trim(s)},convert_to_touch:function(t){var n=this,r=n.getTip(t),i=e.extend({},n.settings,n.data_options(t));r.find(".tap-to-close").length===0&&(r.append(''+i.touch_close_text+""),r.on("click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose",function(e){n.hide(t)})),t.data("tooltip-open-event-type","touch")},show:function(e){var t=this.getTip(e);e.data("tooltip-open-event-type")=="touch"&&this.convert_to_touch(e),this.reposition(e,t,e.attr("class")),e.addClass("open"),t.fadeIn(150)},hide:function(e){var t=this.getTip(e);t.fadeOut(150,function(){t.find(".tap-to-close").remove(),t.off("click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose"),e.removeClass("open")})},off:function(){var t=this;this.S(this.scope).off(".fndtn.tooltip"),this.S(this.settings.tooltip_class).each(function(n){e("["+t.attr_name()+"]").eq(n).attr("title",e(this).text())}).remove()},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.topbar={name:"topbar",version:"5.3.3",settings:{index:0,sticky_class:"sticky",custom_back_text:!0,back_text:"Back",mobile_show_parent_link:!0,is_hover:!0,scrolltop:!0,sticky_on:"all"},init:function(t,n,r){Foundation.inherit(this,"add_custom_rule register_media throttle");var i=this;i.register_media("topbar","foundation-mq-topbar"),this.bindings(n,r),i.S("["+this.attr_name()+"]",this.scope).each(function(){var t=e(this),n=t.data(i.attr_name(!0)+"-init"),r=i.S("section, .top-bar-section",this);t.data("index",0);var s=t.parent();s.hasClass("fixed")||i.is_sticky(t,s,n)?(i.settings.sticky_class=n.sticky_class,i.settings.sticky_topbar=t,t.data("height",s.outerHeight()),t.data("stickyoffset",s.offset().top)):t.data("height",t.outerHeight()),n.assembled||i.assemble(t),n.is_hover?i.S(".has-dropdown",t).addClass("not-click"):i.S(".has-dropdown",t).removeClass("not-click"),i.add_custom_rule(".f-topbar-fixed { padding-top: "+t.data("height")+"px }"),s.hasClass("fixed")&&i.S("body").addClass("f-topbar-fixed")})},is_sticky:function(e,t,n){var r=t.hasClass(n.sticky_class);return r&&n.sticky_on==="all"?!0:r&&this.small()&&n.sticky_on==="small"?matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches&&!matchMedia(Foundation.media_queries.large).matches:r&&this.medium()&&n.sticky_on==="medium"?matchMedia(Foundation.media_queries.small).matches&&matchMedia(Foundation.media_queries.medium).matches&&!matchMedia(Foundation.media_queries.large).matches:r&&this.large()&&n.sticky_on==="large"?matchMedia(Foundation.media_queries.small).matches&&matchMedia(Foundation.media_queries.medium).matches&&matchMedia(Foundation.media_queries.large).matches:!1},toggle:function(n){var r=this,i;n?i=r.S(n).closest("["+this.attr_name()+"]"):i=r.S("["+this.attr_name()+"]");var s=i.data(this.attr_name(!0)+"-init"),o=r.S("section, .top-bar-section",i);r.breakpoint()&&(r.rtl?(o.css({right:"0%"}),e(">.name",o).css({right:"100%"})):(o.css({left:"0%"}),e(">.name",o).css({left:"100%"})),r.S("li.moved",o).removeClass("moved"),i.data("index",0),i.toggleClass("expanded").css("height","")),s.scrolltop?i.hasClass("expanded")?i.parent().hasClass("fixed")&&(s.scrolltop?(i.parent().removeClass("fixed"),i.addClass("fixed"),r.S("body").removeClass("f-topbar-fixed"),t.scrollTo(0,0)):i.parent().removeClass("expanded")):i.hasClass("fixed")&&(i.parent().addClass("fixed"),i.removeClass("fixed"),r.S("body").addClass("f-topbar-fixed")):(r.is_sticky(i,i.parent(),s)&&i.parent().addClass("fixed"),i.parent().hasClass("fixed")&&(i.hasClass("expanded")?(i.addClass("fixed"),i.parent().addClass("expanded"),r.S("body").addClass("f-topbar-fixed")):(i.removeClass("fixed"),i.parent().removeClass("expanded"),r.update_sticky_positioning())))},timer:null,events:function(n){var r=this,i=this.S;i(this.scope).off(".topbar").on("click.fndtn.topbar","["+this.attr_name()+"] .toggle-topbar",function(e){e.preventDefault(),r.toggle(this)}).on("click.fndtn.topbar",'.top-bar .top-bar-section li a[href^="#"],['+this.attr_name()+'] .top-bar-section li a[href^="#"]',function(t){var n=e(this).closest("li");r.breakpoint()&&!n.hasClass("back")&&!n.hasClass("has-dropdown")&&r.toggle()}).on("click.fndtn.topbar","["+this.attr_name()+"] li.has-dropdown",function(t){var n=i(this),s=i(t.target),o=n.closest("["+r.attr_name()+"]"),u=o.data(r.attr_name(!0)+"-init");if(s.data("revealId")){r.toggle();return}if(r.breakpoint())return;if(u.is_hover&&!Modernizr.touch)return;t.stopImmediatePropagation(),n.hasClass("hover")?(n.removeClass("hover").find("li").removeClass("hover"),n.parents("li.hover").removeClass("hover")):(n.addClass("hover"),e(n).siblings().removeClass("hover"),s[0].nodeName==="A"&&s.parent().hasClass("has-dropdown")&&t.preventDefault())}).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown>a",function(e){if(r.breakpoint()){e.preventDefault();var t=i(this),n=t.closest("["+r.attr_name()+"]"),s=n.find("section, .top-bar-section"),o=t.next(".dropdown").outerHeight(),u=t.closest("li");n.data("index",n.data("index")+1),u.addClass("moved"),r.rtl?(s.css({right:-(100*n.data("index"))+"%"}),s.find(">.name").css({right:100*n.data("index")+"%"})):(s.css({left:-(100*n.data("index"))+"%"}),s.find(">.name").css({left:100*n.data("index")+"%"})),n.css("height",t.siblings("ul").outerHeight(!0)+n.data("height"))}}),i(t).off(".topbar").on("resize.fndtn.topbar",r.throttle(function(){r.resize.call(r)},50)).trigger("resize").trigger("resize.fndtn.topbar").load(function(){i(this).trigger("resize.fndtn.topbar")}),i("body").off(".topbar").on("click.fndtn.topbar",function(e){var t=i(e.target).closest("li").closest("li.hover");if(t.length>0)return;i("["+r.attr_name()+"] li.hover").removeClass("hover")}),i(this.scope).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown .back",function(e){e.preventDefault();var t=i(this),n=t.closest("["+r.attr_name()+"]"),s=n.find("section, .top-bar-section"),o=n.data(r.attr_name(!0)+"-init"),u=t.closest("li.moved"),a=u.parent();n.data("index",n.data("index")-1),r.rtl?(s.css({right:-(100*n.data("index"))+"%"}),s.find(">.name").css({right:100*n.data("index")+"%"})):(s.css({left:-(100*n.data("index"))+"%"}),s.find(">.name").css({left:100*n.data("index")+"%"})),n.data("index")===0?n.css("height",""):n.css("height",a.outerHeight(!0)+n.data("height")),setTimeout(function(){u.removeClass("moved")},300)})},resize:function(){var e=this;e.S("["+this.attr_name()+"]").each(function(){var t=e.S(this),r=t.data(e.attr_name(!0)+"-init"),i=t.parent("."+e.settings.sticky_class),s;if(!e.breakpoint()){var o=t.hasClass("expanded");t.css("height","").removeClass("expanded").find("li").removeClass("hover"),o&&e.toggle(t)}e.is_sticky(t,i,r)&&(i.hasClass("fixed")?(i.removeClass("fixed"),s=i.offset().top,e.S(n.body).hasClass("f-topbar-fixed")&&(s-=t.data("height")),t.data("stickyoffset",s),i.addClass("fixed")):(s=i.offset().top,t.data("stickyoffset",s)))})},breakpoint:function(){return!matchMedia(Foundation.media_queries.topbar).matches},small:function(){return matchMedia(Foundation.media_queries.small).matches},medium:function(){return matchMedia(Foundation.media_queries.medium).matches},large:function(){return matchMedia(Foundation.media_queries.large).matches},assemble:function(t){var n=this,r=t.data(this.attr_name(!0)+"-init"),i=n.S("section, .top-bar-section",t);i.detach(),n.S(".has-dropdown>a",i).each(function(){var t=n.S(this),i=t.siblings(".dropdown"),s=t.attr("href"),o;i.find(".title.back").length||(r.mobile_show_parent_link==1&&s?o=e('
  • "):o=e('
  • '),r.custom_back_text==1?e("h5>a",o).html(r.back_text):e("h5>a",o).html("« "+t.html()),i.prepend(o))}),i.appendTo(t),this.sticky(),this.assembled(t)},assembled:function(t){t.data(this.attr_name(!0),e.extend({},t.data(this.attr_name(!0)),{assembled:!0}))},height:function(t){var n=0,r=this;return e("> li",t).each(function(){n+=r.S(this).outerHeight(!0)}),n},sticky:function(){var e=this;this.S(t).on("scroll",function(){e.update_sticky_positioning()})},update_sticky_positioning:function(){var e="."+this.settings.sticky_class,n=this.S(t),r=this;if(r.settings.sticky_topbar&&r.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(),this.settings)){var i=this.settings.sticky_topbar.data("stickyoffset");r.S(e).hasClass("expanded")||(n.scrollTop()>i?r.S(e).hasClass("fixed")||(r.S(e).addClass("fixed"),r.S("body").addClass("f-topbar-fixed")):n.scrollTop()<=i&&r.S(e).hasClass("fixed")&&(r.S(e).removeClass("fixed"),r.S("body").removeClass("f-topbar-fixed")))}},off:function(){this.S(this.scope).off(".fndtn.topbar"),this.S(t).off(".fndtn.topbar")},reflow:function(){}}}(jQuery,window,window.document); diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 0000000..eafffbb --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,31 @@ +filter: + excluded_paths: [ "vendor/*", ".dev/*", "Factories/*" ] + +tools: + # https://scrutinizer-ci.com/docs/tools/external-code-coverage/ + external_code_coverage: true + + # https://scrutinizer-ci.com/docs/tools/php/php-analyzer/ + php_analyzer: true + + # https://scrutinizer-ci.com/docs/tools/php/change-tracking-analyzer/ + php_changetracking: false + + # https://scrutinizer-ci.com/docs/tools/php/code-sniffer/ + php_code_sniffer: + config: + standard: "PSR2" + filter: + excluded_paths: [ "vendor/*", ".dev/*", "Factories/*" ] + + # https://scrutinizer-ci.com/docs/tools/php/mess-detector/ + php_mess_detector: true + + # https://scrutinizer-ci.com/docs/tools/php/pdepend/ + php_pdepend: true + + # https://scrutinizer-ci.com/docs/tools/php/code-similarity-analyzer/ + php_sim: true + + # https://scrutinizer-ci.com/docs/tools/php/security-advisory-checker/ + sensiolabs_security_checker: true diff --git a/.travis.yml b/.travis.yml index 04aa042..8a01b9a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,11 @@ php: - 5.4 - 5.5 - 5.6 + - hhvm + +matrix: + allow_failures: + - php: hhvm notifications: irc: "irc.freenode.org#molajo" @@ -11,7 +16,10 @@ notifications: - amystephen@gmail.com before_script: - - composer install --prefer-source + - composer self-update + - composer install script: - - phpunit -c .dev/phpunit.xml + - phpunit -c .dev/phpunit.xml --coverage-clover=coverage.clover + - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi;' + - sh -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi;' diff --git a/Source/Adapter/AbstractAdapter.php b/Source/Adapter/AbstractAdapter.php index 5afd17f..6460cb1 100644 --- a/Source/Adapter/AbstractAdapter.php +++ b/Source/Adapter/AbstractAdapter.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class AbstractAdapter extends Cache implements ResourceInterface { diff --git a/Source/Adapter/ClassLoader.php b/Source/Adapter/ClassLoader.php index a34cdd0..19b29c6 100644 --- a/Source/Adapter/ClassLoader.php +++ b/Source/Adapter/ClassLoader.php @@ -16,7 +16,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class ClassLoader extends AbstractAdapter implements ResourceInterface { diff --git a/Source/Adapter/File.php b/Source/Adapter/File.php index 9fb0251..b768969 100644 --- a/Source/Adapter/File.php +++ b/Source/Adapter/File.php @@ -16,7 +16,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class File extends AbstractAdapter implements ResourceInterface { diff --git a/Source/Adapter/Folder.php b/Source/Adapter/Folder.php index 14c834b..5848260 100644 --- a/Source/Adapter/Folder.php +++ b/Source/Adapter/Folder.php @@ -18,7 +18,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Folder extends AbstractAdapter implements ResourceInterface { diff --git a/Source/ClassMap.php b/Source/ClassMap.php index ce9a7d8..3c1e715 100644 --- a/Source/ClassMap.php +++ b/Source/ClassMap.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class ClassMap extends Items implements MapInterface { @@ -50,17 +50,9 @@ public function createMap() */ protected function saveOutput() { - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - file_put_contents($this->interface_classes_filename, json_encode($this->interfaces, JSON_PRETTY_PRINT)); - file_put_contents($this->concrete_classes_filename, json_encode($this->concretes, JSON_PRETTY_PRINT)); - file_put_contents($this->events_filename, json_encode($this->events, JSON_PRETTY_PRINT)); - - return $this; - } - - file_put_contents($this->interface_classes_filename, json_encode($this->interfaces)); - file_put_contents($this->concrete_classes_filename, json_encode($this->concretes)); - file_put_contents($this->events_filename, json_encode($this->events)); + file_put_contents($this->interface_classes_filename, json_encode($this->interfaces, JSON_PRETTY_PRINT)); + file_put_contents($this->concrete_classes_filename, json_encode($this->concretes, JSON_PRETTY_PRINT)); + file_put_contents($this->events_filename, json_encode($this->events, JSON_PRETTY_PRINT)); return $this; } diff --git a/Source/ClassMap/Aggregate.php b/Source/ClassMap/Aggregate.php index 339fd3a..0d729c1 100644 --- a/Source/ClassMap/Aggregate.php +++ b/Source/ClassMap/Aggregate.php @@ -14,7 +14,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ abstract class Aggregate extends Events { diff --git a/Source/ClassMap/Base.php b/Source/ClassMap/Base.php index 77ed494..d72892f 100644 --- a/Source/ClassMap/Base.php +++ b/Source/ClassMap/Base.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ abstract class Base { @@ -96,10 +96,11 @@ abstract class Base /** * Constructor * - * @param array $class_maps + * @param array $classmap_files * @param string $interface_classes_filename * @param string $concrete_classes_filename * @param string $events_filename + * @param string $base_path * * @since 1.0.0 */ diff --git a/Source/ClassMap/Events.php b/Source/ClassMap/Events.php index 899d36b..c341032 100644 --- a/Source/ClassMap/Events.php +++ b/Source/ClassMap/Events.php @@ -16,7 +16,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Events extends Base { diff --git a/Source/ClassMap/Items.php b/Source/ClassMap/Items.php index 477e47f..f009126 100644 --- a/Source/ClassMap/Items.php +++ b/Source/ClassMap/Items.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Items extends Aggregate { @@ -56,7 +56,7 @@ protected function processItems() * @param string $path * @param object $reflection * - * @return $class_object + * @return object * @since 1.0.0 */ protected function initialiseObject($path, $reflection) @@ -124,7 +124,7 @@ protected function setConcreteClass($qns, $reflection, $class_object) * @param object $class_object * @param string $qns * - * @return $this; + * @return $this * @since 1.0.0 */ protected function setConcreteInterfaces($reflection, $class_object, $qns) @@ -222,7 +222,7 @@ protected function processDependencies($class_method_array, $parameter) * Add to Dependency Interfaces List * * @param string $qns - * @param array $concretes + * @param array $dependencies * * @return $this * @since 1.0.0 diff --git a/Source/Proxy.php b/Source/Proxy.php index 48f15c9..1c4897f 100644 --- a/Source/Proxy.php +++ b/Source/Proxy.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Proxy extends Uri implements ResourceInterface { diff --git a/Source/Proxy/Base.php b/Source/Proxy/Base.php index e634149..e07c711 100644 --- a/Source/Proxy/Base.php +++ b/Source/Proxy/Base.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Base { diff --git a/Source/Proxy/ClassLoader.php b/Source/Proxy/ClassLoader.php index e259bfe..e97365a 100644 --- a/Source/Proxy/ClassLoader.php +++ b/Source/Proxy/ClassLoader.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class ClassLoader extends Base implements ClassLoaderInterface { diff --git a/Source/Proxy/Scheme.php b/Source/Proxy/Scheme.php index 59bfc1e..49cfedc 100644 --- a/Source/Proxy/Scheme.php +++ b/Source/Proxy/Scheme.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Scheme extends ClassLoader implements SchemeInterface { diff --git a/Source/Proxy/Uri.php b/Source/Proxy/Uri.php index 17ea048..7b33289 100644 --- a/Source/Proxy/Uri.php +++ b/Source/Proxy/Uri.php @@ -14,7 +14,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Uri extends Scheme { diff --git a/Source/ResourceMap.php b/Source/ResourceMap.php index 01a2286..33faef7 100644 --- a/Source/ResourceMap.php +++ b/Source/ResourceMap.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class ResourceMap extends Prefixes implements MapInterface { diff --git a/Source/ResourceMap/Base.php b/Source/ResourceMap/Base.php index 3b1c4d9..b5972ca 100644 --- a/Source/ResourceMap/Base.php +++ b/Source/ResourceMap/Base.php @@ -17,7 +17,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ abstract class Base { diff --git a/Source/ResourceMap/Folders.php b/Source/ResourceMap/Folders.php index 45fdeec..82d01b2 100644 --- a/Source/ResourceMap/Folders.php +++ b/Source/ResourceMap/Folders.php @@ -14,7 +14,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ abstract class Folders extends Base { diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 44ba184..45ac191 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -18,7 +18,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ abstract class Prefixes extends Folders { diff --git a/Source/Scheme.php b/Source/Scheme.php index bb9800b..3eaa87c 100644 --- a/Source/Scheme.php +++ b/Source/Scheme.php @@ -18,7 +18,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Scheme implements SchemeInterface { diff --git a/Source/xxxDriver.php b/Source/xxxDriver.php index 037112c..bbc0460 100644 --- a/Source/xxxDriver.php +++ b/Source/xxxDriver.php @@ -20,7 +20,7 @@ * @package Molajo * @copyright 2014-2015 Amy Stephen. All rights reserved. * @license http://www.opensource.org/licenses/mit-license.html MIT License - * @since 1.0 + * @since 1.0.0 */ class Driver implements ResourceInterface { diff --git a/coverage.clover b/coverage.clover new file mode 100644 index 0000000..b542e82 --- /dev/null +++ b/coverage.clover @@ -0,0 +1,244 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From 026ca47bdc1953bc395220a8638fbdd90f6d36e7 Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Mon, 23 Feb 2015 20:24:17 -0600 Subject: [PATCH 07/11] Fixed 6 new errors --- .dev/Tests/ClassMapTest.php | 16 +- .dev/Tests/Source/C/Js/foundation.min.js | 1970 +++++++++++++++++++++- Source/ClassMap/Base.php | 8 +- Source/Proxy/Base.php | 6 +- Source/ResourceMap/Prefixes.php | 3 +- 5 files changed, 1982 insertions(+), 21 deletions(-) diff --git a/.dev/Tests/ClassMapTest.php b/.dev/Tests/ClassMapTest.php index f5b3ef2..c6b2aba 100644 --- a/.dev/Tests/ClassMapTest.php +++ b/.dev/Tests/ClassMapTest.php @@ -20,20 +20,20 @@ class ClassMapTest extends \PHPUnit_Framework_TestCase { /** * Setup - * + * * @return $this * @since 1.0.0 */ protected function setUp() { /** - - $instance = new Proxy(new Resource(new MockRender)); - - $file = __DIR__ . '/RenderTest.php'; - $data = array(); - $stuff = $instance->render($file, $data); - $this->assertEquals('stuff', $stuff); + * + * $instance = new Proxy(new Resource(new MockRender)); + * + * $file = __DIR__ . '/RenderTest.php'; + * $data = array(); + * $stuff = $instance->render($file, $data); + * $this->assertEquals('stuff', $stuff); */ diff --git a/.dev/Tests/Source/C/Js/foundation.min.js b/.dev/Tests/Source/C/Js/foundation.min.js index 3dfe55f..814af40 100644 --- a/.dev/Tests/Source/C/Js/foundation.min.js +++ b/.dev/Tests/Source/C/Js/foundation.min.js @@ -4,7 +4,1969 @@ * Copyright 2014, ZURB * Free to use under the MIT license. * http://www.opensource.org/licenses/mit-license.php -*/ -(function(e,t,n,r){"use strict";function l(e){if(typeof e=="string"||e instanceof String)e=e.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g,"");return e}var i=function(t){var n=t.length,r=e("head");while(n--)r.has("."+t[n]).length===0&&r.append('')};i(["foundation-mq-small","foundation-mq-medium","foundation-mq-large","foundation-mq-xlarge","foundation-mq-xxlarge","foundation-data-attribute-namespace"]),e(function(){typeof FastClick!="undefined"&&typeof n.body!="undefined"&&FastClick.attach(n.body)});var s=function(t,r){if(typeof t=="string"){if(r){var i;if(r.jquery){i=r[0];if(!i)return r}else i=r;return e(i.querySelectorAll(t))}return e(n.querySelectorAll(t))}return e(t,r)},o=function(e){var t=[];return e||t.push("data"),this.namespace.length>0&&t.push(this.namespace),t.push(this.name),t.join("-")},u=function(e){var t=e.split("-"),n=t.length,r=[];while(n--)n!==0?r.push(t[n]):this.namespace.length>0?r.push(this.namespace,t[n]):r.push(t[n]);return r.reverse().join("-")},a=function(t,n){var r=this,i=!s(this).data(this.attr_name(!0));s(this.scope).is("["+this.attr_name()+"]")?(s(this.scope).data(this.attr_name(!0)+"-init",e.extend({},this.settings,n||t,this.data_options(s(this.scope)))),i&&this.events(this.scope)):s("["+this.attr_name()+"]",this.scope).each(function(){var i=!s(this).data(r.attr_name(!0)+"-init");s(this).data(r.attr_name(!0)+"-init",e.extend({},r.settings,n||t,r.data_options(s(this)))),i&&r.events(this)});if(typeof t=="string")return this[t].call(this,n)},f=function(e,t){function n(){t(e[0])}function r(){this.one("load",n);if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var e=this.attr("src"),t=e.match(/\?/)?"&":"?";t+="random="+(new Date).getTime(),this.attr("src",e+t)}}if(!e.attr("src")){n();return}e[0].complete||e[0].readyState===4?n():r.call(e)};t.matchMedia=t.matchMedia||function(e){var t,n=e.documentElement,r=n.firstElementChild||n.firstChild,i=e.createElement("body"),s=e.createElement("div");return s.id="mq-test-1",s.style.cssText="position:absolute;top:-100em",i.style.background="none",i.appendChild(s),function(e){return s.innerHTML='­',n.insertBefore(i,r),t=s.offsetWidth===42,n.removeChild(i),{matches:t,media:e}}}(n),function(e){function a(){n&&(s(a),u&&jQuery.fx.tick())}var n,r=0,i=["webkit","moz"],s=t.requestAnimationFrame,o=t.cancelAnimationFrame,u="undefined"!=typeof jQuery.fx;for(;r").appendTo("head")[0].sheet,global:{namespace:r},init:function(e,n,r,i,o){var u=[e,r,i,o],a=[];this.rtl=/rtl/i.test(s("html").attr("dir")),this.scope=e||this.scope,this.set_namespace();if(n&&typeof n=="string"&&!/reflow/i.test(n))this.libs.hasOwnProperty(n)&&a.push(this.init_lib(n,u));else for(var f in this.libs)a.push(this.init_lib(f,n));return s(t).load(function(){s(t).trigger("resize.fndtn.clearing").trigger("resize.fndtn.dropdown").trigger("resize.fndtn.equalizer").trigger("resize.fndtn.interchange").trigger("resize.fndtn.joyride").trigger("resize.fndtn.magellan").trigger("resize.fndtn.topbar").trigger("resize.fndtn.slider")}),e},init_lib:function(t,n){return this.libs.hasOwnProperty(t)?(this.patch(this.libs[t]),n&&n.hasOwnProperty(t)?(typeof this.libs[t].settings!="undefined"?e.extend(!0,this.libs[t].settings,n[t]):typeof this.libs[t].defaults!="undefined"&&e.extend(!0,this.libs[t].defaults,n[t]),this.libs[t].init.apply(this.libs[t],[this.scope,n[t]])):(n=n instanceof Array?n:new Array(n),this.libs[t].init.apply(this.libs[t],n))):function(){}},patch:function(e){e.scope=this.scope,e.namespace=this.global.namespace,e.rtl=this.rtl,e.data_options=this.utils.data_options,e.attr_name=o,e.add_namespace=u,e.bindings=a,e.S=this.utils.S},inherit:function(e,t){var n=t.split(" "),r=n.length;while(r--)this.utils.hasOwnProperty(n[r])&&(e[n[r]]=this.utils[n[r]])},set_namespace:function(){var t=this.global.namespace===r?e(".foundation-data-attribute-namespace").css("font-family"):this.global.namespace;this.global.namespace=t===r||/false/i.test(t)?"":t},libs:{},utils:{S:s,throttle:function(e,t){var n=null;return function(){var r=this,i=arguments;n==null&&(n=setTimeout(function(){e.apply(r,i),n=null},t))}},debounce:function(e,t,n){var r,i;return function(){var s=this,o=arguments,u=function(){r=null,n||(i=e.apply(s,o))},a=n&&!r;return clearTimeout(r),r=setTimeout(u,t),a&&(i=e.apply(s,o)),i}},data_options:function(t,n){function f(e){return!isNaN(e-0)&&e!==null&&e!==""&&e!==!1&&e!==!0}function l(t){return typeof t=="string"?e.trim(t):t}n=n||"options";var r={},i,s,o,u=function(e){var t=Foundation.global.namespace;return t.length>0?e.data(t+"-"+n):e.data(n)},a=u(t);if(typeof a=="object")return a;o=(a||":").split(";"),i=o.length;while(i--)s=o[i].split(":"),s=[s[0],s.slice(1).join(":")],/true/i.test(s[1])&&(s[1]=!0),/false/i.test(s[1])&&(s[1]=!1),f(s[1])&&(s[1].indexOf(".")===-1?s[1]=parseInt(s[1],10):s[1]=parseFloat(s[1])),s.length===2&&s[0].length>0&&(r[l(s[0])]=l(s[1]));return r},register_media:function(t,n){Foundation.media_queries[t]===r&&(e("head").append(''),Foundation.media_queries[t]=l(e("."+n).css("font-family")))},add_custom_rule:function(e,t){if(t===r&&Foundation.stylesheet)Foundation.stylesheet.insertRule(e,Foundation.stylesheet.cssRules.length);else{var n=Foundation.media_queries[t];n!==r&&Foundation.stylesheet.insertRule("@media "+Foundation.media_queries[t]+"{ "+e+" }")}},image_loaded:function(e,t){var n=this,r=e.length;r===0&&t(e),e.each(function(){f(n.S(this),function(){r-=1,r===0&&t(e)})})},random_str:function(){return this.fidx||(this.fidx=0),this.prefix=this.prefix||[this.name||"F",(+(new Date)).toString(36)].join("-"),this.prefix+(this.fidx++).toString(36)}}},e.fn.foundation=function(){var e=Array.prototype.slice.call(arguments,0);return this.each(function(){return Foundation.init.apply(Foundation,[this].concat(e)),this})}})(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.abide={name:"abide",version:"5.3.3",settings:{live_validate:!0,focus_on_invalid:!0,error_labels:!0,timeout:1e3,patterns:{alpha:/^[a-zA-Z]+$/,alpha_numeric:/^[a-zA-Z0-9]+$/,integer:/^[-+]?\d+$/,number:/^[-+]?\d*(?:[\.\,]\d+)?$/,card:/^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/,cvv:/^([0-9]){3,4}$/,email:/^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,url:/^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/,domain:/^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/,datetime:/^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/,date:/(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/,time:/^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/,dateISO:/^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/,month_day_year:/^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/,color:/^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/},validators:{equalTo:function(e,t,r){var i=n.getElementById(e.getAttribute(this.add_namespace("data-equalto"))).value,s=e.value,o=i===s;return o}}},timer:null,init:function(e,t,n){this.bindings(t,n)},events:function(t){var n=this,r=n.S(t).attr("novalidate","novalidate"),i=r.data(this.attr_name(!0)+"-init")||{};this.invalid_attr=this.add_namespace("data-invalid"),r.off(".abide").on("submit.fndtn.abide validate.fndtn.abide",function(e){var t=/ajax/i.test(n.S(this).attr(n.attr_name()));return n.validate(n.S(this).find("input, textarea, select").get(),e,t)}).on("reset",function(){return n.reset(e(this))}).find("input, textarea, select").off(".abide").on("blur.fndtn.abide change.fndtn.abide",function(e){n.validate([this],e)}).on("keydown.fndtn.abide",function(e){i.live_validate===!0&&(clearTimeout(n.timer),n.timer=setTimeout(function(){n.validate([this],e)}.bind(this),i.timeout))})},reset:function(t){t.removeAttr(this.invalid_attr),e(this.invalid_attr,t).removeAttr(this.invalid_attr),e(".error",t).not("small").removeClass("error")},validate:function(e,t,n){var r=this.parse_patterns(e),i=r.length,s=this.S(e[0]).closest("form"),o=/submit/.test(t.type);for(var u=0;u0?[e,this.settings.patterns[r],n]:r.length>0?[e,new RegExp(r),n]:this.settings.patterns.hasOwnProperty(t)?[e,this.settings.patterns[t],n]:(r=/.*/,[e,r,n])},check_validation_and_apply_styles:function(t){var n=t.length,r=[],i=this.S(t[0][0]).closest("[data-"+this.attr_name(!0)+"]"),s=i.data(this.attr_name(!0)+"-init")||{};while(n--){var o=t[n][0],u=t[n][2],a=o.value.trim(),f=this.S(o).parent(),l=o.getAttribute(this.add_namespace("data-abide-validator")),c=o.type==="radio",h=o.type==="checkbox",p=this.S('label[for="'+o.getAttribute("id")+'"]'),d=u?o.value.length>0:!0,v,m;o.getAttribute(this.add_namespace("data-equalto"))&&(l="equalTo"),f.is("label")?v=f.parent():v=f,c&&u?r.push(this.valid_radio(o,u)):h&&u?r.push(this.valid_checkbox(o,u)):(l&&(m=this.settings.validators[l].apply(this,[o,u,v]),r.push(m)),t[n][1].test(a)&&d||!u&&o.value.length<1||e(o).attr("disabled")?r.push(!0):r.push(!1),r=[r.every(function(e){return e})],r[0]?(this.S(o).removeAttr(this.invalid_attr),v.removeClass("error"),p.length>0&&this.settings.error_labels&&p.removeClass("error"),e(o).triggerHandler("valid")):(v.addClass("error"),this.S(o).attr(this.invalid_attr,""),p.length>0&&this.settings.error_labels&&p.addClass("error"),e(o).triggerHandler("invalid")))}return r},valid_checkbox:function(e,t){var e=this.S(e),n=e.is(":checked")||!t;return n?e.removeAttr(this.invalid_attr).parent().removeClass("error"):e.attr(this.invalid_attr,"").parent().addClass("error"),n},valid_radio:function(e,t){var n=e.getAttribute("name"),r=this.S(e).closest("[data-"+this.attr_name(!0)+"]").find("[name='"+n+"']"),i=r.length,s=!1;for(var o=0;o0;s?e.removeAttr(this.invalid_attr).parent().removeClass("error"):e.attr(this.invalid_attr,"").parent().addClass("error");if(!r){var o=this;i.each(function(){o.valid_oneof.call(o,this,null,null,!0)})}return s}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.equalizer={name:"equalizer",version:"5.3.3",settings:{use_tallest:!0,before_height_change:e.noop,after_height_change:e.noop,equalize_on_stack:!1},init:function(e,t,n){Foundation.inherit(this,"image_loaded"),this.bindings(t,n),this.reflow()},events:function(){this.S(t).off(".equalizer").on("resize.fndtn.equalizer",function(e){this.reflow()}.bind(this))},equalize:function(t){var n=!1,r=t.find("["+this.attr_name()+"-watch]:visible"),i=t.data(this.attr_name(!0)+"-init");if(r.length===0)return;var s=r.first().offset().top;i.before_height_change(),t.trigger("before-height-change").trigger("before-height-change.fndth.equalizer"),r.height("inherit"),r.each(function(){var t=e(this);t.offset().top!==s&&(n=!0)});if(i.equalize_on_stack===!1&&n)return;var o=r.map(function(){return e(this).outerHeight(!1)}).get();if(i.use_tallest){var u=Math.max.apply(null,o);r.css("height",u)}else{var a=Math.min.apply(null,o);r.css("height",a)}i.after_height_change(),t.trigger("after-height-change").trigger("after-height-change.fndtn.equalizer")},reflow:function(){var t=this;this.S("["+this.attr_name()+"]",this.scope).each(function(){var n=e(this);t.image_loaded(t.S("img",this),function(){t.equalize(n)})})}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.interchange={name:"interchange",version:"5.3.3",cache:{},images_loaded:!1,nodes_loaded:!1,settings:{load_attr:"interchange",named_queries:{"default":"only screen",small:Foundation.media_queries.small,medium:Foundation.media_queries.medium,large:Foundation.media_queries.large,xlarge:Foundation.media_queries.xlarge,xxlarge:Foundation.media_queries.xxlarge,landscape:"only screen and (orientation: landscape)",portrait:"only screen and (orientation: portrait)",retina:"only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx)"},directives:{replace:function(t,n,r){if(/IMG/.test(t[0].nodeName)){var i=t[0].src;if((new RegExp(n,"i")).test(i))return;return t[0].src=n,r(t[0].src)}var s=t.data(this.data_attr+"-last-path"),o=this;if(s==n)return;return/\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(n)?(e(t).css("background-image","url("+n+")"),t.data("interchange-last-path",n),r(n)):e.get(n,function(e){t.html(e),t.data(o.data_attr+"-last-path",n),r()})}}},init:function(t,n,r){Foundation.inherit(this,"throttle random_str"),this.data_attr=this.set_data_attr(),e.extend(!0,this.settings,n,r),this.bindings(n,r),this.load("images"),this.load("nodes")},get_media_hash:function(){var e="";for(var t in this.settings.named_queries)e+=matchMedia(this.settings.named_queries[t]).matches.toString();return e},events:function(){var n=this,r;return e(t).off(".interchange").on("resize.fndtn.interchange",n.throttle(function(){var e=n.get_media_hash();e!==r&&n.resize(),r=e},50)),this},resize:function(){var t=this.cache;if(!this.images_loaded||!this.nodes_loaded){setTimeout(e.proxy(this.resize,this),50);return}for(var n in t)if(t.hasOwnProperty(n)){var r=this.results(n,t[n]);r&&this.settings.directives[r.scenario[1]].call(this,r.el,r.scenario[0],function(){if(arguments[0]instanceof Array)var e=arguments[0];else var e=Array.prototype.slice.call(arguments,0);r.el.trigger(r.scenario[1],e)})}},results:function(e,t){var n=t.length;if(n>0){var r=this.S("["+this.add_namespace("data-uuid")+'="'+e+'"]');while(n--){var i,s=t[n][2];this.settings.named_queries.hasOwnProperty(s)?i=matchMedia(this.settings.named_queries[s]):i=matchMedia(s);if(i.matches)return{el:r,scenario:t[n]}}}return!1},load:function(e,t){return(typeof this["cached_"+e]=="undefined"||t)&&this["update_"+e](),this["cached_"+e]},update_images:function(){var e=this.S("img["+this.data_attr+"]"),t=e.length,n=t,r=0,i=this.data_attr;this.cache={},this.cached_images=[],this.images_loaded=t===0;while(n--){r++;if(e[n]){var s=e[n].getAttribute(i)||"";s.length>0&&this.cached_images.push(e[n])}r===t&&(this.images_loaded=!0,this.enhance("images"))}return this},update_nodes:function(){var e=this.S("["+this.data_attr+"]").not("img"),t=e.length,n=t,r=0,i=this.data_attr;this.cached_nodes=[],this.nodes_loaded=t===0;while(n--){r++;var s=e[n].getAttribute(i)||"";s.length>0&&this.cached_nodes.push(e[n]),r===t&&(this.nodes_loaded=!0,this.enhance("nodes"))}return this},enhance:function(n){var r=this["cached_"+n].length;while(r--)this.object(e(this["cached_"+n][r]));return e(t).trigger("resize").trigger("resize.fndtn.interchange")},convert_directive:function(e){var t=this.trim(e);return t.length>0?t:"replace"},parse_scenario:function(e){var t=e[0].match(/(.+),\s*(\w+)\s*$/),n=e[1];if(t)var r=t[1],i=t[2];else var s=e[0].split(/,\s*$/),r=s[0],i="";return[this.trim(r),this.convert_directive(i),this.trim(n)]},object:function(e){var t=this.parse_data_attr(e),n=[],r=t.length;if(r>0)while(r--){var i=t[r].split(/\((.*?)(\))$/);if(i.length>1){var s=this.parse_scenario(i);n.push(s)}}return this.store(e,n)},store:function(e,t){var n=this.random_str(),r=e.data(this.add_namespace("uuid",!0));return this.cache[r]?this.cache[r]:(e.attr(this.add_namespace("data-uuid"),n),this.cache[n]=t)},trim:function(t){return typeof t=="string"?e.trim(t):t},set_data_attr:function(e){return e?this.namespace.length>0?this.namespace+"-"+this.settings.load_attr:this.settings.load_attr:this.namespace.length>0?"data-"+this.namespace+"-"+this.settings.load_attr:"data-"+this.settings.load_attr},parse_data_attr:function(e){var t=e.attr(this.attr_name()).split(/\[(.*?)\]/),n=t.length,r=[];while(n--)t[n].replace(/[\W\d]+/,"").length>4&&r.push(t[n]);return r},reflow:function(){this.load("images",!0),this.load("nodes",!0)}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.dropdown={name:"dropdown",version:"5.3.3",settings:{active_class:"open",align:"bottom",is_hover:!1,opened:function(){},closed:function(){}},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n)},events:function(n){var r=this,i=r.S;i(this.scope).off(".dropdown").on("click.fndtn.dropdown","["+this.attr_name()+"]",function(t){var n=i(this).data(r.attr_name(!0)+"-init")||r.settings;if(!n.is_hover||Modernizr.touch)t.preventDefault(),r.toggle(e(this))}).on("mouseenter.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(e){var t=i(this),n,s;clearTimeout(r.timeout),t.data(r.data_attr())?(n=i("#"+t.data(r.data_attr())),s=t):(n=t,s=i("["+r.attr_name()+"='"+n.attr("id")+"']"));var o=s.data(r.attr_name(!0)+"-init")||r.settings;i(e.target).data(r.data_attr())&&o.is_hover&&r.closeall.call(r),o.is_hover&&r.open.apply(r,[n,s])}).on("mouseleave.fndtn.dropdown","["+this.attr_name()+"], ["+this.attr_name()+"-content]",function(e){var t=i(this);r.timeout=setTimeout(function(){if(t.data(r.data_attr())){var e=t.data(r.data_attr(!0)+"-init")||r.settings;e.is_hover&&r.close.call(r,i("#"+t.data(r.data_attr())))}else{var n=i("["+r.attr_name()+'="'+i(this).attr("id")+'"]'),e=n.data(r.attr_name(!0)+"-init")||r.settings;e.is_hover&&r.close.call(r,t)}}.bind(this),150)}).on("click.fndtn.dropdown",function(t){var n=i(t.target).closest("["+r.attr_name()+"-content]");if(i(t.target).closest("["+r.attr_name()+"]").length>0)return;if(!i(t.target).data("revealId")&&n.length>0&&(i(t.target).is("["+r.attr_name()+"-content]")||e.contains(n.first()[0],t.target))){t.stopPropagation();return}r.close.call(r,i("["+r.attr_name()+"-content]"))}).on("opened.fndtn.dropdown","["+r.attr_name()+"-content]",function(){r.settings.opened.call(this)}).on("closed.fndtn.dropdown","["+r.attr_name()+"-content]",function(){r.settings.closed.call(this)}),i(t).off(".dropdown").on("resize.fndtn.dropdown",r.throttle(function(){r.resize.call(r)},50)),this.resize()},close:function(e){var t=this;e.each(function(){t.S(this).hasClass(t.settings.active_class)&&(t.S(this).css(Foundation.rtl?"right":"left","-99999px").removeClass(t.settings.active_class).prev("["+t.attr_name()+"]").removeClass(t.settings.active_class).removeData("target"),t.S(this).trigger("closed").trigger("closed.fndtn.dropdown",[e]))})},closeall:function(){var t=this;e.each(t.S("["+this.attr_name()+"-content]"),function(){t.close.call(t,t.S(this))})},open:function(e,t){this.css(e.addClass(this.settings.active_class),t),e.prev("["+this.attr_name()+"]").addClass(this.settings.active_class),e.data("target",t.get(0)).trigger("opened").trigger("opened.fndtn.dropdown",[e,t])},data_attr:function(){return this.namespace.length>0?this.namespace+"-"+this.name:this.name},toggle:function(e){var t=this.S("#"+e.data(this.data_attr()));if(t.length===0)return;this.close.call(this,this.S("["+this.attr_name()+"-content]").not(t)),t.hasClass(this.settings.active_class)?(this.close.call(this,t),t.data("target")!==e.get(0)&&this.open.call(this,t,e)):this.open.call(this,t,e)},resize:function(){var e=this.S("["+this.attr_name()+"-content].open"),t=this.S("["+this.attr_name()+"='"+e.attr("id")+"']");e.length&&t.length&&this.css(e,t)},css:function(e,t){var n=Math.max((t.width()-e.width())/2,8);this.clear_idx();if(this.small()){var r=this.dirs.bottom.call(e,t);e.attr("style","").removeClass("drop-left drop-right drop-top").css({position:"absolute",width:"95%","max-width":"none",top:r.top}),e.css(Foundation.rtl?"right":"left",n)}else{var i=t.data(this.attr_name(!0)+"-init")||this.settings;this.style(e,t,i)}return e},style:function(t,n,r){var i=e.extend({position:"absolute"},this.dirs[r.align].call(t,n,r));t.attr("style","").css(i)},dirs:{_base:function(e){var t=this.offsetParent(),n=t.offset(),r=e.offset();return r.top-=n.top,r.left-=n.left,r},top:function(e,t){var n=Foundation.libs.dropdown,r=n.dirs._base.call(this,e),i=8;return this.addClass("drop-top"),(e.outerWidth() dd > a",function(r){var i=n(this).closest("["+t.attr_name()+"]"),s=t.attr_name()+"="+i.attr(t.attr_name()),o=i.data(t.attr_name(!0)+"-init"),u=n("#"+this.href.split("#")[1]),a=e("> dd",i),f=a.children(".content"),l=f.filter("."+o.active_class);r.preventDefault(),i.attr(t.attr_name())&&(f=f.add("["+s+"] dd > .content"),a=a.add("["+s+"] dd"));if(o.toggleable&&u.is(l)){u.parent("dd").toggleClass(o.active_class,!1),u.toggleClass(o.active_class,!1),o.callback(u),u.triggerHandler("toggled",[i]),i.triggerHandler("toggled",[u]);return}o.multi_expand||(f.removeClass(o.active_class),a.removeClass(o.active_class)),u.addClass(o.active_class).parent().addClass(o.active_class),o.callback(u),u.triggerHandler("toggled",[i]),i.triggerHandler("toggled",[u])})},off:function(){},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.alert={name:"alert",version:"5.3.3",settings:{callback:function(){}},init:function(e,t,n){this.bindings(t,n)},events:function(){var t=this,n=this.S;e(this.scope).off(".alert").on("click.fndtn.alert","["+this.attr_name()+"] a.close",function(e){var r=n(this).closest("["+t.attr_name()+"]"),i=r.data(t.attr_name(!0)+"-init")||t.settings;e.preventDefault(),Modernizr.csstransitions?(r.addClass("alert-close"),r.on("transitionend webkitTransitionEnd oTransitionEnd",function(e){n(this).trigger("close").trigger("close.fndtn.alert").remove(),i.callback()})):r.fadeOut(300,function(){n(this).trigger("close").trigger("close.fndtn.alert").remove(),i.callback()})})},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.clearing={name:"clearing",version:"5.3.3",settings:{templates:{viewing:'×'},close_selectors:".clearing-close, div.clearing-blackout",open_selectors:"",skip_selector:"",touch_label:"",init:!1,locked:!1},init:function(e,t,n){var r=this;Foundation.inherit(this,"throttle image_loaded"),this.bindings(t,n),r.S(this.scope).is("["+this.attr_name()+"]")?this.assemble(r.S("li",this.scope)):r.S("["+this.attr_name()+"]",this.scope).each(function(){r.assemble(r.S("li",this))})},events:function(r){var i=this,s=i.S,o=e(".scroll-container");o.length>0&&(this.scope=o),s(this.scope).off(".clearing").on("click.fndtn.clearing","ul["+this.attr_name()+"] li "+this.settings.open_selectors,function(e,t,n){var t=t||s(this),n=n||t,r=t.next("li"),o=t.closest("["+i.attr_name()+"]").data(i.attr_name(!0)+"-init"),u=s(e.target);e.preventDefault(),o||(i.init(),o=t.closest("["+i.attr_name()+"]").data(i.attr_name(!0)+"-init")),n.hasClass("visible")&&t[0]===n[0]&&r.length>0&&i.is_open(t)&&(n=r,u=s("img",n)),i.open(u,t,n),i.update_paddles(n)}).on("click.fndtn.clearing",".clearing-main-next",function(e){i.nav(e,"next")}).on("click.fndtn.clearing",".clearing-main-prev",function(e){i.nav(e,"prev")}).on("click.fndtn.clearing",this.settings.close_selectors,function(e){Foundation.libs.clearing.close(e,this)}),e(n).on("keydown.fndtn.clearing",function(e){i.keydown(e)}),s(t).off(".clearing").on("resize.fndtn.clearing",function(){i.resize()}),this.swipe_events(r)},swipe_events:function(e){var t=this,n=t.S;n(this.scope).on("touchstart.fndtn.clearing",".visible-img",function(e){e.touches||(e=e.originalEvent);var t={start_page_x:e.touches[0].pageX,start_page_y:e.touches[0].pageY,start_time:(new Date).getTime(),delta_x:0,is_scrolling:r};n(this).data("swipe-transition",t),e.stopPropagation()}).on("touchmove.fndtn.clearing",".visible-img",function(e){e.touches||(e=e.originalEvent);if(e.touches.length>1||e.scale&&e.scale!==1)return;var r=n(this).data("swipe-transition");typeof r=="undefined"&&(r={}),r.delta_x=e.touches[0].pageX-r.start_page_x,Foundation.rtl&&(r.delta_x=-r.delta_x),typeof r.is_scrolling=="undefined"&&(r.is_scrolling=!!(r.is_scrolling||Math.abs(r.delta_x)
  • ');var r=n.detach(),i="";if(r[0]==null)return;i=r[0].outerHTML;var s=this.S("#foundationClearingHolder"),o=n.data(this.attr_name(!0)+"-init"),u={grid:'",viewing:o.templates.viewing},a='
    '+u.viewing+u.grid+"
    ",f=this.settings.touch_label;Modernizr.touch&&(a=e(a).find(".clearing-touch-label").html(f).end()),s.after(a).remove()},open:function(t,r,i){function p(){setTimeout(function(){this.image_loaded(l,function(){l.outerWidth()===1&&!h?p.call(this):d.call(this,l)}.bind(this))}.bind(this),100)}function d(t){var n=e(t);n.css("visibility","visible"),o.css("overflow","hidden"),u.addClass("clearing-blackout"),a.addClass("clearing-container"),f.show(),this.fix_height(i).caption(s.S(".clearing-caption",f),s.S("img",i)).center_and_label(t,c).shift(r,i,function(){i.closest("li").siblings().removeClass("visible"),i.closest("li").addClass("visible")}),f.trigger("opened.fndtn.clearing")}var s=this,o=e(n.body),u=i.closest(".clearing-assembled"),a=s.S("div",u).first(),f=s.S(".visible-img",a),l=s.S("img",f).not(t),c=s.S(".clearing-touch-label",a),h=!1;e("body").on("touchmove",function(e){e.preventDefault()}),l.error(function(){h=!0}),this.locked()||(f.trigger("open.fndtn.clearing"),l.attr("src",this.load(t)).css("visibility","hidden"),p.call(this))},close:function(t,r){t.preventDefault();var i=function(e){return/blackout/.test(e.selector)?e:e.closest(".clearing-blackout")}(e(r)),s=e(n.body),o,u;return r===t.target&&i&&(s.css("overflow",""),o=e("div",i).first(),u=e(".visible-img",o),u.trigger("close.fndtn.clearing"),this.settings.prev_index=0,e("ul["+this.attr_name()+"]",i).attr("style","").closest(".clearing-blackout").removeClass("clearing-blackout"),o.removeClass("clearing-container"),u.hide(),u.trigger("closed.fndtn.clearing")),e("body").off("touchmove"),!1},is_open:function(e){return e.parent().prop("style").length>0},keydown:function(t){var n=e(".clearing-blackout ul["+this.attr_name()+"]"),r=this.rtl?37:39,i=this.rtl?39:37,s=27;t.which===r&&this.go(n,"next"),t.which===i&&this.go(n,"prev"),t.which===s&&this.S("a.clearing-close").trigger("click").trigger("click.fndtn.clearing")},nav:function(t,n){var r=e("ul["+this.attr_name()+"]",".clearing-blackout");t.preventDefault(),this.go(r,n)},resize:function(){var t=e("img",".clearing-blackout .visible-img"),n=e(".clearing-touch-label",".clearing-blackout");t.length&&(this.center_and_label(t,n),t.trigger("resized.fndtn.clearing"))},fix_height:function(e){var t=e.parent().children(),n=this;return t.each(function(){var e=n.S(this),t=e.find("img");e.height()>t.outerHeight()&&e.addClass("fix-height")}).closest("ul").width -(t.length*100+"%"),this},update_paddles:function(e){e=e.closest("li");var t=e.closest(".carousel").siblings(".visible-img");e.next().length>0?this.S(".clearing-main-next",t).removeClass("disabled"):this.S(".clearing-main-next",t).addClass("disabled"),e.prev().length>0?this.S(".clearing-main-prev",t).removeClass("disabled"):this.S(".clearing-main-prev",t).addClass("disabled")},center_and_label:function(e,t){return this.rtl?(e.css({marginRight:-(e.outerWidth()/2),marginTop:-(e.outerHeight()/2),left:"auto",right:"50%"}),t.length>0&&t.css({marginRight:-(t.outerWidth()/2),marginTop:-(e.outerHeight()/2)-t.outerHeight()-10,left:"auto",right:"50%"})):(e.css({marginLeft:-(e.outerWidth()/2),marginTop:-(e.outerHeight()/2)}),t.length>0&&t.css({marginLeft:-(t.outerWidth()/2),marginTop:-(e.outerHeight()/2)-t.outerHeight()-10})),this},load:function(e){var t;return e[0].nodeName==="A"?t=e.attr("href"):t=e.parent().attr("href"),this.preload(e),t?t:e.attr("src")},preload:function(e){this.img(e.closest("li").next()).img(e.closest("li").prev())},img:function(e){if(e.length){var t=new Image,n=this.S("a",e);n.length?t.src=n.attr("href"):t.src=this.S("img",e).attr("src")}return this},caption:function(e,t){var n=t.attr("data-caption");return n?e.html(n).show():e.text("").hide(),this},go:function(e,t){var n=this.S(".visible",e),r=n[t]();this.settings.skip_selector&&r.find(this.settings.skip_selector).length!=0&&(r=r[t]()),r.length&&this.S("img",r).trigger("click",[n,r]).trigger("click.fndtn.clearing",[n,r]).trigger("change.fndtn.clearing")},shift:function(e,t,n){var r=t.parent(),i=this.settings.prev_index||t.index(),s=this.direction(r,e,t),o=this.rtl?"right":"left",u=parseInt(r.css("left"),10),a=t.outerWidth(),f,l={};t.index()!==i&&!/skip/.test(s)?/left/.test(s)?(this.lock(),l[o]=u+a,r.animate(l,300,this.unlock())):/right/.test(s)&&(this.lock(),l[o]=u-a,r.animate(l,300,this.unlock())):/skip/.test(s)&&(f=t.index()-this.settings.up_count,this.lock(),f>0?(l[o]=-(f*a),r.animate(l,300,this.unlock())):(l[o]=0,r.animate(l,300,this.unlock()))),n()},direction:function(e,t,n){var r=this.S("li",e),i=r.outerWidth()+r.outerWidth()/4,s=Math.floor(this.S(".clearing-container").outerWidth()/i)-1,o=r.index(n),u;return this.settings.up_count=s,this.adjacent(this.settings.prev_index,o)?o>s&&o>this.settings.prev_index?u="right":o>s-1&&o<=this.settings.prev_index?u="left":u=!1:u="skip",this.settings.prev_index=o,u},adjacent:function(e,t){for(var n=t+1;n>=t-1;n--)if(n===e)return!0;return!1},lock:function(){this.settings.locked=!0},unlock:function(){this.settings.locked=!1},locked:function(){return this.settings.locked},off:function(){this.S(this.scope).off(".fndtn.clearing"),this.S(t).off(".fndtn.clearing")},reflow:function(){this.init()}}}(jQuery,window,window.document),!function(e){"function"==typeof define&&define.amd?define(["jquery"],e):e("object"==typeof exports?require("jquery"):jQuery)}(function(e){function t(e){return u.raw?e:encodeURIComponent(e)}function n(e){return u.raw?e:decodeURIComponent(e)}function r(e){return t(u.json?JSON.stringify(e):String(e))}function i(e){0===e.indexOf('"')&&(e=e.slice(1,-1).replace(/\\"/g,'"').replace(/\\\\/g,"\\"));try{return e=decodeURIComponent(e.replace(o," ")),u.json?JSON.parse(e):e}catch(t){}}function s(t,n){var r=u.raw?t:i(t);return e.isFunction(n)?n(r):r}var o=/\+/g,u=e.cookie=function(i,o,l){if(void 0!==o&&!e.isFunction(o)){if(l=e.extend({},u.defaults,l),"number"==typeof l.expires){var p=l.expires,v=l.expires=new Date;v.setTime(+v+864e5*p)}return document.cookie=[t(i),"=",r(o),l.expires?"; expires="+l.expires.toUTCString():"",l.path?"; path="+l.path:"",l.domain?"; domain="+l.domain:"",l.secure?"; secure":""].join("")}for(var m=i?void 0:{},g=document.cookie?document.cookie.split("; "):[],y=0,w=g.length;w>y;y++){var E=g[y].split("="),S=n(E.shift()),x=E.join("=");if(i&&i===S){m=s(x,o);break}i||void 0===(x=s(x))||(m[S]=x)}return m};u.defaults={},e.removeCookie=function(t,n){return void 0===e.cookie(t)?!1:(e.cookie(t,"",e.extend({},n,{expires:-1})),!e.cookie(t))}}),function(e,t,n,r){"use strict";var i=i||!1;Foundation.libs.joyride={name:"joyride",version:"5.3.3",defaults:{expose:!1,modal:!0,keyboard:!0,tip_location:"bottom",nub_position:"auto",scroll_speed:1500,scroll_animation:"linear",timer:0,start_timer_on_click:!0,start_offset:0,next_button:!0,prev_button:!0,tip_animation:"fade",pause_after:[],exposed:[],tip_animation_fade_speed:300,cookie_monster:!1,cookie_name:"joyride",cookie_domain:!1,cookie_expires:365,tip_container:"body",abort_on_close:!0,tip_location_patterns:{top:["bottom"],bottom:[],left:["right","top","bottom"],right:["left","top","bottom"]},post_ride_callback:function(){},post_step_callback:function(){},pre_step_callback:function(){},pre_ride_callback:function(){},post_expose_callback:function(){},template:{link:'×',timer:'
    ',tip:'
    ',wrapper:'
    ',button:'',prev_button:'',modal:'
    ',expose:'
    ',expose_cover:'
    '},expose_add_class:""},init:function(t,n,r){Foundation.inherit(this,"throttle random_str"),this.settings=this.settings||e.extend({},this.defaults,r||n),this.bindings(n,r)},go_next:function(){this.settings.$li.next().length<1?this.end():this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(),this.startTimer()):(this.hide(),this.show())},go_prev:function(){this.settings.$li.prev().length<1||(this.settings.timer>0?(clearTimeout(this.settings.automate),this.hide(),this.show(null,!0),this.startTimer()):(this.hide(),this.show(null,!0)))},events:function(){var n=this;e(this.scope).off(".joyride").on("click.fndtn.joyride",".joyride-next-tip, .joyride-modal-bg",function(e){e.preventDefault(),this.go_next()}.bind(this)).on("click.fndtn.joyride",".joyride-prev-tip",function(e){e.preventDefault(),this.go_prev()}.bind(this)).on("click.fndtn.joyride",".joyride-close-tip",function(e){e.preventDefault(),this.end(this.settings.abort_on_close)}.bind(this)).on("keyup.joyride",function(e){if(!this.settings.keyboard)return;switch(e.which){case 39:e.preventDefault(),this.go_next();break;case 37:e.preventDefault(),this.go_prev();break;case 27:e.preventDefault(),this.end(this.settings.abort_on_close)}}.bind(this)),e(t).off(".joyride").on("resize.fndtn.joyride",n.throttle(function(){if(e("["+n.attr_name()+"]").length>0&&n.settings.$next_tip&&n.settings.riding){if(n.settings.exposed.length>0){var t=e(n.settings.exposed);t.each(function(){var t=e(this);n.un_expose(t),n.expose(t)})}n.is_phone()?n.pos_phone():n.pos_default(!1)}},100))},start:function(){var t=this,n=e("["+this.attr_name()+"]",this.scope),r=["timer","scrollSpeed","startOffset","tipAnimationFadeSpeed","cookieExpires"],i=r.length;if(!n.length>0)return;this.settings.init||this.events(),this.settings=n.data(this.attr_name(!0)+"-init"),this.settings.$content_el=n,this.settings.$body=e(this.settings.tip_container),this.settings.body_offset=e(this.settings.tip_container).position(),this.settings.$tip_content=this.settings.$content_el.find("> li"),this.settings.paused=!1,this.settings.attempts=0,this.settings.riding=!0,typeof e.cookie!="function"&&(this.settings.cookie_monster=!1);if(!this.settings.cookie_monster||this.settings.cookie_monster&&!e.cookie(this.settings.cookie_name))this.settings.$tip_content.each(function(n){var s=e(this);this.settings=e.extend({},t.defaults,t.data_options(s));var o=i;while(o--)t.settings[r[o]]=parseInt(t.settings[r[o]],10);t.create({$li:s,index:n})}),!this.settings.start_timer_on_click&&this.settings.timer>0?(this.show("init"),this.startTimer()):this.show("init")},resume:function(){this.set_li(),this.show()},tip_template:function(t){var n,r;return t.tip_class=t.tip_class||"",n=e(this.settings.template.tip).addClass(t.tip_class),r=e.trim(e(t.li).html())+this.prev_button_text(t.prev_button_text,t.index)+this.button_text(t.button_text)+this.settings.template.link+this.timer_instance(t.index),n.append(e(this.settings.template.wrapper)),n.first().attr(this.add_namespace("data-index"),t.index),e(".joyride-content-wrapper",n).append(r),n[0]},timer_instance:function(t){var n;return t===0&&this.settings.start_timer_on_click&&this.settings.timer>0||this.settings.timer===0?n="":n=e(this.settings.template.timer)[0].outerHTML,n},button_text:function(t){return this.settings.tip_settings.next_button?(t=e.trim(t)||"Next",t=e(this.settings.template.button).append(t)[0].outerHTML):t="",t},prev_button_text:function(t,n){return this.settings.tip_settings.prev_button?(t=e.trim(t)||"Previous",n==0?t=e(this.settings.template.prev_button).append(t).addClass("disabled")[0].outerHTML:t=e(this.settings.template.prev_button).append(t)[0].outerHTML):t="",t},create:function(t){this.settings.tip_settings=e.extend({},this.settings,this.data_options(t.$li));var n=t.$li.attr(this.add_namespace("data-button"))||t.$li.attr(this.add_namespace("data-text")),r=t.$li.attr(this.add_namespace("data-button-prev"))||t.$li.attr(this.add_namespace("data-prev-text")),i=t.$li.attr("class"),s=e(this.tip_template({tip_class:i,index:t.index,button_text:n,prev_button_text:r,li:t.$li}));e(this.settings.tip_container).append(s)},show:function(t,n){var i=null;this.settings.$li===r||e.inArray(this.settings.$li.index(),this.settings.pause_after)===-1?(this.settings.paused?this.settings.paused=!1:this.set_li(t,n),this.settings.attempts=0,this.settings.$li.length&&this.settings.$target.length>0?(t&&(this.settings.pre_ride_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.show_modal()),this.settings.pre_step_callback(this.settings.$li.index(),this.settings.$next_tip),this.settings.modal&&this.settings.expose&&this.expose(),this.settings.tip_settings=e.extend({},this.settings,this.data_options(this.settings.$li)),this.settings.timer=parseInt(this.settings.timer,10),this.settings.tip_settings.tip_location_pattern=this.settings.tip_location_patterns[this.settings.tip_settings.tip_location],/body/i.test(this.settings.$target.selector)||this.scroll_to(),this.is_phone()?this.pos_phone(!0):this.pos_default(!0),i=this.settings.$next_tip.find(".joyride-timer-indicator"),/pop/i.test(this.settings.tip_animation)?(i.width(0),this.settings.timer>0?(this.settings.$next_tip.show(),setTimeout(function(){i.animate({width:i.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fade_speed)):this.settings.$next_tip.show()):/fade/i.test(this.settings.tip_animation)&&(i.width(0),this.settings.timer>0?(this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed).show(),setTimeout(function(){i.animate({width:i.parent().width()},this.settings.timer,"linear")}.bind(this),this.settings.tip_animation_fade_speed)):this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed)),this.settings.$current_tip=this.settings.$next_tip):this.settings.$li&&this.settings.$target.length<1?this.show():this.end()):this.settings.paused=!0},is_phone:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},hide:function(){this.settings.modal&&this.settings.expose&&this.un_expose(),this.settings.modal||e(".joyride-modal-bg").hide(),this.settings.$current_tip.css("visibility","hidden"),setTimeout(e.proxy(function(){this.hide(),this.css("visibility","visible")},this.settings.$current_tip),0),this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip)},set_li:function(e,t){e?(this.settings.$li=this.settings.$tip_content.eq(this.settings.start_offset),this.set_next_tip(),this.settings.$current_tip=this.settings.$next_tip):(t?this.settings.$li=this.settings.$li.prev():this.settings.$li=this.settings.$li.next(),this.set_next_tip()),this.set_target()},set_next_tip:function(){this.settings.$next_tip=e(".joyride-tip-guide").eq(this.settings.$li.index()),this.settings.$next_tip.data("closed","")},set_target:function(){var t=this.settings.$li.attr(this.add_namespace("data-class")),r=this.settings.$li.attr(this.add_namespace("data-id")),i=function(){return r?e(n.getElementById(r)):t?e("."+t).first():e("body")};this.settings.$target=i()},scroll_to:function(){var n,r;n=e(t).height()/2,r=Math.ceil(this.settings.$target.offset().top-n+this.settings.$next_tip.outerHeight()),r!=0&&e("html, body").stop().animate({scrollTop:r},this.settings.scroll_speed,"swing")},paused:function(){return e.inArray(this.settings.$li.index()+1,this.settings.pause_after)===-1},restart:function(){this.hide(),this.settings.$li=r,this.show("init")},pos_default:function(e){var t=this.settings.$next_tip.find(".joyride-nub"),n=Math.ceil(t.outerWidth()/2),r=Math.ceil(t.outerHeight()/2),i=e||!1;i&&(this.settings.$next_tip.css("visibility","hidden"),this.settings.$next_tip.show());if(!/body/i.test(this.settings.$target.selector)){var s=this.settings.tip_settings.tipAdjustmentY?parseInt(this.settings.tip_settings.tipAdjustmentY):0,o=this.settings.tip_settings.tipAdjustmentX?parseInt(this.settings.tip_settings.tipAdjustmentX):0;this.bottom()?(this.rtl?this.settings.$next_tip.css({top:this.settings.$target.offset().top+r+this.settings.$target.outerHeight()+s,left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()+o}):this.settings.$next_tip.css({top:this.settings.$target.offset().top+r+this.settings.$target.outerHeight()+s,left:this.settings.$target.offset().left+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"top")):this.top()?(this.rtl?this.settings.$next_tip.css({top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-r+s,left:this.settings.$target.offset().left+this.settings.$target.outerWidth()-this.settings.$next_tip.outerWidth()}):this.settings.$next_tip.css({top:this.settings.$target.offset().top-this.settings.$next_tip.outerHeight()-r+s,left:this.settings.$target.offset().left+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"bottom")):this.right()?(this.settings.$next_tip.css({top:this.settings.$target.offset().top+s,left:this.settings.$target.outerWidth()+this.settings.$target.offset().left+n+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"left")):this.left()&&(this.settings.$next_tip.css({top:this.settings.$target.offset().top+s,left:this.settings.$target.offset().left-this.settings.$next_tip.outerWidth()-n+o}),this.nub_position(t,this.settings.tip_settings.nub_position,"right")),!this.visible(this.corners(this.settings.$next_tip))&&this.settings.attempts0&&arguments[0]instanceof e)i=arguments[0];else{if(!this.settings.$target||!!/body/i.test(this.settings.$target.selector))return!1;i=this.settings.$target}if(i.length<1)return t.console&&console.error("element not valid",i),!1;n=e(this.settings.template.expose),this.settings.$body.append(n),n.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),r=e(this.settings.template.expose_cover),s={zIndex:i.css("z-index"),position:i.css("position")},o=i.attr("class")==null?"":i.attr("class"),i.css("z-index",parseInt(n.css("z-index"))+1),s.position=="static"&&i.css("position","relative"),i.data("expose-css",s),i.data("orig-class",o),i.attr("class",o+" "+this.settings.expose_add_class),r.css({top:i.offset().top,left:i.offset().left,width:i.outerWidth(!0),height:i.outerHeight(!0)}),this.settings.modal&&this.show_modal(),this.settings.$body.append(r),n.addClass(u),r.addClass(u),i.data("expose",u),this.settings.post_expose_callback(this.settings.$li.index(),this.settings.$next_tip,i),this.add_exposed(i)},un_expose:function(){var n,r,i,s,o,u=!1;if(arguments.length>0&&arguments[0]instanceof e)r=arguments[0];else{if(!this.settings.$target||!!/body/i.test(this.settings.$target.selector))return!1;r=this.settings.$target}if(r.length<1)return t.console&&console.error("element not valid",r),!1;n=r.data("expose"),i=e("."+n),arguments.length>1&&(u=arguments[1]),u===!0?e(".joyride-expose-wrapper,.joyride-expose-cover").remove():i.remove(),s=r.data("expose-css"),s.zIndex=="auto"?r.css("z-index",""):r.css("z-index",s.zIndex),s.position!=r.css("position")&&(s.position=="static"?r.css("position",""):r.css("position",s.position)),o=r.data("orig-class"),r.attr("class",o),r.removeData("orig-classes"),r.removeData("expose"),r.removeData("expose-z-index"),this.remove_exposed(r)},add_exposed:function(t){this.settings.exposed=this.settings.exposed||[],t instanceof e||typeof t=="object"?this.settings.exposed.push(t[0]):typeof t=="string"&&this.settings.exposed.push(t)},remove_exposed:function(t){var n,r;t instanceof e?n=t[0]:typeof t=="string"&&(n=t),this.settings.exposed=this.settings.exposed||[],r=this.settings.exposed.length;while(r--)if(this.settings.exposed[r]==n){this.settings.exposed.splice(r,1);return}},center:function(){var n=e(t);return this.settings.$next_tip.css({top:(n.height()-this.settings.$next_tip.outerHeight())/2+n.scrollTop(),left:(n.width()-this.settings.$next_tip.outerWidth())/2+n.scrollLeft()}),!0},bottom:function(){return/bottom/i.test(this.settings.tip_settings.tip_location)},top:function(){return/top/i.test(this.settings.tip_settings.tip_location)},right:function(){return/right/i.test(this.settings.tip_settings.tip_location)},left:function(){return/left/i.test(this.settings.tip_settings.tip_location)},corners:function(n){var r=e(t),i=r.height()/2,s=Math.ceil(this.settings.$target.offset().top-i+this.settings.$next_tip.outerHeight()),o=r.width()+r.scrollLeft(),u=r.height()+s,a=r.height()+r.scrollTop(),f=r.scrollTop();return sa&&(a=u),[n.offset().topn.offset().left]},visible:function(e){var t=e.length;while(t--)if(e[t])return!1;return!0},nub_position:function(e,t,n){t==="auto"?e.addClass(n):e.addClass(t)},startTimer:function(){this.settings.$li.length?this.settings.automate=setTimeout(function(){this.hide(),this.show(),this.startTimer()}.bind(this),this.settings.timer):clearTimeout(this.settings.automate)},end:function(t){this.settings.cookie_monster&&e.cookie(this.settings.cookie_name,"ridden",{expires:this.settings.cookie_expires,domain:this.settings.cookie_domain}),this.settings.timer>0&&clearTimeout(this.settings.automate),this.settings.modal&&this.settings.expose&&this.un_expose(),e(this.scope).off("keyup.joyride"),this.settings.$next_tip.data("closed",!0),this.settings.riding=!1,e(".joyride-modal-bg").hide(),this.settings.$current_tip.hide();if(typeof t=="undefined"||t===!1)this.settings.post_step_callback(this.settings.$li.index(),this.settings.$current_tip),this.settings.post_ride_callback(this.settings.$li.index(),this.settings.$current_tip);e(".joyride-tip-guide").remove()},off:function(){e(this.scope).off(".joyride"),e(t).off(".joyride"),e(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"),e(".joyride-tip-guide, .joyride-modal-bg").remove(),clearTimeout(this.settings.automate),this.settings={}},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs["magellan-expedition"]={name:"magellan-expedition",version:"5.3.3",settings:{active_class:"active",threshold:0,destination_threshold:20,throttle_delay:30,fixed_top:0},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n)},events:function(){var n=this,r=n.S,i=n.settings;n.set_expedition_position(),r(n.scope).off(".magellan").on("click.fndtn.magellan","["+n.add_namespace("data-magellan-arrival")+'] a[href^="#"]',function(t){t.preventDefault();var r=e(this).closest("["+n.attr_name()+"]"),i=r.data("magellan-expedition-init"),s=this.hash.split("#").join(""),o=e("a[name='"+s+"']");o.length===0&&(o=e("#"+s));var u=o.offset().top-i.destination_threshold+1;u-=r.outerHeight(),e("html, body").stop().animate({scrollTop:u},700,"swing",function(){history.pushState?history.pushState(null,null,"#"+s):location.hash="#"+s})}).on("scroll.fndtn.magellan",n.throttle(this.check_for_arrivals.bind(this),i.throttle_delay)),e(t).on("resize.fndtn.magellan",n.throttle(this.set_expedition_position.bind(this),i.throttle_delay))},check_for_arrivals:function(){var e=this;e.update_arrivals(),e.update_expedition_positions()},set_expedition_position:function(){var t=this;e("["+this.attr_name()+"=fixed]",t.scope).each(function(n,r){var i=e(this),s=i.data("magellan-expedition-init"),o=i.attr("styles"),u,a;i.attr("style",""),u=i.offset().top+s.threshold,a=parseInt(i.data("magellan-fixed-top")),isNaN(a)||(t.settings.fixed_top=a),i.data(t.data_attr("magellan-top-offset"),u),i.attr("style",o)})},update_expedition_positions:function(){var n=this,r=e(t).scrollTop();e("["+this.attr_name()+"=fixed]",n.scope).each(function(){var t=e(this),i=t.data("magellan-expedition-init"),s=t.attr("style"),o=t.data("magellan-top-offset");if(r+n.settings.fixed_top>=o){var u=t.prev("["+n.add_namespace("data-magellan-expedition-clone")+"]");u.length===0&&(u=t.clone(),u.removeAttr(n.attr_name()),u.attr(n.add_namespace("data-magellan-expedition-clone"),""),t.before(u)),t.css({position:"fixed",top:i.fixed_top}).addClass("fixed")}else t.prev("["+n.add_namespace("data-magellan-expedition-clone")+"]").remove(),t.attr("style",s).css("position","").css("top","").removeClass("fixed")})},update_arrivals:function(){var n=this,r=e(t).scrollTop();e("["+this.attr_name()+"]",n.scope).each(function(){var t=e(this),i=t.data(n.attr_name(!0)+"-init"),s=n.offsets(t,r),o=t.find("["+n.add_namespace("data-magellan-arrival")+"]"),u=!1;s.each(function(e,r){if(r.viewport_offset>=r.top_offset){var s=t.find("["+n.add_namespace("data-magellan-arrival")+"]");return s.not(r.arrival).removeClass(i.active_class),r.arrival.addClass(i.active_class),u=!0,!0}}),u||o.removeClass(i.active_class)})},offsets:function(t,n){var r=this,i=t.data(r.attr_name(!0)+"-init"),s=n;return t.find("["+r.add_namespace("data-magellan-arrival")+"]").map(function(n,o){var u=e(this).data(r.data_attr("magellan-arrival")),a=e("["+r.add_namespace("data-magellan-destination")+"="+u+"]");if(a.length>0){var f=Math.floor(a.offset().top-i.destination_threshold-t.outerHeight());return{destination:a,arrival:e(this),top_offset:f,viewport_offset:s}}}).sort(function(e,t){return e.top_offsett.top_offset?1:0})},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},off:function(){this.S(this.scope).off(".magellan"),this.S(t).off(".magellan")},reflow:function(){var t=this;e("["+t.add_namespace("data-magellan-expedition-clone")+"]",t.scope).remove()}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.offcanvas={name:"offcanvas",version:"5.3.3",settings:{open_method:"move",close_on_click:!1},init:function(e,t,n){this.bindings(t,n)},events:function(){var e=this,t=e.S,n="",r="",i="";this.settings.open_method==="move"?(n="move-",r="right",i="left"):this.settings.open_method==="overlap_single"?(n="offcanvas-overlap-",r="right",i="left"):this.settings.open_method==="overlap"&&(n="offcanvas-overlap"),t(this.scope).off(".offcanvas").on("click.fndtn.offcanvas",".left-off-canvas-toggle",function(i){e.click_toggle_class(i,n+r),e.settings.open_method!=="overlap"&&t(".left-submenu").removeClass(n+r)}).on("click.fndtn.offcanvas",".left-off-canvas-menu a",function(i){var s=e.get_settings(i),o=t(this).parent();s.close_on_click&&!o.hasClass("has-submenu")&&!o.hasClass("back")?(e.hide.call(e,n+r,e.get_wrapper(i)),o.parent().removeClass(n+r)):t(this).parent().hasClass("has-submenu")?(i.preventDefault(),t(this).siblings(".left-submenu").toggleClass(n+r)):o.hasClass("back")&&(i.preventDefault(),o.parent().removeClass(n+r))}).on("click.fndtn.offcanvas",".right-off-canvas-toggle",function(r){e.click_toggle_class(r,n+i),e.settings.open_method!=="overlap"&&t(".right-submenu").removeClass(n+i)}).on("click.fndtn.offcanvas",".right-off-canvas-menu a",function(r){var s=e.get_settings(r),o=t(this).parent();s.close_on_click&&!o.hasClass("has-submenu")&&!o.hasClass("back")?(e.hide.call(e,n+i,e.get_wrapper(r)),o.parent().removeClass(n+i)):t(this).parent().hasClass("has-submenu")?(r.preventDefault(),t(this).siblings(".right-submenu").toggleClass(n+i)):o.hasClass("back")&&(r.preventDefault(),o.parent().removeClass(n+i))}).on("click.fndtn.offcanvas",".exit-off-canvas",function(s){e.click_remove_class(s,n+i),t(".right-submenu").removeClass(n+i),r&&(e.click_remove_class(s,n+r),t(".left-submenu").removeClass(n+i))})},toggle:function(e,t){t=t||this.get_wrapper(),t.is("."+e)?this.hide(e,t):this.show(e,t)},show:function(e,t){t=t||this.get_wrapper(),t.trigger("open").trigger("open.fndtn.offcanvas"),t.addClass(e)},hide:function(e,t){t=t||this.get_wrapper(),t.trigger("close").trigger("close.fndtn.offcanvas"),t.removeClass(e)},click_toggle_class:function(e,t){e.preventDefault();var n=this.get_wrapper(e);this.toggle(t,n)},click_remove_class:function(e,t){e.preventDefault();var n=this.get_wrapper(e);this.hide(t,n)},get_settings:function(e){var t=this.S(e.target).closest("["+this.attr_name()+"]");return t.data(this.attr_name(!0)+"-init")||this.settings},get_wrapper:function(e){var t=this.S(e?e.target:this.scope).closest(".off-canvas-wrap");return t.length===0&&(t=this.S(".off-canvas-wrap")),t},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";function i(e){var t=/fade/i.test(e),n=/pop/i.test(e);return{animate:t||n,pop:n,fade:t}}Foundation.libs.reveal={name:"reveal",version:"5.3.3",locked:!1,settings:{animation:"fadeAndPop",animation_speed:250,close_on_background_click:!0,close_on_esc:!0,dismiss_modal_class:"close-reveal-modal",bg_class:"reveal-modal-bg",root_element:"body",open:function(){},opened:function(){},close:function(){},closed:function(){},bg:e(".reveal-modal-bg"),css:{open:{opacity:0,visibility:"visible",display:"block"},close:{opacity:1,visibility:"hidden",display:"none"}}},init:function(t,n,r){e.extend(!0,this.settings,n,r),this.bindings(n,r)},events:function(e){var t=this,r=t.S;return r(this.scope).off(".reveal").on("click.fndtn.reveal","["+this.add_namespace("data-reveal-id")+"]:not([disabled])",function(e){e.preventDefault();if(!t.locked){var n=r(this),i=n.data(t.data_attr("reveal-ajax"));t.locked=!0;if(typeof i=="undefined")t.open.call(t,n);else{var s=i===!0?n.attr("href"):i;t.open.call(t,n,{url:s})}}}),r(n).on("click.fndtn.reveal",this.close_targets(),function(e){e.preventDefault();if(!t.locked){var n=r("["+t.attr_name()+"].open").data(t.attr_name(!0)+"-init"),i=r(e.target)[0]===r("."+n.bg_class)[0];if(i){if(!n.close_on_background_click)return;e.stopPropagation()}t.locked=!0,t.close.call(t,i?r("["+t.attr_name()+"].open"):r(this).closest("["+t.attr_name()+"]"))}}),r("["+t.attr_name()+"]",this.scope).length>0?r(this.scope).on("open.fndtn.reveal",this.settings.open).on("opened.fndtn.reveal",this.settings.opened).on("opened.fndtn.reveal",this.open_video).on("close.fndtn.reveal",this.settings.close).on("closed.fndtn.reveal",this.settings.closed).on("closed.fndtn.reveal",this.close_video):r(this.scope).on("open.fndtn.reveal","["+t.attr_name()+"]",this.settings.open).on("opened.fndtn.reveal","["+t.attr_name()+"]",this.settings.opened).on("opened.fndtn.reveal","["+t.attr_name()+"]",this.open_video).on("close.fndtn.reveal","["+t.attr_name()+"]",this.settings.close).on("closed.fndtn.reveal","["+t.attr_name()+"]",this.settings.closed).on("closed.fndtn.reveal","["+t.attr_name()+"]",this.close_video),!0},key_up_on:function(e){var t=this;return t.S("body").off("keyup.fndtn.reveal").on("keyup.fndtn.reveal",function(e){var n=t.S("["+t.attr_name()+"].open"),r=n.data(t.attr_name(!0)+"-init")||t.settings;r&&e.which===27&&r.close_on_esc&&!t.locked&&t.close.call(t,n)}),!0},key_up_off:function(e){return this.S("body").off("keyup.fndtn.reveal"),!0},open:function(t,n){var r=this,i;t?typeof t.selector!="undefined"?i=r.S("#"+t.data(r.data_attr("reveal-id"))).first():(i=r.S(this.scope),n=t):i=r.S(this.scope);var s=i.data(r.attr_name(!0)+"-init");s=s||this.settings;if(i.hasClass("open")&&t.attr("data-reveal-id")==i.attr("id"))return r.close(i);if(!i.hasClass("open")){var o=r.S("["+r.attr_name()+"].open");typeof i.data("css-top")=="undefined"&&i.data("css-top",parseInt(i.css("top"),10)).data("offset",this.cache_offset(i)),this.key_up_on(i),i.trigger("open").trigger("open.fndtn.reveal"),o.length<1&&this.toggle_bg(i,!0),typeof n=="string"&&(n={url:n});if(typeof n=="undefined"||!n.url)o.length>0&&this.hide(o,s.css.close),this.show(i,s.css.open);else{var u=typeof n.success!="undefined"?n.success:null;e.extend(n,{success:function(t,n,a){e.isFunction(u)&&u(t,n,a),i.html(t),r.S(i).foundation("section","reflow"),r.S(i).children().foundation(),o.length>0&&r.hide(o,s.css.close),r.show(i,s.css.open)}}),e.ajax(n)}}},close:function(e){var e=e&&e.length?e:this.S(this.scope),t=this.S("["+this.attr_name()+"].open"),n=e.data(this.attr_name(!0)+"-init")||this.settings;t.length>0&&(this.locked=!0,this.key_up_off(e),e.trigger("close").trigger("close.fndtn.reveal"),this.toggle_bg(e,!1),this.hide(t,n.css.close,n))},close_targets:function(){var e="."+this.settings.dismiss_modal_class;return this.settings.close_on_background_click?e+", ."+this.settings.bg_class:e},toggle_bg:function(t,n){this.S("."+this.settings.bg_class).length===0&&(this.settings.bg=e("
    ",{"class":this.settings.bg_class}).appendTo("body").hide());var i=this.settings.bg.filter(":visible").length>0;n!=i&&((n==r?i:!n)?this.hide(this.settings.bg):this.show(this.settings.bg))},show:function(n,r){if(r){var s=n.data(this.attr_name(!0)+"-init")||this.settings,o=s.root_element;if(n.parent(o).length===0){var u=n.wrap('
    ').parent();n.on("closed.fndtn.reveal.wrapped",function(){n.detach().appendTo(u),n.unwrap().unbind("closed.fndtn.reveal.wrapped")}),n.detach().appendTo(o)}var a=i(s.animation);a.animate||(this.locked=!1);if(a.pop){r.top=e(t).scrollTop()-n.data("offset")+"px";var f={top:e(t).scrollTop()+n.data("css-top")+"px",opacity:1};return setTimeout(function(){return n.css(r).animate(f,s.animation_speed,"linear",function(){this.locked=!1,n.trigger("opened").trigger("opened.fndtn.reveal")}.bind(this)).addClass("open")}.bind(this),s.animation_speed/2)}if(a.fade){r.top=e(t).scrollTop()+n.data("css-top")+"px";var f={opacity:1};return setTimeout(function(){return n.css(r).animate(f,s.animation_speed,"linear",function(){this.locked=!1,n.trigger("opened").trigger("opened.fndtn.reveal")}.bind(this)).addClass("open")}.bind(this),s.animation_speed/2)}return n.css(r).show().css({opacity:1}).addClass("open").trigger("opened").trigger("opened.fndtn.reveal")}var s=this.settings;return i(s.animation).fade?n.fadeIn(s.animation_speed/2):(this.locked=!1,n.show())},hide:function(n,r){if(r){var s=n.data(this.attr_name(!0)+"-init");s=s||this.settings;var o=i(s.animation);o.animate||(this.locked=!1);if(o.pop){var u={top -:-e(t).scrollTop()-n.data("offset")+"px",opacity:0};return setTimeout(function(){return n.animate(u,s.animation_speed,"linear",function(){this.locked=!1,n.css(r).trigger("closed").trigger("closed.fndtn.reveal")}.bind(this)).removeClass("open")}.bind(this),s.animation_speed/2)}if(o.fade){var u={opacity:0};return setTimeout(function(){return n.animate(u,s.animation_speed,"linear",function(){this.locked=!1,n.css(r).trigger("closed").trigger("closed.fndtn.reveal")}.bind(this)).removeClass("open")}.bind(this),s.animation_speed/2)}return n.hide().css(r).removeClass("open").trigger("closed").trigger("closed.fndtn.reveal")}var s=this.settings;return i(s.animation).fade?n.fadeOut(s.animation_speed/2):n.hide()},close_video:function(t){var n=e(".flex-video",t.target),r=e("iframe",n);r.length>0&&(r.attr("data-src",r[0].src),r.attr("src",r.attr("src")),n.hide())},open_video:function(t){var n=e(".flex-video",t.target),i=n.find("iframe");if(i.length>0){var s=i.attr("data-src");if(typeof s=="string")i[0].src=i.attr("data-src");else{var o=i[0].src;i[0].src=r,i[0].src=o}n.show()}},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},cache_offset:function(e){var t=e.show().height()+parseInt(e.css("top"),10);return e.hide(),t},off:function(){e(this.scope).off(".fndtn.reveal")},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.slider={name:"slider",version:"5.3.3",settings:{start:0,end:100,step:1,initial:null,display_selector:"",vertical:!1,on_change:function(){}},cache:{},init:function(e,t,n){Foundation.inherit(this,"throttle"),this.bindings(t,n),this.reflow()},events:function(){var n=this;e(this.scope).off(".slider").on("mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider","["+n.attr_name()+"]:not(.disabled, [disabled]) .range-slider-handle",function(t){n.cache.active||(t.preventDefault(),n.set_active_slider(e(t.target)))}).on("mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider",function(r){if(!!n.cache.active){r.preventDefault();if(e.data(n.cache.active[0],"settings").vertical){var i=0;r.pageY||(i=t.scrollY),n.calculate_position(n.cache.active,(r.pageY||r.originalEvent.clientY||r.originalEvent.touches[0].clientY||r.currentPoint.y)+i)}else n.calculate_position(n.cache.active,r.pageX||r.originalEvent.clientX||r.originalEvent.touches[0].clientX||r.currentPoint.x)}}).on("mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider",function(e){n.remove_active_slider()}).on("change.fndtn.slider",function(e){n.settings.on_change()}),n.S(t).on("resize.fndtn.slider",n.throttle(function(e){n.reflow()},300))},set_active_slider:function(e){this.cache.active=e},remove_active_slider:function(){this.cache.active=null},calculate_position:function(t,n){var r=this,i=e.data(t[0],"settings"),s=e.data(t[0],"handle_l"),o=e.data(t[0],"handle_o"),u=e.data(t[0],"bar_l"),a=e.data(t[0],"bar_o");requestAnimationFrame(function(){var e;Foundation.rtl&&!i.vertical?e=r.limit_to((a+u-n)/u,0,1):e=r.limit_to((n-a)/u,0,1),e=i.vertical?1-e:e;var s=r.normalized_value(e,i.start,i.end,i.step);r.set_ui(t,s)})},set_ui:function(t,n){var r=e.data(t[0],"settings"),i=e.data(t[0],"handle_l"),s=e.data(t[0],"bar_l"),o=this.normalized_percentage(n,r.start,r.end),u=o*(s-i)-1,a=o*100;Foundation.rtl&&!r.vertical&&(u=-u),u=r.vertical?-u+s-i+1:u,this.set_translate(t,u,r.vertical),r.vertical?t.siblings(".range-slider-active-segment").css("height",a+"%"):t.siblings(".range-slider-active-segment").css("width",a+"%"),t.parent().attr(this.attr_name(),n).trigger("change").trigger("change.fndtn.slider"),t.parent().children("input[type=hidden]").val(n),r.input_id!=""&&e(r.display_selector).each(function(){this.hasOwnProperty("value")?e(this).val(n):e(this).text(n)})},normalized_percentage:function(e,t,n){return Math.min(1,(e-t)/(n-t))},normalized_value:function(e,t,n,r){var i=n-t,s=e*i,o=(s-s%r)/r,u=s%r,a=u>=r*.5?r:0;return o*r+a+t},set_translate:function(t,n,r){r?e(t).css("-webkit-transform","translateY("+n+"px)").css("-moz-transform","translateY("+n+"px)").css("-ms-transform","translateY("+n+"px)").css("-o-transform","translateY("+n+"px)").css("transform","translateY("+n+"px)"):e(t).css("-webkit-transform","translateX("+n+"px)").css("-moz-transform","translateX("+n+"px)").css("-ms-transform","translateX("+n+"px)").css("-o-transform","translateX("+n+"px)").css("transform","translateX("+n+"px)")},limit_to:function(e,t,n){return Math.min(Math.max(e,t),n)},initialize_settings:function(t){var n=e.extend({},this.settings,this.data_options(e(t).parent()));n.vertical?(e.data(t,"bar_o",e(t).parent().offset().top),e.data(t,"bar_l",e(t).parent().outerHeight()),e.data(t,"handle_o",e(t).offset().top),e.data(t,"handle_l",e(t).outerHeight())):(e.data(t,"bar_o",e(t).parent().offset().left),e.data(t,"bar_l",e(t).parent().outerWidth()),e.data(t,"handle_o",e(t).offset().left),e.data(t,"handle_l",e(t).outerWidth())),e.data(t,"bar",e(t).parent()),e.data(t,"settings",n)},set_initial_position:function(t){var n=e.data(t.children(".range-slider-handle")[0],"settings"),r=n.initial?n.initial:Math.floor((n.end-n.start)*.5/n.step)*n.step+n.start,i=t.children(".range-slider-handle");this.set_ui(i,r)},set_value:function(t){var n=this;e("["+n.attr_name()+"]",this.scope).each(function(){e(this).attr(n.attr_name(),t)}),!e(this.scope).attr(n.attr_name())||e(this.scope).attr(n.attr_name(),t),n.reflow()},reflow:function(){var t=this;t.S("["+this.attr_name()+"]").each(function(){var n=e(this).children(".range-slider-handle")[0],r=e(this).attr(t.attr_name());t.initialize_settings(n),r?t.set_ui(e(n),parseFloat(r)):t.set_initial_position(e(this))})}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.tab={name:"tab",version:"5.3.3",settings:{active_class:"active",callback:function(){},deep_linking:!1,scroll_to_content:!0,is_hover:!1},default_tab_hashes:[],init:function(e,t,n){var r=this,i=this.S;this.bindings(t,n),this.handle_location_hash_change(),i("["+this.attr_name()+"] > .active > a",this.scope).each(function(){r.default_tab_hashes.push(this.hash)})},events:function(){var e=this,n=this.S;n(this.scope).off(".tab").on("click.fndtn.tab","["+this.attr_name()+"] > * > a",function(t){var r=n(this).closest("["+e.attr_name()+"]").data(e.attr_name(!0)+"-init");if(!r.is_hover||Modernizr.touch)t.preventDefault(),t.stopPropagation(),e.toggle_active_tab(n(this).parent())}).on("mouseenter.fndtn.tab","["+this.attr_name()+"] > * > a",function(t){var r=n(this).closest("["+e.attr_name()+"]").data(e.attr_name(!0)+"-init");r.is_hover&&e.toggle_active_tab(n(this).parent())}),n(t).on("hashchange.fndtn.tab",function(t){t.preventDefault(),e.handle_location_hash_change()})},handle_location_hash_change:function(){var t=this,n=this.S;n("["+this.attr_name()+"]",this.scope).each(function(){var i=n(this).data(t.attr_name(!0)+"-init");if(i.deep_linking){var s=t.scope.location.hash;if(s!=""){var o=n(s);if(o.hasClass("content")&&o.parent().hasClass("tab-content"))t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href="+s+"]").parent());else{var u=o.closest(".content").attr("id");u!=r&&t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href=#"+u+"]").parent(),s)}}else for(var a in t.default_tab_hashes)t.toggle_active_tab(e("["+t.attr_name()+"] > * > a[href="+t.default_tab_hashes[a]+"]").parent())}})},toggle_active_tab:function(n,i){var s=this.S,o=n.closest("["+this.attr_name()+"]"),u=n.children("a").first(),a="#"+u.attr("href").split("#")[1],f=s(a),l=n.siblings(),c=o.data(this.attr_name(!0)+"-init");s(this).data(this.data_attr("tab-content"))&&(a="#"+s(this).data(this.data_attr("tab-content")).split("#")[1],f=s(a));if(c.deep_linking){var h=e("body,html").scrollTop();i!=r?t.location.hash=i:t.location.hash=a,c.scroll_to_content?i==r||i==a?n.parent()[0].scrollIntoView():s(a)[0].scrollIntoView():(i==r||i==a)&&e("body,html").scrollTop(h)}n.addClass(c.active_class).triggerHandler("opened"),l.removeClass(c.active_class),f.siblings().removeClass(c.active_class).end().addClass(c.active_class),c.callback(n),f.triggerHandler("toggled",[n]),o.triggerHandler("toggled",[f])},data_attr:function(e){return this.namespace.length>0?this.namespace+"-"+e:e},off:function(){},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.tooltip={name:"tooltip",version:"5.3.3",settings:{additional_inheritable_classes:[],tooltip_class:".tooltip",append_to:"body",touch_close_text:"Tap To Close",disable_for_touch:!1,hover_delay:200,show_on:"all",tip_template:function(e,t){return''+t+''}},cache:{},init:function(e,t,n){Foundation.inherit(this,"random_str"),this.bindings(t,n)},should_show:function(t,n){var r=e.extend({},this.settings,this.data_options(t));return r.show_on==="all"?!0:this.small()&&r.show_on==="small"?!0:this.medium()&&r.show_on==="medium"?!0:this.large()&&r.show_on==="large"?!0:!1},medium:function(){return matchMedia(Foundation.media_queries.medium).matches},large:function(){return matchMedia(Foundation.media_queries.large).matches},events:function(t){var n=this,r=n.S;n.create(this.S(t)),e(this.scope).off(".tooltip").on("mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip","["+this.attr_name()+"]",function(t){var i=r(this),s=e.extend({},n.settings,n.data_options(i)),o=!1;if(Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&r(t.target).is("a"))return!1;if(/mouse/i.test(t.type)&&n.ie_touch(t))return!1;if(i.hasClass("open"))Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&t.preventDefault(),n.hide(i);else{if(s.disable_for_touch&&Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type))return;!s.disable_for_touch&&Modernizr.touch&&/touchstart|MSPointerDown/i.test(t.type)&&(t.preventDefault(),r(s.tooltip_class+".open").hide(),o=!0),/enter|over/i.test(t.type)?this.timer=setTimeout(function(){var e=n.showTip(i)}.bind(this),n.settings.hover_delay):t.type==="mouseout"||t.type==="mouseleave"?(clearTimeout(this.timer),n.hide(i)):n.showTip(i)}}).on("mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip","["+this.attr_name()+"].open",function(t){if(/mouse/i.test(t.type)&&n.ie_touch(t))return!1;if(e(this).data("tooltip-open-event-type")=="touch"&&t.type=="mouseleave")return;e(this).data("tooltip-open-event-type")=="mouse"&&/MSPointerDown|touchstart/i.test(t.type)?n.convert_to_touch(e(this)):n.hide(e(this))}).on("DOMNodeRemoved DOMAttrModified","["+this.attr_name()+"]:not(a)",function(e){n.hide(r(this))})},ie_touch:function(e){return!1},showTip:function(e){var t=this.getTip(e);if(this.should_show(e,t))return this.show(e);return},getTip:function(t){var n=this.selector(t),r=e.extend({},this.settings,this.data_options(t)),i=null;return n&&(i=this.S('span[data-selector="'+n+'"]'+r.tooltip_class)),typeof i=="object"?i:!1},selector:function(e){var t=e.attr("id"),n=e.attr(this.attr_name())||e.attr("data-selector");return(t&&t.length<1||!t)&&typeof n!="string"&&(n=this.random_str(6),e.attr("data-selector",n)),t&&t.length>0?t:n},create:function(n){var r=this,i=e.extend({},this.settings,this.data_options(n)),s=this.settings.tip_template;typeof i.tip_template=="string"&&t.hasOwnProperty(i.tip_template)&&(s=t[i.tip_template]);var o=e(s(this.selector(n),e("
    ").html(n.attr("title")).html())),u=this.inheritable_classes(n);o.addClass(u).appendTo(i.append_to),Modernizr.touch&&(o.append(''+i.touch_close_text+""),o.on("touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip",function(e){r.hide(n)})),n.removeAttr("title").attr("title","")},reposition:function(t,n,r){var i,s,o,u,a,f;n.css("visibility","hidden").show(),i=t.data("width"),s=n.children(".nub"),o=s.outerHeight(),u=s.outerHeight(),this.small()?n.css({width:"100%"}):n.css({width:i?i:"auto"}),f=function(e,t,n,r,i,s){return e.css({top:t?t:"auto",bottom:r?r:"auto",left:i?i:"auto",right:n?n:"auto"}).end()},f(n,t.offset().top+t.outerHeight()+10,"auto","auto",t.offset().left);if(this.small())f(n,t.offset().top+t.outerHeight()+10,"auto","auto",12.5,e(this.scope).width()),n.addClass("tip-override"),f(s,-o,"auto","auto",t.offset().left);else{var l=t.offset().left;Foundation.rtl&&(s.addClass("rtl"),l=t.offset().left+t.outerWidth()-n.outerWidth()),f(n,t.offset().top+t.outerHeight()+10,"auto","auto",l),n.removeClass("tip-override"),r&&r.indexOf("tip-top")>-1?(Foundation.rtl&&s.addClass("rtl"),f(n,t.offset().top-n.outerHeight(),"auto","auto",l).removeClass("tip-override")):r&&r.indexOf("tip-left")>-1?(f(n,t.offset().top+t.outerHeight()/2-n.outerHeight()/2,"auto","auto",t.offset().left-n.outerWidth()-o).removeClass("tip-override"),s.removeClass("rtl")):r&&r.indexOf("tip-right")>-1&&(f(n,t.offset().top+t.outerHeight()/2-n.outerHeight()/2,"auto","auto",t.offset().left+t.outerWidth()+o).removeClass("tip-override"),s.removeClass("rtl"))}n.css("visibility","visible").hide()},small:function(){return matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches},inheritable_classes:function(t){var n=e.extend({},this.settings,this.data_options(t)),r=["tip-top","tip-left","tip-bottom","tip-right","radius","round"].concat(n.additional_inheritable_classes),i=t.attr("class"),s=i?e.map(i.split(" "),function(t,n){if(e.inArray(t,r)!==-1)return t}).join(" "):"";return e.trim(s)},convert_to_touch:function(t){var n=this,r=n.getTip(t),i=e.extend({},n.settings,n.data_options(t));r.find(".tap-to-close").length===0&&(r.append(''+i.touch_close_text+""),r.on("click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose",function(e){n.hide(t)})),t.data("tooltip-open-event-type","touch")},show:function(e){var t=this.getTip(e);e.data("tooltip-open-event-type")=="touch"&&this.convert_to_touch(e),this.reposition(e,t,e.attr("class")),e.addClass("open"),t.fadeIn(150)},hide:function(e){var t=this.getTip(e);t.fadeOut(150,function(){t.find(".tap-to-close").remove(),t.off("click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose"),e.removeClass("open")})},off:function(){var t=this;this.S(this.scope).off(".fndtn.tooltip"),this.S(this.settings.tooltip_class).each(function(n){e("["+t.attr_name()+"]").eq(n).attr("title",e(this).text())}).remove()},reflow:function(){}}}(jQuery,window,window.document),function(e,t,n,r){"use strict";Foundation.libs.topbar={name:"topbar",version:"5.3.3",settings:{index:0,sticky_class:"sticky",custom_back_text:!0,back_text:"Back",mobile_show_parent_link:!0,is_hover:!0,scrolltop:!0,sticky_on:"all"},init:function(t,n,r){Foundation.inherit(this,"add_custom_rule register_media throttle");var i=this;i.register_media("topbar","foundation-mq-topbar"),this.bindings(n,r),i.S("["+this.attr_name()+"]",this.scope).each(function(){var t=e(this),n=t.data(i.attr_name(!0)+"-init"),r=i.S("section, .top-bar-section",this);t.data("index",0);var s=t.parent();s.hasClass("fixed")||i.is_sticky(t,s,n)?(i.settings.sticky_class=n.sticky_class,i.settings.sticky_topbar=t,t.data("height",s.outerHeight()),t.data("stickyoffset",s.offset().top)):t.data("height",t.outerHeight()),n.assembled||i.assemble(t),n.is_hover?i.S(".has-dropdown",t).addClass("not-click"):i.S(".has-dropdown",t).removeClass("not-click"),i.add_custom_rule(".f-topbar-fixed { padding-top: "+t.data("height")+"px }"),s.hasClass("fixed")&&i.S("body").addClass("f-topbar-fixed")})},is_sticky:function(e,t,n){var r=t.hasClass(n.sticky_class);return r&&n.sticky_on==="all"?!0:r&&this.small()&&n.sticky_on==="small"?matchMedia(Foundation.media_queries.small).matches&&!matchMedia(Foundation.media_queries.medium).matches&&!matchMedia(Foundation.media_queries.large).matches:r&&this.medium()&&n.sticky_on==="medium"?matchMedia(Foundation.media_queries.small).matches&&matchMedia(Foundation.media_queries.medium).matches&&!matchMedia(Foundation.media_queries.large).matches:r&&this.large()&&n.sticky_on==="large"?matchMedia(Foundation.media_queries.small).matches&&matchMedia(Foundation.media_queries.medium).matches&&matchMedia(Foundation.media_queries.large).matches:!1},toggle:function(n){var r=this,i;n?i=r.S(n).closest("["+this.attr_name()+"]"):i=r.S("["+this.attr_name()+"]");var s=i.data(this.attr_name(!0)+"-init"),o=r.S("section, .top-bar-section",i);r.breakpoint()&&(r.rtl?(o.css({right:"0%"}),e(">.name",o).css({right:"100%"})):(o.css({left:"0%"}),e(">.name",o).css({left:"100%"})),r.S("li.moved",o).removeClass("moved"),i.data("index",0),i.toggleClass("expanded").css("height","")),s.scrolltop?i.hasClass("expanded")?i.parent().hasClass("fixed")&&(s.scrolltop?(i.parent().removeClass("fixed"),i.addClass("fixed"),r.S("body").removeClass("f-topbar-fixed"),t.scrollTo(0,0)):i.parent().removeClass("expanded")):i.hasClass("fixed")&&(i.parent().addClass("fixed"),i.removeClass("fixed"),r.S("body").addClass("f-topbar-fixed")):(r.is_sticky(i,i.parent(),s)&&i.parent().addClass("fixed"),i.parent().hasClass("fixed")&&(i.hasClass("expanded")?(i.addClass("fixed"),i.parent().addClass("expanded"),r.S("body").addClass("f-topbar-fixed")):(i.removeClass("fixed"),i.parent().removeClass("expanded"),r.update_sticky_positioning())))},timer:null,events:function(n){var r=this,i=this.S;i(this.scope).off(".topbar").on("click.fndtn.topbar","["+this.attr_name()+"] .toggle-topbar",function(e){e.preventDefault(),r.toggle(this)}).on("click.fndtn.topbar",'.top-bar .top-bar-section li a[href^="#"],['+this.attr_name()+'] .top-bar-section li a[href^="#"]',function(t){var n=e(this).closest("li");r.breakpoint()&&!n.hasClass("back")&&!n.hasClass("has-dropdown")&&r.toggle()}).on("click.fndtn.topbar","["+this.attr_name()+"] li.has-dropdown",function(t){var n=i(this),s=i(t.target),o=n.closest("["+r.attr_name()+"]"),u=o.data(r.attr_name(!0)+"-init");if(s.data("revealId")){r.toggle();return}if(r.breakpoint())return;if(u.is_hover&&!Modernizr.touch)return;t.stopImmediatePropagation(),n.hasClass("hover")?(n.removeClass("hover").find("li").removeClass("hover"),n.parents("li.hover").removeClass("hover")):(n.addClass("hover"),e(n).siblings().removeClass("hover"),s[0].nodeName==="A"&&s.parent().hasClass("has-dropdown")&&t.preventDefault())}).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown>a",function(e){if(r.breakpoint()){e.preventDefault();var t=i(this),n=t.closest("["+r.attr_name()+"]"),s=n.find("section, .top-bar-section"),o=t.next(".dropdown").outerHeight(),u=t.closest("li");n.data("index",n.data("index")+1),u.addClass("moved"),r.rtl?(s.css({right:-(100*n.data("index"))+"%"}),s.find(">.name").css({right:100*n.data("index")+"%"})):(s.css({left:-(100*n.data("index"))+"%"}),s.find(">.name").css({left:100*n.data("index")+"%"})),n.css("height",t.siblings("ul").outerHeight(!0)+n.data("height"))}}),i(t).off(".topbar").on("resize.fndtn.topbar",r.throttle(function(){r.resize.call(r)},50)).trigger("resize").trigger("resize.fndtn.topbar").load(function(){i(this).trigger("resize.fndtn.topbar")}),i("body").off(".topbar").on("click.fndtn.topbar",function(e){var t=i(e.target).closest("li").closest("li.hover");if(t.length>0)return;i("["+r.attr_name()+"] li.hover").removeClass("hover")}),i(this.scope).on("click.fndtn.topbar","["+this.attr_name()+"] .has-dropdown .back",function(e){e.preventDefault();var t=i(this),n=t.closest("["+r.attr_name()+"]"),s=n.find("section, .top-bar-section"),o=n.data(r.attr_name(!0)+"-init"),u=t.closest("li.moved"),a=u.parent();n.data("index",n.data("index")-1),r.rtl?(s.css({right:-(100*n.data("index"))+"%"}),s.find(">.name").css({right:100*n.data("index")+"%"})):(s.css({left:-(100*n.data("index"))+"%"}),s.find(">.name").css({left:100*n.data("index")+"%"})),n.data("index")===0?n.css("height",""):n.css("height",a.outerHeight(!0)+n.data("height")),setTimeout(function(){u.removeClass("moved")},300)})},resize:function(){var e=this;e.S("["+this.attr_name()+"]").each(function(){var t=e.S(this),r=t.data(e.attr_name(!0)+"-init"),i=t.parent("."+e.settings.sticky_class),s;if(!e.breakpoint()){var o=t.hasClass("expanded");t.css("height","").removeClass("expanded").find("li").removeClass("hover"),o&&e.toggle(t)}e.is_sticky(t,i,r)&&(i.hasClass("fixed")?(i.removeClass("fixed"),s=i.offset().top,e.S(n.body).hasClass("f-topbar-fixed")&&(s-=t.data("height")),t.data("stickyoffset",s),i.addClass("fixed")):(s=i.offset().top,t.data("stickyoffset",s)))})},breakpoint:function(){return!matchMedia(Foundation.media_queries.topbar).matches},small:function(){return matchMedia(Foundation.media_queries.small).matches},medium:function(){return matchMedia(Foundation.media_queries.medium).matches},large:function(){return matchMedia(Foundation.media_queries.large).matches},assemble:function(t){var n=this,r=t.data(this.attr_name(!0)+"-init"),i=n.S("section, .top-bar-section",t);i.detach(),n.S(".has-dropdown>a",i).each(function(){var t=n.S(this),i=t.siblings(".dropdown"),s=t.attr("href"),o;i.find(".title.back").length||(r.mobile_show_parent_link==1&&s?o=e('
  • "):o=e('
  • '),r.custom_back_text==1?e("h5>a",o).html(r.back_text):e("h5>a",o).html("« "+t.html()),i.prepend(o))}),i.appendTo(t),this.sticky(),this.assembled(t)},assembled:function(t){t.data(this.attr_name(!0),e.extend({},t.data(this.attr_name(!0)),{assembled:!0}))},height:function(t){var n=0,r=this;return e("> li",t).each(function(){n+=r.S(this).outerHeight(!0)}),n},sticky:function(){var e=this;this.S(t).on("scroll",function(){e.update_sticky_positioning()})},update_sticky_positioning:function(){var e="."+this.settings.sticky_class,n=this.S(t),r=this;if(r.settings.sticky_topbar&&r.is_sticky(this.settings.sticky_topbar,this.settings.sticky_topbar.parent(),this.settings)){var i=this.settings.sticky_topbar.data("stickyoffset");r.S(e).hasClass("expanded")||(n.scrollTop()>i?r.S(e).hasClass("fixed")||(r.S(e).addClass("fixed"),r.S("body").addClass("f-topbar-fixed")):n.scrollTop()<=i&&r.S(e).hasClass("fixed")&&(r.S(e).removeClass("fixed"),r.S("body").removeClass("f-topbar-fixed")))}},off:function(){this.S(this.scope).off(".fndtn.topbar"),this.S(t).off(".fndtn.topbar")},reflow:function(){}}}(jQuery,window,window.document); + */ +(function (e, t, n, r) { + "use strict"; + function l(e) { + if (typeof e == "string" || e instanceof String)e = e.replace(/^['\\/"]+|(;\s?})+|['\\/"]+$/g, ""); + return e + } + + var i = function (t) { + var n = t.length, r = e("head"); + while (n--)r.has("." + t[n]).length === 0 && r.append('') + }; + i(["foundation-mq-small", "foundation-mq-medium", "foundation-mq-large", "foundation-mq-xlarge", "foundation-mq-xxlarge", "foundation-data-attribute-namespace"]), e(function () { + typeof FastClick != "undefined" && typeof n.body != "undefined" && FastClick.attach(n.body) + }); + var s = function (t, r) { + if (typeof t == "string") { + if (r) { + var i; + if (r.jquery) { + i = r[0]; + if (!i)return r + } else i = r; + return e(i.querySelectorAll(t)) + } + return e(n.querySelectorAll(t)) + } + return e(t, r) + }, o = function (e) { + var t = []; + return e || t.push("data"), this.namespace.length > 0 && t.push(this.namespace), t.push(this.name), t.join("-") + }, u = function (e) { + var t = e.split("-"), n = t.length, r = []; + while (n--)n !== 0 ? r.push(t[n]) : this.namespace.length > 0 ? r.push(this.namespace, t[n]) : r.push(t[n]); + return r.reverse().join("-") + }, a = function (t, n) { + var r = this, i = !s(this).data(this.attr_name(!0)); + s(this.scope).is("[" + this.attr_name() + "]") ? (s(this.scope).data(this.attr_name(!0) + "-init", e.extend({}, this.settings, n || t, this.data_options(s(this.scope)))), i && this.events(this.scope)) : s("[" + this.attr_name() + "]", this.scope).each(function () { + var i = !s(this).data(r.attr_name(!0) + "-init"); + s(this).data(r.attr_name(!0) + "-init", e.extend({}, r.settings, n || t, r.data_options(s(this)))), i && r.events(this) + }); + if (typeof t == "string")return this[t].call(this, n) + }, f = function (e, t) { + function n() { + t(e[0]) + } + + function r() { + this.one("load", n); + if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { + var e = this.attr("src"), t = e.match(/\?/) ? "&" : "?"; + t += "random=" + (new Date).getTime(), this.attr("src", e + t) + } + } + + if (!e.attr("src")) { + n(); + return + } + e[0].complete || e[0].readyState === 4 ? n() : r.call(e) + }; + t.matchMedia = t.matchMedia || function (e) { + var t, n = e.documentElement, r = n.firstElementChild || n.firstChild, i = e.createElement("body"), s = e.createElement("div"); + return s.id = "mq-test-1", s.style.cssText = "position:absolute;top:-100em", i.style.background = "none", i.appendChild(s), function (e) { + return s.innerHTML = '­', n.insertBefore(i, r), t = s.offsetWidth === 42, n.removeChild(i), { + matches: t, + media: e + } + } + }(n), function (e) { + function a() { + n && (s(a), u && jQuery.fx.tick()) + } + + var n, r = 0, i = ["webkit", "moz"], s = t.requestAnimationFrame, o = t.cancelAnimationFrame, u = "undefined" != typeof jQuery.fx; + for (; r < i.length && !s; r++)s = t[i[r] + "RequestAnimationFrame"], o = o || t[i[r] + "CancelAnimationFrame"] || t[i[r] + "CancelRequestAnimationFrame"]; + s ? (t.requestAnimationFrame = s, t.cancelAnimationFrame = o, u && (jQuery.fx.timer = function (e) { + e() && jQuery.timers.push(e) && !n && (n = !0, a()) + }, jQuery.fx.stop = function () { + n = !1 + })) : (t.requestAnimationFrame = function (e) { + var n = (new Date).getTime(), i = Math.max(0, 16 - (n - r)), s = t.setTimeout(function () { + e(n + i) + }, i); + return r = n + i, s + }, t.cancelAnimationFrame = function (e) { + clearTimeout(e) + }) + }(jQuery), t.Foundation = { + name: "Foundation", + version: "5.3.3", + media_queries: { + small: s(".foundation-mq-small").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ""), + medium: s(".foundation-mq-medium").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ""), + large: s(".foundation-mq-large").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ""), + xlarge: s(".foundation-mq-xlarge").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, ""), + xxlarge: s(".foundation-mq-xxlarge").css("font-family").replace(/^[\/\\'"]+|(;\s?})+|[\/\\'"]+$/g, "") + }, + stylesheet: e("").appendTo("head")[0].sheet, + global: {namespace: r}, + init: function (e, n, r, i, o) { + var u = [e, r, i, o], a = []; + this.rtl = /rtl/i.test(s("html").attr("dir")), this.scope = e || this.scope, this.set_namespace(); + if (n && typeof n == "string" && !/reflow/i.test(n))this.libs.hasOwnProperty(n) && a.push(this.init_lib(n, u)); else for (var f in this.libs)a.push(this.init_lib(f, n)); + return s(t).load(function () { + s(t).trigger("resize.fndtn.clearing").trigger("resize.fndtn.dropdown").trigger("resize.fndtn.equalizer").trigger("resize.fndtn.interchange").trigger("resize.fndtn.joyride").trigger("resize.fndtn.magellan").trigger("resize.fndtn.topbar").trigger("resize.fndtn.slider") + }), e + }, + init_lib: function (t, n) { + return this.libs.hasOwnProperty(t) ? (this.patch(this.libs[t]), n && n.hasOwnProperty(t) ? (typeof this.libs[t].settings != "undefined" ? e.extend(!0, this.libs[t].settings, n[t]) : typeof this.libs[t].defaults != "undefined" && e.extend(!0, this.libs[t].defaults, n[t]), this.libs[t].init.apply(this.libs[t], [this.scope, n[t]])) : (n = n instanceof Array ? n : new Array(n), this.libs[t].init.apply(this.libs[t], n))) : function () { + } + }, + patch: function (e) { + e.scope = this.scope, e.namespace = this.global.namespace, e.rtl = this.rtl, e.data_options = this.utils.data_options, e.attr_name = o, e.add_namespace = u, e.bindings = a, e.S = this.utils.S + }, + inherit: function (e, t) { + var n = t.split(" "), r = n.length; + while (r--)this.utils.hasOwnProperty(n[r]) && (e[n[r]] = this.utils[n[r]]) + }, + set_namespace: function () { + var t = this.global.namespace === r ? e(".foundation-data-attribute-namespace").css("font-family") : this.global.namespace; + this.global.namespace = t === r || /false/i.test(t) ? "" : t + }, + libs: {}, + utils: { + S: s, throttle: function (e, t) { + var n = null; + return function () { + var r = this, i = arguments; + n == null && (n = setTimeout(function () { + e.apply(r, i), n = null + }, t)) + } + }, debounce: function (e, t, n) { + var r, i; + return function () { + var s = this, o = arguments, u = function () { + r = null, n || (i = e.apply(s, o)) + }, a = n && !r; + return clearTimeout(r), r = setTimeout(u, t), a && (i = e.apply(s, o)), i + } + }, data_options: function (t, n) { + function f(e) { + return !isNaN(e - 0) && e !== null && e !== "" && e !== !1 && e !== !0 + } + + function l(t) { + return typeof t == "string" ? e.trim(t) : t + } + + n = n || "options"; + var r = {}, i, s, o, u = function (e) { + var t = Foundation.global.namespace; + return t.length > 0 ? e.data(t + "-" + n) : e.data(n) + }, a = u(t); + if (typeof a == "object")return a; + o = (a || ":").split(";"), i = o.length; + while (i--)s = o[i].split(":"), s = [s[0], s.slice(1).join(":")], /true/i.test(s[1]) && (s[1] = !0), /false/i.test(s[1]) && (s[1] = !1), f(s[1]) && (s[1].indexOf(".") === -1 ? s[1] = parseInt(s[1], 10) : s[1] = parseFloat(s[1])), s.length === 2 && s[0].length > 0 && (r[l(s[0])] = l(s[1])); + return r + }, register_media: function (t, n) { + Foundation.media_queries[t] === r && (e("head").append(''), Foundation.media_queries[t] = l(e("." + n).css("font-family"))) + }, add_custom_rule: function (e, t) { + if (t === r && Foundation.stylesheet)Foundation.stylesheet.insertRule(e, Foundation.stylesheet.cssRules.length); else { + var n = Foundation.media_queries[t]; + n !== r && Foundation.stylesheet.insertRule("@media " + Foundation.media_queries[t] + "{ " + e + " }") + } + }, image_loaded: function (e, t) { + var n = this, r = e.length; + r === 0 && t(e), e.each(function () { + f(n.S(this), function () { + r -= 1, r === 0 && t(e) + }) + }) + }, random_str: function () { + return this.fidx || (this.fidx = 0), this.prefix = this.prefix || [this.name || "F", (+(new Date)).toString(36)].join("-"), this.prefix + (this.fidx++).toString(36) + } + } + }, e.fn.foundation = function () { + var e = Array.prototype.slice.call(arguments, 0); + return this.each(function () { + return Foundation.init.apply(Foundation, [this].concat(e)), this + }) + } +})(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.abide = { + name: "abide", + version: "5.3.3", + settings: { + live_validate: !0, + focus_on_invalid: !0, + error_labels: !0, + timeout: 1e3, + patterns: { + alpha: /^[a-zA-Z]+$/, + alpha_numeric: /^[a-zA-Z0-9]+$/, + integer: /^[-+]?\d+$/, + number: /^[-+]?\d*(?:[\.\,]\d+)?$/, + card: /^(?:4[0-9]{12}(?:[0-9]{3})?|5[1-5][0-9]{14}|6(?:011|5[0-9][0-9])[0-9]{12}|3[47][0-9]{13}|3(?:0[0-5]|[68][0-9])[0-9]{11}|(?:2131|1800|35\d{3})\d{11})$/, + cvv: /^([0-9]){3,4}$/, + email: /^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/, + url: /^(https?|ftp|file|ssh):\/\/(((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-zA-Z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-zA-Z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/, + domain: /^([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6}$/, + datetime: /^([0-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])T([0-5][0-9])\:([0-5][0-9])\:([0-5][0-9])(Z|([\-\+]([0-1][0-9])\:00))$/, + date: /(?:19|20)[0-9]{2}-(?:(?:0[1-9]|1[0-2])-(?:0[1-9]|1[0-9]|2[0-9])|(?:(?!02)(?:0[1-9]|1[0-2])-(?:30))|(?:(?:0[13578]|1[02])-31))$/, + time: /^(0[0-9]|1[0-9]|2[0-3])(:[0-5][0-9]){2}$/, + dateISO: /^\d{4}[\/\-]\d{1,2}[\/\-]\d{1,2}$/, + month_day_year: /^(0[1-9]|1[012])[- \/.](0[1-9]|[12][0-9]|3[01])[- \/.]\d{4}$/, + color: /^#?([a-fA-F0-9]{6}|[a-fA-F0-9]{3})$/ + }, + validators: { + equalTo: function (e, t, r) { + var i = n.getElementById(e.getAttribute(this.add_namespace("data-equalto"))).value, s = e.value, o = i === s; + return o + } + } + }, + timer: null, + init: function (e, t, n) { + this.bindings(t, n) + }, + events: function (t) { + var n = this, r = n.S(t).attr("novalidate", "novalidate"), i = r.data(this.attr_name(!0) + "-init") || {}; + this.invalid_attr = this.add_namespace("data-invalid"), r.off(".abide").on("submit.fndtn.abide validate.fndtn.abide", function (e) { + var t = /ajax/i.test(n.S(this).attr(n.attr_name())); + return n.validate(n.S(this).find("input, textarea, select").get(), e, t) + }).on("reset", function () { + return n.reset(e(this)) + }).find("input, textarea, select").off(".abide").on("blur.fndtn.abide change.fndtn.abide", function (e) { + n.validate([this], e) + }).on("keydown.fndtn.abide", function (e) { + i.live_validate === !0 && (clearTimeout(n.timer), n.timer = setTimeout(function () { + n.validate([this], e) + }.bind(this), i.timeout)) + }) + }, + reset: function (t) { + t.removeAttr(this.invalid_attr), e(this.invalid_attr, t).removeAttr(this.invalid_attr), e(".error", t).not("small").removeClass("error") + }, + validate: function (e, t, n) { + var r = this.parse_patterns(e), i = r.length, s = this.S(e[0]).closest("form"), o = /submit/.test(t.type); + for (var u = 0; u < i; u++)if (!r[u] && (o || n))return this.settings.focus_on_invalid && e[u].focus(), s.trigger("invalid"), this.S(e[u]).closest("form").attr(this.invalid_attr, ""), !1; + return (o || n) && s.trigger("valid"), s.removeAttr(this.invalid_attr), n ? !1 : !0 + }, + parse_patterns: function (e) { + var t = e.length, n = []; + while (t--)n.push(this.pattern(e[t])); + return this.check_validation_and_apply_styles(n) + }, + pattern: function (e) { + var t = e.getAttribute("type"), n = typeof e.getAttribute("required") == "string", r = e.getAttribute("pattern") || ""; + return this.settings.patterns.hasOwnProperty(r) && r.length > 0 ? [e, this.settings.patterns[r], n] : r.length > 0 ? [e, new RegExp(r), n] : this.settings.patterns.hasOwnProperty(t) ? [e, this.settings.patterns[t], n] : (r = /.*/, [e, r, n]) + }, + check_validation_and_apply_styles: function (t) { + var n = t.length, r = [], i = this.S(t[0][0]).closest("[data-" + this.attr_name(!0) + "]"), s = i.data(this.attr_name(!0) + "-init") || {}; + while (n--) { + var o = t[n][0], u = t[n][2], a = o.value.trim(), f = this.S(o).parent(), l = o.getAttribute(this.add_namespace("data-abide-validator")), c = o.type === "radio", h = o.type === "checkbox", p = this.S('label[for="' + o.getAttribute("id") + '"]'), d = u ? o.value.length > 0 : !0, v, m; + o.getAttribute(this.add_namespace("data-equalto")) && (l = "equalTo"), f.is("label") ? v = f.parent() : v = f, c && u ? r.push(this.valid_radio(o, u)) : h && u ? r.push(this.valid_checkbox(o, u)) : (l && (m = this.settings.validators[l].apply(this, [o, u, v]), r.push(m)), t[n][1].test(a) && d || !u && o.value.length < 1 || e(o).attr("disabled") ? r.push(!0) : r.push(!1), r = [r.every(function (e) { + return e + })], r[0] ? (this.S(o).removeAttr(this.invalid_attr), v.removeClass("error"), p.length > 0 && this.settings.error_labels && p.removeClass("error"), e(o).triggerHandler("valid")) : (v.addClass("error"), this.S(o).attr(this.invalid_attr, ""), p.length > 0 && this.settings.error_labels && p.addClass("error"), e(o).triggerHandler("invalid"))) + } + return r + }, + valid_checkbox: function (e, t) { + var e = this.S(e), n = e.is(":checked") || !t; + return n ? e.removeAttr(this.invalid_attr).parent().removeClass("error") : e.attr(this.invalid_attr, "").parent().addClass("error"), n + }, + valid_radio: function (e, t) { + var n = e.getAttribute("name"), r = this.S(e).closest("[data-" + this.attr_name(!0) + "]").find("[name='" + n + "']"), i = r.length, s = !1; + for (var o = 0; o < i; o++)r[o].checked && (s = !0); + for (var o = 0; o < i; o++)s ? this.S(r[o]).removeAttr(this.invalid_attr).parent().removeClass("error") : this.S(r[o]).attr(this.invalid_attr, "").parent().addClass("error"); + return s + }, + valid_equal: function (e, t, r) { + var i = n.getElementById(e.getAttribute(this.add_namespace("data-equalto"))).value, s = e.value, o = i === s; + return o ? (this.S(e).removeAttr(this.invalid_attr), r.removeClass("error")) : (this.S(e).attr(this.invalid_attr, ""), r.addClass("error")), o + }, + valid_oneof: function (e, t, n, r) { + var e = this.S(e), i = this.S("[" + this.add_namespace("data-oneof") + "]"), s = i.filter(":checked").length > 0; + s ? e.removeAttr(this.invalid_attr).parent().removeClass("error") : e.attr(this.invalid_attr, "").parent().addClass("error"); + if (!r) { + var o = this; + i.each(function () { + o.valid_oneof.call(o, this, null, null, !0) + }) + } + return s + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.equalizer = { + name: "equalizer", + version: "5.3.3", + settings: {use_tallest: !0, before_height_change: e.noop, after_height_change: e.noop, equalize_on_stack: !1}, + init: function (e, t, n) { + Foundation.inherit(this, "image_loaded"), this.bindings(t, n), this.reflow() + }, + events: function () { + this.S(t).off(".equalizer").on("resize.fndtn.equalizer", function (e) { + this.reflow() + }.bind(this)) + }, + equalize: function (t) { + var n = !1, r = t.find("[" + this.attr_name() + "-watch]:visible"), i = t.data(this.attr_name(!0) + "-init"); + if (r.length === 0)return; + var s = r.first().offset().top; + i.before_height_change(), t.trigger("before-height-change").trigger("before-height-change.fndth.equalizer"), r.height("inherit"), r.each(function () { + var t = e(this); + t.offset().top !== s && (n = !0) + }); + if (i.equalize_on_stack === !1 && n)return; + var o = r.map(function () { + return e(this).outerHeight(!1) + }).get(); + if (i.use_tallest) { + var u = Math.max.apply(null, o); + r.css("height", u) + } else { + var a = Math.min.apply(null, o); + r.css("height", a) + } + i.after_height_change(), t.trigger("after-height-change").trigger("after-height-change.fndtn.equalizer") + }, + reflow: function () { + var t = this; + this.S("[" + this.attr_name() + "]", this.scope).each(function () { + var n = e(this); + t.image_loaded(t.S("img", this), function () { + t.equalize(n) + }) + }) + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.interchange = { + name: "interchange", + version: "5.3.3", + cache: {}, + images_loaded: !1, + nodes_loaded: !1, + settings: { + load_attr: "interchange", + named_queries: { + "default": "only screen", + small: Foundation.media_queries.small, + medium: Foundation.media_queries.medium, + large: Foundation.media_queries.large, + xlarge: Foundation.media_queries.xlarge, + xxlarge: Foundation.media_queries.xxlarge, + landscape: "only screen and (orientation: landscape)", + portrait: "only screen and (orientation: portrait)", + retina: "only screen and (-webkit-min-device-pixel-ratio: 2),only screen and (min--moz-device-pixel-ratio: 2),only screen and (-o-min-device-pixel-ratio: 2/1),only screen and (min-device-pixel-ratio: 2),only screen and (min-resolution: 192dpi),only screen and (min-resolution: 2dppx)" + }, + directives: { + replace: function (t, n, r) { + if (/IMG/.test(t[0].nodeName)) { + var i = t[0].src; + if ((new RegExp(n, "i")).test(i))return; + return t[0].src = n, r(t[0].src) + } + var s = t.data(this.data_attr + "-last-path"), o = this; + if (s == n)return; + return /\.(gif|jpg|jpeg|tiff|png)([?#].*)?/i.test(n) ? (e(t).css("background-image", "url(" + n + ")"), t.data("interchange-last-path", n), r(n)) : e.get(n, function (e) { + t.html(e), t.data(o.data_attr + "-last-path", n), r() + }) + } + } + }, + init: function (t, n, r) { + Foundation.inherit(this, "throttle random_str"), this.data_attr = this.set_data_attr(), e.extend(!0, this.settings, n, r), this.bindings(n, r), this.load("images"), this.load("nodes") + }, + get_media_hash: function () { + var e = ""; + for (var t in this.settings.named_queries)e += matchMedia(this.settings.named_queries[t]).matches.toString(); + return e + }, + events: function () { + var n = this, r; + return e(t).off(".interchange").on("resize.fndtn.interchange", n.throttle(function () { + var e = n.get_media_hash(); + e !== r && n.resize(), r = e + }, 50)), this + }, + resize: function () { + var t = this.cache; + if (!this.images_loaded || !this.nodes_loaded) { + setTimeout(e.proxy(this.resize, this), 50); + return + } + for (var n in t)if (t.hasOwnProperty(n)) { + var r = this.results(n, t[n]); + r && this.settings.directives[r.scenario[1]].call(this, r.el, r.scenario[0], function () { + if (arguments[0]instanceof Array)var e = arguments[0]; else var e = Array.prototype.slice.call(arguments, 0); + r.el.trigger(r.scenario[1], e) + }) + } + }, + results: function (e, t) { + var n = t.length; + if (n > 0) { + var r = this.S("[" + this.add_namespace("data-uuid") + '="' + e + '"]'); + while (n--) { + var i, s = t[n][2]; + this.settings.named_queries.hasOwnProperty(s) ? i = matchMedia(this.settings.named_queries[s]) : i = matchMedia(s); + if (i.matches)return {el: r, scenario: t[n]} + } + } + return !1 + }, + load: function (e, t) { + return (typeof this["cached_" + e] == "undefined" || t) && this["update_" + e](), this["cached_" + e] + }, + update_images: function () { + var e = this.S("img[" + this.data_attr + "]"), t = e.length, n = t, r = 0, i = this.data_attr; + this.cache = {}, this.cached_images = [], this.images_loaded = t === 0; + while (n--) { + r++; + if (e[n]) { + var s = e[n].getAttribute(i) || ""; + s.length > 0 && this.cached_images.push(e[n]) + } + r === t && (this.images_loaded = !0, this.enhance("images")) + } + return this + }, + update_nodes: function () { + var e = this.S("[" + this.data_attr + "]").not("img"), t = e.length, n = t, r = 0, i = this.data_attr; + this.cached_nodes = [], this.nodes_loaded = t === 0; + while (n--) { + r++; + var s = e[n].getAttribute(i) || ""; + s.length > 0 && this.cached_nodes.push(e[n]), r === t && (this.nodes_loaded = !0, this.enhance("nodes")) + } + return this + }, + enhance: function (n) { + var r = this["cached_" + n].length; + while (r--)this.object(e(this["cached_" + n][r])); + return e(t).trigger("resize").trigger("resize.fndtn.interchange") + }, + convert_directive: function (e) { + var t = this.trim(e); + return t.length > 0 ? t : "replace" + }, + parse_scenario: function (e) { + var t = e[0].match(/(.+),\s*(\w+)\s*$/), n = e[1]; + if (t)var r = t[1], i = t[2]; else var s = e[0].split(/,\s*$/), r = s[0], i = ""; + return [this.trim(r), this.convert_directive(i), this.trim(n)] + }, + object: function (e) { + var t = this.parse_data_attr(e), n = [], r = t.length; + if (r > 0)while (r--) { + var i = t[r].split(/\((.*?)(\))$/); + if (i.length > 1) { + var s = this.parse_scenario(i); + n.push(s) + } + } + return this.store(e, n) + }, + store: function (e, t) { + var n = this.random_str(), r = e.data(this.add_namespace("uuid", !0)); + return this.cache[r] ? this.cache[r] : (e.attr(this.add_namespace("data-uuid"), n), this.cache[n] = t) + }, + trim: function (t) { + return typeof t == "string" ? e.trim(t) : t + }, + set_data_attr: function (e) { + return e ? this.namespace.length > 0 ? this.namespace + "-" + this.settings.load_attr : this.settings.load_attr : this.namespace.length > 0 ? "data-" + this.namespace + "-" + this.settings.load_attr : "data-" + this.settings.load_attr + }, + parse_data_attr: function (e) { + var t = e.attr(this.attr_name()).split(/\[(.*?)\]/), n = t.length, r = []; + while (n--)t[n].replace(/[\W\d]+/, "").length > 4 && r.push(t[n]); + return r + }, + reflow: function () { + this.load("images", !0), this.load("nodes", !0) + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.dropdown = { + name: "dropdown", + version: "5.3.3", + settings: { + active_class: "open", align: "bottom", is_hover: !1, opened: function () { + }, closed: function () { + } + }, + init: function (e, t, n) { + Foundation.inherit(this, "throttle"), this.bindings(t, n) + }, + events: function (n) { + var r = this, i = r.S; + i(this.scope).off(".dropdown").on("click.fndtn.dropdown", "[" + this.attr_name() + "]", function (t) { + var n = i(this).data(r.attr_name(!0) + "-init") || r.settings; + if (!n.is_hover || Modernizr.touch)t.preventDefault(), r.toggle(e(this)) + }).on("mouseenter.fndtn.dropdown", "[" + this.attr_name() + "], [" + this.attr_name() + "-content]", function (e) { + var t = i(this), n, s; + clearTimeout(r.timeout), t.data(r.data_attr()) ? (n = i("#" + t.data(r.data_attr())), s = t) : (n = t, s = i("[" + r.attr_name() + "='" + n.attr("id") + "']")); + var o = s.data(r.attr_name(!0) + "-init") || r.settings; + i(e.target).data(r.data_attr()) && o.is_hover && r.closeall.call(r), o.is_hover && r.open.apply(r, [n, s]) + }).on("mouseleave.fndtn.dropdown", "[" + this.attr_name() + "], [" + this.attr_name() + "-content]", function (e) { + var t = i(this); + r.timeout = setTimeout(function () { + if (t.data(r.data_attr())) { + var e = t.data(r.data_attr(!0) + "-init") || r.settings; + e.is_hover && r.close.call(r, i("#" + t.data(r.data_attr()))) + } else { + var n = i("[" + r.attr_name() + '="' + i(this).attr("id") + '"]'), e = n.data(r.attr_name(!0) + "-init") || r.settings; + e.is_hover && r.close.call(r, t) + } + }.bind(this), 150) + }).on("click.fndtn.dropdown", function (t) { + var n = i(t.target).closest("[" + r.attr_name() + "-content]"); + if (i(t.target).closest("[" + r.attr_name() + "]").length > 0)return; + if (!i(t.target).data("revealId") && n.length > 0 && (i(t.target).is("[" + r.attr_name() + "-content]") || e.contains(n.first()[0], t.target))) { + t.stopPropagation(); + return + } + r.close.call(r, i("[" + r.attr_name() + "-content]")) + }).on("opened.fndtn.dropdown", "[" + r.attr_name() + "-content]", function () { + r.settings.opened.call(this) + }).on("closed.fndtn.dropdown", "[" + r.attr_name() + "-content]", function () { + r.settings.closed.call(this) + }), i(t).off(".dropdown").on("resize.fndtn.dropdown", r.throttle(function () { + r.resize.call(r) + }, 50)), this.resize() + }, + close: function (e) { + var t = this; + e.each(function () { + t.S(this).hasClass(t.settings.active_class) && (t.S(this).css(Foundation.rtl ? "right" : "left", "-99999px").removeClass(t.settings.active_class).prev("[" + t.attr_name() + "]").removeClass(t.settings.active_class).removeData("target"), t.S(this).trigger("closed").trigger("closed.fndtn.dropdown", [e])) + }) + }, + closeall: function () { + var t = this; + e.each(t.S("[" + this.attr_name() + "-content]"), function () { + t.close.call(t, t.S(this)) + }) + }, + open: function (e, t) { + this.css(e.addClass(this.settings.active_class), t), e.prev("[" + this.attr_name() + "]").addClass(this.settings.active_class), e.data("target", t.get(0)).trigger("opened").trigger("opened.fndtn.dropdown", [e, t]) + }, + data_attr: function () { + return this.namespace.length > 0 ? this.namespace + "-" + this.name : this.name + }, + toggle: function (e) { + var t = this.S("#" + e.data(this.data_attr())); + if (t.length === 0)return; + this.close.call(this, this.S("[" + this.attr_name() + "-content]").not(t)), t.hasClass(this.settings.active_class) ? (this.close.call(this, t), t.data("target") !== e.get(0) && this.open.call(this, t, e)) : this.open.call(this, t, e) + }, + resize: function () { + var e = this.S("[" + this.attr_name() + "-content].open"), t = this.S("[" + this.attr_name() + "='" + e.attr("id") + "']"); + e.length && t.length && this.css(e, t) + }, + css: function (e, t) { + var n = Math.max((t.width() - e.width()) / 2, 8); + this.clear_idx(); + if (this.small()) { + var r = this.dirs.bottom.call(e, t); + e.attr("style", "").removeClass("drop-left drop-right drop-top").css({ + position: "absolute", + width: "95%", + "max-width": "none", + top: r.top + }), e.css(Foundation.rtl ? "right" : "left", n) + } else { + var i = t.data(this.attr_name(!0) + "-init") || this.settings; + this.style(e, t, i) + } + return e + }, + style: function (t, n, r) { + var i = e.extend({position: "absolute"}, this.dirs[r.align].call(t, n, r)); + t.attr("style", "").css(i) + }, + dirs: { + _base: function (e) { + var t = this.offsetParent(), n = t.offset(), r = e.offset(); + return r.top -= n.top, r.left -= n.left, r + }, top: function (e, t) { + var n = Foundation.libs.dropdown, r = n.dirs._base.call(this, e), i = 8; + return this.addClass("drop-top"), (e.outerWidth() < this.outerWidth() || n.small()) && n.adjust_pip(i, r), Foundation.rtl ? { + left: r.left - this.outerWidth() + e.outerWidth(), + top: r.top - this.outerHeight() + } : {left: r.left, top: r.top - this.outerHeight()} + }, bottom: function (e, t) { + var n = Foundation.libs.dropdown, r = n.dirs._base.call(this, e), i = 8; + return (e.outerWidth() < this.outerWidth() || n.small()) && n.adjust_pip(i, r), n.rtl ? { + left: r.left - this.outerWidth() + e.outerWidth(), + top: r.top + e.outerHeight() + } : {left: r.left, top: r.top + e.outerHeight()} + }, left: function (e, t) { + var n = Foundation.libs.dropdown.dirs._base.call(this, e); + return this.addClass("drop-left"), {left: n.left - this.outerWidth(), top: n.top} + }, right: function (e, t) { + var n = Foundation.libs.dropdown.dirs._base.call(this, e); + return this.addClass("drop-right"), {left: n.left + e.outerWidth(), top: n.top} + } + }, + adjust_pip: function (e, t) { + var n = Foundation.stylesheet; + this.small() && (e += t.left - 8), this.rule_idx = n.cssRules.length; + var r = ".f-dropdown.open:before", i = ".f-dropdown.open:after", s = "left: " + e + "px;", o = "left: " + (e - 1) + "px;"; + n.insertRule ? (n.insertRule([r, "{", s, "}"].join(" "), this.rule_idx), n.insertRule([i, "{", o, "}"].join(" "), this.rule_idx + 1)) : (n.addRule(r, s, this.rule_idx), n.addRule(i, o, this.rule_idx + 1)) + }, + clear_idx: function () { + var e = Foundation.stylesheet; + this.rule_idx && (e.deleteRule(this.rule_idx), e.deleteRule(this.rule_idx), delete this.rule_idx) + }, + small: function () { + return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches + }, + off: function () { + this.S(this.scope).off(".fndtn.dropdown"), this.S("html, body").off(".fndtn.dropdown"), this.S(t).off(".fndtn.dropdown"), this.S("[data-dropdown-content]").off(".fndtn.dropdown") + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.accordion = { + name: "accordion", + version: "5.3.3", + settings: { + active_class: "active", multi_expand: !1, toggleable: !0, callback: function () { + } + }, + init: function (e, t, n) { + this.bindings(t, n) + }, + events: function () { + var t = this, n = this.S; + n(this.scope).off(".fndtn.accordion").on("click.fndtn.accordion", "[" + this.attr_name() + "] > dd > a", function (r) { + var i = n(this).closest("[" + t.attr_name() + "]"), s = t.attr_name() + "=" + i.attr(t.attr_name()), o = i.data(t.attr_name(!0) + "-init"), u = n("#" + this.href.split("#")[1]), a = e("> dd", i), f = a.children(".content"), l = f.filter("." + o.active_class); + r.preventDefault(), i.attr(t.attr_name()) && (f = f.add("[" + s + "] dd > .content"), a = a.add("[" + s + "] dd")); + if (o.toggleable && u.is(l)) { + u.parent("dd").toggleClass(o.active_class, !1), u.toggleClass(o.active_class, !1), o.callback(u), u.triggerHandler("toggled", [i]), i.triggerHandler("toggled", [u]); + return + } + o.multi_expand || (f.removeClass(o.active_class), a.removeClass(o.active_class)), u.addClass(o.active_class).parent().addClass(o.active_class), o.callback(u), u.triggerHandler("toggled", [i]), i.triggerHandler("toggled", [u]) + }) + }, + off: function () { + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.alert = { + name: "alert", version: "5.3.3", settings: { + callback: function () { + } + }, init: function (e, t, n) { + this.bindings(t, n) + }, events: function () { + var t = this, n = this.S; + e(this.scope).off(".alert").on("click.fndtn.alert", "[" + this.attr_name() + "] a.close", function (e) { + var r = n(this).closest("[" + t.attr_name() + "]"), i = r.data(t.attr_name(!0) + "-init") || t.settings; + e.preventDefault(), Modernizr.csstransitions ? (r.addClass("alert-close"), r.on("transitionend webkitTransitionEnd oTransitionEnd", function (e) { + n(this).trigger("close").trigger("close.fndtn.alert").remove(), i.callback() + })) : r.fadeOut(300, function () { + n(this).trigger("close").trigger("close.fndtn.alert").remove(), i.callback() + }) + }) + }, reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.clearing = { + name: "clearing", + version: "5.3.3", + settings: { + templates: {viewing: '×'}, + close_selectors: ".clearing-close, div.clearing-blackout", + open_selectors: "", + skip_selector: "", + touch_label: "", + init: !1, + locked: !1 + }, + init: function (e, t, n) { + var r = this; + Foundation.inherit(this, "throttle image_loaded"), this.bindings(t, n), r.S(this.scope).is("[" + this.attr_name() + "]") ? this.assemble(r.S("li", this.scope)) : r.S("[" + this.attr_name() + "]", this.scope).each(function () { + r.assemble(r.S("li", this)) + }) + }, + events: function (r) { + var i = this, s = i.S, o = e(".scroll-container"); + o.length > 0 && (this.scope = o), s(this.scope).off(".clearing").on("click.fndtn.clearing", "ul[" + this.attr_name() + "] li " + this.settings.open_selectors, function (e, t, n) { + var t = t || s(this), n = n || t, r = t.next("li"), o = t.closest("[" + i.attr_name() + "]").data(i.attr_name(!0) + "-init"), u = s(e.target); + e.preventDefault(), o || (i.init(), o = t.closest("[" + i.attr_name() + "]").data(i.attr_name(!0) + "-init")), n.hasClass("visible") && t[0] === n[0] && r.length > 0 && i.is_open(t) && (n = r, u = s("img", n)), i.open(u, t, n), i.update_paddles(n) + }).on("click.fndtn.clearing", ".clearing-main-next", function (e) { + i.nav(e, "next") + }).on("click.fndtn.clearing", ".clearing-main-prev", function (e) { + i.nav(e, "prev") + }).on("click.fndtn.clearing", this.settings.close_selectors, function (e) { + Foundation.libs.clearing.close(e, this) + }), e(n).on("keydown.fndtn.clearing", function (e) { + i.keydown(e) + }), s(t).off(".clearing").on("resize.fndtn.clearing", function () { + i.resize() + }), this.swipe_events(r) + }, + swipe_events: function (e) { + var t = this, n = t.S; + n(this.scope).on("touchstart.fndtn.clearing", ".visible-img", function (e) { + e.touches || (e = e.originalEvent); + var t = { + start_page_x: e.touches[0].pageX, + start_page_y: e.touches[0].pageY, + start_time: (new Date).getTime(), + delta_x: 0, + is_scrolling: r + }; + n(this).data("swipe-transition", t), e.stopPropagation() + }).on("touchmove.fndtn.clearing", ".visible-img", function (e) { + e.touches || (e = e.originalEvent); + if (e.touches.length > 1 || e.scale && e.scale !== 1)return; + var r = n(this).data("swipe-transition"); + typeof r == "undefined" && (r = {}), r.delta_x = e.touches[0].pageX - r.start_page_x, Foundation.rtl && (r.delta_x = -r.delta_x), typeof r.is_scrolling == "undefined" && (r.is_scrolling = !!(r.is_scrolling || Math.abs(r.delta_x) < Math.abs(e.touches[0].pageY - r.start_page_y))); + if (!r.is_scrolling && !r.active) { + e.preventDefault(); + var i = r.delta_x < 0 ? "next" : "prev"; + r.active = !0, t.nav(e, i) + } + }).on("touchend.fndtn.clearing", ".visible-img", function (e) { + n(this).data("swipe-transition", {}), e.stopPropagation() + }) + }, + assemble: function (t) { + var n = t.parent(); + if (n.parent().hasClass("carousel"))return; + n.after('
    '); + var r = n.detach(), i = ""; + if (r[0] == null)return; + i = r[0].outerHTML; + var s = this.S("#foundationClearingHolder"), o = n.data(this.attr_name(!0) + "-init"), u = { + grid: '", + viewing: o.templates.viewing + }, a = '
    ' + u.viewing + u.grid + "
    ", f = this.settings.touch_label; + Modernizr.touch && (a = e(a).find(".clearing-touch-label").html(f).end()), s.after(a).remove() + }, + open: function (t, r, i) { + function p() { + setTimeout(function () { + this.image_loaded(l, function () { + l.outerWidth() === 1 && !h ? p.call(this) : d.call(this, l) + }.bind(this)) + }.bind(this), 100) + } + + function d(t) { + var n = e(t); + n.css("visibility", "visible"), o.css("overflow", "hidden"), u.addClass("clearing-blackout"), a.addClass("clearing-container"), f.show(), this.fix_height(i).caption(s.S(".clearing-caption", f), s.S("img", i)).center_and_label(t, c).shift(r, i, function () { + i.closest("li").siblings().removeClass("visible"), i.closest("li").addClass("visible") + }), f.trigger("opened.fndtn.clearing") + } + + var s = this, o = e(n.body), u = i.closest(".clearing-assembled"), a = s.S("div", u).first(), f = s.S(".visible-img", a), l = s.S("img", f).not(t), c = s.S(".clearing-touch-label", a), h = !1; + e("body").on("touchmove", function (e) { + e.preventDefault() + }), l.error(function () { + h = !0 + }), this.locked() || (f.trigger("open.fndtn.clearing"), l.attr("src", this.load(t)).css("visibility", "hidden"), p.call(this)) + }, + close: function (t, r) { + t.preventDefault(); + var i = function (e) { + return /blackout/.test(e.selector) ? e : e.closest(".clearing-blackout") + }(e(r)), s = e(n.body), o, u; + return r === t.target && i && (s.css("overflow", ""), o = e("div", i).first(), u = e(".visible-img", o), u.trigger("close.fndtn.clearing"), this.settings.prev_index = 0, e("ul[" + this.attr_name() + "]", i).attr("style", "").closest(".clearing-blackout").removeClass("clearing-blackout"), o.removeClass("clearing-container"), u.hide(), u.trigger("closed.fndtn.clearing")), e("body").off("touchmove"), !1 + }, + is_open: function (e) { + return e.parent().prop("style").length > 0 + }, + keydown: function (t) { + var n = e(".clearing-blackout ul[" + this.attr_name() + "]"), r = this.rtl ? 37 : 39, i = this.rtl ? 39 : 37, s = 27; + t.which === r && this.go(n, "next"), t.which === i && this.go(n, "prev"), t.which === s && this.S("a.clearing-close").trigger("click").trigger("click.fndtn.clearing") + }, + nav: function (t, n) { + var r = e("ul[" + this.attr_name() + "]", ".clearing-blackout"); + t.preventDefault(), this.go(r, n) + }, + resize: function () { + var t = e("img", ".clearing-blackout .visible-img"), n = e(".clearing-touch-label", ".clearing-blackout"); + t.length && (this.center_and_label(t, n), t.trigger("resized.fndtn.clearing")) + }, + fix_height: function (e) { + var t = e.parent().children(), n = this; + return t.each(function () { + var e = n.S(this), t = e.find("img"); + e.height() > t.outerHeight() && e.addClass("fix-height") + }).closest("ul").width + (t.length * 100 + "%"), this + }, + update_paddles: function (e) { + e = e.closest("li"); + var t = e.closest(".carousel").siblings(".visible-img"); + e.next().length > 0 ? this.S(".clearing-main-next", t).removeClass("disabled") : this.S(".clearing-main-next", t).addClass("disabled"), e.prev().length > 0 ? this.S(".clearing-main-prev", t).removeClass("disabled") : this.S(".clearing-main-prev", t).addClass("disabled") + }, + center_and_label: function (e, t) { + return this.rtl ? (e.css({ + marginRight: -(e.outerWidth() / 2), + marginTop: -(e.outerHeight() / 2), + left: "auto", + right: "50%" + }), t.length > 0 && t.css({ + marginRight: -(t.outerWidth() / 2), + marginTop: -(e.outerHeight() / 2) - t.outerHeight() - 10, + left: "auto", + right: "50%" + })) : (e.css({ + marginLeft: -(e.outerWidth() / 2), + marginTop: -(e.outerHeight() / 2) + }), t.length > 0 && t.css({ + marginLeft: -(t.outerWidth() / 2), + marginTop: -(e.outerHeight() / 2) - t.outerHeight() - 10 + })), this + }, + load: function (e) { + var t; + return e[0].nodeName === "A" ? t = e.attr("href") : t = e.parent().attr("href"), this.preload(e), t ? t : e.attr("src") + }, + preload: function (e) { + this.img(e.closest("li").next()).img(e.closest("li").prev()) + }, + img: function (e) { + if (e.length) { + var t = new Image, n = this.S("a", e); + n.length ? t.src = n.attr("href") : t.src = this.S("img", e).attr("src") + } + return this + }, + caption: function (e, t) { + var n = t.attr("data-caption"); + return n ? e.html(n).show() : e.text("").hide(), this + }, + go: function (e, t) { + var n = this.S(".visible", e), r = n[t](); + this.settings.skip_selector && r.find(this.settings.skip_selector).length != 0 && (r = r[t]()), r.length && this.S("img", r).trigger("click", [n, r]).trigger("click.fndtn.clearing", [n, r]).trigger("change.fndtn.clearing") + }, + shift: function (e, t, n) { + var r = t.parent(), i = this.settings.prev_index || t.index(), s = this.direction(r, e, t), o = this.rtl ? "right" : "left", u = parseInt(r.css("left"), 10), a = t.outerWidth(), f, l = {}; + t.index() !== i && !/skip/.test(s) ? /left/.test(s) ? (this.lock(), l[o] = u + a, r.animate(l, 300, this.unlock())) : /right/.test(s) && (this.lock(), l[o] = u - a, r.animate(l, 300, this.unlock())) : /skip/.test(s) && (f = t.index() - this.settings.up_count, this.lock(), f > 0 ? (l[o] = -(f * a), r.animate(l, 300, this.unlock())) : (l[o] = 0, r.animate(l, 300, this.unlock()))), n() + }, + direction: function (e, t, n) { + var r = this.S("li", e), i = r.outerWidth() + r.outerWidth() / 4, s = Math.floor(this.S(".clearing-container").outerWidth() / i) - 1, o = r.index(n), u; + return this.settings.up_count = s, this.adjacent(this.settings.prev_index, o) ? o > s && o > this.settings.prev_index ? u = "right" : o > s - 1 && o <= this.settings.prev_index ? u = "left" : u = !1 : u = "skip", this.settings.prev_index = o, u + }, + adjacent: function (e, t) { + for (var n = t + 1; n >= t - 1; n--)if (n === e)return !0; + return !1 + }, + lock: function () { + this.settings.locked = !0 + }, + unlock: function () { + this.settings.locked = !1 + }, + locked: function () { + return this.settings.locked + }, + off: function () { + this.S(this.scope).off(".fndtn.clearing"), this.S(t).off(".fndtn.clearing") + }, + reflow: function () { + this.init() + } + } +}(jQuery, window, window.document), !function (e) { + "function" == typeof define && define.amd ? define(["jquery"], e) : e("object" == typeof exports ? require("jquery") : jQuery) +}(function (e) { + function t(e) { + return u.raw ? e : encodeURIComponent(e) + } + + function n(e) { + return u.raw ? e : decodeURIComponent(e) + } + + function r(e) { + return t(u.json ? JSON.stringify(e) : String(e)) + } + + function i(e) { + 0 === e.indexOf('"') && (e = e.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, "\\")); + try { + return e = decodeURIComponent(e.replace(o, " ")), u.json ? JSON.parse(e) : e + } catch (t) { + } + } + + function s(t, n) { + var r = u.raw ? t : i(t); + return e.isFunction(n) ? n(r) : r + } + + var o = /\+/g, u = e.cookie = function (i, o, l) { + if (void 0 !== o && !e.isFunction(o)) { + if (l = e.extend({}, u.defaults, l), "number" == typeof l.expires) { + var p = l.expires, v = l.expires = new Date; + v.setTime(+v + 864e5 * p) + } + return document.cookie = [t(i), "=", r(o), l.expires ? "; expires=" + l.expires.toUTCString() : "", l.path ? "; path=" + l.path : "", l.domain ? "; domain=" + l.domain : "", l.secure ? "; secure" : ""].join("") + } + for (var m = i ? void 0 : {}, g = document.cookie ? document.cookie.split("; ") : [], y = 0, w = g.length; w > y; y++) { + var E = g[y].split("="), S = n(E.shift()), x = E.join("="); + if (i && i === S) { + m = s(x, o); + break + } + i || void 0 === (x = s(x)) || (m[S] = x) + } + return m + }; + u.defaults = {}, e.removeCookie = function (t, n) { + return void 0 === e.cookie(t) ? !1 : (e.cookie(t, "", e.extend({}, n, {expires: -1})), !e.cookie(t)) + } +}), function (e, t, n, r) { + "use strict"; + var i = i || !1; + Foundation.libs.joyride = { + name: "joyride", + version: "5.3.3", + defaults: { + expose: !1, + modal: !0, + keyboard: !0, + tip_location: "bottom", + nub_position: "auto", + scroll_speed: 1500, + scroll_animation: "linear", + timer: 0, + start_timer_on_click: !0, + start_offset: 0, + next_button: !0, + prev_button: !0, + tip_animation: "fade", + pause_after: [], + exposed: [], + tip_animation_fade_speed: 300, + cookie_monster: !1, + cookie_name: "joyride", + cookie_domain: !1, + cookie_expires: 365, + tip_container: "body", + abort_on_close: !0, + tip_location_patterns: { + top: ["bottom"], + bottom: [], + left: ["right", "top", "bottom"], + right: ["left", "top", "bottom"] + }, + post_ride_callback: function () { + }, + post_step_callback: function () { + }, + pre_step_callback: function () { + }, + pre_ride_callback: function () { + }, + post_expose_callback: function () { + }, + template: { + link: '×', + timer: '
    ', + tip: '
    ', + wrapper: '
    ', + button: '', + prev_button: '', + modal: '
    ', + expose: '
    ', + expose_cover: '
    ' + }, + expose_add_class: "" + }, + init: function (t, n, r) { + Foundation.inherit(this, "throttle random_str"), this.settings = this.settings || e.extend({}, this.defaults, r || n), this.bindings(n, r) + }, + go_next: function () { + this.settings.$li.next().length < 1 ? this.end() : this.settings.timer > 0 ? (clearTimeout(this.settings.automate), this.hide(), this.show(), this.startTimer()) : (this.hide(), this.show()) + }, + go_prev: function () { + this.settings.$li.prev().length < 1 || (this.settings.timer > 0 ? (clearTimeout(this.settings.automate), this.hide(), this.show(null, !0), this.startTimer()) : (this.hide(), this.show(null, !0))) + }, + events: function () { + var n = this; + e(this.scope).off(".joyride").on("click.fndtn.joyride", ".joyride-next-tip, .joyride-modal-bg", function (e) { + e.preventDefault(), this.go_next() + }.bind(this)).on("click.fndtn.joyride", ".joyride-prev-tip", function (e) { + e.preventDefault(), this.go_prev() + }.bind(this)).on("click.fndtn.joyride", ".joyride-close-tip", function (e) { + e.preventDefault(), this.end(this.settings.abort_on_close) + }.bind(this)).on("keyup.joyride", function (e) { + if (!this.settings.keyboard)return; + switch (e.which) { + case 39: + e.preventDefault(), this.go_next(); + break; + case 37: + e.preventDefault(), this.go_prev(); + break; + case 27: + e.preventDefault(), this.end(this.settings.abort_on_close) + } + }.bind(this)), e(t).off(".joyride").on("resize.fndtn.joyride", n.throttle(function () { + if (e("[" + n.attr_name() + "]").length > 0 && n.settings.$next_tip && n.settings.riding) { + if (n.settings.exposed.length > 0) { + var t = e(n.settings.exposed); + t.each(function () { + var t = e(this); + n.un_expose(t), n.expose(t) + }) + } + n.is_phone() ? n.pos_phone() : n.pos_default(!1) + } + }, 100)) + }, + start: function () { + var t = this, n = e("[" + this.attr_name() + "]", this.scope), r = ["timer", "scrollSpeed", "startOffset", "tipAnimationFadeSpeed", "cookieExpires"], i = r.length; + if (!n.length > 0)return; + this.settings.init || this.events(), this.settings = n.data(this.attr_name(!0) + "-init"), this.settings.$content_el = n, this.settings.$body = e(this.settings.tip_container), this.settings.body_offset = e(this.settings.tip_container).position(), this.settings.$tip_content = this.settings.$content_el.find("> li"), this.settings.paused = !1, this.settings.attempts = 0, this.settings.riding = !0, typeof e.cookie != "function" && (this.settings.cookie_monster = !1); + if (!this.settings.cookie_monster || this.settings.cookie_monster && !e.cookie(this.settings.cookie_name))this.settings.$tip_content.each(function (n) { + var s = e(this); + this.settings = e.extend({}, t.defaults, t.data_options(s)); + var o = i; + while (o--)t.settings[r[o]] = parseInt(t.settings[r[o]], 10); + t.create({$li: s, index: n}) + }), !this.settings.start_timer_on_click && this.settings.timer > 0 ? (this.show("init"), this.startTimer()) : this.show("init") + }, + resume: function () { + this.set_li(), this.show() + }, + tip_template: function (t) { + var n, r; + return t.tip_class = t.tip_class || "", n = e(this.settings.template.tip).addClass(t.tip_class), r = e.trim(e(t.li).html()) + this.prev_button_text(t.prev_button_text, t.index) + this.button_text(t.button_text) + this.settings.template.link + this.timer_instance(t.index), n.append(e(this.settings.template.wrapper)), n.first().attr(this.add_namespace("data-index"), t.index), e(".joyride-content-wrapper", n).append(r), n[0] + }, + timer_instance: function (t) { + var n; + return t === 0 && this.settings.start_timer_on_click && this.settings.timer > 0 || this.settings.timer === 0 ? n = "" : n = e(this.settings.template.timer)[0].outerHTML, n + }, + button_text: function (t) { + return this.settings.tip_settings.next_button ? (t = e.trim(t) || "Next", t = e(this.settings.template.button).append(t)[0].outerHTML) : t = "", t + }, + prev_button_text: function (t, n) { + return this.settings.tip_settings.prev_button ? (t = e.trim(t) || "Previous", n == 0 ? t = e(this.settings.template.prev_button).append(t).addClass("disabled")[0].outerHTML : t = e(this.settings.template.prev_button).append(t)[0].outerHTML) : t = "", t + }, + create: function (t) { + this.settings.tip_settings = e.extend({}, this.settings, this.data_options(t.$li)); + var n = t.$li.attr(this.add_namespace("data-button")) || t.$li.attr(this.add_namespace("data-text")), r = t.$li.attr(this.add_namespace("data-button-prev")) || t.$li.attr(this.add_namespace("data-prev-text")), i = t.$li.attr("class"), s = e(this.tip_template({ + tip_class: i, + index: t.index, + button_text: n, + prev_button_text: r, + li: t.$li + })); + e(this.settings.tip_container).append(s) + }, + show: function (t, n) { + var i = null; + this.settings.$li === r || e.inArray(this.settings.$li.index(), this.settings.pause_after) === -1 ? (this.settings.paused ? this.settings.paused = !1 : this.set_li(t, n), this.settings.attempts = 0, this.settings.$li.length && this.settings.$target.length > 0 ? (t && (this.settings.pre_ride_callback(this.settings.$li.index(), this.settings.$next_tip), this.settings.modal && this.show_modal()), this.settings.pre_step_callback(this.settings.$li.index(), this.settings.$next_tip), this.settings.modal && this.settings.expose && this.expose(), this.settings.tip_settings = e.extend({}, this.settings, this.data_options(this.settings.$li)), this.settings.timer = parseInt(this.settings.timer, 10), this.settings.tip_settings.tip_location_pattern = this.settings.tip_location_patterns[this.settings.tip_settings.tip_location], /body/i.test(this.settings.$target.selector) || this.scroll_to(), this.is_phone() ? this.pos_phone(!0) : this.pos_default(!0), i = this.settings.$next_tip.find(".joyride-timer-indicator"), /pop/i.test(this.settings.tip_animation) ? (i.width(0), this.settings.timer > 0 ? (this.settings.$next_tip.show(), setTimeout(function () { + i.animate({width: i.parent().width()}, this.settings.timer, "linear") + }.bind(this), this.settings.tip_animation_fade_speed)) : this.settings.$next_tip.show()) : /fade/i.test(this.settings.tip_animation) && (i.width(0), this.settings.timer > 0 ? (this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed).show(), setTimeout(function () { + i.animate({width: i.parent().width()}, this.settings.timer, "linear") + }.bind(this), this.settings.tip_animation_fade_speed)) : this.settings.$next_tip.fadeIn(this.settings.tip_animation_fade_speed)), this.settings.$current_tip = this.settings.$next_tip) : this.settings.$li && this.settings.$target.length < 1 ? this.show() : this.end()) : this.settings.paused = !0 + }, + is_phone: function () { + return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches + }, + hide: function () { + this.settings.modal && this.settings.expose && this.un_expose(), this.settings.modal || e(".joyride-modal-bg").hide(), this.settings.$current_tip.css("visibility", "hidden"), setTimeout(e.proxy(function () { + this.hide(), this.css("visibility", "visible") + }, this.settings.$current_tip), 0), this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip) + }, + set_li: function (e, t) { + e ? (this.settings.$li = this.settings.$tip_content.eq(this.settings.start_offset), this.set_next_tip(), this.settings.$current_tip = this.settings.$next_tip) : (t ? this.settings.$li = this.settings.$li.prev() : this.settings.$li = this.settings.$li.next(), this.set_next_tip()), this.set_target() + }, + set_next_tip: function () { + this.settings.$next_tip = e(".joyride-tip-guide").eq(this.settings.$li.index()), this.settings.$next_tip.data("closed", "") + }, + set_target: function () { + var t = this.settings.$li.attr(this.add_namespace("data-class")), r = this.settings.$li.attr(this.add_namespace("data-id")), i = function () { + return r ? e(n.getElementById(r)) : t ? e("." + t).first() : e("body") + }; + this.settings.$target = i() + }, + scroll_to: function () { + var n, r; + n = e(t).height() / 2, r = Math.ceil(this.settings.$target.offset().top - n + this.settings.$next_tip.outerHeight()), r != 0 && e("html, body").stop().animate({scrollTop: r}, this.settings.scroll_speed, "swing") + }, + paused: function () { + return e.inArray(this.settings.$li.index() + 1, this.settings.pause_after) === -1 + }, + restart: function () { + this.hide(), this.settings.$li = r, this.show("init") + }, + pos_default: function (e) { + var t = this.settings.$next_tip.find(".joyride-nub"), n = Math.ceil(t.outerWidth() / 2), r = Math.ceil(t.outerHeight() / 2), i = e || !1; + i && (this.settings.$next_tip.css("visibility", "hidden"), this.settings.$next_tip.show()); + if (!/body/i.test(this.settings.$target.selector)) { + var s = this.settings.tip_settings.tipAdjustmentY ? parseInt(this.settings.tip_settings.tipAdjustmentY) : 0, o = this.settings.tip_settings.tipAdjustmentX ? parseInt(this.settings.tip_settings.tipAdjustmentX) : 0; + this.bottom() ? (this.rtl ? this.settings.$next_tip.css({ + top: this.settings.$target.offset().top + r + this.settings.$target.outerHeight() + s, + left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + o + }) : this.settings.$next_tip.css({ + top: this.settings.$target.offset().top + r + this.settings.$target.outerHeight() + s, + left: this.settings.$target.offset().left + o + }), this.nub_position(t, this.settings.tip_settings.nub_position, "top")) : this.top() ? (this.rtl ? this.settings.$next_tip.css({ + top: this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - r + s, + left: this.settings.$target.offset().left + this.settings.$target.outerWidth() - this.settings.$next_tip.outerWidth() + }) : this.settings.$next_tip.css({ + top: this.settings.$target.offset().top - this.settings.$next_tip.outerHeight() - r + s, + left: this.settings.$target.offset().left + o + }), this.nub_position(t, this.settings.tip_settings.nub_position, "bottom")) : this.right() ? (this.settings.$next_tip.css({ + top: this.settings.$target.offset().top + s, + left: this.settings.$target.outerWidth() + this.settings.$target.offset().left + n + o + }), this.nub_position(t, this.settings.tip_settings.nub_position, "left")) : this.left() && (this.settings.$next_tip.css({ + top: this.settings.$target.offset().top + s, + left: this.settings.$target.offset().left - this.settings.$next_tip.outerWidth() - n + o + }), this.nub_position(t, this.settings.tip_settings.nub_position, "right")), !this.visible(this.corners(this.settings.$next_tip)) && this.settings.attempts < this.settings.tip_settings.tip_location_pattern.length && (t.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"), this.settings.tip_settings.tip_location = this.settings.tip_settings.tip_location_pattern[this.settings.attempts], this.settings.attempts++, this.pos_default()) + } else this.settings.$li.length && this.pos_modal(t); + i && (this.settings.$next_tip.hide(), this.settings.$next_tip.css("visibility", "visible")) + }, + pos_phone: function (t) { + var n = this.settings.$next_tip.outerHeight(), r = this.settings.$next_tip.offset(), i = this.settings.$target.outerHeight(), s = e(".joyride-nub", this.settings.$next_tip), o = Math.ceil(s.outerHeight() / 2), u = t || !1; + s.removeClass("bottom").removeClass("top").removeClass("right").removeClass("left"), u && (this.settings.$next_tip.css("visibility", "hidden"), this.settings.$next_tip.show()), /body/i.test(this.settings.$target.selector) ? this.settings.$li.length && this.pos_modal(s) : this.top() ? (this.settings.$next_tip.offset({top: this.settings.$target.offset().top - n - o}), s.addClass("bottom")) : (this.settings.$next_tip.offset({top: this.settings.$target.offset().top + i + o}), s.addClass("top")), u && (this.settings.$next_tip.hide(), this.settings.$next_tip.css("visibility", "visible")) + }, + pos_modal: function (e) { + this.center(), e.hide(), this.show_modal() + }, + show_modal: function () { + if (!this.settings.$next_tip.data("closed")) { + var t = e(".joyride-modal-bg"); + t.length < 1 && e("body").append(this.settings.template.modal).show(), /pop/i.test(this.settings.tip_animation) ? t.show() : t.fadeIn(this.settings.tip_animation_fade_speed) + } + }, + expose: function () { + var n, r, i, s, o, u = "expose-" + this.random_str(6); + if (arguments.length > 0 && arguments[0]instanceof e)i = arguments[0]; else { + if (!this.settings.$target || !!/body/i.test(this.settings.$target.selector))return !1; + i = this.settings.$target + } + if (i.length < 1)return t.console && console.error("element not valid", i), !1; + n = e(this.settings.template.expose), this.settings.$body.append(n), n.css({ + top: i.offset().top, + left: i.offset().left, + width: i.outerWidth(!0), + height: i.outerHeight(!0) + }), r = e(this.settings.template.expose_cover), s = { + zIndex: i.css("z-index"), + position: i.css("position") + }, o = i.attr("class") == null ? "" : i.attr("class"), i.css("z-index", parseInt(n.css("z-index")) + 1), s.position == "static" && i.css("position", "relative"), i.data("expose-css", s), i.data("orig-class", o), i.attr("class", o + " " + this.settings.expose_add_class), r.css({ + top: i.offset().top, + left: i.offset().left, + width: i.outerWidth(!0), + height: i.outerHeight(!0) + }), this.settings.modal && this.show_modal(), this.settings.$body.append(r), n.addClass(u), r.addClass(u), i.data("expose", u), this.settings.post_expose_callback(this.settings.$li.index(), this.settings.$next_tip, i), this.add_exposed(i) + }, + un_expose: function () { + var n, r, i, s, o, u = !1; + if (arguments.length > 0 && arguments[0]instanceof e)r = arguments[0]; else { + if (!this.settings.$target || !!/body/i.test(this.settings.$target.selector))return !1; + r = this.settings.$target + } + if (r.length < 1)return t.console && console.error("element not valid", r), !1; + n = r.data("expose"), i = e("." + n), arguments.length > 1 && (u = arguments[1]), u === !0 ? e(".joyride-expose-wrapper,.joyride-expose-cover").remove() : i.remove(), s = r.data("expose-css"), s.zIndex == "auto" ? r.css("z-index", "") : r.css("z-index", s.zIndex), s.position != r.css("position") && (s.position == "static" ? r.css("position", "") : r.css("position", s.position)), o = r.data("orig-class"), r.attr("class", o), r.removeData("orig-classes"), r.removeData("expose"), r.removeData("expose-z-index"), this.remove_exposed(r) + }, + add_exposed: function (t) { + this.settings.exposed = this.settings.exposed || [], t instanceof e || typeof t == "object" ? this.settings.exposed.push(t[0]) : typeof t == "string" && this.settings.exposed.push(t) + }, + remove_exposed: function (t) { + var n, r; + t instanceof e ? n = t[0] : typeof t == "string" && (n = t), this.settings.exposed = this.settings.exposed || [], r = this.settings.exposed.length; + while (r--)if (this.settings.exposed[r] == n) { + this.settings.exposed.splice(r, 1); + return + } + }, + center: function () { + var n = e(t); + return this.settings.$next_tip.css({ + top: (n.height() - this.settings.$next_tip.outerHeight()) / 2 + n.scrollTop(), + left: (n.width() - this.settings.$next_tip.outerWidth()) / 2 + n.scrollLeft() + }), !0 + }, + bottom: function () { + return /bottom/i.test(this.settings.tip_settings.tip_location) + }, + top: function () { + return /top/i.test(this.settings.tip_settings.tip_location) + }, + right: function () { + return /right/i.test(this.settings.tip_settings.tip_location) + }, + left: function () { + return /left/i.test(this.settings.tip_settings.tip_location) + }, + corners: function (n) { + var r = e(t), i = r.height() / 2, s = Math.ceil(this.settings.$target.offset().top - i + this.settings.$next_tip.outerHeight()), o = r.width() + r.scrollLeft(), u = r.height() + s, a = r.height() + r.scrollTop(), f = r.scrollTop(); + return s < f && (s < 0 ? f = 0 : f = s), u > a && (a = u), [n.offset().top < f, o < n.offset().left + n.outerWidth(), a < n.offset().top + n.outerHeight(), r.scrollLeft() > n.offset().left] + }, + visible: function (e) { + var t = e.length; + while (t--)if (e[t])return !1; + return !0 + }, + nub_position: function (e, t, n) { + t === "auto" ? e.addClass(n) : e.addClass(t) + }, + startTimer: function () { + this.settings.$li.length ? this.settings.automate = setTimeout(function () { + this.hide(), this.show(), this.startTimer() + }.bind(this), this.settings.timer) : clearTimeout(this.settings.automate) + }, + end: function (t) { + this.settings.cookie_monster && e.cookie(this.settings.cookie_name, "ridden", { + expires: this.settings.cookie_expires, + domain: this.settings.cookie_domain + }), this.settings.timer > 0 && clearTimeout(this.settings.automate), this.settings.modal && this.settings.expose && this.un_expose(), e(this.scope).off("keyup.joyride"), this.settings.$next_tip.data("closed", !0), this.settings.riding = !1, e(".joyride-modal-bg").hide(), this.settings.$current_tip.hide(); + if (typeof t == "undefined" || t === !1)this.settings.post_step_callback(this.settings.$li.index(), this.settings.$current_tip), this.settings.post_ride_callback(this.settings.$li.index(), this.settings.$current_tip); + e(".joyride-tip-guide").remove() + }, + off: function () { + e(this.scope).off(".joyride"), e(t).off(".joyride"), e(".joyride-close-tip, .joyride-next-tip, .joyride-modal-bg").off(".joyride"), e(".joyride-tip-guide, .joyride-modal-bg").remove(), clearTimeout(this.settings.automate), this.settings = {} + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs["magellan-expedition"] = { + name: "magellan-expedition", + version: "5.3.3", + settings: {active_class: "active", threshold: 0, destination_threshold: 20, throttle_delay: 30, fixed_top: 0}, + init: function (e, t, n) { + Foundation.inherit(this, "throttle"), this.bindings(t, n) + }, + events: function () { + var n = this, r = n.S, i = n.settings; + n.set_expedition_position(), r(n.scope).off(".magellan").on("click.fndtn.magellan", "[" + n.add_namespace("data-magellan-arrival") + '] a[href^="#"]', function (t) { + t.preventDefault(); + var r = e(this).closest("[" + n.attr_name() + "]"), i = r.data("magellan-expedition-init"), s = this.hash.split("#").join(""), o = e("a[name='" + s + "']"); + o.length === 0 && (o = e("#" + s)); + var u = o.offset().top - i.destination_threshold + 1; + u -= r.outerHeight(), e("html, body").stop().animate({scrollTop: u}, 700, "swing", function () { + history.pushState ? history.pushState(null, null, "#" + s) : location.hash = "#" + s + }) + }).on("scroll.fndtn.magellan", n.throttle(this.check_for_arrivals.bind(this), i.throttle_delay)), e(t).on("resize.fndtn.magellan", n.throttle(this.set_expedition_position.bind(this), i.throttle_delay)) + }, + check_for_arrivals: function () { + var e = this; + e.update_arrivals(), e.update_expedition_positions() + }, + set_expedition_position: function () { + var t = this; + e("[" + this.attr_name() + "=fixed]", t.scope).each(function (n, r) { + var i = e(this), s = i.data("magellan-expedition-init"), o = i.attr("styles"), u, a; + i.attr("style", ""), u = i.offset().top + s.threshold, a = parseInt(i.data("magellan-fixed-top")), isNaN(a) || (t.settings.fixed_top = a), i.data(t.data_attr("magellan-top-offset"), u), i.attr("style", o) + }) + }, + update_expedition_positions: function () { + var n = this, r = e(t).scrollTop(); + e("[" + this.attr_name() + "=fixed]", n.scope).each(function () { + var t = e(this), i = t.data("magellan-expedition-init"), s = t.attr("style"), o = t.data("magellan-top-offset"); + if (r + n.settings.fixed_top >= o) { + var u = t.prev("[" + n.add_namespace("data-magellan-expedition-clone") + "]"); + u.length === 0 && (u = t.clone(), u.removeAttr(n.attr_name()), u.attr(n.add_namespace("data-magellan-expedition-clone"), ""), t.before(u)), t.css({ + position: "fixed", + top: i.fixed_top + }).addClass("fixed") + } else t.prev("[" + n.add_namespace("data-magellan-expedition-clone") + "]").remove(), t.attr("style", s).css("position", "").css("top", "").removeClass("fixed") + }) + }, + update_arrivals: function () { + var n = this, r = e(t).scrollTop(); + e("[" + this.attr_name() + "]", n.scope).each(function () { + var t = e(this), i = t.data(n.attr_name(!0) + "-init"), s = n.offsets(t, r), o = t.find("[" + n.add_namespace("data-magellan-arrival") + "]"), u = !1; + s.each(function (e, r) { + if (r.viewport_offset >= r.top_offset) { + var s = t.find("[" + n.add_namespace("data-magellan-arrival") + "]"); + return s.not(r.arrival).removeClass(i.active_class), r.arrival.addClass(i.active_class), u = !0, !0 + } + }), u || o.removeClass(i.active_class) + }) + }, + offsets: function (t, n) { + var r = this, i = t.data(r.attr_name(!0) + "-init"), s = n; + return t.find("[" + r.add_namespace("data-magellan-arrival") + "]").map(function (n, o) { + var u = e(this).data(r.data_attr("magellan-arrival")), a = e("[" + r.add_namespace("data-magellan-destination") + "=" + u + "]"); + if (a.length > 0) { + var f = Math.floor(a.offset().top - i.destination_threshold - t.outerHeight()); + return {destination: a, arrival: e(this), top_offset: f, viewport_offset: s} + } + }).sort(function (e, t) { + return e.top_offset < t.top_offset ? -1 : e.top_offset > t.top_offset ? 1 : 0 + }) + }, + data_attr: function (e) { + return this.namespace.length > 0 ? this.namespace + "-" + e : e + }, + off: function () { + this.S(this.scope).off(".magellan"), this.S(t).off(".magellan") + }, + reflow: function () { + var t = this; + e("[" + t.add_namespace("data-magellan-expedition-clone") + "]", t.scope).remove() + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.offcanvas = { + name: "offcanvas", + version: "5.3.3", + settings: {open_method: "move", close_on_click: !1}, + init: function (e, t, n) { + this.bindings(t, n) + }, + events: function () { + var e = this, t = e.S, n = "", r = "", i = ""; + this.settings.open_method === "move" ? (n = "move-", r = "right", i = "left") : this.settings.open_method === "overlap_single" ? (n = "offcanvas-overlap-", r = "right", i = "left") : this.settings.open_method === "overlap" && (n = "offcanvas-overlap"), t(this.scope).off(".offcanvas").on("click.fndtn.offcanvas", ".left-off-canvas-toggle", function (i) { + e.click_toggle_class(i, n + r), e.settings.open_method !== "overlap" && t(".left-submenu").removeClass(n + r) + }).on("click.fndtn.offcanvas", ".left-off-canvas-menu a", function (i) { + var s = e.get_settings(i), o = t(this).parent(); + s.close_on_click && !o.hasClass("has-submenu") && !o.hasClass("back") ? (e.hide.call(e, n + r, e.get_wrapper(i)), o.parent().removeClass(n + r)) : t(this).parent().hasClass("has-submenu") ? (i.preventDefault(), t(this).siblings(".left-submenu").toggleClass(n + r)) : o.hasClass("back") && (i.preventDefault(), o.parent().removeClass(n + r)) + }).on("click.fndtn.offcanvas", ".right-off-canvas-toggle", function (r) { + e.click_toggle_class(r, n + i), e.settings.open_method !== "overlap" && t(".right-submenu").removeClass(n + i) + }).on("click.fndtn.offcanvas", ".right-off-canvas-menu a", function (r) { + var s = e.get_settings(r), o = t(this).parent(); + s.close_on_click && !o.hasClass("has-submenu") && !o.hasClass("back") ? (e.hide.call(e, n + i, e.get_wrapper(r)), o.parent().removeClass(n + i)) : t(this).parent().hasClass("has-submenu") ? (r.preventDefault(), t(this).siblings(".right-submenu").toggleClass(n + i)) : o.hasClass("back") && (r.preventDefault(), o.parent().removeClass(n + i)) + }).on("click.fndtn.offcanvas", ".exit-off-canvas", function (s) { + e.click_remove_class(s, n + i), t(".right-submenu").removeClass(n + i), r && (e.click_remove_class(s, n + r), t(".left-submenu").removeClass(n + i)) + }) + }, + toggle: function (e, t) { + t = t || this.get_wrapper(), t.is("." + e) ? this.hide(e, t) : this.show(e, t) + }, + show: function (e, t) { + t = t || this.get_wrapper(), t.trigger("open").trigger("open.fndtn.offcanvas"), t.addClass(e) + }, + hide: function (e, t) { + t = t || this.get_wrapper(), t.trigger("close").trigger("close.fndtn.offcanvas"), t.removeClass(e) + }, + click_toggle_class: function (e, t) { + e.preventDefault(); + var n = this.get_wrapper(e); + this.toggle(t, n) + }, + click_remove_class: function (e, t) { + e.preventDefault(); + var n = this.get_wrapper(e); + this.hide(t, n) + }, + get_settings: function (e) { + var t = this.S(e.target).closest("[" + this.attr_name() + "]"); + return t.data(this.attr_name(!0) + "-init") || this.settings + }, + get_wrapper: function (e) { + var t = this.S(e ? e.target : this.scope).closest(".off-canvas-wrap"); + return t.length === 0 && (t = this.S(".off-canvas-wrap")), t + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + function i(e) { + var t = /fade/i.test(e), n = /pop/i.test(e); + return {animate: t || n, pop: n, fade: t} + } + + Foundation.libs.reveal = { + name: "reveal", + version: "5.3.3", + locked: !1, + settings: { + animation: "fadeAndPop", + animation_speed: 250, + close_on_background_click: !0, + close_on_esc: !0, + dismiss_modal_class: "close-reveal-modal", + bg_class: "reveal-modal-bg", + root_element: "body", + open: function () { + }, + opened: function () { + }, + close: function () { + }, + closed: function () { + }, + bg: e(".reveal-modal-bg"), + css: { + open: {opacity: 0, visibility: "visible", display: "block"}, + close: {opacity: 1, visibility: "hidden", display: "none"} + } + }, + init: function (t, n, r) { + e.extend(!0, this.settings, n, r), this.bindings(n, r) + }, + events: function (e) { + var t = this, r = t.S; + return r(this.scope).off(".reveal").on("click.fndtn.reveal", "[" + this.add_namespace("data-reveal-id") + "]:not([disabled])", function (e) { + e.preventDefault(); + if (!t.locked) { + var n = r(this), i = n.data(t.data_attr("reveal-ajax")); + t.locked = !0; + if (typeof i == "undefined")t.open.call(t, n); else { + var s = i === !0 ? n.attr("href") : i; + t.open.call(t, n, {url: s}) + } + } + }), r(n).on("click.fndtn.reveal", this.close_targets(), function (e) { + e.preventDefault(); + if (!t.locked) { + var n = r("[" + t.attr_name() + "].open").data(t.attr_name(!0) + "-init"), i = r(e.target)[0] === r("." + n.bg_class)[0]; + if (i) { + if (!n.close_on_background_click)return; + e.stopPropagation() + } + t.locked = !0, t.close.call(t, i ? r("[" + t.attr_name() + "].open") : r(this).closest("[" + t.attr_name() + "]")) + } + }), r("[" + t.attr_name() + "]", this.scope).length > 0 ? r(this.scope).on("open.fndtn.reveal", this.settings.open).on("opened.fndtn.reveal", this.settings.opened).on("opened.fndtn.reveal", this.open_video).on("close.fndtn.reveal", this.settings.close).on("closed.fndtn.reveal", this.settings.closed).on("closed.fndtn.reveal", this.close_video) : r(this.scope).on("open.fndtn.reveal", "[" + t.attr_name() + "]", this.settings.open).on("opened.fndtn.reveal", "[" + t.attr_name() + "]", this.settings.opened).on("opened.fndtn.reveal", "[" + t.attr_name() + "]", this.open_video).on("close.fndtn.reveal", "[" + t.attr_name() + "]", this.settings.close).on("closed.fndtn.reveal", "[" + t.attr_name() + "]", this.settings.closed).on("closed.fndtn.reveal", "[" + t.attr_name() + "]", this.close_video), !0 + }, + key_up_on: function (e) { + var t = this; + return t.S("body").off("keyup.fndtn.reveal").on("keyup.fndtn.reveal", function (e) { + var n = t.S("[" + t.attr_name() + "].open"), r = n.data(t.attr_name(!0) + "-init") || t.settings; + r && e.which === 27 && r.close_on_esc && !t.locked && t.close.call(t, n) + }), !0 + }, + key_up_off: function (e) { + return this.S("body").off("keyup.fndtn.reveal"), !0 + }, + open: function (t, n) { + var r = this, i; + t ? typeof t.selector != "undefined" ? i = r.S("#" + t.data(r.data_attr("reveal-id"))).first() : (i = r.S(this.scope), n = t) : i = r.S(this.scope); + var s = i.data(r.attr_name(!0) + "-init"); + s = s || this.settings; + if (i.hasClass("open") && t.attr("data-reveal-id") == i.attr("id"))return r.close(i); + if (!i.hasClass("open")) { + var o = r.S("[" + r.attr_name() + "].open"); + typeof i.data("css-top") == "undefined" && i.data("css-top", parseInt(i.css("top"), 10)).data("offset", this.cache_offset(i)), this.key_up_on(i), i.trigger("open").trigger("open.fndtn.reveal"), o.length < 1 && this.toggle_bg(i, !0), typeof n == "string" && (n = {url: n}); + if (typeof n == "undefined" || !n.url)o.length > 0 && this.hide(o, s.css.close), this.show(i, s.css.open); else { + var u = typeof n.success != "undefined" ? n.success : null; + e.extend(n, { + success: function (t, n, a) { + e.isFunction(u) && u(t, n, a), i.html(t), r.S(i).foundation("section", "reflow"), r.S(i).children().foundation(), o.length > 0 && r.hide(o, s.css.close), r.show(i, s.css.open) + } + }), e.ajax(n) + } + } + }, + close: function (e) { + var e = e && e.length ? e : this.S(this.scope), t = this.S("[" + this.attr_name() + "].open"), n = e.data(this.attr_name(!0) + "-init") || this.settings; + t.length > 0 && (this.locked = !0, this.key_up_off(e), e.trigger("close").trigger("close.fndtn.reveal"), this.toggle_bg(e, !1), this.hide(t, n.css.close, n)) + }, + close_targets: function () { + var e = "." + this.settings.dismiss_modal_class; + return this.settings.close_on_background_click ? e + ", ." + this.settings.bg_class : e + }, + toggle_bg: function (t, n) { + this.S("." + this.settings.bg_class).length === 0 && (this.settings.bg = e("
    ", {"class": this.settings.bg_class}).appendTo("body").hide()); + var i = this.settings.bg.filter(":visible").length > 0; + n != i && ((n == r ? i : !n) ? this.hide(this.settings.bg) : this.show(this.settings.bg)) + }, + show: function (n, r) { + if (r) { + var s = n.data(this.attr_name(!0) + "-init") || this.settings, o = s.root_element; + if (n.parent(o).length === 0) { + var u = n.wrap('
    ').parent(); + n.on("closed.fndtn.reveal.wrapped", function () { + n.detach().appendTo(u), n.unwrap().unbind("closed.fndtn.reveal.wrapped") + }), n.detach().appendTo(o) + } + var a = i(s.animation); + a.animate || (this.locked = !1); + if (a.pop) { + r.top = e(t).scrollTop() - n.data("offset") + "px"; + var f = {top: e(t).scrollTop() + n.data("css-top") + "px", opacity: 1}; + return setTimeout(function () { + return n.css(r).animate(f, s.animation_speed, "linear", function () { + this.locked = !1, n.trigger("opened").trigger("opened.fndtn.reveal") + }.bind(this)).addClass("open") + }.bind(this), s.animation_speed / 2) + } + if (a.fade) { + r.top = e(t).scrollTop() + n.data("css-top") + "px"; + var f = {opacity: 1}; + return setTimeout(function () { + return n.css(r).animate(f, s.animation_speed, "linear", function () { + this.locked = !1, n.trigger("opened").trigger("opened.fndtn.reveal") + }.bind(this)).addClass("open") + }.bind(this), s.animation_speed / 2) + } + return n.css(r).show().css({opacity: 1}).addClass("open").trigger("opened").trigger("opened.fndtn.reveal") + } + var s = this.settings; + return i(s.animation).fade ? n.fadeIn(s.animation_speed / 2) : (this.locked = !1, n.show()) + }, + hide: function (n, r) { + if (r) { + var s = n.data(this.attr_name(!0) + "-init"); + s = s || this.settings; + var o = i(s.animation); + o.animate || (this.locked = !1); + if (o.pop) { + var u = { + top: -e(t).scrollTop() - n.data("offset") + "px", opacity: 0 + }; + return setTimeout(function () { + return n.animate(u, s.animation_speed, "linear", function () { + this.locked = !1, n.css(r).trigger("closed").trigger("closed.fndtn.reveal") + }.bind(this)).removeClass("open") + }.bind(this), s.animation_speed / 2) + } + if (o.fade) { + var u = {opacity: 0}; + return setTimeout(function () { + return n.animate(u, s.animation_speed, "linear", function () { + this.locked = !1, n.css(r).trigger("closed").trigger("closed.fndtn.reveal") + }.bind(this)).removeClass("open") + }.bind(this), s.animation_speed / 2) + } + return n.hide().css(r).removeClass("open").trigger("closed").trigger("closed.fndtn.reveal") + } + var s = this.settings; + return i(s.animation).fade ? n.fadeOut(s.animation_speed / 2) : n.hide() + }, + close_video: function (t) { + var n = e(".flex-video", t.target), r = e("iframe", n); + r.length > 0 && (r.attr("data-src", r[0].src), r.attr("src", r.attr("src")), n.hide()) + }, + open_video: function (t) { + var n = e(".flex-video", t.target), i = n.find("iframe"); + if (i.length > 0) { + var s = i.attr("data-src"); + if (typeof s == "string")i[0].src = i.attr("data-src"); else { + var o = i[0].src; + i[0].src = r, i[0].src = o + } + n.show() + } + }, + data_attr: function (e) { + return this.namespace.length > 0 ? this.namespace + "-" + e : e + }, + cache_offset: function (e) { + var t = e.show().height() + parseInt(e.css("top"), 10); + return e.hide(), t + }, + off: function () { + e(this.scope).off(".fndtn.reveal") + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.slider = { + name: "slider", + version: "5.3.3", + settings: { + start: 0, + end: 100, + step: 1, + initial: null, + display_selector: "", + vertical: !1, + on_change: function () { + } + }, + cache: {}, + init: function (e, t, n) { + Foundation.inherit(this, "throttle"), this.bindings(t, n), this.reflow() + }, + events: function () { + var n = this; + e(this.scope).off(".slider").on("mousedown.fndtn.slider touchstart.fndtn.slider pointerdown.fndtn.slider", "[" + n.attr_name() + "]:not(.disabled, [disabled]) .range-slider-handle", function (t) { + n.cache.active || (t.preventDefault(), n.set_active_slider(e(t.target))) + }).on("mousemove.fndtn.slider touchmove.fndtn.slider pointermove.fndtn.slider", function (r) { + if (!!n.cache.active) { + r.preventDefault(); + if (e.data(n.cache.active[0], "settings").vertical) { + var i = 0; + r.pageY || (i = t.scrollY), n.calculate_position(n.cache.active, (r.pageY || r.originalEvent.clientY || r.originalEvent.touches[0].clientY || r.currentPoint.y) + i) + } else n.calculate_position(n.cache.active, r.pageX || r.originalEvent.clientX || r.originalEvent.touches[0].clientX || r.currentPoint.x) + } + }).on("mouseup.fndtn.slider touchend.fndtn.slider pointerup.fndtn.slider", function (e) { + n.remove_active_slider() + }).on("change.fndtn.slider", function (e) { + n.settings.on_change() + }), n.S(t).on("resize.fndtn.slider", n.throttle(function (e) { + n.reflow() + }, 300)) + }, + set_active_slider: function (e) { + this.cache.active = e + }, + remove_active_slider: function () { + this.cache.active = null + }, + calculate_position: function (t, n) { + var r = this, i = e.data(t[0], "settings"), s = e.data(t[0], "handle_l"), o = e.data(t[0], "handle_o"), u = e.data(t[0], "bar_l"), a = e.data(t[0], "bar_o"); + requestAnimationFrame(function () { + var e; + Foundation.rtl && !i.vertical ? e = r.limit_to((a + u - n) / u, 0, 1) : e = r.limit_to((n - a) / u, 0, 1), e = i.vertical ? 1 - e : e; + var s = r.normalized_value(e, i.start, i.end, i.step); + r.set_ui(t, s) + }) + }, + set_ui: function (t, n) { + var r = e.data(t[0], "settings"), i = e.data(t[0], "handle_l"), s = e.data(t[0], "bar_l"), o = this.normalized_percentage(n, r.start, r.end), u = o * (s - i) - 1, a = o * 100; + Foundation.rtl && !r.vertical && (u = -u), u = r.vertical ? -u + s - i + 1 : u, this.set_translate(t, u, r.vertical), r.vertical ? t.siblings(".range-slider-active-segment").css("height", a + "%") : t.siblings(".range-slider-active-segment").css("width", a + "%"), t.parent().attr(this.attr_name(), n).trigger("change").trigger("change.fndtn.slider"), t.parent().children("input[type=hidden]").val(n), r.input_id != "" && e(r.display_selector).each(function () { + this.hasOwnProperty("value") ? e(this).val(n) : e(this).text(n) + }) + }, + normalized_percentage: function (e, t, n) { + return Math.min(1, (e - t) / (n - t)) + }, + normalized_value: function (e, t, n, r) { + var i = n - t, s = e * i, o = (s - s % r) / r, u = s % r, a = u >= r * .5 ? r : 0; + return o * r + a + t + }, + set_translate: function (t, n, r) { + r ? e(t).css("-webkit-transform", "translateY(" + n + "px)").css("-moz-transform", "translateY(" + n + "px)").css("-ms-transform", "translateY(" + n + "px)").css("-o-transform", "translateY(" + n + "px)").css("transform", "translateY(" + n + "px)") : e(t).css("-webkit-transform", "translateX(" + n + "px)").css("-moz-transform", "translateX(" + n + "px)").css("-ms-transform", "translateX(" + n + "px)").css("-o-transform", "translateX(" + n + "px)").css("transform", "translateX(" + n + "px)") + }, + limit_to: function (e, t, n) { + return Math.min(Math.max(e, t), n) + }, + initialize_settings: function (t) { + var n = e.extend({}, this.settings, this.data_options(e(t).parent())); + n.vertical ? (e.data(t, "bar_o", e(t).parent().offset().top), e.data(t, "bar_l", e(t).parent().outerHeight()), e.data(t, "handle_o", e(t).offset().top), e.data(t, "handle_l", e(t).outerHeight())) : (e.data(t, "bar_o", e(t).parent().offset().left), e.data(t, "bar_l", e(t).parent().outerWidth()), e.data(t, "handle_o", e(t).offset().left), e.data(t, "handle_l", e(t).outerWidth())), e.data(t, "bar", e(t).parent()), e.data(t, "settings", n) + }, + set_initial_position: function (t) { + var n = e.data(t.children(".range-slider-handle")[0], "settings"), r = n.initial ? n.initial : Math.floor((n.end - n.start) * .5 / n.step) * n.step + n.start, i = t.children(".range-slider-handle"); + this.set_ui(i, r) + }, + set_value: function (t) { + var n = this; + e("[" + n.attr_name() + "]", this.scope).each(function () { + e(this).attr(n.attr_name(), t) + }), !e(this.scope).attr(n.attr_name()) || e(this.scope).attr(n.attr_name(), t), n.reflow() + }, + reflow: function () { + var t = this; + t.S("[" + this.attr_name() + "]").each(function () { + var n = e(this).children(".range-slider-handle")[0], r = e(this).attr(t.attr_name()); + t.initialize_settings(n), r ? t.set_ui(e(n), parseFloat(r)) : t.set_initial_position(e(this)) + }) + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.tab = { + name: "tab", version: "5.3.3", settings: { + active_class: "active", callback: function () { + }, deep_linking: !1, scroll_to_content: !0, is_hover: !1 + }, default_tab_hashes: [], init: function (e, t, n) { + var r = this, i = this.S; + this.bindings(t, n), this.handle_location_hash_change(), i("[" + this.attr_name() + "] > .active > a", this.scope).each(function () { + r.default_tab_hashes.push(this.hash) + }) + }, events: function () { + var e = this, n = this.S; + n(this.scope).off(".tab").on("click.fndtn.tab", "[" + this.attr_name() + "] > * > a", function (t) { + var r = n(this).closest("[" + e.attr_name() + "]").data(e.attr_name(!0) + "-init"); + if (!r.is_hover || Modernizr.touch)t.preventDefault(), t.stopPropagation(), e.toggle_active_tab(n(this).parent()) + }).on("mouseenter.fndtn.tab", "[" + this.attr_name() + "] > * > a", function (t) { + var r = n(this).closest("[" + e.attr_name() + "]").data(e.attr_name(!0) + "-init"); + r.is_hover && e.toggle_active_tab(n(this).parent()) + }), n(t).on("hashchange.fndtn.tab", function (t) { + t.preventDefault(), e.handle_location_hash_change() + }) + }, handle_location_hash_change: function () { + var t = this, n = this.S; + n("[" + this.attr_name() + "]", this.scope).each(function () { + var i = n(this).data(t.attr_name(!0) + "-init"); + if (i.deep_linking) { + var s = t.scope.location.hash; + if (s != "") { + var o = n(s); + if (o.hasClass("content") && o.parent().hasClass("tab-content"))t.toggle_active_tab(e("[" + t.attr_name() + "] > * > a[href=" + s + "]").parent()); else { + var u = o.closest(".content").attr("id"); + u != r && t.toggle_active_tab(e("[" + t.attr_name() + "] > * > a[href=#" + u + "]").parent(), s) + } + } else for (var a in t.default_tab_hashes)t.toggle_active_tab(e("[" + t.attr_name() + "] > * > a[href=" + t.default_tab_hashes[a] + "]").parent()) + } + }) + }, toggle_active_tab: function (n, i) { + var s = this.S, o = n.closest("[" + this.attr_name() + "]"), u = n.children("a").first(), a = "#" + u.attr("href").split("#")[1], f = s(a), l = n.siblings(), c = o.data(this.attr_name(!0) + "-init"); + s(this).data(this.data_attr("tab-content")) && (a = "#" + s(this).data(this.data_attr("tab-content")).split("#")[1], f = s(a)); + if (c.deep_linking) { + var h = e("body,html").scrollTop(); + i != r ? t.location.hash = i : t.location.hash = a, c.scroll_to_content ? i == r || i == a ? n.parent()[0].scrollIntoView() : s(a)[0].scrollIntoView() : (i == r || i == a) && e("body,html").scrollTop(h) + } + n.addClass(c.active_class).triggerHandler("opened"), l.removeClass(c.active_class), f.siblings().removeClass(c.active_class).end().addClass(c.active_class), c.callback(n), f.triggerHandler("toggled", [n]), o.triggerHandler("toggled", [f]) + }, data_attr: function (e) { + return this.namespace.length > 0 ? this.namespace + "-" + e : e + }, off: function () { + }, reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.tooltip = { + name: "tooltip", + version: "5.3.3", + settings: { + additional_inheritable_classes: [], + tooltip_class: ".tooltip", + append_to: "body", + touch_close_text: "Tap To Close", + disable_for_touch: !1, + hover_delay: 200, + show_on: "all", + tip_template: function (e, t) { + return '' + t + '' + } + }, + cache: {}, + init: function (e, t, n) { + Foundation.inherit(this, "random_str"), this.bindings(t, n) + }, + should_show: function (t, n) { + var r = e.extend({}, this.settings, this.data_options(t)); + return r.show_on === "all" ? !0 : this.small() && r.show_on === "small" ? !0 : this.medium() && r.show_on === "medium" ? !0 : this.large() && r.show_on === "large" ? !0 : !1 + }, + medium: function () { + return matchMedia(Foundation.media_queries.medium).matches + }, + large: function () { + return matchMedia(Foundation.media_queries.large).matches + }, + events: function (t) { + var n = this, r = n.S; + n.create(this.S(t)), e(this.scope).off(".tooltip").on("mouseenter.fndtn.tooltip mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip", "[" + this.attr_name() + "]", function (t) { + var i = r(this), s = e.extend({}, n.settings, n.data_options(i)), o = !1; + if (Modernizr.touch && /touchstart|MSPointerDown/i.test(t.type) && r(t.target).is("a"))return !1; + if (/mouse/i.test(t.type) && n.ie_touch(t))return !1; + if (i.hasClass("open"))Modernizr.touch && /touchstart|MSPointerDown/i.test(t.type) && t.preventDefault(), n.hide(i); else { + if (s.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(t.type))return; + !s.disable_for_touch && Modernizr.touch && /touchstart|MSPointerDown/i.test(t.type) && (t.preventDefault(), r(s.tooltip_class + ".open").hide(), o = !0), /enter|over/i.test(t.type) ? this.timer = setTimeout(function () { + var e = n.showTip(i) + }.bind(this), n.settings.hover_delay) : t.type === "mouseout" || t.type === "mouseleave" ? (clearTimeout(this.timer), n.hide(i)) : n.showTip(i) + } + }).on("mouseleave.fndtn.tooltip touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip", "[" + this.attr_name() + "].open", function (t) { + if (/mouse/i.test(t.type) && n.ie_touch(t))return !1; + if (e(this).data("tooltip-open-event-type") == "touch" && t.type == "mouseleave")return; + e(this).data("tooltip-open-event-type") == "mouse" && /MSPointerDown|touchstart/i.test(t.type) ? n.convert_to_touch(e(this)) : n.hide(e(this)) + }).on("DOMNodeRemoved DOMAttrModified", "[" + this.attr_name() + "]:not(a)", function (e) { + n.hide(r(this)) + }) + }, + ie_touch: function (e) { + return !1 + }, + showTip: function (e) { + var t = this.getTip(e); + if (this.should_show(e, t))return this.show(e); + return + }, + getTip: function (t) { + var n = this.selector(t), r = e.extend({}, this.settings, this.data_options(t)), i = null; + return n && (i = this.S('span[data-selector="' + n + '"]' + r.tooltip_class)), typeof i == "object" ? i : !1 + }, + selector: function (e) { + var t = e.attr("id"), n = e.attr(this.attr_name()) || e.attr("data-selector"); + return (t && t.length < 1 || !t) && typeof n != "string" && (n = this.random_str(6), e.attr("data-selector", n)), t && t.length > 0 ? t : n + }, + create: function (n) { + var r = this, i = e.extend({}, this.settings, this.data_options(n)), s = this.settings.tip_template; + typeof i.tip_template == "string" && t.hasOwnProperty(i.tip_template) && (s = t[i.tip_template]); + var o = e(s(this.selector(n), e("
    ").html(n.attr("title")).html())), u = this.inheritable_classes(n); + o.addClass(u).appendTo(i.append_to), Modernizr.touch && (o.append('' + i.touch_close_text + ""), o.on("touchstart.fndtn.tooltip MSPointerDown.fndtn.tooltip", function (e) { + r.hide(n) + })), n.removeAttr("title").attr("title", "") + }, + reposition: function (t, n, r) { + var i, s, o, u, a, f; + n.css("visibility", "hidden").show(), i = t.data("width"), s = n.children(".nub"), o = s.outerHeight(), u = s.outerHeight(), this.small() ? n.css({width: "100%"}) : n.css({width: i ? i : "auto"}), f = function (e, t, n, r, i, s) { + return e.css({ + top: t ? t : "auto", + bottom: r ? r : "auto", + left: i ? i : "auto", + right: n ? n : "auto" + }).end() + }, f(n, t.offset().top + t.outerHeight() + 10, "auto", "auto", t.offset().left); + if (this.small())f(n, t.offset().top + t.outerHeight() + 10, "auto", "auto", 12.5, e(this.scope).width()), n.addClass("tip-override"), f(s, -o, "auto", "auto", t.offset().left); else { + var l = t.offset().left; + Foundation.rtl && (s.addClass("rtl"), l = t.offset().left + t.outerWidth() - n.outerWidth()), f(n, t.offset().top + t.outerHeight() + 10, "auto", "auto", l), n.removeClass("tip-override"), r && r.indexOf("tip-top") > -1 ? (Foundation.rtl && s.addClass("rtl"), f(n, t.offset().top - n.outerHeight(), "auto", "auto", l).removeClass("tip-override")) : r && r.indexOf("tip-left") > -1 ? (f(n, t.offset().top + t.outerHeight() / 2 - n.outerHeight() / 2, "auto", "auto", t.offset().left - n.outerWidth() - o).removeClass("tip-override"), s.removeClass("rtl")) : r && r.indexOf("tip-right") > -1 && (f(n, t.offset().top + t.outerHeight() / 2 - n.outerHeight() / 2, "auto", "auto", t.offset().left + t.outerWidth() + o).removeClass("tip-override"), s.removeClass("rtl")) + } + n.css("visibility", "visible").hide() + }, + small: function () { + return matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches + }, + inheritable_classes: function (t) { + var n = e.extend({}, this.settings, this.data_options(t)), r = ["tip-top", "tip-left", "tip-bottom", "tip-right", "radius", "round"].concat(n.additional_inheritable_classes), i = t.attr("class"), s = i ? e.map(i.split(" "), function (t, n) { + if (e.inArray(t, r) !== -1)return t + }).join(" ") : ""; + return e.trim(s) + }, + convert_to_touch: function (t) { + var n = this, r = n.getTip(t), i = e.extend({}, n.settings, n.data_options(t)); + r.find(".tap-to-close").length === 0 && (r.append('' + i.touch_close_text + ""), r.on("click.fndtn.tooltip.tapclose touchstart.fndtn.tooltip.tapclose MSPointerDown.fndtn.tooltip.tapclose", function (e) { + n.hide(t) + })), t.data("tooltip-open-event-type", "touch") + }, + show: function (e) { + var t = this.getTip(e); + e.data("tooltip-open-event-type") == "touch" && this.convert_to_touch(e), this.reposition(e, t, e.attr("class")), e.addClass("open"), t.fadeIn(150) + }, + hide: function (e) { + var t = this.getTip(e); + t.fadeOut(150, function () { + t.find(".tap-to-close").remove(), t.off("click.fndtn.tooltip.tapclose MSPointerDown.fndtn.tapclose"), e.removeClass("open") + }) + }, + off: function () { + var t = this; + this.S(this.scope).off(".fndtn.tooltip"), this.S(this.settings.tooltip_class).each(function (n) { + e("[" + t.attr_name() + "]").eq(n).attr("title", e(this).text()) + }).remove() + }, + reflow: function () { + } + } +}(jQuery, window, window.document), function (e, t, n, r) { + "use strict"; + Foundation.libs.topbar = { + name: "topbar", + version: "5.3.3", + settings: { + index: 0, + sticky_class: "sticky", + custom_back_text: !0, + back_text: "Back", + mobile_show_parent_link: !0, + is_hover: !0, + scrolltop: !0, + sticky_on: "all" + }, + init: function (t, n, r) { + Foundation.inherit(this, "add_custom_rule register_media throttle"); + var i = this; + i.register_media("topbar", "foundation-mq-topbar"), this.bindings(n, r), i.S("[" + this.attr_name() + "]", this.scope).each(function () { + var t = e(this), n = t.data(i.attr_name(!0) + "-init"), r = i.S("section, .top-bar-section", this); + t.data("index", 0); + var s = t.parent(); + s.hasClass("fixed") || i.is_sticky(t, s, n) ? (i.settings.sticky_class = n.sticky_class, i.settings.sticky_topbar = t, t.data("height", s.outerHeight()), t.data("stickyoffset", s.offset().top)) : t.data("height", t.outerHeight()), n.assembled || i.assemble(t), n.is_hover ? i.S(".has-dropdown", t).addClass("not-click") : i.S(".has-dropdown", t).removeClass("not-click"), i.add_custom_rule(".f-topbar-fixed { padding-top: " + t.data("height") + "px }"), s.hasClass("fixed") && i.S("body").addClass("f-topbar-fixed") + }) + }, + is_sticky: function (e, t, n) { + var r = t.hasClass(n.sticky_class); + return r && n.sticky_on === "all" ? !0 : r && this.small() && n.sticky_on === "small" ? matchMedia(Foundation.media_queries.small).matches && !matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches : r && this.medium() && n.sticky_on === "medium" ? matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches && !matchMedia(Foundation.media_queries.large).matches : r && this.large() && n.sticky_on === "large" ? matchMedia(Foundation.media_queries.small).matches && matchMedia(Foundation.media_queries.medium).matches && matchMedia(Foundation.media_queries.large).matches : !1 + }, + toggle: function (n) { + var r = this, i; + n ? i = r.S(n).closest("[" + this.attr_name() + "]") : i = r.S("[" + this.attr_name() + "]"); + var s = i.data(this.attr_name(!0) + "-init"), o = r.S("section, .top-bar-section", i); + r.breakpoint() && (r.rtl ? (o.css({right: "0%"}), e(">.name", o).css({right: "100%"})) : (o.css({left: "0%"}), e(">.name", o).css({left: "100%"})), r.S("li.moved", o).removeClass("moved"), i.data("index", 0), i.toggleClass("expanded").css("height", "")), s.scrolltop ? i.hasClass("expanded") ? i.parent().hasClass("fixed") && (s.scrolltop ? (i.parent().removeClass("fixed"), i.addClass("fixed"), r.S("body").removeClass("f-topbar-fixed"), t.scrollTo(0, 0)) : i.parent().removeClass("expanded")) : i.hasClass("fixed") && (i.parent().addClass("fixed"), i.removeClass("fixed"), r.S("body").addClass("f-topbar-fixed")) : (r.is_sticky(i, i.parent(), s) && i.parent().addClass("fixed"), i.parent().hasClass("fixed") && (i.hasClass("expanded") ? (i.addClass("fixed"), i.parent().addClass("expanded"), r.S("body").addClass("f-topbar-fixed")) : (i.removeClass("fixed"), i.parent().removeClass("expanded"), r.update_sticky_positioning()))) + }, + timer: null, + events: function (n) { + var r = this, i = this.S; + i(this.scope).off(".topbar").on("click.fndtn.topbar", "[" + this.attr_name() + "] .toggle-topbar", function (e) { + e.preventDefault(), r.toggle(this) + }).on("click.fndtn.topbar", '.top-bar .top-bar-section li a[href^="#"],[' + this.attr_name() + '] .top-bar-section li a[href^="#"]', function (t) { + var n = e(this).closest("li"); + r.breakpoint() && !n.hasClass("back") && !n.hasClass("has-dropdown") && r.toggle() + }).on("click.fndtn.topbar", "[" + this.attr_name() + "] li.has-dropdown", function (t) { + var n = i(this), s = i(t.target), o = n.closest("[" + r.attr_name() + "]"), u = o.data(r.attr_name(!0) + "-init"); + if (s.data("revealId")) { + r.toggle(); + return + } + if (r.breakpoint())return; + if (u.is_hover && !Modernizr.touch)return; + t.stopImmediatePropagation(), n.hasClass("hover") ? (n.removeClass("hover").find("li").removeClass("hover"), n.parents("li.hover").removeClass("hover")) : (n.addClass("hover"), e(n).siblings().removeClass("hover"), s[0].nodeName === "A" && s.parent().hasClass("has-dropdown") && t.preventDefault()) + }).on("click.fndtn.topbar", "[" + this.attr_name() + "] .has-dropdown>a", function (e) { + if (r.breakpoint()) { + e.preventDefault(); + var t = i(this), n = t.closest("[" + r.attr_name() + "]"), s = n.find("section, .top-bar-section"), o = t.next(".dropdown").outerHeight(), u = t.closest("li"); + n.data("index", n.data("index") + 1), u.addClass("moved"), r.rtl ? (s.css({right: -(100 * n.data("index")) + "%"}), s.find(">.name").css({right: 100 * n.data("index") + "%"})) : (s.css({left: -(100 * n.data("index")) + "%"}), s.find(">.name").css({left: 100 * n.data("index") + "%"})), n.css("height", t.siblings("ul").outerHeight(!0) + n.data("height")) + } + }), i(t).off(".topbar").on("resize.fndtn.topbar", r.throttle(function () { + r.resize.call(r) + }, 50)).trigger("resize").trigger("resize.fndtn.topbar").load(function () { + i(this).trigger("resize.fndtn.topbar") + }), i("body").off(".topbar").on("click.fndtn.topbar", function (e) { + var t = i(e.target).closest("li").closest("li.hover"); + if (t.length > 0)return; + i("[" + r.attr_name() + "] li.hover").removeClass("hover") + }), i(this.scope).on("click.fndtn.topbar", "[" + this.attr_name() + "] .has-dropdown .back", function (e) { + e.preventDefault(); + var t = i(this), n = t.closest("[" + r.attr_name() + "]"), s = n.find("section, .top-bar-section"), o = n.data(r.attr_name(!0) + "-init"), u = t.closest("li.moved"), a = u.parent(); + n.data("index", n.data("index") - 1), r.rtl ? (s.css({right: -(100 * n.data("index")) + "%"}), s.find(">.name").css({right: 100 * n.data("index") + "%"})) : (s.css({left: -(100 * n.data("index")) + "%"}), s.find(">.name").css({left: 100 * n.data("index") + "%"})), n.data("index") === 0 ? n.css("height", "") : n.css("height", a.outerHeight(!0) + n.data("height")), setTimeout(function () { + u.removeClass("moved") + }, 300) + }) + }, + resize: function () { + var e = this; + e.S("[" + this.attr_name() + "]").each(function () { + var t = e.S(this), r = t.data(e.attr_name(!0) + "-init"), i = t.parent("." + e.settings.sticky_class), s; + if (!e.breakpoint()) { + var o = t.hasClass("expanded"); + t.css("height", "").removeClass("expanded").find("li").removeClass("hover"), o && e.toggle(t) + } + e.is_sticky(t, i, r) && (i.hasClass("fixed") ? (i.removeClass("fixed"), s = i.offset().top, e.S(n.body).hasClass("f-topbar-fixed") && (s -= t.data("height")), t.data("stickyoffset", s), i.addClass("fixed")) : (s = i.offset().top, t.data("stickyoffset", s))) + }) + }, + breakpoint: function () { + return !matchMedia(Foundation.media_queries.topbar).matches + }, + small: function () { + return matchMedia(Foundation.media_queries.small).matches + }, + medium: function () { + return matchMedia(Foundation.media_queries.medium).matches + }, + large: function () { + return matchMedia(Foundation.media_queries.large).matches + }, + assemble: function (t) { + var n = this, r = t.data(this.attr_name(!0) + "-init"), i = n.S("section, .top-bar-section", t); + i.detach(), n.S(".has-dropdown>a", i).each(function () { + var t = n.S(this), i = t.siblings(".dropdown"), s = t.attr("href"), o; + i.find(".title.back").length || (r.mobile_show_parent_link == 1 && s ? o = e('
  • ") : o = e('
  • '), r.custom_back_text == 1 ? e("h5>a", o).html(r.back_text) : e("h5>a", o).html("« " + t.html()), i.prepend(o)) + }), i.appendTo(t), this.sticky(), this.assembled(t) + }, + assembled: function (t) { + t.data(this.attr_name(!0), e.extend({}, t.data(this.attr_name(!0)), {assembled: !0})) + }, + height: function (t) { + var n = 0, r = this; + return e("> li", t).each(function () { + n += r.S(this).outerHeight(!0) + }), n + }, + sticky: function () { + var e = this; + this.S(t).on("scroll", function () { + e.update_sticky_positioning() + }) + }, + update_sticky_positioning: function () { + var e = "." + this.settings.sticky_class, n = this.S(t), r = this; + if (r.settings.sticky_topbar && r.is_sticky(this.settings.sticky_topbar, this.settings.sticky_topbar.parent(), this.settings)) { + var i = this.settings.sticky_topbar.data("stickyoffset"); + r.S(e).hasClass("expanded") || (n.scrollTop() > i ? r.S(e).hasClass("fixed") || (r.S(e).addClass("fixed"), r.S("body").addClass("f-topbar-fixed")) : n.scrollTop() <= i && r.S(e).hasClass("fixed") && (r.S(e).removeClass("fixed"), r.S("body").removeClass("f-topbar-fixed"))) + } + }, + off: function () { + this.S(this.scope).off(".fndtn.topbar"), this.S(t).off(".fndtn.topbar") + }, + reflow: function () { + } + } +}(jQuery, window, window.document); diff --git a/Source/ClassMap/Base.php b/Source/ClassMap/Base.php index d72892f..b9495ca 100644 --- a/Source/ClassMap/Base.php +++ b/Source/ClassMap/Base.php @@ -105,10 +105,10 @@ abstract class Base * @since 1.0.0 */ public function __construct( - array $classmap_files = array(), - $interface_classes_filename = '', - $concrete_classes_filename = '', - $events_filename = '', + array $classmap_files, + $interface_classes_filename, + $concrete_classes_filename, + $events_filename, $base_path ) { $this->classmap_files = $classmap_files; diff --git a/Source/Proxy/Base.php b/Source/Proxy/Base.php index e07c711..b6e136f 100644 --- a/Source/Proxy/Base.php +++ b/Source/Proxy/Base.php @@ -121,7 +121,7 @@ public function __construct( array $adapter_instance_array = array() ) { - $this->scheme = $scheme; + $this->scheme = $scheme; foreach ($adapter_instance_array as $adapter => $adapter_instance) { $this->setAdapterInstance($adapter, $adapter_instance); @@ -131,8 +131,8 @@ public function __construct( /** * Set Adapter Instance * - * @param string $adapter_name - * @param object /CommonApi/Resource/ResourceInterface + * @param string $adapter_name + * @param object /CommonApi/Resource/ResourceInterface * * @return $this * @since 1.0.0 diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 45ac191..0f3b317 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -94,8 +94,7 @@ protected function processNamespaceFolder($namespace_base_folder, $namespace_pre $paths[] = $this->base_path . '/' . $namespace_base_folder; $this->resource_map[strtolower($namespace_prefix)] = array_unique($paths); - $objects = new RecursiveIteratorIterator - ( + $objects = new RecursiveIteratorIterator( new RecursiveDirectoryIterator($this->base_path . '/' . $namespace_base_folder), RecursiveIteratorIterator::SELF_FIRST ); From 1ba3b283f221735161a88d899c8aa3bdfa12363e Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Tue, 24 Feb 2015 15:42:52 -0600 Subject: [PATCH 08/11] ResourceMapTest --- .dev/Bootstrap.php | 2 + .dev/ReadJsonFile.php | 31 ++ .dev/Reflection.php | 3 +- .dev/Tests/ClassMapTest.php | 9 - .dev/Tests/ResourceMapTest.php | 412 ++++++++++++++++++++ .dev/Tests/Source/ExcludeFolders.json | 13 + .dev/Tests/Source/Output/ClassMap.json | 44 +++ .dev/Tests/Source/Output/ResourceMap.json | 59 +++ .dev/Tests/Source/Results/ClassMap.json | 44 +++ .dev/Tests/Source/SetNamespace.php | 10 + Source/ResourceMap.php | 11 +- Source/ResourceMap/Prefixes.php | 148 +++++--- Source/xxxDriver.php | 438 ---------------------- coverage.clover | 367 +++++++++++++++--- 14 files changed, 1022 insertions(+), 569 deletions(-) create mode 100644 .dev/ReadJsonFile.php create mode 100644 .dev/Tests/ResourceMapTest.php create mode 100644 .dev/Tests/Source/ExcludeFolders.json create mode 100644 .dev/Tests/Source/Output/ClassMap.json create mode 100644 .dev/Tests/Source/Output/ResourceMap.json create mode 100644 .dev/Tests/Source/Results/ClassMap.json create mode 100644 .dev/Tests/Source/SetNamespace.php delete mode 100644 Source/xxxDriver.php diff --git a/.dev/Bootstrap.php b/.dev/Bootstrap.php index f94b426..65daaf6 100644 --- a/.dev/Bootstrap.php +++ b/.dev/Bootstrap.php @@ -1,4 +1,5 @@ 0) { + $temp_array = array(); + foreach ($temp as $key => $value) { + $temp_array[$key] = $value; + } + } + + return $temp_array; +} diff --git a/.dev/Reflection.php b/.dev/Reflection.php index 558b32a..abb3fc7 100644 --- a/.dev/Reflection.php +++ b/.dev/Reflection.php @@ -1,7 +1,6 @@ getMethods(); -var_dump($methods); foreach ($methods as $method) { echo ' * @covers ' . $method->class . '::' . $method->name . PHP_EOL; } diff --git a/.dev/Tests/ClassMapTest.php b/.dev/Tests/ClassMapTest.php index c6b2aba..722d10a 100644 --- a/.dev/Tests/ClassMapTest.php +++ b/.dev/Tests/ClassMapTest.php @@ -26,16 +26,7 @@ class ClassMapTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - /** - * - * $instance = new Proxy(new Resource(new MockRender)); - * - * $file = __DIR__ . '/RenderTest.php'; - * $data = array(); - * $stuff = $instance->render($file, $data); - * $this->assertEquals('stuff', $stuff); - */ return $this; } diff --git a/.dev/Tests/ResourceMapTest.php b/.dev/Tests/ResourceMapTest.php new file mode 100644 index 0000000..931ef3c --- /dev/null +++ b/.dev/Tests/ResourceMapTest.php @@ -0,0 +1,412 @@ +resource_adapter = new $class ( + // Input + $base_path, + $exclude_folders_array, + // Output + $classmap_filename, + $resource_map_filename + ); + + return $this; + } + + /** + * Set Namespace + * + * @covers Molajo\Resource\ResourceMap::setNamespace + * @covers Molajo\Resource\ResourceMap::createMap + * @covers Molajo\Resource\ResourceMap::saveOutput + * @covers Molajo\Resource\ResourceMap::getResourceMap + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespacePrefixes + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Prefixes::processFilePathObjects + * @covers Molajo\Resource\ResourceMap\Prefixes::testFileForNamespaceRules + * @covers Molajo\Resource\ResourceMap\Prefixes::setBase + * @covers Molajo\Resource\ResourceMap\Prefixes::setFileInclusion + * @covers Molajo\Resource\ResourceMap\Prefixes::testPHPClassExceptions + * @covers Molajo\Resource\ResourceMap\Prefixes::testExcludeFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::setPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setQNS + * @covers Molajo\Resource\ResourceMap\Prefixes::setNamespaceObject + * @covers Molajo\Resource\ResourceMap\Prefixes::useFilesWithNamespace + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Base::__construct + * @covers Molajo\Resource\ResourceMap\Base::getReflectionObject + * @covers Molajo\Resource\ResourceMap\Base::addSlash + * + * @return $this + * @since 1.0.0 + */ + public function setNamespace() + { + $this->resource_adapter->setNamespace('Molajo\\A\\', 'Source/A/'); + $this->resource_adapter->setNamespace('Molajo\\B\\', 'Source/B/'); + $this->resource_adapter->setNamespace('Molajo\\C\\', 'Source/C/'); + + return $this; + } + + /** + * Set Namespace + * + * @covers Molajo\Resource\ResourceMap::setNamespace + * @covers Molajo\Resource\ResourceMap::createMap + * @covers Molajo\Resource\ResourceMap::saveOutput + * @covers Molajo\Resource\ResourceMap::getResourceMap + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespacePrefixes + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Prefixes::processFilePathObjects + * @covers Molajo\Resource\ResourceMap\Prefixes::testFileForNamespaceRules + * @covers Molajo\Resource\ResourceMap\Prefixes::setBase + * @covers Molajo\Resource\ResourceMap\Prefixes::setFileInclusion + * @covers Molajo\Resource\ResourceMap\Prefixes::testPHPClassExceptions + * @covers Molajo\Resource\ResourceMap\Prefixes::testExcludeFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::setPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setQNS + * @covers Molajo\Resource\ResourceMap\Prefixes::setNamespaceObject + * @covers Molajo\Resource\ResourceMap\Prefixes::useFilesWithNamespace + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Base::__construct + * @covers Molajo\Resource\ResourceMap\Base::getReflectionObject + * @covers Molajo\Resource\ResourceMap\Base::addSlash + * + * @return $this + * @since 1.0.0 + */ + public function createMap() + { + $this->resource_adapter->createMap(); + + return $this; + } + + /** + * @covers Molajo\Resource\ResourceMap::setNamespace + * @covers Molajo\Resource\ResourceMap::createMap + * @covers Molajo\Resource\ResourceMap::saveOutput + * @covers Molajo\Resource\ResourceMap::getResourceMap + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespacePrefixes + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Prefixes::processFilePathObjects + * @covers Molajo\Resource\ResourceMap\Prefixes::testFileForNamespaceRules + * @covers Molajo\Resource\ResourceMap\Prefixes::setBase + * @covers Molajo\Resource\ResourceMap\Prefixes::setFileInclusion + * @covers Molajo\Resource\ResourceMap\Prefixes::testPHPClassExceptions + * @covers Molajo\Resource\ResourceMap\Prefixes::testExcludeFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::setPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setQNS + * @covers Molajo\Resource\ResourceMap\Prefixes::setNamespaceObject + * @covers Molajo\Resource\ResourceMap\Prefixes::useFilesWithNamespace + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Base::__construct + * @covers Molajo\Resource\ResourceMap\Base::getReflectionObject + * @covers Molajo\Resource\ResourceMap\Base::addSlash + * + * @return $this + * @since 1.0.0 + */ + public function testSetNamespace() + { + $this->resource_adapter->setNamespace('Molajo\\A\\', 'Source/A/'); + $this->resource_adapter->setNamespace('Molajo\\B\\', 'Source/B/'); + $this->resource_adapter->setNamespace('Molajo\\C\\', 'Source/C/'); + + $expected = array(); + $expected['Molajo\\A\\'] = array('Source/A/'); + $expected['Molajo\\B\\'] = array('Source/B/'); + $expected['Molajo\\C\\'] = array('Source/C/'); + + $this->assertEquals($expected, $this->resource_adapter->get('namespace_prefixes')); + + return $this; + } + + /** + * @covers Molajo\Resource\ResourceMap::setNamespace + * @covers Molajo\Resource\ResourceMap::createMap + * @covers Molajo\Resource\ResourceMap::saveOutput + * @covers Molajo\Resource\ResourceMap::getResourceMap + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespacePrefixes + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Prefixes::processFilePathObjects + * @covers Molajo\Resource\ResourceMap\Prefixes::testFileForNamespaceRules + * @covers Molajo\Resource\ResourceMap\Prefixes::setBase + * @covers Molajo\Resource\ResourceMap\Prefixes::setFileInclusion + * @covers Molajo\Resource\ResourceMap\Prefixes::testPHPClassExceptions + * @covers Molajo\Resource\ResourceMap\Prefixes::testExcludeFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::setPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setQNS + * @covers Molajo\Resource\ResourceMap\Prefixes::setNamespaceObject + * @covers Molajo\Resource\ResourceMap\Prefixes::useFilesWithNamespace + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Base::__construct + * @covers Molajo\Resource\ResourceMap\Base::getReflectionObject + * @covers Molajo\Resource\ResourceMap\Base::addSlash + * + * @return $this + * @since 1.0.0 + */ + public function testClassFiles() + { + $this->setNamespace(); + $this->resource_adapter->createMap(); + + $class_files = array(); + + /** Row 1 */ + $row = new stdClass(); + + $row->file_name = 'Cat.php'; + $row->base_name = 'Cat'; + $row->path = 'Source/A/Cat.php'; + $row->file_name = 'Cat.php'; + $row->qns = 'Molajo\\A\\Cat'; + + $class_files[$row->path] = $row; + + /** Row 2 */ + $row = new stdClass(); + + $row->file_name = 'Dog.php'; + $row->base_name = 'Dog'; + $row->path = 'Source/A/Dog.php'; + $row->file_name = 'Dog.php'; + $row->qns = 'Molajo\\A\\Dog'; + + $class_files[$row->path] = $row; + + /** Row 3 */ + $row = new stdClass(); + + $row->file_name = 'Mouse.php'; + $row->base_name = 'Mouse'; + $row->path = 'Source/A/Mouse.php'; + $row->file_name = 'Mouse.php'; + $row->qns = 'Molajo\\A\\Mouse'; + + $class_files[$row->path] = $row; + + /** Row 4 */ + $row = new stdClass(); + + $row->file_name = 'Zebra.php'; + $row->base_name = 'Zebra'; + $row->path = 'Source/A/Z/Zebra.php'; + $row->file_name = 'Zebra.php'; + $row->qns = 'Molajo\\A\\Z\\Zebra'; + + $class_files[$row->path] = $row; + + /** Row 5 */ + $row = new stdClass(); + + $row->file_name = 'Banana.php'; + $row->base_name = 'Banana'; + $row->path = 'Source/B/Banana.php'; + $row->file_name = 'Banana.php'; + $row->qns = 'Molajo\\B\\Banana'; + + $class_files[$row->path] = $row; + + /** Row 6 */ + $row = new stdClass(); + + $row->file_name = 'Bat.php'; + $row->base_name = 'Bat'; + $row->path = 'Source/B/Bat.php'; + $row->file_name = 'Bat.php'; + $row->qns = 'Molajo\\B\\Bat'; + + $class_files[$row->path] = $row; + + /** Row 7 */ + $row = new stdClass(); + + $row->file_name = 'Candy.php'; + $row->base_name = 'Candy'; + $row->path = 'Source/C/Candy.php'; + $row->file_name = 'Candy.php'; + $row->qns = 'Molajo\\C\\Candy'; + + $class_files[$row->path] = $row; + + $this->assertEquals($class_files, $this->resource_adapter->get('class_files')); + + return $this; + } + + + /** + * @covers Molajo\Resource\ResourceMap::setNamespace + * @covers Molajo\Resource\ResourceMap::createMap + * @covers Molajo\Resource\ResourceMap::saveOutput + * @covers Molajo\Resource\ResourceMap::getResourceMap + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespacePrefixes + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::processNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Prefixes::processFilePathObjects + * @covers Molajo\Resource\ResourceMap\Prefixes::testFileForNamespaceRules + * @covers Molajo\Resource\ResourceMap\Prefixes::setBase + * @covers Molajo\Resource\ResourceMap\Prefixes::setFileInclusion + * @covers Molajo\Resource\ResourceMap\Prefixes::testPHPClassExceptions + * @covers Molajo\Resource\ResourceMap\Prefixes::testExcludeFolders + * @covers Molajo\Resource\ResourceMap\Prefixes::setPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setQNS + * @covers Molajo\Resource\ResourceMap\Prefixes::setNamespaceObject + * @covers Molajo\Resource\ResourceMap\Prefixes::useFilesWithNamespace + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths + * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder + * @covers Molajo\Resource\ResourceMap\Base::__construct + * @covers Molajo\Resource\ResourceMap\Base::getReflectionObject + * @covers Molajo\Resource\ResourceMap\Base::addSlash + * + * @return $this + * @since 1.0.0 + */ + public function testResourceFiles() + { + $base = __DIR__ . '/'; + + $this->setNamespace(); + + $this->resource_adapter->createMap(); + + $resource_files = array(); + $resource_files['molajo\\a\\'] = array($base . 'Source/A/'); + $resource_files['molajo\\a\\cat'] = array($base . 'Source/A/Cat.php'); + $resource_files['molajo\\a\\dog'] = array($base . 'Source/A/Dog.php'); + $resource_files['molajo\\a\\mouse'] = array($base . 'Source/A/Mouse.php'); + $resource_files['molajo\\a\\z'] = array($base . 'Source/A/Z'); + $resource_files['molajo\\a\\z\\stripes.txt'] = array($base . 'Source/A/Z/Stripes.txt'); + $resource_files['molajo\\a\\z\\zebra'] = array($base . 'Source/A/Z/Zebra.php'); + $resource_files['molajo\\b\\'] = array($base . 'Source/B/'); + $resource_files['molajo\\b\\100x100.gif'] = array($base . 'Source/B/100x100.gif'); + $resource_files['molajo\\b\\150x150.gif'] = array($base . 'Source/B/150x150.gif'); + $resource_files['molajo\\b\\50x50.gif'] = array($base . 'Source/B/50x50.gif'); + $resource_files['molajo\\b\\banana'] = array($base . 'Source/B/Banana.php'); + $resource_files['molajo\\b\\bat'] = array($base . 'Source/B/Bat.php'); + $resource_files['molajo\\c\\'] = array($base . 'Source/C/'); + $resource_files['molajo\\c\\candy'] = array($base . 'Source/C/Candy.php'); + $resource_files['molajo\\c\\content.xml'] = array($base . 'Source/C/Content.xml'); + $resource_files['molajo\\c\\customize.css'] = array($base . 'Source/C/Customize.css'); + $resource_files['molajo\\c\\js'] = array($base . 'Source/C/Js'); + $resource_files['molajo\\c\\js\\foundation.min.js'] = array($base . 'Source/C/Js/foundation.min.js'); + + $resource_output = $this->resource_adapter->getResourceMap(); + + foreach ($resource_output as $key => $row) { + $this->assertEquals($row, $resource_files[$key]); + } + + return $this; + } +} + +class MockResourceMap extends ResourceMap +{ + public function get($key) + { + return $this->$key; + } +} diff --git a/.dev/Tests/Source/ExcludeFolders.json b/.dev/Tests/Source/ExcludeFolders.json new file mode 100644 index 0000000..88527f3 --- /dev/null +++ b/.dev/Tests/Source/ExcludeFolders.json @@ -0,0 +1,13 @@ +[ + ".dev", + ".travis.yml", + ".DS_Store", + ".git", + ".idea", + ".", + "..", + ".gitattributes", + ".gitignore", + "Test" +] + diff --git a/.dev/Tests/Source/Output/ClassMap.json b/.dev/Tests/Source/Output/ClassMap.json new file mode 100644 index 0000000..579583c --- /dev/null +++ b/.dev/Tests/Source/Output/ClassMap.json @@ -0,0 +1,44 @@ +{ + "Source\/A\/Cat.php": { + "file_name": "Cat.php", + "base_name": "Cat", + "path": "Source\/A\/Cat.php", + "qns": "Molajo\\A\\Cat" + }, + "Source\/A\/Dog.php": { + "file_name": "Dog.php", + "base_name": "Dog", + "path": "Source\/A\/Dog.php", + "qns": "Molajo\\A\\Dog" + }, + "Source\/A\/Mouse.php": { + "file_name": "Mouse.php", + "base_name": "Mouse", + "path": "Source\/A\/Mouse.php", + "qns": "Molajo\\A\\Mouse" + }, + "Source\/A\/Z\/Zebra.php": { + "file_name": "Zebra.php", + "base_name": "Zebra", + "path": "Source\/A\/Z\/Zebra.php", + "qns": "Molajo\\A\\Z\\Zebra" + }, + "Source\/B\/Banana.php": { + "file_name": "Banana.php", + "base_name": "Banana", + "path": "Source\/B\/Banana.php", + "qns": "Molajo\\B\\Banana" + }, + "Source\/B\/Bat.php": { + "file_name": "Bat.php", + "base_name": "Bat", + "path": "Source\/B\/Bat.php", + "qns": "Molajo\\B\\Bat" + }, + "Source\/C\/Candy.php": { + "file_name": "Candy.php", + "base_name": "Candy", + "path": "Source\/C\/Candy.php", + "qns": "Molajo\\C\\Candy" + } +} \ No newline at end of file diff --git a/.dev/Tests/Source/Output/ResourceMap.json b/.dev/Tests/Source/Output/ResourceMap.json new file mode 100644 index 0000000..9f719e6 --- /dev/null +++ b/.dev/Tests/Source/Output/ResourceMap.json @@ -0,0 +1,59 @@ +{ + "molajo\\a\\": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/" + ], + "molajo\\a\\cat": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Cat.php" + ], + "molajo\\a\\dog": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Dog.php" + ], + "molajo\\a\\mouse": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Mouse.php" + ], + "molajo\\a\\z": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Z" + ], + "molajo\\a\\z\\stripes.txt": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Z\/Stripes.txt" + ], + "molajo\\a\\z\\zebra": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/A\/Z\/Zebra.php" + ], + "molajo\\b\\": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/" + ], + "molajo\\b\\100x100.gif": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/100x100.gif" + ], + "molajo\\b\\150x150.gif": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/150x150.gif" + ], + "molajo\\b\\50x50.gif": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/50x50.gif" + ], + "molajo\\b\\banana": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/Banana.php" + ], + "molajo\\b\\bat": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/B\/Bat.php" + ], + "molajo\\c\\": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/" + ], + "molajo\\c\\candy": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/Candy.php" + ], + "molajo\\c\\content.xml": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/Content.xml" + ], + "molajo\\c\\customize.css": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/Customize.css" + ], + "molajo\\c\\js": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/Js" + ], + "molajo\\c\\js\\foundation.min.js": [ + "\/Users\/amystephen\/Sites\/git\/Molajo\/Resource\/.dev\/Tests\/Source\/C\/Js\/foundation.min.js" + ] +} \ No newline at end of file diff --git a/.dev/Tests/Source/Results/ClassMap.json b/.dev/Tests/Source/Results/ClassMap.json new file mode 100644 index 0000000..579583c --- /dev/null +++ b/.dev/Tests/Source/Results/ClassMap.json @@ -0,0 +1,44 @@ +{ + "Source\/A\/Cat.php": { + "file_name": "Cat.php", + "base_name": "Cat", + "path": "Source\/A\/Cat.php", + "qns": "Molajo\\A\\Cat" + }, + "Source\/A\/Dog.php": { + "file_name": "Dog.php", + "base_name": "Dog", + "path": "Source\/A\/Dog.php", + "qns": "Molajo\\A\\Dog" + }, + "Source\/A\/Mouse.php": { + "file_name": "Mouse.php", + "base_name": "Mouse", + "path": "Source\/A\/Mouse.php", + "qns": "Molajo\\A\\Mouse" + }, + "Source\/A\/Z\/Zebra.php": { + "file_name": "Zebra.php", + "base_name": "Zebra", + "path": "Source\/A\/Z\/Zebra.php", + "qns": "Molajo\\A\\Z\\Zebra" + }, + "Source\/B\/Banana.php": { + "file_name": "Banana.php", + "base_name": "Banana", + "path": "Source\/B\/Banana.php", + "qns": "Molajo\\B\\Banana" + }, + "Source\/B\/Bat.php": { + "file_name": "Bat.php", + "base_name": "Bat", + "path": "Source\/B\/Bat.php", + "qns": "Molajo\\B\\Bat" + }, + "Source\/C\/Candy.php": { + "file_name": "Candy.php", + "base_name": "Candy", + "path": "Source\/C\/Candy.php", + "qns": "Molajo\\C\\Candy" + } +} \ No newline at end of file diff --git a/.dev/Tests/Source/SetNamespace.php b/.dev/Tests/Source/SetNamespace.php new file mode 100644 index 0000000..d6b937c --- /dev/null +++ b/.dev/Tests/Source/SetNamespace.php @@ -0,0 +1,10 @@ +resource_map); ksort($this->class_files); - if (version_compare(PHP_VERSION, '5.4.0', '>=')) { - file_put_contents($this->resource_map_filename, json_encode($this->resource_map, JSON_PRETTY_PRINT)); - file_put_contents($this->classmap_filename, json_encode($this->class_files, JSON_PRETTY_PRINT)); - - return $this; - } - - file_put_contents($this->resource_map_filename, json_encode($this->resource_map)); - file_put_contents($this->classmap_filename, json_encode($this->class_files)); + file_put_contents($this->resource_map_filename, json_encode($this->resource_map, JSON_PRETTY_PRINT)); + file_put_contents($this->classmap_filename, json_encode($this->class_files, JSON_PRETTY_PRINT)); return $this; } diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 0f3b317..56368ef 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -170,20 +170,13 @@ protected function testFileForNamespaceRules( return $this; } - $path = $this->setPath($is_directory, $file_path, $file_name); - $class_namespace_path = substr($path, strlen($base_directory), 9999); - $qns = $this->setQNS($class_namespace_path, $namespace_prefix); - $nspath = $path; - - if ($is_directory === true) { - } else { - list($qns, $nspath) = $this->setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath); - } - - if ($qns === false) { - } else { - $this->mergeFQNSPaths($nspath, $qns); - } + $this->useFilesWithNamespace( + $namespace_prefix, + $base_directory, + $is_directory, + $file_path, + $file_name, + $file_extension); return $this; } @@ -342,57 +335,63 @@ protected function setQNS($class_namespace_path, $namespace_prefix) } /** - * Get Resource Map Tags + * Set Namespace Object * + * @param string $file_name * @param string $nspath * @param string $qns * - * @return $this + * @return object * @since 1.0.0 */ - protected function mergeFQNSPaths($nspath, $qns) + protected function setNamespaceObject($file_name, $nspath, $qns) { - if ($nspath === '') { - return $this; - } - - $qns = strtolower($qns); - - if (isset($this->resource_map[$qns])) { - $paths = $this->mergeExistingFQNSPath($qns); - } else { - $paths = array(); - } - - $paths[] = $this->base_path . '/' . $nspath; - - $this->resource_map[$qns] = array_unique($paths); + $temp = new stdClass(); + $temp->file_name = $file_name; + $temp->base_name = $this->base_name; + $temp->path = $nspath; + $temp->qns = $qns; - return $this; + return $temp; } /** - * Merge Existing FQNS Path + * File qualifies for use with Namespace * - * @param string $nspath - * @param string $qns + * @param string $namespace_prefix + * @param string $base_directory + * @param string $is_directory + * @param string $file_path + * @param string $file_name + * @param string $file_extension * - * @return array + * @return object * @since 1.0.0 */ - protected function mergeExistingFQNSPath($qns) - { - $paths = array(); - $existing = $this->resource_map[$qns]; + protected function useFilesWithNamespace( + $namespace_prefix, + $base_directory, + $is_directory, + $file_path, + $file_name, + $file_extension + ) { + $path = $this->setPath($is_directory, $file_path, $file_name); + $class_namespace_path = substr($path, strlen($base_directory), 9999); + $qns = $this->setQNS($class_namespace_path, $namespace_prefix); + $nspath = $path; - if (is_array($existing)) { - $paths = $existing; - if (count($paths) === 0) { - $paths = array(); - return $paths; - } + if ($is_directory === true) { + } else { + list($qns, $nspath) = $this->setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath); } - return $paths; + + if ($qns === false) { + } else { + $this->mergeFQNSPaths($nspath, $qns); + } + + return $this; } /** @@ -419,23 +418,56 @@ protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $ns } /** - * Set Namespace Object + * Get Resource Map Tags * - * @param string $file_name * @param string $nspath * @param string $qns * - * @return object + * @return $this * @since 1.0.0 */ - protected function setNamespaceObject($file_name, $nspath, $qns) + protected function mergeFQNSPaths($nspath, $qns) { - $temp = new stdClass(); - $temp->file_name = $file_name; - $temp->base_name = $this->base_name; - $temp->path = $nspath; - $temp->qns = $qns; + if ($nspath === '') { + return $this; + } - return $temp; + $qns = strtolower($qns); + + if (isset($this->resource_map[$qns])) { + $paths = $this->mergeExistingFQNSPath($qns); + } else { + $paths = array(); + } + + $paths[] = $this->base_path . '/' . $nspath; + + $this->resource_map[$qns] = array_unique($paths); + + return $this; + } + + /** + * Merge Existing FQNS Path + * + * @param string $nspath + * @param string $qns + * + * @return array + * @since 1.0.0 + */ + protected function mergeExistingFQNSPath($qns) + { + $paths = array(); + $existing = $this->resource_map[$qns]; + + if (is_array($existing)) { + $paths = $existing; + if (count($paths) === 0) { + $paths = array(); + } + } + + return $paths; } } diff --git a/Source/xxxDriver.php b/Source/xxxDriver.php deleted file mode 100644 index bbc0460..0000000 --- a/Source/xxxDriver.php +++ /dev/null @@ -1,438 +0,0 @@ -scheme = $scheme; - $this->adapter_instance_array = array(); - - foreach ($adapter_instance_array as $key => $value) { - $this->setAdapterInstance($key, $value); - } - - $this->register(); - } - - /** - * Map a namespace prefix to a filesystem path - * - * @param string $namespace_prefix - * @param string $base_directory - * @param boolean $prepend - * - * @return $this - * @since 1.0.0 - */ - public function setNamespace($namespace_prefix, $base_directory, $prepend = true) - { - foreach ($this->adapter_instance_array as $key => $value) { - $this->adapter_instance_array[$key]->setNamespace( - $namespace_prefix, - $base_directory, - $prepend - ); - } - - return $this; - } - - /** - * Pass in the Adapter Instance for a Scheme Adapter - * => For class construction or adding a new scheme/adapter after instantiation - * - * @param string $adapter - * @param object $adapter_instance - * - * @return $this - * @since 1.0.0 - */ - public function setAdapterInstance($adapter = 'File', $adapter_instance) - { - if ($adapter_instance instanceof AdapterInterface) { - $this->adapter_instance_array[$adapter] = $adapter_instance; - } - - return $this; - } - - /** - * Registers Class Autoloader - * - * @param boolean $prepend - * - * @return $this - * @since 1.0.0 - */ - public function register($prepend = true) - { - spl_autoload_register(array($this, 'locateNamespace'), true, $prepend); - - return $this; - } - - /** - * Unregister Class Autoloader - * - * @return $this - * @since 1.0.0 - */ - public function unregister() - { - spl_autoload_unregister(array($this, 'locateNamespace')); - - return $this; - } - - /** - * Get Scheme (or all schemes) - * - * @param string $scheme - * - * @return object|array - * @since 1.0.0 - * @throws \CommonApi\Exception\RuntimeException - */ - public function getScheme($scheme = '') - { - if ($scheme == '') { - return $this->scheme->getScheme(); - } - - $scheme = ucfirst(strtolower($scheme)); - - $this->scheme_value = $scheme; - - $this->scheme_properties = $this->scheme->getScheme($this->scheme_value); - - if ($this->scheme_properties === false) { - throw new RuntimeException('Resource getScheme Scheme not found: ' . $this->scheme_value); - } - - $this->adapter_value = $this->scheme_properties->adapter; - - if (isset($this->adapter_instance_array[$this->adapter_value])) { - } else { - echo 'in Resource Adapter ' . $this->adapter_value . '
    '; - echo '
    ';
    -            foreach ($this->adapter_instance_array as $key => $value) {
    -                echo $key . '
    '; - } - die; - var_dump($this->adapter_instance_array); - echo '
    '; - throw new RuntimeException('Resource getScheme Adapter not found: ' . $this->adapter_value); - } - - return $this->scheme_properties; - } - - /** - * Define Scheme, associated Adapter and allowable file extensions (empty array means any extension allowed) - * - * @param string $scheme_name - * @param string $adapter - * @param array $extensions - * @param bool $replace - * - * @return $this - * @since 1.0.0 - */ - public function setScheme($scheme_name, $adapter = 'File', array $extensions = array(), $replace = false) - { - $this->scheme->setScheme($scheme_name, $adapter, $extensions, $replace); - - return $this; - } - - /** - * Verify if the resource namespace has been defined or not - * - * @param string $uri_namespace - * - * @return boolean - * @since 1.0.0 - */ - public function exists($uri_namespace) - { - try { - $this->parseUri($uri_namespace); - $this->scheme_value = 'file'; - $this->getScheme($this->scheme_value); - - $located_path = $this->adapter_instance_array[$this->adapter_value]->get($uri_namespace); - if ($located_path === false) { - return false; - } - - return true; - - } catch (Exception $e) { - return false; - } - } - - /** - * Locates folder/file associated with URI Namespace for Resource - * - * @param string $uri_namespace - * @param array $options - * - * @return void|mixed - * @since 1.0.0 - */ - public function get($uri_namespace, array $options = array()) - { - $this->parseUri($uri_namespace); - - if ($this->scheme_value === 'Field') { - return $this->adapter_instance_array[$this->adapter_value]->get(substr($uri_namespace, 9, 999)); - } - - return $this->locateNamespace(str_replace('\\', '/', $this->path), $this->scheme_value, $options); - } - - /** - * Locates a resource using only the namespace - * - * @param string $namespace - * @param string $scheme - * @param array $options - * - * @return void|mixed - * @since 1.0.0 - */ - public function locateNamespace($namespace, $scheme = 'ClassLoader', array $options = array()) - { - $this->getScheme($scheme); - - $multiple = false; - - if (isset($options['multiple']) && $options['multiple'] === true) { - $multiple = true; - } - - $located_path = $this->adapter_instance_array[$this->adapter_value]->get($namespace, $multiple); - - $options['namespace'] = $namespace; - - return $this->handlePath($this->scheme_value, $located_path, $options); - } - - /** - * Handle located folder/file associated with URI Namespace for Resource - * - * @param string $scheme_value - * @param string $located_path - * @param array $options - * - * @return void|mixed - * @since 1.0.0 - */ - public function handlePath($scheme_value, $located_path, array $options = array()) - { - $this->getScheme($scheme_value); - - if (strtolower($scheme_value) == 'query') { - $xml = $this->adapter_instance_array['Xml']->handlePath( - $scheme_value, - $located_path, - $options - ); - $options['xml'] = $xml; - - $this->adapter_value = 'Query'; - } - - return $this->adapter_instance_array[$this->adapter_value]->handlePath($scheme_value, $located_path, $options); - } - - /** - * Retrieve a collection of a specific adapter - * - * @param string $scheme_value - * @param array $options - * - * @return mixed - * @since 1.0.0 - */ - public function getCollection($scheme_value, array $options = array()) - { - $this->getScheme($scheme_value); - - return $this->adapter_instance_array[$this->adapter_value]->getCollection($scheme_value, $options); - } - - /** - * Parse the URL - * - * @param string $uri - * - * @return $this - * @since 1.0.0 - */ - protected function parseUri($uri) - { - $scheme = parse_url($uri, PHP_URL_SCHEME); - - if ($scheme === false) { - if (strpos($uri, ':///') === false) { - } else { - $scheme = substr($uri, 0, strpos($uri, ':///')); - $uri = substr($uri, strpos($uri, ':///') + 4, 9999); - } - } - - if ($scheme === false) { - if (strpos($uri, ':/') === false) { - } else { - $scheme = substr($uri, 0, strpos($uri, ':/')); - $uri = substr($uri, strpos($uri, ':/') + 2, 9999); - } - } - - $this->getScheme($scheme); - - $this->host = parse_url($uri, PHP_URL_HOST); - $this->user = parse_url($uri, PHP_URL_USER); - $this->password = parse_url($uri, PHP_URL_PASS); - $this->path = parse_url($uri, PHP_URL_PATH); - $this->query = array(); - $query = parse_url($uri, PHP_URL_QUERY); - if ($query === null || $query === false) { - $query = ''; - } - $temp = explode(',', $query); - if (count($temp) > 0) { - foreach ($temp as $item) { - $pair = explode('=', $item); - if (count($pair) == 2) { - $this->query[$pair[0]] = $pair[1]; - } - } - } - $this->fragment = parse_url($uri, PHP_URL_FRAGMENT); - - return $this; - } -} diff --git a/coverage.clover b/coverage.clover index b542e82..30d312c 100644 --- a/coverage.clover +++ b/coverage.clover @@ -1,12 +1,12 @@ - - + + - - + + @@ -34,6 +34,266 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -142,73 +402,73 @@ - - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - + + + + + + - + - + - - + + - - - + + + - - - + + + - + - - + + - - - - - + + + + + - + + - + @@ -221,24 +481,25 @@ - + - + - + - - - + + + - + + - + From 2780e61f14cfdc813a40e7140523a3bd2febdaf8 Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Tue, 24 Feb 2015 15:50:47 -0600 Subject: [PATCH 09/11] ResourceMapTest Fixed 2 new errors --- Source/Proxy/Base.php | 2 +- Source/ResourceMap/Prefixes.php | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/Proxy/Base.php b/Source/Proxy/Base.php index b6e136f..fefe01d 100644 --- a/Source/Proxy/Base.php +++ b/Source/Proxy/Base.php @@ -132,7 +132,7 @@ public function __construct( * Set Adapter Instance * * @param string $adapter_name - * @param object /CommonApi/Resource/ResourceInterface + * @param object ResourceInterface * * @return $this * @since 1.0.0 diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 56368ef..84ab101 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -176,7 +176,8 @@ protected function testFileForNamespaceRules( $is_directory, $file_path, $file_name, - $file_extension); + $file_extension + ); return $this; } From ff7a958ce30980ef154360da7a2c3c3e246dff8f Mon Sep 17 00:00:00 2001 From: AmyStephen Date: Tue, 24 Feb 2015 15:58:07 -0600 Subject: [PATCH 10/11] mergeExistingFQNSPath method --- .dev/Tests/ResourceMapTest.php | 6 +++ Source/ResourceMap/Prefixes.php | 83 ++++++++++++++++++++------------- 2 files changed, 57 insertions(+), 32 deletions(-) diff --git a/.dev/Tests/ResourceMapTest.php b/.dev/Tests/ResourceMapTest.php index 931ef3c..e50606f 100644 --- a/.dev/Tests/ResourceMapTest.php +++ b/.dev/Tests/ResourceMapTest.php @@ -51,6 +51,7 @@ class ResourceMapTest extends \PHPUnit_Framework_TestCase * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder @@ -106,6 +107,7 @@ protected function setUp() * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder @@ -148,6 +150,7 @@ public function setNamespace() * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder @@ -186,6 +189,7 @@ public function createMap() * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder @@ -233,6 +237,7 @@ public function testSetNamespace() * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder @@ -354,6 +359,7 @@ public function testClassFiles() * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Prefixes::mergeFQNSPaths * @covers Molajo\Resource\ResourceMap\Prefixes::mergeExistingFQNSPath + * @covers Molajo\Resource\ResourceMap\Prefixes::setClassfileArrayEntry * @covers Molajo\Resource\ResourceMap\Folders::setMultipleNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::appendNamespaceFolder * @covers Molajo\Resource\ResourceMap\Folders::prependNamespaceFolder diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 84ab101..21cb348 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -382,42 +382,11 @@ protected function useFilesWithNamespace( $qns = $this->setQNS($class_namespace_path, $namespace_prefix); $nspath = $path; - if ($is_directory === true) { - } else { - list($qns, $nspath) = $this->setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath); - } - - if ($qns === false) { - } else { - $this->mergeFQNSPaths($nspath, $qns); - } + $this->SetFileDirectoryNamespace($is_directory, $file_name, $file_extension, $qns, $nspath); return $this; } - /** - * Set Class File Array Entry - * - * @param string $file_name - * @param string $file_extension - * @param string $nspath - * - * @return array - * @since 1.0.0 - */ - protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath) - { - $qns = $this->addSlash($qns); - $qns = $qns . $this->base_name; - $nspath = $nspath . '/' . $file_name; - - if ($file_extension === 'php') { - $this->class_files[$nspath] = $this->setNamespaceObject($file_name, $nspath, $qns); - } - - return array($qns, $nspath); - } - /** * Get Resource Map Tags * @@ -471,4 +440,54 @@ protected function mergeExistingFQNSPath($qns) return $paths; } + + /** + * Set File Directory Namespace + * + * @param string $is_directory + * @param string $file_name + * @param string $file_extension + * @param string $qns + * @param string $nspath + * + * @return $this + * @since 1.0.0 + */ + protected function SetFileDirectoryNamespace($is_directory, $file_name, $file_extension, $qns, $nspath) + { + if ($is_directory === true) { + } else { + list($qns, $nspath) = $this->setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath); + } + + if ($qns === false) { + } else { + $this->mergeFQNSPaths($nspath, $qns); + } + + return $this; + } + + /** + * Set Class File Array Entry + * + * @param string $file_name + * @param string $file_extension + * @param string $nspath + * + * @return array + * @since 1.0.0 + */ + protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath) + { + $qns = $this->addSlash($qns); + $qns = $qns . $this->base_name; + $nspath = $nspath . '/' . $file_name; + + if ($file_extension === 'php') { + $this->class_files[$nspath] = $this->setNamespaceObject($file_name, $nspath, $qns); + } + + return array($qns, $nspath); + } } From 34edab17c830aa785562915fb3464e52f38bc8d7 Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Tue, 24 Feb 2015 22:06:28 +0000 Subject: [PATCH 11/11] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- Source/ResourceMap/Prefixes.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/ResourceMap/Prefixes.php b/Source/ResourceMap/Prefixes.php index 21cb348..635939c 100644 --- a/Source/ResourceMap/Prefixes.php +++ b/Source/ResourceMap/Prefixes.php @@ -85,7 +85,7 @@ protected function processNamespaceFolders($namespace_base_folders, $namespace_p * @param string $namespace_base_folder * @param string $namespace_prefix * - * @return object + * @return Prefixes * @since 1.0.0 */ protected function processNamespaceFolder($namespace_base_folder, $namespace_prefix) @@ -107,11 +107,11 @@ protected function processNamespaceFolder($namespace_base_folder, $namespace_pre /** * Process File Objects * - * @param object $objects + * @param RecursiveIteratorIterator $objects * @param string $namespace_prefix * @param string $namespace_base_folder * - * @return object + * @return Prefixes * @since 1.0.0 */ protected function processFilePathObjects($objects, $namespace_prefix, $namespace_base_folder) @@ -145,7 +145,7 @@ protected function processFilePathObjects($objects, $namespace_prefix, $namespac * @param string $file_name * @param string $file_extension * - * @return int|object + * @return Prefixes * @since 1.0.0 */ protected function testFileForNamespaceRules( @@ -215,7 +215,7 @@ protected function setBase($is_directory, $file_path, $file_name, $file_extensio * @param string $file_name * @param string $file_extension * - * @return boolean + * @return integer * @since 1.0.0 */ protected function setFileInclusion($is_directory, $file_name, $file_extension) @@ -241,7 +241,7 @@ protected function setFileInclusion($is_directory, $file_name, $file_extension) * * @param string $file_name * - * @return $this + * @return boolean * @since 1.0.0 */ protected function testPHPClassExceptions($file_name) @@ -342,7 +342,7 @@ protected function setQNS($class_namespace_path, $namespace_prefix) * @param string $nspath * @param string $qns * - * @return object + * @return stdClass * @since 1.0.0 */ protected function setNamespaceObject($file_name, $nspath, $qns) @@ -366,7 +366,7 @@ protected function setNamespaceObject($file_name, $nspath, $qns) * @param string $file_name * @param string $file_extension * - * @return object + * @return Prefixes * @since 1.0.0 */ protected function useFilesWithNamespace( @@ -420,7 +420,6 @@ protected function mergeFQNSPaths($nspath, $qns) /** * Merge Existing FQNS Path * - * @param string $nspath * @param string $qns * * @return array @@ -474,8 +473,9 @@ protected function SetFileDirectoryNamespace($is_directory, $file_name, $file_ex * @param string $file_name * @param string $file_extension * @param string $nspath + * @param string $qns * - * @return array + * @return string[] * @since 1.0.0 */ protected function setClassfileArrayEntry($file_name, $file_extension, $qns, $nspath)