From 0ec131d3d0cdf8e81cafb7bdf04fc6572382ef6c Mon Sep 17 00:00:00 2001 From: balexey88 Date: Tue, 19 Dec 2023 16:15:53 +0200 Subject: [PATCH 01/16] Fix cleanup files during build process --- build.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/build.sh b/build.sh index 6fcbf6793..3d9a1e28a 100644 --- a/build.sh +++ b/build.sh @@ -186,15 +186,16 @@ else rm -rf ocular.phar rm -rf build rm -rf node_modules - rm -rf composer.lock - rm -rf .scrutinizer.yml - rm -rf circle.yml - rm -rf build.sh - rm -rf gruntfile.js - rm -rf makefile - rm -rf package.json + rm -f composer.lock + rm -f .scrutinizer.yml + rm -f circle.yml + rm -f build.sh + rm -f Gruntfile.js + rm -f Makefile + rm -f package.json rm -rf test - rm -rf package-lock.json + rm -f package-lock.json + rm -f .gitignore echo "Be sure we do not add .git directories" find ./vendor -name .git -exec rm -rf '{}' \; echo "Be sure we do not add .svn directories" From 2eeffeb9fc1133d0b8c4bc947f2d296c6a9cfbb7 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 29 Dec 2023 18:27:28 +0200 Subject: [PATCH 02/16] Remove 'udx/lib-settings' and 'udx/lib-utility' packages --- changelog.txt | 4 + changes.md | 4 + composer.json | 10 +- composer.lock | 142 +- lib/classes/class-errors.php | 2 +- lib/classes/class-settings.php | 6 +- .../lib => lib/includes}/class-settings.php | 28 +- lib/includes/class-utility.php | 207 ++ readme.txt | 2 +- vendor/composer/autoload_classmap.php | 10 +- vendor/composer/autoload_static.php | 10 +- vendor/composer/installed.json | 150 +- vendor/composer/installed.php | 34 +- vendor/udx/lib-settings/.gitignore | 20 - vendor/udx/lib-settings/composer.json | 50 - vendor/udx/lib-settings/gruntfile.js | 181 -- vendor/udx/lib-settings/package.json | 28 - vendor/udx/lib-settings/readme.md | 111 - vendor/udx/lib-settings/static/readme.html | 206 -- .../lib-settings/static/schemas/settings.json | 4 - .../static/scripts/src/udx.settings.js | 142 - .../static/scripts/src/udx.storage.js | 179 -- .../static/scripts/udx.settings.js | 1 - .../static/scripts/udx.storage.js | 1 - .../static/views/new-installation.xhtml | 5 - .../static/views/setup-assistant.xhtml | 73 - .../static/views/upgrade-splash.xhtml | 121 - vendor/udx/lib-settings/test/basic.php | 36 - vendor/udx/lib-settings/test/mocha.opts | 37 - vendor/udx/lib-ud-api-client/changes.md | 3 + vendor/udx/lib-ud-api-client/gruntfile.js | 2 +- .../lib/classes/class-admin.php | 2 +- .../lib/classes/class-bootstrap.php | 2 +- .../lib/classes/class-licenses-table.php | 2 +- .../lib/classes/class-utility.php | 53 + vendor/udx/lib-ud-api-client/package.json | 2 +- vendor/udx/lib-utility/.gitignore | 20 - vendor/udx/lib-utility/.gitmodules | 3 - vendor/udx/lib-utility/composer.json | 52 - vendor/udx/lib-utility/composer.lock | 720 ----- vendor/udx/lib-utility/gruntfile.js | 229 -- vendor/udx/lib-utility/lib/class-guid-fix.php | 205 -- vendor/udx/lib-utility/lib/class-job.php | 417 --- vendor/udx/lib-utility/lib/class-loader.php | 445 --- .../udx/lib-utility/lib/class-structure.php | 229 -- vendor/udx/lib-utility/lib/class-term.php | 127 - vendor/udx/lib-utility/lib/class-utility.php | 2595 ----------------- vendor/udx/lib-utility/package.json | 30 - vendor/udx/lib-utility/readme.md | 59 - .../lib-utility/scripts/analysis.client.js | 1 - .../scripts/analysis.visualizer.js | 1 - .../lib-utility/scripts/jquery.ud.buttons.js | 1 - .../scripts/jquery.ud.date-selector.js | 1 - .../scripts/jquery.ud.dynamic-filter.js | 2 - .../scripts/jquery.ud.elastic_filter.js | 1 - .../scripts/jquery.ud.execute-triggers.js | 1 - .../scripts/jquery.ud.form-helper.js | 1 - .../scripts/jquery.ud.smart-buttons.js | 1 - .../lib-utility/scripts/jquery.ud.social.js | 1 - .../scripts/jquery.ud.super-search.js | 1 - .../scripts/jquery.ui.progressbar.js | 1 - .../scripts/src/analysis.client.js | 205 -- .../scripts/src/analysis.visualizer.js | 194 -- .../scripts/src/jquery.ud.buttons.js | 260 -- .../scripts/src/jquery.ud.date-selector.js | 1175 -------- .../scripts/src/jquery.ud.dynamic-filter.js | 2351 --------------- .../scripts/src/jquery.ud.elastic_filter.js | 938 ------ .../scripts/src/jquery.ud.execute-triggers.js | 161 - .../scripts/src/jquery.ud.form-helper.js | 1123 ------- .../scripts/src/jquery.ud.smart-buttons.js | 260 -- .../scripts/src/jquery.ud.social.js | 193 -- .../scripts/src/jquery.ud.super-search.js | 363 --- .../scripts/src/jquery.ui.progressbar.js | 108 - .../lib-utility/scripts/src/udx.analytics.js | 233 -- .../udx/lib-utility/scripts/src/udx.event.js | 561 ---- .../udx/lib-utility/scripts/src/udx.filter.js | 54 - .../udx/lib-utility/scripts/src/udx.fleck.js | 214 -- .../udx/lib-utility/scripts/src/udx.happ.js | 450 --- .../scripts/src/udx.happ.json_editor.js | 196 -- .../scripts/src/udx.happ.socket.js | 35 - .../scripts/src/udx.happ.view_model.js | 278 -- .../udx/lib-utility/scripts/src/udx.loader.js | 360 --- vendor/udx/lib-utility/scripts/src/udx.log.js | 420 --- vendor/udx/lib-utility/scripts/src/udx.spa.js | 189 -- .../scripts/src/udx.utility.activity.js | 263 -- .../scripts/src/udx.utility.bus.js | 93 - .../scripts/src/udx.utility.device.js | 28 - .../scripts/src/udx.utility.facebook.like.js | 23 - .../scripts/src/udx.utility.job.js | 10 - .../lib-utility/scripts/src/udx.utility.js | 241 -- .../scripts/src/udx.utility.loader.js | 10 - .../scripts/src/udx.utility.md5.js | 188 -- .../scripts/src/udx.utility.process.js | 205 -- .../udx/lib-utility/scripts/udx.analytics.js | 1 - vendor/udx/lib-utility/scripts/udx.event.js | 1 - vendor/udx/lib-utility/scripts/udx.filter.js | 1 - vendor/udx/lib-utility/scripts/udx.fleck.js | 1 - vendor/udx/lib-utility/scripts/udx.happ.js | 1 - .../scripts/udx.happ.json_editor.js | 1 - .../lib-utility/scripts/udx.happ.socket.js | 1 - .../scripts/udx.happ.view_model.js | 1 - vendor/udx/lib-utility/scripts/udx.loader.js | 1 - vendor/udx/lib-utility/scripts/udx.log.js | 1 - vendor/udx/lib-utility/scripts/udx.spa.js | 1 - .../scripts/udx.utility.activity.js | 1 - .../lib-utility/scripts/udx.utility.bus.js | 1 - .../lib-utility/scripts/udx.utility.device.js | 1 - .../scripts/udx.utility.facebook.like.js | 1 - .../lib-utility/scripts/udx.utility.job.js | 1 - vendor/udx/lib-utility/scripts/udx.utility.js | 1 - .../lib-utility/scripts/udx.utility.loader.js | 1 - .../lib-utility/scripts/udx.utility.md5.js | 1 - .../scripts/udx.utility.process.js | 1 - vendor/udx/lib-utility/static/readme.html | 166 -- vendor/udx/lib-utility/static/yuidoc.json | 16 - .../udx/lib-utility/test/fixtures/sample.json | 124 - .../udx/lib-utility/test/fixtures/sample.php | 14 - .../udx/lib-utility/test/fixtures/sample.xml | 86 - vendor/udx/lib-utility/test/js/basic.js | 16 - .../udx/lib-utility/test/php/basic-test.php | 58 - vendor/udx/lib-wp-bootstrap/changes.md | 4 + vendor/udx/lib-wp-bootstrap/composer.json | 3 +- .../lib/classes/class-bootstrap.php | 2 +- .../lib/classes/class-utility.php | 52 + wp-stateless-media.php | 2 +- 125 files changed, 390 insertions(+), 18569 deletions(-) rename {vendor/udx/lib-settings/lib => lib/includes}/class-settings.php (95%) create mode 100644 lib/includes/class-utility.php delete mode 100644 vendor/udx/lib-settings/.gitignore delete mode 100644 vendor/udx/lib-settings/composer.json delete mode 100644 vendor/udx/lib-settings/gruntfile.js delete mode 100644 vendor/udx/lib-settings/package.json delete mode 100644 vendor/udx/lib-settings/readme.md delete mode 100644 vendor/udx/lib-settings/static/readme.html delete mode 100644 vendor/udx/lib-settings/static/schemas/settings.json delete mode 100644 vendor/udx/lib-settings/static/scripts/src/udx.settings.js delete mode 100644 vendor/udx/lib-settings/static/scripts/src/udx.storage.js delete mode 100644 vendor/udx/lib-settings/static/scripts/udx.settings.js delete mode 100644 vendor/udx/lib-settings/static/scripts/udx.storage.js delete mode 100644 vendor/udx/lib-settings/static/views/new-installation.xhtml delete mode 100644 vendor/udx/lib-settings/static/views/setup-assistant.xhtml delete mode 100644 vendor/udx/lib-settings/static/views/upgrade-splash.xhtml delete mode 100644 vendor/udx/lib-settings/test/basic.php delete mode 100644 vendor/udx/lib-settings/test/mocha.opts create mode 100644 vendor/udx/lib-ud-api-client/changes.md create mode 100644 vendor/udx/lib-ud-api-client/lib/classes/class-utility.php delete mode 100644 vendor/udx/lib-utility/.gitignore delete mode 100644 vendor/udx/lib-utility/.gitmodules delete mode 100644 vendor/udx/lib-utility/composer.json delete mode 100644 vendor/udx/lib-utility/composer.lock delete mode 100644 vendor/udx/lib-utility/gruntfile.js delete mode 100644 vendor/udx/lib-utility/lib/class-guid-fix.php delete mode 100644 vendor/udx/lib-utility/lib/class-job.php delete mode 100644 vendor/udx/lib-utility/lib/class-loader.php delete mode 100644 vendor/udx/lib-utility/lib/class-structure.php delete mode 100644 vendor/udx/lib-utility/lib/class-term.php delete mode 100644 vendor/udx/lib-utility/lib/class-utility.php delete mode 100644 vendor/udx/lib-utility/package.json delete mode 100644 vendor/udx/lib-utility/readme.md delete mode 100644 vendor/udx/lib-utility/scripts/analysis.client.js delete mode 100644 vendor/udx/lib-utility/scripts/analysis.visualizer.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.buttons.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.date-selector.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.dynamic-filter.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.elastic_filter.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.execute-triggers.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.form-helper.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.smart-buttons.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.social.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ud.super-search.js delete mode 100644 vendor/udx/lib-utility/scripts/jquery.ui.progressbar.js delete mode 100644 vendor/udx/lib-utility/scripts/src/analysis.client.js delete mode 100644 vendor/udx/lib-utility/scripts/src/analysis.visualizer.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.buttons.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.date-selector.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.dynamic-filter.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.elastic_filter.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.execute-triggers.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.form-helper.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.smart-buttons.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.social.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ud.super-search.js delete mode 100644 vendor/udx/lib-utility/scripts/src/jquery.ui.progressbar.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.analytics.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.event.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.filter.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.fleck.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.happ.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.happ.json_editor.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.happ.socket.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.happ.view_model.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.loader.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.log.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.spa.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.activity.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.bus.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.device.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.facebook.like.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.job.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.loader.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.md5.js delete mode 100644 vendor/udx/lib-utility/scripts/src/udx.utility.process.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.analytics.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.event.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.filter.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.fleck.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.happ.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.happ.json_editor.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.happ.socket.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.happ.view_model.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.loader.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.log.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.spa.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.activity.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.bus.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.device.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.facebook.like.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.job.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.loader.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.md5.js delete mode 100644 vendor/udx/lib-utility/scripts/udx.utility.process.js delete mode 100644 vendor/udx/lib-utility/static/readme.html delete mode 100644 vendor/udx/lib-utility/static/yuidoc.json delete mode 100644 vendor/udx/lib-utility/test/fixtures/sample.json delete mode 100644 vendor/udx/lib-utility/test/fixtures/sample.php delete mode 100644 vendor/udx/lib-utility/test/fixtures/sample.xml delete mode 100644 vendor/udx/lib-utility/test/js/basic.js delete mode 100644 vendor/udx/lib-utility/test/php/basic-test.php diff --git a/changelog.txt b/changelog.txt index 17c8b5050..0ffee5af6 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,4 +1,8 @@ == Changelog == += 4.1.0 = +* ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons +* ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons + = 3.3.0 = * NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions. * FIX - Stateless mode Incompatible with Media Uploader in Media Library Grid mode [#675](https://github.com/udx/wp-stateless/issues/675). diff --git a/changes.md b/changes.md index 136d098f3..f0e6089c2 100644 --- a/changes.md +++ b/changes.md @@ -1,3 +1,7 @@ +#### 4.1.0 +* ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons +* ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons + #### 3.3.0 * NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions. * FIX - Stateless mode Incompatible with Media Uploader in Media Library Grid mode [#675](https://github.com/udx/wp-stateless/issues/675). diff --git a/composer.json b/composer.json index e805684c9..06685b617 100644 --- a/composer.json +++ b/composer.json @@ -23,16 +23,16 @@ "require": { "php": ">=5.6.20", "composer/installers": "~1.0", - "udx/lib-settings": "~0.3", - "udx/lib-wp-bootstrap": "~1.3", - "udx/lib-ud-api-client": "~1.2", "ccampbell/chromephp": "^4.1", "firebase/php-jwt": "^6.1.2", - "wpmetabox/meta-box": "^5.6.3" + "wpmetabox/meta-box": "^5.6.3", + "udx/lib-ud-api-client": "^1.2", + "udx/lib-wp-bootstrap": "^1.3" }, "autoload": { "classmap": [ - "lib/classes" + "lib/classes", + "lib/includes" ] }, "archive": { diff --git a/composer.lock b/composer.lock index 267945b37..a38318e53 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "1763bfd3d53f8f11612d0a9cb9b037da", + "content-hash": "ee72847ceb6d6c1c588115004311ecb7", "packages": [ { "name": "ccampbell/chromephp", @@ -267,83 +267,17 @@ }, "time": "2023-10-05T00:24:42+00:00" }, - { - "name": "udx/lib-settings", - "version": "0.3.0", - "source": { - "type": "git", - "url": "git@github.com:udx/lib-settings", - "reference": "0.3.0" - }, - "dist": { - "type": "zip", - "url": "https://github.com/udx/lib-settings/archive/0.3.0.zip" - }, - "require": { - "udx/lib-utility": "~0.3" - }, - "require-dev": { - "justinrainbow/json-schema": "1.1.*" - }, - "type": "library", - "extra": { - "component": { - "scripts": [ - "static/scripts/settings.js" - ], - "templates": [ - "static/views/new-installation.xhtml" - ], - "files": [ - "static/schemas/settings.json" - ] - }, - "installer-name": "lib-settings" - }, - "autoload": { - "classmap": [ - "lib" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "homepage": "https://github.com/udx/lib-settings", - "keywords": [ - "settings" - ] - }, { "name": "udx/lib-ud-api-client", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "git@github.com:udx/lib-ud-api-client", - "reference": "1.2.1" + "reference": "1.2.2" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.1.zip" + "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.2.zip" }, "require": { "php": ">=5.3" @@ -376,80 +310,20 @@ "wordpress" ] }, - { - "name": "udx/lib-utility", - "version": "0.4.0", - "source": { - "type": "git", - "url": "git@github.com:udx/lib-utility", - "reference": "0.4.0" - }, - "dist": { - "type": "zip", - "url": "https://github.com/udx/lib-utility/archive/0.4.0.zip" - }, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "type": "library", - "extra": { - "installer-name": "lib-utility", - "component": { - "name": "utility", - "scripts": [ - "scripts/*.js" - ] - } - }, - "autoload": { - "classmap": [ - "lib" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "keywords": [ - "job", - "process", - "utility" - ] - }, { "name": "udx/lib-wp-bootstrap", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "git@github.com:udx/lib-wp-bootstrap", - "reference": "1.3.0" + "reference": "1.3.1" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.0.zip" + "url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.1.zip" }, "require": { - "php": ">=5.3", - "udx/lib-utility": "~0.3" + "php": ">=5.3" }, "type": "library", "extra": { diff --git a/lib/classes/class-errors.php b/lib/classes/class-errors.php index 13bf7e85d..d5099c9d9 100644 --- a/lib/classes/class-errors.php +++ b/lib/classes/class-errors.php @@ -2,7 +2,7 @@ /** * Admin Notices Handler * - * @namespace UsabilityDynamics + * @namespace wpCloud\StatelessMedia * * This file can be used to bootstrap any of the UD plugins, it essentially requires that you have * a core file which will be called after 'plugins_loaded'. In addition, if the core class has diff --git a/lib/classes/class-settings.php b/lib/classes/class-settings.php index 4388c85a4..74c6ee9f8 100644 --- a/lib/classes/class-settings.php +++ b/lib/classes/class-settings.php @@ -8,7 +8,7 @@ if( !class_exists( 'wpCloud\StatelessMedia\Settings' ) ) { - final class Settings extends \UsabilityDynamics\Settings { + final class Settings extends \UDX\Settings { /** * @var false|null|string @@ -382,7 +382,7 @@ public function root_dir_wildcards( $root_dir, $regex = false, $current_values = * @param $path * @return array */ - public function parse_root_dir_wildcards ( $path ) { + public function parse_root_dir_wildcards( $path ) { $result = []; /** @@ -585,7 +585,7 @@ public function save_media_settings(){ * @param string $key * @param bool $value * @param bool $bypass_validation - * @return \UsabilityDynamics\Settings + * @return \UDX\Settings */ public function set( $key = '', $value = false, $bypass_validation = false ) { return parent::set( $key, $value, $bypass_validation ); diff --git a/vendor/udx/lib-settings/lib/class-settings.php b/lib/includes/class-settings.php similarity index 95% rename from vendor/udx/lib-settings/lib/class-settings.php rename to lib/includes/class-settings.php index 8e60efcf7..451786f34 100644 --- a/vendor/udx/lib-settings/lib/class-settings.php +++ b/lib/includes/class-settings.php @@ -2,16 +2,16 @@ /** * Settings Library * - * @namespace UsabilityDynamics + * @namespace UDX */ -namespace UsabilityDynamics { +namespace UDX { - if( !class_exists( 'UsabilityDynamics\Settings' ) ) { + if( !class_exists( 'UDX\Settings' ) ) { /** * Class Settings * - * @package UsabilityDynamics + * @package UDX */ class Settings { @@ -142,10 +142,10 @@ class Settings { * * $_settings->set( 'my.key', 'my.value' ); * - * @internal param \UsabilityDynamics\type $defaults - * @internal param bool|\UsabilityDynamics\type $force_save - * @internal param string|\UsabilityDynamics\type $prefix - * @internal param bool|\UsabilityDynamics\type $hash_keys + * @internal param \UDX\type $defaults + * @internal param bool|\UDX\type $force_save + * @internal param string|\UDX\type $prefix + * @internal param bool|\UDX\type $hash_keys */ public function __construct( $args = false ) { @@ -212,7 +212,7 @@ public function __construct( $args = false ) { /** * Getter for options * - * @param bool|\UsabilityDynamics\type $key + * @param bool|\UDX\type $key * * @param bool $default * @@ -238,13 +238,13 @@ public function get( $key = false, $default = false ) { /** * Setter for options * - * @param string|\UsabilityDynamics\type $key - * @param bool|\UsabilityDynamics\type $value + * @param string|\UDX\type $key + * @param bool|\UDX\type $value * @param bool $bypass_validation * - * @internal param bool|\UsabilityDynamics\type $force_save + * @internal param bool|\UDX\type $force_save * - * @return \UsabilityDynamics\Settings + * @return \UDX\Settings */ public function set( $key = '', $value = false, $bypass_validation = false ) { @@ -533,7 +533,7 @@ public function _console( $data ) { /** * Load options from DB * - * @return \UsabilityDynamics\Settings + * @return \UDX\Settings */ public function _load() { diff --git a/lib/includes/class-utility.php b/lib/includes/class-utility.php new file mode 100644 index 000000000..fb45f9110 --- /dev/null +++ b/lib/includes/class-utility.php @@ -0,0 +1,207 @@ + $value ) { + if( !array_key_exists( $key, $base ) and !is_numeric( $key ) ) { + $base[ $key ] = $append[ $key ]; + continue; + } + if( ( isset( $value ) && @is_array( $value ) ) || ( isset( $base[ $key ] ) && @is_array( $base[ $key ] ) ) ) { + + // extend if exists, otherwise create. + if( isset( $base[ $key ] ) ) { + $base[ $key ] = self::extend( $base[ $key ], $append[ $key ] ); + } else { + $base[ $key ] = $append[ $key ]; + } + + } else if( is_numeric( $key ) ) { + if( !in_array( $value, $base ) ) $base[ ] = $value; + } else { + $base[ $key ] = $value; + } + } + } + + return $base; + } + + /** + * Localization Functionality. + * + * Replaces array's l10n data. + * Helpful for localization of data which is stored in JSON files ( see /schemas ) + * + * Usage: + * + * add_filter( 'ud::schema::localization', function($locals){ + * return array_merge( array( 'value_for_translating' => __( 'Blah Blah' ) ), $locals ); + * }); + * + * $result = self::l10n_localize (array( + * 'key' => 'l10n.value_for_translating' + * ) ); + * + * + * @param array $data + * @param array $l10n translated values + * @return array + * @author peshkov@UD + */ + static public function l10n_localize( $data, $l10n = array() ) { + + if ( !is_array( $data ) && !is_object( $data ) ) { + return $data; + } + + //** The Localization's list. */ + $l10n = apply_filters( 'ud::schema::localization', $l10n ); + + //** Replace l10n entries */ + foreach( $data as $k => $v ) { + if ( is_array( $v ) ) { + $data[ $k ] = self::l10n_localize( $v, $l10n ); + } elseif ( is_string( $v ) ) { + if ( strpos( $v, 'l10n' ) !== false ) { + preg_match_all( '/l10n\.([^\s]*)/', $v, $matches ); + if ( !empty( $matches[ 1 ] ) ) { + foreach ( $matches[ 1 ] as $i => $m ) { + if ( array_key_exists( $m, $l10n ) ) { + $data[ $k ] = str_replace( $matches[ 0 ][ $i ], $l10n[ $m ], $data[ $k ] ); + } + } + } + } + } + } + + return $data; + } + } + + } + +} diff --git a/readme.txt b/readme.txt index d29d13d44..1b5d6b9af 100644 --- a/readme.txt +++ b/readme.txt @@ -6,7 +6,7 @@ License: GPLv2 or later Requires PHP: 8.0 Requires at least: 5.0 Tested up to: 6.4.2 -Stable tag: 3.3.0 +Stable tag: 4.1.0 Upload and serve your WordPress media files from Google Cloud Storage. diff --git a/vendor/composer/autoload_classmap.php b/vendor/composer/autoload_classmap.php index f5a17cf75..e7ac0e088 100644 --- a/vendor/composer/autoload_classmap.php +++ b/vendor/composer/autoload_classmap.php @@ -7,11 +7,8 @@ return array( 'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php', - 'UsabilityDynamics\\Job' => $vendorDir . '/udx/lib-utility/lib/class-job.php', - 'UsabilityDynamics\\Loader' => $vendorDir . '/udx/lib-utility/lib/class-loader.php', - 'UsabilityDynamics\\Settings' => $vendorDir . '/udx/lib-settings/lib/class-settings.php', - 'UsabilityDynamics\\Structure' => $vendorDir . '/udx/lib-utility/lib/class-structure.php', - 'UsabilityDynamics\\Term' => $vendorDir . '/udx/lib-utility/lib/class-term.php', + 'UDX\\Settings' => $baseDir . '/lib/includes/class-settings.php', + 'UDX\\Utility' => $baseDir . '/lib/includes/class-utility.php', 'UsabilityDynamics\\UD_API\\API' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-api.php', 'UsabilityDynamics\\UD_API\\Admin' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-admin.php', 'UsabilityDynamics\\UD_API\\Bootstrap' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-bootstrap.php', @@ -21,8 +18,7 @@ 'UsabilityDynamics\\UD_API\\Scaffold' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-scaffold.php', 'UsabilityDynamics\\UD_API\\UI' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-ui.php', 'UsabilityDynamics\\UD_API\\Update_Checker' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-update-checker.php', - 'UsabilityDynamics\\Utility' => $vendorDir . '/udx/lib-utility/lib/class-utility.php', - 'UsabilityDynamics\\Utility\\Guid_Fix' => $vendorDir . '/udx/lib-utility/lib/class-guid-fix.php', + 'UsabilityDynamics\\UD_API\\Utility' => $vendorDir . '/udx/lib-ud-api-client/lib/classes/class-utility.php', 'UsabilityDynamics\\WP\\Bootstrap' => $vendorDir . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php', 'UsabilityDynamics\\WP\\Bootstrap_Plugin' => $vendorDir . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap-plugin.php', 'UsabilityDynamics\\WP\\Bootstrap_Theme' => $vendorDir . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap-theme.php', diff --git a/vendor/composer/autoload_static.php b/vendor/composer/autoload_static.php index 3fa00a4cc..f0b0b5ddf 100644 --- a/vendor/composer/autoload_static.php +++ b/vendor/composer/autoload_static.php @@ -48,11 +48,8 @@ class ComposerStaticInitc59d002476a452800baaf79c430753cb public static $classMap = array ( 'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php', - 'UsabilityDynamics\\Job' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-job.php', - 'UsabilityDynamics\\Loader' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-loader.php', - 'UsabilityDynamics\\Settings' => __DIR__ . '/..' . '/udx/lib-settings/lib/class-settings.php', - 'UsabilityDynamics\\Structure' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-structure.php', - 'UsabilityDynamics\\Term' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-term.php', + 'UDX\\Settings' => __DIR__ . '/../..' . '/lib/includes/class-settings.php', + 'UDX\\Utility' => __DIR__ . '/../..' . '/lib/includes/class-utility.php', 'UsabilityDynamics\\UD_API\\API' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-api.php', 'UsabilityDynamics\\UD_API\\Admin' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-admin.php', 'UsabilityDynamics\\UD_API\\Bootstrap' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-bootstrap.php', @@ -62,8 +59,7 @@ class ComposerStaticInitc59d002476a452800baaf79c430753cb 'UsabilityDynamics\\UD_API\\Scaffold' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-scaffold.php', 'UsabilityDynamics\\UD_API\\UI' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-ui.php', 'UsabilityDynamics\\UD_API\\Update_Checker' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-update-checker.php', - 'UsabilityDynamics\\Utility' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-utility.php', - 'UsabilityDynamics\\Utility\\Guid_Fix' => __DIR__ . '/..' . '/udx/lib-utility/lib/class-guid-fix.php', + 'UsabilityDynamics\\UD_API\\Utility' => __DIR__ . '/..' . '/udx/lib-ud-api-client/lib/classes/class-utility.php', 'UsabilityDynamics\\WP\\Bootstrap' => __DIR__ . '/..' . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php', 'UsabilityDynamics\\WP\\Bootstrap_Plugin' => __DIR__ . '/..' . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap-plugin.php', 'UsabilityDynamics\\WP\\Bootstrap_Theme' => __DIR__ . '/..' . '/udx/lib-wp-bootstrap/lib/classes/class-bootstrap-theme.php', diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index 1dc71e802..a5e38b9de 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -262,87 +262,18 @@ }, "install-path": "../firebase/php-jwt" }, - { - "name": "udx/lib-settings", - "version": "0.3.0", - "version_normalized": "0.3.0.0", - "source": { - "type": "git", - "url": "git@github.com:udx/lib-settings", - "reference": "0.3.0" - }, - "dist": { - "type": "zip", - "url": "https://github.com/udx/lib-settings/archive/0.3.0.zip" - }, - "require": { - "udx/lib-utility": "~0.3" - }, - "require-dev": { - "justinrainbow/json-schema": "1.1.*" - }, - "type": "library", - "extra": { - "component": { - "scripts": [ - "static/scripts/settings.js" - ], - "templates": [ - "static/views/new-installation.xhtml" - ], - "files": [ - "static/schemas/settings.json" - ] - }, - "installer-name": "lib-settings" - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "lib" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "homepage": "https://github.com/udx/lib-settings", - "keywords": [ - "settings" - ], - "install-path": "../udx/lib-settings" - }, { "name": "udx/lib-ud-api-client", - "version": "1.2.1", - "version_normalized": "1.2.1.0", + "version": "1.2.2", + "version_normalized": "1.2.2.0", "source": { "type": "git", "url": "git@github.com:udx/lib-ud-api-client", - "reference": "1.2.1" + "reference": "1.2.2" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.1.zip" + "url": "https://github.com/udx/lib-ud-api-client/archive/1.2.2.zip" }, "require": { "php": ">=5.3" @@ -377,84 +308,21 @@ ], "install-path": "../udx/lib-ud-api-client" }, - { - "name": "udx/lib-utility", - "version": "0.4.0", - "version_normalized": "0.4.0.0", - "source": { - "type": "git", - "url": "git@github.com:udx/lib-utility", - "reference": "0.4.0" - }, - "dist": { - "type": "zip", - "url": "https://github.com/udx/lib-utility/archive/0.4.0.zip" - }, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "type": "library", - "extra": { - "installer-name": "lib-utility", - "component": { - "name": "utility", - "scripts": [ - "scripts/*.js" - ] - } - }, - "installation-source": "dist", - "autoload": { - "classmap": [ - "lib" - ] - }, - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "keywords": [ - "job", - "process", - "utility" - ], - "install-path": "../udx/lib-utility" - }, { "name": "udx/lib-wp-bootstrap", - "version": "1.3.0", - "version_normalized": "1.3.0.0", + "version": "1.3.1", + "version_normalized": "1.3.1.0", "source": { "type": "git", "url": "git@github.com:udx/lib-wp-bootstrap", - "reference": "1.3.0" + "reference": "1.3.1" }, "dist": { "type": "zip", - "url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.0.zip" + "url": "https://github.com/udx/lib-wp-bootstrap/archive/1.3.1.zip" }, "require": { - "php": ">=5.3", - "udx/lib-utility": "~0.3" + "php": ">=5.3" }, "type": "library", "extra": { diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index dd362bae5..c6fbe42cb 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'wpcloud/wp-stateless', 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '4abec93a85fb4b1e2f9ac40f85f13b4a1db70082', + 'reference' => '4e811ffcf935c543ab66a31c9562301a405d988d', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -49,37 +49,19 @@ 0 => '*', ), ), - 'udx/lib-settings' => array( - 'pretty_version' => '0.3.0', - 'version' => '0.3.0.0', - 'reference' => '0.3.0', - 'type' => 'library', - 'install_path' => __DIR__ . '/../udx/lib-settings', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'udx/lib-ud-api-client' => array( - 'pretty_version' => '1.2.1', - 'version' => '1.2.1.0', - 'reference' => '1.2.1', + 'pretty_version' => '1.2.2', + 'version' => '1.2.2.0', + 'reference' => '1.2.2', 'type' => 'library', 'install_path' => __DIR__ . '/../udx/lib-ud-api-client', 'aliases' => array(), 'dev_requirement' => false, ), - 'udx/lib-utility' => array( - 'pretty_version' => '0.4.0', - 'version' => '0.4.0.0', - 'reference' => '0.4.0', - 'type' => 'library', - 'install_path' => __DIR__ . '/../udx/lib-utility', - 'aliases' => array(), - 'dev_requirement' => false, - ), 'udx/lib-wp-bootstrap' => array( - 'pretty_version' => '1.3.0', - 'version' => '1.3.0.0', - 'reference' => '1.3.0', + 'pretty_version' => '1.3.1', + 'version' => '1.3.1.0', + 'reference' => '1.3.1', 'type' => 'library', 'install_path' => __DIR__ . '/../udx/lib-wp-bootstrap', 'aliases' => array(), @@ -88,7 +70,7 @@ 'wpcloud/wp-stateless' => array( 'pretty_version' => 'dev-latest', 'version' => 'dev-latest', - 'reference' => '4abec93a85fb4b1e2f9ac40f85f13b4a1db70082', + 'reference' => '4e811ffcf935c543ab66a31c9562301a405d988d', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/vendor/udx/lib-settings/.gitignore b/vendor/udx/lib-settings/.gitignore deleted file mode 100644 index 3be44b977..000000000 --- a/vendor/udx/lib-settings/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -temp -node_modules -npm-debug.log -static/codex -.svn -.idea -.idea/workspace.xml -.DS_Store -.dynamic -.Trashes -*.sublime-project -*.sublime-workspace - -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz \ No newline at end of file diff --git a/vendor/udx/lib-settings/composer.json b/vendor/udx/lib-settings/composer.json deleted file mode 100644 index 90e5ee3e2..000000000 --- a/vendor/udx/lib-settings/composer.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "udx/lib-settings", - "keywords": [ "settings" ], - "type": "library", - "require": { - "udx/lib-utility": "~0.3" - }, - "require-dev": { - "justinrainbow/json-schema": "1.1.*" - }, - "minimum-stability": "dev", - "repositories": [ - { - "type": "composer", - "url": "https://repository.usabilitydynamics.com" - } - ], - "autoload": { - "classmap": [ "lib" ] - }, - "homepage": "https://github.com/udx/lib-settings", - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "extra": { - "component": { - "scripts": [ "static/scripts/settings.js" ], - "templates": [ "static/views/new-installation.xhtml" ], - "files": [ "static/schemas/settings.json" ] - } - }, - "license": "MIT" -} diff --git a/vendor/udx/lib-settings/gruntfile.js b/vendor/udx/lib-settings/gruntfile.js deleted file mode 100644 index 29926368c..000000000 --- a/vendor/udx/lib-settings/gruntfile.js +++ /dev/null @@ -1,181 +0,0 @@ -/** - * Library Build. - * - * @author potanin@UD - * @version 1.1.2 - * @param grunt - */ -module.exports = function build( grunt ) { - - grunt.initConfig( { - - // Read Composer File. - pkg: grunt.file.readJSON( 'composer.json' ), - - // Generate Documentation. - yuidoc: { - compile: { - name: '<%= pkg.name %>', - description: '<%= pkg.description %>', - version: '<%= pkg.version %>', - url: '<%= pkg.homepage %>', - options: { - paths: [ 'lib', 'scripts' ], - outdir: 'static/codex/' - } - } - }, - - // Compile LESS. - less: { - development: { - options: { - relativeUrls: true - }, - files: { - //'styles/requires.dev.css': [ 'styles/src/requires.less' ] - } - }, - production: { - options: { - yuicompress: true, - relativeUrls: true - }, - files: { - //'styles/requires.css': [ 'styles/src/requires.less' ] - } - } - }, - - // Development Watch. - watch: { - options: { - interval: 100, - debounceDelay: 500 - }, - less: { - files: [ - 'styles/src/*.*' - ], - tasks: [ 'less' ] - }, - js: { - files: [ - 'scripts/src/*.*' - ], - tasks: [ 'uglify' ] - } - }, - - // Uglify Scripts. - uglify: { - production: { - options: { - preserveComments: false, - wrap: false - }, - files: [ - { - expand: true, - cwd: 'scripts/src', - src: [ '*.js' ], - dest: 'scripts' - } - ] - } - }, - - // Generate Markdown. - markdown: { - all: { - files: [ - { - expand: true, - src: 'readme.md', - dest: 'static/', - ext: '.html' - } - ], - options: { - markdownOptions: { - gfm: true, - codeLines: { - before: '', - after: '' - } - } - } - } - }, - - // Clean for Development. - clean: { - all: [ - "vendor", - "static/readme.md", - "composer.lock", - "styles/*.css", - "scripts/*.js" - ], - update: [ - "composer.lock" - ] - }, - - // CLI Commands. - shell: { - update: { - options: { - stdout: true - }, - command: 'composer update --prefer-source' - } - }, - - // Coverage Tests. - mochacov: { - options: { - reporter: 'list', - requires: [ 'should' ] - }, - all: [ 'test/*.js' ] - }, - - // Usage Tests. - mochacli: { - options: { - requires: [ 'should' ], - reporter: 'list', - ui: 'exports', - bail: false - }, - all: [ - 'test/*.js' - ] - } - - }); - - // Load NPM Tasks. - grunt.loadNpmTasks( 'grunt-markdown' ); - grunt.loadNpmTasks( 'grunt-requirejs' ); - grunt.loadNpmTasks( 'grunt-contrib-yuidoc' ); - grunt.loadNpmTasks( 'grunt-contrib-uglify' ); - grunt.loadNpmTasks( 'grunt-contrib-watch' ); - grunt.loadNpmTasks( 'grunt-contrib-less' ); - grunt.loadNpmTasks( 'grunt-contrib-concat' ); - grunt.loadNpmTasks( 'grunt-contrib-clean' ); - grunt.loadNpmTasks( 'grunt-shell' ); - grunt.loadNpmTasks( 'grunt-mocha-cli' ); - grunt.loadNpmTasks( 'grunt-mocha-cov' ); - - // Register NPM Tasks. - grunt.registerTask( 'default', [ 'markdown', 'less' , 'yuidoc', 'uglify' ] ); - - // Build Distribution. - grunt.registerTask( 'distribution', [ 'mochacli:all', 'mochacov:all', 'clean:all', 'markdown', 'less:production', 'uglify:production' ] ); - - // Update Environment. - grunt.registerTask( 'update', [ 'clean:update', 'shell:update' ] ); - -}; \ No newline at end of file diff --git a/vendor/udx/lib-settings/package.json b/vendor/udx/lib-settings/package.json deleted file mode 100644 index e1a74bafd..000000000 --- a/vendor/udx/lib-settings/package.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "lib-settings", - "version": "0.3.0", - "description": "Settings Library.", - "private": false, - "repository": { - "type": "git", - "url": "https://github.com/udx/lib-settings" - }, - "main": "scripts/settings", - "engines": { - "node": ">= 0.10.0" - }, - "devDependencies": { - "grunt-contrib-symlink": "~0.2.0", - "grunt-contrib-yuidoc": "~0.5.0", - "grunt-contrib-uglify": "~0.2.4", - "grunt-contrib-watch": "~0.5.3", - "grunt-markdown": "~0.4.0", - "grunt-requirejs": "~0.4.0", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-shell": "~0.6.0", - "grunt-contrib-less": "~0.8.3", - "grunt-mocha-cli": "~1.5.0", - "grunt-mocha-cov": "~0.1.1" - } -} diff --git a/vendor/udx/lib-settings/readme.md b/vendor/udx/lib-settings/readme.md deleted file mode 100644 index d77031cdd..000000000 --- a/vendor/udx/lib-settings/readme.md +++ /dev/null @@ -1,111 +0,0 @@ -## Storage Usage -Storage module is developed for client-side persistant storing of key & value pairs. - -```javascript - - // Initialize Storage. - var Storage = require( 'udx.storage' ).create(); - - // Set some values. - Storage.setItem( 'name', 'Andy' ); - Storage.setItem( 'latitude', '34.4239' ); - Storage.setItem( 'longitude', '-77.5584' ); - - // Later... - console.log( 'Welcome', Storage.getItem( 'name' ), 'we have you located at', Storage.getItem( 'latitude' ), ', ', Storage.getItem( 'longitude' ) ); - -``` - -Storage attempts to save data into localStorage, if the browser supports it. Otherwise we fallback to Cookie storage. - -## Usage Notes -* Root keys that start with __ will never be committed to storage. -* There are four types of storage types available - "option", "site_meta", "transient" and "site_transient". - -## Settings Usage - -```php -// Instantiate and load Settings. -$settings = new Settings(array( - "store" => "options", - "key" => "settings_test", - "format" => "object", - "auto_commit" => true, - "data" => array( 'initial data', 'blah' ) -)); - -$settings->set( 'make', 'Chevy' ); -$settings->set( 'model', 'Tahoe' ); - -$settings->set( 'features', array( - 'ac', - 'stuff' - 'dvd', - 'sunroof' -)); - -$settings->set( 'options', array( - "gps" => 'standard', - "rims" => '24', - "towing" => true, - "onstar" => 'active' -)); -``` - -```php -// Initialize Settings. -$this->_settings = new Settings(array( - "store" => "options", - "key" => "ud:veneer", -)); - -// ElasticSearch Service Settings. -$this->set( 'documents', array( - "host" => "localhost", - "active" => true, - "token" => "alsdkjflaksdjsadsdff", - "port" => 9200 -)); - -// Varnish Service Settings. -$this->set( 'varnish', array( - "host" => "localhost", - "active" => false -)); - -// CDN Service Settings. -$this->set( 'cdn', array( - "active" => true, - "provider" => "gcs", - "subdomain" => "media", - "key" => "alsdkjflaksdjf" -)); - -// Save Settings. -$this->_settings->commit(); -``` - -## License - -(The MIT License) - -Copyright (c) 2013 Usability Dynamics, Inc. <info@usabilitydynamics.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/udx/lib-settings/static/readme.html b/vendor/udx/lib-settings/static/readme.html deleted file mode 100644 index 0dc44670f..000000000 --- a/vendor/udx/lib-settings/static/readme.html +++ /dev/null @@ -1,206 +0,0 @@ - - - - - - doc - - - -

Storage Usage

-

Storage module is developed for client-side persistant storing of key & value pairs.

-

- // Initialize Storage.
- var Storage = require( 'udx.storage' ).create();
-
-  // Set some values.
- Storage.setItem( 'name', 'Andy' );
- Storage.setItem( 'latitude', '34.4239' );
- Storage.setItem( 'longitude', '-77.5584' );
-
- // Later...
- console.log( 'Welcome', Storage.getItem( 'name' ), 'we have you located at', Storage.getItem( 'latitude' ), ', ', Storage.getItem( 'longitude' ) );
-

Storage attempts to save data into localStorage, if the browser supports it. Otherwise we fallback to Cookie storage.

-

Settings Usage

-
// Instantiate and load Settings.
-$settings  = new Settings(array(
-  "store" => "options",
-  "key" => "settings_test",
-  "format" => "object",
-  "auto_commit" => true,
-  "data" => array( 'initial data', 'blah' )
-));
-
-$settings->set( 'make', 'Chevy' );
-$settings->set( 'model', 'Tahoe' );
-
-$settings->set( 'features', array(
-  'ac',
-  'stuff'
-  'dvd',
-  'sunroof'
-));
-
-$settings->set( 'options', array(
-  "gps" => 'standard',
-  "rims" => '24',
-  "towing" => true,
-  "onstar" => 'active'
-));
-
// Initialize Settings.
-$this->_settings = new Settings(array(
-  "store" => "options",
-  "key" => "ud:veneer",
-));
-
-// ElasticSearch Service Settings.
-$this->set( 'documents', array(
-  "host" => "localhost",
-  "active" => true,
-  "token" => "alsdkjflaksdjsadsdff",
-  "port" => 9200
-));
-
-// Varnish Service Settings.
-$this->set( 'varnish', array(
-  "host" => "localhost",
-  "active" => false
-));
-
-// CDN Service Settings.
-$this->set( 'cdn', array(
-  "active" => true,
-  "provider" => "gcs",
-  "subdomain" => "media",
-  "key" => "alsdkjflaksdjf"
-));
-
-// Save Settings.
-$this->_settings->commit();
-

License

-

(The MIT License)

-

Copyright (c) 2013 Usability Dynamics, Inc. <info@usabilitydynamics.com>

-

Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions:

-

The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software.

-

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

- - - diff --git a/vendor/udx/lib-settings/static/schemas/settings.json b/vendor/udx/lib-settings/static/schemas/settings.json deleted file mode 100644 index cc681b5e7..000000000 --- a/vendor/udx/lib-settings/static/schemas/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name": "settings-schema", - "version": "0.1.3" -} \ No newline at end of file diff --git a/vendor/udx/lib-settings/static/scripts/src/udx.settings.js b/vendor/udx/lib-settings/static/scripts/src/udx.settings.js deleted file mode 100644 index 6151fe272..000000000 --- a/vendor/udx/lib-settings/static/scripts/src/udx.settings.js +++ /dev/null @@ -1,142 +0,0 @@ -/** - * Settings - * - * @version 0.1.4 - * @returns {Object} - */ -define( 'udx.settings', [ 'udx.utility' ], function settings() { - console.log( 'udx.settings', 'loaded' ); - - function Settings( name, options ) { - console.log( 'udx.settings', 'created' ); - - Object.defineProperties( this, { - store: { - value: {}, - enumerable: false, - configurable: true, - writable: true - } - }); - - return this; - - } - - /** - * Settings Instance Properties. - * - */ - Object.defineProperties( Settings.prototype, { - set: { - value: function set( sKey, sValue, vEnd, sPath, sDomain, bSecure ) { - if( !sKey || /^(?:expires|max\-age|path|domain|secure)$/i.test( sKey ) ) { - return false; - } - var sExpires = ""; - if( vEnd ) { - switch( vEnd.constructor ) { - case Number: - sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; - break; - case String: - sExpires = "; expires=" + vEnd; - break; - case Date: - sExpires = "; expires=" + vEnd.toUTCString(); - break; - } - } - document.cookie = encodeURIComponent( sKey ) + "=" + encodeURIComponent( sValue ) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); - return true; - - }, - enumerable: true, - configurable: true, - writable: true - }, - get: { - value: function get( key ) { - - return decodeURIComponent( document.cookie.replace( new RegExp( "(?:(?:^|.*;)\\s*" + encodeURIComponent( key ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=\\s*([^;]*).*$)|^.*$" ), "$1" ) ) || null; - - }, - enumerable: true, - configurable: true, - writable: true - }, - remove: { - value: function remove( sKey, sPath, sDomain ) { - if( !sKey || !this.has( sKey ) ) { - return false; - } - document.cookie = encodeURIComponent( sKey ) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + ( sDomain ? "; domain=" + sDomain : "") + ( sPath ? "; path=" + sPath : ""); - return true; - - }, - enumerable: true, - configurable: true, - writable: true - }, - has: { - value: function has( sKey ) { - return (new RegExp( "(?:^|;\\s*)" + encodeURIComponent( sKey ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=" )).test( document.cookie ); - - }, - enumerable: true, - configurable: true, - writable: true - }, - keys: { - value: function keys() { - var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ ); - - for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) { - aKeys[nIdx] = decodeURIComponent( aKeys[nIdx] ); - } - return aKeys; - - }, - enumerable: true, - configurable: true, - writable: true - }, - data: { - value: function data() { - - var data = {}; - - var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ ); - - for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) { - var key = decodeURIComponent( aKeys[nIdx] ); - data[ key ] = this.get( key ); - } - - return data; - - }, - enumerable: true, - configurable: true, - writable: true - } - }); - - /** - * Settings Constructor Properties. - * - */ - Object.defineProperties( Settings, { - create: { - value: function create( name, options ) { - return new Settings( name, options ) - }, - enumerable: true, - configurable: true, - writable: true - } - }); - - return Settings; - -}); \ No newline at end of file diff --git a/vendor/udx/lib-settings/static/scripts/src/udx.storage.js b/vendor/udx/lib-settings/static/scripts/src/udx.storage.js deleted file mode 100644 index 08aa22f54..000000000 --- a/vendor/udx/lib-settings/static/scripts/src/udx.storage.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * Client Settings - * - * Attempts to utilize localStorage if available, otherwise falls back to cookies. - * - * @version 0.1.0 - * @returns {Object} - */ -define( 'udx.storage', [ 'udx.utility' ], function settings() { - console.debug( 'udx.storage', 'loaded' ); - - function Settings( name, options ) { - console.debug( 'udx.storage', 'created' ); - - // Return native. - if( 'object' === typeof window.localStorage && 'function' === typeof window.localStorage.getItem ) { - console.debug( 'udx.storage', 'Browser supports native localStorage.' ); - - return window.localStorage; - - } - - Object.defineProperties( this, { - store: { - value: {}, - enumerable: false, - configurable: true, - writable: true - } - }); - - return this; - - } - - /** - * Settings Instance Properties. - * - */ - Object.defineProperties( Settings.prototype, { - set: { - value: function set( key, value, vEnd, sPath, sDomain, bSecure ) { - if( !key || /^(?:expires|max\-age|path|domain|secure)$/i.test( key ) ) { - return false; - } - var sExpires = ""; - if( vEnd ) { - switch( vEnd.constructor ) { - case Number: - sExpires = vEnd === Infinity ? "; expires=Fri, 31 Dec 9999 23:59:59 GMT" : "; max-age=" + vEnd; - break; - case String: - sExpires = "; expires=" + vEnd; - break; - case Date: - sExpires = "; expires=" + vEnd.toUTCString(); - break; - } - } - document.cookie = encodeURIComponent( key ) + "=" + encodeURIComponent( value ) + sExpires + (sDomain ? "; domain=" + sDomain : "") + (sPath ? "; path=" + sPath : "") + (bSecure ? "; secure" : ""); - return true; - - }, - enumerable: true, - configurable: true, - writable: true - }, - get: { - value: function get( key ) { - - return decodeURIComponent( document.cookie.replace( new RegExp( "(?:(?:^|.*;)\\s*" + encodeURIComponent( key ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=\\s*([^;]*).*$)|^.*$" ), "$1" ) ) || null; - - }, - enumerable: true, - configurable: true, - writable: true - }, - remove: { - value: function remove( key, sPath, sDomain ) { - if( !key || !this.has( key ) ) { - return false; - } - document.cookie = encodeURIComponent( key ) + "=; expires=Thu, 01 Jan 1970 00:00:00 GMT" + ( sDomain ? "; domain=" + sDomain : "") + ( sPath ? "; path=" + sPath : ""); - return true; - - }, - enumerable: true, - configurable: true, - writable: true - }, - has: { - value: function has( key ) { - return (new RegExp( "(?:^|;\\s*)" + encodeURIComponent( key ).replace( /[\-\.\+\*]/g, "\\$&" ) + "\\s*\\=" )).test( document.cookie ); - - }, - enumerable: true, - configurable: true, - writable: true - }, - keys: { - value: function keys() { - var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ ); - - for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) { - aKeys[nIdx] = decodeURIComponent( aKeys[nIdx] ); - } - return aKeys; - - }, - enumerable: true, - configurable: true, - writable: true - }, - data: { - value: function data() { - - var data = {}; - - var aKeys = document.cookie.replace( /((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g, "" ).split( /\s*(?:\=[^;]*)?;\s*/ ); - - for( var nIdx = 0; nIdx < aKeys.length; nIdx++ ) { - var key = decodeURIComponent( aKeys[nIdx] ); - data[ key ] = this.get( key ); - } - - return data; - - }, - enumerable: true, - configurable: true, - writable: true - }, - getItem: { - value: function getItem( key ) { - return this.get( key ); - }, - enumerable: true, - configurable: true, - writable: true - }, - setItem: { - value: function setItem( key, value ) { - return this.get( key, value ); - }, - enumerable: true, - configurable: true, - writable: true - } - }); - - /** - * Settings Constructor Properties. - * - */ - Object.defineProperties( Settings, { - create: { - /** - * - * @param name {String|Null} - * @param options {Object|Null} - * @returns {settings.Settings} - */ - value: function create( name, options ) { - return new Settings( name, options ) - }, - enumerable: true, - configurable: true, - writable: true - }, - version: { - value: '1.0.1', - enumerable: false, - writable: false - } - }); - - return Settings; - -}); \ No newline at end of file diff --git a/vendor/udx/lib-settings/static/scripts/udx.settings.js b/vendor/udx/lib-settings/static/scripts/udx.settings.js deleted file mode 100644 index e21760002..000000000 --- a/vendor/udx/lib-settings/static/scripts/udx.settings.js +++ /dev/null @@ -1 +0,0 @@ -define("udx.settings",["udx.utility"],function(){function a(){return console.log("udx.settings","created"),Object.defineProperties(this,{store:{value:{},enumerable:!1,configurable:!0,writable:!0}}),this}return console.log("udx.settings","loaded"),Object.defineProperties(a.prototype,{set:{value:function(a,b,c,d,e,f){if(!a||/^(?:expires|max\-age|path|domain|secure)$/i.test(a))return!1;var g="";if(c)switch(c.constructor){case Number:g=1/0===c?"; expires=Fri, 31 Dec 9999 23:59:59 GMT":"; max-age="+c;break;case String:g="; expires="+c;break;case Date:g="; expires="+c.toUTCString()}return document.cookie=encodeURIComponent(a)+"="+encodeURIComponent(b)+g+(e?"; domain="+e:"")+(d?"; path="+d:"")+(f?"; secure":""),!0},enumerable:!0,configurable:!0,writable:!0},get:{value:function(a){return decodeURIComponent(document.cookie.replace(new RegExp("(?:(?:^|.*;)\\s*"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=\\s*([^;]*).*$)|^.*$"),"$1"))||null},enumerable:!0,configurable:!0,writable:!0},remove:{value:function(a,b,c){return a&&this.has(a)?(document.cookie=encodeURIComponent(a)+"=; expires=Thu, 01 Jan 1970 00:00:00 GMT"+(c?"; domain="+c:"")+(b?"; path="+b:""),!0):!1},enumerable:!0,configurable:!0,writable:!0},has:{value:function(a){return new RegExp("(?:^|;\\s*)"+encodeURIComponent(a).replace(/[\-\.\+\*]/g,"\\$&")+"\\s*\\=").test(document.cookie)},enumerable:!0,configurable:!0,writable:!0},keys:{value:function(){for(var a=document.cookie.replace(/((?:^|\s*;)[^\=]+)(?=;|$)|^\s*|\s*(?:\=[^;]*)?(?:\1|$)/g,"").split(/\s*(?:\=[^;]*)?;\s*/),b=0;b -

-
- - diff --git a/vendor/udx/lib-settings/static/views/setup-assistant.xhtml b/vendor/udx/lib-settings/static/views/setup-assistant.xhtml deleted file mode 100644 index 1d24b4c29..000000000 --- a/vendor/udx/lib-settings/static/views/setup-assistant.xhtml +++ /dev/null @@ -1,73 +0,0 @@ - - -
- - - - - - - - - -
-
-
-
- - Some text here explaining why we are asking for this stuff and how it's going to make the user's life easier.. -

- A single-family detached home, also called a single-detached dwelling or separate house is a free-standing... -

-
- -
- -
- -
- -
- -
- - - diff --git a/vendor/udx/lib-settings/static/views/upgrade-splash.xhtml b/vendor/udx/lib-settings/static/views/upgrade-splash.xhtml deleted file mode 100644 index a26335535..000000000 --- a/vendor/udx/lib-settings/static/views/upgrade-splash.xhtml +++ /dev/null @@ -1,121 +0,0 @@ -
-
-
-
- icon goes here -

title goes here

-
-
-
-
- - -
-
-
-

-
-
-
-
- - - -
-
-
-
-
-
-
-
-
-
-
- - -
-
-
-
-

Welcome to WP-Property version something something

-
-

Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum. Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit a, eros.

-
-
-
-
- -
-
- -
-
    -
  • My listings are
    - - -
    , configure my listings to use local currency and formatting.
  • -
  • My role is best described as a
    - - -
    on this project.
  • -
  • I am planning to use this website to showcase the following types of listings:
    - - -
  • -
-
- -
- -
-
    -
  • -
  • -
  • -
-
-
- -
-
- Some miscellaneous options -
Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper, lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum. Donec porttitor ligula eu dolor.
-
-
-
    -
  • -
  • -
  • -
  • -
-
-
- - - - -
-
- - - -
-
-
- -
-
-
-
    -
  • Premium Features you might like.
  • -
  • XML Property Importer

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien.

  • -
  • XML Property Importer

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien.

  • -
  • XML Property Importer

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse id velit vitae ligula volutpat condimentum. Aliquam erat volutpat. Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere sapien.

  • -
- -
-
-
-
-
\ No newline at end of file diff --git a/vendor/udx/lib-settings/test/basic.php b/vendor/udx/lib-settings/test/basic.php deleted file mode 100644 index a372ca990..000000000 --- a/vendor/udx/lib-settings/test/basic.php +++ /dev/null @@ -1,36 +0,0 @@ - "options", - "key" => "settings_test", - "format" => "object" -)); - -$settings->set( 'make', 'Chevy' ); -$settings->set( 'model', 'Tahoe' ); -$settings->set( 'features', array( - 'ac', - 'stuff' -)); - -$settings->set( 'features', array( - 'dvd', - 'sunroof' -)); - -$settings->set( 'options', array( - "rims" => '24', - "towing" => true, - "onstar" => 'active' -)); - -$settings->set( 'options', array( - "gps" => 'standard' -)); - -//echo '
get all:
' . print_r( $settings->get(), true ) . '
'; -echo '
get make: ' . print_r( $settings->get( 'make' ), true ); -echo '
get options.gps: ' . print_r( $settings->get( 'options.gps' ), true ); -echo '
get features: ' . print_r( $settings->get( 'features' ), true ); -die( '
get all' . print_r( $settings->get(), true ) . '
' ); diff --git a/vendor/udx/lib-settings/test/mocha.opts b/vendor/udx/lib-settings/test/mocha.opts deleted file mode 100644 index f1d544e17..000000000 --- a/vendor/udx/lib-settings/test/mocha.opts +++ /dev/null @@ -1,37 +0,0 @@ -REPORTER = list -JSON_FILE = static/all.json -HTML_FILE = static/coverage.html - -test-all: - clean - document - lib-cov - test-code - -document: - yuidoc -q - -test-code: - @NODE_ENV=test mocha \ - --timeout 200 \ - --ui exports \ - --reporter $(REPORTER) \ - test/*.js - -test-cov: - lib-cov - @APP_COVERAGE=1 $(MAKE) test \ - REPORTER=html-cov > $(HTML_FILE) - -lib-cov: - jscoverage lib static/lib-cov - -clean: - rm -fr static/lib-cov - rm -fr static/assets - rm -fr static/classes - rm -fr static/files - rm -fr static/modules - rm -f static/api.js - rm -f static/data.json - rm -f static/index.html diff --git a/vendor/udx/lib-ud-api-client/changes.md b/vendor/udx/lib-ud-api-client/changes.md new file mode 100644 index 000000000..4a53a070a --- /dev/null +++ b/vendor/udx/lib-ud-api-client/changes.md @@ -0,0 +1,3 @@ +### 1.2.2 + +* Remove dependency from `udx/lib-utility`. diff --git a/vendor/udx/lib-ud-api-client/gruntfile.js b/vendor/udx/lib-ud-api-client/gruntfile.js index e1b95dc30..3a68976fb 100644 --- a/vendor/udx/lib-ud-api-client/gruntfile.js +++ b/vendor/udx/lib-ud-api-client/gruntfile.js @@ -2,7 +2,7 @@ * Build Plugin. * * @author potanin@UD - * @version 1.2.1 + * @version 1.2.2 * @param grunt */ module.exports = function( grunt ) { diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php b/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php index 473f93883..6cbdeb0b9 100644 --- a/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-admin.php @@ -283,7 +283,7 @@ public function process_request () { $status = 'true'; } - $redirect_url = \UsabilityDynamics\Utility::current_url( array( 'type' => urlencode( $type ), 'status' => urlencode( $status ) ), array( 'action', 'filepath', '_wpnonce' ) ); + $redirect_url = Utility::current_url( array( 'type' => urlencode( $type ), 'status' => urlencode( $status ) ), array( 'action', 'filepath', '_wpnonce' ) ); wp_safe_redirect( $redirect_url ); exit; } diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php b/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php index 74e359cc2..7d2845ebe 100644 --- a/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-bootstrap.php @@ -18,7 +18,7 @@ class Bootstrap extends Scaffold { /** * */ - public static $version = '1.2.1'; + public static $version = '1.2.2'; /** * diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-licenses-table.php b/vendor/udx/lib-ud-api-client/lib/classes/class-licenses-table.php index e2a5717dc..64258aca4 100644 --- a/vendor/udx/lib-ud-api-client/lib/classes/class-licenses-table.php +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-licenses-table.php @@ -138,7 +138,7 @@ public function column_product_version ( $item ) { public function column_product_status ( $item ) { $response = ''; if ( 'active' == $item['product_status'] ) { - $deactivate_url = wp_nonce_url(\UsabilityDynamics\Utility::current_url( array( + $deactivate_url = wp_nonce_url(Utility::current_url( array( 'action' => 'deactivate-product', 'filepath' => urlencode( $item['product_file_path'] ), ) ), 'bulk-licenses' ); diff --git a/vendor/udx/lib-ud-api-client/lib/classes/class-utility.php b/vendor/udx/lib-ud-api-client/lib/classes/class-utility.php new file mode 100644 index 000000000..8e859092c --- /dev/null +++ b/vendor/udx/lib-ud-api-client/lib/classes/class-utility.php @@ -0,0 +1,53 @@ + $v ) { + if( is_string( $v ) ) $url = add_query_arg( $k, $v, $url ); + } + } + + if( !empty( $except_args ) ) { + foreach( (array) $except_args as $arg ) { + if( is_string( $arg ) ) $url = remove_query_arg( $arg, $url ); + } + } + + return $url; + } + + } + + } + +} \ No newline at end of file diff --git a/vendor/udx/lib-ud-api-client/package.json b/vendor/udx/lib-ud-api-client/package.json index bcd255c4d..23c77afb9 100644 --- a/vendor/udx/lib-ud-api-client/package.json +++ b/vendor/udx/lib-ud-api-client/package.json @@ -1,6 +1,6 @@ { "name": "lib-ud-api-client", - "version": "1.2.1", + "version": "1.2.2", "description": "UD Client for WooCommerce API Manager", "repository": { "type": "git", diff --git a/vendor/udx/lib-utility/.gitignore b/vendor/udx/lib-utility/.gitignore deleted file mode 100644 index f01ac072f..000000000 --- a/vendor/udx/lib-utility/.gitignore +++ /dev/null @@ -1,20 +0,0 @@ -temp -node_modules -npm-debug.log -static/codex -vendor -.svn -.idea -.idea/workspace.xml -.DS_Store -.dynamic -.Trashes -*.sublime-project -*.sublime-workspace -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz \ No newline at end of file diff --git a/vendor/udx/lib-utility/.gitmodules b/vendor/udx/lib-utility/.gitmodules deleted file mode 100644 index ff8dbced6..000000000 --- a/vendor/udx/lib-utility/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "static/wiki"] - path = static/wiki - url = git@github.com:UsabilityDynamics/lib-utility.wiki.git diff --git a/vendor/udx/lib-utility/composer.json b/vendor/udx/lib-utility/composer.json deleted file mode 100644 index 02f995949..000000000 --- a/vendor/udx/lib-utility/composer.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "udx/lib-utility", - "keywords": [ - "utility", - "process", - "job" - ], - "version": "0.4.0", - "type": "library", - "minimum-stability": "dev", - "repositories": [ - { - "type": "composer", - "url": "https://repository.usabilitydynamics.com" - } - ], - "require": {}, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "autoload": { - "classmap": [ "lib" ] - }, - "authors": [ - { - "name": "Andy Potanin", - "email": "andy.potanin@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Maxim Peshkov", - "email": "maxim.peshkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - }, - { - "name": "Anton Korotkov", - "email": "anton.korotkov@usabilitydynamics.com", - "homepage": "https://www.usabilitydynamics.com", - "role": "Developer" - } - ], - "extra": { - "installer-name": "lib-utility", - "component": { - "name": "utility", - "scripts": [ "scripts/*.js" ] - } - }, - "license": "MIT" -} diff --git a/vendor/udx/lib-utility/composer.lock b/vendor/udx/lib-utility/composer.lock deleted file mode 100644 index 2f960f3c0..000000000 --- a/vendor/udx/lib-utility/composer.lock +++ /dev/null @@ -1,720 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" - ], - "hash": "859a04bbecf3bef6e6d4e7cefc281f0f", - "packages": [ - - ], - "packages-dev": [ - { - "name": "phpunit/php-code-coverage", - "version": "2.0.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "99a530363b6cf50efc18e1a7cbb12d42b6b22a0b" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/99a530363b6cf50efc18e1a7cbb12d42b6b22a0b", - "reference": "99a530363b6cf50efc18e1a7cbb12d42b6b22a0b", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-file-iterator": "~1.3.1", - "phpunit/php-text-template": "~1.2.0", - "phpunit/php-token-stream": "~1.2.2", - "sebastian/environment": "~1.0.0", - "sebastian/version": "~1.0.3" - }, - "require-dev": { - "ext-xdebug": ">=2.1.4", - "phpunit/phpunit": "~4.0.14" - }, - "suggest": { - "ext-dom": "*", - "ext-xdebug": ">=2.2.1", - "ext-xmlwriter": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", - "homepage": "https://github.com/sebastianbergmann/php-code-coverage", - "keywords": [ - "coverage", - "testing", - "xunit" - ], - "time": "2014-05-19 02:25:07" - }, - { - "name": "phpunit/php-file-iterator", - "version": "1.3.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/acd690379117b042d1c8af1fafd61bde001bf6bb", - "reference": "acd690379117b042d1c8af1fafd61bde001bf6bb", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "File/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2013-10-10 15:34:57" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "reference": "206dfefc0ffe9cebf65c413e3d0e809c82fbf00a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "Text/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2014-01-30 17:20:04" - }, - { - "name": "phpunit/php-timer", - "version": "1.0.5", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2013-08-02 07:42:54" - }, - { - "name": "phpunit/php-token-stream", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "955c24b708f8bfd6a05f303217a8dac3a443d531" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/955c24b708f8bfd6a05f303217a8dac3a443d531", - "reference": "955c24b708f8bfd6a05f303217a8dac3a443d531", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2-dev" - } - }, - "autoload": { - "classmap": [ - "PHP/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2014-05-12 05:34:42" - }, - { - "name": "phpunit/phpunit", - "version": "4.1.x-dev", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "069d57f964bb6a0f2cd360cfcf231d767e2996bb" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/069d57f964bb6a0f2cd360cfcf231d767e2996bb", - "reference": "069d57f964bb6a0f2cd360cfcf231d767e2996bb", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", - "php": ">=5.3.3", - "phpunit/php-code-coverage": "~2.0", - "phpunit/php-file-iterator": "~1.3.1", - "phpunit/php-text-template": "~1.2", - "phpunit/php-timer": "~1.0.2", - "phpunit/phpunit-mock-objects": "~2.1", - "sebastian/comparator": "~1.0", - "sebastian/diff": "~1.1", - "sebastian/environment": "~1.0", - "sebastian/exporter": "~1.0", - "sebastian/version": "~1.0", - "symfony/yaml": "~2.0" - }, - "suggest": { - "phpunit/php-invoker": "~1.1" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "", - "../../symfony/yaml/" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "http://www.phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2014-05-13 14:01:48" - }, - { - "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "4dada9d8762055e292d79142adbdde56c113b21a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/4dada9d8762055e292d79142adbdde56c113b21a", - "reference": "4dada9d8762055e292d79142adbdde56c113b21a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "phpunit/php-text-template": "~1.2" - }, - "require-dev": { - "phpunit/phpunit": "4.2.*@dev" - }, - "suggest": { - "ext-soap": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.2.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "include-path": [ - "" - ], - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sb@sebastian-bergmann.de", - "role": "lead" - } - ], - "description": "Mock Object library for PHPUnit", - "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", - "keywords": [ - "mock", - "xunit" - ], - "time": "2014-05-09 09:09:30" - }, - { - "name": "sebastian/comparator", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "reference": "e54a01c0da1b87db3c5a3c4c5277ddf331da4aef", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "sebastian/diff": "~1.1", - "sebastian/exporter": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "http://www.github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2014-05-11 23:00:21" - }, - { - "name": "sebastian/diff", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "ac84cfdec593945f36f24074d6ea17d296e86f76" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ac84cfdec593945f36f24074d6ea17d296e86f76", - "reference": "ac84cfdec593945f36f24074d6ea17d296e86f76", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.1-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - } - ], - "description": "Diff implementation", - "homepage": "http://www.github.com/sebastianbergmann/diff", - "keywords": [ - "diff" - ], - "time": "2014-05-12 05:21:40" - }, - { - "name": "sebastian/environment", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "10c7467da0622f7848cc5cadc0828c3359254df4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/10c7467da0622f7848cc5cadc0828c3359254df4", - "reference": "10c7467da0622f7848cc5cadc0828c3359254df4", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2014-05-04 17:56:05" - }, - { - "name": "sebastian/exporter", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/eb54a69388e5b7ea48561a65588f067fdda0c886", - "reference": "eb54a69388e5b7ea48561a65588f067fdda0c886", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - }, - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2014-05-05 08:31:02" - }, - { - "name": "sebastian/version", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "reference": "b6e1f0cf6b9e1ec409a0d3e2f2a5fb0998e36b43", - "shasum": "" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "lead" - } - ], - "description": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2014-03-07 15:35:33" - }, - { - "name": "symfony/yaml", - "version": "dev-master", - "target-dir": "Symfony/Component/Yaml", - "source": { - "type": "git", - "url": "https://github.com/symfony/Yaml.git", - "reference": "2158ca824145bd01877f58c987aff828bccddefa" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/Yaml/zipball/2158ca824145bd01877f58c987aff828bccddefa", - "reference": "2158ca824145bd01877f58c987aff828bccddefa", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.5-dev" - } - }, - "autoload": { - "psr-0": { - "Symfony\\Component\\Yaml\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Fabien Potencier", - "email": "fabien@symfony.com", - "homepage": "http://fabien.potencier.org", - "role": "Lead Developer" - }, - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - } - ], - "description": "Symfony Yaml Component", - "homepage": "http://symfony.com", - "time": "2014-05-16 14:25:18" - } - ], - "aliases": [ - - ], - "minimum-stability": "dev", - "stability-flags": [ - - ], - "platform": [ - - ], - "platform-dev": [ - - ] -} diff --git a/vendor/udx/lib-utility/gruntfile.js b/vendor/udx/lib-utility/gruntfile.js deleted file mode 100644 index 9bc70cf74..000000000 --- a/vendor/udx/lib-utility/gruntfile.js +++ /dev/null @@ -1,229 +0,0 @@ -/** - * Library Build. - * - * @author potanin@UD - * @version 1.2.0 - * @param grunt - */ -module.exports = function buildLibrary( grunt ) { - - // Require Utility Modules. - var joinPath = require( 'path' ).join; - var findup = require( 'findup-sync' ); - - // Determine Paths. - var _paths = { - composer: findup( 'composer.json' ), - vendor: findup( 'vendor' ), - phpTests: findup( 'test/php' ), - jsTests: findup( 'test/js' ), - autoload: findup( 'vendor/autoload.php' ) || findup( '**/autoload.php' ) - }; - - grunt.initConfig({ - - // Read Composer File. - package: grunt.file.readJSON( _paths.composer ), - - // PHP Unit Tests. - phpunit: { - classes: { - dir: joinPath( _paths.phpTests, '*.php' ) - }, - options: { - bin: 'phpunit', - bootstrap: _paths.autoload, - colors: true - } - }, - - // Generate Documentation. - yuidoc: { - compile: { - name: '<%= package.name %>', - description: '<%= package.description %>', - version: '<%= package.version %>', - url: '<%= package.homepage %>', - options: { - paths: [ 'lib', 'scripts' ], - outdir: 'static/codex/' - } - } - }, - - // Compile LESS. - less: { - development: { - options: { - relativeUrls: true - }, - files: { - //'styles/requires.dev.css': [ 'styles/src/requires.less' ] - } - }, - production: { - options: { - yuicompress: true, - relativeUrls: true - }, - files: { - //'styles/requires.css': [ 'styles/src/requires.less' ] - } - } - }, - - // Development Watch. - watch: { - options: { - interval: 100, - debounceDelay: 500 - }, - php: { - files: [ 'lib/class-*.php' ], - tasks: [ 'phpunit' ] - }, - less: { - files: [ 'styles/src/*.*' ], - tasks: [ 'less' ] - }, - js: { - files: [ 'scripts/src/*.*' ], - tasks: [ 'uglify' ] - } - }, - - // Uglify Scripts. - uglify: { - development: { - options: { - preserveComments: true, - beautify: true, - wrap: false - }, - files: [ - { - expand: true, - cwd: 'scripts/src', - src: [ '*.js' ], - dest: 'scripts' - } - ] - }, - production: { - options: { - preserveComments: false, - wrap: false - }, - files: [ - { - expand: true, - cwd: 'scripts/src', - src: [ '*.js' ], - dest: 'scripts' - } - ] - } - }, - - // Generate Markdown. - markdown: { - all: { - files: [ - { - expand: true, - src: 'readme.md', - dest: 'static/', - ext: '.html' - } - ], - options: { - markdownOptions: { - gfm: true, - codeLines: { - before: '', - after: '' - } - } - } - } - }, - - // Clean for Development. - clean: { - all: [ - "vendor", - "static/readme.md", - "composer.lock", - "styles/*.css", - "scripts/*.js" - ], - update: [ - "composer.lock" - ] - }, - - // CLI Commands. - shell: { - update: { - options: { - stdout: true - }, - command: 'composer update --prefer-source' - } - }, - - // Coverage Tests. - mochacov: { - options: { - reporter: 'list', - requires: [ 'should' ] - }, - all: [ joinPath( _paths.jsTests, '*.js' ) ] - }, - - // Usage Tests. - mochacli: { - options: { - requires: [ 'should' ], - reporter: 'list', - ui: 'exports', - bail: false - }, - all: [ joinPath( _paths.jsTests, '*.js' ) ] - } - - }); - - // Load NPM Tasks. - grunt.loadNpmTasks( 'grunt-markdown' ); - grunt.loadNpmTasks( 'grunt-requirejs' ); - grunt.loadNpmTasks( 'grunt-contrib-yuidoc' ); - grunt.loadNpmTasks( 'grunt-contrib-uglify' ); - grunt.loadNpmTasks( 'grunt-contrib-watch' ); - grunt.loadNpmTasks( 'grunt-contrib-less' ); - grunt.loadNpmTasks( 'grunt-contrib-concat' ); - grunt.loadNpmTasks( 'grunt-contrib-clean' ); - grunt.loadNpmTasks( 'grunt-shell' ); - grunt.loadNpmTasks( 'grunt-mocha-cli' ); - grunt.loadNpmTasks( 'grunt-mocha-cov' ); - grunt.loadNpmTasks( 'grunt-phpunit' ); - - // Register NPM Tasks. - grunt.registerTask( 'default', [ 'build' ] ); - - // Installation. - grunt.registerTask( 'install', [ 'build' ] ); - - // Build Task. - grunt.registerTask( 'build', [ 'markdown', 'less' , 'yuidoc', 'uglify' ] ); - - // Run Unit Tests. - grunt.registerTask( 'test', [ 'phpunit', 'mochacli:all', 'mochacov:all' ] ); - - // Build Distribution. - grunt.registerTask( 'distribution', [ 'mochacli:all', 'mochacov:all', 'clean:all', 'markdown', 'less:production', 'uglify:production' ] ); - - // Update Environment. - grunt.registerTask( 'update', [ 'clean:update', 'shell:update' ] ); - -}; \ No newline at end of file diff --git a/vendor/udx/lib-utility/lib/class-guid-fix.php b/vendor/udx/lib-utility/lib/class-guid-fix.php deleted file mode 100644 index 6ae9d8fb2..000000000 --- a/vendor/udx/lib-utility/lib/class-guid-fix.php +++ /dev/null @@ -1,205 +0,0 @@ -non-unique GUID bug. - * - * @source http://crowdfavorite.com/wordpress/plugins/cf-guid-fix/ - * - */ -namespace UsabilityDynamics\Utility { - - if( !class_exists( 'UsabilityDynamics\Utility\Guid_Fix' ) ) { - - class Guid_Fix { - - function __construct() { - - if( is_admin() ) { - $this->add_actions(); - } - - $this->menu_page_slug = 'cf_guid_fix'; - $this->page_url = admin_url( 'tools.php?page=' . $this->menu_page_slug ); - $this->errors = array(); - $this->error_msgs = array( - '1' => __( 'Could not create index on your posts table for the `guid` column', 'cf_guid_fix' ), - '2' => __( 'Could not update a post’s GUID', 'cf_guid_fix' ), - '3' => __( 'Could not remove the index from `guid`', 'cf_guid_fix' ), - ); - } - - function add_actions() { - add_action( 'admin_init', array( $this, 'admin_init' ) ); - add_action( 'admin_menu', array( $this, 'register_admin_menu' ) ); - add_filter( 'plugin_action_links', array( $this, 'plugin_action_links' ), 10, 2 ); - } - - function plugin_action_links( $links, $file ) { - $plugin_file = basename( __FILE__ ); - if( basename( $file ) == $plugin_file ) { - $tools_link = '' . __( 'Run GUID-fix', 'cf_guid_fix' ) . ''; - array_unshift( $links, $tools_link ); - } - - return $links; - } - - function register_admin_menu() { - add_submenu_page( - 'tools.php', // parent slug - 'GUID Fix', // page title - 'GUID Fix', // menu title - 'manage_options', // capability - $this->menu_page_slug, // menu item slug - array( $this, 'output_admin_page' ) // callback function - ); - } - - function output_admin_page() { - ?> -
-

- -

You should now disable and remove this plugin.', 'cf_guid_fix' ); ?>

- -
- ' . esc_html( $this->error_msgs[ intval( $num ) ] ) . '

'; - } - ?> -
- -

non-unique GUID bug.', 'cf_guid_fix' ); ?>

-

-
- - - -
-
- fix_guids(); - if( empty( $this->errors ) ) { - wp_redirect( add_query_arg( array( 'success' => '' ), $this->page_url ) ); - } else { - wp_redirect( add_query_arg( array( 'error' => implode( ',', $this->errors ) ), $this->page_url ) ); - } - exit; - break; - } - } - } - - private function fix_guids() { - global $wpdb; - - // add index on GUID column - $r = $wpdb->query( " - ALTER TABLE $wpdb->posts - ADD INDEX (guid) - " ); - - // Error Handling - if( $r === false ) { - $this->add_error( 1 ); - } - - // find non-unique GUID values - - // NOTE: not including revisions since that's a whole other mess to - // try to get the numbering right if we change the GUID - - // this gets the GUIDs - // SELECT guid - // FROM $wpdb->posts - // WHERE post_type != 'revision' - // GROUP BY guid - // HAVING COUNT(guid) > 1 - - // WORKS - but is very slow - // SELECT ID - // FROM $wpdb->posts - // WHERE guid IN ( - // SELECT guid - // FROM $wpdb->posts - // WHERE post_type != 'revision' - // GROUP BY guid - // HAVING COUNT(guid) > 1 - // ) - // AND post_type != 'revision' - - $non_unique_guids = $wpdb->get_col( $wpdb->prepare( " - SELECT p1.ID - FROM $wpdb->posts p1 - WHERE 1 < ( - SELECT COUNT(ID) - FROM $wpdb->posts p2 - WHERE p1.post_type != 'revision' - AND p1.guid = p2.guid - ) - AND p1.post_type != 'revision' - " ) ); - - // make them unique - if( count( $non_unique_guids ) ) { - foreach( $non_unique_guids as $post_id ) { - $url = site_url( '?p=' . $post_id ); - $r = $wpdb->query( $wpdb->prepare( " - UPDATE $wpdb->posts - SET guid = %s - WHERE ID = %d - ", $url, $post_id ) ); - - // Error Handling - if( $r === false ) { - $this->add_error( 2 ); - } - } - } - - // remove index from GUID column - $r = $wpdb->query( " - ALTER TABLE $wpdb->posts - DROP INDEX guid - " ); - - // Error Handling - if( $r === false ) { - $this->add_error( 3 ); - } - - } - - function add_error( $error_num ) { - if( !in_array( $error_num, $this->errors ) ) { - $this->errors[ ] = intval( $error_num ); - } - } - - } - } - -} - diff --git a/vendor/udx/lib-utility/lib/class-job.php b/vendor/udx/lib-utility/lib/class-job.php deleted file mode 100644 index 94242cb93..000000000 --- a/vendor/udx/lib-utility/lib/class-job.php +++ /dev/null @@ -1,417 +0,0 @@ - '_default', - 'post_title' => null, - 'post_password' => null, - 'post_status' => 'job-ready', - 'post_type' => '_ud_job' - ); - - /** - * Meta Keys. - * - * self::$_meta - * - * @property $_meta - * @private - * @type {Array} - */ - public static $_meta = array( - 'type' => array( 'is_single' => true ), - 'status' => array( 'is_single' => true ), - 'callback::worker' => array( 'is_single' => true ), - 'callback::complete' => array( 'is_single' => true ) - ); - - /** - * Job Instance ID. - * - * @property $id - * @private - * @type {Integer} - */ - public $id = null; - - /** - * Job Status. - * - * @property $status - * @private - * @type {Integer} - */ - private $status = null; - - /** - * Job Type. - * - * @property $type - * @private - * @type {Integer} - */ - private $type = null; - - /** - * Job Batches. - * - * @property $batches - * @private - * @type {Array} - */ - private $batches = array(); - - /** - * Job Instance Settings. - * - * @property $_settings - * @private - * @type {Object} - */ - private $_settings = stdClass; - - /** - * Constructor for the Job class. - * - * - * @todo Finish job loading. - * - * @method __construct - * @for Job - * @constructor - * @param array|\UsabilityDynamics\object $settings array - * @return \UsabilityDynamics\Job - * @version 0.0.1 - * @since 0.0.1 - */ - public function __construct( $settings = array() ) { - - // Register Job Post Type, if needed. - $this->_register_post_type(); - - // Save Settings to Instance, applying defaults, returns deeply-converted object. - $this->_settings = self::defaults( $settings, self::$defaults ); - - // Load job if ID is set. - if( $this->_settings->id ) { - return Job::query( array( "id" => $this->_settings->id ) ); - } - - // Generate Title. - $this->_settings->post_title = sprintf( __( 'Job %s', self::$text_domain ), $this->_settings->type ); - - // Generate public job hash. - $this->_settings->post_password = uniqid( $this->_settings->type . '-' ); - - // Encode payload. - $this->_settings->post_content = json_encode( (array) $this->_settings->post_content ); - - // Insert Job, get job ID. - $this->id = wp_insert_post( $this->_settings ); - - // Handle creation error. - if( $this->id instanceof WP_Error ) { - return $this->id; - } - - // Commit Meta Key. - foreach( (array) self::$_meta as $_key => $_options ) { - - $_value = $this->_settings->{$_key}; - - if( $_value ) { - update_post_meta( $this->id, 'job::' . $_key, $_value ); - } - - } - - - // Worker. - return $this; - - } - - /** - * Load Job. - * - * Parses post object and adds declared meta. - * - * @param null $job - * - * @internal param null $id - * - * @return object - */ - public function load_meta( $job = null ) { - - if( !$job ) { - $_id = $this->id; - } - - if( is_object( $job ) && $job->id ) { - $_id = $job->id; - } - - if( is_integer( $job ) ) { - $_id = $job; - } - - if( !$_id ) { - return new WP_Error( __( 'Could not load job with unknown ID.', self::$text_domain ) ); - } - - $_meta = array(); - - foreach( (array) self::$_meta as $_key => $_options ) { - $_value = get_post_meta( $_id, 'job::' . $_key, $_options[ 'is_single' ] ? true : false ); - - if( $_value ) { - $_meta[ $_key ] = $_value; - } - - } - - return $_meta; - - } - - /** - * Delete Job Instance. - * - */ - public function delete() { - global $wpdb; - - // Kill Babies. - foreach( (array) $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_parent=%d;", $this->id ) ) as $_child ) { - $_post = wp_delete_post( $_child, true ); - } - - // Kill Parent. - $_post = wp_delete_post( $this->id, true ); - - // Return object. - return $_post; - - } - - /** - * Push Batch Cargo. - * - * @param array $data - * @param array $args - * - * @return int|void|\WP_Error - */ - public function push( $data = array(), $args = array() ) { - - // Convert to JSON String. - $_data = json_encode( (array) $data ); - - // Generate public job hash. - $_batchid = wp_insert_post( self::defaults( $args, array( - 'post_parent' => $this->id, - 'post_status' => 'job-ready', - 'post_title' => sprintf( __( 'Job Batch %s', self::$text_domain ), $this->_settings->type ), - 'post_password' => uniqid( $this->_settings->type . '-' ), - 'post_type' => $this->_settings->post_type, - 'post_content' => $_data - )) ); - - // Add to batch list if not an error. - if( !is_wp_error( $_batchid ) ) { - $this->batches[ $_batchid ] = json_decode( $_data ); - } - - return $_batchid; - - } - - /** - * Process Mutiple Jobs. - * - * - * @param string $type Job type. - * @param array $args - * - * @return null - */ - public static function process_jobs( $type = null, $args = array() ) { - - $_results = array(); - - foreach( self::query( $type ) as $_count => $_job ) { - - $_batches = self::query( $_job->type, array( - "post_parent" => $_job->ID, - "post_status" => 'job-ready', - - )); - - //die( '
' . print_r( $_batches, true ) . '
' ); - // Get Batches - - // $_results[ $_count ] = apply_filters( 'job::' . $_job->type, $_job, $_results[ $_count ] = $_results[ $_count ] || array(), $_count ); - - } - - return $_results; - - } - - /** - * Query Job Instance(s) - * - * @todo Should use instances of Job instead of WP_Post. - * - * @param null $type - * @param array $args - * - * @return array - */ - public static function query( $type = null, $args = array() ) { - - // Build get_posts query. - $args = self::defaults( $args, array( - 'posts_per_page' => 100, - 'offset' => 0, - 'post_parent' => 0, - 'orderby' => 'post_date', - 'order' => 'DESC', - 'post_type' => '_ud_job', - 'post_status' => 'job-ready' - )); - - // Query by ID. - if( is_numeric( $type ) ) { - $args->ID = $type; - } - - // Query by type. - if( is_string( $type ) ) { - $args->meta_key = 'job::type'; - $args->meta_value = $type; - } - - // Get all top-level jobs. - $_jobs = get_posts( (array) $args ); - - // Extend Job objects with meta. - foreach( (array) $_jobs as $_count => $_job ) { - - // Remove unused keys. - unset( $_jobs[ $_count ]->ping_status ); - unset( $_jobs[ $_count ]->to_ping ); - unset( $_jobs[ $_count ]->pinged ); - unset( $_jobs[ $_count ]->pinged ); - unset( $_jobs[ $_count ]->guid ); - unset( $_jobs[ $_count ]->menu_order ); - unset( $_jobs[ $_count ]->post_mime_type ); - unset( $_jobs[ $_count ]->filter ); - - // Decode cargo. - $_jobs[ $_count ]->post_content = json_decode( $_jobs[ $_count ]->post_content ? $_jobs[ $_count ]->post_content : array() ); - $_jobs[ $_count ]->post_excerpt = json_decode( $_jobs[ $_count ]->post_excerpt ? $_jobs[ $_count ]->post_excerpt : array() ); - - // Load Meta into Object. - foreach( self::load_meta( $_job->ID ) as $_key => $_value ) { - $_jobs[ $_count ]->{$_key} = $_value; - } - - } - - // Return formatted jobs result. - return (object) $_jobs; - - } - - /** - * Register Job Post Type - * - * @private - * @uses get_post_type_object - * @uses register_post_type - */ - private function _register_post_type() { - - // Return if already registered. - if( get_post_type_object( $this->_settings->post_type ) ) { - return get_post_type_object( $this->_settings->post_type ); - } - - // Register; - register_post_type( $this->_settings->post_type, array( - 'labels' => array( - 'name' => __( 'Jobs', self::$text_domain ), - 'singular_name' => __( 'Jobs', self::$text_domain ), - 'new_item' => __( 'New Job', self::$text_domain ), - 'view_item' => __( 'View Job', self::$text_domain ), - 'all_items' => __( 'Jobs', self::$text_domain ) - ), - 'description' => __( 'UsabilityDynamics Jobs.', self::$text_domain ), - 'public' => false, - 'hierarchical' => true, - 'exclude_from_search' => true, - 'publicly_queryable' => false, - 'show_ui' => false, - 'show_in_menu' => false, - 'show_in_nav_menus' => false, - 'show_in_admin_bar' => false, - 'map_meta_cap' => false, - 'supports' => array( 'raas' ), - 'has_archive' => false, - 'rewrite' => false, - 'query_var' => false, - 'can_export' => true, - 'delete_with_user' => false, - '_edit_link' => 'veneer/?job=%d', - )); - - // Return post type object. - return get_post_type_object( $this->_settings->post_type ); - - } - - } - - } - -} - diff --git a/vendor/udx/lib-utility/lib/class-loader.php b/vendor/udx/lib-utility/lib/class-loader.php deleted file mode 100644 index d89e63836..000000000 --- a/vendor/udx/lib-utility/lib/class-loader.php +++ /dev/null @@ -1,445 +0,0 @@ -add( 'Symfony', __DIR__ . '/framework' ); - * - * // register classes with namespaces by passing an array - * $loader->add( array( - * 'UsabilityDynamics\\' => __DIR__ . '/usabilitydynamics' - * 'JsonSchema\\' => __DIR__ . '/jsonschema/src' - * )); - * - * // activate the autoloader - * $loader->register(); - * - * This class is loosely based on the Symfony UniversalClassLoader. - * - * @class Loader - * @author potanin@UD - */ - class Loader { - - /** - * Loader Class version. - * - * @property $version - * @type {Object} - */ - public static $version = '0.0.3'; - - /** - * Extra header parameters. - * - * @property $headers - * @type {Object} - */ - public static $headers = array( - 'theme' => array( - 'Name' => 'Theme Name', - 'ThemeURI' => 'Theme URI', - 'Description' => 'Description', - 'Author' => 'Author', - 'AuthorURI' => 'Author URI', - 'Version' => 'Version', - 'Template' => 'Template', - 'Status' => 'Status', - 'Tags' => 'Tags' - ) - ); - - /** - * Configuration. - * - * @property $settings - * @type {Object} - */ - public $settings = array(); - - /** - * Array with fallback directories for auto-loading. - * - * @property $fallback_directories - * @type {Object} - */ - public $fallback_directories = array(); - - /** - * Array of stored namespace prefixes. - * - * @property $prefixes - * @type {Object} - */ - public $prefixes = array(); - - /** - * Array of stored class mappings. - * - * @property $class_map - * @type {Object} - */ - public $class_map = array(); - - /** - * Constructor for the Loader class. - * - * @method __construct - * @for Loader - * @constructor - * - * @param $settings array - * - * @return \UsabilityDynamics\Loader - * @version 0.0.2 - * @since 0.0.2 - */ - function __construct( $settings = array() ) { - - // Save Loader Settings. - $this->settings = json_decode( json_encode( $settings ) ); - - // Load libraries that use namespaces. - if( isset( $this->settings->controllers ) ) { - $this->set_namespace( $this->settings->controllers ); - } - - // Loads libraries that do not use namespaces. - if( isset( $this->settings->helpders ) ) { - $this->add_class_map( $this->settings->helpers ); - } - - // Register Autoloader. - $this->register( true ); - - // Prepare Filters. - add_filter( 'template_redirect', array( $this, 'template_redirect' ) ); - - // Utility. - add_filter( 'extra_theme_headers', array( $this, 'extra_theme_headers' ) ); - - // @chainable - return $this; - - } - - /** - * Fronted Setup - * - * @return $this - * - * @method template_redirect - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - function template_redirect() { - - // Unrefister Autoloader. - $this->unregister(); - - // @chainable - return $this; - - } - - /** - * Add Color Scheme - * - * @method extra_theme_headers - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - function extra_theme_headers() { - return (array) $this->headers; - } - - /** - * Add Class Map - * - * @param array $class_map Class to filename map - * - * @return $this - * - * @method add_class_map - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function add_class_map( array $class_map ) { - - if( $this->class_map ) { - $this->class_map = array_merge( $this->class_map, $class_map ); - } else { - $this->class_map = $class_map; - } - - return $this; - - } - - /** - * Registers a set of classes, merging with any others previously set. - * - * @param string $prefix The classes prefix - * @param array|string $paths The location(s) of the classes - * @param bool $prepend Prepend the location(s) - * - * @return $this - * - * @method add_class - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function add_class( $prefix, $paths, $prepend = false ) { - - if( !$prefix ) { - if( $prepend ) { - $this->fallback_directories = array_merge( (array) $paths, (array) $this->fallback_directories ); - } else { - $this->fallback_directories = array_merge( (array) $this->fallback_directories, (array) $paths ); - } - - return $this; - } - - $first = $prefix[ 0 ]; - - if( !isset( $this->prefixes[ $first ][ $prefix ] ) ) { - $this->prefixes[ $first ][ $prefix ] = (array) $paths; - - return $this; - } - if( $prepend ) { - $this->prefixes[ $first ][ $prefix ] = array_merge( (array) $paths, $this->prefixes[ $first ][ $prefix ] ); - } else { - $this->prefixes[ $first ][ $prefix ] = array_merge( $this->prefixes[ $first ][ $prefix ], (array) $paths ); - } - - return $this; - - } - - /** - * Registers a set of classes, replacing any others previously set. - * - * @param string|array $prefix The classes prefix or an object containing prefixes and strings. - * @param array|string $paths The location(s) of the classes - * - * @return $this - * - * @method set_namespace - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function set_namespace( $prefix, $paths = null ) { - - if( is_array( $prefix ) || is_object( $prefix ) ) { - - foreach( $prefix as $namespace => $path ) { - $this->set_namespace( $namespace, $path ); - } - - return $this; - - } - - if( !$prefix ) { - $this->fallback_directories = (array) $paths; - } else { - $this->prefixes[ substr( $prefix, 0, 1 ) ][ $prefix ] = (array) $paths; - } - - return $this; - - } - - /** - * Registers this instance as an autoloader. - * - * @param callback $autoload_function [optional]. The autoload function being registered. - * @param bool $throw This parameter specifies whether spl_autoload_register() should throw exceptions when the autoload_function cannot be registered. - * @param bool $prepend If true, spl_autoload_register() will prepend the autoloader on the autoload stack instead of appending it. - * - * @method register - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function register( $throw = false, $prepend = false ) { - spl_autoload_register( array( $this, 'load_class' ), $throw, $prepend ); - } - - /** - * Unregisters this instance as an autoloader. - * - * @method unregister - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function unregister() { - spl_autoload_unregister( array( $this, 'load_class' ) ); - } - - /** - * Loads the given class or interface. - * - * @param string $class The name of the class - * - * @return bool|null True if loaded, null otherwise - * - * @method load_class - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function load_class( $class ) { - - if( $file = $this->find_file( $class ) ) { - include $file; - - return true; - } - - } - - /** - * Finds the path to the file where the class is defined. - * - * - $namespace Raw namespace. - * - $class_path Fully reoslved name. - * - $class_name Just the class name. - * - * @param string $class The name of the class - * - * @return string|false The path if found, false otherwise - * - * @method find_file - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - */ - public function find_file( $class ) { - - // work around for PHP 5.3.0 - 5.3.2 https://bugs.php.net/50731 - if( '\\' == $class[ 0 ] ) { - $class = substr( $class, 1 ); - } - - // $class = str_replace( 'Flawless\\', '\\', $class ); - - if( isset( $this->class_map[ $class ] ) ) { - return $this->class_map[ $class ]; - } - - if( false !== $pos = strrpos( $class, '\\' ) ) { - $class_path = strtr( substr( $class, 0, $pos ), '\\', DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR; - $class_name = substr( $class, $pos + 1 ); - } else { - $class_path = null; - $class_name = $class; - } - - $namespace = $class_path; - $class_path .= strtr( $class_name, '_', DIRECTORY_SEPARATOR ) . '.php'; - - $first = $class[ 0 ]; - - if( isset( $this->prefixes[ $first ] ) ) { - - //die( '
' . print_r( $this->prefixes[ $first ], true ) . '
' ); - - foreach( $this->prefixes[ $first ] as $prefix => $dirs ) { - if( 0 === strpos( $class, $prefix ) ) { - foreach( $dirs as $dir ) { - - if( file_exists( $dir . DIRECTORY_SEPARATOR . $class_path ) ) { - return $dir . DIRECTORY_SEPARATOR . $class_path; - } - - // If file not found, try with the namespace stripped - if( file_exists( $dir . DIRECTORY_SEPARATOR . str_replace( $namespace, '', $class_path ) ) ) { - return $dir . DIRECTORY_SEPARATOR . str_replace( $namespace, '', $class_path ); - } - - } - } - } - } - - foreach( $this->fallback_directories as $dir ) { - if( file_exists( $dir . DIRECTORY_SEPARATOR . $class_path ) ) { - return $dir . DIRECTORY_SEPARATOR . $class_path; - } - } - - return $this->class_map[ $class ] = false; - - } - - /** - * Parse File Headers - * - * @example - * - * Loader::get_file_data( 'style.css' ); - * Loader::get_file_data( 'my-module/my-module.php', 'module' ); - * - * @method get_file_data - * @for Loader - * - * @author potanin@UD - * @version 0.0.2 - * @since 0.0.2 - * - * @param string $path Full path to the target file. - * @param string $type Type of target file, defaults to theme, must be defined in Loader::$headers. - * - * @return array - */ - public static function get_file_data( $path = '', $type = 'theme' ) { - return array_filter( (array) get_file_data( $path, is_string( $type ) ? Loader::$headers[ $type ] : Loader::$headers[ 'theme' ], $type ) ); - } - - } - - } - -} - diff --git a/vendor/udx/lib-utility/lib/class-structure.php b/vendor/udx/lib-utility/lib/class-structure.php deleted file mode 100644 index 8f8d0f120..000000000 --- a/vendor/udx/lib-utility/lib/class-structure.php +++ /dev/null @@ -1,229 +0,0 @@ - - * @package Theme - * @author peshkov@UD - */ -namespace UsabilityDynamics { - - if( !class_exists( 'UsabilityDynamics\Structure' ) ) { - - class Structure { - - /** - * - * - */ - static private $args = array(); - - /** - * - * - */ - static private $structure = array(); - - /** - * Define Data Structure - * - * @param $args - * @param $args.types (array) Post type definitions - * @param $args.meta (array) Meta definitions. - * @param $args.taxonomies (array) Taxonomy fields. - * - * @return array|bool - */ - static public function define( $args = array() ) { - - self::$args = wp_parse_args( $args, array( - 'types' => array(), // Custom post types - 'meta' => array(), // Meta fields - 'taxonomies' => array(), // Taxonomies - ) ); - - $structure = array(); - - foreach( (array) self::$args[ 'types' ] as $object_type => $type ) { - - $object_type = sanitize_key( $object_type ); - - self::$structure[ $object_type ] = array( - 'meta' => array(), - 'terms' => array(), - ); - - // STEP 1. Register post_type - - // Register Post Type - $data = ( isset( $type[ 'data' ] ) && is_array( $type[ 'data' ] ) ) ? $type[ 'data' ] : array(); - - if( !post_type_exists( $object_type ) ) { - register_post_type( $object_type, self::_prepare_post_type( $object_type, $data )); - } - - // STEP 2. Register taxonomy ( and Taxonomy's Post Type if theme supports 'extended-taxonomies' feature ) - - // Define post type's taxonomies - $taxonomies = ( isset( $type[ 'taxonomies' ] ) && is_array( $type[ 'taxonomies' ] ) ) ? $type[ 'taxonomies' ] : array( - 'post_tag', - 'category', - ); - - // Initialize taxonomies if they don't exist and assign them to the current post type - foreach( (array) $taxonomies as $taxonomy ) { - - if( empty( $taxonomy ) || !is_string( $taxonomy ) ) { - continue; - } - - if( !taxonomy_exists( $taxonomy ) ) { - $data = self::_prepare_taxonomy( $taxonomy ); - register_taxonomy( $taxonomy, null, $data ); - } - - register_taxonomy_for_object_type( $taxonomy, $object_type ); - - //** Add custom post type for our taxonomy if theme supports extended-taxonomies */ - $taxonomy_post_type = '_tp_' . $taxonomy; - if( current_theme_supports( 'extended-taxonomies' ) && !post_type_exists( $taxonomy_post_type ) ) { - register_post_type( $taxonomy_post_type, array( - 'label' => $data[ 'label' ], - 'public' => false, - 'rewrite' => false, - 'labels' => array( - 'name' => $data[ 'label' ], - 'edit_item' => 'Edit Term: ' . $data[ 'label' ] - ), - 'supports' => array( 'title', 'editor' ), - )); - } - - if( isset( $structure[ $object_type ] ) && isset( $structure[ $object_type ]['terms' ] ) && is_array( $structure[ $object_type ]['terms' ] ) ) { - array_push( $structure[ $object_type ][ 'terms' ], $taxonomy ); - } - - } - - // STEP 3. Set meta fields and meta boxes - - // Stop here if Meta Box class doesn't exist - if( !class_exists( '\RW_Meta_Box' ) ) { - continue; - } - - // Init \RW_Meta_Box defines if needed - if ( !defined( 'RWMB_VER' ) ) { - - $reflector = new \ReflectionClass( '\RW_Meta_Box' ); - - $file = dirname( dirname( $reflector->getFileName() ) ) . '/meta-box.php'; - if( !file_exists( $file ) ) { - continue; - } - include_once( $file ); - } - - $metaboxes = ( isset( $type[ 'meta' ] ) && is_array( $type[ 'meta' ] ) ) ? $type[ 'meta' ] : array(); - - foreach( $metaboxes as $key => $data ) { - $data = self::_prepare_metabox( $key, $object_type, $data ); - - if( $data ) { - new \RW_Meta_Box( $data ); - } - } - - } - - // STEP 4. reset static vars and return structure data. - $structure = array( - 'post_types' => self::$structure, - 'schema' => self::$args, - ); - - self::$args = array(); - self::$structure = array(); - - return $structure; - } - - /** - * - * - */ - static private function _prepare_metabox( $key, $object_type, $data ) { - $label = \UsabilityDynamics\Utility::de_slug( $key ); - - $data = wp_parse_args( $data, array( - 'id' => $key, - 'title' => $label, - 'pages' => array( $object_type ), - 'context' => 'normal', - 'priority' => 'high', - 'autosave' => false, - 'fields' => array(), - ) ); - - // There is no sense to init empty metabox - if( !is_array( $data[ 'fields' ] ) || empty( $data[ 'fields' ] ) ) { - return false; - } - - $fields = array(); - foreach( $data[ 'fields' ] as $field ) { - array_push( self::$structure[ $object_type ][ 'meta' ], $field ); - $fields[] = self::_prepare_metafield( $field ); - } - - $data[ 'fields' ] = $fields; - - return $data; - } - - /** - * - * - */ - static private function _prepare_metafield( $key ) { - $data = isset( self::$args[ 'meta' ][ $key ] ) ? (array) self::$args[ 'meta' ][ $key ] : array(); - $data = wp_parse_args( $data, array( - 'id' => $key, - 'name' => \UsabilityDynamics\Utility::de_slug( $key ), - 'type' => 'text', - ) ); - return $data; - } - - /** - * - * - */ - static private function _prepare_taxonomy( $key ) { - $data = isset( self::$args[ 'taxonomies' ][ $key ] ) && is_array( self::$args[ 'taxonomies' ][ $key ] ) ? self::$args[ 'taxonomies' ][ $key ] : array(); - $data = wp_parse_args( $data, array( - 'label' => \UsabilityDynamics\Utility::de_slug( $key ), - ) ); - return $data; - } - - /** - * - * - */ - static private function _prepare_post_type( $key, $args = array() ) { - $args = wp_parse_args( $args, array( - 'label' => \UsabilityDynamics\Utility::de_slug( $key ), - 'exclude_from_search' => false, - ) ); - return $args; - } - - } - - } - -} - - - diff --git a/vendor/udx/lib-utility/lib/class-term.php b/vendor/udx/lib-utility/lib/class-term.php deleted file mode 100644 index 62b662e30..000000000 --- a/vendor/udx/lib-utility/lib/class-term.php +++ /dev/null @@ -1,127 +0,0 @@ - - * @package Theme - * @author potanin@UD - * @author peshkov@UD - */ -namespace UsabilityDynamics { - - if( !class_exists( 'UsabilityDynamics\Term' ) ) { - - class Term { - - /** - * Add meta data field to a term. - * - */ - static public function add_meta( $term_id, $meta_key, $meta_value, $unique = false ) { - - if( current_theme_supports( 'extended-taxonomies' ) ) { - return add_post_meta( self::get_post_for_extended_term( $term_id )->ID, $meta_key, $meta_value, $unique ); - } - - return add_metadata( 'taxonomy', $term_id, $meta_key, $meta_value, $unique ); - } - - /** - * Remove metadata matching criteria from a term. - * - * - */ - static public function delete_meta( $term_id, $meta_key, $meta_value = '' ) { - - if( current_theme_supports( 'extended-taxonomies' ) ) { - return delete_post_meta( self::get_post_for_extended_term( $term_id )->ID, $meta_key, $meta_value ); - } - - return delete_metadata( 'taxonomy', $term_id, $meta_key, $meta_value ); - } - - /** - * Retrieve term meta field for a term. - * - */ - static public function get_meta( $term_id, $key, $single = false ) { - - if( current_theme_supports( 'extended-taxonomies' ) ) { - return get_post_meta( self::get_post_for_extended_term( $term_id )->ID, $key, $single ); - } - - return get_metadata( 'taxonomy', $term_id, $key, $single ); - } - - /** - * Update term meta field based on term ID. - * - */ - static public function update_meta( $term_id, $meta_key, $meta_value, $prev_value = '' ) { - - if( current_theme_supports( 'extended-taxonomies' ) ) { - return update_post_meta( self::get_post_for_extended_term( $term_id )->ID, $meta_key, $meta_value, $prev_value ); - } - - return update_metadata( 'taxonomy', $term_id, $meta_key, $meta_value, $prev_value ); - } - - /** - * {} - * - * @author potanin@UD - */ - static public function get_post_for_extended_term( $term_id = false, $taxonomy = false ) { - global $wpdb; - - if( !$term_id ) { - return false; - } - - if( is_object( $term_id ) ) { - $term_id = $term_id->term_id; - $taxonomy = $taxonomy ? $taxonomy : $term_id->taxonomy; - } - - //** Try to get taxonomy -if this term only has one relationship, it's a good guess */ - if( !$taxonomy ) { - $taxonomy = $wpdb->get_col( "SELECT taxonomy FROM {$wpdb->term_taxonomy} WHERE term_id = {$term_id}" ); - - if( count( $taxonomy ) > 1 ) { - return false; - } else { - $taxonomy = $taxonomy[0]; - } - } - - if( !is_numeric( $term_id ) || empty( $taxonomy ) ) { - return false; - } - - $post_id = $wpdb->get_var( "SELECT post_id FROM {$wpdb->postmeta} pm LEFT JOIN {$wpdb->posts} p ON pm.post_id = p.ID WHERE meta_key = 'extended_term_id' AND meta_value = '{$term_id}' AND post_type = '_tp_{$taxonomy}' " ); - - if( !$post_id ) { - return false; - } - - if( $post_id ) { - $post = get_post( $post_id ); - } - - if( !$post ) { - return false; - } - - return $post; - - } - - } - - } - -} - - - diff --git a/vendor/udx/lib-utility/lib/class-utility.php b/vendor/udx/lib-utility/lib/class-utility.php deleted file mode 100644 index be11f8a7e..000000000 --- a/vendor/udx/lib-utility/lib/class-utility.php +++ /dev/null @@ -1,2595 +0,0 @@ - 10, - "offset" => 10, - "post_type" => 'any', - "post_status" => 'any' - )); - - foreach ( $allposts as $_post ) { - - $postmeta = get_post_meta($postinfo->ID, $key); - - die( '
' . print_r( $postmeta, true ) . '
'); - - } - - $keys = array('address', 'address2', 'city', 'state', 'zip'); //Add post meta keys here - - foreach ( $keys as $key ) { - - foreach( $allposts as $postinfo) { - - // Fetch array of custom field values - - - //print_r($postinfo); - - if (!empty($postmeta) ) { - - // Delete the custom field for this post (all occurrences) - delete_post_meta($postinfo->ID, $key); - - // Insert one and only one custom field - update_post_meta($postinfo->ID, $key, $postmeta[0]); - - } - } - - } - - - break; - - default: - - break; - - } - - //$wpdb->query( "DELETE a,b,c FROM {$wpdb->posts} a LEFT JOIN wp_term_relationships b ON (a.ID = b.object_id) LEFT JOIN {$wpdb->postmeta} c ON (a.ID = c.post_id) WHERE a.post_type = 'revision'" ); - //$wpdb->query( "DELETE pm FROM wp_postmeta pm LEFT JOIN wp_posts wp ON wp.ID = pm.post_id WHERE wp.ID IS NULL;" ); - //$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE ('_site_transient_%');" ); - //$wpdb->query( "DELETE FROM {$wpdb->options} WHERE option_name LIKE ('_transient_%');" ); - - - } - - /** - * Looks for a json or a php file in specified directory, if the file is not found traverse up and look for it again until its found or until a document root is reached - * - * - * @todo Honor the "nocase" option setting. - * @todo Perhaps wrap simplexml_load_file into - potanin@UD - * - * @since 0.3.2 - * @method findUp - * @param string $name - Name of file to find. - * @param string $cwd - Directory to start seeking from. Defaults to __DIR__ - * @param string $required - If the file is required - if not found, will trigger an error. - * @author tosheen@UD - * @return array|bool|mixed|\SimpleXMLElement - */ - static public function findUp( $name = false, $cwd = false, $required = false ) { - - // No name provided, bail. - if( !$name ) { - return false; - } - - // If first argument appears to be an object/array, treat it as a configuration object. - if( is_array( $name ) || is_object( $name ) ) { - - // Apply default settings to passed argument. - $_settings = self::defaults( $name, array( - "cwd" => $cwd ? $cwd : null, - "required" => $required ? $required : false, - "nocase" => true - )); - - $name = $_settings->name; - $cwd = $_settings->cwd; - $required = $_settings->required; - $nocase = $_settings->nocase; - - } - - // No CWD set, backtrace to determine caller. - $cwd = $cwd ? $cwd : dirname( self::backtrace_caller()->file ); - - // Determine if file is JSON - $fileData = explode( '.', $name ); - $fileExtension = $fileData[ count( $fileData ) - 1 ]; - - // Determine traverse path - $_path = ( !empty( $cwd ) ? $cwd : $_SERVER[ 'DOCUMENT_ROOT' ] ); - - $file = $_path . DIRECTORY_SEPARATOR . $name; - - // Trigger Error and bail on failures. - if( !is_dir( $_path ) ) { - - // Trigger error if required, otherwise fail silently. - if( $required ) { - trigger_error( __( 'Required file not found.', self::$text_domain ), E_USER_ERROR ); - } - - return false; - - } - - if( file_exists( $file ) ) { - - // Fetch and parse JSON. - if( $fileExtension === 'json' ) { - return json_decode( file_get_contents( $file ) ); - } - - // Fetch and parse XML. - if( $fileExtension === 'xml' ) { - return simplexml_load_file( $file ); - } - - // Include all others. - return include_once( $file ); - - } - - if( $_path != $_SERVER[ 'DOCUMENT_ROOT' ] ) { - $lastDirSeparator = strrpos( $_path, DIRECTORY_SEPARATOR, -1 ); - $_path = substr( $_path, 0, $lastDirSeparator ); - return self::findUp( $name, $_path ); - } - - // Trigger error if file was required. - if( $required ) { - trigger_error( __( 'Required file not found.', self::$text_domain ), E_USER_ERROR ); - } - - // Couldn't find anything - return false; - - } - - /** - * Get Caller Object - * - * @method backtrace_caller - * @since 0.3.2 - * @author potanin@UD - * @param int $depth - * @return object - */ - static public function backtrace_caller( $depth = 1 ) { - - // Always add one level to backtrace. - $_backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, ( $depth ? $depth : 1 ) + 1 ); - - // Return first hit as object, or a scaffolded object. - return $_backtrace[1] ? (object) $_backtrace[1] : (object) array( 'file' => null ); - - } - - /** - * Set Dot-Notated Array Value - * - * @param array $arr - * @param $path - * @param $val - * - * @return mixed - */ - static public function _set_val( array &$arr, $path, $val ) { - $loc = & $arr; - - foreach( explode( '.', $path ) as $step ) { - $loc = & $loc[ $step ]; - } - - return $loc = $val; - - } - - /** - * Convert dot-notated array key->value items to nested object - * - * @param $items - * @return array - */ - static public function unwrap( $items ) { - - $_result = array(); - - foreach( (array) $items as $key => $value ) { - self::_set_val( $_result, $key, $value ); - } - - return (array) $_result; - - } - - /** - * Wrapper for wp_parse_args. - * - * @author potanin@UD - * @since 0.3.0 - * @param $args - * @param $defaults - * - * @return object - */ - static public function parse_args( $args, $defaults ) { - - return (object) wp_parse_args( $args, $defaults ); - - } - - /** - * Parses Query. - * HACK. The current logic solves the issue of max_input_vars in the case if query is huge. - * - * @see parse_str() Default PHP function - * @version 1.1 - * @author peshkov@UD - * @param $request - * @return array|mixed - */ - static public function parse_str( $request ) { - $data = array(); - $tokens = explode( "&", $request ); - foreach ( $tokens as $token ) { - $token = str_replace( '%2B', md5( '%2B' ), $token ); - $arr = array(); - parse_str( $token, $arr ); - array_walk_recursive( $arr, function( &$value,$key ) { - $value = str_replace( md5( "%2B" ), "+", $value ); - }); - $data = self::extend( $data, $arr ); - } - return $data; - } - - /** - * Deep Conversion - * - * @updated 2.0 - * @since 0.1 - */ - static public function array_to_object( $array = array() ) { - return json_decode( json_encode( $array ) ); - } - - /** - * Recursively converts object to array - * - * @since 2.0 - * @author peshkov@UD - */ - static public function object_to_array( $data ) { - - if ( is_object( $data ) ) { - $data = get_object_vars( $data ); - } - - if ( is_array( $data ) ) { - foreach ( $data as $k => $v ) { - if ( is_object( $v ) ) { - $data[ $k ] = self::object_to_array( $v ); - } - } - } - - return $data; - - } - - /** - * Parse standard WordPress readme file - * - * @source Readme Parser ( http://www.tomsdimension.de/wp-plugins/readme-parser ) - * @author potanin@UD - */ - static public function parse_readme( $readme_file = false ) { - - if( !$readme_file ) { - $readme_file = untrailingslashit( TEMPLATEPATH ) . '/readme.txt'; - } - - $file = @file_get_contents( $readme_file ); - - if( !$file ) { - return false; - } - - $file = preg_replace( "/(\n\r|\r\n|\r|\n)/", "\n", $file ); - - // headlines - $s = array( '===', '==', '=' ); - $r = array( 'h2', 'h3', 'h4' ); - for( $x = 0; $x < sizeof( $s ); $x++ ) { - $file = preg_replace( '/(.*?)' . $s[ $x ] . '(?!\")(.*?)' . $s[ $x ] . '(.*?)/', '$1<' . $r[ $x ] . '>$2$3', $file ); - } - - // inline - $s = array( '\*\*', '\'' ); - $r = array( 'b', 'code' ); - for( $x = 0; $x < sizeof( $s ); $x++ ) { - $file = preg_replace( '/(.*?)' . $s[ $x ] . '(?!\s)(.*?)(?!\s )' . $s[ $x ] . '(.*?)/', '$1<' . $r[ $x ] . '>$2$3', $file ); - } - - // ' _italic_ ' - $file = preg_replace( '/(\s)_(\S.*?\S)_(\s|$)/', '$2 ', $file ); - - // ul lists - $s = array( '\*', '\+', '\-' ); - for( $x = 0; $x < sizeof( $s ); $x++ ) { - $file = preg_replace( '/^[ ' . $s[ $x ] . ' ](\s)(.*?)(\n|$)/m', '
  • $2
  • ', $file ); - } - - $file = preg_replace( '/\n
  • (.*?)/', '
    • $1', $file ); - $file = preg_replace( '/(<\/li>)(?!
    • )/', '$1
    ', $file ); - - // ol lists - $file = preg_replace( '/(\d{1,2}\. )\s(.*?)(\n|$)/', '
  • $2
  • ', $file ); - $file = preg_replace( '/\n
  • (.*?)/', '
    1. $1', $file ); - $file = preg_replace( '/(<\/li>)(?!(\|\<\/ul\> ))/', '$1
    ', $file ); - - // ol screenshots style - $file = preg_replace( '/(?=Screenshots)(.*?)
      /', '$1
        ', $file ); - - // line breaks - $file = preg_replace( '/(.*?)(\n)/', "$1
        \n", $file ); - $file = preg_replace( '/(1|2|3|4)(>)/', '$1>', $file ); - $file = str_replace( '
        ', '', $file ); - $file = str_replace( '

        ', '
        ', $file ); - - // urls - $file = str_replace( 'http://www.', 'www.', $file ); - $file = str_replace( 'www.', 'http://www.', $file ); - $file = preg_replace( '#(^|[^\"=]{1})(http://|ftp://|mailto:|https://)([^\s<>]+)([\s\n<>]|$)#', '$1$3$4', $file ); - - // divs - $file = preg_replace( '/(

        Description <\/h3>)/', "$1\n
        \n", $file ); - $file = preg_replace( '/(

        Installation <\/h3>)/', "

        \n$1\n
        \n", $file ); - $file = preg_replace( '/(

        Frequently Asked Questions <\/h3>)/', "

        \n$1\n
        \n", $file ); - $file = preg_replace( '/(

        Screenshots <\/h3>)/', "

        \n$1\n
        \n", $file ); - $file = preg_replace( '/(

        Arbitrary section <\/h3>)/', "

        \n$1\n
        \n", $file ); - $file = preg_replace( '/(

        Changelog <\/h3>)/', "

        \n$1\n
        \n", $file ); - $file = $file . '
        '; - - return $file; - - } - - /** - * Detects Variable Type. - * - * Distinguishes between object and array based on associative status. - * - * @source http://php.net/manual/en/function.gettype.php - * @since 1.0.4 - */ - static public function get_type( $var ) { - - if( is_object( $var ) ) return get_class( $var ); - if( is_null( $var ) ) return 'null'; - if( is_string( $var ) ) return 'string'; - - if( is_array( $var ) ) { - - if( self::is_associative( $var ) ) { - return 'object'; - } - - return 'array'; - - } - - if( is_int( $var ) ) return 'integer'; - if( is_bool( $var ) ) return 'boolean'; - if( is_float( $var ) ) return 'float'; - if( is_resource( $var ) ) return 'resource'; - - } - - /** - * Test if Array is Associative - * - * @param $arr - * @return bool - */ - static public function is_associative( $arr ) { - - if( !$arr ) { - return false; - } - - return array_keys($arr) !== range(0, count($arr) - 1) ? true : false; - - } - - /** - * Port of Lo-dash defaults function. - * - * Basically switches the order of arguments used by Utility::extend(); - * - * @method defaults - * - * @param array $data Data to be applied against defaults. $data Data to be applied against defaults. - * @param array $defaults Default array|object. $defaults Default array|object. - * - * @return object Extended data wtih defaults.@since 0.2.5 - */ - static public function defaults( $data = array(), $defaults = array() ) { - - // Extend and return data object/arary with defaults. - return (object) self::extend( (array) $defaults, (array) $data ); - - } - - /** - * Fix Serialized (Broken) Array Strings - * - * @example - * - * foreach( $wpdb->get_results( "SELECT meta_id, meta_value from {$wpdb->postmeta} WHERE meta_key = '_cfct_build_data'" ) as $row ) { - * $fixed = \UsabilityDynamics\Utility::repair_serialized_object( $row->meta_value ); - * $wpdb->query("UPDATE {$wpdb->postmeta} SET meta_value = {$fixed} WHERE meta_key = {$row->meta_key}"); - * } - * - * @param $input - * - * @return mixed - */ - static public function repair_serialized_object( $input ) { - return preg_replace( '!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $input ); - } - - /** - * Rename uploaded files as the hash of their original. - * - * @public - * @since 0.2.4 - * @method hashify_file_name - * @for UsabilityDynamics\Utility - * - * @param string $filename Original filename to hashify.. - * @param array|object $args Configuration arguments. - * - * @return string - * @author sopp@ID - */ - public static function hashify_file_name( $filename = null, $args = array() ) { - - if( !$filename ) { - return ''; - } - - $args = wp_parse_args( $args, array( - 'limit' => 99 - ) ); - - $info = pathinfo( $filename ); - $ext = empty( $info[ 'extension' ] ) ? '' : '.' . $info[ 'extension' ]; - - return md5( basename( $filename, $ext ) ) . rand( 0, $args[ 'limit' ] ) . $ext; - } - - /** - * Tests if remote image can be loaded. - * - * Returns URL to image if valid. - * Return false if image is invalid or could not be reached. - * - * @example - * - * // Try to load image. - * if( $url = Utility::can_get_image( $theme_settings->logo_url ) ) { - * echo "Image Found: $url."; - * } - * - * - * @method can_get_image - * @for Utility - * - * @param bool $url Valid URL to an image. - * - * @since 0.2.2 - * @return bool|int|string - */ - static public function can_get_image( $url = false ) { - - if( !is_string( $url ) ) { - return false; - } - - if( empty( $url ) ) { - return false; - } - - //** Test if post_id */ - if( is_numeric( $url ) && $image_attributes = wp_get_attachment_image_src( $url, 'full' ) ) { - $url = $image_attributes[ 0 ]; - } - - $result = wp_remote_get( $url, array( 'timeout' => 10 ) ); - - if( is_wp_error( $result ) ) { - return false; - } - - //** Image content types should always begin with 'image' ( I hope ) */ - if( strpos( $result[ 'headers' ][ 'content-type' ], 'image' ) !== 0 ) { - return false; - } - - return $url; - - } - - /** - * Return array of active plugins for current instance - * - * Improvement over wp_get_active_and_valid_plugins() which doesn't return any plugins when in MS - * - * @method get_active_plugins - * @for Utility - * - * @since 0.2.0 - */ - static public function get_active_plugins() { - $mu_plugins = (array) wp_get_mu_plugins(); - $regular_plugins = (array) wp_get_active_and_valid_plugins(); - - if( is_multisite() ) { - $network_plugins = (array) wp_get_active_network_plugins(); - } else { - $network_plugins = array(); - } - - return array_merge( $regular_plugins, $mu_plugins, $network_plugins ); - - } - - /** - * Validate URL - * - * @for Utility - * @since 0.1.1 - * - * @param string $url - * - * @param string $url - * - * @return bool - */ - static public function is_url( $url = '' ) { - return esc_url( $url ); - } - - /** - * Strip out protected keys from an associative array. - * - * Example below will remove all keys from array that being with $$: - * - * - * strip_protected_keys( $my_array, array( 'prefix' => '$$' ) ); - * - * - * @since 2.0 - * @author potanin@UD - */ - static public function strip_protected_keys( $array, $args = '' ) { - - $args = wp_parse_args( $args, array( 'prefix' => '_' ) ); - - foreach( (array) $array as $key => $value ) { - - if( strpos( $key, $args[ 'prefix' ] ) === 0 ) { - unset( $array[ $key ] ); - continue; - } - - if( is_array( $value ) ) { - $array[ $key ] = self::strip_protected_keys( $value, $args ); - } - - } - - $array = array_filter( $array ); - - return $array; - - } - - /** - * Recursively remove empty values from array. - * - * @method array_filter_deep - * @for Utility - * - * @version 1.0.1 - * @since 1.0.3 - * @author potanin@UD - */ - static public function array_filter_deep( $haystack = array() ) { - - foreach( (array) $haystack as $key => $value ) { - - if( is_object( $value ) || is_array( $value ) ) { - - if( is_object( $haystack ) ) { - $haystack->{$key} = self::array_filter_deep( (array) $value ); - } else if( is_array( $haystack ) ) { - $haystack[ $key ] = self::array_filter_deep( (array) $value ); - } - - } - - } - - return array_filter( (array) $haystack ); - - } - - /** - * Determines if a passed timestamp is newer than a requirement. - * - * Usage: UD_API::is_fresher_than( $timestamp, '5 minutes' ); - * - * @since 1.0.3 - */ - static public function fresher_than( $time, $ago = '1 week' ) { - return ( strtotime( "-" . $ago ) < $time ) ? true : false; - } - - /** - * Starts a timer for the passed string. - * - * @since 1.0.0.2 - * @author potanin@UD - */ - static public function timer_start( $function = 'global' ) { - global $ud_api; - - return $ud_api[ 'timers' ][ $function ][ 'start' ] = microtime( true ); - } - - /** - * Stop a timer. - * - * @since 1.0.0.2 - * @author potanin@UD - */ - static public function timer_stop( $function = 'global', $precision = 2 ) { - global $ud_api; - - return $ud_api[ 'timers' ][ $function ][ 'start' ] ? round( microtime( true ) - $ud_api[ 'timers' ][ $function ][ 'start' ], $precision ) : false; - } - - /** - * Start Profiling, can also double as timer. - * - * Profiling will only start if another profiling process is not already running. - * XHProf is required, other profilers may be added later. - * - * @updated 1.0.4 - * @since 1.0.0.2 - * @author potanin@UD - */ - static public function profiler_start( $method = false, $args = false ) { - global $ud_api; - - if( $ud_api[ 'profiling_now' ] && ( $ud_api[ 'profiling_now' ] != $method ) ) { - return; - } - - define( 'UD_API_Profiling', true ); - - if( extension_loaded( 'xhprof' ) && function_exists( 'xhprof_enable' ) ) { - xhprof_enable( XHPROF_FLAGS_CPU | XHPROF_FLAGS_NO_BUILTINS | XHPROF_FLAGS_MEMORY, $args ); - } - - return self::timer_start( $ud_api[ 'profiling_now' ] = $method ); - - } - - /** - * Stop Profiling. - * - * @since 1.0.0.2 - * @author potanin@UD - */ - static public function profiler_stop( $method = false, $args = false ) { - global $ud_api; - - if( $ud_api[ 'profiling_now' ] && ( $ud_api[ 'profiling_now' ] != $method ) ) { - return; - } - - if( extension_loaded( 'xhprof' ) && class_exists( 'XHProfRuns_Default' ) ) { - $xhprof_data = xhprof_disable(); - $xhprof_runs = new XHProfRuns_Default(); - $xhprof_runs->save_run( $xhprof_data, $method ); - } - - unset( $ud_api[ 'profiling_now' ] ); - - return self::timer_stop( $method ); - - } - - /** - * Attempt to download a remote files attachments - * - * @param bool $images - * @param array $args - * - * @return bool|object - */ - static public function image_fetch( $images = false, $args = array() ) { - - $images = array_filter( (array) $images ); - - //** Image URLs may be passed as string or array, or none at all */ - if( count( $images ) < 1 ) { - return false; - } - - self::timer_start( __METHOD__ ); - - $args = wp_parse_args( $args, array( - 'upload_dir' => false, - 'timeout' => 30, - ) ); - - /** - * Regular Image Download. - */ - foreach( (array) $images as $count => $url ) { - - $url = esc_url_raw( $url ); - - $_image = array( - 'source_url' => $url, - 'error' => false - ); - - //** Set correct filename ( some URLs can have not valid file extensions ) */ - $filename = sanitize_file_name( basename( $url ) ); - $ext = false; - $filetype = wp_check_filetype( $filename ); - if( !$filetype[ 'ext' ] ) { - $file_headers = get_headers( $url, 1 ); - if( strpos( $file_headers[ 0 ], '200 OK' ) ) { - if( isset( $file_headers[ 'Content-Type' ] ) ) { - $file_mime = sanitize_mime_type( $file_headers[ 'Content-Type' ] ); - switch( $file_mime ) { - case "image/gif": - $ext = 'gif'; - break; - case "image/jpeg": - $ext = 'jpg'; - break; - case "image/png": - $ext = 'png'; - break; - case "image/bmp": - $ext = 'bmp'; - break; - } - if( $ext ) { - $filename .= '.' . $ext; - } - } - } - } else { - $ext = $filetype[ 'ext' ]; - } - - $_wp_error_data = array( - 'url' => $url, - 'filename' => $filename, - 'file_type' => $ext, - ); - - //** We MUST NOT allow to upload not-image files */ - if( !$ext || !in_array( $ext, array( 'gif', 'jpg', 'png', 'bmp', 'jpeg' ) ) ) { - $_image[ 'error' ] = new WP_Error( __METHOD__, __( 'Invalid file type.', self::$text_domain ), $_wp_error_data ); - } - - //** Set file path */ - if( !empty( $args[ 'upload_dir' ] ) ) { - - if( wp_mkdir_p( $args[ 'upload_dir' ] ) ) { - $_image[ 'file' ] = trailingslashit( $args[ 'upload_dir' ] ) . wp_unique_filename( $args[ 'upload_dir' ], $filename ); - } else { - $_image[ 'error' ] = new WP_Error( __METHOD__, __( 'Could not create mentioned directory.', self::$text_domain ) ); - } - - } else { - - $wp_upload_bits = wp_upload_bits( $filename, null, '' ); - if( $wp_upload_bits[ 'error' ] ) { - $_image[ 'error' ] = new WP_Error( __METHOD__, $wp_upload_bits[ 'error' ], $wp_upload_bits ); - } - $_image = self::extend( $_image, $wp_upload_bits ); - - } - - if( !is_wp_error( $_image[ 'error' ] ) ) { - - $wp_remote_request = wp_remote_request( $url, array_filter( array( - 'method' => 'GET', - 'timeout' => $args[ 'timeout' ], - 'stream' => true, - 'filename' => $_image[ 'file' ] - ) ) ); - - if( is_wp_error( $wp_remote_request ) ) { - $wp_remote_request->add_data( $_wp_error_data ); - $_image[ 'error' ] = $wp_remote_request; - } else { - - $_image[ 'file' ] = $wp_remote_request[ 'filename' ]; - $_image[ 'filesize' ] = filesize( $_image[ 'file' ] ); - - /* Disabled. Was failing multiple images - if( isset( $wp_remote_request[ 'headers' ][ 'content-length'] ) && $_image[ 'filesize' ] != $wp_remote_request[ 'headers' ][ 'content-length'] ) { - $_image[ 'error' ] = new WP_Error( 'image_fetch', __( 'Remote file has incorrect size', self::$text_domain ), array( - 'headers' => $wp_remote_request[ 'headers' ], - 'image' => $_image - )); - }*/ - - if( 0 == $_image[ 'filesize' ] ) { - $_image[ 'error' ] = new WP_Error( __METHOD__, __( 'Zero size file downloaded', self::$text_domain ) ); - } - - $_image = self::extend( $_image, wp_check_filetype( $_image[ 'file' ] ) ); - - //require_once( ABSPATH . 'wp-admin/includes/image.php' ); - //wp_update_attachment_metadata( $row->attachment_id, wp_generate_attachment_metadata( $row->attachment_id, $upload[ 'file' ] ) ); - } - - } - - if( is_wp_error( $_image[ 'error' ] ) ) { - @unlink( $_image[ 'file' ] ); - } - - $return[ $count ] = (object) array_filter( $_image ); - - } //** End foreach */ - - return (object) array( - 'images' => $return, - 'timer' => self::timer_stop( __METHOD__ ) - ); - - } - - /** - * Checks if images exist and returns images dimensions - * - * @param mixed $images Image url - * @param mixed $args - * - * @return array - * @author peshkov@UD - */ - static public function image_dimensions( $images = false, $args = array() ) { - - $result = array(); - $images = array_filter( (array) $images ); - - //** Image URLs may be passed as string or array, or none at all */ - if( count( $images ) < 1 ) { - return $result; - } - - self::timer_start( __METHOD__ ); - - //** Params below are used only by RIM ( getMultiImageTypeAndSize ) **/ - $args = wp_parse_args( $args, array( - 'max_num_of_threads' => 10, - 'time_limit' => 30, - 'curl_connect_timeout' => 2, - 'curl_timeout' => 3, - ) ); - - //** If PHP 5.3.0, and rim class found, we use it. In other case we use default function getimagesize() */ - if( version_compare( PHP_VERSION, '5.3.0' ) >= 0 && method_exists( 'rim', 'getMultiImageTypeAndSize' ) ) { - $rim = new rim(); - $response = $rim->getMultiImageTypeAndSize( $images, $args ); - if( is_array( $response ) ) { - foreach( $response as $r ) { - $result[ ] = array( - 'width' => isset( $r[ 'image_data' ][ 'width' ] ) ? $r[ 'image_data' ][ 'width' ] : 0, - 'height' => isset( $r[ 'image_data' ][ 'height' ] ) ? $r[ 'image_data' ][ 'height' ] : 0, - 'url' => isset( $r[ 'url' ] ) ? $r[ 'url' ] : false, - 'error' => !empty( $r[ 'error' ] ) ? new WP_Error( 'image_fetch', __( 'Could not get image dimensions (headers)', 'wpp' ), $r[ 'error' ] ) : false - ); - } - } - } else { - $result = array(); - foreach( $images as $image ) { - $r = @getimagesize( $image ); - $result[ ] = array( - 'width' => isset( $r[ 0 ] ) ? $r[ 0 ] : 0, - 'height' => isset( $r[ 1 ] ) ? $r[ 1 ] : 0, - 'url' => $image, - 'error' => empty( $r ) ? new WP_Error( 'image_fetch', __( 'Could not get image dimensions (headers)', 'wpp' ) ) : false - ); - } - - } - - return $result; - } - - /** - * Converts slashes for Windows paths. - * - * @since 1.0.0.0 - * @source Flawless - * @author potanin@UD - */ - static public function fix_path( $path ) { - return str_replace( '\\', '/', $path ); - } - - /** - * Applies trim() function to all values in an array - * - * @source WP-Property - * @since 0.6.0 - */ - static public function trim_array( $array = array() ) { - - foreach( (array) $array as $key => $value ) { - - if( is_object( $value ) ) { - continue; - } - - $array[ $key ] = is_array( $value ) ? self::trim_array( $value ) : trim( $value ); - } - - return $array; - - } - - /** - * Returns all available image sizes - * - * @method all_image_sizes - * @for Utility - * - * @param $size {String} - * - * @returns array keys: 'width' and 'height' - */ - static public function all_image_sizes( $size = '' ) { - global $_wp_additional_image_sizes; - - $image_sizes = (array) $_wp_additional_image_sizes; - - $image_sizes[ 'thumbnail' ] = array( - 'width' => intval( get_option( 'thumbnail_size_w' ) ), - 'height' => intval( get_option( 'thumbnail_size_h' ) ) - ); - - $image_sizes[ 'medium' ] = array( - 'width' => intval( get_option( 'medium_size_w' ) ), - 'height' => intval( get_option( 'medium_size_h' ) ) - ); - - $image_sizes[ 'large' ] = array( - 'width' => intval( get_option( 'large_size_w' ) ), - 'height' => intval( get_option( 'large_size_h' ) ) - ); - - foreach( (array) $image_sizes as $_size => $data ) { - $image_sizes[ $_size ] = array_filter( (array) $data ); - $image_sizes[ $_size ][ 'label' ] = self::de_slug( $_size ); - $image_sizes[ $_size ][ 'crop' ] = isset( $image_sizes[ $_size ][ 'crop' ] ) && $image_sizes[ $_size ][ 'crop' ] ? $image_sizes[ $_size ][ 'crop' ] : false; - } - - if( $size ) { - return array_filter( (array) $image_sizes[ $size ] ); - } - - return array_filter( (array) $image_sizes ); - - } - - /** - * Retrieves the attachment ID from the file URL ( guid ) - * - * @global object $wpdb - * - * @param string $guid - * - * @return string - * @author peshkovUD - */ - static public function get_image_id_by_guid( $guid ) { - global $wpdb; - $attachment = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM {$wpdb->prefix}posts WHERE guid='%s';", $guid ) ); - - return !empty( $attachment[ 0 ] ) ? $attachment[ 0 ] : false; - } - - /** - * Returns Image link (url) - * - * If image with the current size doesn't exist, we try to generate it. - * If image cannot be resized, the URL to the main image (original) is returned. - * - * @todo Add something to check if requested image size is bigger than the original, in which case cannot be "resized" - * @todo Add a check to see if the specified image dimensions have changed. Right now only checks if slug exists, not the actualy size. - * - * @param bool $attachment_id - * @param bool $size - * @param array $args - * - * @return array|bool|mixed - */ - static public function get_image_link( $attachment_id = false, $size = false, $args = array() ) { - global $wp_properties; - - if( !$size || !$attachment_id ) { - return false; - } - - $image_sizes = self::all_image_sizes( $size ); - - $args = wp_parse_args( $args, array( - 'cache_id' => sanitize_title( $attachment_id . $size ), - 'return' => 'string', - 'default' => '', - 'cache_group' => 'ud_api' - ) ); - - //** Added 'return' arg to avoid cache problems odokienko@UD */ - $args[ 'cache_id' ] .= $args[ 'return' ]; - - if( $return = wp_cache_get( $args[ 'cache_id' ], $args[ 'cache_group' ] ) ) { - return $return; - } - - $attachment_image_src = ( array ) wp_get_attachment_image_src( $attachment_id, $size ); - - //** If wp_get_attachment_image_src() returned the information we need, we return it */ - if( empty( $image_sizes ) || ( is_array( $attachment_image_src ) && $attachment_image_src[ 1 ] == $image_sizes[ $size ][ 'width' ] ) ) { - - $return = $args[ 'return' ] == 'string' ? $attachment_image_src[ 0 ] : array( - 'url' => $attachment_image_src[ 0 ], - 'link' => $attachment_image_src[ 0 ], - 'width' => $attachment_image_src[ 1 ], - 'height' => $attachment_image_src[ 2 ], - 'crop' => $attachment_image_src[ 3 ] - ); - - wp_cache_set( $args[ 'cache_id' ], $return, $args[ 'cache_group' ] ); - - return $return; - } - - //** If we are this far, that means that the returned image, if any, was not the right size, so we regenreate */ - $image_resize = image_resize( get_attached_file( $attachment_id, true ), $image_sizes[ $size ][ 'width' ], $image_sizes[ $size ][ 'height' ], $image_sizes[ $size ][ 'crop' ] ); - - if( is_wp_error( $image_resize ) || !file_exists( $image_resize ) ) { - - if( $attachment_image_src[ 0 ] ) { - $return = $args[ 'default' ] ? $args[ 'default' ] : $attachment_image_src[ 0 ]; - } else { - $return = $args[ 'default' ]; - } - - } - - //** If image was resized, we update metadata, cache our result, and return */ - require_once( ABSPATH . 'wp-admin/includes/image.php' ); - - if( function_exists( 'wp_update_attachment_metadata' ) ) { - wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, get_attached_file( $attachment_id, true ) ) ); - } - - $attachment_image_src = (array) wp_get_attachment_image_src( $attachment_id, $size ); - - $return = $args[ 'return' ] == 'string' ? $attachment_image_src[ 0 ] : array( - 'url' => $attachment_image_src[ 0 ], - 'link' => $attachment_image_src[ 0 ], - 'width' => $attachment_image_src[ 1 ], - 'height' => $attachment_image_src[ 2 ], - 'crop' => $attachment_image_src[ 3 ] - ); - - wp_cache_set( $args[ 'cache_id' ], $return, $args[ 'cache_group' ] ); - - return $return; - - } - - /** - * Returns Image link (url) with custom size. - * Almost the same as get_image_link, but the current function can generate images with custom sizes. - * It generates image with custom size only once. - * - * @global $wpdb - * - * @param type $atts - * - * @return string - * @author peshkov@UD - * @since 0.2.5 - */ - static function get_image_link_with_custom_size( $attachment_id, $width, $height, $crop = false ) { - global $wpdb; - - // Sanitize - $height = absint( $height ); - $width = absint( $width ); - $needs_resize = true; - - // Look through the attachment meta data for an image that fits our size. - $meta = wp_get_attachment_metadata( $attachment_id ); - $upload_dir = wp_upload_dir(); - $base_url = strtolower( $upload_dir[ 'baseurl' ] ); - $src = trailingslashit( $base_url ) . $meta[ 'file' ]; - foreach( $meta[ 'sizes' ] as $key => $size ) { - if( ( $size[ 'width' ] == $width && $size[ 'height' ] == $height ) || $key == sprintf( 'resized-%dx%d', $width, $height ) ) { - if( !empty( $size[ 'file' ] ) ) { - $src = str_replace( basename( $src ), $size[ 'file' ], $src ); - } - $needs_resize = false; - break; - } - } - - // If an image of such size was not found, we can create one. - if( $needs_resize ) { - $attached_file = get_attached_file( $attachment_id ); - $resized = image_make_intermediate_size( $attached_file, $width, $height, $crop ); - if( is_wp_error( $resized ) ) { - return $resized; - } - - // Let metadata know about our new size. - $key = sprintf( 'resized-%dx%d', $width, $height ); - $meta[ 'sizes' ][ $key ] = $resized; - if( !empty( $resized[ 'file' ] ) ) { - $src = str_replace( basename( $src ), $resized[ 'file' ], $src ); - } - wp_update_attachment_metadata( $attachment_id, $meta ); - - // Record in backup sizes so everything's cleaned up when attachment is deleted. - $backup_sizes = get_post_meta( $attachment_id, '_wp_attachment_backup_sizes', true ); - if( !is_array( $backup_sizes ) ) $backup_sizes = array(); - $backup_sizes[ $key ] = $resized; - update_post_meta( $attachment_id, '_wp_attachment_backup_sizes', $backup_sizes ); - - } - - return array( - 'url' => esc_url( $src ), - 'width' => absint( $width ), - 'height' => absint( $height ), - ); - } - - /** - * Insert array into an associative array before a specific key - * - * @source http://stackoverflow.com/questions/6501845/php-need-help-inserting-arrays-into-associative-arrays-at-given-keys - * @author potanin@UD - */ - static public function array_insert_before( $array, $key, $new ) { - $array = (array) $array; - $keys = array_keys( $array ); - $pos = (int) array_search( $key, $keys ); - - return array_merge( - array_slice( $array, 0, $pos ), - $new, - array_slice( $array, $pos ) - ); - } - - /** - * Insert array into an associative array after a specific key - * - * @source http://stackoverflow.com/questions/6501845/php-need-help-inserting-arrays-into-associative-arrays-at-given-keys - * @author potanin@UD - */ - static public function array_insert_after( $array, $key, $new ) { - $array = (array) $array; - $keys = array_keys( $array ); - $pos = (int) array_search( $key, $keys ) + 1; - - return array_merge( - array_slice( $array, 0, $pos ), - $new, - array_slice( $array, $pos ) - ); - } - - /** - * Attemp to convert a plural US word into a singular. - * - * @todo API Service Candidate since we ideally need a dictionary reference. - * @author potanin@UD - */ - static public function depluralize( $word ) { - $rules = array( 'ss' => false, 'os' => 'o', 'ies' => 'y', 'xes' => 'x', 'oes' => 'o', 'ies' => 'y', 'ves' => 'f', 's' => '' ); - - foreach( array_keys( $rules ) as $key ) { - - if( substr( $word, ( strlen( $key ) * -1 ) ) != $key ) - continue; - - if( $key === false ) - return $word; - - return substr( $word, 0, strlen( $word ) - strlen( $key ) ) . $rules[ $key ]; - - } - - return $word; - - } - - /** - * Convert bytes into the logical unit of measure based on size. - * - * @source Flawless - * @since 1.0.0.0 - * @author potanin@UD - */ - static public function format_bytes( $bytes, $precision = 2 ) { - _deprecated_function( __FUNCTION__, '2.3.0', 'size_format()' ); - - return size_format( $bytes, $precision ); - } - - /** - * Used to enable/disable/print SQL log - * - * Usage: - * self::sql_log( 'enable' ); - * self::sql_log( 'disable' ); - * $queries= self::sql_log( 'print_log' ); - * - * @since 0.1.0 - */ - static public function sql_log( $action = 'attach_filter' ) { - global $wpdb; - - if( !in_array( $action, array( 'enable', 'disable', 'print_log' ) ) ) { - $wpdb->ud_queries[ ] = array( $action, $wpdb->timer_stop(), $wpdb->get_caller() ); - - return $action; - } - - if( $action == 'enable' ) { - add_filter( 'query', array( __CLASS__, 'sql_log' ), 75 ); - } - - if( $action == 'disable' ) { - remove_filter( 'query', array( __CLASS__, 'sql_log' ), 75 ); - } - - if( $action == 'print_log' ) { - $result = array(); - foreach( (array) $wpdb->ud_queries as $query ) { - $result[ ] = $query[ 0 ] ? $query[ 0 ] . ' (' . $query[ 1 ] . ')' : $query[ 2 ]; - } - - return $result; - } - - } - - /** - * Return data for UD Log - * - * @updated 1.04 - * @sincde 1.03 - * @note This is a proof of concept, in future it should be able to support AJAX calls so can be displayed via Dynamic Filter. - * @author potanin@UD - */ - static public function log( $message = '', $args = array() ) { - global $wpdb; - - //** Prevents MySQL Gone Away. @todo Should check if connection exists before automatically connecting. */ - //$wpdb->db_connect(); - - //** Create Log if it does not exist */ - if( !$wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->prefix}ud_log';" ) ) { - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); - dbDelta( "CREATE TABLE {$wpdb->prefix}ud_log ( - id mediumint(9) NOT NULL AUTO_INCREMENT, - post_id mediumint(9) DEFAULT NULL COMMENT 'ID of related post.', - product VARCHAR(100) DEFAULT '' NOT NULL COMMENT 'Slug of related product.', - feature VARCHAR(100) DEFAULT '' NOT NULL COMMENT 'Slug of specific feature, if applicable.', - message text NOT NULL COMMENT 'Long description of log entry.', - type VARCHAR(100) DEFAULT '' NOT NULL COMMENT 'Type of variable stored in message. May be concatentaetd with other data for additional information.', - action VARCHAR(128) DEFAULT '' NOT NULL COMMENT 'If applicable, a slug for a specific action that triggered the entry.', - method VARCHAR(128) DEFAULT '' NOT NULL COMMENT 'If applicable, PHP method that triggered log entry.', - time int(11) NOT NULL, - UNIQUE KEY id (id), - KEY post_id (post_id), - KEY type (type) - );" ); - } - - $args = array_filter( (array) shortcode_atts( array( - 'post_id' => null, - 'type' => gettype( $message ), - 'message' => maybe_serialize( $message ), - 'product' => null, - 'feature' => null, - 'action' => null, - 'method' => null, - 'time' => time() - ), $args ) ); - - //** Only the keys below may be updated via $args */ - $wpdb->insert( $wpdb->prefix . 'ud_log', $args ); - - return $wpdb->insert_id ? $message : false; - } - - /** - * Return data for UD Log - * - * @note This is a proof of concept, in future it should be able to support AJAX calls so can be displayed via Dynamic Filter. - * @author potanin@UD - */ - static public function get_log( $args = false ) { - global $wpdb; - - $args = wp_parse_args( $args, array( - 'offset' => 0, - 'limit' => 100, - 'last_id' => false, - 'sort_type' => 'ASC', - 'direction' => 'greater', - 'product' => '', - 'post_id' => false, - ) ); - - $where = array(); - if( $args[ 'last_id' ] && $args[ 'last_id' ] > 1 ) { - $direction = ''; - switch( $args[ 'direction' ] ) { - case 'greater': - $direction = '>'; - break; - case 'less': - $direction = '<'; - break; - } - if( !empty( $direction ) ) { - $where[ ] = " l.id {$direction} {$args['last_id']} "; - } - } - - foreach( $args as $k => $v ) { - if( in_array( $k, array( 'product', 'post_id' ) ) && !empty( $v ) ) { - if( is_array( $v ) ) { - $where[ ] = " l.{$k} IN ( '" . implode( "','", $v ) . "' ) "; - } else { - $where[ ] = " l.{$k} = '{$v}' "; - } - } - } - - if( !empty( $where ) ) { - $where = " WHERE " . implode( " AND ", $where ) . " "; - } else { - $where = ''; - } - - $response = $wpdb->get_results( " - SELECT l.*, p.post_title - FROM {$wpdb->prefix}ud_log l - LEFT JOIN {$wpdb->posts} p ON l.post_id = p.ID - {$where} - ORDER BY l.id {$args['sort_type']} - LIMIT {$args['offset']}, {$args['limit']}; - " ); - - //die( '
        ' . print_r( $wpdb->last_query ,true) . '
        ' ); - - return $response; - - } - - /** - * Removes data from Logs table - * - * @param mixed $args - * - * @author peshkov@UD - */ - static public function clear_log( $args = array() ) { - global $wpdb; - - $args = array_filter( self::prepare_to_sql( wp_parse_args( $args, array( - 'id' => false, - 'product' => false, - 'feature' => false, - 'product_id' => false, - 'type' => false, - 'action' => false, - ) ) ) ); - - $where = ""; - foreach( $args as $k => $v ) { - $where .= empty( $where ) ? " WHERE " : " AND "; - $where .= " {$k} = '{$v}' "; - } - - return $wpdb->query( "DELETE FROM {$wpdb->prefix}ud_log {$where}" ); - } - - /** - * Add an entry to the plugin-specifig log. - * - * Creates log if one does not exist. - * - * - * UD\Utility::log( "Settings updated." ); - * - * - * @depreciated peshkov@UD - */ - static public function _log( $message = false, $args = array() ) { - - $args = wp_parse_args( $args, array( - 'type' => 'default', - 'object' => false, - 'prefix' => 'ud', - ) ); - - extract( $args ); - - $log = "{$prefix}_log"; - - if( !did_action( 'init' ) ) { - _doing_it_wrong( __FUNCTION__, sprintf( __( 'You cannot call UD\Utility::log() before the %1$s hook, since the current user is not yet known.' ), 'init' ), '3.4' ); - } - - $current_user = wp_get_current_user(); - - $this_log = get_option( $log ); - - if( empty( $this_log ) ) { - - $this_log = array(); - - $entry = array( - 'time' => time(), - 'message' => __( 'Log Started.', self::$text_domain ), - 'user' => $current_user->ID, - 'type' => $type - ); - - } - - if( $message ) { - - $entry = array( - 'time' => time(), - 'message' => $message, - 'user' => $type == 'system' ? 'system' : $current_user->ID, - 'type' => $type, - 'object' => $object - ); - - } - - if( !is_array( $entry ) ) { - return false; - } - - array_push( $this_log, $entry ); - - $this_log = array_filter( $this_log ); - - update_option( $log, $this_log ); - - return true; - - } - - /** - * Helpder function for figuring out if another specific function is a predecesor of current function. - * - * @since 1.0.0.0 - * @author potanin@UD - */ - static public function _backtrace_function( $function = false ) { - - foreach( debug_backtrace() as $step ) { - if( $function && $step[ 'function' ] == $function ) { - return true; - } - } - - } - - /** - * Helpder function for figuring out if a specific file is a predecesor of current file. - * - * @since 1.0.0.0 - * @author potanin@UD - */ - static public function _backtrace_file( $file = false ) { - - foreach( debug_backtrace() as $step ) { - if( $file && basename( $step[ 'file' ] ) == $file ) { - return true; - } - } - - } - - /** - * Fixed serialized arrays which sometimes get messed up in WordPress - * - * @source http://shauninman.com/archive/2008/01/08/recovering_truncated_php_serialized_arrays - */ - static public function repair_serialized_array( $serialized ) { - $tmp = preg_replace( '/^a:\d+:\{/', '', $serialized ); - - return self::repair_serialized_array_callback( $tmp ); // operates on and whittles down the actual argument - } - - /** - * The recursive function that does all of the heavy lifing. Do not call directly. - - - */ - static public function repair_serialized_array_callback( &$broken ) { - - $data = array(); - $index = null; - $len = strlen( $broken ); - $i = 0; - - while( strlen( $broken ) ) { - $i++; - if( $i > $len ) { - break; - } - - if( substr( $broken, 0, 1 ) == '}' ) // end of array - { - $broken = substr( $broken, 1 ); - - return $data; - } else { - $bite = substr( $broken, 0, 2 ); - switch( $bite ) { - case 's:': // key or value - $re = '/^s:\d+:"([^\"]*)";/'; - if( preg_match( $re, $broken, $m ) ) { - if( $index === null ) { - $index = $m[ 1 ]; - } else { - $data[ $index ] = $m[ 1 ]; - $index = null; - } - $broken = preg_replace( $re, '', $broken ); - } - break; - - case 'i:': // key or value - $re = '/^i:(\d+);/'; - if( preg_match( $re, $broken, $m ) ) { - if( $index === null ) { - $index = (int) $m[ 1 ]; - } else { - $data[ $index ] = (int) $m[ 1 ]; - $index = null; - } - $broken = preg_replace( $re, '', $broken ); - } - break; - - case 'b:': // value only - $re = '/^b:[01];/'; - if( preg_match( $re, $broken, $m ) ) { - $data[ $index ] = (bool) $m[ 1 ]; - $index = null; - $broken = preg_replace( $re, '', $broken ); - } - break; - - case 'a:': // value only - $re = '/^a:\d+:\{/'; - if( preg_match( $re, $broken, $m ) ) { - $broken = preg_replace( '/^a:\d+:\{/', '', $broken ); - $data[ $index ] = self::repair_serialized_array_callback( $broken ); - $index = null; - } - break; - - case 'N;': // value only - $broken = substr( $broken, 2 ); - $data[ $index ] = null; - $index = null; - break; - } - } - } - - return $data; - } - - /** - * Determine if an item is in array and return checked - * - * @since 0.5.0 - */ - static public function checked_in_array( $item, $array ) { - - if( is_array( $array ) && in_array( $item, $array ) ) { - echo ' checked="checked" '; - } - - } - - /** - * Check if the current WP version is older then given parameter $version. - * - * @param string $version - * - * @return bool - * @since 1.0.0.0 - * @author peshkov@UD - */ - static public function is_older_wp_version( $version = '' ) { - if( empty( $version ) || (float) $version == 0 ) return false; - $current_version = get_bloginfo( 'version' ); - /** Clear version numbers */ - $current_version = preg_replace( "/^([0-9\.]+)-(.)+$/", "$1", $current_version ); - $version = preg_replace( "/^([0-9\.]+)-(.)+$/", "$1", $version ); - - return ( (float) $current_version < (float) $version ) ? true : false; - } - - /** - * Determine if any requested template exists and return path to it. - * - * == Usage == - * The function will search through: STYLESHEETPATH, TEMPLATEPATH, and any custom paths you pass as second argument. - * - * $best_template = UD\Utility::get_template_part( array( - * 'template-ideal-match', - * 'template-default', - * ), array( PATH_TO_MY_TEMPLATES ); - * - * Note: load_template() extracts $wp_query->query_vars into the loaded template, so to add any global variables to the template, add them to - * $wp_query->query_vars prior to calling this function. - * - * @param mixed $name List of requested templates. Will be return the first found - * @param array $path [optional]. Method tries to find template in theme, but also it can be found in given list of pathes. - * @param array $opts [optional]. Set of additional params: - * - string $instance. Template can depend on instance. For example: facebook, PDF, etc. Uses filter: ud::template_part::{instance} - * - boolean $load. if true, rendered HTML will be returned, in other case, only found template's path. - * @load boolean [optional]. If true and a template is found, the template will be loaded via load_template() and returned as a string - * @author peshkov@UD - * @version 1.1 - */ - static public function get_template_part( $name, $path = array(), $opts = array() ) { - $name = (array)$name; - $template = ""; - - /** - * Set default instance. - * Template can depend on instance. For example: facebook, PDF, etc. - */ - $instance = apply_filters( "ud::current_instance", "default" ); - - $opts = wp_parse_args( $opts, array( - 'instance' => $instance, - 'load' => false, - ) ); - - //** Allows to add/change templates storage directory. */ - $path = apply_filters( "ud::template_part::path", $path, $name, $opts ); - - foreach ( $name as $n ) { - $n = "{$n}.php"; - $template = locate_template( $n, false ); - if ( empty( $template ) && !empty( $path ) ) { - foreach ( (array)$path as $p ) { - if ( file_exists( $p . "/" . $n ) ) { - $template = $p . "/" . $n; - break( 2 ); - } - } - } - if ( !empty( $template ) ) break; - } - - $template = apply_filters( "ud::template_part::{$opts['instance']}", $template, array( 'name' => $name, 'path' => $path, 'opts' => $opts ) ); - - //** If match and load was requested, get template and return */ - if( !empty( $template ) && $opts[ 'load' ] == true ) { - ob_start(); - load_template( $template, false ); - return ob_get_clean(); - } - - return !empty( $template ) ? $template : false; - - } - - /** - * The goal of function is going through specific filters and return (or print) classes. - * This function should not be called directly. - * Every ud plugin/theme should have own short function ( wrapper ) for calling it. E.g., see: wpp_css(). - * So, use it in template as:
        ">
        - * - * Arguments: - * - instance [string] - UD plugin|theme's slug. E.g.: wpp, denali, wpi, etc - * - element [string] - specific element in template which will use the current classes. - * Element should be called as {template}::{specific_name_of_element}. Where {template} is name of template, - * where current classes will be used. This standart is optional. You can set any element's name if you want. - * - classes [array] - set of classes which will be used for element. - * - return [boolean] - If false, the function prints all classes like 'class1 class2 class3' - * - * @param array $args - * - * @return string - * @author peshkov@UD - * @version 0.1 - */ - static public function get_css_classes( $args = array() ) { - - //** Set arguments */ - $args = wp_parse_args( (array) $args, array( - 'classes' => array(), - 'instance' => '', - 'element' => '', - 'return' => false, - ) ); - - extract( $args ); - - //** Cast (set correct types) to avoid issues */ - if( !is_array( $classes ) ) { - $classes = trim( $classes ); - $classes = str_replace( ',', ' ', $classes ); - $classes = explode( ' ', $classes ); - } - - foreach( $classes as &$c ) { - $c = trim( $c ); - } - - $instance = (string) $instance; - $element = (string) $element; - - //** Now go through the filters */ - $classes = apply_filters( "$instance::css::$element", $classes, $args ); - - if( !$return ) { - echo implode( " ", (array) $classes ); - } - - return implode( " ", (array) $classes ); - - } - - /** - * Return simple array of column tables in a table - * - * @version 0.6 - */ - static public function get_column_names( $table ) { - - global $wpdb; - - $table_info = $wpdb->get_results( "SHOW COLUMNS FROM $table" ); - - if( empty( $table_info ) ) { - return array(); - } - - foreach( (array) $table_info as $row ) { - $columns[ ] = $row->Field; - } - - return $columns; - - } - - /** - * Port of jQuery.extend() function. - * - * @since 1.0.3 - */ - static public function extend() { - - $arrays = func_get_args(); - $base = array_shift( $arrays ); - if( !is_array( $base ) ) $base = empty( $base ) ? array() : array( $base ); - foreach( (array) $arrays as $append ) { - if( !is_array( $append ) ) $append = array( $append ); - foreach( (array) $append as $key => $value ) { - if( !array_key_exists( $key, $base ) and !is_numeric( $key ) ) { - $base[ $key ] = $append[ $key ]; - continue; - } - if( ( isset( $value ) && @is_array( $value ) ) || ( isset( $base[ $key ] ) && @is_array( $base[ $key ] ) ) ) { - - // extend if exists, otherwise create. - if( isset( $base[ $key ] ) ) { - $base[ $key ] = self::extend( $base[ $key ], $append[ $key ] ); - } else { - $base[ $key ] = $append[ $key ]; - } - - } else if( is_numeric( $key ) ) { - if( !in_array( $value, $base ) ) $base[ ] = $value; - } else { - $base[ $key ] = $value; - } - } - } - - return $base; - } - - /** - * Returns a URL to a post object based on passed variable. - * - * If its a number, then assumes its the id, If it resembles a slug, then get the first slug match. - * - * @since 1.0.0 - * - * @param bool|string $title A page title, although ID integer can be passed as well - * - * @return string The page's URL if found, otherwise the general blog URL - */ - static public function post_link( $title = false ) { - - global $wpdb; - - if( !$title ) return get_bloginfo( 'url' ); - - if( is_numeric( $title ) ) return get_permalink( $title ); - - if( $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE post_name = %s AND post_status='publish'", $title ) ) ) return get_permalink( $id ); - - if( $id = $wpdb->get_var( $wpdb->prepare( "SELECT ID FROM {$wpdb->posts} WHERE LOWER(post_title) = %s AND post_status='publish'", strtolower( $title ) ) ) ) return get_permalink( $id ); - - } - - /** - * Used to get the current plugin's log created via UD class - * - * If no log exists, it creates one, and then returns it in chronological order. - * - * Example to view log: - * - * print_r( self::get_log() ); - * - * - * $param string Event description - * - * @depreciated peshkov@UD - * @uses get_option() - * @uses update_option() - * @return array Using the get_option function returns the contents of the log. - * - * @param bool $args - * - * @return array Using the get_option function returns the contents of the log. - */ - static public function _get_log( $args = false ) { - - $args = wp_parse_args( $args, array( - 'limit' => 20, - 'prefix' => 'ud' - ) ); - - extract( $args ); - - $this_log = get_option( $prefix . '_log' ); - - if( empty( $this_log ) ) { - $this_log = self::log( false, array( 'prefix' => $prefix ) ); - } - - $entries = (array) get_option( $prefix . '_log' ); - - $entries = array_reverse( $entries ); - - $entries = array_slice( $entries, 0, $args[ 'args' ] ? $args[ 'args' ] : $args[ 'limit' ] ); - - return $entries; - - } - - /** - * Delete UD log for this plugin. - * - * @uses update_option() - */ - static public function delete_log( $args = array() ) { - - $args = wp_parse_args( $args, array( - 'prefix' => 'ud' - ) ); - - extract( $args ); - - $log = "{$prefix}_log"; - - delete_option( $log ); - } - - /** - * Creates Admin Menu page for UD Log - * - * @todo Need to make sure this will work if multiple plugins utilize the UD classes - * @see function show_log_page - * @since 1.0.0 - * @uses add_action() Calls 'admin_menu' hook with an anonymous ( lambda-style ) function which uses add_menu_page to create a UI Log page - */ - static public function add_log_page() { - if( did_action( 'admin_menu' ) ) { - _doing_it_wrong( __FUNCTION__, sprintf( __( 'You cannot call UD\Utility::add_log_page() after the %1$s hook.' ), 'init' ), '3.4' ); - - return false; - } - add_action( 'admin_menu', function() { - add_menu_page( __( 'Log', UD_API_Transdomain ), __( 'Log', UD_API_Transdomain ), current_user_can( 'manage_options' ), 'ud_log', array( 'UD_API', 'show_log_page' ) ); - }); - } - - /** - * Displays the UD UI log page. - * - * @todo Add button or link to delete log - * @todo Add nonce to clear_log functions - * @todo Should be refactored to implement adding LOG tabs for different instances (wpp, wpi, wp-crm). peshkov@UD - * - * @since 1.0.0.0 - */ - static public function show_log_page() { - - if( $_REQUEST[ 'ud_action' ] == 'clear_log' ) { - self::delete_log(); - } - - $output = array(); - - $output[ ] = ''; - - $output[ ] = '
        '; - $output[ ] = '

        ' . __( 'Log Page for', self::$text_domain ) . ' ud_log '; - $output[ ] = '' . __( 'Clear Log', self::$text_domain ) . '

        '; - - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - - $output[ ] = ''; - - foreach( (array) self::_get_log() as $event ) { - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - $output[ ] = ''; - } - - $output[ ] = '
        ' . __( 'Timestamp', self::$text_domain ) . '' . __( 'Type', self::$text_domain ) . '' . __( 'Event', self::$text_domain ) . '' . __( 'User', self::$text_domain ) . '' . __( 'Related Object', self::$text_domain ) . '
        ' . self::nice_time( $event[ 'time' ] ) . '' . $event[ 'type' ] . '' . $event[ 'message' ] . '' . ( is_numeric( $event[ 'user' ] ) ? get_userdata( $event[ 'user' ] )->display_name : __( 'None' ) ) . '' . $event[ 'object' ] . '
        '; - - $output[ ] = '
        '; - - echo implode( '', (array) $output ); - - } - - /** - * Replace in $str all entries of keys of the given $values - * where each key will be rounded by $brackets['left'] and $brackets['right'] - * with the relevant values of the $values - * - * @param string|array $str - * @param array $values - * @param array $brackets - * - * @return string|array - * @author odokienko@UD - */ - static public function replace_data( $str = '', $values = array(), $brackets = array( 'left' => '[', 'right' => ']' ) ) { - $values = (array) $values; - $replacements = array_keys( $values ); - array_walk( $replacements, function(&$val) use ($brackets){ - $val = $brackets[ 'left' ] . $val . $brackets[ 'right' ]; - } ); - - return str_replace( $replacements, array_values( $values ), $str ); - } - - /** - * Wrapper function to send notification with WP-CRM or without one - * - * @param array|mixed $args ['message'] using in email notification - * - * @uses self::replace_data() - * @uses wp_crm_send_notification() - * @return boolean false if notification was not sent successfully - * @autor odokienko@UD - */ - static public function send_notification( $args = array() ) { - - $args = wp_parse_args( $args, array( - 'ignore_wp_crm' => false, - 'user' => false, - 'trigger_action' => false, - 'data' => array(), - 'message' => '', - 'subject' => '', - 'crm_log_message' => '' - ) ); - - if( is_numeric( $args[ 'user' ] ) ) { - $args[ 'user' ] = get_user_by( 'id', $args[ 'user' ] ); - } elseif( filter_var( $args[ 'user' ], FILTER_VALIDATE_EMAIL ) ) { - $args[ 'user' ] = get_user_by( 'email', $args[ 'user' ] ); - } elseif( is_string( $args[ 'user' ] ) ) { - $args[ 'user' ] = get_user_by( 'login', $args[ 'user' ] ); - } - - if( !is_object( $args[ 'user' ] ) || empty( $args[ 'user' ]->data->user_email ) ) { - return false; - } - - if( function_exists( 'wp_crm_send_notification' ) && - empty( $args[ 'ignore_wp_crm' ] ) - ) { - - if( !empty( $args[ 'crm_log_message' ] ) ) { - wp_crm_add_to_user_log( $args[ 'user' ]->ID, self::replace_data( $args[ 'crm_log_message' ], $args[ 'data' ] ) ); - } - - if ( !empty( $args[ 'trigger_action' ] ) && is_callable( 'WP_CRM_N', 'get_trigger_action_notification' ) ) { - $notifications = \WP_CRM_N::get_trigger_action_notification( $args[ 'trigger_action' ] ); - if ( !empty( $notifications ) ) { - return wp_crm_send_notification( $args[ 'trigger_action' ], $args[ 'data' ] ); - } - } - - } - - if( empty( $args[ 'message' ] ) ) { - return false; - } - - return wp_mail( $args[ 'user' ]->data->user_email, self::replace_data( $args[ 'subject' ], $args[ 'data' ] ), self::replace_data( $args[ 'message' ], $args[ 'data' ] ) ); - - } - - /** - * Turns a passed string into a URL slug - * - * @param bool|string $content - * @param bool|string $args Optional list of arguments to overwrite the defaults. - * - * @author potanin@UD - * @version 1.1.0 - * @since 1.0.0 - * @return string - */ - static public function create_slug( $content = null, $args = false ) { - - if( !$content ) { - return null; - } - - $args = wp_parse_args( $args, array( - 'separator' => '-' - ) ); - - $content = preg_replace( '~[^\\pL0-9_]+~u', $args[ 'separator' ], $content ); // substitutes anything but letters, numbers and '_' with separator - $content = trim( $content, $args[ 'separator' ] ); - $content = iconv( "utf-8", "us-ascii//TRANSLIT", $content ); // TRANSLIT does the whole job - $content = strtolower( $content ); - - // Removed the following logic because it was removing custom separators such as ":". - potanin@UD | October 17, 2013 - // return preg_replace( '~[^-a-z0-9_]+~', '', $content ); // keep only letters, numbers, '_' and separator - - return $content; - - } - - /** - * Convert a slug to a more readable string - * - * @since 1.3 - * - * @param $string - * - * @return string - */ - static public function de_slug( $string ) { - return ucwords( str_replace( "_", " ", $string ) ); - } - - /** - * Returns current url - * - * @param mixed $args GET args which should be added to url - * @param mixed $except_args GET args which will be removed from URL if they exist - * - * @return string - * @author peshkov@UD - */ - static public function current_url( $args = array(), $except_args = array() ) { - $url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ]; - - $args = wp_parse_args( $args ); - $except_args = wp_parse_args( $except_args ); - - if( !empty( $args ) ) { - foreach( (array) $args as $k => $v ) { - if( is_string( $v ) ) $url = add_query_arg( $k, $v, $url ); - } - } - - if( !empty( $except_args ) ) { - foreach( (array) $except_args as $arg ) { - if( is_string( $arg ) ) $url = remove_query_arg( $arg, $url ); - } - } - - return $url; - } - - /** - * Prepares data for SQL query. - * - * i.e. It should be used when $pwdb->prepare cannot be used. - * For example: - * we have situation when SQL query could not be prepared by default $wpdb->prepare: - * $titles = array( "John's appartment", " '; DELETE FROM $wpdb->posts;# " ); - * $wpdb->query( "SELECT ID FROM $wpdb->posts WHERE post_title IN ( '" . implode ("','", UD_Utility::prepare_to_sql( $titles ) ) . "' ) " ); - * - * @global type $wpdb - * - * @param mixed $args data which should be prepared for SQL query - * - * @return mixed prepared data - * @author peshkov@UD - */ - static public function prepare_to_sql( $args ) { - global $wpdb; - - $prepared = $args; - if( is_array( $prepared ) ) { - foreach( $prepared as $k => $v ) { - if( is_string( $v ) ) { - $prepared[ $k ] = $wpdb->_real_escape( $v ); - } else if( is_array( $v ) ) { - $prepared[ $k ] = self::prepare_to_sql( $v ); - } - } - } else if( is_string( $prepared ) ) { - $prepared = $wpdb->_real_escape( $prepared ); - } - - return $prepared; - } - - /** - * Returns date and/or time using the WordPress date or time format, as configured. - * - * @param bool|string $time Date or time to use for calculation. - * @param bool|string $args List of arguments to overwrite the defaults. - * - * @uses wp_parse_args() - * @uses get_option() - * @return string|bool Returns formatted date or time, or false if no time passed. - * @updated 3.0 - */ - static public function nice_time( $time = false, $args = false ) { - - $args = wp_parse_args( $args, array( - 'format' => 'date_and_time' - ) ); - - if( !$time ) { - return false; - } - - if( $args[ 'format' ] == 'date' ) { - return date( get_option( 'date_format' ), $time ); - } - - if( $args[ 'format' ] == 'time' ) { - return date( get_option( 'time_format' ), $time ); - } - - if( $args[ 'format' ] == 'date_and_time' ) { - return date( get_option( 'date_format' ), $time ) . ' ' . date( get_option( 'time_format' ), $time ); - } - - return false; - - } - - /** - * This function is for the encryption of data - * - * @source http://stackoverflow.com/questions/1289061/best-way-to-use-php-to-encrypt-and-decrypt - * @source http://php.net/manual/en/function.base64-encode.php - * @author williams@ud - * - * @param mixed $pt Object or plain text string - * @param bool|string $salt The salt to use - * - * @return mixed - */ - static public function encrypt( $pt, $salt = false ) { - - if( !$salt ) $salt = AUTH_SALT; - $encrypted = base64_encode( mcrypt_encrypt( MCRYPT_RIJNDAEL_256, md5( $salt ), $pt, MCRYPT_MODE_CBC, md5( md5( $salt ) ) ) ); - $encrypted = str_replace( array( '+', '/', '=' ), array( '-', '_', '' ), $encrypted ); - - return $encrypted; - - } - - /** - * This function decrypts data - * - * @source http://stackoverflow.com/questions/1289061/best-way-to-use-php-to-encrypt-and-decrypt - * @source http://php.net/manual/en/function.base64-encode.php - * @author williams@ud - * - * @param mixed $ct Ciphertext - * @param bool|string $salt The salt to use - * - * @return string - */ - static public function decrypt( $ct, $salt = false ) { - - if( !$salt ) $salt = AUTH_SALT; - $data = str_replace( array( '-', '_' ), array( '+', '/' ), $ct ); - $mod4 = strlen( $data ) % 4; - if( $mod4 ) { - $data .= substr( '====', $mod4 ); - } - $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $salt ), base64_decode( $data ), MCRYPT_MODE_CBC, md5( md5( $salt ) ) ), "\0" ); - - return ( $decrypted ); - - } - - /** - * Returns array of full pathes of files or directories which we try to find. - * - * @param mixed $needle Directory(ies) or file(s) which we want to find - * @param string $path The path where we try to find it - * @param boolean $_is_dir We're finding dir or file. Default is file. - * - * @return array - * @author peshkov@UD - */ - static public function find_file_in_system( $needle, $path, $_is_dir = false ) { - $return = array(); - $needle = (array) $needle; - $dir = @opendir( $path ); - - if( $dir ) { - while( ( $file = readdir( $dir ) ) !== false ) { - if( $file[ 0 ] == '.' ) { - continue; - } - $fullpath = trailingslashit( $path ) . $file; - if( is_dir( $fullpath ) ) { - if( $_is_dir && in_array( $file, $needle ) ) { - $return[ ] = $fullpath; - } - $return = array_merge( $return, self::find_file_in_system( $needle, $fullpath, $_is_dir ) ); - } else { - if( !$_is_dir && in_array( $file, $needle ) ) { - $return[ ] = $fullpath; - } - } - } - } - - return $return; - } - - /** - * Gets complicated html entity e.g. Table and ou|ol - * and removes whitespace characters include new line. - * we should to do this before use nl2br - * - * @author odokienko@UD - */ - static public function cleanup_extra_whitespace( $content ) { - $content = preg_replace_callback( '~<(?:table|ul|ol )[^>]*>.*?<\/( ?:table|ul|ol )>~ims', function($matches){ - return preg_replace('~>[\s]+<((?:t[rdh]|li|\/tr|/table|/ul ))~ims', '><$1', $matches[0]); - }, $content ); - - return $content; - } - - /** - * Parses passed directory for widget files - * includes and registers widget if they exist - * - * @param string $path - * @param boolean $cache - * - * @return null - * @author peshkov@UD - */ - static public function maybe_load_widgets( $path, $cache = true ) { - if ( !is_dir( $path ) ) { - return null; - } - - $_widgets = wp_cache_get( 'widgets', 'usabilitydynamics' ); - if( !is_array( $_widgets ) ) { - $_widgets = array(); - } - - if( $cache && !empty( $_widgets[ $path ] ) && is_array( $_widgets[ $path ] ) ) { - foreach( $_widgets[ $path ] as $_widget ) { - include_once( $path . "/" . $_widget[ 'file' ] ); - register_widget( $_widget[ 'headers' ][ 'class' ] ); - } - return null; - } - - $_widgets[ $path ] = array(); - - if ( $dir = @opendir( $path ) ) { - $headers = array( - 'name' => 'Name', - 'id' => 'ID', - 'type' => 'Type', - 'group' => 'Group', - 'class' => 'Class', - 'version' => 'Version', - 'description' => 'Description', - ); - while ( false !== ( $file = readdir( $dir ) ) ) { - $data = @get_file_data( $path . "/" . $file, $headers, 'widget' ); - if( $data[ 'type' ] == 'widget' && !empty( $data[ 'class' ] ) ) { - include_once( $path . "/" . $file ); - if( class_exists( $data[ 'class' ] ) ) { - //var_dump( $data[ 'class' ] ); - array_push( $_widgets[ $path ], array( - 'file' => $file, - 'headers' => $data, - ) ); - register_widget( $data[ 'class' ] ); - } - } - } - } - - wp_cache_set( 'widgets', $_widgets, 'usabilitydynamics' ); - - } - - /** - * Includes all PHP files from specific folder - * - * @param string $dir Directory's path - * @author peshkov@UD - * @version 0.2 - */ - static public function load_files ( $dir = '' ) { - if ( !empty( $dir ) && is_dir( $dir ) ) { - if ( $dh = opendir( $dir ) ) { - while (($file = readdir($dh)) !== false) { - $path = trailingslashit( $dir ) . $file; - if( !in_array( $file, array( '.', '..' ) ) && is_file( $path ) && 'php' == pathinfo( $path, PATHINFO_EXTENSION ) ) { - include_once( $path ); - } - } - closedir( $dh ); - } - } - } - - /** - * Localization Functionality. - * - * Replaces array's l10n data. - * Helpful for localization of data which is stored in JSON files ( see /schemas ) - * - * Usage: - * - * add_filter( 'ud::schema::localization', function($locals){ - * return array_merge( array( 'value_for_translating' => __( 'Blah Blah' ) ), $locals ); - * }); - * - * $result = self::l10n_localize (array( - * 'key' => 'l10n.value_for_translating' - * ) ); - * - * - * @param array $data - * @param array $l10n translated values - * @return array - * @author peshkov@UD - */ - static public function l10n_localize( $data, $l10n = array() ) { - - if ( !is_array( $data ) && !is_object( $data ) ) { - return $data; - } - - //** The Localization's list. */ - $l10n = apply_filters( 'ud::schema::localization', $l10n ); - - //** Replace l10n entries */ - foreach( $data as $k => $v ) { - if ( is_array( $v ) ) { - $data[ $k ] = self::l10n_localize( $v, $l10n ); - } elseif ( is_string( $v ) ) { - if ( strpos( $v, 'l10n' ) !== false ) { - preg_match_all( '/l10n\.([^\s]*)/', $v, $matches ); - if ( !empty( $matches[ 1 ] ) ) { - foreach ( $matches[ 1 ] as $i => $m ) { - if ( array_key_exists( $m, $l10n ) ) { - $data[ $k ] = str_replace( $matches[ 0 ][ $i ], $l10n[ $m ], $data[ $k ] ); - } - } - } - } - } - } - - return $data; - } - - /** - * Wrapper for json_encode function. - * Emulates JSON_UNESCAPED_UNICODE. - * - * @param type $arr - * @return JSON - * @author peshkov@UD - */ - static public function json_encode( $arr ) { - // convmap since 0x80 char codes so it takes all multibyte codes (above ASCII 127). So such characters are being "hidden" from normal json_encoding - array_walk_recursive( $arr, function(&$item, $key){ - if (is_string($item)) - $item = mb_encode_numericentity($item, array (0x80, 0xffff, 0, 0xffff), "UTF-8"); - }); - return mb_decode_numericentity( json_encode( $arr ), array( 0x80, 0xffff, 0, 0xffff ), 'UTF-8' ); - } - - /** - * Merges any number of arrays / parameters recursively, - * - * Replacing entries with string keys with values from latter arrays. - * If the entry or the next value to be assigned is an array, then it - * automagically treats both arguments as an array. - * Numeric entries are appended, not replaced, but only if they are - * unique - * - * @source http://us3.php.net/array_merge_recursive - * @version 0.4 - */ - static public function array_merge_recursive_distinct() { - $arrays = func_get_args(); - $base = array_shift( $arrays ); - if ( !is_array( $base ) ) $base = empty( $base ) ? array() : array( $base ); - foreach ( (array)$arrays as $append ) { - if ( !is_array( $append ) ) $append = empty( $append ) ? array() : array( $append ); - foreach ( (array)$append as $key => $value ) { - if ( !array_key_exists( $key, $base ) and !is_numeric( $key ) ) { - $base[ $key ] = $append[ $key ]; - continue; - } - if ( @is_array( $value ) && isset( $base[ $key ] ) && isset( $append[ $key ] ) && is_array( $base[ $key ] ) && is_array( $append[ $key ] ) ) { - $base[ $key ] = self::array_merge_recursive_distinct( $base[ $key ], $append[ $key ] ); - } else if ( is_numeric( $key ) ) { - if ( !in_array( $value, $base ) ) $base[ ] = $value; - } else { - $base[ $key ] = $value; - } - } - } - return $base; - } - - } - - } - -} diff --git a/vendor/udx/lib-utility/package.json b/vendor/udx/lib-utility/package.json deleted file mode 100644 index 56023a358..000000000 --- a/vendor/udx/lib-utility/package.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "lib-utility", - "version": "0.4.0", - "description": "Utility Library.", - "private": true, - "repository": { - "type": "git", - "url": "https://github.com/udx/lib-utility" - }, - "main": "scripts/udx.utility.js", - "engines": { - "node": ">= 0.10.0" - }, - "devDependencies": { - "grunt-contrib-symlink": "~0.2.0", - "grunt-contrib-yuidoc": "~0.5.0", - "grunt-contrib-uglify": "~0.2.4", - "grunt-contrib-watch": "~0.5.3", - "grunt-markdown": "~0.4.0", - "grunt-requirejs": "~0.4.0", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-shell": "~0.6.0", - "grunt-contrib-less": "~0.8.3", - "grunt-mocha-cli": "~1.5.0", - "grunt-mocha-cov": "~0.1.1", - "grunt-phpunit": "~0.3.3", - "findup-sync": "~0.1.3" - } -} diff --git a/vendor/udx/lib-utility/readme.md b/vendor/udx/lib-utility/readme.md deleted file mode 100644 index 6243a56fb..000000000 --- a/vendor/udx/lib-utility/readme.md +++ /dev/null @@ -1,59 +0,0 @@ -## Classes - - - Utility: General utility methods. - - Job: Job and processing handling. - - Loader: PSR class loader. - -## Utility Methods - - - extend() - - defaults() - - pluralize() - - singularize() - - ordinalize() - - hashify_file_name() - - can_get_image() - - ... - -## Changelog - -0.2.4 - - Added Utility::hashify_file_name() method; - - Added seperator options to Utility:;create_slug() to support things such as "::" - -## Usage - -```PHP -// Extend an Array or Object with another for easily setting of defaults. This is similar to extend() but in reverse. -$settings = UsabilityDynamics\Utility::defaults( $configurationObject, $defaultsObject ); - -// Find composer.json file and return as Object. -$composer = UsabilityDynamics\Utility::findUp( 'composer.json', __DIR__ ); -echo "Versio is {$composer->version}." -``` - - -## License - -(The MIT License) - -Copyright (c) 2013 Usability Dynamics, Inc. <info@usabilitydynamics.com> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/udx/lib-utility/scripts/analysis.client.js b/vendor/udx/lib-utility/scripts/analysis.client.js deleted file mode 100644 index 14961ed7a..000000000 --- a/vendor/udx/lib-utility/scripts/analysis.client.js +++ /dev/null @@ -1 +0,0 @@ -define("analysis.client",["jquery.elasticsearch","analysis.visualizer"],function(){function a(){return h||b()}function b(a,b,c){return i={host:a,index:b,type:c},h=new jQuery.es.Client({hosts:a})}function c(b,c){console.debug("getMapping",typeof c);var d={index:i.index||"deafult",type:i.type||"profile"};return a().indices.getMapping(d).then(function(a){"function"==typeof c&&c.call(null,a["jezf-truq-qgox-hfxp"].mappings.profile||{},d)})}function d(b){console.debug("getResults",typeof handleResponse);var c={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:b};return a().suggest(c).then(function(a){console.debug("getSuggestion","parseResponse",typeof a),"function"==typeof handleResponse&&handleResponse.call(null,null,a,"suggest",c)})}function e(b,c){console.debug("getMeta",typeof c);var d={index:i.index||"deafult",type:i.type||"profile"};return a().indices.getMapping(d).then(function(a){"function"==typeof c&&c.call(null,a["jezf-truq-qgox-hfxp"].mappings[i.type]._meta||{},"meta",d)})}function f(b,c,d){console.debug("getFacets",typeof d);var e={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:{query:{filtered:{query:b}},facets:c}};return a().search(e).then(function(a){"function"==typeof d&&d.call(null,null,a.facets,"facets",e)}).then(function(a){console.debug("handleError",arguments),"function"==typeof d&&d.call(a,null,{},"facets",e)})}function g(b,c){console.debug("getResults",typeof c);var d={index:i.index||"deafult",type:i.type||"profile",from:0,size:0,body:b};return a().search(d).then(function(a){console.debug("getResults","parseResponse",typeof a),"function"==typeof c&&c.call(null,null,a,"search",d)})}console.debug("analysis.client","loaded");var h,i={};return{client:a,createClient:b,getSuggestion:d,getMeta:e,getMapping:c,getFacets:f,getResults:g}}); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/analysis.visualizer.js b/vendor/udx/lib-utility/scripts/analysis.visualizer.js deleted file mode 100644 index 45945aebf..000000000 --- a/vendor/udx/lib-utility/scripts/analysis.visualizer.js +++ /dev/null @@ -1 +0,0 @@ -define("analysis.visualizer",["http://www.google.com/jsapi/"],function(){function a(){console.debug("analysis.visualizer","googleVisualizationReady")}function b(a){var b={raleigh:"Raleigh",port:"New Port","new":"Wilmington",west:"West River",lake:"Lake",south:"South Raleigh",north:"North Raleigh",est:"Eastern",east:"East Brook",wilfred:"Wilfred",zena:"Durham",en_us:"English",twitter:"Twitter",facebook:"Facebook",male:"Male",female:"Female"};return b[a]||a}function c(a,b){console.debug("Pie");var c=google.visualization.arrayToDataTable(b),d=jQuery('
        ');return jQuery(".query-result").append(d),new google.visualization.PieChart(d.get(0)).draw(c,{title:a}),g[a]={title:a,element:d},f}function d(a,b){console.debug("Map");var c=google.visualization.arrayToDataTable(b.raw),d=jQuery('
        ');return jQuery(".query-result").append(d),new google.visualization.GeoChart(d.get(0)).draw(c,{region:"US",displayMode:"regions",resolution:"provinces",enableRegionInteractivity:!0}),g[a]={title:a,element:d},f}function e(a,c){console.debug("Table",c);var d=new google.visualization.DataTable,e=c.total,h=c.terms||[];d.addColumn("string","Metric"),d.addColumn("number","Percentage"),d.addColumn("number","Count"),h.forEach(function(a){d.addRows([[b(a.term),{v:Math.round(a.count/e*100),f:Math.round(a.count/e*100)+"%"},{v:a.count}]])});var i=jQuery('
        ');return jQuery(".query-result").append(i),new google.visualization.Table(i.get(0)).draw(d,{showRowNumber:!1,pageSize:5}),g[a]={title:a,element:i},f}console.debug("analysis.visualizer"),google.load("visualization","1",{packages:["geochart","corechart","table"],callback:a});var f=this,g={};return{Map:d,Table:e,Pie:c,_cached:g}}); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.buttons.js b/vendor/udx/lib-utility/scripts/jquery.ud.buttons.js deleted file mode 100644 index 9b14c452d..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.buttons.js +++ /dev/null @@ -1 +0,0 @@ -!function(a){a.fn.smart_dom_button=function(b){var c=a.extend({debug:!1,action_attribute:"action_attribute",response_container:"response_container",ajax_action:"action",label_attributes:{process:"processing_label",revert_label:"revert_label",verify_action:"verify_action"}},b);return log=function(a,b){c.debug&&window.console&&console.debug&&("error"==b?console.error(a):console.log(a))},get_label=function(b){var c=a(b).get(0).tagName,d="";switch(c){case"SPAN":d=a(b).text();break;case"INPUT":d=a(b).val()}return d},set_label=function(b,c){switch(c.type){case"SPAN":a(c.button).text(b);break;case"INPUT":a(c.button).val(b)}return b},do_execute=function(b){var d={button:b,type:a(b).get(0).tagName,original_label:a(b).attr("original_label")?a(b).attr("original_label"):get_label(b)};c.wrapper&&a(d.button).closest(c.wrapper).length?(d.wrapper=a(d.button).closest(c.wrapper),d.use_wrapper=!0):(d.wrapper=d.button,d.use_wrapper=!1),d.the_action=a(d.wrapper).attr(c.action_attribute)?a(d.wrapper).attr(c.action_attribute):!1,c.label_attributes.processing&&a(d.wrapper).attr(c.label_attributes.processing)&&(d.processing_label=a(d.wrapper).attr(c.label_attributes.processing)?a(d.wrapper).attr(c.label_attributes.processing):!1),c.label_attributes.verify_action&&a(d.wrapper).attr(c.label_attributes.verify_action)&&(d.verify_action=a(d.wrapper).attr(c.label_attributes.verify_action)?a(d.wrapper).attr(c.label_attributes.verify_action):!1),c.label_attributes.revert_label&&a(d.wrapper).attr(c.label_attributes.revert_label)&&(d.revert_label=a(d.wrapper).attr(c.label_attributes.revert_label)?a(d.wrapper).attr(c.label_attributes.revert_label):!1,a(d.wrapper).attr("original_label")||(d.original_label=get_label(d.button),a(d.wrapper).attr("original_label",d.original_label))),d.the_action&&(!d.verify_action||confirm(d.verify_action))&&(d.use_wrapper&&(a(c.response_container,d.wrapper).length||a(d.wrapper).append(''),d.response_container=a(".response_container",d.wrapper),a(d.response_container).removeClass(),a(d.response_container).addClass("response_container"),d.processing_label&&a(d.response_container).html(d.processing_label)),"ui"==d.the_action?(d.revert_label&&(get_label(d.button)==d.revert_label?set_label(d.original_label,d):set_label(d.revert_label,d)),a(d.wrapper).attr("toggle")&&a(a(d.wrapper).attr("toggle")).toggle(),a(d.wrapper).attr("show")&&a(a(d.wrapper).attr("show")).show(),a(d.wrapper).attr("hide")&&a(a(d.wrapper).attr("hide")).hide()):a.post(ajaxurl,{_wpnonce:flawless_admin.actions_nonce,action:c.ajax_action,the_action:d.the_action},function(b){b&&b.success&&(a(d.response_container).show(),b.css_class&&a(d.response_container).addClass(b.css_class),b.remove_element&&a(b.remove_element).length&&a(b.remove_element).remove(),a(d.response_container).html(b.message),setTimeout(function(){a(d.response_container).fadeOut("slow",function(){a(d.response_container).remove()})},1e4))},"json"))},a(this).click(function(){log("Button triggered."),do_execute(this)}),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.date-selector.js b/vendor/udx/lib-utility/scripts/jquery.ud.date-selector.js deleted file mode 100644 index d3c7aa5a1..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.date-selector.js +++ /dev/null @@ -1 +0,0 @@ -!function(a){"use strict";a.prototype.date_selector=function(b){var d={element:this,cache:{}};d.options=a.extend(!0,{flat:!1,starts:1,prev:"◀",next:"▶",lastSel:!1,mode:"single",view:"days",calendars:1,format:"Y-m-d",position:"bottom",eventName:"click",onRender:function(){return{}},onChange:function(){return!0},onShow:function(){return!0},onBeforeShow:function(){return!0},locale:{days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday","Sunday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat","Sun"],daysMin:["Su","Mo","Tu","We","Th","Fr","Sa","Su"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekMin:"wk"},views:{years:"date_selector_view_years",moths:"date_selector_view_months",days:"date_selector_view_days"},template:{wrapper:'
        ',head:["",'',"","",'','','',"",'',"","","","","","","","","","","
        <%=prev%><%=next%>
        <%=week%><%=day1%><%=day2%><%=day3%><%=day4%><%=day5%><%=day6%><%=day7%>
        "],space:'
        ',days:['',"",'<%=weeks[0].week%>','<%=weeks[0].days[0].text%>','<%=weeks[0].days[1].text%>','<%=weeks[0].days[2].text%>','<%=weeks[0].days[3].text%>','<%=weeks[0].days[4].text%>','<%=weeks[0].days[5].text%>','<%=weeks[0].days[6].text%>',"","",'<%=weeks[1].week%>','<%=weeks[1].days[0].text%>','<%=weeks[1].days[1].text%>','<%=weeks[1].days[2].text%>','<%=weeks[1].days[3].text%>','<%=weeks[1].days[4].text%>','<%=weeks[1].days[5].text%>','<%=weeks[1].days[6].text%>',"","",'<%=weeks[2].week%>','<%=weeks[2].days[0].text%>','<%=weeks[2].days[1].text%>','<%=weeks[2].days[2].text%>','<%=weeks[2].days[3].text%>','<%=weeks[2].days[4].text%>','<%=weeks[2].days[5].text%>','<%=weeks[2].days[6].text%>',"","",'<%=weeks[3].week%>','<%=weeks[3].days[0].text%>','<%=weeks[3].days[1].text%>','<%=weeks[3].days[2].text%>','<%=weeks[3].days[3].text%>','<%=weeks[3].days[4].text%>','<%=weeks[3].days[5].text%>','<%=weeks[3].days[6].text%>',"","",'<%=weeks[4].week%>','<%=weeks[4].days[0].text%>','<%=weeks[4].days[1].text%>','<%=weeks[4].days[2].text%>','<%=weeks[4].days[3].text%>','<%=weeks[4].days[4].text%>','<%=weeks[4].days[5].text%>','<%=weeks[4].days[6].text%>',"","",'<%=weeks[5].week%>','<%=weeks[5].days[0].text%>','<%=weeks[5].days[1].text%>','<%=weeks[5].days[2].text%>','<%=weeks[5].days[3].text%>','<%=weeks[5].days[4].text%>','<%=weeks[5].days[5].text%>','<%=weeks[5].days[6].text%>',"",""],months:['',"",'<%=data[0]%>','<%=data[1]%>','<%=data[2]%>','<%=data[3]%>',"","",'<%=data[4]%>','<%=data[5]%>','<%=data[6]%>','<%=data[7]%>',"","",'<%=data[8]%>','<%=data[9]%>','<%=data[10]%>','<%=data[11]%>',"",""]}},b),d.log="function"==typeof d.log?d.log:function(){},d.initialize="function"==typeof d.initialize?d.initialize:function(){return d.log("s.initialize()","function"),d.extendDate(d.options.locale),d.options.calendars=Math.max(1,parseInt(d.options.calendars,10)||1),d.options.mode=/single|multiple|range/.test(d.options.mode)?d.options.mode:"single",d.element.each(function(b,c){var j,k,l="date_selector_"+parseInt(1e3*Math.random());if(a(d.element).data("date_selector_initialized"))return void d.log("s.initialize() - DOM element already initialized, skipping.","function");if(d.options.date||(d.options.date=new Date),d.options.date.constructor===String&&(d.options.date=g(d.options.date,d.options.format),d.options.date.setHours(0,0,0,0)),"single"!=d.options.mode)if(d.options.date.constructor!=Array)d.options.date=[d.options.date.valueOf()],"range"===d.options.mode&&d.options.date.push(new Date(d.options.date[0]).setHours(23,59,59,0).valueOf());else{for(var n=0;n0&&(o+=d.options.template.space),o+=e(d.options.template.head.join(""),{week:d.options.locale.weekMin,prev:d.options.prev,next:d.options.next,day1:d.options.locale.daysMin[k++%7],day2:d.options.locale.daysMin[k++%7],day3:d.options.locale.daysMin[k++%7],day4:d.options.locale.daysMin[k++%7],day5:d.options.locale.daysMin[k++%7],day6:d.options.locale.daysMin[k++%7],day7:d.options.locale.daysMin[k++%7]});j.find("tr:first").append(o).find("table").addClass(d.options.views[d.options.view]),f(j.get(0)),d.options.flat?(j.appendTo(this).show().css("position","relative"),h(j.get(0))):(j.appendTo(document.body),a(this).bind(d.options.eventName,m)),a(d.element).data("date_selector_initialized",!0)})};var e=function(a,b){d.log("tmpl()","function");var c=/\W/.test(a)?new Function("obj","var p=[],print=function(){p.push.apply(p,arguments);};with(obj){p.push('"+a.replace(/[\r\t\n]/g," ").split("<%").join(" ").replace(/((^|%>)[^\t]*)'/g,"$1\r").replace(/\t=(.*?)%>/g,"',$1,'").split(" ").join("');").split("%>").join("p.push('").split("\r").join("\\'")+"');}return p.join('');"):d.cache[a]=d.cache[a]||e(document.getElementById(a).innerHTML);return b?c(b):c},f=function(b){d.log("fill()","function"),b=a(b);var c,f,g,h,i,j,k,l,m,n=Math.floor(d.options.calendars/2),o=0;b.find("td>table tbody").remove();for(var p=0;pq;q++)f.data.push(g+q);l=e(d.options.template.months.join(""),f),c.setDate(1),f={weeks:[],test:10},h=c.getMonth();var g=(c.getDay()-d.options.starts)%7;for(c.addDays(-(g+(0>g?7:0))),i=-1,o=0;42>o;){j=parseInt(o/7,10),k=o%7,f.weeks[j]||(i=c.getWeekNumber(),f.weeks[j]={week:i,days:[]}),f.weeks[j].days[k]={text:c.getDate(),classname:[]},h!=c.getMonth()&&f.weeks[j].days[k].classname.push("date_selectorNotInMonth"),0===c.getDay()&&f.weeks[j].days[k].classname.push("date_selectorSunday"),6===c.getDay()&&f.weeks[j].days[k].classname.push("date_selectorSaturday");var r=d.options.onRender(c),s=c.valueOf();(r.selected||d.options.date===s||a.inArray(s,d.options.date)>-1||"range"===d.options.mode&&s>=d.options.date[0]&&s<=d.options.date[1])&&f.weeks[j].days[k].classname.push("date_selector_selected"),r.disabled&&f.weeks[j].days[k].classname.push("date_selector_disabled"),r.className&&f.weeks[j].days[k].classname.push(r.className),f.weeks[j].days[k].classname=f.weeks[j].days[k].classname.join(" "),o++,c.addDays(1)}l=e(d.options.template.days.join(""),f)+l,f={data:d.options.locale.monthsShort,className:"date_selector_months"},l=e(d.options.template.months.join(""),f)+l,m.append(l)}},g=function(a,b){if(d.log("parseDate()","function"),a){if(a.constructor===Date)return new Date(a);for(var c,e,f,g,h,i=a.split(/\W+/),j=b.split(/\W+/),k=new Date,l=0;l100?0:29>f?2e3:1900;break;case"H":case"I":case"k":case"l":g=parseInt(i[l],10);break;case"P":case"p":/pm/i.test(i[l])&&12>g?g+=12:/am/i.test(i[l])&&g>=12&&(g-=12);break;case"M":h=parseInt(i[l],10)}return new Date(void 0===f?k.getFullYear():f,void 0===e?k.getMonth():e,void 0===c?k.getDate():c,void 0===g?k.getHours():g,void 0===h?k.getMinutes():h,0)}};d.formatDate="function"==typeof d.formatDate?d.formatDate:function(a,b){g&&g.log("s.formatDate()","function");var c=a.getMonth(),d=a.getDate(),e=a.getFullYear(),f=(a.getWeekNumber(),a.getDay()),g={},h=a.getHours(),i=h>=12,j=i?h-12:h,k=a.getDayOfYear();0===j&&(j=12);for(var l,m=a.getMinutes(),n=a.getSeconds(),o=b.split(""),p=0;pd?"0"+d:d;break;case"e":l=d;break;case"H":l=10>h?"0"+h:h;break;case"I":l=10>j?"0"+j:j;break;case"j":l=100>k?10>k?"00"+k:"0"+k:k;break;case"k":l=h;break;case"l":l=j;break;case"m":l=9>c?"0"+(1+c):1+c;break;case"M":l=10>m?"0"+m:m;break;case"p":case"P":l=i?"PM":"AM";break;case"s":l=Math.floor(a.getTime()/1e3);break;case"S":l=10>n?"0"+n:n;break;case"u":l=f+1;break;case"w":l=f;break;case"y":l=(""+e).substr(2,2);break;case"Y":l=e}o[p]=l}return o.join("")},d.extendDate="function"==typeof d.extendDate?d.extendDate:function(a){Date.prototype.tempDate||(Date.prototype.tempDate=null,Date.prototype.months=a.months,Date.prototype.monthsShort=a.monthsShort,Date.prototype.days=a.days,Date.prototype.daysShort=a.daysShort,Date.prototype.getMonthName=function(a){return this[a?"months":"monthsShort"][this.getMonth()]},Date.prototype.getDayName=function(a){return this[a?"days":"daysShort"][this.getDay()]},Date.prototype.addDays=function(a){this.setDate(this.getDate()+a),this.tempDate=this.getDate()},Date.prototype.addMonths=function(a){null===this.tempDate&&(this.tempDate=this.getDate()),this.setDate(1),this.setMonth(this.getMonth()+a),this.setDate(Math.min(this.tempDate,this.getMaxDays()))},Date.prototype.addYears=function(a){null===this.tempDate&&(this.tempDate=this.getDate()),this.setDate(1),this.setFullYear(this.getFullYear()+a),this.setDate(Math.min(this.tempDate,this.getMaxDays()))},Date.prototype.getMaxDays=function(){var a,b=new Date(Date.parse(this)),c=28;for(a=b.getMonth(),c=28;b.getMonth()===a;)c++,b.setDate(c);return c-1},Date.prototype.getFirstDay=function(){var a=new Date(Date.parse(this));return a.setDate(1),a.getDay()},Date.prototype.getWeekNumber=function(){var a=new Date(this);a.setDate(a.getDate()-(a.getDay()+6)%7+3);var b=a.valueOf();return a.setMonth(0),a.setDate(4),Math.round((b-a.valueOf())/6048e5)+1},Date.prototype.getDayOfYear=function(){var a=new Date(this.getFullYear(),this.getMonth(),this.getDate(),0,0,0),b=new Date(this.getFullYear(),0,0,0,0,0),c=a-b;return Math.floor(c/24*60*60*1e3)})};var h=function(b){d.log("layout()","function");var c=a(b).data("date_selector"),e=a("#"+c.id);if(!d.options.extraHeight){var f=a(b).find("div");d.options.extraHeight=f.get(0).offsetHeight+f.get(1).offsetHeight,d.options.extraWidth=f.get(2).offsetWidth+f.get(3).offsetWidth}var g=e.find("table:first").get(0),h=g.offsetWidth,i=g.offsetHeight;e.css({width:h+d.options.extraWidth+"px",height:i+d.options.extraHeight+"px"}).find("div.date_selector_container").css({width:h+"px",height:i+"px"})},i=function(b){d.log("click()","function"),a(b.target).is("span")&&(b.target=b.target.parentNode);var c=a(b.target);if(c.is("a")){if(b.stopPropagation(),b.preventDefault(),b.target.blur(),c.hasClass("date_selector_disabled"))return!1;var e=d.options,g=c.parent(),h=g.parent().parent().parent(),i=a("table",this).index(h.get(0))-1,k=new Date(e.current),l=!1,m=!1;if(g.is("th")){if(g.hasClass("date_selectorWeek")&&"range"===d.options.mode&&!g.next().hasClass("date_selector_disabled")){var n=parseInt(g.next().text(),10);k.addMonths(i-Math.floor(d.options.calendars/2)),g.next().hasClass("date_selectorNotInMonth")&&k.addMonths(n>15?-1:1),k.setDate(n),d.options.date[0]=k.setHours(0,0,0,0).valueOf(),k.setHours(23,59,59,0),k.addDays(6),d.options.date[1]=k.valueOf(),m=!0,l=!0,d.options.lastSel=!1}else if(g.hasClass("date_selector_month"))switch(k.addMonths(i-Math.floor(d.options.calendars/2)),h.get(0).className){case"date_selector_view_days":h.get(0).className="date_selector_view_months",c.find("span").text(k.getFullYear());break;case"date_selector_view_months":h.get(0).className="date_selector_view_years",c.find("span").text(k.getFullYear()-6+" - "+(k.getFullYear()+5));break;case"date_selector_view_years":h.get(0).className="date_selector_view_days",c.find("span").text(d.formatDate(k,"B, Y"))}else if(g.parent().parent().is("thead")){switch(h.get(0).className){case"date_selector_view_days":d.options.current.addMonths(g.hasClass("date_selectorGoPrev")?-1:1);break;case"date_selector_view_months":d.options.current.addYears(g.hasClass("date_selectorGoPrev")?-1:1);break;case"date_selector_view_years":d.options.current.addYears(g.hasClass("date_selectorGoPrev")?-12:12)}m=!0}}else if(g.is("td")&&!g.hasClass("date_selector_disabled")){switch(h.get(0).className){case"date_selector_view_months":d.options.current.setMonth(h.find("tbody.date_selector_months td").index(g)),d.options.current.setFullYear(parseInt(h.find("thead th.date_selector_month span").text(),10)),d.options.current.addMonths(Math.floor(d.options.calendars/2)-i),h.get(0).className="date_selector_view_days";break;case"date_selector_view_years":d.options.current.setFullYear(parseInt(c.text(),10)),h.get(0).className="date_selector_view_months";break;default:var n=parseInt(c.text(),10);switch(k.addMonths(i-Math.floor(d.options.calendars/2)),g.hasClass("date_selectorNotInMonth")&&k.addMonths(n>15?-1:1),k.setDate(n),d.options.mode){case"multiple":n=k.setHours(0,0,0,0).valueOf(),a.inArray(n,d.options.date)>-1?a.each(d.options.date,function(a,b){return b===n?(d.options.date.splice(a,1),!1):void 0}):d.options.date.push(n);break;case"range":d.options.lastSel||(d.options.date[0]=k.setHours(0,0,0,0).valueOf()),n=k.setHours(23,59,59,0).valueOf(),nj.t+j.h&&(l=i.top-g.offsetHeight),lj.l+j.w&&(m=i.left-g.offsetWidth),m0?j(a("#"+a(this).data("date_selector_id")).data("date_selector"))[formated?0:1]:void 0},this.Clear=d.clear="function"==typeof d.clear?d.clear:function(){return d.log("clear()","function"),this.each(function(){if(a(this).data("date_selector_id")){{a("#"+a(this).data("date_selector_id"))}d.options=d.element.data("date_selector"),"single"!=d.options.mode&&(d.options.date=[],f(d.element.get(0)))}})},this.fixLayout=d.fixLayout="function"==typeof d.fixLayout?d.fixLayout:function(){return d.log("fixLayout()","function"),this.each(function(){if(a(this).data("date_selector_id")){{a("#"+a(this).data("date_selector_id"))}d.options=d.element.data("date_selector"),d.options.flat&&h(d.element.get(0))}})},d.initialize(),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.dynamic-filter.js b/vendor/udx/lib-utility/scripts/jquery.ud.dynamic-filter.js deleted file mode 100644 index 12ea808e2..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.dynamic-filter.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(a){"use strict";a.prototype.dynamic_filter=function(b){this.s=b=a.extend(!0,{ajax:{args:{},async:!0,cache:!0,format:"json"},active_timers:{status:{}},attributes:{},attribute_defaults:{label:"",concatenation_character:", ",display:!0,default_filter_label:"",related_attributes:[],sortable:!1,filter:!1,filter_always_show:!1,filter_collapsable:4,filter_multi_select:!1,filter_show_count:!1,filter_show_label:!0,filter_note:"",filter_placeholder:"",filter_show_disabled_values:!1,filter_range:{},filter_ux:[],filter_value_order:"native",filter_values:[]},callbacks:{result_format:function(a){return a}},data:{filterable_attributes:{},current_filters:{},sortable_attributes:{},dom_results:{},rendered_query:[]},filter_types:{checkbox:{filter_show_count:!0,filter_multi_select:!0},input:{filter_always_show:!0,filter_ux:[{autocomplete:{}}]},dropdown:{default_filter_label:"Show All",filter_show_count:!0,filter_always_show:!0},range:{filter_always_show:!0}},helpers:{},instance:{},settings:{auto_request:!0,chesty_puller:!1,debug:!1,dom_limit:200,filter_id:a(this).attr("dynamic_filter")?a(this).attr("dynamic_filter"):"df_"+location.host+location.pathname,load_ahead_multiple:2,sort_by:"",sort_direction:"",set_url_hashes:!0,per_page:25,request_range:{},use_instances:!0,timers:{notice:{dim:5e3,hide:2500},filter_intent:1600,initial_request:0},messages:{no_results:"No results found.",show_more:"Show More",show_less:"Show Less",loading:"Loading...",server_fail:"Could not retrieve results due to a server error, please notify the website administrator.",total_results:"There are {1} total results.",load_more:"Showing {1} of {2} results. Show {3} more."},unique_tag:!1},classes:{wrappers:{ui_debug:"df_ui_debug",element:"df_top_wrapper",results_wrapper:"df_results_wrapper",sorter:"df_sorter",results:"df_results",filter:"df_filter",load_more:"df_load_more",status_wrapper:"df_status_wrapper"},inputs:{input:"df_input",checkbox:"df_checkbox",start_range:"df_start_range",end_range:"df_end_range",range_slider:"df_range_slider"},labels:{range_slider:"df_range_slider_label",attribute:"df_attribute_label",checkbox:"df_checkbox"},status:{success:"df_alert_success",error:"df_alert_error"},results:{row:"df_result_row",result_data:"df_result_data",list_item:"df_list_item"},element:{ajax_loading:"df_ajax_loading",filter_pending:"df_filter_pending",server_fail:"df_server_fail",have_results:"df_have_results"},filter:{inputs_list_wrapper:"df_filter_inputs_list_wrapper",inputs_list:"df_filter_inputs_list",value_wrapper:"df_filter_value_wrapper",value_label:"df_filter_value_label",value_title:"df_filter_title",value_count:"df_filter_value_count",trigger:"df_filter_trigger",filter_label:"df_filter_label",filter_note:"df_filter_note",show_more:"df_filter_toggle_list df_show_more",show_less:"df_filter_toggle_list df_show_less",selected:"df_filter_selected",extended_option:"df_extended_option",currently_extended:"df_currently_extended"},sorter:{button:"df_sortable_button",button_active:"df_sortable_active"},close:"df_close",separator:"df_separator",selected_page:"df_current",disabled_item:"df_disabled_item"},css:{results:{hidden_row:" display: none; ",visible_row:" display: block; "}},ux:{element:this,results_wrapper:a("
        "),results:a("
          "),result_item:a("
        • "),sorter:a("
          "),sorter_button:a("
          "),filter:a("
          "),filter_label:a("
          "),load_more:a("
          "),status:a("
          ")},status:{},supported:{isotope:"function"==typeof a.prototype.isotope?!0:!1,jquery_ui:"object"==typeof a.ui?!0:!1,jquery_widget:"function"==typeof a.widget?!0:!1,jquery_position:"object"==typeof a.ui.position?!0:!1,autocomplete:"object"==typeof a.ui&&"function"==typeof a.widget&&"object"==typeof a.ui.position&&"function"==typeof a.prototype.autocomplete?!0:!1,date_selector:"function"==typeof a.prototype.date_selector?!0:!1,slider:"function"==typeof a.prototype.slider?!0:!1,window_history:"object"==typeof history&&"function"==typeof history.pushState?!0:!1}},b);var c=(this.get_log=function(d,e){d="undefind"!=typeof d?d:!1,e="undefind"!=typeof e?e:!1,"object"==typeof b.log_history&&a.each(b.log_history,function(a,b){d&&d!=b.type||c(b.notice,b.type,b.console_type,!0)})},this.log=function(a,c,d,e){if(c="undefined"!=typeof c?c:"log",d=d?d:"log",b.log_history.push({notice:a,type:c,console_type:d}),a="string"==typeof a||"number"==typeof a?"DF::"+a:a,!(e||b.settings.debug&&window.console))return a;if(!e&&"object"==typeof b.debug_detail&&!b.debug_detail[c])return a;if(window.console&&console.debug)switch(d){case"error":console.error(a);break;case"info":console.info(a);break;case"time":"undefined"!=typeof console.time&&console.time(a);break;case"timeEnd":"undefined"!=typeof console.timeEnd&&console.timeEnd(a);break;case"debug":"undefined"!=typeof console.debug?console.debug(a):console.log(a);break;case"dir":"undefined"!=typeof console.dir?console.dir(a):console.log(a);break;case"warn":"undefined"!=typeof console.warn?console.warn(a):console.log(a);break;case"clear":"undefined"!=typeof console.clear&&console.clear();break;case"log":console.log(a)}return a?a:void 0}),d=this.status=function(d,e){e=a.extend(!0,{element:b.ux.status,type:"default",message:d,hide:b.settings.timers.notice.hide},e),c("status( "+d+" ), type: "+e.type,"status","log"),a(b.ux.status).show().addClass(b.classes.status_wrapper),""===d&&(a(b.ux.status).html(""),a(b.ux.status).hide()),a(b.ux.status).data("original_classes")||a(b.ux.status).data("original_classes",a(b.ux.status).attr("class")),a(b.ux.status).attr("class",a(b.ux.status).data("original_classes")),clearTimeout(b.active_timers.status.hide),"string"==typeof b.classes.status[e.type]&&a(b.ux.status).addClass(b.classes.status[e.type]),b.ux.status.html(d),"undefined"!=typeof e.click_trigger?a(b.ux.status).one("click",function(){a(document).trigger(e.click_trigger,{})}):"function"==typeof a.prototype.alert&&(a(b.ux.status).prepend(a('×')),a(b.ux.status).alert()),e.hide&&(b.active_timers.status.hide=setTimeout(function(){a(b.ux.status).fadeTo(3e3,0,function(){a(b.ux.status).hide()})},e.hide)),"error"===e.type&&a(document).trigger("dynamic_filter::error_status",e)},e=this.prepare_system=function(){b.debug_detail=a.extend(!0,{ajax_detail:!1,attribute_detail:!0,detail:!0,dom_detail:!1,event_handlers:!0,filter_ux:!0,filter_detail:!0,helpers:!1,instance_detail:!0,log:!0,procedurals:!0,status:!1,supported:!0,timers:!0,ui_debug:!1},"object"==typeof b.settings.debug?b.settings.debug:{}),b.log_history=[],c("prepare_system","procedurals"),a.each(b.supported,function(a,b){b?c("Support for ("+a+") verified.","supported","info"):!1}),a(b.ux.element).children().length&&(b.ux.placeholder_results=a(b.ux.element).children()),b.settings.chesty_puller&&"function"==typeof a.prototype.animate&&q()},f=this.analyze_attributes=function(){c("analyze_attributes","procedurals"),a(document).trigger("dynamic_filter::analyze_attributes::initialize"),"undefined"==typeof b.ajax.args&&(b.ajax.args={}),a.each(b.attribute_defaults,function(a,c){b.attribute_defaults[a]="true"===c?!0:"false"===c?!1:c}),b.ajax.args.attributes=b.ajax.args.attributes?b.ajax.args.attributes:{},b.ajax.args.filter_query=b.ajax.args.filter_query?b.ajax.args.filter_query:{},f.add_ux_support=function(a,d,e){c("analyze_attributes.add_ux_support("+a+")","procedurals"),b.attributes[a].verified_ux=b.attributes[a].verified_ux?b.attributes[a].verified_ux:{},b.attributes[a].verified_ux[d]=e?e:{}},f.analyze_single=function(d,e){if(c("analyze_attributes.analyze("+d+")","procedurals"),e=e?e:b.attributes[d],a.each(e,function(a,b){e[a]="true"===b?!0:"false"===b?!1:b}),b.attributes[d]=a.extend({},b.attribute_defaults,b.attributes[d].filter?b.filter_types[b.attributes[d].filter]:{},e),b.attributes[d].verified_ux={},b.ajax.args.attributes[d]=b.ajax.args.attributes[d]?b.ajax.args.attributes[d]:{},a.each(b.attributes[d],function(a,c){b.ajax.args.attributes[d][a]="function"!=typeof c?c:"callback"}),b.attributes[d].sortable&&(b.data.sortable_attributes[d]=b.attributes[d]),b.attributes[d].filter&&(b.data.filterable_attributes[d]={filter:b.attributes[d].filter},b.ajax.args.filter_query[d]=b.ajax.args.filter_query[d]?b.ajax.args.filter_query[d]:[],"undefined"!=typeof e.filter_ux)){if("string"==typeof e.filter_ux){var g=new Object;g[e.filter_ux]={},e.filter_ux=[g]}a.each(e.filter_ux?e.filter_ux:[],function(c,e){a.each(e,function(a,c){b.supported[a]&&f.add_ux_support(d,a,c),"boolean"==typeof b.supported[a]&&b.supported[a]===!1&&b.helpers.attempt_ud_ux_fetch(a,d,c)})})}},a.each(b.attributes,function(a,b){f.analyze_single(a,b)}),a(document).trigger("dynamic_filter::analyze_attributes::complete")},g=this.render_ui=function(){c("render_ui","procedurals"),a.each(b.ux,function(d,e){return e&&"object"!=typeof e&&(b.ux[d]=a(e)),a(b.ux[d]).length?(a(b.ux[d]).addClass("df_element"),a(b.ux.element).addClass(b.debug_detail.ui_debug?b.classes.wrappers.ui_debug:""),void a(b.ux[d]).addClass(b.classes.wrappers[d])):void c("render_ui - s.ux."+d+" was passed as a selector. Corresponding DOM element could not be found.","misconfiguration","error")}),a(b.ux.results_wrapper).not(":visible").length&&a(b.ux.element).prepend(b.ux.results_wrapper),a(b.ux.sorter).not(":visible").length&&a(b.ux.element).prepend(b.ux.sorter),a(b.ux.results).not(":visible").length&&a(b.ux.results_wrapper).append(b.ux.results),b.ux.filter&&!a(b.ux.filter,"body").is(":visible")&&(a(b.ux.element).prepend(b.ux.filter),a(b.ux.filter).addClass(b.classes.filter)),b.ux.status&&!a(b.ux.status).is(":visible")&&(a(b.ux.element).before(b.ux.status),a(b.ux.status).hide()),b.ux.load_more&&!a(b.ux.load_more).is(":visible")&&(a(b.ux.results_wrapper).append(b.ux.load_more),a(b.ux.load_more).click(function(){b.status.loading||(a(b.ux.load_more).unbind("s.ux.load_more"),a(document).trigger("dynamic_filter::load_more"))}),a(b.ux.load_more).hide()),b.supported.isotope&&a(b.ux.results).isotope({itemSelector:"."+b.classes.results.row})},h=this.render_sorter_ui=function(){""!==b.settings.sort_by&&"object"==typeof b.attributes[b.settings.sort_by]&&(b.attributes[b.settings.sort_by].sortable=!0),a.each(b.attributes?b.attributes:{},function(a){b.attributes[a].sortable&&(b.data.sortable_attributes[a]=b.attributes[a])}),a.each(b.data.sortable_attributes?b.data.sortable_attributes:{},function(c,d){a('div[attribute_key="'+c+'"]',b.ux.sorter).length||(b.ux.sorter.append(b.ux.sorter[c]=a(b.ux.sorter_button).clone(!1).addClass(b.classes.sorter.button).attr("attribute_key",c).attr("sort_direction","ASC").text(d.label)),a(b.ux.sorter[c]).click(function(){b.settings.sort_by=this.getAttribute("attribute_key"),b.settings.sort_direction=this.getAttribute("sort_direction"),a("div",b.ux.sorter).removeClass(b.classes.sorter.button_active),a(this).addClass(b.classes.sorter.button_active),a(document).trigger("dynamic_filter::execute_filters")}))})},i=this.render_filter_ui=function(d){c("render_filter_ui","procedurals"),a(document).trigger("dynamic_filter::render_filter_ui::initiate"),"object"!=typeof b.data.filters&&(c("render_filter_ui - s.data.filters is not an object. Creating initial DOM References for filters.","dom_detail"),b.data.filters={}),a.each(b.data.filterable_attributes,function(a,b){k(a,b,d)}),a(document).trigger("dynamic_filter::render_filter_ui::complete")},j=this.update_filters=function(d){c("update_filters","procedurals"),a(document).trigger("dynamic_filter::update_filters::initialize"),a.each(b.data.filterable_attributes,function(a,c){"undefined"!=typeof b.attributes[a]&&k(a,c,d)}),a(document).trigger("dynamic_filter::update_filters::complete")},k=this.render_single_filter=function(d,e){c("render_filter_ui( "+d+", "+typeof e+" ) ","procedurals");var f=b.attributes[d],g=b.data.filters[d],h={},i={},j=function(a,c){"enable"!==c&&c?a.prop("checked",!1).closest("li").removeClass(b.classes.filter.selected):a.prop("checked",!0).closest("li").addClass(b.classes.filter.selected)};switch("undefined"==typeof g&&(i.initial_run=!0,g={inputs_list_wrapper:a('
          '),filter_label:a(b.ux.filter_label).clone(!0).attr("class",b.classes.filter.filter_label).text(b.attributes[d].label),inputs_list:a('
            '),show_more:a('
            '+b.settings.messages.show_more+"
            ").hide(),show_less:a('
            '+b.settings.messages.show_less+"
            ").hide(),filter_note:a('
            ').hide(),items:{},triggers:[]},b.attributes[d].filter_show_label||g.filter_label.hide(),b.ux.filter.append(g.inputs_list_wrapper),g.inputs_list_wrapper.append(g.filter_label),g.inputs_list_wrapper.append(g.inputs_list),g.inputs_list_wrapper.append(g.filter_note),g.inputs_list_wrapper.append(g.show_more),g.inputs_list_wrapper.append(g.show_less),""!==f.filter_note&&g.filter_note.show(),""===f.label&&g.filter_label.hide(),b.data.filters[d]=g,g.show_more.click(function(){a("."+b.classes.filter.extended_option,g.inputs_list_wrapper).show(),g.inputs_list_wrapper.toggleClass(b.classes.filter.currently_extended),g.show_more.toggle(),g.show_less.toggle()}),g.show_less.click(function(){a("."+b.classes.filter.extended_option,g.inputs_list_wrapper).hide(),g.inputs_list_wrapper.toggleClass(b.classes.filter.currently_extended),g.show_more.toggle(),g.show_less.toggle()})),c({"Attribute Key":d,"Attribute Settings":f,"Filter Type":f.filter,"Filter Detail":g,"Verified UX":a.map(f.verified_ux?f.verified_ux:{},function(a,b){return b}),"Filter Items":g.items},"filter_detail","dir"),f.filter){case"input":i.initial_run&&(g.items.single={wrapper:a('
          • '),label:a(''),trigger:a('')},a(g.inputs_list).append(g.items.single.wrapper),g.items.single.wrapper.append(g.items.single.label),g.items.single.label.append(g.items.single.trigger),a(g.items.single.trigger).unbind("keyup").keyup(function(){b.ajax.args.filter_query[d]=g.items.single.trigger.val(),a(document).trigger("dynamic_filter::execute_filters")}),""!=b.ajax.args.filter_query[d]&&g.items.single.trigger.val(b.ajax.args.filter_query[d]),g.items.single.execute_filter=function(){b.ajax.args.filter_query[d]=g.items.single.trigger.val(),a(document).trigger("dynamic_filter::execute_filters")}),f.verified_ux.autocomplete&&(c("render_filter_ui() - Adding AutoComplete UX to ("+d+").","filter_ux","info"),a(g.items.single.trigger).unbind("keyup"),a(g.items.single.trigger).autocomplete({appendTo:g.items.single.wrapper,source:a.map(f.filter_values?f.filter_values:[],function(a){return"object"==typeof a?a.value:!1}),select:function(){g.items.single.execute_filter()},change:function(){g.items.single.execute_filter()}}));break;case"dropdown":i.initial_run&&(g.items.single={wrapper:a('
          • '),label:a(''),trigger:a(''),empty_placeholder:a('")},a(g.inputs_list).append(g.items.single.wrapper),g.items.single.wrapper.append(g.items.single.label),g.items.single.label.append(g.items.single.trigger),g.items.single.trigger.append(g.items.single.empty_placeholder),a(g.items.single.trigger).keyup(function(){b.ajax.args.filter_query[d]=g.items.single.trigger.val(),a(document).trigger("dynamic_filter::execute_filters")}),a(g.items.single.trigger).unbind("change").change(function(){g.items.single.trigger.value=a(":selected",this).val(),b.ajax.args.filter_query[d]=-1===a.inArray(g.items.single.trigger.value,b.ajax.args.filter_query[d])?[g.items.single.trigger.value]:[],a(document).trigger("dynamic_filter::execute_filters")})),a("> option",g.items.single.trigger).each(function(){a(this).attr("filter_key")&&(h[a(this).attr("filter_key")]=a(this))}),a.each(f.filter_values?f.filter_values:[],function(b,c){"object"==typeof c&&(delete h[c.filter_key],c.element=a('option[filter_key="'+c.filter_key+'"]',g.items.single.trigger),c.element.length?f.filter_show_count&&c.element.text(c.element.text().replace(/\(\d+\)$/,"("+c.value_count+")")):(c.element=a('"),f.filter_show_count&&c.value_count&&c.element.append(" ("+c.value_count+")")),t(g.items.single.trigger,c.element,b+1))}),""!=b.ajax.args.filter_query[d]&&""===g.items.single.trigger.val()&&g.items.single.trigger.val(b.ajax.args.filter_query[d]);break;case"checkbox":i.initial_run,a(" > ."+b.classes.filter.value_wrapper,g.inputs_list).each(function(){a(this).attr("filter_key")&&(h[a(this).attr("filter_key")]=a(this))}),""!=f.default_filter_label&&(f.filter_values[0]={filter_key:"show_all",value:f.default_filter_label,css_class:b.classes.filter.default_filter}),a.each(f.filter_values?f.filter_values:[],function(c,e){if("object"==typeof e){c=parseInt(c);var i=g.items[e.filter_key]=g.items[e.filter_key]?g.items[e.filter_key]:{};delete h[e.filter_key],e.css_class=e.css_class?e.css_class:b.classes.filter.value_wrapper,i.wrapper=a('li[filter_key="'+e.filter_key+'"]',g.inputs_list),i.wrapper.length||(i.wrapper=a('
          • '),i.label_wrapper=a(''),i.trigger=a(''),i.label=a(''+e.value+" "),i.count=a(''),i.label_wrapper.append(i.trigger),i.label_wrapper.append(i.label),i.label_wrapper.append(i.count),i.wrapper.append(i.label_wrapper)),"show_all"!==e.filter_key&&g.triggers.push(i.trigger),"number"==typeof f.filter_collapsable&&c>f.filter_collapsable?(i.wrapper.addClass(b.classes.filter.extended_option),g.inputs_list_wrapper.hasClass(b.classes.filter.currently_extended)||(i.wrapper.addClass(b.classes.filter.extended_option).hide(),g.show_more.show(),g.show_less.hide())):i.wrapper.removeClass(b.classes.filter.extended_option),i.wrapper.removeClass(b.classes.disabled_item),i.trigger.prop("disabled",!1),("undefined"!=typeof e.value_count||"object"==typeof e.value_count&&""===e.value_count.val())&&i.count.text(" ("+e.value_count+") "),f.filter_show_count||a(i.count).hide(),t(g.inputs_list,i.wrapper,c+1),a(i.trigger).unbind("change").change(function(){return"show_all"!==a(this).val()||a(this).prop("checked")?("show_all"!=a(this).val()&&a(this).prop("checked")&&(j(a(this),"enable"),j(g.items.show_all.trigger,"disable"),-1===a.inArray(i.trigger.val(),b.ajax.args.filter_query[d])?b.ajax.args.filter_query[d].push(i.trigger.val()):b.ajax.args.filter_query[d]=s(i.trigger.val(),b.ajax.args.filter_query[d]),a(document).trigger("dynamic_filter::execute_filters")),void("show_all"===a(this).val()&&a(this).prop("checked")&&(j(a(this),"enable"),a(g.triggers).each(function(){j(a(this),"disable")}),b.ajax.args.filter_query[d]=[],a(document).trigger("dynamic_filter::execute_filters")))):(j(g.items.show_all.trigger,"enable"),!1)}),-1!==a.inArray(e.filter_key,b.ajax.args.filter_query[d])&&j(i.trigger,"enable")}}),a.isEmptyObject(b.ajax.args.filter_query[d])&&"object"==typeof g.items.show_all&&j(g.items.show_all.trigger,"enable");break;case"range":i.initial_run&&(g.items.single={wrapper:a('
          • '),label:a(''),min:a(''),max:a('')},a(g.inputs_list).append(g.items.single.min),a(g.inputs_list).append(g.items.single.max),a(g.items.single.min).unbind("keyup").keyup(function(){b.ajax.args.filter_query[d]={min:g.items.single.min.val(),max:g.items.single.max.val()},a(document).trigger("dynamic_filter::execute_filters")}),a(g.items.single.max).unbind("keyup").keyup(function(){b.ajax.args.filter_query[d]={min:g.items.single.min.val(),max:g.items.single.max.val()},a(document).trigger("dynamic_filter::execute_filters")})),f.verified_ux.date_selector&&(c("render_filter_ui() - Updating DateSelector UX to ("+d+").","filter_ux","info"),"undefined"==typeof g.items.single.range_selector&&(a(g.items.single.min).remove(),a(g.items.single.max).remove(),a(g.inputs_list).append(g.items.single.date_selector_field=a('
            ')),a(g.inputs_list).append(g.items.single.range_selector=a('
            ')),g.items.single.range_selector.date_selector({flat:!0,calendars:2,position:"left",format:"ymd",mode:"range",onChange:function(c){g.items.single.date_selector_field.val("object"==typeof c?c.join(" - "):""),b.ajax.args.filter_query[d]={min:c[0],max:c[1]},a(document).trigger("dynamic_filter::execute_filters")}}),a(document).bind("dynamic_filter::get_data",function(){}),g.items.single.date_selector_field.focus(function(){})),"object"==typeof b.ajax.args.filter_query[d]&&g.items.single.range_selector.setDate([b.ajax.args.filter_query[d].min,b.ajax.args.filter_query[d].max]))}a.each(h,function(c){f.filter_show_disabled_values?"object"==typeof g.items[c]&&g.items[c].count&&(g.items[c].wrapper.addClass(b.classes.disabled_item),g.items[c].trigger.prop("disabled",!0),g.items[c].count.text("")):a(this).remove()}),!f.filter_always_show&&a.isEmptyObject(f.filter_values)?(c("render_filter_ui - No Filter Values for "+d+" - hiding input.","filter_detail","info"),g.inputs_list_wrapper.hide()):g.inputs_list_wrapper.show()},l=this.get_data=function(e,f){a(document).trigger("dynamic_filter::get_data::initialize",[f]),b.status.loading=!0,f=a.extend(!0,{silent_fetch:!1,append_results:!1},f),b.data.get_count="number"==typeof b.data.get_count?b.data.get_count+1:1,b.settings.request_range.start||(b.settings.request_range.start=0),b.settings.request_range.end||(b.settings.request_range.end=b.settings.dom_limit);var g=a.extend(!0,b.ajax.args,b.settings,{filterable_attributes:b.data.filterable_attributes});f.silent_fetch||a(document).trigger("dynamic_filter::doing_ajax",{settings:b,args:f,ajax_request:g}),c(g.filter_query,"ajax_detail","dir"),a.ajax({dataType:b.ajax.format,type:"POST",cache:b.ajax.cache,async:b.ajax.async,url:b.ajax.url,data:g,success:function(e){c("get_data - Have AJAX response.","ajax_detail","debug"),delete b.status.loading;var g=b.callbacks.result_format(e);return g&&"object"==typeof g&&(e=g),c(e,"ajax_detail","dir"),"object"!=typeof e.all_results?(c("get_data() - AJAX response missing all_results array.","log","error"),!1):(a.each(b.attributes,function(a){b.attributes[a].filter_values=[]}),a.each(e.current_filters?e.current_filters:{},function(c,d){b.attributes[c]&&("undefined"!=typeof d.min&&"undefined"!=typeof d.max&&(b.attributes[c].filter_values=d),a.each(d,function(a,d){"undefined"!=typeof d.filter_key&&null!==d.filter_key&&(("undefined"==typeof d.value||""==d.value||null===d.value)&&(d.value=d.filter_key),d.value.length&&(b.attributes[c].filter_values[parseInt(a)+1]=d))}))}),void(a.isEmptyObject(e)?"object"==typeof b.data.rendered_query[0]?d(b.settings.messages.no_results,{type:"error",hide:!1,click_trigger:"dynamic_filter::undo_last_query"}):(d(b.settings.messages.no_results,{type:"error",hide:!1,click_trigger:b.settings.debug?"dynamic_filter::get_data":""}),a(document).trigger("dynamic_filter::get_data::fail",f)):a(document).trigger("dynamic_filter::get_data::complete",a.extend(f,e))))},error:function(){d(b.settings.messages.server_fail,{type:"error",hide:!1,click_trigger:b.settings.debug?"dynamic_filter::get_data":""}),a(document).trigger("dynamic_filter::get_data::fail",f)}})},m=this.append_dom=function(d,e){c("append_dom()","procedurals"),a(document).trigger("dynamic_filter::append_dom::initialize",e),b.data.all_results=b.data.all_results?b.data.all_results:[],e.append_results||(b.data.all_results=[]),b.ux.placeholder_results&&e.initial_request&&b.ux.placeholder_results.length&&(c("Removing Placeholder Results.","dom_detail","info"),a(b.ux.placeholder_results).remove()),m.process_attributes=function(d){d.dom.row.append(d.dom.attribute_wrapper),a.each(d.attribute_data,function(e,f){if(b.attributes[e]){if(b.attributes[e].filter&&d.dom.row.attr(e,f),!b.attributes[e].display)return void c("append_dom.process_attributes - Returned attribute ("+e+") is defined, but not for display - skipping.","attribute_detail","info");a.isArray(f)&&(c("append_dom.process_attributes - Value returned as an array for "+e,"attribute_detail","info"),f=f.join(concatenation_character)),"function"==typeof b.attributes[e].render_callback&&(c("append_dom.process_attributes - Callback function found for "+e+".","attribute_detail","info"),f=b.attributes[e].render_callback(f,{data:d.attribute_data,dfro:d})),d.dom.attribute_wrapper.append(d.dom.attributes[e]=a('
          • '+(null!==f?f:"")+"
          • ")),c({"Log Event":"Appended dfro.dom.attributes["+e+"] attribute.","Attribute Key":e,"Attribute Value":f,"Attribute Value Type":typeof f,"Attribute DOM":d.dom.attributes[e]},"attribute_detail","dir")}})};var f=a.extend({},b.data.dom_results);return a.each(e.all_results,function(d,g){if("number"!=typeof d)return c('append_dom() - Unexpected Data Error! "index" is ('+typeof d+"), not a numeric value as expected.","log","error"),!0;e.append_results&&(d=b.data.total_in_dom+d);var h="df_"+(b.settings.unique_tag?b.settings.unique_tag:"row")+"_"+("string"==typeof b.settings.unique_tag&&"undefined"!=typeof g[b.settings.unique_tag]?g[b.settings.unique_tag]:b.helpers.random_string());if(delete f[h],"object"==typeof b.data.dom_results[h])return c("append_dom() - Result #"+h+" already in DOM - moving to position "+d,"dom_detail","info"),t(b.ux.results,b.data.dom_results[h].dom.row,d),b.data.all_results[d]=b.data.dom_results[h],!0;var i=b.data.dom_results[h]=b.data.all_results[d]=a.extend({},{attribute_data:g,unique_id:"string"==typeof b.settings.unique_tag?g[b.settings.unique_tag]:!1,dom:{row:b.ux.result_item.clone(!1),attribute_wrapper:a('
              '),attributes:{}},dom_id:h,result_count:d});a(document).trigger("dynamic_filter::render_data::row_element",i),i.dom.row.attr("id",h).attr("class",b.classes.results.row).attr("df_result_count",d).attr("style",b.css.results.hidden_row),c({"Log Event":"append_dom() - #"+i.dom_id+" - DOM created.","DOM ID":"#"+i.dom_id,"Result Count":i.result_count,DOM:i.dom,"Attribute Data":i.attribute_data},"attribute_detail","dir"),m.process_attributes(i),t(b.ux.results,i.dom.row,i.result_count)?c("append_dom() - Inserted #"+i.dom_id+" at position "+i.result_count+".","dom_detail","info"):c("append_dom() - Unable to insert #"+i.dom_id+" at position "+i.result_count+".","dom_detail","error")}),e.append_results||a.each(f?f:{},function(a,d){c("append_dom() - Removing #"+a+", no longer in result set.","dom_detail","info"),d.dom.row.remove(),delete b.data.dom_results[a]}),b.data.all_results.length>0?a(b.ux.element).addClass(b.classes.element.have_results):a(b.ux.element).removeClass(b.classes.element.have_results),a(document).trigger("dynamic_filter::append_dom::complete",e),b.data.total_results=e.total_results?e.total_results:b.data.all_results.length,b.data.total_in_dom=parseInt(b.data.all_results.length),b.data.more_available_on_server=b.data.total_results-b.data.total_in_dom,e},n=this.render_data=function(d,e){return c("render_data()","procedurals"),a(document).trigger("dynamic_filter::render_data::initialize",e),b.settings.visible_range||(b.settings.visible_range={start:0,end:b.settings.per_page?b.settings.per_page:25}),b.data.now_visible=parseInt(b.settings.visible_range.end)-parseInt(b.settings.visible_range.start),b.data.more_available_in_dom=parseInt(b.data.total_in_dom)-parseInt(b.data.now_visible),b.data.next_batch=b.data.total_results-b.settings.visible_range.end0)&&(c("load_more - fetching more results.","detail"),b.settings.request_range={start:b.data.total_in_dom,end:b.data.total_in_dom+b.settings.per_page*b.settings.load_ahead_multiple},a(document).trigger("dynamic_filter::get_data",{silent_fetch:!0,append_results:!0}))},q=this.chesty_puller=function(){b.settings.chesty_puller=a.extend(!0,{top_padding:45,offset:a(b.ux.filter).offset()},b.settings.chesty_puller),q.move_chesty=function(){var c=b.settings.chesty_puller;a(b.ux.filter).stop().animate(a(window).scrollTop()>c.offset.top?{marginTop:a(window).scrollTop()-c.offset.top+c.top_padding}:{marginTop:0})},a(window).scroll(move_chesty)},r=function(a,b){if(c("sprintf()","helpers"),"array"!=typeof b);else;var d=a;for(var e in b){var f=parseInt(e)+1;d=d.replace("{"+f+"}",b[e])}return d},s=this.remove_from_array=function(b,d){return c("remove_from_array()","helpers"),a.grep(d,function(a){return a!==b})},t=this.insert_at=function(b,d,e){c("insert_at()","procedurals"),b=a(b);var e=(b.children().size(),parseInt(e));return b.append(0!==e&&b.children().eq(e-1).length?d:d),!0};b.instance.load="function"==typeof b.instance.load?b.instance.load:function(){c("s.instance.load()","procedurals"),b.supported.cookies&&(b.instance.rendered_query=jaaulde.utils.cookies.get(b.settings.filter_id+"_rendered_query"),b.instance.per_page=jaaulde.utils.cookies.get(b.settings.filter_id+"_per_page"),b.instance.sort_by=jaaulde.utils.cookies.get(b.settings.filter_id+"_sort_by"),b.instance.sort_direction=jaaulde.utils.cookies.get(b.settings.filter_id+"_sort_direction")),b.instance.rendered_query=b.instance.rendered_query?b.instance.rendered_query:{},a.each(b.helpers.url_to_object(),function(c,d){-1!==a.inArray(c,["sort_by","sort_direction","per_page"])?b.instance[c]=d[0]:b.instance.rendered_query[c]=d -}),b.ajax.args.filter_query=a.extend(!0,b.ajax.args.filter_query,b.instance.rendered_query),b.settings.sort_by=b.instance.sort_by?b.instance.sort_by:b.settings.sort_by,b.settings.sort_direction=b.instance.sort_direction?b.instance.sort_direction:b.settings.sort_direction,b.settings.per_page=parseInt(b.instance.per_page?b.instance.per_page:b.settings.per_page),b.instance.result_range&&(b.settings.request_range={start:b.instance.result_range.split("-")[0],end:b.instance.result_range.split("-")[1]},c("s.instance.clear() - Setting Result Range: ("+b.settings.request_range.start+" - "+b.settings.request_range.end+").","instance_detail"))},b.instance.set="function"==typeof b.instance.set?b.instance.set:function(){c("s.instance.set()","procedurals"),b.instance.data={cookies:{rendered_query:b.data.rendered_query?b.data.rendered_query[0]:"",sort_direction:b.settings.sort_direction,per_page:b.settings.per_page,sort_by:b.settings.sort_by},hash:{sort_direction:b.settings.sort_direction,per_page:b.settings.per_page,sort_by:b.settings.sort_by},window_history:{rendered_query:b.data.rendered_query?b.data.rendered_query[0]:""}},a.each(b.data.rendered_query&&b.data.rendered_query?b.data.rendered_query[0]:[],function(a,c){b.instance.data.hash[a]=c}),b.supported.cookies&&a.each(b.instance.data.cookies,function(c,d){a.cookies.set(b.settings.filter_id+"_"+c,d)}),window.location.hash=b.settings.set_url_hashes?b.helpers.object_to_url(b.instance.data.hash):"",b.supported.window_history},b.instance.clear="function"==typeof b.instance.clear?b.instance.clear:function(){return b.supported.cookies&&(delete b.instance.cookie_data,jaaulde.utils.cookies.del(b.settings.filter_id+"_rendered_query"),jaaulde.utils.cookies.del(b.settings.filter_id+"_result_range"),jaaulde.utils.cookies.del(b.settings.filter_id+"_sort_by"),jaaulde.utils.cookies.del(b.settings.filter_id+"_sort_direction")),c("s.instance.clear() - All Instance data cleared out. ","instance_detail")},b.helpers.attempt_ud_ux_fetch="function"==typeof b.helpers.attempt_ud_ux_fetch?b.helpers.attempt_ud_ux_fetch:function(d,e,g){switch(b.helpers.attempt_ud_ux_fetch.attempted=b.helpers.attempt_ud_ux_fetch.attempted?b.helpers.attempt_ud_ux_fetch.attempted:{},d){case"date_selector":var h=" http://cdn.usabilitydynamics.com/jquery.ud.date_selector.js"}return b.helpers.attempt_ud_ux_fetch.attempted[d]||!h?!1:(b.helpers.attempt_ud_ux_fetch.fail=function(a,b){c("Library ("+a+") could not be loaded for: ("+b+"), but we did try.","filter_ux","info")},b.helpers.attempt_ud_ux_fetch.success=function(a,b){c("Library ("+a+") loaded automatically from UD. Applying to: ("+b+"). You are welcome.","filter_ux","info"),f.add_ux_support(b,a,g)},b.helpers.attempt_ud_ux_fetch.attempted[d]=!0,void a.getScript("http://cdn.usabilitydynamics.com/jquery.ud.date_selector.js",function(){"function"==typeof a.prototype.date_selector?b.helpers.attempt_ud_ux_fetch.success(e,d):b.helpers.attempt_ud_ux_fetch.fail(e,d)}).fail(function(){b.helpers.attempt_ud_ux_fetch.fail(e,d)}))},b.helpers.object_to_url="function"==typeof b.helpers.object_to_url?b.helpers.object_to_url:function(b){if(c("s.helpers.object_to_url()","helpers"),"object"!=typeof b)return"string"==typeof b?b:"";var d=a.map(b,function(b,c){return"string"==typeof b&&""!==b?b=b:"function"==typeof b.join?b=b.join(","):"object"==typeof b&&(b=a.map(b,function(a){return a}).join("-")),b?c+"="+b:void 0});return d.length?encodeURI(d.join("&")):""},b.helpers.url_to_object="function"==typeof b.helpers.url_to_object?b.helpers.url_to_object:function(b){c("s.helpers.url_to_object()","helpers");var d=b?b:decodeURI(window.location.hash.replace("#","")),e={};return a.each(d.split("&"),function(a,b){b&&(a=b.split("=")[0],b=b.split("=")[1],-1!==b.indexOf("-")?b={min:b.split("-")[0],max:b.split("-")[1]}:"string"==typeof b&&(b=[b]),e[a]=b)}),e},b.helpers.random_string="function"==typeof b.helpers.random_string?b.helpers.random_string:function(a,b){c("random_string()","helpers"),a="string"==typeof a?a:"",b="string"==typeof b?b:"abcdefghijklmnopqrstuvwxyz";for(var d=0;10>d;d++)a+=b.charAt(Math.floor(Math.random()*b.length));return a},b.helpers.purge="function"==typeof b.helpers.purge?b.helpers.purge:function(a){var c,d,e,f=a.attributes;if(f)for(c=f.length-1;c>=0;c-=1)e=f[c].name,"function"==typeof a[e]&&(a[e]=null);if(f=a.childNodes)for(d=f.length,c=0;d>c;c+=1)b.helpers.purge(a.childNodes[c])};var u=this.enable=function(){a(document).bind("dynamic_filter::doing_ajax",function(){c("doing_ajax","event_handlers"),a(b.ux.element).removeClass(b.classes.element.filter_pending),a(b.ux.element).removeClass(b.classes.element.server_fail),a(b.ux.element).addClass(b.classes.element.ajax_loading)}),a(document).bind("dynamic_filter::ajax_complete",function(){c("ajax_complete","event_handlers"),a(b.ux.element).removeClass(b.classes.element.ajax_loading)}),a(document).bind("dynamic_filter::get_data",function(a,b){c("get_data","event_handlers"),l(a,b)}),a(document).bind("dynamic_filter::instance::set",function(){b.settings.use_instances?b.instance.set():!1}),a(document).bind("dynamic_filter::get_data::complete",function(b,d){c("get_data::complete","event_handlers"),a(document).trigger("dynamic_filter::ajax_complete",d),m(b,d),d.silent_fetch||(n(b,d),j(b,d))}),a(document).bind("dynamic_filter::get_data::fail",function(){a(document).trigger("dynamic_filter::ajax_complete"),a(b.ux.element).addClass(b.classes.element.server_fail)}),a(document).bind("dynamic_filter::undo_last_query",function(){c("undo_last_query","event_handlers"),a(b.ux.element).removeClass(b.classes.element.server_fail),a(b.ux.element).removeClass(b.classes.element.ajax_loading),d("")}),a(document).bind("dynamic_filter::render_data",function(){c("render_data","event_handlers"),n()}),a(document).bind("dynamic_filter::render_data::complete",function(){c("render_data::complete","event_handlers")}),a(document).bind("dynamic_filter::execute_filters",function(){c("execute_filters","event_handlers"),o()}),a(document).bind("dynamic_filter::update_filters::complete",function(){c("update_filters::complete","event_handlers")}),a(document).bind("dynamic_filter::load_more",function(){c("load_more","event_handlers"),p()}),a(document).bind("dynamic_filter::onpopstate",function(){c("dynamic_filter::onpopstate","log","info")}),e(),f(),b.settings.use_instances?b.instance.load():!1,g(),i(),h(),b.settings.auto_request&&(b.settings.timers.initial_request&&c("Doing Initial Request with a "+b.settings.timers.initial_request+"ms pause.","log","info"),setTimeout(function(){a(document).trigger("dynamic_filter::get_data",{initial_request:!0})},b.settings.timers.initial_request))};return window.onpopstate=function(b){a(document).trigger("dynamic_filter::onpopstate",b)},u(),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.elastic_filter.js b/vendor/udx/lib-utility/scripts/jquery.ud.elastic_filter.js deleted file mode 100644 index 8e38959bb..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.elastic_filter.js +++ /dev/null @@ -1 +0,0 @@ -!new function(a){var b=window.ef_app=jQuery.extend(!0,this,{settings:{account_id:void 0,access_key:void 0,per_page:10,debug:!1,visual_debug:!1,url:"https://cloud.usabilitydynamics.com",index:""},documents:[],facets:[],sort_options:[],defaults:null,state:"loading",query:{full_text:null,field:[],terms:[],range:[],fuzzy:[],from:0},size:0,sort:null,bindings_initialized:[],total:null,message:"",elastic_ready:!1,session_id:null,global:window.__elastic_filter={},ready:function(){},_required:{io:"//ud-cdn.com/js/ud.socket/1.0.0/ud.socket.js","ko.mapping":"//ud-cdn.com/js/knockout.mapping/2.3.2/knockout.mapping.js",async:"//ud-cdn.com/js/async/1.0/async.js","ud.ko":"//ud-cdn.com/js/knockout.ud/1.0/knockout.ud.js","ud.select":"//ud-cdn.com/js/ud.select/3.2/ud.select.js","jq-lazyload":"//ud-cdn.com/js/jquery.lazyload/1.8.2/jquery.lazyload.js"},_log:{subscriptions:{},search:[],debug:[],profilers:{}}},a);b._document=function(a){return a},b._facet=function(a,c){var d=[];for(var e in a.terms)d.push({text:a.terms[e].term,id:a.terms[e].term});return a._label=c,a.options=ko.observableArray(d),a.value=ko.observable(),a.select_multiple=ko.observableArray(),a.select_multiple.subscribe(function(a){if(b.view_model.query.terms.remove(ko.utils.arrayFirst(b.view_model.query.terms(),function(a){return"undefined"!=typeof a[c]})),a.length){var d={};d[c]=a,b.view_model.query.terms.push(d)}b.view_model.size(parseInt(b.view_model.settings.per_page())),b.search_request()}),a.css_class=ko.computed(function(){var b="undefined"!=typeof a.options()?a.options().length:0,d=1==b?"eff_single_option":b?"eff_options_"+b:"eff_no_options";return d+" ef_facet_"+c.replace(" ","_")}),a},b.profile=function(a,c,d){if(b._log.profilers[a]&&c){var e=["Profiler",a,c,((new Date).getTime()-b._log.profilers[a])/1e3];return d&&e.push(d),b.log.apply(this,e)}return b._log.profilers[a]=(new Date).getTime(),this},b.log=function(){return"undefined"==typeof console?arguments?arguments:null:arguments[0]instanceof Error?(console.error("ElasticFilter Fatal Error:",arguments[0].message),arguments):(console.log(arguments),arguments?arguments:null)},b.debug=function(){return b._log.debug.push({time:(new Date).getTime(),data:arguments}),ko.utils.unwrapObservable(b.settings.debug)||arguments[0]instanceof Error?b.log.apply(this,arguments):arguments},b.init=function(){return c.back_support(),b.debug("init"),async.auto({binding_handlers:[function(a){return b.debug("init","auto","binding_handlers"),"object"!=typeof ko?a(new Error("Missing Knockout.")):"object"!=typeof io?a(b.debug(new Error("Missing Socket.io."))):(ko.bindingHandlers["elastic-filter"]={init:function(a,c){b.log("binding_handlers","elastic-filter","init"),ko.mapping.fromJS({settings:jQuery.extend(!0,{},b.settings,ko.utils.unwrapObservable(c()))},b.view_model),b.bindings_initialized.push("elastic-filter")}},ko.bindingHandlers["fulltext-search"]={init:function(a,c,d){return b.debug("binding_handlers","fulltext-search","init"),"undefined"==typeof jQuery().select2?new Error("Select2 library is required for Fulltext Search feature"):(jQuery(a).select2(c()),"undefined"!=typeof d().elastic_settings&&ko.mapping.fromJS({settings:d().elastic_settings},b.view_model),ko.utils.domNodeDisposal.addDisposeCallback(a,function(){jQuery(a).select2("destroy")}),void b.bindings_initialized.push("fulltext-search"))}},a(null,[ko.bindingHandlers]))}],observable:["binding_handlers",function(a){return b.debug("init","auto","observable"),b.view_model=ko.mapping.fromJS(b,{ignore:c.get_methods(b).concat("_log","_required","model_functions","facet_functions","document_functions","utils","success","global")}),ko.applyBindings(b.view_model),jQuery.extend(!0,b.view_model,b.facet_functions,b.document_functions),a(null,b)}],socket:["observable",function(a){return b.debug("init","auto","socket"),b.bindings_initialized.length?"undefined"==typeof b.view_model.settings.account_id||"undefined"==typeof b.view_model.settings.access_key?a(new Error("Empty credentials.")):void ud.socket.connect(ko.utils.unwrapObservable(b.view_model.settings.url),{resource:"websocket.api/1.5","account-id":ko.utils.unwrapObservable(b.view_model.settings.account_id),"access-key":ko.utils.unwrapObservable(b.view_model.settings.access_key)},function(c,d){return b.socket=d,c?a(c):(b.socket.once("reconnect",function(){b.debug(new Error("Reconnecting, re-initializing ElasticFilter.").arguments),b.init()}),b.view_model.session_id(b.socket.sessionid),a(null,b.socket))}):void 0}],settings:["socket",function(a){b.debug("init","auto","settings"),b.socket.request("get","api/v1/settings",function(c,d){return b.log("settings",d),c||!d?a(b.log(c||new Error("Request for index settings returned no results."))):(ko.mapping.fromJS({settings:d.settings},b.view_model),b.ready(),a(null,b.settings))})}],ready:["settings",function(a,c){b.debug("init","auto","ready",c),b.view_model.sort(ko.mapping.toJS(b.view_model.settings.defaults.sort)),b.view_model.size(parseInt(b.view_model.settings.per_page())),-1!==b.bindings_initialized.indexOf("elastic-filter")&&b.search_request(),b.view_model.elastic_ready(!0),a(null,b.view_model.elastic_ready())}]},b.initialized),this},b.search_request=function(a){b.profile("search_request");var d={index:b.view_model.settings.index(),query:jQuery.extend(!0,{match_all:{}},ko.mapping.toJS(b.view_model.query)),facets:ko.mapping.toJS(b.view_model.settings.facets),size:b.view_model.size(),sort:b.view_model.sort()};d=c.clean_object(d),b.computed_query=function(){return d},b.log("search_request_data","Data Before Send",d),b.view_model.state("loading"),b.socket.request("post","api/v1/search",d,function(c,d){b.last_response=function(){return d},b.profile("search_request","Have Cloud Response.",d),b.profile("search_request","Request Mapping Start.");var e=[];jQuery.each("undefined"!=typeof d.documents?d.documents:[],function(){e.push(arguments[1])}),b.view_model.documents(ko.utils.arrayMap(e,function(a){return new b._document(a)}));for(var f in"undefined"!=typeof d.meta.facets?d.meta.facets:{}){var g=!1;ko.utils.arrayForEach(b.view_model.facets(),function(a){f==a._label&&(g=!0)}),g||b.view_model.facets.push(new b._facet(d.meta.facets[f],f))}return b.view_model.total("undefined"!=typeof d.meta.total?d.meta.total:0),b.view_model.state("ready"),b.profile("search_request","Request Mapping Complete."),"function"==typeof a?a(c,d):d})},b.custom_search=function(a){b.profile("custom_search_start");var c={index:b.view_model.settings.index(),query:{query_string:{query:b.view_model.query.full_text()}},size:b.view_model.size(),sort:b.view_model.sort()};return b.socket.request("post","api/v1/search",c,a),b.profile("custom_search_end"),!0},b.get_json=function(){return JSON.parse(ko.mapping.toJSON(b.view_model))},b.initialized=function(a,c){return b.debug("initialized",arguments),b.initialization=b.log(a?"Initializaiton Failed.":"Initializaiton Done.",c?c:a),"function"==typeof b.ready&&b.ready(b,a,c),b.initialization},b.facet_functions={facet_after_render:function(){},facet_before_remove:function(a){ko.removeNode(a)},facet_after_add:function(){},facet_template:function(a){var c=[];switch(a&&a._type){case"terms":c.push("template-facet-terms")}return c.push("template-default-facet"),b.model_functions._get_template(c)},submit_facets:function(){b.debug("facet_functions","submit_facets"),b.view_model.size(parseInt(b.view_model.settings.per_page())),b.search_request()}},b.document_functions={document_after_render:function(){},document_before_remove:function(a){ko.removeNode(a)},document_after_add:function(){},document_template:function(){return b.model_functions._get_template(["template-default-document"])},sort_by:function(a,c){b.debug("document_functions","sort"),jQuery(c.target).trigger("sort",[a]);var d=jQuery(c.target).data("field"),e=ko.utils.arrayFirst(a.sort_options,function(a){return"undefined"!=typeof a[d]});if(b.view_model.sort()){var f="undefined"!=typeof b.view_model.sort()[d]?b.view_model.sort()[d]:!1;f&&(e[d].order="desc"==b.view_model.sort()[d].order?"asc":"desc")}b.view_model.sort(e),b.view_model.size(parseInt(b.view_model.settings.per_page())),b.search_request()},is_active_sort:function(a){return b.view_model.sort()&&"undefined"!=typeof b.view_model.sort()[a]?"active":"disabled"},have_more:function(){return b.debug("document_functions","have_more()"),b.have_more=ko.computed({owner:this,read:function(){return b.view_model.total()>b.view_model.documents().length?!0:!1}}),b.have_more()},load_more:function(){b.debug("document_functions","load_more()"),b.view_model.size(parseInt(b.view_model.size())+parseInt(b.view_model.settings.per_page())),b.search_request()}},b.model_functions={_get_template:function(a){for(i in a?a:[])if(document.getElementById(a[i]))return a[i];return a[0]},_remove_item:function(a,b){var c=this[a];ko.utils.arrayFirst(c,function(a){a&&parseInt(a.id)===parseInt(b)&&(c.remove(document),ko.utils.arrayRemoveItem(a))})}};var c=b.utilis={back_support:function(){Object.keys=Object.keys||function(){var a=Object.prototype.hasOwnProperty,b=!{toString:null}.propertyIsEnumerable("toString"),c=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],d=c.length;return function(e){if("object"!=typeof e&&"function"!=typeof e||null===e)throw new TypeError("Object.keys called on a non-object");var f=[];for(var g in e)a.call(e,g)&&f.push(g);if(b)for(var h=0;d>h;h++)a.call(e,c[h])&&f.push(c[h]);return f}}()},get_methods:function(a){var b=jQuery.map(a,function(a,b){return"function"==typeof a?b:void 0});return b},json_editor:function(){ud.load.js({JSONEditor:"http://ud-cdn.com/js/ud.json.editor.js"},function(){ud.load.css("http://ud-cdn.com/js/assets/ud.json.editor.css"),b.json_editor=new JSONEditor(jQuery(".elastic_json_editor").get(0),{indentation:2,search:!1,history:!1})})},contains:function(a,b){for(var c=0;c0&&i.lengthd.selection_limit&&a(c).removeAttr("checked"),b.helpers.update_inline_help(e.control_group,e);break;case"password":case"matching_passwords":var l;if(a.each(e.related_fields,function(b,c){l=a(c).val()}),""===g&&""===l){h.detail_log.push("Passwords are empty: "+g+" - "+l),e.status_code="error";break}if(g===l){h.detail_log.push("Passwords match: "+g+" - "+l),e.status_code="success",e.password_strength=Math.round(l.length/13*100),e.messages.success=a('
              Password Strength:
              '),b.helpers.update_inline_help(e.control_group,e);break}if(g!=l){h.detail_log.push("Passwords do not match: "+g+" - "+l),e.status_code="error";break}break;case"email":e.status_code=""==g?"blank":b.helpers.validate_email(g)?"success":"error";break;case"url":e.status_code=""==g?"blank":b.helpers.validate_url(g)?"success":"error";break;case"domain":e.status_code=""==g?"blank":b.helpers.validate_url(g,{use_http:!1})?"success":"error";break;case"address":if(""==g){e.status_code="blank";break}if("object"!=typeof google||"object"!=typeof google.maps)break;e.remote_request=!0,e.geocoder=e.geocoder?e.geocoder:new google.maps.Geocoder,e.clean_value=g.replace(/(\r\n|\n|\r)/gm," "),e.geocoder.geocode({address:e.clean_value},function(c){"object"==typeof c&&(a.each(c,function(a,b){"ROOFTOP"==b.geometry.location_type?(e.messages.success="Validated: "+b.formatted_address,e.status_code="success"):e.status_code="ZERO_RESULTS"==b.status?"error":"warning"}),b.helpers.update_inline_help(e.control_group,e),j(g,h,e))});break;case"ajax":if(!e.validation_ajax)break;e.remote_request=!0;var m=a.extend({},{action:e.validation_ajax,field_name:e.name,field_value:g,field_type:e.type},b.settings.ajax_url);a.ajax({url:b.settings.ajax_url,data:m,success:function(a){e.status_code="false"==a.success?"error":"success",e.messages[e.status_code]=a.message,k(e.control_group,e),h.detail_log.push(e.name+" - Custom Ajax Validation. Result: "+e.status_code),j(g,h,e)},dataType:"json"});break;case"pattern":var n=new RegExp(e.attributes.pattern,"g");""==g?e.status_code="blank":n.test(g)?e.status_code="success":(e.status_code="error",e.messages[e.status_code]="Please, match the requested format"+("undefined"!=typeof e.title?":"+e.title:""));break;case"not_empty":default:e.status_code=""==g?"blank":"success",e.status_code=""==g?"blank":"success"}e.remote_request||j(g,h,e)},j=this.finalize_field_validation=function(c,d,e){"blank"==e.status_code&&b.settings.error_on_blank&&(e.status_code="error"),d.detail_log.push("new status_code: "+e.status_code),a(e.input_element).attr("validation_status_code",e.status_code),a(e.control_group).attr("validation_status_code",e.status_code),e.form.form_helper_fields[e.name].status_code=e.status_code,e.validation_required&&("success"!=e.status_code&&d.detail_log.push("Field validation fail."),l(e.form).validation_fail?(a(e.form).addClass("validation_fail"),a(e.form).data("do_not_process",!0),d.detail_log.push("Form validation fail.")):(a(e.form).removeClass("validation_fail"),a(e.form).removeData("do_not_process"),d.detail_log.push("Form passed validation."))),f(d.detail_log,"dir"),(!e.initial_run||b.settings.validate_on_enable)&&k(e.control_group,e)},k=this.update_control_group_ui=function(c,d){f("update_control_group_ui()"),d.do_not_markup||(a.each(b.classes.status,function(b,d){a(c).removeClass(d)}),d.helpers&&(a("> ."+b.classes.helper_item,d.helpers).removeClass(b.classes.active_helper).addClass(b.classes.disabled_helper),a("."+d.status_code,d.helpers).removeClass(b.classes.disabled_helper).addClass(b.classes.active_helper)),a(c).addClass(b.classes.status[d.status_code]))},l=this.form_status=function(b){if(f("form_status()"),"object"!=typeof b.form_helper_fields)return f("form_status() - form.form_helper_fields is not an object, leaving."),{};var c={validation_fail:!1,failed_fields:[]};return a.each(b.form_helper_fields,function(a,b){"success"!=b.status_code&&(f("form_status() - Input Field failed validation: "+a),c.failed_fields.push(a))}),c.failed_fields.length?(f("form_status() - Form failed validation. Invalid fields: "+c.failed_fields.length),b.validation_fail=c.validation_fail=!0,b.failed_fields=c.failed_fields):f("form_status() - Form is valid. "),c};return"function"!=typeof b.helpers.update_inline_help&&(b.helpers.update_inline_help=function(c,d){f("helpers.update_inline_help()"),d.helpers||(d.helpers=a(b.class_selector.help_block,c)),d.helpers.length||a(d.type+":last",c).after(d.helpers=a('')),a.each(d.messages,function(c,e){var f=b.classes.status[c],g=a("span."+f,d.helpers);g.length||a(d.helpers).append(g=a("")),g.addClass(b.classes.helper_item),g.addClass(f),b.settings.auto_hide_helpers&&g.addClass(b.classes.disabled_helper),a(g).html(e)})}),"function"!=typeof b.helpers.css_class_query&&(b.helpers.css_class_query=function(b){var c=[];if("object"==typeof b||"array"==typeof b){var d=!1;if(a.each(b,function(b,e){return c.push(e),a.isNumeric(b)?void 0:void(d=!0)}),d)return b}else"string"==typeof b&&(c=b.split(" "));return("."+c.join(".")).replace(/\.\./g,".")}),"function"!=typeof b.helpers.remove_from_array&&(b.helpers.remove_from_array=function(b,c){return a.grep(c,function(a){return a!==b})}),"function"!=typeof b.helpers.validate_url&&(b.helpers.validate_url=function(b,c){return f("helpers.validate_url("+b+")"),c=a.extend({use_http:!0},c),c.use_http?/^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/i.test(b):/^[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/i.test(b)}),"function"!=typeof b.helpers.validate_email&&(b.helpers.validate_email=function(a){f("helpers.validate_email("+a+")");var b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return b.test(a)}),b.settings.auto_enable&&g(),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.smart-buttons.js b/vendor/udx/lib-utility/scripts/jquery.ud.smart-buttons.js deleted file mode 100644 index 10ad4d181..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.smart-buttons.js +++ /dev/null @@ -1 +0,0 @@ -!function(a){a.fn.smart_dom_button=function(b){var c=a.extend({debug:!1,action_attribute:"action_attribute",response_container:"response_container",ajax_action:"action",label_attributes:{process:"processing_label",revert_label:"revert_label",verify_action:"verify_action"}},b);return log=function(a,b){c.debug&&window.console&&console.debug&&("error"==b?console.error(a):console.log(a))},get_label=function(b){var c=a(b).get(0).tagName,d="";switch(c){case"SPAN":d=a(b).text();break;case"INPUT":d=a(b).val()}return d},set_label=function(b,c){switch(c.type){case"SPAN":a(c.button).text(b);break;case"INPUT":a(c.button).val(b)}return b},do_execute=function(b){var d={button:b,type:a(b).get(0).tagName,original_label:a(b).attr("original_label")?a(b).attr("original_label"):get_label(b)};c.wrapper&&a(d.button).closest(c.wrapper).length?(d.wrapper=a(d.button).closest(c.wrapper),d.use_wrapper=!0):(d.wrapper=d.button,d.use_wrapper=!1),d.the_action=a(d.wrapper).attr(c.action_attribute)?a(d.wrapper).attr(c.action_attribute):!1,c.label_attributes.processing&&a(d.wrapper).attr(c.label_attributes.processing)&&(d.processing_label=a(d.wrapper).attr(c.label_attributes.processing)?a(d.wrapper).attr(c.label_attributes.processing):!1),c.label_attributes.verify_action&&a(d.wrapper).attr(c.label_attributes.verify_action)&&(d.verify_action=a(d.wrapper).attr(c.label_attributes.verify_action)?a(d.wrapper).attr(c.label_attributes.verify_action):!1),c.label_attributes.revert_label&&a(d.wrapper).attr(c.label_attributes.revert_label)&&(d.revert_label=a(d.wrapper).attr(c.label_attributes.revert_label)?a(d.wrapper).attr(c.label_attributes.revert_label):!1,a(d.wrapper).attr("original_label")||(d.original_label=get_label(d.button),a(d.wrapper).attr("original_label",d.original_label))),d.the_action&&(!d.verify_action||confirm(d.verify_action))&&(d.use_wrapper&&(a(c.response_container,d.wrapper).length||a(d.wrapper).append(''),d.response_container=a(".response_container",d.wrapper),a(d.response_container).removeClass(),a(d.response_container).addClass("response_container"),d.processing_label&&a(d.response_container).html(d.processing_label)),"ui"==d.the_action?(d.revert_label&&(get_label(d.button)==d.revert_label?set_label(d.original_label,d):set_label(d.revert_label,d)),a(d.wrapper).attr("toggle")&&a(a(d.wrapper).attr("toggle")).toggle(),a(d.wrapper).attr("show")&&a(a(d.wrapper).attr("show")).show(),a(d.wrapper).attr("hide")&&a(a(d.wrapper).attr("hide")).hide()):a.post(ajaxurl,{action:c.ajax_action,the_action:d.the_action},function(b){if(b&&b.success){a(d.response_container).show(),b.css_class&&a(d.response_container).addClass(b.css_class),b.remove_element&&a(b.remove_element).length&&a(b.remove_element).remove(),a(d.response_container).html(b.message);var c;a(d.response_container).mouseover(function(){c=setTimeout(function(){a(d.response_container).fadeOut("slow",function(){a(d.response_container).remove()})},1e4)}).mouseout(function(){clearTimeout(c)})}},"json"))},a(this).click(function(){log("Button triggered."),do_execute(this)}),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.social.js b/vendor/udx/lib-utility/scripts/jquery.ud.social.js deleted file mode 100644 index ac85c3d17..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.social.js +++ /dev/null @@ -1 +0,0 @@ -!function(a){"use strict";a.fn.social=function(b){b=a.extend({element:this,networks:{linkedin:{profile_fields:{id:"network_id",firstName:"first_name",lastName:"last_name",pictureUrl:"user_image",headline:"headline",industry:"industry",summary:"summary",specialties:"specialties",location:"location",associations:"associations",certifications:"certifications",educations:"educations",skills:"skills",patents:"patents",honors:"honors",proposalComments:"proposal_comments","three-current-positions":"current_positions","recommendations-received":"recommendations","main-address":"primary_address","member-url-resources":"url_resources","phone-numbers":"phone_number","public-profile-url":"profile_url","im-accounts":"im_accounts"}}},user_data:{},debug:!0},b);{var c=this.log=function(a,c){b.debug&&window.console&&console.debug&&("error"===c?console.error(a):console.log(a))},d=this.handle_linkedin=function(){c("handle_linkedin()"),b.networks.linkedin.active=!0,"undefined"!=typeof IN.Event&&(a(".linkedin_asset").show(),IN.Event.on(IN,"auth",function(){c("IN.Event::auth ");var d=[];a.each(b.networks.linkedin.profile_fields,function(a){d.push(a)}),IN.API.Profile("me").fields(d).result(function(d){c("IN.API.Profile()"),a.each(d.values[0],function(a,c){var d=b.networks.linkedin.profile_fields[a];if("undefined"!=typeof d&&""!=c){switch(a){case"location":c=c.name}b.user_data[d]=c}}),b.user_data.display_name=b.user_data.first_name+" "+b.user_data.last_name,b.user_data&&a(".linked_in_login").html('

              '+("string"==typeof b.user_data.user_image?'':"")+'Hello, '+b.user_data.first_name+"! "+("string"==typeof b.user_data.headline?''+b.user_data.headline+"":"")+("string"==typeof b.user_data.industry?''+b.user_data.industry+"":"")+"

              "),a(document).trigger("social::user_data_update",b.user_data)}),a(document).bind("social::user_logout",function(){"object"==typeof IN&&"undefined"!=typeof IN.User&&IN.User.logout()})}))};this.user_logout=function(){a(document).trigger("social::user_logout")},this.enable=function(){c("social::enable()"),"object"==typeof IN&&d()}}return this.enable(),this}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ud.super-search.js b/vendor/udx/lib-utility/scripts/jquery.ud.super-search.js deleted file mode 100644 index ebc17ace9..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ud.super-search.js +++ /dev/null @@ -1 +0,0 @@ -!function(a){a.fn.super_search=function(b){var c,d,e=this,f={},g={},h={current:"",previous:""};this.attr("ss_element","search_input");var i=a.extend({action:"super_search",ajax_url:ajaxurl,input_classes:{no_results:"ss_no_results",processing:"ss_processing",error:"ss_error"},response_classes:{response_wrapper:"ss_response_container",show_scroll:"ss_show_scroll",item_class:""},append_to:a(e).parent(),search_trigger:!1,search_result_gap:200,limit:5,timers:{abandonment:1e3,search_entry:2e3},async:!1,debug:!0,success:!1,beforeSend:!1,ui:{}},b);"function"!=typeof i.log&&(i.log=function(a){i.debug&&console.log(a)}),a(i.append_to).length||i.log("The ("+i.append_to+") element does not exist.","warning"),i.search_trigger&&"object"==typeof i.search_trigger&&a(i.search_trigger).click(function(){h.current!=h.previous&&a.fn.super_search.do_search()}),this.keyup(function(){return h.current=e.val(),d&&!h.current?void clearTimeout(d):void(h.current!=h.previous&&(d&&clearTimeout(d),d=setTimeout(a.fn.super_search.do_search,i.timers.search_entry)))}),this.focus(function(){a.fn.super_search.ux_change()}),this.blur(function(){a.fn.super_search.ux_change()}),a.fn.super_search.do_search=function(){i.log("do_search()"),h.current=e.val();var b={action:i.action,limit:i.limit,query:h.current};cb_data={post_data:b,settings:i},a.each(i.input_classes,function(b,c){a(e).removeClass(c)}),a(e).addClass(i.input_classes.processing),a.ajax({url:i.ajax_url,async:i.async,data:b,beforeSend:function(a,b){i.log("do_search.beforeSend() - have callback, executing"),cb_data.settings=b,"function"==typeof i.beforeSend&&i.beforeSend.call(this,cb_data)},complete:function(b,c){i.log("do_search.complete( jqXHR, "+c+" )"),a(e).removeClass(i.input_classes.processing),i.log("Ajax response received.")},success:function(b,c,d){i.log("do_search.success()"),"function"==typeof i.success&&(i.log("do_search.success() - have callback, executing"),i.success.call(b,c,d))||(h.previous=h.current,a.fn.super_search.remove_rendered_results(),b.results?(i.last_results=b.results,a.fn.super_search.render_results(b.results)):a(e).addClass(i.input_classes.no_results),b.other&&i.log("Search Debug Data:".data.debug_response))},error:function(){i.log("do_search.error()"),a(e).addClass(i.input_classes.error)},dataType:"json"})},a.fn.super_search.remove_rendered_results=function(){i.log("remove_rendered_results()"),i.rendered_element&&i.rendered_element.length&&a(i.rendered_element).fadeOut(300,function(){}),a.fn.super_search.update_dom_triggers()},a.fn.super_search.update_dom_triggers=function(){i.log("update_dom_triggers()"),a(i.rendered_element).off("mouseenter"),a(i.rendered_element).off("mouseleave"),a(i.rendered_element).mouseenter(function(){g.results_over=!0,a.fn.super_search.ux_change()}).mouseleave(function(){g.results_over=!1,a.fn.super_search.ux_change()})},a.fn.super_search.ux_change=function(){i.log("ux_change()"),a(e).is(":focus")?(g.input_focus=!0,h.current==h.previous&&i.rendered_element&&i.rendered_element.show()):g.input_focus=!1,i.rendered_element&&!g.input_focus&&g.results_over===!1?c=setTimeout(a.fn.super_search.remove_rendered_results,i.timers.abandonment):c&&clearTimeout(c)},a.fn.super_search.render_results=function(b){i.log("render_results()");var c=b.length-1;html=[],html.push(i.ui.response_container='
                '),console.log(i.ui.response_container),a.each(b,function(a,b){var d=[];i.response_classes.item_class&&d.push(i.response_classes.item_class),b.item_class&&d.push(b.item_class),a==c&&d.push("last_item"),html.push('
              • '),b.url&&html.push(''),html.push(b.title),b.url&&html.push(""),html.push("
              • ")}),html.push("
              "),i.rendered_element=a(html.join("")),a(i.append_to).append(i.rendered_element),f.window_height=a(window).height(),f.rendered_element=a(i.rendered_element).height(),f.rendered_element+i.search_result_gap>f.window_height&&(a(i.rendered_element).css("max-height",f.window_height-i.search_result_gap+"px"),a(i.rendered_element).addClass(i.response_classes.show_scroll),f.rendered_element=a(i.rendered_element).height()),a.fn.super_search.update_dom_triggers()}}}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/jquery.ui.progressbar.js b/vendor/udx/lib-utility/scripts/jquery.ui.progressbar.js deleted file mode 100644 index e2ef8d8d1..000000000 --- a/vendor/udx/lib-utility/scripts/jquery.ui.progressbar.js +++ /dev/null @@ -1 +0,0 @@ -!function(a,b){a.widget("ui.progressbar",{options:{value:0,max:100},min:0,_create:function(){this.element.addClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").attr({role:"progressbar","aria-valuemin":this.min,"aria-valuemax":this.options.max,"aria-valuenow":this._value()}),this.valueDiv=a("
              ").appendTo(this.element),this.oldValue=this._value(),this._refreshValue()},destroy:function(){this.element.removeClass("ui-progressbar ui-widget ui-widget-content ui-corner-all").removeAttr("role").removeAttr("aria-valuemin").removeAttr("aria-valuemax").removeAttr("aria-valuenow"),this.valueDiv.remove(),a.Widget.prototype.destroy.apply(this,arguments)},value:function(a){return a===b?this._value():(this._setOption("value",a),this)},_setOption:function(b,c){"value"===b&&(this.options.value=c,this._refreshValue(),this._value()===this.options.max&&this._trigger("complete")),a.Widget.prototype._setOption.apply(this,arguments)},_value:function(){var a=this.options.value;return"number"!=typeof a&&(a=0),Math.min(this.options.max,Math.max(this.min,a))},_percentage:function(){return 100*this._value()/this.options.max},_refreshValue:function(){var a=this.value(),b=this._percentage();this.oldValue!==a&&(this.oldValue=a,this._trigger("change")),this.valueDiv.toggleClass("ui-corner-right",a===this.options.max).width(b.toFixed(0)+"%"),this.element.attr("aria-valuenow",a)}}),a.extend(a.ui.progressbar,{version:"1.8.10"})}(jQuery); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/analysis.client.js b/vendor/udx/lib-utility/scripts/src/analysis.client.js deleted file mode 100644 index 285d2b123..000000000 --- a/vendor/udx/lib-utility/scripts/src/analysis.client.js +++ /dev/null @@ -1,205 +0,0 @@ -/** - * ElasticSearch Analysis Client - * - * @todo Switch to vanilla version of elasticsearch to avoid dependency and resolve shim issue. - */ -define( 'analysis.client', [ 'jquery.elasticsearch', 'analysis.visualizer' ], function() { - console.debug( 'analysis.client', 'loaded' ); - - var options = {}; - var client; - - /** - * Get Current Client - * - * @returns {*|jQuery.es.Client} - */ - function getClient() { - return client || createClient(); - } - - /** - * Create Client Instance - * - * @returns {tinylr.Client} - */ - function createClient( host, index, type ) { - - options = { - host: host, - index: index, - type: type - }; - - return client = new jQuery.es.Client({ - hosts: host - }); - - } - - /** - * Parse Response - * - * @param error - * @param res - */ - function parseResponse( error, res ) { - console.debug( 'parseResponse', error, res ); - console.log( res.hits.hits ); - } - - /** - * Get Mapping - * - * @param query - * @param handleResponse - * @returns {*|Promise} - */ - function getMapping( query, handleResponse ) { - console.debug( 'getMapping', typeof handleResponse ); - - var request = { - index: options.index || 'deafult', - type: options.type || 'profile' - }; - - return getClient().indices.getMapping( request ).then( function parseResponse( res ) { - - if( 'function' === typeof handleResponse ) { - handleResponse.call( null, res[ 'jezf-truq-qgox-hfxp' ].mappings[ 'profile' ] || {}, request ) - } - - }); - - } - - function getSuggestion( query, handleResonse ) { - console.debug( 'getResults', typeof handleResponse ); - - var request = { - index: options.index || 'deafult', - type: options.type || 'profile', - from: 0, - size: 0, - body: query - }; - - return getClient().suggest( request ).then( function parseResponse( res ) { - console.debug( 'getSuggestion', 'parseResponse', typeof res ); - - if( 'function' === typeof handleResponse ) { - handleResponse.call( null, null, res, 'suggest', request ) - } - - }); - } - - /** - * Get Type Mapping - * - * @param query - * @param handleResponse - * @returns {*|Promise} - */ - function getMeta( query, handleResponse ) { - console.debug( 'getMeta', typeof handleResponse ); - - var request = { - index: options.index || 'deafult', - type: options.type || 'profile', - }; - - return getClient().indices.getMapping( request ).then( function parseResponse( res ) { - - if( 'function' === typeof handleResponse ) { - handleResponse.call( null, res[ 'jezf-truq-qgox-hfxp' ].mappings[ options.type ]._meta || {}, 'meta', request ) - } - - }); - - } - - /** - * Get Facets - * - * @param query - * @param facets - * @param handleResponse - * @returns {*|Promise} - */ - function getFacets( query, facets, handleResponse ) { - console.debug( 'getFacets', typeof handleResponse ); - - var request = { - index: options.index || 'deafult', - type: options.type || 'profile', - from: 0, - size: 0, - body: { - query: { - filtered: { - query: query - } - }, - facets: facets - } - }; - - return getClient().search( request ).then( function parseResponse( res ) { - - if( 'function' === typeof handleResponse ) { - handleResponse.call( null, null, res.facets, 'facets', request ) - } - - }).then( function handleError( error ) { - console.debug( 'handleError', arguments ); - - if( 'function' === typeof handleResponse ) { - handleResponse.call( error, null, {}, 'facets', request ) - } - - }); - - } - - /** - * Get Search - * - * @param query - * @param handleResponse - * @returns {*|Promise} - * @constructor - */ - function getResults( query, handleResponse ) { - console.debug( 'getResults', typeof handleResponse ); - - var request = { - index: options.index || 'deafult', - type: options.type || 'profile', - from: 0, - size: 0, - body: query - }; - - return getClient().search( request ).then( function parseResponse( res ) { - console.debug( 'getResults', 'parseResponse', typeof res ); - - if( 'function' === typeof handleResponse ) { - handleResponse.call( null, null, res, 'search', request ) - } - - }); - - } - - return { - client: getClient, - createClient: createClient, - getSuggestion: getSuggestion, - getMeta: getMeta, - getMapping: getMapping, - getFacets: getFacets, - getResults: getResults - }; - -}); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/analysis.visualizer.js b/vendor/udx/lib-utility/scripts/src/analysis.visualizer.js deleted file mode 100644 index ef5ad4387..000000000 --- a/vendor/udx/lib-utility/scripts/src/analysis.visualizer.js +++ /dev/null @@ -1,194 +0,0 @@ -/** - * - * - * @todo Consider adding udx.fleck for fixing strings for view. - * - * require( 'analysis.visualizer' )._cached - * - */ -define( 'analysis.visualizer', [ 'http://www.google.com/jsapi/' ], function() { - console.debug( 'analysis.visualizer' ); - - /** - * Google Visualization Library Loaded - */ - function googleVisualizationReady() { - console.debug( 'analysis.visualizer', 'googleVisualizationReady' ); - } - - google.load( 'visualization', '1', { - packages: [ 'geochart', 'corechart', 'table' ], - callback: googleVisualizationReady - }); - - var instance = this; - - var _cached = {}; - - /** - * Get Client Location from Google JS-API - * - * @returns {*} - */ - function clientLocation() { - console.debug( 'analysis.visualizer', 'clientLocation', google.loader.ClientLocation ); - return google.loader.ClientLocation; - } - - /** - * Convert Term to Label - * - * @param key - * @returns {*} - */ - function termLabel( key ) { - - var labels = { - raleigh: 'Raleigh', - port: 'New Port', - new: 'Wilmington', - west: 'West River', - lake: 'Lake', - south: 'South Raleigh', - north: 'North Raleigh', - est: 'Eastern', - east: 'East Brook', - wilfred: 'Wilfred', - zena: 'Durham', - en_us: 'English', - twitter: 'Twitter', - facebook: 'Facebook', - male: 'Male', - female: 'Female' - }; - - return labels[ key ] || key; - - } - - /** - * Render Piegraph - * - * @param title - * @param data - * @returns {*} - */ - function Pie( title, data ) { - console.debug( 'Pie' ); - - var parsedData = google.visualization.arrayToDataTable( data ); - - var element = jQuery( '
              ' ); - - jQuery( '.query-result' ).append( element ); - - new google.visualization.PieChart( element.get( 0 ) ).draw(parsedData, { - title: title - }); - - _cached[ title ] = { - title: title, - element: element - }; - - return instance; - - } - - /** - * Render Regional Map. - * - * @param title - * @param data - * @returns {*} - */ - function Map( title, data ) { - console.debug( 'Map' ); - - var parsedData = google.visualization.arrayToDataTable( data.raw ); - - var element = jQuery( '
              ' ); - jQuery( '.query-result' ).append( element ); - - new google.visualization.GeoChart( element.get( 0 ) ).draw( parsedData, { - region: 'US', - displayMode: 'regions', - resolution: 'provinces', - enableRegionInteractivity: true - }); - - _cached[ title ] = { - title: title, - element: element - }; - - return instance; - - } - - /** - * Render Table. - * - * @param title - * @param data - * @returns {*} - * @constructor - */ - function Table( title, data ) { - console.debug( 'Table', data ); - - var parsedData = new google.visualization.DataTable(); - - if( 'object' !== typeof data ) { - // data = {}; - } - - var total = data.total; - var terms = data.terms || []; - - parsedData.addColumn( 'string', 'Metric' ); - parsedData.addColumn( 'number', 'Percentage' ); - parsedData.addColumn( 'number', 'Count' ); - - terms.forEach( function( item ) { - - parsedData.addRows([ [ - termLabel( item.term ), - { - v: Math.round( ( item.count / total ) * 100 ), - f: ( Math.round( ( item.count / total ) * 100 ) ) + '%' - }, - { - v: item.count - } - ] ]); - - }); - - - var element = jQuery( '
              ' ); - jQuery( '.query-result' ).append( element ); - - new google.visualization.Table( element.get( 0 ) ).draw( parsedData, { - showRowNumber: false, - pageSize: 5 - }); - - _cached[ title ] = { - title: title, - element: element - }; - - return instance; - - } - - return { - Map: Map, - Table: Table, - Pie: Pie, - _cached: _cached - } - -}); - diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.buttons.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.buttons.js deleted file mode 100644 index bc5dbccbe..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.buttons.js +++ /dev/null @@ -1,260 +0,0 @@ -/* ========================================================= - * jquery-smart-dom-buttons.js v1.0 - * http://usabilitydynamics.com - * ========================================================= - * Copyright 2011 Usability Dynamics, Inc. - * - * Version 0.0.5 - * - * Copyright (c) 2011 Usability Dynamics, Inc. (usabilitydynamics.com) - * ========================================================= */ - -(function( jQuery ){ - - /** - * Handle AJAX Actions and UI actions - * - * {missing detailed description} - * - * @author potanin@UD - * @version 0.2.2 - */ - jQuery.fn.smart_dom_button = function( settings ) { - - /* Set Settings */ - var s = jQuery.extend({ - debug: false, - action_attribute: 'action_attribute', - response_container: 'response_container', - ajax_action: 'action', - label_attributes: { - process: 'processing_label', - revert_label: 'revert_label', - verify_action: 'verify_action' - } - }, settings); - - /* Internal logging function */ - log = function(something, type) { - - if(!s.debug) { - return; - } - - if(window.console && console.debug) { - - if (type == 'error') { - console.error(something); - } else { - console.log(something); - } - - } - - }; - - - /** - * Gets label for the type of element - * - */ - get_label = function( this_button ) { - - var type = jQuery(this_button).get(0).tagName; - var label = ''; - - switch (type) { - - case 'SPAN': - label = jQuery(this_button).text(); - break; - - case 'INPUT': - label = jQuery(this_button).val(); - break; - - } - - return label; - - } - - - /** - * Sets the label for the type - * - */ - set_label = function( label, a ) { - - switch (a.type) { - - case 'SPAN': - jQuery(a.button).text(label); - break; - - case 'INPUT': - jQuery(a.button).val(label); - break; - - } - - return label; - - } - - - /** - * Execute an action for the button - * - * @todo Improve ajax response handling, to include hiding response element on error. - * - */ - do_execute = function( this_button ) { - - /* Array of all settings specific to the current button */ - var a = { - button: this_button, - type: jQuery(this_button).get(0).tagName, - original_label: jQuery(this_button).attr('original_label') ? jQuery(this_button).attr('original_label') : get_label(this_button) - }; - - /* Get wrapper if used and exists */ - if(s.wrapper && jQuery(a.button).closest(s.wrapper).length) { - a.wrapper = jQuery(a.button).closest(s.wrapper); - a.use_wrapper = true; - } else { - a.wrapper = a.button; - a.use_wrapper = false; - } - - /* Determine action */ - a.the_action = jQuery(a.wrapper).attr(s.action_attribute) ? jQuery(a.wrapper).attr(s.action_attribute) : false; - - /* Get labels */ - if(s.label_attributes.processing && jQuery(a.wrapper).attr(s.label_attributes.processing)) { - a.processing_label = jQuery(a.wrapper).attr(s.label_attributes.processing) ? jQuery(a.wrapper).attr(s.label_attributes.processing) : false; - } - - if(s.label_attributes.verify_action && jQuery(a.wrapper).attr(s.label_attributes.verify_action)) { - a.verify_action = jQuery(a.wrapper).attr(s.label_attributes.verify_action) ? jQuery(a.wrapper).attr(s.label_attributes.verify_action) : false; - } - - /* Set original label only if a revert label exists */ - if(s.label_attributes.revert_label && jQuery(a.wrapper).attr(s.label_attributes.revert_label)) { - a.revert_label = jQuery(a.wrapper).attr(s.label_attributes.revert_label) ? jQuery(a.wrapper).attr(s.label_attributes.revert_label) : false; - - /* Set original label if not already set */ - if(!jQuery(a.wrapper).attr('original_label')) { - a.original_label = get_label(a.button); - jQuery(a.wrapper).attr('original_label', a.original_label); - } - - } - - /* If no action found, we leave */ - if(!a.the_action) { - return; - } - - if(a.verify_action) { - if(!confirm(a.verify_action)) { - return; - } - } - - /* Create a response container if we are using a wrapper */ - if(a.use_wrapper) { - - if(!jQuery(s.response_container, a.wrapper).length) { - jQuery(a.wrapper).append(''); - } - - a.response_container = jQuery('.response_container', a.wrapper); - - /* Unset all classes */ - jQuery(a.response_container).removeClass(); - jQuery(a.response_container).addClass('response_container'); - - if(a.processing_label) { - jQuery(a.response_container).html(a.processing_label); - } - - } - - /* Check if this is a UI action first, otherwise use AJAX */ - if(a.the_action == 'ui') { - - /* If a revert label exists, we toggle them */ - if(a.revert_label) { - - if(get_label(a.button) == a.revert_label) { - set_label(a.original_label, a); - - } else { - set_label(a.revert_label, a); - - } - - } - - if(jQuery(a.wrapper).attr('toggle')) { - jQuery(jQuery(a.wrapper).attr('toggle')).toggle(); - } - - if(jQuery(a.wrapper).attr('show')) { - jQuery(jQuery(a.wrapper).attr('show')).show(); - } - - if(jQuery(a.wrapper).attr('hide')) { - jQuery(jQuery(a.wrapper).attr('hide')).hide(); - } - - } else { - - jQuery.post(ajaxurl, { - _wpnonce: flawless_admin.actions_nonce, - action: s.ajax_action, - the_action: a.the_action - }, function (result) { - - if(result && result.success) { - jQuery(a.response_container).show(); - - if(result.css_class) { - jQuery(a.response_container).addClass(result.css_class); - } - - if(result.remove_element && jQuery(result.remove_element).length) { - jQuery(result.remove_element).remove(); - } - - jQuery(a.response_container).html(result.message); - - setTimeout(function() { - - jQuery(a.response_container).fadeOut('slow', function() { - jQuery(a.response_container).remove(); - }); - - }, 10000); - - } - - }, 'json'); - - - } - - } - - - jQuery( this ).click(function() { - log("Button triggered."); - do_execute( this ); - }); - - - return this; - - }; -}) ( jQuery ); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.date-selector.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.date-selector.js deleted file mode 100644 index 49bd2cca3..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.date-selector.js +++ /dev/null @@ -1,1175 +0,0 @@ -/** ========================================================= - * jquery.ud.date_selector.js v0.1.1 - * http://usabilitydynamics.com - * ========================================================= - * - * Commercial use requires one-time license fee - * http://usabilitydynamics.com/licenses - * - * Copyright © 2012 Usability Dynamics, Inc. (usabilitydynamics.com) - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * TO DO: - * - Convert all data to be stored in JS object, not in DOM. - * - Add validation and better converion for date formats to setDate(); - * - * - * - * ========================================================= */ - -/*jslint devel: true, undef: true, browser: true, continue: true, unparam: true, debug: true, eqeq: true, vars: true, white: true, newcap: true, plusplus: true, maxerr: 50, indent: 2 */ -/*global window */ -/*global console */ -/*global clearTimeout */ -/*global setTimeout */ -/*global jQuery */ - - -(function (jQuery) { - "use strict"; - - jQuery.prototype.date_selector = function ( default_options ) { - - var s = { - element: this, - cache: {} - }; - - /** Merge Custom Settings with Defaults */ - s.options = jQuery.extend( true, { - flat: false, - starts: 1, - prev: '◀', - next: '▶', - lastSel: false, - mode: 'single', - view: 'days', - calendars: 1, - format: 'Y-m-d', - position: 'bottom', - eventName: 'click', - onRender: function () { - return {}; - }, - onChange: function () { - return true; - }, - onShow: function () { - return true; - }, - onBeforeShow: function () { - return true; - }, - locale: { - days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"], - daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"], - daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"], - months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], - monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], - weekMin: 'wk' - }, - views: { - years: 'date_selector_view_years', - moths: 'date_selector_view_months', - days: 'date_selector_view_days' - }, - template: { - wrapper: '
              ', - head: [ - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '', - '
              <%=prev%><%=next%>
              <%=week%><%=day1%><%=day2%><%=day3%><%=day4%><%=day5%><%=day6%><%=day7%>
              '], - space: '
              ', - days: ['', '', '<%=weeks[0].week%>', '<%=weeks[0].days[0].text%>', '<%=weeks[0].days[1].text%>', '<%=weeks[0].days[2].text%>', '<%=weeks[0].days[3].text%>', '<%=weeks[0].days[4].text%>', '<%=weeks[0].days[5].text%>', '<%=weeks[0].days[6].text%>', '', '', '<%=weeks[1].week%>', '<%=weeks[1].days[0].text%>', '<%=weeks[1].days[1].text%>', '<%=weeks[1].days[2].text%>', '<%=weeks[1].days[3].text%>', '<%=weeks[1].days[4].text%>', '<%=weeks[1].days[5].text%>', '<%=weeks[1].days[6].text%>', '', '', '<%=weeks[2].week%>', '<%=weeks[2].days[0].text%>', '<%=weeks[2].days[1].text%>', '<%=weeks[2].days[2].text%>', '<%=weeks[2].days[3].text%>', '<%=weeks[2].days[4].text%>', '<%=weeks[2].days[5].text%>', '<%=weeks[2].days[6].text%>', '', '', '<%=weeks[3].week%>', '<%=weeks[3].days[0].text%>', '<%=weeks[3].days[1].text%>', '<%=weeks[3].days[2].text%>', '<%=weeks[3].days[3].text%>', '<%=weeks[3].days[4].text%>', '<%=weeks[3].days[5].text%>', '<%=weeks[3].days[6].text%>', '', '', '<%=weeks[4].week%>', '<%=weeks[4].days[0].text%>', '<%=weeks[4].days[1].text%>', '<%=weeks[4].days[2].text%>', '<%=weeks[4].days[3].text%>', '<%=weeks[4].days[4].text%>', '<%=weeks[4].days[5].text%>', '<%=weeks[4].days[6].text%>', '', '', '<%=weeks[5].week%>', '<%=weeks[5].days[0].text%>', '<%=weeks[5].days[1].text%>', '<%=weeks[5].days[2].text%>', '<%=weeks[5].days[3].text%>', '<%=weeks[5].days[4].text%>', '<%=weeks[5].days[5].text%>', '<%=weeks[5].days[6].text%>', '', ''], - months: ['', '', '<%=data[0]%>', '<%=data[1]%>', '<%=data[2]%>', '<%=data[3]%>', '', '', '<%=data[4]%>', '<%=data[5]%>', '<%=data[6]%>', '<%=data[7]%>', '', '', '<%=data[8]%>', '<%=data[9]%>', '<%=data[10]%>', '<%=data[11]%>', '', ''] - } - }, default_options ); - - - /** - * Logging Function. - * - * @since 0.1 - * @author potanin@UD - */ - s.log = typeof s.log === 'function' ? s.log : function (notice, type, console_type, override_debug) { - //console.log('DP:: ' + notice); - }; - - - /** - * Primary Initializer. - * - * @since 0.1 - * @author potanin@UD - */ - s.initialize = typeof s.initialize === 'function' ? s.initialize : function () { - s.log('s.initialize()', 'function'); - - s.extendDate( s.options.locale ); - s.options.calendars = Math.max(1, parseInt(s.options.calendars, 10) || 1); - s.options.mode = /single|multiple|range/.test(s.options.mode) ? s.options.mode : 'single'; - - /* Cycle through each container and identify related calendar elements */ - return s.element.each( function ( index, this_wrapper ) { - var id = 'date_selector_' + parseInt(Math.random() * 1000), this_calendar, count; - - /* If this element alreay has options saved to data, we do nothing */ - if( jQuery( s.element ).data('date_selector_initialized') ) { - s.log('s.initialize() - DOM element already initialized, skipping.', 'function'); - return; - } - - if( !s.options.date ) { - s.options.date = new Date(); - } - - if ( s.options.date.constructor === String ) { - s.options.date = parseDate(s.options.date, s.options.format); - s.options.date.setHours(0, 0, 0, 0); - } - - if (s.options.mode != 'single') { - if ( s.options.date.constructor != Array ) { - s.options.date = [s.options.date.valueOf()]; - if (s.options.mode === 'range') { - s.options.date.push(((new Date(s.options.date[0])).setHours(23, 59, 59, 0)).valueOf()); - } - } else { - for (var i = 0; i < s.options.date.length; i++) { - s.options.date[i] = (parseDate(s.options.date[i], s.options.format).setHours(0, 0, 0, 0)).valueOf(); - } - if (s.options.mode === 'range') { - s.options.date[1] = ((new Date(s.options.date[1])).setHours(23, 59, 59, 0)).valueOf(); - } - } - } else { - s.options.date = s.options.date.valueOf(); - } - - if (!s.options.current) { - s.options.current = new Date(); - } else { - s.options.current = parseDate(s.options.current, s.options.format); - } - - s.options.current.setDate(1); - s.options.current.setHours(0, 0, 0, 0); - - s.options.id = id; - - jQuery( this_wrapper ).data('date_selector_id', s.options.id); - - /* Attach to mousedown so propagadtion can be stopped early enough when the calendar is being interacted with */ - this_calendar = jQuery( s.options.template.wrapper ).attr( 'id' , id ).bind( 'mousedown', click ).data('date_selector', s.options); - - if (s.options.className) { - this_calendar.addClass(s.options.className); - } - - var html = ''; - for (var i = 0; i < s.options.calendars; i++) { - count = s.options.starts; - - if (i > 0) { - html += s.options.template.space; - } - - html += tmpl(s.options.template.head.join(''), { - week: s.options.locale.weekMin, - prev: s.options.prev, - next: s.options.next, - day1: s.options.locale.daysMin[(count++) % 7], - day2: s.options.locale.daysMin[(count++) % 7], - day3: s.options.locale.daysMin[(count++) % 7], - day4: s.options.locale.daysMin[(count++) % 7], - day5: s.options.locale.daysMin[(count++) % 7], - day6: s.options.locale.daysMin[(count++) % 7], - day7: s.options.locale.daysMin[(count++) % 7] - }); - - }; - - this_calendar.find('tr:first').append( html ).find( 'table' ).addClass( s.options.views[s.options.view] ); - - fill( this_calendar.get(0) ); - - if ( s.options.flat ) { - this_calendar.appendTo( this ).show().css('position', 'relative'); - layout(this_calendar.get(0)); - - } else { - this_calendar.appendTo(document.body); - jQuery(this).bind(s.options.eventName, show); - - } - - jQuery( s.element ).data('date_selector_initialized', true ); - - }); - - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var tmpl = function (str, data) { - s.log('tmpl()', 'function'); - - // Figure out if we're getting a template, or if we need to load the template - and be sure to cache the result. - var fn = !/\W/.test(str) ? s.cache[str] = s.cache[str] || tmpl(document.getElementById(str).innerHTML) : - - // Generate a reusable function that will serve as a template generator (and which will be cached). - new Function("obj", "var p=[],print=function(){p.push.apply(p,arguments);};" + "with(obj){p.push('" + str.replace(/[\r\t\n]/g, " ").split("<%").join("\t").replace(/((^|%>)[^\t]*)'/g, "$1\r").replace(/\t=(.*?)%>/g, "',$1,'").split("\t").join("');").split("%>").join("p.push('").split("\r").join("\\'") + "');}return p.join('');"); - - // Provide some basic currying to the user - return data ? fn(data) : fn; - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var fill = function ( this_calendar ) { - s.log('fill()', 'function'); - - this_calendar = jQuery( this_calendar ); - - var currentCal = Math.floor( s.options.calendars / 2 ), - date, data, dow, month, count = 0, - week, days, indic, indic2, html, tblCal; - - this_calendar.find('td>table tbody').remove(); - - for (var i = 0; i < s.options.calendars; i++) { - date = new Date(s.options.current); - date.addMonths(-currentCal + i); - - tblCal = this_calendar.find('table').eq( i + 1) ; - - if( typeof tblCal === 'object' && typeof tblCal[0] != 'undefined' ) { - - switch ( tblCal[0].className ) { - case 'date_selector_view_days': - dow = s.formatDate(date, 'B, Y'); - break; - - case 'date_selector_view_months': - dow = date.getFullYear(); - break; - - case 'date_selector_view_years': - dow = (date.getFullYear() - 6) + ' - ' + (date.getFullYear() + 5); - break; - - }; - - } - - tblCal.find('thead tr:first th:eq(1) span').text(dow); - dow = date.getFullYear() - 6; - data = { - data: [], - className: 'date_selector_years' - } - - for (var j = 0; j < 12; j++) { - data.data.push(dow + j); - }; - - html = tmpl(s.options.template.months.join(''), data); - date.setDate(1); - data = { - weeks: [], - test: 10 - }; - - month = date.getMonth(); - var dow = (date.getDay() - s.options.starts) % 7; - date.addDays(-(dow + (dow < 0 ? 7 : 0))); - week = -1; - count = 0; - while (count < 42) { - indic = parseInt(count / 7, 10); - indic2 = count % 7; - if (!data.weeks[indic]) { - week = date.getWeekNumber(); - data.weeks[indic] = { - week: week, - days: [] - }; - } - data.weeks[indic].days[indic2] = { - text: date.getDate(), - classname: [] - }; - if (month != date.getMonth()) { - data.weeks[indic].days[indic2].classname.push('date_selectorNotInMonth'); - } - if (date.getDay() === 0) { - data.weeks[indic].days[indic2].classname.push('date_selectorSunday'); - } - if (date.getDay() === 6) { - data.weeks[indic].days[indic2].classname.push('date_selectorSaturday'); - } - var fromUser = s.options.onRender(date); - var val = date.valueOf(); - if (fromUser.selected || s.options.date === val || jQuery.inArray(val, s.options.date) > -1 || (s.options.mode === 'range' && val >= s.options.date[0] && val <= s.options.date[1])) { - data.weeks[indic].days[indic2].classname.push('date_selector_selected'); - } - if (fromUser.disabled) { - data.weeks[indic].days[indic2].classname.push('date_selector_disabled'); - } - if (fromUser.className) { - data.weeks[indic].days[indic2].classname.push(fromUser.className); - } - data.weeks[indic].days[indic2].classname = data.weeks[indic].days[indic2].classname.join(' '); - count++; - date.addDays(1); - } - - html = tmpl(s.options.template.days.join(''), data) + html; - - data = { - data: s.options.locale.monthsShort, - className: 'date_selector_months' - }; - - html = tmpl(s.options.template.months.join(''), data) + html; - tblCal.append(html); - - } - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var parseDate = function ( date, format ) { - s.log('parseDate()', 'function'); - - if( !date ) { - return; - } - - if ( date.constructor === Date ) { - return new Date(date); - } - var parts = date.split(/\W+/); - var against = format.split(/\W+/), - d, m, y, h, min, now = new Date(); - for (var i = 0; i < parts.length; i++) { - switch (against[i]) { - case 'd': - case 'e': - d = parseInt(parts[i], 10); - break; - case 'm': - m = parseInt(parts[i], 10) - 1; - break; - case 'Y': - case 'y': - y = parseInt(parts[i], 10); - y += y > 100 ? 0 : (y < 29 ? 2000 : 1900); - break; - case 'H': - case 'I': - case 'k': - case 'l': - h = parseInt(parts[i], 10); - break; - case 'P': - case 'p': - if (/pm/i.test(parts[i]) && h < 12) { - h += 12; - } else if (/am/i.test(parts[i]) && h >= 12) { - h -= 12; - } - break; - case 'M': - min = parseInt(parts[i], 10); - break; - } - } - return new Date( - y === undefined ? now.getFullYear() : y, m === undefined ? now.getMonth() : m, d === undefined ? now.getDate() : d, h === undefined ? now.getHours() : h, min === undefined ? now.getMinutes() : min, 0); - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - s.formatDate = typeof s.formatDate === 'function' ? s.formatDate : function (date, format) { - - if( s ) { - s.log('s.formatDate()', 'function'); - } - - var m = date.getMonth(); - var d = date.getDate(); - var y = date.getFullYear(); - var wn = date.getWeekNumber(); - var w = date.getDay(); - var s = {}; - var hr = date.getHours(); - var pm = (hr >= 12); - var ir = (pm) ? (hr - 12) : hr; - var dy = date.getDayOfYear(); - if (ir === 0) { - ir = 12; - } - var min = date.getMinutes(); - var sec = date.getSeconds(); - var parts = format.split(''), - part; - for (var i = 0; i < parts.length; i++) { - part = parts[i]; - switch (parts[i]) { - case 'a': - part = date.getDayName(); - break; - case 'A': - part = date.getDayName(true); - break; - case 'b': - part = date.getMonthName(); - break; - case 'B': - part = date.getMonthName(true); - break; - case 'C': - part = 1 + Math.floor(y / 100); - break; - case 'd': - part = (d < 10) ? ("0" + d) : d; - break; - case 'e': - part = d; - break; - case 'H': - part = (hr < 10) ? ("0" + hr) : hr; - break; - case 'I': - part = (ir < 10) ? ("0" + ir) : ir; - break; - case 'j': - part = (dy < 100) ? ((dy < 10) ? ("00" + dy) : ("0" + dy)) : dy; - break; - case 'k': - part = hr; - break; - case 'l': - part = ir; - break; - case 'm': - part = (m < 9) ? ("0" + (1 + m)) : (1 + m); - break; - case 'M': - part = (min < 10) ? ("0" + min) : min; - break; - case 'p': - case 'P': - part = pm ? "PM" : "AM"; - break; - case 's': - part = Math.floor(date.getTime() / 1000); - break; - case 'S': - part = (sec < 10) ? ("0" + sec) : sec; - break; - case 'u': - part = w + 1; - break; - case 'w': - part = w; - break; - case 'y': - part = ('' + y).substr(2, 2); - break; - case 'Y': - part = y; - break; - } - parts[i] = part; - } - return parts.join(''); - }; - - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - s.extendDate = typeof s.extendDate === 'function' ? s.extendDate : function ( locale ) { - - if (Date.prototype.tempDate) { - return; - } - - Date.prototype.tempDate = null; - Date.prototype.months = locale.months; - Date.prototype.monthsShort = locale.monthsShort; - Date.prototype.days = locale.days; - Date.prototype.daysShort = locale.daysShort; - - Date.prototype.getMonthName = function (fullName) { - return this[ fullName ? 'months' : 'monthsShort' ][ this.getMonth() ]; - }; - - Date.prototype.getDayName = function (fullName) { - return this[fullName ? 'days' : 'daysShort'][this.getDay()]; - }; - - Date.prototype.addDays = function (n) { - this.setDate(this.getDate() + n); - this.tempDate = this.getDate(); - }; - - Date.prototype.addMonths = function (n) { - if (this.tempDate === null) { - this.tempDate = this.getDate(); - } - this.setDate(1); - this.setMonth(this.getMonth() + n); - this.setDate(Math.min(this.tempDate, this.getMaxDays())); - }; - - Date.prototype.addYears = function (n) { - if (this.tempDate === null) { - this.tempDate = this.getDate(); - } - this.setDate(1); - this.setFullYear(this.getFullYear() + n); - this.setDate(Math.min(this.tempDate, this.getMaxDays())); - }; - - Date.prototype.getMaxDays = function () { - var tmpDate = new Date(Date.parse(this)), - d = 28, - m; - m = tmpDate.getMonth(); - d = 28; - while (tmpDate.getMonth() === m) { - d++; - tmpDate.setDate(d); - } - return d - 1; - }; - - Date.prototype.getFirstDay = function () { - var tmpDate = new Date(Date.parse(this)); - tmpDate.setDate(1); - return tmpDate.getDay(); - }; - - Date.prototype.getWeekNumber = function () { - var tempDate = new Date(this); - tempDate.setDate(tempDate.getDate() - (tempDate.getDay() + 6) % 7 + 3); - var dms = tempDate.valueOf(); - tempDate.setMonth(0); - tempDate.setDate(4); - return Math.round((dms - tempDate.valueOf()) / (604800000)) + 1; - }; - - Date.prototype.getDayOfYear = function () { - var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); - var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); - var time = now - then; - return Math.floor(time / 24 * 60 * 60 * 1000); - }; - - }; - - - /** - * Displays a single calendar. The calendar object (not the wrapper) is passed to function. - * - * Adds width and height to the Calendar element and to the primary container (.date_selector_container) - * - * @since 0.1 - * @author potanin@UD - */ - var layout = function ( el ) { - s.log('layout()', 'function'); - - var options = jQuery( el ).data('date_selector'); - var this_calendar = jQuery('#' + options.id); - - /* Gets all the divs within the Calendar element */ - if (!s.options.extraHeight) { - var divs = jQuery( el ).find( 'div' ); - s.options.extraHeight = divs.get(0).offsetHeight + divs.get(1).offsetHeight; - s.options.extraWidth = divs.get(2).offsetWidth + divs.get(3).offsetWidth; - } - - var first_table = this_calendar.find('table:first').get(0); - var width = first_table.offsetWidth; - var height = first_table.offsetHeight; - - this_calendar.css({ - width: width + s.options.extraWidth + 'px', - height: height + s.options.extraHeight + 'px' - }).find('div.date_selector_container').css({ - width: width + 'px', - height: height + 'px' - }); - - }; - - - /** - * Click Monitor for the entire Calendar object. - * - * @since 0.1 - * @author potanin@UD - */ - var click = function ( ev ) { - s.log('click()', 'function'); - - if (jQuery(ev.target).is('span')) { - ev.target = ev.target.parentNode; - } - - var clicked_element = jQuery(ev.target); - - /* If we didn't click a link, there is nothing we can do here */ - if( !clicked_element.is('a') ) { - return; - } - - ev.stopPropagation(); - - ev.preventDefault(); - - ev.target.blur(); - - if (clicked_element.hasClass('date_selector_disabled')) { - return false; - } - - var options = s.options; - var parentEl = clicked_element.parent(); - var tblEl = parentEl.parent().parent().parent(); /* the table element, e.g. .date_selector_view_days */ - var tblIndex = jQuery('table', this).index(tblEl.get(0)) - 1; - var tmp = new Date(options.current); - var changed = false; - var fillIt = false; - - if (parentEl.is('th')) { - - if (parentEl.hasClass('date_selectorWeek') && s.options.mode === 'range' && !parentEl.next().hasClass('date_selector_disabled')) { - var val = parseInt(parentEl.next().text(), 10); - tmp.addMonths(tblIndex - Math.floor(s.options.calendars / 2)); - - if (parentEl.next().hasClass('date_selectorNotInMonth')) { - tmp.addMonths(val > 15 ? -1 : 1); - } - - tmp.setDate(val); - s.options.date[0] = (tmp.setHours(0, 0, 0, 0)).valueOf(); - tmp.setHours(23, 59, 59, 0); - tmp.addDays(6); - s.options.date[1] = tmp.valueOf(); - fillIt = true; - changed = true; - s.options.lastSel = false; - - } else if (parentEl.hasClass('date_selector_month')) { - tmp.addMonths(tblIndex - Math.floor(s.options.calendars / 2)); - switch (tblEl.get(0).className) { - case 'date_selector_view_days': - tblEl.get(0).className = 'date_selector_view_months'; - clicked_element.find('span').text(tmp.getFullYear()); - break; - case 'date_selector_view_months': - tblEl.get(0).className = 'date_selector_view_years'; - clicked_element.find('span').text((tmp.getFullYear() - 6) + ' - ' + (tmp.getFullYear() + 5)); - break; - case 'date_selector_view_years': - tblEl.get(0).className = 'date_selector_view_days'; - clicked_element.find('span').text(s.formatDate(tmp, 'B, Y')); - break; - } - - } else if (parentEl.parent().parent().is('thead')) { - switch (tblEl.get(0).className) { - case 'date_selector_view_days': - s.options.current.addMonths(parentEl.hasClass('date_selectorGoPrev') ? -1 : 1); - break; - case 'date_selector_view_months': - s.options.current.addYears(parentEl.hasClass('date_selectorGoPrev') ? -1 : 1); - break; - case 'date_selector_view_years': - s.options.current.addYears(parentEl.hasClass('date_selectorGoPrev') ? -12 : 12); - break; - } - fillIt = true; - } - - } else if ( parentEl.is('td') && !parentEl.hasClass('date_selector_disabled')) { - - switch (tblEl.get(0).className) { - - case 'date_selector_view_months': - s.options.current.setMonth(tblEl.find('tbody.date_selector_months td').index(parentEl)); - s.options.current.setFullYear(parseInt(tblEl.find('thead th.date_selector_month span').text(), 10)); - s.options.current.addMonths(Math.floor(s.options.calendars / 2) - tblIndex); - tblEl.get(0).className = 'date_selector_view_days'; - break; - - case 'date_selector_view_years': - s.options.current.setFullYear(parseInt(clicked_element.text(), 10)); - tblEl.get(0).className = 'date_selector_view_months'; - break; - - default: - var val = parseInt(clicked_element.text(), 10); - tmp.addMonths(tblIndex - Math.floor(s.options.calendars / 2)); - - if (parentEl.hasClass('date_selectorNotInMonth')) { - tmp.addMonths(val > 15 ? -1 : 1); - } - - tmp.setDate(val); - switch (s.options.mode) { - - case 'multiple': - val = (tmp.setHours(0, 0, 0, 0)).valueOf(); - if (jQuery.inArray(val, s.options.date) > -1) { - jQuery.each(s.options.date, function (nr, dat) { - if (dat === val) { - s.options.date.splice(nr, 1); - return false; - } - }); - } else { - s.options.date.push(val); - } - break; - - case 'range': - if (!s.options.lastSel) { - s.options.date[0] = (tmp.setHours(0, 0, 0, 0)).valueOf(); - } - val = (tmp.setHours(23, 59, 59, 0)).valueOf(); - if (val < s.options.date[0]) { - s.options.date[1] = s.options.date[0] + 86399000; - s.options.date[0] = val - 86399000; - } else { - s.options.date[1] = val; - } - s.options.lastSel = !s.options.lastSel; - break; - - default: - s.options.date = tmp.valueOf(); - break; - - } - - break; - } - - fillIt = true; - changed = true; - - } - - if (fillIt) { - fill(this); - } - - if (changed) { - s.options.onChange.apply( this, prepareDate( options ) ); - } - - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var prepareDate = function ( options ) { - s.log('prepareDate()', 'function'); - - var tmp; - - if (s.options.mode === 'single') { - tmp = new Date( s.options.date ); - return [s.formatDate( tmp, s.options.format), tmp, s.options.el]; - - } else { - - tmp = [ [], [], s.options.el ]; - - jQuery.each( s.options.date , function( nr, val ) { - var date = new Date(val); - tmp[0].push(s.formatDate( date , s.options.format)); - tmp[1].push(date); - }); - - return tmp; - } - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var getViewport = function () { - s.log('getViewport()', 'function'); - - var m = document.compatMode === 'CSS1Compat'; - return { - l: window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft), - t: window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop), - w: window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth), - h: window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight) - }; - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var isChildOf = function (parentEl, el, container) { - s.log('isChildOf()', 'function'); - - if (parentEl === el) { - return true; - } - if (parentEl.contains) { - return parentEl.contains(el); - } - if (parentEl.compareDocumentPosition) { - return !!(parentEl.compareDocumentPosition(el) & 16); - } - var prEl = s.element.parentNode; - while (prEl && prEl != container) { - if (prEl === parentEl) return true; - prEl = prEl.parentNode; - } - return false; - } - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var show = function ( ev ) { - s.log('show()', 'function'); - - /* Get the calendar container DOM element */ - var element = this; - - /* Get jQuery Object for calendar */ - var calendar_object = jQuery('#' + jQuery( this ).data('date_selector_id')); - - if (!calendar_object.is(':visible')) { - - /* Get DOM Element */ - var calendar_element = calendar_object.get(0); - - fill( calendar_element ); - - /* Applying to the wrapper? */ - s.options.onBeforeShow.apply(this, [ calendar_element ]); - - var pos = jQuery( element ).offset(); - var viewPort = getViewport(); - var top = pos.top; - var left = pos.left; - var oldDisplay = jQuery.curCSS( calendar_element , 'display' ); - - calendar_object.css({ - visibility: 'hidden', - display: 'block' - }); - - layout( calendar_element ); - - switch (s.options.position) { - case 'top': - top -= calendar_element.offsetHeight; - break; - case 'left': - left -= c.offsetWidth; - break; - case 'right': - left += element.offsetWidth; - break; - case 'bottom': - top += element.offsetHeight; - break; - } - - if (top + calendar_element.offsetHeight > viewPort.t + viewPort.h) { - top = pos.top - calendar_element.offsetHeight; - } - - if (top < viewPort.t) { - top = pos.top + this.offsetHeight + calendar_element.offsetHeight; - } - - if (left + calendar_element.offsetWidth > viewPort.l + viewPort.w) { - left = pos.left - calendar_element.offsetWidth; - } - - if (left < viewPort.l) { - left = pos.left + this.offsetWidth - } - - calendar_object.css({ - visibility: 'visible', - display: 'block', - top: top + 'px', - left: left + 'px' - }); - - if (s.options.onShow.apply(this, [ calendar_element ]) != false) { - calendar_object.show(); - } - - jQuery( document ).bind( 'mousedown' , { - element: element, - calendar_object: calendar_object, - trigger: this - }, hide ); - - } - return false; - }; - - - /** - * {}. - * - * @since 0.1 - * @author potanin@UD - */ - var hide = function ( ev, args ) { - s.log('hide()', 'function'); - - if ( ev.target != ev.data.trigger && !isChildOf( ev.data.calendar_object, ev.target, ev.data.element )) { - ev.data.calendar_object.hide(); - jQuery(document).unbind('mousedown', hide); - } - }; - - - - /** - * {} - * - * @author potanin@UD - */ - this.showPicker = s.showPicker = typeof s.showPicker === 'function' ? s.showPicker : function() { - s.log('showPicker()', 'function'); - - return this.each(function () { - if (jQuery(this).data('date_selector_id')) { - show.apply(this); - } - }); - }; - - - /** - * {} - * - * @author potanin@UD - */ - this.hidePicker = s.hidePicker = typeof s.hidePicker === 'function' ? s.hidePicker : function() { - s.log('hidePicker()', 'function'); - - return this.each(function () { - if (jQuery(this).data('date_selector_id')) { - jQuery('#' + jQuery(this).data('date_selector_id')).hide(); - } - }); - }; - - - /** - * {} - * - * - * @author potanin@UD - */ - this.setDate = s.setDate = typeof s.setDate === 'function' ? s.setDate : function( date, shiftTo ) { - s.log('setDate()', 'function'); - - return s.element.each( function () { - - if( !jQuery( this ).data('date_selector_id')) { - s.log('setDate() - Element not initialized.', 'function'); - return; - } - - var cal = jQuery('#' + jQuery(this).data('date_selector_id')); - - s.options.date = date; - - if( !s.options.date ) { - s.options.date = new Date(); - } - - if ( s.options.date.constructor === String ) { - s.options.date = parseDate(s.options.date, s.options.format); - s.options.date.setHours(0, 0, 0, 0); - } - - if (s.options.mode != 'single') { - if ( s.options.date.constructor != Array ) { - s.options.date = [s.options.date.valueOf()]; - if (s.options.mode === 'range') { - s.options.date.push(((new Date(s.options.date[0])).setHours(23, 59, 59, 0)).valueOf()); - } - } else { - - for (var i = 0; i < s.options.date.length; i++) { - if( typeof s.options.date[i] != 'undefined' ) { - s.options.date[i] = (parseDate( s.options.date[i] , s.options.format).setHours(0, 0, 0, 0)).valueOf(); - } - } - - if ( s.options.mode === 'range' ) { - s.options.date[1] = ((new Date(s.options.date[1])).setHours(23, 59, 59, 0)).valueOf(); - } - } - } else { - s.options.date = s.options.date.valueOf(); - } - - - if (shiftTo) { - s.options.current = new Date( s.options.mode != 'single' ? s.options.date[0] : s.options.date ); - } - - fill( s.element.get(0) ); - - }); - - }; - - - /** - * {} - * - * @author potanin@UD - */ - this.getDate = s.getDate = typeof s.getDate === 'function' ? s.getDate : function() { - s.log('getDate()', 'function'); - - if (this.size() > 0) { - return prepareDate(jQuery('#' + jQuery(this).data('date_selector_id')).data('date_selector'))[formated ? 0 : 1]; - } - }; - - - /** - * {} - * - * @author potanin@UD - */ - this.Clear = s.clear = typeof s.clear === 'function' ? s.clear : function() { - s.log('clear()', 'function'); - - return this.each(function () { - if (jQuery(this).data('date_selector_id')) { - var cal = jQuery('#' + jQuery(this).data('date_selector_id')); - s.options = s.element.data('date_selector'); - if (s.options.mode != 'single') { - s.options.date = []; - fill(s.element.get(0)); - } - } - }); - }; - - - /** - * {} - * - * @author potanin@UD - */ - this.fixLayout = s.fixLayout = typeof s.fixLayout === 'function' ? s.fixLayout : function() { - s.log('fixLayout()', 'function'); - - return this.each(function () { - if (jQuery(this).data('date_selector_id')) { - var cal = jQuery('#' + jQuery(this).data('date_selector_id')); - s.options = s.element.data('date_selector'); - if (s.options.flat) { - layout(s.element.get(0)); - } - } - }); - }; - - - s.initialize(); - - return this; - - } /* end jQuery.prototype.date_selector */ - -}(jQuery) /* p.s. No dog balls. */ ); - - diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.dynamic-filter.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.dynamic-filter.js deleted file mode 100644 index 48908f372..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.dynamic-filter.js +++ /dev/null @@ -1,2351 +0,0 @@ -/** ========================================================= - * jquery.ud.dynamic_filter.js v1.1.4-a2 - * http://usabilitydynamics.com - * ========================================================= - * - * Commercial use requires one-time license fee - * http://usabilitydynamics.com/licenses - * - * Copyright © 2012 Usability Dynamics, Inc. (usabilitydynamics.com) - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * - * =TODO= - * - Show More / Show Less are visible when only one option remains, need to decide how to handle - should the filter inputs be visible at all with one option? - * - * - * ========================================================= */ - -/*jslint devel: true, undef: true, browser: true, continue: true, unparam: true, debug: true, eqeq: true, vars: true, white: true, newcap: true, plusplus: true, maxerr: 50, indent: 2 */ -/*global window */ -/*global console */ -/*global clearTimeout */ -/*global setTimeout */ -/*global jQuery */ - -( function ( jQuery ) { - "use strict"; - - jQuery.prototype.dynamic_filter = function ( s ) { - - /** Merge Custom Settings with Defaults */ - this.s = s = jQuery.extend( true, { - ajax: { - args: {}, - async: true, - cache: true, - format: 'json' - }, - active_timers: { - status: {} - }, - attributes: {}, - attribute_defaults: { - label: '', - concatenation_character: ', ', - display: true, - default_filter_label: '', - related_attributes: [], - sortable: false, - filter: false, - filter_always_show: false, - filter_collapsable: 4, /* zero based */ - filter_multi_select: false, - filter_show_count: false, - filter_show_label: true, - filter_note: '', - filter_placeholder: '', - filter_show_disabled_values: false, - filter_range: {}, - filter_ux: [], - filter_value_order: 'native', /* Or 'value_count', or 'label' */ - filter_values: [] - }, - callbacks: { - result_format: function ( result ) { return result; } - }, - data: { - filterable_attributes: {}, - current_filters: {}, - sortable_attributes: {}, - dom_results: {}, - rendered_query: [] - }, - filter_types: { - checkbox: { - filter_show_count: true, - filter_multi_select: true - }, - input: { - filter_always_show: true, - filter_ux: [ { 'autocomplete': {} } ] - }, - dropdown: { - default_filter_label: 'Show All', - filter_show_count: true, - filter_always_show: true - }, - range: { - filter_always_show: true - } - }, - helpers: {}, - instance: {}, - settings: { - auto_request: true, - chesty_puller: false, - debug: false, - dom_limit: 200, - filter_id: jQuery( this ).attr( 'dynamic_filter' ) ? jQuery( this ).attr( 'dynamic_filter' ) : 'df_' + location.host + location.pathname, - load_ahead_multiple: 2, - sort_by: '', - sort_direction: '', - set_url_hashes: true, - per_page: 25, - request_range: {}, - use_instances: true, - timers: { - notice: { - dim: 5000, - hide: 2500 - }, - filter_intent: 1600, - initial_request: 0 - }, - messages: { - no_results: 'No results found.', - show_more: 'Show More', - show_less: 'Show Less', - loading: 'Loading...', - server_fail: 'Could not retrieve results due to a server error, please notify the website administrator.', - total_results: 'There are {1} total results.', - load_more: 'Showing {1} of {2} results. Show {3} more.' - }, - unique_tag: false - }, - classes: { - wrappers: { - ui_debug: 'df_ui_debug', - element: 'df_top_wrapper', - results_wrapper: 'df_results_wrapper', - sorter: 'df_sorter', - results: 'df_results', - filter: 'df_filter', - load_more: 'df_load_more', - status_wrapper: 'df_status_wrapper' - }, - inputs: { - input: 'df_input', - checkbox: 'df_checkbox', - start_range: 'df_start_range', - end_range: 'df_end_range', - range_slider: 'df_range_slider' - }, - labels: { - range_slider: 'df_range_slider_label', - attribute: 'df_attribute_label', - checkbox: 'df_checkbox' - }, - status: { - success: 'df_alert_success', - error: 'df_alert_error' - }, - results: { - row: 'df_result_row', - result_data: 'df_result_data', - list_item: 'df_list_item' - }, - element: { - ajax_loading: 'df_ajax_loading', - filter_pending: 'df_filter_pending', - server_fail: 'df_server_fail', - have_results: 'df_have_results' - }, - filter: { - inputs_list_wrapper: 'df_filter_inputs_list_wrapper', - inputs_list: 'df_filter_inputs_list', - value_wrapper: 'df_filter_value_wrapper', - value_label: 'df_filter_value_label', - value_title: 'df_filter_title', - value_count: 'df_filter_value_count', - trigger: 'df_filter_trigger', - filter_label: 'df_filter_label', - filter_note: 'df_filter_note', - show_more: 'df_filter_toggle_list df_show_more', - show_less: 'df_filter_toggle_list df_show_less', - selected: 'df_filter_selected', - extended_option: 'df_extended_option', - currently_extended: 'df_currently_extended' - }, - sorter: { - button: 'df_sortable_button', - button_active: 'df_sortable_active' - }, - close: 'df_close', - separator: 'df_separator', - selected_page: 'df_current', - disabled_item: 'df_disabled_item' - }, - css: { - results: { - hidden_row: ' display: none; ', - visible_row: ' display: block; ' - } - }, - ux: { - element: this, - results_wrapper: jQuery( '
              ' ), - results: jQuery( '
                ' ), - result_item: jQuery( '
              • ' ), - sorter: jQuery( '
                ' ), - sorter_button: jQuery( '
                ' ), - filter: jQuery( '
                ' ), - filter_label: jQuery( '
                ' ), - load_more: jQuery( '
                ' ), - status: jQuery( '
                ' ) - }, - status: {}, - supported: { - isotope: typeof jQuery.prototype.isotope === 'function' ? true : false, - jquery_ui: typeof jQuery.ui === 'object' ? true : false, - jquery_widget: typeof jQuery.widget === 'function' ? true : false, - jquery_position: typeof jQuery.ui.position === 'object' ? true : false, - autocomplete: typeof jQuery.ui === 'object' && typeof jQuery.widget === 'function' && typeof jQuery.ui.position === 'object' && typeof jQuery.prototype.autocomplete === 'function' ? true : false, - date_selector: typeof jQuery.prototype.date_selector === 'function' ? true : false, - slider: typeof jQuery.prototype.slider === 'function' ? true : false, - //cookies: typeof jaaulde === 'object' && jaaulde.utils.cookies.test() ? true : false, - window_history: typeof history === 'object' && typeof history.pushState === 'function' ? true : false - } - }, s ); - - - /** - * Return Log - * - * @since 0.1 - * @author potanin@UD - */ - var get_log = this.get_log = function ( type, console_type ) { - - type = typeof type != 'undefind' ? type : false; - console_type = typeof console_type != 'undefind' ? console_type : false; - - if( typeof s.log_history === 'object' ) { - jQuery.each( s.log_history, function( index, entry_data ) { - - if( type && type != entry_data.type ) { - return; - } - - log( entry_data.notice, entry_data.type, entry_data.console_type, true ); - }); - - } - - } - - - /** - * Internal logging function - * - * @since 0.1 - * @author potanin@UD - */ - var log = this.log = function ( notice, type, console_type, override_debug ) { - - /** Defaults */ - type = typeof type !== 'undefined' ? type : 'log'; - console_type = console_type ? console_type : 'log'; - - /** Save entry to log */ - s.log_history.push( { notice: notice, type: type, console_type: console_type } ); - - /** Add Prefix */ - notice = ( typeof notice === 'string' || typeof notice === 'number' ? 'DF::' + notice : notice ); - - /** If debugging is disabled, or the current browser does not support it, do nothing */ - if ( !override_debug && ( !s.settings.debug || !window.console ) ) { - return notice; - } - - /** Check if this log type should be displayed */ - if( !override_debug && typeof s.debug_detail === 'object' && !s.debug_detail[ type ] ) { - return notice; - } - - if ( window.console && console.debug ) { - - switch ( console_type ) { - - case 'error': - console.error( notice ); - break; - - case 'info': - console.info( notice ); - break; - - case 'time': - if( typeof console.time != 'undefined' ) { console.time( notice ); } - break; - - case 'timeEnd': - if( typeof console.timeEnd != 'undefined' ) { console.timeEnd( notice ); } - break; - - case 'debug': - if( typeof console.debug != 'undefined' ) { console.debug( notice ); } else { console.log( notice ); } - break; - - case 'dir': - if( typeof console.dir != 'undefined' ) { console.dir( notice ); } else { console.log( notice ); } - break; - - case 'warn': - if( typeof console.warn != 'undefined' ) { console.warn( notice ); } else { console.log( notice ); } - break; - - case 'clear': - if( typeof console.clear != 'undefined' ) { console.clear(); } - break; - - case 'log': - console.log( notice ); - break; - - } - - } - - if( notice ) { - return notice; - } - - }; - - - /** - * Create the main status bar container or add a message to it - * - * !todo Verify that data-dismiss will work with custom classes. - potanin@UD (4/4/12) - * @since 0.1 - * @author potanin@UD - */ - var status = this.status = function ( message, this_status ) { - - /** Set Settings */ - this_status = jQuery.extend( true, { - element: s.ux.status, - type: 'default', - message: message, - hide: s.settings.timers.notice.hide - }, this_status ); - - log( 'status( ' + message + ' ), type: ' + this_status.type, 'status', 'log' ); - - /** Status is added to DOM in render_ui, if it is not visible at this point, it was disabled completely */ - jQuery( s.ux.status ).show().addClass( s.classes.status_wrapper ); - - if( message === '' ) { - jQuery( s.ux.status ).html( '' ); - jQuery( s.ux.status ).hide(); - } - - /** Save original classes, if they are not yet saved */ - if( !jQuery( s.ux.status ).data( 'original_classes' ) ) { - jQuery( s.ux.status ).data( 'original_classes' , jQuery( s.ux.status ).attr( 'class' ) ); - } - - /** Set classes to original ( to clear out any new classes added previously by this function */ - jQuery( s.ux.status ).attr( 'class' , jQuery( s.ux.status ).data( 'original_classes' ) ); - - /** Remove any old timers */ - clearTimeout( s.active_timers.status.hide ); - - /** Add a custom class if passeed */ - if( typeof s.classes.status[ this_status.type ] === 'string' ) { - jQuery( s.ux.status ).addClass( s.classes.status[ this_status.type ] ); - } - - s.ux.status.html( message ); - - /** If Trigger callback is set, we call it, otherwise bind Dismiss action */ - if( typeof this_status.click_trigger != 'undefined' ) { - jQuery( s.ux.status ).one( 'click', function() { - jQuery( document ).trigger( this_status.click_trigger, {} ); - }); - - } else { - - if( typeof jQuery.prototype.alert === 'function' ) { - jQuery( s.ux.status ).prepend( jQuery( '×' ) ); - jQuery( s.ux.status ).alert(); - } - - } - - /** Schedule removal */ - if ( this_status.hide ) { - s.active_timers.status.hide = setTimeout( function () { - jQuery( s.ux.status ).fadeTo( 3000, 0, function () { - jQuery( s.ux.status ).hide(); - }); - }, this_status.hide ); - } - - if( this_status.type === 'error' ) { - jQuery( document ).trigger( 'dynamic_filter::error_status', this_status ); - } - - }; - - - /** - * Automates configuration, restores a saved DF state for the current user. - * - * Attempt to restore any user-specific configuration for this filter - * - * !todo URL hash checking. - potanin@UD - * !todo URL $_GET variable checking. - potanin@UD - * @author potanin@UD - */ - var prepare_system = this.prepare_system = function ( event, args ) { - - /** Debug can be passed as an object configuring what type of information to log in the console */ - s.debug_detail = jQuery.extend( true, { - ajax_detail: false, - attribute_detail: true, - detail: true, - dom_detail: false, - event_handlers: true, - filter_ux: true, - filter_detail: true, - helpers: false, - instance_detail: true, - log: true, - procedurals: true, - status: false, - supported: true, - timers: true, - ui_debug: false - }, ( typeof s.settings.debug === 'object' ? s.settings.debug : {} ) ); - - /** Create Log History */ - s.log_history = []; - - /** First Log Entry */ - log( 'prepare_system', 'procedurals' ); - - /** Log found third-party libraries */ - jQuery.each( s.supported, function( library, is_used ) { - is_used ? log( 'Support for (' + library + ') verified.', 'supported', 'info' ) : false ; - }); - - /** Save Placeholder Results (any content within the UX Element */ - if( jQuery( s.ux.element ).children().length ) { - s.ux.placeholder_results = jQuery( s.ux.element ).children(); - } - - /** If Chesty is with us, we call him */ - if( s.settings.chesty_puller && typeof jQuery.prototype.animate === 'function' ) { - chesty_puller(); - } - - } - - - /** - * Analyze the specified attributes, must be run before AJAX request. - * - * Builds array of filtertable attributes, which are necessary for server-driven ajax calls. - * - * !todo Need to check that the requested Filter is defined before merging settings - potanin@UD (4/4/12) - * @author potanin@UD - */ - var analyze_attributes = this.analyze_attributes = function ( attribute ) { - log( 'analyze_attributes', 'procedurals' ); - - jQuery( document ).trigger( 'dynamic_filter::analyze_attributes::initialize' ); - - if( typeof s.ajax.args === 'undefined' ) { - s.ajax.args = {}; - } - - /* Convert strings to booleans in Attribute Deftauls */ - jQuery.each( s.attribute_defaults , function( key, value ) { - s.attribute_defaults[ key ] = value === 'true' ? true : ( value === 'false' ? false : value ) ; - }); - - s.ajax.args.attributes = s.ajax.args.attributes ? s.ajax.args.attributes : {}; - s.ajax.args.filter_query = s.ajax.args.filter_query ? s.ajax.args.filter_query : {}; - - - /** - * Analyze Single Attribute - * - */ - analyze_attributes.add_ux_support = function( attribute_key, ux_type, ux_settings ) { - log( 'analyze_attributes.add_ux_support(' + attribute_key + ')', 'procedurals' ); - - s.attributes[ attribute_key ].verified_ux = s.attributes[ attribute_key ].verified_ux ? s.attributes[ attribute_key ].verified_ux : {}; - s.attributes[ attribute_key ].verified_ux[ ux_type ] = ux_settings ? ux_settings : {}; - - } - - - /** - * Analyze Single Attribute - * - */ - analyze_attributes.analyze_single = function( attribute_key, attribute_settings ) { - log( 'analyze_attributes.analyze(' + attribute_key + ')', 'procedurals' ); - - attribute_settings = attribute_settings ? attribute_settings : s.attributes[ attribute_key ]; - - /* Convert strings to booleans */ - jQuery.each( attribute_settings , function( key, value ) { - attribute_settings[ key ] = value === 'true' ? true : ( value === 'false' ? false : value ) ; - }); - - /** Merge Attribute Settings with defaults */ - s.attributes[ attribute_key ] = jQuery.extend( {} , s.attribute_defaults, s.attributes[ attribute_key ].filter ? s.filter_types[ s.attributes[ attribute_key ].filter ] : {}, attribute_settings ); - - s.attributes[ attribute_key ].verified_ux = {}; - - /** Create AJAX request place for this attribute. */ - s.ajax.args.attributes[ attribute_key ] = s.ajax.args.attributes[ attribute_key ] ? s.ajax.args.attributes[ attribute_key ] : {}; - - /** Create AJAX Args query, removing any unsupported values such as callback functions */ - jQuery.each( s.attributes[ attribute_key ] , function( key, settings ) { - s.ajax.args.attributes[ attribute_key ][ key ] = typeof settings !== 'function' ? settings : 'callback'; - }); - - /** If Sortable */ - if( s.attributes[ attribute_key ].sortable ) { - s.data.sortable_attributes[ attribute_key ] = s.attributes[ attribute_key ]; - } - - /** If this Attribute uses a Filter */ - if( s.attributes[ attribute_key ].filter ) { - - /** Add this attribute to the Filterable Attributes object for quick reference */ - s.data.filterable_attributes[ attribute_key ] = { - filter: s.attributes[ attribute_key ].filter - }; - - /** Create Filter Query location */ - s.ajax.args.filter_query[ attribute_key ] = s.ajax.args.filter_query[ attribute_key ] ? s.ajax.args.filter_query[ attribute_key ] : []; - - /** Check if Filter UX is used, and if library exists */ - - - if( typeof attribute_settings.filter_ux !== 'undefined' ) { - - /** Convert incorrectly passed filter UX from string to object in an array */ - if( typeof attribute_settings.filter_ux === 'string' ) { - var this_filter_ux = new Object; - this_filter_ux[ attribute_settings.filter_ux ] = {}; - attribute_settings.filter_ux = [ this_filter_ux ]; - } - - jQuery.each( attribute_settings.filter_ux ? attribute_settings.filter_ux : [] , function( i, filter_ux ) { - - jQuery.each( filter_ux, function( ux_type, settings ) { - - if( s.supported[ ux_type ] ) { - analyze_attributes.add_ux_support( attribute_key, ux_type, settings ); - } - - if( typeof s.supported[ ux_type ] === 'boolean' && s.supported[ ux_type ] === false ) { - s.helpers.attempt_ud_ux_fetch( ux_type, attribute_key, settings ); - } - - }); - - }); - - } - - } - - } - - jQuery.each( s.attributes, function ( attribute_key , attribute_settings ) { - analyze_attributes.analyze_single( attribute_key, attribute_settings ); - }); - - jQuery( document ).trigger( 'dynamic_filter::analyze_attributes::complete' ); - - }; - - - /** - * Prepare DOM by rendering elements and adding custom classes. Ran once. - * - * @author potanin@UD - */ - var render_ui = this.render_ui = function () { - log( 'render_ui', 'procedurals' ); - - /** If UX elements are passed via selectors, find them, add classeses */ - jQuery.each( s.ux, function( wrapper_slug, object ) { - - /** Check if UX Element was passed as a jQuery selector */ - if( object && typeof object != 'object' ) { - s.ux[ wrapper_slug ] = jQuery( object ); - } - - /** Check if UX element is in DOM */ - if( !jQuery( s.ux[ wrapper_slug ] ).length ) { - log( 'render_ui - s.ux.' + wrapper_slug + ' was passed as a selector. Corresponding DOM element could not be found.', 'misconfiguration', 'error' ); - return; - } - - /** Add standard class */ - jQuery( s.ux[ wrapper_slug ] ).addClass( 'df_element' ); - - /** Add Debug Class */ - jQuery( s.ux.element ).addClass( s.debug_detail.ui_debug ? s.classes.wrappers.ui_debug : '' ); - - /** Add wrapper classes */ - jQuery( s.ux[ wrapper_slug ] ).addClass( s.classes.wrappers[ wrapper_slug ] ); - - }); - - /** The Results Wrapper is rendered automatically */ - if( jQuery( s.ux.results_wrapper ).not( ':visible' ).length ) { - jQuery( s.ux.element ).prepend( s.ux.results_wrapper ); - } - - /** Sorter UI */ - if( jQuery( s.ux.sorter ).not( ':visible' ).length ) { - jQuery( s.ux.element ).prepend( s.ux.sorter ); - } - - /** The Results Container is rendered automatically */ - if( jQuery( s.ux.results ).not( ':visible' ).length ) { - jQuery( s.ux.results_wrapper ).append( s.ux.results ); - } - - /** Append the results DOM element to the wrapper element. This element can be disabled by being set to false. */ - if( s.ux.filter && !jQuery( s.ux.filter, 'body' ).is( ':visible' ) ){ - jQuery( s.ux.element ).prepend( s.ux.filter ); - jQuery( s.ux.filter ).addClass( s.classes.filter ); - } - - /** Show the message container if not already rendered. This element can be disabled by being set to false. */ - if( s.ux.status && !jQuery( s.ux.status ).is( ':visible' ) ) { - jQuery( s.ux.element ).before( s.ux.status ); - jQuery( s.ux.status ).hide(); - } - - /** Append Load More element to wrapper */ - if( s.ux.load_more && !jQuery( s.ux.load_more ).is( ':visible' ) ) { - jQuery( s.ux.results_wrapper ).append( s.ux.load_more ); - - jQuery( s.ux.load_more ).click( function ( event ) { - - /** Disable click until AJAX request is done */ - if( s.status.loading ) { - return; - } - - jQuery( s.ux.load_more ).unbind( 's.ux.load_more' ); - jQuery( document ).trigger( 'dynamic_filter::load_more' ); - - }); - - jQuery( s.ux.load_more ).hide(); - - } - - /** Use Isotype for aesthetics if available */ - if( s.supported.isotope ) { - jQuery( s.ux.results ).isotope({ - itemSelector : '.' + s.classes.results.row - }); - }; - - }; - - - /** - * Draws the User Interface for sorting. - * - * - * @author potanin@UD - */ - var render_sorter_ui = this.render_sorter_ui = function () { - - /** If Sort By is set and it corresponds to an attribute, we force-add Sortable setting to Attribute */ - if( s.settings.sort_by !== '' && typeof s.attributes[ s.settings.sort_by ] === 'object' ) { - s.attributes[ s.settings.sort_by ].sortable = true; - } - - /** Update Sortable Attributes */ - jQuery.each( s.attributes ? s.attributes : {} , function( attribute_key, settings) { - if( s.attributes[ attribute_key ].sortable ) { - s.data.sortable_attributes[ attribute_key ] = s.attributes[ attribute_key ]; - } - }); - - - /** Render each Sort Button and attach Click event */ - jQuery.each( s.data.sortable_attributes ? s.data.sortable_attributes : {} , function( attribute_key, settings ) { - if( !jQuery('div[attribute_key="' + attribute_key + '"]', s.ux.sorter ).length ) { - s.ux.sorter.append( s.ux.sorter[ attribute_key ] = jQuery( s.ux.sorter_button ).clone(false).addClass( s.classes.sorter.button ).attr( 'attribute_key', attribute_key ).attr( 'sort_direction', 'ASC' ).text( settings.label ) ); - jQuery( s.ux.sorter[ attribute_key ] ).click( function( event ) { - s.settings.sort_by = this.getAttribute('attribute_key'); - s.settings.sort_direction = this.getAttribute('sort_direction'); - jQuery( 'div', s.ux.sorter ).removeClass( s.classes.sorter.button_active ); - jQuery( this ).addClass( s.classes.sorter.button_active ); - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }) - } - }); - - } - - - /** - * Renders the filters. Ran once before Filter Values are known. - * - * Creates s.ux_filters - an associative object for associating filtertable attributes with their DOM filter containers. - * - * !todo This does not take into account that Filter Values can be declared with the attribute - potanin@UD (4/5/12) - * @author potanin@UD - */ - var render_filter_ui = this.render_filter_ui = function ( args ) { - log( 'render_filter_ui', 'procedurals'); - jQuery( document ).trigger( 'dynamic_filter::render_filter_ui::initiate' ); - - if( typeof s.data.filters != 'object' ) { - log( 'render_filter_ui - s.data.filters is not an object. Creating initial DOM References for filters.', 'dom_detail' ); - s.data.filters = {} - } - - /** Cycle through each filterable attribute */ - jQuery.each( s.data.filterable_attributes, function ( attribute_key , filter_data ) { - render_single_filter( attribute_key, filter_data, args ); - }); - - jQuery( document ).trigger( 'dynamic_filter::render_filter_ui::complete' ); - - } - - - /** - * Update Filter Values and counts once updated - * - * @author potanin@UD - */ - var update_filters = this.update_filters = function ( args ) { - log( 'update_filters', 'procedurals' ); - jQuery( document ).trigger( 'dynamic_filter::update_filters::initialize' ); - - jQuery.each( s.data.filterable_attributes , function ( attribute_key , filter_data ) { - /** Can happen if server returns a non-existing Current Filter - e.g. if result was cached */ - if( typeof s.attributes[ attribute_key ] === 'undefined' ) { - return; - } - - render_single_filter( attribute_key, filter_data, args ); - - }); - - jQuery( document ).trigger( 'dynamic_filter::update_filters::complete' ); - - } - - - /** - * Render, or update, a Filter Input. - * - * @author potanin@UD - */ - var render_single_filter = this.render_single_filter = function ( attribute_key, filter_data ) { - log( 'render_filter_ui( ' + attribute_key + ', ' + typeof( filter_data ) + ' ) ', 'procedurals' ); - - var attribute = s.attributes[ attribute_key ]; - var filter = s.data.filters[ attribute_key ]; - var keys_to_remove = {}; - var args = {}; - - var change_selection = function( element, action ) { - if( action === 'enable' || !action ) { - element.prop( 'checked', true ).closest( 'li' ).addClass( s.classes.filter.selected ); - } else { - element.prop( 'checked', false ).closest( 'li' ).removeClass( s.classes.filter.selected ); - } - } - - /** Check if Filter UI has not been rendered yet - this is only run once. */ - if( typeof filter === 'undefined' ) { - - args.initial_run = true; - - /** Create UX object of Filter DOM elements and settings that is applicable to all filters */ - filter = { - inputs_list_wrapper: jQuery( '
                ' ), - filter_label: jQuery( s.ux.filter_label ).clone( true ).attr( 'class', s.classes.filter.filter_label ).text( s.attributes[ attribute_key ].label ), - inputs_list: jQuery( '
                  ' ), - show_more: jQuery( '
                  ' + s.settings.messages.show_more + '
                  ' ).hide(), - show_less: jQuery( '
                  ' + s.settings.messages.show_less + '
                  ' ).hide(), - filter_note: jQuery( '
                  ' ).hide(), - items: {}, - triggers: [] - }; - - /** Hide the label if it isn't supposed to be seen */ - if( !s.attributes[ attribute_key ].filter_show_label ) { - filter.filter_label.hide(); - } - - /** Create DOM elements that apply to all Input Types: Inputs List Wrapper, Label, Inputs List and Dynamic Text */ - s.ux.filter.append( filter.inputs_list_wrapper ); - filter.inputs_list_wrapper.append( filter.filter_label ); - filter.inputs_list_wrapper.append( filter.inputs_list ); - filter.inputs_list_wrapper.append( filter.filter_note ); - filter.inputs_list_wrapper.append( filter.show_more ); - filter.inputs_list_wrapper.append( filter.show_less ); - - /** Show Filter Note if it exists */ - if( attribute.filter_note !== '' ) { - filter.filter_note.show(); - } - - /** If no Label is empty, hide the Label element */ - if( attribute.label === '' ) { - filter.filter_label.hide(); - } - - s.data.filters[ attribute_key ] = filter; - - filter.show_more.click( function() { - jQuery( '.' + s.classes.filter.extended_option, filter.inputs_list_wrapper ).show(); - filter.inputs_list_wrapper.toggleClass( s.classes.filter.currently_extended ); - filter.show_more.toggle(); - filter.show_less.toggle(); - }) - - filter.show_less.click( function() { - jQuery( '.' + s.classes.filter.extended_option, filter.inputs_list_wrapper ).hide(); - filter.inputs_list_wrapper.toggleClass( s.classes.filter.currently_extended ); - filter.show_more.toggle(); - filter.show_less.toggle(); - }) - - } /* Initial Filter Run */ - - log({ - 'Attribute Key': attribute_key, - 'Attribute Settings': attribute, - 'Filter Type': attribute.filter, - 'Filter Detail': filter, - 'Verified UX': jQuery.map( attribute.verified_ux ? attribute.verified_ux : {} , function( value, key ) { return key; } ), - 'Filter Items': filter.items - }, 'filter_detail', 'dir' ); - - /** The standard DOM elements have been added - add Input-Type-specific UI */ - switch ( attribute.filter ) { - - /** - * Standard text input box - can be rendered now since not dependent on Filter Values. - * - */ - case 'input': - - if( args.initial_run ) { - - filter.items.single = { - wrapper: jQuery( '
                • ' ), - label: jQuery( '' ), - trigger: jQuery( '' ) - } - - /** Add to DOM */ - jQuery( filter.inputs_list ).append( filter.items.single.wrapper ); - - filter.items.single.wrapper.append( filter.items.single.label ); - filter.items.single.label.append( filter.items.single.trigger ); - - jQuery( filter.items.single.trigger ).unbind( 'keyup' ).keyup( function( event ) { - s.ajax.args.filter_query[ attribute_key ] = filter.items.single.trigger.val(); - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }); - - /** If a value is set in Fitler Query for this attribute, we load it into the Input field */ - if( s.ajax.args.filter_query[ attribute_key ] != '' ) { - filter.items.single.trigger.val( s.ajax.args.filter_query[ attribute_key ] ); - } - - /** Initiated Filter Query */ - filter.items.single.execute_filter = function() { - s.ajax.args.filter_query[ attribute_key ] = filter.items.single.trigger.val(); - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }; - - } - - /** If autocomplete was requested and exists */ - if( attribute.verified_ux.autocomplete ) { - log( 'render_filter_ui() - Adding AutoComplete UX to (' + attribute_key + ').' , 'filter_ux', 'info' ); - - jQuery( filter.items.single.trigger ).unbind( 'keyup' ); - - jQuery( filter.items.single.trigger ).autocomplete({ - appendTo: filter.items.single.wrapper, - source: jQuery.map( attribute.filter_values ? attribute.filter_values : [], function( value, key ) { - return typeof value === 'object' ? value.value : false; - }), - select: function( event, ui ) { - filter.items.single.execute_filter(); - }, - change: function( event, ui ) { - filter.items.single.execute_filter(); - } - }); - - } - - break; - - - /** - * Dropdown values are fully refreshed every time CF changes. - * - * - */ - case 'dropdown': - - if( args.initial_run ) { - - filter.items.single = { - wrapper: jQuery( '
                • ' ), - label: jQuery( '' ), - trigger: jQuery( '' ), - empty_placeholder: jQuery( '' ) - } - - /** Add to DOM */ - jQuery( filter.inputs_list ).append( filter.items.single.wrapper ); - filter.items.single.wrapper.append( filter.items.single.label ); - filter.items.single.label.append( filter.items.single.trigger ); - filter.items.single.trigger.append( filter.items.single.empty_placeholder ); - - jQuery( filter.items.single.trigger ).keyup( function( event ) { - s.ajax.args.filter_query[ attribute_key ] = filter.items.single.trigger.val(); - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }); - - jQuery( filter.items.single.trigger ).unbind( 'change' ).change( function ( event ) { - - filter.items.single.trigger.value = jQuery( ':selected', this ).val(); - - if( jQuery.inArray( filter.items.single.trigger.value, s.ajax.args.filter_query[ attribute_key ] ) === -1 ) { - s.ajax.args.filter_query[ attribute_key ] = [ filter.items.single.trigger.value ]; - } else { - s.ajax.args.filter_query[ attribute_key ] = []; - } - - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - - }); - - } - - jQuery( '> option', filter.items.single.trigger ).each( function() { - if( jQuery( this ).attr( 'filter_key' ) ) { - keys_to_remove[ jQuery( this ).attr( 'filter_key' ) ] = jQuery( this ); - } - }); - - /** Cycle through each filter Value - if exist */ - jQuery.each( attribute.filter_values ? attribute.filter_values: [] , function ( index, filter_value ) { - - if( typeof filter_value !== 'object' ) { - return; - } - - delete keys_to_remove[ filter_value.filter_key ]; - - /** Get ' ); - - /** If we want to show the count */ - if( attribute.filter_show_count && filter_value.value_count ) { - filter_value.element.append( ' (' + filter_value.value_count + ')' ); - } - - } else { - /** If we want to show count, here we replace the value */ - if( attribute.filter_show_count ){ - filter_value.element.text( filter_value.element.text().replace( /\(\d+\)$/, '(' + filter_value.value_count + ')' ) ); - } - - } - - /** Insert Option at position in index */ - insert_at( filter.items.single.trigger, filter_value.element, ( index + 1 ) ); - - }); - - /** If a value is set in Fitler Query for this attribute, we load it into the Input field */ - if( s.ajax.args.filter_query[ attribute_key ] != '' && filter.items.single.trigger.val() === '' ) { - filter.items.single.trigger.val( s.ajax.args.filter_query[ attribute_key ] ); - } - - break; - - - /** - * Creates an input field for every returned value and the count. - * - * Should remove all existing filter values once have new site unless filter_show_disabled_values is set to true - */ - case 'checkbox': - - if( args.initial_run ) { - } - - /** Build array of all current inputs for potential later removal */ - jQuery( ' > .' + s.classes.filter.value_wrapper , filter.inputs_list ).each( function() { - if( jQuery( this ).attr( 'filter_key' ) ) { - keys_to_remove[ jQuery( this ).attr( 'filter_key' ) ] = jQuery( this ); - } - }); - - if( attribute.default_filter_label != '' ) { - attribute.filter_values[ 0 ] = { - filter_key: 'show_all', - value: attribute.default_filter_label, - css_class: s.classes.filter.default_filter - }; - } - - /** Cycle through each filter Value - if exist */ - jQuery.each( attribute.filter_values ? attribute.filter_values: [] , function ( index, filter_value ) { - - if( typeof filter_value !== 'object' ) { - return; - } - - index = parseInt( index ); - - var this_element = filter.items[ filter_value.filter_key ] = filter.items[ filter_value.filter_key ] ? filter.items[ filter_value.filter_key ] : {}; - - /** Do not remove this input */ - delete keys_to_remove[ filter_value.filter_key ]; - - filter_value.css_class = filter_value.css_class ? filter_value.css_class : s.classes.filter.value_wrapper; - - /** Look for existing element */ - this_element.wrapper = jQuery( 'li[filter_key="' + filter_value.filter_key + '"]', filter.inputs_list ); - - /** If no wrapper - create and append all elements, otherwise load from this_element */ - if( !this_element.wrapper.length ) { - this_element.wrapper = jQuery( '
                • ' ); - - this_element.label_wrapper = jQuery( '' ); - this_element.trigger = jQuery( '' ); - this_element.label = jQuery( '' + filter_value.value + ' ' ); - this_element.count = jQuery( '' ); - - this_element.label_wrapper.append( this_element.trigger ); - this_element.label_wrapper.append( this_element.label ); - this_element.label_wrapper.append( this_element.count ); - - this_element.wrapper.append( this_element.label_wrapper ); - - }; - - if( filter_value.filter_key !== 'show_all' ) { - filter.triggers.push( this_element.trigger ); - } - - if( typeof attribute.filter_collapsable === 'number' && index > attribute.filter_collapsable ) { - this_element.wrapper.addClass( s.classes.filter.extended_option ); - - //** If Inputs List is already extended, we do not hide "extra" inputs */ - if( !filter.inputs_list_wrapper.hasClass( s.classes.filter.currently_extended ) ) { - this_element.wrapper.addClass( s.classes.filter.extended_option ).hide(); - filter.show_more.show(); - filter.show_less.hide(); - } - - } else { - this_element.wrapper.removeClass( s.classes.filter.extended_option ); - } - - this_element.wrapper.removeClass( s.classes.disabled_item ); - this_element.trigger.prop( 'disabled', false ); - - /** If Value Count has not been created, or is empty */ - if( typeof filter_value.value_count !== 'undefined' || ( typeof filter_value.value_count == 'object' && filter_value.value_count.val() === '' ) ) { - this_element.count.text( ' (' + filter_value.value_count + ') ' ); - } - - if( !attribute.filter_show_count ) { - jQuery( this_element.count ).hide(); - } - - /** Insert at position, increase index by 1 to give space to Default Filter Label */ - insert_at( filter.inputs_list, this_element.wrapper, ( index + 1 ) ); - - jQuery( this_element.trigger ).unbind( 'change' ).change( function () { - - /** Do not allow Show All to be unchecked */ - if( jQuery( this ).val() === 'show_all' && !jQuery( this ).prop( 'checked' ) ) { - change_selection( filter.items[ 'show_all' ].trigger, 'enable' ); - return false; - } - - /** If regular input is checked, uncheck Show All */ - if( jQuery( this ).val() != 'show_all' && jQuery( this ).prop( 'checked' ) ) { - - change_selection( jQuery( this ), 'enable' ); - change_selection( filter.items[ 'show_all' ].trigger, 'disable' ); - - if( jQuery.inArray( this_element.trigger.val(), s.ajax.args.filter_query[ attribute_key ] ) === -1 ) { - s.ajax.args.filter_query[ attribute_key ].push( this_element.trigger.val() ); - } else { - s.ajax.args.filter_query[ attribute_key ] = remove_from_array( this_element.trigger.val() , s.ajax.args.filter_query[ attribute_key ] ); - } - - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - - } - - /** If Show All is checked, uncheck all other inputs */ - if( jQuery( this ).val() === 'show_all' && jQuery( this ).prop( 'checked' ) ) { - change_selection( jQuery( this ), 'enable' ); - - jQuery( filter.triggers ).each( function() { - change_selection( jQuery( this ), 'disable' ); - }); - - s.ajax.args.filter_query[ attribute_key ] = []; - - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - - } - - }); - - /** If a value is set in Filter Query for this attribute, we load it into the Input field */ - if( jQuery.inArray( filter_value.filter_key, s.ajax.args.filter_query[ attribute_key ] ) !== -1 ) { - change_selection( this_element.trigger, 'enable' ); - } - - }); - - if( jQuery.isEmptyObject( s.ajax.args.filter_query[ attribute_key ] ) && typeof filter.items[ 'show_all' ] === 'object' ) { - change_selection( filter.items[ 'show_all' ].trigger, 'enable' ); - } - - - break; - - - /** - * Builds Range Input (or a slider) based off minimum and maximum Filter Values. - * - */ - case 'range': - - if( args.initial_run ) { - - filter.items.single = { - wrapper: jQuery( '
                • ' ), - label: jQuery( '' ), - min: jQuery( '' ), - max: jQuery( '' ) - } - - /** Add to DOM ( Not properly nested, hack. ) */ - jQuery( filter.inputs_list ).append( filter.items.single.min ); - jQuery( filter.inputs_list ).append( filter.items.single.max ); - - jQuery( filter.items.single.min ).unbind( 'keyup' ).keyup( function( event ) { - s.ajax.args.filter_query[ attribute_key ] = { - min: filter.items.single.min.val(), - max: filter.items.single.max.val() - } - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }); - - jQuery( filter.items.single.max ).unbind( 'keyup' ).keyup( function( event ) { - s.ajax.args.filter_query[ attribute_key ] = { - min: filter.items.single.min.val(), - max: filter.items.single.max.val() - } - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - }); - - } - - /** If autocomplete was requested and exists */ - if( attribute.verified_ux.date_selector ) { - log( 'render_filter_ui() - Updating DateSelector UX to (' + attribute_key + ').' , 'filter_ux', 'info' ); - - /** Render full object only once */ - if( typeof filter.items.single.range_selector === 'undefined' ) { - jQuery( filter.items.single.min ).remove(); - jQuery( filter.items.single.max ).remove(); - - jQuery( filter.inputs_list ).append( filter.items.single.date_selector_field = jQuery('
                  ') ); - jQuery( filter.inputs_list ).append( filter.items.single.range_selector = jQuery('
                  ') ); - - filter.items.single.range_selector.date_selector({ - flat: true, - calendars: 2, - position: 'left', - format: 'ymd', - mode: 'range', - onChange: function( range ) { - filter.items.single.date_selector_field.val( typeof range === 'object' ? range.join(' - ') : '' ); - s.ajax.args.filter_query[ attribute_key ] = { min: range[0], max: range[1] } - jQuery( document ).trigger( 'dynamic_filter::execute_filters' ); - } - }); - - jQuery( document ).bind( 'dynamic_filter::get_data', function() { - //filter.items.single.range_selector.hidePicker(); - }); - - filter.items.single.date_selector_field.focus( function() { - //console.log( filter.items.single.range_selector.showPicker() ); - }); - - } - - /** If a value is set in Fitler Query for this attribute, we load it into the Date Selector */ - if( typeof s.ajax.args.filter_query[ attribute_key ] === 'object' ) { - filter.items.single.range_selector.setDate( [ s.ajax.args.filter_query[ attribute_key ].min, s.ajax.args.filter_query[ attribute_key ].max ] ); - } - - } /* end date_selector */ - - - break; - - } - - /** Remove old filter keys */ - jQuery.each( keys_to_remove, function( filter_key ) { - - if( attribute.filter_show_disabled_values ) { - - if( typeof filter.items[ filter_key ] === 'object' && filter.items[ filter_key ].count ) { - filter.items[ filter_key ].wrapper.addClass( s.classes.disabled_item ); - filter.items[ filter_key ].trigger.prop( 'disabled', true ); - filter.items[ filter_key ].count.text( '' ); - } - - } else { - jQuery( this ).remove(); - } - - }); - - - /** Toggle Filter List Wrapper if there are no values - unless it should always be dispalyed */ - if( !attribute.filter_always_show && jQuery.isEmptyObject( attribute.filter_values ) ) { - log( 'render_filter_ui - No Filter Values for ' + attribute_key + ' - hiding input.', 'filter_detail', 'info' ); - filter.inputs_list_wrapper.hide(); - } else { - filter.inputs_list_wrapper.show(); - } - - } - - - /** - * Gets remote data to match the Requested Range and query. - * - * @author potanin@UD - */ - var get_data = this.get_data = function ( event, args ) { - jQuery( document ).trigger( 'dynamic_filter::get_data::initialize', [args] ); - - s.status.loading = true; - - /** Merge defaults with passed args */ - args = jQuery.extend( true, { - silent_fetch: false, - append_results: false - }, args ); - - /** Request counter */ - s.data.get_count = typeof s.data.get_count === 'number' ? ( s.data.get_count + 1 ) : 1; - - /** Set ranges */ - if( !s.settings.request_range.start ) { - s.settings.request_range.start = 0; - } - - if( !s.settings.request_range.end ) { - s.settings.request_range.end = s.settings.dom_limit; - } - - /** Combine defined AJAX args with settings, which include query */ - var ajax_request = jQuery.extend( true, s.ajax.args, s.settings, { - filterable_attributes: s.data.filterable_attributes - }); - - if( !args.silent_fetch ) { - jQuery( document ).trigger( 'dynamic_filter::doing_ajax', { settings: s, args: args, ajax_request: ajax_request } ); - } - - log( ajax_request.filter_query, 'ajax_detail', 'dir' ); - - jQuery.ajax({ - dataType: s.ajax.format, - type: 'POST', - cache: s.ajax.cache, - async: s.ajax.async, - url: s.ajax.url, - data: ajax_request, - success: function ( ajax_response, textStatus, jqXHR ) { - log( 'get_data - Have AJAX response.', 'ajax_detail', 'debug' ); - - delete s.status.loading; - - /** Make sure callback returns notice. Apply any filters and callbacks to the s.data.all_results */ - var maybe_ajax_response = s.callbacks.result_format( ajax_response ); - if( maybe_ajax_response && typeof maybe_ajax_response === 'object' ) { - ajax_response = maybe_ajax_response; - } - - log( ajax_response, 'ajax_detail', 'dir' ); - - /** Ensure AJAX Response has proppery formatting */ - if( typeof ajax_response.all_results !== 'object' ) { - log( 'get_data() - AJAX response missing all_results array.', 'log', 'error' ); - return false; - } - - /** BLank out Filter Values */ - jQuery.each( s.attributes , function( attribute_key, attribute_data ) { - s.attributes[ attribute_key ].filter_values = []; - }); - - /** Cycle through Current Filters and copy returned data into s.attributes */ - jQuery.each( ajax_response.current_filters ? ajax_response.current_filters : {} , function( attribute_key, attribute_filters ) { - - if( !s.attributes[ attribute_key ] ) { - return; - } - - if( typeof attribute_filters.min !== 'undefined' && typeof attribute_filters.max !== 'undefined' ) { - s.attributes[ attribute_key ].filter_values = attribute_filters; - } - - /** Cycle through Filters and determine the best key to use ( Value, Label or index count ) */ - jQuery.each( attribute_filters, function( index, data ) { - - /** Must have a filter_key */ - if( typeof data.filter_key === 'undefined' || data.filter_key === null ) { - return; - } - - if( typeof data.value === 'undefined' || data.value == '' || data.value === null ) { - data.value = data.filter_key; - } - - if( !data.value.length ) { - return; - } - - /** Add to Filter Values, leaving 0 index in for default */ - s.attributes[ attribute_key ].filter_values[ ( parseInt( index ) + 1 ) ] = data; - - }); - - }); /* end ajax_response.current_filters */ - - /** Make sure that All Results contains data, or else we fail */ - if( !jQuery.isEmptyObject( ajax_response ) ) { - jQuery( document ).trigger( 'dynamic_filter::get_data::complete', jQuery.extend( args, ajax_response ) ); - - } else { - /** No Results returned - is there a rendered query in history? */ - if( typeof s.data.rendered_query[0] === 'object') { - status( s.settings.messages.no_results , { type: 'error', hide: false, click_trigger: 'dynamic_filter::undo_last_query' }); - - } else { - status( s.settings.messages.no_results , { type: 'error', hide: false, click_trigger: ( s.settings.debug ? 'dynamic_filter::get_data' : '' ) }); - jQuery( document ).trigger( 'dynamic_filter::get_data::fail', args ); - - } - - } - - }, - error: function ( jqXHR, textStatus, errorThrown ) { - status( s.settings.messages.server_fail , { type: 'error', hide: false, click_trigger: ( s.settings.debug ? 'dynamic_filter::get_data' : '' ) }); - jQuery( document ).trigger( 'dynamic_filter::get_data::fail', args ); - - } - }); - - }; - - - /** - * Handles DFRO conversion and inserts DFRO DOM elements into All Results UX - * - * All results inserted at their positions as hidden elements, existing results are not hidden, only moved. - * If a DFRO's Result Count has changed, then we assume that the query has changed since on Load More and Silent Fetch - * the Result Count should stay the same from one request to the next. - * - * @author potanin@UD - */ - var append_dom = this.append_dom = function ( event, args ) { - log( 'append_dom()', 'procedurals' ); - - jQuery( document ).trigger( 'dynamic_filter::append_dom::initialize', args ); - - s.data.all_results = s.data.all_results ? s.data.all_results : []; - - if( !args.append_results ) { - s.data.all_results = []; - } - - /** Remove Placeholder Results */ - if( s.ux.placeholder_results && args.initial_request && s.ux.placeholder_results.length ) { - log( 'Removing Placeholder Results.', 'dom_detail', 'info' ); - jQuery( s.ux.placeholder_results ).remove(); - /* s.helpers.purge( s.ux.placeholder_results ); */ - } - - /** Processes single DFRO's attributes */ - append_dom.process_attributes = function( dfro ) { - - /** Create Attribute Wrapper container */ - dfro.dom.row.append( dfro.dom.attribute_wrapper ); - - /** Cycle through individual attributes in the result row */ - jQuery.each( dfro.attribute_data , function ( attribute_key, attribute_value ) { - - /** Skip if returned attribute has not been defined */ - if( !s.attributes[ attribute_key ] ) { - return; - } - - /** If this attribute has a filter, add the key and value to the Result Row as an argument */ - if( s.attributes[ attribute_key ].filter ) { - dfro.dom.row.attr( attribute_key, attribute_value ); - } - - /** If this Attribute is not displayed, there is nothing else to do */ - if( !s.attributes[ attribute_key ].display ) { - log( 'append_dom.process_attributes - Returned attribute (' + attribute_key +') is defined, but not for display - skipping.', 'attribute_detail', 'info' ); - return; - } - - /** Concatenate array of Attribute Values */ - if( jQuery.isArray( attribute_value ) ) { - log( 'append_dom.process_attributes - Value returned as an array for ' + attribute_key, 'attribute_detail', 'info' ); - attribute_value = attribute_value.join( concatenation_character ); - } - - /** If this attribute has a Render callback, we call it */ - if( typeof s.attributes[ attribute_key ].render_callback == 'function' ) { - log( 'append_dom.process_attributes - Callback function found for ' + attribute_key + '.', 'attribute_detail', 'info' ); - attribute_value = s.attributes[ attribute_key ].render_callback( attribute_value, { data: dfro.attribute_data, dfro: dfro }); - } - - /** Create DOM reference for this attribute in DFRO and append it to Attribute Wrapper */ - dfro.dom.attribute_wrapper.append( dfro.dom.attributes[ attribute_key ] = jQuery( '
                • ' + ( attribute_value !== null ? attribute_value : '' ) + '
                • ' ) ); - - log({ - 'Log Event' : 'Appended dfro.dom.attributes[' + attribute_key + '] attribute.', - 'Attribute Key': attribute_key, - 'Attribute Value': attribute_value, - 'Attribute Value Type': typeof attribute_value, - 'Attribute DOM': dfro.dom.attributes[ attribute_key ] - }, 'attribute_detail', 'dir' ); - - }); /* end of single attribute processing */ - - } /* end append_dom.process_attributes() */ - - var to_remove = jQuery.extend( {}, s.data.dom_results ); - - /** Cycle through All Results and convert raw JSON items into DFROs */ - jQuery.each( args.all_results, function ( result_count, attribute_data ) { - - /** Indeces must be numeric since they establish Result Count (rendered order) */ - if( typeof result_count != 'number' ) { - log( 'append_dom() - Unexpected Data Error! "index" is (' + typeof result_count + '), not a numeric value as expected.', 'log', 'error' ); - return true; - } - - /** If we are appending - then the Result Count is modified based on current results */ - if( args.append_results ) { - result_count = s.data.total_in_dom + result_count; - } - - /** Get the Unique DOM ID for this DFRO */ - var dom_id = 'df_' + ( s.settings.unique_tag ? s.settings.unique_tag : 'row' ) + '_' + ( typeof s.settings.unique_tag === 'string' && typeof attribute_data[ s.settings.unique_tag ] !== 'undefined' ? attribute_data[ s.settings.unique_tag ] : s.helpers.random_string() ); - - delete to_remove[ dom_id ]; - - /* Check if this result is already in DOM */ - if( typeof s.data.dom_results[ dom_id ] === 'object' ) { - log( 'append_dom() - Result #' + dom_id + ' already in DOM - moving to position ' + result_count, 'dom_detail', 'info' ); - insert_at( s.ux.results, s.data.dom_results[ dom_id ].dom.row, result_count ); - s.data.all_results[ result_count ] = s.data.dom_results[ dom_id ]; - return true; - } - - /** Create structure for DFRO, move raw JSON data into attribute_data */ - var dfro = s.data.dom_results[ dom_id ] = s.data.all_results[ result_count ] = jQuery.extend( {}, { - attribute_data: attribute_data, - unique_id: typeof s.settings.unique_tag === 'string' ? attribute_data[ s.settings.unique_tag ] : false, - dom: { - row: s.ux.result_item.clone( false ), - attribute_wrapper: jQuery( '
                    ' ), - attributes: {} - }, - dom_id: dom_id, - result_count: result_count - }); - - jQuery( document ).trigger( 'dynamic_filter::render_data::row_element', dfro ); - - dfro.dom.row.attr( 'id', dom_id ).attr( 'class', s.classes.results.row ).attr( 'df_result_count', result_count ).attr( 'style', s.css.results.hidden_row ); - - log({ - 'Log Event' : 'append_dom() - #' + dfro.dom_id + ' - DOM created.', - 'DOM ID': '#' + dfro.dom_id, - 'Result Count': dfro.result_count, - 'DOM': dfro.dom, - 'Attribute Data': dfro.attribute_data - }, 'attribute_detail', 'dir' ); - - append_dom.process_attributes( dfro ); - - /** Swiftly, silently and deadly append the new DFRO to UX All Results at position */ - if( insert_at( s.ux.results, dfro.dom.row, dfro.result_count ) ) { - log( 'append_dom() - Inserted #' + dfro.dom_id + ' at position ' + dfro.result_count + '.', 'dom_detail', 'info' ); - } else { - log( 'append_dom() - Unable to insert #' + dfro.dom_id + ' at position ' + dfro.result_count + '.', 'dom_detail', 'error' ); - } - - }); /** DFRO has been created and appended */ - - if( !args.append_results ) { - jQuery.each( to_remove ? to_remove : {}, function( dom_id, data ) { - log( 'append_dom() - Removing #' + dom_id + ', no longer in result set.', 'dom_detail', 'info' ); - data.dom.row.remove(); - delete s.data.dom_results[ dom_id ]; - }); - } - - if( s.data.all_results.length > 0 ) { - jQuery( s.ux.element ).addClass( s.classes.element.have_results ); - } else { - jQuery( s.ux.element ).removeClass( s.classes.element.have_results ); - } - - jQuery( document ).trigger( 'dynamic_filter::append_dom::complete', args ); - - /** Count of all possible results based on current query. */ - s.data.total_results = args.total_results ? args.total_results : s.data.all_results.length; - - /** Numeric count of elements in DOM, regardless of visibility status. */ - s.data.total_in_dom = parseInt( s.data.all_results.length ); - - /** Numeric count of additional results, matching current query, that are not in DOM. */ - s.data.more_available_on_server = s.data.total_results - s.data.total_in_dom; - - return args; - - } - - - /** - * Visually render DFROs. - * - * @author potanin@UD - */ - var render_data = this.render_data = function ( event, args ) { - log( 'render_data()', 'procedurals' ); - - jQuery( document ).trigger( 'dynamic_filter::render_data::initialize', args ); - - /** Set default visible range */ - if( !s.settings.visible_range ) { - s.settings.visible_range = { - start: 0, - end: s.settings.per_page ? s.settings.per_page : 25 - } - } - - /** Numeric count of the currently visible results based on s.settings.visible_range (does not take into account remainders) */ - s.data.now_visible = parseInt( s.settings.visible_range.end ) - parseInt( s.settings.visible_range.start ); - - /** Numeric count of available results that are in DOM, but are not visible. */ - s.data.more_available_in_dom = parseInt( s.data.total_in_dom ) - parseInt( s.data.now_visible ); - - /** Numeric count of the number of results that are expected to be rendered when "Load More" is pressed, regardless of if a server call will be necesary*/ - s.data.next_batch = ( s.data.total_results - s.settings.visible_range.end ) < s.settings.per_page ? ( s.data.total_results - s.settings.visible_range.end ) : s.settings.per_page; - - log({ - 'Total In DOM': s.data.total_in_dom, - 's.data.all_results.length': s.data.all_results.length, - 'Now Visible': s.data.now_visible, - 'Next Batch': s.data.next_batch, - 'Per Page': s.settings.per_page, - 'More Available in DOM': s.data.more_available_in_dom, - 'More Available on Server': s.data.more_available_on_server, - 'Total Results': s.data.total_results - }, 'dom_detail', 'dir' ); - - /** Use Isotope to render results */ - if( s.supported.isotope ) { - - /** Show current row if it is within the Visible Range */ - if( s.settings.visible_range.start <= index && index < s.settings.visible_range.end ) { - s.ux.results.isotope( 'insert', result.dom.row.row ); - } else { - result.dom.row.show(); - } - - /** {missing description} */ - if( s.supported.isotope ) { - s.ux.results.isotope( 'destroy' ).isotope({ - itemSelector : '.' + s.classes.results.row + ':visible' - }); - } - - } else { - - /** Cycle through the All Results array, this time simply referencing the DOM Object */ - jQuery.each( s.data.all_results , function ( result_count, result ) { - /** Hide Result Row if it is outside of Visible Range */ - if( s.settings.visible_range.start <= result_count && result_count < s.settings.visible_range.end ) { - log( 'render_data - #' + result.dom_id + ' - Appending to Results, index: (' + result_count + '). Displaying.', 'dom_detail' ); - result.dom.row.attr( 'style', s.css.results.visible_row ); - - } else { - log( 'render_data - #' + result.dom_id + ' - Appending to Results, index: (' + result_count + '). Hiding.', 'dom_detail' ); - result.dom.row.attr( 'style', s.css.results.hidden_row ); - } - - }); - - } - - /** If less results than rendered in first view, no "Load More" button */ - if( s.data.next_batch <= 0 ) { - jQuery( s.ux.load_more ).hide(); - } else { - jQuery( s.ux.load_more ).show(); - jQuery( s.ux.load_more ).html( sprintf( s.settings.messages.load_more , [s.data.now_visible, s.data.total_results, s.data.next_batch] ) ); - - } - - /** Save Rendered Query to history. */ - s.data.rendered_query.unshift( jQuery.extend( true, {}, s.ajax.args.filter_query) ); - - jQuery( document ).trigger( 'dynamic_filter::render_data::complete', s.data ); - - /** Since we have results, we save certain configurations */ - jQuery( document ).trigger( 'dynamic_filter::instance::set', s.data ); - - return true; - - } - - - /** - * Initiated after a filter has been changed, and user intent has been established. - * - * No triggers on purpose since this function can be called very often and rapidly when triggered on keyupresses. - * - * @author potanin@UD - */ - var execute_filters = this.execute_filters = function ( value ) { - - clearTimeout( s.active_timers.filter_intent ); - - jQuery( s.ux.element ).addClass( s.classes.element.filter_pending ); - - s.active_timers.filter_intent = setTimeout( function () { - - /** These Request Range values force a reset of request range in get_data() */ - s.settings.request_range = { - start: 0, - end: /* s.settings.dom_limit */ false - } - - jQuery( document ).trigger( 'dynamic_filter::get_data' ); - - }, s.settings.timers.filter_intent ); - - } - - - /** - * Loads more listings - * - * @author potanin@UD - */ - var load_more = this.load_more = function () { - - /* Update Visible Range */ - s.settings.visible_range.end = s.settings.visible_range.end + s.settings.per_page; - - /* Render the results with the updated Visible Range */ - render_data(); - - /** If next batch requires a server call, make it now */ - if( s.data.total_in_dom <= ( s.data.now_visible + s.data.next_batch ) && parseInt( s.data.more_available_on_server > 0 ) ) { - - log( 'load_more - fetching more results.', 'detail' ); - - /** Update ranges */ - s.settings.request_range = { - start: s.data.total_in_dom, - end: s.data.total_in_dom + ( s.settings.per_page * s.settings.load_ahead_multiple ) - }; - - jQuery( document ).trigger( 'dynamic_filter::get_data', { - silent_fetch: true, - append_results: true - }); - - } - - } - - - /** - * Scrolls the sidebar along with view. - * - * Function does not check if .animate exists, so must be checked before this is called. - * - * !todo Bugs out in IE7 when used with UserVoice widget. - potanin@UD - * @since 1.0.7 - * @author potanin@UD - */ - var chesty_puller = this.chesty_puller = function ( args ) { - - s.settings.chesty_puller = jQuery.extend( true, { - top_padding: 45, - offset: jQuery( s.ux.filter ).offset() - }, s.settings.chesty_puller ); - - - chesty_puller.move_chesty = function () { - var args = s.settings.chesty_puller; - - if ( jQuery( window ).scrollTop() > args.offset.top ) { - jQuery( s.ux.filter ).stop().animate({ marginTop: jQuery( window ).scrollTop() - args.offset.top + args.top_padding }); - } else { - jQuery( s.ux.filter ).stop().animate({ marginTop: 0 }); - }; - - } - - jQuery( window ).scroll( move_chesty ); - - - } - - - /** - * Serialize an object. Alternative to JSON.stringify() which IE7 does not have. - * - * @author potanin@UD - */ - var serialize_json = function( obj ) { - log( 'serialize_json()', 'helpers' ); - - if( typeof JSON === 'object' && typeof JSON.stringify === 'function' ) { - return JSON.stringify( obj ); - } - - var t = typeof(obj); - if(t != "object" || obj === null) { - if(t === "string") obj = '"' + obj + '"'; - return String(obj); - - } else { - var json = [], arr = (obj && obj.constructor === Array); - - jQuery.each(obj, function(k, v) { - t = typeof(v); - if(t === "string") v = '"' + v + '"'; - else if (t === "object" & v !== null) v = serialize_json(v) - json.push((arr ? "" : '"' + k + '":') + String(v)); - }); - - return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}"); - } - } - - - /** - * Replaces values in a string. - * - * For now this is a very basic implementation, only replacing a single instance. - * - * @author potanin@UD - */ - var sprintf = function( string, value ) { - log( 'sprintf()', 'helpers' ); - - /** Ensure an array */ - if( typeof value != 'array' ){ - var arr = [ value ]; - }else{ - var arr = value; - } - - /** Setup our ret */ - var ret = string; - - /** Loop through the array replacing all the values as we go through */ - for( var x in value ){ - - var pos = parseInt( x ) + 1; - // log( 'Replace::' + x + '::' + pos ); - // log( 'Value::' + value[ x ] ); - ret = ret.replace( '{' + pos + '}', value[ x ] ); - - } - - /** Return */ - return ret; - } - - - /** - * Unserialize a string if it is serialized, or leave be if already an object - * - * !todo Needs to be done so cookie-data can be restored and merged into the settings object. - potanin@UD - * @author potanin@UD - */ - var maybe_unserialize_json = function( string ) { - - if( typeof string === 'object' ) { - return string; - } - - if( typeof JSON === 'object' && typeof JSON.parse === 'function' ) { - return JSON.parse( string ); - } - - /** TO DO: add equivilant to parse */ - - } - - - /** - * Helper: Remove from an array by value - * - * @author potanin@UD - */ - var remove_from_array = this.remove_from_array = function( value, arr ) { - log( 'remove_from_array()', 'helpers' ); - - return jQuery.grep(arr, function(elem, index) { - return elem !== value; - }); - } - - - /** - * Helper: Insert an element at a position - * - * !todo Add logic to ensure that element was inserted at position. - * @author potanin@UD - */ - var insert_at = this.insert_at = function( container, element, index ) { - log( 'insert_at()', 'procedurals' ); - - container = jQuery( container ); - - var size = container.children().size(); - var index = parseInt( index ); - -//console.log( element ); -//console.log( container.html() ); - - /** If the container does not have any children, we insert the element at first position */ - if( index === 0 || !container.children().eq( (index - 1) ).length ) { - container.append( element ); - - } else { - - container.append( element ); - - /** @todo After the element is appended, then we should move it to a position */ - - //container.children().eq( index - 1 ).after( element ); - - } - - return true; - -//console.log( 'Index: ' + index + ', Actual Index: ' + element.index() ); - - } - - - /** - * Meant to be run on initializtion only, otherwise will overwrite our s.history object - * - * URL-parameters overwrite cookie settings when there is a value conflict. - * - * author potanin@UD - */ - s.instance.load = typeof s.instance.load === 'function' ? s.instance.load : function( args ) { - log( 's.instance.load()', 'procedurals' ); - - /** Load Cookie Data */ - if( s.supported.cookies ) { - s.instance.rendered_query = jaaulde.utils.cookies.get( s.settings.filter_id + '_rendered_query' ); - //s.instance.result_range = jaaulde.utils.cookies.get( s.settings.filter_id + '_result_range' ); - s.instance.per_page = jaaulde.utils.cookies.get( s.settings.filter_id + '_per_page' ); - s.instance.sort_by = jaaulde.utils.cookies.get( s.settings.filter_id + '_sort_by' ); - s.instance.sort_direction = jaaulde.utils.cookies.get( s.settings.filter_id + '_sort_direction' ); - } - - /** Ensure Rendered Query is an object before checking URL for data */ - s.instance.rendered_query = s.instance.rendered_query ? s.instance.rendered_query : {}; - - /** Check URL hash for data, if found - append Filter Query and overwrite cookie settings */ - jQuery.each( s.helpers.url_to_object(), function( key, value ) { - - if( jQuery.inArray( key, [ 'sort_by', 'sort_direction', 'per_page' ] ) !== -1 ) { - s.instance[ key ] = value[0]; - } else { - s.instance.rendered_query[ key ] = value; - } - - }); - - //log( s.instance, 'instance_detail', 'dir' ); - - /** Apply Instance Data */ - s.ajax.args.filter_query = jQuery.extend( true, s.ajax.args.filter_query, s.instance.rendered_query ); - s.settings.sort_by = s.instance.sort_by ? s.instance.sort_by : s.settings.sort_by; - s.settings.sort_direction = s.instance.sort_direction ? s.instance.sort_direction : s.settings.sort_direction; - s.settings.per_page = parseInt( s.instance.per_page ? s.instance.per_page : s.settings.per_page ); - - /** Result Rnage (Disabled for now, the URL-stored values are all being placed into Rendered Query, so rules are needed to prevent that */ - if( s.instance.result_range ) { - s.settings.request_range = { - start: s.instance.result_range.split( '-' )[0], - end: s.instance.result_range.split( '-' )[1] - } - log( 's.instance.clear() - Setting Result Range: (' + s.settings.request_range.start + ' - ' + s.settings.request_range.end +').', 'instance_detail' ); - } - - } - - - /** - * Saves current instance. - * - * author potanin@UD - */ - s.instance.set = typeof s.instance.set === 'function' ? s.instance.set : function( key, value ) { - log( 's.instance.set()', 'procedurals' ); - - /** Set Instance Data object */ - s.instance.data = { - cookies: { - rendered_query: s.data.rendered_query ? s.data.rendered_query[0] : '', - sort_direction: s.settings.sort_direction, - per_page: s.settings.per_page, - sort_by: s.settings.sort_by - }, - hash: { - sort_direction: s.settings.sort_direction, - per_page: s.settings.per_page, - sort_by: s.settings.sort_by - }, - window_history: { - rendered_query: s.data.rendered_query ? s.data.rendered_query[0] : '' - } - } - - /** Build URL query from latest Rendered Query */ - jQuery.each( s.data.rendered_query && s.data.rendered_query ? s.data.rendered_query[0] : [], function( k, v ) { - s.instance.data.hash[ k ] = v; - }); - - /** Save Cookie Data stuff */ - if( s.supported.cookies ) { - jQuery.each( s.instance.data.cookies, function( key, value ) { - jQuery.cookies.set( s.settings.filter_id + '_' + key, value ); - }); - } - - /** Update URL location hash tags */ - if( s.settings.set_url_hashes ) { - window.location.hash = s.helpers.object_to_url( s.instance.data.hash ); - } else { - window.location.hash = ''; - } - - if( s.supported.window_history ) { - //history.pushState( s.instance.data.window_history , '' ); - } - - return; - - } - - - /** - * Clear our current instance - * - * author potanin@UD - */ - s.instance.clear = typeof s.instance.clear === 'function' ? s.instance.clear : function( args ) { - - /** Clear out Cookie Data if used */ - if( s.supported.cookies ) { - delete s.instance.cookie_data; - jaaulde.utils.cookies.del( s.settings.filter_id + '_rendered_query' ); - jaaulde.utils.cookies.del( s.settings.filter_id + '_result_range' ); - jaaulde.utils.cookies.del( s.settings.filter_id + '_sort_by' ); - jaaulde.utils.cookies.del( s.settings.filter_id + '_sort_direction' ); - } - - return log( 's.instance.clear() - All Instance data cleared out. ', 'instance_detail' ); - } - - - /** - * Tries to load an external library when it is needed. - * - * @author potanin@UD - */ - s.helpers.attempt_ud_ux_fetch = typeof s.helpers.attempt_ud_ux_fetch === 'function' ? s.helpers.attempt_ud_ux_fetch : function( ux_type, attribute_key, ux_settings ) { - - s.helpers.attempt_ud_ux_fetch.attempted = s.helpers.attempt_ud_ux_fetch.attempted ? s.helpers.attempt_ud_ux_fetch.attempted : {}; - - switch( ux_type ) { - - case 'date_selector': - var script_url =' http://cdn.usabilitydynamics.com/jquery.ud.date_selector.js'; - break; - - default: - /** Callback maybe? */ - break; - - } - - /** If already tried, or unknown, fail */ - if( s.helpers.attempt_ud_ux_fetch.attempted[ ux_type ] || !script_url ) { - return false; - } - - s.helpers.attempt_ud_ux_fetch.fail = function( ux_type, attribute_key ) { - log( 'Library (' + ux_type + ') could not be loaded for: (' + attribute_key + '), but we did try.', 'filter_ux', 'info' ); - } - - s.helpers.attempt_ud_ux_fetch.success = function( ux_type, attribute_key ) { - log( 'Library (' + ux_type + ') loaded automatically from UD. Applying to: (' + attribute_key + '). You are welcome.', 'filter_ux', 'info' ); - analyze_attributes.add_ux_support( attribute_key, ux_type, ux_settings ) - } - - /** Mark this script as attempted */ - s.helpers.attempt_ud_ux_fetch.attempted[ ux_type ] = true; - - jQuery.getScript( 'http://cdn.usabilitydynamics.com/jquery.ud.date_selector.js', function( data, textStatus, jqxhr ) { - if( typeof jQuery.prototype.date_selector === 'function' ) { - s.helpers.attempt_ud_ux_fetch.success( attribute_key, ux_type ); - } else { - s.helpers.attempt_ud_ux_fetch.fail( attribute_key, ux_type ); - } - }).fail(function(jqxhr, settings, exception) { - s.helpers.attempt_ud_ux_fetch.fail( attribute_key, ux_type ); - }); - - } - - - /** - * Convert object to URL string. - * - * @author potanin@UD - */ - s.helpers.object_to_url = typeof s.helpers.object_to_url === 'function' ? s.helpers.object_to_url : function( data ) { - log( 's.helpers.object_to_url()', 'helpers' ); - - /** If an object is not passed, return as if its a string, or blank string of something else */ - if( typeof data !== 'object' ) { - return typeof data === 'string' ? data : ''; - } - - var hash = jQuery.map( data, function( value, key ) { - - if( typeof value === 'string' && value !== '' ) { - value = value; - } else if ( typeof value.join === 'function' ) { - value = value.join( ',' ); - } else if ( typeof value === 'object' ) { - value = jQuery.map( value, function( value, index ) { return value; } ).join( '-' ); - } - - if( value ) { - return key + '=' + value + ''; - } - - }); - - return hash.length ? encodeURI( hash.join( '&' ) ) : ''; - - } - - - /** - * Convert URL string to object. - * - * @author potanin@UD - */ - s.helpers.url_to_object = typeof s.helpers.url_to_object === 'function' ? s.helpers.url_to_object : function( url ) { - log( 's.helpers.url_to_object()', 'helpers' ); - - var hash = url ? url : decodeURI( window.location.hash.replace( '#', '' ) ); - var object = {}; - - jQuery.each( hash.split( '&' ), function( key, value ) { - - if( !value ) { - return; - } - - key = value.split( '=' )[0]; - value = value.split( '=' )[1]; - - if( value.indexOf( '-' ) !== -1 ) { - value = { - min: value.split( '-' )[0], - max: value.split( '-' )[1] - } - } else if ( typeof value === 'string' ) { - value = [ value ]; - } - - object[ key ] = value; - - }) - - return object; - - } - - - /** - * Get Instance Data from URL - * - * @source http://stackoverflow.com/questions/1349404/generate-a-string-of-5-random-characters-in-javascript - * @author potanin@UD - */ - s.helpers.random_string = typeof s.helpers.random_string === 'function' ? s.helpers.random_string : function( string , possible ) { - log( 'random_string()', 'helpers' ); - - string = typeof string === 'string' ? string : ''; - possible = typeof possible === 'string' ? possible : 'abcdefghijklmnopqrstuvwxyz'; - - for( var i=0; i < 10; i++ ) { - string += possible.charAt( Math.floor( Math.random() * possible.length ) ); - } - - return string; - - } - - - /** - * {} - * - * @source http://javascript.crockford.com/memory/leak.html - * @author potanin@UD - */ - s.helpers.purge = typeof s.helpers.purge === 'function' ? s.helpers.purge : function( d ) { - var a = d.attributes, i, l, n; - if (a) { - for (i = a.length - 1; i >= 0; i -= 1) { - n = a[i].name; - if (typeof d[n] === 'function') { - d[n] = null; - } - } - } - a = d.childNodes; - if (a) { - l = a.length; - for (i = 0; i < l; i += 1) { - s.helpers.purge( d.childNodes[i] ); - } - } - } - - - /** - * Enable the script, ran once on initialization - * - * Binds DF events for API access. - * - * @author potanin@UD - */ - var enable = this.enable = function() { - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::doing_ajax', function() { - log( 'doing_ajax' , 'event_handlers' ); - jQuery( s.ux.element ).removeClass( s.classes.element.filter_pending ); - jQuery( s.ux.element ).removeClass( s.classes.element.server_fail ); - jQuery( s.ux.element ).addClass( s.classes.element.ajax_loading ); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::ajax_complete', function() { - log( 'ajax_complete', 'event_handlers' ); - jQuery( s.ux.element ).removeClass( s.classes.element.ajax_loading ); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::get_data', function( event, args ) { - log( 'get_data', 'event_handlers' ); - get_data( event, args ); - }); - - /** Called whenever an instance/history related event takes place. */ - jQuery( document ).bind( 'dynamic_filter::instance::set', function() { - s.settings.use_instances ? s.instance.set() : false; - }); - - /** Triggered after AJAX JSON results have been successfully loaded. */ - jQuery( document ).bind( 'dynamic_filter::get_data::complete', function( event, args ) { - log( 'get_data::complete', 'event_handlers' ); - jQuery( document ).trigger( 'dynamic_filter::ajax_complete' , args ); - - append_dom( event, args ) - - if( !args.silent_fetch ) { - render_data( event, args ); - update_filters( event, args ); - } - - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::get_data::fail', function() { - jQuery( document ).trigger( 'dynamic_filter::ajax_complete' ); - jQuery( s.ux.element ).addClass( s.classes.element.server_fail ); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::undo_last_query', function() { - log( 'undo_last_query', 'event_handlers' ); - jQuery( s.ux.element ).removeClass( s.classes.element.server_fail ); - jQuery( s.ux.element ).removeClass( s.classes.element.ajax_loading ); - status( '' ); - }); - - /** Call to display results based on... ? */ - jQuery( document ).bind( 'dynamic_filter::render_data', function() { - log( 'render_data', 'event_handlers' ); - render_data(); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::render_data::complete', function() { - log( 'render_data::complete', 'event_handlers' ); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::execute_filters', function() { - log( 'execute_filters', 'event_handlers' ); - execute_filters(); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::update_filters::complete', function() { - log( 'update_filters::complete', 'event_handlers' ); - }); - - /** {missing description} */ - jQuery( document ).bind( 'dynamic_filter::load_more', function() { - log( 'load_more', 'event_handlers' ); - load_more(); - }); - - /** Whenever History Entry changes (HTML5 browsers as of now) */ - jQuery( document ).bind( 'dynamic_filter::onpopstate', function( args ) { - log( 'dynamic_filter::onpopstate', 'log', 'info' ); - }); - - /** {missing detail} */ - prepare_system(); - - /** Walyze the passed attributes */ - analyze_attributes(); - - /** Load instance-specific information */ - s.settings.use_instances ? s.instance.load() : false; - - /** Render UI elements (containers) and add custom classes */ - render_ui(); - - /** Render the filters */ - render_filter_ui(); - - /** Render UI for sorting, if enabled */ - render_sorter_ui(); - - /** If Auto Request enable, Get Data, after an optional pause */ - if( s.settings.auto_request ) { - - if( s.settings.timers.initial_request ) { - log( 'Doing Initial Request with a ' + s.settings.timers.initial_request + 'ms pause.', 'log', 'info' ); - } - - setTimeout( function () { jQuery( document ).trigger( 'dynamic_filter::get_data', { initial_request: true } ); }, s.settings.timers.initial_request ); - } - - } /* end enable() */ - - /** If this browser support Pop State, we bind to it */ - window.onpopstate = function( event ) { - jQuery( document ).trigger( 'dynamic_filter::onpopstate', event ); - } - - /** Initialize the script */ - enable(); - - /** Return object for chaining */ - return this; - - }; - -} ( jQuery ) /* p.s. No dog balls. */ ); - - diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.elastic_filter.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.elastic_filter.js deleted file mode 100644 index 5771d732a..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.elastic_filter.js +++ /dev/null @@ -1,938 +0,0 @@ -/** ========================================================= - * jquery.ud.elastic_filter.js v0.5 - * http://usabilitydynamics.com - * ========================================================= - * - * Commercial use requires one-time license fee - * http://usabilitydynamics.com/licenses - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS".. - * http://usabilitydynamics.com/warranty - * - * Copyright 2012-2013 Usability Dynamics, Inc. (usabilitydynamics.com) - * * - * Console Log Commands - * ==================== - * Last Query: elastic_filter.computed_query(); - * - * ========================================================= */ - -new (function( args ) { - - // Merge Custom Args into Default Args and then into Self - var app = window.ef_app = jQuery.extend( true, this, { - - // Local Settings. - 'settings': { - - 'account_id' : undefined, - - 'access_key' : undefined, - - 'per_page': 10, - - 'debug': false, - - 'visual_debug': false, - - 'url': 'https://cloud.usabilitydynamics.com', - - 'index' : '' - - }, - - // Result Items. - 'documents' : [], - - // Facet Objects. - 'facets' : [], - - // Available Sorting Types - 'sort_options': [], - - // Defaults from CloudAPI - 'defaults' : null, - - // Overall App State - 'state' : 'loading', - - // Query Object - 'query' : { - - // Full Text Search - 'full_text': null, - - // Single Field Search(es) - 'field' : [], - - // Multiple Term Search(es) - 'terms' : [], - - // Range Search(es) - 'range' : [], - - // Fuzzy Term / Date / Number Search(es) - 'fuzzy' : [], - - // Start Result - 'from' : 0 - - }, - - 'size' : 0, - - // Sort Order - 'sort' : null, - - 'bindings_initialized': [], - - // Total available results. Integer - 'total' : null, - - // General Status Message. String. - 'message' : '', - - // Set to true once fully loaded - 'elastic_ready': false, - - // Socket Session ID - 'session_id' : null, - - // Global Variable for Data Storage - 'global' : window.__elastic_filter = {}, - - // Initialization Complete - 'ready' : function() {}, - - // Required Assets - '_required' : { - 'io' : '//ud-cdn.com/js/ud.socket/1.0.0/ud.socket.js', - 'ko.mapping' : '//ud-cdn.com/js/knockout.mapping/2.3.2/knockout.mapping.js', - 'async' : '//ud-cdn.com/js/async/1.0/async.js', - 'ud.ko' : '//ud-cdn.com/js/knockout.ud/1.0/knockout.ud.js', - 'ud.select' : '//ud-cdn.com/js/ud.select/3.2/ud.select.js', - 'jq-lazyload': '//ud-cdn.com/js/jquery.lazyload/1.8.2/jquery.lazyload.js' - }, - - // Application Event Log - '_log' : { - - // Active Socket Subscriptions - 'subscriptions': {}, - - // Search History - 'search' : [], - - // Debug History - 'debug' : [], - - // Active Profilers - 'profilers' : {} - - } - - }, args ); - - /** - * Document constructor. Use to normalize incoming object. - */ - app._document = function( item ) {return item;}; - - /** - * Facet constructor. Use to normalize incoming object. - */ - app._facet = function( item, title ) { - - var options = []; - for( var i in item.terms ) { - options.push( { - 'text' : item.terms[i].term, - 'id': item.terms[i].term - }); - } - item._label = title; - - // Objervable dropdown options - item.options = ko.observableArray( options ); - - // Observable value - item.value = ko.observable(); - - // Observable multiple options - item.select_multiple = ko.observableArray(); - - // Build Terms Query based on Facet Selections - item.select_multiple.subscribe( function( value ) { - - // Organize terms inside query - app.view_model.query.terms.remove( - ko.utils.arrayFirst( app.view_model.query.terms(), function( term ) { - return typeof term[title] != 'undefined'; - } ) - ); - - if( value.length ) { - var object = {}; - object[title] = value; - app.view_model.query.terms.push( object ); - } - - // Set default size - app.view_model.size( parseInt( app.view_model.settings.per_page() ) ); - - // Do request - app.search_request(); - - } ); - - // Add CSS class for wrapper of facet to be able to manage its appearence in different states - item.css_class = ko.computed(function(){ - var len = typeof item.options() !== 'undefined' ? item.options().length : 0; - var len_class = len == 1 ? 'eff_single_option' : (!len ? 'eff_no_options': 'eff_options_'+len); - return len_class+' ef_facet_'+title.replace(' ','_'); - }); - - return item; - }; - - /** - * Profiler. A note is required to output. - * - * @version 0.1.1 - * @updated 0.1.5 - */ - app.profile = function( name, note, args ) { - - // If note is set, output timer. - if( app._log.profilers[ name ] && note ) { - - var output = [ 'Profiler', name, note, ( new Date().getTime() - app._log.profilers[ name ] ) / 1000 ]; - - if( args ) { - output.push( args ); - } - - return app.log.apply( this, output ); - } - - // Mark app.profiler as active - app._log.profilers[ name ] = new Date().getTime(); - - return this; - } - - /** - * Internal logging function - * - * @updated 0.4 - * @since 0.1 - */ - app.log = function() { - - if ( typeof console === 'undefined' ) { - return arguments ? arguments : null; - } - - if( arguments[0] instanceof Error ) { - console.error( 'ElasticFilter Fatal Error:', arguments[0].message ); - return arguments; - } - - console.log( arguments ); - - return arguments ? arguments : null; - - }; - - /** - * Debug Logging. Requires debug to be set to true, unless an Error object is passed. - * - * @author potanin@UD - */ - app.debug = function() { - - app._log.debug.push( {'time': new Date().getTime(), 'data': arguments} ); - - return ( ko.utils.unwrapObservable( app.settings.debug ) || arguments[0] instanceof Error ? app.log.apply( this, arguments ) : arguments ); - - } - - /** - * Initial Asynchronous Initialization - * - * @todo Add Meta Mapping and have them return labels - * @author potanin@UD - */ - app.init = function() { - - utils.back_support(); - - app.debug( 'init' ); - - // Make Things Happen. - async.auto( { - - /** - * Verify Dependancies and Create Knockout Bindings for Elastic Filter Elements - */ - 'binding_handlers': [ function( next, report ) { - app.debug( 'init', 'auto', 'binding_handlers' ); - - if( typeof ko !== 'object' ) { - return next( new Error( 'Missing Knockout.' ) ); - } - - if( typeof io !== 'object' ) { - return next( app.debug( new Error( 'Missing Socket.io.' ) ) ); - } - - // Main Configurations. Merges DOM Settings into app.settings - ko.bindingHandlers[ 'elastic-filter' ] = { - - 'init': function( element, valueAccessor ) { - app.log( 'binding_handlers', 'elastic-filter', 'init' ); - ko.mapping.fromJS( {'settings': jQuery.extend( true, {}, app.settings, ko.utils.unwrapObservable( valueAccessor() ) )}, app.view_model ); - app.bindings_initialized.push('elastic-filter'); - } - - } - - /** - * Handler for fulltext search function. Similar to "select" - * - */ - ko.bindingHandlers[ 'fulltext-search' ] = { - - 'init': function( element, valueAccessor, allBindingsAccessor, viewModel, bindingContext ) { - app.debug( 'binding_handlers', 'fulltext-search', 'init' ); - - if( typeof jQuery().select2 == 'undefined' ) return new Error( 'Select2 library is required for Fulltext Search feature' ); - - jQuery( element ).select2(valueAccessor()); - - if ( typeof allBindingsAccessor().elastic_settings != 'undefined' ) - ko.mapping.fromJS( {'settings': allBindingsAccessor().elastic_settings}, app.view_model ); - - ko.utils.domNodeDisposal.addDisposeCallback( element, function() { - jQuery( element ).select2( 'destroy' ); - }); - - app.bindings_initialized.push('fulltext-search'); - } - - }; - - return next( null, [ ko.bindingHandlers ] ); - - }], - - /** - * Create Observables and Computed Functions - * - */ - 'observable': [ 'binding_handlers', function( next, report ) { - app.debug( 'init', 'auto', 'observable' ); - - // Create Initial JSON Object from App, and Extend Template Functions into Root - app.view_model = ko.mapping.fromJS( app, { - - 'ignore': utils.get_methods( app ).concat( '_log', '_required', 'model_functions', 'facet_functions', 'document_functions', 'utils', 'success', 'global' ) - - }); - - /*app.view_model.query.full_text.subscribe(function(value){ - app.search_request(); - });*/ - - // Execute Binding Magic - ko.applyBindings( app.view_model ); - - // Expand Additional Template Functions into View Model - jQuery.extend( true, app.view_model, app.facet_functions, app.document_functions ); - - // Always a success. - return next( null, app ); - - }], - - /** - * Initialize Socket Connection - * - */ - 'socket': [ 'observable', function( next ) { - app.debug( 'init', 'auto', 'socket' ); - - if ( !app.bindings_initialized.length ) return; - - if ( typeof app.view_model.settings[ 'account_id' ] == 'undefined' || - typeof app.view_model.settings[ 'access_key' ] == 'undefined' ) { - return next( new Error('Empty credentials.') ); - } - - ud.socket.connect( ko.utils.unwrapObservable( app.view_model.settings[ 'url' ] ), { - 'resource': 'websocket.api/1.5', - 'account-id': ko.utils.unwrapObservable( app.view_model.settings[ 'account_id' ] ), - 'access-key': ko.utils.unwrapObservable( app.view_model.settings[ 'access_key' ] ) - }, function( error, socket ) { - - app.socket = socket; - - // Break initializtion chain since a WebSocket connection is required - if( error ) { - return next( error ); - } - - app.socket.once( 'reconnect', function() { - app.debug( new Error( 'Reconnecting, re-initializing ElasticFilter.' ). arguments ); - app.init(); - }); - - app.view_model.session_id( app.socket.sessionid ); - - return next( null, app.socket ); - - }); - - }], - - /** - * Load Settings and setup Defaults. Settings request could also be filtered via { 'path': 'defaults' } - * - */ - 'settings': [ 'socket', function( next, report ) { - app.debug( 'init', 'auto', 'settings' ); - - app.socket.request( 'get', 'api/v1/settings', function( error, response ) { - - app.log('settings', response); - - if( error || !response ) { - return next( app.log( error || new Error( 'Request for index settings returned no results.' ) ) ); - } - - ko.mapping.fromJS({'settings': response.settings}, app.view_model ); - - app.ready(); - - return next( null, app.settings ); - - }); - - }], - - /** - * Fully Loaded, make initial request - * - */ - 'ready': [ 'settings', function( next, report ) { - app.debug( 'init', 'auto', 'ready', report ); - - // Make Default Search Requests - app.view_model.sort( ko.mapping.toJS( app.view_model.settings.defaults.sort ) ); - app.view_model.size( parseInt( app.view_model.settings.per_page() ) ); - - // Do this only if elastic-filter binding exists on the page - if( app.bindings_initialized.indexOf( 'elastic-filter' ) !== -1 ) { - app.search_request(); - } - - // Fully loaded. - app.view_model.elastic_ready( true ); - - next( null, app.view_model.elastic_ready() ); - - }] - - }, app.initialized ); - - return this; - - } - - /** - * Execute Search Request. Gets value from computed_query observable - * - * @since 0.1.5 - */ - app.search_request = function( callback ) { - - app.profile( 'search_request' ); - - var request = { - index : app.view_model.settings.index(), - query : jQuery.extend( true, {'match_all': {}}, ko.mapping.toJS( app.view_model.query ) ), - facets : ko.mapping.toJS( app.view_model.settings.facets ), - size : app.view_model.size(), - sort : app.view_model.sort() - } - - request = utils.clean_object( request ); - - /** Temp logger */ - app.computed_query = function() { - return request; - } - - app.log( 'search_request_data', 'Data Before Send', request ); - - app.view_model.state( 'loading' ); - - app.socket.request( 'post', 'api/v1/search', request, function( error, response ) { - - /** Temp logger */ - app.last_response = function() { - return response; - } - - //** Profiling */ - app.profile( 'search_request', 'Have Cloud Response.', response ); - app.profile( 'search_request', 'Request Mapping Start.' ); - - var documents = []; - jQuery.each(typeof response.documents !== 'undefined' ? response.documents : [], function(){ - documents.push(arguments[1]); - }); - - app.view_model.documents( ko.utils.arrayMap( documents, function( item ) { - return new app._document( item ); - })); - - for( var i in typeof response.meta.facets != 'undefined' ? response.meta.facets : {} ) { - var found = false; - - ko.utils.arrayForEach( app.view_model.facets(), function( existing_facet ) { - if( i == existing_facet._label ) { - //existing_facet.options( item.options ); - found = true; - } - }); - - if( !found ) { - app.view_model.facets.push( new app._facet( response.meta.facets[i], i ) ); - } - } - - app.view_model.total( typeof response.meta.total != 'undefined' ? response.meta.total : 0 ); - app.view_model.state( 'ready' ); - - //** Profiling */ - app.profile( 'search_request', 'Request Mapping Complete.' ); - - return typeof callback === 'function' ? callback( error, response ) : response; - - }); - - }; - - /** - * Custom search requester. - */ - app.custom_search = function( callback ) { - app.profile( 'custom_search_start' ); - - var request = { - index : app.view_model.settings.index(), - query : { "query_string": { "query": app.view_model.query.full_text() } }, - size : app.view_model.size(), - sort : app.view_model.sort() - } - - app.socket.request( 'post', 'api/v1/search', request, callback ); - - app.profile( 'custom_search_end' ); - - return true; - } - - /** - * Get JSON Output of full View Model - * - * @since 0.1.5 - */ - app.get_json = function() { - return JSON.parse( ko.mapping.toJSON( app.view_model ) ); - }; - - /** - * Post Initialization - * - */ - app.initialized = function( error, report ) { - app.debug( 'initialized', arguments ); - - app.initialization = app.log( error ? 'Initializaiton Failed.' : 'Initializaiton Done.', ( report ? report : error ) ); - - if( typeof app.ready === 'function' ) { - app.ready( app, error, report ); - } - - return app.initialization; - - }; - - /** - * Facet Functions - * - */ - app.facet_functions = { - - /** - * Single Facet Rendered in DOM - * - * @event afterRender - */ - 'facet_after_render': function( data ) { - }, - - /** - * Before Single Facet is Removed from DOM - * - * @event beforeRemove - */ - 'facet_before_remove': function( element ) { // app.debug( 'facet_functions', 'facet_before_remove' ); - ko.removeNode( element ); - }, - - /** - * After a Single Facet is Added to DOM - * - * @event afterAdd - */ - 'facet_after_add': function( element, something, object ) { - }, - - /** - * Get Best Template for Facet - * - * @todo Use .notifySubscribers() to trigger request() - */ - 'facet_template': function( facet ) { // app.debug( 'facet_functions', 'facet_template' ); - - var templates = []; - - // Add Possible Templates - switch( facet && facet._type ) { - - case 'terms': - templates.push( 'template-facet-terms' ); - break; - - } - - // Default Facet Template - templates.push( 'template-default-facet' ); - - return app.model_functions._get_template( templates ); - - }, - - /** - * Submit Search - */ - 'submit_facets': function( data, event ) { - app.debug( 'facet_functions', 'submit_facets' ); - app.view_model.size( parseInt( app.view_model.settings.per_page() ) ); - app.search_request(); - return; - } - - }; - - /** - * Document Functions - * - */ - app.document_functions = { - - /** - * Single Document Rendered in DOM - * - * @event afterRender - */ - 'document_after_render': function( data, object ) { - }, - - /** - * Before Single Document is Removed from DOM - * - * @event beforeRemove - */ - 'document_before_remove': function( element, something, object ) { // app.debug( 'document_functions', 'document_before_remove' ); - ko.removeNode( element ); - }, - - /** - * After a Single Document is Added to DOM - * - * @event afterAdd - */ - 'document_after_add': function( element, something, object ) { - }, - - /** - * Get Best Template for Document - * - */ - 'document_template': function( document ) { // app.debug( 'document_functions', 'document_template' ); - return app.model_functions._get_template( ['template-default-document' ] ); - }, - - /** - * Toggle Sort Option - */ - 'sort_by': function( data, event ) { - app.debug( 'document_functions', 'sort' ); - - jQuery( event.target ).trigger( 'sort', [data] ); - - var field = jQuery( event.target ).data( 'field' ); - - var sort = ko.utils.arrayFirst( data.sort_options, function( option ) { - return typeof option[field] != 'undefined'; - } ); - - if( app.view_model.sort() ) { - var existing_sort = typeof app.view_model.sort()[field] != 'undefined' ? app.view_model.sort()[field] : false; - if( existing_sort ) - sort[field].order = app.view_model.sort()[field].order == 'desc' ? 'asc' : 'desc'; - } - - app.view_model.sort( sort ); - app.view_model.size( parseInt( app.view_model.settings.per_page() ) ); - app.search_request(); - }, - - /** - * Determine if sort type is active by sort - */ - 'is_active_sort': function( data ) { - if( !app.view_model.sort() ) return 'disabled'; - return typeof app.view_model.sort()[data] != 'undefined' ? 'active' : 'disabled'; - }, - - /** - * If there are more results available - */ - 'have_more': function( data, event ) { - app.debug( 'document_functions', 'have_more()' ); - - // Create Obervable if it has not been created yet. - app.have_more = ko.computed( { - 'owner': this, - 'read' : function() { - return ( app.view_model.total() > app.view_model.documents().length ) ? true : false; - } - } ); - - return app.have_more(); - - }, - - /** - * Load More - * - */ - 'load_more': function( data, event ) { - app.debug( 'document_functions', 'load_more()' ); - app.view_model.size( parseInt( app.view_model.size() ) + parseInt( app.view_model.settings.per_page() ) ); - app.search_request(); - } - - }; - - /** - * Template Functions, expanded into _view_model - * - */ - app.model_functions = { - - /** - * Accepts an array of Knockout template IDs, and returns first one that exists in document - * - */ - '_get_template': function( templates ) { // app.debug( 'model_functions', '_get_template' ); - - for( i in templates ? templates : [] ) { - if( document.getElementById( templates[i] ) ) { - return templates[i]; - } - } - - return templates[0]; - - }, - - /** - * Delete a Document by ID (Could be triggered by subscribed event) - * - * elastic_filter.observable._documents.remove( function( item ) { item.id = 6552 } ); - * - * @todo Does not work. Perhaps some issues with computation.. - */ - '_remove_item': function( index, id ) { // app.debug( 'model_functions', '_remove_item' ); - - var items = this[ index ]; - - ko.utils.arrayFirst( items, function( item ) { - - if( item && parseInt( item.id ) === parseInt( id ) ) { - items.remove( document ); - ko.utils.arrayRemoveItem( item ); - } - - } ); - - } - - }; - - /** - * Utility Functions - * - * @author potanin@UD - */ - var utils = app.utilis = { - - /** - * Adds Compatibility with Crappy Browsers - * - */ - 'back_support': function() { - - //** IE fix for unsupported methods */ - Object.keys = Object.keys || (function() { - var hasOwnProperty = Object.prototype.hasOwnProperty, hasDontEnumBug = !{toString: null}.propertyIsEnumerable( "toString" ), DontEnums = - [ - 'toString', 'toLocaleString', 'valueOf', 'hasOwnProperty', 'isPrototypeOf', 'propertyIsEnumerable', - 'constructor' - ], DontEnumsLength = DontEnums.length; - - return function( o ) { - if( typeof o != "object" && typeof o != "function" || o === null ) { - throw new TypeError( "Object.keys called on a non-object" ); - } - - var result = []; - for( var name in o ) { - if( hasOwnProperty.call( o, name ) ) { - result.push( name ); - } - } - - if( hasDontEnumBug ) { - for( var i = 0; i < DontEnumsLength; i++ ) { - if( hasOwnProperty.call( o, DontEnums[i] ) ) { - result.push( DontEnums[i] ); - } - } - } - - return result; - }; - })(); - - }, - - /** - * I know they are not technically methods. - * - * @version 0.1.1 - * @author potanin@UD - */ - 'get_methods': function( object ) { - - var functions = jQuery.map( object, function( item, name ) { - if( typeof item === 'function' ) { - return name; - } - } ); - - return functions; - - }, - - /** - * Load Inline JSON Editor (Needs CSS Fixes and some Logic Fixes to be useful) - * - * @version 0.1.1 - * @author potanin@UD - */ - 'json_editor': function() { - - ud.load.js( {'JSONEditor': 'http://ud-cdn.com/js/ud.json.editor.js'}, function() { - - ud.load.css( 'http://ud-cdn.com/js/assets/ud.json.editor.css' ); - - app.json_editor = new JSONEditor( jQuery( '.elastic_json_editor' ).get( 0 ), { - 'indentation': 2, - 'search' : false, - 'history' : false - } ); - - } ); - - }, - - /** - * Test if Array contains an item - * - * @version 0.1.1 - */ - 'contains': function( a, obj ) { - - for( var i = 0; i < a.length; i++ ) { - if( a[i] === obj ) { - return true; - } - } - - return false; - - }, - - /** - * Remove empty values - * - * @version 0.1.1 - */ - 'clean_object': function( object, args ) { - - jQuery.extend( true, { - 'strip_values': [] - }, args ); - - for( i in object ) { - - if( !object[i] ) { - delete object[i]; - } - - if( object[i] === null ) { - delete object[i]; - } - - if( typeof object[i] === 'object' ) { - - if( Object.keys( object[i] ).length ) { - object[i] = utils.clean_object( object[i], args ); - } else { - delete object[i]; - } - - } - - } - - return object; - } - - } - - // Load Required Assets, and then Initialize - ud.load.js( app._required, function() { - jQuery( document ).trigger( 'elastic_filter::initialize' ); - }); - - return this; - -})(); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.execute-triggers.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.execute-triggers.js deleted file mode 100644 index 2febe2a85..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.execute-triggers.js +++ /dev/null @@ -1,161 +0,0 @@ -/* ========================================================= - * jquery.ud.execute_triggers.js v1.0.1 - * http://usabilitydynamics.com - * ========================================================= - * Copyright 2012 Usability Dynamics, Inc. - * - * Validation: http://www.jslint.com/ - * - * The plugin handles jQuery Trigger execution by DOM elements. - * - * ==USAGE== - * - * Initialization: - * jQuery( '.execute_triggers' ).execute_triggers(); - * - * HTML Usage: - * Do Something - * - * Bound Trigger: - * jQuery( document ).bind( 'bound_trigger' , function( event, args ) { - * if( args.attributes.action == 'custom_action' && args.attributes.custom_argument !== 0 ) { - * // Do Stuff - * } - * } - * - * Built-in Attributes: - * - execute_once : Will bind the target action to only run once. By default, the target function will be run everytime. - * - * - * - * Copyright (c) 2012 Usability Dynamics, Inc. ( usabilitydynamics.com ) - * ========================================================= */ - -/*jslint indent: 2 */ -/*global window */ -/*global console */ -/*global clearTimeout */ -/*global setTimeout */ -/*global jQuery */ - -( function ( jQuery ) { - "use strict"; - - jQuery.fn.execute_triggers = function ( s ) { - - /* Set Settings */ - s = jQuery.extend( { - element: this, - ux: {}, - timers: {}, - debug: false - }, s ); - - - /* Internal logging function */ - var log = this.log = function ( something, type ) { - - if ( !s.debug ) { - return; - } - - if ( window.console && console.debug ) { - - if ( type === 'error' ) { - console.error( something ); - } else { - console.log( something ); - } - - } - - }; - - - /** - * The main function ran when the script is initialized. - * - * @author potanin@UD - */ - var enable = this.enable = function () { - log( 'execute_triggers::enable()' ); - - /* Cycle through all triggers */ - jQuery( s.element ).each( function() { - - - if( typeof jQuery( this ).attr( 'execute_once' ) !== 'undefined' ){ - - jQuery( this ).one( 'click', function( event ) { - execute_triggers( event ); - }); - - } else { - - /* Attach "click" listener event to this trgger. Unbind first incase this function is ran more than once. */ - jQuery( this ).unbind( 'click' ).bind( 'click', function( event ) { - execute_triggers( event ); - }); - - } - - }); - - }; - - - /** - * The main function ran when the script is executed. - * - * @author potanin@UD - */ - var execute_triggers = this.execute_triggers = function ( event ) { - log( 'execute_triggers::execute_triggers()' ); - - event.preventDefault(); - - var args = jQuery.extend( true, { - position: [ event.clientX, event.clientY ], - attributes: {}, - element: event.currentTarget, - triggers: jQuery( event.currentTarget ).attr( 'execute_triggers' ) - }, event ); - - /* Bail if there is are no triggers */ - if( typeof( args.triggers ) == 'undefined' || args.triggers == '' ) { - return; - } - - /* Convert all element attributes into an array */ - jQuery.each( args.element.attributes, function( index, attr ) { - args.attributes[attr.name] = attr.value; - }); - - /* Convert trigger string into array */ - args.triggers = args.triggers.split( ',' ); - - /* Do some data cleansing */ - jQuery.each( args.triggers , function( index, trigger_name ) { - args.triggers[ index ] = jQuery.trim( trigger_name ); - }) - - /* Cycle through and actually execute */ - jQuery.each( args.triggers , function( index, trigger_name ) { - - args.this_trigger_count = index; - - jQuery( document ).trigger( trigger_name, args ); - - }); - - }; - - /* Enable */ - this.enable(); - - /* Return object for chaining */ - return this; - - }; - -} ( jQuery ) ); diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.form-helper.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.form-helper.js deleted file mode 100644 index c267e88fd..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.form-helper.js +++ /dev/null @@ -1,1123 +0,0 @@ -/* ========================================================= - * jquery.ud.form_helper.js v1.1.0 - * http://usabilitydynamics.com - * ========================================================= - * - * Handles various functions related to forms. - * - * ==ClosureCompiler== - * @compilation_level ADVANCED_OPTIMIZATIONS - * @output_file_name jquery.ud.form_helper.min.js - * @js_externs form_helper, jQuery, - * ==/ClosureCompiler== - * - * Copyright (c) 2012 Usability Dynamics, Inc. ( usabilitydynamics.com ) - * - * ========================================================= */ - -( function( jQuery ) { - "use strict"; - - jQuery.fn.form_helper = function( s ) { - - /* Set Settings */ - /** - * Primary function, ran on initialization by default, or on demand when needed. - * - * - Cycles through all forms - * - Processes all required fields - * - Sets up control groups - * - Binds listener events to Input Fields - * - * @todo Make debug-override form-specific, right now it's global. - potanin@UD - * @todo Add check to prevent Form Helper being bound to same form more than once. - potanin@UD - * @todo Add similar function to helpers.css_class_query() that creates class strings that are ready to be inserted into DOM. - potanin@UD - * @author potanin@UD - */ - s = jQuery.extend( true, { - element : this, - settings : { - auto_enable : true, - validate_on_enable : false, - error_on_blank : false, - auto_hide_helpers : true, - check_required_fields : true, - disable_html5_validation : true, - markup_all_fields_on_form_fail : true, - intent_delay : 2500, - initialization_pause : 0 - }, - ajax : { - ajax_url : false, - data : {} - }, - timers : {}, - helpers : {}, - class_selector : {}, - classes : { - help_block : 'help-block', - validate_group : 'validate', - helper_item : 'helper_item', - disabled_helper : 'hide', - active_helper : 'show', - status : { - error : 'error', - blank : 'blank', - success : 'success', - warning : 'warning' - }, - checkbox : { - on : 'c_on', - off : 'c_off' - }, - ajax_form : 'form-ajax' - }, - debug : false - }, s ); - - /* Internal logging function */ - var log = this.log = function( notice, type, force ) { - - if( !s.debug && !force ) { - return; - } - - if( window.console && console.debug ) { - - if( type === 'error' ) { - console.error( notice ); - } - else if( type === 'dir' && typeof console.dir == 'function' ) { - console.dir( notice ); - } - else { - console.log( typeof notice == 'string' ? 'form_helper::' + notice : notice ); - } - - } - - }; - - /** - * Enable Script - * - * @author potanin@UD - */ - var enable = this.enable = function() { - log( 'enable()' ); - - /* Create jQuery selector-ready class versions */ - jQuery.each( s.classes, function( key, settings ) { - s.class_selector[ key] = s.helpers.css_class_query( settings ); - } ) - - /* Cycle through each element - which is usually a Form */ - jQuery( s.element ).each( function( index ) { - var form = this; - - if( form.initialized ) { - log( 'Form Helper already enabled on this form.' ); - } - - /* Allow Debug override. */ - if( jQuery( form ).attr( 'debug_form' ) == 'true' ) { - s.debug = true; - } - - /* Unbind any events in case this is initialized more than once */ - jQuery( form ).unbind( 'submit' ); - - /* Reference for all Input Fields for this form */ - form.form_helper_fields = {}; - - /* Simple Reference for all Control Groups for this form */ - form.form_control_groups = []; - - /* Analyze Attributes with the HTML5 "required" attribute, attempt to figure out the Validation Type, and add classes and attributes to the element's Control Group */ - if( s.settings.check_required_fields ) { - check_required_fields( form ); - } - - /* Automate things by adding the Validate Group class when validation_type or validation_required attributes are set */ - jQuery( '.control-group[validation_required="true"], .control-group[validation_type]', form ).addClass( s.classes.validate_group ); - - /* Add extra classes to checkboxes */ - handle_special_styling(); - - /* Cycle through each Control Group that requires validation, build args, and associate validation function to $.change() event */ - jQuery( '.control-group.' + s.classes.validate_group, form ).each( function() { - - /* Prepare Control Group Settings */ - var control_group = { - form : form, - messages : {}, - timers : {}, - control_group : this, - helpers : false, - attributes : {} - }; - - /* Add this Control Group to the Form Control Group Reference */ - form.form_control_groups.push( control_group.control_group ); - - /* Create placeholders for messages types based on available classes, and get messages passed as Control Group attributes */ - jQuery.each( s.classes.status, function( status_key, status_class ) { - control_group.messages[ status_key ] = jQuery( control_group.control_group ).attr( status_key + '_message' ); - } ); - - /* Convert field attributes from the jQuery format into an associate array */ - jQuery.each( control_group.control_group.attributes, function( index, attr ) { - control_group.attributes[ attr.name ] = attr.value; - } ); - - /* Convert to jQuery Object */ - control_group.control_group = jQuery( control_group.control_group ); - - control_group.validation_required = control_group.control_group.attr( 'validation_required' ) == 'true' ? true : false; - control_group.validation_type = control_group.control_group.attr( 'validation_type' ) != '' ? control_group.control_group.attr( 'validation_type' ) : 'not_empty'; - control_group.do_not_markup = control_group.control_group.attr( 'do_not_markup' ) !== undefined ? true : false; - - if( control_group.validation_type && jQuery( control_group.control_group ).attr( control_group.validation_type ) ) { - control_group[ control_group.validation_type ] = jQuery( control_group.control_group ).attr( control_group.validation_type ); - } - - /* Check if conditional help exists */ - if( jQuery( s.class_selector.help_block, control_group.control_group ).length ) { - control_group.helpers = jQuery( s.class_selector.help_block, control_group.control_group ); - } - - /* Run Validation on every single field, and attach Validation to future change events */ - jQuery( 'input,textarea,select', control_group.control_group ).each( function() { - - /* Build Input Field arg */ - var input_field = { - input_element : jQuery( this ), - input_type : jQuery( this ).attr( 'type' ), - name : jQuery( this ).attr( 'name' ), - type : this.nodeName.toLowerCase() - } - - /* Simple array of Input Fields of same type in same group */ - input_field.related_fields = jQuery.map( jQuery( input_field.type, control_group.control_group ).not( input_field.input_element ), function( element, index ) { - return element; - } ); - - /* Remove any bound change events from this input field */ - jQuery( input_field.input_element ).unbind( 'change' ); - - /* Add any attributes that will not change as the input is interacted with */ - if( !s.settings.disable_html5_validation ) { - jQuery( input_field.input_element ).attr( 'aria-required', 'true' ); - } - - /* Combine Field and Control Group settings and add to Input Field to reference. This groups fields with same name (e.g. checkboxes) together. */ - form.form_helper_fields[ input_field.name ] = jQuery.extend( {}, control_group, input_field ); - - } ); - /* End of single Input Field processing */ - - } ); - /* End of single Control Group processing */ - - log( form.form_helper_fields, 'dir' ); - - /* All Monitored Fields are loaded at this point. Now we cycle through all fields, run initial validaiton, and attach revent handlers to them */ - jQuery.each( form.form_helper_fields, function( name, vs ) { - - /* Save the Validation Settings in DOM object */ - jQuery( vs.input_element ).data( 'validation_settings', vs ); - - vs.inputs_in_group = jQuery( 'input,textarea,select', vs.control_group ).length; - - /* Render, or update, Message via Helpers */ - s.helpers.update_inline_help( vs.control_group, vs ); - - /* Bind initial Validation to Window.load to utilize any autocompleted fields. */ - jQuery( window ).load( function() { - setTimeout( function() { - log( 'enable() - Executing initial field validation.' ); - validate_field( vs.input_element, vs ); - - }, s.settings.initialization_pause ); - } ); - - // Allow Intent Delay override via attribute. - // @todo This should be migrated elsewhere and integrated w/ a better override system - potanin@UD - vs.intent_delay = typeof vs.control_group.attr( 'intent_delay' ) == 'string' ? vs.control_group.attr( 'intent_delay' ) : s.settings.intent_delay; - - monitor_field( vs.input_element, vs, { - check_related : true - } ); - - } ); - /* End of Form Helper Fields processing */ - - form.initialized = true; - - /* Monitor submit event */ - jQuery( form ).submit( function( event ) { - handle_submission( form, event ); - } ); - - } ); - /* End of single Form Procesing */ - - }; - - /** - * Attaches all events to monitored Input Fields - * - * @author potanin@UD - */ - var monitor_field = function( input_element, vs, args ) { - - args = jQuery.extend( {}, { - check_related : false - }, args ); - - /* Monitor change events */ - jQuery( input_element ).bind( 'change', function( e ) { - validate_field( input_element, vs ); - } ); - - /* Monitor keyup events for Inputs and Textareas */ - if( vs.type == 'input' || vs.type == 'textarea' ) { - - jQuery( input_element ).keyup( function( event ) { - - /* Reset Done Typing timer */ - clearTimeout( vs.timers.intent_delay ); - - vs.timers.intent_delay = setTimeout( function() { - validate_field( input_element, vs ); - }, vs.intent_delay ); - - } ); - - /* Kill Typing Timer when user leaves Input Field */ - jQuery( input_element ).blur( function( event ) { - clearTimeout( vs.timers.intent_delay ); - } ); - - } - - jQuery( vs.input_element ).addClass( 'monitored' ); - - /* Attach monitoring to any related fields, that have the same name and are therefore not in form.form_helper_fields */ - if( args.check_related ) { - jQuery.each( vs.related_fields, function( i, related_element ) { - - if( !jQuery( related_element ).hasClass( 'monitored' ) ) { - monitor_field( related_element, vs ); - } - - } ); - } - - } - - /** - * Style checkboxes by adding custom classes to the label element. - * - * @todo This does not seem to be very efficient. - * @author potanin@UD - */ - function handle_special_styling() { - log( 'handle_special_styling()' ); - - if( !jQuery( '.checkbox.styled input' ).length ) { - return; - } - - jQuery( '.checkbox.styled' ).each( function() { - jQuery( this ).closest( 'label' ).removeClass( s.classes.checkbox.on ).addClass( s.classes.checkbox.off ); - } ); - - jQuery( '.checkbox.styled input:checked' ).each( function() { - jQuery( this ).closest( 'label' ).addClass( s.classes.checkbox.on ).removeClass( s.classes.checkbox.off ); - } ); - - jQuery( '.checkbox.styled input' ).click( handle_special_styling ); - - }; - - /** - * A shortcut that looks for enabled Input Fields with a "required" attribute in the form, and modifies the Control Group automatically. - * - * Attempts to determine Validation Type based on Input Type. - * - * Adds to the Control Group of each required field: - * - class: validate - * - attr: validation_required - * - attr: validation_type - * - * Optionally removes the "required" attribute to stop HTML5 validation on modern browsers. - * - * @author potanin@UD - */ - function check_required_fields( form ) { - log( 'check_required_fields()' ); - - jQuery( 'input[required],textarea[required],select[required]', form ).each( function() { - - /* Don't do anything with disabled fields */ - if( this.disabled ) { - log( ' Skipping ' + this.name + ' because it is disabled.' ); - return; - } - - /* If configured, remove attribute to disable built-in browser support for validation */ - if( s.settings.disable_html5_validation ) { - jQuery( this ).removeAttr( 'required' ); - } - - /* Identify our Control Group */ - var control_group = jQuery( this ).closest( '.control-group' ); - - /* If no CG, as of now we do nothing */ - if( !control_group.length ) { - return; - } - - /* Check if Validation Type attribute is declared */ - var validation_type = jQuery( this ).attr( 'validation_type' ) != '' ? jQuery( this ).attr( 'validation_type' ) : false; - - /* If Control Group does not have a defined Validation Requirement, we set it */ - if( !control_group.attr( 'validation_required' ) ) { - control_group.attr( 'validation_required', 'true' ); - } - - /* Mark the CG as needing to be validateed */ - control_group.addClass( s.classes.validate_group ); - - /* If Validation Type was not set, we check Input Type for possible Validation Type */ - if( !validation_type && jQuery( this ).attr( 'type' ) ) { - - switch( jQuery( this ).attr( 'type' ).toLowerCase() ) { - - case 'email' : - control_group.attr( 'validation_type', 'email' ); - break; - - case 'url' : - control_group.attr( 'validation_type', 'url' ); - break; - - case 'tel' : - control_group.attr( 'validation_type', 'tel' ); - break; - - } - - } - - /* If we found a Validation Type, we add it and the type-specific setting to the Control Group */ - if( validation_type ) { - control_group.attr( 'validation_type', validation_type ); - - if( jQuery( this ).attr( validation_type ) ) { - control_group.attr( validation_type, jQuery( this ).attr( validation_type ) ); - } - - } - - jQuery( document ).trigger( 'form_helper::check_required_fields::field_complete', { element : this, validation_type : validation_type } ); - - } ); - - } - - /** - * Ran when from is submitted. - * - * @author potanin@UD - */ - function handle_submission( form, e ) { - log( 'handle_submission()' ); - - /* Sometimes causes error on IE7 */ - form.status = form_status( form ); - - if( form.status.validation_fail ) { - e.preventDefault(); - - /* Cycle through all fields and validate them, to show user what they missed */ - if( s.settings.markup_all_fields_on_form_fail ) { - - jQuery.each( form.form_helper_fields, function( name, settings ) { - - if( settings.status_code != 'success' ) { - validate_field( settings.input_field, settings ); - } - - } ); - - } - - /* Cycle only through failed fields */ - if( !s.settings.markup_all_fields_on_form_fail ) { - - jQuery.each( form.status.failed_fields, function( i, name ) { - validate_field( name ); - - } ); - - } - - return false; - - } - else { - - jQuery( form ).trigger( 'form_helper::success', { form : form, event : e } ); - - if( jQuery( form ).hasClass( s.classes.ajax_form ) ) { - e.preventDefault(); - return false; - } - - } - - //return true; - - } - - /** - * Checks a single field, in relation to it's control group, against the specified validation settings - * - * Function executed on $.ready() and everytime the input is updated, or on demand. - * To call on demand, pass two arguments: - * - input_element (jQuery Object) - target field - * - validation_settings (Object) - see enable() for object information, will vary from one situations to the next - * - * @author potanin@UD - */ - var validate_field = this.validate_field = function( input_element, validation_settings ) { - log( 'validate_field(' + ( typeof validation_settings == 'object' ? validation_settings.name : '?' ) + ')' ); - - /* If this function is being called with only a Field Name, we attempt to get the DOM Oject */ - if( input_element && typeof input_element != 'object' ) { - input_element = jQuery( '[name="' + input_element + '"]' ); - - if( input_element.length ) { - log( 'validate_field(): Input Element not passed as object, but found using name in DOM.' ); - } - else { - log( 'validate_field(): Input Element not passed as object, and could not be found by name (' + input_element + ') in DOM.' ); - } - } - - /* If we have the DOM Input Element Object, but no Validation Settings */ - if( input_element && !validation_settings ) { - validation_settings = input_element.data( 'validation_settings' ); - } - - /* If cannot get Validation Settings, we re-enable */ - if( !validation_settings ) { - return log( 'validate_field(): Warning. validate_field() was called on an Input Field that could not be found, or does not have Validation Settings.', 'error', true ); - } - - /* Merge passed Validation Settings with Defaults */ - var args = jQuery.extend( true, { - validation_type : 'not_empty' - }, validation_settings ); - - var current_value = typeof jQuery( input_element ).val() == 'string' ? jQuery( input_element ).val() : ''; - - /* Determine if this is the first time this field has been put through validation */ - if( typeof args.form.form_helper_fields[ args.name ].status_code === 'undefined' ) { - args.initial_run = true; - } - - var result = { - detail_log : [] - } - - result.detail_log.push( ( args.initial_run ? 'Initial Run' : 'Secondary Run' ) + ': ' + args.name ); - result.detail_log.push( 'args.validation_required: ' + args.validation_required ); - result.detail_log.push( 'args.inputs_in_group: ' + args.inputs_in_group ); - result.detail_log.push( 'current_value: ' + current_value ); - result.detail_log.push( 'validation_type: ' + args.validation_type ); - - switch( args.validation_type ) { - - case 'checked': - - if( jQuery( input_element ).attr( 'type' ) != 'checkbox' ) { - args.status_code = 'success'; - - } - else { - if( jQuery( input_element ).is( ':checked' ) ) { - args.status_code = 'success'; - - } - else { - args.status_code = 'error'; - - } - } - - break; - - /** - * Compare all elements of same type within the Control Group - * - * @todo Bug with last element being excluded from related. So when it is checked, it does not count. - potanin@UD - */ - case 'selection_limit': - - result.detail_log.push( 'Total related: ' + args.related_fields.length ); - - /* Build array of checked elements */ - var checked = jQuery.map( jQuery( args.related_fields ), function( element, index ) { - if( element.checked ) { - return element; - } - } ); - - result.detail_log.push( 'Total checked: ' + checked.length ); - result.detail_log.push( 'Selection limit: ' + validation_settings.selection_limit ); - - if( checked.length === 0 ) { - args.status_code = 'error'; - args.messages[ 'success' ] = 'Please make a selection.'; - } - - if( checked.length > 0 && checked.length < validation_settings.selection_limit ) { - args.status_code = 'success'; - args.messages[ 'success' ] = 'You may select ' + ( validation_settings.selection_limit - checked.length ) + ' more.'; - } - - if( checked.length == validation_settings.selection_limit ) { - args.status_code = 'success'; - args.messages[ 'success' ] = 'You can not select anymore.'; - } - - if( checked.length > validation_settings.selection_limit ) { - jQuery( input_element ).removeAttr( 'checked' ) - } - - /* Update Inline Help */ - s.helpers.update_inline_help( args.control_group, args ); - - break; - - - /** - * Compare all elements of same type within the Control Group - * - * @todo The password strength is temporary. - */ - case 'password': - case 'matching_passwords': - - var other_value; - - /* For password there should only be two, but we cycle through full loop */ - jQuery.each( args.related_fields, function( i, element ) { - other_value = jQuery( element ).val(); - } ); - - if( current_value === '' && other_value === '' ) { - result.detail_log.push( 'Passwords are empty: ' + current_value + ' - ' + other_value ); - args.status_code = 'error'; - break; - } - - if( current_value === other_value ) { - result.detail_log.push( 'Passwords match: ' + current_value + ' - ' + other_value ); - args.status_code = 'success'; - - /* Simple Password Strength (should be done much better via third-party of sort */ - args.password_strength = Math.round( ( other_value.length / 13 ) * 100 ); - args.messages[ 'success' ] = jQuery( '
                    Password Strength:
                    ' ); - - /* Update Inline Help */ - s.helpers.update_inline_help( args.control_group, args ); - - break; - } - - if( current_value != other_value ) { - result.detail_log.push( 'Passwords do not match: ' + current_value + ' - ' + other_value ) - args.status_code = 'error'; - break; - } - - break; - - case 'email': - - if( current_value == '' ) { - args.status_code = 'blank'; - - } - else if( s.helpers.validate_email( current_value ) ) { - args.status_code = 'success'; - - } - else { - args.status_code = 'error'; - - } - - break; - - case 'url': - - if( current_value == '' ) { - args.status_code = 'blank'; - - } - else if( s.helpers.validate_url( current_value ) ) { - args.status_code = 'success'; - - } - else { - args.status_code = 'error'; - - } - - break; - - case 'domain': - if( current_value == '' ) { - args.status_code = 'blank'; - } - else if( s.helpers.validate_url( current_value, { use_http : false } ) ) { - args.status_code = 'success'; - } - else { - args.status_code = 'error'; - } - - break; - - /** - * Uses Google Maps, if available, to get quality of address. - * - * @todo This is not complete, mostly proof of concept. - potanin@UD - */ - case 'address': - - if( current_value == '' ) { - args.status_code = 'blank'; - break; - } - - /* Make sure Google Maps API is loaded */ - if( typeof google != 'object' || typeof google.maps != 'object' ) { - break; - } - - args.remote_request = true; - - args.geocoder = args.geocoder ? args.geocoder : new google.maps.Geocoder(); - - /* Remove line breaks from GM request */ - args.clean_value = current_value.replace( /(\r\n|\n|\r)/gm, " " ); - - args.geocoder.geocode( { 'address' : args.clean_value }, function( results, status ) { - - if( typeof results == 'object' ) { - - jQuery.each( results, function( i, data ) { - - if( data.geometry.location_type == 'ROOFTOP' ) { - args.messages[ 'success' ] = 'Validated: ' + data.formatted_address; - args.status_code = 'success'; - - } - else if( data.status == 'ZERO_RESULTS' ) { - args.status_code = 'error'; - - } - else { - args.status_code = 'warning'; - } - - } ); - - /* Render, or update, Message via Helpers */ - s.helpers.update_inline_help( args.control_group, args ); - - finalize_field_validation( current_value, result, args ); - - } - - } ); - - break; - - case 'ajax': - - if( !args.validation_ajax ) { - break; - } - - args.remote_request = true; - - /* Load default AJAX arguments */ - var ajax_request = jQuery.extend( {}, { - action : args.validation_ajax, - field_name : args.name, - field_value : current_value, - field_type : args.type - }, s.settings.ajax_url ); - - jQuery.ajax( { - url : s.settings.ajax_url, - data : ajax_request, - success : function( response ) { - args.status_code = ( response.success == 'false' ) ? 'error' : 'success'; - - /* Add new message to Control Group's Messages */ - args.messages[ args.status_code ] = response.message; - - update_control_group_ui( args.control_group, args ); - - result.detail_log.push( args.name + ' - Custom Ajax Validation. Result: ' + args.status_code ); - - finalize_field_validation( current_value, result, args ); - - }, - dataType : "json" - } ); - - break; - - case 'pattern': - - var this_regex = new RegExp( args.attributes.pattern, "g" ); - - if( current_value == '' ) { - args.status_code = 'blank'; - - } - else if( this_regex.test( current_value ) ) { - args.status_code = 'success'; - - } - else { - args.status_code = 'error'; - args.messages[ args.status_code ] = "Please, match the requested format" + ( ( typeof args.title != 'undefined' ) ? ":" + args.title : '' ); - } - - break; - - case 'not_empty': - default: - - if( current_value == '' ) { - args.status_code = 'blank'; - - } - else { - args.status_code = 'success'; - - } - - if( current_value == '' ) { - args.status_code = 'blank'; - } - else { - args.status_code = 'success'; - } - - break; - - } - /* Attribute Validation Complete */ - - if( !args.remote_request ) { - finalize_field_validation( current_value, result, args ); - } - - } - - /** - * Ran after validate_field() has completed processing. - * - * @todo Migrate this into a bound function within validate_field(). - potanin@UD - * @author potanin@UD - */ - var finalize_field_validation = this.finalize_field_validation = function( current_value, result, args ) { - - if( args.status_code == 'blank' && s.settings.error_on_blank ) { - args.status_code = 'error'; - } - - result.detail_log.push( 'new status_code: ' + args.status_code ); - - /* Not used yet, jsut added for reference */ - jQuery( args.input_element ).attr( 'validation_status_code', args.status_code ); - jQuery( args.control_group ).attr( 'validation_status_code', args.status_code ); - - /* Save new Status Code into Form Helper Fields */ - args.form.form_helper_fields[ args.name ].status_code = args.status_code; - - /* Actions for Input Fields that are monitored, e.g. the chang of which can affect the overall Form Status */ - if( args.validation_required ) { - - /* If Validation is Required for submitting, and the result is anything other than success - we stop the form */ - if( args.status_code != 'success' ) { - result.detail_log.push( 'Field validation fail.' ); - } - - /* Class added for quick reference, not markup */ - if( form_status( args.form ).validation_fail ) { - jQuery( args.form ).addClass( 'validation_fail' ); - jQuery( args.form ).data( 'do_not_process', true ); - result.detail_log.push( 'Form validation fail.' ); - - } - else { - jQuery( args.form ).removeClass( 'validation_fail' ); - jQuery( args.form ).removeData( 'do_not_process' ); - result.detail_log.push( 'Form passed validation.' ); - - } - - } - /* End Validation-only Actions */ - - log( result.detail_log, 'dir' ); - - /* If this is not initialization, do the markup */ - if( !args.initial_run || s.settings.validate_on_enable ) { - update_control_group_ui( args.control_group, args ) - } - - } - - /** - * Updates the visual styles of a Control Group and displays helpers. - * - * control_group is passed as first argument for API access as an object - * - * @author potanin@UD - */ - var update_control_group_ui = this.update_control_group_ui = function( control_group, args ) { - log( 'update_control_group_ui()' ); - - /* If this Control Group has a do_not_markup attribute, we let it be */ - if( args.do_not_markup ) { - return; - } - - /* Remove all Status Classes from CG */ - jQuery.each( s.classes.status, function( key, value ) { - jQuery( control_group ).removeClass( value ); - } ); - - /* Render applicable Notices, if they exists */ - if( args.helpers ) { - - /* Hide all immediate children and remove any .active classes */ - jQuery( '> .' + s.classes.helper_item, args.helpers ).removeClass( s.classes.active_helper ).addClass( s.classes.disabled_helper ); - - /* Find the helper by class, if exists, and show it */ - jQuery( '.' + args.status_code, args.helpers ).removeClass( s.classes.disabled_helper ).addClass( s.classes.active_helper ); - - } - - /* If this is a Validated field that has failed validation: */ - jQuery( control_group ).addClass( s.classes.status[ args.status_code ] ); - - } - - /** - * Determine and update that overall status of a form - * - * @author potanin@UD - */ - var form_status = this.form_status = function( form ) { - log( 'form_status()' ); - - /* Ensure Form Helper Fields are set, if not return an empty object */ - if( typeof form.form_helper_fields != 'object' ) { - log( 'form_status() - form.form_helper_fields is not an object, leaving.' ); - return {}; - } - - var response = { - validation_fail : false, - failed_fields : [] - }; - - jQuery.each( form.form_helper_fields, function( name, settings ) { - - if( settings.status_code != 'success' ) { - log( 'form_status() - Input Field failed validation: ' + name ); - response.failed_fields.push( name ); - } - - } ); - - /* If we have Failed Fields, then the form is failed */ - if( response.failed_fields.length ) { - log( 'form_status() - Form failed validation. Invalid fields: ' + response.failed_fields.length ); - form.validation_fail = response.validation_fail = true; - form.failed_fields = response.failed_fields; - } - else { - log( 'form_status() - Form is valid. ' ); - } - - return response; - - }; - - /** - * Updates Inline Help based on available messages in the Control Group Message Handler. - * - * Ran when on enable() and on other events that may result in updates to Control Group - * status message text, such as AJAX returned data. - * - * @todo Not sure at which point this should be ran first. - potanin@UD - * @author odokienko@UD - */ - if( typeof s.helpers.update_inline_help != 'function' ) { - s.helpers.update_inline_help = function( control_group, args ) { - log( 'helpers.update_inline_help()' ); - - /* Try to load exisitng Help Block */ - if( !args.helpers ) { - args.helpers = jQuery( s.class_selector.help_block, control_group ); - } - - /* If no Help Block found, create one by inserting it after the last input type in CG */ - if( !args.helpers.length ) { - jQuery( args.type + ':last', control_group ).after( args.helpers = jQuery( '' ) ); - } - - /* Update Status-based Help Messages by going through all available statuses */ - jQuery.each( args.messages, function( status_key, text ) { - - /* Get Status Class form global settings */ - var status_class = s.classes.status[ status_key ]; - var this_line = jQuery( 'span.' + status_class, args.helpers ); - - if( !this_line.length ) { - jQuery( args.helpers ).append( this_line = jQuery( '' ) ); - } - - /* Always add the main Helper Item class */ - this_line.addClass( s.classes.helper_item ); - - /* Add status-specific class */ - this_line.addClass( status_class ); - - /* If enabled, as on default, the Disabled Helper class is added to all helper items */ - if( s.settings.auto_hide_helpers ) { - this_line.addClass( s.classes.disabled_helper ); - } - - /* Insert text into Line Item */ - jQuery( this_line ).html( text ); - - } ); - - } - } - - /** - * Flexible converter of user-specified classes into a jQuery-friendly query. - * - * Classes may be passed in several ways: - * - 'my_class' - * - 'my_class another_class' - * - ['my_class', 'another_class'] - * - * Purposely ignores associative arrays returning them as they were passed. - * - * @author potanin@UD - */ - if( typeof s.helpers.css_class_query != 'function' ) { - s.helpers.css_class_query = function( css_class ) { - - var css_query = []; - - if( typeof css_class == 'object' || typeof css_class == 'array' ) { - - var associative_array = false; - - jQuery.each( css_class, function( i, single_class ) { - css_query.push( single_class ); - - if( !jQuery.isNumeric( i ) ) { - associative_array = true; - return; - } - - } ); - - if( associative_array ) { - return css_class; - } - - } - else if( typeof css_class == 'string' ) { - css_query = css_class.split( ' ' ); - } - - /* Joing pieces together and replace double-periods with single */ - return ('.' + css_query.join( '.' ) ).replace( /\.\./g, '.' ); - - } - } - - /** - * Helper for properly removing an element from array by value - * - * {Not currently used} - * - * @author potanin@UD - */ - if( typeof s.helpers.remove_from_array != 'function' ) { - s.helpers.remove_from_array = function( value, arr ) { - return jQuery.grep( arr, function( elem, index ) { - return elem !== value; - } ); - } - } - - /** - * Helper for URL Validation - * - * @author potanin@UD - */ - if( typeof s.helpers.validate_url != 'function' ) { - s.helpers.validate_url = function( value, args ) { - log( 'helpers.validate_url(' + value + ')' ); - args = jQuery.extend( { use_http : true }, args ); - if( args.use_http ) return /^(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/i.test( value ); - return /^[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&:/~\+#]*[\w\-\@?^=%&/~\+#])?/i.test( value ); - } - } - - /** - * Helper for Email Validation - * - * @author potanin@UD - */ - if( typeof s.helpers.validate_email != 'function' ) { - s.helpers.validate_email = function( value ) { - log( 'helpers.validate_email(' + value + ')' ); - var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; - return re.test( value ); - } - } - - /* Enable functionality on each instance */ - if( s.settings.auto_enable ) { - enable(); - } - - /* Return object for chaining */ - return this; - - }; - -}( jQuery ) ); diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.smart-buttons.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.smart-buttons.js deleted file mode 100644 index 8806ef824..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.smart-buttons.js +++ /dev/null @@ -1,260 +0,0 @@ -/* ========================================================= - * jquery.ud.smart_buttons.js v0.6 - * http://usabilitydynamics.com - * ========================================================= - * Copyright 2012 Usability Dynamics, Inc. - * - * Copyright (c) 2011 Usability Dynamics, Inc. (usabilitydynamics.com) - * ========================================================= */ - -(function( jQuery ){ - - /** - * Handle AJAX Actions and UI actions - * - * {missing detailed description} - * - * @author potanin@UD - * @version 0.2.2 - */ - jQuery.fn.smart_dom_button = function( settings ) { - - /* Set Settings */ - var s = jQuery.extend({ - debug: false, - action_attribute: 'action_attribute', - response_container: 'response_container', - ajax_action: 'action', - label_attributes: { - process: 'processing_label', - revert_label: 'revert_label', - verify_action: 'verify_action' - } - }, settings); - - /* Internal logging function */ - log = function(something, type) { - - if(!s.debug) { - return; - } - - if(window.console && console.debug) { - - if (type == 'error') { - console.error(something); - } else { - console.log(something); - } - - } - - }; - - - /** - * Gets label for the type of element - * - */ - get_label = function( this_button ) { - - var type = jQuery(this_button).get(0).tagName; - var label = ''; - - switch (type) { - - case 'SPAN': - label = jQuery(this_button).text(); - break; - - case 'INPUT': - label = jQuery(this_button).val(); - break; - - } - - return label; - - } - - - /** - * Sets the label for the type - * - */ - set_label = function( label, a ) { - - switch (a.type) { - - case 'SPAN': - jQuery(a.button).text(label); - break; - - case 'INPUT': - jQuery(a.button).val(label); - break; - - } - - return label; - - } - - - /** - * Execute an action for the button - * - * @todo Improve ajax response handling, to include hiding response element on error. - * - */ - do_execute = function( this_button ) { - - /* Array of all settings specific to the current button */ - var a = { - button: this_button, - type: jQuery(this_button).get(0).tagName, - original_label: jQuery(this_button).attr('original_label') ? jQuery(this_button).attr('original_label') : get_label(this_button) - }; - - /* Get wrapper if used and exists */ - if(s.wrapper && jQuery(a.button).closest(s.wrapper).length) { - a.wrapper = jQuery(a.button).closest(s.wrapper); - a.use_wrapper = true; - } else { - a.wrapper = a.button; - a.use_wrapper = false; - } - - /* Determine action */ - a.the_action = jQuery(a.wrapper).attr(s.action_attribute) ? jQuery(a.wrapper).attr(s.action_attribute) : false; - - /* Get labels */ - if(s.label_attributes.processing && jQuery(a.wrapper).attr(s.label_attributes.processing)) { - a.processing_label = jQuery(a.wrapper).attr(s.label_attributes.processing) ? jQuery(a.wrapper).attr(s.label_attributes.processing) : false; - } - - if(s.label_attributes.verify_action && jQuery(a.wrapper).attr(s.label_attributes.verify_action)) { - a.verify_action = jQuery(a.wrapper).attr(s.label_attributes.verify_action) ? jQuery(a.wrapper).attr(s.label_attributes.verify_action) : false; - } - - /* Set original label only if a revert label exists */ - if(s.label_attributes.revert_label && jQuery(a.wrapper).attr(s.label_attributes.revert_label)) { - a.revert_label = jQuery(a.wrapper).attr(s.label_attributes.revert_label) ? jQuery(a.wrapper).attr(s.label_attributes.revert_label) : false; - - /* Set original label if not already set */ - if(!jQuery(a.wrapper).attr('original_label')) { - a.original_label = get_label(a.button); - jQuery(a.wrapper).attr('original_label', a.original_label); - } - - } - - /* If no action found, we leave */ - if(!a.the_action) { - return; - } - - if(a.verify_action) { - if(!confirm(a.verify_action)) { - return; - } - } - - /* Create a response container if we are using a wrapper */ - if(a.use_wrapper) { - - if(!jQuery(s.response_container, a.wrapper).length) { - jQuery(a.wrapper).append(''); - } - - a.response_container = jQuery('.response_container', a.wrapper); - - /* Unset all classes */ - jQuery(a.response_container).removeClass(); - jQuery(a.response_container).addClass('response_container'); - - if(a.processing_label) { - jQuery(a.response_container).html(a.processing_label); - } - - } - - /* Check if this is a UI action first, otherwise use AJAX */ - if(a.the_action == 'ui') { - - /* If a revert label exists, we toggle them */ - if(a.revert_label) { - - if(get_label(a.button) == a.revert_label) { - set_label(a.original_label, a); - - } else { - set_label(a.revert_label, a); - - } - - } - - if(jQuery(a.wrapper).attr('toggle')) { - jQuery(jQuery(a.wrapper).attr('toggle')).toggle(); - } - - if(jQuery(a.wrapper).attr('show')) { - jQuery(jQuery(a.wrapper).attr('show')).show(); - } - - if(jQuery(a.wrapper).attr('hide')) { - jQuery(jQuery(a.wrapper).attr('hide')).hide(); - } - - } else { - - jQuery.post(ajaxurl, { - action: s.ajax_action, - the_action: a.the_action - }, function (result) { - - if(result && result.success) { - jQuery(a.response_container).show(); - - if(result.css_class) { - jQuery(a.response_container).addClass(result.css_class); - } - - if(result.remove_element && jQuery(result.remove_element).length) { - jQuery(result.remove_element).remove(); - } - - jQuery(a.response_container).html(result.message); - - var this_timeout; - - jQuery(a.response_container).mouseover( function() { - this_timeout = setTimeout(function() { - jQuery(a.response_container).fadeOut('slow', function() { - jQuery(a.response_container).remove(); - }); - }, 10000); - - }).mouseout(function() { - clearTimeout( this_timeout ); - }); - - } - - }, 'json'); - - } - - } - - jQuery( this ).click(function() { - log("Button triggered."); - do_execute( this ); - }); - - - return this; - - }; -}) ( jQuery ); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.social.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.social.js deleted file mode 100644 index 73d7ff22c..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.social.js +++ /dev/null @@ -1,193 +0,0 @@ -/* ========================================================= - * jquery.ud.social.js v1.0.0 - * http://usabilitydynamics.com - * ========================================================= - * - * Handle interaction with social sites. - * - * Validation: http://www.jslint.com/ - * - * Copyright ( c ) 2012 Usability Dynamics, Inc. ( usabilitydynamics.com ) - * ========================================================= */ - -( function ( jQuery ) { - "use strict"; - - jQuery.fn.social = function ( s ) { - - /* Set Settings */ - s = jQuery.extend( { - element: this, - networks: { - linkedin: { - profile_fields: { - id: 'network_id', - firstName: 'first_name', - lastName: 'last_name', - pictureUrl: 'user_image', - headline: 'headline', - industry: 'industry', - summary: 'summary', - specialties: 'specialties', - location: 'location', - associations: 'associations', - certifications: 'certifications', - educations: 'educations', - skills: 'skills', - patents: 'patents', - honors: 'honors', - proposalComments: 'proposal_comments', - 'three-current-positions': 'current_positions', - 'recommendations-received': 'recommendations', - 'main-address': 'primary_address', - 'member-url-resources': 'url_resources', - 'phone-numbers': 'phone_number', - 'public-profile-url': 'profile_url', - 'im-accounts': 'im_accounts' - } - } - }, - user_data: {}, - debug: true - }, s ); - - /* Internal logging function */ - var log = this.log = function ( something, type ) { - - if ( !s.debug ) { - return; - } - - if ( window.console && console.debug ) { - - if ( type === 'error' ) { - console.error( something ); - } else { - console.log( something ); - } - - } - - }; - - - /** - * The main function ran when the script is executed. - * - * Profile Fields: https://developer.linkedin.com/documents/profile-fields - * - * @called onLoad - * @author potanin@UD - */ - var handle_linkedin = this.handle_linkedin = function ( ) { - log( 'handle_linkedin()' ); - - s.networks.linkedin.active = true; - - if( typeof IN.Event == 'undefined') { - return; - } - - jQuery( '.linkedin_asset' ).show(); - - /* Executed after the current user has been authenticated */ - IN.Event.on( IN, "auth", function() { - log( 'IN.Event::auth ' ); - - var these_fields = []; - - /* Create a simple array of LinkedIn-friendly fields */ - jQuery.each( s.networks.linkedin.profile_fields, function( network_key , global_key) { - these_fields.push( network_key ); - }); - - IN.API.Profile( 'me' ).fields( these_fields ).result( function( profile ) { - log( 'IN.API.Profile()' ); - - /* Cycle through returnes values and match the values up with global user meta keys */ - jQuery.each( profile.values[0], function( network_key, value ) { - - var global_key = s.networks.linkedin.profile_fields[ network_key ]; - - if( typeof global_key == 'undefined' || value == '' ) { - return; - } - - switch( network_key ) { - - case 'location': - value = value.name; - break; - - } - - s.user_data[global_key] = value; - - }); - - s.user_data.display_name = s.user_data.first_name + ' ' + s.user_data.last_name; - - if( s.user_data ) { - jQuery( '.linked_in_login' ).html( - '

                    ' - + ( typeof s.user_data.user_image == 'string' ? '' : '' ) - + 'Hello, ' + s.user_data.first_name + '! ' - + ( typeof s.user_data.headline == 'string' ? '' + s.user_data.headline + '' : '' ) - + ( typeof s.user_data.industry == 'string' ? '' + s.user_data.industry + '' : '' ) - + '

                    '); - } - - jQuery( document ).trigger( 'social::user_data_update' , s.user_data ); - - }); - - jQuery( document ).bind( 'social::user_logout', function() { - - if( typeof IN == 'object' && typeof IN.User != 'undefined' ) { - IN.User.logout(); - } - - }); - - - - }); - - } - - - /** - * The main function ran when the script is executed. - * - */ - var user_logout = this.user_logout = function() { - - jQuery( document ).trigger( 'social::user_logout' ); - - } - - - /** - * The main function ran when the script is executed. - * - */ - var enable = this.enable = function ( ) { - log( 'social::enable()' ); - - /* Detect Social Networks */ - if( typeof (IN) == 'object' ) { - handle_linkedin(); - } - - }; - - - /* Authormatically enable */ - this.enable( ); - - /* Return object for chaining */ - return this; - - }; - -} ( jQuery ) ); diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ud.super-search.js b/vendor/udx/lib-utility/scripts/src/jquery.ud.super-search.js deleted file mode 100644 index 7e5625a08..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ud.super-search.js +++ /dev/null @@ -1,363 +0,0 @@ -/* ========================================================= - * jquery.ud.super_search.js v1.0.1 - * http://usabilitydynamics.com - * ========================================================= - * Copyright 2012 Usability Dynamics, Inc. - * - * Validation: http://www.jslint.com/ - * - * Copyright (c) 2012 Usability Dynamics, Inc. ( usabilitydynamics.com ) - * ========================================================= */ - -(function( jQuery ){ - jQuery.fn.super_search = function( ss_settings ) { - - var element = this; - var abandoned_timer; - var ui= {}; - var ux = {}; - var typing_timer; - var query = { - current: '', - previous: '' - }; - - /* Add ss_eleemnt attribute to this element so it can be IDied later */ - this.attr('ss_element', 'search_input'); - - /* Default Settings */ - var ss = jQuery.extend({ - action : 'super_search', - ajax_url : ajaxurl, - input_classes : { - no_results: 'ss_no_results', - processing: 'ss_processing', - error: 'ss_error' - }, - response_classes: { - response_wrapper: 'ss_response_container', - show_scroll: 'ss_show_scroll', - item_class: '' - }, - append_to: jQuery( element ).parent(), - search_trigger: false, - search_result_gap : 200, - limit : 5, - timers: { - abandonment: 1000, - search_entry : 2000 - }, - async : false, - debug : true, - success : false, - beforeSend : false, - ui: {} - }, ss_settings); - - /* Internal logging function */ - - if( typeof ss.log !== 'function' ) { - ss.log = function( something, type ) { - - if(!ss.debug) { - return; - } - - console.log(something); - - }; - } - - /* Do some QC early on - make sure append to element exist */ - if(!jQuery(ss.append_to).length) { - ss.log('The (' + ss.append_to + ') element does not exist.', 'warning'); - } - - if( ss.search_trigger && typeof ss.search_trigger === 'object' ) { - jQuery( ss.search_trigger ).click( function() { - - /* If current search is same as old, we do nothing */ - if(query.current == query.previous) { - return; - } - - jQuery.fn.super_search.do_search(); - - }); - } - - this.keyup(function() { - - query.current = element.val(); - - /* If no query, we stop scheduld search, if it scheduled */ - if(typing_timer && !query.current) { - clearTimeout(typing_timer); - return; - } - - /* If current search is same as old, we do nothing */ - if(query.current == query.previous) { - return; - } - - /* Clear timer because something was changed, and reset */ - if(typing_timer) { - clearTimeout(typing_timer); - } - - /* All is good, schedule search to happen in few seconds */ - typing_timer = setTimeout(jQuery.fn.super_search.do_search, ss.timers.search_entry); - - }); - - /* Watch for when user enteres input area */ - this.focus(function() { - jQuery.fn.super_search.ux_change(); - }); - - /* Watch for when user leaves input area */ - this.blur(function() { - jQuery.fn.super_search.ux_change(); - }); - - - /** - * Search function, fired when user is done typing - * - * @todo Need error handling. - * @todo Before send should probably accept data returned from callback function to manipulate what happens. - */ - jQuery.fn.super_search.do_search = function() { - ss.log('do_search()'); - - //** Update to latest value */ - query.current = element.val(); - - /* Build ajax post array */ - var post_data = { - action: ss.action, - limit: ss.limit, - query: query.current - } - - /* Build object for callback functions */ - cb_data = { - post_data: post_data, - settings: ss - } - - /* Remove all status-related classes */ - jQuery.each(ss.input_classes, function(slug, css_class) { - jQuery(element).removeClass(css_class); - }); - - jQuery(element).addClass(ss.input_classes.processing); - - jQuery.ajax({ - url: ss.ajax_url, - async: ss.async, - data: post_data, - beforeSend: function(jqXHR, settings) { - ss.log('do_search.beforeSend() - have callback, executing'); - - /* Load current settings into CB data */ - cb_data.settings = settings; - - if(typeof ss.beforeSend == 'function'){ - if(ss.beforeSend.call(this, cb_data)) { - return; - } - } - - }, - complete: function(jqXHR, textStatus) { - ss.log('do_search.complete( jqXHR, ' + textStatus + ' )'); - - /* Clear out processing class, regardless of success */ - jQuery(element).removeClass(ss.input_classes.processing); - - ss.log('Ajax response received.'); - - }, - success: function(data, textStatus, jqXHR) { - ss.log('do_search.success()'); - - if(typeof ss.success == 'function') { - ss.log('do_search.success() - have callback, executing'); - if(ss.success.call(data, textStatus, jqXHR)) { - return; - } - } - - /* Update "Last Searched" query */ - query.previous = query.current; - - //** Delete existing results, regardless of result to avoid confusion. */ - jQuery.fn.super_search.remove_rendered_results(); - - if(data.results) { - ss.last_results = data.results; - jQuery.fn.super_search.render_results(data.results) - } else { - jQuery(element).addClass(ss.input_classes.no_results); - } - - if(data.other) { - ss.log("Search Debug Data:" . data.debug_response); - } - - }, - error: function(jqXHR, textStatus, errorThrown) { - ss.log('do_search.error()'); - jQuery(element).addClass(ss.input_classes.error); - - }, - dataType: "json" - }); - - } - - - /** - * Remove search results. - * - */ - jQuery.fn.super_search.remove_rendered_results = function() { - ss.log('remove_rendered_results()'); - - if(ss.rendered_element && ss.rendered_element.length) { - jQuery(ss.rendered_element).fadeOut(300, function() { - /* jQuery(this).remove();*/ - }); - } - - jQuery.fn.super_search.update_dom_triggers(); - - } - - - /** - * Monitors visual changes to the DOM - * - */ - jQuery.fn.super_search.update_dom_triggers = function() { - ss.log('update_dom_triggers()'); - - /* Remove to avoid multiple triggers */ - jQuery(ss.rendered_element).off('mouseenter'); - jQuery(ss.rendered_element).off('mouseleave'); - - /* Create event to hide rearch result if user's mouse leaves the area, and update UX status */ - jQuery(ss.rendered_element).mouseenter(function() { - ux.results_over = true; - jQuery.fn.super_search.ux_change(); - }).mouseleave(function() { - ux.results_over = false; - jQuery.fn.super_search.ux_change(); - }); - - } - - /** - * Monitors user interactions with the interface, and updates any trigger events. - * - * Called on various events such as user working with input box, or leaving the input box - * - */ - jQuery.fn.super_search.ux_change = function() { - ss.log('ux_change()'); - - /* Check if user is focused on input element */ - if(jQuery(element).is(":focus")) { - ux.input_focus = true; - - /* If search box is clicked, the query has not changed, and search result exists, we show them again */ - if(query.current == query.previous && ss.rendered_element) { - ss.rendered_element.show(); - } - - } else { - ux.input_focus = false; - } - - /* If user is not focused on input, and HAS moused over results, and left, we started a timer to hide the results */ - if(ss.rendered_element && !ux.input_focus && ux.results_over === false) { - abandoned_timer = setTimeout(jQuery.fn.super_search.remove_rendered_results, ss.timers.abandonment); - } else if(abandoned_timer) { - clearTimeout(abandoned_timer); - } - - } - - - /** - * Render search results from query - * - */ - jQuery.fn.super_search.render_results = function(results) { - ss.log('render_results()'); - - /* Account for zero based keys */ - var total_results = (results.length - 1); - - html = []; - - html.push( ss.ui.response_container = '
                      ' ); - - console.log(ss.ui.response_container); - - jQuery.each(results, function(i, data) { - - var classes = []; - - if(ss.response_classes.item_class) { - classes.push(ss.response_classes.item_class); - } - - if(data.item_class) { - classes.push(data.item_class); - } - - if(i == total_results) { - classes.push('last_item'); - } - - html.push('
                    • '); - - if(data.url) { - html.push(''); - } - - html.push(data.title); - - if(data.url) { - html.push(''); - } - - - html.push('
                    • '); - }); - - html.push('
                    '); - - ss.rendered_element = jQuery(html.join('')); - - jQuery(ss.append_to).append(ss.rendered_element); - - ui.window_height = jQuery(window).height(); - ui.rendered_element = jQuery(ss.rendered_element).height(); - - if((ui.rendered_element + ss.search_result_gap) > ui.window_height) { - jQuery(ss.rendered_element).css('max-height', (ui.window_height - ss.search_result_gap) + 'px'); - jQuery(ss.rendered_element).addClass(ss.response_classes.show_scroll); - ui.rendered_element = jQuery(ss.rendered_element).height(); - } - - jQuery.fn.super_search.update_dom_triggers(); - - } - - - }; -})( jQuery ); diff --git a/vendor/udx/lib-utility/scripts/src/jquery.ui.progressbar.js b/vendor/udx/lib-utility/scripts/src/jquery.ui.progressbar.js deleted file mode 100644 index d54e583f5..000000000 --- a/vendor/udx/lib-utility/scripts/src/jquery.ui.progressbar.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * jQuery UI Progressbar 1.8.10 - * - * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about) - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * http://docs.jquery.com/UI/Progressbar - * - * Depends: - * jquery.ui.core.js - * jquery.ui.widget.js - */ -(function( $, undefined ) { - -$.widget( "ui.progressbar", { - options: { - value: 0, - max: 100 - }, - - min: 0, - - _create: function() { - this.element - .addClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .attr({ - role: "progressbar", - "aria-valuemin": this.min, - "aria-valuemax": this.options.max, - "aria-valuenow": this._value() - }); - - this.valueDiv = $( "
                    " ) - .appendTo( this.element ); - - this.oldValue = this._value(); - this._refreshValue(); - }, - - destroy: function() { - this.element - .removeClass( "ui-progressbar ui-widget ui-widget-content ui-corner-all" ) - .removeAttr( "role" ) - .removeAttr( "aria-valuemin" ) - .removeAttr( "aria-valuemax" ) - .removeAttr( "aria-valuenow" ); - - this.valueDiv.remove(); - - $.Widget.prototype.destroy.apply( this, arguments ); - }, - - value: function( newValue ) { - if ( newValue === undefined ) { - return this._value(); - } - - this._setOption( "value", newValue ); - return this; - }, - - _setOption: function( key, value ) { - if ( key === "value" ) { - this.options.value = value; - this._refreshValue(); - if ( this._value() === this.options.max ) { - this._trigger( "complete" ); - } - } - - $.Widget.prototype._setOption.apply( this, arguments ); - }, - - _value: function() { - var val = this.options.value; - // normalize invalid value - if ( typeof val !== "number" ) { - val = 0; - } - return Math.min( this.options.max, Math.max( this.min, val ) ); - }, - - _percentage: function() { - return 100 * this._value() / this.options.max; - }, - - _refreshValue: function() { - var value = this.value(); - var percentage = this._percentage(); - - if ( this.oldValue !== value ) { - this.oldValue = value; - this._trigger( "change" ); - } - - this.valueDiv - .toggleClass( "ui-corner-right", value === this.options.max ) - .width( percentage.toFixed(0) + "%" ); - this.element.attr( "aria-valuenow", value ); - } -}); - -$.extend( $.ui.progressbar, { - version: "1.8.10" -}); - -})( jQuery ); diff --git a/vendor/udx/lib-utility/scripts/src/udx.analytics.js b/vendor/udx/lib-utility/scripts/src/udx.analytics.js deleted file mode 100644 index bf1e70a3e..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.analytics.js +++ /dev/null @@ -1,233 +0,0 @@ -/** - * Event Analytics - * - * data-event="category/action" - * data-track - * - * http://www.google-analytics.com/analytics.js - * - * @version 0.1.0 - * @returns {Object} - */ -define( 'udx.analytics', [ '//www.google-analytics.com/analytics.js' ], function analyticsModule() { - // console.debug( 'udx.analytics', 'analyticsModule' ); - - function Analytics( settings ) { - // console.debug( 'udx.analytics', 'Analytics()', settings ); - - if( 'string' === typeof settings ) { - settings = { id: settings } - } - - if( 'function' !== typeof ga ) { - return console.error( 'udx.analytics', 'The ga variable is not a function.' ) - } - - if( !settings.id ) { - return console.error( 'udx.analytics', 'No id provided.' ) - } - - ga( 'create', settings.id, { - // name: undefined, - // alwaysSendReferrer: true, - // cookieName: '_ga', - // cookieExpires: 63072000 - // clientId: undefined, - userId: settings.userId || undefined, - cookieDomain: window.location.hostname - }); - - this.setView(); - - return this; - - } - - /** - * Prototype Properties. - * - */ - Object.defineProperties( Analytics.prototype, { - ga: { - value: ga, - enumerable: true, - configurable: true, - writable: true - }, - autoLink: { - value: function autoLink() { - - ga(function( tracker ) { - - var page = tracker.get('name'); - - //var linker = new window.gaplugins.Linker( tracker ); - // var output = linker.decorate('//www.eventbrite.com'); - // ga('require', 'linker'); - // ga('linker:autoLink', ['eventbrite.com', 'www.eventbrite.com']); - // var clientId = tracker.get('clientId'); - // console.log( 'clientId', clientId ); - - }); - - return this; - - }, - enumerable: true, - configurable: true, - writable: true - }, - emit: { - /** - * Sent Event - * - * category - * - * @param eventCategory - * @param eventAction - * @param eventLabel - * @param eventValue - */ - value: function emitEvent( eventCategory, eventAction, eventLabel, eventValue ) { - // console.debug( 'udx.analytics', 'emitEvent' ); - - ga( 'send', 'event', { - eventCategory: eventCategory, - eventAction: eventAction, - eventLabel: eventLabel, - eventValue: eventValue - }); - - return this; - - }, - enumerable: true, - configurable: true, - writable: true - }, - set: { - /** - * Set Something - * - * referrer - * campaignName - * campaignId - * campaignSource - * campaignMedium - * campaignKeyword - * campaignContent - * screenResolution - * viewportSize - * - * screenName - * hostname - * title - * page - * - * - * appName - * appId - * appVersion - * - * @param key - * @param value - */ - value: function set( key, value ) { - // console.debug( 'udx.analytics', 'set' ); - - ga('set', key, value ); - - return this; - - }, - enumerable: true, - configurable: true, - writable: true - }, - sendHit: { - /** - * Send Hit - * - * Hit Types - * * pageview - * * screenview - * * event - * * transaction - * * item - * * social - * * exception - * * timing - * - */ - value: function sendHit( hitType, page ) { - // console.debug( 'udx.analytics', 'sendHit' ); - - ga( 'send', { - hitType: hitType || 'pageview', - page: page || document.location.pathname - }); - - return this; - - }, - enumerable: true, - configurable: true, - writable: true - }, - setView: { - /** - * Determine and set view type. - * - * screenview - * - * @param page - * @param title - */ - value: function setView( page, title ) { - // console.debug( 'udx.analytics', 'setView' ); - ga( 'send', 'pageview' ); - return this; - - }, - enumerable: true, - configurable: true, - writable: true - }, - setClient: { - value: function setClient() {}, - enumerable: true, - configurable: true, - writable: true - }, - setSocial: { - value: function setSocial() {}, - enumerable: true, - configurable: true, - writable: true - } - }); - - /** - * Constructor Properties. - * - */ - Object.defineProperties( Analytics, { - create: { - /** - * Create Analytics Session - * - * @param settings - */ - value: function create( settings ) { - return new Analytics( settings ); - }, - enumerable: true, - configurable: true, - writable: true - } - }) - - return Analytics; - -}); - diff --git a/vendor/udx/lib-utility/scripts/src/udx.event.js b/vendor/udx/lib-utility/scripts/src/udx.event.js deleted file mode 100644 index dee120693..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.event.js +++ /dev/null @@ -1,561 +0,0 @@ -/** - * UD Event - * - * Event Emitter handler. - * - * @original https://github.com/hij1nx/EventEmitter2/ - * @version 0.4 - * @author team@UD - */ - -define( 'udx.event', function() { - - var ud = ( typeof ud === 'object' ) ? ud : {}; - - var isArray = Array.isArray ? Array.isArray : function _isArray( obj ) { - return Object.prototype.toString.call( obj ) === "[object Array]"; - }; - - function init() { - this._events = {}; - - if( this._conf ) { - configure.call( this, this._conf ); - } - - } - - function configure( conf ) { - - this._conf = conf || ud.event.prototype.defaults; - - console.log( 'configure', this._conf ); - if( this._conf.wildcard ) { - this.listenerTree = {}; - } - - } - - // - // Attention, function return type now is array, always ! - // It has zero elements if no any matches found and one or more - // elements (leafs) if there are matches - // - function searchListenerTree( handlers, type, tree, i ) { - if( !tree ) { - return []; - } - var listeners = [], leaf, len, branch, xTree, xxTree, isolatedBranch, endReached, typeLength = type.length, currentType = type[i], nextType = type[i + 1]; - if( i === typeLength && tree._listeners ) { - // - // If at the end of the event(s) list and the tree has listeners - // invoke those listeners. - // - if( typeof tree._listeners === 'function' ) { - handlers && handlers.push( tree._listeners ); - return [tree]; - } else { - for( leaf = 0, len = tree._listeners.length; leaf < len; leaf++ ) { - handlers && handlers.push( tree._listeners[leaf] ); - } - return [tree]; - } - } - - if( (currentType === '*' || currentType === '**') || tree[currentType] ) { - // - // If the event emitted is '*' at this part - // or there is a concrete match at this patch - // - if( currentType === '*' ) { - for( branch in tree ) { - if( branch !== '_listeners' && tree.hasOwnProperty( branch ) ) { - listeners = listeners.concat( searchListenerTree( handlers, type, tree[branch], i + 1 ) ); - } - } - return listeners; - } else if( currentType === '**' ) { - endReached = (i + 1 === typeLength || (i + 2 === typeLength && nextType === '*')); - if( endReached && tree._listeners ) { - // The next element has a _listeners, add it to the handlers. - listeners = listeners.concat( searchListenerTree( handlers, type, tree, typeLength ) ); - } - - for( branch in tree ) { - if( branch !== '_listeners' && tree.hasOwnProperty( branch ) ) { - if( branch === '*' || branch === '**' ) { - if( tree[branch]._listeners && !endReached ) { - listeners = listeners.concat( searchListenerTree( handlers, type, tree[branch], typeLength ) ); - } - listeners = listeners.concat( searchListenerTree( handlers, type, tree[branch], i ) ); - } else if( branch === nextType ) { - listeners = listeners.concat( searchListenerTree( handlers, type, tree[branch], i + 2 ) ); - } else { - // No match on this one, shift into the tree but not in the type array. - listeners = listeners.concat( searchListenerTree( handlers, type, tree[branch], i ) ); - } - } - } - return listeners; - } - - listeners = listeners.concat( searchListenerTree( handlers, type, tree[currentType], i + 1 ) ); - } - - xTree = tree['*']; - if( xTree ) { - // - // If the listener tree will allow any match for this part, - // then recursively explore all branches of the tree - // - searchListenerTree( handlers, type, xTree, i + 1 ); - } - - xxTree = tree['**']; - if( xxTree ) { - if( i < typeLength ) { - if( xxTree._listeners ) { - // If we have a listener on a '**', it will catch all, so add its handler. - searchListenerTree( handlers, type, xxTree, typeLength ); - } - - // Build arrays of matching next branches and others. - for( branch in xxTree ) { - if( branch !== '_listeners' && xxTree.hasOwnProperty( branch ) ) { - if( branch === nextType ) { - // We know the next element will match, so jump twice. - searchListenerTree( handlers, type, xxTree[branch], i + 2 ); - } else if( branch === currentType ) { - // Current node matches, move into the tree. - searchListenerTree( handlers, type, xxTree[branch], i + 1 ); - } else { - isolatedBranch = {}; - isolatedBranch[branch] = xxTree[branch]; - searchListenerTree( handlers, type, { '**': isolatedBranch }, i + 1 ); - } - } - } - } else if( xxTree._listeners ) { - // We have reached the end and still on a '**' - searchListenerTree( handlers, type, xxTree, typeLength ); - } else if( xxTree['*'] && xxTree['*']._listeners ) { - searchListenerTree( handlers, type, xxTree['*'], typeLength ); - } - } - - return listeners; - } - - function growListenerTree( type, listener ) { - - type = typeof type === 'string' ? type.split( this._conf.delimiter ) : type.slice(); - - // - // Looks for two consecutive '**', if so, don't add the event at all. - // - for( var i = 0, len = type.length; i + 1 < len; i++ ) { - if( type[i] === '**' && type[i + 1] === '**' ) { - return; - } - } - - var tree = this.listenerTree; - var name = type.shift(); - - while( name ) { - - if( !tree[name] ) { - tree[name] = {}; - } - - tree = tree[name]; - - if( type.length === 0 ) { - - if( !tree._listeners ) { - tree._listeners = listener; - } - - else if( typeof tree._listeners === 'function' ) { - tree._listeners = [tree._listeners, listener]; - } - - else if( isArray( tree._listeners ) ) { - - tree._listeners.push( listener ); - - if( !tree._listeners.warned ) { - - var m = this.defaultMaxListeners; - - if( typeof this._events.maxListeners !== 'undefined' ) { - m = this._events.maxListeners; - } - - if( m > 0 && tree._listeners.length > m ) { - - tree._listeners.warned = true; - console.error( '(node) warning: possible ud.event memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', tree._listeners.length ); - console.trace(); - } - } - } - return true; - } - name = type.shift(); - } - return true; - }; - - /** - * Constructor - * - */ - ud.event = function( conf ) { - this._events = {}; - configure.call( this, conf ); - } - - /** - * Bestow Event functionality into another object - * - * @method bestow - */ - ud.event.bestow = function bestow( target, config ) { - - // Create new instance - var _event = new ud.event( config ); - - // Ensure Target is an Object - target = target && 'object' === typeof target ? target : {}; - - for( var key in _event ) { - - if( 'function' === typeof Object.defineProperty ) { - - Object.defineProperty( target, key, { - 'value': _event[ key ], - 'enumerable': 'function' === typeof _event[ key ] ? false : true, - 'writable': 'function' === typeof _event[ key ] ? false : true - } ); - - } else { - target[ key ] = _event[ key ]; - } - - } - - return target; - - } - - ud.event.prototype.defaults = { - wildcard: true, - defaultMaxListeners: 20, - delimiter: '.' - } - - ud.event.prototype.setMaxListeners = function( n ) { - this._events || init.call( this ); - this._events.maxListeners = n; - if( !this._conf ) this._conf = {}; - this._conf.maxListeners = n; - }; - - ud.event.prototype.event = ''; - - ud.event.prototype.once = function once( event, fn ) { - this.many( event, 1, fn ); - return this; - }; - - ud.event.prototype.many = function many( event, ttl, fn ) { - var self = this; - - if( typeof fn !== 'function' ) { - throw new Error( 'many only accepts instances of Function' ); - } - - function listener() { - if( --ttl === 0 ) { - self.off( event, listener ); - } - fn.apply( this, arguments ); - }; - - listener._origin = fn; - - this.on( event, listener ); - - return self; - }; - - ud.event.prototype.emit = function() { - - this._events || init.call( this ); - - var type = arguments[0]; - - // Loop through the *_all* functions and invoke them. - if( this._all ) { - var l = arguments.length; - var args = new Array( l - 1 ); - for( var i = 1; i < l; i++ ) args[i - 1] = arguments[i]; - for( i = 0, l = this._all.length; i < l; i++ ) { - this.event = type; - this._all[i].apply( this, args ); - } - } - - // If there is no 'error' event listener then throw. - if( type === 'error' ) { - - if( !this._all && !this._events.error && !(this._conf.wildcard && this.listenerTree.error) ) { - - if( arguments[1] instanceof Error ) { - throw arguments[1]; // Unhandled 'error' event - } else { - throw new Error( "Uncaught, unspecified 'error' event." ); - } - return false; - } - } - - var handler; - - if( this._conf.wildcard ) { - handler = []; - var ns = typeof type === 'string' ? type.split( this._conf.delimiter ) : type.slice(); - searchListenerTree.call( this, handler, ns, this.listenerTree, 0 ); - } else { - handler = this._events[type]; - } - - if( typeof handler === 'function' ) { - this.event = type; - if( arguments.length === 1 ) { - handler.call( this ); - } else if( arguments.length > 1 ) - switch( arguments.length ) { - case 2: - handler.call( this, arguments[1] ); - break; - case 3: - handler.call( this, arguments[1], arguments[2] ); - break; - // slower - default: - var l = arguments.length; - var args = new Array( l - 1 ); - for( var i = 1; i < l; i++ ) args[i - 1] = arguments[i]; - handler.apply( this, args ); - } - return true; - } else if( handler ) { - var l = arguments.length; - var args = new Array( l - 1 ); - for( var i = 1; i < l; i++ ) args[i - 1] = arguments[i]; - - var listeners = handler.slice(); - for( var i = 0, l = listeners.length; i < l; i++ ) { - this.event = type; - listeners[i].apply( this, args ); - } - return (listeners.length > 0) || this._all; - } else { - return this._all; - } - - }; - - ud.event.prototype.on = function( type, listener ) { - - if( typeof type === 'function' ) { - this.onAny( type ); - return this; - } - - if( typeof listener !== 'function' ) { - throw new Error( 'on only accepts instances of Function' ); - } - this._events || init.call( this ); - - if( this._conf.wildcard ) { - growListenerTree.call( this, type, listener ); - return this; - } - - if( !this._events[type] ) { - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - } else if( typeof this._events[type] === 'function' ) { - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - } else if( isArray( this._events[type] ) ) { - // If we've already got an array, just append. - this._events[type].push( listener ); - - // Check for listener leak - if( !this._events[type].warned ) { - - var m = this.defaultMaxListeners; - - if( typeof this._events.maxListeners !== 'undefined' ) { - m = this._events.maxListeners; - } - - if( m > 0 && this._events[type].length > m ) { - - this._events[type].warned = true; - console.error( '(node) warning: possible ud.event memory ' + 'leak detected. %d listeners added. ' + 'Use emitter.setMaxListeners() to increase limit.', this._events[type].length ); - console.trace(); - } - } - } - return this; - }; - - ud.event.prototype.onAny = function( fn ) { - - if( !this._all ) { - this._all = []; - } - - if( typeof fn !== 'function' ) { - throw new Error( 'onAny only accepts instances of Function' ); - } - - // Add the function to the event listener collection. - this._all.push( fn ); - return this; - }; - - ud.event.prototype.addListener = ud.event.prototype.on; - - ud.event.prototype.off = function( type, listener ) { - if( typeof listener !== 'function' ) { - throw new Error( 'removeListener only takes instances of Function' ); - } - - var handlers, leafs = []; - - if( this._conf.wildcard ) { - var ns = typeof type === 'string' ? type.split( this._conf.delimiter ) : type.slice(); - leafs = searchListenerTree.call( this, null, ns, this.listenerTree, 0 ); - } else { - // does not use listeners(), so no side effect of creating _events[type] - if( !this._events[type] ) return this; - handlers = this._events[type]; - leafs.push( {_listeners: handlers} ); - } - - for( var iLeaf = 0; iLeaf < leafs.length; iLeaf++ ) { - var leaf = leafs[iLeaf]; - handlers = leaf._listeners; - if( isArray( handlers ) ) { - - var position = -1; - - for( var i = 0, length = handlers.length; i < length; i++ ) { - if( handlers[i] === listener || (handlers[i].listener && handlers[i].listener === listener) || (handlers[i]._origin && handlers[i]._origin === listener) ) { - position = i; - break; - } - } - - if( position < 0 ) { - return this; - } - - if( this._conf.wildcard ) { - leaf._listeners.splice( position, 1 ) - } else { - this._events[type].splice( position, 1 ); - } - - if( handlers.length === 0 ) { - if( this._conf.wildcard ) { - delete leaf._listeners; - } else { - delete this._events[type]; - } - } - } else if( handlers === listener || (handlers.listener && handlers.listener === listener) || (handlers._origin && handlers._origin === listener) ) { - if( this._conf.wildcard ) { - delete leaf._listeners; - } else { - delete this._events[type]; - } - } - } - - return this; - }; - - ud.event.prototype.offAny = function( fn ) { - var i = 0, l = 0, fns; - if( fn && this._all && this._all.length > 0 ) { - fns = this._all; - for( i = 0, l = fns.length; i < l; i++ ) { - if( fn === fns[i] ) { - fns.splice( i, 1 ); - return this; - } - } - } else { - this._all = []; - } - return this; - }; - - ud.event.prototype.removeListener = ud.event.prototype.off; - - ud.event.prototype.removeAllListeners = function( type ) { - if( arguments.length === 0 ) { - !this._events || init.call( this ); - return this; - } - - if( this._conf.wildcard ) { - var ns = typeof type === 'string' ? type.split( this._conf.delimiter ) : type.slice(); - var leafs = searchListenerTree.call( this, null, ns, this.listenerTree, 0 ); - - for( var iLeaf = 0; iLeaf < leafs.length; iLeaf++ ) { - var leaf = leafs[iLeaf]; - leaf._listeners = null; - } - } else { - if( !this._events[type] ) return this; - this._events[type] = null; - } - return this; - }; - - ud.event.prototype.listeners = function( type ) { - if( this._conf.wildcard ) { - var handlers = []; - var ns = typeof type === 'string' ? type.split( this._conf.delimiter ) : type.slice(); - searchListenerTree.call( this, handlers, ns, this.listenerTree, 0 ); - return handlers; - } - - this._events || init.call( this ); - - if( !this._events[type] ) this._events[type] = []; - if( !isArray( this._events[type] ) ) { - this._events[type] = [this._events[type]]; - } - return this._events[type]; - }; - - ud.event.prototype.listenersAny = function() { - - if( this._all ) { - return this._all; - } else { - return []; - } - - }; - -}); diff --git a/vendor/udx/lib-utility/scripts/src/udx.filter.js b/vendor/udx/lib-utility/scripts/src/udx.filter.js deleted file mode 100644 index e439010a4..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.filter.js +++ /dev/null @@ -1,54 +0,0 @@ -/** - * Migrated from ud.global.js - * - */ -define( 'udx.filter', function() { - - return { - - /** - * Applies filter for the passed object - * - * @param name. string. required. Name of filter - * @param obj. object. required. Object which will go through called filter - * @author peshkov@UD - */ - apply_filter: function( name, obj ) { - - /* Filter's name and callback are required */ - if( typeof obj === 'undefined' || typeof name === 'undefined' || typeof name !== 'string' ) return obj; - /* jQuery must be inititialized */ - if( typeof jQuery === 'undefined' ) return obj; - /* Called filter must exist */ - if( typeof window.__ud_filters === 'undefined' || typeof window.__ud_filters[ name ] === 'undefined' ) return obj; - - jQuery.each( window.__ud_filters[ name ], function( i, e ) { - if( typeof e === 'function' ) { - obj = e( obj ); - } else if( typeof e === 'object' ) { - if( typeof obj !== 'object' ) return false; - obj = jQuery.extend( true, obj, e ); - } - } ); - return obj; - }, - - /** - * Adds filter to filters array. - * - * @param name. string. required. Name of filter. - * @param calback. object|function. required. Filter which will be used on filter applying - * @author peshkov@UD - */ - add_filter: function( name, callback ) { - /* Filter's name and callback are required */ - if( typeof callback === 'undefined' || typeof name === 'undefined' || typeof name !== 'string' ) return; - /* Add object to filter */ - if( typeof window.__ud_filters === 'undefined' ) window.__ud_filters = {}; - if( typeof window.__ud_filters[ name ] === 'undefined' ) window.__ud_filters[ name ] = []; - window.__ud_filters[ name ].push( callback ); - } - } - -} ); - diff --git a/vendor/udx/lib-utility/scripts/src/udx.fleck.js b/vendor/udx/lib-utility/scripts/src/udx.fleck.js deleted file mode 100644 index 26dcfdc00..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.fleck.js +++ /dev/null @@ -1,214 +0,0 @@ -/** - * fleck - functional style string inflections - * https://github.com/trek/fleck - * copyright Trek Glowacki - * MIT License - * - * @version 1.0 - * @description functional style string inflections - * @package fleck - * @author Trek Glowacki - */ - -!function (name, definition) { - if (typeof module != 'undefined') module.exports = definition() - else if (typeof define == 'function' && typeof define.amd == 'object') define(definition) - else this[name] = definition() -}('fleck', function () { - - var lib = { - // plural rules, singular rules, and starting uncountables - // from http://code.google.com/p/inflection-js/ - // with corrections for ordering and spelling - pluralRules: [ - [new RegExp('(m)an$', 'gi'), '$1en'], - [new RegExp('(pe)rson$', 'gi'), '$1ople'], - [new RegExp('(child)$', 'gi'), '$1ren'], - [new RegExp('^(ox)$', 'gi'), '$1en'], - [new RegExp('(ax|test)is$', 'gi'), '$1es'], - [new RegExp('(octop|vir)us$', 'gi'), '$1i'], - [new RegExp('(alias|status)$', 'gi'), '$1es'], - [new RegExp('(bu)s$', 'gi'), '$1ses'], - [new RegExp('(buffal|tomat|potat)o$', 'gi'), '$1oes'], - [new RegExp('([ti])um$', 'gi'), '$1a'], - [new RegExp('sis$', 'gi'), 'ses'], - [new RegExp('(?:([^f])fe|([lr])f)$', 'gi'), '$1$2ves'], - [new RegExp('(hive)$', 'gi'), '$1s'], - [new RegExp('([^aeiouy]|qu)y$', 'gi'), '$1ies'], - [new RegExp('(matr|vert|ind)ix|ex$', 'gi'), '$1ices'], - [new RegExp('(x|ch|ss|sh)$', 'gi'), '$1es'], - [new RegExp('([m|l])ouse$', 'gi'), '$1ice'], - [new RegExp('(quiz)$', 'gi'), '$1zes'], - [new RegExp('s$', 'gi'), 's'], - [new RegExp('$', 'gi'), 's'] - ], - singularRules: [ - [new RegExp('(m)en$', 'gi'), '$1an'], - [new RegExp('(pe)ople$', 'gi'), '$1rson'], - [new RegExp('(child)ren$', 'gi'), '$1'], - [new RegExp('([ti])a$', 'gi'), '$1um'], - [new RegExp('((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$','gi'), '$1$2sis'], - [new RegExp('(hive)s$', 'gi'), '$1'], - [new RegExp('(tive)s$', 'gi'), '$1'], - [new RegExp('(curve)s$', 'gi'), '$1'], - [new RegExp('([lr])ves$', 'gi'), '$1f'], - [new RegExp('([^fo])ves$', 'gi'), '$1fe'], - [new RegExp('([^aeiouy]|qu)ies$', 'gi'), '$1y'], - [new RegExp('(s)eries$', 'gi'), '$1eries'], - [new RegExp('(m)ovies$', 'gi'), '$1ovie'], - [new RegExp('(x|ch|ss|sh)es$', 'gi'), '$1'], - [new RegExp('([m|l])ice$', 'gi'), '$1ouse'], - [new RegExp('(bus)es$', 'gi'), '$1'], - [new RegExp('(o)es$', 'gi'), '$1'], - [new RegExp('(shoe)s$', 'gi'), '$1'], - [new RegExp('(cris|ax|test)es$', 'gi'), '$1is'], - [new RegExp('(octop|vir)i$', 'gi'), '$1us'], - [new RegExp('(alias|status)es$', 'gi'), '$1'], - [new RegExp('^(ox)en', 'gi'), '$1'], - [new RegExp('(vert|ind)ices$', 'gi'), '$1ex'], - [new RegExp('(matr)ices$', 'gi'), '$1ix'], - [new RegExp('(quiz)zes$', 'gi'), '$1'], - [new RegExp('s$', 'gi'), ''] - ], - uncountableWords: { - 'equipment': true, - 'information': true, - 'rice': true, - 'money': true, - 'species': true, - 'series':true, - 'fish':true, - 'sheep':true, - 'moose':true, - 'deer':true, - 'news':true - }, - // Chain multiple inflections into a signle call - // Examples: - // lib.inflect(' posts', 'strip', 'singularize', 'capitalize') == 'Post' - inflect: function(str){ - for (var i = 1, l = arguments.length; i < l; i++) { - str = lib[arguments[i]](str); - }; - - return str; - }, - // Uppercases the first letter and lowercases all other letters - // Examples: - // lib.capitalize("message_properties") == "Message_properties" - // lib.capitalize("message properties") == "Message properties" - capitalize: function(str) { - return str.charAt(0).toUpperCase() + str.substring(1).toLowerCase(); - }, - // lib.camelize("message_properties") == "messageProperties" - // lib.camelize('-moz-border-radius') == 'mozBorderRadius' - // lib.camelize("message_properties", true) == "MessageProperties" - camelize: function(str, upper){ - if (upper) { return lib.upperCamelize(str) }; - return str.replace(/[-_]+(.)?/g, function(match, chr) { - return chr ? chr.toUpperCase() : ''; - }); - }, - // lib.upperCamelize("message_properties") == "MessageProperties" - upperCamelize: function(str){ - return lib.camelize(lib.capitalize(str)); - }, - // Replaces all spaces or underscores with dashes - // Examples: - // lib.dasherize("message_properties") == "message-properties" - // lib.dasherize("Message properties") == "Message-properties" - dasherize: function(str){ - return str.replace(/\s|_/g, '-'); - }, - // turns number or string formatted number into ordinalize version - // Examples: - // lib.ordinalize(4) == "4th" - // lib.ordinalize("13") == "13th" - // lib.ordinalize("122") == "122nd" - ordinalize: function(str){ - var isTeen, r, n; - n = parseInt(str, 10) % 100; - isTeen = { 11: true, 12: true, 13: true}[n]; - if(isTeen) {return str + 'th'}; - n = parseInt(str, 10) % 10 - switch(n) { - case 1: - r = str + 'st'; - break; - case 2: - r = str + 'nd'; - break; - case 3: - r = str + 'rd'; - break; - default: - r = str + 'th'; - } - return r; - }, - pluralize: function(str){ - var uncountable = lib.uncountableWords[str.toLowerCase()]; - if (uncountable) { - return str; - }; - var rules = lib.pluralRules; - for(var i = 0, l = rules.length; i < l; i++){ - if (str.match(rules[i][0])) { - str = str.replace(rules[i][0], rules[i][1]); - break; - }; - } - - return str; - }, - singularize: function(str){ - var uncountable = lib.uncountableWords[str.toLowerCase()]; - if (uncountable) { - return str; - }; - var rules = lib.singularRules; - for(var i = 0, l = rules.length; i < l; i++){ - if (str.match(rules[i][0])) { - str = str.replace(rules[i][0], rules[i][1]); - break; - }; - } - - return str; - }, - // Removes leading and trailing whitespace - // Examples: - // lib.strip(" hello world! ") == "hello world!" - strip: function(str){ - // implementation from Prototype.js - return str.replace(/^\s+/, '').replace(/\s+$/, ''); - }, - // Converts a camelized string into a series of words separated by an - // underscore (`_`). - // Examples - // lib.underscore('borderBottomWidth') == "border_bottom_width" - // lib.underscore('border-bottom-width') == "border_bottom_width" - // lib.underscore('Foo::Bar') == "foo_bar" - // lib.underscore('Foo.Bar') == "foo_bar" - underscore: function(str){ - // implementation from Prototype.js - return str.replace(/::/g, '_') - .replace(/([A-Z]+)([A-Z][a-z])/g, '$1_$2') - .replace(/([a-z\d])([A-Z])/g, '$1_$2') - .replace(/[-\.]/g, '_') - .toLowerCase(); - }, - - // add an uncountable word - // fleck.uncountable('ninja', 'tsumani'); - uncountable: function(){ - for(var i=0,l=arguments.length; i 0 && !jQuery( '#' + self.modules[i].id ).length > 0 ) { - var content_wrapper = '
                    '; - try { content = self.listeners.add_content_wrapper( content_wrapper, self.modules[i], self ) } - catch( e ) { self.show_error( 'add_content_wrapper', e ) } - if( typeof content_wrapper === 'string' ) { - jQuery( self.ui.content ).append( content_wrapper ); - } - } - break; - - case 'link': - - break; - - } - - /* Add menu item to HTML */ - if( jQuery( self.modules[i].menu ).length > 0 ) { - var href = self.is_url( self.modules[i].href ) ? self.modules[i].href : '#' + self.modules[i].id; - var menu_item = '' + self.modules[i].name + ''; - try { menu_item = self.listeners.add_menu_item( menu_item, self.modules[i], self ) } - catch( e ) { self.show_error( 'add_menu_item', e ) } - if( typeof menu_item === 'string' ) { - menu_item = jQuery( menu_item ); - menu_item.each( function( index, e ) { - var a = typeof jQuery( e ).attr( 'href' ) !== 'undefined' ? jQuery( e ) : jQuery( 'a', e ); - if( a.length > 0 ) { - a.attr( 'module', i ).attr( 'type', self.modules[i].type ); - } - } ); - jQuery( self.modules[i].menu ).append( menu_item ); - } - } - - } - - /* Loads required CSS */ - if( typeof self._required.css === 'object' ) { - jQuery.each( self._required.css, function( style, url ) { - ud.load.css( url ); - } ); - } - - /* Load all required files before continue */ - ud.load.js( self._required.js, function() { - - /* Initialize Router */ - self.router = self.router(); - - /** - * Determine if we need to load addtional javascript/css files. - * Specific module javascript/css files must be loaded before continue! - */ - var _required = {}; - - jQuery.each( self.models, function( i, m ) { - if( typeof m === 'object' && typeof m._required === 'object' ) { - if( typeof m._required.js === 'object' ) { - jQuery.each( m._required.js, function( script, url ) { - _required[ script ] = url; - } ); - } - if( typeof m._required.css === 'object' ) { - jQuery.each( m._required.css, function( style, url ) { - /* Load module's CSS */ - ud.load.css( url ); - } ); - } - } - } ); - - Object.size = function( obj ) { - var size = 0, key; - for( key in obj ) { if( obj.hasOwnProperty( key ) ) size++; } - return size; - }; - - if( Object.size( _required ) > 0 ) { - ud.load.js( _required, self._run ); - } else { - self._run(); - } - - } ); - - } - - /** - * Runs application. - * - * It does the following steps: - * 1. tries connecting to socket; - * 2. runs router. - * - * Must be called after init. - * - * @author peshkov@UD - */ - self._run = function() { - - if( self.rendered ) return null; - - /* Determine is socket arguments are set */ - if( self.socket && typeof self.socket === 'object' ) { - - self.core.socket( self.socket, function( socket ) { - self.socket = socket; - try { self.listeners.socket_connected( self ) } - catch( e ) { self.show_error( 'socket_connected', e ) } - /* Run App */ - self.router.run(); - } ); - - } else { - - /* Run App */ - self.router.run(); - - // console.log( self ); - - } - - } - - /** - * Sets ( inits ) Router - * - * @author peshkov@UD - */ - self.router = function() { - - /* Pagination. History implementation. */ - return new Sammy( function() { - - this.home = self.url; - - this.loading = false; - - this.get( /\#(.*)/, function( router ) { - - /* Looks like router did not finish previous process. */ - if( router.app.loading ) { - return null; - } - router.app.loading = true; - - /* Parse query hash and set params */ - var params = { - 'section' : false, - 'args' : [] - }; - jQuery.each( router.params[ 'splat' ][0].split( '/' ), function( i,e ) { - if( e.length == 0 ) return null; - else if ( !params.section ) params.section = e; - else params.args.push( e ); - } ); - - /* Initialize Knockout View Model if it's undefined */ - var module = typeof self.sections[ params.section ] !== 'undefined' ? self.sections[ params.section ] : false; - - /* Get the default ( home ) section if the called one doesn't exist */ - if( !module || typeof self.modules[ module ] === 'undefined' ) { - self.show_error( 'Module with the hash \'' + params.section + '\' doesn\'t exist.', - 'Sammy.get( \'#:module\' )' ); - router.app.loading = false; - if( typeof self.modules[ self.default_module ] !== 'undefined' && typeof self.sections[ self.modules[ self.default_module ].id ] !== 'undefined' ) { - router.app.runRoute( 'get', '#' + self.modules[ self.default_module ].id ); - } - return null; - } - - if( self.modules[ module ].view_model === null || typeof self.modules[ module ].view_model !== 'object' ) { - self.modules[ module ].view_model = self.core.view_model( { - 'scope': self, - 'model': typeof self.models[ module ] === 'object' ? self.models[ module ] : {}, - 'view': self.modules[ module ].view, - 'args': jQuery.extend( self.modules[ module ].args, { 'module': module } ), - 'container': '#' + params.section - } ); - /** - * Timeout is used to prevent the issues with socket requests. Hope, that 300msec is always enought. - * I have no idea why it happens, but when page loads on specific section which is using socket request on init, - * socket doesn't send response. Probably the issue is related to socket object links ( scope ). - * peshkov@UD - */ - setTimeout( function() { - self.modules[ module ].view_model.apply( params.args ); - }, 300 ); - } else { - self.modules[ module ].view_model.update( params.args ); - } - - /* Determine if the module is already selected we stop process here. */ - var selected_section = self.sections[ params.section ]; - if( typeof self.selected_section !== 'undefined' && selected_section === self.selected_section ) { - // Finish process - router.app.loading = false; - return null; - } - - self.selected_section = selected_section; - - for( var a in self.sections ) { - if( typeof self.sections[a] !== 'function' ) { - jQuery( 'a[href="#' + a + '"]' ).removeClass( 'selected' ); - } - } - - for( var a in self.sections ) { - if( typeof self.sections[a] !== 'function' ) { - var section = jQuery( '#' + a ).get( 0 ); - jQuery( section ).hide(); - if( jQuery( section ).attr( 'id' ) === params.section ) { - if( self.modules[ module ].parent && typeof self.modules[ self.modules[ module ].parent ] === 'object' ) { - jQuery( 'a[href="#' + self.modules[ self.modules[ module ].parent ].id + '"][type="module"]' ).addClass( 'selected' ); - } - jQuery( 'a[href="#' + params.section + '"]' ).addClass( 'selected' ); - jQuery( section ).fadeIn( 500, function() { - jQuery( this ).show( 500, function() { - // Finish process - router.app.loading = false; - } ); - } ); - } - } - } - - try { self.listeners.section_selected( params.section, self ) } - catch( e ) { self.show_error( 'section_selected', e ) } - - if( !self.rendered ) { - try { self.listeners.rendered( self ) } - catch( e ) { self.show_error( 'rendered', e ) } - self.rendered = true; - } - - }); - - this.get( '', function( router ) { - var reg = new RegExp( "(https?|ftp):", 'g' ); - if( router.app.home.replace( reg, '' ) !== location.href.replace( reg, '' ) ) { - window.location = location.href; - } else { - if( self.default_module && jQuery( '#' + self.default_module ).length > 0 ) { - router.app.runRoute( 'get', '#' + self.default_module ); - } else { - //Ignore. - } - } - } ); - - }); - - } - - this.__ = self; - - self._init(); - - return this.__; - -} \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/udx.happ.json_editor.js b/vendor/udx/lib-utility/scripts/src/udx.happ.json_editor.js deleted file mode 100644 index 2a0ff4fe1..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.happ.json_editor.js +++ /dev/null @@ -1,196 +0,0 @@ -/** - * JSON Editor - * It's just a wrapper for ud.json.editor - * - loads ud.json.editor library and styles - * - adds schema and validation functionality. - * - * @required ud.loader, ud.async - * @author peshkov@UD - */ - -Application.define( 'core.json_editor', function( args ) { - - /* Set arguments */ - args = jQuery.extend( true, { - 'container' : false, // ID of DOM element where editor/formatter will be initialized - 'instance' : 'editor', // Available value: 'editor', 'formatter' - 'options' : {}, - 'json' : null, - 'callback' : function( editor ) { return editor; }, // Object can be got only using callback! - // Set of actions listeners which are fired on json editor events - 'actions' : { - /** - * Called on Save event. - * @param object json - */ - 'save': function( json ) { - return null; - }, - /** - * Called after validation process - * @param object result Validation's response - */ - 'validate': function( result ) { - return null; - } - } - }, typeof args === 'object' ? args : {} ); - - /* Check container argument */ - var container = typeof args.container === 'object' ? args.container.get(0) : document.getElementById( args.container.replace( '#', '' ) ); - - /** - * - */ - var editor = function( container, args ) { - - var self = this; - - self._args = typeof args.options == 'object' ? args.options : {}; - - /* */ - self.options = jQuery.extend( true, { - 'change' : function() { return null }, // Set a callback method triggered when the contents of the JSONEditor change. Called without parameters. - 'history' : true, // Enables history, adds a button Undo and Redo to the menu of the JSONEditor. Only applicable when mode is 'editor'. - 'mode' : 'editor', // Set the editor mode. Available values: 'editor', 'viewer', or 'form'. In 'viewer' mode, the data and datastructure is read-only. In 'form' mode, only the value can be changed, the datastructure is read-only. - //'name' : 'name_' + ( Math.ceil( Math.random() * 10000 ) ), // Initial field name for the root node. Can also be set using JSONEditor.setName(name) - 'search' : true // Enables a search box in the upper right corner of the JSONEditor. True by default. - }, typeof args.options == 'object' ? args.options : {} ); - - /* */ - self.__ = new JSONEditor (container, self.options, typeof self._args.json != 'undefined' ? self._args.json : null ); - - /* */ - self.schema = false; - - /** - * - */ - self.save = function() { - if( self.schema && !self.validate() ) { - return false; - } - /* Special Handlers can be added here */ - try { self._args.actions.save( schema.get() ); } catch( error ) { return false; } - return true; - } - - - /** - * - */ - self.set = function ( json, options ) { - - options = jQuery.extend( true, { - 'name' : null, - 'schema' : null - }, typeof options === 'object' ? options : {} ); - - self.schema = typeof options.schema === 'object' && options.schema != null ? options.schema : false; - if( self.schema ) { - jQuery( 'button.jsoneditor-validate-object', container ).show(); - } else { - jQuery( 'button.jsoneditor-validate-object', container ).hide(); - } - - if( typeof options.name === 'string' ) { - return self.__.set( json, options.name ); - } else { - return self.__.set( json ); - } - - } - - /** - * - */ - self.get = function () { - console.log( 'JSON EDITOR: GET' ); - return self.__.get(); - } - - - /** - * Validates the current object if schema is set and returns boolean - * - * @uses ud.json.validate - */ - self.validate = function () { - if( typeof self.schema !== 'object' || typeof validate === 'undefined' ) { - return true; - } - self.last_validation = validate( self.get(), self.schema ); - /* Special Handlers can be added here */ - try { self._args.actions.validate( self.last_validation ); } catch( error ) { return false; } - return self.last_validation.valid; - } - - /** - * - */ - self._update_menu = function( enable ) { - var save_button = jQuery( 'button.jsoneditor-save-object', container ); - - var validate_button = document.createElement( 'button' ); - validate_button.title = 'Validate'; - validate_button.className = 'jsoneditor-menu jsoneditor-validate-object'; - validate_button.appendChild( document.createTextNode( "Validate" ) ); - validate_button.style.display = 'none'; - validate_button.onclick = function(){ self.validate(); } - - save_button.click( function() { self.save(); } ).after( validate_button ); - } - - - /* Add default scope's properties to our wrapper */ - jQuery.each( self.__, function( i, e ) { - if( typeof self[ i ] === 'undefined' ) { - self[ i ] = e; - } - } ); - - self._update_menu(); - - }; - - /* */ - async.parallel( { - // Load required scripts - 'js' : function( callback ) { - - ud.load.js( { - 'JSONEditor' : '//ud-cdn.com/js/ud.json.editor/latest/ud.json.editor.js', - 'validate' : '//ud-cdn.com/js/ud.json.validate/1.0/ud.json.validate.js' - }, function() { - callback( null, true ); - }); - }, - // Loads required CSS if needed - 'css' : function( callback ) { - window._flags = typeof window._flags !== 'undefined' ? window._flags : {}; - if( typeof window._flags.json_editor_css === 'undefined' || !window._flags.json_editor_css ) { - ud.load.css( '//ud-cdn.com/js/ud.json.editor/latest/assets/ud.json.editor.css' ); - window._flags.json_editor_css = true; - } - callback( null, true ); - } - }, function( err ) { - - if ( typeof args.callback === 'function' ) { - /* */ - var instance = null; - switch( args.instance ) { - case 'editor': - instance = new editor( container, args ); - break; - - case 'formatter': - instance = new JSONformatter ( container, args.options ); - break; - } - args.callback( instance ); - } - - } ); - -} ); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/udx.happ.socket.js b/vendor/udx/lib-utility/scripts/src/udx.happ.socket.js deleted file mode 100644 index 39ad1171f..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.happ.socket.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Socket - * - * @required ud.socket - * @author peshkov@UD - */ - -Application.define( 'core.socket', function( args, callback ) { - - /* Set arguments */ - args = jQuery.extend( true, { - 'port': 443, - 'url': false, - 'resource': 'websocket.api/v1.5', - 'secure': true, - 'account-id': false, - 'access-key': false - }, typeof args === 'object' ? args : {} ); - - if( typeof callback === 'undefined' ) { - callback = function() { - return null; - } - } - - return new ud.socket.connect( args.url, args, function( error, socket ) { - if( error ) { - console.error( 'Socket Callback', 'Connection Failed', error ); - return null; - } - try { callback( socket ); } - catch( e ) { console.error( 'Socket Callback', 'Custom callback failed', e ); } - } ); - -} ); \ No newline at end of file diff --git a/vendor/udx/lib-utility/scripts/src/udx.happ.view_model.js b/vendor/udx/lib-utility/scripts/src/udx.happ.view_model.js deleted file mode 100644 index f307d11eb..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.happ.view_model.js +++ /dev/null @@ -1,278 +0,0 @@ -/** - * View Model - * - * @required jQuery, knockout, knockout.mapping, knockout.ud - * @author peshkov@UD - */ - -Application.define( 'core.view_model', function( args ) { - - /* Set arguments */ - args = jQuery.extend( true, { - '_required': {}, - 'scope': false, // Application's object - 'model': {}, // - 'view': false, // HTML data or template's url - 'container': false, // HTML container - 'args': { - // Localization strings - 'l10n': { - 'remove_confirmation': 'Are you sure you want to remove it?' - } - }, - // Set of actions listeners which are fired on view model 'triggers' - 'actions': { - // Called on view_model update. view_model is updated on every selection ( see app.js -> Sammy implementation ) - 'update': function() { - return null; - }, - // Called before ko.applyBindings() function - 'pre_apply': function( self, callback ) { - callback( null, true ); - }, - // Child Constructor. Called after ko.applyBindings() function - 'init': function( self, callback ) { - callback( null, true ); - }, - // Called after data adding - 'add_data': function() { - return null; - }, - // Called after data removing - 'remove_data': function() { - return null; - }, - // Additional callback - 'callback': false - }, - // Callback should not be overwritten! If you want to add your callback use actions.callback - 'callback': function( error, data ) { - var self = this; - if( typeof self.actions === 'object' && typeof self.actions.callback === 'function' ) { - return self.actions.callback( error, data ); - } else { - - if( error && error instanceof Error ) { - console.error( error.message, data ); - } - - return data; - - } - } - }, typeof args === 'object' ? args : {} ); - - /* Check container argument */ - var container = ( args.container && typeof args.container !== 'object' ) ? jQuery( args.container ) : args.container; - - if( !container || typeof container.length === 'undefined' || !container.length > 0 ) { - return args.callback( new Error( 'ko.view_model. Container is missing, or incorrect.' ), false ); - } - - /* Appends View if it exists */ - if( args.view ) { - - /* Determine if view is link we try to get template using ajax. */ - if( /^((https?|ftp):)?\/\/([\-A-Z0-9.]+)(\/[\-A-Z0-9+&@#\/%=~_|!:,.;]*)?(\?[A-Z0-9+&@#\/%=~_|!:,.;]*)?/i.test( args.view ) ) { - jQuery.ajax( { - url: args.view, - async: false, - dataType: 'html', - complete: function( r, status ) { - args.view = r.responseText; - } - } ); - } - container.html( args.view ); - } - - var html = container.html(); - - container.html( '' ).addClass( 'ud_view_model ud_ui_loading' ).append( '
                    ' ).append( '
                    ' ).find( '.ud_ui_prepared_interface' ).html( html ); - - /** - * Creates View_Model - */ - var vm = function( args, container ) { - - var self = this; - - /* Determines if view_model already applied Bindings ( ko.applyBinding ) */ - self._applied = false; - - /* Arguments */ - self._args = args; - - /* Application's object */ - self.scope = args.scope; - - /* Application core functions */ - self.core = args.scope.core; - - /* Socket connection */ - self.socket = typeof args.scope.socket === 'object' ? args.scope.socket : false; - - /* DOM */ - self.container = container; - - /** - * Pushes new element to array. - * - * Example of usage: - * data-bind="click: $root.add_data.bind( $data, $root.some_array, $root.vhandler )" - * where $root.vhandler is a function, which creates data. - * - * $root.vhandler example: - * self.handler = function() { - * var self = this; - * self.arg1 = ko.observable( 'value1' ); - * self.arg2 = 'value2'; - * } - * - * @param observableArray item. Where we want to add new data - * @param mixed vhandler. Name of function or function which inits new data - * @param object view_model. The current view_model object - * @param object event. - * @author peshkov@UD - */ - self.add_data = function( item, vhanlder, view_model, event ) { - if( typeof vhanlder == 'function' ) { - item.push( new vhanlder ); - } else if( typeof view_model[ vhanlder ] === 'function' ) { - item.push( new view_model[ vhanlder ]() ); - } - try { self._args.actions.add_data( self, event, item, vhanlder ) } - catch( e ) { self._args.callback( e, view_model ); } - }; - - /** - * Adds message (success/warning/error) - * - * @author peshkov@UD - */ - self.alert = function( message, type ) { - var c = 'alert-success'; - if( typeof type !== 'undefined' ) { - switch( type ) { - case 'error': - c = 'alert-error'; - break; - case 'warning': - c = ''; - break; - } - } - var html = '
                    ' + message + '
                    '; - self.container.prepend( html ); - }; - - /** - * Removes data from array. - * - * Example of usage: - * data-bind="click: $root.remove_data.bind( $data, $root.some_array )" - * - * @param observableArray item. Where we want to remove data - * @param mixed data. Data which should be removed from array. - * @param object event. - * @author peshkov@UD - */ - self.remove_data = function( item, data, event ) { - - if( confirm( self.l10n.remove_confirmation ) ) { - item.remove( data ); - } - - try { - self._args.actions.remove_data( self, event, item, data ) - } catch( e ) { self._args.callback( e, self ); } - }; - - /** - * Wrapper for ko.applyBindings() - * - * Calls before ko.applyBindings() - self.pre_apply() - * Calls after ko.applyBindings() - init() - * - * @TODO: NEED TO IMPLEMENT ASYNC HERE TO HAVE ABILITY TO LOAD ALL DATA FROM SOCKET BEFORE APPLYBINDING. peshkov@UD - * @param array args. Optional - * @author peshkov@UD - */ - self.apply = function( args ) { - var self = this; - - var element = self.container.get( 0 ); - - if( self._applied ) { - return self._args.callback( null, self, element ); - } - - async.series({ - 'pre_apply': function( callback ){ - /* Special Handlers can be added here */ - try { - self._args.actions.pre_apply( self, callback ); - } catch( error ) { - callback( 'Error occured on VM pre_apply event' ); - } - }, - 'apply_bindings': function( callback ){ - ko.applyBindings( self, self.container.get( 0 ) ); - self._applied = true; - callback( null, true ); - }, - 'init': function ( callback ) { - self.container.removeClass( 'ud_ui_loading' ).addClass( 'ud_ui_applied' ); - /* Special Handlers can be added here */ - try { - self._args.actions.init( self, callback ); - } catch( error ) { - callback( 'Error occured on VM init event' ); - } - } - }, - function(err, results) { - self.update( typeof args !== 'undefined' ? args : [] ); - return self._args.callback( null, self ); - }); - - return null; - - }; - - /** - * It's just a wrapper. - * It should be called if view_model should be updated - * - * @param array args. Optional - * @author peshkov@UD - */ - self.update = function( args ) { - var self = this; - /* Special Handlers can be added here */ - try { self._args.actions.update( self, typeof args !== 'undefined' ? args : [] ); } catch( error ) { self._args.callback( error, self ); } - }; - - /* Add view_model data which is not related to args from model. */ - var m = {}; - var args = {}; - - if( typeof self._args.model === 'object' ? self._args.model : {} ) { - jQuery.each( self._args.model, function( i, e ) { - if( typeof self._args[ i ] === 'undefined' ) { m[ i ] = e; } else { args[ i ] = e; } - }); - } - - /* Combine arguments */ - self._args = jQuery.extend( true, self._args, args ); - - /* All additional methods and elements for the current model are added here */ - self = jQuery.extend( true, self, typeof self._args.args === 'object' ? self._args.args : args, m ); - - }; - - /* Bind Knockout */ - return new vm( args, container ); - -}); - diff --git a/vendor/udx/lib-utility/scripts/src/udx.loader.js b/vendor/udx/lib-utility/scripts/src/udx.loader.js deleted file mode 100644 index 8aba064d9..000000000 --- a/vendor/udx/lib-utility/scripts/src/udx.loader.js +++ /dev/null @@ -1,360 +0,0 @@ -/** - * UD Loader - * Initial global object extended by product-specific globals. - * - * @version 1.0 - * @description UD Loader. Initial global object extended by product-specific globals - * @package UD - * @author team@UD - */ -var ud = { - 'load': ( function (doc) { - - var env, - - head, - - pending = {}, - - pollCount = 0, - - // Queued requests. - queue = {css: [], js: []}, - - // Reference to the browser's list of stylesheets. - styleSheets = doc.styleSheets; - - /** - * Creates and returns an HTML element with the specified name and attributes. - * - */ - function createNode(name, attrs) { - var node = doc.createElement(name), attr; - - for (attr in attrs) { - if (attrs.hasOwnProperty(attr)) { - node.setAttribute(attr, attrs[attr]); - } - } - - return node; - } - - /** - Called when the current pending resource of the specified type has finished - loading. Executes the associated callback (if any) and loads the next - resource in the queue. - - @method finish - @param {String} type resource type ('css' or 'js') - @private - */ - function finish(type) { - var p = pending[type], - callback, - urls; - - if (p) { - callback = p.callback; - urls = p.urls; - - urls.shift(); - pollCount = 0; - - // If this is the last of the pending URLs, execute the callback and - // start the next request in the queue (if any). - if (!urls.length) { - callback && callback.call(p.context, p.obj); - pending[type] = null; - queue[type].length && load(type); - } - } - } - - /** - Populates the env variable with user agent and feature test - information. - - @method getEnv - @private - */ - function getEnv() { - var ua = navigator.userAgent; - - env = { - // True if this browser supports disabling async mode on dynamically - // created script nodes. See - // http://wiki.whatwg.org/wiki/Dynamic_Script_Execution_Order - async: doc.createElement('script').async === true - }; - - (env.webkit = /AppleWebKit\//.test(ua)) - || (env.ie = /MSIE/.test(ua)) - || (env.opera = /Opera/.test(ua)) - || (env.gecko = /Gecko\//.test(ua)) - || (env.unknown = true); - } - - /** - Loads the specified resources, or the next resource of the specified type - in the queue if no resources are specified. If a resource of the specified - type is already being loaded, the new request will be queued until the - first request has been finished. - - When an array of resource URLs is specified, those URLs will be loaded in - parallel if it is possible to do so while preserving execution order. All - browsers support parallel loading of CSS, but only Firefox and Opera - support parallel loading of scripts. In other browsers, scripts will be - queued and loaded one at a time to ensure correct execution order. - - @method load - @param {String} type resource type ('css' or 'js') - @param {String|Array} urls (optional) URL or array of URLs to load - @param {Function} callback (optional) callback function to execute when the - resource is loaded - @param {Object} obj (optional) object to pass to the callback function - @param {Object} context (optional) if provided, the callback function will - be executed in this object's context - @private - */ - function load(type, urls, callback, obj, context) { - var _finish = function () { finish(type); }, - isCSS = type === 'css', - nodes = [], - i, len, node, p, pendingUrls, url; - - env || getEnv(); - - if (urls) { - // If urls is a string, wrap it in an array. Otherwise assume it's an - // array and create a copy of it so modifications won't be made to the - // original. - urls = typeof urls === 'string' ? [urls] : urls.concat(); - - // Create a request object for each URL. If multiple URLs are specified, - // the callback will only be executed after all URLs have been loaded. - // - // Sadly, Firefox and Opera are the only browsers capable of loading - // scripts in parallel while preserving execution order. In all other - // browsers, scripts must be loaded sequentially. - // - // All browsers respect CSS specificity based on the order of the link - // elements in the DOM, regardless of the order in which the stylesheets - // are actually downloaded. - if (isCSS || env.async || env.gecko || env.opera) { - // Load in parallel. - queue[type].push({ - urls : urls, - callback: callback, - obj : obj, - context : context - }); - } else { - // Load sequentially. - for (i = 0, len = urls.length; i < len; ++i) { - queue[type].push({ - urls : [urls[i]], - callback: i === len - 1 ? callback : null, // callback is only added to the last URL - obj : obj, - context : context - }); - } - } - } - - // If a previous load request of this type is currently in progress, we'll - // wait our turn. Otherwise, grab the next item in the queue. - if (pending[type] || !(p = pending[type] = queue[type].shift())) { - return; - } - - head || (head = doc.head || doc.getElementsByTagName('head')[0]); - pendingUrls = p.urls; - - for (i = 0, len = pendingUrls.length; i < len; ++i) { - url = pendingUrls[i]; - - if (isCSS) { - node = env.gecko ? createNode('style') : createNode('link', { - href: url, - rel : 'stylesheet' - }); - } else { - node = createNode('script', {src: url}); - node.async = false; - } - - node.className = 'lazyload'; - node.setAttribute('charset', 'utf-8'); - - if (env.ie && !isCSS) { - node.onreadystatechange = function () { - if (/loaded|complete/.test(node.readyState)) { - node.onreadystatechange = null; - _finish(); - } - }; - } else if (isCSS && (env.gecko || env.webkit)) { - // Gecko and WebKit don't support the onload event on link nodes. - if (env.webkit) { - // In WebKit, we can poll for changes to document.styleSheets to - // figure out when stylesheets have loaded. - p.urls[i] = node.href; // resolve relative URLs (or polling won't work) - pollWebKit(); - } else { - // In Gecko, we can import the requested URL into a - - -

                    Classes

                    -
                      -
                    • Utility: General utility methods.
                    • -
                    • Job: Job and processing handling.
                    • -
                    • Loader: PSR class loader.
                    • -
                    -

                    Utility Methods

                    -
                      -
                    • extend()
                    • -
                    • defaults()
                    • -
                    • pluralize()
                    • -
                    • singularize()
                    • -
                    • ordinalize()
                    • -
                    • hashify_file_name()
                    • -
                    • can_get_image()
                    • -
                    • ...
                    • -
                    -

                    Changelog

                    -

                    0.2.4

                    -
                      -
                    • Added Utility::hashify_file_name() method;
                    • -
                    • Added seperator options to Utility:;create_slug() to support things such as "::"
                    • -
                    -

                    Usage

                    -
                    // Extend an Array or Object with another for easily setting of defaults. This is similar to extend() but in reverse.
                    -$settings = UsabilityDynamics\Utility::defaults( $configurationObject, $defaultsObject );
                    -
                    -// Find composer.json file and return as Object.
                    -$composer = UsabilityDynamics\Utility::findUp( 'composer.json', __DIR__ );
                    -echo "Versio is {$composer->version}."
                    -

                    License

                    -

                    (The MIT License)

                    -

                    Copyright (c) 2013 Usability Dynamics, Inc. <info@usabilitydynamics.com>

                    -

                    Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions:

                    -

                    The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software.

                    -

                    THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

                    - - - diff --git a/vendor/udx/lib-utility/static/yuidoc.json b/vendor/udx/lib-utility/static/yuidoc.json deleted file mode 100644 index 5317288b6..000000000 --- a/vendor/udx/lib-utility/static/yuidoc.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "utility", - "version": "0.0.1", - "url": "https://github.com/udx/lib-utility/", - "logo": "http://a3d72a45d111006ec192-ec5b80a12b0b09b4d52373336afb4254.r80.cf1.rackcdn.com/usability-dynamics.png", - "options": { - "norecurse": false, - "no-code": false, - "extension": ".js,.php", - "tabtospace": 2, - "outdir": "./static/codex", - "paths": [ - "./lib", "./scripts" - ] - } -} \ No newline at end of file diff --git a/vendor/udx/lib-utility/test/fixtures/sample.json b/vendor/udx/lib-utility/test/fixtures/sample.json deleted file mode 100644 index b71323e7f..000000000 --- a/vendor/udx/lib-utility/test/fixtures/sample.json +++ /dev/null @@ -1,124 +0,0 @@ -{ - "anagrafica": { - "@version" : 1.1, - "testata": { - "nomemercato": { - "-id": "007", - "#text": "Mercato di test" - }, - "data": "Giovedi 18 dicembre 2003 16.05.29" - }, - "record": [ - { - "codice_cliente": "5", - "rag_soc": "Miami American Cafe", - "codice_fiscale": "IT07654930130", - "indirizzo": { - "-tipo": "casa", - "#text": "Viale Carlo Espinasse 5, Como" - }, - "num_prodotti": "13" - }, - { - "codice_cliente": "302", - "rag_soc": "Filiberto Gilardi", - "codice_fiscale": "IT87654770157", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Biancospini 20, Messina" - }, - "num_prodotti": "8" - }, - { - "codice_cliente": "1302", - "rag_soc": "Eidon", - "codice_fiscale": "IT887511231", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Bassini 17/2, Milano" - }, - "num_prodotti": "18" - }, - { - "codice_cliente": "202", - "rag_soc": "SkillNet", - "codice_fiscale": "IT887642131", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Chiasserini 11A, Milano" - }, - "num_prodotti": "24" - }, - { - "codice_cliente": "12", - "rag_soc": "Eidon", - "codice_fiscale": "IT04835710965", - "indirizzo": { - "-tipo": "casa", - "#text": "Via Cignoli 17/2, Roma" - }, - "num_prodotti": "1112" - }, - { - "codice_cliente": "5", - "rag_soc": "Miami American Cafe", - "codice_fiscale": "IT07654930130", - "indirizzo": { - "-tipo": "casa", - "#text": "Viale Carlo Espinasse 5, Como" - }, - "num_prodotti": "13" - }, - { - "codice_cliente": "302", - "rag_soc": "Filiberto Gilardi", - "codice_fiscale": "IT87654770157", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Biancospini 20, Messina" - }, - "num_prodotti": "8" - }, - { - "codice_cliente": "1302", - "rag_soc": "Eidon", - "codice_fiscale": "IT887511231", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Bassini 17/2, Milano" - }, - "num_prodotti": "18" - }, - { - "codice_cliente": "202", - "rag_soc": "SkillNet", - "codice_fiscale": "IT887642131", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Chiasserini 11A, Milano" - }, - "num_prodotti": "24" - }, - { - "codice_cliente": "202", - "rag_soc": "SkillNet", - "codice_fiscale": "IT887642131", - "indirizzo": { - "-tipo": "ufficio", - "#text": "Via Chiasserini 11A, Milano" - }, - "num_prodotti": "24" - }, - { - "codice_cliente": "12", - "rag_soc": "Eidon", - "codice_fiscale": "IT04835710965", - "indirizzo": { - "-tipo": "casa", - "#text": "Via Cignoli 17/2, Roma" - }, - "num_prodotti": "1112" - } - ] - } -} \ No newline at end of file diff --git a/vendor/udx/lib-utility/test/fixtures/sample.php b/vendor/udx/lib-utility/test/fixtures/sample.php deleted file mode 100644 index 249a1c596..000000000 --- a/vendor/udx/lib-utility/test/fixtures/sample.php +++ /dev/null @@ -1,14 +0,0 @@ - - - - 1.1 - - Mercato di test - Giovedi 18 dicembre 2003 16.05.29 - - - 5 - Miami American Cafe - IT07654930130 - Viale Carlo Espinasse 5, Como - 13 - - - 302 - Filiberto Gilardi - IT87654770157 - Via Biancospini 20, Messina - 8 - - - 1302 - Eidon - IT887511231 - Via Bassini 17/2, Milano - 18 - - - 202 - SkillNet - IT887642131 - Via Chiasserini 11A, Milano - 24 - - - 12 - Eidon - IT04835710965 - Via Cignoli 17/2, Roma - 1112 - - - 5 - Miami American Cafe - IT07654930130 - Viale Carlo Espinasse 5, Como - 13 - - - 302 - Filiberto Gilardi - IT87654770157 - Via Biancospini 20, Messina - 8 - - - 1302 - Eidon - IT887511231 - Via Bassini 17/2, Milano - 18 - - - 202 - SkillNet - IT887642131 - Via Chiasserini 11A, Milano - 24 - - - 202 - SkillNet - IT887642131 - Via Chiasserini 11A, Milano - 24 - - - 12 - Eidon - IT04835710965 - Via Cignoli 17/2, Roma - 1112 - - diff --git a/vendor/udx/lib-utility/test/js/basic.js b/vendor/udx/lib-utility/test/js/basic.js deleted file mode 100644 index dc66872f1..000000000 --- a/vendor/udx/lib-utility/test/js/basic.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Basic JavaScript Tests. - * - * @type {{Utility Basic Tests: {test-one: "test-one"}}} - */ -module.exports = { - - "Utility Tests": { - - "example-test": function() { - - } - - } - -}; \ No newline at end of file diff --git a/vendor/udx/lib-utility/test/php/basic-test.php b/vendor/udx/lib-utility/test/php/basic-test.php deleted file mode 100644 index ed4b44239..000000000 --- a/vendor/udx/lib-utility/test/php/basic-test.php +++ /dev/null @@ -1,58 +0,0 @@ - 10 - ); - - $defaultsSettings = array( - "someDefault" => 7 - ); - - $finalConfiguration = UsabilityDynamics\Utility::defaults( $myConfiguration, $defaultsSettings ); - - $this->assertEquals( 7, $finalConfiguration->someDefault ); - $this->assertEquals( 10, $finalConfiguration->someOther ); - - } - - /** - * Test Utility::findUp(); - * - */ - public function testFindUp() { - - // Traverse upward directory tree until fixtures/sample.json is found. - $sampleJSON = UsabilityDynamics\Utility::findUp( 'fixtures/sample.json' ); - - // Traverse upward directory tree until fixtures/sample.xml is found. - $sampleXML = UsabilityDynamics\Utility::findUp( 'fixtures/sample.xml' ); - - // Traverse upward directory tree until fixtures/sample.php is found. - UsabilityDynamics\Utility::findUp( 'fixtures/sample.php' ); - - // JSON Formatted properly. - $this->assertEquals( 1.1, $sampleJSON->anagrafica->{"@version"} ); - - // XML Formatted properly. - $this->assertEquals( 1.1, (string) $sampleXML->version ); - - // Custom class loaded. - $this->assertEquals( true, class_exists( 'MySampleClass' ) ); - - // Custom class method is accessible. - $this->assertEquals( true, method_exists( 'MySampleClass', 'test_method' ) ); - - } - -} diff --git a/vendor/udx/lib-wp-bootstrap/changes.md b/vendor/udx/lib-wp-bootstrap/changes.md index 40b309617..5b8d6d10b 100644 --- a/vendor/udx/lib-wp-bootstrap/changes.md +++ b/vendor/udx/lib-wp-bootstrap/changes.md @@ -1,3 +1,7 @@ +### 1.3.1 + +* Remove dependency from `udx/lib-utility`. + ### 1.2.2 * Fixed `path` utility function: detecting if dir belongs to plugins directory by `WP_PLUGIN_DIR`, but not only by deprecated `PLUGINDIR`. \ No newline at end of file diff --git a/vendor/udx/lib-wp-bootstrap/composer.json b/vendor/udx/lib-wp-bootstrap/composer.json index 3d77eb3b7..9886f0f3e 100755 --- a/vendor/udx/lib-wp-bootstrap/composer.json +++ b/vendor/udx/lib-wp-bootstrap/composer.json @@ -8,8 +8,7 @@ "minimum-stability": "dev", "license": "MIT", "require": { - "php": ">=5.3", - "udx/lib-utility": "~0.3" + "php": ">=5.3" }, "autoload": { "classmap": [ "lib/classes" ] diff --git a/vendor/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php b/vendor/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php index 00f747540..f395058df 100644 --- a/vendor/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php +++ b/vendor/udx/lib-wp-bootstrap/lib/classes/class-bootstrap.php @@ -148,7 +148,7 @@ public function get( $key = null, $default = null ) { public function get_schema( $key = '' ) { if( $this->schema === null ) { if( !empty( $this->schema_path ) && file_exists( $this->schema_path ) ) { - $this->schema = (array)\UsabilityDynamics\Utility::l10n_localize( json_decode( file_get_contents( $this->schema_path ), true ), (array)$this->get_localization() ); + $this->schema = (array)Utility::l10n_localize( json_decode( file_get_contents( $this->schema_path ), true ), (array)$this->get_localization() ); } } //** Break if composer.json does not exist */ diff --git a/vendor/udx/lib-wp-bootstrap/lib/classes/class-utility.php b/vendor/udx/lib-wp-bootstrap/lib/classes/class-utility.php index 2a28eb12b..71fba229f 100644 --- a/vendor/udx/lib-wp-bootstrap/lib/classes/class-utility.php +++ b/vendor/udx/lib-wp-bootstrap/lib/classes/class-utility.php @@ -101,6 +101,58 @@ static private function _path_dir( $instance ) { return $path; } + /** + * Localization Functionality. + * + * Replaces array's l10n data. + * Helpful for localization of data which is stored in JSON files ( see /schemas ) + * + * Usage: + * + * add_filter( 'ud::schema::localization', function($locals){ + * return array_merge( array( 'value_for_translating' => __( 'Blah Blah' ) ), $locals ); + * }); + * + * $result = self::l10n_localize (array( + * 'key' => 'l10n.value_for_translating' + * ) ); + * + * + * @param array $data + * @param array $l10n translated values + * @return array + * @author peshkov@UD + */ + static public function l10n_localize( $data, $l10n = array() ) { + + if ( !is_array( $data ) && !is_object( $data ) ) { + return $data; + } + + //** The Localization's list. */ + $l10n = apply_filters( 'ud::schema::localization', $l10n ); + + //** Replace l10n entries */ + foreach( $data as $k => $v ) { + if ( is_array( $v ) ) { + $data[ $k ] = self::l10n_localize( $v, $l10n ); + } elseif ( is_string( $v ) ) { + if ( strpos( $v, 'l10n' ) !== false ) { + preg_match_all( '/l10n\.([^\s]*)/', $v, $matches ); + if ( !empty( $matches[ 1 ] ) ) { + foreach ( $matches[ 1 ] as $i => $m ) { + if ( array_key_exists( $m, $l10n ) ) { + $data[ $k ] = str_replace( $matches[ 0 ][ $i ], $l10n[ $m ], $data[ $k ] ); + } + } + } + } + } + } + + return $data; + } + } } diff --git a/wp-stateless-media.php b/wp-stateless-media.php index 13c59f839..16b1d1658 100644 --- a/wp-stateless-media.php +++ b/wp-stateless-media.php @@ -4,7 +4,7 @@ * Plugin URI: https://stateless.udx.io/ * Description: Upload and serve your WordPress media files from Google Cloud Storage. * Author: UDX - * Version: 3.3.0 + * Version: 4.1.0 * Text Domain: stateless-media * Author URI: https://www.udx.io * From 4dab62272d44004beda0537e3b652378b6f37306 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 29 Dec 2023 18:33:34 +0200 Subject: [PATCH 03/16] Refactor page to remove Angular dependency --- changelog.txt | 5 +- lib/classes/class-addons.php | 2 +- lib/classes/class-bootstrap.php | 1 - lib/classes/class-compatibility.php | 2 +- lib/classes/class-module.php | 21 + lib/classes/class-settings.php | 119 +++--- lib/classes/compatibility/buddyboss.php | 1 + lib/classes/compatibility/buddypress.php | 1 + lib/classes/compatibility/divi.php | 1 + .../compatibility/easy-digital-downloads.php | 1 + lib/classes/compatibility/elementor.php | 1 + lib/classes/compatibility/ewww.php | 1 + .../compatibility/gravity-forms-signature.php | 1 + lib/classes/compatibility/gravity-forms.php | 1 + lib/classes/compatibility/imagify.php | 1 + lib/classes/compatibility/learn-dash.php | 1 + .../compatibility/lite-speed-cache.php | 1 + lib/classes/compatibility/polylang-pro.php | 1 + lib/classes/compatibility/shortpixel.php | 1 + .../compatibility/simple-local-avatars.php | 1 + lib/classes/compatibility/siteorigin-css.php | 1 + .../siteorigin-widget-bundle.php | 1 + .../compatibility/the-events-calendar.php | 1 + .../woo-extra-product-options.php | 1 + lib/classes/compatibility/woocommerce.php | 1 + lib/classes/compatibility/wp-smush.php | 1 + .../compatibility/wpbakery-page-builder.php | 1 + lib/classes/compatibility/wpforms.php | 1 + static/scripts/wp-stateless.js | 373 +++++++++++------- static/views/compatibility-tab.php | 69 ++++ static/views/settings-sections/file-url.php | 119 ++++++ static/views/settings-sections/general.php | 104 +++++ .../google-cloud-storage.php | 74 ++++ static/views/settings-sections/network.php | 37 ++ static/views/settings-tab.php | 21 + static/views/settings_interface.php | 294 +------------- 36 files changed, 790 insertions(+), 473 deletions(-) create mode 100644 static/views/compatibility-tab.php create mode 100644 static/views/settings-sections/file-url.php create mode 100644 static/views/settings-sections/general.php create mode 100644 static/views/settings-sections/google-cloud-storage.php create mode 100644 static/views/settings-sections/network.php create mode 100644 static/views/settings-tab.php diff --git a/changelog.txt b/changelog.txt index 0ffee5af6..b7513409d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,8 @@ == Changelog == = 4.1.0 = -* ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons -* ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons +* ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons. +* ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons. +* ENHANCEMENT - refactor `Settings` admin page to remove Angular dependency. = 3.3.0 = * NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions. diff --git a/lib/classes/class-addons.php b/lib/classes/class-addons.php index 619e113b2..c6c3285f1 100644 --- a/lib/classes/class-addons.php +++ b/lib/classes/class-addons.php @@ -45,7 +45,7 @@ protected function __construct() { add_action('sm::module::init', array($this, 'check_addons')); add_action('sm::module::messages', array($this, 'show_messages'), 10, 3); - add_action('wp_stateless_addons_tab_content', array($this, 'tab_content'), 10, 1); + add_action('wp_stateless_addons_tab_content', array($this, 'tab_content')); add_filter('wp_stateless_addons_tab_visible', array($this, 'addons_tab_visible'), 10, 1); } diff --git a/lib/classes/class-bootstrap.php b/lib/classes/class-bootstrap.php index 198ed7f33..a2dc638fd 100644 --- a/lib/classes/class-bootstrap.php +++ b/lib/classes/class-bootstrap.php @@ -1229,7 +1229,6 @@ public function admin_init() { $settings['key_json'] = "Currently configured via a constant."; } wp_localize_script('wp-stateless', 'wp_stateless_settings', $settings); - wp_localize_script('wp-stateless', 'wp_stateless_compatibility', Module::get_modules()); } /** diff --git a/lib/classes/class-compatibility.php b/lib/classes/class-compatibility.php index 530f351d3..fef3c6738 100644 --- a/lib/classes/class-compatibility.php +++ b/lib/classes/class-compatibility.php @@ -25,7 +25,7 @@ abstract class Compatibility { * ['WP_STATELESS_MEDIA_ON_FLY' => 'WP_STATELESS_DYNAMIC_IMAGE_SUPPORT'] */ protected $constant = ''; - protected $enabled = false; + protected $enabled = true; protected $description = ''; protected $plugin_file = null; protected $theme_name = null; diff --git a/lib/classes/class-module.php b/lib/classes/class-module.php index ad0537b52..6cde2ddf7 100644 --- a/lib/classes/class-module.php +++ b/lib/classes/class-module.php @@ -22,6 +22,8 @@ class Module { */ public function __construct() { add_action('admin_init', array($this, 'save_modules'), 1); + add_filter('wp_stateless_compatibility_tab_visible', array($this, 'compatibility_tab_visible'), 10, 1); + add_action('wp_stateless_compatibility_tab_content', array($this, 'tab_content')); /** * Support for BuddyBoss @@ -185,5 +187,24 @@ public function save_modules() { wp_redirect($_POST['_wp_http_referer']); } } + + /** + * Check if 'Compatibility' tab should be visible. + */ + public function compatibility_tab_visible($visible) { + return !empty(self::$modules); + } + + /** + * Outputs 'Compatibility' tab content on the settings page. + * + */ + public function tab_content() { + $modules = Helper::array_of_objects( self::get_modules() ); + + include ud_get_stateless_media()->path('static/views/compatibility-tab.php', 'dir'); + } + } + } \ No newline at end of file diff --git a/lib/classes/class-settings.php b/lib/classes/class-settings.php index 74c6ee9f8..c7ecb0b55 100644 --- a/lib/classes/class-settings.php +++ b/lib/classes/class-settings.php @@ -93,6 +93,8 @@ public function __construct($bootstrap = null) { // Parse root dir by wildcards add_filter( 'wp_stateless_unhandle_root_dir', array( $this, 'parse_root_dir_wildcards' ), 10, 3); + add_action('wp_stateless_settings_tab_content', array($this, 'tab_content')); + $site_url = parse_url( site_url() ); $site_url['path'] = isset($site_url['path']) ? $site_url['path'] : ''; $this->wildcards = array( @@ -441,56 +443,6 @@ public function network_admin_menu($slug) { * Draw interface */ public function settings_interface() { - $wildcards = apply_filters('wp_stateless_root_dir_wildcard', $this->wildcards); - $wildcard_year_month = '%date_year/date_month%'; - $root_dir = $this->get( 'sm.root_dir' ); - - $use_year_month = (strpos($root_dir, $wildcard_year_month) !== false) ?: false; - - /** - * removing year/month wildcard - */ - if ($use_year_month) { - $root_dir = str_replace($wildcard_year_month, '%YM%', $root_dir); - } - - /** - * preparing array with wildcards - */ - $root_dir_values = explode('/', $root_dir); - - /** - * adding year/month wildcard - */ - if ($use_year_month) { - if ( !empty($root_dir_values) ) { - foreach( $root_dir_values as $k=>$root_dir_value ) { - if ( $root_dir_value == '%YM%' ) { - $root_dir_values[$k] = $wildcard_year_month; - } - } - } else { - $root_dir_values[] = $wildcard_year_month; - } - } - - /** - * first slash - */ - array_unshift($root_dir_values , '/'); - - /** - * removing empty values - */ - $root_dir_values = array_filter($root_dir_values); - - /** - * merging user's wildcards with default values - */ - if (!empty($root_dir_values)) { - $wildcards = array_unique( array_merge($root_dir_values, array_keys($wildcards)) ); - } - $tab = isset($_GET['tab']) && !empty($_GET['tab']) ? $_GET['tab'] : 'stless_settings_tab'; include $this->bootstrap->path( '/static/views/settings_interface.php', 'dir' ); @@ -591,6 +543,73 @@ public function set( $key = '', $value = false, $bypass_validation = false ) { return parent::set( $key, $value, $bypass_validation ); } + /** + * Outputs 'Compatibility' tab content on the settings page. + * + */ + public function tab_content() { + $wildcards = apply_filters('wp_stateless_root_dir_wildcard', $this->wildcards); + $wildcard_year_month = '%date_year/date_month%'; + $root_dir = $this->get( 'sm.root_dir' ); + + $use_year_month = (strpos($root_dir, $wildcard_year_month) !== false) ?: false; + + /** + * removing year/month wildcard + */ + if ($use_year_month) { + $root_dir = str_replace($wildcard_year_month, '%YM%', $root_dir); + } + + /** + * preparing array with wildcards + */ + $root_dir_values = explode('/', $root_dir); + + /** + * adding year/month wildcard + */ + if ($use_year_month) { + if ( !empty($root_dir_values) ) { + foreach( $root_dir_values as $k=>$root_dir_value ) { + if ( $root_dir_value == '%YM%' ) { + $root_dir_values[$k] = $wildcard_year_month; + } + } + } else { + $root_dir_values[] = $wildcard_year_month; + } + } + + /** + * first slash + */ + array_unshift($root_dir_values , '/'); + + /** + * removing empty values + */ + $root_dir_values = array_filter($root_dir_values); + + foreach ($root_dir_values as $k => $v) { + $root_dir_values[$k] = trim($v); + } + + /** + * merging user's wildcards with default values + */ + $wildcards = array_keys($wildcards); + + if (!empty($root_dir_values)) { + $wildcards = array_unique( array_merge($root_dir_values, $wildcards) ); + } + + $sm = (object)$this->get('sm'); + + include ud_get_stateless_media()->path('static/views/settings-tab.php', 'dir'); + } + + } } diff --git a/lib/classes/compatibility/buddyboss.php b/lib/classes/compatibility/buddyboss.php index 53cdb217d..d0f55df07 100644 --- a/lib/classes/compatibility/buddyboss.php +++ b/lib/classes/compatibility/buddyboss.php @@ -18,6 +18,7 @@ class BuddyBoss extends Compatibility { protected $description = 'Ensures compatibility with BuddyBoss.'; protected $plugin_file = [ 'buddyboss-platform/bp-loader.php' ]; protected $sm_mode_not_supported = [ 'stateless' ]; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/buddypress.php b/lib/classes/compatibility/buddypress.php index f92223b57..15eca610e 100644 --- a/lib/classes/compatibility/buddypress.php +++ b/lib/classes/compatibility/buddypress.php @@ -19,6 +19,7 @@ class BuddyPress extends Compatibility { protected $description = 'Ensures compatibility with BuddyPress.'; protected $plugin_file = ['buddypress/bp-loader.php']; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/divi.php b/lib/classes/compatibility/divi.php index 874a76529..2cf62d0d2 100644 --- a/lib/classes/compatibility/divi.php +++ b/lib/classes/compatibility/divi.php @@ -18,6 +18,7 @@ class Divi extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_DIVI'; protected $description = 'Ensures compatibility with Divi theme.'; protected $theme_name = 'Divi'; + protected $enabled = false; /** * Cache Busting call stack conditions to disable. diff --git a/lib/classes/compatibility/easy-digital-downloads.php b/lib/classes/compatibility/easy-digital-downloads.php index cf9f2ed14..dca31efb1 100644 --- a/lib/classes/compatibility/easy-digital-downloads.php +++ b/lib/classes/compatibility/easy-digital-downloads.php @@ -21,6 +21,7 @@ class EDDDownloadMethod extends Compatibility { protected $description = 'Ensures compatibility with the forced download method and WP-Stateless.'; protected $plugin_file = 'easy-digital-downloads/easy-digital-downloads.php'; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/elementor.php b/lib/classes/compatibility/elementor.php index 199c8cbb0..4a02eb778 100644 --- a/lib/classes/compatibility/elementor.php +++ b/lib/classes/compatibility/elementor.php @@ -21,6 +21,7 @@ class Elementor extends Compatibility { protected $description = 'Ensures compatibility with Elementor Page Builder. Sync css files generated by Elementor.'; protected $plugin_file = 'elementor/elementor.php'; protected $non_library_sync = true; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/ewww.php b/lib/classes/compatibility/ewww.php index 1fd64f142..6c5b1b223 100644 --- a/lib/classes/compatibility/ewww.php +++ b/lib/classes/compatibility/ewww.php @@ -19,6 +19,7 @@ class EWWW extends Compatibility { protected $description = 'Enables limited support for EWWW Image Optimizer in CDN mode.'; protected $plugin_file = [ 'ewww-image-optimizer/ewww-image-optimizer.php' ]; protected $sm_mode_not_supported = [ 'stateless' ]; + protected $enabled = false; public function module_init( $sm ) { // add_filter( 'ewww_image_optimizer_pre_optimization', array($this, 'pre_optimization'), 10, 3 ); diff --git a/lib/classes/compatibility/gravity-forms-signature.php b/lib/classes/compatibility/gravity-forms-signature.php index c4fa14819..4934d5a80 100644 --- a/lib/classes/compatibility/gravity-forms-signature.php +++ b/lib/classes/compatibility/gravity-forms-signature.php @@ -19,6 +19,7 @@ class GravityFormSignature extends Compatibility { protected $description = 'Enables support for signature images generated by the signature add-on for Gravity Forms.'; protected $plugin_file = 'gravityformssignature/signature.php'; protected $plugin_version; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/gravity-forms.php b/lib/classes/compatibility/gravity-forms.php index 9b87829c8..179a87df9 100644 --- a/lib/classes/compatibility/gravity-forms.php +++ b/lib/classes/compatibility/gravity-forms.php @@ -21,6 +21,7 @@ class GravityForm extends Compatibility { protected $plugin_file = 'gravityforms/gravityforms.php'; protected $plugin_version; protected $non_library_sync = true; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/imagify.php b/lib/classes/compatibility/imagify.php index f3eb56f26..8cc9b3425 100644 --- a/lib/classes/compatibility/imagify.php +++ b/lib/classes/compatibility/imagify.php @@ -21,6 +21,7 @@ class Imagify extends Compatibility { protected $description = 'Enables support for these Imagify Image Optimizer features: auto-optimize images on upload, bulk optimizer, resize larger images, optimization levels (normal, aggressive, ultra).'; protected $plugin_file = ['imagify/imagify.php', 'imagify-plugin/imagify.php']; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; public function module_init($sm) { // Skip sync on upload when attachment is image, sync will be handled after image is optimized. diff --git a/lib/classes/compatibility/learn-dash.php b/lib/classes/compatibility/learn-dash.php index 1ac87b4da..c4a5c169c 100644 --- a/lib/classes/compatibility/learn-dash.php +++ b/lib/classes/compatibility/learn-dash.php @@ -18,6 +18,7 @@ class LearnDash extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_LEARNDASH_LMS'; protected $description = 'Ensures compatibility with LearnDash.'; protected $plugin_file = ['sfwd-lms/sfwd_lms.php']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/lite-speed-cache.php b/lib/classes/compatibility/lite-speed-cache.php index f979d2e0d..886d6f78f 100644 --- a/lib/classes/compatibility/lite-speed-cache.php +++ b/lib/classes/compatibility/lite-speed-cache.php @@ -23,6 +23,7 @@ class LSCacheWP extends Compatibility { protected $description = 'Ensures compatibility with LiteSpeed Cache plugins.'; protected $plugin_file = 'litespeed-cache/litespeed-cache.php'; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/polylang-pro.php b/lib/classes/compatibility/polylang-pro.php index 968589cc6..23c3ddb1f 100644 --- a/lib/classes/compatibility/polylang-pro.php +++ b/lib/classes/compatibility/polylang-pro.php @@ -19,6 +19,7 @@ class Polylang extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_POLYLANG_PRO'; protected $description = 'Ensures compatibility with Polylang Pro.'; protected $plugin_file = ['polylang-pro/polylang.php']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/shortpixel.php b/lib/classes/compatibility/shortpixel.php index eaf401948..4bc4e903f 100644 --- a/lib/classes/compatibility/shortpixel.php +++ b/lib/classes/compatibility/shortpixel.php @@ -27,6 +27,7 @@ class ShortPixel extends Compatibility { protected $description = 'Ensures compatibility with ShortPixel Image Optimizer.'; protected $plugin_file = 'shortpixel-image-optimiser/wp-shortpixel.php'; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/simple-local-avatars.php b/lib/classes/compatibility/simple-local-avatars.php index f21f2e568..97f20f5a9 100644 --- a/lib/classes/compatibility/simple-local-avatars.php +++ b/lib/classes/compatibility/simple-local-avatars.php @@ -22,6 +22,7 @@ class SimpleLocalAvatars extends Compatibility { protected $description = 'Ensures compatibility with Simple Local Avatars plugin.'; protected $plugin_file = 'simple-local-avatars/simple-local-avatars.php'; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; /** * Initialize compatibility module diff --git a/lib/classes/compatibility/siteorigin-css.php b/lib/classes/compatibility/siteorigin-css.php index 9281406ce..c4d465be4 100644 --- a/lib/classes/compatibility/siteorigin-css.php +++ b/lib/classes/compatibility/siteorigin-css.php @@ -19,6 +19,7 @@ class SOCSS extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_SOCSS'; protected $description = 'Ensures compatibility with CSS files generated by SiteOrigin.'; protected $plugin_file = 'so-css/so-css.php'; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/siteorigin-widget-bundle.php b/lib/classes/compatibility/siteorigin-widget-bundle.php index 7b9f0331a..50266d18b 100644 --- a/lib/classes/compatibility/siteorigin-widget-bundle.php +++ b/lib/classes/compatibility/siteorigin-widget-bundle.php @@ -19,6 +19,7 @@ class SOWidgetCSS extends Compatibility { protected $description = 'Enabled support for CSS files generated by SiteOrigin Widgets Bundle.'; protected $plugin_file = 'so-widgets-bundle/so-widgets-bundle.php'; protected $non_library_sync = true; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/the-events-calendar.php b/lib/classes/compatibility/the-events-calendar.php index 995b568b8..dd19492ca 100644 --- a/lib/classes/compatibility/the-events-calendar.php +++ b/lib/classes/compatibility/the-events-calendar.php @@ -19,6 +19,7 @@ class TheEventsCalendar extends Compatibility { protected $description = 'Ensures compatibility with TheEventsCalendar.'; protected $plugin_file = [ 'the-events-calendar/the-events-calendar.php' ]; protected $sm_mode_not_supported = [ ]; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/woo-extra-product-options.php b/lib/classes/compatibility/woo-extra-product-options.php index e30fe9c74..0e7729465 100644 --- a/lib/classes/compatibility/woo-extra-product-options.php +++ b/lib/classes/compatibility/woo-extra-product-options.php @@ -19,6 +19,7 @@ class CompatibilityWooExtraProductOptions extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_WOO_EXTRA_PRODUCT_OPTION'; protected $description = 'Ensures compatibility with WooCommerce Extra Product Options.'; protected $plugin_file = 'woocommerce-tm-extra-product-options/tm-woo-extra-product-options.php'; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/woocommerce.php b/lib/classes/compatibility/woocommerce.php index ed5909389..589a81357 100644 --- a/lib/classes/compatibility/woocommerce.php +++ b/lib/classes/compatibility/woocommerce.php @@ -18,6 +18,7 @@ class WooCommerce extends Compatibility { protected $description = 'Ensures compatibility with WooCommerce.'; protected $plugin_file = [ 'woocommerce/woocommerce.php' ]; protected $sm_mode_not_supported = [ 'stateless' ]; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/wp-smush.php b/lib/classes/compatibility/wp-smush.php index c3536645a..69bd89443 100644 --- a/lib/classes/compatibility/wp-smush.php +++ b/lib/classes/compatibility/wp-smush.php @@ -19,6 +19,7 @@ class WPSmush extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_WPSMUSH'; protected $description = 'Ensures compatibility with WP Smush.'; protected $plugin_file = ['wp-smushit/wp-smush.php', 'wp-smush-pro/wp-smush.php', 'wp-smushit-pro/wp-smush-pro.php']; + protected $enabled = false; /** * @param $sm diff --git a/lib/classes/compatibility/wpbakery-page-builder.php b/lib/classes/compatibility/wpbakery-page-builder.php index fd6972b5e..1944d7242 100644 --- a/lib/classes/compatibility/wpbakery-page-builder.php +++ b/lib/classes/compatibility/wpbakery-page-builder.php @@ -19,6 +19,7 @@ class WPBakeryPageBuilder extends Compatibility { protected $description = 'Enables support for these WPBakery Page Builder features: single image element.'; protected $plugin_file = 'js_composer/js_composer.php'; protected $sm_mode_not_supported = ['stateless']; + protected $enabled = false; public function __construct() { parent::__construct(); diff --git a/lib/classes/compatibility/wpforms.php b/lib/classes/compatibility/wpforms.php index f557c5ef2..cf4b5264b 100644 --- a/lib/classes/compatibility/wpforms.php +++ b/lib/classes/compatibility/wpforms.php @@ -18,6 +18,7 @@ class WPForms extends Compatibility { protected $constant = 'WP_STATELESS_COMPATIBILITY_WPFORMS'; protected $description = 'Ensures compatibility with WPForms.'; protected $plugin_file = ['wpforms-lite/wpforms.php', 'wpforms/wpforms.php']; + protected $enabled = false; public function module_init($sm) { // exclude randomize_filename from wpforms page diff --git a/static/scripts/wp-stateless.js b/static/scripts/wp-stateless.js index 0a9e8cf4c..07ebd79d2 100644 --- a/static/scripts/wp-stateless.js +++ b/static/scripts/wp-stateless.js @@ -107,53 +107,134 @@ function replace_wildcard_to_the_end(wildcards, remove_slashes = false) { } // Application -var wpStatelessApp = angular - .module('wpStatelessApp', ['ngSanitize']) +var wpStatelessSettingsApp = { + sm: {}, + backup: {}, + is_ssl: false, + + // Show notices for readonly fields + showNotice: function (field) { + if (this.sm.readonly && this.sm.readonly[field]) { + var slug = this.sm.readonly[field] + + jQuery(`#notice-${field}`).html(this.sm.strings[slug]) + jQuery(`[name="sm[${field}]"]`).prop('disabled', true) + } else { + jQuery(`#notice-${field}`).html('') + jQuery(`[name="sm[${field}]"]`).prop('disabled', false) + } + }, - // Controllers - .controller('wpStatelessSettings', function ($scope, $filter) { - $scope.backup = {} - $scope.sm = wp_stateless_settings || {} - $scope.sm.readonly = $scope.sm.readonly || {} - - if ($scope.sm.network_admin) { - $scope.sm.hashify_file_name = 'true' - $scope.sm.readonly.hashify_file_name = true + showSupportedTypes: function () { + value = jQuery('#sm_body_rewrite').val() + + if ( ['true', 'enable_editor', 'enable_meta'].indexOf(value) > -1 ) { + jQuery('.supported-file-types').show() + } else { + jQuery('.supported-file-types').hide() } + }, - $scope.$watch('sm.mode', function (value) { - if ( - (value == 'stateless' || value == 'ephemeral') && - $scope.sm.readonly.hashify_file_name != 'constant' - ) { - $scope.backup.hashify_file_name = $scope.sm.hashify_file_name - $scope.sm.hashify_file_name = 'true' - // $scope.apply(); - } else { - if ($scope.backup.hashify_file_name) { - $scope.sm.hashify_file_name = $scope.backup.hashify_file_name - // $scope.apply(); - } - } + setIsSSL: function () { + this.is_ssl = jQuery('#custom_domain').val().indexOf('https://') === 0 - if (value == 'stateless' && $scope.sm.readonly.hashify_file_name != 'constant' ) { - $scope.backup.dynamic_image_support = $scope.sm.dynamic_image_support - $scope.sm.dynamic_image_support = 'false' - } else { - if ($scope.backup.dynamic_image_support) { - $scope.sm.dynamic_image_support = $scope.backup.dynamic_image_support - } - } - }) + if (this.is_ssl) { + jQuery('.notice-is-ssl').show() + } else { + jQuery('.notice-is-ssl').hide() + } + }, + + getRadioValue: function(name) { + return jQuery(`input[name="${name}"]:checked`).val() + }, + + enableHashifyFileName: function () { + var mode = this.getRadioValue('sm[mode]') + + if ( ['stateless', 'ephemeral'].indexOf(mode) > -1 + && this.sm.readonly['hashify_file_name'] != 'constant' ) { + this.backup['hashify_file_name'] = jQuery('#cache_busting').val() + jQuery('#cache_busting').val('true') + } else if ( this.backup['hashify_file_name'] ) { + jQuery('#cache_busting').val( this.backup['hashify_file_name'] ) + } + + if (mode == 'stateless') { + jQuery('#cache_busting').prop('disabled', true) + } else { + this.showNotice('hashify_file_name') + } + + if (mode == 'stateless' && this.sm.readonly['hashify_file_name'] != 'constant') { + jQuery('#notice-hashify_file_name-mode').show() + } else { + jQuery('#notice-hashify_file_name-mode').hide() + } + }, + + enableDynamicImageSupport: function () { + var mode = this.getRadioValue('sm[mode]') + + if ( mode == 'stateless' && this.sm.readonly['dynamic_image_support'] != 'constant' ) { + this.backup['dynamic_image_support'] = jQuery('#dynamic_image_support').val() + jQuery('#dynamic_image_support').val('false') + } else if ( this.backup['dynamic_image_support'] ) { + jQuery('#dynamic_image_support').val( this.backup['dynamic_image_support'] ) + } + + if (mode == 'stateless') { + jQuery('#dynamic_image_support').prop('disabled', true) + } else { + this.showNotice('dynamic_image_support') + } + + if (mode == 'stateless' && this.sm.readonly['dynamic_image_support'] != 'constant') { + jQuery('#notice-dynamic_image_support-mode').show() + } else { + jQuery('#notice-dynamic_image_support-mode').hide() + } + }, + + switchBucketFolderType: function() { + var value = jQuery('#sm_root_dir').val() + var folderType = jQuery('#sm_bucket_folder_type').val() + + switch (value) { + case '%date_year/date_month%': + folderType = 'single-site' + break; + case 'sites/%site_id%/%date_year/date_month%': + folderType = 'multi-site' + break; + case '': + if ( this.sm.network_admin ) + folderType = '' + break; + default: + folderType = 'custom' + } - $scope.$watch('sm.bucket_folder_type', function (value) { - if (value == 'single-site') { + if ( jQuery('#sm_bucket_folder_type').val() != folderType ) { + jQuery('#sm_bucket_folder_type').val( folderType) + } + + setTimeout(function () { + jQuery('#permalink_structure').trigger('change') + }, 1) + }, + + switchRootDir: function() { + var value = jQuery('#sm_bucket_folder_type').val() + + switch (value) { + case 'single-site': replace_wildcard_to_the_end(['/', '%date_year/date_month%', '/'], true) $wildcards_select .val(['/', '%date_year/date_month%', '/']) .trigger('change') - } else if (value == 'multi-site') { - //changins wildcards position + break; + case 'multi-site': replace_wildcard_to_the_end( ['/', 'sites', '/', '%site_id%', '/', '%date_year/date_month%', '/'], true @@ -169,115 +250,141 @@ var wpStatelessApp = angular '/', ]) .trigger('change') - } else if (value == '' && $scope.sm.network_admin) { - $wildcards_select.val(null).trigger('change') - } - prepare_preview_url() - }) + break; + case '': + if ( wp_stateless_settings.network_admin ) { + $wildcards_select.val(null).trigger('change') + } + break; + } - $scope.$watch('sm.root_dir', function (value) { - if (value == '%date_year/date_month%') { - $scope.sm.bucket_folder_type = 'single-site' - } else if (value == 'sites/%site_id%/%date_year/date_month%') { - $scope.sm.bucket_folder_type = 'multi-site' - } else if (value == '' && $scope.sm.network_admin) { - $scope.sm.bucket_folder_type = '' - } else { - $scope.sm.bucket_folder_type = 'custom' - } + prepare_preview_url() + }, - setTimeout(function () { - jQuery('#permalink_structure').trigger('change') - }, 1) + generatePreviewUrl: function() { + var host = 'https://storage.googleapis.com/' + var hash = + jQuery('#cache_busting').val() == 'true' + ? Date.now().toString(36) + '-' + : '' + var custom_domain = jQuery('#custom_domain').val().toString() + var root_dir = jQuery('#sm_root_dir').val().toString() + var bucket = jQuery('#bucket_name').val().toString() + + jQuery.each(this.sm.wildcards, function (index, item) { + var reg = new RegExp(index, 'g') + root_dir = root_dir.replace(reg, item[0]) }) + + var tags = [ + '%date_year%', + '%date_month%', + '%site_id%', + '%site_url%', + '%site_url_host%', + '%site_url_path%', + ] + + var value_splitted = root_dir.split('/') - var readonlyTag = $scope.sm.readonly.root_dir || false - if (readonlyTag) { - jQuery('.available-structure-tags .button') - .off('click') - .css('opacity', '.5') + for (var i = 0; i < value_splitted.length; i++) { + if ( + !/^[a-zA-Z0-9_\-.]+$/.test(value_splitted[i]) && + value_splitted[i] != '' && + jQuery.inArray(value_splitted[i], tags) == -1 + ) { + value_splitted[i] = value_splitted[i].replace(/[^a-zA-Z0-9_\-.]/g, '') + } } - $scope.tagClicked = function () { - if (readonlyTag) return false - $scope.sm.bucket_folder_type = 'custom' - setTimeout(function () { - jQuery('#permalink_structure').trigger('change') - }, 1) + + root_dir = value_splitted.join('/') + root_dir = root_dir.replace(/(\/+)/g, '/') + root_dir = root_dir.replace(/^\//, '') + root_dir = root_dir.replace(/\/$/, '') + + if (root_dir) { + root_dir = root_dir + '/' } - $scope.sm.showNotice = function (option) { - if ($scope.sm.readonly && $scope.sm.readonly[option]) { - var slug = $scope.sm.readonly[option] - return $scope.sm.strings[slug] - } + custom_domain = custom_domain.replace(/\/+$/, '') // removing trailing slashes + custom_domain = custom_domain.replace(/https?:\/\//, '') // removing http:// or https:// from the beginning. + host += bucket.length > 0 ? bucket : '{bucket-name}' + + if ( + custom_domain !== 'storage.googleapis.com' && + bucket.length > 0 && + custom_domain.length > 0 && + (this.is_ssl || custom_domain == bucket) + ) { + host = this.is_ssl ? 'https://' : 'http://' // bucket name will be host + host += custom_domain } - $scope.sm.generatePreviewUrl = function () { - $scope.sm.is_custom_domain = false - var host = 'https://storage.googleapis.com/' - var hash = - $scope.sm.hashify_file_name == 'true' - ? Date.now().toString(36) + '-' - : '' - var is_ssl = $scope.sm.custom_domain.indexOf('https://') - var custom_domain = $scope.sm.custom_domain.toString() - var root_dir = $scope.sm.root_dir ? $scope.sm.root_dir : '' - - jQuery.each($scope.sm.wildcards, function (index, item) { - var reg = new RegExp(index, 'g') - root_dir = root_dir.replace(reg, item[0]) - }) - let tags = [ - '%date_year%', - '%date_month%', - '%site_id%', - '%site_url%', - '%site_url_host%', - '%site_url_path%', - ] - let value_splitted = root_dir.split('/') - for (let i = 0; i < value_splitted.length; i++) { - if ( - !/^[a-zA-Z0-9_\-.]+$/.test(value_splitted[i]) && - value_splitted[i] != '' && - jQuery.inArray(value_splitted[i], tags) == -1 - ) { - value_splitted[i] = value_splitted[i].replace(/[^a-zA-Z0-9_\-.]/g, '') - } - } - root_dir = value_splitted.join('/') - root_dir = root_dir.replace(/(\/+)/g, '/') - root_dir = root_dir.replace(/^\//, '') - root_dir = root_dir.replace(/\/$/, '') - if (root_dir) { - root_dir = root_dir + '/' - } + host += '/' + root_dir + hash + 'your-image-name.jpeg' - custom_domain = custom_domain.replace(/\/+$/, '') // removing trailing slashes - custom_domain = custom_domain.replace(/https?:\/\//, '') // removing http:// or https:// from the beginning. - host += $scope.sm.bucket ? $scope.sm.bucket : '{bucket-name}' + jQuery('#file_url_grp_preview').val(host) + }, - if ( - custom_domain !== 'storage.googleapis.com' && - $scope.sm.bucket && - custom_domain && - (is_ssl === 0 || custom_domain == $scope.sm.bucket) - ) { - $scope.sm.is_custom_domain = true - $scope.sm.is_ssl = is_ssl === 0 ? true : false - host = is_ssl === 0 ? 'https://' : 'http://' // bucketname will be host - host += custom_domain - } + // Init application + init: function () { + this.sm = wp_stateless_settings || {} + this.sm.readonly = this.sm.readonly || {} + + var readonly = Object.keys(this.sm.readonly); - $scope.sm.preview_url = - host + '/' + root_dir + hash + 'your-image-name.jpeg' + for (var key of readonly) { + this.showNotice(key) } - $scope.sm.generatePreviewUrl() - }) - .controller('wpStatelessCompatibility', function ($scope, $filter) { - $scope.modules = wp_stateless_compatibility || {} - }) + if (this.sm.network_admin) { + jQuery('#cache_busting').val('true') + this.sm.readonly.hashify_file_name = true + } + + // Disable root dir editing if it's readonly + if (this.sm.readonly['root_dir']) { + $wildcards_select.prop('disabled', true) + jQuery('#sm_bucket_folder_type').prop('disabled', true) + } + + // Show supported file types + jQuery('#sm_body_rewrite').on('change', this.showSupportedTypes) + this.showSupportedTypes() + + // Check if custom domain is SSL + jQuery('#custom_domain').on('change', this.setIsSSL.bind(this)) + this.setIsSSL() + + // Check if hashify file name is enabled + jQuery('[name="sm[mode]"').on('change', this.enableHashifyFileName.bind(this)) + this.enableHashifyFileName() + + // Check if dynamic image support is enabled + jQuery('[name="sm[mode]"').on('change', this.enableDynamicImageSupport.bind(this)) + this.enableDynamicImageSupport() + + // Switch folder type depending on root dir + jQuery('#sm_root_dir').on('change', this.switchBucketFolderType.bind(this)) + this.switchBucketFolderType() + + // Update root dir depending on folder type + jQuery('#sm_bucket_folder_type').on('change', this.switchRootDir) + + // Generate preview URL + jQuery('#bucket_name').on('change', this.generatePreviewUrl.bind(this)) + jQuery('#sm_root_dir').on('change', this.generatePreviewUrl.bind(this)) + jQuery('#custom_domain').on('change', this.generatePreviewUrl.bind(this)) + this.generatePreviewUrl() + } +}; + +wpStatelessSettingsApp.init(); + + +var wpStatelessApp = angular + .module('wpStatelessApp', ['ngSanitize']) + + // Controllers .controller('wpStatelessProcessing', function ($scope, $http) { /** * General Errors diff --git a/static/views/compatibility-tab.php b/static/views/compatibility-tab.php new file mode 100644 index 000000000..02940eaac --- /dev/null +++ b/static/views/compatibility-tab.php @@ -0,0 +1,69 @@ +

                    domain); ?>

                    + +

                    Submit feedback and let us know your issue!", ud_get_stateless_media()->domain), + "https://wordpress.org/support/plugin/wp-stateless/" +); ?>

                    + +
                    + + + + + + + + + + + + +
                    + id); + + $disabled = $module->is_constant || ($module->is_network_override || !$module->is_plugin_active || !$module->is_mode_supported) && !is_network_admin(); + $disabled = $disabled ? 'disabled="true"' : ''; + ?> + + + +

                    + is_plugin_active && $module->is_plugin && $module->is_mode_supported ) : ?> + domain); ?> + + + is_plugin_active && $module->is_theme && $module->is_mode_supported ) : ?> + domain); ?> + + + is_mode_supported ) : ?> + domain), $module->mode ); ?> + + + is_constant ) : ?> + domain); ?> + + + is_network_override ) : ?> + domain); ?> + + + description?> +

                    +
                    + + 'save-compatibility')); ?> +
                    + diff --git a/static/views/settings-sections/file-url.php b/static/views/settings-sections/file-url.php new file mode 100644 index 000000000..afcb6743c --- /dev/null +++ b/static/views/settings-sections/file-url.php @@ -0,0 +1,119 @@ + + domain); ?> + + +
                    + domain); ?> + +

                    domain); ?>

                    + +

                    + +

                    + +

                    domain); ?>

                    + +
                    + + + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain)); ?> + configure a CNAME. Be advised that the bucket name and domain name must match exactly, and HTTPS is not supported with a custom domain out of the box.', ud_get_stateless_media()->domain), 'https://cloud.google.com/storage/docs/xml-api/reference-uris#cname'); ?> +

                    + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + + Required by Stateless Mode. Override with the WP_STATELESS_MEDIA_CACHE_BUSTING constant.", "https://stateless.udx.io/docs/constants/#wp_stateless_media_cache_busting"), ud_get_stateless_media()->domain); ?> + + + domain); ?> +

                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + + Not available in Stateless Mode.", ud_get_stateless_media()->domain); ?> + + + domain); ?> +

                    +
                    + + diff --git a/static/views/settings-sections/general.php b/static/views/settings-sections/general.php new file mode 100644 index 000000000..dea067d90 --- /dev/null +++ b/static/views/settings-sections/general.php @@ -0,0 +1,104 @@ + + domain); ?> + + +
                    + + domain); ?> + +

                    domain); ?>

                    + +

                    + + +

                    + +

                    + + +

                    + +

                    + +

                    + +

                    + +

                    + +

                    + +

                    + +

                    + +

                    + +

                    + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain); ?> +

                    + +

                    domain); ?>

                    + +
                    +

                    + +

                    + +

                    + domain); ?> +

                    +
                    +
                    + + diff --git a/static/views/settings-sections/google-cloud-storage.php b/static/views/settings-sections/google-cloud-storage.php new file mode 100644 index 000000000..1a8f3c6cb --- /dev/null +++ b/static/views/settings-sections/google-cloud-storage.php @@ -0,0 +1,74 @@ + + domain); ?> + + +
                    + domain); ?> + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain); ?> +

                    + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain); ?> +

                    + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain); ?> +

                    + +
                    + +

                    domain); ?>

                    + +

                    + +

                    + +

                    + + domain); ?> +

                    + +
                    + + diff --git a/static/views/settings-sections/network.php b/static/views/settings-sections/network.php new file mode 100644 index 000000000..02e4b40bb --- /dev/null +++ b/static/views/settings-sections/network.php @@ -0,0 +1,37 @@ + + domain); ?> + + +
                    + domain); ?> + +

                    + +

                    + +

                    +
                    + + + + + domain); ?> + + +
                    + domain); ?> + +

                    + +

                    + +

                    +
                    + + diff --git a/static/views/settings-tab.php b/static/views/settings-tab.php new file mode 100644 index 000000000..4673356c6 --- /dev/null +++ b/static/views/settings-tab.php @@ -0,0 +1,21 @@ + + +
                    + + + + + + + + + + + + + + +
                    + + 'save-settings')); ?> +
                    diff --git a/static/views/settings_interface.php b/static/views/settings_interface.php index 8a94fbdb4..d56402378 100644 --- a/static/views/settings_interface.php +++ b/static/views/settings_interface.php @@ -16,299 +16,23 @@

                    -
                    -
                    - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
                    domain); ?> -
                    - domain); ?> -

                    - -

                    -

                    -
                    -
                    domain); ?> -
                    - domain); ?> -

                    - -

                    -

                    -
                    -
                    domain); ?> -
                    - domain); ?> -

                    domain); ?>

                    -

                    - -

                    - -

                    - -

                    - -

                    -

                    - -

                    -

                    - -

                    -

                    - -

                    -

                    - -

                    -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    - -

                    domain); ?>

                    -
                    -

                    - -

                    -

                    domain); ?>

                    -
                    -
                    -
                    domain); ?> -
                    - domain); ?> -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    -
                    -
                    domain); ?> -
                    - domain); ?> -

                    domain); ?>

                    -

                    - -

                    -

                    domain); ?>

                    -
                    - - -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    - - domain)); ?> - configure a CNAME. Be advised that the bucket name and domain name must match exactly, and HTTPS is not supported with a custom domain out of the box.', ud_get_stateless_media()->domain), 'https://cloud.google.com/storage/docs/xml-api/reference-uris#cname'); ?> -

                    -
                    - -

                    domain); ?>

                    -

                    - -

                    -

                    - - Required by Stateless Mode. Override with the WP_STATELESS_MEDIA_CACHE_BUSTING constant.", "https://stateless.udx.io/docs/constants/#wp_stateless_media_cache_busting"), ud_get_stateless_media()->domain); ?> - - domain); ?>

                    - -

                    domain); ?>

                    -

                    - -

                    -

                    - - Not available in Stateless Mode.", ud_get_stateless_media()->domain); ?> - - domain); ?> -

                    -
                    -
                    - - 'save-settings')); ?> -
                    +
                    +
                    +
                    -
                    -
                    -

                    -

                    Submit feedback and let us know your issue!", "https://wordpress.org/support/plugin/wp-stateless/")); ?>

                    -
                    - - - - - - - - -
                    - - - -

                    - - - - - - -

                    -
                    - 'save-compatibility')); ?> -
                    + +
                    +
                    + +
                    -
                    +
                    From 9d30334b99672fcb733dd463a2f992311edea940 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 29 Dec 2023 18:46:44 +0200 Subject: [PATCH 04/16] Replace with to support PHP 8.2 and above --- changelog.txt | 1 + changes.md | 2 ++ lib/classes/class-logger.php | 14 +++++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/changelog.txt b/changelog.txt index b7513409d..9e3ae1423 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ * ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons. * ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons. * ENHANCEMENT - refactor `Settings` admin page to remove Angular dependency. +* FIX - replace `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above. = 3.3.0 = * NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions. diff --git a/changes.md b/changes.md index f0e6089c2..504364498 100644 --- a/changes.md +++ b/changes.md @@ -1,6 +1,8 @@ #### 4.1.0 * ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons * ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons +* ENHANCEMENT - refactor `Settings` admin page to remove Angular dependecy. +* FIX - replace `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above. #### 3.3.0 * NEW - Added new filter `wp_stateless_attachment_url`. Allows to customize attachment URL after WP-Stateless generates it based on it's internal conditions. diff --git a/lib/classes/class-logger.php b/lib/classes/class-logger.php index ffeba0148..29ee8ecc4 100644 --- a/lib/classes/class-logger.php +++ b/lib/classes/class-logger.php @@ -388,7 +388,19 @@ protected function _writeHeader( $data ) { * @return string */ protected function _encode( $data ) { - return base64_encode( utf8_encode( json_encode( $data ) ) ); + if ( function_exists('mb_convert_encoding') ) { + $encoded = json_encode($data); + + if ( $encoded !== false ) { + $utf8 = mb_convert_encoding($encoded, 'UTF-8', 'UTF-8'); + + if ($utf8 !== false) { + return base64_encode($utf8); + } + } + } + + return false; } /** From 1201296946e87fc77d73b15ac2801e5e57f1400a Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 29 Dec 2023 18:51:30 +0200 Subject: [PATCH 05/16] Update package dependencies for Google Client Library for security reasons --- changelog.txt | 1 + changes.md | 3 +- lib/Google/composer.lock | 350 ++++++++++-------- lib/Google/vendor/composer/installed.json | 138 +++---- lib/Google/vendor/composer/installed.php | 68 ++-- .../vendor/firebase/php-jwt/CHANGELOG.md | 7 + .../vendor/firebase/php-jwt/src/JWT.php | 9 +- lib/Google/vendor/google/auth/README.md | 12 + .../Credentials/ServiceAccountCredentials.php | 19 + .../google/auth/src/CredentialsLoader.php | 12 + .../google/auth/src/FetchAuthTokenCache.php | 15 + .../auth/src/GetUniverseDomainInterface.php | 35 ++ .../src/Middleware/AuthTokenMiddleware.php | 47 ++- lib/Google/vendor/google/cloud-core/VERSION | 2 +- .../google/cloud-core/src/RequestWrapper.php | 40 +- .../cloud-core/src/Testing/TestHelpers.php | 4 +- .../vendor/google/cloud-storage/VERSION | 2 +- .../google/cloud-storage/src/Bucket.php | 7 + .../cloud-storage/src/Connection/Rest.php | 6 + .../ServiceDefinition/storage-v1.json | 320 +++++++++++++++- .../cloud-storage/src/StorageClient.php | 6 +- .../cloud-storage/src/StorageObject.php | 12 + .../vendor/guzzlehttp/guzzle/CHANGELOG.md | 13 +- lib/Google/vendor/guzzlehttp/guzzle/README.md | 4 +- .../vendor/guzzlehttp/guzzle/UPGRADING.md | 14 +- .../vendor/guzzlehttp/guzzle/composer.json | 4 +- .../guzzle/src/Cookie/CookieJar.php | 2 +- .../guzzle/src/Cookie/SetCookie.php | 4 +- .../guzzle/src/Handler/CurlFactory.php | 2 +- .../guzzlehttp/guzzle/src/RequestOptions.php | 4 +- .../vendor/guzzlehttp/guzzle/src/Utils.php | 15 +- .../vendor/guzzlehttp/promises/CHANGELOG.md | 7 + .../vendor/guzzlehttp/promises/composer.json | 4 +- .../vendor/guzzlehttp/promises/src/Each.php | 7 +- .../guzzlehttp/promises/src/EachPromise.php | 8 +- .../promises/src/RejectionException.php | 2 +- .../vendor/guzzlehttp/psr7/CHANGELOG.md | 11 + lib/Google/vendor/guzzlehttp/psr7/README.md | 16 +- .../vendor/guzzlehttp/psr7/composer.json | 4 +- .../vendor/guzzlehttp/psr7/src/FnStream.php | 33 +- .../vendor/guzzlehttp/psr7/src/Header.php | 2 +- .../guzzlehttp/psr7/src/InflateStream.php | 8 +- .../vendor/guzzlehttp/psr7/src/Message.php | 8 +- .../guzzlehttp/psr7/src/MessageTrait.php | 8 +- .../guzzlehttp/psr7/src/MultipartStream.php | 20 +- .../vendor/guzzlehttp/psr7/src/PumpStream.php | 6 +- .../vendor/guzzlehttp/psr7/src/Request.php | 4 +- .../vendor/guzzlehttp/psr7/src/Response.php | 2 +- .../guzzlehttp/psr7/src/ServerRequest.php | 2 +- .../vendor/guzzlehttp/psr7/src/Stream.php | 4 +- .../psr7/src/StreamDecoratorTrait.php | 2 +- .../guzzlehttp/psr7/src/StreamWrapper.php | 32 +- .../guzzlehttp/psr7/src/UploadedFile.php | 4 +- lib/Google/vendor/guzzlehttp/psr7/src/Uri.php | 28 +- .../guzzlehttp/psr7/src/UriNormalizer.php | 10 +- .../guzzlehttp/psr7/src/UriResolver.php | 6 +- .../vendor/guzzlehttp/psr7/src/Utils.php | 6 +- .../Crypt/Common/Formats/Keys/PKCS8.php | 3 +- .../Crypt/EC/Formats/Signature/IEEE.php | 66 ++++ .../phpseclib/phpseclib/Math/BigInteger.php | 3 +- .../phpseclib/Math/BigInteger/Engines/PHP.php | 3 +- .../phpseclib/phpseclib/Math/BinaryField.php | 9 + .../phpseclib/Math/PrimeField/Integer.php | 2 +- .../phpseclib/phpseclib/Net/SSH2.php | 41 +- .../uuid/src/Generator/UnixTimeGenerator.php | 2 +- .../vendor/ramsey/uuid/src/UuidInterface.php | 2 +- 66 files changed, 1106 insertions(+), 446 deletions(-) create mode 100644 lib/Google/vendor/google/auth/src/GetUniverseDomainInterface.php create mode 100644 lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php diff --git a/changelog.txt b/changelog.txt index 9e3ae1423..ecfef2fcc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ * ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons. * ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons. * ENHANCEMENT - refactor `Settings` admin page to remove Angular dependency. +* FIX - update package dependencies for Google Client Library for security reasons. * FIX - replace `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above. = 3.3.0 = diff --git a/changes.md b/changes.md index 504364498..24a1b4d30 100644 --- a/changes.md +++ b/changes.md @@ -1,7 +1,8 @@ #### 4.1.0 * ENHANCEMENT - remove `udx/lib-settings` package dependency for security reasons * ENHANCEMENT - remove `udx/lib-utility` package dependency for security reasons -* ENHANCEMENT - refactor `Settings` admin page to remove Angular dependecy. +* ENHANCEMENT - refactor `Settings` admin page to remove Angular dependency. +* FIX - update package dependencies for Google Client Library for security reasons. * FIX - replace `utf8_encode` with `mb_convert_encoding` to support PHP 8.2 and above. #### 3.3.0 diff --git a/lib/Google/composer.lock b/lib/Google/composer.lock index cb62414bb..60223301f 100644 --- a/lib/Google/composer.lock +++ b/lib/Google/composer.lock @@ -63,16 +63,16 @@ }, { "name": "firebase/php-jwt", - "version": "v6.9.0", + "version": "v6.10.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "f03270e63eaccf3019ef0f32849c497385774e11" + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11", - "reference": "f03270e63eaccf3019ef0f32849c497385774e11", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", "shasum": "" }, "require": { @@ -120,9 +120,9 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.9.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" }, - "time": "2023-10-05T00:24:42+00:00" + "time": "2023-12-01T16:26:39+00:00" }, { "name": "google/apiclient-services", @@ -170,16 +170,16 @@ }, { "name": "google/auth", - "version": "v1.32.1", + "version": "v1.33.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "999e9ce8b9d17914f04e1718271a0a46da4de2f3" + "reference": "682dc6c30bb509953c9e43bb0960d901582da00b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/999e9ce8b9d17914f04e1718271a0a46da4de2f3", - "reference": "999e9ce8b9d17914f04e1718271a0a46da4de2f3", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/682dc6c30bb509953c9e43bb0960d901582da00b", + "reference": "682dc6c30bb509953c9e43bb0960d901582da00b", "shasum": "" }, "require": { @@ -222,22 +222,22 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.32.1" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.33.0" }, - "time": "2023-10-17T21:13:22+00:00" + "time": "2023-11-30T15:49:27+00:00" }, { "name": "google/cloud-core", - "version": "v1.52.8", + "version": "v1.52.10", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c" + "reference": "5e34556498ecadee2161402fd1024bec7ce33186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c", - "reference": "2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/5e34556498ecadee2161402fd1024bec7ce33186", + "reference": "5e34556498ecadee2161402fd1024bec7ce33186", "shasum": "" }, "require": { @@ -287,22 +287,22 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.8" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.10" }, - "time": "2023-11-02T19:15:44+00:00" + "time": "2023-12-08T22:36:35+00:00" }, { "name": "google/cloud-storage", - "version": "v1.34.0", + "version": "v1.36.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "4589dd3c8f4171db4ce3eb335fc7d894661ca0e9" + "reference": "94215228fd03e548590134d1e521a34ec727460c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4589dd3c8f4171db4ce3eb335fc7d894661ca0e9", - "reference": "4589dd3c8f4171db4ce3eb335fc7d894661ca0e9", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/94215228fd03e548590134d1e521a34ec727460c", + "reference": "94215228fd03e548590134d1e521a34ec727460c", "shasum": "" }, "require": { @@ -343,22 +343,22 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.34.0" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.36.0" }, - "time": "2023-11-02T19:15:44+00:00" + "time": "2023-12-08T22:36:35+00:00" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.0", + "version": "7.8.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9" + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1110f66a6530a40fe7aea0378fe608ee2b2248f9", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", "shasum": "" }, "require": { @@ -373,11 +373,11 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -455,7 +455,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.0" + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" }, "funding": [ { @@ -471,28 +471,28 @@ "type": "tidelift" } ], - "time": "2023-08-27T10:20:53+00:00" + "time": "2023-12-03T20:35:24+00:00" }, { "name": "guzzlehttp/promises", - "version": "2.0.1", + "version": "2.0.2", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "type": "library", "extra": { @@ -538,7 +538,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.1" + "source": "https://github.com/guzzle/promises/tree/2.0.2" }, "funding": [ { @@ -554,20 +554,20 @@ "type": "tidelift" } ], - "time": "2023-08-03T15:11:55+00:00" + "time": "2023-12-03T20:19:20+00:00" }, { "name": "guzzlehttp/psr7", - "version": "2.6.1", + "version": "2.6.2", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727" + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/be45764272e8873c72dbe3d2edcfdfcc3bc9f727", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", "shasum": "" }, "require": { @@ -581,9 +581,9 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" @@ -654,7 +654,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.1" + "source": "https://github.com/guzzle/psr7/tree/2.6.2" }, "funding": [ { @@ -670,7 +670,7 @@ "type": "tidelift" } ], - "time": "2023-08-27T10:13:57+00:00" + "time": "2023-12-03T20:05:35+00:00" }, { "name": "monolog/monolog", @@ -893,16 +893,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.33", + "version": "3.0.34", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0" + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/33fa69b2514a61138dd48e7a49f99445711e0ad0", - "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/56c79f16a6ae17e42089c06a2144467acc35348a", + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a", "shasum": "" }, "require": { @@ -983,7 +983,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.33" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.34" }, "funding": [ { @@ -999,7 +999,7 @@ "type": "tidelift" } ], - "time": "2023-10-21T14:00:39+00:00" + "time": "2023-11-27T11:13:31+00:00" }, { "name": "psr/cache", @@ -1396,16 +1396,16 @@ }, { "name": "ramsey/uuid", - "version": "4.7.4", + "version": "4.7.5", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "shasum": "" }, "require": { @@ -1472,7 +1472,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" + "source": "https://github.com/ramsey/uuid/tree/4.7.5" }, "funding": [ { @@ -1484,7 +1484,7 @@ "type": "tidelift" } ], - "time": "2023-04-15T23:01:58+00:00" + "time": "2023-11-08T05:53:05+00:00" }, { "name": "rize/uri-template", @@ -1893,16 +1893,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.3.7", + "version": "1.4.0", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "76e46335014860eec1aa5a724799a00a2e47cc85" + "reference": "b66d11b7479109ab547f9405b97205640b17d385" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/76e46335014860eec1aa5a724799a00a2e47cc85", - "reference": "76e46335014860eec1aa5a724799a00a2e47cc85", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/b66d11b7479109ab547f9405b97205640b17d385", + "reference": "b66d11b7479109ab547f9405b97205640b17d385", "shasum": "" }, "require": { @@ -1914,7 +1914,7 @@ "phpstan/phpstan": "^0.12.55", "psr/log": "^1.0", "symfony/phpunit-bridge": "^4.2 || ^5", - "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0" + "symfony/process": "^2.5 || ^3.0 || ^4.0 || ^5.0 || ^6.0 || ^7.0" }, "type": "library", "extra": { @@ -1949,7 +1949,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.7" + "source": "https://github.com/composer/ca-bundle/tree/1.4.0" }, "funding": [ { @@ -1965,7 +1965,7 @@ "type": "tidelift" } ], - "time": "2023-08-30T09:31:38+00:00" + "time": "2023-12-18T12:05:55+00:00" }, { "name": "composer/composer", @@ -2148,16 +2148,16 @@ }, { "name": "composer/spdx-licenses", - "version": "1.5.7", + "version": "1.5.8", "source": { "type": "git", "url": "https://github.com/composer/spdx-licenses.git", - "reference": "c848241796da2abf65837d51dce1fae55a960149" + "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/c848241796da2abf65837d51dce1fae55a960149", - "reference": "c848241796da2abf65837d51dce1fae55a960149", + "url": "https://api.github.com/repos/composer/spdx-licenses/zipball/560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", + "reference": "560bdcf8deb88ae5d611c80a2de8ea9d0358cc0a", "shasum": "" }, "require": { @@ -2206,9 +2206,9 @@ "validator" ], "support": { - "irc": "irc://irc.freenode.org/composer", + "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/spdx-licenses/issues", - "source": "https://github.com/composer/spdx-licenses/tree/1.5.7" + "source": "https://github.com/composer/spdx-licenses/tree/1.5.8" }, "funding": [ { @@ -2224,7 +2224,7 @@ "type": "tidelift" } ], - "time": "2022-05-23T07:37:50+00:00" + "time": "2023-11-20T07:44:33+00:00" }, { "name": "composer/xdebug-handler", @@ -2688,16 +2688,16 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v4.18.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/1bcbb2179f97633e98bbbc87044ee2611c7d7999", + "reference": "1bcbb2179f97633e98bbbc87044ee2611c7d7999", "shasum": "" }, "require": { @@ -2738,9 +2738,9 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v4.18.0" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2023-12-10T21:03:43+00:00" }, { "name": "phar-io/manifest", @@ -3085,29 +3085,29 @@ }, { "name": "phpspec/prophecy", - "version": "v1.17.0", + "version": "v1.18.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2" + "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/15873c65b207b07765dbc3c95d20fdf4a320cbe2", - "reference": "15873c65b207b07765dbc3c95d20fdf4a320cbe2", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d4f454f7e1193933f04e6500de3e79191648ed0c", + "reference": "d4f454f7e1193933f04e6500de3e79191648ed0c", "shasum": "" }, "require": { "doctrine/instantiator": "^1.2 || ^2.0", - "php": "^7.2 || 8.0.* || 8.1.* || 8.2.*", + "php": "^7.2 || 8.0.* || 8.1.* || 8.2.* || 8.3.*", "phpdocumentor/reflection-docblock": "^5.2", - "sebastian/comparator": "^3.0 || ^4.0", - "sebastian/recursion-context": "^3.0 || ^4.0" + "sebastian/comparator": "^3.0 || ^4.0 || ^5.0", + "sebastian/recursion-context": "^3.0 || ^4.0 || ^5.0" }, "require-dev": { "phpspec/phpspec": "^6.0 || ^7.0", "phpstan/phpstan": "^1.9", - "phpunit/phpunit": "^8.0 || ^9.0" + "phpunit/phpunit": "^8.0 || ^9.0 || ^10.0" }, "type": "library", "extra": { @@ -3140,6 +3140,7 @@ "keywords": [ "Double", "Dummy", + "dev", "fake", "mock", "spy", @@ -3147,28 +3148,28 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy/issues", - "source": "https://github.com/phpspec/prophecy/tree/v1.17.0" + "source": "https://github.com/phpspec/prophecy/tree/v1.18.0" }, - "time": "2023-02-02T15:41:36+00:00" + "time": "2023-12-07T16:22:33+00:00" }, { "name": "phpspec/prophecy-phpunit", - "version": "v2.0.2", + "version": "v2.1.0", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy-phpunit.git", - "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87" + "reference": "29f8114c2c319a4308e6b070902211e062efa392" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/9f26c224a2fa335f33e6666cc078fbf388255e87", - "reference": "9f26c224a2fa335f33e6666cc078fbf388255e87", + "url": "https://api.github.com/repos/phpspec/prophecy-phpunit/zipball/29f8114c2c319a4308e6b070902211e062efa392", + "reference": "29f8114c2c319a4308e6b070902211e062efa392", "shasum": "" }, "require": { "php": "^7.3 || ^8", - "phpspec/prophecy": "^1.3", - "phpunit/phpunit": "^9.1" + "phpspec/prophecy": "^1.18", + "phpunit/phpunit": "^9.1 || ^10.1" }, "type": "library", "extra": { @@ -3199,22 +3200,22 @@ ], "support": { "issues": "https://github.com/phpspec/prophecy-phpunit/issues", - "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.0.2" + "source": "https://github.com/phpspec/prophecy-phpunit/tree/v2.1.0" }, - "time": "2023-04-18T11:58:05+00:00" + "time": "2023-12-08T12:48:02+00:00" }, { "name": "phpstan/phpdoc-parser", - "version": "1.24.2", + "version": "1.24.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "bcad8d995980440892759db0c32acae7c8e79442" + "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/bcad8d995980440892759db0c32acae7c8e79442", - "reference": "bcad8d995980440892759db0c32acae7c8e79442", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/fedf211ff14ec8381c9bf5714e33a7a552dd1acc", + "reference": "fedf211ff14ec8381c9bf5714e33a7a552dd1acc", "shasum": "" }, "require": { @@ -3246,29 +3247,29 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.2" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.24.5" }, - "time": "2023-09-26T12:28:12+00:00" + "time": "2023-12-16T09:33:33+00:00" }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "9.2.30", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/ca2bd87d2f9215904682a9cb9bb37dda98e76089", + "reference": "ca2bd87d2f9215904682a9cb9bb37dda98e76089", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -3318,7 +3319,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.30" }, "funding": [ { @@ -3326,7 +3327,7 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2023-12-22T06:47:57+00:00" }, { "name": "phpunit/php-file-iterator", @@ -3571,16 +3572,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "9.6.15", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/05017b80304e0eb3f31d90194a563fd53a6021f1", + "reference": "05017b80304e0eb3f31d90194a563fd53a6021f1", "shasum": "" }, "require": { @@ -3654,7 +3655,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.15" }, "funding": [ { @@ -3670,7 +3671,7 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2023-12-01T16:55:19+00:00" }, { "name": "psr/container", @@ -4019,20 +4020,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -4064,7 +4065,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -4072,7 +4073,7 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", @@ -4346,20 +4347,20 @@ }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -4391,7 +4392,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -4399,7 +4400,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -4742,16 +4743,16 @@ }, { "name": "seld/jsonlint", - "version": "1.10.0", + "version": "1.10.1", "source": { "type": "git", "url": "https://github.com/Seldaek/jsonlint.git", - "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1" + "reference": "76d449a358ece77d6f1d6331c68453e657172202" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/594fd6462aad8ecee0b45ca5045acea4776667f1", - "reference": "594fd6462aad8ecee0b45ca5045acea4776667f1", + "url": "https://api.github.com/repos/Seldaek/jsonlint/zipball/76d449a358ece77d6f1d6331c68453e657172202", + "reference": "76d449a358ece77d6f1d6331c68453e657172202", "shasum": "" }, "require": { @@ -4778,7 +4779,7 @@ { "name": "Jordi Boggiano", "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "homepage": "https://seld.be" } ], "description": "JSON Linter", @@ -4790,7 +4791,7 @@ ], "support": { "issues": "https://github.com/Seldaek/jsonlint/issues", - "source": "https://github.com/Seldaek/jsonlint/tree/1.10.0" + "source": "https://github.com/Seldaek/jsonlint/tree/1.10.1" }, "funding": [ { @@ -4802,7 +4803,7 @@ "type": "tidelift" } ], - "time": "2023-05-11T13:16:46+00:00" + "time": "2023-12-18T13:03:25+00:00" }, { "name": "seld/phar-utils", @@ -4854,16 +4855,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.7.2", + "version": "3.8.0", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ed8e00df0a83aa96acf703f8c2979ff33341f879", - "reference": "ed8e00df0a83aa96acf703f8c2979ff33341f879", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/5805f7a4e4958dbb5e944ef1e6edae0a303765e7", + "reference": "5805f7a4e4958dbb5e944ef1e6edae0a303765e7", "shasum": "" }, "require": { @@ -4873,7 +4874,7 @@ "php": ">=5.4.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/phpcs", @@ -4892,35 +4893,58 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", "standards", "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2023-02-22T23:07:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + } + ], + "time": "2023-12-08T12:32:31+00:00" }, { "name": "symfony/console", - "version": "v5.4.28", + "version": "v5.4.32", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827" + "reference": "c70df1ffaf23a8d340bded3cfab1b86752ad6ed7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f4f71842f24c2023b91237c72a365306f3c58827", - "reference": "f4f71842f24c2023b91237c72a365306f3c58827", + "url": "https://api.github.com/repos/symfony/console/zipball/c70df1ffaf23a8d340bded3cfab1b86752ad6ed7", + "reference": "c70df1ffaf23a8d340bded3cfab1b86752ad6ed7", "shasum": "" }, "require": { @@ -4990,7 +5014,7 @@ "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.4.28" + "source": "https://github.com/symfony/console/tree/v5.4.32" }, "funding": [ { @@ -5006,7 +5030,7 @@ "type": "tidelift" } ], - "time": "2023-08-07T06:12:30+00:00" + "time": "2023-11-18T18:23:04+00:00" }, { "name": "symfony/css-selector", @@ -5974,16 +5998,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.1", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e" + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e", - "reference": "34a41e998c2183e22995f158c581e7b5e755ab9e", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", "shasum": "" }, "require": { @@ -6012,7 +6036,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.1" + "source": "https://github.com/theseer/tokenizer/tree/1.2.2" }, "funding": [ { @@ -6020,7 +6044,7 @@ "type": "github" } ], - "time": "2021-07-28T10:34:58+00:00" + "time": "2023-11-20T00:12:19+00:00" }, { "name": "webmozart/assert", @@ -6090,5 +6114,5 @@ "php": "^7.4|^8.0" }, "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/lib/Google/vendor/composer/installed.json b/lib/Google/vendor/composer/installed.json index acfd6408e..943f52b55 100644 --- a/lib/Google/vendor/composer/installed.json +++ b/lib/Google/vendor/composer/installed.json @@ -60,17 +60,17 @@ }, { "name": "firebase/php-jwt", - "version": "v6.9.0", - "version_normalized": "6.9.0.0", + "version": "v6.10.0", + "version_normalized": "6.10.0.0", "source": { "type": "git", "url": "https://github.com/firebase/php-jwt.git", - "reference": "f03270e63eaccf3019ef0f32849c497385774e11" + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/firebase/php-jwt/zipball/f03270e63eaccf3019ef0f32849c497385774e11", - "reference": "f03270e63eaccf3019ef0f32849c497385774e11", + "url": "https://api.github.com/repos/firebase/php-jwt/zipball/a49db6f0a5033aef5143295342f1c95521b075ff", + "reference": "a49db6f0a5033aef5143295342f1c95521b075ff", "shasum": "" }, "require": { @@ -88,7 +88,7 @@ "ext-sodium": "Support EdDSA (Ed25519) signatures", "paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present" }, - "time": "2023-10-05T00:24:42+00:00", + "time": "2023-12-01T16:26:39+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -120,7 +120,7 @@ ], "support": { "issues": "https://github.com/firebase/php-jwt/issues", - "source": "https://github.com/firebase/php-jwt/tree/v6.9.0" + "source": "https://github.com/firebase/php-jwt/tree/v6.10.0" }, "install-path": "../firebase/php-jwt" }, @@ -173,17 +173,17 @@ }, { "name": "google/auth", - "version": "v1.32.1", - "version_normalized": "1.32.1.0", + "version": "v1.33.0", + "version_normalized": "1.33.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-auth-library-php.git", - "reference": "999e9ce8b9d17914f04e1718271a0a46da4de2f3" + "reference": "682dc6c30bb509953c9e43bb0960d901582da00b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/999e9ce8b9d17914f04e1718271a0a46da4de2f3", - "reference": "999e9ce8b9d17914f04e1718271a0a46da4de2f3", + "url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/682dc6c30bb509953c9e43bb0960d901582da00b", + "reference": "682dc6c30bb509953c9e43bb0960d901582da00b", "shasum": "" }, "require": { @@ -206,7 +206,7 @@ "suggest": { "phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2." }, - "time": "2023-10-17T21:13:22+00:00", + "time": "2023-11-30T15:49:27+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -228,23 +228,23 @@ "support": { "docs": "https://googleapis.github.io/google-auth-library-php/main/", "issues": "https://github.com/googleapis/google-auth-library-php/issues", - "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.32.1" + "source": "https://github.com/googleapis/google-auth-library-php/tree/v1.33.0" }, "install-path": "../google/auth" }, { "name": "google/cloud-core", - "version": "v1.52.8", - "version_normalized": "1.52.8.0", + "version": "v1.52.10", + "version_normalized": "1.52.10.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-core.git", - "reference": "2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c" + "reference": "5e34556498ecadee2161402fd1024bec7ce33186" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c", - "reference": "2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/5e34556498ecadee2161402fd1024bec7ce33186", + "reference": "5e34556498ecadee2161402fd1024bec7ce33186", "shasum": "" }, "require": { @@ -271,7 +271,7 @@ "opis/closure": "May be used to serialize closures to process jobs in the batch daemon. Please require version ^3.", "symfony/lock": "Required for the Spanner cached based session pool. Please require the following commit: 3.3.x-dev#1ba6ac9" }, - "time": "2023-11-02T19:15:44+00:00", + "time": "2023-12-08T22:36:35+00:00", "bin": [ "bin/google-cloud-batch" ], @@ -296,23 +296,23 @@ ], "description": "Google Cloud PHP shared dependency, providing functionality useful to all components.", "support": { - "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.8" + "source": "https://github.com/googleapis/google-cloud-php-core/tree/v1.52.10" }, "install-path": "../google/cloud-core" }, { "name": "google/cloud-storage", - "version": "v1.34.0", - "version_normalized": "1.34.0.0", + "version": "v1.36.0", + "version_normalized": "1.36.0.0", "source": { "type": "git", "url": "https://github.com/googleapis/google-cloud-php-storage.git", - "reference": "4589dd3c8f4171db4ce3eb335fc7d894661ca0e9" + "reference": "94215228fd03e548590134d1e521a34ec727460c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/4589dd3c8f4171db4ce3eb335fc7d894661ca0e9", - "reference": "4589dd3c8f4171db4ce3eb335fc7d894661ca0e9", + "url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/94215228fd03e548590134d1e521a34ec727460c", + "reference": "94215228fd03e548590134d1e521a34ec727460c", "shasum": "" }, "require": { @@ -333,7 +333,7 @@ "google/cloud-pubsub": "May be used to register a topic to receive bucket notifications.", "phpseclib/phpseclib": "May be used in place of OpenSSL for creating signed Cloud Storage URLs. Please require version ^2." }, - "time": "2023-11-02T19:15:44+00:00", + "time": "2023-12-08T22:36:35+00:00", "type": "library", "extra": { "component": { @@ -355,23 +355,23 @@ ], "description": "Cloud Storage Client for PHP", "support": { - "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.34.0" + "source": "https://github.com/googleapis/google-cloud-php-storage/tree/v1.36.0" }, "install-path": "../google/cloud-storage" }, { "name": "guzzlehttp/guzzle", - "version": "7.8.0", - "version_normalized": "7.8.0.0", + "version": "7.8.1", + "version_normalized": "7.8.1.0", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9" + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/1110f66a6530a40fe7aea0378fe608ee2b2248f9", - "reference": "1110f66a6530a40fe7aea0378fe608ee2b2248f9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/41042bc7ab002487b876a0683fc8dce04ddce104", + "reference": "41042bc7ab002487b876a0683fc8dce04ddce104", "shasum": "" }, "require": { @@ -386,11 +386,11 @@ "psr/http-client-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "ext-curl": "*", "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { @@ -398,7 +398,7 @@ "ext-intl": "Required for Internationalized Domain Name (IDN) support", "psr/log": "Required for using the Log middleware" }, - "time": "2023-08-27T10:20:53+00:00", + "time": "2023-12-03T20:35:24+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -470,7 +470,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.8.0" + "source": "https://github.com/guzzle/guzzle/tree/7.8.1" }, "funding": [ { @@ -490,27 +490,27 @@ }, { "name": "guzzlehttp/promises", - "version": "2.0.1", - "version_normalized": "2.0.1.0", + "version": "2.0.2", + "version_normalized": "2.0.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/promises.git", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d" + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/promises/zipball/111166291a0f8130081195ac4556a5587d7f1b5d", - "reference": "111166291a0f8130081195ac4556a5587d7f1b5d", + "url": "https://api.github.com/repos/guzzle/promises/zipball/bbff78d96034045e58e13dedd6ad91b5d1253223", + "reference": "bbff78d96034045e58e13dedd6ad91b5d1253223", "shasum": "" }, "require": { "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, - "time": "2023-08-03T15:11:55+00:00", + "time": "2023-12-03T20:19:20+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -556,7 +556,7 @@ ], "support": { "issues": "https://github.com/guzzle/promises/issues", - "source": "https://github.com/guzzle/promises/tree/2.0.1" + "source": "https://github.com/guzzle/promises/tree/2.0.2" }, "funding": [ { @@ -576,17 +576,17 @@ }, { "name": "guzzlehttp/psr7", - "version": "2.6.1", - "version_normalized": "2.6.1.0", + "version": "2.6.2", + "version_normalized": "2.6.2.0", "source": { "type": "git", "url": "https://github.com/guzzle/psr7.git", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727" + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/psr7/zipball/be45764272e8873c72dbe3d2edcfdfcc3bc9f727", - "reference": "be45764272e8873c72dbe3d2edcfdfcc3bc9f727", + "url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", + "reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", "shasum": "" }, "require": { @@ -600,14 +600,14 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" }, - "time": "2023-08-27T10:13:57+00:00", + "time": "2023-12-03T20:05:35+00:00", "type": "library", "extra": { "bamarni-bin": { @@ -675,7 +675,7 @@ ], "support": { "issues": "https://github.com/guzzle/psr7/issues", - "source": "https://github.com/guzzle/psr7/tree/2.6.1" + "source": "https://github.com/guzzle/psr7/tree/2.6.2" }, "funding": [ { @@ -923,17 +923,17 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.33", - "version_normalized": "3.0.33.0", + "version": "3.0.34", + "version_normalized": "3.0.34.0", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0" + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/33fa69b2514a61138dd48e7a49f99445711e0ad0", - "reference": "33fa69b2514a61138dd48e7a49f99445711e0ad0", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/56c79f16a6ae17e42089c06a2144467acc35348a", + "reference": "56c79f16a6ae17e42089c06a2144467acc35348a", "shasum": "" }, "require": { @@ -951,7 +951,7 @@ "ext-mcrypt": "Install the Mcrypt extension in order to speed up a few other cryptographic operations.", "ext-openssl": "Install the OpenSSL extension in order to speed up a wide variety of cryptographic operations." }, - "time": "2023-10-21T14:00:39+00:00", + "time": "2023-11-27T11:13:31+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -1016,7 +1016,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.33" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.34" }, "funding": [ { @@ -1450,17 +1450,17 @@ }, { "name": "ramsey/uuid", - "version": "4.7.4", - "version_normalized": "4.7.4.0", + "version": "4.7.5", + "version_normalized": "4.7.5.0", "source": { "type": "git", "url": "https://github.com/ramsey/uuid.git", - "reference": "60a4c63ab724854332900504274f6150ff26d286" + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/ramsey/uuid/zipball/60a4c63ab724854332900504274f6150ff26d286", - "reference": "60a4c63ab724854332900504274f6150ff26d286", + "url": "https://api.github.com/repos/ramsey/uuid/zipball/5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", + "reference": "5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e", "shasum": "" }, "require": { @@ -1501,7 +1501,7 @@ "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, - "time": "2023-04-15T23:01:58+00:00", + "time": "2023-11-08T05:53:05+00:00", "type": "library", "extra": { "captainhook": { @@ -1529,7 +1529,7 @@ ], "support": { "issues": "https://github.com/ramsey/uuid/issues", - "source": "https://github.com/ramsey/uuid/tree/4.7.4" + "source": "https://github.com/ramsey/uuid/tree/4.7.5" }, "funding": [ { diff --git a/lib/Google/vendor/composer/installed.php b/lib/Google/vendor/composer/installed.php index dd404f09d..420722874 100644 --- a/lib/Google/vendor/composer/installed.php +++ b/lib/Google/vendor/composer/installed.php @@ -1,9 +1,9 @@ array( 'name' => 'google/apiclient', - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'f7f20f2eef1ca5dc4e2614c43dd40bb5689ccda3', + 'pretty_version' => 'dev-latest', + 'version' => 'dev-latest', + 'reference' => 'fd648044ff982d46b7692c486068bf1bc9120dee', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -20,18 +20,18 @@ 'dev_requirement' => false, ), 'firebase/php-jwt' => array( - 'pretty_version' => 'v6.9.0', - 'version' => '6.9.0.0', - 'reference' => 'f03270e63eaccf3019ef0f32849c497385774e11', + 'pretty_version' => 'v6.10.0', + 'version' => '6.10.0.0', + 'reference' => 'a49db6f0a5033aef5143295342f1c95521b075ff', 'type' => 'library', 'install_path' => __DIR__ . '/../firebase/php-jwt', 'aliases' => array(), 'dev_requirement' => false, ), 'google/apiclient' => array( - 'pretty_version' => 'dev-master', - 'version' => 'dev-master', - 'reference' => 'f7f20f2eef1ca5dc4e2614c43dd40bb5689ccda3', + 'pretty_version' => 'dev-latest', + 'version' => 'dev-latest', + 'reference' => 'fd648044ff982d46b7692c486068bf1bc9120dee', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -47,54 +47,54 @@ 'dev_requirement' => false, ), 'google/auth' => array( - 'pretty_version' => 'v1.32.1', - 'version' => '1.32.1.0', - 'reference' => '999e9ce8b9d17914f04e1718271a0a46da4de2f3', + 'pretty_version' => 'v1.33.0', + 'version' => '1.33.0.0', + 'reference' => '682dc6c30bb509953c9e43bb0960d901582da00b', 'type' => 'library', 'install_path' => __DIR__ . '/../google/auth', 'aliases' => array(), 'dev_requirement' => false, ), 'google/cloud-core' => array( - 'pretty_version' => 'v1.52.8', - 'version' => '1.52.8.0', - 'reference' => '2ebcaa410f7e92dca5677dd9cc4ec1f9f315e83c', + 'pretty_version' => 'v1.52.10', + 'version' => '1.52.10.0', + 'reference' => '5e34556498ecadee2161402fd1024bec7ce33186', 'type' => 'library', 'install_path' => __DIR__ . '/../google/cloud-core', 'aliases' => array(), 'dev_requirement' => false, ), 'google/cloud-storage' => array( - 'pretty_version' => 'v1.34.0', - 'version' => '1.34.0.0', - 'reference' => '4589dd3c8f4171db4ce3eb335fc7d894661ca0e9', + 'pretty_version' => 'v1.36.0', + 'version' => '1.36.0.0', + 'reference' => '94215228fd03e548590134d1e521a34ec727460c', 'type' => 'library', 'install_path' => __DIR__ . '/../google/cloud-storage', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/guzzle' => array( - 'pretty_version' => '7.8.0', - 'version' => '7.8.0.0', - 'reference' => '1110f66a6530a40fe7aea0378fe608ee2b2248f9', + 'pretty_version' => '7.8.1', + 'version' => '7.8.1.0', + 'reference' => '41042bc7ab002487b876a0683fc8dce04ddce104', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/guzzle', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/promises' => array( - 'pretty_version' => '2.0.1', - 'version' => '2.0.1.0', - 'reference' => '111166291a0f8130081195ac4556a5587d7f1b5d', + 'pretty_version' => '2.0.2', + 'version' => '2.0.2.0', + 'reference' => 'bbff78d96034045e58e13dedd6ad91b5d1253223', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/promises', 'aliases' => array(), 'dev_requirement' => false, ), 'guzzlehttp/psr7' => array( - 'pretty_version' => '2.6.1', - 'version' => '2.6.1.0', - 'reference' => 'be45764272e8873c72dbe3d2edcfdfcc3bc9f727', + 'pretty_version' => '2.6.2', + 'version' => '2.6.2.0', + 'reference' => '45b30f99ac27b5ca93cb4831afe16285f57b8221', 'type' => 'library', 'install_path' => __DIR__ . '/../guzzlehttp/psr7', 'aliases' => array(), @@ -128,9 +128,9 @@ 'dev_requirement' => false, ), 'phpseclib/phpseclib' => array( - 'pretty_version' => '3.0.33', - 'version' => '3.0.33.0', - 'reference' => '33fa69b2514a61138dd48e7a49f99445711e0ad0', + 'pretty_version' => '3.0.34', + 'version' => '3.0.34.0', + 'reference' => '56c79f16a6ae17e42089c06a2144467acc35348a', 'type' => 'library', 'install_path' => __DIR__ . '/../phpseclib/phpseclib', 'aliases' => array(), @@ -224,9 +224,9 @@ 'dev_requirement' => false, ), 'ramsey/uuid' => array( - 'pretty_version' => '4.7.4', - 'version' => '4.7.4.0', - 'reference' => '60a4c63ab724854332900504274f6150ff26d286', + 'pretty_version' => '4.7.5', + 'version' => '4.7.5.0', + 'reference' => '5f0df49ae5ad6efb7afa69e6bfab4e5b1e080d8e', 'type' => 'library', 'install_path' => __DIR__ . '/../ramsey/uuid', 'aliases' => array(), @@ -235,7 +235,7 @@ 'rhumsaa/uuid' => array( 'dev_requirement' => false, 'replaced' => array( - 0 => '4.7.4', + 0 => '4.7.5', ), ), 'rize/uri-template' => array( diff --git a/lib/Google/vendor/firebase/php-jwt/CHANGELOG.md b/lib/Google/vendor/firebase/php-jwt/CHANGELOG.md index 4279dfd23..644fa0bea 100644 --- a/lib/Google/vendor/firebase/php-jwt/CHANGELOG.md +++ b/lib/Google/vendor/firebase/php-jwt/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [6.10.0](https://github.com/firebase/php-jwt/compare/v6.9.0...v6.10.0) (2023-11-28) + + +### Features + +* allow typ header override ([#546](https://github.com/firebase/php-jwt/issues/546)) ([79cb30b](https://github.com/firebase/php-jwt/commit/79cb30b729a22931b2fbd6b53f20629a83031ba9)) + ## [6.9.0](https://github.com/firebase/php-jwt/compare/v6.8.1...v6.9.0) (2023-10-04) diff --git a/lib/Google/vendor/firebase/php-jwt/src/JWT.php b/lib/Google/vendor/firebase/php-jwt/src/JWT.php index 6efcbb56d..263492068 100644 --- a/lib/Google/vendor/firebase/php-jwt/src/JWT.php +++ b/lib/Google/vendor/firebase/php-jwt/src/JWT.php @@ -203,13 +203,14 @@ public static function encode( string $keyId = null, array $head = null ): string { - $header = ['typ' => 'JWT', 'alg' => $alg]; + $header = ['typ' => 'JWT']; + if (isset($head) && \is_array($head)) { + $header = \array_merge($header, $head); + } + $header['alg'] = $alg; if ($keyId !== null) { $header['kid'] = $keyId; } - if (isset($head) && \is_array($head)) { - $header = \array_merge($head, $header); - } $segments = []; $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($header)); $segments[] = static::urlsafeB64Encode((string) static::jsonEncode($payload)); diff --git a/lib/Google/vendor/google/auth/README.md b/lib/Google/vendor/google/auth/README.md index 91f12b2db..87f6f6064 100644 --- a/lib/Google/vendor/google/auth/README.md +++ b/lib/Google/vendor/google/auth/README.md @@ -257,6 +257,18 @@ print_r((string) $response->getBody()); [iap-proxy-header]: https://cloud.google.com/iap/docs/authentication-howto#authenticating_from_proxy-authorization_header +#### External credentials (Workload identity federation) + +Using workload identity federation, your application can access Google Cloud resources from Amazon Web Services (AWS), +Microsoft Azure or any identity provider that supports OpenID Connect (OIDC). + +Traditionally, applications running outside Google Cloud have used service account keys to access Google Cloud +resources. Using identity federation, you can allow your workload to impersonate a service account. This lets you access +Google Cloud resources directly, eliminating the maintenance and security burden associated with service account keys. + +Follow the detailed instructions on how to +[Configure Workload Identity Federation](https://cloud.google.com/iam/docs/workload-identity-federation-with-other-clouds). + #### Verifying JWTs If you are [using Google ID tokens to authenticate users][google-id-tokens], use diff --git a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php index 76aa0fc99..086417c07 100644 --- a/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php +++ b/lib/Google/vendor/google/auth/src/Credentials/ServiceAccountCredentials.php @@ -99,6 +99,11 @@ class ServiceAccountCredentials extends CredentialsLoader implements */ private $jwtAccessCredentials; + /** + * @var string|null + */ + private ?string $universeDomain; + /** * Create a new ServiceAccountCredentials. * @@ -159,6 +164,7 @@ public function __construct( ]); $this->projectId = $jsonKey['project_id'] ?? null; + $this->universeDomain = $jsonKey['universe_domain'] ?? null; } /** @@ -328,6 +334,19 @@ public function getQuotaProject() return $this->quotaProject; } + /** + * Get the universe domain configured in the JSON credential. + * + * @return string + */ + public function getUniverseDomain(): string + { + if (null === $this->universeDomain) { + return self::DEFAULT_UNIVERSE_DOMAIN; + } + return $this->universeDomain; + } + /** * @return bool */ diff --git a/lib/Google/vendor/google/auth/src/CredentialsLoader.php b/lib/Google/vendor/google/auth/src/CredentialsLoader.php index 9e28701ed..746b957a9 100644 --- a/lib/Google/vendor/google/auth/src/CredentialsLoader.php +++ b/lib/Google/vendor/google/auth/src/CredentialsLoader.php @@ -30,6 +30,7 @@ * credentials files on the file system. */ abstract class CredentialsLoader implements + GetUniverseDomainInterface, FetchAuthTokenInterface, UpdateMetadataInterface { @@ -273,4 +274,15 @@ private static function loadDefaultClientCertSourceFile() } return $clientCertSourceJson; } + + /** + * Get the universe domain from the credential. Defaults to "googleapis.com" + * for all credential types which do not support universe domain. + * + * @return string + */ + public function getUniverseDomain(): string + { + return self::DEFAULT_UNIVERSE_DOMAIN; + } } diff --git a/lib/Google/vendor/google/auth/src/FetchAuthTokenCache.php b/lib/Google/vendor/google/auth/src/FetchAuthTokenCache.php index 47174a1b7..cac1984ab 100644 --- a/lib/Google/vendor/google/auth/src/FetchAuthTokenCache.php +++ b/lib/Google/vendor/google/auth/src/FetchAuthTokenCache.php @@ -26,6 +26,7 @@ class FetchAuthTokenCache implements FetchAuthTokenInterface, GetQuotaProjectInterface, + GetUniverseDomainInterface, SignBlobInterface, ProjectIdProviderInterface, UpdateMetadataInterface @@ -191,6 +192,20 @@ public function getProjectId(callable $httpHandler = null) return $this->fetcher->getProjectId($httpHandler); } + /* + * Get the Universe Domain from the fetcher. + * + * @return string + */ + public function getUniverseDomain(): string + { + if ($this->fetcher instanceof GetUniverseDomainInterface) { + return $this->fetcher->getUniverseDomain(); + } + + return GetUniverseDomainInterface::DEFAULT_UNIVERSE_DOMAIN; + } + /** * Updates metadata with the authorization token. * diff --git a/lib/Google/vendor/google/auth/src/GetUniverseDomainInterface.php b/lib/Google/vendor/google/auth/src/GetUniverseDomainInterface.php new file mode 100644 index 000000000..1656ddc2e --- /dev/null +++ b/lib/Google/vendor/google/auth/src/GetUniverseDomainInterface.php @@ -0,0 +1,35 @@ +withHeader('authorization', 'Bearer ' . $this->fetchToken()); + $request = $this->addAuthHeaders($request); if ($quotaProject = $this->getQuotaProject()) { $request = $request->withHeader( @@ -113,32 +119,33 @@ public function __invoke(callable $handler) } /** - * Call fetcher to fetch the token. + * Adds auth related headers to the request. * - * @return string|null + * @param RequestInterface $request + * @return RequestInterface */ - private function fetchToken() + private function addAuthHeaders(RequestInterface $request) { - $auth_tokens = (array) $this->fetcher->fetchAuthToken($this->httpHandler); - - if (array_key_exists('access_token', $auth_tokens)) { - // notify the callback if applicable - if ($this->tokenCallback) { - call_user_func( - $this->tokenCallback, - $this->fetcher->getCacheKey(), - $auth_tokens['access_token'] - ); - } - - return $auth_tokens['access_token']; + if (!$this->fetcher instanceof UpdateMetadataInterface || + ($this->fetcher instanceof FetchAuthTokenCache && + !$this->fetcher->getFetcher() instanceof UpdateMetadataInterface) + ) { + $token = $this->fetcher->fetchAuthToken(); + $request = $request->withHeader( + 'authorization', 'Bearer ' . ($token['access_token'] ?? $token['id_token']) + ); + } else { + $headers = $this->fetcher->updateMetadata($request->getHeaders(), null, $this->httpHandler); + $request = Utils::modifyRequest($request, ['set_headers' => $headers]); } - if (array_key_exists('id_token', $auth_tokens)) { - return $auth_tokens['id_token']; + if ($this->tokenCallback && ($token = $this->fetcher->getLastReceivedToken())) { + if (array_key_exists('access_token', $token)) { + call_user_func($this->tokenCallback, $this->fetcher->getCacheKey(), $token['access_token']); + } } - return null; + return $request; } /** diff --git a/lib/Google/vendor/google/cloud-core/VERSION b/lib/Google/vendor/google/cloud-core/VERSION index 4b7e78db0..a91664e0a 100644 --- a/lib/Google/vendor/google/cloud-core/VERSION +++ b/lib/Google/vendor/google/cloud-core/VERSION @@ -1 +1 @@ -1.52.8 +1.52.10 diff --git a/lib/Google/vendor/google/cloud-core/src/RequestWrapper.php b/lib/Google/vendor/google/cloud-core/src/RequestWrapper.php index f45e7a7a5..79c2f142e 100644 --- a/lib/Google/vendor/google/cloud-core/src/RequestWrapper.php +++ b/lib/Google/vendor/google/cloud-core/src/RequestWrapper.php @@ -17,10 +17,12 @@ namespace Google\Cloud\Core; +use Google\Auth\FetchAuthTokenCache; use Google\Auth\FetchAuthTokenInterface; use Google\Auth\GetQuotaProjectInterface; use Google\Auth\HttpHandler\Guzzle6HttpHandler; use Google\Auth\HttpHandler\HttpHandlerFactory; +use Google\Auth\UpdateMetadataInterface; use Google\Cloud\Core\Exception\ServiceException; use Google\Cloud\Core\RequestWrapperTrait; use GuzzleHttp\Exception\RequestException; @@ -305,48 +307,60 @@ private function applyHeaders(RequestInterface $request, array $options = []) unset($options['retryHeaders']); } + $request = Utils::modifyRequest($request, ['set_headers' => $headers]); + if ($this->shouldSignRequest) { $quotaProject = $this->quotaProject; - $token = null; if ($this->accessToken) { - $token = $this->accessToken; + $request = $request->withHeader('authorization', 'Bearer ' . $this->accessToken); } else { $credentialsFetcher = $this->getCredentialsFetcher(); - $token = $this->fetchCredentials($credentialsFetcher)['access_token']; + $request = $this->addAuthHeaders($request, $credentialsFetcher); if ($credentialsFetcher instanceof GetQuotaProjectInterface) { $quotaProject = $credentialsFetcher->getQuotaProject(); } } - $headers['Authorization'] = 'Bearer ' . $token; - if ($quotaProject) { - $headers['X-Goog-User-Project'] = [$quotaProject]; + $request = $request->withHeader('X-Goog-User-Project', $quotaProject); } } - return Utils::modifyRequest($request, ['set_headers' => $headers]); + return $request; } /** - * Fetches credentials. + * Adds auth headers to the request. * - * @param FetchAuthTokenInterface $credentialsFetcher + * @param RequestInterface $request + * @param FetchAuthTokenInterface $fetcher * @return array * @throws ServiceException */ - private function fetchCredentials(FetchAuthTokenInterface $credentialsFetcher) + private function addAuthHeaders(RequestInterface $request, FetchAuthTokenInterface $fetcher) { $backoff = new ExponentialBackoff($this->retries, $this->getRetryFunction()); try { return $backoff->execute( - function () use ($credentialsFetcher) { - if ($token = $credentialsFetcher->fetchAuthToken($this->authHttpHandler)) { - return $token; + function () use ($request, $fetcher) { + if (!$fetcher instanceof UpdateMetadataInterface || + ($fetcher instanceof FetchAuthTokenCache && + !$fetcher->getFetcher() instanceof UpdateMetadataInterface + ) + ) { + // This covers an edge case where the token fetcher does not implement UpdateMetadataInterface, + // which only would happen if a user implemented a custom fetcher + if ($token = $fetcher->fetchAuthToken($this->authHttpHandler)) { + return $request->withHeader('authorization', 'Bearer ' . $token['access_token']); + } + } else { + $headers = $fetcher->updateMetadata($request->getHeaders(), null, $this->authHttpHandler); + return Utils::modifyRequest($request, ['set_headers' => $headers]); } + // As we do not know the reason the credentials fetcher could not fetch the // token, we should not retry. throw new \RuntimeException('Unable to fetch token'); diff --git a/lib/Google/vendor/google/cloud-core/src/Testing/TestHelpers.php b/lib/Google/vendor/google/cloud-core/src/Testing/TestHelpers.php index 3e6c39772..2e832559b 100644 --- a/lib/Google/vendor/google/cloud-core/src/Testing/TestHelpers.php +++ b/lib/Google/vendor/google/cloud-core/src/Testing/TestHelpers.php @@ -186,6 +186,8 @@ public static function systemBootstrap() SystemTestCase::setupQueue(); + // also set up the generated system tests + self::generatedSystemTestBootstrap(); $bootstraps = glob(self::projectRoot() .'/*tests/System/bootstrap.php'); foreach ($bootstraps as $bootstrap) { require_once $bootstrap; @@ -212,7 +214,7 @@ public static function generatedSystemTestBootstrap() putenv("GOOGLE_APPLICATION_CREDENTIALS=$keyFilePath"); $keyFileData = json_decode(file_get_contents($keyFilePath), true); putenv('PROJECT_ID=' . $keyFileData['project_id']); - + putenv('GOOGLE_PROJECT_ID=' . $keyFileData['project_id']); } /** diff --git a/lib/Google/vendor/google/cloud-storage/VERSION b/lib/Google/vendor/google/cloud-storage/VERSION index 2b17ffd50..39fc130ef 100644 --- a/lib/Google/vendor/google/cloud-storage/VERSION +++ b/lib/Google/vendor/google/cloud-storage/VERSION @@ -1 +1 @@ -1.34.0 +1.36.0 diff --git a/lib/Google/vendor/google/cloud-storage/src/Bucket.php b/lib/Google/vendor/google/cloud-storage/src/Bucket.php index 68279fb11..cc215b1db 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Bucket.php +++ b/lib/Google/vendor/google/cloud-storage/src/Bucket.php @@ -267,6 +267,13 @@ public function exists(array $options = []) * Acceptable values include, `"authenticatedRead"`, * `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, * `"projectPrivate"`, and `"publicRead"`. + * @type array $retention The full list of available options are outlined + * at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body). + * @type string $retention.retainUntilTime The earliest time in RFC 3339 + * UTC "Zulu" format that the object can be deleted or replaced. + * This is the retention configuration set for this object. + * @type string $retention.mode The mode of the retention configuration, + * which can be either `"Unlocked"` or `"Locked"`. * @type array $metadata The full list of available options are outlined * at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/insert#request-body). * @type array $metadata.metadata User-provided metadata, in key/value pairs. diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php index b32ed878d..2b37bb283 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/Rest.php @@ -431,6 +431,12 @@ private function resolveUploadOptions(array $args) } $args['metadata']['name'] = $args['name']; + if (isset($args['retention'])) { + // during object creation retention properties go into metadata + // but not into request body + $args['metadata']['retention'] = $args['retention']; + unset($args['retention']); + } unset($args['name']); $args['contentType'] = $args['metadata']['contentType'] ?? MimeType::fromFilename($args['metadata']['name']); diff --git a/lib/Google/vendor/google/cloud-storage/src/Connection/ServiceDefinition/storage-v1.json b/lib/Google/vendor/google/cloud-storage/src/Connection/ServiceDefinition/storage-v1.json index f4a150b2f..25303d3bf 100644 --- a/lib/Google/vendor/google/cloud-storage/src/Connection/ServiceDefinition/storage-v1.json +++ b/lib/Google/vendor/google/cloud-storage/src/Connection/ServiceDefinition/storage-v1.json @@ -474,7 +474,7 @@ "properties": { "retentionDurationSeconds": { "type": "string", - "description": "The period of time in seconds, that soft-deleted objects in the bucket will be retained and cannot be permanently deleted.", + "description": "The duration in seconds that soft-deleted objects in the bucket will be retained and cannot be permanently deleted.", "format": "int64" }, "effectiveTime": { @@ -528,6 +528,84 @@ } } }, + "AnywhereCache": { + "id": "AnywhereCache", + "type": "object", + "description": "An Anywhere Cache instance.", + "properties": { + "kind": { + "type": "string", + "description": "The kind of item this is. For Anywhere Cache, this is always storage#anywhereCache.", + "default": "storage#anywhereCache" + }, + "id": { + "type": "string", + "description": "The ID of the resource, including the project number, bucket name and anywhere cache ID." + }, + "selfLink": { + "type": "string", + "description": "The link to this cache instance." + }, + "bucket": { + "type": "string", + "description": "The name of the bucket containing this cache instance." + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of the Anywhere cache instance." + }, + "state": { + "type": "string", + "description": "The current state of the cache instance." + }, + "createTime": { + "type": "string", + "description": "The creation time of the cache instance in RFC 3339 format.", + "format": "date-time" + }, + "updateTime": { + "type": "string", + "description": "The modification time of the cache instance metadata in RFC 3339 format.", + "format": "date-time" + }, + "ttl": { + "type": "string", + "description": "The TTL of all cache entries in whole seconds. e.g., \"7200s\". ", + "format": "google-duration" + }, + "admissionPolicy": { + "type": "string", + "description": "The cache-level entry admission policy." + }, + "pendingUpdate": { + "type": "boolean", + "description": "True if the cache instance has an active Update long-running operation." + } + } + }, + "AnywhereCaches": { + "id": "AnywhereCaches", + "type": "object", + "description": "A list of Anywhere Caches.", + "properties": { + "kind": { + "type": "string", + "description": "The kind of item this is. For lists of Anywhere Caches, this is always storage#anywhereCaches.", + "default": "storage#anywhereCaches" + }, + "nextPageToken": { + "type": "string", + "description": "The continuation token, used to page through large result sets. Provide this value in a subsequent request to return the next page of results." + }, + "items": { + "type": "array", + "description": "The list of items.", + "items": { + "$ref": "AnywhereCache" + } + } + } + }, "BucketAccessControl": { "id": "BucketAccessControl", "type": "object", @@ -1601,6 +1679,242 @@ } }, "resources": { + "anywhereCache": { + "methods": { + "insert": { + "id": "storage.anywhereCaches.insert", + "path": "b/{bucket}/anywhereCaches", + "httpMethod": "POST", + "description": "Creates an Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket" + ], + "request": { + "$ref": "AnywhereCache" + }, + "response": { + "$ref": "GoogleLongrunningOperation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "update": { + "id": "storage.anywhereCaches.update", + "path": "b/{bucket}/anywhereCaches/{anywhereCacheId}", + "httpMethod": "PATCH", + "description": "Updates the config(ttl and admissionPolicy) of an Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of requested Anywhere Cache instance.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket", + "anywhereCacheId" + ], + "request": { + "$ref": "AnywhereCache" + }, + "response": { + "$ref": "GoogleLongrunningOperation" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "get": { + "id": "storage.anywhereCaches.get", + "path": "b/{bucket}/anywhereCaches/{anywhereCacheId}", + "httpMethod": "GET", + "description": "Returns the metadata of an Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of requested Anywhere Cache instance.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket", + "anywhereCacheId" + ], + "response": { + "$ref": "AnywhereCache" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_only", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "list": { + "id": "storage.anywhereCaches.list", + "path": "b/{bucket}/anywhereCache", + "httpMethod": "GET", + "description": "Returns a list of Anywhere Cache instances of the bucket matching the criteria.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "pageSize": { + "type": "integer", + "description": "Maximum number of items return in a single page of responses. Maximum 1000.", + "format": "int32", + "minimum": "0", + "location": "query" + }, + "pageToken": { + "type": "string", + "description": "A previously-returned page token representing part of the larger set of results to view.", + "location": "query" + } + }, + "parameterOrder": [ + "bucket" + ], + "response": { + "$ref": "AnywhereCaches" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/cloud-platform.read-only", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_only", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "pause": { + "id": "storage.anywhereCaches.pause", + "path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/pause", + "httpMethod": "POST", + "description": "Pauses an Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of requested Anywhere Cache instance.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket", + "anywhereCacheId" + ], + "response": { + "$ref": "AnywhereCache" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "resume": { + "id": "storage.anywhereCaches.resume", + "path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/resume", + "httpMethod": "POST", + "description": "Resumes a paused or disabled Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of requested Anywhere Cache instance.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket", + "anywhereCacheId" + ], + "response": { + "$ref": "AnywhereCache" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + }, + "disable": { + "id": "storage.anywhereCaches.disable", + "path": "b/{bucket}/anywhereCaches/{anywhereCacheId}/disable", + "httpMethod": "POST", + "description": "Disables an Anywhere Cache instance.", + "parameters": { + "bucket": { + "type": "string", + "description": "Name of the partent bucket", + "required": true, + "location": "path" + }, + "anywhereCacheId": { + "type": "string", + "description": "The ID of requested Anywhere Cache instance.", + "required": true, + "location": "path" + } + }, + "parameterOrder": [ + "bucket", + "anywhereCacheId" + ], + "response": { + "$ref": "AnywhereCache" + }, + "scopes": [ + "https://www.googleapis.com/auth/cloud-platform", + "https://www.googleapis.com/auth/devstorage.full_control", + "https://www.googleapis.com/auth/devstorage.read_write" + ] + } + } + }, "bucketAccessControls": { "methods": { "delete": { @@ -5072,6 +5386,6 @@ } } }, - "revision": "20231012", - "etag": "\"3133333835393639383131353638313238353437\"" + "revision": "20231028", + "etag": "\"39383633393336373936373236333033393737\"" } diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php index 8613e0a5e..d79ef9f03 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageClient.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageClient.php @@ -47,7 +47,7 @@ class StorageClient use ArrayTrait; use ClientTrait; - const VERSION = '1.34.0'; + const VERSION = '1.36.0'; const FULL_CONTROL_SCOPE = 'https://www.googleapis.com/auth/devstorage.full_control'; const READ_ONLY_SCOPE = 'https://www.googleapis.com/auth/devstorage.read_only'; @@ -271,6 +271,10 @@ function (array $bucket) use ($userProject) { * `"projectPrivate"`, and `"publicRead"`. * @type string $predefinedDefaultObjectAcl Apply a predefined set of * default object access controls to this bucket. + * @type bool $enableObjectRetention Whether object retention should + * be enabled on this bucket. For more information, refer to the + * [Object Retention Lock](https://cloud.google.com/storage/docs/object-lock) + * documentation. * @type string $projection Determines which properties to return. May * be either `"full"` or `"noAcl"`. **Defaults to** `"noAcl"`, * unless the bucket resource specifies acl or defaultObjectAcl diff --git a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php index 724782b3b..e2c207a12 100644 --- a/lib/Google/vendor/google/cloud-storage/src/StorageObject.php +++ b/lib/Google/vendor/google/cloud-storage/src/StorageObject.php @@ -224,6 +224,18 @@ public function delete(array $options = []) * Acceptable values include, `"authenticatedRead"`, * `"bucketOwnerFullControl"`, `"bucketOwnerRead"`, `"private"`, * `"projectPrivate"`, and `"publicRead"`. + * @type array $retention The full list of available options are outlined + * at the [JSON API docs](https://cloud.google.com/storage/docs/json_api/v1/objects/update#request-body). + * @type string $retention.retainUntilTime The earliest time in RFC 3339 + * UTC "Zulu" format that the object can be deleted or replaced. + * This is the retention configuration set for this object. + * @type string $retention.mode The mode of the retention configuration, + * which can be either `"Unlocked"` or `"Locked"`. + * @type bool $overrideUnlockedRetention Applicable for objects that + * have an unlocked retention configuration. Required to be set to + * `true` if the operation includes a retention property that + * changes the mode to `Locked`, reduces the `retainUntilTime`, or + * removes the retention configuration from the object. * @type string $projection Determines which properties to return. May * be either 'full' or 'noAcl'. * @type string $fields Selector which will cause the response to only diff --git a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md index 990b86c9e..13709d1b8 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/guzzle/CHANGELOG.md @@ -3,6 +3,14 @@ Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. +## 7.8.1 - 2023-12-03 + +### Changed + +- Updated links in docs to their canonical versions +- Replaced `call_user_func*` with native calls + + ## 7.8.0 - 2023-08-27 ### Added @@ -643,7 +651,8 @@ object). * Note: This has been changed in 5.0.3 to now encode query string values by default unless the `rawString` argument is provided when setting the query string on a URL: Now allowing many more characters to be present in the - query string without being percent encoded. See https://tools.ietf.org/html/rfc3986#appendix-A + query string without being percent encoded. See + https://datatracker.ietf.org/doc/html/rfc3986#appendix-A ## 5.0.1 - 2014-10-16 @@ -1182,7 +1191,7 @@ interfaces. ## 3.4.0 - 2013-04-11 -* Bug fix: URLs are now resolved correctly based on https://tools.ietf.org/html/rfc3986#section-5.2. #289 +* Bug fix: URLs are now resolved correctly based on https://datatracker.ietf.org/doc/html/rfc3986#section-5.2. #289 * Bug fix: Absolute URLs with a path in a service description will now properly override the base URL. #289 * Bug fix: Parsing a query string with a single PHP array value will now result in an array. #263 * Bug fix: Better normalization of the User-Agent header to prevent duplicate headers. #264. diff --git a/lib/Google/vendor/guzzlehttp/guzzle/README.md b/lib/Google/vendor/guzzlehttp/guzzle/README.md index 0786462b3..6d78a9309 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/README.md +++ b/lib/Google/vendor/guzzlehttp/guzzle/README.md @@ -3,7 +3,7 @@ # Guzzle, PHP HTTP client [![Latest Version](https://img.shields.io/github/release/guzzle/guzzle.svg?style=flat-square)](https://github.com/guzzle/guzzle/releases) -[![Build Status](https://img.shields.io/github/workflow/status/guzzle/guzzle/CI?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) +[![Build Status](https://img.shields.io/github/actions/workflow/status/guzzle/guzzle/ci.yml?label=ci%20build&style=flat-square)](https://github.com/guzzle/guzzle/actions?query=workflow%3ACI) [![Total Downloads](https://img.shields.io/packagist/dt/guzzlehttp/guzzle.svg?style=flat-square)](https://packagist.org/packages/guzzlehttp/guzzle) Guzzle is a PHP HTTP client that makes it easy to send HTTP requests and @@ -66,7 +66,7 @@ composer require guzzlehttp/guzzle | 4.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v4][guzzle-4-repo] | N/A | No | >=5.4,<7.0 | | 5.x | EOL | `guzzlehttp/guzzle` | `GuzzleHttp` | [v5][guzzle-5-repo] | [v5][guzzle-5-docs] | No | >=5.4,<7.4 | | 6.x | Security fixes only | `guzzlehttp/guzzle` | `GuzzleHttp` | [v6][guzzle-6-repo] | [v6][guzzle-6-docs] | Yes | >=5.5,<8.0 | -| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >=7.2.5,<8.3 | +| 7.x | Latest | `guzzlehttp/guzzle` | `GuzzleHttp` | [v7][guzzle-7-repo] | [v7][guzzle-7-docs] | Yes | >=7.2.5,<8.4 | [guzzle-3-repo]: https://github.com/guzzle/guzzle3 [guzzle-4-repo]: https://github.com/guzzle/guzzle/tree/4.x diff --git a/lib/Google/vendor/guzzlehttp/guzzle/UPGRADING.md b/lib/Google/vendor/guzzlehttp/guzzle/UPGRADING.md index 8fa0afb5d..4efbb5962 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/UPGRADING.md +++ b/lib/Google/vendor/guzzlehttp/guzzle/UPGRADING.md @@ -189,11 +189,11 @@ $client = new GuzzleHttp\Client(['handler' => $handler]); ## POST Requests -This version added the [`form_params`](http://guzzle.readthedocs.org/en/latest/request-options.html#form_params) +This version added the [`form_params`](https://docs.guzzlephp.org/en/latest/request-options.html#form_params) and `multipart` request options. `form_params` is an associative array of strings or array of strings and is used to serialize an `application/x-www-form-urlencoded` POST request. The -[`multipart`](http://guzzle.readthedocs.org/en/latest/request-options.html#multipart) +[`multipart`](https://docs.guzzlephp.org/en/latest/request-options.html#multipart) option is now used to send a multipart/form-data POST request. `GuzzleHttp\Post\PostFile` has been removed. Use the `multipart` option to add @@ -209,7 +209,7 @@ The `base_url` option has been renamed to `base_uri`. ## Rewritten Adapter Layer -Guzzle now uses [RingPHP](http://ringphp.readthedocs.org/en/latest) to send +Guzzle now uses [RingPHP](https://ringphp.readthedocs.org/en/latest) to send HTTP requests. The `adapter` option in a `GuzzleHttp\Client` constructor is still supported, but it has now been renamed to `handler`. Instead of passing a `GuzzleHttp\Adapter\AdapterInterface`, you must now pass a PHP @@ -575,7 +575,7 @@ You can intercept a request and inject a response using the `intercept()` event of a `GuzzleHttp\Event\BeforeEvent`, `GuzzleHttp\Event\CompleteEvent`, and `GuzzleHttp\Event\ErrorEvent` event. -See: http://docs.guzzlephp.org/en/latest/events.html +See: https://docs.guzzlephp.org/en/latest/events.html ## Inflection @@ -668,9 +668,9 @@ in separate repositories: The service description layer of Guzzle has moved into two separate packages: -- http://github.com/guzzle/command Provides a high level abstraction over web +- https://github.com/guzzle/command Provides a high level abstraction over web services by representing web service operations using commands. -- http://github.com/guzzle/guzzle-services Provides an implementation of +- https://github.com/guzzle/guzzle-services Provides an implementation of guzzle/command that provides request serialization and response parsing using Guzzle service descriptions. @@ -870,7 +870,7 @@ HeaderInterface (e.g. toArray(), getAll(), etc.). 3.3 to 3.4 ---------- -Base URLs of a client now follow the rules of https://tools.ietf.org/html/rfc3986#section-5.2.2 when merging URLs. +Base URLs of a client now follow the rules of https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.2 when merging URLs. 3.2 to 3.3 ---------- diff --git a/lib/Google/vendor/guzzlehttp/guzzle/composer.json b/lib/Google/vendor/guzzlehttp/guzzle/composer.json index 72defd614..69583d7cc 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/composer.json +++ b/lib/Google/vendor/guzzlehttp/guzzle/composer.json @@ -63,10 +63,10 @@ }, "require-dev": { "ext-curl": "*", - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "php-http/client-integration-tests": "dev-master#2c025848417c1135031fdf9c728ee53d0a7ceaee as 3.0.999", "php-http/message-factory": "^1.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23", + "phpunit/phpunit": "^8.5.36 || ^9.6.15", "psr/log": "^1.1 || ^2.0 || ^3.0" }, "suggest": { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php index fa2b10a8c..c29b4b7e9 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/CookieJar.php @@ -243,7 +243,7 @@ public function extractCookies(RequestInterface $request, ResponseInterface $res /** * Computes cookie path following RFC 6265 section 5.1.4 * - * @see https://tools.ietf.org/html/rfc6265#section-5.1.4 + * @see https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.4 */ private function getCookiePathFromRequest(RequestInterface $request): string { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php index d74915bed..c9806da88 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Cookie/SetCookie.php @@ -420,7 +420,7 @@ public function matchesDomain(string $domain): bool } // Remove the leading '.' as per spec in RFC 6265. - // https://tools.ietf.org/html/rfc6265#section-5.2.3 + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.2.3 $cookieDomain = \ltrim(\strtolower($cookieDomain), '.'); $domain = \strtolower($domain); @@ -431,7 +431,7 @@ public function matchesDomain(string $domain): bool } // Matching the subdomain according to RFC 6265. - // https://tools.ietf.org/html/rfc6265#section-5.1.3 + // https://datatracker.ietf.org/doc/html/rfc6265#section-5.1.3 if (\filter_var($domain, \FILTER_VALIDATE_IP)) { return false; } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php index be88d9e49..16a942232 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php @@ -256,7 +256,7 @@ private function applyMethod(EasyHandle $easy, array &$conf): void $method = $easy->request->getMethod(); if ($method === 'PUT' || $method === 'POST') { - // See https://tools.ietf.org/html/rfc7230#section-3.3.2 + // See https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2 if (!$easy->request->hasHeader('Content-Length')) { $conf[\CURLOPT_HTTPHEADER][] = 'Content-Length: 0'; } diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/RequestOptions.php b/lib/Google/vendor/guzzlehttp/guzzle/src/RequestOptions.php index bf3b02b6b..a38768c0c 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/RequestOptions.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/RequestOptions.php @@ -5,9 +5,7 @@ /** * This class contains a list of built-in Guzzle request options. * - * More documentation for each option can be found at http://guzzlephp.org/. - * - * @see http://docs.guzzlephp.org/en/v6/request-options.html + * @see https://docs.guzzlephp.org/en/latest/request-options.html */ final class RequestOptions { diff --git a/lib/Google/vendor/guzzlehttp/guzzle/src/Utils.php b/lib/Google/vendor/guzzlehttp/guzzle/src/Utils.php index fcf571d6b..93d6d39cd 100644 --- a/lib/Google/vendor/guzzlehttp/guzzle/src/Utils.php +++ b/lib/Google/vendor/guzzlehttp/guzzle/src/Utils.php @@ -176,14 +176,13 @@ public static function defaultCaBundle(): string PHP versions earlier than 5.6 are not properly configured to use the system's CA bundle by default. In order to verify peer certificates, you will need to supply the path on disk to a certificate bundle to the 'verify' request -option: http://docs.guzzlephp.org/en/latest/clients.html#verify. If you do not -need a specific certificate bundle, then Mozilla provides a commonly used CA -bundle which can be downloaded here (provided by the maintainer of cURL): -https://curl.haxx.se/ca/cacert.pem. Once -you have a CA bundle available on disk, you can set the 'openssl.cafile' PHP -ini setting to point to the path to the file, allowing you to omit the 'verify' -request option. See https://curl.haxx.se/docs/sslcerts.html for more -information. +option: https://docs.guzzlephp.org/en/latest/request-options.html#verify. If +you do not need a specific certificate bundle, then Mozilla provides a commonly +used CA bundle which can be downloaded here (provided by the maintainer of +cURL): https://curl.haxx.se/ca/cacert.pem. Once you have a CA bundle available +on disk, you can set the 'openssl.cafile' PHP ini setting to point to the path +to the file, allowing you to omit the 'verify' request option. See +https://curl.haxx.se/docs/sslcerts.html for more information. EOT ); } diff --git a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md index eaf2af426..c73afb903 100644 --- a/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/promises/CHANGELOG.md @@ -1,6 +1,13 @@ # CHANGELOG +## 2.0.2 - 2023-12-03 + +### Changed + +- Replaced `call_user_func*` with native calls + + ## 2.0.1 - 2023-08-03 ### Changed diff --git a/lib/Google/vendor/guzzlehttp/promises/composer.json b/lib/Google/vendor/guzzlehttp/promises/composer.json index fc1989ec1..6c5bdd662 100644 --- a/lib/Google/vendor/guzzlehttp/promises/composer.json +++ b/lib/Google/vendor/guzzlehttp/promises/composer.json @@ -29,8 +29,8 @@ "php": "^7.2.5 || ^8.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "bamarni/composer-bin-plugin": "^1.8.2", + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "autoload": { "psr-4": { diff --git a/lib/Google/vendor/guzzlehttp/promises/src/Each.php b/lib/Google/vendor/guzzlehttp/promises/src/Each.php index 1a7aa0fb6..c09d23c60 100644 --- a/lib/Google/vendor/guzzlehttp/promises/src/Each.php +++ b/lib/Google/vendor/guzzlehttp/promises/src/Each.php @@ -19,9 +19,7 @@ final class Each * index, and the aggregate promise. The callback can invoke any necessary * side effects and choose to resolve or reject the aggregate if needed. * - * @param mixed $iterable Iterator or array to iterate over. - * @param callable $onFulfilled - * @param callable $onRejected + * @param mixed $iterable Iterator or array to iterate over. */ public static function of( $iterable, @@ -44,8 +42,6 @@ public static function of( * * @param mixed $iterable * @param int|callable $concurrency - * @param callable $onFulfilled - * @param callable $onRejected */ public static function ofLimit( $iterable, @@ -67,7 +63,6 @@ public static function ofLimit( * * @param mixed $iterable * @param int|callable $concurrency - * @param callable $onFulfilled */ public static function ofLimitAll( $iterable, diff --git a/lib/Google/vendor/guzzlehttp/promises/src/EachPromise.php b/lib/Google/vendor/guzzlehttp/promises/src/EachPromise.php index 28dd9793a..e12389818 100644 --- a/lib/Google/vendor/guzzlehttp/promises/src/EachPromise.php +++ b/lib/Google/vendor/guzzlehttp/promises/src/EachPromise.php @@ -135,7 +135,7 @@ private function refillPending(): void // Add only up to N pending promises. $concurrency = is_callable($this->concurrency) - ? call_user_func($this->concurrency, count($this->pending)) + ? ($this->concurrency)(count($this->pending)) : $this->concurrency; $concurrency = max($concurrency - count($this->pending), 0); // Concurrency may be set to 0 to disallow new promises. @@ -170,8 +170,7 @@ private function addPending(): bool $this->pending[$idx] = $promise->then( function ($value) use ($idx, $key): void { if ($this->onFulfilled) { - call_user_func( - $this->onFulfilled, + ($this->onFulfilled)( $value, $key, $this->aggregate @@ -181,8 +180,7 @@ function ($value) use ($idx, $key): void { }, function ($reason) use ($idx, $key): void { if ($this->onRejected) { - call_user_func( - $this->onRejected, + ($this->onRejected)( $reason, $key, $this->aggregate diff --git a/lib/Google/vendor/guzzlehttp/promises/src/RejectionException.php b/lib/Google/vendor/guzzlehttp/promises/src/RejectionException.php index 47dca8624..72a81ba20 100644 --- a/lib/Google/vendor/guzzlehttp/promises/src/RejectionException.php +++ b/lib/Google/vendor/guzzlehttp/promises/src/RejectionException.php @@ -18,7 +18,7 @@ class RejectionException extends \RuntimeException * @param mixed $reason Rejection reason. * @param string|null $description Optional description. */ - public function __construct($reason, ?string $description = null) + public function __construct($reason, string $description = null) { $this->reason = $reason; diff --git a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md index d897feedd..fe3eda70a 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md +++ b/lib/Google/vendor/guzzlehttp/psr7/CHANGELOG.md @@ -5,6 +5,17 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 2.6.2 - 2023-12-03 + +### Fixed + +- Fixed another issue with the fact that PHP transforms numeric strings in array keys to ints + +### Changed + +- Updated links in docs to their canonical versions +- Replaced `call_user_func*` with native calls + ## 2.6.1 - 2023-08-27 ### Fixed diff --git a/lib/Google/vendor/guzzlehttp/psr7/README.md b/lib/Google/vendor/guzzlehttp/psr7/README.md index a64ec9046..850fa9d70 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/README.md +++ b/lib/Google/vendor/guzzlehttp/psr7/README.md @@ -273,7 +273,7 @@ class EofCallbackStream implements StreamInterface // Invoke the callback when EOF is hit. if ($this->eof()) { - call_user_func($this->callback); + ($this->callback)(); } return $result; @@ -637,7 +637,7 @@ this library also provides additional functionality when working with URIs as st An instance of `Psr\Http\Message\UriInterface` can either be an absolute URI or a relative reference. An absolute URI has a scheme. A relative reference is used to express a URI relative to another URI, the base URI. Relative references can be divided into several forms according to -[RFC 3986 Section 4.2](https://tools.ietf.org/html/rfc3986#section-4.2): +[RFC 3986 Section 4.2](https://datatracker.ietf.org/doc/html/rfc3986#section-4.2): - network-path references, e.g. `//example.com/path` - absolute-path references, e.g. `/path` @@ -696,8 +696,8 @@ or the standard port. This method can be used independently of the implementatio `public static function composeComponents($scheme, $authority, $path, $query, $fragment): string` Composes a URI reference string from its various components according to -[RFC 3986 Section 5.3](https://tools.ietf.org/html/rfc3986#section-5.3). Usually this method does not need to be called -manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. +[RFC 3986 Section 5.3](https://datatracker.ietf.org/doc/html/rfc3986#section-5.3). Usually this method does not need +to be called manually but instead is used indirectly via `Psr\Http\Message\UriInterface::__toString`. ### `GuzzleHttp\Psr7\Uri::fromParts` @@ -741,8 +741,8 @@ Determines if a modified URL should be considered cross-origin with respect to a ## Reference Resolution `GuzzleHttp\Psr7\UriResolver` provides methods to resolve a URI reference in the context of a base URI according -to [RFC 3986 Section 5](https://tools.ietf.org/html/rfc3986#section-5). This is for example also what web browsers -do when resolving a link in a website based on the current request URI. +to [RFC 3986 Section 5](https://datatracker.ietf.org/doc/html/rfc3986#section-5). This is for example also what web +browsers do when resolving a link in a website based on the current request URI. ### `GuzzleHttp\Psr7\UriResolver::resolve` @@ -755,7 +755,7 @@ Converts the relative URI into a new URI that is resolved against the base URI. `public static function removeDotSegments(string $path): string` Removes dot segments from a path and returns the new path according to -[RFC 3986 Section 5.2.4](https://tools.ietf.org/html/rfc3986#section-5.2.4). +[RFC 3986 Section 5.2.4](https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4). ### `GuzzleHttp\Psr7\UriResolver::relativize` @@ -781,7 +781,7 @@ echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // pr ## Normalization and Comparison `GuzzleHttp\Psr7\UriNormalizer` provides methods to normalize and compare URIs according to -[RFC 3986 Section 6](https://tools.ietf.org/html/rfc3986#section-6). +[RFC 3986 Section 6](https://datatracker.ietf.org/doc/html/rfc3986#section-6). ### `GuzzleHttp\Psr7\UriNormalizer::normalize` diff --git a/lib/Google/vendor/guzzlehttp/psr7/composer.json b/lib/Google/vendor/guzzlehttp/psr7/composer.json index d51dd622e..70293fc40 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/composer.json +++ b/lib/Google/vendor/guzzlehttp/psr7/composer.json @@ -60,9 +60,9 @@ "psr/http-message-implementation": "1.0" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8.1", + "bamarni/composer-bin-plugin": "^1.8.2", "http-interop/http-factory-tests": "^0.9", - "phpunit/phpunit": "^8.5.29 || ^9.5.23" + "phpunit/phpunit": "^8.5.36 || ^9.6.15" }, "suggest": { "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/FnStream.php b/lib/Google/vendor/guzzlehttp/psr7/src/FnStream.php index 9fdddb9c6..9e6a7f31a 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/FnStream.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/FnStream.php @@ -54,7 +54,7 @@ public function __get(string $name): void public function __destruct() { if (isset($this->_fn_close)) { - call_user_func($this->_fn_close); + ($this->_fn_close)(); } } @@ -93,7 +93,8 @@ public static function decorate(StreamInterface $stream, array $methods) public function __toString(): string { try { - return call_user_func($this->_fn___toString); + /** @var string */ + return ($this->_fn___toString)(); } catch (\Throwable $e) { if (\PHP_VERSION_ID >= 70400) { throw $e; @@ -106,67 +107,67 @@ public function __toString(): string public function close(): void { - call_user_func($this->_fn_close); + ($this->_fn_close)(); } public function detach() { - return call_user_func($this->_fn_detach); + return ($this->_fn_detach)(); } public function getSize(): ?int { - return call_user_func($this->_fn_getSize); + return ($this->_fn_getSize)(); } public function tell(): int { - return call_user_func($this->_fn_tell); + return ($this->_fn_tell)(); } public function eof(): bool { - return call_user_func($this->_fn_eof); + return ($this->_fn_eof)(); } public function isSeekable(): bool { - return call_user_func($this->_fn_isSeekable); + return ($this->_fn_isSeekable)(); } public function rewind(): void { - call_user_func($this->_fn_rewind); + ($this->_fn_rewind)(); } public function seek($offset, $whence = SEEK_SET): void { - call_user_func($this->_fn_seek, $offset, $whence); + ($this->_fn_seek)($offset, $whence); } public function isWritable(): bool { - return call_user_func($this->_fn_isWritable); + return ($this->_fn_isWritable)(); } public function write($string): int { - return call_user_func($this->_fn_write, $string); + return ($this->_fn_write)($string); } public function isReadable(): bool { - return call_user_func($this->_fn_isReadable); + return ($this->_fn_isReadable)(); } public function read($length): string { - return call_user_func($this->_fn_read, $length); + return ($this->_fn_read)($length); } public function getContents(): string { - return call_user_func($this->_fn_getContents); + return ($this->_fn_getContents)(); } /** @@ -174,6 +175,6 @@ public function getContents(): string */ public function getMetadata($key = null) { - return call_user_func($this->_fn_getMetadata, $key); + return ($this->_fn_getMetadata)($key); } } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Header.php b/lib/Google/vendor/guzzlehttp/psr7/src/Header.php index 6e38e0031..bbce8b03d 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Header.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Header.php @@ -22,7 +22,7 @@ public static function parse($header): array foreach ((array) $header as $value) { foreach (self::splitList($value) as $val) { $part = []; - foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) { + foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) ?: [] as $kvp) { if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) { $m = $matches[0]; if (isset($m[1])) { diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/InflateStream.php b/lib/Google/vendor/guzzlehttp/psr7/src/InflateStream.php index 599b55da3..e674c9ab6 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/InflateStream.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/InflateStream.php @@ -13,9 +13,9 @@ * then appends the zlib.inflate filter. The stream is then converted back * to a Guzzle stream resource to be used as a Guzzle stream. * - * @see http://tools.ietf.org/html/rfc1950 - * @see http://tools.ietf.org/html/rfc1952 - * @see http://php.net/manual/en/filters.compression.php + * @see https://datatracker.ietf.org/doc/html/rfc1950 + * @see https://datatracker.ietf.org/doc/html/rfc1952 + * @see https://www.php.net/manual/en/filters.compression.php */ final class InflateStream implements StreamInterface { @@ -28,7 +28,7 @@ public function __construct(StreamInterface $stream) { $resource = StreamWrapper::getResource($stream); // Specify window=15+32, so zlib will use header detection to both gzip (with header) and zlib data - // See http://www.zlib.net/manual.html#Advanced definition of inflateInit2 + // See https://www.zlib.net/manual.html#Advanced definition of inflateInit2 // "Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection" // Default window size is 15. stream_filter_append($resource, 'zlib.inflate', STREAM_FILTER_READ, ['window' => 15 + 32]); diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Message.php b/lib/Google/vendor/guzzlehttp/psr7/src/Message.php index 6e6c3e51b..5561a5130 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Message.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Message.php @@ -146,7 +146,7 @@ public static function parseMessage(string $message): array // If these aren't the same, then one line didn't match and there's an invalid header. if ($count !== substr_count($rawHeaders, "\n")) { - // Folding is deprecated, see https://tools.ietf.org/html/rfc7230#section-3.2.4 + // Folding is deprecated, see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4 if (preg_match(Rfc7230::HEADER_FOLD_REGEX, $rawHeaders)) { throw new \InvalidArgumentException('Invalid header syntax: Obsolete line folding'); } @@ -227,9 +227,9 @@ public static function parseRequest(string $message): RequestInterface public static function parseResponse(string $message): ResponseInterface { $data = self::parseMessage($message); - // According to https://tools.ietf.org/html/rfc7230#section-3.1.2 the space - // between status-code and reason-phrase is required. But browsers accept - // responses without space and reason as well. + // According to https://datatracker.ietf.org/doc/html/rfc7230#section-3.1.2 + // the space between status-code and reason-phrase is required. But + // browsers accept responses without space and reason as well. if (!preg_match('/^HTTP\/.* [0-9]{3}( .*|$)/', $data['start-line'])) { throw new \InvalidArgumentException('Invalid response string: '.$data['start-line']); } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php index e05ebea88..65dbc4ba0 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/MessageTrait.php @@ -141,7 +141,7 @@ public function withBody(StreamInterface $body): MessageInterface } /** - * @param array $headers + * @param (string|string[])[] $headers */ private function setHeaders(array $headers): void { @@ -193,7 +193,7 @@ private function normalizeHeaderValue($value): array * * @return string[] Trimmed header values * - * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2.4 */ private function trimAndValidateHeaderValues(array $values): array { @@ -213,7 +213,7 @@ private function trimAndValidateHeaderValues(array $values): array } /** - * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 * * @param mixed $header */ @@ -234,7 +234,7 @@ private function assertHeader($header): void } /** - * @see https://tools.ietf.org/html/rfc7230#section-3.2 + * @see https://datatracker.ietf.org/doc/html/rfc7230#section-3.2 * * field-value = *( field-content / obs-fold ) * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/MultipartStream.php b/lib/Google/vendor/guzzlehttp/psr7/src/MultipartStream.php index 41c48eef8..d23fba8a3 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/MultipartStream.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/MultipartStream.php @@ -51,7 +51,7 @@ public function isWritable(): bool /** * Get the headers needed before transferring the content of a POST file * - * @param array $headers + * @param string[] $headers */ private function getHeaders(array $headers): string { @@ -112,10 +112,15 @@ private function addElement(AppendStream $stream, array $element): void $stream->addStream(Utils::streamFor("\r\n")); } + /** + * @param string[] $headers + * + * @return array{0: StreamInterface, 1: string[]} + */ private function createElement(string $name, StreamInterface $stream, ?string $filename, array $headers): array { // Set a default content-disposition header if one was no provided - $disposition = $this->getHeader($headers, 'content-disposition'); + $disposition = self::getHeader($headers, 'content-disposition'); if (!$disposition) { $headers['Content-Disposition'] = ($filename === '0' || $filename) ? sprintf( @@ -127,7 +132,7 @@ private function createElement(string $name, StreamInterface $stream, ?string $f } // Set a default content-length header if one was no provided - $length = $this->getHeader($headers, 'content-length'); + $length = self::getHeader($headers, 'content-length'); if (!$length) { if ($length = $stream->getSize()) { $headers['Content-Length'] = (string) $length; @@ -135,7 +140,7 @@ private function createElement(string $name, StreamInterface $stream, ?string $f } // Set a default Content-Type if one was not supplied - $type = $this->getHeader($headers, 'content-type'); + $type = self::getHeader($headers, 'content-type'); if (!$type && ($filename === '0' || $filename)) { $headers['Content-Type'] = MimeType::fromFilename($filename) ?? 'application/octet-stream'; } @@ -143,11 +148,14 @@ private function createElement(string $name, StreamInterface $stream, ?string $f return [$stream, $headers]; } - private function getHeader(array $headers, string $key) + /** + * @param string[] $headers + */ + private static function getHeader(array $headers, string $key): ?string { $lowercaseHeader = strtolower($key); foreach ($headers as $k => $v) { - if (strtolower($k) === $lowercaseHeader) { + if (strtolower((string) $k) === $lowercaseHeader) { return $v; } } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/PumpStream.php b/lib/Google/vendor/guzzlehttp/psr7/src/PumpStream.php index 5585190cf..e2040709f 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/PumpStream.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/PumpStream.php @@ -18,7 +18,7 @@ */ final class PumpStream implements StreamInterface { - /** @var callable|null */ + /** @var callable(int): (string|false|null)|null */ private $source; /** @var int|null */ @@ -163,9 +163,9 @@ public function getMetadata($key = null) private function pump(int $length): void { - if ($this->source) { + if ($this->source !== null) { do { - $data = call_user_func($this->source, $length); + $data = ($this->source)($length); if ($data === false || $data === null) { $this->source = null; diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Request.php b/lib/Google/vendor/guzzlehttp/psr7/src/Request.php index db29d95d3..faafe1ad8 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Request.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Request.php @@ -28,7 +28,7 @@ class Request implements RequestInterface /** * @param string $method HTTP method * @param string|UriInterface $uri URI - * @param array $headers Request headers + * @param (string|string[])[] $headers Request headers * @param string|resource|StreamInterface|null $body Request body * @param string $version Protocol version */ @@ -143,7 +143,7 @@ private function updateHostFromUri(): void $this->headerNames['host'] = 'Host'; } // Ensure Host is the first header. - // See: http://tools.ietf.org/html/rfc7230#section-5.4 + // See: https://datatracker.ietf.org/doc/html/rfc7230#section-5.4 $this->headers = [$header => [$host]] + $this->headers; } diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Response.php b/lib/Google/vendor/guzzlehttp/psr7/src/Response.php index 8fc11478b..00f16e2d9 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Response.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Response.php @@ -86,7 +86,7 @@ class Response implements ResponseInterface /** * @param int $status Status code - * @param array $headers Response headers + * @param (string|string[])[] $headers Response headers * @param string|resource|StreamInterface|null $body Response body * @param string $version Protocol version * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/ServerRequest.php b/lib/Google/vendor/guzzlehttp/psr7/src/ServerRequest.php index c852d96f5..3cc953453 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/ServerRequest.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/ServerRequest.php @@ -59,7 +59,7 @@ class ServerRequest extends Request implements ServerRequestInterface /** * @param string $method HTTP method * @param string|UriInterface $uri URI - * @param array $headers Request headers + * @param (string|string[])[] $headers Request headers * @param string|resource|StreamInterface|null $body Request body * @param string $version Protocol version * @param array $serverParams Typically the $_SERVER superglobal diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Stream.php b/lib/Google/vendor/guzzlehttp/psr7/src/Stream.php index f730ddacf..0aff9b2b7 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Stream.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Stream.php @@ -12,8 +12,8 @@ class Stream implements StreamInterface { /** - * @see http://php.net/manual/function.fopen.php - * @see http://php.net/manual/en/function.gzopen.php + * @see https://www.php.net/manual/en/function.fopen.php + * @see https://www.php.net/manual/en/function.gzopen.php */ private const READABLE_MODES = '/r|a\+|ab\+|w\+|wb\+|x\+|xb\+|c\+|cb\+/'; private const WRITABLE_MODES = '/a|w|r\+|rb\+|rw|x|c/'; diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php b/lib/Google/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php index 96196a3ea..601c13afb 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/StreamDecoratorTrait.php @@ -70,7 +70,7 @@ public function __call(string $method, array $args) { /** @var callable $callable */ $callable = [$this->stream, $method]; - $result = call_user_func_array($callable, $args); + $result = ($callable)(...$args); // Always return the wrapped object if the result is a return $this return $result === $this->stream ? $this : $result; diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/StreamWrapper.php b/lib/Google/vendor/guzzlehttp/psr7/src/StreamWrapper.php index b3655cb3a..ae8538814 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/StreamWrapper.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/StreamWrapper.php @@ -122,7 +122,21 @@ public function stream_cast(int $cast_as) } /** - * @return array + * @return array{ + * dev: int, + * ino: int, + * mode: int, + * nlink: int, + * uid: int, + * gid: int, + * rdev: int, + * size: int, + * atime: int, + * mtime: int, + * ctime: int, + * blksize: int, + * blocks: int + * } */ public function stream_stat(): array { @@ -152,7 +166,21 @@ public function stream_stat(): array } /** - * @return array + * @return array{ + * dev: int, + * ino: int, + * mode: int, + * nlink: int, + * uid: int, + * gid: int, + * rdev: int, + * size: int, + * atime: int, + * mtime: int, + * ctime: int, + * blksize: int, + * blocks: int + * } */ public function url_stat(string $path, int $flags): array { diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/UploadedFile.php b/lib/Google/vendor/guzzlehttp/psr7/src/UploadedFile.php index b1521bcf8..b26719937 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/UploadedFile.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/UploadedFile.php @@ -113,7 +113,7 @@ private function setError(int $error): void $this->error = $error; } - private function isStringNotEmpty($param): bool + private static function isStringNotEmpty($param): bool { return is_string($param) && false === empty($param); } @@ -163,7 +163,7 @@ public function moveTo($targetPath): void { $this->validateActive(); - if (false === $this->isStringNotEmpty($targetPath)) { + if (false === self::isStringNotEmpty($targetPath)) { throw new InvalidArgumentException( 'Invalid path provided for move operation; must be a non-empty string' ); diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Uri.php b/lib/Google/vendor/guzzlehttp/psr7/src/Uri.php index fbba7f123..f1feee871 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Uri.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Uri.php @@ -41,14 +41,14 @@ class Uri implements UriInterface, \JsonSerializable /** * Unreserved characters for use in a regex. * - * @see https://tools.ietf.org/html/rfc3986#section-2.3 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.3 */ private const CHAR_UNRESERVED = 'a-zA-Z0-9_\-\.~'; /** * Sub-delims for use in a regex. * - * @see https://tools.ietf.org/html/rfc3986#section-2.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-2.2 */ private const CHAR_SUB_DELIMS = '!\$&\'\(\)\*\+,;='; private const QUERY_SEPARATORS_REPLACEMENT = ['=' => '%3D', '&' => '%26']; @@ -162,7 +162,7 @@ public function __toString(): string * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to * that format). * - * @see https://tools.ietf.org/html/rfc3986#section-5.3 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.3 */ public static function composeComponents(?string $scheme, ?string $authority, string $path, ?string $query, ?string $fragment): string { @@ -219,7 +219,7 @@ public static function isDefaultPort(UriInterface $uri): bool * @see Uri::isNetworkPathReference * @see Uri::isAbsolutePathReference * @see Uri::isRelativePathReference - * @see https://tools.ietf.org/html/rfc3986#section-4 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4 */ public static function isAbsolute(UriInterface $uri): bool { @@ -231,7 +231,7 @@ public static function isAbsolute(UriInterface $uri): bool * * A relative reference that begins with two slash characters is termed an network-path reference. * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 */ public static function isNetworkPathReference(UriInterface $uri): bool { @@ -243,7 +243,7 @@ public static function isNetworkPathReference(UriInterface $uri): bool * * A relative reference that begins with a single slash character is termed an absolute-path reference. * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 */ public static function isAbsolutePathReference(UriInterface $uri): bool { @@ -258,7 +258,7 @@ public static function isAbsolutePathReference(UriInterface $uri): bool * * A relative reference that does not begin with a slash character is termed a relative-path reference. * - * @see https://tools.ietf.org/html/rfc3986#section-4.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.2 */ public static function isRelativePathReference(UriInterface $uri): bool { @@ -277,7 +277,7 @@ public static function isRelativePathReference(UriInterface $uri): bool * @param UriInterface $uri The URI to check * @param UriInterface|null $base An optional base URI to compare against * - * @see https://tools.ietf.org/html/rfc3986#section-4.4 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-4.4 */ public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null): bool { @@ -336,8 +336,8 @@ public static function withQueryValue(UriInterface $uri, string $key, ?string $v * * It has the same behavior as withQueryValue() but for an associative array of key => value. * - * @param UriInterface $uri URI to use as a base. - * @param array $keyValueArray Associative array of key and values + * @param UriInterface $uri URI to use as a base. + * @param (string|null)[] $keyValueArray Associative array of key and values */ public static function withQueryValues(UriInterface $uri, array $keyValueArray): UriInterface { @@ -353,7 +353,7 @@ public static function withQueryValues(UriInterface $uri, array $keyValueArray): /** * Creates a URI from a hash of `parse_url` components. * - * @see http://php.net/manual/en/function.parse-url.php + * @see https://www.php.net/manual/en/function.parse-url.php * * @throws MalformedUriException If the components do not form a valid URI. */ @@ -638,7 +638,7 @@ private function filterPort($port): ?int } /** - * @param string[] $keys + * @param (string|int)[] $keys * * @return string[] */ @@ -650,7 +650,9 @@ private static function getFilteredQueryString(UriInterface $uri, array $keys): return []; } - $decodedKeys = array_map('rawurldecode', $keys); + $decodedKeys = array_map(function ($k): string { + return rawurldecode((string) $k); + }, $keys); return array_filter(explode('&', $current), function ($part) use ($decodedKeys) { return !in_array(rawurldecode(explode('=', $part)[0]), $decodedKeys, true); diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/UriNormalizer.php b/lib/Google/vendor/guzzlehttp/psr7/src/UriNormalizer.php index cd4c383aa..e17455737 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/UriNormalizer.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/UriNormalizer.php @@ -11,7 +11,7 @@ * * @author Tobias Schultze * - * @see https://tools.ietf.org/html/rfc3986#section-6 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6 */ final class UriNormalizer { @@ -119,7 +119,7 @@ final class UriNormalizer * @param UriInterface $uri The URI to normalize * @param int $flags A bitmask of normalizations to apply, see constants * - * @see https://tools.ietf.org/html/rfc3986#section-6.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.2 */ public static function normalize(UriInterface $uri, int $flags = self::PRESERVING_NORMALIZATIONS): UriInterface { @@ -174,7 +174,7 @@ public static function normalize(UriInterface $uri, int $flags = self::PRESERVIN * @param UriInterface $uri2 An URI to compare * @param int $normalizations A bitmask of normalizations to apply, see constants * - * @see https://tools.ietf.org/html/rfc3986#section-6.1 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-6.1 */ public static function isEquivalent(UriInterface $uri1, UriInterface $uri2, int $normalizations = self::PRESERVING_NORMALIZATIONS): bool { @@ -185,7 +185,7 @@ private static function capitalizePercentEncoding(UriInterface $uri): UriInterfa { $regex = '/(?:%[A-Fa-f0-9]{2})++/'; - $callback = function (array $match) { + $callback = function (array $match): string { return strtoupper($match[0]); }; @@ -201,7 +201,7 @@ private static function decodeUnreservedCharacters(UriInterface $uri): UriInterf { $regex = '/%(?:2D|2E|5F|7E|3[0-9]|[46][1-9A-F]|[57][0-9A])/i'; - $callback = function (array $match) { + $callback = function (array $match): string { return rawurldecode($match[0]); }; diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/UriResolver.php b/lib/Google/vendor/guzzlehttp/psr7/src/UriResolver.php index 38d5793c7..3737be1e5 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/UriResolver.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/UriResolver.php @@ -11,14 +11,14 @@ * * @author Tobias Schultze * - * @see https://tools.ietf.org/html/rfc3986#section-5 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5 */ final class UriResolver { /** * Removes dot segments from a path and returns the new path. * - * @see http://tools.ietf.org/html/rfc3986#section-5.2.4 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2.4 */ public static function removeDotSegments(string $path): string { @@ -53,7 +53,7 @@ public static function removeDotSegments(string $path): string /** * Converts the relative URI into a new URI that is resolved against the base URI. * - * @see http://tools.ietf.org/html/rfc3986#section-5.2 + * @see https://datatracker.ietf.org/doc/html/rfc3986#section-5.2 */ public static function resolve(UriInterface $base, UriInterface $rel): UriInterface { diff --git a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php index 917c05e30..bf5ea9dba 100644 --- a/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php +++ b/lib/Google/vendor/guzzlehttp/psr7/src/Utils.php @@ -14,18 +14,18 @@ final class Utils /** * Remove the items given by the keys, case insensitively from the data. * - * @param string[] $keys + * @param (string|int)[] $keys */ public static function caselessRemove(array $keys, array $data): array { $result = []; foreach ($keys as &$key) { - $key = strtolower($key); + $key = strtolower((string) $key); } foreach ($data as $k => $v) { - if (!is_string($k) || !in_array(strtolower($k), $keys)) { + if (!in_array(strtolower((string) $k), $keys)) { $result[$k] = $v; } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php index 4638a5393..7aa554808 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/Common/Formats/Keys/PKCS8.php @@ -141,6 +141,7 @@ private static function getPBES1EncryptionObject($algo) break; case 'RC2': $cipher = new RC2('cbc'); + $cipher->setKeyLength(64); break; case '3-KeyTripleDES': $cipher = new TripleDES('cbc'); @@ -218,7 +219,7 @@ private static function getPBES2EncryptionObject($algo) { switch ($algo) { case 'desCBC': - $cipher = new TripleDES('cbc'); + $cipher = new DES('cbc'); break; case 'des-EDE3-CBC': $cipher = new TripleDES('cbc'); diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php new file mode 100644 index 000000000..69139da45 --- /dev/null +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Crypt/EC/Formats/Signature/IEEE.php @@ -0,0 +1,66 @@ + + * @copyright 2016 Jim Wigginton + * @license http://www.opensource.org/licenses/mit-license.html MIT License + * @link http://phpseclib.sourceforge.net + */ + +namespace phpseclib3\Crypt\EC\Formats\Signature; + +use phpseclib3\Math\BigInteger; + +/** + * ASN1 Signature Handler + * + * @author Jim Wigginton + */ +abstract class IEEE +{ + /** + * Loads a signature + * + * @param string $sig + * @return array + */ + public static function load($sig) + { + if (!is_string($sig)) { + return false; + } + + $len = strlen($sig); + if ($len & 1) { + return false; + } + + $r = new BigInteger(substr($sig, 0, $len >> 1), 256); + $s = new BigInteger(substr($sig, $len >> 1), 256); + + return compact('r', 's'); + } + + /** + * Returns a signature in the appropriate format + * + * @param \phpseclib3\Math\BigInteger $r + * @param \phpseclib3\Math\BigInteger $s + * @return string + */ + public static function save(BigInteger $r, BigInteger $s) + { + $r = $r->toBytes(); + $s = $s->toBytes(); + $len = max(strlen($r), strlen($s)); + return str_pad($r, $len, "\0", STR_PAD_LEFT) . str_pad($s, $len, "\0", STR_PAD_LEFT); + } +} diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php index 3f4dc2ed7..67d4788f9 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger.php @@ -29,7 +29,6 @@ use phpseclib3\Exception\BadConfigurationException; use phpseclib3\Math\BigInteger\Engines\Engine; -use UnexpectedValueException; /** * Pure-PHP arbitrary precision integer arithmetic library. Supports base-2, base-10, base-16, and base-256 @@ -153,7 +152,7 @@ private static function initialize_static_variables() } } - throw new UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath'); + throw new \UnexpectedValueException('No valid BigInteger found. This is only possible when JIT is enabled on Windows and neither the GMP or BCMath extensions are available so either disable JIT or install GMP / BCMath'); } } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php index 4c30da564..7e85783ef 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BigInteger/Engines/PHP.php @@ -1332,7 +1332,8 @@ private function bitwise_small_split($split) */ protected static function testJITOnWindows() { - if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && !defined('PHPSECLIB_ALLOW_JIT')) { + // see https://github.com/php/php-src/issues/11917 + if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN' && function_exists('opcache_get_status') && PHP_VERSION_ID < 80213 && !defined('PHPSECLIB_ALLOW_JIT')) { $status = opcache_get_status(); if ($status && isset($status['jit']) && $status['jit']['enabled'] && $status['jit']['on']) { return true; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BinaryField.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BinaryField.php index 3e21a67ad..5da8c937e 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BinaryField.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/BinaryField.php @@ -48,6 +48,15 @@ class BinaryField extends FiniteField public function __construct(...$indices) { $m = array_shift($indices); + if ($m > 571) { + /* sect571r1 and sect571k1 are the largest binary curves that https://www.secg.org/sec2-v2.pdf defines + altho theoretically there may be legit reasons to use binary finite fields with larger degrees + imposing a limit on the maximum size is both reasonable and precedented. in particular, + http://tools.ietf.org/html/rfc4253#section-6.1 (The Secure Shell (SSH) Transport Layer Protocol) says + "implementations SHOULD check that the packet length is reasonable in order for the implementation to + avoid denial of service and/or buffer overflow attacks" */ + throw new \OutOfBoundsException('Degrees larger than 571 are not supported'); + } $val = str_repeat('0', $m) . '1'; foreach ($indices as $index) { $val[$index] = '1'; diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php index ddb04912d..1bd7aaf0f 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Math/PrimeField/Integer.php @@ -263,7 +263,7 @@ public function squareRoot() $r = $this->value->powMod($temp, static::$modulo[$this->instanceID]); while (!$t->equals($one)) { - for ($i == clone $one; $i->compare($m) < 0; $i = $i->add($one)) { + for ($i = clone $one; $i->compare($m) < 0; $i = $i->add($one)) { if ($t->powMod($two->pow($i), static::$modulo[$this->instanceID])->equals($one)) { break; } diff --git a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php index 581b05966..57edc48cb 100644 --- a/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php +++ b/lib/Google/vendor/phpseclib/phpseclib/phpseclib/Net/SSH2.php @@ -1122,6 +1122,7 @@ public function __construct($host, $port = 22, $timeout = 10) 4 => 'NET_SSH2_MSG_DEBUG', 5 => 'NET_SSH2_MSG_SERVICE_REQUEST', 6 => 'NET_SSH2_MSG_SERVICE_ACCEPT', + 7 => 'NET_SSH2_MSG_EXT_INFO', // RFC 8308 20 => 'NET_SSH2_MSG_KEXINIT', 21 => 'NET_SSH2_MSG_NEWKEYS', 30 => 'NET_SSH2_MSG_KEXDH_INIT', @@ -1535,6 +1536,8 @@ private function key_exchange($kexinit_payload_server = false) $preferred['client_to_server']['comp'] : SSH2::getSupportedCompressionAlgorithms(); + $kex_algorithms = array_merge($kex_algorithms, array('ext-info-c')); + // some SSH servers have buggy implementations of some of the above algorithms switch (true) { case $this->server_identifier == 'SSH-2.0-SSHD': @@ -1551,6 +1554,20 @@ private function key_exchange($kexinit_payload_server = false) ['hmac-sha1-96', 'hmac-md5-96'] )); } + break; + case substr($this->server_identifier, 0, 24) == 'SSH-2.0-TurboFTP_SERVER_': + if (!isset($preferred['server_to_client']['crypt'])) { + $s2c_encryption_algorithms = array_values(array_diff( + $s2c_encryption_algorithms, + ['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] + )); + } + if (!isset($preferred['client_to_server']['crypt'])) { + $c2s_encryption_algorithms = array_values(array_diff( + $c2s_encryption_algorithms, + ['aes128-gcm@openssh.com', 'aes256-gcm@openssh.com'] + )); + } } $client_cookie = Random::string(16); @@ -2315,10 +2332,26 @@ private function login_helper($username, $password = null) return $this->login_helper($username, $password); } $this->disconnect_helper(NET_SSH2_DISCONNECT_CONNECTION_LOST); - throw new ConnectionClosedException('Connection closed by server'); + throw $e; } - list($type, $service) = Strings::unpackSSH2('Cs', $response); + list($type) = Strings::unpackSSH2('C', $response); + + if ($type == NET_SSH2_MSG_EXT_INFO) { + list($nr_extensions) = Strings::unpackSSH2('N', $response); + for ($i = 0; $i < $nr_extensions; $i++) { + list($extension_name, $extension_value) = Strings::unpackSSH2('ss', $response); + if ($extension_name == 'server-sig-algs') { + $this->supported_private_key_algorithms = explode(',', $extension_value); + } + } + + $response = $this->get_binary_packet(); + list($type) = Strings::unpackSSH2('C', $response); + } + + list($service) = Strings::unpackSSH2('s', $response); + if ($type != NET_SSH2_MSG_SERVICE_ACCEPT || $service != 'ssh-userauth') { $this->disconnect_helper(NET_SSH2_DISCONNECT_PROTOCOL_ERROR); throw new \UnexpectedValueException('Expected SSH_MSG_SERVICE_ACCEPT'); @@ -2594,7 +2627,7 @@ private function privatekey_login($username, PrivateKey $privatekey) $privatekey = $privatekey->withPadding(RSA::SIGNATURE_PKCS1); $algos = ['rsa-sha2-256', 'rsa-sha2-512', 'ssh-rsa']; if (isset($this->preferred['hostkey'])) { - $algos = array_intersect($this->preferred['hostkey'], $algos); + $algos = array_intersect($algos, $this->preferred['hostkey']); } $algo = self::array_intersect_first($algos, $this->supported_private_key_algorithms); switch ($algo) { @@ -3403,6 +3436,8 @@ protected function reset_connection($reason) $this->session_id = false; $this->retry_connect = true; $this->get_seq_no = $this->send_seq_no = 0; + $this->channel_status = []; + $this->channel_id_last_interactive = 0; } /** diff --git a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php index af94decf2..d7c8ed4ee 100644 --- a/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php +++ b/lib/Google/vendor/ramsey/uuid/src/Generator/UnixTimeGenerator.php @@ -142,7 +142,7 @@ private function increment(): string self::$seedIndex = 21; } - self::$rand[5] = 0xffff & $carry = self::$rand[5] + (self::$seedParts[self::$seedIndex--] & 0xffffff); + self::$rand[5] = 0xffff & $carry = self::$rand[5] + 1 + (self::$seedParts[self::$seedIndex--] & 0xffffff); self::$rand[4] = 0xffff & $carry = self::$rand[4] + ($carry >> 16); self::$rand[3] = 0xffff & $carry = self::$rand[3] + ($carry >> 16); self::$rand[2] = 0xffff & $carry = self::$rand[2] + ($carry >> 16); diff --git a/lib/Google/vendor/ramsey/uuid/src/UuidInterface.php b/lib/Google/vendor/ramsey/uuid/src/UuidInterface.php index 0a9780805..cac9457de 100644 --- a/lib/Google/vendor/ramsey/uuid/src/UuidInterface.php +++ b/lib/Google/vendor/ramsey/uuid/src/UuidInterface.php @@ -46,7 +46,7 @@ interface UuidInterface extends * * @param UuidInterface $other The UUID to compare * - * @return int -1, 0, or 1 if the UUID is less than, equal to, or greater than $other + * @return int<-1,1> -1, 0, or 1 if the UUID is less than, equal to, or greater than $other */ public function compareTo(UuidInterface $other): int; From ed97ee4504535121c2260fc7ac6267ad74e06194 Mon Sep 17 00:00:00 2001 From: balexey88 Date: Fri, 5 Jan 2024 23:25:22 +0200 Subject: [PATCH 06/16] Refactor Sync tab to switch from Angular, remove Angular --- lib/classes/class-bootstrap.php | 4 - lib/classes/class-settings.php | 18 +- static/scripts/angular-sanitize.min.js | 18 - static/scripts/angular.min.js | 349 -------------- static/scripts/wp-stateless-settings.js | 28 +- static/scripts/wp-stateless.js | 592 ++++++++++++++---------- static/styles/wp-stateless-settings.css | 16 + static/views/processing_interface.php | 136 +++--- static/views/settings_interface.php | 5 +- 9 files changed, 478 insertions(+), 688 deletions(-) delete mode 100644 static/scripts/angular-sanitize.min.js delete mode 100644 static/scripts/angular.min.js diff --git a/lib/classes/class-bootstrap.php b/lib/classes/class-bootstrap.php index a2dc638fd..f6012b913 100644 --- a/lib/classes/class-bootstrap.php +++ b/lib/classes/class-bootstrap.php @@ -1211,8 +1211,6 @@ public function admin_init() { wp_register_style('wp-stateless-addons', $this->path('static/styles/wp-stateless-addons.css', 'url'), array(), self::$version); // Sync tab - wp_register_script('wp-stateless-angular', ud_get_stateless_media()->path('static/scripts/angular.min.js', 'url'), array(), '1.8.0', true); - wp_register_script('wp-stateless-angular-sanitize', ud_get_stateless_media()->path('static/scripts/angular-sanitize.min.js', 'url'), array('wp-stateless-angular'), '1.8.0', true); wp_register_script('wp-stateless', ud_get_stateless_media()->path('static/scripts/wp-stateless.js', 'url'), array('jquery-ui-core', 'wp-stateless-settings', 'wp-api-request'), self::$version, true); wp_localize_script('wp-stateless', 'stateless_l10n', $this->get_l10n_data()); @@ -1287,8 +1285,6 @@ public function admin_enqueue_scripts($hook) { wp_enqueue_style('wp-stateless-addons'); // Sync tab - wp_enqueue_script('wp-stateless-angular'); - wp_enqueue_script('wp-stateless-angular-sanitize'); wp_enqueue_script('wp-stateless'); wp_enqueue_style('wp-pointer'); diff --git a/lib/classes/class-settings.php b/lib/classes/class-settings.php index c7ecb0b55..145a2dc35 100644 --- a/lib/classes/class-settings.php +++ b/lib/classes/class-settings.php @@ -93,7 +93,9 @@ public function __construct($bootstrap = null) { // Parse root dir by wildcards add_filter( 'wp_stateless_unhandle_root_dir', array( $this, 'parse_root_dir_wildcards' ), 10, 3); - add_action('wp_stateless_settings_tab_content', array($this, 'tab_content')); + // Settings page content + add_action('wp_stateless_settings_tab_content', array($this, 'settings_tab_content')); + add_action('wp_stateless_processing_tab_content', array($this, 'processing_tab_content')); $site_url = parse_url( site_url() ); $site_url['path'] = isset($site_url['path']) ? $site_url['path'] : ''; @@ -547,7 +549,7 @@ public function set( $key = '', $value = false, $bypass_validation = false ) { * Outputs 'Compatibility' tab content on the settings page. * */ - public function tab_content() { + public function settings_tab_content() { $wildcards = apply_filters('wp_stateless_root_dir_wildcard', $this->wildcards); $wildcard_year_month = '%date_year/date_month%'; $root_dir = $this->get( 'sm.root_dir' ); @@ -609,7 +611,19 @@ public function tab_content() { include ud_get_stateless_media()->path('static/views/settings-tab.php', 'dir'); } + /** + * Outputs 'Sync' tab content on the settings page. + * + */ + public function processing_tab_content() { + // Drop non-public properties + $processes = json_encode(Utility::get_available_sync_classes()); + $processes = json_decode($processes, true); + $processes = Helper::array_of_objects($processes); + + include ud_get_stateless_media()->path('static/views/processing_interface.php', 'dir'); + } } } diff --git a/static/scripts/angular-sanitize.min.js b/static/scripts/angular-sanitize.min.js deleted file mode 100644 index a8b0b0fee..000000000 --- a/static/scripts/angular-sanitize.min.js +++ /dev/null @@ -1,18 +0,0 @@ -/* - AngularJS v1.8.0 - (c) 2010-2020 Google, Inc. http://angularjs.org - License: MIT -*/ -(function(s,c){'use strict';function P(c){var h=[];C(h,E).chars(c);return h.join("")}var D=c.$$minErr("$sanitize"),F,h,G,H,I,q,E,J,K,C;c.module("ngSanitize",[]).provider("$sanitize",function(){function f(a,e){return B(a.split(","),e)}function B(a,e){var d={},b;for(b=0;b/g,">")}function A(a){for(;a;){if(a.nodeType===s.Node.ELEMENT_NODE)for(var e=a.attributes,d=0,b=e.length;d"))},end:function(a){a=q(a);d||!0!==m[a]||!0===r[a]||(b(""));a==d&&(d=!1)},chars:function(a){d|| - b(L(a))}}};J=s.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)};var z=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,u=/([^#-~ |!])/g,r=f("area,br,col,hr,img,wbr"),x=f("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),p=f("rp,rt"),n=h({},p,x),x=h({},x,f("address,article,aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul")),p=h({},p,f("a,abbr,acronym,b,bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s,samp,small,span,strike,strong,sub,sup,time,tt,u,var")), - l=f("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph,hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline,radialGradient,rect,stop,svg,switch,text,title,tspan"),w=f("script,style"),m=h({},r,x,p,n),O=f("background,cite,href,longdesc,src,xlink:href,xml:base"),n=f("abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,valign,value,vspace,width"), - p=f("accent-height,accumulate,additive,alphabetic,arabic-form,ascent,baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan", - !0),M=h({},O,p,n),N=function(a,e){function d(b){b=""+b;try{var d=(new a.DOMParser).parseFromString(b,"text/html").body;d.firstChild.remove();return d}catch(e){}}function b(a){c.innerHTML=a;e.documentMode&&A(c);return c}var g;if(e&&e.implementation)g=e.implementation.createHTMLDocument("inert");else throw D("noinert");var c=(g.documentElement||g.getDocumentElement()).querySelector("body");c.innerHTML='';return c.querySelector("svg")? - (c.innerHTML='

                    ',c.querySelector("svg img")?d:b):function(b){b=""+b;try{b=encodeURI(b)}catch(d){return}var e=new a.XMLHttpRequest;e.responseType="document";e.open("GET","data:text/html;charset=utf-8,"+b,!1);e.send(null);b=e.response.body;b.firstChild.remove();return b}}(s,s.document)}).info({angularVersion:"1.8.0"});c.module("ngSanitize").filter("linky",["$sanitize",function(f){var h=/((s?ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i, - t=/^mailto:/i,q=c.$$minErr("linky"),s=c.isDefined,A=c.isFunction,v=c.isObject,y=c.isString;return function(c,z,u){function r(c){c&&l.push(P(c))}function x(c,g){var f,a=p(c);l.push("');r(g);l.push("")}if(null==c||""===c)return c;if(!y(c))throw q("notstring",c);for(var p=A(u)?u:v(u)?function(){return u}:function(){return{}},n=c,l=[],w,m;c=n.match(h);)w=c[0],c[2]|| - c[4]||(w=(c[3]?"http://":"mailto:")+w),m=c.index,r(n.substr(0,m)),x(w,c[0].replace(t,"")),n=n.substring(m+c[0].length);r(n);return f(l.join(""))}}])})(window,window.angular); - \ No newline at end of file diff --git a/static/scripts/angular.min.js b/static/scripts/angular.min.js deleted file mode 100644 index 5830aad43..000000000 --- a/static/scripts/angular.min.js +++ /dev/null @@ -1,349 +0,0 @@ -/* - AngularJS v1.8.0 - (c) 2010-2020 Google, Inc. http://angularjs.org - License: MIT -*/ -(function(z){'use strict';function ve(a){if(D(a))w(a.objectMaxDepth)&&(Xb.objectMaxDepth=Yb(a.objectMaxDepth)?a.objectMaxDepth:NaN),w(a.urlErrorParamsEnabled)&&Ga(a.urlErrorParamsEnabled)&&(Xb.urlErrorParamsEnabled=a.urlErrorParamsEnabled);else return Xb}function Yb(a){return X(a)&&0c)return"...";var d=b.$$hashKey,f;if(H(a)){f=0;for(var g=a.length;f

                    ").append(a).html();try{return a[0].nodeType===Pa?K(b):b.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,function(a,b){return"<"+K(b)})}catch(d){return K(b)}}function Vc(a){try{return decodeURIComponent(a)}catch(b){}}function hc(a){var b={};r((a||"").split("&"), -function(a){var c,e,f;a&&(e=a=a.replace(/\+/g,"%20"),c=a.indexOf("="),-1!==c&&(e=a.substring(0,c),f=a.substring(c+1)),e=Vc(e),w(e)&&(f=w(f)?Vc(f):!0,ta.call(b,e)?H(b[e])?b[e].push(f):b[e]=[b[e],f]:b[e]=f))});return b}function Ce(a){var b=[];r(a,function(a,c){H(a)?r(a,function(a){b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))}):b.push(ba(c,!0)+(!0===a?"":"="+ba(a,!0)))});return b.length?b.join("&"):""}function ic(a){return ba(a,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function ba(a, -b){return encodeURIComponent(a).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,b?"%20":"+")}function De(a,b){var d,c,e=Qa.length;for(c=0;c protocol indicates an extension, document.location.href does not match."))}function Wc(a,b,d){D(d)||(d={});d=S({strictDi:!1},d);var c=function(){a=x(a);if(a.injector()){var c=a[0]===z.document?"document":Aa(a);throw oa("btstrpd",c.replace(//,">"));}b=b||[];b.unshift(["$provide",function(b){b.value("$rootElement",a)}]);d.debugInfoEnabled&&b.push(["$compileProvider", -function(a){a.debugInfoEnabled(!0)}]);b.unshift("ng");c=fb(b,d.strictDi);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;z&&e.test(z.name)&&(d.debugInfoEnabled=!0,z.name=z.name.replace(e,""));if(z&&!f.test(z.name))return c();z.name=z.name.replace(f,"");ca.resumeBootstrap=function(a){r(a,function(a){b.push(a)});return c()};B(ca.resumeDeferredBootstrap)&& -ca.resumeDeferredBootstrap()}function Ge(){z.name="NG_ENABLE_DEBUG_INFO!"+z.name;z.location.reload()}function He(a){a=ca.element(a).injector();if(!a)throw oa("test");return a.get("$$testability")}function Xc(a,b){b=b||"_";return a.replace(Ie,function(a,c){return(c?b:"")+a.toLowerCase()})}function Je(){var a;if(!Yc){var b=rb();(sb=A(b)?z.jQuery:b?z[b]:void 0)&&sb.fn.on?(x=sb,S(sb.fn,{scope:Wa.scope,isolateScope:Wa.isolateScope,controller:Wa.controller,injector:Wa.injector,inheritedData:Wa.inheritedData})): -x=U;a=x.cleanData;x.cleanData=function(b){for(var c,e=0,f;null!=(f=b[e]);e++)(c=(x._data(f)||{}).events)&&c.$destroy&&x(f).triggerHandler("$destroy");a(b)};ca.element=x;Yc=!0}}function Ke(){U.legacyXHTMLReplacement=!0}function gb(a,b,d){if(!a)throw oa("areq",b||"?",d||"required");return a}function tb(a,b,d){d&&H(a)&&(a=a[a.length-1]);gb(B(a),b,"not a function, got "+(a&&"object"===typeof a?a.constructor.name||"Object":typeof a));return a}function Ja(a,b){if("hasOwnProperty"===a)throw oa("badname", -b);}function Le(a,b,d){if(!b)return a;b=b.split(".");for(var c,e=a,f=b.length,g=0;g"):a;if(10>wa)for(c=hb[c]||hb._default,d.innerHTML=c[1]+e+c[2],k=c[0];k--;)d=d.firstChild;else{c=qa[c]||[];for(k=c.length;-1<--k;)d.appendChild(z.document.createElement(c[k])),d=d.firstChild;d.innerHTML=e}g=db(g,d.childNodes);d=f.firstChild;d.textContent=""}else g.push(b.createTextNode(a)); -f.textContent="";f.innerHTML="";r(g,function(a){f.appendChild(a)});return f}function U(a){if(a instanceof U)return a;var b;C(a)&&(a=V(a),b=!0);if(!(this instanceof U)){if(b&&"<"!==a.charAt(0))throw oc("nosel");return new U(a)}if(b){b=z.document;var d;a=(d=tg.exec(a))?[b.createElement(d[1])]:(d=gd(a,b))?d.childNodes:[];pc(this,a)}else B(a)?hd(a):pc(this,a)}function qc(a){return a.cloneNode(!0)}function zb(a,b){!b&&mc(a)&&x.cleanData([a]);a.querySelectorAll&&x.cleanData(a.querySelectorAll("*"))}function id(a){for(var b in a)return!1; -return!0}function jd(a){var b=a.ng339,d=b&&Ka[b],c=d&&d.events,d=d&&d.data;d&&!id(d)||c&&!id(c)||(delete Ka[b],a.ng339=void 0)}function kd(a,b,d,c){if(w(c))throw oc("offargs");var e=(c=Ab(a))&&c.events,f=c&&c.handle;if(f){if(b){var g=function(b){var c=e[b];w(d)&&cb(c||[],d);w(d)&&c&&0l&&this.remove(n.key);return b}},get:function(a){if(l";b=Fa.firstChild.attributes;var d=b[0];b.removeNamedItem(d.name);d.value=c;a.attributes.setNamedItem(d)}function sa(a,b){try{a.addClass(b)}catch(c){}}function da(a,b,c,d,e){a instanceof x||(a=x(a));var f=Xa(a,b,a,c,d,e);da.$$addScopeClass(a);var g=null;return function(b,c,d){if(!a)throw $("multilink");gb(b,"scope");e&&e.needsNewScope&& -(b=b.$parent.$new());d=d||{};var h=d.parentBoundTranscludeFn,k=d.transcludeControllers;d=d.futureParentElement;h&&h.$$boundTransclude&&(h=h.$$boundTransclude);g||(g=(d=d&&d[0])?"foreignobject"!==ua(d)&&la.call(d).match(/SVG/)?"svg":"html":"html");d="html"!==g?x(ja(g,x("
                    ").append(a).html())):c?Wa.clone.call(a):a;if(k)for(var l in k)d.data("$"+l+"Controller",k[l].instance);da.$$addScopeInfo(d,b);c&&c(d,b);f&&f(b,d,d,h);c||(a=f=null);return d}}function Xa(a,b,c,d,e,f){function g(a,c,d,e){var f, -k,l,m,p,I,t;if(n)for(t=Array(c.length),m=0;mu.priority)break;if(O=u.scope)u.templateUrl||(D(O)?(ba("new/isolated scope",s||t,u,y),s=u):ba("new/isolated scope",s,u,y)),t=t||u;Q=u.name;if(!ma&&(u.replace&&(u.templateUrl||u.template)||u.transclude&& -!u.$$tlb)){for(O=sa+1;ma=a[O++];)if(ma.transclude&&!ma.$$tlb||ma.replace&&(ma.templateUrl||ma.template)){Jb=!0;break}ma=!0}!u.templateUrl&&u.controller&&(J=J||T(),ba("'"+Q+"' controller",J[Q],u,y),J[Q]=u);if(O=u.transclude)if(G=!0,u.$$tlb||(ba("transclusion",L,u,y),L=u),"element"===O)N=!0,n=u.priority,M=y,y=d.$$element=x(da.$$createComment(Q,d[Q])),b=y[0],oa(f,Ha.call(M,0),b),R=Z(Jb,M,e,n,g&&g.name,{nonTlbTranscludeDirective:L});else{var ka=T();if(D(O)){M=z.document.createDocumentFragment();var Xa= -T(),F=T();r(O,function(a,b){var c="?"===a.charAt(0);a=c?a.substring(1):a;Xa[a]=b;ka[b]=null;F[b]=c});r(y.contents(),function(a){var b=Xa[xa(ua(a))];b?(F[b]=!0,ka[b]=ka[b]||z.document.createDocumentFragment(),ka[b].appendChild(a)):M.appendChild(a)});r(F,function(a,b){if(!a)throw $("reqslot",b);});for(var K in ka)ka[K]&&(R=x(ka[K].childNodes),ka[K]=Z(Jb,R,e));M=x(M.childNodes)}else M=x(qc(b)).contents();y.empty();R=Z(Jb,M,e,void 0,void 0,{needsNewScope:u.$$isolateScope||u.$$newScope});R.$$slots=ka}if(u.template)if(P= -!0,ba("template",v,u,y),v=u,O=B(u.template)?u.template(y,d):u.template,O=Na(O),u.replace){g=u;M=nc.test(O)?td(ja(u.templateNamespace,V(O))):[];b=M[0];if(1!==M.length||1!==b.nodeType)throw $("tplrt",Q,"");oa(f,y,b);C={$attr:{}};O=tc(b,[],C);var Ig=a.splice(sa+1,a.length-(sa+1));(s||t)&&fa(O,s,t);a=a.concat(O).concat(Ig);ga(d,C);C=a.length}else y.html(O);if(u.templateUrl)P=!0,ba("template",v,u,y),v=u,u.replace&&(g=u),p=ha(a.splice(sa,a.length-sa),y,d,f,G&&R,h,k,{controllerDirectives:J,newScopeDirective:t!== -u&&t,newIsolateScopeDirective:s,templateDirective:v,nonTlbTranscludeDirective:L}),C=a.length;else if(u.compile)try{q=u.compile(y,d,R);var Y=u.$$originalDirective||u;B(q)?m(null,Va(Y,q),E,jb):q&&m(Va(Y,q.pre),Va(Y,q.post),E,jb)}catch(ca){c(ca,Aa(y))}u.terminal&&(p.terminal=!0,n=Math.max(n,u.priority))}p.scope=t&&!0===t.scope;p.transcludeOnThisElement=G;p.templateOnThisElement=P;p.transclude=R;l.hasElementTranscludeDirective=N;return p}function X(a,b,c,d){var e;if(C(b)){var f=b.match(l);b=b.substring(f[0].length); -var g=f[1]||f[3],f="?"===f[2];"^^"===g?c=c.parent():e=(e=d&&d[b])&&e.instance;if(!e){var h="$"+b+"Controller";e="^^"===g&&c[0]&&9===c[0].nodeType?null:g?c.inheritedData(h):c.data(h)}if(!e&&!f)throw $("ctreq",b,a);}else if(H(b))for(e=[],g=0,f=b.length;gc.priority)&&-1!==c.restrict.indexOf(e)){k&&(c=bc(c,{$$start:k,$$end:l}));if(!c.$$bindings){var I=m=c,t=c.name,u={isolateScope:null,bindToController:null}; -D(I.scope)&&(!0===I.bindToController?(u.bindToController=d(I.scope,t,!0),u.isolateScope={}):u.isolateScope=d(I.scope,t,!1));D(I.bindToController)&&(u.bindToController=d(I.bindToController,t,!0));if(u.bindToController&&!I.controller)throw $("noctrl",t);m=m.$$bindings=u;D(m.isolateScope)&&(c.$$isolateBindings=m.isolateScope)}b.push(c);m=c}}return m}function ca(b){if(f.hasOwnProperty(b))for(var c=a.get(b+"Directive"),d=0,e=c.length;d"+b+"";return c.childNodes[0].childNodes;default:return b}}function qa(a,b){if("srcdoc"=== -b)return u.HTML;if("src"===b||"ngSrc"===b)return-1===["img","video","audio","source","track"].indexOf(a)?u.RESOURCE_URL:u.MEDIA_URL;if("xlinkHref"===b)return"image"===a?u.MEDIA_URL:"a"===a?u.URL:u.RESOURCE_URL;if("form"===a&&"action"===b||"base"===a&&"href"===b||"link"===a&&"href"===b)return u.RESOURCE_URL;if("a"===a&&("href"===b||"ngHref"===b))return u.URL}function ya(a,b){var c=b.toLowerCase();return v[a+"|"+c]||v["*|"+c]}function za(a){return ma(u.valueOf(a),"ng-prop-srcset")}function Ea(a,b,c, -d){if(m.test(d))throw $("nodomevents");a=ua(a);var e=ya(a,d),f=Ta;"srcset"!==d||"img"!==a&&"source"!==a?e&&(f=u.getTrusted.bind(u,e)):f=za;b.push({priority:100,compile:function(a,b){var e=p(b[c]),g=p(b[c],function(a){return u.valueOf(a)});return{pre:function(a,b){function c(){var g=e(a);b[0][d]=f(g)}c();a.$watch(g,c)}}}})}function Ia(a,c,d,e,f){var g=ua(a),k=qa(g,e),l=h[e]||f,p=b(d,!f,k,l);if(p){if("multiple"===e&&"select"===g)throw $("selmulti",Aa(a));if(m.test(e))throw $("nodomevents");c.push({priority:100, -compile:function(){return{pre:function(a,c,f){c=f.$$observers||(f.$$observers=T());var g=f[e];g!==d&&(p=g&&b(g,!0,k,l),d=g);p&&(f[e]=p(a),(c[e]||(c[e]=[])).$$inter=!0,(f.$$observers&&f.$$observers[e].$$scope||a).$watch(p,function(a,b){"class"===e&&a!==b?f.$updateClass(a,b):f.$set(e,a)}))}}}})}}function oa(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g=b)return a;for(;b--;){var d=a[b];(8===d.nodeType||d.nodeType===Pa&&""===d.nodeValue.trim())&&Kg.call(a,b,1)}return a} -function Gg(a,b){if(b&&C(b))return b;if(C(a)){var d=wd.exec(a);if(d)return d[3]}}function Kf(){var a={};this.has=function(b){return a.hasOwnProperty(b)};this.register=function(b,d){Ja(b,"controller");D(b)?S(a,b):a[b]=d};this.$get=["$injector",function(b){function d(a,b,d,g){if(!a||!D(a.$scope))throw F("$controller")("noscp",g,b);a.$scope[b]=d}return function(c,e,f,g){var k,h,l;f=!0===f;g&&C(g)&&(l=g);if(C(c)){g=c.match(wd);if(!g)throw xd("ctrlfmt",c);h=g[1];l=l||g[3];c=a.hasOwnProperty(h)?a[h]:Le(e.$scope, -h,!0);if(!c)throw xd("ctrlreg",h);tb(c,h,!0)}if(f)return f=(H(c)?c[c.length-1]:c).prototype,k=Object.create(f||null),l&&d(e,l,k,h||c.name),S(function(){var a=b.invoke(c,k,e,h);a!==k&&(D(a)||B(a))&&(k=a,l&&d(e,l,k,h||c.name));return k},{instance:k,identifier:l});k=b.instantiate(c,e,h);l&&d(e,l,k,h||c.name);return k}}]}function Lf(){this.$get=["$window",function(a){return x(a.document)}]}function Mf(){this.$get=["$document","$rootScope",function(a,b){function d(){e=c.hidden}var c=a[0],e=c&&c.hidden; -a.on("visibilitychange",d);b.$on("$destroy",function(){a.off("visibilitychange",d)});return function(){return e}}]}function Nf(){this.$get=["$log",function(a){return function(b,d){a.error.apply(a,arguments)}}]}function vc(a){return D(a)?ha(a)?a.toISOString():eb(a):a}function Tf(){this.$get=function(){return function(a){if(!a)return"";var b=[];Qc(a,function(a,c){null===a||A(a)||B(a)||(H(a)?r(a,function(a){b.push(ba(c)+"="+ba(vc(a)))}):b.push(ba(c)+"="+ba(vc(a))))});return b.join("&")}}}function Uf(){this.$get= -function(){return function(a){function b(a,e,f){H(a)?r(a,function(a,c){b(a,e+"["+(D(a)?c:"")+"]")}):D(a)&&!ha(a)?Qc(a,function(a,c){b(a,e+(f?"":"[")+c+(f?"":"]"))}):(B(a)&&(a=a()),d.push(ba(e)+"="+(null==a?"":ba(vc(a)))))}if(!a)return"";var d=[];b(a,"",!0);return d.join("&")}}}function wc(a,b){if(C(a)){var d=a.replace(Lg,"").trim();if(d){var c=b("Content-Type"),c=c&&0===c.indexOf(yd),e;(e=c)||(e=(e=d.match(Mg))&&Ng[e[0]].test(d));if(e)try{a=Tc(d)}catch(f){if(!c)return a;throw Lb("baddata",a,f);}}}return a} -function zd(a){var b=T(),d;C(a)?r(a.split("\n"),function(a){d=a.indexOf(":");var e=K(V(a.substr(0,d)));a=V(a.substr(d+1));e&&(b[e]=b[e]?b[e]+", "+a:a)}):D(a)&&r(a,function(a,d){var f=K(d),g=V(a);f&&(b[f]=b[f]?b[f]+", "+g:g)});return b}function Ad(a){var b;return function(d){b||(b=zd(a));return d?(d=b[K(d)],void 0===d&&(d=null),d):b}}function Bd(a,b,d,c){if(B(c))return c(a,b,d);r(c,function(c){a=c(a,b,d)});return a}function Sf(){var a=this.defaults={transformResponse:[wc],transformRequest:[function(a){return D(a)&& -"[object File]"!==la.call(a)&&"[object Blob]"!==la.call(a)&&"[object FormData]"!==la.call(a)?eb(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ja(xc),put:ja(xc),patch:ja(xc)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",paramSerializer:"$httpParamSerializer",jsonpCallbackParam:"callback"},b=!1;this.useApplyAsync=function(a){return w(a)?(b=!!a,this):b};var d=this.interceptors=[],c=this.xsrfWhitelistedOrigins=[];this.$get=["$browser","$httpBackend","$$cookieReader", -"$cacheFactory","$rootScope","$q","$injector","$sce",function(e,f,g,k,h,l,m,p){function n(b){function c(a,b){for(var d=0,e=b.length;da?b:l.reject(b)}if(!D(b))throw F("$http")("badreq",b);if(!C(p.valueOf(b.url)))throw F("$http")("badreq", -b.url);var g=S({method:"get",transformRequest:a.transformRequest,transformResponse:a.transformResponse,paramSerializer:a.paramSerializer,jsonpCallbackParam:a.jsonpCallbackParam},b);g.headers=function(b){var c=a.headers,e=S({},b.headers),f,g,h,c=S({},c.common,c[K(b.method)]);a:for(f in c){g=K(f);for(h in e)if(K(h)===g)continue a;e[f]=c[f]}return d(e,ja(b))}(b);g.method=vb(g.method);g.paramSerializer=C(g.paramSerializer)?m.get(g.paramSerializer):g.paramSerializer;e.$$incOutstandingRequestCount("$http"); -var h=[],k=[];b=l.resolve(g);r(v,function(a){(a.request||a.requestError)&&h.unshift(a.request,a.requestError);(a.response||a.responseError)&&k.push(a.response,a.responseError)});b=c(b,h);b=b.then(function(b){var c=b.headers,d=Bd(b.data,Ad(c),void 0,b.transformRequest);A(d)&&r(c,function(a,b){"content-type"===K(b)&&delete c[b]});A(b.withCredentials)&&!A(a.withCredentials)&&(b.withCredentials=a.withCredentials);return s(b,d).then(f,f)});b=c(b,k);return b=b.finally(function(){e.$$completeOutstandingRequest(E, -"$http")})}function s(c,d){function e(a){if(a){var c={};r(a,function(a,d){c[d]=function(c){function d(){a(c)}b?h.$applyAsync(d):h.$$phase?d():h.$apply(d)}});return c}}function k(a,c,d,e,f){function g(){m(c,a,d,e,f)}R&&(200<=a&&300>a?R.put(O,[a,c,zd(d),e,f]):R.remove(O));b?h.$applyAsync(g):(g(),h.$$phase||h.$apply())}function m(a,b,d,e,f){b=-1<=b?b:0;(200<=b&&300>b?L.resolve:L.reject)({data:a,status:b,headers:Ad(d),config:c,statusText:e,xhrStatus:f})}function s(a){m(a.data,a.status,ja(a.headers()), -a.statusText,a.xhrStatus)}function v(){var a=n.pendingRequests.indexOf(c);-1!==a&&n.pendingRequests.splice(a,1)}var L=l.defer(),u=L.promise,R,q,ma=c.headers,x="jsonp"===K(c.method),O=c.url;x?O=p.getTrustedResourceUrl(O):C(O)||(O=p.valueOf(O));O=G(O,c.paramSerializer(c.params));x&&(O=t(O,c.jsonpCallbackParam));n.pendingRequests.push(c);u.then(v,v);!c.cache&&!a.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(R=D(c.cache)?c.cache:D(a.cache)?a.cache:N);R&&(q=R.get(O),w(q)?q&&B(q.then)?q.then(s, -s):H(q)?m(q[1],q[0],ja(q[2]),q[3],q[4]):m(q,200,{},"OK","complete"):R.put(O,u));A(q)&&((q=kc(c.url)?g()[c.xsrfCookieName||a.xsrfCookieName]:void 0)&&(ma[c.xsrfHeaderName||a.xsrfHeaderName]=q),f(c.method,O,d,k,ma,c.timeout,c.withCredentials,c.responseType,e(c.eventHandlers),e(c.uploadEventHandlers)));return u}function G(a,b){0=h&&(t.resolve(s),f(r.$$intervalId));G||c.$apply()},k,t,G);return r}}}]}function Cd(a,b){var d=ga(a);b.$$protocol=d.protocol;b.$$host=d.hostname;b.$$port=fa(d.port)||Rg[d.protocol]||null}function Dd(a,b,d){if(Sg.test(a))throw kb("badpath",a);var c="/"!== -a.charAt(0);c&&(a="/"+a);a=ga(a);for(var c=(c&&"/"===a.pathname.charAt(0)?a.pathname.substring(1):a.pathname).split("/"),e=c.length;e--;)c[e]=decodeURIComponent(c[e]),d&&(c[e]=c[e].replace(/\//g,"%2F"));d=c.join("/");b.$$path=d;b.$$search=hc(a.search);b.$$hash=decodeURIComponent(a.hash);b.$$path&&"/"!==b.$$path.charAt(0)&&(b.$$path="/"+b.$$path)}function yc(a,b){return a.slice(0,b.length)===b}function ya(a,b){if(yc(b,a))return b.substr(a.length)}function Da(a){var b=a.indexOf("#");return-1===b?a: -a.substr(0,b)}function zc(a,b,d){this.$$html5=!0;d=d||"";Cd(a,this);this.$$parse=function(a){var d=ya(b,a);if(!C(d))throw kb("ipthprfx",a,b);Dd(d,this,!0);this.$$path||(this.$$path="/");this.$$compose()};this.$$normalizeUrl=function(a){return b+a.substr(1)};this.$$parseLinkUrl=function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;w(f=ya(a,c))?(g=f,g=d&&w(f=ya(d,f))?b+(ya("/",f)||f):a+g):w(f=ya(b,c))?g=b+f:b===c+"/"&&(g=b);g&&this.$$parse(g);return!!g}}function Ac(a,b,d){Cd(a,this); -this.$$parse=function(c){var e=ya(a,c)||ya(b,c),f;A(e)||"#"!==e.charAt(0)?this.$$html5?f=e:(f="",A(e)&&(a=c,this.replace())):(f=ya(d,e),A(f)&&(f=e));Dd(f,this,!1);c=this.$$path;var e=a,g=/^\/[A-Z]:(\/.*)/;yc(f,e)&&(f=f.replace(e,""));g.exec(f)||(c=(f=g.exec(c))?f[1]:c);this.$$path=c;this.$$compose()};this.$$normalizeUrl=function(b){return a+(b?d+b:"")};this.$$parseLinkUrl=function(b,d){return Da(a)===Da(b)?(this.$$parse(b),!0):!1}}function Ed(a,b,d){this.$$html5=!0;Ac.apply(this,arguments);this.$$parseLinkUrl= -function(c,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;a===Da(c)?f=c:(g=ya(b,c))?f=a+d+g:b===c+"/"&&(f=b);f&&this.$$parse(f);return!!f};this.$$normalizeUrl=function(b){return a+d+b}}function Mb(a){return function(){return this[a]}}function Fd(a,b){return function(d){if(A(d))return this[a];this[a]=b(d);this.$$compose();return this}}function Yf(){var a="!",b={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(b){return w(b)?(a=b,this):a};this.html5Mode=function(a){if(Ga(a))return b.enabled= -a,this;if(D(a)){Ga(a.enabled)&&(b.enabled=a.enabled);Ga(a.requireBase)&&(b.requireBase=a.requireBase);if(Ga(a.rewriteLinks)||C(a.rewriteLinks))b.rewriteLinks=a.rewriteLinks;return this}return b};this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(d,c,e,f,g){function k(a,b){return a===b||ga(a).href===ga(b).href}function h(a,b,d){var e=m.url(),f=m.$$state;try{c.url(a,b,d),m.$$state=c.state()}catch(g){throw m.url(e),m.$$state=f,g;}}function l(a,b){d.$broadcast("$locationChangeSuccess", -m.absUrl(),a,m.$$state,b)}var m,p;p=c.baseHref();var n=c.url(),s;if(b.enabled){if(!p&&b.requireBase)throw kb("nobase");s=n.substring(0,n.indexOf("/",n.indexOf("//")+2))+(p||"/");p=e.history?zc:Ed}else s=Da(n),p=Ac;var r=s.substr(0,Da(s).lastIndexOf("/")+1);m=new p(s,r,"#"+a);m.$$parseLinkUrl(n,n);m.$$state=c.state();var t=/^\s*(javascript|mailto):/i;f.on("click",function(a){var e=b.rewriteLinks;if(e&&!a.ctrlKey&&!a.metaKey&&!a.shiftKey&&2!==a.which&&2!==a.button){for(var g=x(a.target);"a"!==ua(g[0]);)if(g[0]=== -f[0]||!(g=g.parent())[0])return;if(!C(e)||!A(g.attr(e))){var e=g.prop("href"),h=g.attr("href")||g.attr("xlink:href");D(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=ga(e.animVal).href);t.test(e)||!e||g.attr("target")||a.isDefaultPrevented()||!m.$$parseLinkUrl(e,h)||(a.preventDefault(),m.absUrl()!==c.url()&&d.$apply())}}});m.absUrl()!==n&&c.url(m.absUrl(),!0);var N=!0;c.onUrlChange(function(a,b){yc(a,r)?(d.$evalAsync(function(){var c=m.absUrl(),e=m.$$state,f;m.$$parse(a);m.$$state=b;f=d.$broadcast("$locationChangeStart", -a,c,b,e).defaultPrevented;m.absUrl()===a&&(f?(m.$$parse(c),m.$$state=e,h(c,!1,e)):(N=!1,l(c,e)))}),d.$$phase||d.$digest()):g.location.href=a});d.$watch(function(){if(N||m.$$urlUpdatedByLocation){m.$$urlUpdatedByLocation=!1;var a=c.url(),b=m.absUrl(),f=c.state(),g=m.$$replace,n=!k(a,b)||m.$$html5&&e.history&&f!==m.$$state;if(N||n)N=!1,d.$evalAsync(function(){var b=m.absUrl(),c=d.$broadcast("$locationChangeStart",b,a,m.$$state,f).defaultPrevented;m.absUrl()===b&&(c?(m.$$parse(a),m.$$state=f):(n&&h(b, -g,f===m.$$state?null:m.$$state),l(a,f)))})}m.$$replace=!1});return m}]}function Zf(){var a=!0,b=this;this.debugEnabled=function(b){return w(b)?(a=b,this):a};this.$get=["$window",function(d){function c(a){dc(a)&&(a.stack&&f?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=d.console||{},e=b[a]||b.log||E;return function(){var a=[];r(arguments,function(b){a.push(c(b))});return Function.prototype.apply.call(e, -b,a)}}var f=wa||/\bEdge\//.test(d.navigator&&d.navigator.userAgent);return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){a&&c.apply(b,arguments)}}()}}]}function Tg(a){return a+""}function Ug(a,b){return"undefined"!==typeof a?a:b}function Gd(a,b){return"undefined"===typeof a?b:"undefined"===typeof b?a:a+b}function Vg(a,b){switch(a.type){case q.MemberExpression:if(a.computed)return!1;break;case q.UnaryExpression:return 1;case q.BinaryExpression:return"+"!== -a.operator?1:!1;case q.CallExpression:return!1}return void 0===b?Hd:b}function Z(a,b,d){var c,e,f=a.isPure=Vg(a,d);switch(a.type){case q.Program:c=!0;r(a.body,function(a){Z(a.expression,b,f);c=c&&a.expression.constant});a.constant=c;break;case q.Literal:a.constant=!0;a.toWatch=[];break;case q.UnaryExpression:Z(a.argument,b,f);a.constant=a.argument.constant;a.toWatch=a.argument.toWatch;break;case q.BinaryExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch= -a.left.toWatch.concat(a.right.toWatch);break;case q.LogicalExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=a.constant?[]:[a];break;case q.ConditionalExpression:Z(a.test,b,f);Z(a.alternate,b,f);Z(a.consequent,b,f);a.constant=a.test.constant&&a.alternate.constant&&a.consequent.constant;a.toWatch=a.constant?[]:[a];break;case q.Identifier:a.constant=!1;a.toWatch=[a];break;case q.MemberExpression:Z(a.object,b,f);a.computed&&Z(a.property,b,f);a.constant=a.object.constant&& -(!a.computed||a.property.constant);a.toWatch=a.constant?[]:[a];break;case q.CallExpression:c=d=a.filter?!b(a.callee.name).$stateful:!1;e=[];r(a.arguments,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c;a.toWatch=d?e:[a];break;case q.AssignmentExpression:Z(a.left,b,f);Z(a.right,b,f);a.constant=a.left.constant&&a.right.constant;a.toWatch=[a];break;case q.ArrayExpression:c=!0;e=[];r(a.elements,function(a){Z(a,b,f);c=c&&a.constant;e.push.apply(e,a.toWatch)});a.constant=c; -a.toWatch=e;break;case q.ObjectExpression:c=!0;e=[];r(a.properties,function(a){Z(a.value,b,f);c=c&&a.value.constant;e.push.apply(e,a.value.toWatch);a.computed&&(Z(a.key,b,!1),c=c&&a.key.constant,e.push.apply(e,a.key.toWatch))});a.constant=c;a.toWatch=e;break;case q.ThisExpression:a.constant=!1;a.toWatch=[];break;case q.LocalsExpression:a.constant=!1,a.toWatch=[]}}function Id(a){if(1===a.length){a=a[0].expression;var b=a.toWatch;return 1!==b.length?b:b[0]!==a?b:void 0}}function Jd(a){return a.type=== -q.Identifier||a.type===q.MemberExpression}function Kd(a){if(1===a.body.length&&Jd(a.body[0].expression))return{type:q.AssignmentExpression,left:a.body[0].expression,right:{type:q.NGValueParameter},operator:"="}}function Ld(a){this.$filter=a}function Md(a){this.$filter=a}function Nb(a,b,d){this.ast=new q(a,d);this.astCompiler=d.csp?new Md(b):new Ld(b)}function Bc(a){return B(a.valueOf)?a.valueOf():Wg.call(a)}function $f(){var a=T(),b={"true":!0,"false":!1,"null":null,undefined:void 0},d,c;this.addLiteral= -function(a,c){b[a]=c};this.setIdentifierFns=function(a,b){d=a;c=b;return this};this.$get=["$filter",function(e){function f(b,c){var d,f;switch(typeof b){case "string":return f=b=b.trim(),d=a[f],d||(d=new Ob(G),d=(new Nb(d,e,G)).parse(b),a[f]=p(d)),s(d,c);case "function":return s(b,c);default:return s(E,c)}}function g(a,b,c){return null==a||null==b?a===b:"object"!==typeof a||(a=Bc(a),"object"!==typeof a||c)?a===b||a!==a&&b!==b:!1}function k(a,b,c,d,e){var f=d.inputs,h;if(1===f.length){var k=g,f=f[0]; -return a.$watch(function(a){var b=f(a);g(b,k,f.isPure)||(h=d(a,void 0,void 0,[b]),k=b&&Bc(b));return h},b,c,e)}for(var l=[],m=[],n=0,p=f.length;n=c.$$state.status&&e&&e.length&&a(function(){for(var a,c,f=0,g=e.length;fa)for(b in l++,f)ta.call(e,b)||(t--,delete f[b])}else f!==e&&(f=e,l++);return l}}c.$$pure=g(a).literal;c.$stateful=!c.$$pure;var d=this,e,f,h,k=1r&&(A=4-r,N[A]||(N[A]=[]),N[A].push({msg:B(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,newVal:g,oldVal:h}));else if(a===c){s=!1;break a}}catch(E){f(E)}if(!(n=!q.$$suspended&&q.$$watchersCount&&q.$$childHead||q!==y&&q.$$nextSibling))for(;q!==y&&!(n=q.$$nextSibling);)q=q.$parent}while(q=n);if((s||w.length)&&!r--)throw v.$$phase=null,d("infdig",b,N); -}while(s||w.length);for(v.$$phase=null;Jwa)throw Ea("iequirks");var c=ja(W);c.isEnabled=function(){return a};c.trustAs=d.trustAs;c.getTrusted=d.getTrusted;c.valueOf=d.valueOf;a||(c.trustAs=c.getTrusted=function(a,b){return b},c.valueOf=Ta);c.parseAs=function(a,d){var e=b(d);return e.literal&&e.constant?e:b(d,function(b){return c.getTrusted(a,b)})};var e=c.parseAs,f=c.getTrusted,g=c.trustAs;r(W, -function(a,b){var d=K(b);c[("parse_as_"+d).replace(Dc,xb)]=function(b){return e(a,b)};c[("get_trusted_"+d).replace(Dc,xb)]=function(b){return f(a,b)};c[("trust_as_"+d).replace(Dc,xb)]=function(b){return g(a,b)}});return c}]}function fg(){this.$get=["$window","$document",function(a,b){var d={},c=!((!a.nw||!a.nw.process)&&a.chrome&&(a.chrome.app&&a.chrome.app.runtime||!a.chrome.app&&a.chrome.runtime&&a.chrome.runtime.id))&&a.history&&a.history.pushState,e=fa((/android (\d+)/.exec(K((a.navigator||{}).userAgent))|| -[])[1]),f=/Boxee/i.test((a.navigator||{}).userAgent),g=b[0]||{},k=g.body&&g.body.style,h=!1,l=!1;k&&(h=!!("transition"in k||"webkitTransition"in k),l=!!("animation"in k||"webkitAnimation"in k));return{history:!(!c||4>e||f),hasEvent:function(a){if("input"===a&&wa)return!1;if(A(d[a])){var b=g.createElement("div");d[a]="on"+a in b}return d[a]},csp:Ba(),transitions:h,animations:l,android:e}}]}function gg(){this.$get=ia(function(a){return new Yg(a)})}function Yg(a){function b(){var a=e.pop();return a&& -a.cb}function d(a){for(var b=e.length-1;0<=b;--b){var c=e[b];if(c.type===a)return e.splice(b,1),c.cb}}var c={},e=[],f=this.ALL_TASKS_TYPE="$$all$$",g=this.DEFAULT_TASK_TYPE="$$default$$";this.completeTask=function(e,h){h=h||g;try{e()}finally{var l;l=h||g;c[l]&&(c[l]--,c[f]--);l=c[h];var m=c[f];if(!m||!l)for(l=m?d:b;m=l(h);)try{m()}catch(p){a.error(p)}}};this.incTaskCount=function(a){a=a||g;c[a]=(c[a]||0)+1;c[f]=(c[f]||0)+1};this.notifyWhenNoPendingTasks=function(a,b){b=b||f;c[b]?e.push({type:b,cb:a}): -a()}}function ig(){var a;this.httpOptions=function(b){return b?(a=b,this):a};this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(b,d,c,e,f){function g(k,h){g.totalPendingRequests++;if(!C(k)||A(d.get(k)))k=f.getTrustedResourceUrl(k);var l=c.defaults&&c.defaults.transformResponse;H(l)?l=l.filter(function(a){return a!==wc}):l===wc&&(l=null);return c.get(k,S({cache:d,transformResponse:l},a)).finally(function(){g.totalPendingRequests--}).then(function(a){return d.put(k,a.data)}, -function(a){h||(a=Zg("tpload",k,a.status,a.statusText),b(a));return e.reject(a)})}g.totalPendingRequests=0;return g}]}function jg(){this.$get=["$rootScope","$browser","$location",function(a,b,d){return{findBindings:function(a,b,d){a=a.getElementsByClassName("ng-binding");var g=[];r(a,function(a){var c=ca.element(a).data("$binding");c&&r(c,function(c){d?(new RegExp("(^|\\s)"+Od(b)+"(\\s|\\||$)")).test(c)&&g.push(a):-1!==c.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,d){for(var g=["ng-", -"data-ng-","ng\\:"],k=0;kc&&(c=e),c+=+a.slice(e+1),a=a.substring(0,e)):0>c&&(c=a.length);for(e=0;a.charAt(e)===Fc;e++);if(e===(g=a.length))d=[0],c=1;else{for(g--;a.charAt(g)===Fc;)g--;c-=e;d=[];for(f=0;e<=g;e++,f++)d[f]=+a.charAt(e)}c>Yd&&(d=d.splice(0,Yd-1),b=c-1,c=1);return{d:d,e:b,i:c}}function ih(a, -b,d,c){var e=a.d,f=e.length-a.i;b=A(b)?Math.min(Math.max(d,f),c):+b;d=b+a.i;c=e[d];if(0d-1){for(c=0;c>d;c--)e.unshift(0),a.i++;e.unshift(1);a.i++}else e[d-1]++;for(;fk;)h.unshift(0),k++;0=b.lgSize&&k.unshift(h.splice(-b.lgSize,h.length).join(""));h.length>b.gSize;)k.unshift(h.splice(-b.gSize,h.length).join(""));h.length&&k.unshift(h.join(""));h=k.join(d);f.length&&(h+=c+f.join(""));e&&(h+="e+"+e)}return 0>a&&!g?b.negPre+h+b.negSuf:b.posPre+ -h+b.posSuf}function Pb(a,b,d,c){var e="";if(0>a||c&&0>=a)c?a=-a+1:(a=-a,e="-");for(a=""+a;a.length-d)f+=d;0===f&&-12===d&&(f=12);return Pb(f,b,c,e)}}function lb(a,b,d){return function(c,e){var f=c["get"+a](),g=vb((d?"STANDALONE":"")+(b?"SHORT":"")+a);return e[g][f]}}function Zd(a){var b=(new Date(a,0,1)).getDay();return new Date(a,0,(4>=b?5:12)-b)}function $d(a){return function(b){var d= -Zd(b.getFullYear());b=+new Date(b.getFullYear(),b.getMonth(),b.getDate()+(4-b.getDay()))-+d;b=1+Math.round(b/6048E5);return Pb(b,a)}}function Gc(a,b){return 0>=a.getFullYear()?b.ERAS[0]:b.ERAS[1]}function Td(a){function b(a){var b;if(b=a.match(d)){a=new Date(0);var f=0,g=0,k=b[8]?a.setUTCFullYear:a.setFullYear,h=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=fa(b[9]+b[10]),g=fa(b[9]+b[11]));k.call(a,fa(b[1]),fa(b[2])-1,fa(b[3]));f=fa(b[4]||0)-f;g=fa(b[5]||0)-g;k=fa(b[6]||0);b=Math.round(1E3*parseFloat("0."+ -(b[7]||0)));h.call(a,f,g,k,b)}return a}var d=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,d,f){var g="",k=[],h,l;d=d||"mediumDate";d=a.DATETIME_FORMATS[d]||d;C(c)&&(c=jh.test(c)?fa(c):b(c));X(c)&&(c=new Date(c));if(!ha(c)||!isFinite(c.getTime()))return c;for(;d;)(l=kh.exec(d))?(k=db(k,l,1),d=k.pop()):(k.push(d),d=null);var m=c.getTimezoneOffset();f&&(m=fc(f,m),c=gc(c,f,!0));r(k,function(b){h=lh[b];g+=h?h(c,a.DATETIME_FORMATS, -m):"''"===b?"'":b.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function ch(){return function(a,b){A(b)&&(b=2);return eb(a,b)}}function dh(){return function(a,b,d){b=Infinity===Math.abs(Number(b))?Number(b):fa(b);if(Y(b))return a;X(a)&&(a=a.toString());if(!za(a))return a;d=!d||isNaN(d)?0:fa(d);d=0>d?Math.max(0,a.length+d):d;return 0<=b?Hc(a,d,d+b):0===d?Hc(a,b,a.length):Hc(a,Math.max(0,d+b),d)}}function Hc(a,b,d){return C(a)?a.slice(b,d):Ha.call(a,b,d)}function Vd(a){function b(b){return b.map(function(b){var c= -1,d=Ta;if(B(b))d=b;else if(C(b)){if("+"===b.charAt(0)||"-"===b.charAt(0))c="-"===b.charAt(0)?-1:1,b=b.substring(1);if(""!==b&&(d=a(b),d.constant))var e=d(),d=function(a){return a[e]}}return{get:d,descending:c}})}function d(a){switch(typeof a){case "number":case "boolean":case "string":return!0;default:return!1}}function c(a,b){var c=0,d=a.type,h=b.type;if(d===h){var h=a.value,l=b.value;"string"===d?(h=h.toLowerCase(),l=l.toLowerCase()):"object"===d&&(D(h)&&(h=a.index),D(l)&&(l=b.index));h!==l&&(c= -hb||37<=b&&40>=b|| -m(a,this,this.value)});if(e.hasEvent("paste"))b.on("paste cut drop",m)}b.on("change",l);if(ee[g]&&c.$$hasNativeValidators&&g===d.type)b.on("keydown wheel mousedown",function(a){if(!h){var b=this.validity,c=b.badInput,d=b.typeMismatch;h=f.defer(function(){h=null;b.badInput===c&&b.typeMismatch===d||l(a)})}});c.$render=function(){var a=c.$isEmpty(c.$viewValue)?"":c.$viewValue;b.val()!==a&&b.val(a)}}function Rb(a,b){return function(d,c){var e,f;if(ha(d))return d;if(C(d)){'"'===d.charAt(0)&&'"'===d.charAt(d.length- -1)&&(d=d.substring(1,d.length-1));if(mh.test(d))return new Date(d);a.lastIndex=0;if(e=a.exec(d))return e.shift(),f=c?{yyyy:c.getFullYear(),MM:c.getMonth()+1,dd:c.getDate(),HH:c.getHours(),mm:c.getMinutes(),ss:c.getSeconds(),sss:c.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(e,function(a,c){cf.yyyy&&e.setFullYear(f.yyyy),e}return NaN}}function ob(a,b,d,c){return function(e,f,g,k,h,l,m, -p){function n(a){return a&&!(a.getTime&&a.getTime()!==a.getTime())}function s(a){return w(a)&&!ha(a)?r(a)||void 0:a}function r(a,b){var c=k.$options.getOption("timezone");v&&v!==c&&(b=Uc(b,fc(v)));var e=d(a,b);!isNaN(e)&&c&&(e=gc(e,c));return e}Jc(e,f,g,k,a);Sa(e,f,g,k,h,l);var t="time"===a||"datetimelocal"===a,q,v;k.$parsers.push(function(c){if(k.$isEmpty(c))return null;if(b.test(c))return r(c,q);k.$$parserName=a});k.$formatters.push(function(a){if(a&&!ha(a))throw pb("datefmt",a);if(n(a)){q=a;var b= -k.$options.getOption("timezone");b&&(v=b,q=gc(q,b,!0));var d=c;t&&C(k.$options.getOption("timeSecondsFormat"))&&(d=c.replace("ss.sss",k.$options.getOption("timeSecondsFormat")).replace(/:$/,""));a=m("date")(a,d,b);t&&k.$options.getOption("timeStripZeroSeconds")&&(a=a.replace(/(?::00)?(?:\.000)?$/,""));return a}v=q=null;return""});if(w(g.min)||g.ngMin){var x=g.min||p(g.ngMin)(e),z=s(x);k.$validators.min=function(a){return!n(a)||A(z)||d(a)>=z};g.$observe("min",function(a){a!==x&&(z=s(a),x=a,k.$validate())})}if(w(g.max)|| -g.ngMax){var y=g.max||p(g.ngMax)(e),J=s(y);k.$validators.max=function(a){return!n(a)||A(J)||d(a)<=J};g.$observe("max",function(a){a!==y&&(J=s(a),y=a,k.$validate())})}}}function Jc(a,b,d,c,e){(c.$$hasNativeValidators=D(b[0].validity))&&c.$parsers.push(function(a){var d=b.prop("validity")||{};if(d.badInput||d.typeMismatch)c.$$parserName=e;else return a})}function fe(a){a.$parsers.push(function(b){if(a.$isEmpty(b))return null;if(nh.test(b))return parseFloat(b);a.$$parserName="number"});a.$formatters.push(function(b){if(!a.$isEmpty(b)){if(!X(b))throw pb("numfmt", -b);b=b.toString()}return b})}function na(a){w(a)&&!X(a)&&(a=parseFloat(a));return Y(a)?void 0:a}function Kc(a){var b=a.toString(),d=b.indexOf(".");return-1===d?-1a&&(a=/e-(\d+)$/.exec(b))?Number(a[1]):0:b.length-d-1}function ge(a,b,d){a=Number(a);var c=(a|0)!==a,e=(b|0)!==b,f=(d|0)!==d;if(c||e||f){var g=c?Kc(a):0,k=e?Kc(b):0,h=f?Kc(d):0,g=Math.max(g,k,h),g=Math.pow(10,g);a*=g;b*=g;d*=g;c&&(a=Math.round(a));e&&(b=Math.round(b));f&&(d=Math.round(d))}return 0===(a-b)%d}function he(a,b,d,c,e){if(w(c)){a= -a(c);if(!a.constant)throw pb("constexpr",d,c);return a(b)}return e}function Lc(a,b){function d(a,b){if(!a||!a.length)return[];if(!b||!b.length)return a;var c=[],d=0;a:for(;d(?:<\/\1>|)$/,nc=/<|&#?\w+;/,rg=/<([\w:-]+)/,sg=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,qa={thead:["table"],col:["colgroup","table"],tr:["tbody","table"],td:["tr", -"tbody","table"]};qa.tbody=qa.tfoot=qa.colgroup=qa.caption=qa.thead;qa.th=qa.td;var hb={option:[1,'"],_default:[0,"",""]},Nc;for(Nc in qa){var le=qa[Nc],me=le.slice().reverse();hb[Nc]=[me.length,"<"+me.join("><")+">",""]}hb.optgroup=hb.option;var zg=z.Node.prototype.contains||function(a){return!!(this.compareDocumentPosition(a)&16)},Wa=U.prototype={ready:hd,toString:function(){var a=[];r(this,function(b){a.push(""+b)});return"["+a.join(", ")+ -"]"},eq:function(a){return 0<=a?x(this[a]):x(this[this.length+a])},length:0,push:ph,sort:[].sort,splice:[].splice},Hb={};r("multiple selected checked disabled readOnly required open".split(" "),function(a){Hb[K(a)]=a});var od={};r("input select option textarea button form details".split(" "),function(a){od[a]=!0});var vd={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};r({data:sc,removeData:rc,hasData:function(a){for(var b in Ka[a.ng339])return!0; -return!1},cleanData:function(a){for(var b=0,d=a.length;b/,Cg=/^[^(]*\(\s*([^)]*)\)/m,sh=/,/,th=/^\s*(_?)(\S+?)\1\s*$/,Ag=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ca=F("$injector");fb.$$annotate=function(a,b,d){var c;if("function"===typeof a){if(!(c=a.$inject)){c=[];if(a.length){if(b)throw C(d)&&d||(d=a.name||Dg(a)),Ca("strictdi",d);b=qd(a);r(b[1].split(sh),function(a){a.replace(th,function(a,b,d){c.push(d)})})}a.$inject=c}}else H(a)?(b=a.length-1,tb(a[b],"fn"),c=a.slice(0,b)):tb(a,"fn",!0);return c};var ne=F("$animate"), -Ef=function(){this.$get=E},Ff=function(){var a=new Ib,b=[];this.$get=["$$AnimateRunner","$rootScope",function(d,c){function e(a,b,c){var d=!1;b&&(b=C(b)?b.split(" "):H(b)?b:[],r(b,function(b){b&&(d=!0,a[b]=c)}));return d}function f(){r(b,function(b){var c=a.get(b);if(c){var d=Eg(b.attr("class")),e="",f="";r(c,function(a,b){a!==!!d[b]&&(a?e+=(e.length?" ":"")+b:f+=(f.length?" ":"")+b)});r(b,function(a){e&&Eb(a,e);f&&Db(a,f)});a.delete(b)}});b.length=0}return{enabled:E,on:E,off:E,pin:E,push:function(g, -k,h,l){l&&l();h=h||{};h.from&&g.css(h.from);h.to&&g.css(h.to);if(h.addClass||h.removeClass)if(k=h.addClass,l=h.removeClass,h=a.get(g)||{},k=e(h,k,!0),l=e(h,l,!1),k||l)a.set(g,h),b.push(g),1===b.length&&c.$$postDigest(f);g=new d;g.complete();return g}}}]},Cf=["$provide",function(a){var b=this,d=null,c=null;this.$$registeredAnimations=Object.create(null);this.register=function(c,d){if(c&&"."!==c.charAt(0))throw ne("notcsel",c);var g=c+"-animation";b.$$registeredAnimations[c.substr(1)]=g;a.factory(g, -d)};this.customFilter=function(a){1===arguments.length&&(c=B(a)?a:null);return c};this.classNameFilter=function(a){if(1===arguments.length&&(d=a instanceof RegExp?a:null)&&/[(\s|\/)]ng-animate[(\s|\/)]/.test(d.toString()))throw d=null,ne("nongcls","ng-animate");return d};this.$get=["$$animateQueue",function(a){function b(a,c,d){if(d){var e;a:{for(e=0;e <= >= && || ! = |".split(" "),function(a){Vb[a]= -!0});var wh={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Ob=function(a){this.options=a};Ob.prototype={constructor:Ob,lex:function(a){this.text=a;this.index=0;for(this.tokens=[];this.index=a&&"string"=== -typeof a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdentifierStart:function(a){return this.options.isIdentifierStart?this.options.isIdentifierStart(a,this.codePointAt(a)):this.isValidIdentifierStart(a)},isValidIdentifierStart:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isIdentifierContinue:function(a){return this.options.isIdentifierContinue?this.options.isIdentifierContinue(a,this.codePointAt(a)):this.isValidIdentifierContinue(a)}, -isValidIdentifierContinue:function(a,b){return this.isValidIdentifierStart(a,b)||this.isNumber(a)},codePointAt:function(a){return 1===a.length?a.charCodeAt(0):(a.charCodeAt(0)<<10)+a.charCodeAt(1)-56613888},peekMultichar:function(){var a=this.text.charAt(this.index),b=this.peek();if(!b)return a;var d=a.charCodeAt(0),c=b.charCodeAt(0);return 55296<=d&&56319>=d&&56320<=c&&57343>=c?a+b:a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,b,d){d=d||this.index;b= -w(b)?"s "+b+"-"+this.index+" ["+this.text.substring(b,d)+"]":" "+d;throw Ya("lexerr",a,b,this.text);},readNumber:function(){for(var a="",b=this.index;this.index","<=",">=");)a={type:q.BinaryExpression,operator:b.text, -left:a,right:this.additive()};return a},additive:function(){for(var a=this.multiplicative(),b;b=this.expect("+","-");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.multiplicative()};return a},multiplicative:function(){for(var a=this.unary(),b;b=this.expect("*","/","%");)a={type:q.BinaryExpression,operator:b.text,left:a,right:this.unary()};return a},unary:function(){var a;return(a=this.expect("+","-","!"))?{type:q.UnaryExpression,operator:a.text,prefix:!0,argument:this.unary()}:this.primary()}, -primary:function(){var a;this.expect("(")?(a=this.filterChain(),this.consume(")")):this.expect("[")?a=this.arrayDeclaration():this.expect("{")?a=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?a=Ia(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?a={type:q.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?a=this.identifier():this.peek().constant?a=this.constant():this.throwError("not a primary expression", -this.peek());for(var b;b=this.expect("(","[",".");)"("===b.text?(a={type:q.CallExpression,callee:a,arguments:this.parseArguments()},this.consume(")")):"["===b.text?(a={type:q.MemberExpression,object:a,property:this.expression(),computed:!0},this.consume("]")):"."===b.text?a={type:q.MemberExpression,object:a,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return a},filter:function(a){a=[a];for(var b={type:q.CallExpression,callee:this.identifier(),arguments:a,filter:!0};this.expect(":");)a.push(this.expression()); -return b},parseArguments:function(){var a=[];if(")"!==this.peekToken().text){do a.push(this.filterChain());while(this.expect(","))}return a},identifier:function(){var a=this.consume();a.identifier||this.throwError("is not a valid identifier",a);return{type:q.Identifier,name:a.text}},constant:function(){return{type:q.Literal,value:this.consume().value}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;a.push(this.expression())}while(this.expect(","))}this.consume("]"); -return{type:q.ArrayExpression,elements:a}},object:function(){var a=[],b;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;b={type:q.Property,kind:"init"};this.peek().constant?(b.key=this.constant(),b.computed=!1,this.consume(":"),b.value=this.expression()):this.peek().identifier?(b.key=this.identifier(),b.computed=!1,this.peek(":")?(this.consume(":"),b.value=this.expression()):b.value=b.key):this.peek("[")?(this.consume("["),b.key=this.expression(),this.consume("]"),b.computed=!0,this.consume(":"), -b.value=this.expression()):this.throwError("invalid key",this.peek());a.push(b)}while(this.expect(","))}this.consume("}");return{type:q.ObjectExpression,properties:a}},throwError:function(a,b){throw Ya("syntax",b.text,a,b.index+1,this.text,this.text.substring(b.index));},consume:function(a){if(0===this.tokens.length)throw Ya("ueoe",this.text);var b=this.expect(a);b||this.throwError("is unexpected, expecting ["+a+"]",this.peek());return b},peekToken:function(){if(0===this.tokens.length)throw Ya("ueoe", -this.text);return this.tokens[0]},peek:function(a,b,d,c){return this.peekAhead(0,a,b,d,c)},peekAhead:function(a,b,d,c,e){if(this.tokens.length>a){a=this.tokens[a];var f=a.text;if(f===b||f===d||f===c||f===e||!(b||d||c||e))return a}return!1},expect:function(a,b,d,c){return(a=this.peek(a,b,d,c))?(this.tokens.shift(),a):!1},selfReferential:{"this":{type:q.ThisExpression},$locals:{type:q.LocalsExpression}}};var Hd=2;Ld.prototype={compile:function(a){var b=this;this.state={nextId:0,filters:{},fn:{vars:[], -body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]};Z(a,b.$filter);var d="",c;this.stage="assign";if(c=Kd(a))this.state.computing="assign",d=this.nextId(),this.recurse(c,d),this.return_(d),d="fn.assign="+this.generateFunction("assign","s,v,l");c=Id(a.body);b.stage="inputs";r(c,function(a,c){var d="fn"+c;b.state[d]={vars:[],body:[],own:{}};b.state.computing=d;var k=b.nextId();b.recurse(a,k);b.return_(k);b.state.inputs.push({name:d,isPure:a.isPure});a.watchId=c});this.state.computing="fn";this.stage= -"main";this.recurse(a);a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+d+this.watchFns()+"return fn;";a=(new Function("$filter","getStringValue","ifDefined","plus",a))(this.$filter,Tg,Ug,Gd);this.state=this.stage=void 0;return a},USE:"use",STRICT:"strict",watchFns:function(){var a=[],b=this.state.inputs,d=this;r(b,function(b){a.push("var "+b.name+"="+d.generateFunction(b.name,"s"));b.isPure&&a.push(b.name,".isPure="+JSON.stringify(b.isPure)+ -";")});b.length&&a.push("fn.inputs=["+b.map(function(a){return a.name}).join(",")+"];");return a.join("")},generateFunction:function(a,b){return"function("+b+"){"+this.varsPrefix(a)+this.body(a)+"};"},filterPrefix:function(){var a=[],b=this;r(this.state.filters,function(d,c){a.push(d+"=$filter("+b.escape(c)+")")});return a.length?"var "+a.join(",")+";":""},varsPrefix:function(a){return this.state[a].vars.length?"var "+this.state[a].vars.join(",")+";":""},body:function(a){return this.state[a].body.join("")}, -recurse:function(a,b,d,c,e,f){var g,k,h=this,l,m,p;c=c||E;if(!f&&w(a.watchId))b=b||this.nextId(),this.if_("i",this.lazyAssign(b,this.computedMember("i",a.watchId)),this.lazyRecurse(a,b,d,c,e,!0));else switch(a.type){case q.Program:r(a.body,function(b,c){h.recurse(b.expression,void 0,void 0,function(a){k=a});c!==a.body.length-1?h.current().body.push(k,";"):h.return_(k)});break;case q.Literal:m=this.escape(a.value);this.assign(b,m);c(b||m);break;case q.UnaryExpression:this.recurse(a.argument,void 0, -void 0,function(a){k=a});m=a.operator+"("+this.ifDefined(k,0)+")";this.assign(b,m);c(m);break;case q.BinaryExpression:this.recurse(a.left,void 0,void 0,function(a){g=a});this.recurse(a.right,void 0,void 0,function(a){k=a});m="+"===a.operator?this.plus(g,k):"-"===a.operator?this.ifDefined(g,0)+a.operator+this.ifDefined(k,0):"("+g+")"+a.operator+"("+k+")";this.assign(b,m);c(m);break;case q.LogicalExpression:b=b||this.nextId();h.recurse(a.left,b);h.if_("&&"===a.operator?b:h.not(b),h.lazyRecurse(a.right, -b));c(b);break;case q.ConditionalExpression:b=b||this.nextId();h.recurse(a.test,b);h.if_(b,h.lazyRecurse(a.alternate,b),h.lazyRecurse(a.consequent,b));c(b);break;case q.Identifier:b=b||this.nextId();d&&(d.context="inputs"===h.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",a.name)+"?l:s"),d.computed=!1,d.name=a.name);h.if_("inputs"===h.stage||h.not(h.getHasOwnProperty("l",a.name)),function(){h.if_("inputs"===h.stage||"s",function(){e&&1!==e&&h.if_(h.isNull(h.nonComputedMember("s",a.name)), -h.lazyAssign(h.nonComputedMember("s",a.name),"{}"));h.assign(b,h.nonComputedMember("s",a.name))})},b&&h.lazyAssign(b,h.nonComputedMember("l",a.name)));c(b);break;case q.MemberExpression:g=d&&(d.context=this.nextId())||this.nextId();b=b||this.nextId();h.recurse(a.object,g,void 0,function(){h.if_(h.notNull(g),function(){a.computed?(k=h.nextId(),h.recurse(a.property,k),h.getStringValue(k),e&&1!==e&&h.if_(h.not(h.computedMember(g,k)),h.lazyAssign(h.computedMember(g,k),"{}")),m=h.computedMember(g,k),h.assign(b, -m),d&&(d.computed=!0,d.name=k)):(e&&1!==e&&h.if_(h.isNull(h.nonComputedMember(g,a.property.name)),h.lazyAssign(h.nonComputedMember(g,a.property.name),"{}")),m=h.nonComputedMember(g,a.property.name),h.assign(b,m),d&&(d.computed=!1,d.name=a.property.name))},function(){h.assign(b,"undefined")});c(b)},!!e);break;case q.CallExpression:b=b||this.nextId();a.filter?(k=h.filter(a.callee.name),l=[],r(a.arguments,function(a){var b=h.nextId();h.recurse(a,b);l.push(b)}),m=k+"("+l.join(",")+")",h.assign(b,m),c(b)): -(k=h.nextId(),g={},l=[],h.recurse(a.callee,k,g,function(){h.if_(h.notNull(k),function(){r(a.arguments,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m=g.name?h.member(g.context,g.name,g.computed)+"("+l.join(",")+")":k+"("+l.join(",")+")";h.assign(b,m)},function(){h.assign(b,"undefined")});c(b)}));break;case q.AssignmentExpression:k=this.nextId();g={};this.recurse(a.left,void 0,g,function(){h.if_(h.notNull(g.context),function(){h.recurse(a.right,k);m=h.member(g.context, -g.name,g.computed)+a.operator+k;h.assign(b,m);c(b||m)})},1);break;case q.ArrayExpression:l=[];r(a.elements,function(b){h.recurse(b,a.constant?void 0:h.nextId(),void 0,function(a){l.push(a)})});m="["+l.join(",")+"]";this.assign(b,m);c(b||m);break;case q.ObjectExpression:l=[];p=!1;r(a.properties,function(a){a.computed&&(p=!0)});p?(b=b||this.nextId(),this.assign(b,"{}"),r(a.properties,function(a){a.computed?(g=h.nextId(),h.recurse(a.key,g)):g=a.key.type===q.Identifier?a.key.name:""+a.key.value;k=h.nextId(); -h.recurse(a.value,k);h.assign(h.member(b,g,a.computed),k)})):(r(a.properties,function(b){h.recurse(b.value,a.constant?void 0:h.nextId(),void 0,function(a){l.push(h.escape(b.key.type===q.Identifier?b.key.name:""+b.key.value)+":"+a)})}),m="{"+l.join(",")+"}",this.assign(b,m));c(b||m);break;case q.ThisExpression:this.assign(b,"s");c(b||"s");break;case q.LocalsExpression:this.assign(b,"l");c(b||"l");break;case q.NGValueParameter:this.assign(b,"v"),c(b||"v")}},getHasOwnProperty:function(a,b){var d=a+"."+ -b,c=this.current().own;c.hasOwnProperty(d)||(c[d]=this.nextId(!1,a+"&&("+this.escape(b)+" in "+a+")"));return c[d]},assign:function(a,b){if(a)return this.current().body.push(a,"=",b,";"),a},filter:function(a){this.state.filters.hasOwnProperty(a)||(this.state.filters[a]=this.nextId(!0));return this.state.filters[a]},ifDefined:function(a,b){return"ifDefined("+a+","+this.escape(b)+")"},plus:function(a,b){return"plus("+a+","+b+")"},return_:function(a){this.current().body.push("return ",a,";")},if_:function(a, -b,d){if(!0===a)b();else{var c=this.current().body;c.push("if(",a,"){");b();c.push("}");d&&(c.push("else{"),d(),c.push("}"))}},not:function(a){return"!("+a+")"},isNull:function(a){return a+"==null"},notNull:function(a){return a+"!=null"},nonComputedMember:function(a,b){var d=/[^$_a-zA-Z0-9]/g;return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(b)?a+"."+b:a+'["'+b.replace(d,this.stringEscapeFn)+'"]'},computedMember:function(a,b){return a+"["+b+"]"},member:function(a,b,d){return d?this.computedMember(a,b):this.nonComputedMember(a, -b)},getStringValue:function(a){this.assign(a,"getStringValue("+a+")")},lazyRecurse:function(a,b,d,c,e,f){var g=this;return function(){g.recurse(a,b,d,c,e,f)}},lazyAssign:function(a,b){var d=this;return function(){d.assign(a,b)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)},escape:function(a){if(C(a))return"'"+a.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(X(a))return a.toString();if(!0===a)return"true";if(!1=== -a)return"false";if(null===a)return"null";if("undefined"===typeof a)return"undefined";throw Ya("esc");},nextId:function(a,b){var d="v"+this.state.nextId++;a||this.current().vars.push(d+(b?"="+b:""));return d},current:function(){return this.state[this.state.computing]}};Md.prototype={compile:function(a){var b=this;Z(a,b.$filter);var d,c;if(d=Kd(a))c=this.recurse(d);d=Id(a.body);var e;d&&(e=[],r(d,function(a,c){var d=b.recurse(a);d.isPure=a.isPure;a.input=d;e.push(d);a.watchId=c}));var f=[];r(a.body, -function(a){f.push(b.recurse(a.expression))});a=0===a.body.length?E:1===a.body.length?f[0]:function(a,b){var c;r(f,function(d){c=d(a,b)});return c};c&&(a.assign=function(a,b,d){return c(a,d,b)});e&&(a.inputs=e);return a},recurse:function(a,b,d){var c,e,f=this,g;if(a.input)return this.inputs(a.input,a.watchId);switch(a.type){case q.Literal:return this.value(a.value,b);case q.UnaryExpression:return e=this.recurse(a.argument),this["unary"+a.operator](e,b);case q.BinaryExpression:return c=this.recurse(a.left), -e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.LogicalExpression:return c=this.recurse(a.left),e=this.recurse(a.right),this["binary"+a.operator](c,e,b);case q.ConditionalExpression:return this["ternary?:"](this.recurse(a.test),this.recurse(a.alternate),this.recurse(a.consequent),b);case q.Identifier:return f.identifier(a.name,b,d);case q.MemberExpression:return c=this.recurse(a.object,!1,!!d),a.computed||(e=a.property.name),a.computed&&(e=this.recurse(a.property)),a.computed?this.computedMember(c, -e,b,d):this.nonComputedMember(c,e,b,d);case q.CallExpression:return g=[],r(a.arguments,function(a){g.push(f.recurse(a))}),a.filter&&(e=this.$filter(a.callee.name)),a.filter||(e=this.recurse(a.callee,!0)),a.filter?function(a,c,d,f){for(var p=[],n=0;n":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)>b(c,e,f,g);return d?{value:c}:c}},"binary<=":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)<=b(c,e,f,g);return d?{value:c}:c}},"binary>=":function(a,b,d){return function(c,e,f,g){c= -a(c,e,f,g)>=b(c,e,f,g);return d?{value:c}:c}},"binary&&":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)&&b(c,e,f,g);return d?{value:c}:c}},"binary||":function(a,b,d){return function(c,e,f,g){c=a(c,e,f,g)||b(c,e,f,g);return d?{value:c}:c}},"ternary?:":function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k)?b(e,f,g,k):d(e,f,g,k);return c?{value:e}:e}},value:function(a,b){return function(){return b?{context:void 0,name:void 0,value:a}:a}},identifier:function(a,b,d){return function(c,e,f,g){c= -e&&a in e?e:c;d&&1!==d&&c&&null==c[a]&&(c[a]={});e=c?c[a]:void 0;return b?{context:c,name:a,value:e}:e}},computedMember:function(a,b,d,c){return function(e,f,g,k){var h=a(e,f,g,k),l,m;null!=h&&(l=b(e,f,g,k),l+="",c&&1!==c&&h&&!h[l]&&(h[l]={}),m=h[l]);return d?{context:h,name:l,value:m}:m}},nonComputedMember:function(a,b,d,c){return function(e,f,g,k){e=a(e,f,g,k);c&&1!==c&&e&&null==e[b]&&(e[b]={});f=null!=e?e[b]:void 0;return d?{context:e,name:b,value:f}:f}},inputs:function(a,b){return function(d, -c,e,f){return f?f[b]:a(d,c,e)}}};Nb.prototype={constructor:Nb,parse:function(a){a=this.getAst(a);var b=this.astCompiler.compile(a.ast),d=a.ast;b.literal=0===d.body.length||1===d.body.length&&(d.body[0].expression.type===q.Literal||d.body[0].expression.type===q.ArrayExpression||d.body[0].expression.type===q.ObjectExpression);b.constant=a.ast.constant;b.oneTime=a.oneTime;return b},getAst:function(a){var b=!1;a=a.trim();":"===a.charAt(0)&&":"===a.charAt(1)&&(b=!0,a=a.substring(2));return{ast:this.ast.ast(a), -oneTime:b}}};var Ea=F("$sce"),W={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Dc=/_([a-z])/g,Zg=F("$templateRequest"),$g=F("$timeout"),aa=z.document.createElement("a"),Qd=ga(z.location.href),Na;aa.href="http://[::1]";var ah="[::1]"===aa.hostname;Rd.$inject=["$document"];fd.$inject=["$provide"];var Yd=22,Xd=".",Fc="0";Sd.$inject=["$locale"];Ud.$inject=["$locale"];var lh={yyyy:ea("FullYear",4,0,!1,!0),yy:ea("FullYear",2,0,!0,!0),y:ea("FullYear",1,0,!1,!0), -MMMM:lb("Month"),MMM:lb("Month",!0),MM:ea("Month",2,1),M:ea("Month",1,1),LLLL:lb("Month",!1,!0),dd:ea("Date",2),d:ea("Date",1),HH:ea("Hours",2),H:ea("Hours",1),hh:ea("Hours",2,-12),h:ea("Hours",1,-12),mm:ea("Minutes",2),m:ea("Minutes",1),ss:ea("Seconds",2),s:ea("Seconds",1),sss:ea("Milliseconds",3),EEEE:lb("Day"),EEE:lb("Day",!0),a:function(a,b){return 12>a.getHours()?b.AMPMS[0]:b.AMPMS[1]},Z:function(a,b,d){a=-1*d;return a=(0<=a?"+":"")+(Pb(Math[0=a.getFullYear()?b.ERANAMES[0]:b.ERANAMES[1]}},kh=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,jh=/^-?\d+$/;Td.$inject=["$locale"];var eh=ia(K),fh=ia(vb);Vd.$inject=["$parse"];var Re=ia({restrict:"E",compile:function(a,b){if(!b.href&&!b.xlinkHref)return function(a,b){if("a"===b[0].nodeName.toLowerCase()){var e="[object SVGAnimatedString]"===la.call(b.prop("href"))?"xlink:href":"href"; -b.on("click",function(a){b.attr(e)||a.preventDefault()})}}}}),wb={};r(Hb,function(a,b){function d(a,d,e){a.$watch(e[c],function(a){e.$set(b,!!a)})}if("multiple"!==a){var c=xa("ng-"+b),e=d;"checked"===a&&(e=function(a,b,e){e.ngModel!==e[c]&&d(a,b,e)});wb[c]=function(){return{restrict:"A",priority:100,link:e}}}});r(vd,function(a,b){wb[b]=function(){return{priority:100,link:function(a,c,e){if("ngPattern"===b&&"/"===e.ngPattern.charAt(0)&&(c=e.ngPattern.match(ke))){e.$set("ngPattern",new RegExp(c[1], -c[2]));return}a.$watch(e[b],function(a){e.$set(b,a)})}}}});r(["src","srcset","href"],function(a){var b=xa("ng-"+a);wb[b]=["$sce",function(d){return{priority:99,link:function(c,e,f){var g=a,k=a;"href"===a&&"[object SVGAnimatedString]"===la.call(e.prop("href"))&&(k="xlinkHref",f.$attr[k]="xlink:href",g=null);f.$set(b,d.getTrustedMediaUrl(f[b]));f.$observe(b,function(b){b?(f.$set(k,b),wa&&g&&e.prop(g,f[k])):"href"===a&&f.$set(k,null)})}}}]});var mb={$addControl:E,$getControls:ia([]),$$renameControl:function(a, -b){a.$name=b},$removeControl:E,$setValidity:E,$setDirty:E,$setPristine:E,$setSubmitted:E,$$setSubmitted:E};Qb.$inject=["$element","$attrs","$scope","$animate","$interpolate"];Qb.prototype={$rollbackViewValue:function(){r(this.$$controls,function(a){a.$rollbackViewValue()})},$commitViewValue:function(){r(this.$$controls,function(a){a.$commitViewValue()})},$addControl:function(a){Ja(a.$name,"input");this.$$controls.push(a);a.$name&&(this[a.$name]=a);a.$$parentForm=this},$getControls:function(){return ja(this.$$controls)}, -$$renameControl:function(a,b){var d=a.$name;this[d]===a&&delete this[d];this[b]=a;a.$name=b},$removeControl:function(a){a.$name&&this[a.$name]===a&&delete this[a.$name];r(this.$pending,function(b,d){this.$setValidity(d,null,a)},this);r(this.$error,function(b,d){this.$setValidity(d,null,a)},this);r(this.$$success,function(b,d){this.$setValidity(d,null,a)},this);cb(this.$$controls,a);a.$$parentForm=mb},$setDirty:function(){this.$$animate.removeClass(this.$$element,Za);this.$$animate.addClass(this.$$element, -Wb);this.$dirty=!0;this.$pristine=!1;this.$$parentForm.$setDirty()},$setPristine:function(){this.$$animate.setClass(this.$$element,Za,Wb+" ng-submitted");this.$dirty=!1;this.$pristine=!0;this.$submitted=!1;r(this.$$controls,function(a){a.$setPristine()})},$setUntouched:function(){r(this.$$controls,function(a){a.$setUntouched()})},$setSubmitted:function(){for(var a=this;a.$$parentForm&&a.$$parentForm!==mb;)a=a.$$parentForm;a.$$setSubmitted()},$$setSubmitted:function(){this.$$animate.addClass(this.$$element, -"ng-submitted");this.$submitted=!0;r(this.$$controls,function(a){a.$$setSubmitted&&a.$$setSubmitted()})}};ce({clazz:Qb,set:function(a,b,d){var c=a[b];c?-1===c.indexOf(d)&&c.push(d):a[b]=[d]},unset:function(a,b,d){var c=a[b];c&&(cb(c,d),0===c.length&&delete a[b])}});var oe=function(a){return["$timeout","$parse",function(b,d){function c(a){return""===a?d('this[""]').assign:d(a).assign||E}return{name:"form",restrict:a?"EAC":"E",require:["form","^^?form"],controller:Qb,compile:function(d,f){d.addClass(Za).addClass(nb); -var g=f.name?"name":a&&f.ngForm?"ngForm":!1;return{pre:function(a,d,e,f){var p=f[0];if(!("action"in e)){var n=function(b){a.$apply(function(){p.$commitViewValue();p.$setSubmitted()});b.preventDefault()};d[0].addEventListener("submit",n);d.on("$destroy",function(){b(function(){d[0].removeEventListener("submit",n)},0,!1)})}(f[1]||p.$$parentForm).$addControl(p);var s=g?c(p.$name):E;g&&(s(a,p),e.$observe(g,function(b){p.$name!==b&&(s(a,void 0),p.$$parentForm.$$renameControl(p,b),s=c(p.$name),s(a,p))})); -d.on("$destroy",function(){p.$$parentForm.$removeControl(p);s(a,void 0);S(p,mb)})}}}}}]},Se=oe(),df=oe(!0),mh=/^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/,xh=/^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i,yh=/^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+/0-9=?A-Z^_`a-z{|}~]+)*@[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])?)*$/, -nh=/^\s*(-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/,pe=/^(\d{4,})-(\d{2})-(\d{2})$/,qe=/^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Oc=/^(\d{4,})-W(\d\d)$/,re=/^(\d{4,})-(\d\d)$/,se=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,ee=T();r(["date","datetime-local","month","time","week"],function(a){ee[a]=!0});var te={text:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c)},date:ob("date",pe,Rb(pe,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":ob("datetimelocal",qe,Rb(qe,"yyyy MM dd HH mm ss sss".split(" ")), -"yyyy-MM-ddTHH:mm:ss.sss"),time:ob("time",se,Rb(se,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:ob("week",Oc,function(a,b){if(ha(a))return a;if(C(a)){Oc.lastIndex=0;var d=Oc.exec(a);if(d){var c=+d[1],e=+d[2],f=d=0,g=0,k=0,h=Zd(c),e=7*(e-1);b&&(d=b.getHours(),f=b.getMinutes(),g=b.getSeconds(),k=b.getMilliseconds());return new Date(c,0,h.getDate()+e,d,f,g,k)}}return NaN},"yyyy-Www"),month:ob("month",re,Rb(re,["yyyy","MM"]),"yyyy-MM"),number:function(a,b,d,c,e,f,g,k){Jc(a,b,d,c,"number");fe(c);Sa(a, -b,d,c,e,f);var h;if(w(d.min)||d.ngMin){var l=d.min||k(d.ngMin)(a);h=na(l);c.$validators.min=function(a,b){return c.$isEmpty(b)||A(h)||b>=h};d.$observe("min",function(a){a!==l&&(h=na(a),l=a,c.$validate())})}if(w(d.max)||d.ngMax){var m=d.max||k(d.ngMax)(a),p=na(m);c.$validators.max=function(a,b){return c.$isEmpty(b)||A(p)||b<=p};d.$observe("max",function(a){a!==m&&(p=na(a),m=a,c.$validate())})}if(w(d.step)||d.ngStep){var n=d.step||k(d.ngStep)(a),s=na(n);c.$validators.step=function(a,b){return c.$isEmpty(b)|| -A(s)||ge(b,h||0,s)};d.$observe("step",function(a){a!==n&&(s=na(a),n=a,c.$validate())})}},url:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c);c.$validators.url=function(a,b){var d=a||b;return c.$isEmpty(d)||xh.test(d)}},email:function(a,b,d,c,e,f){Sa(a,b,d,c,e,f);Ic(c);c.$validators.email=function(a,b){var d=a||b;return c.$isEmpty(d)||yh.test(d)}},radio:function(a,b,d,c){var e=!d.ngTrim||"false"!==V(d.ngTrim);A(d.name)&&b.attr("name",++qb);b.on("change",function(a){var g;b[0].checked&&(g=d.value,e&&(g= -V(g)),c.$setViewValue(g,a&&a.type))});c.$render=function(){var a=d.value;e&&(a=V(a));b[0].checked=a===c.$viewValue};d.$observe("value",c.$render)},range:function(a,b,d,c,e,f){function g(a,c){b.attr(a,d[a]);var e=d[a];d.$observe(a,function(a){a!==e&&(e=a,c(a))})}function k(a){p=na(a);Y(c.$modelValue)||(m?(a=b.val(),p>a&&(a=p,b.val(a)),c.$setViewValue(a)):c.$validate())}function h(a){n=na(a);Y(c.$modelValue)||(m?(a=b.val(),n=p},g("min",k)); -e&&(n=na(d.max),c.$validators.max=m?function(){return!0}:function(a,b){return c.$isEmpty(b)||A(n)||b<=n},g("max",h));f&&(s=na(d.step),c.$validators.step=m?function(){return!r.stepMismatch}:function(a,b){return c.$isEmpty(b)||A(s)||ge(b,p||0,s)},g("step",l))},checkbox:function(a,b,d,c,e,f,g,k){var h=he(k,a,"ngTrueValue",d.ngTrueValue,!0),l=he(k,a,"ngFalseValue",d.ngFalseValue,!1);b.on("change",function(a){c.$setViewValue(b[0].checked,a&&a.type)});c.$render=function(){b[0].checked=c.$viewValue};c.$isEmpty= -function(a){return!1===a};c.$formatters.push(function(a){return va(a,h)});c.$parsers.push(function(a){return a?h:l})},hidden:E,button:E,submit:E,reset:E,file:E},$c=["$browser","$sniffer","$filter","$parse",function(a,b,d,c){return{restrict:"E",require:["?ngModel"],link:{pre:function(e,f,g,k){k[0]&&(te[K(g.type)]||te.text)(e,f,g,k[0],b,a,d,c)}}}}],Af=function(){var a={configurable:!0,enumerable:!1,get:function(){return this.getAttribute("value")||""},set:function(a){this.setAttribute("value",a)}}; -return{restrict:"E",priority:200,compile:function(b,d){if("hidden"===K(d.type))return{pre:function(b,d,f,g){b=d[0];b.parentNode&&b.parentNode.insertBefore(b,b.nextSibling);Object.defineProperty&&Object.defineProperty(b,"value",a)}}}}},zh=/^(true|false|\d+)$/,xf=function(){function a(a,d,c){var e=w(c)?c:9===wa?"":null;a.prop("value",e);d.$set("value",c)}return{restrict:"A",priority:100,compile:function(b,d){return zh.test(d.ngValue)?function(b,d,f){b=b.$eval(f.ngValue);a(d,f,b)}:function(b,d,f){b.$watch(f.ngValue, -function(b){a(d,f,b)})}}}},We=["$compile",function(a){return{restrict:"AC",compile:function(b){a.$$addBindingClass(b);return function(b,c,e){a.$$addBindingInfo(c,e.ngBind);c=c[0];b.$watch(e.ngBind,function(a){c.textContent=jc(a)})}}}}],Ye=["$interpolate","$compile",function(a,b){return{compile:function(d){b.$$addBindingClass(d);return function(c,d,f){c=a(d.attr(f.$attr.ngBindTemplate));b.$$addBindingInfo(d,c.expressions);d=d[0];f.$observe("ngBindTemplate",function(a){d.textContent=A(a)?"":a})}}}}], -Xe=["$sce","$parse","$compile",function(a,b,d){return{restrict:"A",compile:function(c,e){var f=b(e.ngBindHtml),g=b(e.ngBindHtml,function(b){return a.valueOf(b)});d.$$addBindingClass(c);return function(b,c,e){d.$$addBindingInfo(c,e.ngBindHtml);b.$watch(g,function(){var d=f(b);c.html(a.getTrustedHtml(d)||"")})}}}}],wf=ia({restrict:"A",require:"ngModel",link:function(a,b,d,c){c.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),Ze=Lc("",!0),af=Lc("Odd",0),$e=Lc("Even",1),bf=Ra({compile:function(a, -b){b.$set("ngCloak",void 0);a.removeClass("ng-cloak")}}),cf=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],ed={},Ah={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),function(a){var b=xa("ng-"+a);ed[b]=["$parse","$rootScope","$exceptionHandler",function(d,c,e){return sd(d,c,e,b,a,Ah[a])}]});var ff=["$animate","$compile",function(a,b){return{multiElement:!0, -transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(d,c,e,f,g){var k,h,l;d.$watch(e.ngIf,function(d){d?h||g(function(d,f){h=f;d[d.length++]=b.$$createComment("end ngIf",e.ngIf);k={clone:d};a.enter(d,c.parent(),c)}):(l&&(l.remove(),l=null),h&&(h.$destroy(),h=null),k&&(l=ub(k.clone),a.leave(l).done(function(a){!1!==a&&(l=null)}),k=null))})}}}],gf=["$templateRequest","$anchorScroll","$animate",function(a,b,d){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element", -controller:ca.noop,compile:function(c,e){var f=e.ngInclude||e.src,g=e.onload||"",k=e.autoscroll;return function(c,e,m,p,n){var r=0,q,t,x,v=function(){t&&(t.remove(),t=null);q&&(q.$destroy(),q=null);x&&(d.leave(x).done(function(a){!1!==a&&(t=null)}),t=x,x=null)};c.$watch(f,function(f){var m=function(a){!1===a||!w(k)||k&&!c.$eval(k)||b()},t=++r;f?(a(f,!0).then(function(a){if(!c.$$destroyed&&t===r){var b=c.$new();p.template=a;a=n(b,function(a){v();d.enter(a,null,e).done(m)});q=b;x=a;q.$emit("$includeContentLoaded", -f);c.$eval(g)}},function(){c.$$destroyed||t!==r||(v(),c.$emit("$includeContentError",f))}),c.$emit("$includeContentRequested",f)):(v(),p.template=null)})}}}}],zf=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",link:function(b,d,c,e){la.call(d[0]).match(/SVG/)?(d.empty(),a(gd(e.template,z.document).childNodes)(b,function(a){d.append(a)},{futureParentElement:d})):(d.html(e.template),a(d.contents())(b))}}}],hf=Ra({priority:450,compile:function(){return{pre:function(a, -b,d){a.$eval(d.ngInit)}}}}),vf=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,b,d,c){var e=d.ngList||", ",f="false"!==d.ngTrim,g=f?V(e):e;c.$parsers.push(function(a){if(!A(a)){var b=[];a&&r(a.split(g),function(a){a&&b.push(f?V(a):a)});return b}});c.$formatters.push(function(a){if(H(a))return a.join(e)});c.$isEmpty=function(a){return!a||!a.length}}}},nb="ng-valid",be="ng-invalid",Za="ng-pristine",Wb="ng-dirty",pb=F("ngModel");Sb.$inject="$scope $exceptionHandler $attrs $element $parse $animate $timeout $q $interpolate".split(" "); -Sb.prototype={$$initGetterSetters:function(){if(this.$options.getOption("getterSetter")){var a=this.$$parse(this.$$attr.ngModel+"()"),b=this.$$parse(this.$$attr.ngModel+"($$$p)");this.$$ngModelGet=function(b){var c=this.$$parsedNgModel(b);B(c)&&(c=a(b));return c};this.$$ngModelSet=function(a,c){B(this.$$parsedNgModel(a))?b(a,{$$$p:c}):this.$$parsedNgModelAssign(a,c)}}else if(!this.$$parsedNgModel.assign)throw pb("nonassign",this.$$attr.ngModel,Aa(this.$$element));},$render:E,$isEmpty:function(a){return A(a)|| -""===a||null===a||a!==a},$$updateEmptyClasses:function(a){this.$isEmpty(a)?(this.$$animate.removeClass(this.$$element,"ng-not-empty"),this.$$animate.addClass(this.$$element,"ng-empty")):(this.$$animate.removeClass(this.$$element,"ng-empty"),this.$$animate.addClass(this.$$element,"ng-not-empty"))},$setPristine:function(){this.$dirty=!1;this.$pristine=!0;this.$$animate.removeClass(this.$$element,Wb);this.$$animate.addClass(this.$$element,Za)},$setDirty:function(){this.$dirty=!0;this.$pristine=!1;this.$$animate.removeClass(this.$$element, -Za);this.$$animate.addClass(this.$$element,Wb);this.$$parentForm.$setDirty()},$setUntouched:function(){this.$touched=!1;this.$untouched=!0;this.$$animate.setClass(this.$$element,"ng-untouched","ng-touched")},$setTouched:function(){this.$touched=!0;this.$untouched=!1;this.$$animate.setClass(this.$$element,"ng-touched","ng-untouched")},$rollbackViewValue:function(){this.$$timeout.cancel(this.$$pendingDebounce);this.$viewValue=this.$$lastCommittedViewValue;this.$render()},$validate:function(){if(!Y(this.$modelValue)){var a= -this.$$lastCommittedViewValue,b=this.$$rawModelValue,d=this.$valid,c=this.$modelValue,e=this.$options.getOption("allowInvalid"),f=this;this.$$runValidators(b,a,function(a){e||d===a||(f.$modelValue=a?b:void 0,f.$modelValue!==c&&f.$$writeModelToScope())})}},$$runValidators:function(a,b,d){function c(){var c=!0;r(h.$validators,function(d,e){var g=Boolean(d(a,b));c=c&&g;f(e,g)});return c?!0:(r(h.$asyncValidators,function(a,b){f(b,null)}),!1)}function e(){var c=[],d=!0;r(h.$asyncValidators,function(e, -g){var h=e(a,b);if(!h||!B(h.then))throw pb("nopromise",h);f(g,void 0);c.push(h.then(function(){f(g,!0)},function(){d=!1;f(g,!1)}))});c.length?h.$$q.all(c).then(function(){g(d)},E):g(!0)}function f(a,b){k===h.$$currentValidationRunId&&h.$setValidity(a,b)}function g(a){k===h.$$currentValidationRunId&&d(a)}this.$$currentValidationRunId++;var k=this.$$currentValidationRunId,h=this;(function(){var a=h.$$parserName;if(A(h.$$parserValid))f(a,null);else return h.$$parserValid||(r(h.$validators,function(a, -b){f(b,null)}),r(h.$asyncValidators,function(a,b){f(b,null)})),f(a,h.$$parserValid),h.$$parserValid;return!0})()?c()?e():g(!1):g(!1)},$commitViewValue:function(){var a=this.$viewValue;this.$$timeout.cancel(this.$$pendingDebounce);if(this.$$lastCommittedViewValue!==a||""===a&&this.$$hasNativeValidators)this.$$updateEmptyClasses(a),this.$$lastCommittedViewValue=a,this.$pristine&&this.$setDirty(),this.$$parseAndValidate()},$$parseAndValidate:function(){var a=this.$$lastCommittedViewValue,b=this;this.$$parserValid= -A(a)?void 0:!0;this.$setValidity(this.$$parserName,null);this.$$parserName="parse";if(this.$$parserValid)for(var d=0;dg||e.$isEmpty(b)||b.length<=g}}}}}],cd= -["$parse",function(a){return{restrict:"A",require:"?ngModel",link:function(b,d,c,e){if(e){var f=c.minlength||a(c.ngMinlength)(b),g=Ub(f)||-1;c.$observe("minlength",function(a){f!==a&&(g=Ub(a)||-1,f=a,e.$validate())});e.$validators.minlength=function(a,b){return e.$isEmpty(b)||b.length>=g}}}}}];z.angular.bootstrap?z.console&&console.log("WARNING: Tried to load AngularJS more than once."):(Je(),Oe(ca),ca.module("ngLocale",[],["$provide",function(a){function b(a){a+="";var b=a.indexOf(".");return-1== -b?0:a.length-b-1}a.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:"January February March April May June July August September October November December".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),STANDALONEMONTH:"January February March April May June July August September October November December".split(" "), -WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a","short":"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-\u00a4",negSuf:"",posPre:"\u00a4",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(a, -c){var e=a|0,f=c;void 0===f&&(f=Math.min(b(a),3));Math.pow(10,f);return 1==e&&0==f?"one":"other"}})}]),x(function(){Ee(z.document,Wc)}))})(window);!window.angular.$$csp().noInlineStyle&&window.angular.element(document.head).prepend(window.angular.element("