Skip to content

Commit da61523

Browse files
authored
Merge pull request #1236 from cloudinary/develop
3.3.6 (develop to UAT)
2 parents 111318f + ec0934f commit da61523

139 files changed

Lines changed: 20129 additions & 20628 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 30 deletions
This file was deleted.

.github/dependabot.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
target-branch: develop
8+
- package-ecosystem: npm
9+
directory: /
10+
schedule:
11+
interval: weekly
12+
target-branch: develop
13+
groups:
14+
wordpress:
15+
patterns:
16+
- "@wordpress/*"

.github/workflows/build-docs.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build Docs
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types: [published]
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
hookdocs:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '22'
25+
cache: 'npm'
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build docs
31+
run: npm run build:docs
32+
33+
- name: Deploy to GitHub Pages
34+
uses: peaceiris/actions-gh-pages@v4
35+
with:
36+
github_token: ${{ secrets.GITHUB_TOKEN }}
37+
publish_dir: ./docs

.github/workflows/deploy-to-wp-org.yml

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,21 @@ jobs:
7878
- name: Prepare build directory
7979
run: npx grunt prepare
8080

81+
# Read once so both the tag check and the deploy step use the exact same value, rather
82+
# than letting the deploy action derive its own version from GITHUB_REF - that only works
83+
# when triggered from a tag push, and yields a bogus value like "refs/heads/master" (which
84+
# SVN then can't use as a tag path) on a workflow_dispatch run against a branch.
85+
- name: Read plugin version
86+
run: echo "PLUGIN_VERSION=$(cat .version | tr -d '[:space:]')" >> "$GITHUB_ENV"
87+
8188
# Ensure the version in the .version file matches the tag of the release.
8289
# Skipped for manual runs, which may not be run against a release tag.
8390
- name: Verify version matches tag
8491
if: github.event_name == 'release'
8592
run: |
8693
TAG="${GITHUB_REF_NAME#v}"
87-
FILE_VERSION=$(cat .version | tr -d '[:space:]')
88-
if [ "$TAG" != "$FILE_VERSION" ]; then
89-
echo "::error::Tag $TAG does not match .version $FILE_VERSION"
94+
if [ "$TAG" != "$PLUGIN_VERSION" ]; then
95+
echo "::error::Tag $TAG does not match .version $PLUGIN_VERSION"
9096
exit 1
9197
fi
9298
@@ -102,10 +108,20 @@ jobs:
102108
env:
103109
BUILD_DIR: 'build'
104110
SLUG: 'cloudinary-image-management-and-manipulation-in-the-cloud-cdn'
111+
VERSION: ${{ env.PLUGIN_VERSION }}
105112
# Use secrets to authenticate with WP.org.
106113
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
107114
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
108115

116+
# Makes the zip downloadable from the run's Artifacts panel regardless of trigger, so
117+
# manual/dry-run dispatches can be inspected without publishing a release.
118+
- name: Upload build artifact
119+
uses: actions/upload-artifact@v4
120+
with:
121+
name: ${{ env.PLUGIN_VERSION }}.zip
122+
path: ${{ steps.deploy.outputs.zip-path }}
123+
retention-days: 7
124+
109125
- name: Upload release asset
110126
if: github.event_name == 'release'
111127
uses: softprops/action-gh-release@v2

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,6 @@ package/dist
6161

6262
# PHPStan result cache
6363
/.phpstan-cache/
64+
65+
# Generated docs (published to gh-pages by workflow)
66+
/docs/

.hookdoc/layout.tmpl

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<title><?js= title ?> - Cloudinary Docs</title>
6+
7+
<script src="scripts/prettify/prettify.js"></script>
8+
<script src="scripts/prettify/lang-css.js"></script>
9+
<!--[if lt IE 9]>
10+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
11+
<![endif]-->
12+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
13+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
14+
15+
<link
16+
href="https://fonts.googleapis.com/css?family=IBM+Plex+Mono|IBM+Plex+Sans:300,400|Playfair+Display:900&display=swap"
17+
rel="stylesheet">
18+
</head>
19+
20+
<body>
21+
22+
<div id="main">
23+
24+
<?js if (title !== 'Home') { ?>
25+
<h1 class="page-title"><?js= title ?></h1>
26+
<?js } ?>
27+
28+
<?js= content ?>
29+
</div>
30+
31+
<nav>
32+
<?js= this.nav ?>
33+
</nav>
34+
35+
<br class="clear">
36+
37+
<footer>
38+
<a href="https://cloudinary.com/" target="_blank" rel="noopener noreferrer">Cloudinary</a> |
39+
<a href="https://github.com/cloudinary/cloudinary_wordpress/" target="_blank" rel="noopener noreferrer">Cloudinary
40+
on GitHub</a>
41+
</footer>
42+
43+
<script> prettyPrint(); </script>
44+
<script src="scripts/linenumber.js"></script>
45+
</body>
46+
</html>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?php
2+
/**
3+
* Analytics egress capture — local/e2e dev helper mu-plugin.
4+
*
5+
* Intercepts outgoing requests to any Cloudinary analytics-api.cloudinary.com
6+
* endpoint — the custom-events collector AND the older deactivation-reason
7+
* collector, both on the same host — and appends each payload as a JSONL
8+
* entry to a log file, so e2e tests and manual QA can assert on emitted
9+
* events. The request is fully preempted with a synthetic response: earlier
10+
* versions of this mu-plugin only logged the payload and let the request
11+
* proceed, which meant every local/CI test run was quietly leaking synthetic
12+
* events (and deactivation "feedback") into the real production collector.
13+
*
14+
* @package Cloudinary
15+
*/
16+
17+
defined( 'ABSPATH' ) || exit;
18+
19+
/**
20+
* Returns the path to the capture log file.
21+
*
22+
* @return string
23+
*/
24+
function cld_analytics_capture_log_path() {
25+
$upload = wp_upload_dir();
26+
27+
return $upload['basedir'] . '/analytics-capture.log';
28+
}
29+
30+
add_filter( 'pre_http_request', 'cld_analytics_capture_intercept', 10, 3 );
31+
32+
/**
33+
* Logs outgoing analytics/deactivation-reason requests and preempts them
34+
* with a synthetic success response, so nothing actually reaches the real
35+
* collector during local dev or CI runs.
36+
*
37+
* @param false|array|WP_Error $preempt Whether to preempt the request.
38+
* @param array $parsed_args Parsed request arguments.
39+
* @param string $url The request URL.
40+
*
41+
* @return false|array|WP_Error
42+
*/
43+
function cld_analytics_capture_intercept( $preempt, $parsed_args, $url ) {
44+
if ( false === strpos( $url, 'analytics-api.cloudinary.com' ) ) {
45+
return $preempt;
46+
}
47+
48+
$body = isset( $parsed_args['body'] ) ? $parsed_args['body'] : '';
49+
$decoded = json_decode( $body, true );
50+
51+
file_put_contents( // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
52+
cld_analytics_capture_log_path(),
53+
wp_json_encode( null !== $decoded ? $decoded : $body ) . "\n",
54+
FILE_APPEND | LOCK_EX
55+
);
56+
57+
return array(
58+
'headers' => array(),
59+
'body' => '',
60+
'response' => array(
61+
'code' => 200,
62+
'message' => 'OK',
63+
),
64+
'cookies' => array(),
65+
'filename' => null,
66+
);
67+
}
68+
69+
/**
70+
* Prints the captured analytics events, one JSON object per line.
71+
*
72+
* ## OPTIONS
73+
*
74+
* [--clear]
75+
* : Empty the log after printing it.
76+
*
77+
* @param array $args Positional arguments.
78+
* @param array $assoc_args Associative arguments.
79+
*/
80+
function cld_analytics_capture_wpcli_command( $args, $assoc_args ) {
81+
$log_file = cld_analytics_capture_log_path();
82+
83+
if ( file_exists( $log_file ) ) {
84+
WP_CLI::line( file_get_contents( $log_file ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents, WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
85+
}
86+
87+
if ( isset( $assoc_args['clear'] ) ) {
88+
file_put_contents( $log_file, '' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_file_put_contents, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
89+
}
90+
}
91+
92+
if ( defined( 'WP_CLI' ) && WP_CLI ) {
93+
WP_CLI::add_command( 'cloudinary analytics-events', 'cld_analytics_capture_wpcli_command' );
94+
}

css/cloudinary.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

css/gallery-ui.css

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)