Version Description
Download this release
Release Info
Developer | wpdevteam |
Plugin | EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor |
Version | 3.3.6 |
Comparing to | |
See all releases |
Code changes from version 3.3.5 to 3.3.6
- EmbedPress/Elementor/Widgets/Embedpress_Calendar.php +1 -1
- EmbedPress/Elementor/Widgets/Embedpress_Document.php +3 -2
- EmbedPress/Elementor/Widgets/Embedpress_Elementor.php +1 -1
- EmbedPress/Elementor/Widgets/Embedpress_Pdf.php +1 -1
- EmbedPress/Includes/Traits/Shared.php +1 -1
- EmbedPress/Shortcode.php +53 -40
- embedpress.php +1 -1
- includes.php +1 -1
- readme.txt +11 -3
EmbedPress/Elementor/Widgets/Embedpress_Calendar.php
CHANGED
@@ -122,7 +122,7 @@ class Embedpress_Calendar extends Widget_Base
|
|
122 |
return ['embedpress', 'calendar', 'google', 'google calendar', 'google-calendar', 'ics', 'event', 'embedpress calendar'];
|
123 |
}
|
124 |
|
125 |
-
protected function
|
126 |
{
|
127 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
128 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
122 |
return ['embedpress', 'calendar', 'google', 'google calendar', 'google-calendar', 'ics', 'event', 'embedpress calendar'];
|
123 |
}
|
124 |
|
125 |
+
protected function register_controls()
|
126 |
{
|
127 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
128 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
EmbedPress/Elementor/Widgets/Embedpress_Document.php
CHANGED
@@ -56,7 +56,7 @@ class Embedpress_Document extends Widget_Base
|
|
56 |
return ['embedpress', 'pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'embedpress-document'];
|
57 |
}
|
58 |
|
59 |
-
protected function
|
60 |
{
|
61 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
62 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
@@ -147,6 +147,7 @@ class Embedpress_Document extends Widget_Base
|
|
147 |
'selectors' => [
|
148 |
'{{WRAPPER}} .embedpress-document-embed iframe' => 'width: {{SIZE}}{{UNIT}} !important; max-width: 100%',
|
149 |
'{{WRAPPER}} .embedpress-document-embed .pdfobject-container' => 'width: {{SIZE}}{{UNIT}} !important; max-width: 100%',
|
|
|
150 |
],
|
151 |
]
|
152 |
);
|
@@ -194,7 +195,7 @@ class Embedpress_Document extends Widget_Base
|
|
194 |
]
|
195 |
],
|
196 |
'prefix_class' => 'elementor%s-align-',
|
197 |
-
'default' => '',
|
198 |
]
|
199 |
);
|
200 |
|
56 |
return ['embedpress', 'pdf', 'doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx', 'embedpress-document'];
|
57 |
}
|
58 |
|
59 |
+
protected function register_controls()
|
60 |
{
|
61 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
62 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
147 |
'selectors' => [
|
148 |
'{{WRAPPER}} .embedpress-document-embed iframe' => 'width: {{SIZE}}{{UNIT}} !important; max-width: 100%',
|
149 |
'{{WRAPPER}} .embedpress-document-embed .pdfobject-container' => 'width: {{SIZE}}{{UNIT}} !important; max-width: 100%',
|
150 |
+
'{{WRAPPER}} .embedpress-document-embed' => 'width: {{SIZE}}{{UNIT}} !important; max-width: 100%',
|
151 |
],
|
152 |
]
|
153 |
);
|
195 |
]
|
196 |
],
|
197 |
'prefix_class' => 'elementor%s-align-',
|
198 |
+
'default' => 'center',
|
199 |
]
|
200 |
);
|
201 |
|
EmbedPress/Elementor/Widgets/Embedpress_Elementor.php
CHANGED
@@ -75,7 +75,7 @@ class Embedpress_Elementor extends Widget_Base {
|
|
75 |
];
|
76 |
}
|
77 |
|
78 |
-
protected function
|
79 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
80 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
81 |
/**
|
75 |
];
|
76 |
}
|
77 |
|
78 |
+
protected function register_controls() {
|
79 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
80 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
81 |
/**
|
EmbedPress/Elementor/Widgets/Embedpress_Pdf.php
CHANGED
@@ -56,7 +56,7 @@ class Embedpress_Pdf extends Widget_Base
|
|
56 |
return ['embedpress', 'pdf', 'doc', 'embedpress-document'];
|
57 |
}
|
58 |
|
59 |
-
protected function
|
60 |
{
|
61 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
62 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
56 |
return ['embedpress', 'pdf', 'doc', 'embedpress-document'];
|
57 |
}
|
58 |
|
59 |
+
protected function register_controls()
|
60 |
{
|
61 |
$this->pro_class = is_embedpress_pro_active() ? '': 'embedpress-pro-control';
|
62 |
$this->pro_text = is_embedpress_pro_active() ? '': '<sup class="embedpress-pro-label" style="color:red">'.__('Pro', 'embedpress').'</sup>';
|
EmbedPress/Includes/Traits/Shared.php
CHANGED
@@ -102,7 +102,7 @@ trait Shared {
|
|
102 |
* Message message for showing.
|
103 |
*/
|
104 |
$notice->classes( 'upsale', 'notice is-dismissible ' );
|
105 |
-
$notice->message( 'upsale', '<p>' . __( 'Thank you for relying on EmbedPress with
|
106 |
|
107 |
// Update Notice For PRO Version
|
108 |
if ( $this->is_pro_active() && \version_compare( get_embedpress_pro_version(), '2.0.0', '<' ) ) {
|
102 |
* Message message for showing.
|
103 |
*/
|
104 |
$notice->classes( 'upsale', 'notice is-dismissible ' );
|
105 |
+
$notice->message( 'upsale', '<p>' . __( 'Thank you for relying on EmbedPress with 50,000 other websites. Checkout our Pro features.', $notice->text_domain ) . '</p>' );
|
106 |
|
107 |
// Update Notice For PRO Version
|
108 |
if ( $this->is_pro_active() && \version_compare( get_embedpress_pro_version(), '2.0.0', '<' ) ) {
|
EmbedPress/Shortcode.php
CHANGED
@@ -67,7 +67,7 @@ class Shortcode {
|
|
67 |
add_shortcode( 'embed_oembed_html', ['\\EmbedPress\\Shortcode', 'do_shortcode'] );
|
68 |
add_shortcode( 'embedpress', ['\\EmbedPress\\Shortcode', 'do_shortcode'] );
|
69 |
}
|
70 |
-
|
71 |
/**
|
72 |
* Method that converts the plugin shortcoded-string into its complex content.
|
73 |
*
|
@@ -79,7 +79,7 @@ class Shortcode {
|
|
79 |
* @static
|
80 |
*
|
81 |
*/
|
82 |
-
|
83 |
public static function do_shortcode( $attributes = [], $subject = null ) {
|
84 |
$plgSettings = Core::getSettings();
|
85 |
$default = [];
|
@@ -112,7 +112,7 @@ class Shortcode {
|
|
112 |
self::set_default_size( $customAttributes);
|
113 |
$url = preg_replace( '/(\[' . EMBEDPRESS_SHORTCODE . '(?:\]|.+?\])|\[\/' . EMBEDPRESS_SHORTCODE . '\])/i',
|
114 |
"", $subject );
|
115 |
-
|
116 |
// Converts any special HTML entities back to characters.
|
117 |
$url = htmlspecialchars_decode( $url );
|
118 |
$content_uid = md5( $url );
|
@@ -152,7 +152,7 @@ class Shortcode {
|
|
152 |
if ( empty( $embedResults ) ) {
|
153 |
return $subject;
|
154 |
}
|
155 |
-
|
156 |
// Transform all shortcode attributes into html form. I.e.: {foo: "joe"} -> foo="joe"
|
157 |
$attributesHtml = ['class="ose-{provider_alias} ose-uid-' . $content_uid.' ose-embedpress-responsive"'];
|
158 |
//$attributesHtml = [];
|
@@ -172,6 +172,7 @@ class Shortcode {
|
|
172 |
// Replace all single quotes to double quotes. I.e: foo='joe' -> foo="joe"
|
173 |
$parsedContent = str_replace( "'", '"', $parsedContent );
|
174 |
$parsedContent = str_replace( "{provider_alias}", $provider_name , $parsedContent );
|
|
|
175 |
|
176 |
self::purify_html_content( $parsedContent);
|
177 |
self::modify_content_for_fb_and_canada( $provider_name, $parsedContent);
|
@@ -186,14 +187,14 @@ class Shortcode {
|
|
186 |
if ( preg_match( '~width="(\d+)"|width\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
187 |
$iframeWidth = (int)$matches[ 1 ];
|
188 |
}
|
189 |
-
|
190 |
if ( preg_match( '~height="(\d+)"|height\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
191 |
$iframeHeight = (int)$matches[ 1 ];
|
192 |
}
|
193 |
-
|
194 |
if ( isset( $iframeWidth ) && isset( $iframeHeight ) && $iframeWidth > 0 && $iframeHeight > 0 ) {
|
195 |
$iframeRatio = ceil( $iframeWidth / $iframeHeight );
|
196 |
-
|
197 |
if ( isset( self::$emberaInstanceSettings[ 'maxwidth' ] ) ) {
|
198 |
$customWidth = (int)self::$emberaInstanceSettings[ 'maxwidth' ];
|
199 |
$customHeight = ceil( $customWidth / $iframeRatio );
|
@@ -213,7 +214,7 @@ class Shortcode {
|
|
213 |
$parsedContent = preg_replace( '~width="({.+})"~i', 'width="' . $customWidth . '"',
|
214 |
$parsedContent );
|
215 |
}
|
216 |
-
|
217 |
if ( preg_match( '~height="(\d+)"~i', $parsedContent ) ) {
|
218 |
$parsedContent = preg_replace( '~height="(\d+)"~i', 'height="' . $customHeight . '"',
|
219 |
$parsedContent );
|
@@ -221,16 +222,28 @@ class Shortcode {
|
|
221 |
$parsedContent = preg_replace( '~height="({.+})"~i', 'height="' . $customHeight . '"',
|
222 |
$parsedContent );
|
223 |
}
|
224 |
-
|
225 |
if ( preg_match( '~width\s+:\s+(\d+)~i', $parsedContent ) ) {
|
226 |
$parsedContent = preg_replace( '~width\s+:\s+(\d+)~i', 'width: ' . $customWidth,
|
227 |
$parsedContent );
|
228 |
}
|
229 |
-
|
230 |
if ( preg_match( '~height\s+:\s+(\d+)~i', $parsedContent ) ) {
|
231 |
$parsedContent = preg_replace( '~height\s+:\s+(\d+)~i', 'height: ' . $customHeight,
|
232 |
$parsedContent );
|
233 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
}
|
235 |
}
|
236 |
|
@@ -249,7 +262,7 @@ KAMAL;
|
|
249 |
$styles = str_replace( ['{height}', '{width}'], [$customAttributes['height'], $customAttributes['width']], $styles);
|
250 |
$parsedContent = $styles.$parsedContent;
|
251 |
}
|
252 |
-
|
253 |
if ( $stripNewLine ) {
|
254 |
$parsedContent = preg_replace( '/\n/', '', $parsedContent );
|
255 |
}
|
@@ -268,7 +281,7 @@ KAMAL;
|
|
268 |
return $embed;
|
269 |
}
|
270 |
}
|
271 |
-
|
272 |
return $subject;
|
273 |
}
|
274 |
|
@@ -352,7 +365,7 @@ KAMAL;
|
|
352 |
return false;
|
353 |
}
|
354 |
}
|
355 |
-
|
356 |
/**
|
357 |
* Method that retrieves all custom parameters from a shortcoded string.
|
358 |
*
|
@@ -369,7 +382,7 @@ KAMAL;
|
|
369 |
if ( preg_match_all( '/(\!?\w+-?\w*)(?:="(.+?)")?/i', stripslashes( $m[ 1 ] ), $matches ) ) {
|
370 |
$attributes = $matches[ 1 ];
|
371 |
$attrValues = $matches[ 2 ];
|
372 |
-
|
373 |
foreach ( $attributes as $attrIndex => $attrName ) {
|
374 |
$customAttributes[ $attrName ] = $attrValues[ $attrIndex ];
|
375 |
}
|
@@ -377,7 +390,7 @@ KAMAL;
|
|
377 |
}
|
378 |
return $customAttributes;
|
379 |
}
|
380 |
-
|
381 |
/**
|
382 |
* Method that parses and adds the "data-" prefix to the given custom shortcode attributes.
|
383 |
*
|
@@ -394,34 +407,34 @@ KAMAL;
|
|
394 |
$attributes = [
|
395 |
'class' => ["embedpress-wrapper ose-embedpress-responsive"],
|
396 |
];
|
397 |
-
|
398 |
$embedShouldBeResponsive = true;
|
399 |
$embedShouldHaveCustomDimensions = false;
|
400 |
if ( !empty( $customAttributes ) ) {
|
401 |
if ( isset( $customAttributes[ 'class' ] ) ) {
|
402 |
if ( !empty( $customAttributes[ 'class' ] ) ) {
|
403 |
$customAttributes[ 'class' ] = explode( ' ', $customAttributes[ 'class' ] );
|
404 |
-
|
405 |
$attributes[ 'class' ] = array_merge( $attributes[ 'class' ], $customAttributes[ 'class' ] );
|
406 |
}
|
407 |
-
|
408 |
unset( $customAttributes[ 'class' ] );
|
409 |
}
|
410 |
-
|
411 |
if ( isset( $customAttributes[ 'width' ] ) ) {
|
412 |
if ( !empty( $customAttributes[ 'width' ] ) ) {
|
413 |
$attributes[ 'width' ] = (int)$customAttributes[ 'width' ];
|
414 |
$embedShouldHaveCustomDimensions = true;
|
415 |
}
|
416 |
}
|
417 |
-
|
418 |
if ( isset( $customAttributes[ 'height' ] ) ) {
|
419 |
if ( !empty( $customAttributes[ 'height' ] ) ) {
|
420 |
$attributes[ 'height' ] = (int)$customAttributes[ 'height' ];
|
421 |
$embedShouldHaveCustomDimensions = true;
|
422 |
}
|
423 |
}
|
424 |
-
|
425 |
if ( !empty( $customAttributes ) ) {
|
426 |
$attrNameDefaultPrefix = "data-";
|
427 |
foreach ( $customAttributes as $attrName => $attrValue ) {
|
@@ -429,9 +442,9 @@ KAMAL;
|
|
429 |
$attrName = $attrValue;
|
430 |
$attrValue = "";
|
431 |
}
|
432 |
-
|
433 |
$attrName = str_replace( $attrNameDefaultPrefix, "", $attrName );
|
434 |
-
|
435 |
if ( !strlen( $attrValue ) ) {
|
436 |
if ( $attrName[ 0 ] === "!" ) {
|
437 |
$attrValue = "false";
|
@@ -440,11 +453,11 @@ KAMAL;
|
|
440 |
$attrValue = "true";
|
441 |
}
|
442 |
}
|
443 |
-
|
444 |
$attributes[ $attrNameDefaultPrefix . $attrName ] = $attrValue;
|
445 |
}
|
446 |
}
|
447 |
-
|
448 |
// Check if there's any "responsive" parameter
|
449 |
$responsiveAttributes = ["responsive", "data-responsive"];
|
450 |
foreach ( $responsiveAttributes as $responsiveAttr ) {
|
@@ -454,30 +467,30 @@ KAMAL;
|
|
454 |
} else {
|
455 |
$embedShouldBeResponsive = !self::valueIsFalse( $attributes[ $responsiveAttr ] );
|
456 |
}
|
457 |
-
|
458 |
break;
|
459 |
}
|
460 |
}
|
461 |
unset( $responsiveAttr, $responsiveAttributes );
|
462 |
}
|
463 |
-
|
464 |
$attributes[ 'class' ][] = 'ose-{provider_alias}';
|
465 |
-
|
466 |
if ( !empty( $content_uid ) ) {
|
467 |
$attributes[ 'class' ][] = 'ose-uid-' . $content_uid;
|
468 |
}
|
469 |
-
|
470 |
if ( $embedShouldBeResponsive && !$embedShouldHaveCustomDimensions ) {
|
471 |
$attributes[ 'class' ][] = 'responsive';
|
472 |
} else {
|
473 |
$attributes[ 'data-responsive' ] = "false";
|
474 |
}
|
475 |
-
|
476 |
$attributes[ 'class' ] = implode( ' ', array_unique( array_filter( $attributes[ 'class' ] ) ) );
|
477 |
if ( isset( $attributes[ 'width' ] ) ) {
|
478 |
$attributes[ 'style' ] = "width:{$attributes['width'] }px;height:{$attributes['height'] }px;";
|
479 |
}
|
480 |
-
|
481 |
return $attributes;
|
482 |
}
|
483 |
|
@@ -501,7 +514,7 @@ KAMAL;
|
|
501 |
protected static function get_embera_settings() {
|
502 |
return self::$emberaInstanceSettings;
|
503 |
}
|
504 |
-
|
505 |
/**
|
506 |
* Method that checks if a given value is/can be identified as (bool)false.
|
507 |
*
|
@@ -527,7 +540,7 @@ KAMAL;
|
|
527 |
return false;
|
528 |
}
|
529 |
}
|
530 |
-
|
531 |
/**
|
532 |
* Return the value from a header which is in an array resulted from a get_headers() call.
|
533 |
* If the header cannot be found, this method will return null instead.
|
@@ -543,17 +556,17 @@ KAMAL;
|
|
543 |
*/
|
544 |
private static function extractContentFromHeaderAsArray( $headerPattern, $headersList ) {
|
545 |
$headerValue = null;
|
546 |
-
|
547 |
foreach ( $headersList as $header ) {
|
548 |
if ( preg_match( $headerPattern, $header, $matches ) ) {
|
549 |
$headerValue = $matches[ 1 ];
|
550 |
break;
|
551 |
}
|
552 |
}
|
553 |
-
|
554 |
return $headerValue;
|
555 |
}
|
556 |
-
|
557 |
/**
|
558 |
* Sanitize the object returned by the embed source. Sometimes we need to convert
|
559 |
* attributes from "dash" separated to "underline" separated to be able to access
|
@@ -570,11 +583,11 @@ KAMAL;
|
|
570 |
private static function sanitizeUrlData( $data ) {
|
571 |
if ( is_object( $data ) ) {
|
572 |
$attributes = get_object_vars( $data );
|
573 |
-
|
574 |
foreach ( $attributes as $key => $value ) {
|
575 |
if ( substr_count( $key, '-' ) ) {
|
576 |
unset( $data->$key );
|
577 |
-
|
578 |
$key = str_replace( '-', '_', $key );
|
579 |
$data->$key = $value;
|
580 |
}
|
@@ -583,13 +596,13 @@ KAMAL;
|
|
583 |
foreach ( $data as $key => $value ) {
|
584 |
if ( substr_count( $key, '-' ) ) {
|
585 |
unset( $data[ $key ] );
|
586 |
-
|
587 |
$key = str_replace( '-', '_', $key );
|
588 |
$data[ $key ] = $value;
|
589 |
}
|
590 |
}
|
591 |
}
|
592 |
-
|
593 |
return $data;
|
594 |
}
|
595 |
|
67 |
add_shortcode( 'embed_oembed_html', ['\\EmbedPress\\Shortcode', 'do_shortcode'] );
|
68 |
add_shortcode( 'embedpress', ['\\EmbedPress\\Shortcode', 'do_shortcode'] );
|
69 |
}
|
70 |
+
|
71 |
/**
|
72 |
* Method that converts the plugin shortcoded-string into its complex content.
|
73 |
*
|
79 |
* @static
|
80 |
*
|
81 |
*/
|
82 |
+
|
83 |
public static function do_shortcode( $attributes = [], $subject = null ) {
|
84 |
$plgSettings = Core::getSettings();
|
85 |
$default = [];
|
112 |
self::set_default_size( $customAttributes);
|
113 |
$url = preg_replace( '/(\[' . EMBEDPRESS_SHORTCODE . '(?:\]|.+?\])|\[\/' . EMBEDPRESS_SHORTCODE . '\])/i',
|
114 |
"", $subject );
|
115 |
+
|
116 |
// Converts any special HTML entities back to characters.
|
117 |
$url = htmlspecialchars_decode( $url );
|
118 |
$content_uid = md5( $url );
|
152 |
if ( empty( $embedResults ) ) {
|
153 |
return $subject;
|
154 |
}
|
155 |
+
|
156 |
// Transform all shortcode attributes into html form. I.e.: {foo: "joe"} -> foo="joe"
|
157 |
$attributesHtml = ['class="ose-{provider_alias} ose-uid-' . $content_uid.' ose-embedpress-responsive"'];
|
158 |
//$attributesHtml = [];
|
172 |
// Replace all single quotes to double quotes. I.e: foo='joe' -> foo="joe"
|
173 |
$parsedContent = str_replace( "'", '"', $parsedContent );
|
174 |
$parsedContent = str_replace( "{provider_alias}", $provider_name , $parsedContent );
|
175 |
+
$parsedContent = str_replace( 'sandbox="allow-scripts"', 'sandbox="allow-scripts allow-same-origin"', $parsedContent );
|
176 |
|
177 |
self::purify_html_content( $parsedContent);
|
178 |
self::modify_content_for_fb_and_canada( $provider_name, $parsedContent);
|
187 |
if ( preg_match( '~width="(\d+)"|width\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
188 |
$iframeWidth = (int)$matches[ 1 ];
|
189 |
}
|
190 |
+
|
191 |
if ( preg_match( '~height="(\d+)"|height\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
192 |
$iframeHeight = (int)$matches[ 1 ];
|
193 |
}
|
194 |
+
|
195 |
if ( isset( $iframeWidth ) && isset( $iframeHeight ) && $iframeWidth > 0 && $iframeHeight > 0 ) {
|
196 |
$iframeRatio = ceil( $iframeWidth / $iframeHeight );
|
197 |
+
|
198 |
if ( isset( self::$emberaInstanceSettings[ 'maxwidth' ] ) ) {
|
199 |
$customWidth = (int)self::$emberaInstanceSettings[ 'maxwidth' ];
|
200 |
$customHeight = ceil( $customWidth / $iframeRatio );
|
214 |
$parsedContent = preg_replace( '~width="({.+})"~i', 'width="' . $customWidth . '"',
|
215 |
$parsedContent );
|
216 |
}
|
217 |
+
|
218 |
if ( preg_match( '~height="(\d+)"~i', $parsedContent ) ) {
|
219 |
$parsedContent = preg_replace( '~height="(\d+)"~i', 'height="' . $customHeight . '"',
|
220 |
$parsedContent );
|
222 |
$parsedContent = preg_replace( '~height="({.+})"~i', 'height="' . $customHeight . '"',
|
223 |
$parsedContent );
|
224 |
}
|
225 |
+
|
226 |
if ( preg_match( '~width\s+:\s+(\d+)~i', $parsedContent ) ) {
|
227 |
$parsedContent = preg_replace( '~width\s+:\s+(\d+)~i', 'width: ' . $customWidth,
|
228 |
$parsedContent );
|
229 |
}
|
230 |
+
|
231 |
if ( preg_match( '~height\s+:\s+(\d+)~i', $parsedContent ) ) {
|
232 |
$parsedContent = preg_replace( '~height\s+:\s+(\d+)~i', 'height: ' . $customHeight,
|
233 |
$parsedContent );
|
234 |
}
|
235 |
+
if ( 'gfycat' === $provider_name && preg_match( '~height\s*:\s*auto\s*;~i', $parsedContent ) ){
|
236 |
+
$parsedContent = preg_replace( '~height\s*:\s*auto\s*~i', 'height: ' . $customHeight . 'px',
|
237 |
+
$parsedContent );
|
238 |
+
$parsedContent = preg_replace( '~style="position:relative;padding-bottom(.+?)"~i', '',
|
239 |
+
$parsedContent );
|
240 |
+
$styles = "<style>
|
241 |
+
.ose-gfycat.ose-embedpress-responsive{
|
242 |
+
position: relative;
|
243 |
+
}
|
244 |
+
</style>";
|
245 |
+
$parsedContent = $styles . $parsedContent;
|
246 |
+
}
|
247 |
}
|
248 |
}
|
249 |
|
262 |
$styles = str_replace( ['{height}', '{width}'], [$customAttributes['height'], $customAttributes['width']], $styles);
|
263 |
$parsedContent = $styles.$parsedContent;
|
264 |
}
|
265 |
+
|
266 |
if ( $stripNewLine ) {
|
267 |
$parsedContent = preg_replace( '/\n/', '', $parsedContent );
|
268 |
}
|
281 |
return $embed;
|
282 |
}
|
283 |
}
|
284 |
+
|
285 |
return $subject;
|
286 |
}
|
287 |
|
365 |
return false;
|
366 |
}
|
367 |
}
|
368 |
+
|
369 |
/**
|
370 |
* Method that retrieves all custom parameters from a shortcoded string.
|
371 |
*
|
382 |
if ( preg_match_all( '/(\!?\w+-?\w*)(?:="(.+?)")?/i', stripslashes( $m[ 1 ] ), $matches ) ) {
|
383 |
$attributes = $matches[ 1 ];
|
384 |
$attrValues = $matches[ 2 ];
|
385 |
+
|
386 |
foreach ( $attributes as $attrIndex => $attrName ) {
|
387 |
$customAttributes[ $attrName ] = $attrValues[ $attrIndex ];
|
388 |
}
|
390 |
}
|
391 |
return $customAttributes;
|
392 |
}
|
393 |
+
|
394 |
/**
|
395 |
* Method that parses and adds the "data-" prefix to the given custom shortcode attributes.
|
396 |
*
|
407 |
$attributes = [
|
408 |
'class' => ["embedpress-wrapper ose-embedpress-responsive"],
|
409 |
];
|
410 |
+
|
411 |
$embedShouldBeResponsive = true;
|
412 |
$embedShouldHaveCustomDimensions = false;
|
413 |
if ( !empty( $customAttributes ) ) {
|
414 |
if ( isset( $customAttributes[ 'class' ] ) ) {
|
415 |
if ( !empty( $customAttributes[ 'class' ] ) ) {
|
416 |
$customAttributes[ 'class' ] = explode( ' ', $customAttributes[ 'class' ] );
|
417 |
+
|
418 |
$attributes[ 'class' ] = array_merge( $attributes[ 'class' ], $customAttributes[ 'class' ] );
|
419 |
}
|
420 |
+
|
421 |
unset( $customAttributes[ 'class' ] );
|
422 |
}
|
423 |
+
|
424 |
if ( isset( $customAttributes[ 'width' ] ) ) {
|
425 |
if ( !empty( $customAttributes[ 'width' ] ) ) {
|
426 |
$attributes[ 'width' ] = (int)$customAttributes[ 'width' ];
|
427 |
$embedShouldHaveCustomDimensions = true;
|
428 |
}
|
429 |
}
|
430 |
+
|
431 |
if ( isset( $customAttributes[ 'height' ] ) ) {
|
432 |
if ( !empty( $customAttributes[ 'height' ] ) ) {
|
433 |
$attributes[ 'height' ] = (int)$customAttributes[ 'height' ];
|
434 |
$embedShouldHaveCustomDimensions = true;
|
435 |
}
|
436 |
}
|
437 |
+
|
438 |
if ( !empty( $customAttributes ) ) {
|
439 |
$attrNameDefaultPrefix = "data-";
|
440 |
foreach ( $customAttributes as $attrName => $attrValue ) {
|
442 |
$attrName = $attrValue;
|
443 |
$attrValue = "";
|
444 |
}
|
445 |
+
|
446 |
$attrName = str_replace( $attrNameDefaultPrefix, "", $attrName );
|
447 |
+
|
448 |
if ( !strlen( $attrValue ) ) {
|
449 |
if ( $attrName[ 0 ] === "!" ) {
|
450 |
$attrValue = "false";
|
453 |
$attrValue = "true";
|
454 |
}
|
455 |
}
|
456 |
+
|
457 |
$attributes[ $attrNameDefaultPrefix . $attrName ] = $attrValue;
|
458 |
}
|
459 |
}
|
460 |
+
|
461 |
// Check if there's any "responsive" parameter
|
462 |
$responsiveAttributes = ["responsive", "data-responsive"];
|
463 |
foreach ( $responsiveAttributes as $responsiveAttr ) {
|
467 |
} else {
|
468 |
$embedShouldBeResponsive = !self::valueIsFalse( $attributes[ $responsiveAttr ] );
|
469 |
}
|
470 |
+
|
471 |
break;
|
472 |
}
|
473 |
}
|
474 |
unset( $responsiveAttr, $responsiveAttributes );
|
475 |
}
|
476 |
+
|
477 |
$attributes[ 'class' ][] = 'ose-{provider_alias}';
|
478 |
+
|
479 |
if ( !empty( $content_uid ) ) {
|
480 |
$attributes[ 'class' ][] = 'ose-uid-' . $content_uid;
|
481 |
}
|
482 |
+
|
483 |
if ( $embedShouldBeResponsive && !$embedShouldHaveCustomDimensions ) {
|
484 |
$attributes[ 'class' ][] = 'responsive';
|
485 |
} else {
|
486 |
$attributes[ 'data-responsive' ] = "false";
|
487 |
}
|
488 |
+
|
489 |
$attributes[ 'class' ] = implode( ' ', array_unique( array_filter( $attributes[ 'class' ] ) ) );
|
490 |
if ( isset( $attributes[ 'width' ] ) ) {
|
491 |
$attributes[ 'style' ] = "width:{$attributes['width'] }px;height:{$attributes['height'] }px;";
|
492 |
}
|
493 |
+
|
494 |
return $attributes;
|
495 |
}
|
496 |
|
514 |
protected static function get_embera_settings() {
|
515 |
return self::$emberaInstanceSettings;
|
516 |
}
|
517 |
+
|
518 |
/**
|
519 |
* Method that checks if a given value is/can be identified as (bool)false.
|
520 |
*
|
540 |
return false;
|
541 |
}
|
542 |
}
|
543 |
+
|
544 |
/**
|
545 |
* Return the value from a header which is in an array resulted from a get_headers() call.
|
546 |
* If the header cannot be found, this method will return null instead.
|
556 |
*/
|
557 |
private static function extractContentFromHeaderAsArray( $headerPattern, $headersList ) {
|
558 |
$headerValue = null;
|
559 |
+
|
560 |
foreach ( $headersList as $header ) {
|
561 |
if ( preg_match( $headerPattern, $header, $matches ) ) {
|
562 |
$headerValue = $matches[ 1 ];
|
563 |
break;
|
564 |
}
|
565 |
}
|
566 |
+
|
567 |
return $headerValue;
|
568 |
}
|
569 |
+
|
570 |
/**
|
571 |
* Sanitize the object returned by the embed source. Sometimes we need to convert
|
572 |
* attributes from "dash" separated to "underline" separated to be able to access
|
583 |
private static function sanitizeUrlData( $data ) {
|
584 |
if ( is_object( $data ) ) {
|
585 |
$attributes = get_object_vars( $data );
|
586 |
+
|
587 |
foreach ( $attributes as $key => $value ) {
|
588 |
if ( substr_count( $key, '-' ) ) {
|
589 |
unset( $data->$key );
|
590 |
+
|
591 |
$key = str_replace( '-', '_', $key );
|
592 |
$data->$key = $value;
|
593 |
}
|
596 |
foreach ( $data as $key => $value ) {
|
597 |
if ( substr_count( $key, '-' ) ) {
|
598 |
unset( $data[ $key ] );
|
599 |
+
|
600 |
$key = str_replace( '-', '_', $key );
|
601 |
$data[ $key ] = $value;
|
602 |
}
|
603 |
}
|
604 |
}
|
605 |
+
|
606 |
return $data;
|
607 |
}
|
608 |
|
embedpress.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.com
|
8 |
-
* Version: 3.3.
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.com
|
8 |
+
* Version: 3.3.6
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
includes.php
CHANGED
@@ -22,7 +22,7 @@ if ( ! defined('EMBEDPRESS_PLG_NAME')) {
|
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
-
define('EMBEDPRESS_VERSION', "3.3.
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
+
define('EMBEDPRESS_VERSION', "3.3.6");
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
readme.txt
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
=== EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor ===
|
2 |
-
Contributors: EmbedPress, asif2bd, re_enter_rupok, wpdevteam, manzurahammed,
|
3 |
Author: WPDeveloper
|
4 |
Author URI: https://wpdeveloper.com
|
5 |
Tags: embed, embed youtube, gutenberg embed, pdf, doc, docs, ppt, elementor embed, video embed, Google Doc, map embed, youTube Embed, content embed, iframes, vimeo embed, wistia, google sheet, youtube player, block editor, embed wordpress, elementor, WPML, Meetup, Boomplay, PDF Logo
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.9
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 3.3.
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
@@ -382,10 +382,18 @@ Not at all. You can set up everything your team needs without any coding knowled
|
|
382 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
383 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
= [3.3.5] - 2022-03-01 =
|
386 |
* Fixed: Microsoft Sway embedding issues.
|
387 |
* Fixed: Unnecessary jquery calling issues.
|
388 |
-
* Improvement: Added notice for apple podcasts embed.
|
389 |
* Few minor bug fix and improvements.
|
390 |
|
391 |
= [3.3.4] - 2022-02-14 =
|
1 |
=== EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor ===
|
2 |
+
Contributors: EmbedPress, asif2bd, re_enter_rupok, wpdevteam, manzurahammed, alimuzzamanalim
|
3 |
Author: WPDeveloper
|
4 |
Author URI: https://wpdeveloper.com
|
5 |
Tags: embed, embed youtube, gutenberg embed, pdf, doc, docs, ppt, elementor embed, video embed, Google Doc, map embed, youTube Embed, content embed, iframes, vimeo embed, wistia, google sheet, youtube player, block editor, embed wordpress, elementor, WPML, Meetup, Boomplay, PDF Logo
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 5.9
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 3.3.6
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
382 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
383 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
384 |
|
385 |
+
= [3.3.6] - 2022-03-27 =
|
386 |
+
* Fixed: Coub videos embedding.
|
387 |
+
* Fixed: Matterport embedding.
|
388 |
+
* Fixed: Gfycat height width control.
|
389 |
+
* Fixed: Elementor deprecation issue.
|
390 |
+
* Improvement: EmbedPress document embedding.
|
391 |
+
* Few minor bug fix and improvements.
|
392 |
+
|
393 |
= [3.3.5] - 2022-03-01 =
|
394 |
* Fixed: Microsoft Sway embedding issues.
|
395 |
* Fixed: Unnecessary jquery calling issues.
|
396 |
+
* Improvement: Added notice for apple podcasts embed.
|
397 |
* Few minor bug fix and improvements.
|
398 |
|
399 |
= [3.3.4] - 2022-02-14 =
|