Skip to content

Commit f29261e

Browse files
KMchaudharysubodhr258CopilotOpuRockeyshivamdev-lgtm
authored
Develop to Main Sync for v1.5.0 (#1523)
* fix: Robust background scroll fix for iPhone 13 Pro and others (#1408) * fix: Robust background scroll fix for iPhone 13 Pro and others * fix: Check for dvh support before using it * Manual Transcode Option using Filter (#1391) * feat: Add filter to skip automatic transcoding on upload * feat: Update Transcoding text * fix: Sanitize array of ids Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: Merge conflict (#1425) * Fix: Empty CTA screen on incomplete details filled. #1162 (#1244) * Fix: Empty CTA screen on incomplete details filled. #1162 * Removed default image from CTA image container * Fix fatal error if CTA image is removed from media library * display upload option if physical image is removed from media library * fix: Capitalization in text (#1430) * Feat: make analytics page responsive (#1093) * feat: responsive analytics page * fix: review automated review comments --------- Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> * chore: Create issue templates (#1455) * Fixed Image CTA (Portrait) Cut Off in Safari Instead of Being Responsive (#1416) * Fixed Image CTA (Portrait) Cut Off in Safari Instead of Being Responsive * Updated text wrap property for title andd description in image cta * fix: Improve Vertical Image CTA scroll behaviour --------- Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> * Fix - Hotspot positioning and other fixes (#1449) * fix: Hotspot positions in portrait and fullscreen * fix: Backward Compatibility with legacy hotspots * fix: Clamping based on resize and drag both * fix: Hotspot apearing over the controls * fix: Apply copilot feedbacks * fix: Use consistent hotspot size for new hotspots * fix: Add new hotspot layer with initial hotspot of the correct size * Fix poll layer skip button not updating to "Continue" after submission (#1457) * Initial plan * Fix poll confirmation detection and preserve button icon Co-authored-by: subodhr258 <58080782+subodhr258@users.noreply.github.com> * Refactor arrow icon creation and optimize text node search Co-authored-by: subodhr258 <58080782+subodhr258@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: subodhr258 <58080782+subodhr258@users.noreply.github.com> * Fix godam-tab video mpd url source (#1462) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Feat/godam gallery iframe (#1429) * Implement godam-embed video page, and integrate on godam-gallery block * Implement the responsive width height for godam embed video * Implement iframe on gallery-block and remove the unwanted API calls and make code clean * Implement loading animation and improve the gallary item scroll behaviour * Fix the iframe URL issue on dynamic load * Implement iframe postMessages to trigger previous/next video load on gallery block * Conditionaly add style if godam block is rendered threw iframe * Improve the godam engagement style for iframe * Provide engagements query parameter to show engagements along with video * Add lofig to only show engagement options if engagement enabled and video is transcoded * Fix the engagment options not working issues * Add loading spinner until engagment popup is not opened * Fix the gallery block larger screen height issue * Make godam-gallery block style responsive * Introduce video close button * Fix the engagements query parameter issue for dynamically loaded gallery videos * Fix the iframe fullscreen for iOS devices * Show single CPT page on gallery-video if open_to_new_tab attributes is enabled * Resolve the copilot feedback * Hide the godam gallery modal's close button on fullscreenmode * Fix the transcoded status casing issue * Fix the godam video title issue for non-transcoded videos * Resolve PR feedback * Restirct the video scroll on forms, cta, and polls layers * Stop scrolling of video on fullscreen --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix: aspect ratio in godam/video block (#1460) * Fix godam block apsectRation reflection issue on block editor * Resolved copilot comments * Improve the code comment * Fix the godam/video height and aspect ratio related issue on block editor --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the HLS URL quality menu issue for safari and iOS devices (#1470) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix: fullscreen layer font size (#1474) * Fix the fullscreen font-size issue for all forms, CTA, and polls layers * Address copilot comment --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Feat - Add PostHog support for GoDAM (#1342) * feat: Add PostHog support in GoDAM * feat: Add PostHog settings to allow user to disable tracking * fix: Update settings help text Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: Update package.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: Update PostHog setting in Help page, Opt-in methods * feat: Add Admin Notice for usage tracking * fix: Console error on Help page * fix: Update notice message * fix: Make tracking anonymous * fix: PostHog initialization * fix: Enqueue JS for admin notice --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Fix/ios player (#1465) * Fixed Image CTA (Portrait) Cut Off in Safari Instead of Being Responsive * Updated text wrap property for title andd description in image cta * fix: Player controls for minimal skin * fix: Play button vertical alignment * fix: Skip buttons alignment in Default skin * fix: Video loading animation play button on mobile screen * fix: Share button not clickable * fix: Remove outline from video player elements * fix: Make CTA image layer (landscape) responsive * fix: No left padding in control bar for Pills skin * fix: Captions on Safari * fix: Image CTA double container in video editor * fix: Make CTA image layer responsive on inline video * fix: Remove Share button from iOS fullscreen * fix: Seeker overlapping over captions menu * fix: Default Skin play button slightly to the left * fix: CTA title should have ellipsis after exceeding 2 lines * fix: Hover effects for menu in Bubble Skin * fix: Time start and time duration in bubble skin * fix: Time flickering issue in Bubble skin * fix: Hide share button in all fullscreens * fix: Horizontally align play button in classic skin * fix: Improve Vertical Image CTA scroll behaviour * fix: CTA scroll behaviour in portrait mode * fix: Make CTA consistent in video editor and frontend * fix: Remove extra gap in container * fix: Remove unnecessary else if condition * fix: Minial skin play button for desktop * fix: Increase CTA description text size * fix: Keyboard play/pause indicator icon * fix: Undo centering of play button for minimal and pills skins * fix: Center the big play button for both mobile and desktop * fix: Keyboard vjs-play indicator --------- Co-authored-by: opurockey <opu.rockey@gmail.com> * Fix: Recorder pop up modal doesn't open for SureForms on preview page. (#1477) * Fix the overlap of godam/video block UI with engagement modal (#1473) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * fix: Make hotspot tooltip visible inside video container always (#1478) * Add hotfix to videojs config for Safari, and iOS device playback (#1479) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix - GoDAM Block in Row and Stack, Block Icon Hover issue (#1501) * fix: Add support for Row and Stack in block editor * fix: Blue hover issue on GoDAM Blocks icons * fix: Add alt text to icon images * Feat/virtual media all (#1412) * Implement virtual media support for audio, image, and PDF blocks * Fix the core/image attempt block recovery issue Create block extension script that will help us extend the core blocks editor logic * Implement image versions callback endpoint * Add subtype=pdf check for pdf attachments * Only show the oEmbed field on medias popup if its video attachment * Add transcoding URL, and virtual status for audio, pdf, and image attachments This will show the correct transcoding status for default and virtual media imported from GoDAM central * Fix the virtual file name, add extension after filename * Fix the icon preview based on file type for virtual attachments * Add support for virtual pdf media thumbnail support * Completed the image subsizes generation, and rendering on frontend for image attachments Remove debug statements * Handle image version generation if all requested versions are already available * Fix the fullsize image's srcset domain mismatch issue * Remove unwanted changes * Resolve copilot feedback * Resolve the second iteration of copilot issues * Fix video thumbnail regresion issue for virtual media * Resolve the PR feedback * Resolve breaking merge conflicts * Update the use of URL validation function --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Started storing the transcoded image url in attachment postmeta (#1505) * Started storing the transcoded image url in attachment postmeta * Resolve copilot comments --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix: GoDAM Recorder links are not working as expected for WPForms and Ninja Forms #1182 (#1502) * Fix: GoDAM Recorder links are not working as expected for WPForms and Ninja Forms #1182 * Update inc/classes/ninja-forms/class-ninja-forms-integration.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update inc/classes/ninja-forms/class-ninja-forms-integration.php Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Moved Ninja submission list script to standalone file --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Implement the loading animation on godam_video block (#1500) * Implement the loading animation on godam_video block Show loading animation for first time until videojs player is ready * Resolve copilot comments * fix the style loading issue for some sites --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Show the oEmbed URL for godam tab video items (#1513) * Show the oEmbed URL for godam tab video items * fix the audio, pdf thumbnail url if thumbnail url not recevied from godam-central --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix mobile responsiveness for Analytics and Dashboard pages (#1481) * Fix buttons overflow issue * Fix underline issue * Fix graph issue * Adress github bot comments * fix: Analytics page header and text --------- Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> * Fix - QA skins fixes (#1515) * fix: Volume slider for Bubble skin * fix: Text CTA overflow and Quill Styles * fix: Limit height of VideoJS menus * fix: Close button width on mobile fullscreen * fix: Font Weight * fix: Time Control in bubble skin for Engagements modal * fix: Add space in comment Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: Add missing semicolon Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: Add horizontal padding to Text CTA * fix: Wrong share button in Bubble Skin --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * fix: New PCP errors related to ABSPATH (#1519) * fix: Add possible check for Refresh Status error (#1517) * Fix the image transcoding retranscoding requests (#1520) * Fix the image transcoding retranscoding requests Restrict the retranscoding request for images when virtual media is created * Address typos --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the url missmatch of virtual image source set (#1522) * Fix the url missmatch of virtual image source set * Resolve copilot comments --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the Copy Block button breaking block on editor issue (#1529) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the gallery block console errors, occure due to rtmedia plugin (#1530) * Fix the gallery block console errors, occure due to rtmedia plugin * Fix github advance security issue: DOM text reinterpreted as HTML --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the email, firstname, lastname 0 value passed to transcoding request (#1538) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Fix the aspectRatio compatibility issue on godam video block (#1541) Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Release/doc v1.5.0 (#1540) * Replace the doc commetn @SInCE version string n.e.x.t with 1.5.0 * Add changelogs, update versions, and add new contributors profiles * Generate new POT file for release v1.5.0 --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> * Add new contributors (#1542) * Add new contributors * Add kishu7270 --------- Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> --------- Co-authored-by: Subodh Rajpopat <subodh.rajpopat@rtcamp.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Rockey Opu <opu.rockey@gmail.com> Co-authored-by: Shivam Jha <jhashivam2020@gmail.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: subodhr258 <58080782+subodhr258@users.noreply.github.com> Co-authored-by: KMchaudhary <kuldipkumar.chaudhary@rtcamp.com> Co-authored-by: Ahmar Zaidi <71930390+AhmarZaidi@users.noreply.github.com>
1 parent b34468d commit f29261e

112 files changed

Lines changed: 5620 additions & 2014 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.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: "Bug Report"
3+
about: "If something isn't working as expected"
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
## Bug Report
10+
11+
**Current Behavior**
12+
A clear and concise description of the buggy behavior.
13+
14+
**Expected behavior/code**
15+
A clear and concise description of what you expected to happen (or code).
16+
17+
**Steps to reproduce the bug**
18+
Steps to reproduce if any.
19+
20+
**Testing Environment (if applicable)**
21+
22+
- Browser used
23+
- OS: [e.g. OSX 10.15.x, Ubuntu 18.04]
24+
- Browser used
25+
- ...
26+
27+
**Possible Solution**
28+
<!--- Only if you have suggestions on a fix for the bug -->
29+
30+
**Additional context/Screenshots**
31+
Add any other context about the problem here. If applicable, add screenshots to help explain.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
name: "\U0001F680 Feature Request"
3+
about: "Suggest an idea for this project."
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
---
8+
9+
## Feature Request
10+
11+
**Is your feature request related to a problem? Please describe.**
12+
A clear and concise description of what the problem is. Ex. I have an issue when [...]
13+
14+
**Describe the solution you'd like**
15+
A clear and concise description of what you want to happen. Add any considered drawbacks.
16+
17+
**Describe alternatives you've considered**
18+
A clear and concise description of any alternative solutions or features you've considered.
19+
20+
**Documentation, Adoption, Migration Strategy (if applicable)**
21+
If you can, explain how users will be able to use this and possibly write out a version of the docs.
22+
Maybe a screenshot or design?

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# Changelog #
22

3+
## v1.5.0 (January 20, 2026) ##
4+
5+
- Feat: Implemented GoDAM virtual attachment support for Image, Audio, and PDF media. This allows users to import a wide range of media directly from GoDAM Central.
6+
- Feat: Added support for the video quality menu on the Desktop Safari browser.
7+
- Tweak: Made the Dashboard and Analytics pages mobile-responsive.
8+
- Tweak: Improved the video player mobile view for different player skins, including Default, Classic, Minimal, Pills, and Bubble.
9+
- Tweak: Improved layer styles for mobile device sizes.
10+
- Tweak: Improved keyboard forward and backward shortcuts for the video player.
11+
- Fix: Resolved interactive form and poll layer submission issues in the GoDAM Gallery block.
12+
- Fix: Constrained hotspot layer points within the video canvas to ensure consistency across devices.
13+
- Fix: Skipped poll label updates on poll submission to improve user experience.
14+
- Fix: Displayed media item metadata (such as transcoded and embed URLs) in the GoDAM tab.
15+
- Fix: Improved real-time aspect ratio updates for the GoDAM Block.
16+
- Fix: Resolved an issue where input was not possible when a form was used in fullscreen mode on Safari with GoDAM Video.
17+
- Fix: Made the video preview page work correctly for all layers.
18+
- Fix: Fixed overlap issues between the GoDAM Video block UI and the engagement modal on mobile screens.
19+
- Fix: Resolved GoDAM block rendering issues when used as a child block of Row, Columns, or Grid blocks.
20+
21+
322
## v1.4.9 (December 19, 2025) ##
423

524
- Feat: Added Free Plan for GoDAM

admin/class-rtgodam-retranscodemedia.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function load_rest_endpoints() {
111111
* Add the Retranscode Media meta box to the EasyDam Tools page.
112112
*/
113113
public function render_tools_page() {
114-
$this->add_easydam_meta_boxes()
114+
$this->add_easydam_meta_boxes();
115115
?>
116116
<div>
117117
<h1><?php esc_html_e( 'GoDAM Tools', 'godam' ); ?></h1>

admin/class-rtgodam-transcoder-admin.php

Lines changed: 142 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ public function __construct() {
4040
add_action( 'admin_notices', array( $this, 'dashboard_offer_banner' ) );
4141
add_action( 'admin_notices', array( $this, 'free_plan_admin_notice' ) );
4242
add_action( 'admin_notices', array( $this, 'usage_limit_notices' ) );
43+
add_action( 'admin_notices', array( $this, 'posthog_tracking_notice' ) );
44+
add_action( 'admin_init', array( $this, 'handle_posthog_tracking_action' ) );
45+
add_action( 'admin_init', array( $this, 'handle_clear_godam_cache' ) );
4346
add_action( 'wp_ajax_rtgodam_dismiss_free_plan_notice', array( $this, 'dismiss_free_plan_notice' ) );
4447
}
4548
}
@@ -388,6 +391,41 @@ public function is_dashboard_screen() {
388391
return isset( $current_screen->id ) && 'dashboard' === $current_screen->id;
389392
}
390393

394+
/**
395+
* Handle the cache clearing request for GoDAM usage data.
396+
* This runs on admin_init to ensure headers haven't been sent yet.
397+
*
398+
* @since 1.5.0
399+
*/
400+
public function handle_clear_godam_cache() {
401+
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Nonce is verified below.
402+
if ( ! isset( $_GET['clear_godam_cache'] ) ) {
403+
return;
404+
}
405+
406+
// Verify user capabilities.
407+
if ( ! current_user_can( 'manage_options' ) ) {
408+
return;
409+
}
410+
411+
// Verify nonce.
412+
if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'clear_godam_cache' ) ) {
413+
return;
414+
}
415+
416+
// Clear the cache.
417+
delete_option( 'rtgodam_user_data' );
418+
419+
// Build redirect URL safely.
420+
$current_url = remove_query_arg( array( 'clear_godam_cache', '_wpnonce' ) );
421+
422+
// Perform the redirect with error handling.
423+
if ( ! headers_sent() ) {
424+
wp_safe_redirect( $current_url );
425+
exit;
426+
}
427+
}
428+
391429
/**
392430
* Display usage limit notices when bandwidth/storage usage is high.
393431
*/
@@ -408,15 +446,6 @@ public function usage_limit_notices() {
408446
return;
409447
}
410448

411-
// Handle cache clearing request.
412-
if ( isset( $_GET['clear_godam_cache'] ) && current_user_can( 'manage_options' ) && isset( $_GET['_wpnonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ), 'clear_godam_cache' ) ) {
413-
delete_option( 'rtgodam_user_data' );
414-
// Redirect back to the same page without the query parameter.
415-
$current_url = remove_query_arg( array( 'clear_godam_cache', '_wpnonce' ) );
416-
wp_safe_redirect( $current_url );
417-
exit;
418-
}
419-
420449
// Get user data with usage information.
421450
$user_data = rtgodam_get_user_data( true );
422451

@@ -623,4 +652,108 @@ private function display_bandwidth_exceeded_notice( $bandwidth_percentage ) {
623652
</div>
624653
<?php
625654
}
655+
656+
/**
657+
* Display PostHog tracking notice.
658+
*
659+
* @since 1.5.0
660+
*/
661+
public function posthog_tracking_notice() {
662+
if ( ! current_user_can( 'manage_options' ) ) {
663+
return;
664+
}
665+
666+
$settings = get_option( 'rtgodam-settings', array() );
667+
$api_key = get_option( 'rtgodam-api-key', '' );
668+
669+
// If API key is present, we don't show the notice (it's auto-enabled or already handled).
670+
if ( ! empty( $api_key ) ) {
671+
return;
672+
}
673+
674+
// If posthog_initialized is true, it means the user has already made a choice or it was auto-enabled.
675+
if ( ! empty( $settings['general']['posthog_initialized'] ) ) {
676+
return;
677+
}
678+
679+
$optin_url = wp_nonce_url( add_query_arg( 'godam_tracker_optin', 'true' ), 'godam_tracker_action' );
680+
$optout_url = wp_nonce_url( add_query_arg( 'godam_tracker_optout', 'true' ), 'godam_tracker_action' );
681+
682+
$notice = sprintf(
683+
__( 'Want to help make <strong>GoDAM</strong> even more awesome? Allow GoDAM to collect anonymous diagnostic data and usage information.', 'godam' )
684+
);
685+
686+
$policy_url = 'https://posthog.com/privacy';
687+
688+
echo '<div class="updated"><p>';
689+
echo wp_kses_post( $notice );
690+
echo ' (<a class="godam-insights-data-we-collect" href="#">' . esc_html__( 'what we collect', 'godam' ) . '</a>)';
691+
echo '<div class="description" style="display:none; margin-top: 10px; padding: 10px; background: #f9f9f9; border: 1px solid #e5e5e5; border-radius: 4px;">';
692+
echo '<p style="margin-top: 0;"><strong>' . esc_html__( 'Data we collect:', 'godam' ) . '</strong></p>';
693+
echo '<ul style="list-style: disc; margin-left: 20px;">';
694+
echo '<li>' . esc_html__( 'Server environment details (PHP, MySQL, Server, and WordPress versions)', 'godam' ) . '</li>';
695+
echo '<li>' . esc_html__( 'Site and user count (Language and number of users)', 'godam' ) . '</li>';
696+
echo '<li>' . esc_html__( 'Plugin details (Number of active and inactive plugins)', 'godam' ) . '</li>';
697+
echo '<li>' . esc_html__( 'Usage data (Interactions, navigation, session replays, heatmaps, and errors via PostHog)', 'godam' ) . '</li>';
698+
echo '</ul>';
699+
echo '<p style="margin-bottom: 0;">';
700+
printf(
701+
wp_kses(
702+
/* translators: %s: PostHog privacy policy URL */
703+
__( 'We are using PostHog to collect anonymous data. <a href="%s" target="_blank">Learn more</a>. This can be disabled from the settings on the Help page.', 'godam' ),
704+
array(
705+
'a' => array(
706+
'href' => array(),
707+
'target' => array(),
708+
),
709+
)
710+
),
711+
esc_url( $policy_url )
712+
);
713+
echo '</p></div>';
714+
echo '</p><p class="submit">';
715+
echo '&nbsp;<a href="' . esc_url( $optin_url ) . '" class="button-primary button-large">' . esc_html__( 'Allow', 'godam' ) . '</a>';
716+
echo '&nbsp;<a href="' . esc_url( $optout_url ) . '" class="button-secondary button-large">' . esc_html__( 'No thanks', 'godam' ) . '</a>';
717+
echo '</p></div>';
718+
}
719+
720+
/**
721+
* Handle PostHog tracking action.
722+
*
723+
* @since 1.4.9
724+
*/
725+
public function handle_posthog_tracking_action() {
726+
if ( ! isset( $_GET['godam_tracker_optin'] ) && ! isset( $_GET['godam_tracker_optout'] ) ) {
727+
return;
728+
}
729+
730+
$nonce = isset( $_GET['_wpnonce'] ) ? sanitize_text_field( wp_unslash( $_GET['_wpnonce'] ) ) : '';
731+
732+
if ( ! wp_verify_nonce( $nonce, 'godam_tracker_action' ) ) {
733+
return;
734+
}
735+
736+
if ( ! current_user_can( 'manage_options' ) ) {
737+
return;
738+
}
739+
740+
$settings = get_option( 'rtgodam-settings', array() );
741+
742+
if ( ! isset( $settings['general'] ) ) {
743+
$settings['general'] = array();
744+
}
745+
746+
if ( isset( $_GET['godam_tracker_optin'] ) && 'true' === $_GET['godam_tracker_optin'] ) {
747+
$settings['general']['enable_posthog_tracking'] = true;
748+
$settings['general']['posthog_initialized'] = true;
749+
} elseif ( isset( $_GET['godam_tracker_optout'] ) && 'true' === $_GET['godam_tracker_optout'] ) {
750+
$settings['general']['enable_posthog_tracking'] = false;
751+
$settings['general']['posthog_initialized'] = true;
752+
}
753+
754+
update_option( 'rtgodam-settings', $settings );
755+
756+
wp_safe_redirect( esc_url_raw( remove_query_arg( array( 'godam_tracker_optin', 'godam_tracker_optout', '_wpnonce' ) ) ) );
757+
exit;
758+
}
626759
}

admin/class-rtgodam-transcoder-handler.php

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,34 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
202202
return;
203203
}
204204

205+
/**
206+
* Filter to allow external developers to disable automatic transcoding on upload.
207+
* This allows users to have manual control over when videos get transcoded.
208+
*
209+
* Note: This filter only applies to automatic uploads. Manual retranscoding requests
210+
* (via bulk actions, tools page, etc.) will always proceed regardless of this setting.
211+
* Form integrations will also use this filter to disable transcoding for form uploads.
212+
*
213+
* Example usage:
214+
* add_filter( 'godam_auto_transcode_on_upload', '__return_false' ); // Disable globally
215+
*
216+
* @since 1.5.0
217+
*
218+
* @param bool $auto_transcode_on_upload Whether to automatically transcode on upload. Default true.
219+
*/
220+
if ( ! $retranscode ) {
221+
$auto_transcode_on_upload = apply_filters( 'godam_auto_transcode_on_upload', true );
222+
223+
if ( ! $auto_transcode_on_upload ) {
224+
return $wp_metadata;
225+
}
226+
}
227+
228+
// Skip transcoding and re-transcoding for images.
229+
if ( preg_match( '/image/i', $wp_metadata['mime_type'], $type_array ) ) {
230+
return $wp_metadata;
231+
}
232+
205233
if ( empty( $wp_metadata['mime_type'] ) ) {
206234
return $wp_metadata;
207235
}
@@ -255,7 +283,6 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
255283
$type = strtolower( $type_arry[ count( $type_arry ) - 1 ] );
256284
$extension = pathinfo( $path, PATHINFO_EXTENSION );
257285
$not_allowed_type = array();
258-
preg_match( '/video|audio/i', $metadata['mime_type'], $type_array );
259286

260287
if ( (
261288
preg_match( '/video|audio/i', $metadata['mime_type'], $type_array ) ||
@@ -321,14 +348,16 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
321348
// Get author name with fallback to username.
322349
$author_first_name = '';
323350
$author_last_name = '';
351+
$author_email = '';
324352

325353
if ( $attachment_author ) {
326-
$author_first_name = $attachment_author->first_name;
327-
$author_last_name = $attachment_author->last_name;
354+
$author_first_name = $attachment_author->first_name ?? '';
355+
$author_last_name = $attachment_author->last_name ?? '';
356+
$author_email = $attachment_author->user_email ?? '';
328357

329358
// If first and last names are empty, use username as fallback.
330359
if ( empty( $author_first_name ) && empty( $author_last_name ) ) {
331-
$author_first_name = $attachment_author->user_login;
360+
$author_first_name = $attachment_author->user_login ?? '';
332361
}
333362
}
334363

@@ -352,7 +381,7 @@ public function wp_media_transcoding( $wp_metadata, $attachment_id, $autoformat
352381
'watermark' => boolval( $rtgodam_watermark ),
353382
'resolutions' => array( 'auto' ),
354383
'video_quality' => $rtgodam_video_compress_quality,
355-
'wp_author_email' => apply_filters( 'godam_author_email_to_send', $attachment_author ? $attachment_author->user_email : '', $attachment_id ),
384+
'wp_author_email' => apply_filters( 'godam_author_email_to_send', $author_email, $attachment_id ),
356385
'wp_site' => $site_url,
357386
'wp_author_first_name' => apply_filters( 'godam_author_first_name_to_send', $author_first_name, $attachment_id ),
358387
'wp_author_last_name' => apply_filters( 'godam_author_last_name_to_send', $author_last_name, $attachment_id ),
@@ -765,7 +794,7 @@ public function get_post_id_by_meta_key_and_value( $key, $value ) {
765794
$meta = wp_cache_get( $cache_key, 'godam' );
766795
if ( empty( $meta ) ) {
767796
$meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->postmeta} WHERE meta_key = %s AND meta_value = %s", $key, $value ) ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery
768-
wp_cache_set( $cache_key, $meta, 'godam', 3600 );
797+
wp_cache_set( $cache_key, $meta, 'godam', HOUR_IN_SECONDS );
769798
}
770799

771800
if ( is_array( $meta ) && ! empty( $meta ) && isset( $meta[0] ) ) {

admin/class-rtgodam-transcoder-rest-routes.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@ public function handle_callback( WP_REST_Request $request ) {
287287
// Setting the transcoded PDF URL.
288288
update_post_meta( $attachment_id, 'rtgodam_transcoded_url', esc_url_raw( $post_array['download_url'] ) );
289289
}
290+
291+
if ( 'image' === $job_type && isset( $post_array['download_url'] ) && ! empty( $post_array['download_url'] ) ) {
292+
// Setting the transcoded Image URL.
293+
update_post_meta( $attachment_id, 'rtgodam_transcoded_url', esc_url_raw( $post_array['download_url'] ) );
294+
}
290295
} else {
291296
$flag = __( 'Something went wrong. The required attachment id does not exists. It must have been deleted.', 'godam' );
292297
}

admin/godam-transcoder-actions.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function rtgodam_add_transcoded_url_field( $form_fields, $post ) {
3232
$is_allowed = (
3333
str_starts_with( $mime_type, 'video/' ) ||
3434
str_starts_with( $mime_type, 'audio/' ) ||
35+
str_starts_with( $mime_type, 'image/' ) ||
3536
'application/pdf' === $mime_type
3637
);
3738

@@ -44,15 +45,13 @@ function rtgodam_add_transcoded_url_field( $form_fields, $post ) {
4445

4546
$easydam_settings = get_option( 'rtgodam-settings', array() );
4647

47-
$adaptive_bitrate_enabled = ! empty( $easydam_settings['video']['adaptive_bitrate'] );
48-
4948
// Determine if the site has a valid API key (i.e., Premium user).
5049
$api_key = get_option( 'rtgodam-api-key', '' );
5150

5251
if ( ! empty( $api_key ) ) {
5352

54-
// If $job_id is present then show the oEmbed URL.
55-
if ( ! empty( $job_id ) ) {
53+
// If $job_id is present then show the oEmbed URL field for video files.
54+
if ( ! empty( $job_id ) && 0 === strpos( $mime_type, 'video/' ) ) {
5655
$oembed_url = RTGODAM_API_BASE . '/web/video/' . $job_id;
5756

5857
$form_fields['oembed_url'] = array(
@@ -70,7 +69,7 @@ function rtgodam_add_transcoded_url_field( $form_fields, $post ) {
7069
}
7170

7271
$transcoded_url_label = __( 'Transcoded CDN URL', 'godam' );
73-
if ( strpos( $mime_type, 'video/' ) === 0 ) {
72+
if ( 0 === strpos( $mime_type, 'video/' ) ) {
7473
$transcoded_url_label = __( 'Transcoded CDN URL (MPD)', 'godam' );
7574
}
7675

0 commit comments

Comments
 (0)