Repository navigation
Render the GoDAM player from attributes instead of a built shortcode string - #2243
Conversation
🔍 WordPress Plugin Check Report
📊 Report
|
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
mismatched_plugin_name | Plugin name "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" is different from the name declared in plugin header "GoDAM". |
0 |
trademarked_term | The plugin name includes a restricted term. Your chosen plugin name - "GoDAM - Organize WordPress Media Library & File Manager with Unlimited Folders for Images, Videos & more" - contains the restricted term "wordpress" which cannot be used at all in your plugin name. |
📁 assets/build/css/main.css (1 warning)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedStylesScope | This style is being loaded in all contexts. |
📁 assets/src/libs/analytics.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/26/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead. |
📁 assets/build/js/main.min.js (5 warnings)
| 📍 Line | 🔖 Check | 💬 Message |
|---|---|---|
0 |
EnqueuedScriptsScope | This script is being loaded in all frontend contexts. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/2026/10/26/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
0 |
NonBlockingScripts.NoStrategy | This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead. |
🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check
…string The video embed page, the video-shortcode REST route, the GoDAM Gallery Elementor widget, the preview page and the entry screens of the Fluent Forms, WPForms, Everest Forms, SureForms and Gravity Forms recorder fields now hand their values to the player as an attributes array. A new helper, rtgodam_render_shortcode_from_atts(), calls the registered shortcode callback directly, so a value is only ever an attribute value and is never parsed as shortcode syntax. - The embed page and the route reduce godam_context and block_source to slug characters with sanitize_key(); the route argument uses sanitize_key too. - Stored recording and transcoded URLs are passed through esc_url_raw(). - The route gets a rtgodam_shortcode_atts filter for the attributes array. The rtgodam_shortcode_output filter, which receives the shortcode string, is deprecated but still applied when a site uses it; every value in that string is now an ID, a slug, 'show'/'hide' or JSON. The rendered player HTML for normal values is unchanged. Adds unit tests for the helper, the embed and preview pages, the route, the Elementor gallery widget and each form plugin's entry view. The tests register a harmless shortcode and check that extra shortcode text in a value does not run it, and that a normal value still reaches the player.
b7cdaae to
c79ab5b
Compare
|
Tested together with the other five 2.5.1 PRs on a hosted test site connected to production GoDAM Central. Full table and all recordings: https://github.com/rtCamp/godam-plugin-wp/issues/68 (recordings are in the rtCamp Test media library; sign in to watch). Tested commit |
elifvish
left a comment
There was a problem hiding this comment.
No issues found. One thing worth knowing for third parties: rtgodam_render_shortcode_from_atts() calls the callback directly, so pre_do_shortcode_tag / do_shortcode_tag no longer fire on these paths. Nothing in rtCamp hooks them for godam_video.
Verification
- Head tested:
c79ab5b41c. PHPUnit on this PR's head: 665/665 OK. - All seven 2.5.1 PRs merged onto
main(no conflicts): PHPUnit 915/915, Jest 690/690,build:prodOK. - Playwright API checks against that build on a local WordPress 7.1.3 site: 4/4 for this PR.
- Not covered: Form entry views (Fluent, WPForms, Everest, SureForms, Gravity) with a real recording: no recorder submissions on test-this; covered by the PR’s unit tests; Elementor gallery widget render.
Screenshots and a recording of the local run are available on request.
Review — Approvable ✅Reviewed at high effort. This is a clean, well-scoped fix for the shortcode-string injection class. Verified:
Non-blocking notes (follow-up, not this PR):
No blocking issues. 👍 |
What changes
Several places built a
[godam_video ...]shortcode string from request or form-entry values and passed it todo_shortcode(). They now pass an attributes array to the registered[godam_video]callback through a new helper,rtgodam_render_shortcode_from_atts( $tag, $atts )ininc/helpers/custom-functions.php. A value can only ever be an attribute value, never shortcode syntax.godam_embed_page_content()godam_contextandblock_sourcego throughsanitize_key(); player rendered from an array. The preview page uses the helper toogodam/v1/video-shortcoderoutegodam_contextusessanitize_key(route arg and handler); player rendered from an array, so the__rtgob__bracket placeholders are no longer needed on the default pathesc_url_raw())[godam_video_gallery]Filters on the route:
rtgodam_shortcode_atts( $atts, $id )filters the attributes array.rtgodam_shortcode_output( $shortcode, $id )still works when a site uses it: the string is built as before and the filter runs throughapply_filters_deprecated(). Every value in that string is now an ID, a slug,show/hideor JSON.Rendered HTML for normal values is unchanged.
Testing
Throwaway WordPress (Playground, WordPress 7.1.3, PHP 8.3) with the 2.5.0 release plus these files and Fluent Forms 6.2.16. A test shortcode registered on the site records whether it runs.
godam_contextandblock_sourcedata-block-sourcekeptgodam_contextorblock_sourcevideo-shortcoderoute, normal callsuccess, player HTMLvideo-shortcoderoute with extra shortcode text ingodam_context/fluentform/v1/submissions/<id>), normal recordingphpcsclean on every changed file;bin/hook-checkbalance and coverage checks pass.Worth knowing
godam_contextandblock_sourceare reduced to slug characters (lowercase letters, digits,-and_). Every context GoDAM and GoDAM for WooCommerce send already is one.[godam_video]now renders nothing instead of the literal shortcode text.QA:
godam_context): plays as before.Issue: rtCamp/godam-plugin-wp#71