Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Private files preview and google drawings support #8

Open
wants to merge 2 commits into
base: custom-oembed-provider
Choose a base branch
from

Conversation

abhishekfdd
Copy link

  • Fixes Preview for private files
  • Adds google drawings embed support

@juhi123 juhi123 requested a review from SID177 November 4, 2020 06:11
$basedir = '';
$baseurl = '';

$file_id = $this->get_file_id_from_url( $url );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation. = should align with = below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check this at all instances

$baseurl = '';

$file_id = $this->get_file_id_from_url( $url );
$cached_data = $this->get_cached_data_from_file_id( $file_id );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're already getting cached file URL in get_thumbnail_url function, then why do we need this code again? $thumbnail_url itself is a cached URL here if the file is cached.

</a>
<img src="<?php echo esc_url( $thumbnail_url ); ?>" alt="<?php esc_attr_e( 'Shared Document Preview', 'rt-google-embeds' ); ?>" style="border: 1px solid #eee; margin: 15px auto; display: block;" />
</div>
if ( file_exists( $cached_file ) ) : ?>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not supposed to be done here. Do this before calling render_embed function and pass only 1 URL here. That URL will be used here directly.

@SID177
Copy link
Contributor

SID177 commented Nov 4, 2020

@abhishekfdd We will only pass drive_file_url and thumbnail_url in render_embed args. The thumbnail_url will be cached URL if the file exists else it'll be external URL.
We don't need to send cached_file and cached_url.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants