diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml new file mode 100644 index 0000000..9ff0505 --- /dev/null +++ b/.github/workflows/publish-release.yml @@ -0,0 +1,152 @@ +name: Publish Release +run-name: Publish Release + +on: + workflow_dispatch: + inputs: + release: + description: 'Release version (e.g. 1.2.3)' + required: true + prerelease: + description: 'Pre-release version (e.g. RC1, beta, etc...)' + required: false + +permissions: + contents: write + +env: + TAG: ${{ github.event.inputs.release }} + PRETAG: ${{ github.event.inputs.prerelease }} + BRANCH: temp-release-${{ github.event.inputs.release }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Prepare vars + id: vars + uses: actions/github-script@v7 + with: + script: | + const full_tag = [ + process.env.TAG, + process.env.PRETAG + ].filter(Boolean).join('-'); + const branch = `temp-release-${full_tag}`; + const is_prerelease = !!process.env.PRETAG; + + core.setOutput('full_tag', full_tag ); + core.setOutput('branch', branch ); + core.setOutput('is_prerelease', is_prerelease ); + + # 'ref' and 'repository' are required, otherwise repo could appear in detached head state + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + repository: ${{ github.repository }} + + - name: Parse Changelog Entries + uses: actions/github-script@v7 + id: changelog + with: + script: | + const { open } = require('fs/promises'); + + const version = process.env.TAG; + const delimiter = '#### '; + const file = await open('./changes.md'); + + let description = []; + let found = false; + + for await (let line of file.readLines()) { + line = line.trim(); + + if ( line.startsWith(`${delimiter}${version}`) ) { + found = true; + continue; + } + + if (!found) continue; + if ( line.startsWith(delimiter) ) break; + + description.push(line); + } + + if ( !description.length ) core.setFailed(`Release ${version} not found in the changelog!`); + + core.setOutput('description', description.join('\n') ); + + + # cleanup files that are not needed for the release + # but keep the .git folder, because we need it for the next step + - name: Cleanup files + run: | + rm -f composer.lock || true + rm -rf tests || true + rm -rf vendor/bin || true + rm -rf vendor/composer/installers || true + find ./ -name '.git*' -not -path './.git' -type f -delete || true + find ./ -name '.git*' -not -path './.git' -type d -exec rm -rf {} \; || true + find ./vendor -name .svn -exec rm -rf {} \; || true + + # cleanup files, specific to Google API PHP library + - name: Cleanup files for Google API library + run: | + rm -f lib/Google/phpstan.neon.dist || true + rm -f lib/Google/vendor/paragonie/random_compat/build-phar.sh || true + find ./lib/Google/ -name '.repo-metadata.json' -type f -delete || true + find ./lib/Google/vendor -name .svn -exec rm -rf '{}' \; || true + + # commit changes to temporary release branch and create a new tag + - name: Commit changes + uses: EndBug/add-and-commit@v9 + with: + message: Cleanup files for release + new_branch: ${{ steps.vars.outputs.branch }} + tag: ${{ steps.vars.outputs.full_tag }} + + # generate SBOM that will be attached to a release as an artifact + - name: Create SBOM + id: sbom + uses: anchore/sbom-action@v0 + with: + path: . + output-file: sbom.spdx.json + format: spdx-json + + # create a draft release with the version changelog as a description + - name: Create Draft Release + id: draft_release + uses: softprops/action-gh-release@v2 + with: + name: "Release ${{ steps.vars.outputs.full_tag }}" + body: "${{ steps.changelog.outputs.description }}" + tag_name: ${{ steps.vars.outputs.full_tag }} + draft: true + prerelease: ${{ steps.vars.outputs.is_prerelease }} + + # attach SBOM to release + - name: Upload SBOM to release + uses: actions/upload-release-asset@v1.0.2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.draft_release.outputs.upload_url }} + asset_path: ./sbom.spdx.json + asset_name: sbom.spdx.json + asset_content_type: application/json + + # publish release using an ID from the 'draft_release' step + - name: Publish Release + uses: eregon/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ steps.draft_release.outputs.id }} + + # delete temporary release branch + - name: Delete temporary release branch + run: | + git push origin --delete ${{ steps.vars.outputs.branch }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 076dde0..153a3ce 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,7 @@ name: Tests on: push: - branches: [main] pull_request: - branches: [main] jobs: build: diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..82c3b1a --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,23 @@ +# Security Policy Overview + +Thank you for using and contributing to our product. At [UDX](https://udx.io), we take the security of our products seriously and appreciate collaborative efforts to ensure the safety of our users and contributors. + +## Reporting a Security Vulnerability + +**Please do not report security vulnerabilities through public GitHub issues.** + +If you find a security vulnerability, please [submit a vulnerability report](https://github.com/udx/wp-stateless-gravity-forms-signature-addon/security/advisories/new). Provide detailed information about the vulnerability to help us understand and address the issue promptly. We kindly request that you avoid public disclosure until we've had the opportunity to analyze and resolve the reported issue. + +## Responsible Disclosure + +Responsible disclosure is crucial to maintaining the security of our product. We ask for your cooperation in allowing us sufficient time to investigate and address the reported vulnerability before making it public. We will keep you informed of our progress and make every effort to address the issue promptly. + +## Supported Versions + +Security updates are provided for the latest stable release. Please ensure that you are using a supported version before reporting a security vulnerability. + +## Contact Information + +For security-related matters, please contact our security team at [security@udx.io](mailto:security@udx.io). For general inquiries, feature requests, and other non-security-related discussions, please use our regular [issue tracker](https://github.com/udx/wp-stateless-gravity-forms-signature-addon/issues). + +Thank you for helping us ensure the security of WP-Stateless - Gravity Forms Signature Addon. Your contributions are greatly appreciated. diff --git a/class-gravity-forms-signature.php b/class-gravity-forms-signature.php index 0951de5..e6e3e7c 100644 --- a/class-gravity-forms-signature.php +++ b/class-gravity-forms-signature.php @@ -1,10 +1,15 @@ plugin_version = defined('GF_SIGNATURE_VERSION') ? GF_SIGNATURE_VERSION : ''; + add_filter('gform_save_field_value', array($this, 'gform_save_field_value'), 10, 5); - add_filter('site_url', array($this, 'signature_url'), 10, 4); add_filter('gform_signature_delete_file_pre_delete_entry', array($this, 'delete_signature'), 10, 4); add_filter('gform_signature_url', array($this, 'get_signature_url'), 10, 4); + + add_filter('sm:sync::syncArgs', array($this, 'sync_args'), 10, 4); + } /** @@ -35,48 +44,37 @@ public function gform_save_field_value($value, $lead, $field, $form, $input_id) if (empty($value)) return $value; $type = \GFFormsModel::get_input_type($field); + if ($type == 'signature') { - /** - * Compatibility for Signature addon. - */ + $is_stateless = ud_get_stateless_media()->get('sm.mode') === 'stateless'; + try { $folder = \GFSignature::get_signatures_folder(); $file_path = $folder . $value; - $name = apply_filters('wp_stateless_file_name', $file_path, false); - do_action('sm:sync::syncFile', $name, $file_path, true); - } catch (\Throwable $th) { - //throw $th; - } - } - return $value; - } + // For stateless mode there is no way to override signature upload path in GFSignature::get_signatures_folder() + // so we have to move the file to the proper location + if ( $is_stateless ) { + $old_path = $file_path; + $file_path = ud_get_stateless_media()->get_gs_path() . '/' . self::GF_SIGNATURE_PATH . $value; - /** - * [older version of Gravity Forms Signature] - * Currently there is no way to filter signature url. So instead we are filtering site_url function - * with help of debug backtrace. - * - * Also doing sync on the fly for previous entries. - */ - public function signature_url($url, $path, $scheme, $blog_id) { - try { - $db = debug_backtrace(false, 7); - foreach ($db as $key => $value) { - if ($value['function'] == 'get_signature_url' && rgar($value, 'class') == 'GFSignature') { - $folder = \GFSignature::get_signatures_folder(); - $name = $value['args'][0]; - $file_path = $folder . $name . '.png'; - $name = apply_filters('wp_stateless_file_name', $file_path); - do_action('sm:sync::syncFile', $name, $file_path); - $url = ud_get_stateless_media()->get_gs_host() . '/' . $name; - break; + if ( !class_exists('\WP_Filesystem_Direct') ) { + require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); + require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-direct.php'); + } + + $filesystem = new \WP_Filesystem_Direct( false ); + $res = $filesystem->move($old_path, $file_path, true); } + + $name = self::GF_SIGNATURE_PATH . $value; + $name = apply_filters('wp_stateless_file_name', $name, 0); + + do_action( 'sm:sync::syncFile', $name, $file_path, true ); + } catch (\Throwable $th) { } - } catch (\Throwable $th) { - //throw $th; } - return $url; + return $value; } /** @@ -103,7 +101,6 @@ public function get_signature_url($url, $filename, $form_id, $field_id) { $url = ud_get_stateless_media()->get_gs_host() . '/' . $name; } } catch (\Throwable $th) { - //throw $th; } return $url; @@ -115,16 +112,36 @@ public function get_signature_url($url, $filename, $form_id, $field_id) { public function delete_signature($return, $form, $lead_id, $field_id) { try { $lead = \RGFormsModel::get_lead($lead_id); - $folder = \GFSignature::get_signatures_folder(); - $name = rgar($lead, $field_id); - $file_path = $folder . $name; - $name = apply_filters('wp_stateless_file_name', $file_path); - do_action('sm:sync::deleteFile', $name); + do_action('sm:sync::deleteFile', self::GF_SIGNATURE_PATH . $name); } catch (\Throwable $th) { - //throw $th; } return $return; } + + /** + * Update args when uploading/syncing GF file to GCS. + * + * @param array $args + * @param string $name + * @param string $file + * @param bool $force + * + * @return array + */ + public function sync_args($args, $name, $file, $force) { + if ( strpos($name, self::GF_SIGNATURE_PATH) === false ) { + return $args; + } + + if ( ud_get_stateless_media()->is_mode('stateless') ) { + $args['name_with_root'] = false; + } + + $args['source'] = 'Gravity Forms Signature'; + $args['source_version'] = $this->plugin_version; + + return $args; + } } diff --git a/composer.lock b/composer.lock index ceffcc0..7937d6c 100644 --- a/composer.lock +++ b/composer.lock @@ -9,16 +9,16 @@ "packages-dev": [ { "name": "antecedent/patchwork", - "version": "2.1.26", + "version": "2.1.28", "source": { "type": "git", "url": "https://github.com/antecedent/patchwork.git", - "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55" + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/antecedent/patchwork/zipball/f2dae0851b2eae4c51969af740fdd0356d7f8f55", - "reference": "f2dae0851b2eae4c51969af740fdd0356d7f8f55", + "url": "https://api.github.com/repos/antecedent/patchwork/zipball/6b30aff81ebadf0f2feb9268d3e08385cebcc08d", + "reference": "6b30aff81ebadf0f2feb9268d3e08385cebcc08d", "shasum": "" }, "require": { @@ -39,7 +39,7 @@ } ], "description": "Method redefinition (monkey-patching) functionality for PHP.", - "homepage": "http://patchwork2.org/", + "homepage": "https://antecedent.github.io/patchwork/", "keywords": [ "aop", "aspect", @@ -51,9 +51,9 @@ ], "support": { "issues": "https://github.com/antecedent/patchwork/issues", - "source": "https://github.com/antecedent/patchwork/tree/2.1.26" + "source": "https://github.com/antecedent/patchwork/tree/2.1.28" }, - "time": "2023-09-18T08:18:37+00:00" + "time": "2024-02-06T09:26:11+00:00" }, { "name": "brain/monkey", @@ -248,16 +248,16 @@ }, { "name": "mockery/mockery", - "version": "1.6.6", + "version": "1.6.12", "source": { "type": "git", "url": "https://github.com/mockery/mockery.git", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e" + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mockery/mockery/zipball/b8e0bb7d8c604046539c1115994632c74dcb361e", - "reference": "b8e0bb7d8c604046539c1115994632c74dcb361e", + "url": "https://api.github.com/repos/mockery/mockery/zipball/1f4efdd7d3beafe9807b08156dfcb176d18f1699", + "reference": "1f4efdd7d3beafe9807b08156dfcb176d18f1699", "shasum": "" }, "require": { @@ -269,10 +269,8 @@ "phpunit/phpunit": "<8.0" }, "require-dev": { - "phpunit/phpunit": "^8.5 || ^9.6.10", - "psalm/plugin-phpunit": "^0.18.4", - "symplify/easy-coding-standard": "^11.5.0", - "vimeo/psalm": "^4.30" + "phpunit/phpunit": "^8.5 || ^9.6.17", + "symplify/easy-coding-standard": "^12.1.14" }, "type": "library", "autoload": { @@ -329,7 +327,7 @@ "security": "https://github.com/mockery/mockery/security/advisories", "source": "https://github.com/mockery/mockery" }, - "time": "2023-08-09T00:03:52+00:00" + "time": "2024-05-16T03:13:13+00:00" }, { "name": "myclabs/deep-copy", @@ -392,25 +390,27 @@ }, { "name": "nikic/php-parser", - "version": "v4.17.1", + "version": "v5.0.2", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d" + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", - "reference": "a6303e50c90c355c7eeee2c4a8b27fe8dc8fef1d", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/139676794dc1e9231bf7bcd123cfc0c99182cb13", + "reference": "139676794dc1e9231bf7bcd123cfc0c99182cb13", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^7.0 || ^8.0 || ^9.0" }, "bin": [ "bin/php-parse" @@ -418,7 +418,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.0-dev" } }, "autoload": { @@ -442,26 +442,27 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.17.1" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.0.2" }, - "time": "2023-08-13T19:53:39+00:00" + "time": "2024-03-05T20:51:40+00:00" }, { "name": "phar-io/manifest", - "version": "2.0.3", + "version": "2.0.4", "source": { "type": "git", "url": "https://github.com/phar-io/manifest.git", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53" + "reference": "54750ef60c58e43759730615a392c31c80e23176" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53", - "reference": "97803eca37d319dfa7826cc2437fc020857acb53", + "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176", + "reference": "54750ef60c58e43759730615a392c31c80e23176", "shasum": "" }, "require": { "ext-dom": "*", + "ext-libxml": "*", "ext-phar": "*", "ext-xmlwriter": "*", "phar-io/version": "^3.0.1", @@ -502,9 +503,15 @@ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)", "support": { "issues": "https://github.com/phar-io/manifest/issues", - "source": "https://github.com/phar-io/manifest/tree/2.0.3" + "source": "https://github.com/phar-io/manifest/tree/2.0.4" }, - "time": "2021-07-20T11:28:43+00:00" + "funding": [ + { + "url": "https://github.com/theseer", + "type": "github" + } + ], + "time": "2024-03-03T12:33:53+00:00" }, { "name": "phar-io/version", @@ -559,23 +566,23 @@ }, { "name": "phpunit/php-code-coverage", - "version": "9.2.29", + "version": "9.2.31", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76" + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6a3a87ac2bbe33b25042753df8195ba4aa534c76", - "reference": "6a3a87ac2bbe33b25042753df8195ba4aa534c76", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/48c34b5d8d983006bd2adc2d0de92963b9155965", + "reference": "48c34b5d8d983006bd2adc2d0de92963b9155965", "shasum": "" }, "require": { "ext-dom": "*", "ext-libxml": "*", "ext-xmlwriter": "*", - "nikic/php-parser": "^4.15", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3", "phpunit/php-file-iterator": "^3.0.3", "phpunit/php-text-template": "^2.0.2", @@ -625,7 +632,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues", "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy", - "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.29" + "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.31" }, "funding": [ { @@ -633,7 +640,7 @@ "type": "github" } ], - "time": "2023-09-19T04:57:46+00:00" + "time": "2024-03-02T06:37:42+00:00" }, { "name": "phpunit/php-file-iterator", @@ -878,16 +885,16 @@ }, { "name": "phpunit/phpunit", - "version": "9.6.13", + "version": "9.6.19", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be" + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/f3d767f7f9e191eab4189abe41ab37797e30b1be", - "reference": "f3d767f7f9e191eab4189abe41ab37797e30b1be", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/a1a54a473501ef4cdeaae4e06891674114d79db8", + "reference": "a1a54a473501ef4cdeaae4e06891674114d79db8", "shasum": "" }, "require": { @@ -961,7 +968,7 @@ "support": { "issues": "https://github.com/sebastianbergmann/phpunit/issues", "security": "https://github.com/sebastianbergmann/phpunit/security/policy", - "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.13" + "source": "https://github.com/sebastianbergmann/phpunit/tree/9.6.19" }, "funding": [ { @@ -977,20 +984,20 @@ "type": "tidelift" } ], - "time": "2023-09-19T05:39:22+00:00" + "time": "2024-04-05T04:35:58+00:00" }, { "name": "sebastian/cli-parser", - "version": "1.0.1", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/cli-parser.git", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2" + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2", - "reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2", + "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/2b56bea83a09de3ac06bb18b92f068e60cc6f50b", + "reference": "2b56bea83a09de3ac06bb18b92f068e60cc6f50b", "shasum": "" }, "require": { @@ -1025,7 +1032,7 @@ "homepage": "https://github.com/sebastianbergmann/cli-parser", "support": { "issues": "https://github.com/sebastianbergmann/cli-parser/issues", - "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1" + "source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.2" }, "funding": [ { @@ -1033,7 +1040,7 @@ "type": "github" } ], - "time": "2020-09-28T06:08:49+00:00" + "time": "2024-03-02T06:27:43+00:00" }, { "name": "sebastian/code-unit", @@ -1222,20 +1229,20 @@ }, { "name": "sebastian/complexity", - "version": "2.0.2", + "version": "2.0.3", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/complexity.git", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88" + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88", - "reference": "739b35e53379900cc9ac327b2147867b8b6efd88", + "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/25f207c40d62b8b7aa32f5ab026c53561964053a", + "reference": "25f207c40d62b8b7aa32f5ab026c53561964053a", "shasum": "" }, "require": { - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -1267,7 +1274,7 @@ "homepage": "https://github.com/sebastianbergmann/complexity", "support": { "issues": "https://github.com/sebastianbergmann/complexity/issues", - "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2" + "source": "https://github.com/sebastianbergmann/complexity/tree/2.0.3" }, "funding": [ { @@ -1275,20 +1282,20 @@ "type": "github" } ], - "time": "2020-10-26T15:52:27+00:00" + "time": "2023-12-22T06:19:30+00:00" }, { "name": "sebastian/diff", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131" + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/74be17022044ebaaecfdf0c5cd504fc9cd5a7131", - "reference": "74be17022044ebaaecfdf0c5cd504fc9cd5a7131", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/ba01945089c3a293b01ba9badc29ad55b106b0bc", + "reference": "ba01945089c3a293b01ba9badc29ad55b106b0bc", "shasum": "" }, "require": { @@ -1333,7 +1340,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/diff/tree/4.0.6" }, "funding": [ { @@ -1341,7 +1348,7 @@ "type": "github" } ], - "time": "2023-05-07T05:35:17+00:00" + "time": "2024-03-02T06:30:58+00:00" }, { "name": "sebastian/environment", @@ -1408,16 +1415,16 @@ }, { "name": "sebastian/exporter", - "version": "4.0.5", + "version": "4.0.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d" + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", - "reference": "ac230ed27f0f98f597c8a2b6eb7ac563af5e5b9d", + "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/78c00df8f170e02473b682df15bfcdacc3d32d72", + "reference": "78c00df8f170e02473b682df15bfcdacc3d32d72", "shasum": "" }, "require": { @@ -1473,7 +1480,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/exporter/issues", - "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.5" + "source": "https://github.com/sebastianbergmann/exporter/tree/4.0.6" }, "funding": [ { @@ -1481,20 +1488,20 @@ "type": "github" } ], - "time": "2022-09-14T06:03:37+00:00" + "time": "2024-03-02T06:33:00+00:00" }, { "name": "sebastian/global-state", - "version": "5.0.6", + "version": "5.0.7", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/global-state.git", - "reference": "bde739e7565280bda77be70044ac1047bc007e34" + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bde739e7565280bda77be70044ac1047bc007e34", - "reference": "bde739e7565280bda77be70044ac1047bc007e34", + "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", + "reference": "bca7df1f32ee6fe93b4d4a9abbf69e13a4ada2c9", "shasum": "" }, "require": { @@ -1537,7 +1544,7 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/global-state/issues", - "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.6" + "source": "https://github.com/sebastianbergmann/global-state/tree/5.0.7" }, "funding": [ { @@ -1545,24 +1552,24 @@ "type": "github" } ], - "time": "2023-08-02T09:26:13+00:00" + "time": "2024-03-02T06:35:11+00:00" }, { "name": "sebastian/lines-of-code", - "version": "1.0.3", + "version": "1.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/lines-of-code.git", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc" + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc", - "reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc", + "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/e1e4a170560925c26d424b6a03aed157e7dcc5c5", + "reference": "e1e4a170560925c26d424b6a03aed157e7dcc5c5", "shasum": "" }, "require": { - "nikic/php-parser": "^4.6", + "nikic/php-parser": "^4.18 || ^5.0", "php": ">=7.3" }, "require-dev": { @@ -1594,7 +1601,7 @@ "homepage": "https://github.com/sebastianbergmann/lines-of-code", "support": { "issues": "https://github.com/sebastianbergmann/lines-of-code/issues", - "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3" + "source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.4" }, "funding": [ { @@ -1602,7 +1609,7 @@ "type": "github" } ], - "time": "2020-11-28T06:42:11+00:00" + "time": "2023-12-22T06:20:34+00:00" }, { "name": "sebastian/object-enumerator", @@ -1781,16 +1788,16 @@ }, { "name": "sebastian/resource-operations", - "version": "3.0.3", + "version": "3.0.4", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8" + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", - "reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8", + "url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/05d5692a7993ecccd56a03e40cd7e5b09b1d404e", + "reference": "05d5692a7993ecccd56a03e40cd7e5b09b1d404e", "shasum": "" }, "require": { @@ -1802,7 +1809,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.0-dev" + "dev-main": "3.0-dev" } }, "autoload": { @@ -1823,8 +1830,7 @@ "description": "Provides a list of PHP built-in functions that operate on resources", "homepage": "https://www.github.com/sebastianbergmann/resource-operations", "support": { - "issues": "https://github.com/sebastianbergmann/resource-operations/issues", - "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3" + "source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.4" }, "funding": [ { @@ -1832,7 +1838,7 @@ "type": "github" } ], - "time": "2020-09-28T06:45:17+00:00" + "time": "2024-03-14T16:00:52+00:00" }, { "name": "sebastian/type", @@ -1945,16 +1951,16 @@ }, { "name": "theseer/tokenizer", - "version": "1.2.2", + "version": "1.2.3", "source": { "type": "git", "url": "https://github.com/theseer/tokenizer.git", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96" + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b2ad5003ca10d4ee50a12da31de12a5774ba6b96", - "reference": "b2ad5003ca10d4ee50a12da31de12a5774ba6b96", + "url": "https://api.github.com/repos/theseer/tokenizer/zipball/737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", + "reference": "737eda637ed5e28c3413cb1ebe8bb52cbf1ca7a2", "shasum": "" }, "require": { @@ -1983,7 +1989,7 @@ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats", "support": { "issues": "https://github.com/theseer/tokenizer/issues", - "source": "https://github.com/theseer/tokenizer/tree/1.2.2" + "source": "https://github.com/theseer/tokenizer/tree/1.2.3" }, "funding": [ { @@ -1991,7 +1997,7 @@ "type": "github" } ], - "time": "2023-11-20T00:12:19+00:00" + "time": "2024-03-03T12:36:25+00:00" } ], "aliases": [], @@ -2001,5 +2007,5 @@ "prefer-lowest": false, "platform": [], "platform-dev": [], - "plugin-api-version": "2.3.0" + "plugin-api-version": "2.6.0" } diff --git a/readme.txt b/readme.txt index 328792f..5b91523 100644 --- a/readme.txt +++ b/readme.txt @@ -1,11 +1,11 @@ === WP-Stateless - Gravity Forms Signature Addon === Contributors: usability_dynamics, andypotanin, ideric, maxim.peshkov, planvova, obolgun Donate link: https://udx.io -Tags: gravity forms. gravity forms signature, signature, google, google cloud, google cloud storage, cdn, uploads, media, stateless, backup +Tags: gravity forms signature, gravity forms signature addon extension, google cloud storage, stateless, wp-stateless License: GPLv2 or later Requires PHP: 8.0 Requires at least: 5.0 -Tested up to: 6.4.1 +Tested up to: 6.5.3 Stable tag: 0.0.1 Provides compatibility between the Gravity Forms Signature and the WP-Stateless plugins. diff --git a/tests/ClassGravityFormsSignatureTest.php b/tests/ClassGravityFormsSignatureTest.php index db63267..6ba92d5 100644 --- a/tests/ClassGravityFormsSignatureTest.php +++ b/tests/ClassGravityFormsSignatureTest.php @@ -1,6 +1,6 @@ module_init([]); self::assertNotFalse( has_filter('gform_save_field_value', [ $gravityFormSignature, 'gform_save_field_value' ]) ); - self::assertNotFalse( has_filter('site_url', [ $gravityFormSignature, 'signature_url' ]) ); self::assertNotFalse( has_filter('gform_signature_delete_file_pre_delete_entry', [ $gravityFormSignature, 'delete_signature' ]) ); + self::assertNotFalse( has_filter('gform_signature_url', [ $gravityFormSignature, 'get_signature_url' ]) ); + self::assertNotFalse( has_filter('sm:sync::syncArgs', [ $gravityFormSignature, 'sync_args' ]) ); } public function testShouldSaveFieldValue() { @@ -72,27 +73,13 @@ public function testShouldSaveFieldValue() { $this->assertTrue(true); } - public function testShouldProcessSignatureUrl() { - $gravityFormSignature = new GravityFormSignature(); - - Functions\when('rgar')->justReturn( 'GFSignature' ); - - Actions\expectDone('sm:sync::syncFile')->once(); - - $this->assertEquals( - self::DST_URL, - $gravityFormSignature->signature_url(self::SRC_URL, null, null, null) - ); - } - public function testShouldRemoveSignatureFile() { $gravityFormSignature = new GravityFormSignature(); Functions\when('rgar')->justReturn( null ); Actions\expectDone('sm:sync::deleteFile') - ->once() - ->with(self::TEST_FILE); + ->once(); $gravityFormSignature->delete_signature(self::TEST_FILE, null, 15, null); diff --git a/vendor/bin/.phpunit.result.cache b/vendor/bin/.phpunit.result.cache index 4067a68..0e491b7 100644 --- a/vendor/bin/.phpunit.result.cache +++ b/vendor/bin/.phpunit.result.cache @@ -1 +1 @@ -{"version":1,"defects":{"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValueFileUpload":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValuePostImage":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldModifyDb":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveMedia":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSkipCacheBusting":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":4,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisables":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":4,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":3},"times":{"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldInitHooks":0.105,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValueFileUpload":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValuePostImage":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldModifyDb":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveMedia":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSkipCacheBusting":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":0.002,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":0.002,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveSignatureFile":0.001,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrl":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisables":0.009,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":0}} \ No newline at end of file +{"version":1,"defects":{"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValueFileUpload":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValuePostImage":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldModifyDb":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveMedia":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSkipCacheBusting":5,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":4,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisables":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":4,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":3,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":3,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldInitHooks":3,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":4,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":4,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveSignatureFile":4,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":4,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":4,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":4},"times":{"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldInitHooks":0.105,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValueFileUpload":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValuePostImage":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldModifyDb":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveMedia":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSkipCacheBusting":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":0.002,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":0.002,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveSignatureFile":0.001,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrl":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisables":0.009,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":0,"WPSL\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":0,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldInitHooks":0.124,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldSaveFieldValue":0.003,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldProcessSignatureUrl":0.005,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldRemoveSignatureFile":0.001,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlDisabled":0.002,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlBackup":0,"SLCA\\GravityFormSignature\\ClassGravityFormsSignatureTest::testShouldGetSignatureUrlCdn":0}} \ No newline at end of file diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index bbf3bd9..13f5cf1 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => 'udx/wp-stateless-gravity-forms-signature-addon', 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '5dccb0ced874c2706eae37d679f85443d74e1e1a', + 'reference' => '82d6300f5fba34b1301319034340c7b0a18e1044', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,7 +13,7 @@ 'udx/wp-stateless-gravity-forms-signature-addon' => array( 'pretty_version' => 'dev-main', 'version' => 'dev-main', - 'reference' => '5dccb0ced874c2706eae37d679f85443d74e1e1a', + 'reference' => '82d6300f5fba34b1301319034340c7b0a18e1044', 'type' => 'wordpress-plugin', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), diff --git a/wp-stateless-gravity-forms-signature-addon.php b/wp-stateless-gravity-forms-signature-addon.php index db9383a..36d7b5e 100644 --- a/wp-stateless-gravity-forms-signature-addon.php +++ b/wp-stateless-gravity-forms-signature-addon.php @@ -6,25 +6,25 @@ * Description: Provides compatibility between the Gravity Forms Signature and the WP-Stateless plugins. * Author: UDX * Version: 0.0.1 - * Text Domain: wpsgfs + * Text Domain: slcagfs * Author URI: https://udx.io - * License: MIT + * License: GPLv2 or later * - * Copyright 2023 UDX (email: info@udx.io) + * Copyright 2024 UDX (email: info@udx.io) */ -namespace WPSL\GravityFormSignature; +namespace SLCA\GravityFormSignature; add_action('plugins_loaded', function () { if (class_exists('wpCloud\StatelessMedia\Compatibility')) { - require_once 'vendor/autoload.php'; + require_once ( dirname( __FILE__ ) . '/vendor/autoload.php' ); // Load return new GravityFormSignature(); } add_filter('plugin_row_meta', function ($plugin_meta, $plugin_file, $_, $__) { if ($plugin_file !== join(DIRECTORY_SEPARATOR, [basename(__DIR__), basename(__FILE__)])) return $plugin_meta; - $plugin_meta[] = sprintf('%s', __('This plugin requires WP-Stateless plugin version 4.0.0 or greater to be installed and active.')); + $plugin_meta[] = sprintf('%s', __('This plugin requires WP-Stateless plugin version 3.4.0 or greater to be installed and active.', 'slcagfs')); return $plugin_meta; }, 10, 4); });