Skip to content

Commit

Permalink
Merge pull request #17 from awsmin/dev-branch
Browse files Browse the repository at this point in the history
Dev branch
  • Loading branch information
sruthihari authored Dec 13, 2021
2 parents ebb0457 + fca576a commit ce7844a
Show file tree
Hide file tree
Showing 20 changed files with 213 additions and 106 deletions.
10 changes: 6 additions & 4 deletions awsm-embed.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: Embed Any Document
* Plugin URI: http://awsm.in/embed-any-documents
* Description: Embed Any Document WordPress plugin lets you upload and embed your documents easily in your WordPress website without any additional browser plugins like Flash or Acrobat reader. The plugin lets you choose between Google Docs Viewer and Microsoft Office Online to display your documents.
* Version: 2.7.0
* Version: 2.7.1
* Author: Awsm Innovations
* Author URI: https://awsm.in
* License: GPL V3
Expand All @@ -19,7 +19,7 @@
}

if ( ! defined( 'AWSM_EMBED_VERSION' ) ) {
define( 'AWSM_EMBED_VERSION', '2.7.0' );
define( 'AWSM_EMBED_VERSION', '2.7.1' );
}

/**
Expand Down Expand Up @@ -174,12 +174,14 @@ public function embedpopup() {
*/
public function embed_helper() {
$script_deps = array( 'jquery' );

if ( function_exists( 'get_current_screen' ) ) {
$screen = get_current_screen();
if ( method_exists( $screen, 'is_block_editor' ) && $screen->is_block_editor() ) {
if ( ! empty( $screen ) && method_exists( $screen, 'is_block_editor' ) && $screen->is_block_editor() ) {
$script_deps[] = 'wp-blocks';
}
}

wp_enqueue_script( 'ead_media_button', plugins_url( 'js/embed.min.js', $this->plugin_file ), $script_deps, $this->plugin_version, true );
wp_enqueue_style( 'ead_media_button', plugins_url( 'css/embed.min.css', $this->plugin_file ), false, $this->plugin_version, 'all' );
wp_localize_script(
Expand Down Expand Up @@ -625,7 +627,7 @@ public function providerlink( $provider ) {
$configure = '<span class="overlay"><strong>' . esc_html__( 'Buy Pro Version', 'embed-any-document' ) . '</strong><i></i></span>';
$target = 'target="_blank"';
/* translators: %1$s: Service provider */
echo '<a href="' . esc_url( $link ) . '" id="' . esc_attr( $id ) . '" ' . $target . '><span><img src="' . esc_url( $this->plugin_url ) . 'images/icon-' . esc_attr( strtolower( $provider ) ) . '.png" alt="' . esc_attr( sprintf( __( 'Add From %1$s', 'embed-any-document' ), $provider ) ) . '" />' . esc_html( sprintf( __( 'Add From %1$s', 'embed-any-document' ), $provider ) ) . $configure . '</span></a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo '<a href="' . esc_url( $link ) . '" id="' . esc_attr( $id ) . '" ' . $target . '><span><img src="' . esc_url( $this->plugin_url ) . 'images/icon-' . esc_attr( strtolower( $provider ) ) . '.svg" alt="' . esc_attr( sprintf( __( 'Add From %1$s', 'embed-any-document' ), $provider ) ) . '" />' . esc_html( sprintf( __( 'Add From %1$s', 'embed-any-document' ), $provider ) ) . $configure . '</span></a>'; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}

/**
Expand Down
2 changes: 1 addition & 1 deletion blocks/document/document-block.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion blocks/document/document-block.js.map

Large diffs are not rendered by default.

16 changes: 11 additions & 5 deletions blocks/document/editor.css
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,43 @@ div[data-type="embed-any-document/document"] .components-placeholder__fieldset .
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-dropbox::before {
background-image: url("../../images/dropbox_logo.svg");
background-image: url("../../images/icon-dropbox.svg");
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-dropbox::after {
content: "Dropbox";
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-drive::before {
background-image: url("../../images/google_drive_logo.svg");
background-image: url("../../images/icon-drive.svg");
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-drive::after {
content: "Google Drive";
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-box::before {
background-image: url("../../images/box_inc_logo.svg");
background-size: 50px;
background-image: url("../../images/icon-box.svg");
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-box::after {
content: "Box.com";
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-onedrive::before {
background-image: url("../../images/icon-onedrive.svg");
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-button.ead-button-onedrive::after {
content: "OneDrive";
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-form-file-upload .components-button {
margin: 0 !important;
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-form-file-upload .components-button::before {
background-image: url("../../images/iconmonstr-upload-17.svg");
background-size: 35px;
}

div[data-type="embed-any-document/document"] .components-placeholder__fieldset .components-form-file-upload .components-button::after {
Expand Down
8 changes: 8 additions & 0 deletions blocks/document/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import icon from './modules/icon';
const { __ } = wp.i18n; // Import __() from wp.i18n
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
const { Button } = wp.components;
const { Fragment } = wp.element;
const { MediaPlaceholder } = wp.blockEditor || wp.editor;
const { isURL } = wp.url;

Expand Down Expand Up @@ -141,6 +142,7 @@ registerBlockType( 'embed-any-document/document', {
} else {
return (
<MediaPlaceholder className="ead-media-placeholder" onSelect={ onSelectDocument } onSelectURL={ onSelectURL } labels = { { title: __( 'Embed Any Document', 'embed-any-document' ), 'instructions':__( 'Upload a document, pick from your media library, or add from an external URL.', 'embed-any-document' ) } } icon={icon.block} accept={validExtension.join(', ')} allowedTypes={ validTypes } OnError={ onUploadError }>
<Fragment>
<Button className="ead-button-dropbox disabled" onClick={ providerLink } value="click">{ __( 'Add from dropbox', 'embed-any-document' ) }
<span className="overlay">
<span>{ __( 'Pro Feature', 'embed-any-document' ) }</span>
Expand All @@ -156,6 +158,12 @@ registerBlockType( 'embed-any-document/document', {
<span>{ __( 'Pro Feature', 'embed-any-document' ) }</span>
</span>
</Button>
<Button className="ead-button-onedrive disabled" onClick={ providerLink } value="click">{ __( 'Add from OneDrive', 'embed-any-document' ) }
<span className="overlay">
<span>{ __( 'Pro Feature', 'embed-any-document' ) }</span>
</span>
</Button>
</Fragment>
</MediaPlaceholder>
);
}
Expand Down
1 change: 0 additions & 1 deletion images/box_inc_logo.svg

This file was deleted.

1 change: 0 additions & 1 deletion images/dropbox_logo.svg

This file was deleted.

1 change: 0 additions & 1 deletion images/google_drive_logo.svg

This file was deleted.

Empty file modified images/icon-box.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions images/icon-box.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/icon-drive.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions images/icon-drive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file modified images/icon-dropbox.png
100755 → 100644
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions images/icon-dropbox.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/icon-onedrive.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions images/icon-onedrive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions inc/popup.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<li><?php $this->providerlink( 'Drive' ); ?></li>
<li><?php $this->providerlink( 'Dropbox' ); ?></li>
<li><?php $this->providerlink( 'Box' ); ?></li>
<li><?php $this->providerlink( 'OneDrive' ); ?></li>
</ul>
<div class="ead-url-box addurl-box">
<label for="awsm-url"><?php esc_html_e( 'Enter document URL', 'embed-any-document' ); ?></label>
Expand Down
Loading

0 comments on commit ce7844a

Please sign in to comment.