diff --git a/assets/css/rt-google-embed-main.scss b/assets/css/rt-google-embed-main.scss index 05d2a51..e17891e 100644 --- a/assets/css/rt-google-embed-main.scss +++ b/assets/css/rt-google-embed-main.scss @@ -1,3 +1,3 @@ @charset "UTF-8"; -@import "embeds"; +@import "./embeds"; diff --git a/includes/classes/class-rtcamp-google-embeds.php b/includes/classes/class-rtcamp-google-embeds.php index a618030..6721aee 100644 --- a/includes/classes/class-rtcamp-google-embeds.php +++ b/includes/classes/class-rtcamp-google-embeds.php @@ -43,6 +43,7 @@ public function __construct() { $this->add_plugin_constants(); add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); add_action( 'wp_enqueue_scripts', array( $this, 'rt_google_embed_enqueue_scripts' ) ); + add_action( 'admin_enqueue_scripts', array( $this, 'rt_google_embed_enqueue_scripts' ) ); add_action( 'after_setup_theme', array( $this, 'rt_google_embed_add_editor_css' ) ); add_action( 'init', array( $this, 'register_embeds' ) ); } @@ -89,7 +90,7 @@ public function register_embeds() { // Google Docs regex. $gdoc_oembed_pattern = '#https?:\\/\\/docs\\.google\\.com\\/document\\/d\\/(.*)\\/(.*)?#i'; wp_embed_register_handler( - 'google_docs', + 'rt_google_docs', $gdoc_oembed_pattern, array( $this, 'wpdocs_embed_handler_google_drive' ) ); @@ -97,7 +98,7 @@ public function register_embeds() { // Google Sheets regex. $gsheet_oembed_pattern = '#https?:\\/\\/docs\\.google\\.com\\/spreadsheets\\/d\\/(.*)\\/(.*)?#i'; wp_embed_register_handler( - 'google_sheets', + 'rt_google_sheets', $gsheet_oembed_pattern, array( $this, 'wpdocs_embed_handler_google_drive' ) ); @@ -105,16 +106,24 @@ public function register_embeds() { // Google Slides regex. $gslides_oembed_pattern = '#https?:\\/\\/docs\\.google\\.com\\/presentation\\/d\\/(.*)\\/(.*)?#i'; wp_embed_register_handler( - 'google_presentations', + 'rt_google_presentations', $gslides_oembed_pattern, array( $this, 'wpdocs_embed_handler_google_drive' ) ); // Common URL regex. - $gdoc_common_oembed_pattern = '#https?:\\/\\/drive\\.google\\.com\\/open\\?id\\=(.*)?#i'; + $gdrive_common_oembed_pattern = '#https?:\\/\\/drive\\.google\\.com\\/open\\?id\\=(.*)?#i'; wp_embed_register_handler( - 'google_doc_common', - $gdoc_common_oembed_pattern, + 'rt_google_doc_common', + $gdrive_common_oembed_pattern, + array( $this, 'wpdocs_embed_handler_google_drive' ) + ); + + // Common file URL regex. + $gdrive_common_file_oembed_pattern = '#https?:\\/\\/drive\\.google\\.com\\/file\\/d\\/(.*)\\/(.*)?#i'; + wp_embed_register_handler( + 'rt_google_file_common', + $gdrive_common_file_oembed_pattern, array( $this, 'wpdocs_embed_handler_google_drive' ) ); } @@ -137,7 +146,7 @@ public function wpdocs_embed_handler_google_drive( $matches, $attr, $url ) { array( 'drive_file_url' => $url, 'thumbnail_url' => $thumbnail_url, - ) + ) ); } diff --git a/templates/embeds/google-drive-file.php b/templates/embeds/google-drive-file.php index 2af0039..45171ff 100644 --- a/templates/embeds/google-drive-file.php +++ b/templates/embeds/google-drive-file.php @@ -12,7 +12,7 @@ ?>
- + <?php esc_attr_e( 'Shared Document Preview', 'rt-google-embeds' ); ?>