diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml
new file mode 100644
index 0000000..79d2df1
--- /dev/null
+++ b/.github/workflows/publish-release.yml
@@ -0,0 +1,131 @@
+name: Publish Release
+run-name: Publish Release
+
+on:
+ workflow_dispatch:
+ inputs:
+ release:
+ description: 'Release version (e.g. 1.2.3)'
+ required: true
+
+permissions:
+ contents: write
+
+env:
+ TAG: ${{ github.event.inputs.release }}
+ BRANCH: temp-release-${{ github.event.inputs.release }}
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ # 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/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: ${{ env.BRANCH }}
+ tag: ${{ env.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@v1
+ with:
+ name: "Release ${{ env.TAG }}"
+ body: "${{ steps.changelog.outputs.description }}"
+ tag_name: ${{ env.TAG }}
+ draft: true
+ prerelease: false
+
+ # 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 ${{ env.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..93dacd5
--- /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-polylang-pro-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-polylang-pro-addon/issues).
+
+Thank you for helping us ensure the security of WP-Stateless - Polylang Pro Addon. Your contributions are greatly appreciated.
diff --git a/class-polylang-pro.php b/class-polylang-pro.php
index ebde4ff..4f0f299 100644
--- a/class-polylang-pro.php
+++ b/class-polylang-pro.php
@@ -1,17 +1,12 @@
get_stateless_data($attachment_id);
+
+ if ( !empty($data) ) {
+ try {
+ foreach ( [$attachment_id, $tr_id] as $id ) {
+ do_action('wp_stateless_set_file', $id, $data['file']);
+
+ $sizes = $data['sizes'] ?? [];
+
+ foreach ($sizes as $name => $size) {
+ do_action('wp_stateless_set_file_size', $id, $name, $size);
+ }
+
+ $meta = $data['meta'] ?? [];
+
+ foreach ($meta as $key => $value) {
+ do_action('wp_stateless_set_file_meta', $id, $key, $value);
+ }
+ }
+ } catch (\Throwable $e) {
+ error_log( $e->getMessage() );
+ }
+ }
+
return $metadata;
}, 10, 4);
}
diff --git a/readme.txt b/readme.txt
index 273cb34..e1a5ee1 100644
--- a/readme.txt
+++ b/readme.txt
@@ -5,7 +5,7 @@ Tags: polylang, multilingual, translate, localization, google, google cloud, goo
License: GPLv2 or later
Requires PHP: 8.0
Requires at least: 5.0
-Tested up to: 6.4.1
+Tested up to: 6.4.3
Stable tag: 0.0.1
Provides compatibility between the Polylang Pro and the WP-Stateless plugins.
diff --git a/tests/ClassPolylangProTest.php b/tests/ClassPolylangProTest.php
index fdf417d..f74d9e0 100644
--- a/tests/ClassPolylangProTest.php
+++ b/tests/ClassPolylangProTest.php
@@ -1,6 +1,6 @@
'udx/wp-stateless-polylang-pro-addon',
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '28a9c23a310fd699b1075f9a6ca396d948715e93',
+ 'reference' => '3797ee5f24f994f8c5f8703fdf3060523d703aa9',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
@@ -13,7 +13,7 @@
'udx/wp-stateless-polylang-pro-addon' => array(
'pretty_version' => 'dev-main',
'version' => 'dev-main',
- 'reference' => '28a9c23a310fd699b1075f9a6ca396d948715e93',
+ 'reference' => '3797ee5f24f994f8c5f8703fdf3060523d703aa9',
'type' => 'wordpress-plugin',
'install_path' => __DIR__ . '/../../',
'aliases' => array(),
diff --git a/wp-stateless-polylang-pro-addon.php b/wp-stateless-polylang-pro-addon.php
index c185777..4dea2aa 100644
--- a/wp-stateless-polylang-pro-addon.php
+++ b/wp-stateless-polylang-pro-addon.php
@@ -6,25 +6,25 @@
* Description: Provides compatibility between the Polylang Pro and the WP-Stateless plugins.
* Author: UDX
* Version: 0.0.1
- * Text Domain: wpsplp
+ * Text Domain: slcapolylang
* 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\PolylangPro;
+namespace SLCA\PolylangPro;
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 PolylangPro();
}
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.'));
return $plugin_meta;
}, 10, 4);
});