diff --git a/LICENSE.txt b/LICENSE.txt old mode 100755 new mode 100644 diff --git a/README.txt b/README.txt old mode 100755 new mode 100644 index 78dbe93..7f3a6a3 --- a/README.txt +++ b/README.txt @@ -1,18 +1,18 @@ === Plugin Name === Contributors: leonstafford -Donate link: https://leonstafford.netlify.io -Tags: wp2static,netlify,static +Donate link: https://leonstafford.github.io +Tags: wp2static,s3,static Requires at least: 3.2 Tested up to: 5.0.3 Stable tag: 0.1 License: Unlicense License URI: http://unlicense.org -Adds Netlify as a deployment option for WP2Static. +Adds AWS S3 as a deployment option for WP2Static. == Description == -Take advantage of the Netlify to host your WordPress +Take advantage of the S3 and optionally CloudFront to host your WordPress powered static website. == Installation == diff --git a/admin/class-wp2static-addon-s3-admin.php b/admin/class-wp2static-addon-s3-admin.php new file mode 100644 index 0000000..f881e52 --- /dev/null +++ b/admin/class-wp2static-addon-s3-admin.php @@ -0,0 +1,17 @@ +plugin_name = $plugin_name; + $this->version = $version; + + } + + public function enqueue_scripts() { + wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/wp2static-addon-s3-admin.js', array( 'jquery' ), $this->version, false ); + } +} diff --git a/admin/js/wp2static-addon-s3-admin.js b/admin/js/wp2static-addon-s3-admin.js new file mode 100644 index 0000000..2ccb8bf --- /dev/null +++ b/admin/js/wp2static-addon-s3-admin.js @@ -0,0 +1,24 @@ +(function( $ ) { + 'use strict'; + + $(function() { + deploy_options['s3'] = { + exportSteps: [ + 's3_prepare_export', + 's3_transfer_files', + 'cloudfront_invalidate_all_items', + 'finalize_deployment' + ], + required_fields: { + s3Key: 'Please input an S3 Key in order to authenticate when using the S3 deployment method.', + s3Secret: 'Please input an S3 Secret in order to authenticate when using the S3 deployment method.', + s3Bucket: 'Please input the name of the S3 bucket you are trying to deploy to.', + } + }; + + status_descriptions['s3_prepare_export'] = 'Preparing files for S3 deployment'; + status_descriptions['s3_transfer_files'] = 'Deploying files to S3'; + status_descriptions['cloudfront_invalidate_all_items'] = 'Invalidating CloudFront cache'; + }); // end DOM ready + +})( jQuery ); diff --git a/composer.json b/composer.json index 3a2b18b..55bd820 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "wp2static/wp2static-addon-netlify", - "description": "Netlify deployment Add-on for WP2Static.", + "name": "wp2static/wp2static-addon-s3", + "description": "S3 deployment Add-on for WP2Static.", "homepage": "https://wp2static.com", "license": "UNLICENSE", "authors": [ @@ -12,10 +12,10 @@ ], "type": "wordpress-plugin", "support": { - "issues": "https://github.com/WP2Static/wp2static-addon-netlify/issues", + "issues": "https://github.com/WP2Static/wp2static-addon-s3/issues", "forum": "https://wp2static.com/community", "docs": "https://wp2static.com/documentation", - "source": "https://github.com/WP2Static/wp2static-addon-netlify" + "source": "https://github.com/WP2Static/wp2static-addon-s3" }, "repositories": [ { @@ -24,7 +24,7 @@ } ], "require": { - "php": ">=7.0" + "php": ">=7.2" }, "require-dev": { "phpstan/phpstan-shim": "^0.11.5", @@ -37,13 +37,13 @@ }, "autoload": { "psr-4": { - "WP2Static\\": "src/" + "WP2StaticS3\\": "src/" } }, "autoload-dev": { "psr-4": { "PHPStan\\WordPress\\": "tests/phpstan/", - "WP2Static\\": "src/" + "WP2StaticS3\\": "src/" } }, "config": { @@ -59,6 +59,7 @@ "phpstan": "php -d memory_limit=-1 ./vendor/bin/phpstan analyse", "phpcs": "vendor/bin/phpcs --standard=./tools/phpcs.xml --ignore=,*/tests/*,*/vendor/*,wp2static.php ./", "phpunit": "vendor/bin/phpunit ./tests/unit/", - "lint": "vendor/bin/parallel-lint --exclude vendor ." + "lint": "vendor/bin/parallel-lint --exclude vendor .", + "build": "/bin/sh tools/build_release.sh" } } diff --git a/composer.lock b/composer.lock deleted file mode 100644 index 8f71c2e..0000000 --- a/composer.lock +++ /dev/null @@ -1,1789 +0,0 @@ -{ - "_readme": [ - "This file locks the dependencies of your project to a known state", - "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", - "This file is @generated automatically" - ], - "content-hash": "27d2db3aecc5f9a1cf206cc876c1928d", - "packages": [], - "packages-dev": [ - { - "name": "dealerdirect/phpcodesniffer-composer-installer", - "version": "v0.5.0", - "source": { - "type": "git", - "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/e749410375ff6fb7a040a68878c656c2e610b132", - "reference": "e749410375ff6fb7a040a68878c656c2e610b132", - "shasum": "" - }, - "require": { - "composer-plugin-api": "^1.0", - "php": "^5.3|^7", - "squizlabs/php_codesniffer": "^2|^3" - }, - "require-dev": { - "composer/composer": "*", - "phpcompatibility/php-compatibility": "^9.0", - "sensiolabs/security-checker": "^4.1.0" - }, - "type": "composer-plugin", - "extra": { - "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin" - }, - "autoload": { - "psr-4": { - "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Franck Nijhof", - "email": "franck.nijhof@dealerdirect.com", - "homepage": "http://www.frenck.nl", - "role": "Developer / IT Manager" - } - ], - "description": "PHP_CodeSniffer Standards Composer Installer Plugin", - "homepage": "http://www.dealerdirect.com", - "keywords": [ - "PHPCodeSniffer", - "PHP_CodeSniffer", - "code quality", - "codesniffer", - "composer", - "installer", - "phpcs", - "plugin", - "qa", - "quality", - "standard", - "standards", - "style guide", - "stylecheck", - "tests" - ], - "time": "2018-10-26T13:21:45+00:00" - }, - { - "name": "doctrine/instantiator", - "version": "1.2.0", - "source": { - "type": "git", - "url": "https://github.com/doctrine/instantiator.git", - "reference": "a2c590166b2133a4633738648b6b064edae0814a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/a2c590166b2133a4633738648b6b064edae0814a", - "reference": "a2c590166b2133a4633738648b6b064edae0814a", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "doctrine/coding-standard": "^6.0", - "ext-pdo": "*", - "ext-phar": "*", - "phpbench/phpbench": "^0.13", - "phpstan/phpstan-phpunit": "^0.11", - "phpstan/phpstan-shim": "^0.11", - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.2.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com", - "homepage": "http://ocramius.github.com/" - } - ], - "description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors", - "homepage": "https://www.doctrine-project.org/projects/instantiator.html", - "keywords": [ - "constructor", - "instantiate" - ], - "time": "2019-03-17T17:37:11+00:00" - }, - { - "name": "giacocorsiglia/wordpress-stubs", - "version": "v5.1.1", - "source": { - "type": "git", - "url": "https://github.com/GiacoCorsiglia/wordpress-stubs.git", - "reference": "1c6f011f5c241bab7293315d7fb7fca27fe79473" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/GiacoCorsiglia/wordpress-stubs/zipball/1c6f011f5c241bab7293315d7fb7fca27fe79473", - "reference": "1c6f011f5c241bab7293315d7fb7fca27fe79473", - "shasum": "" - }, - "require-dev": { - "ext-gettext": "*", - "giacocorsiglia/stubs-generator": "^0.5.0", - "johnpbloch/wordpress": "5.1.1", - "php": "^7.1" - }, - "type": "library", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2.0+" - ], - "authors": [ - { - "name": "Giaco Corsiglia", - "email": "GiacoCorsiglia@gmail.com" - } - ], - "description": "WordPress function, class, and global variable declaration stubs for easier static analysis.", - "homepage": "https://github.com/GiacoCorsiglia/wordpress-stubs", - "keywords": [ - "static analysis", - "wordpress" - ], - "time": "2019-03-13T21:16:05+00:00" - }, - { - "name": "jakub-onderka/php-parallel-lint", - "version": "v1.0.0", - "source": { - "type": "git", - "url": "https://github.com/JakubOnderka/PHP-Parallel-Lint.git", - "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/JakubOnderka/PHP-Parallel-Lint/zipball/04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", - "reference": "04fbd3f5fb1c83f08724aa58a23db90bd9086ee8", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "require-dev": { - "jakub-onderka/php-console-highlighter": "~0.3", - "nette/tester": "~1.3", - "squizlabs/php_codesniffer": "~2.7" - }, - "suggest": { - "jakub-onderka/php-console-highlighter": "Highlight syntax in code snippet" - }, - "bin": [ - "parallel-lint" - ], - "type": "library", - "autoload": { - "classmap": [ - "./" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Jakub Onderka", - "email": "ahoj@jakubonderka.cz" - } - ], - "description": "This tool check syntax of PHP files about 20x faster than serial check.", - "homepage": "https://github.com/JakubOnderka/PHP-Parallel-Lint", - "time": "2018-02-24T15:31:20+00:00" - }, - { - "name": "myclabs/deep-copy", - "version": "1.9.1", - "source": { - "type": "git", - "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "reference": "e6828efaba2c9b79f4499dae1d66ef8bfa7b2b72", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "replace": { - "myclabs/deep-copy": "self.version" - }, - "require-dev": { - "doctrine/collections": "^1.0", - "doctrine/common": "^2.6", - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "autoload": { - "psr-4": { - "DeepCopy\\": "src/DeepCopy/" - }, - "files": [ - "src/DeepCopy/deep_copy.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "Create deep copies (clones) of your objects", - "keywords": [ - "clone", - "copy", - "duplicate", - "object", - "object graph" - ], - "time": "2019-04-07T13:18:21+00:00" - }, - { - "name": "phar-io/manifest", - "version": "1.0.3", - "source": { - "type": "git", - "url": "https://github.com/phar-io/manifest.git", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "reference": "7761fcacf03b4d4f16e7ccb606d4879ca431fcf4", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-phar": "*", - "phar-io/version": "^2.0", - "php": "^5.6 || ^7.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": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", - "time": "2018-07-08T19:23:20+00:00" - }, - { - "name": "phar-io/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/phar-io/version.git", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phar-io/version/zipball/45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "reference": "45a2ec53a73c70ce41d55cedef9063630abaf1b6", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - }, - { - "name": "Sebastian Heuer", - "email": "sebastian@phpeople.de", - "role": "Developer" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de", - "role": "Developer" - } - ], - "description": "Library for handling version information and constraints", - "time": "2018-07-08T19:19:57+00:00" - }, - { - "name": "phpdocumentor/reflection-common", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "reference": "21bdeb5f65d7ebf9f43b1b25d404f87deab5bfb6", - "shasum": "" - }, - "require": { - "php": ">=5.5" - }, - "require-dev": { - "phpunit/phpunit": "^4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" - } - ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", - "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" - ], - "time": "2017-09-11T18:02:19+00:00" - }, - { - "name": "phpdocumentor/reflection-docblock", - "version": "4.3.1", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "reference": "bdd9f737ebc2a01c06ea7ff4308ec6697db9b53c", - "shasum": "" - }, - "require": { - "php": "^7.0", - "phpdocumentor/reflection-common": "^1.0.0", - "phpdocumentor/type-resolver": "^0.4.0", - "webmozart/assert": "^1.0" - }, - "require-dev": { - "doctrine/instantiator": "~1.0.5", - "mockery/mockery": "^1.0", - "phpunit/phpunit": "^6.4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "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-04-30T17:48:53+00:00" - }, - { - "name": "phpdocumentor/type-resolver", - "version": "0.4.0", - "source": { - "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/9c977708995954784726e25d0cd1dddf4e65b0f7", - "reference": "9c977708995954784726e25d0cd1dddf4e65b0f7", - "shasum": "" - }, - "require": { - "php": "^5.5 || ^7.0", - "phpdocumentor/reflection-common": "^1.0" - }, - "require-dev": { - "mockery/mockery": "^0.9.4", - "phpunit/phpunit": "^5.2||^4.8.24" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-4": { - "phpDocumentor\\Reflection\\": [ - "src/" - ] - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - } - ], - "time": "2017-07-14T14:27:02+00:00" - }, - { - "name": "phpspec/prophecy", - "version": "1.8.0", - "source": { - "type": "git", - "url": "https://github.com/phpspec/prophecy.git", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "reference": "4ba436b55987b4bf311cb7c6ba82aa528aac0a06", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.0.2", - "php": "^5.3|^7.0", - "phpdocumentor/reflection-docblock": "^2.0|^3.0.2|^4.0", - "sebastian/comparator": "^1.1|^2.0|^3.0", - "sebastian/recursion-context": "^1.0|^2.0|^3.0" - }, - "require-dev": { - "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" - } - }, - "autoload": { - "psr-0": { - "Prophecy\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Konstantin Kudryashov", - "email": "ever.zet@gmail.com", - "homepage": "http://everzet.com" - }, - { - "name": "Marcello Duarte", - "email": "marcello.duarte@gmail.com" - } - ], - "description": "Highly opinionated mocking framework for PHP 5.3+", - "homepage": "https://github.com/phpspec/prophecy", - "keywords": [ - "Double", - "Dummy", - "fake", - "mock", - "spy", - "stub" - ], - "time": "2018-08-05T17:53:17+00:00" - }, - { - "name": "phpstan/phpstan-shim", - "version": "0.11.6", - "source": { - "type": "git", - "url": "https://github.com/phpstan/phpstan-shim.git", - "reference": "f38e0658f497517aff0635f4a622858a5d20c37f" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan-shim/zipball/f38e0658f497517aff0635f4a622858a5d20c37f", - "reference": "f38e0658f497517aff0635f4a622858a5d20c37f", - "shasum": "" - }, - "require": { - "php": "~7.1" - }, - "replace": { - "nikic/php-parser": "^4.0.2", - "phpstan/phpdoc-parser": "^0.3.3", - "phpstan/phpstan": "self.version" - }, - "bin": [ - "phpstan", - "phpstan.phar" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.11-dev" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "description": "PHPStan Phar distribution", - "time": "2019-05-08T19:07:51+00:00" - }, - { - "name": "phpunit/php-code-coverage", - "version": "7.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/0317a769a81845c390e19684d9ba25d7f6aa4707", - "reference": "0317a769a81845c390e19684d9ba25d7f6aa4707", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-xmlwriter": "*", - "php": "^7.2", - "phpunit/php-file-iterator": "^2.0.2", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-token-stream": "^3.0.1", - "sebastian/code-unit-reverse-lookup": "^1.0.1", - "sebastian/environment": "^4.1", - "sebastian/version": "^2.0.1", - "theseer/tokenizer": "^1.1" - }, - "require-dev": { - "phpunit/phpunit": "^8.0" - }, - "suggest": { - "ext-xdebug": "^2.6.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "7.0-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": "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": "2019-02-26T07:38:26+00:00" - }, - { - "name": "phpunit/php-file-iterator", - "version": "2.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-file-iterator.git", - "reference": "050bedf145a257b1ff02746c31894800e5122946" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/050bedf145a257b1ff02746c31894800e5122946", - "reference": "050bedf145a257b1ff02746c31894800e5122946", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "FilterIterator implementation that filters files based on a list of suffixes.", - "homepage": "https://github.com/sebastianbergmann/php-file-iterator/", - "keywords": [ - "filesystem", - "iterator" - ], - "time": "2018-09-13T20:33:42+00:00" - }, - { - "name": "phpunit/php-text-template", - "version": "1.2.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-text-template.git", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "reference": "31f8b717e51d9a2afca6c9f046f5d69fc27c8686", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "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": "Simple template engine.", - "homepage": "https://github.com/sebastianbergmann/php-text-template/", - "keywords": [ - "template" - ], - "time": "2015-06-21T13:50:34+00:00" - }, - { - "name": "phpunit/php-timer", - "version": "2.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-timer.git", - "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/8b389aebe1b8b0578430bda0c7c95a829608e059", - "reference": "8b389aebe1b8b0578430bda0c7c95a829608e059", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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" - } - ], - "description": "Utility class for timing", - "homepage": "https://github.com/sebastianbergmann/php-timer/", - "keywords": [ - "timer" - ], - "time": "2019-02-20T10:12:59+00:00" - }, - { - "name": "phpunit/php-token-stream", - "version": "3.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/c99e3be9d3e85f60646f152f9002d46ed7770d18", - "reference": "c99e3be9d3e85f60646f152f9002d46ed7770d18", - "shasum": "" - }, - "require": { - "ext-tokenizer": "*", - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Wrapper around PHP's tokenizer extension.", - "homepage": "https://github.com/sebastianbergmann/php-token-stream/", - "keywords": [ - "tokenizer" - ], - "time": "2018-10-30T05:52:18+00:00" - }, - { - "name": "phpunit/phpunit", - "version": "8.1.4", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "b534b017daaef2d7f60c6ee61e6aa2e13fdc6910" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/b534b017daaef2d7f60c6ee61e6aa2e13fdc6910", - "reference": "b534b017daaef2d7f60c6ee61e6aa2e13fdc6910", - "shasum": "" - }, - "require": { - "doctrine/instantiator": "^1.1", - "ext-dom": "*", - "ext-json": "*", - "ext-libxml": "*", - "ext-mbstring": "*", - "ext-xml": "*", - "ext-xmlwriter": "*", - "myclabs/deep-copy": "^1.7", - "phar-io/manifest": "^1.0.2", - "phar-io/version": "^2.0", - "php": "^7.2", - "phpspec/prophecy": "^1.7", - "phpunit/php-code-coverage": "^7.0", - "phpunit/php-file-iterator": "^2.0.1", - "phpunit/php-text-template": "^1.2.1", - "phpunit/php-timer": "^2.1", - "sebastian/comparator": "^3.0", - "sebastian/diff": "^3.0", - "sebastian/environment": "^4.1", - "sebastian/exporter": "^3.1", - "sebastian/global-state": "^3.0", - "sebastian/object-enumerator": "^3.0.3", - "sebastian/resource-operations": "^2.0", - "sebastian/version": "^2.0.1" - }, - "require-dev": { - "ext-pdo": "*" - }, - "suggest": { - "ext-soap": "*", - "ext-xdebug": "*", - "phpunit/php-invoker": "^2.0" - }, - "bin": [ - "phpunit" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "8.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" - } - ], - "description": "The PHP Unit Testing framework.", - "homepage": "https://phpunit.de/", - "keywords": [ - "phpunit", - "testing", - "xunit" - ], - "time": "2019-05-09T05:13:39+00:00" - }, - { - "name": "sebastian/code-unit-reverse-lookup", - "version": "1.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "reference": "4419fcdb5eabb9caa61a27c7a1db532a6b55dd18", - "shasum": "" - }, - "require": { - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.7 || ^6.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" - } - ], - "description": "Looks up which function or method a line of code belongs to", - "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/", - "time": "2017-03-04T06:30:41+00:00" - }, - { - "name": "sebastian/comparator", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/comparator.git", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "reference": "5de4fc177adf9bce8df98d8d141a7559d7ccf6da", - "shasum": "" - }, - "require": { - "php": "^7.1", - "sebastian/diff": "^3.0", - "sebastian/exporter": "^3.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides the functionality to compare PHP values for equality", - "homepage": "https://github.com/sebastianbergmann/comparator", - "keywords": [ - "comparator", - "compare", - "equality" - ], - "time": "2018-07-12T15:12:46+00:00" - }, - { - "name": "sebastian/diff", - "version": "3.0.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "reference": "720fcc7e9b5cf384ea68d9d930d480907a0c1a29", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5 || ^8.0", - "symfony/process": "^2 || ^3.3 || ^4" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Kore Nordmann", - "email": "mail@kore-nordmann.de" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Diff implementation", - "homepage": "https://github.com/sebastianbergmann/diff", - "keywords": [ - "diff", - "udiff", - "unidiff", - "unified diff" - ], - "time": "2019-02-04T06:01:07+00:00" - }, - { - "name": "sebastian/environment", - "version": "4.2.2", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "reference": "f2a2c8e1c97c11ace607a7a667d73d47c19fe404", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "require-dev": { - "phpunit/phpunit": "^7.5" - }, - "suggest": { - "ext-posix": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.2-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides functionality to handle HHVM/PHP environments", - "homepage": "http://www.github.com/sebastianbergmann/environment", - "keywords": [ - "Xdebug", - "environment", - "hhvm" - ], - "time": "2019-05-05T09:05:15+00:00" - }, - { - "name": "sebastian/exporter", - "version": "3.1.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/234199f4528de6d12aaa58b612e98f7d36adb937", - "reference": "234199f4528de6d12aaa58b612e98f7d36adb937", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-mbstring": "*", - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Volker Dusch", - "email": "github@wallbash.com" - }, - { - "name": "Bernhard Schussek", - "email": "bschussek@2bepublished.at" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides the functionality to export PHP variables for visualization", - "homepage": "http://www.github.com/sebastianbergmann/exporter", - "keywords": [ - "export", - "exporter" - ], - "time": "2017-04-03T13:19:02+00:00" - }, - { - "name": "sebastian/global-state", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "reference": "edf8a461cf1d4005f19fb0b6b8b95a9f7fa0adc4", - "shasum": "" - }, - "require": { - "php": "^7.2", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "ext-dom": "*", - "phpunit/phpunit": "^8.0" - }, - "suggest": { - "ext-uopz": "*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Snapshotting of global state", - "homepage": "http://www.github.com/sebastianbergmann/global-state", - "keywords": [ - "global state" - ], - "time": "2019-02-01T05:30:01+00:00" - }, - { - "name": "sebastian/object-enumerator", - "version": "3.0.3", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "reference": "7cfd9e65d11ffb5af41198476395774d4c8a84c5", - "shasum": "" - }, - "require": { - "php": "^7.0", - "sebastian/object-reflector": "^1.1.1", - "sebastian/recursion-context": "^3.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Traverses array structures and object graphs to enumerate all referenced objects", - "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2017-08-03T12:35:26+00:00" - }, - { - "name": "sebastian/object-reflector", - "version": "1.1.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/object-reflector.git", - "reference": "773f97c67f28de00d397be301821b06708fca0be" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/773f97c67f28de00d397be301821b06708fca0be", - "reference": "773f97c67f28de00d397be301821b06708fca0be", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "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" - } - ], - "description": "Allows reflection of object attributes, including inherited and non-public ones", - "homepage": "https://github.com/sebastianbergmann/object-reflector/", - "time": "2017-03-29T09:07:27+00:00" - }, - { - "name": "sebastian/recursion-context", - "version": "3.0.0", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "reference": "5b0cd723502bac3b006cbf3dbf7a1e3fcefe4fa8", - "shasum": "" - }, - "require": { - "php": "^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^6.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.0.x-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Jeff Welch", - "email": "whatthejeff@gmail.com" - }, - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - }, - { - "name": "Adam Harvey", - "email": "aharvey@php.net" - } - ], - "description": "Provides functionality to recursively process PHP variables", - "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2017-03-03T06:23:57+00:00" - }, - { - "name": "sebastian/resource-operations", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "reference": "4d7a795d35b889bf80a0cc04e08d77cedfa917a9", - "shasum": "" - }, - "require": { - "php": "^7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } - }, - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Sebastian Bergmann", - "email": "sebastian@phpunit.de" - } - ], - "description": "Provides a list of PHP built-in functions that operate on resources", - "homepage": "https://www.github.com/sebastianbergmann/resource-operations", - "time": "2018-10-04T04:07:39+00:00" - }, - { - "name": "sebastian/version", - "version": "2.0.1", - "source": { - "type": "git", - "url": "https://github.com/sebastianbergmann/version.git", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/99732be0ddb3361e16ad77b68ba41efc8e979019", - "reference": "99732be0ddb3361e16ad77b68ba41efc8e979019", - "shasum": "" - }, - "require": { - "php": ">=5.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.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": "Library that helps with managing the version number of Git-hosted PHP projects", - "homepage": "https://github.com/sebastianbergmann/version", - "time": "2016-10-03T07:35:21+00:00" - }, - { - "name": "squizlabs/php_codesniffer", - "version": "3.4.2", - "source": { - "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", - "reference": "b8a7362af1cc1aadb5bd36c3defc4dda2cf5f0a8", - "shasum": "" - }, - "require": { - "ext-simplexml": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": ">=5.4.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" - }, - "bin": [ - "bin/phpcs", - "bin/phpcbf" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Greg Sherwood", - "role": "lead" - } - ], - "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", - "keywords": [ - "phpcs", - "standards" - ], - "time": "2019-04-10T23:49:02+00:00" - }, - { - "name": "symfony/polyfill-ctype", - "version": "v1.11.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "82ebae02209c21113908c229e9883c419720738a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a", - "reference": "82ebae02209c21113908c229e9883c419720738a", - "shasum": "" - }, - "require": { - "php": ">=5.3.3" - }, - "suggest": { - "ext-ctype": "For best performance" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.11-dev" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, - "files": [ - "bootstrap.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - }, - { - "name": "Gert de Pagter", - "email": "BackEndTea@gmail.com" - } - ], - "description": "Symfony polyfill for ctype functions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "ctype", - "polyfill", - "portable" - ], - "time": "2019-02-06T07:57:58+00:00" - }, - { - "name": "theseer/tokenizer", - "version": "1.1.2", - "source": { - "type": "git", - "url": "https://github.com/theseer/tokenizer.git", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/1c42705be2b6c1de5904f8afacef5895cab44bf8", - "reference": "1c42705be2b6c1de5904f8afacef5895cab44bf8", - "shasum": "" - }, - "require": { - "ext-dom": "*", - "ext-tokenizer": "*", - "ext-xmlwriter": "*", - "php": "^7.0" - }, - "type": "library", - "autoload": { - "classmap": [ - "src/" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Arne Blankerts", - "email": "arne@blankerts.de", - "role": "Developer" - } - ], - "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", - "time": "2019-04-04T09:56:43+00:00" - }, - { - "name": "webmozart/assert", - "version": "1.4.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/assert.git", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/83e253c8e0be5b0257b881e1827274667c5c17a9", - "reference": "83e253c8e0be5b0257b881e1827274667c5c17a9", - "shasum": "" - }, - "require": { - "php": "^5.3.3 || ^7.0", - "symfony/polyfill-ctype": "^1.8" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Assert\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "Assertions to validate method input/output with nice error messages.", - "keywords": [ - "assert", - "check", - "validate" - ], - "time": "2018-12-25T11:19:39+00:00" - }, - { - "name": "wp-coding-standards/wpcs", - "version": "2.1.0", - "source": { - "type": "git", - "url": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git", - "reference": "8c7a2e7682de9ef5955251874b639deda51ef470" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/WordPress-Coding-Standards/WordPress-Coding-Standards/zipball/8c7a2e7682de9ef5955251874b639deda51ef470", - "reference": "8c7a2e7682de9ef5955251874b639deda51ef470", - "shasum": "" - }, - "require": { - "php": ">=5.4", - "squizlabs/php_codesniffer": "^3.3.1" - }, - "require-dev": { - "dealerdirect/phpcodesniffer-composer-installer": "^0.5.0", - "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." - }, - "type": "phpcodesniffer-standard", - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Contributors", - "homepage": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/graphs/contributors" - } - ], - "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions", - "keywords": [ - "phpcs", - "standards", - "wordpress" - ], - "time": "2019-04-08T10:53:57+00:00" - } - ], - "aliases": [], - "minimum-stability": "stable", - "stability-flags": [], - "prefer-stable": false, - "prefer-lowest": false, - "platform": { - "php": ">=7.0" - }, - "platform-dev": [], - "platform-overrides": { - "php": "7.2.17" - } -} diff --git a/includes/class-wp2static-addon-s3.php b/includes/class-wp2static-addon-s3.php new file mode 100644 index 0000000..9f67276 --- /dev/null +++ b/includes/class-wp2static-addon-s3.php @@ -0,0 +1,142 @@ +version = PLUGIN_NAME_VERSION; + } else { + $this->version = '1.0.0'; + } + $this->plugin_name = 'wp2static-addon-s3'; + + $this->load_dependencies(); + $this->define_admin_hooks(); + } + + private function load_dependencies() { + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp2static-addon-s3-loader.php'; + require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-wp2static-addon-s3-admin.php'; + + $this->loader = new Wp2static_Addon_S3_Loader(); + } + + private function define_admin_hooks() { + $plugin_admin = new Wp2static_Addon_S3_Admin( $this->get_plugin_name(), $this->get_version() ); + + if ( isset( $_GET['page'] ) && ( $_GET['page'] == 'wp2static')) { + $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' ); + } + } + + public function add_deployment_option_to_ui( $deploy_options ) { + $deploy_options['s3'] = array('Amazon S3'); + + return $deploy_options; + } + + public function load_deployment_option_template( $templates ) { + $templates[] = __DIR__ . '/../views/s3_settings_block.phtml'; + + return $templates; + } + + public function add_deployment_option_keys( $keys ) { + $new_keys = array( + 'baseUrl-s3', + 'cfDistributionId', + 's3Bucket', + 's3CacheControl', + 's3Key', + 's3Region', + 's3RemotePath', + 's3Secret', + ); + + $keys = array_merge( + $keys, + $new_keys + ); + + return $keys; + } + + public function whitelist_deployment_option_keys( $keys ) { + $whitelist_keys = array( + 'baseUrl-s3', + 'cfDistributionId', + 's3Bucket', + 's3CacheControl', + 's3Key', + 's3Region', + 's3RemotePath', + ); + + $keys = array_merge( + $keys, + $whitelist_keys + ); + + return $keys; + } + + public function add_post_and_db_keys( $keys ) { + $keys['s3'] = array( + 'baseUrl-s3', + 'cfDistributionId', + 's3Bucket', + 's3CacheControl', + 's3Key', + 's3Region', + 's3RemotePath', + 's3Secret', + ); + + return $keys; + } + + public function run() { + $this->loader->run(); + + add_filter( + 'wp2static_add_deployment_method_option_to_ui', + [$this, 'add_deployment_option_to_ui'] + ); + + add_filter( + 'wp2static_load_deploy_option_template', + [$this, 'load_deployment_option_template'] + ); + + add_filter( + 'wp2static_add_option_keys', + [$this, 'add_deployment_option_keys'] + ); + + add_filter( + 'wp2static_whitelist_option_keys', + [$this, 'whitelist_deployment_option_keys'] + ); + + add_filter( + 'wp2static_add_post_and_db_keys', + [$this, 'add_post_and_db_keys'] + ); + } + + public function get_plugin_name() { + return $this->plugin_name; + } + + public function get_loader() { + return $this->loader; + } + + public function get_version() { + return $this->version; + } +} diff --git a/js/wp2static-addon-netlify-admin.js b/js/wp2static-addon-netlify-admin.js deleted file mode 100755 index a359ff5..0000000 --- a/js/wp2static-addon-netlify-admin.js +++ /dev/null @@ -1,18 +0,0 @@ -(function( $ ) { - 'use strict'; - - $(function() { - deploy_options['netlify'] = { - exportSteps: [ - 'netlify_do_export', - 'finalize_deployment' - ], - required_fields: { - netlifyPersonalAccessToken: 'Please specify your Netlify personal access token in order to deploy to Netlify.', - netlifySiteID: 'Please specify the id of your Netlify site you want to deploy to.', - }, - }; - status_descriptions['netlify_do_export'] = 'Deploying to Netlify'; - }); // end DOM ready - -})( jQuery ); diff --git a/src/Controller.php b/src/Controller.php new file mode 100755 index 0000000..82d8e09 --- /dev/null +++ b/src/Controller.php @@ -0,0 +1,452 @@ +prefix . 'wp2static_addon_s3_options'; + + $charset_collate = $wpdb->get_charset_collate(); + + $sql = "CREATE TABLE $table_name ( + id mediumint(9) NOT NULL AUTO_INCREMENT, + name VARCHAR(255) NOT NULL, + value VARCHAR(255) NOT NULL, + label VARCHAR(255) NULL, + description VARCHAR(255) NULL, + PRIMARY KEY (id) + ) $charset_collate;"; + + require_once ABSPATH . 'wp-admin/includes/upgrade.php'; + dbDelta( $sql ); + + // check for seed data + // if deployment_url option doesn't exist, create: + $options = $this->getOptions(); + + if ( ! isset( $options['s3Bucket'] ) ) { + $this->seedOptions(); + } + + add_filter( 'wp2static_add_menu_items', [ 'WP2StaticS3\Controller', 'addSubmenuPage' ] ); + + add_action( + 'admin_post_wp2static_s3_save_options', + [ $this, 'saveOptionsFromUI' ], + 15, + 1); + + add_action( + 'wp2static_deploy', + [ $this, 'deploy' ], + 15, + 1); + + add_action( + 'wp2static_post_deploy_trigger', + [ 'WP2StaticS3\Deployer', 'cloudfront_invalidate' ], + 15, + 1); + + // if ( defined( 'WP_CLI' ) ) { + // \WP_CLI::add_command( + // 'wp2static s3', + // [ 'WP2StaticS3\CLI', 's3' ]); + // } + } + + // TODO: is this needed? confirm slashing of destination URLs... + public function modifyWordPressSiteURL( $site_url ) { + return rtrim( $site_url, '/' ); + } + + /** + * Get all add-on options + * + * @return mixed[] All options + */ + public static function getOptions() : array { + global $wpdb; + $options = []; + + $table_name = $wpdb->prefix . 'wp2static_addon_s3_options'; + + $rows = $wpdb->get_results( "SELECT * FROM $table_name" ); + + foreach($rows as $row) { + $options[$row->name] = $row; + } + + return $options; + } + + /** + * Seed options + * + */ + public static function seedOptions() : void { + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_addon_s3_options'; + + $query_string = "INSERT INTO $table_name (name, value, label, description) VALUES (%s, %s, %s, %s);"; + $query = $wpdb->prepare( + $query_string, + 'cfDistributionID', + '', + 'CloudFront Distribution ID', + 'If using CloudFront, set this to auto-invalidate cache'); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 's3Bucket', + '', + 'Bucket name', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 's3AccessKeyID', + '', + 'Access Key ID', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 's3SecretAccessKey', + '', + 'Secret Access Key', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 'cfAccessKeyID', + '', + 'Access Key ID', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 'cfSecretAccessKey', + '', + 'Secret Access Key', + ''); + + $wpdb->query( $query ); + + + $query = $wpdb->prepare( + $query_string, + 's3Region', + '', + 'Region', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 's3Profile', + '', + 'Profile', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 'cfRegion', + '', + 'Region', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 'cfProfile', + '', + 'Profile', + ''); + + $wpdb->query( $query ); + + $query = $wpdb->prepare( + $query_string, + 's3RemotePath', + '', + 'Path prefix in bucket', + 'Optionally, deploy to a subdirectory within bucket'); + + $wpdb->query( $query ); + } + + /** + * Save options + * + */ + public static function saveOption( $name, $value ) : void { + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_addon_s3_options'; + + $query_string = "INSERT INTO $table_name (name, value) VALUES (%s, %s);"; + $query = $wpdb->prepare( $query_string, $name, $value ); + + $wpdb->query( $query ); + } + + public static function renderS3Page() : void { + $view = []; + $view['nonce_action'] = 'wp2static-s3-options'; + $view['uploads_path'] = \WP2Static\SiteInfo::getPath('uploads'); + $s3_path = \WP2Static\SiteInfo::getPath( 'uploads' ) . 'wp2static-processed-site.s3'; + + + $view['options'] = self::getOptions(); + + $view['s3_url'] = + is_file( $s3_path ) ? + \WP2Static\SiteInfo::getUrl( 'uploads' ) . 'wp2static-processed-site.s3' : '#'; + + require_once __DIR__ . '/../views/s3-page.php'; + } + + + public function deploy( $processed_site_path ) { + \WP2Static\WsLog::l('S3 Addon deploying'); + + $s3_deployer = new Deployer(); + $s3_deployer->upload_files( $processed_site_path ); + } + + /* + * Naive encypting/decrypting + * + */ + public static function encrypt_decrypt($action, $string) { + $output = false; + $encrypt_method = "AES-256-CBC"; + + $secret_key = + defined( 'AUTH_KEY' ) ? + constant( 'AUTH_KEY' ) : + 'LC>_cVZv34+W.P&_8d|ejfr]d31h)J?z5n(LB6iY=;P@?5/qzJSyB3qctr,.D$[L'; + + $secret_iv = + defined( 'AUTH_SALT' ) ? + constant( 'AUTH_SALT' ) : + 'ec64SSHB{8|AA_ThIIlm:PD(Z!qga!/Dwll 4|i.?UkC§NNO}z?{Qr/q.KpH55K9'; + + $key = hash('sha256', $secret_key); + $variate = substr(hash('sha256', $secret_iv), 0, 16); + + if ( $action == 'encrypt' ) { + $output = openssl_encrypt($string, $encrypt_method, $key, 0, $variate); + $output = base64_encode($output); + } else if( $action == 'decrypt' ) { + $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $variate); + } + + return $output; + } + + public static function activate_for_single_site() : void { + error_log('activating WP2Static S3 Add-on'); + } + + public static function deactivate_for_single_site() : void { + error_log('deactivating WP2Static S3 Add-on, maintaining options'); + } + + public static function deactivate( bool $network_wide = null ) : void { + error_log('deactivating WP2Static S3 Add-on'); + if ( $network_wide ) { + global $wpdb; + + $query = 'SELECT blog_id FROM %s WHERE site_id = %d;'; + + $site_ids = $wpdb->get_col( + sprintf( + $query, + $wpdb->blogs, + $wpdb->siteid + ) + ); + + foreach ( $site_ids as $site_id ) { + switch_to_blog( $site_id ); + self::deactivate_for_single_site(); + } + + restore_current_blog(); + } else { + self::deactivate_for_single_site(); + } + } + + public static function activate( bool $network_wide = null ) : void { + error_log('activating s3 addon'); + if ( $network_wide ) { + global $wpdb; + + $query = 'SELECT blog_id FROM %s WHERE site_id = %d;'; + + $site_ids = $wpdb->get_col( + sprintf( + $query, + $wpdb->blogs, + $wpdb->siteid + ) + ); + + foreach ( $site_ids as $site_id ) { + switch_to_blog( $site_id ); + self::activate_for_single_site(); + } + + restore_current_blog(); + } else { + self::activate_for_single_site(); + } + } + + public static function addSubmenuPage( $submenu_pages ) { + $submenu_pages['s3'] = [ 'WP2StaticS3\Controller', 'renderS3Page' ]; + + return $submenu_pages; + } + + public static function saveOptionsFromUI() { + check_admin_referer( 'wp2static-s3-options' ); + + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_addon_s3_options'; + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['cfDistributionID'] ) ], + [ 'name' => 'cfDistributionID' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['s3Bucket'] ) ], + [ 'name' => 's3Bucket' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['s3AccessKeyID'] ) ], + [ 'name' => 's3AccessKeyID' ] + ); + + $secret_access_key = + $_POST['s3SecretAccessKey'] ? + self::encrypt_decrypt( + 'encrypt', + sanitize_text_field( $_POST['s3SecretAccessKey'] ) + ) : ''; + + $wpdb->update( + $table_name, + [ 'value' => $secret_access_key ], + [ 'name' => 's3SecretAccessKey' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['cfAccessKeyID'] ) ], + [ 'name' => 'cfAccessKeyID' ] + ); + + $secret_access_key = + $_POST['cfSecretAccessKey'] ? + self::encrypt_decrypt( + 'encrypt', + sanitize_text_field( $_POST['cfSecretAccessKey'] ) + ) : ''; + + $wpdb->update( + $table_name, + [ 'value' => $secret_access_key ], + [ 'name' => 'cfSecretAccessKey' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['s3Region'] ) ], + [ 'name' => 's3Region' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['cfRegion'] ) ], + [ 'name' => 'cfRegion' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['s3Profile'] ) ], + [ 'name' => 's3Profile' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['cfProfile'] ) ], + [ 'name' => 'cfProfile' ] + ); + + $wpdb->update( + $table_name, + [ 'value' => sanitize_text_field( $_POST['s3RemotePath'] ) ], + [ 'name' => 's3RemotePath' ] + ); + + wp_safe_redirect( admin_url( 'admin.php?page=wp2static-s3' ) ); + exit; + } + + /** + * Get option value + * + * @return string option value + */ + public static function getValue( string $name ) : string { + global $wpdb; + + $table_name = $wpdb->prefix . 'wp2static_addon_s3_options'; + + $sql = $wpdb->prepare( + "SELECT value FROM $table_name WHERE" . ' name = %s LIMIT 1', + $name + ); + + $option_value = $wpdb->get_var( $sql ); + + if ( ! is_string( $option_value ) ) { + return ''; + } + + return $option_value; + } +} + diff --git a/src/Deployer.php b/src/Deployer.php new file mode 100755 index 0000000..beb64d1 --- /dev/null +++ b/src/Deployer.php @@ -0,0 +1,174 @@ +prepareDeploy(); + + // options - load from addon's static methods + + public function __construct() {} + + public function upload_files ( $processed_site_path ) : void { + // check if dir exists + if ( ! is_dir( $processed_site_path ) ) { + return; + } + + $client_options = [ + 'profile' => Controller::getValue( 's3Profile' ), + 'version' => 'latest', + 'region' => Controller::getValue( 's3Region' ), + ]; + + /* + If no credentials option, SDK attempts to load credentials from your environment in the following order: + + - environment variables. + - a credentials .ini file. + - an IAM role. + */ + if ( + Controller::getValue( 's3AccessKeyID' ) && + Controller::getValue( 's3SecretAccessKey' ) + ) { + error_log('using supplied creds'); + $client_options['credentials'] = [ + 'key' => Controller::getValue( 's3AccessKeyID' ), + 'secret' => \WP2StaticS3\Controller::encrypt_decrypt( + 'decrypt', + Controller::getValue( 's3SecretAccessKey' ) + ) + ]; + unset( $client_options['profile'] ); + } + + error_log(print_r($client_options, true)); + + // instantiate S3 client + $s3 = new \Aws\S3\S3Client( $client_options ); + + + // iterate each file in ProcessedSite + $iterator = new RecursiveIteratorIterator( + new RecursiveDirectoryIterator( + $processed_site_path, + RecursiveDirectoryIterator::SKIP_DOTS + ) + ); + + foreach ( $iterator as $filename => $file_object ) { + $base_name = basename( $filename ); + if ( $base_name != '.' && $base_name != '..' ) { + $real_filepath = realpath( $filename ); + + // TODO: do filepaths differ when running from WP-CLI (non-chroot)? + + // TODO: check if in DeployCache + if ( \WP2Static\DeployCache::fileisCached( $filename ) ) { + continue; + } + + if ( ! $real_filepath ) { + $err = 'Trying to add unknown file to Zip: ' . $filename; + WsLog::l( $err ); + continue; + } + + // Standardise all paths to use / (Windows support) + $filename = str_replace( '\\', '/', $filename ); + + if ( ! is_string( $filename ) ) { + continue; + } + + $key = + Controller::getValue( 's3RemotePath' ) ? + Controller::getValue( 's3RemotePath' ) . '/' . ltrim( str_replace( $processed_site_path, '', $filename ), '/' ) : + ltrim( str_replace( $processed_site_path, '', $filename ), '/' ); + + $result = $s3->putObject([ + 'Bucket' => Controller::getValue( 's3Bucket' ), + 'Key' => $key, + 'Body' => file_get_contents( $filename ), + 'ACL' => 'public-read', + 'ContentType' => mime_content_type( $filename ), + ]); + + if ( $result['@metadata']['statusCode'] === 200 ) { + \WP2Static\DeployCache::addFile( $filename ); + } + } + } + } + + + public function cloudfront_invalidate_all_items() { + if ( ! Controller::getValue( 'cfDistributionID' ) ) { + return; + } + + \WsLog::l( 'Invalidating all CloudFront items' ); + + $client_options = [ + 'profile' => 'default', + 'version' => 'latest', + 'region' => Controller::getValue( 'cfRegion' ), + ]; + + /* + If no credentials option, SDK attempts to load credentials from your environment in the following order: + + - environment variables. + - a credentials .ini file. + - an IAM role. + */ + if ( + Controller::getValue( 's3AccessKeyID' ) && + Controller::getValue( 's3SecretAccessKey' ) + ) { + + $credentials = new Aws\Credentials\Credentials( + Controller::getValue( 's3AccessKeyID' ), + \WP2StaticS3\Controller::encrypt_decrypt( + 'decrypt', + Controller::getValue( 's3SecretAccessKey' ) + ) + ); + + $client_options['credentials'] = $credentials; + } + + $client = new Aws\CloudFront\CloudFrontClient( $client ); + + try { + $result = $client->createInvalidation([ + 'DistributionId' => Controller::getValue( 'cfDistributionID' ), + 'InvalidationBatch' => [ + 'CallerReference' => 'WP2Static S3 Add-on', + 'Paths' => [ + 'Items' => ['/*'], + 'Quantity' => 1, + ], + ] + ]); + + error_log(print_r($result, true)); + + } catch (AwsException $e) { + // output error message if fails + error_log($e->getMessage()); + } + } +} + diff --git a/src/Netlify.php b/src/Netlify.php deleted file mode 100755 index eb1aefd..0000000 --- a/src/Netlify.php +++ /dev/null @@ -1,110 +0,0 @@ -base_url = 'https://api.netlify.com'; - - $this->site_id = - $this->detectSiteID( - $plugin->options->getOption( 'netlifySiteID' ) - ); - - $this->access_token = - $plugin->options->getOption( 'netlifyPersonalAccessToken' ); - } - - public function detectSiteID( $site_id ) { - if ( strpos( $site_id, 'netlify.com' ) !== false ) { - return $site_id; - } elseif ( strpos( $site_id, '.' ) !== false ) { - return $site_id; - } elseif ( strlen( $site_id ) === 37 ) { - return; - } else { - return $site_id .= '.netlify.com'; - } - } - - public function deploy() { - WsLog::l('Deploying to Netlify'); - - $this->zip_archive_path = SiteInfo::getPath('uploads') . - 'wp2static-exported-site.zip'; - - $zip_size = filesize( $this->zip_archive_path ); - - $zip_size = number_format( $zip_size / 1048576, 2) . ' MB'; - - WsLog::l("ZIP size: {$zip_size}"); - - $zip_deploy_endpoint = $this->base_url . '/api/v1/sites/' . - $this->site_id . '/deploys'; - - try { - $headers = array( - 'Authorization: Bearer ' . $this->access_token, - 'Content-Type: application/zip', - ); - - $this->client = new Request(); - - $this->client->postWithFileStreamAndHeaders( - $zip_deploy_endpoint, - $this->zip_archive_path, - $headers - ); - - $this->checkForValidResponses( - $this->client->status_code, - array( '100', '200', '201', '301', '302', '304' ) - ); - - $this->finalizeDeployment(); - } catch ( Exception $e ) { - $this->handleException( $e ); - } - } - - public function test_netlify() { - $site_info_endpoint = $this->base_url . '/api/v1/sites/' . - $this->site_id; - - try { - - $headers = array( 'Authorization: Bearer ' . $this->access_token ); - - $this->client = new Request(); - - $status_code = $this->client->getWithCustomHeaders( - $site_info_endpoint, - $headers - ); - - // NOTE: check for certain header, as response is always 200 - if ( isset( $this->client->headers['x-ratelimit-limit'] ) ) { - if ( ! defined( 'WP_CLI' ) ) { - echo 'SUCCESS'; - } - } else { - WsLog::l( - 'BAD RESPONSE CODE FROM API (' . $status_code . ')' - ); - - http_response_code( $code ); - - echo 'Netlify test error'; - wp_die(); - } - } catch ( Exception $e ) { - $this->handleException( $e ); - } - } -} diff --git a/src/NetlifyAddon.php b/src/NetlifyAddon.php deleted file mode 100755 index d189ed8..0000000 --- a/src/NetlifyAddon.php +++ /dev/null @@ -1,116 +0,0 @@ -version = PLUGIN_NAME_VERSION; - } else { - $this->version = '0.1'; - } - - $this->plugin_name = 'wp2static-addon-netlify'; - } - - public function add_deployment_option_to_ui( $deploy_options ) { - $deploy_options['netlify'] = array('Netlify'); - - return $deploy_options; - } - - public function load_deployment_option_template( $templates ) { - $templates[] = __DIR__ . '/../views/netlify_settings_block.phtml'; - - return $templates; - } - - public function add_deployment_option_keys( $keys ) { - $new_keys = array( - 'baseUrl-netlify', - 'netlifyHeaders', - 'netlifyPersonalAccessToken', - 'netlifyRedirects', - 'netlifySiteID', - ); - - $keys = array_merge( - $keys, - $new_keys - ); - - return $keys; - } - - public function whitelist_deployment_option_keys( $keys ) { - $whitelist_keys = array( - 'baseUrl-netlify', - 'netlifyHeaders', - 'netlifyRedirects', - 'netlifySiteID', - ); - - $keys = array_merge( - $keys, - $whitelist_keys - ); - - return $keys; - } - - public function add_post_and_db_keys( $keys ) { - $keys['netlify'] = array( - 'baseUrl-netlify', - 'netlifyHeaders', - 'netlifyPersonalAccessToken', - 'netlifyRedirects', - 'netlifySiteID', - ); - - return $keys; - } - - public function netlify_load_js( $hook ) { - if ( $hook !== 'toplevel_page_wp2static' ) { - return; - } - - wp_enqueue_script( - $this->plugin_name, - plugin_dir_url( __FILE__ ) . - '../js/wp2static-addon-netlify-admin.js', - array( 'jquery' ), - $this->version, false - ); - } - - public function run() { - add_action( 'admin_enqueue_scripts', [ $this, 'netlify_load_js' ] ); - - add_filter( - 'wp2static_add_deployment_method_option_to_ui', - [$this, 'add_deployment_option_to_ui'] - ); - - add_filter( - 'wp2static_load_deploy_option_template', - [$this, 'load_deployment_option_template'] - ); - - add_filter( - 'wp2static_add_option_keys', - [$this, 'add_deployment_option_keys'] - ); - - add_filter( - 'wp2static_whitelist_option_keys', - [$this, 'whitelist_deployment_option_keys'] - ); - - add_filter( - 'wp2static_add_post_and_db_keys', - [$this, 'add_post_and_db_keys'] - ); - } -} diff --git a/uninstall.php b/uninstall.php new file mode 100644 index 0000000..ebba9d4 --- /dev/null +++ b/uninstall.php @@ -0,0 +1,31 @@ + - - - -
This can be a common issue but easy to fix. It means that the installation of the PHP programming language on your web host does not currently have support for reading and generating compressed ZIP files. This is needed for the plugin to be able to generate a .zip archive of your static website. Here's some hosting company and platform specific guides on how to fix:
- -After installing/enabling the ZIP extension for PHP, you will likely also need to restart your webserver (Apache or nginx) for it to be usable within WordPress and this plugin.
- -- - | -
- displayTextfield($this, 'baseUrl-netlify', 'http://mystaticsite.com', '', ''); ?> - - - |
-
---|---|
- - | -- displayTextfield($this, 'netlifyPersonalAccessToken', 'Netlify Personal Access Token', 'How do I get this?', 'password'); ?> - | -
- - | -- displayTextfield($this, 'netlifySiteID', 'Netlify Site ID', 'supports: mystaticsite, mystaticsite.netlify.com, mydomain.com, 3970e0fe-8564-4903-9a55-c5f8de49fb8b'); ?> - | -
- - - | -- - | -
- - - | -- - | -
- - | -- - - | -