Version Description
Release Date: 2016-10-04
- Fixed bugs with PollDaddy embeds;
- Fixed bugs with Vine embeds;
- Fixed bugs with Twitter Collection and Moments embeds;
- Fixed bugs with SmugMug embeds;
- Fixed bugs with SlideShare embeds;
- Fixed bugs with Infogram embeds;
- Fixed bugs with MobyPicture embeds;
- Dropped support to IFTTT embeds;
- Probably fixed the double embed on paste bug;
- Prevent mouse interaction with the embed while its being loaded;
- Changed the general look of EmbedPress embeds;
- General code enhancements;
- General minor optimizations.
Download this release
Release Info
Developer | pressshack |
Plugin | EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor |
Version | 1.2.0 |
Comparing to | |
See all releases |
Code changes from version 1.1.3 to 1.2.0
- EmbedPress/Providers/GoogleMaps.php +1 -1
- EmbedPress/Shortcode.php +64 -0
- PROVIDERS.md +0 -1
- assets/css/preview.css +27 -21
- assets/js/preview.js +115 -63
- changelog.txt +17 -0
- embedpress.php +1 -1
- includes.php +1 -1
- providers.php +1 -1
- readme.txt +19 -3
EmbedPress/Providers/GoogleMaps.php
CHANGED
@@ -26,7 +26,7 @@ class GoogleMaps extends EmberaService
|
|
26 |
*/
|
27 |
public function validateUrl()
|
28 |
{
|
29 |
-
return preg_match('~http[s]?:\/\/((?:www\.)?google\.com(\.[a-z]{2})
|
30 |
}
|
31 |
|
32 |
/**
|
26 |
*/
|
27 |
public function validateUrl()
|
28 |
{
|
29 |
+
return preg_match('~http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)~i', $this->url);
|
30 |
}
|
31 |
|
32 |
/**
|
EmbedPress/Shortcode.php
CHANGED
@@ -118,6 +118,43 @@ class Shortcode
|
|
118 |
// Define the EmbedPress html template where the generated embed will be injected in
|
119 |
$embedTemplate = '<div '. implode(' ', $attributesHtml) .'>{html}</div>';
|
120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
// Try to generate the embed using WP API
|
122 |
$parsedContent = self::$oEmbedInstance->get_html($content, $attributes);
|
123 |
if (!$parsedContent) {
|
@@ -364,4 +401,31 @@ class Shortcode
|
|
364 |
return false;
|
365 |
}
|
366 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
367 |
}
|
118 |
// Define the EmbedPress html template where the generated embed will be injected in
|
119 |
$embedTemplate = '<div '. implode(' ', $attributesHtml) .'>{html}</div>';
|
120 |
|
121 |
+
// Check if $content is a google shortened url and tries to extract from it which Google service it refers to.
|
122 |
+
if (preg_match('/http[s]?:\/\/goo\.gl\/(?:([a-z]+)\/)?[a-z0-9]+\/?$/i', $content, $matches)) {
|
123 |
+
// Fetch all headers from the short-url so we can know how to handle its original content depending on the service.
|
124 |
+
$headers = get_headers($content);
|
125 |
+
|
126 |
+
$supportedServicesHeadersPatterns = array(
|
127 |
+
'maps' => '/^Location:\s+(http[s]?:\/\/.+)$/i'
|
128 |
+
);
|
129 |
+
|
130 |
+
$service = strtolower(@$matches[1]);
|
131 |
+
// No specific service was found in the url.
|
132 |
+
if (empty($service)) {
|
133 |
+
// Let's try to guess which service the original url belongs to.
|
134 |
+
foreach ($headers as $header) {
|
135 |
+
// Check if the short-url reffers to a Google Maps url.
|
136 |
+
if (preg_match($supportedServicesHeadersPatterns['maps'], $header, $matches)) {
|
137 |
+
// Replace the shortened url with its original url.
|
138 |
+
$content = $matches[1];
|
139 |
+
break;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
unset($header);
|
143 |
+
} else {
|
144 |
+
// Check if the Google service is supported atm.
|
145 |
+
if (isset($supportedServicesHeadersPatterns[$service])) {
|
146 |
+
// Tries to extract the url based on its headers.
|
147 |
+
$originalUrl = self::extractContentFromHeaderAsArray($supportedServicesHeadersPatterns[$service], $headers);
|
148 |
+
// Replace the shortened url with its original url if the specific header was found.
|
149 |
+
if (!empty($originalUrl)) {
|
150 |
+
$content = $originalUrl;
|
151 |
+
}
|
152 |
+
unset($originalUrl);
|
153 |
+
}
|
154 |
+
}
|
155 |
+
unset($service, $supportedServicesHeadersPatterns, $headers, $matches);
|
156 |
+
}
|
157 |
+
|
158 |
// Try to generate the embed using WP API
|
159 |
$parsedContent = self::$oEmbedInstance->get_html($content, $attributes);
|
160 |
if (!$parsedContent) {
|
401 |
return false;
|
402 |
}
|
403 |
}
|
404 |
+
|
405 |
+
/**
|
406 |
+
* Return the value from a header which is in an array resulted from a get_headers() call.
|
407 |
+
* If the header cannot be found, this method will return null instead.
|
408 |
+
*
|
409 |
+
* @since 1.1.0
|
410 |
+
* @access private
|
411 |
+
* @static
|
412 |
+
*
|
413 |
+
* @param string $headerPattern Regex pattern the header and its value must match.
|
414 |
+
* @param array $headersList A list of headers resulted from a get_headers() call.
|
415 |
+
*
|
416 |
+
* @return mixed
|
417 |
+
*/
|
418 |
+
private static function extractContentFromHeaderAsArray($headerPattern, $headersList)
|
419 |
+
{
|
420 |
+
$headerValue = null;
|
421 |
+
|
422 |
+
foreach ($headersList as $header) {
|
423 |
+
if (preg_match($headerPattern, $header, $matches)) {
|
424 |
+
$headerValue = $matches[1];
|
425 |
+
break;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
|
429 |
+
return $headerValue;
|
430 |
+
}
|
431 |
}
|
PROVIDERS.md
CHANGED
@@ -25,7 +25,6 @@ In addition to the default WordPress sources, EmbedPress supports these provider
|
|
25 |
- Google Sheets (Spreadsheets)
|
26 |
- Google Slides (Presentation Slideshows)
|
27 |
- HuffDuffer (Audios)
|
28 |
-
- IFTTT (Idea)
|
29 |
- Infogram (Charts)
|
30 |
- MobyPicture (Image)
|
31 |
- NFB (Videos)
|
25 |
- Google Sheets (Spreadsheets)
|
26 |
- Google Slides (Presentation Slideshows)
|
27 |
- HuffDuffer (Audios)
|
|
|
28 |
- Infogram (Charts)
|
29 |
- MobyPicture (Image)
|
30 |
- NFB (Videos)
|
assets/css/preview.css
CHANGED
@@ -6,6 +6,10 @@
|
|
6 |
* @since 1.0
|
7 |
*/
|
8 |
|
|
|
|
|
|
|
|
|
9 |
.embedpress_wrapper {
|
10 |
position: relative;
|
11 |
padding: 1px;
|
@@ -14,6 +18,10 @@
|
|
14 |
white-space: nowrap;
|
15 |
}
|
16 |
|
|
|
|
|
|
|
|
|
17 |
.embedpress_wrapper.dynamic-width {
|
18 |
display: inline-block;
|
19 |
}
|
@@ -53,11 +61,11 @@
|
|
53 |
width: 62px;
|
54 |
top: 1px;
|
55 |
left: 50%;
|
56 |
-
background: #
|
57 |
-
border: 1px solid rgba(
|
58 |
-
-webkit-box-shadow: 0px 10px 44px -5px rgba(0,0,0,0.66);
|
59 |
-
-moz-box-shadow: 0px 10px 44px -5px rgba(0,0,0,0.66);
|
60 |
-
box-shadow: 0px 10px 44px -5px rgba(0,0,0,0.66);
|
61 |
z-index: 999999;
|
62 |
}
|
63 |
|
@@ -72,7 +80,7 @@
|
|
72 |
|
73 |
.embedpress_controller_panel div.embedpress_controller_button:hover {
|
74 |
text-decoration: none;
|
75 |
-
color: #
|
76 |
}
|
77 |
|
78 |
.embedpress_controller_panel.hidden {
|
@@ -82,30 +90,28 @@
|
|
82 |
.embedpress_wrapper.embedpress_placeholder {
|
83 |
display: block;
|
84 |
padding: 10px;
|
85 |
-
background: #
|
86 |
-
border: 1px solid #
|
87 |
height: 120px;
|
88 |
width: 450px;
|
89 |
text-align: center;
|
90 |
box-sizing: border-box;
|
91 |
-
color: #
|
92 |
}
|
93 |
|
94 |
.embedpress_wrapper.embedpress_placeholder:before {
|
95 |
content: attr(data-loading-text);
|
96 |
-
display: block;
|
97 |
-
margin-top: 30px;
|
98 |
-
margin-bottom: 7px;
|
99 |
font-weight: bold;
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
content:
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
|
|
109 |
}
|
110 |
|
111 |
.embedpress_wrapper img {
|
6 |
* @since 1.0
|
7 |
*/
|
8 |
|
9 |
+
#tinymce {
|
10 |
+
max-width: 100% !important;
|
11 |
+
}
|
12 |
+
|
13 |
.embedpress_wrapper {
|
14 |
position: relative;
|
15 |
padding: 1px;
|
18 |
white-space: nowrap;
|
19 |
}
|
20 |
|
21 |
+
.embedpress_wrapper.is-loading {
|
22 |
+
cursor: progress;
|
23 |
+
}
|
24 |
+
|
25 |
.embedpress_wrapper.dynamic-width {
|
26 |
display: inline-block;
|
27 |
}
|
61 |
width: 62px;
|
62 |
top: 1px;
|
63 |
left: 50%;
|
64 |
+
background: #796FAB;
|
65 |
+
border: 1px solid rgba(151, 142, 196, 0.8);
|
66 |
+
-webkit-box-shadow: 0px 10px 44px -5px rgba(0, 0, 0, 0.66);
|
67 |
+
-moz-box-shadow: 0px 10px 44px -5px rgba(0, 0, 0, 0.66);
|
68 |
+
box-shadow: 0px 10px 44px -5px rgba(0, 0, 0, 0.66);
|
69 |
z-index: 999999;
|
70 |
}
|
71 |
|
80 |
|
81 |
.embedpress_controller_panel div.embedpress_controller_button:hover {
|
82 |
text-decoration: none;
|
83 |
+
color: #978EC4;
|
84 |
}
|
85 |
|
86 |
.embedpress_controller_panel.hidden {
|
90 |
.embedpress_wrapper.embedpress_placeholder {
|
91 |
display: block;
|
92 |
padding: 10px;
|
93 |
+
background: #796FAB;
|
94 |
+
border: 1px solid #978EC4;
|
95 |
height: 120px;
|
96 |
width: 450px;
|
97 |
text-align: center;
|
98 |
box-sizing: border-box;
|
99 |
+
color: #FFF;
|
100 |
}
|
101 |
|
102 |
.embedpress_wrapper.embedpress_placeholder:before {
|
103 |
content: attr(data-loading-text);
|
|
|
|
|
|
|
104 |
font-weight: bold;
|
105 |
+
font-family: 'Source Sans Pro', sans-serif;
|
106 |
+
display: flex;
|
107 |
+
flex-direction: column;
|
108 |
+
justify-content: center;
|
109 |
+
position: absolute;
|
110 |
+
top: 0;
|
111 |
+
right: 0;
|
112 |
+
bottom: 0;
|
113 |
+
left: 0;
|
114 |
+
margin: auto;
|
115 |
}
|
116 |
|
117 |
.embedpress_wrapper img {
|
assets/js/preview.js
CHANGED
@@ -356,6 +356,9 @@
|
|
356 |
var urlSchemes = [
|
357 |
// PollDaddy
|
358 |
'*.polldaddy.com/s/*',
|
|
|
|
|
|
|
359 |
'polldaddy.com/poll/*',
|
360 |
'polldaddy.com/ratings/*',
|
361 |
|
@@ -367,9 +370,11 @@
|
|
367 |
|
368 |
// SmugMug
|
369 |
'smugmug.com/*',
|
|
|
370 |
|
371 |
// SlideShare
|
372 |
-
'slideshare.net
|
|
|
373 |
|
374 |
// Reddit
|
375 |
'reddit.com/r/[^/]+/comments/*',
|
@@ -388,9 +393,6 @@
|
|
388 |
// YouTube (http://www.youtube.com/)
|
389 |
'youtube.com/watch\\?*',
|
390 |
|
391 |
-
// IFTTT (http://www.ifttt.com/)
|
392 |
-
'ifttt.com/recipes/*',
|
393 |
-
|
394 |
// Flickr (http://www.flickr.com/)
|
395 |
'flickr.com/photos/*/*',
|
396 |
'flic.kr/p/*',
|
@@ -415,11 +417,6 @@
|
|
415 |
'sta.sh/*',
|
416 |
|
417 |
// SlideShare (http://www.slideshare.net/)
|
418 |
-
'slideshare.net/*/*',
|
419 |
-
'fr.slideshare.net/*/*',
|
420 |
-
'de.slideshare.net/*/*',
|
421 |
-
'es.slideshare.net/*/*',
|
422 |
-
'pt.slideshare.net/*/*',
|
423 |
|
424 |
// chirbit.com (http://www.chirbit.com/)
|
425 |
'chirb.it/*',
|
@@ -557,6 +554,8 @@
|
|
557 |
|
558 |
// Twitter
|
559 |
'twitter.com/*/status/*',
|
|
|
|
|
560 |
|
561 |
// http://bambuser.com
|
562 |
'bambuser.com/v/*',
|
@@ -589,11 +588,14 @@
|
|
589 |
'videojug.com/*',
|
590 |
|
591 |
// https://vine.com
|
592 |
-
'vine.co/*',
|
593 |
|
594 |
// Facebook
|
595 |
'facebook.com/*',
|
596 |
|
|
|
|
|
|
|
597 |
// Google Maps
|
598 |
'google.com/*',
|
599 |
'google.com.*/*',
|
@@ -686,11 +688,13 @@
|
|
686 |
'data-url': url,
|
687 |
'data-uid': uid,
|
688 |
'id': 'embedpress_wrapper_' + uid,
|
689 |
-
'data-loading-text': 'Loading...'
|
690 |
};
|
691 |
|
692 |
wrapperSettings = $.extend({}, wrapperSettings, shortcodeAttributes);
|
693 |
|
|
|
|
|
694 |
wrapper.attr(wrapperSettings);
|
695 |
|
696 |
var panel = new self.Node('div', 1);
|
@@ -747,7 +751,7 @@
|
|
747 |
// Trigger the timeout which will load the content
|
748 |
window.setTimeout(function() {
|
749 |
self.parseContentAsync(uid, url, customAttributes);
|
750 |
-
},
|
751 |
|
752 |
return wrapper;
|
753 |
};
|
@@ -763,6 +767,8 @@
|
|
763 |
|
764 |
var $wrapper = $(self.getElementInContentById('embedpress_wrapper_' + uid));
|
765 |
|
|
|
|
|
766 |
// Parse as DOM element
|
767 |
var $content;
|
768 |
try {
|
@@ -794,17 +800,48 @@
|
|
794 |
iframe.style.width = (customAttributes.width ? customAttributes.width +'px' : '100%');
|
795 |
|
796 |
dom.add(contentWrapper, iframe);
|
797 |
-
|
798 |
var iframeWindow = iframe.contentWindow;
|
|
|
|
|
|
|
|
|
|
|
799 |
var iframeDoc = iframeWindow.document;
|
800 |
|
801 |
$(iframe).load(function() {
|
802 |
-
|
803 |
-
|
804 |
-
|
805 |
-
|
806 |
-
|
807 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
808 |
});
|
809 |
|
810 |
iframeDoc.open();
|
@@ -831,7 +868,7 @@
|
|
831 |
'}'+
|
832 |
'</style>'+
|
833 |
'</head>'+
|
834 |
-
'<body id="wpview-iframe-sandbox" class="'+ self.editor.getBody().className +'">'+
|
835 |
$content.html() +
|
836 |
'</body>'+
|
837 |
'</html>'
|
@@ -1014,40 +1051,43 @@
|
|
1014 |
// These patterns need to have groups for the pre and post texts
|
1015 |
var patterns = self.getProvidersURLPatterns();
|
1016 |
|
1017 |
-
|
1018 |
-
|
1019 |
-
|
1020 |
-
|
1021 |
|
1022 |
-
|
1023 |
|
1024 |
-
|
1025 |
-
|
1026 |
-
|
1027 |
-
|
1028 |
-
var postText = matches[3];
|
1029 |
-
var wrapper = self.addURLsPlaceholder(node, url);
|
1030 |
|
1031 |
-
|
1032 |
-
var text;
|
1033 |
-
if (preText !== '') {
|
1034 |
-
text = new self.Node('#text', 3);
|
1035 |
-
text.value = preText.trim();
|
1036 |
|
1037 |
-
//
|
1038 |
-
|
1039 |
-
|
|
|
|
|
|
|
|
|
|
|
1040 |
|
1041 |
-
|
1042 |
-
|
1043 |
-
|
1044 |
-
|
|
|
1045 |
|
1046 |
-
|
1047 |
-
|
|
|
|
|
|
|
1048 |
}
|
1049 |
}
|
1050 |
-
});
|
1051 |
});
|
1052 |
});
|
1053 |
|
@@ -1196,40 +1236,52 @@
|
|
1196 |
* @return void
|
1197 |
*/
|
1198 |
self.onPaste = function(e, b) {
|
1199 |
-
var event;
|
1200 |
|
1201 |
// Prevent default paste behavior. We have 2 arguments because the difference between JCE and TinyMCE.
|
1202 |
-
// Sometimes, the argument e is the editor, instead of the event
|
1203 |
if (e.preventDefault) {
|
1204 |
event = e;
|
1205 |
} else {
|
1206 |
event = b;
|
1207 |
}
|
1208 |
|
1209 |
-
// Check for clipboard data in various places for cross-browser compatibility
|
1210 |
-
// Get that data as text
|
1211 |
var content = ((event.originalEvent || event).clipboardData || window.clipboardData).getData('Text');
|
1212 |
|
1213 |
// Check if the pasted content has a recognized embed url pattern
|
1214 |
var patterns = self.getProvidersURLPatterns();
|
1215 |
|
1216 |
-
|
1217 |
-
|
1218 |
-
|
1219 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1220 |
|
1221 |
-
|
1222 |
-
|
1223 |
|
1224 |
-
|
|
|
1225 |
|
1226 |
-
|
1227 |
-
|
1228 |
-
|
1229 |
|
1230 |
-
|
|
|
|
|
|
|
|
|
1231 |
}
|
1232 |
-
});
|
1233 |
};
|
1234 |
|
1235 |
/**
|
@@ -1688,7 +1740,7 @@
|
|
1688 |
self.hidePreviewControllerPanel();
|
1689 |
}
|
1690 |
|
1691 |
-
if (!self.controllerPanelIsActive()) {
|
1692 |
var uid = $wrapper.data('uid');
|
1693 |
var $panel = self.getElementInContentById('embedpress_controller_panel_' + uid);
|
1694 |
|
356 |
var urlSchemes = [
|
357 |
// PollDaddy
|
358 |
'*.polldaddy.com/s/*',
|
359 |
+
'*.polldaddy.com/poll/*',
|
360 |
+
'*.polldaddy.com/ratings/*',
|
361 |
+
'polldaddy.com/s/*',
|
362 |
'polldaddy.com/poll/*',
|
363 |
'polldaddy.com/ratings/*',
|
364 |
|
370 |
|
371 |
// SmugMug
|
372 |
'smugmug.com/*',
|
373 |
+
'*.smugmug.com/*',
|
374 |
|
375 |
// SlideShare
|
376 |
+
'slideshare.net/*/*',
|
377 |
+
'*.slideshare.net/*/*',
|
378 |
|
379 |
// Reddit
|
380 |
'reddit.com/r/[^/]+/comments/*',
|
393 |
// YouTube (http://www.youtube.com/)
|
394 |
'youtube.com/watch\\?*',
|
395 |
|
|
|
|
|
|
|
396 |
// Flickr (http://www.flickr.com/)
|
397 |
'flickr.com/photos/*/*',
|
398 |
'flic.kr/p/*',
|
417 |
'sta.sh/*',
|
418 |
|
419 |
// SlideShare (http://www.slideshare.net/)
|
|
|
|
|
|
|
|
|
|
|
420 |
|
421 |
// chirbit.com (http://www.chirbit.com/)
|
422 |
'chirb.it/*',
|
554 |
|
555 |
// Twitter
|
556 |
'twitter.com/*/status/*',
|
557 |
+
'twitter.com/i/moments/*',
|
558 |
+
'twitter.com/*/timelines/*',
|
559 |
|
560 |
// http://bambuser.com
|
561 |
'bambuser.com/v/*',
|
588 |
'videojug.com/*',
|
589 |
|
590 |
// https://vine.com
|
591 |
+
'vine.co/v/*',
|
592 |
|
593 |
// Facebook
|
594 |
'facebook.com/*',
|
595 |
|
596 |
+
// Google Shortened Url
|
597 |
+
'goo.gl/*',
|
598 |
+
|
599 |
// Google Maps
|
600 |
'google.com/*',
|
601 |
'google.com.*/*',
|
688 |
'data-url': url,
|
689 |
'data-uid': uid,
|
690 |
'id': 'embedpress_wrapper_' + uid,
|
691 |
+
'data-loading-text': 'Loading your embed...'
|
692 |
};
|
693 |
|
694 |
wrapperSettings = $.extend({}, wrapperSettings, shortcodeAttributes);
|
695 |
|
696 |
+
wrapperSettings.class += " is-loading";
|
697 |
+
|
698 |
wrapper.attr(wrapperSettings);
|
699 |
|
700 |
var panel = new self.Node('div', 1);
|
751 |
// Trigger the timeout which will load the content
|
752 |
window.setTimeout(function() {
|
753 |
self.parseContentAsync(uid, url, customAttributes);
|
754 |
+
}, 200);
|
755 |
|
756 |
return wrapper;
|
757 |
};
|
767 |
|
768 |
var $wrapper = $(self.getElementInContentById('embedpress_wrapper_' + uid));
|
769 |
|
770 |
+
$wrapper.removeClass('is-loading');
|
771 |
+
|
772 |
// Parse as DOM element
|
773 |
var $content;
|
774 |
try {
|
800 |
iframe.style.width = (customAttributes.width ? customAttributes.width +'px' : '100%');
|
801 |
|
802 |
dom.add(contentWrapper, iframe);
|
|
|
803 |
var iframeWindow = iframe.contentWindow;
|
804 |
+
// Content failed to load.
|
805 |
+
if (!iframeWindow) {
|
806 |
+
return;
|
807 |
+
}
|
808 |
+
|
809 |
var iframeDoc = iframeWindow.document;
|
810 |
|
811 |
$(iframe).load(function() {
|
812 |
+
var maximumChecksAllowed = 50;
|
813 |
+
var checkIndex = 0;
|
814 |
+
var checkerInterval = setInterval(function() {
|
815 |
+
if (checkIndex === maximumChecksAllowed) {
|
816 |
+
clearInterval(checkerInterval);
|
817 |
+
|
818 |
+
setTimeout(function() {
|
819 |
+
iframe.height = $(iframeDoc.body).height();
|
820 |
+
iframe.width = $(iframeDoc.body).width();
|
821 |
+
|
822 |
+
$wrapper.attr('width', iframe.width);
|
823 |
+
$wrapper.css('width', iframe.width + 'px');
|
824 |
+
|
825 |
+
$($wrapper).after('<p> </p>');
|
826 |
+
}, 250);
|
827 |
+
} else {
|
828 |
+
if (customAttributes.height) {
|
829 |
+
iframe.height = customAttributes.height;
|
830 |
+
iframe.style.height = customAttributes.height +'px';
|
831 |
+
} else {
|
832 |
+
iframe.height = iframeDoc.body.scrollHeight;
|
833 |
+
}
|
834 |
+
|
835 |
+
if (customAttributes.width) {
|
836 |
+
iframe.width = customAttributes.width;
|
837 |
+
iframe.style.width = customAttributes.width +'px';
|
838 |
+
} else {
|
839 |
+
iframe.width = $(iframeDoc.body).width();
|
840 |
+
}
|
841 |
+
|
842 |
+
checkIndex++;
|
843 |
+
}
|
844 |
+
}, 100);
|
845 |
});
|
846 |
|
847 |
iframeDoc.open();
|
868 |
'}'+
|
869 |
'</style>'+
|
870 |
'</head>'+
|
871 |
+
'<body id="wpview-iframe-sandbox" class="'+ self.editor.getBody().className +'" style="display: inline-block;">'+
|
872 |
$content.html() +
|
873 |
'</body>'+
|
874 |
'</html>'
|
1051 |
// These patterns need to have groups for the pre and post texts
|
1052 |
var patterns = self.getProvidersURLPatterns();
|
1053 |
|
1054 |
+
(function tryToMatchContentAgainstUrlPatternWithIndex(urlPatternIndex) {
|
1055 |
+
if (urlPatternIndex < patterns.length) {
|
1056 |
+
var urlPattern = patterns[urlPatternIndex];
|
1057 |
+
var urlPatternRegex = new RegExp(urlPattern);
|
1058 |
|
1059 |
+
var url = self.decodeEmbedURLSpecialChars(subject).trim();
|
1060 |
|
1061 |
+
var matches = url.match(urlPatternRegex);
|
1062 |
+
// Check if content matches the url pattern.
|
1063 |
+
if (matches && matches !== null && !!matches.length) {
|
1064 |
+
url = self.encodeEmbedURLSpecialChars(matches[2]);
|
|
|
|
|
1065 |
|
1066 |
+
var wrapper = self.addURLsPlaceholder(node, url);
|
|
|
|
|
|
|
|
|
1067 |
|
1068 |
+
// Look for a pre-text and adds it on content if exists.
|
1069 |
+
var preText = matches[1];
|
1070 |
+
if (!!preText.length) {
|
1071 |
+
var text = new self.Node('#text', 3);
|
1072 |
+
text.value = preText.trim();
|
1073 |
+
|
1074 |
+
wrapper.parent.insert(text, wrapper, true);
|
1075 |
+
}
|
1076 |
|
1077 |
+
// Look for a post-text and adds it on content if exists.
|
1078 |
+
var postText = matches[3];
|
1079 |
+
if (!!postText.length) {
|
1080 |
+
var text = new self.Node('#text', 3);
|
1081 |
+
text.value = postText.trim();
|
1082 |
|
1083 |
+
wrapper.parent.insert(text, wrapper, false);
|
1084 |
+
}
|
1085 |
+
} else {
|
1086 |
+
// No match. So we move on to check the next url pattern.
|
1087 |
+
tryToMatchContentAgainstUrlPatternWithIndex(urlPatternIndex + 1);
|
1088 |
}
|
1089 |
}
|
1090 |
+
})(0);
|
1091 |
});
|
1092 |
});
|
1093 |
|
1236 |
* @return void
|
1237 |
*/
|
1238 |
self.onPaste = function(e, b) {
|
1239 |
+
var event = null;
|
1240 |
|
1241 |
// Prevent default paste behavior. We have 2 arguments because the difference between JCE and TinyMCE.
|
1242 |
+
// Sometimes, the argument e is the editor, instead of the event.
|
1243 |
if (e.preventDefault) {
|
1244 |
event = e;
|
1245 |
} else {
|
1246 |
event = b;
|
1247 |
}
|
1248 |
|
1249 |
+
// Check for clipboard data in various places for cross-browser compatibility and get its data as text.
|
|
|
1250 |
var content = ((event.originalEvent || event).clipboardData || window.clipboardData).getData('Text');
|
1251 |
|
1252 |
// Check if the pasted content has a recognized embed url pattern
|
1253 |
var patterns = self.getProvidersURLPatterns();
|
1254 |
|
1255 |
+
(function tryToMatchContentAgainstUrlPatternWithIndex(urlPatternIndex) {
|
1256 |
+
if (urlPatternIndex < content.length) {
|
1257 |
+
var urlPattern = patterns[urlPatternIndex];
|
1258 |
+
|
1259 |
+
var urlPatternRegex = new RegExp(urlPattern);
|
1260 |
+
var matches = content.match(urlPatternRegex) || null;
|
1261 |
+
|
1262 |
+
// Check if content matches the url pattern.
|
1263 |
+
if (matches && matches !== null && !!matches.length) {
|
1264 |
+
// Cancel the default behavior.
|
1265 |
+
event.preventDefault();
|
1266 |
+
event.stopPropagation();
|
1267 |
|
1268 |
+
// Remove "www." subdomain from Slideshare.net urls that was causing bugs on TinyMCE.
|
1269 |
+
content = content.replace(/www\.slideshare\.net\//i, 'slideshare.net/');
|
1270 |
|
1271 |
+
// Make sure that the cursor will be positioned after the embed.
|
1272 |
+
content += '<span> </span>';
|
1273 |
|
1274 |
+
// Let TinyMCE do the heavy lifting for inserting that content into the self.editor.
|
1275 |
+
// We cancel the default behavior and insert the embed-content using a command to trigger the node change and the parser.
|
1276 |
+
self.editor.execCommand('mceInsertContent', false, content);
|
1277 |
|
1278 |
+
self.configureWrappers();
|
1279 |
+
} else {
|
1280 |
+
// No match. So we move on to check the next url pattern.
|
1281 |
+
tryToMatchContentAgainstUrlPatternWithIndex(urlPatternIndex + 1);
|
1282 |
+
}
|
1283 |
}
|
1284 |
+
})(0);
|
1285 |
};
|
1286 |
|
1287 |
/**
|
1740 |
self.hidePreviewControllerPanel();
|
1741 |
}
|
1742 |
|
1743 |
+
if (!self.controllerPanelIsActive() && !$wrapper.hasClass('is-loading')) {
|
1744 |
var uid = $wrapper.data('uid');
|
1745 |
var $panel = self.getElementInContentById('embedpress_controller_panel_' + uid);
|
1746 |
|
changelog.txt
CHANGED
@@ -1,4 +1,21 @@
|
|
1 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
= 1.1.3 =
|
3 |
Release Date: 2016-09-20
|
4 |
|
1 |
== Changelog ==
|
2 |
+
= 1.2.0 =
|
3 |
+
Release Date: 2016-10-04
|
4 |
+
|
5 |
+
* Fixed bugs with PollDaddy embeds;
|
6 |
+
* Fixed bugs with Vine embeds;
|
7 |
+
* Fixed bugs with Twitter Collection and Moments embeds;
|
8 |
+
* Fixed bugs with SmugMug embeds;
|
9 |
+
* Fixed bugs with SlideShare embeds;
|
10 |
+
* Fixed bugs with Infogram embeds;
|
11 |
+
* Fixed bugs with MobyPicture embeds;
|
12 |
+
* Dropped support to IFTTT embeds;
|
13 |
+
* Probably fixed the double embed on paste bug;
|
14 |
+
* Prevent mouse interaction with the embed while its being loaded;
|
15 |
+
* Changed the general look of EmbedPress embeds;
|
16 |
+
* General code enhancements;
|
17 |
+
* General minor optimizations.
|
18 |
+
|
19 |
= 1.1.3 =
|
20 |
Release Date: 2016-09-20
|
21 |
|
embedpress.php
CHANGED
@@ -12,7 +12,7 @@
|
|
12 |
* @embedpress
|
13 |
* Plugin Name: EmbedPress
|
14 |
* Plugin URI: http://pressshack.com/embedpress/
|
15 |
-
* Version: 1.
|
16 |
* Description: WordPress supports around 35 embed sources, but EmbedPress adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
|
17 |
* Author: PressShack
|
18 |
* Author URI: http://pressshack.com/
|
12 |
* @embedpress
|
13 |
* Plugin Name: EmbedPress
|
14 |
* Plugin URI: http://pressshack.com/embedpress/
|
15 |
+
* Version: 1.2.0
|
16 |
* Description: WordPress supports around 35 embed sources, but EmbedPress adds over 40 more, including Facebook, Google Maps, Google Docs, UStream! Just use the URL!
|
17 |
* Author: PressShack
|
18 |
* Author URI: http://pressshack.com/
|
includes.php
CHANGED
@@ -16,7 +16,7 @@ if (!defined('EMBEDPRESS_PLG_NAME')) {
|
|
16 |
}
|
17 |
|
18 |
if (!defined('EMBEDPRESS_PLG_VERSION')) {
|
19 |
-
define('EMBEDPRESS_PLG_VERSION', "1.
|
20 |
}
|
21 |
|
22 |
if (!defined('EMBEDPRESS_PATH_BASE')) {
|
16 |
}
|
17 |
|
18 |
if (!defined('EMBEDPRESS_PLG_VERSION')) {
|
19 |
+
define('EMBEDPRESS_PLG_VERSION', "1.2.0");
|
20 |
}
|
21 |
|
22 |
if (!defined('EMBEDPRESS_PATH_BASE')) {
|
providers.php
CHANGED
@@ -15,6 +15,6 @@
|
|
15 |
*/
|
16 |
|
17 |
$additionalServiceProviders = array(
|
18 |
-
'GoogleMaps' => array("google.com", "google.com.*", "maps.google.com"),
|
19 |
'GoogleDocs' => array("docs.google.com")
|
20 |
);
|
15 |
*/
|
16 |
|
17 |
$additionalServiceProviders = array(
|
18 |
+
'GoogleMaps' => array("google.com", "google.com.*", "maps.google.com", "goo.gl"),
|
19 |
'GoogleDocs' => array("docs.google.com")
|
20 |
);
|
readme.txt
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
=== EmbedPress ===
|
2 |
Contributors: PressShack
|
3 |
-
Tags: 23hq, amcharts, animoto, aol on, bambuser, cacoo, chartblocks, chirbit, circuitlab, cloudup, clyp, collegehumor, coub, crowd ranking, daily mile, dailymotion, devianart, dipity, dotsub, edocr, facebook, flickr, funnyordie, gettyimages, github gist, google docs, google drawings, google maps, google sheets, google slides, huffduffer, hulu,
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6.1
|
6 |
-
Stable tag: 1.
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
@@ -41,7 +41,6 @@ In addition to the default WordPress sources, EmbedPress supports these provider
|
|
41 |
- [Google Sheets](https://www.google.com/sheets/) <em>(Spreadsheets)</em>
|
42 |
- [Google Slides](https://google.com/slides) <em>(Presentation Slideshows)</em>
|
43 |
- [HuffDuffer](http://huffduffer.com/) <em>(Audios)</em>
|
44 |
-
- [IFTTT](http://ifttt.com/) <em>(Idea)</em>
|
45 |
- [Infogram](https://infogr.am/) <em>(Charts)</em>
|
46 |
- [MobyPicture](http://mobypicture.com/) <em>(Image)</em>
|
47 |
- [NFB](http://www.nfb.ca/) <em>(Videos)</em>
|
@@ -93,6 +92,23 @@ There're two ways to install EmbedPress plugin:
|
|
93 |
`
|
94 |
|
95 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
96 |
= 1.1.3 =
|
97 |
Release Date: 2016-09-20
|
98 |
|
1 |
=== EmbedPress ===
|
2 |
Contributors: PressShack
|
3 |
+
Tags: 23hq, amcharts, animoto, aol on, bambuser, cacoo, chartblocks, chirbit, circuitlab, cloudup, clyp, collegehumor, coub, crowd ranking, daily mile, dailymotion, devianart, dipity, dotsub, edocr, facebook, flickr, funnyordie, gettyimages, github gist, google docs, google drawings, google maps, google sheets, google slides, huffduffer, hulu, imgur, infogram, instagram, issuu, kickstarter, meetup, mixcloud, mobypicture, nfb, photobucket, polldaddy, porfolium, reddit, release wire, reverbnation, roomshare, rutube, sapo videos, scribd, shortnote, shoudio, sketchfab, slideshare, smugmug, soundcloud, speaker deck, spotify, ted, tumblr, twitter, ustream, viddler, videojug, videopress, vimeo, vine, wordpress tv, youtube
|
4 |
Requires at least: 4.0
|
5 |
Tested up to: 4.6.1
|
6 |
+
Stable tag: 1.2.0
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
41 |
- [Google Sheets](https://www.google.com/sheets/) <em>(Spreadsheets)</em>
|
42 |
- [Google Slides](https://google.com/slides) <em>(Presentation Slideshows)</em>
|
43 |
- [HuffDuffer](http://huffduffer.com/) <em>(Audios)</em>
|
|
|
44 |
- [Infogram](https://infogr.am/) <em>(Charts)</em>
|
45 |
- [MobyPicture](http://mobypicture.com/) <em>(Image)</em>
|
46 |
- [NFB](http://www.nfb.ca/) <em>(Videos)</em>
|
92 |
`
|
93 |
|
94 |
== Changelog ==
|
95 |
+
= 1.2.0 =
|
96 |
+
Release Date: 2016-10-04
|
97 |
+
|
98 |
+
* Fixed bugs with PollDaddy embeds;
|
99 |
+
* Fixed bugs with Vine embeds;
|
100 |
+
* Fixed bugs with Twitter Collection and Moments embeds;
|
101 |
+
* Fixed bugs with SmugMug embeds;
|
102 |
+
* Fixed bugs with SlideShare embeds;
|
103 |
+
* Fixed bugs with Infogram embeds;
|
104 |
+
* Fixed bugs with MobyPicture embeds;
|
105 |
+
* Dropped support to IFTTT embeds;
|
106 |
+
* Probably fixed the double embed on paste bug;
|
107 |
+
* Prevent mouse interaction with the embed while its being loaded;
|
108 |
+
* Changed the general look of EmbedPress embeds;
|
109 |
+
* General code enhancements;
|
110 |
+
* General minor optimizations.
|
111 |
+
|
112 |
= 1.1.3 =
|
113 |
Release Date: 2016-09-20
|
114 |
|