EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor - Version 2.1.5

Version Description

Download this release

Release Info

Developer andergmartins
Plugin Icon wp plugin EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor
Version 2.1.5
Comparing to
See all releases

Code changes from version 2.1.4 to 2.1.5

EmbedPress/Core.php CHANGED
@@ -155,16 +155,18 @@ class Core
155
 
156
  $plgHandlerPublicInstance = new EndHandlerPublic($this->getPluginName(), $this->getPluginVersion());
157
 
158
- $enqueueScriptsHookName = "wp_enqueue_scripts";
159
- $this->loaderInstance->add_action($enqueueScriptsHookName, $plgHandlerPublicInstance, 'enqueueScripts');
160
- $this->loaderInstance->add_action($enqueueScriptsHookName, $plgHandlerPublicInstance, 'enqueueStyles');
161
 
162
- unset($enqueueScriptsHookName, $plgHandlerPublicInstance);
163
  }
164
 
165
  // Add support for embeds on AMP pages
166
  add_filter('pp_embed_parsed_content', array('\EmbedPress\AMP\EmbedHandler', 'processParsedContent'), 10, 3);
167
 
 
 
 
168
  $this->loaderInstance->run();
169
  }
170
 
@@ -377,7 +379,7 @@ class Core
377
  // to modify the input since it was already injected.
378
  $mceInit['paste_preprocess'] = 'function (plugin, args) {EmbedPress.onPaste(plugin, args);}';
379
  }
380
-
381
 
382
  return $mceInit;
383
  }
155
 
156
  $plgHandlerPublicInstance = new EndHandlerPublic($this->getPluginName(), $this->getPluginVersion());
157
 
158
+ $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueScripts');
159
+ $this->loaderInstance->add_action('wp_enqueue_scripts', $plgHandlerPublicInstance, 'enqueueStyles');
 
160
 
161
+ unset($plgHandlerPublicInstance);
162
  }
163
 
164
  // Add support for embeds on AMP pages
165
  add_filter('pp_embed_parsed_content', array('\EmbedPress\AMP\EmbedHandler', 'processParsedContent'), 10, 3);
166
 
167
+ // Add support for our embeds on Beaver Builder. Without this it only run the native embeds.
168
+ add_filter('fl_builder_before_render_shortcodes', array('\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes'));
169
+
170
  $this->loaderInstance->run();
171
  }
172
 
379
  // to modify the input since it was already injected.
380
  $mceInit['paste_preprocess'] = 'function (plugin, args) {EmbedPress.onPaste(plugin, args);}';
381
  }
382
+
383
 
384
  return $mceInit;
385
  }
EmbedPress/Ends/Front/Handler.php CHANGED
@@ -49,6 +49,7 @@ class Handler extends EndHandlerAbstract
49
  // Replace line breaks from all HTML elements with placeholders.
50
  $content = wp_replace_in_html_tags($content, array("\n" => '<!-- embedpress-line-break -->'));
51
 
 
52
  if (preg_match('#(^|\s|>)https?://#i', $content)) {
53
  $callbackFingerprint = array('\EmbedPress\Ends\Front\Handler', 'autoEmbedUrlsCallback');
54
 
49
  // Replace line breaks from all HTML elements with placeholders.
50
  $content = wp_replace_in_html_tags($content, array("\n" => '<!-- embedpress-line-break -->'));
51
 
52
+ // Look for links in the content (not wrapped by shortcode)
53
  if (preg_match('#(^|\s|>)https?://#i', $content)) {
54
  $callbackFingerprint = array('\EmbedPress\Ends\Front\Handler', 'autoEmbedUrlsCallback');
55
 
EmbedPress/Shortcode.php CHANGED
@@ -40,7 +40,7 @@ class Shortcode
40
  public static function register()
41
  {
42
  // Register the new shortcode for embeds.
43
- add_shortcode(EMBEDPRESS_SHORTCODE, array('\\EmbedPress\\Shortcode', 'do_shortcode'), 1);
44
  }
45
 
46
  /**
40
  public static function register()
41
  {
42
  // Register the new shortcode for embeds.
43
+ add_shortcode(EMBEDPRESS_SHORTCODE, array('\\EmbedPress\\Shortcode', 'do_shortcode'));
44
  }
45
 
46
  /**
EmbedPress/ThirdParty/BeaverBuilder.php ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace EmbedPress\ThirdParty;
3
+
4
+ (defined('ABSPATH') && defined('EMBEDPRESS_IS_LOADED')) or die("No direct script access allowed.");
5
+
6
+ /**
7
+ * Entity responsible for adding support for the Beaver Builder.
8
+ *
9
+ * @package EmbedPress
10
+ * @author EmbedPress <help@embedpress.com>
11
+ * @copyright Copyright (C) 2018 EmbedPress. All rights reserved.
12
+ * @license GPLv2 or later
13
+ * @since 1.0.0
14
+ */
15
+ class BeaverBuilder
16
+ {
17
+ /**
18
+ * Method that replaces the embed shortcodes, before Beaver calls WP's native embed shortcode.
19
+ * It forces that when it runs $wp_embed->run_shortcode.
20
+ *
21
+ * @param string $content
22
+ *
23
+ * @return string
24
+ */
25
+ public static function before_render_shortcodes($content)
26
+ {
27
+ global $shortcode_tags;
28
+
29
+ // Back up current registered shortcodes and clear them all out
30
+ $orig_shortcode_tags = $shortcode_tags;
31
+ remove_all_shortcodes();
32
+
33
+ add_shortcode( EMBEDPRESS_SHORTCODE, array('\\EmbedPress\\Shortcode', 'do_shortcode') );
34
+
35
+ // Do the shortcode (only the [embed] one is registered)
36
+ $content = do_shortcode( $content, true );
37
+
38
+ // Put the original shortcodes back
39
+ $shortcode_tags = $orig_shortcode_tags;
40
+
41
+ return $content;
42
+ }
43
+ }
assets/css/preview.css CHANGED
@@ -147,7 +147,7 @@ span.hidden {
147
  }
148
 
149
  .bootbox.modal {
150
- z-index: 100002;
151
  }
152
 
153
  .modal-dialog .row {
147
  }
148
 
149
  .bootbox.modal {
150
+ z-index: 100012;
151
  }
152
 
153
  .modal-dialog .row {
assets/js/preview.js CHANGED
@@ -262,7 +262,7 @@
262
  * @return void
263
  */
264
  self.onReady = function() {
265
- if (self.tinymceIsAvailable()) {
266
  // Wait until the editor is available
267
  var interval = window.setInterval(
268
  function() {
@@ -281,6 +281,27 @@
281
  },
282
  250
283
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
284
  }
285
  };
286
 
@@ -836,6 +857,11 @@
836
  // Add the node filter that will convert the url into the preview box for the embed code
837
  editorInstance.parser.addNodeFilter('#text', function addNodeFilterIntoParser(nodes, arg) {
838
  self.each(nodes, function eachNodeInParser(node) {
 
 
 
 
 
839
  var subject = node.value.trim();
840
 
841
 
@@ -875,6 +901,10 @@
875
  setTimeout(function() {
876
  var doc = editorInstance.getDoc();
877
 
 
 
 
 
878
  var previewWrapper = $(doc.querySelector('#'+ wrapper.attributes.map['id']));
879
  var previewWrapperParent = $(previewWrapper.parent());
880
 
@@ -922,6 +952,11 @@
922
  // Add the filter that will convert the preview box/embed code back to the raw url
923
  editorInstance.serializer.addNodeFilter('div', function addNodeFilterIntoSerializer(nodes, arg) {
924
  self.each(nodes, function eachNodeInSerializer(node) {
 
 
 
 
 
925
  var nodeClasses = (node.attributes.map.class || "").split(' ');
926
  var wrapperFactoryClasses = ["embedpress_wrapper", "embedpress_placeholder", "wpview", "wpview-wrap"];
927
 
@@ -1497,15 +1532,12 @@
1497
  window.setTimeout(
1498
  function configureWrappersTimeOut() {
1499
  var doc = editorInstance.getDoc(),
1500
- total = 0,
1501
- $wrapper = null,
1502
- $iframe = null;
1503
 
1504
  // Get all the wrappers
1505
  var wrappers = doc.getElementsByClassName('embedpress_wrapper');
1506
- total = wrappers.length;
1507
- if (total > 0) {
1508
- for (var i = 0; i < total; i++) {
1509
  $wrapper = $(wrappers[i]);
1510
 
1511
  // Check if the wrapper wasn't already configured
@@ -1564,6 +1596,10 @@
1564
  self.getElementInContentById = function(id, editorInstance) {
1565
  var doc = editorInstance.getDoc();
1566
 
 
 
 
 
1567
  return $(doc.getElementById(id));
1568
  };
1569
 
@@ -1618,6 +1654,7 @@
1618
  window.EmbedPress = new EmbedPress();
1619
  }
1620
 
 
1621
  window.EmbedPress.init($data.previewSettings);
1622
  });
1623
  })(jQuery, String, $data);
262
  * @return void
263
  */
264
  self.onReady = function() {
265
+ var findEditors = function() {
266
  // Wait until the editor is available
267
  var interval = window.setInterval(
268
  function() {
281
  },
282
  250
283
  );
284
+ };
285
+
286
+ if (self.tinymceIsAvailable()) {
287
+ findEditors();
288
+ }
289
+
290
+ // Add support for the Beaver Builder.
291
+ if (typeof FLLightbox !== 'undefined') {
292
+ $.each(FLLightbox._instances, function(index) {
293
+ FLLightbox._instances[index].on('open', function() {
294
+ setTimeout(function() {
295
+ findEditors();
296
+ }, 500);
297
+ });
298
+
299
+ FLLightbox._instances[index].on('didHideLightbox', function() {
300
+ setTimeout(function() {
301
+ findEditors();
302
+ }, 500);
303
+ });
304
+ });
305
  }
306
  };
307
 
857
  // Add the node filter that will convert the url into the preview box for the embed code
858
  editorInstance.parser.addNodeFilter('#text', function addNodeFilterIntoParser(nodes, arg) {
859
  self.each(nodes, function eachNodeInParser(node) {
860
+ // Stop if the node is "isolated". It would generate an error in the browser console and break.
861
+ if (node.parent === null && node.prev === null) {
862
+ return;
863
+ }
864
+
865
  var subject = node.value.trim();
866
 
867
 
901
  setTimeout(function() {
902
  var doc = editorInstance.getDoc();
903
 
904
+ if (doc === null) {
905
+ return;
906
+ }
907
+
908
  var previewWrapper = $(doc.querySelector('#'+ wrapper.attributes.map['id']));
909
  var previewWrapperParent = $(previewWrapper.parent());
910
 
952
  // Add the filter that will convert the preview box/embed code back to the raw url
953
  editorInstance.serializer.addNodeFilter('div', function addNodeFilterIntoSerializer(nodes, arg) {
954
  self.each(nodes, function eachNodeInSerializer(node) {
955
+ // Stop if the node is "isolated". It would generate an error in the browser console and break.
956
+ if (node.parent === null && node.prev === null) {
957
+ return;
958
+ }
959
+
960
  var nodeClasses = (node.attributes.map.class || "").split(' ');
961
  var wrapperFactoryClasses = ["embedpress_wrapper", "embedpress_placeholder", "wpview", "wpview-wrap"];
962
 
1532
  window.setTimeout(
1533
  function configureWrappersTimeOut() {
1534
  var doc = editorInstance.getDoc(),
1535
+ $wrapper = null;
 
 
1536
 
1537
  // Get all the wrappers
1538
  var wrappers = doc.getElementsByClassName('embedpress_wrapper');
1539
+ if (wrappers.length > 0) {
1540
+ for (var i = 0; i < wrappers.length; i++) {
 
1541
  $wrapper = $(wrappers[i]);
1542
 
1543
  // Check if the wrapper wasn't already configured
1596
  self.getElementInContentById = function(id, editorInstance) {
1597
  var doc = editorInstance.getDoc();
1598
 
1599
+ if (doc === null) {
1600
+ return;
1601
+ }
1602
+
1603
  return $(doc.getElementById(id));
1604
  };
1605
 
1654
  window.EmbedPress = new EmbedPress();
1655
  }
1656
 
1657
+ // Initialize EmbedPress for all the current editors.
1658
  window.EmbedPress.init($data.previewSettings);
1659
  });
1660
  })(jQuery, String, $data);
embedpress.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: WordPress supports around 35 embed sources, but PublishPress Embeds adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
6
  * Author: EmbedPress
7
  * Author URI: http://embedpress.com
8
- * Version: 2.1.4
9
  * Text Domain: embedpress
10
  * Domain Path: /languages
11
  *
5
  * Description: WordPress supports around 35 embed sources, but PublishPress Embeds adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
6
  * Author: EmbedPress
7
  * Author URI: http://embedpress.com
8
+ * Version: 2.1.5
9
  * Text Domain: embedpress
10
  * Domain Path: /languages
11
  *
includes.php CHANGED
@@ -21,7 +21,7 @@ if (!defined('EMBEDPRESS_PLG_NAME')) {
21
  }
22
 
23
  if (!defined('EMBEDPRESS_PLG_VERSION')) {
24
- define('EMBEDPRESS_PLG_VERSION', "2.1.3");
25
  }
26
 
27
  if (!defined('EMBEDPRESS_ROOT')) {
21
  }
22
 
23
  if (!defined('EMBEDPRESS_PLG_VERSION')) {
24
+ define('EMBEDPRESS_PLG_VERSION', "2.1.5");
25
  }
26
 
27
  if (!defined('EMBEDPRESS_ROOT')) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Author URI: https://embedpress.com
5
  Tags: YouTube, Google, Facebook, Wistia, Vimeo
6
  Requires at least: 4.6
7
  Tested up to: 4.9.4
8
- Stable tag: 2.1.4
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -184,6 +184,12 @@ Not at all. You can set up everything your team needs without any coding knowled
184
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
185
  and this project adheres to [Semantic Versioning](http://semver.org/).
186
 
 
 
 
 
 
 
187
  = [2.1.4] - 2018-06-27 =
188
 
189
  *Fixed:*
5
  Tags: YouTube, Google, Facebook, Wistia, Vimeo
6
  Requires at least: 4.6
7
  Tested up to: 4.9.4
8
+ Stable tag: 2.1.5
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
184
  The format is based on [Keep a Changelog](http://keepachangelog.com/)
185
  and this project adheres to [Semantic Versioning](http://semver.org/).
186
 
187
+ = [2.1.5] - 2018-08-03 =
188
+
189
+ *Fixed:*
190
+
191
+ * Fixed embeds in the Beaver Builder;
192
+
193
  = [2.1.4] - 2018-06-27 =
194
 
195
  *Fixed:*