diff --git a/.gitignore b/.gitignore index 3ce5adb..8ab5fa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,12 @@ .idea -vendor +*.phar +scratch* +.DS_Store +vendor/* +releases +wp-content +*.zip + +wordpress +src/vendor/ +src/dependencies/ diff --git a/README.md b/README.md index 974d2b4..7f18a0a 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![WordPress tested 5.2](https://img.shields.io/badge/WordPress-v5.2%20tested-0073aa.svg)](https://wordpress.org/) [![PHPCS WPCS](https://img.shields.io/badge/PHPCS-WordPress%20Coding%20Standards-8892BF.svg)](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) [![License: GPL v2 or later](https://img.shields.io/badge/License-GPL%20v2%20or%20later-bd0000.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) [![PHPUnit ](https://img.shields.io/badge/PHPUnit-32%25%20coverage-dc3545.svg)]() +[![WordPress tested 5.4](https://img.shields.io/badge/WordPress-v5.4%20tested-0073aa.svg)](https://wordpress.org/) [![PHPCS WPCS](https://img.shields.io/badge/PHPCS-WordPress%20Coding%20Standards-8892BF.svg)](https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards) [![License: GPL v2 or later](https://img.shields.io/badge/License-GPL%20v2%20or%20later-bd0000.svg)](https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html) [![PHPUnit ](https://img.shields.io/badge/PHPUnit-31%25%20coverage-dc3545.svg)]() # EA WP AWS SNS - Client REST Endpoint @@ -7,9 +7,9 @@ A [WordPress](https://wordpress.org/) plugin providing a REST API endpoint to re ## Purpose -We are using [AWS Transcribe](https://aws.amazon.com/transcribe/) to transcribe videos on [AnabolicTV.com](https://anabolictv.com) and when it completes, AWS SNS communicates to our WordPress instance that the job is finished so we can retrieve the output. +We send emails from WordPress via [AWS SES](https://aws.amazon.com/ses/) (using [WP SES plugin](https://wordpress.org/plugins/wp-ses/)). A sister plugin of this, [EA WP AWS SES Bounce Handler](https://github.com/EnhancedAthlete/EA-WP-AWS-SES-Bounce-Handler) uses this plugin to receive the notifications before processing them itself. -If emails from WordPress are sent via [AWS SES](https://aws.amazon.com/ses/) (using [WP SES plugin](https://wordpress.org/plugins/wp-ses/)) a plugin to delete accounts whose email addresses bounce could use this plugin to receive the notifications. +We are using [AWS Transcribe](https://aws.amazon.com/transcribe/) to transcribe videos on [AnabolicTV.com](https://anabolictv.com) and when it completes, AWS SNS communicates to our WordPress instance that the job is finished so we can retrieve the output. ## How To Use diff --git a/composer.json b/composer.json index a203024..f2dc642 100644 --- a/composer.json +++ b/composer.json @@ -3,29 +3,85 @@ { "url": "https://github.com/WordPress/wordpress-develop", "type": "git" + }, + { + "url": "https://github.com/BrianHenryIE/WPPB-lib", + "type": "git" + }, + { + "url": "https://github.com/pablo-sg-pacheco/wp-namespace-autoloader", + "type": "git" + }, + { + "url": "https://github.com/BrianHenryIE/composer-phpstorm", + "type": "git" } ], + "require": { + "brianhenryie/wppb-lib": "dev-master", + "pablo-sg-pacheco/wp-namespace-autoloader": "dev-master" + }, "require-dev": { "wordpress/wordpress": "dev-master", - "10up/wp_mock": "0.4.2", + "10up/wp_mock": "0.4.0", "dealerdirect/phpcodesniffer-composer-installer": "*", "wp-coding-standards/wpcs": "*", "phpunit/phpcov": "^5.0", - "kporras07/composer-symlinks": "dev-master" + "kporras07/composer-symlinks": "dev-master", + "brianhenryie/composer-phpstorm": "dev-master", + "cweagans/composer-patches": "~1.0", + "coenjacobs/mozart": "0.5.1", + "phpunit/phpunit" : ">=7.5", + "phpcompatibility/phpcompatibility-wp": "*" }, "extra": { + "patches": { + "coenjacobs/mozart": { + "Allow default packages" : "https://github.com/coenjacobs/mozart/pull/34.patch", + "Add config option to disable deleting vendor directories": "https://github.com/coenjacobs/mozart/pull/38.patch" + } + }, + "mozart": { + "dep_namespace": "EA_WP_AWS_SNS_Client_REST_Endpoint\\", + "dep_directory": "/src/vendor/", + "classmap_directory": "/src/dependencies/", + "classmap_prefix": "EA_WP_AWS_SNS_Client_REST_Endpoint_", + "delete_vendor_directories": false + }, "symlinks": { - "trunk": "wp-content/plugins/ea-wp-aws-sns-client-rest-endpoint", + "src": "wp-content/plugins/ea-wp-aws-sns-client-rest-endpoint", "wp-content/plugins": "vendor/wordpress/wordpress/src/wp-content/plugins", "vendor/wordpress/wordpress/src": "wordpress" + }, + "phpstorm": { + "exclude_folders": { + "folders": [ + "vendor/wordpress/wordpress/src", + "vendor/wordpress/wordpress/build", + "wordpress/wp-content/plugins", + "wp-content/plugins/ea-wp-aws-sns-client-rest-endpoint" + ], + "include_folders": [ + "vendor/wordpress/wordpress/" + ], + "composer-symlinks": false + } } }, "scripts": { "post-install-cmd": [ - "Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks" + "\"vendor/bin/mozart\" compose", + "Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks", + "mkdir -p vendor/wordpress/wordpress/src/wp-content/uploads", + "BrianHenryIE\\ComposerPhpStorm\\ExcludeFolders::update", + "BrianHenryIE\\ComposerPhpStorm\\PHPUnitRunConfigurations::update" ], "post-update-cmd": [ - "Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks" + "\"vendor/bin/mozart\" compose", + "Kporras07\\ComposerSymlinks\\ScriptHandler::createSymlinks", + "mkdir -p vendor/wordpress/wordpress/src/wp-content/uploads", + "BrianHenryIE\\ComposerPhpStorm\\ExcludeFolders::update", + "BrianHenryIE\\ComposerPhpStorm\\PHPUnitRunConfigurations::update" ] }, "license": "GPL-2.0+-or-later", diff --git a/composer.lock b/composer.lock index 274d26a..f43fcfe 100644 --- a/composer.lock +++ b/composer.lock @@ -4,21 +4,89 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "89e9a8718ff5f751a7f32fe8afe202ed", - "packages": [], + "content-hash": "3bc07db4921eecffab2293253c214596", + "packages": [ + { + "name": "brianhenryie/wppb-lib", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/BrianHenryIE/WPPB-lib", + "reference": "771f970ce469ff91bbba88d6653be45cad9aec25" + }, + "require": { + "php": ">=5.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "WPPB\\": "src" + } + }, + "license": [ + "GPL-2.0-or-later" + ], + "description": "Common files from WordPress Plugin Boilerplate", + "time": "2020-02-17T23:06:06+00:00" + }, + { + "name": "pablo-sg-pacheco/wp-namespace-autoloader", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/pablo-sg-pacheco/wp-namespace-autoloader", + "reference": "22ca6a0e137784f4e833bc6815bb8311a075691b" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pablo_Pacheco\\WP_Namespace_Autoloader\\": "src" + } + }, + "autoload-dev": { + "psr-4": { + "Pablo_Pacheco\\WP_Namespace_Autoloader\\Tests\\": "tests" + } + }, + "license": [ + "GPLv2" + ], + "authors": [ + { + "name": "Pablo dos S G Pacheco", + "email": "pablo.sg.pacheco@gmail.com" + } + ], + "description": "A PHP autoloader class that follows the WordPress coding standards for class names and class filenames", + "homepage": "https://github.com/pablo-pacheco/wp-namespace-autoloader", + "keywords": [ + "autoload", + "namespace", + "wordpress", + "wp" + ], + "time": "2020-02-01T20:48:35+00:00" + } + ], "packages-dev": [ { "name": "10up/wp_mock", - "version": "0.4.2", + "version": "0.4.0", "source": { "type": "git", "url": "https://github.com/10up/wp_mock.git", - "reference": "9019226eb50df275aa86bb15bfc98a619601ee49" + "reference": "9f3525a162ab187962c223909d54220f84b5258a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/10up/wp_mock/zipball/9019226eb50df275aa86bb15bfc98a619601ee49", - "reference": "9019226eb50df275aa86bb15bfc98a619601ee49", + "url": "https://api.github.com/repos/10up/wp_mock/zipball/9f3525a162ab187962c223909d54220f84b5258a", + "reference": "9f3525a162ab187962c223909d54220f84b5258a", "shasum": "" }, "require": { @@ -46,20 +114,20 @@ "GPL-2.0-or-later" ], "description": "A mocking library to take the pain out of unit testing for WordPress", - "time": "2019-03-16T03:44:39+00:00" + "time": "2019-01-17T04:51:49+00:00" }, { "name": "antecedent/patchwork", - "version": "2.1.11", + "version": "2.1.12", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "ff7aae02f1c5492716fe13d59de4cfc389b8c4b0" + "reference": "b98e046dd4c0acc34a0846604f06f6111654d9ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/ff7aae02f1c5492716fe13d59de4cfc389b8c4b0", - "reference": "ff7aae02f1c5492716fe13d59de4cfc389b8c4b0", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/b98e046dd4c0acc34a0846604f06f6111654d9ea", + "reference": "b98e046dd4c0acc34a0846604f06f6111654d9ea", "shasum": "" }, "require": { @@ -90,20 +158,171 @@ "runkit", "testing" ], - "time": "2019-10-26T07:10:56+00:00" + "time": "2019-12-22T17:52:09+00:00" + }, + { + "name": "brianhenryie/composer-phpstorm", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/BrianHenryIE/composer-phpstorm", + "reference": "5cbbd7e3b49421825cd4e2e3c33c3f1424df7a4d" + }, + "require": { + "symfony/filesystem": "^2.5 || ^3.0" + }, + "require-dev": { + "composer/composer": "^1.0@dev", + "phpunit/phpunit": "^8", + "squizlabs/php_codesniffer": "*" + }, + "type": "library", + "autoload": { + "psr-4": { + "BrianHenryIE\\ComposerPhpStorm\\": "src/" + }, + "exclude-from-classmap": [ + "/tests/" + ] + }, + "autoload-dev": { + "psr-4": { + "BrianHenryIE\\ComposerPhpStorm\\Tests\\": "tests/" + } + }, + "scripts": { + "post-install-cmd": [ + "BrianHenryIE\\ComposerPhpStorm\\PHPUnitRunConfigurations::update" + ], + "post-update-cmd": [ + "BrianHenryIE\\ComposerPhpStorm\\PHPUnitRunConfigurations::update" + ] + }, + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Brian Henry", + "email": "BrianHenryIE@gmail.com" + } + ], + "description": "Composer script to exclude folders from PhpStorm code navigation.", + "homepage": "https://github.com/BrianHenryIE/composer-phpstorm", + "keywords": [ + "composer", + "excludefolder", + "phpstorm" + ], + "time": "2020-03-22T18:43:05+00:00" + }, + { + "name": "coenjacobs/mozart", + "version": "0.5.1", + "source": { + "type": "git", + "url": "https://github.com/coenjacobs/mozart.git", + "reference": "4bdde231f3309d9299c87b2246166e87acc93653" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/coenjacobs/mozart/zipball/4bdde231f3309d9299c87b2246166e87acc93653", + "reference": "4bdde231f3309d9299c87b2246166e87acc93653", + "shasum": "" + }, + "require": { + "league/flysystem": "^1.0", + "php": "^7.2", + "symfony/console": "^4|^5", + "symfony/finder": "^4|^5" + }, + "require-dev": { + "phpunit/phpunit": "^8.5" + }, + "bin": [ + "bin/mozart" + ], + "type": "library", + "extra": { + "patches_applied": { + "Allow default packages": "https://github.com/coenjacobs/mozart/pull/34.patch", + "Add config option to disable deleting vendor directories": "https://github.com/coenjacobs/mozart/pull/38.patch" + } + }, + "autoload": { + "psr-4": { + "CoenJacobs\\Mozart\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Coen Jacobs", + "email": "coenjacobs@gmail.com" + } + ], + "description": "Composes all dependencies as a package inside a WordPress plugin", + "time": "2019-12-23T12:24:56+00:00" + }, + { + "name": "cweagans/composer-patches", + "version": "1.6.7", + "source": { + "type": "git", + "url": "https://github.com/cweagans/composer-patches.git", + "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweagans/composer-patches/zipball/2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", + "reference": "2e6f72a2ad8d59cd7e2b729f218bf42adb14f590", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "php": ">=5.3.0" + }, + "require-dev": { + "composer/composer": "~1.0", + "phpunit/phpunit": "~4.6" + }, + "type": "composer-plugin", + "extra": { + "class": "cweagans\\Composer\\Patches" + }, + "autoload": { + "psr-4": { + "cweagans\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Cameron Eagans", + "email": "me@cweagans.net" + } + ], + "description": "Provides a way to patch Composer packages.", + "time": "2019-08-29T20:11:49+00:00" }, { "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.5.0", + "version": "v0.6.2", "source": { "type": "git", "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132" + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132", + "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a", + "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a", "shasum": "" }, "require": { @@ -156,7 +375,7 @@ "stylecheck", "tests" ], - "time": "2018-10-26T13:21:45+00:00" + "time": "2020-01-29T20:22:20+00:00" }, { "name": "doctrine/instantiator", @@ -317,25 +536,108 @@ ], "time": "2019-11-22T15:48:21+00:00" }, + { + "name": "league/flysystem", + "version": "1.0.67", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/flysystem.git", + "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/flysystem/zipball/5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", + "reference": "5b1f36c75c4bdde981294c2a0ebdb437ee6f275e", + "shasum": "" + }, + "require": { + "ext-fileinfo": "*", + "php": ">=5.5.9" + }, + "conflict": { + "league/flysystem-sftp": "<1.0.6" + }, + "require-dev": { + "phpspec/phpspec": "^3.4", + "phpunit/phpunit": "^5.7.26" + }, + "suggest": { + "ext-fileinfo": "Required for MimeType", + "ext-ftp": "Allows you to use FTP server storage", + "ext-openssl": "Allows you to use FTPS server storage", + "league/flysystem-aws-s3-v2": "Allows you to use S3 storage with AWS SDK v2", + "league/flysystem-aws-s3-v3": "Allows you to use S3 storage with AWS SDK v3", + "league/flysystem-azure": "Allows you to use Windows Azure Blob storage", + "league/flysystem-cached-adapter": "Flysystem adapter decorator for metadata caching", + "league/flysystem-eventable-filesystem": "Allows you to use EventableFilesystem", + "league/flysystem-rackspace": "Allows you to use Rackspace Cloud Files", + "league/flysystem-sftp": "Allows you to use SFTP server storage via phpseclib", + "league/flysystem-webdav": "Allows you to use WebDAV storage", + "league/flysystem-ziparchive": "Allows you to use ZipArchive adapter", + "spatie/flysystem-dropbox": "Allows you to use Dropbox storage", + "srmklive/flysystem-dropbox-v2": "Allows you to use Dropbox storage for PHP 5 applications" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.1-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Flysystem\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Frank de Jonge", + "email": "info@frenky.net" + } + ], + "description": "Filesystem abstraction: Many filesystems, one API.", + "keywords": [ + "Cloud Files", + "WebDAV", + "abstraction", + "aws", + "cloud", + "copy.com", + "dropbox", + "file systems", + "files", + "filesystem", + "filesystems", + "ftp", + "rackspace", + "remote", + "s3", + "sftp", + "storage" + ], + "time": "2020-04-16T13:21:26+00:00" + }, { "name": "mockery/mockery", - "version": "1.3.0", + "version": "1.3.1", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "5571962a4f733fbb57bede39778f71647fae8e66" + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/5571962a4f733fbb57bede39778f71647fae8e66", - "reference": "5571962a4f733fbb57bede39778f71647fae8e66", + "url": "https://api.github.com/repos/mockery/mockery/zipball/f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", + "reference": "f69bbde7d7a75d6b2862d9ca8fab1cd28014b4be", "shasum": "" }, "require": { "hamcrest/hamcrest-php": "~2.0", "lib-pcre": ">=7.0", - "php": ">=5.6.0", - "sebastian/comparator": "^1.2.4|^3.0" + "php": ">=5.6.0" }, "require-dev": { "phpunit/phpunit": "~5.7.10|~6.5|~7.0|~8.0" @@ -343,7 +645,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -381,20 +683,20 @@ "test double", "testing" ], - "time": "2019-11-24T07:54:50+00:00" + "time": "2019-12-26T09:49:15+00:00" }, { "name": "myclabs/deep-copy", - "version": "1.9.3", + "version": "1.9.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea" + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/007c053ae6f31bba39dfa19a7726f56e9763bbea", - "reference": "007c053ae6f31bba39dfa19a7726f56e9763bbea", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/b2c28789e80a97badd14145fda39b545d83ca3ef", + "reference": "b2c28789e80a97badd14145fda39b545d83ca3ef", "shasum": "" }, "require": { @@ -429,7 +731,7 @@ "object", "object graph" ], - "time": "2019-08-09T12:45:53+00:00" + "time": "2020-01-17T21:11:47+00:00" }, { "name": "phar-io/manifest", @@ -533,6 +835,166 @@ "description": "Library for handling version information and constraints", "time": "2018-07-08T19:19:57+00:00" }, + { + "name": "phpcompatibility/php-compatibility", + "version": "9.3.5", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibility.git", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243", + "reference": "9fb324479acf6f39452e0655d2429cc0d3914243", + "shasum": "" + }, + "require": { + "php": ">=5.3", + "squizlabs/php_codesniffer": "^2.3 || ^3.0.2" + }, + "conflict": { + "squizlabs/php_codesniffer": "2.6.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "homepage": "https://github.com/wimg", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "homepage": "https://github.com/jrfnl", + "role": "lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors" + } + ], + "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.", + "homepage": "http://techblog.wimgodden.be/tag/codesniffer/", + "keywords": [ + "compatibility", + "phpcs", + "standards" + ], + "time": "2019-12-27T09:44:58+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-paragonie", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c", + "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5", + "paragonie/random_compat": "dev-master", + "paragonie/sodium_compat": "dev-master" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "paragonie", + "phpcs", + "polyfill", + "standards" + ], + "time": "2019-11-04T15:17:54+00:00" + }, + { + "name": "phpcompatibility/phpcompatibility-wp", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f", + "reference": "41bef18ba688af638b7310666db28e1ea9158b2f", + "shasum": "" + }, + "require": { + "phpcompatibility/php-compatibility": "^9.0", + "phpcompatibility/phpcompatibility-paragonie": "^1.0" + }, + "require-dev": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5" + }, + "suggest": { + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.", + "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues." + }, + "type": "phpcodesniffer-standard", + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0-or-later" + ], + "authors": [ + { + "name": "Wim Godden", + "role": "lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "lead" + } + ], + "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.", + "homepage": "http://phpcompatibility.com/", + "keywords": [ + "compatibility", + "phpcs", + "standards", + "wordpress" + ], + "time": "2019-08-28T14:22:28+00:00" + }, { "name": "phpdocumentor/reflection-common", "version": "2.0.0", @@ -587,40 +1049,38 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "4.3.2", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/b83ff7cfcfee7827e1e78b637a5904fe6a96698e", - "reference": "b83ff7cfcfee7827e1e78b637a5904fe6a96698e", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0 || ^2.0.0", - "phpdocumentor/type-resolver": "~0.4 || ^1.0.0", - "webmozart/assert": "^1.0" + "ext-filter": "^7.1", + "php": "^7.2", + "phpdocumentor/reflection-common": "^2.0", + "phpdocumentor/type-resolver": "^1.0", + "webmozart/assert": "^1" }, "require-dev": { - "doctrine/instantiator": "^1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" + "doctrine/instantiator": "^1", + "mockery/mockery": "^1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-master": "5.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -631,33 +1091,36 @@ { "name": "Mike van Riel", "email": "me@mikevanriel.com" + }, + { + "name": "Jaap van Otterdijk", + "email": "account@ijaap.nl" } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2019-09-12T14:27:41+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.2", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" }, "type": "library", "extra": { @@ -681,37 +1144,37 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" + "time": "2020-02-18T18:59:58+00:00" }, { "name": "phpspec/prophecy", - "version": "1.9.0", + "version": "v1.10.3", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203" + "reference": "451c3cd1418cf640de218914901e51b064abb093" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/f6811d96d97bdf400077a0cc100ae56aa32b9203", - "reference": "f6811d96d97bdf400077a0cc100ae56aa32b9203", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/451c3cd1418cf640de218914901e51b064abb093", + "reference": "451c3cd1418cf640de218914901e51b064abb093", "shasum": "" }, "require": { "doctrine/instantiator": "^1.0.2", "php": "^5.3|^7.0", "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0|^5.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" + "sebastian/comparator": "^1.2.3|^2.0|^3.0|^4.0", + "sebastian/recursion-context": "^1.0|^2.0|^3.0|^4.0" }, "require-dev": { - "phpspec/phpspec": "^2.5|^3.2", + "phpspec/phpspec": "^2.5 || ^3.2", "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5 || ^7.1" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.8.x-dev" + "dev-master": "1.10.x-dev" } }, "autoload": { @@ -744,7 +1207,7 @@ "spy", "stub" ], - "time": "2019-10-03T11:07:50+00:00" + "time": "2020-03-05T15:02:03+00:00" }, { "name": "phpunit/php-code-coverage", @@ -1052,16 +1515,16 @@ }, { "name": "phpunit/phpunit", - "version": "7.5.18", + "version": "7.5.20", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d" + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/fcf6c4bfafaadc07785528b06385cce88935474d", - "reference": "fcf6c4bfafaadc07785528b06385cce88935474d", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/9467db479d1b0487c99733bb1e7944d32deded2c", + "reference": "9467db479d1b0487c99733bb1e7944d32deded2c", "shasum": "" }, "require": { @@ -1132,7 +1595,7 @@ "testing", "xunit" ], - "time": "2019-12-06T05:14:37+00:00" + "time": "2020-01-08T08:45:45+00:00" }, { "name": "psr/container", @@ -1470,23 +1933,27 @@ }, { "name": "sebastian/finder-facade", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/finder-facade.git", - "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f" + "reference": "167c45d131f7fc3d159f56f191a0a22228765e16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f", - "reference": "4a3174709c2dc565fe5fb26fcf827f6a1fc7b09f", + "url": "https://api.github.com/repos/sebastianbergmann/finder-facade/zipball/167c45d131f7fc3d159f56f191a0a22228765e16", + "reference": "167c45d131f7fc3d159f56f191a0a22228765e16", "shasum": "" }, "require": { - "symfony/finder": "~2.3|~3.0|~4.0", - "theseer/fdomdocument": "~1.3" + "php": "^7.1", + "symfony/finder": "^2.3|^3.0|^4.0|^5.0", + "theseer/fdomdocument": "^1.6" }, "type": "library", + "extra": { + "branch-alias": [] + }, "autoload": { "classmap": [ "src/" @@ -1505,7 +1972,7 @@ ], "description": "FinderFacade is a convenience wrapper for Symfony's Finder component.", "homepage": "https://github.com/sebastianbergmann/finder-facade", - "time": "2017-11-18T17:31:49+00:00" + "time": "2020-01-16T08:08:45+00:00" }, { "name": "sebastian/global-state", @@ -1790,16 +2257,16 @@ }, { "name": "squizlabs/php_codesniffer", - "version": "3.5.3", + "version": "3.5.5", "source": { "type": "git", "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb" + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", - "reference": "557a1fc7ac702c66b0bbfe16ab3d55839ef724cb", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/73e2e7f57d958e7228fce50dc0c61f58f017f9f6", + "reference": "73e2e7f57d958e7228fce50dc0c61f58f017f9f6", "shasum": "" }, "require": { @@ -1837,20 +2304,20 @@ "phpcs", "standards" ], - "time": "2019-12-04T04:46:47+00:00" + "time": "2020-04-17T01:09:41+00:00" }, { "name": "symfony/console", - "version": "v4.4.1", + "version": "v4.4.7", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201" + "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f0aea3df20d15635b3cb9730ca5eea1c65b7f201", - "reference": "f0aea3df20d15635b3cb9730ca5eea1c65b7f201", + "url": "https://api.github.com/repos/symfony/console/zipball/10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", + "reference": "10bb3ee3c97308869d53b3e3d03f6ac23ff985f7", "shasum": "" }, "require": { @@ -1913,20 +2380,20 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2019-12-01T10:06:17+00:00" + "time": "2020-03-30T11:41:10+00:00" }, { "name": "symfony/filesystem", - "version": "v3.4.36", + "version": "v3.4.39", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2" + "reference": "ec47520778d524b1736e768e0678cd1f01c03019" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/00cdad0936d06fab136944bc2342b762b1c3a4a2", - "reference": "00cdad0936d06fab136944bc2342b762b1c3a4a2", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/ec47520778d524b1736e768e0678cd1f01c03019", + "reference": "ec47520778d524b1736e768e0678cd1f01c03019", "shasum": "" }, "require": { @@ -1963,29 +2430,29 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2019-11-25T16:36:22+00:00" + "time": "2020-03-16T08:31:04+00:00" }, { "name": "symfony/finder", - "version": "v4.4.1", + "version": "v5.0.7", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e" + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/ce8743441da64c41e2a667b8eb66070444ed911e", - "reference": "ce8743441da64c41e2a667b8eb66070444ed911e", + "url": "https://api.github.com/repos/symfony/finder/zipball/600a52c29afc0d1caa74acbec8d3095ca7e9910d", + "reference": "600a52c29afc0d1caa74acbec8d3095ca7e9910d", "shasum": "" }, "require": { - "php": "^7.1.3" + "php": "^7.2.5" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.4-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -2012,20 +2479,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2019-11-17T21:56:56+00:00" + "time": "2020-03-27T16:56:45+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.13.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3" + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", - "reference": "f8f0b461be3385e56d6de3dbb5a0df24c0c275e3", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/4719fa9c18b0464d399f1a63bf624b42b6fa8d14", + "reference": "4719fa9c18b0464d399f1a63bf624b42b6fa8d14", "shasum": "" }, "require": { @@ -2037,7 +2504,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -2070,20 +2537,20 @@ "polyfill", "portable" ], - "time": "2019-11-27T13:56:44+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.13.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f" + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/7b4aab9743c30be783b73de055d24a39cf4b954f", - "reference": "7b4aab9743c30be783b73de055d24a39cf4b954f", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/81ffd3a9c6d707be22e3012b827de1c9775fc5ac", + "reference": "81ffd3a9c6d707be22e3012b827de1c9775fc5ac", "shasum": "" }, "require": { @@ -2095,7 +2562,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -2129,20 +2596,20 @@ "portable", "shim" ], - "time": "2019-11-27T14:18:11+00:00" + "time": "2020-03-09T19:04:49+00:00" }, { "name": "symfony/polyfill-php73", - "version": "v1.13.1", + "version": "v1.15.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f" + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/4b0e2222c55a25b4541305a053013d5647d3a25f", - "reference": "4b0e2222c55a25b4541305a053013d5647d3a25f", + "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", + "reference": "0f27e9f464ea3da33cbe7ca3bdf4eb66def9d0f7", "shasum": "" }, "require": { @@ -2151,7 +2618,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.13-dev" + "dev-master": "1.15-dev" } }, "autoload": { @@ -2187,24 +2654,24 @@ "portable", "shim" ], - "time": "2019-11-27T16:25:15+00:00" + "time": "2020-02-27T09:26:54+00:00" }, { "name": "symfony/service-contracts", - "version": "v1.1.8", + "version": "v2.0.1", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf" + "reference": "144c5e51266b281231e947b51223ba14acf1a749" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffc7f5692092df31515df2a5ecf3b7302b3ddacf", - "reference": "ffc7f5692092df31515df2a5ecf3b7302b3ddacf", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/144c5e51266b281231e947b51223ba14acf1a749", + "reference": "144c5e51266b281231e947b51223ba14acf1a749", "shasum": "" }, "require": { - "php": "^7.1.3", + "php": "^7.2.5", "psr/container": "^1.0" }, "suggest": { @@ -2213,7 +2680,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1-dev" + "dev-master": "2.0-dev" } }, "autoload": { @@ -2245,7 +2712,7 @@ "interoperability", "standards" ], - "time": "2019-10-14T12:27:06+00:00" + "time": "2019-11-18T17:27:11+00:00" }, { "name": "theseer/fdomdocument", @@ -2329,16 +2796,16 @@ }, { "name": "webmozart/assert", - "version": "1.6.0", + "version": "1.8.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925" + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/573381c0a64f155a0d9a23f4b0c797194805b925", - "reference": "573381c0a64f155a0d9a23f4b0c797194805b925", + "url": "https://api.github.com/repos/webmozart/assert/zipball/ab2cb0b3b559010b75981b1bdce728da3ee90ad6", + "reference": "ab2cb0b3b559010b75981b1bdce728da3ee90ad6", "shasum": "" }, "require": { @@ -2346,7 +2813,7 @@ "symfony/polyfill-ctype": "^1.8" }, "conflict": { - "vimeo/psalm": "<3.6.0" + "vimeo/psalm": "<3.9.1" }, "require-dev": { "phpunit/phpunit": "^4.8.36 || ^7.5.13" @@ -2373,7 +2840,7 @@ "check", "validate" ], - "time": "2019-11-24T13:36:37+00:00" + "time": "2020-04-18T12:12:48+00:00" }, { "name": "wordpress/wordpress", @@ -2381,13 +2848,13 @@ "source": { "type": "git", "url": "https://github.com/WordPress/wordpress-develop", - "reference": "1440dab429b9643f9c2fd4fe6c84689b46e38ba0" + "reference": "d2deb5eba3b597e43259156d9f7564b383448c27" }, "require": { "php": ">=5.6" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "~0.5.0", + "dealerdirect/phpcodesniffer-composer-installer": "~0.6.0", "phpcompatibility/phpcompatibility-wp": "^2.1.0", "wp-coding-standards/wpcs": "~2.1.0" }, @@ -2420,20 +2887,20 @@ "support": { "issues": "https://core.trac.wordpress.org/" }, - "time": "2019-12-13T21:43:06+00:00" + "time": "2020-04-18T07:01:58+00:00" }, { "name": "wp-coding-standards/wpcs", - "version": "2.2.0", + "version": "2.2.1", "source": { "type": "git", "url": "https://github.com/WordPress/WordPress-Coding-Standards.git", - "reference": "f90e8692ce97b693633db7ab20bfa78d930f536a" + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/f90e8692ce97b693633db7ab20bfa78d930f536a", - "reference": "f90e8692ce97b693633db7ab20bfa78d930f536a", + "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/b5a453203114cc2284b1a614c4953456fbe4f546", + "reference": "b5a453203114cc2284b1a614c4953456fbe4f546", "shasum": "" }, "require": { @@ -2441,12 +2908,12 @@ "squizlabs/php_codesniffer": "^3.3.1" }, "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", + "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6", "phpcompatibility/php-compatibility": "^9.0", "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" }, "suggest": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." + "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically." }, "type": "phpcodesniffer-standard", "notification-url": "https://packagist.org/downloads/", @@ -2465,14 +2932,17 @@ "standards", "wordpress" ], - "time": "2019-11-11T12:34:03+00:00" + "time": "2020-02-04T02:52:06+00:00" } ], "aliases": [], "minimum-stability": "stable", "stability-flags": { + "brianhenryie/wppb-lib": 20, + "pablo-sg-pacheco/wp-namespace-autoloader": 20, "wordpress/wordpress": 20, - "kporras07/composer-symlinks": 20 + "kporras07/composer-symlinks": 20, + "brianhenryie/composer-phpstorm": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/phpcs.xml b/phpcs.xml index 68c8eb5..0dd14df 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -11,9 +11,10 @@ - */node_modules/* - */vendor/* - */trunk/lib/* + ./wordpress/* + ./wp-content/* + vendor/* + src/lib/* diff --git a/trunk/LICENSE.txt b/src/LICENSE.txt similarity index 100% rename from trunk/LICENSE.txt rename to src/LICENSE.txt diff --git a/trunk/README.txt b/src/README.txt similarity index 92% rename from trunk/README.txt rename to src/README.txt index 4484793..4388505 100755 --- a/trunk/README.txt +++ b/src/README.txt @@ -14,6 +14,8 @@ Adds a REST endpoint to WordPress for receiving AWS SNS messages; fires `do_acti https://aws.amazon.com/sns/ +https://github.com/EnhancedAthlete/ea-wp-aws-sns-client-rest-endpoint + == Installation == 1. Upload `ea-wp-aws-sns-client-rest-endpoint.php` to the `/wp-content/plugins/` directory @@ -51,6 +53,11 @@ function my_notification_handler( $handled $notification_topic_arn, $headers, $b == Changelog == += 2.0.1 = + +Use Mozart for namespacing dependencies. +Code reorganised. + = 2.0.0 = Changed action to filter so this plugin can log if the notification was handled. diff --git a/trunk/admin/class-admin.php b/src/admin/class-admin.php similarity index 98% rename from trunk/admin/class-admin.php rename to src/admin/class-admin.php index d1f2bf4..c889e25 100755 --- a/trunk/admin/class-admin.php +++ b/src/admin/class-admin.php @@ -12,6 +12,7 @@ namespace EA_WP_AWS_SNS_Client_REST_Endpoint\admin; use EA_WP_AWS_SNS_Client_REST_Endpoint\includes\EA_WP_AWS_SNS_Client_REST_Endpoint; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Object; /** * The admin-specific functionality of the plugin. @@ -23,7 +24,7 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/admin * @author Brian Henry */ -class Admin extends \WPPB_Object { +class Admin extends WPPB_Object { /** * Register the JavaScript for the admin area. diff --git a/trunk/ajax/class-ajax.php b/src/admin/class-ajax.php similarity index 98% rename from trunk/ajax/class-ajax.php rename to src/admin/class-ajax.php index 265b005..267a5d6 100755 --- a/trunk/ajax/class-ajax.php +++ b/src/admin/class-ajax.php @@ -9,9 +9,10 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/ajax */ -namespace EA_WP_AWS_SNS_Client_REST_Endpoint\ajax; +namespace EA_WP_AWS_SNS_Client_REST_Endpoint\admin; use EA_WP_AWS_SNS_Client_REST_Endpoint\includes\EA_WP_AWS_SNS_Client_REST_Endpoint; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Object; /** * The ajax-specific functionality of the plugin. @@ -22,7 +23,7 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/ajax * @author Brian Henry */ -class Ajax extends \WPPB_Object { +class Ajax extends WPPB_Object { /** diff --git a/trunk/admin/index.php b/src/admin/index.php similarity index 100% rename from trunk/admin/index.php rename to src/admin/index.php diff --git a/trunk/admin/js/ea-wp-aws-sns-client-rest-endpoint-admin.js b/src/admin/js/ea-wp-aws-sns-client-rest-endpoint-admin.js similarity index 100% rename from trunk/admin/js/ea-wp-aws-sns-client-rest-endpoint-admin.js rename to src/admin/js/ea-wp-aws-sns-client-rest-endpoint-admin.js diff --git a/src/autoload.php b/src/autoload.php new file mode 100644 index 0000000..8c92196 --- /dev/null +++ b/src/autoload.php @@ -0,0 +1,42 @@ +init(); + diff --git a/trunk/ea-wp-aws-sns-client-rest-endpoint.php b/src/ea-wp-aws-sns-client-rest-endpoint.php similarity index 91% rename from trunk/ea-wp-aws-sns-client-rest-endpoint.php rename to src/ea-wp-aws-sns-client-rest-endpoint.php index 15f3503..d933453 100755 --- a/trunk/ea-wp-aws-sns-client-rest-endpoint.php +++ b/src/ea-wp-aws-sns-client-rest-endpoint.php @@ -23,8 +23,8 @@ namespace EA_WP_AWS_SNS_Client_REST_Endpoint; // If this file is called directly, abort. -use EA_WP_AWS_SNS_Client_REST_Endpoint\cron\Cron; use EA_WP_AWS_SNS_Client_REST_Endpoint\includes\EA_WP_AWS_SNS_Client_REST_Endpoint; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Loader; if ( ! defined( 'WPINC' ) ) { die; @@ -54,7 +54,7 @@ function deactivate_ea_wp_aws_sns_client_rest_endpoint() { */ function instantiate_ea_wp_aws_sns_client_rest_endpoint() { - $loader = new \WPPB_Loader(); + $loader = new WPPB_Loader(); $ea_wp_aws_sns_client_rest_endpoint = new EA_WP_AWS_SNS_Client_REST_Endpoint( $loader ); @@ -74,6 +74,3 @@ function instantiate_ea_wp_aws_sns_client_rest_endpoint() { */ $GLOBALS['ea_wp_aws_sns_client_rest_endpoint'] = $ea_wp_aws_sns_client_rest_endpoint = instantiate_ea_wp_aws_sns_client_rest_endpoint(); $ea_wp_aws_sns_client_rest_endpoint->run(); - - -add_action( Cron::NOTIFY_IN_BACKGROUND_JOB_NAME, array( 'EA_WP_AWS_SNS_Client_REST_Endpoint_Cron', 'notify_in_background_static' ), 10, 4 ); diff --git a/trunk/cron/class-cron.php b/src/includes/class-cron.php similarity index 75% rename from trunk/cron/class-cron.php rename to src/includes/class-cron.php index b08a507..9632103 100755 --- a/trunk/cron/class-cron.php +++ b/src/includes/class-cron.php @@ -12,9 +12,9 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/admin */ -namespace EA_WP_AWS_SNS_Client_REST_Endpoint\cron; +namespace EA_WP_AWS_SNS_Client_REST_Endpoint\includes; -use EA_WP_AWS_SNS_Client_REST_Endpoint\includes\EA_WP_AWS_SNS_Client_REST_Endpoint; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Object; /** * The cron-specific functionality of the plugin. @@ -25,14 +25,14 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/cron * @author Brian Henry */ -class Cron extends \WPPB_Object { +class Cron extends WPPB_Object { const NOTIFY_IN_BACKGROUND_JOB_NAME = 'ea_wp_aws_sns_client_rest_endpoint_notify_in_background'; /** * This method is hooked to an action so WordPress's cron system can be used to process the notification * in the background. - * If fires the action `ea_aws_sns_notification` with the notification data and other plugins are expected + * It fires the action `ea_aws_sns_notification` with the notification data and other plugins are expected * to listen for this action. * * @param string $topic_arn The AWS SNS topic Amazon Resource Name. @@ -47,12 +47,4 @@ public function notify_in_background( $topic_arn, $headers, $body, $message ) { apply_filters( EA_WP_AWS_SNS_Client_REST_Endpoint::NEW_NOTIFICATION_ACTION, $handled, $topic_arn, $headers, $body, $message ); } - public static function notify_in_background_static( $topic_arn, $headers, $body, $message ) { - - $handled = array(); - - apply_filters( EA_WP_AWS_SNS_Client_REST_Endpoint::NEW_NOTIFICATION_ACTION, $handled, $topic_arn, $headers, $body, $message ); - } - - } diff --git a/trunk/includes/class-deactivator.php b/src/includes/class-deactivator.php similarity index 100% rename from trunk/includes/class-deactivator.php rename to src/includes/class-deactivator.php diff --git a/trunk/includes/class-ea-wp-aws-sns-client-rest-endpoint.php b/src/includes/class-ea-wp-aws-sns-client-rest-endpoint.php similarity index 70% rename from trunk/includes/class-ea-wp-aws-sns-client-rest-endpoint.php rename to src/includes/class-ea-wp-aws-sns-client-rest-endpoint.php index 6d74d71..a017479 100755 --- a/trunk/includes/class-ea-wp-aws-sns-client-rest-endpoint.php +++ b/src/includes/class-ea-wp-aws-sns-client-rest-endpoint.php @@ -15,9 +15,10 @@ namespace EA_WP_AWS_SNS_Client_REST_Endpoint\includes; use EA_WP_AWS_SNS_Client_REST_Endpoint\admin\Admin; -use EA_WP_AWS_SNS_Client_REST_Endpoint\ajax\Ajax; -use EA_WP_AWS_SNS_Client_REST_Endpoint\cron\Cron; +use EA_WP_AWS_SNS_Client_REST_Endpoint\admin\Ajax; use EA_WP_AWS_SNS_Client_REST_Endpoint\rest\REST; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Loader_Interface; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Object; /** * The core plugin class. @@ -33,7 +34,7 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/includes * @author Brian Henry */ -class EA_WP_AWS_SNS_Client_REST_Endpoint { +class EA_WP_AWS_SNS_Client_REST_Endpoint extends WPPB_Object { /** * The WordPress Plugin Boilerplate loader that's responsible for maintaining and @@ -41,34 +42,21 @@ class EA_WP_AWS_SNS_Client_REST_Endpoint { * * @since 1.0.0 * @access protected - * @var \WPPB_Loader_Interface $loader Maintains and registers all hooks for the plugin. + * @var WPPB_Loader_Interface $loader Maintains and registers all hooks for the plugin. */ protected $loader; - /** - * The unique identifier of this plugin. - * - * @since 1.0.0 - * @access protected - * @var string $plugin_name The string used to uniquely identify this plugin. - */ - protected $plugin_name; - - /** - * The current version of the plugin. - * - * @since 1.0.0 - * @access protected - * @var string $version The current version of the plugin. - */ - protected $version; - const PENDING_SUBSCRIPTIONS_OPTION_KEY = 'ea-wp-aws-sns-client-rest-endpoint-pending-subscriptions'; const BACKGROUND_NOTIFY_CRON_ACTION = 'ea_wp_aws_sns_client_rest_endpoint_notify_in_background'; const NEW_NOTIFICATION_ACTION = 'ea_aws_sns_notification'; + /** + * The Cron object so other plugins can access it for unhooking. + * + * @var Cron + */ public $cron; /** @@ -80,15 +68,17 @@ class EA_WP_AWS_SNS_Client_REST_Endpoint { * * @since 1.0.0 * - * @param \WPPB_Loader_Interface $loader The WordPress Plugin Boilerplate loader object. + * @param WPPB_Loader_Interface $loader The WordPress Plugin Boilerplate loader object. */ public function __construct( $loader ) { if ( defined( 'EA_WP_AWS_SNS_CLIENT_REST_ENDPOINT_VERSION' ) ) { - $this->version = EA_WP_AWS_SNS_CLIENT_REST_ENDPOINT_VERSION; + $version = EA_WP_AWS_SNS_CLIENT_REST_ENDPOINT_VERSION; } else { - $this->version = '2.0.0'; + $version = '2.0.1'; } - $this->plugin_name = 'ea-wp-aws-sns-client-rest-endpoint'; + $plugin_name = 'ea-wp-aws-sns-client-rest-endpoint'; + + parent::__construct( $plugin_name, $version ); $this->loader = $loader; @@ -157,9 +147,9 @@ private function define_rest_hooks() { */ private function define_cron_hooks() { - $this->cron = $plugin_cron = new Cron( $this->get_plugin_name(), $this->get_version() ); + $this->cron = new Cron( $this->get_plugin_name(), $this->get_version() ); - // $this->loader->add_action( EA_WP_AWS_SNS_Client_REST_Endpoint_Cron::NOTIFY_IN_BACKGROUND_JOB_NAME, $plugin_cron, 'notify_in_background', 10, 4 ); + $this->loader->add_action( Cron::NOTIFY_IN_BACKGROUND_JOB_NAME, $this->cron, 'notify_in_background', 10, 4 ); } /** @@ -171,35 +161,14 @@ public function run() { $this->loader->run(); } - /** - * The name of the plugin used to uniquely identify it within the context of - * WordPress and to define internationalization functionality. - * - * @since 1.0.0 - * @return string The name of the plugin. - */ - public function get_plugin_name() { - return $this->plugin_name; - } - /** * The reference to the class that orchestrates the hooks with the plugin. * * @since 1.0.0 - * @return \WPPB_Loader_Interface Orchestrates the hooks of the plugin. + * @return WPPB_Loader_Interface Orchestrates the hooks of the plugin. */ public function get_loader() { return $this->loader; } - /** - * Retrieve the version number of the plugin. - * - * @since 1.0.0 - * @return string The version number of the plugin. - */ - public function get_version() { - return $this->version; - } - } diff --git a/trunk/ajax/index.php b/src/includes/index.php similarity index 100% rename from trunk/ajax/index.php rename to src/includes/index.php diff --git a/trunk/cron/index.php b/src/index.php similarity index 100% rename from trunk/cron/index.php rename to src/index.php diff --git a/trunk/rest/class-rest.php b/src/rest/class-rest.php similarity index 98% rename from trunk/rest/class-rest.php rename to src/rest/class-rest.php index 007b360..c4fd983 100755 --- a/trunk/rest/class-rest.php +++ b/src/rest/class-rest.php @@ -14,6 +14,7 @@ namespace EA_WP_AWS_SNS_Client_REST_Endpoint\rest; use EA_WP_AWS_SNS_Client_REST_Endpoint\includes\EA_WP_AWS_SNS_Client_REST_Endpoint; +use EA_WP_AWS_SNS_Client_REST_Endpoint\WPPB\WPPB_Object; /** * The REST API functionality of the plugin. @@ -24,7 +25,7 @@ * @subpackage EA_WP_AWS_SNS_Client_REST_Endpoint/rest * @author Brian Henry */ -class REST extends \WPPB_Object { +class REST extends WPPB_Object { /** * Defines the REST endpoint itself. Added on WordPress `rest_api_init` action. diff --git a/trunk/includes/index.php b/src/rest/index.php similarity index 100% rename from trunk/includes/index.php rename to src/rest/index.php diff --git a/trunk/uninstall.php b/src/uninstall.php similarity index 100% rename from trunk/uninstall.php rename to src/uninstall.php diff --git a/tests/data/notification.json b/tests/data/notification.json index ce07dfd..cd89784 100644 --- a/tests/data/notification.json +++ b/tests/data/notification.json @@ -10,7 +10,7 @@ "Keep-Alive" ], "host": [ - "anabolictv-staging.gv1md4q4-liquidwebsites.com" + "enhancedathlete.com" ], "content_type": [ "text\/plain; charset=UTF-8" @@ -19,13 +19,13 @@ "1825" ], "x_amz_sns_subscription_arn": [ - "arn:aws:sns:us-east-1:112382221323:new_transcription_complete:7f191918-71ca-454c-b19a-05d834e74e35" + "arn:aws:sns:us-east-1:111234221323:new_transcription_complete:7f191918-71ca-454c-b19a-05d834e74e35" ], "x_amz_sns_topic_arn": [ - "arn:aws:sns:us-east-1:112382221323:new_transcription_complete" + "arn:aws:sns:us-east-1:111234221323:new_transcription_complete" ], "x_amz_sns_message_id": [ - "8e64dd96-e4f9-51b8-98f3-88956d2ee5b0" + "8e64dd96-e4f9-51b8-98f3-12346d2ee5b0" ], "x_amz_sns_message_type": [ "Notification" @@ -33,7 +33,7 @@ }, "body": { "Type": "Notification", - "MessageId": "8e64dd96-e4f9-51b8-98f3-88956d2ee5b0", + "MessageId": "8e64dd96-e4f9-51b8-98f3-1234d2ee5b0", "TopicArn": "arn:aws:sns:us-east-1:112382221323:new_transcription_complete", "Subject": "Amazon S3 Notification", "Message": "{\"Records\":[{\"eventVersion\":\"2.1\",\"eventSource\":\"aws:s3\",\"awsRegion\":\"us-east-1\",\"eventTime\":\"2019-03-13T22:43:35.430Z\",\"eventName\":\"ObjectCreated:Put\",\"userIdentity\":{\"principalId\":\"AWS:AROAJKNQZEYTYXZUY7HR2:downloadFileToS3\"},\"requestParameters\":{\"sourceIPAddress\":\"54.209.250.211\"},\"responseElements\":{\"x-amz-request-id\":\"1B4822A692737467\",\"x-amz-id-2\":\"8y+y6ItUGGNipki\/P7ZpgW7oeFZwG4NQQJqT2FdC8UAkIYAy1Z1qXu8gv3fRIsMtgNw\/bqk7+ww=\"},\"s3\":{\"s3SchemaVersion\":\"1.0\",\"configurationId\":\"NewTranscription\",\"bucket\":{\"name\":\"video-ea-public\",\"ownerIdentity\":{\"principalId\":\"A18PYG3BV02B3W\"},\"arn\":\"arn:aws:s3:::video-ea-public\"},\"object\":{\"key\":\"deleteme2-bh-index.mp4.json\",\"size\":1613,\"eTag\":\"830fc983109dc0676cdbc98eaf37f96b\",\"sequencer\":\"005C8987975C82F03E\"}}}]}", diff --git a/tests/wordpress-develop/bootstrap.php b/tests/wordpress-develop/bootstrap.php index dd060b2..99746f5 100644 --- a/tests/wordpress-develop/bootstrap.php +++ b/tests/wordpress-develop/bootstrap.php @@ -7,7 +7,7 @@ */ $project_root_dir = dirname( __FILE__, 3 ); // No trailing slash/. -$plugin_root_dir = $project_root_dir . '/trunk'; +$plugin_root_dir = $project_root_dir . '/src'; $plugin_name = basename( $project_root_dir ); $plugin_name_php = $plugin_name . '.php'; $plugin_path_php = $plugin_root_dir . '/' . $plugin_name_php; @@ -43,7 +43,7 @@ function _manually_load_plugin() { // Assumes the plugin's directory name is the same as its filename. $plugin_name = basename( $project_root_dir ); - require_once $project_root_dir . '/trunk/' . $plugin_name . '.php'; + require_once $project_root_dir . '/src/' . $plugin_name . '.php'; } tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' ); diff --git a/tests/wordpress-develop/includes/class-cron-test.php b/tests/wordpress-develop/includes/class-cron-test.php new file mode 100644 index 0000000..0bff6a5 --- /dev/null +++ b/tests/wordpress-develop/includes/class-cron-test.php @@ -0,0 +1,110 @@ +cron, 'notify_in_background' ); + + $cron_action_added = has_action($tag, $function ); + + $this->assertNotFalse($cron_action_added); + + } + + + public function test_cron_action() { + + global $project_root_dir; + + // Set up a job. + + $notification_json = file_get_contents( $project_root_dir . '/tests/data/notification.json' ); + $notification = json_decode( $notification_json ); + + $request = new \WP_REST_Request( 'POST', '/ea/v1/aws-sns' ); + + $request->set_headers( $notification->headers ); + $request->set_body( wp_json_encode( $notification->body ) ); + + rest_do_request( $request ); + + // Remove existing actions the cron should fire and add one for the test. + + + global $project_root_dir; + + $notification_json = file_get_contents( $project_root_dir . '/tests/data/notification.json' ); + $notification = json_decode( $notification_json ); + + $request = new \WP_REST_Request( 'POST', '/ea/v1/aws-sns' ); + + $request->set_headers( $notification->headers ); + $request->set_body( wp_json_encode( $notification->body ) ); + + rest_do_request( $request ); + + + // Execute cron. + + // include $project_root_dir . '/wordpress/wp-cron.php'; + + + + $called = false; + + $filter_spy = function( $handled, ...$args ) use ( &$called ) { + + $called = true; + + return $handled; + + }; + + add_filter( 'ea_aws_sns_notification', $filter_spy ); + + $crons = _get_cron_array(); + + // Lifted from wp-cron.php + foreach ( $crons as $timestamp => $cronhooks ) { + + foreach ( $cronhooks as $hook => $keys ) { + + if( 'ea_wp_aws_sns_client_rest_endpoint_notify_in_background' !== $hook ) { + continue; + } + + foreach ( $keys as $k => $v ) { + + /** + * Fires scheduled events. + * + * @ignore + * @since 2.1.0 + * + * @param string $hook Name of the hook that was scheduled to be fired. + * @param array $args The arguments to be passed to the hook. + */ + do_action_ref_array( $hook, $v['args'] ); + + } + } + } + + $this->assertTrue( $called ); + + } + +} diff --git a/tests/wordpress-develop/phpunit.xml b/tests/wordpress-develop/phpunit.xml index aad742d..e8be274 100644 --- a/tests/wordpress-develop/phpunit.xml +++ b/tests/wordpress-develop/phpunit.xml @@ -12,13 +12,13 @@ - ../../trunk/ + ../../src/ - ../../trunk/lib/ - ../../trunk/index.php - ../../trunk/admin/index.php - ../../trunk/cron/index.php - ../../trunk/includes/index.php + ../../src/lib/ + ../../src/index.php + ../../src/admin/index.php + ../../src/cron/index.php + ../../src/includes/index.php ../../trunk/rest/index.php diff --git a/tests/wordpress-develop/rest/class-rest-test.php b/tests/wordpress-develop/rest/class-rest-test.php new file mode 100644 index 0000000..db4c6e8 --- /dev/null +++ b/tests/wordpress-develop/rest/class-rest-test.php @@ -0,0 +1,76 @@ +assertArrayHasKey( '/ea/v1/aws-sns', $rest_server->get_routes() ); + } + + /** + * Check we can POST to the endpoint. + */ + public function test_endpoint_accepts_post() { + + $rest_server = rest_get_server(); + + $route = $rest_server->get_routes()['/ea/v1/aws-sns'][0]; + + $this->assertArrayHasKey('POST', $route['methods'] ); + + $this->assertTrue( $route['methods']['POST'] ); + + } + + + /** + * A valid request from AWS-SNS should schedule a notification on a cron job and return success. + */ + public function test_valid_notification_schedules_cron() { + + global $project_root_dir; + + $notification_json = file_get_contents( $project_root_dir . '/tests/data/notification.json' ); + $notification = json_decode( $notification_json ); + + $request = new \WP_REST_Request( 'POST', '/ea/v1/aws-sns' ); + + $request->set_headers( $notification->headers ); + $request->set_body( wp_json_encode( $notification->body ) ); + + rest_do_request( $request ); + + $cron = _get_cron_array(); + + $scheduled_cron_hooks = array(); + + foreach( $cron as $cron_time_array ){ + + foreach( $cron_time_array as $hook_name => $value ) { + + $scheduled_cron_hooks[] = $hook_name; + + } + } + + $this->assertContains( 'ea_wp_aws_sns_client_rest_endpoint_notify_in_background', $scheduled_cron_hooks ); + + // wp_next_scheduled() + } + +} diff --git a/tests/wp-mock/ajax/class-ajax-test.php b/tests/wp-mock/admin/class-ajax-test.php similarity index 98% rename from tests/wp-mock/ajax/class-ajax-test.php rename to tests/wp-mock/admin/class-ajax-test.php index 98b7dcf..6241103 100644 --- a/tests/wp-mock/ajax/class-ajax-test.php +++ b/tests/wp-mock/admin/class-ajax-test.php @@ -1,6 +1,6 @@ */ -namespace EA_WP_AWS_SNS_Client_REST_Endpoint\cron; +namespace EA_WP_AWS_SNS_Client_REST_Endpoint\includes; /** * Class Cron_Test diff --git a/tests/wp-mock/phpunit.xml b/tests/wp-mock/phpunit.xml index bd3bb8c..68aa0e9 100644 --- a/tests/wp-mock/phpunit.xml +++ b/tests/wp-mock/phpunit.xml @@ -12,15 +12,15 @@ - ../../trunk/ + ../../src/ - ../../trunk/lib/ - ../../trunk/lib/ - ../../trunk/index.php - ../../trunk/admin/index.php - ../../trunk/cron/index.php - ../../trunk/includes/index.php - ../../trunk/rest/index.php + ../../src/lib/ + ../../src/lib/ + ../../src/index.php + ../../src/admin/index.php + ../../src/cron/index.php + ../../src/includes/index.php + ../../src/rest/index.php diff --git a/trunk/autoload.php b/trunk/autoload.php deleted file mode 100644 index b271618..0000000 --- a/trunk/autoload.php +++ /dev/null @@ -1,27 +0,0 @@ - __DIR__, - 'namespace_prefix' => 'EA_WP_AWS_SNS_Client_REST_Endpoint', - ) -); -$autoloader->init(); diff --git a/trunk/index.php b/trunk/index.php deleted file mode 100755 index b1dc662..0000000 --- a/trunk/index.php +++ /dev/null @@ -1,8 +0,0 @@ - null, - 'namespace_prefix' => null, - 'lowercase' => array( 'file' ), // 'file' | folders - 'underscore_to_hyphen' => array( 'file' ), // 'file' | folders - 'prepend_class' => true, - 'classes_dir' => '', - 'debug' => false, - ); - - foreach( $args as $key => $value ) { - $arguments[$key] = $value; - } - - $this->set_args( $arguments ); - } - - /** - * Register autoloader - * - * @return string - */ - public function init() { - spl_autoload_register( array( $this, 'autoload' ) ); - } - - public function need_to_autoload( $class ) { - $args = $this->get_args(); - $namespace = $args['namespace_prefix']; - - if ( ! class_exists( $class ) && ! interface_exists( $class) ) { - - if ( false !== strpos( $class, $namespace ) ) { - if ( ! class_exists( $class ) ) { - return true; - } - } - } - - return false; - } - - /** - * Autoloads classes - * - * @param string $class - */ - public function autoload( $class ) { - if ( $this->need_to_autoload( $class ) ) { - $file = $this->convert_class_to_file( $class ); - if ( is_string( $file ) && file_exists( $file ) ) { - require_once $file; - } else { - $args = $this->get_args(); - if ( $args['debug'] ) { - error_log( 'WP Namespace Autoloader could not load file: ' . print_r( $file, true ) ); - } - } - } - } - - /** - * Gets full path of directory containing all classes - * - * @return string - */ - private function get_dir() { - $args = $this->get_args(); - $dir = $this->sanitize_file_path( $args['classes_dir'] ); - - // Directory containing all classes - $classes_dir = empty( $dir ) ? '' : rtrim( $dir, DIRECTORY_SEPARATOR ) . DIRECTORY_SEPARATOR; - - return rtrim( $args['directory'], '/\\' ) . DIRECTORY_SEPARATOR . $classes_dir; - } - - /** - * Gets only the path leading to final file based on namespace - * - * @param string $class - * - * @return string - */ - private function get_namespace_file_path( $class ) { - $args = $this->get_args(); - $namespace_prefix = $args['namespace_prefix']; - - // Sanitized class and namespace prefix - $sanitized_class = $this->sanitize_namespace( $class, false ); - $sanitized_namespace_prefix = $this->sanitize_namespace( $namespace_prefix, true ); - - // Removes prefix from class namespace - $namespace_without_prefix = str_replace( $sanitized_namespace_prefix, '', $sanitized_class ); - - // Gets namespace file path - $namespaces_without_prefix_arr = explode( '\\', $namespace_without_prefix ); - - array_pop( $namespaces_without_prefix_arr ); - $namespace_file_path = implode( DIRECTORY_SEPARATOR, $namespaces_without_prefix_arr ) . DIRECTORY_SEPARATOR; - - if ( in_array( 'folders', $args['lowercase'] ) ) { - $namespace_file_path = strtolower( $namespace_file_path ); - } - - if ( in_array( 'folders', $args['underscore_to_hyphen'] ) ) { - $namespace_file_path = str_replace( array( '_', "\0" ), array( '-', '' ), $namespace_file_path ); - } - - if ( $namespace_file_path == '\\' || $namespace_file_path == '\/' ) { - $namespace_file_path = ''; - } - - return $namespace_file_path; - } - - /** - * Gets final file to be loaded considering WordPress coding standards - * - * @param string $class - * - * @return string - */ - private function get_file_applying_wp_standards( $class ) { - $args = $this->get_args(); - - // Sanitized class and namespace prefix - $sanitized_class = $this->sanitize_namespace( $class, false ); - - // Gets namespace file path - $namespaces_arr = explode( '\\', $sanitized_class ); - - $final_file = array_pop( $namespaces_arr ); - - // Final file name - if ( in_array( 'file', $args['lowercase'] ) ) { - $final_file = strtolower( $final_file ); - } - - // Final file with underscores replaced - if ( in_array( 'file', $args['underscore_to_hyphen'] ) ) { - $final_file = str_replace( array( '_', "\0" ), array( '-', '' ), $final_file ); - } - - // Prepend class - if ( $args['prepend_class'] ) { - // Added by BH: Not WPCS! - $prepended = preg_replace('/(.*)-interface$/', 'interface-$1', $final_file); - $prepended = preg_replace('/(.*)-abstract$/', 'abstract-$1', $prepended); - - if( $prepended === $final_file ) { - $final_file = 'class-' . $final_file; - } else { - $final_file = $prepended; - } - } - - $final_file .= '.php'; - - return $final_file; - } - - /** - * Sanitizes file path - * - * @param string $file_path - * - * @return string - */ - private function sanitize_file_path( $file_path ) { - return trim( $file_path, DIRECTORY_SEPARATOR ); - } - - - /** - * Sanitizes namespace - * - * @param string $namespace - * @param bool $add_backslash - * - * @return string - */ - private function sanitize_namespace( $namespace, $add_backslash = false ) { - if ( $add_backslash ) { - return trim( $namespace, '\\' ) . '\\'; - } else { - return trim( $namespace, '\\' ); - } - } - - /** - * Converts a namespaced class in a file to be loaded - * - * @param string $class - * @param bool $check_loading_need - * - * @return bool|string - */ - public function convert_class_to_file( $class, $check_loading_need = false ) { - if ( $check_loading_need ) { - if ( ! $this->need_to_autoload( $class ) ) { - return false; - } - } - - $dir = $this->get_dir(); - $namespace_file_path = $this->get_namespace_file_path( $class ); - $final_file = $this->get_file_applying_wp_standards( $class ); - - return $dir . $namespace_file_path . $final_file; - } - - /** - * @return mixed - */ - public function get_args() { - return $this->args; - } - - /** - * @param mixed $args - */ - public function set_args( $args ) { - $this->args = $args; - } - } -} diff --git a/trunk/lib/wppb/class-wppb-loader.php b/trunk/lib/wppb/class-wppb-loader.php deleted file mode 100755 index 0655f36..0000000 --- a/trunk/lib/wppb/class-wppb-loader.php +++ /dev/null @@ -1,140 +0,0 @@ -actions = array(); - $this->filters = array(); - - } - - /** - * Add a new action to the collection to be registered with WordPress. - * - * @param string $hook The name of the WordPress action that is being registered. - * @param object $component A reference to the instance of the object on which the action is defined. - * @param string $callback The name of the function definition on the $component. - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. - * - * @since 1.0.0 - */ - public function add_action( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { - $this->actions = $this->add( $this->actions, $hook, $component, $callback, $priority, $accepted_args ); - } - - /** - * Add a new filter to the collection to be registered with WordPress. - * - * @param string $hook The name of the WordPress filter that is being registered. - * @param object $component A reference to the instance of the object on which the filter is defined. - * @param string $callback The name of the function definition on the $component. - * @param int $priority Optional. The priority at which the function should be fired. Default is 10. - * @param int $accepted_args Optional. The number of arguments that should be passed to the $callback. Default is 1. - * - * @since 1.0.0 - */ - public function add_filter( $hook, $component, $callback, $priority = 10, $accepted_args = 1 ) { - $this->filters = $this->add( $this->filters, $hook, $component, $callback, $priority, $accepted_args ); - } - - /** - * A utility function that is used to register the actions and hooks into a single - * collection. - * - * @param array $hooks The collection of hooks that is being registered (that is, actions or filters). - * @param string $hook The name of the WordPress filter that is being registered. - * @param object $component A reference to the instance of the object on which the filter is defined. - * @param string $callback The name of the function definition on the $component. - * @param int $priority The priority at which the function should be fired. - * @param int $accepted_args The number of arguments that should be passed to the $callback. - * - * @return array The collection of actions and filters registered with WordPress. - * @since 1.0.0 - * @access private - */ - private function add( $hooks, $hook, $component, $callback, $priority, $accepted_args ) { - - $hooks[] = array( - 'hook' => $hook, - 'component' => $component, - 'callback' => $callback, - 'priority' => $priority, - 'accepted_args' => $accepted_args, - ); - - return $hooks; - - } - - /** - * Register the filters and actions with WordPress. - * - * @since 1.0.0 - */ - public function run() { - - foreach ( $this->filters as $hook ) { - add_filter( - $hook['hook'], - array( - $hook['component'], - $hook['callback'], - ), - $hook['priority'], - $hook['accepted_args'] - ); - } - - foreach ( $this->actions as $hook ) { - add_action( - $hook['hook'], - array( - $hook['component'], - $hook['callback'], - ), - $hook['priority'], - $hook['accepted_args'] - ); - } - - } - - } -} \ No newline at end of file diff --git a/trunk/lib/wppb/class-wppb-object.php b/trunk/lib/wppb/class-wppb-object.php deleted file mode 100644 index 129da59..0000000 --- a/trunk/lib/wppb/class-wppb-object.php +++ /dev/null @@ -1,46 +0,0 @@ -plugin_name = $plugin_name; - $this->version = $version; - - } - } - -} diff --git a/trunk/lib/wppb/interface-wppb-loader.php b/trunk/lib/wppb/interface-wppb-loader.php deleted file mode 100644 index 6646dd7..0000000 --- a/trunk/lib/wppb/interface-wppb-loader.php +++ /dev/null @@ -1,15 +0,0 @@ -