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 | 2.7.3 |
Comparing to | |
See all releases |
Code changes from version 2.7.2 to 2.7.3
- EmbedPress/Ends/Back/Settings.php +43 -446
- EmbedPress/Providers/Giphy.php +4 -4
- EmbedPress/Providers/GoogleDocs.php +7 -2
- EmbedPress/Providers/GoogleMaps.php +3 -2
- EmbedPress/Providers/Twitch.php +5 -2
- EmbedPress/Shortcode.php +259 -251
- EmbedPress/simple_html_dom.php +2398 -0
- Gutenberg/dist/blocks.build.js +1 -1
- Gutenberg/dist/blocks.editor.build.css +1 -1
- Gutenberg/dist/blocks.style.build.css +1 -1
- Gutenberg/src/blocks.js +0 -44
- Gutenberg/src/common.scss +0 -13
- Gutenberg/src/common/Iframe.js +0 -31
- Gutenberg/src/common/core-embeds.js +0 -25
- Gutenberg/src/common/embed-controls.js +0 -33
- Gutenberg/src/common/embed-loading.js +0 -14
- Gutenberg/src/common/embed-placeholder.js +0 -49
- Gutenberg/src/common/embed-wrap.js +0 -28
- Gutenberg/src/common/icons.js +0 -211
- Gutenberg/src/document/edit.js +0 -235
- Gutenberg/src/document/editor.scss +0 -11
- Gutenberg/src/document/index.js +0 -109
- Gutenberg/src/document/style.scss +0 -29
- Gutenberg/src/embedpress/edit.js +0 -115
- Gutenberg/src/embedpress/editor.scss +0 -10
- Gutenberg/src/embedpress/index.js +0 -100
- Gutenberg/src/embedpress/index.php +0 -21
- Gutenberg/src/embedpress/style.scss +0 -9
- Gutenberg/src/google-docs/edit.js +0 -161
- Gutenberg/src/google-docs/editor.scss +0 -6
- Gutenberg/src/google-docs/index.js +0 -110
- Gutenberg/src/google-docs/style.scss +0 -5
- Gutenberg/src/google-drawings/edit.js +0 -116
- Gutenberg/src/google-drawings/editor.scss +0 -6
- Gutenberg/src/google-drawings/index.js +0 -78
- Gutenberg/src/google-drawings/style.scss +0 -5
- Gutenberg/src/google-forms/edit.js +0 -142
- Gutenberg/src/google-forms/editor.scss +0 -6
- Gutenberg/src/google-forms/index.js +0 -79
- Gutenberg/src/google-forms/style.scss +0 -5
- Gutenberg/src/google-maps/edit.js +0 -144
- Gutenberg/src/google-maps/editor.scss +0 -6
- Gutenberg/src/google-maps/index.js +0 -78
- Gutenberg/src/google-maps/style.scss +0 -5
- Gutenberg/src/google-sheets/edit.js +0 -165
- Gutenberg/src/google-sheets/editor.scss +0 -6
- Gutenberg/src/google-sheets/index.js +0 -102
- Gutenberg/src/google-sheets/style.scss +0 -5
- Gutenberg/src/google-slides/edit.js +0 -142
- Gutenberg/src/google-slides/editor.scss +0 -6
- Gutenberg/src/google-slides/index.js +0 -77
- Gutenberg/src/google-slides/style.scss +0 -6
- Gutenberg/src/init.php +0 -130
- Gutenberg/src/twitch/edit.js +0 -187
- Gutenberg/src/twitch/editor.scss +0 -6
- Gutenberg/src/twitch/index.js +0 -82
- Gutenberg/src/twitch/style.scss +0 -5
- Gutenberg/src/wistia/edit.js +0 -168
- Gutenberg/src/wistia/editor.scss +0 -7
- Gutenberg/src/wistia/index.js +0 -77
- Gutenberg/src/wistia/index.php +0 -54
- Gutenberg/src/wistia/style.scss +0 -6
- Gutenberg/src/youtube/edit.js +0 -155
- Gutenberg/src/youtube/editor.scss +0 -0
- Gutenberg/src/youtube/index.js +0 -60
- Gutenberg/src/youtube/index.php +0 -66
- Gutenberg/src/youtube/style.scss +0 -0
- assets/js/preview.js +9 -7
- embedpress.php +1 -1
- includes.php +2 -2
- readme.txt +11 -2
- vendor/autoload.php +1 -1
- vendor/composer/ClassLoader.php +3 -3
- vendor/composer/InstalledVersions.php +228 -0
- vendor/composer/autoload_classmap.php +1 -0
- vendor/composer/autoload_real.php +7 -5
- vendor/composer/autoload_static.php +8 -3
- vendor/composer/installed.json +71 -66
- vendor/composer/installed.php +33 -0
- vendor/composer/platform_check.php +26 -0
EmbedPress/Ends/Back/Settings.php
CHANGED
@@ -2,8 +2,6 @@
|
|
2 |
|
3 |
namespace EmbedPress\Ends\Back;
|
4 |
|
5 |
-
use EmbedPress\Compatibility;
|
6 |
-
|
7 |
(defined( 'ABSPATH' ) && defined( 'EMBEDPRESS_IS_LOADED' )) or die( "No direct script access allowed." );
|
8 |
|
9 |
/**
|
@@ -84,7 +82,7 @@ class Settings {
|
|
84 |
* @static
|
85 |
*/
|
86 |
public static function registerMenuItem() {
|
87 |
-
add_menu_page( 'EmbedPress Settings', 'EmbedPress', 'manage_options', 'embedpress',
|
88 |
[ self::$namespace, 'renderForm' ], null, 64 );
|
89 |
}
|
90 |
|
@@ -96,73 +94,12 @@ class Settings {
|
|
96 |
*/
|
97 |
public static function registerActions() {
|
98 |
$activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
|
99 |
-
|
100 |
-
|
101 |
-
} else {
|
102 |
-
$activeTab = "";
|
103 |
-
}
|
104 |
-
|
105 |
-
if ( !empty( $activeTab ) && has_action( $action ) ) {
|
106 |
do_action( $action, [
|
107 |
'id' => self::$sectionAdminIdentifier,
|
108 |
'slug' => self::$identifier,
|
109 |
] );
|
110 |
-
} else {
|
111 |
-
register_setting( self::$sectionGroupIdentifier, self::$sectionGroupIdentifier,
|
112 |
-
[ self::$namespace, "validateForm" ] );
|
113 |
-
|
114 |
-
add_settings_section( self::$sectionAdminIdentifier, '', null, self::$identifier );
|
115 |
-
|
116 |
-
$fieldMap = [];
|
117 |
-
if ( !Compatibility::isWordPress5() || Compatibility::isClassicalEditorActive() ) {
|
118 |
-
$fieldMap = [
|
119 |
-
'enablePluginInAdmin' => [
|
120 |
-
'label' => "Load previews in the admin editor",
|
121 |
-
'section' => "admin",
|
122 |
-
],
|
123 |
-
'enablePluginInFront' => [
|
124 |
-
'label' => "Load previews in the frontend editor",
|
125 |
-
'section' => "admin",
|
126 |
-
],
|
127 |
-
'enableGlobalEmbedResize' => [
|
128 |
-
'label' => "Enable Global Embed Dimension",
|
129 |
-
'section' => "admin",
|
130 |
-
],
|
131 |
-
'enableEmbedResizeWidth' => [
|
132 |
-
'label' => "Embed Iframe Width",
|
133 |
-
'section' => "admin",
|
134 |
-
],
|
135 |
-
'enableEmbedResizeHeight' => [
|
136 |
-
'label' => "Embed Iframe Height",
|
137 |
-
'section' => "admin",
|
138 |
-
]
|
139 |
-
];
|
140 |
-
}
|
141 |
-
|
142 |
-
$fieldMap['heading_settings'] = [
|
143 |
-
'label' => " ",
|
144 |
-
'section' => "admin",
|
145 |
-
];
|
146 |
-
|
147 |
-
$fieldMap['facebook_app_code'] = [
|
148 |
-
'label' => "App Code",
|
149 |
-
'section' => "admin",
|
150 |
-
];
|
151 |
-
|
152 |
-
$fieldMap['facebook_app_secret'] = [
|
153 |
-
'label' => "App Secret",
|
154 |
-
'section' => "admin",
|
155 |
-
];
|
156 |
-
|
157 |
-
$fieldMap['forceFacebookLanguage'] = [
|
158 |
-
'label' => "Facebook embed language",
|
159 |
-
'section' => "admin",
|
160 |
-
];
|
161 |
-
|
162 |
-
foreach ( $fieldMap as $fieldName => $field ) {
|
163 |
-
add_settings_field( $fieldName, $field['label'], [ self::$namespace, "renderField_{$fieldName}" ],
|
164 |
-
self::$identifier, self::${"section" . ucfirst( $field['section'] ) . "Identifier"} );
|
165 |
-
}
|
166 |
}
|
167 |
}
|
168 |
|
@@ -189,7 +126,7 @@ class Settings {
|
|
189 |
}
|
190 |
|
191 |
/**
|
192 |
-
* Method that render the settings
|
193 |
*
|
194 |
* @since 1.0.0
|
195 |
* @static
|
@@ -202,8 +139,17 @@ class Settings {
|
|
202 |
EMBEDPRESS_VERSION, true );
|
203 |
|
204 |
$activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
|
|
|
|
|
205 |
$settingsFieldsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$sectionGroupIdentifier;
|
206 |
$settingsSectionsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$identifier;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
207 |
?>
|
208 |
<div id="embedpress-settings-wrapper">
|
209 |
<header>
|
@@ -214,10 +160,9 @@ class Settings {
|
|
214 |
</a>
|
215 |
</h1>
|
216 |
<div class="embedpress-version-name">
|
217 |
-
<span class="free">Core Version:
|
218 |
-
|
219 |
<?php if ( defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ) { ?>
|
220 |
-
<span class="pro"> Pro Version:
|
221 |
<?php } ?>
|
222 |
</div>
|
223 |
</header>
|
@@ -225,14 +170,10 @@ class Settings {
|
|
225 |
<?php settings_errors(); ?>
|
226 |
<div>
|
227 |
<h2 class="nav-tab-wrapper">
|
228 |
-
<a href="?page=embedpress"
|
229 |
-
class="nav-tab<?php echo $activeTab === 'embedpress' || empty( $activeTab ) ? ' nav-tab-active' : ''; ?> ">
|
230 |
-
General settings
|
231 |
-
</a>
|
232 |
<?php if ( !defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ): ?>
|
233 |
<a href="?page=embedpress&tab=embedpress_get_pro"
|
234 |
-
class="nav-tab<?php echo $
|
235 |
-
|
236 |
</a>
|
237 |
<?php endif; ?>
|
238 |
<?php do_action( 'embedpress:settings:render:tab', $activeTab ); ?>
|
@@ -243,16 +184,18 @@ class Settings {
|
|
243 |
<form action="options.php" method="POST" style="padding-bottom: 20px;">
|
244 |
<?php settings_fields( $settingsFieldsIdentifier ); ?>
|
245 |
<?php do_settings_sections( $settingsSectionsIdentifier ); ?>
|
246 |
-
<?php if (
|
247 |
-
|
248 |
-
|
249 |
-
|
|
|
|
|
250 |
</form>
|
251 |
<?php endif; ?>
|
252 |
-
<?php if ( $
|
253 |
-
<?php
|
254 |
<?php endif; ?>
|
255 |
-
<?php if ( $
|
256 |
<div class=" embedpress-go-premium">
|
257 |
<div class="embedpress-col-half">
|
258 |
<div class="embedpress-admin-block-wrapper">
|
@@ -262,14 +205,14 @@ class Settings {
|
|
262 |
<img src="<?php echo plugins_url( 'assets/images/icon-why-premium.svg',
|
263 |
EMBEDPRESS_PLUGIN_BASENAME ); ?>" alt="embedpress-go-pro">
|
264 |
</div>
|
265 |
-
<h4 class="embedpress-admin-title"
|
266 |
</header>
|
267 |
<div class="embedpress-admin-block-content">
|
268 |
-
<p
|
269 |
-
incorporating even more features and enhancements
|
270 |
-
<p
|
271 |
<a href="https://wpdeveloper.net/plugins/embedpress#pricing" target="_blank"
|
272 |
-
class="button embedpress-btn"
|
273 |
</div>
|
274 |
</div>
|
275 |
</div><!--admin block-wrapper end-->
|
@@ -281,35 +224,35 @@ class Settings {
|
|
281 |
<footer>
|
282 |
<p>
|
283 |
<a href="//embedpress.com/go/review-ep" target="_blank"
|
284 |
-
rel="noopener noreferrer">
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
</p>
|
291 |
<hr>
|
292 |
<nav>
|
293 |
<ul>
|
294 |
<li>
|
295 |
<a href="//embedpress.com" target="_blank" rel="noopener noreferrer"
|
296 |
-
title="About EmbedPress"
|
297 |
</li>
|
298 |
<li>
|
299 |
<a href="//embedpress.com/sources/" target="_blank" rel="noopener noreferrer"
|
300 |
-
title="List of supported sources by EmbedPress"
|
301 |
</li>
|
302 |
<li>
|
303 |
<a href="//embedpress.com/documentation/" target="_blank" rel="noopener noreferrer"
|
304 |
-
title="EmbedPress Documentation"
|
305 |
</li>
|
306 |
<li>
|
307 |
<a href="//embedpress.com/#pricing" target="_blank" rel="noopener noreferrer"
|
308 |
-
title="Get EmbedPress Pro"
|
309 |
</li>
|
310 |
<li>
|
311 |
<a href="//embedpress.com/support/" target="_blank" rel="noopener noreferrer"
|
312 |
-
title="Contact the EmbedPress team"
|
313 |
</li>
|
314 |
<li>
|
315 |
<a href="//twitter.com/wpdevteam" target="_blank" rel="noopener noreferrer">
|
@@ -325,7 +268,7 @@ class Settings {
|
|
325 |
</nav>
|
326 |
<p>
|
327 |
<a href="//embedpress.com" target="_blank" rel="noopener noreferrer">
|
328 |
-
<img width="100" src="<?php echo plugins_url( 'assets/images/embedpress.png',
|
329 |
EMBEDPRESS_PLUGIN_BASENAME ); ?>">
|
330 |
</a>
|
331 |
</p>
|
@@ -333,350 +276,4 @@ class Settings {
|
|
333 |
</div>
|
334 |
<?php
|
335 |
}
|
336 |
-
|
337 |
-
/**
|
338 |
-
* Method that validates the form data.
|
339 |
-
*
|
340 |
-
* @param mixed $freshData Data received from the form.
|
341 |
-
*
|
342 |
-
* @return array
|
343 |
-
* @since 1.0.0
|
344 |
-
* @static
|
345 |
-
*
|
346 |
-
*/
|
347 |
-
public static function validateForm( $freshData ) {
|
348 |
-
$data = [
|
349 |
-
'enablePluginInAdmin' => isset( $freshData['enablePluginInAdmin'] ) ? (bool)$freshData['enablePluginInAdmin'] : true,
|
350 |
-
'enablePluginInFront' => isset( $freshData['enablePluginInFront'] ) ? (bool)$freshData['enablePluginInFront'] : true,
|
351 |
-
'enableGlobalEmbedResize' => isset( $freshData['enableGlobalEmbedResize'] ) ? (bool)$freshData['enableGlobalEmbedResize'] : false,
|
352 |
-
'enableEmbedResizeHeight' => isset( $freshData['enableEmbedResizeHeight'] ) ? $freshData['enableEmbedResizeHeight'] : 552,
|
353 |
-
'enableEmbedResizeWidth' => isset( $freshData['enableEmbedResizeWidth'] ) ? $freshData['enableEmbedResizeWidth'] : 652,
|
354 |
-
'facebook_app_code' => isset( $freshData['facebook_app_code'] ) ? $freshData['facebook_app_code'] : 652,
|
355 |
-
'facebook_app_secret' => isset( $freshData['facebook_app_secret'] ) ? $freshData['facebook_app_secret'] : 652,
|
356 |
-
'fbLanguage' => $freshData['fbLanguage'],
|
357 |
-
];
|
358 |
-
|
359 |
-
return $data;
|
360 |
-
}
|
361 |
-
|
362 |
-
/**
|
363 |
-
* Method that renders the enablePluginInAdmin input.
|
364 |
-
*
|
365 |
-
* @since 1.0.0
|
366 |
-
* @static
|
367 |
-
*/
|
368 |
-
public static function renderField_enablePluginInAdmin() {
|
369 |
-
$fieldName = "enablePluginInAdmin";
|
370 |
-
|
371 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
372 |
-
|
373 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? true : (bool)$options[$fieldName];
|
374 |
-
|
375 |
-
echo '<label><input type="radio" id="' . $fieldName . '_0" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="0" ' . (!$options[$fieldName] ? "checked" : "") . ' /> No</label>';
|
376 |
-
echo " ";
|
377 |
-
echo '<label><input type="radio" id="' . $fieldName . '_1" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="1" ' . ($options[$fieldName] ? "checked" : "") . ' /> Yes</label>';
|
378 |
-
echo '<p class="description">Do you want EmbedPress to run here in the admin area? Disabling this <strong>will not</strong> affect your frontend embeds.</p>';
|
379 |
-
}
|
380 |
-
|
381 |
-
/**
|
382 |
-
* Method that renders the enablePluginInFront input.
|
383 |
-
*
|
384 |
-
* @since 1.6.0
|
385 |
-
* @static
|
386 |
-
*/
|
387 |
-
public static function renderField_enablePluginInFront() {
|
388 |
-
$fieldName = "enablePluginInFront";
|
389 |
-
|
390 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
391 |
-
|
392 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? true : (bool)$options[$fieldName];
|
393 |
-
|
394 |
-
echo '<label><input type="radio" id="' . $fieldName . '_0" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="0" ' . (!$options[$fieldName] ? "checked" : "") . ' /> No</label>';
|
395 |
-
echo " ";
|
396 |
-
echo '<label><input type="radio" id="' . $fieldName . '_1" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="1" ' . ($options[$fieldName] ? "checked" : "") . ' /> Yes</label>';
|
397 |
-
echo '<p class="description">Do you want EmbedPress to run within editors in frontend (if there\'s any)? Disabling this <strong>will not</strong> affect embeds seem by your regular users in frontend.</p>';
|
398 |
-
}
|
399 |
-
|
400 |
-
/**
|
401 |
-
* Method that renders the enablePluginInAdmin input.
|
402 |
-
*
|
403 |
-
* @since 2.4.1
|
404 |
-
* @static
|
405 |
-
*/
|
406 |
-
public static function renderField_enableGlobalEmbedResize() {
|
407 |
-
$fieldName = "enableGlobalEmbedResize";
|
408 |
-
|
409 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
410 |
-
|
411 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? false : (bool)$options[$fieldName];
|
412 |
-
|
413 |
-
echo '<label><input class="enableglobalembedresize" type="radio" id="' . $fieldName . '_0" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="0" ' . (!$options[$fieldName] ? "checked" : "") . ' /> No</label>';
|
414 |
-
echo " ";
|
415 |
-
echo '<label><input class="enableglobalembedresize" type="radio" id="' . $fieldName . '_1" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']" value="1" ' . ($options[$fieldName] ? "checked" : "") . ' /> Yes</label>';
|
416 |
-
echo '<p class="description">Do you want use global embed dimension, Disabling this <strong>will not</strong> affect embeds.</p>';
|
417 |
-
}
|
418 |
-
|
419 |
-
/**
|
420 |
-
* Method that renders the enableEmbedResizeHeight input.
|
421 |
-
*
|
422 |
-
* @since 2.4.0
|
423 |
-
* @static
|
424 |
-
*/
|
425 |
-
public static function renderField_enableEmbedResizeHeight() {
|
426 |
-
$fieldName = "enableEmbedResizeHeight";
|
427 |
-
|
428 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
429 |
-
|
430 |
-
$value = !isset( $options[$fieldName] ) ? '552' : $options[$fieldName];
|
431 |
-
|
432 |
-
echo '<span class="embedpress-allow-globla-dimension"><input type="number" value="' . absint( $value ) . '" class="regular-text" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']">';
|
433 |
-
|
434 |
-
echo '<p class="description">Global Embed Iframe Height</p></span>';
|
435 |
-
}
|
436 |
-
|
437 |
-
/**
|
438 |
-
* Method that renders the enableEmbedResizeWidth input.
|
439 |
-
*
|
440 |
-
* @since 2.4.0
|
441 |
-
* @static
|
442 |
-
*/
|
443 |
-
public static function renderField_enableEmbedResizeWidth() {
|
444 |
-
$fieldName = "enableEmbedResizeWidth";
|
445 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
446 |
-
$value = !isset( $options[$fieldName] ) ? '652' : $options[$fieldName];
|
447 |
-
|
448 |
-
echo '<span class="embedpress-allow-globla-dimension"><input type="number" value="' . absint( $value ) . '" class="regular-text" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']">';
|
449 |
-
echo '<p class="description">Global Embed Iframe Width </p></span>';
|
450 |
-
}
|
451 |
-
|
452 |
-
/**
|
453 |
-
* Method that renders the forceFacebookLanguage input.
|
454 |
-
*
|
455 |
-
* @since 1.3.0
|
456 |
-
* @static
|
457 |
-
*/
|
458 |
-
public static function renderField_facebook_app_code() {
|
459 |
-
$fieldName = "facebook_app_code";
|
460 |
-
|
461 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
462 |
-
|
463 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? "" : $options[$fieldName];
|
464 |
-
|
465 |
-
$facebookLocales = self::getFacebookAvailableLocales();
|
466 |
-
|
467 |
-
echo '<span><input type="text" value="' . $options[$fieldName] . '" class="regular-text" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']">';
|
468 |
-
}
|
469 |
-
|
470 |
-
/**
|
471 |
-
* Method that renders the forceFacebookLanguage input.
|
472 |
-
*
|
473 |
-
* @since 1.3.0
|
474 |
-
* @static
|
475 |
-
*/
|
476 |
-
public static function renderField_heading_settings() {
|
477 |
-
printf( "<h2>%s</h2>", esc_html__( 'Facebook and Instagram Embed Settings', 'embedpress' ) );
|
478 |
-
printf( __( '<p>Starting October 24th, due to changes in Facebook API, you will need Facebook Developer app credentials to embed Facebook & Instagram content on your WordPress website. You need to <a class="embedpress-settings-link" href="%s" target="_blank" rel="noopener noreferrer">register a Facebook app</a>, enable <a class="embedpress-settings-link" href="%s">oEmbed</a>, and add its `App ID` & `App secret` in the fields below.</p>', "embedpress" ), esc_url( 'https://developers.facebook.com/apps/' ), esc_url( 'https://developers.facebook.com/docs/plugins/oembed' ) );
|
479 |
-
printf( __( '<p>For more details, check out this documentation <a class="embedpress-settings-link" href="%s">Here</a></p>', 'embedpress' ), esc_url( 'https://embedpress.com/docs/how-to-connect-facebook-instagram-embedpress/' ) );
|
480 |
-
}
|
481 |
-
|
482 |
-
/**
|
483 |
-
* Method that renders the forceFacebookLanguage input.
|
484 |
-
*
|
485 |
-
* @since 1.3.0
|
486 |
-
* @static
|
487 |
-
*/
|
488 |
-
public static function renderField_facebook_app_secret() {
|
489 |
-
$fieldName = "facebook_app_secret";
|
490 |
-
|
491 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
492 |
-
|
493 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? "" : $options[$fieldName];
|
494 |
-
|
495 |
-
|
496 |
-
echo '<span><input type="text" value="' . $options[$fieldName] . '" class="regular-text" name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']">';
|
497 |
-
}
|
498 |
-
|
499 |
-
/**
|
500 |
-
* Method that renders the forceFacebookLanguage input.
|
501 |
-
*
|
502 |
-
* @since 1.3.0
|
503 |
-
* @static
|
504 |
-
*/
|
505 |
-
public static function renderField_forceFacebookLanguage() {
|
506 |
-
$fieldName = "fbLanguage";
|
507 |
-
|
508 |
-
$options = get_option( self::$sectionGroupIdentifier );
|
509 |
-
|
510 |
-
$options[$fieldName] = !isset( $options[$fieldName] ) ? "" : $options[$fieldName];
|
511 |
-
|
512 |
-
$facebookLocales = self::getFacebookAvailableLocales();
|
513 |
-
|
514 |
-
echo '<select name="' . self::$sectionGroupIdentifier . '[' . $fieldName . ']">';
|
515 |
-
echo '<option value="0">Automatic (by Facebook)</option>';
|
516 |
-
echo '<optgroup label="Available">';
|
517 |
-
foreach ( $facebookLocales as $locale => $localeName ) {
|
518 |
-
echo '<option value="' . $locale . '"' . ($options[$fieldName] === $locale ? ' selected' : '') . '>' . $localeName . '</option>';
|
519 |
-
}
|
520 |
-
echo '</optgroup>';
|
521 |
-
echo '</select>';
|
522 |
-
|
523 |
-
echo '<p class="description">Sometimes Facebook can choose the wrong language for embeds. If this happens, choose the correct language here.</p>';
|
524 |
-
}
|
525 |
-
|
526 |
-
/**
|
527 |
-
* Returns a list of locales that can be used on Facebook embeds.
|
528 |
-
*
|
529 |
-
* @return array
|
530 |
-
* @since 1.3.0
|
531 |
-
* @static
|
532 |
-
*
|
533 |
-
*/
|
534 |
-
public static function getFacebookAvailableLocales() {
|
535 |
-
$locales = [
|
536 |
-
'af_ZA' => "Afrikaans",
|
537 |
-
'ak_GH' => "Akan",
|
538 |
-
'am_ET' => "Amharic",
|
539 |
-
'ar_AR' => "Arabic",
|
540 |
-
'as_IN' => "Assamese",
|
541 |
-
'ay_BO' => "Aymara",
|
542 |
-
'az_AZ' => "Azerbaijani",
|
543 |
-
'be_BY' => "Belarusian",
|
544 |
-
'bg_BG' => "Bulgarian",
|
545 |
-
'bn_IN' => "Bengali",
|
546 |
-
'br_FR' => "Breton",
|
547 |
-
'bs_BA' => "Bosnian",
|
548 |
-
'ca_ES' => "Catalan",
|
549 |
-
'cb_IQ' => "Sorani Kurdish",
|
550 |
-
'ck_US' => "Cherokee",
|
551 |
-
'co_FR' => "Corsican",
|
552 |
-
'cs_CZ' => "Czech",
|
553 |
-
'cx_PH' => "Cebuano",
|
554 |
-
'cy_GB' => "Welsh",
|
555 |
-
'da_DK' => "Danish",
|
556 |
-
'de_DE' => "German",
|
557 |
-
'el_GR' => "Greek",
|
558 |
-
'en_GB' => "English (UK)",
|
559 |
-
'en_IN' => "English (India)",
|
560 |
-
'en_PI' => "English (Pirate)",
|
561 |
-
'en_UD' => "English (Upside Down)",
|
562 |
-
'en_US' => "English (US)",
|
563 |
-
'eo_EO' => "Esperanto",
|
564 |
-
'es_CL' => "Spanish (Chile)",
|
565 |
-
'es_CO' => "Spanish (Colombia)",
|
566 |
-
'es_ES' => "Spanish (Spain)",
|
567 |
-
'es_LA' => "Spanish",
|
568 |
-
'es_MX' => "Spanish (Mexico)",
|
569 |
-
'es_VE' => "Spanish (Venezuela)",
|
570 |
-
'et_EE' => "Estonian",
|
571 |
-
'eu_ES' => "Basque",
|
572 |
-
'fa_IR' => "Persian",
|
573 |
-
'fb_LT' => "Leet Speak",
|
574 |
-
'ff_NG' => "Fulah",
|
575 |
-
'fi_FI' => "Finnish",
|
576 |
-
'fo_FO' => "Faroese",
|
577 |
-
'fr_CA' => "French (Canada)",
|
578 |
-
'fr_FR' => "French (France)",
|
579 |
-
'fy_NL' => "Frisian",
|
580 |
-
'ga_IE' => "Irish",
|
581 |
-
'gl_ES' => "Galician",
|
582 |
-
'gn_PY' => "Guarani",
|
583 |
-
'gu_IN' => "Gujarati",
|
584 |
-
'gx_GR' => "Classical Greek",
|
585 |
-
'ha_NG' => "Hausa",
|
586 |
-
'he_IL' => "Hebrew",
|
587 |
-
'hi_IN' => "Hindi",
|
588 |
-
'hr_HR' => "Croatian",
|
589 |
-
'ht_HT' => "Haitian Creole",
|
590 |
-
'hu_HU' => "Hungarian",
|
591 |
-
'hy_AM' => "Armenian",
|
592 |
-
'id_ID' => "Indonesian",
|
593 |
-
'ig_NG' => "Igbo",
|
594 |
-
'is_IS' => "Icelandic",
|
595 |
-
'it_IT' => "Italian",
|
596 |
-
'ja_JP' => "Japanese",
|
597 |
-
'ja_KS' => "Japanese (Kansai)",
|
598 |
-
'jv_ID' => "Javanese",
|
599 |
-
'ka_GE' => "Georgian",
|
600 |
-
'kk_KZ' => "Kazakh",
|
601 |
-
'km_KH' => "Khmer",
|
602 |
-
'kn_IN' => "Kannada",
|
603 |
-
'ko_KR' => "Korean",
|
604 |
-
'ku_TR' => "Kurdish (Kurmanji)",
|
605 |
-
'ky_KG' => "Kyrgyz",
|
606 |
-
'la_VA' => "Latin",
|
607 |
-
'lg_UG' => "Ganda",
|
608 |
-
'li_NL' => "Limburgish",
|
609 |
-
'ln_CD' => "Lingala",
|
610 |
-
'lo_LA' => "Lao",
|
611 |
-
'lt_LT' => "Lithuanian",
|
612 |
-
'lv_LV' => "Latvian",
|
613 |
-
'mg_MG' => "Malagasy",
|
614 |
-
'mi_NZ' => "Māori",
|
615 |
-
'mk_MK' => "Macedonian",
|
616 |
-
'ml_IN' => "Malayalam",
|
617 |
-
'mn_MN' => "Mongolian",
|
618 |
-
'mr_IN' => "Marathi",
|
619 |
-
'ms_MY' => "Malay",
|
620 |
-
'mt_MT' => "Maltese",
|
621 |
-
'my_MM' => "Burmese",
|
622 |
-
'nb_NO' => "Norwegian (bokmal)",
|
623 |
-
'nd_ZW' => "Ndebele",
|
624 |
-
'ne_NP' => "Nepali",
|
625 |
-
'nl_BE' => "Dutch (België)",
|
626 |
-
'nl_NL' => "Dutch",
|
627 |
-
'nn_NO' => "Norwegian (nynorsk)",
|
628 |
-
'ny_MW' => "Chewa",
|
629 |
-
'or_IN' => "Oriya",
|
630 |
-
'pa_IN' => "Punjabi",
|
631 |
-
'pl_PL' => "Polish",
|
632 |
-
'ps_AF' => "Pashto",
|
633 |
-
'pt_BR' => "Portuguese (Brazil)",
|
634 |
-
'pt_PT' => "Portuguese (Portugal)",
|
635 |
-
'qc_GT' => "Quiché",
|
636 |
-
'qu_PE' => "Quechua",
|
637 |
-
'rm_CH' => "Romansh",
|
638 |
-
'ro_RO' => "Romanian",
|
639 |
-
'ru_RU' => "Russian",
|
640 |
-
'rw_RW' => "Kinyarwanda",
|
641 |
-
'sa_IN' => "Sanskrit",
|
642 |
-
'sc_IT' => "Sardinian",
|
643 |
-
'se_NO' => "Northern Sámi",
|
644 |
-
'si_LK' => "Sinhala",
|
645 |
-
'sk_SK' => "Slovak",
|
646 |
-
'sl_SI' => "Slovenian",
|
647 |
-
'sn_ZW' => "Shona",
|
648 |
-
'so_SO' => "Somali",
|
649 |
-
'sq_AL' => "Albanian",
|
650 |
-
'sr_RS' => "Serbian",
|
651 |
-
'sv_SE' => "Swedish",
|
652 |
-
'sw_KE' => "Swahili",
|
653 |
-
'sy_SY' => "Syriac",
|
654 |
-
'sz_PL' => "Silesian",
|
655 |
-
'ta_IN' => "Tamil",
|
656 |
-
'te_IN' => "Telugu",
|
657 |
-
'tg_TJ' => "Tajik",
|
658 |
-
'th_TH' => "Thai",
|
659 |
-
'tk_TM' => "Turkmen",
|
660 |
-
'tl_PH' => "Filipino",
|
661 |
-
'tl_ST' => "Klingon",
|
662 |
-
'tr_TR' => "Turkish",
|
663 |
-
'tt_RU' => "Tatar",
|
664 |
-
'tz_MA' => "Tamazight",
|
665 |
-
'uk_UA' => "Ukrainian",
|
666 |
-
'ur_PK' => "Urdu",
|
667 |
-
'uz_UZ' => "Uzbek",
|
668 |
-
'vi_VN' => "Vietnamese",
|
669 |
-
'wo_SN' => "Wolof",
|
670 |
-
'xh_ZA' => "Xhosa",
|
671 |
-
'yi_DE' => "Yiddish",
|
672 |
-
'yo_NG' => "Yoruba",
|
673 |
-
'zh_CN' => "Simplified Chinese (China)",
|
674 |
-
'zh_HK' => "Traditional Chinese (Hong Kong)",
|
675 |
-
'zh_TW' => "Traditional Chinese (Taiwan)",
|
676 |
-
'zu_ZA' => "Zulu",
|
677 |
-
'zz_TR' => "Zazaki",
|
678 |
-
];
|
679 |
-
|
680 |
-
return $locales;
|
681 |
-
}
|
682 |
}
|
2 |
|
3 |
namespace EmbedPress\Ends\Back;
|
4 |
|
|
|
|
|
5 |
(defined( 'ABSPATH' ) && defined( 'EMBEDPRESS_IS_LOADED' )) or die( "No direct script access allowed." );
|
6 |
|
7 |
/**
|
82 |
* @static
|
83 |
*/
|
84 |
public static function registerMenuItem() {
|
85 |
+
add_menu_page( __('EmbedPress Settings', 'embedpress'), 'EmbedPress', 'manage_options', 'embedpress',
|
86 |
[ self::$namespace, 'renderForm' ], null, 64 );
|
87 |
}
|
88 |
|
94 |
*/
|
95 |
public static function registerActions() {
|
96 |
$activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
|
97 |
+
$action = ( $activeTab !== "embedpress" ) ? "embedpress:{$activeTab}:settings:register" : '';
|
98 |
+
if ( !empty( $activeTab ) && has_action( $action ) ) {
|
|
|
|
|
|
|
|
|
|
|
99 |
do_action( $action, [
|
100 |
'id' => self::$sectionAdminIdentifier,
|
101 |
'slug' => self::$identifier,
|
102 |
] );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
}
|
105 |
|
126 |
}
|
127 |
|
128 |
/**
|
129 |
+
* Method that render the settings form.
|
130 |
*
|
131 |
* @since 1.0.0
|
132 |
* @static
|
139 |
EMBEDPRESS_VERSION, true );
|
140 |
|
141 |
$activeTab = isset( $_GET['tab'] ) ? strtolower( $_GET['tab'] ) : "";
|
142 |
+
$is_upgrade_tab_active = ($activeTab === 'embedpress_get_pro' || empty( $activeTab )) && !defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' );
|
143 |
+
$is_license_tab_active = ($activeTab === 'embedpress_license' || empty( $activeTab )) && defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' );
|
144 |
$settingsFieldsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$sectionGroupIdentifier;
|
145 |
$settingsSectionsIdentifier = !empty( $activeTab ) ? "embedpress:{$activeTab}" : self::$identifier;
|
146 |
+
$five_stars = `
|
147 |
+
<span class="dashicons dashicons-star-filled"></span>
|
148 |
+
<span class="dashicons dashicons-star-filled"></span>
|
149 |
+
<span class="dashicons dashicons-star-filled"></span>
|
150 |
+
<span class="dashicons dashicons-star-filled"></span>
|
151 |
+
<span class="dashicons dashicons-star-filled"></span>
|
152 |
+
`;
|
153 |
?>
|
154 |
<div id="embedpress-settings-wrapper">
|
155 |
<header>
|
160 |
</a>
|
161 |
</h1>
|
162 |
<div class="embedpress-version-name">
|
163 |
+
<span class="free"> <?php esc_html_e("Core Version: ", "embedpress"); echo EMBEDPRESS_VERSION; ?></span>
|
|
|
164 |
<?php if ( defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ) { ?>
|
165 |
+
<span class="pro"> <?php esc_html_e("Pro Version: ", "embedpress"); echo EMBEDPRESS_PRO_PLUGIN_VERSION; ?></span>
|
166 |
<?php } ?>
|
167 |
</div>
|
168 |
</header>
|
170 |
<?php settings_errors(); ?>
|
171 |
<div>
|
172 |
<h2 class="nav-tab-wrapper">
|
|
|
|
|
|
|
|
|
173 |
<?php if ( !defined( 'EMBEDPRESS_PRO_PLUGIN_VERSION' ) ): ?>
|
174 |
<a href="?page=embedpress&tab=embedpress_get_pro"
|
175 |
+
class="nav-tab<?php echo $is_upgrade_tab_active ? ' nav-tab-active' : ''; ?> ">
|
176 |
+
<?php esc_html_e( 'Go Premium', 'embedpress'); ?>
|
177 |
</a>
|
178 |
<?php endif; ?>
|
179 |
<?php do_action( 'embedpress:settings:render:tab', $activeTab ); ?>
|
184 |
<form action="options.php" method="POST" style="padding-bottom: 20px;">
|
185 |
<?php settings_fields( $settingsFieldsIdentifier ); ?>
|
186 |
<?php do_settings_sections( $settingsSectionsIdentifier ); ?>
|
187 |
+
<?php if ( !$is_license_tab_active && !$is_upgrade_tab_active ) {
|
188 |
+
?>
|
189 |
+
<button type="submit" class="button button-primary embedpress-setting-save"><?php esc_html_e( 'Save Changes', 'embedpress'); ?>
|
190 |
+
</button>
|
191 |
+
<?php } ?>
|
192 |
+
|
193 |
</form>
|
194 |
<?php endif; ?>
|
195 |
+
<?php if ( $is_license_tab_active ) : ?>
|
196 |
+
<?php do_action( 'embedpress_license' ); ?>
|
197 |
<?php endif; ?>
|
198 |
+
<?php if ( $is_upgrade_tab_active ) : ?>
|
199 |
<div class=" embedpress-go-premium">
|
200 |
<div class="embedpress-col-half">
|
201 |
<div class="embedpress-admin-block-wrapper">
|
205 |
<img src="<?php echo plugins_url( 'assets/images/icon-why-premium.svg',
|
206 |
EMBEDPRESS_PLUGIN_BASENAME ); ?>" alt="embedpress-go-pro">
|
207 |
</div>
|
208 |
+
<h4 class="embedpress-admin-title"><?php esc_html_e( 'Why upgrade to Premium Version?', 'embedpress'); ?></h4>
|
209 |
</header>
|
210 |
<div class="embedpress-admin-block-content">
|
211 |
+
<p><?php esc_html_e( 'The premium version helps us to continue development of the product
|
212 |
+
incorporating even more features and enhancements.', 'embedpress'); ?></p>
|
213 |
+
<p><?php esc_html_e( 'You will also get world class support from our dedicated team, 24/7.', 'embedpress'); ?></p>
|
214 |
<a href="https://wpdeveloper.net/plugins/embedpress#pricing" target="_blank"
|
215 |
+
class="button embedpress-btn"><?php esc_html_e( 'Get Pro Version', 'embedpress'); ?></a>
|
216 |
</div>
|
217 |
</div>
|
218 |
</div><!--admin block-wrapper end-->
|
224 |
<footer>
|
225 |
<p>
|
226 |
<a href="//embedpress.com/go/review-ep" target="_blank"
|
227 |
+
rel="noopener noreferrer">
|
228 |
+
<?php
|
229 |
+
/* translators: 1: EmbedPress Plugin Name, 2: 5 stars. */
|
230 |
+
printf( __('If you like %1$s please leave us a 5 stars %2$s
|
231 |
+
rating. Thank you!', 'embedpress'), '<strong>EmbedPress</strong>', $five_stars ) ?>
|
232 |
+
</a>
|
233 |
</p>
|
234 |
<hr>
|
235 |
<nav>
|
236 |
<ul>
|
237 |
<li>
|
238 |
<a href="//embedpress.com" target="_blank" rel="noopener noreferrer"
|
239 |
+
title="About EmbedPress"><?php esc_html_e( 'About', 'embedpress'); ?></a>
|
240 |
</li>
|
241 |
<li>
|
242 |
<a href="//embedpress.com/sources/" target="_blank" rel="noopener noreferrer"
|
243 |
+
title="List of supported sources by EmbedPress"><?php esc_html_e( 'Supported Sources', 'embedpress'); ?></a>
|
244 |
</li>
|
245 |
<li>
|
246 |
<a href="//embedpress.com/documentation/" target="_blank" rel="noopener noreferrer"
|
247 |
+
title="EmbedPress Documentation"><?php esc_html_e( 'Documentation', 'embedpress'); ?></a>
|
248 |
</li>
|
249 |
<li>
|
250 |
<a href="//embedpress.com/#pricing" target="_blank" rel="noopener noreferrer"
|
251 |
+
title="Get EmbedPress Pro"><?php esc_html_e( 'Get EmbedPress Pro', 'embedpress'); ?></a>
|
252 |
</li>
|
253 |
<li>
|
254 |
<a href="//embedpress.com/support/" target="_blank" rel="noopener noreferrer"
|
255 |
+
title="Contact the EmbedPress team"><?php esc_html_e( 'Contact', 'embedpress'); ?></a>
|
256 |
</li>
|
257 |
<li>
|
258 |
<a href="//twitter.com/wpdevteam" target="_blank" rel="noopener noreferrer">
|
268 |
</nav>
|
269 |
<p>
|
270 |
<a href="//embedpress.com" target="_blank" rel="noopener noreferrer">
|
271 |
+
<img width="100" alt="embedpress logo" src="<?php echo plugins_url( 'assets/images/embedpress.png',
|
272 |
EMBEDPRESS_PLUGIN_BASENAME ); ?>">
|
273 |
</a>
|
274 |
</p>
|
276 |
</div>
|
277 |
<?php
|
278 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
279 |
}
|
EmbedPress/Providers/Giphy.php
CHANGED
@@ -56,10 +56,10 @@ class Giphy extends ProviderAdapter implements ProviderInterface
|
|
56 |
|
57 |
if (preg_match($this->urlRegexPattern, $url, $matches)) {
|
58 |
$gifId = count($matches) > 3 && strtolower($matches[3]) === ".gif" ? $matches[2] : $matches[1];
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
'<img src="https://media.giphy.com/media/' . $gifId . '/giphy.gif" alt="" width="
|
63 |
'</a>';
|
64 |
|
65 |
$response = [
|
56 |
|
57 |
if (preg_match($this->urlRegexPattern, $url, $matches)) {
|
58 |
$gifId = count($matches) > 3 && strtolower($matches[3]) === ".gif" ? $matches[2] : $matches[1];
|
59 |
+
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: 400;
|
60 |
+
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 400;
|
61 |
+
$html = '<a href="https://giphy.com/gifs/' . $gifId . '">' .
|
62 |
+
'<img src="https://media.giphy.com/media/' . $gifId . '/giphy.gif" alt="" width="'.$width.'" height="'.$height.'">' .
|
63 |
'</a>';
|
64 |
|
65 |
$response = [
|
EmbedPress/Providers/GoogleDocs.php
CHANGED
@@ -104,10 +104,15 @@ class GoogleDocs extends ProviderAdapter implements ProviderInterface
|
|
104 |
break;
|
105 |
}
|
106 |
|
|
|
|
|
|
|
107 |
if ($type !== 'drawings') {
|
108 |
-
$html = '<iframe src="' . $iframeSrc . '" frameborder="0" width="
|
109 |
} else {
|
110 |
-
|
|
|
|
|
111 |
}
|
112 |
|
113 |
return [
|
104 |
break;
|
105 |
}
|
106 |
|
107 |
+
|
108 |
+
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: 600;
|
109 |
+
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 450;
|
110 |
if ($type !== 'drawings') {
|
111 |
+
$html = '<iframe src="' . $iframeSrc . '" frameborder="0" width="'.$width.'" height="'.$height.'" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>';
|
112 |
} else {
|
113 |
+
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: 960;
|
114 |
+
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 720;
|
115 |
+
$html = '<img src="' . $iframeSrc . '" width="'.$width.'" height="'.$height.'" />';
|
116 |
}
|
117 |
|
118 |
return [
|
EmbedPress/Providers/GoogleMaps.php
CHANGED
@@ -58,13 +58,14 @@ class GoogleMaps extends ProviderAdapter implements ProviderInterface
|
|
58 |
return [];
|
59 |
}
|
60 |
}
|
61 |
-
|
|
|
62 |
return [
|
63 |
'type' => 'rich',
|
64 |
'provider_name' => 'Google Maps',
|
65 |
'provider_url' => 'https://maps.google.com',
|
66 |
'title' => 'Unknown title',
|
67 |
-
'html' => '<iframe
|
68 |
];
|
69 |
}
|
70 |
/** inline @inheritDoc */
|
58 |
return [];
|
59 |
}
|
60 |
}
|
61 |
+
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: 600;
|
62 |
+
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 450;
|
63 |
return [
|
64 |
'type' => 'rich',
|
65 |
'provider_name' => 'Google Maps',
|
66 |
'provider_url' => 'https://maps.google.com',
|
67 |
'title' => 'Unknown title',
|
68 |
+
'html' => '<iframe width="'.$width.'" height="'.$height.'" src="' . $iframeSrc . '" frameborder="0"></iframe>',
|
69 |
];
|
70 |
}
|
71 |
/** inline @inheritDoc */
|
EmbedPress/Providers/Twitch.php
CHANGED
@@ -78,7 +78,6 @@ class Twitch extends ProviderAdapter implements ProviderInterface
|
|
78 |
{
|
79 |
$url = $this->getUrl();
|
80 |
$providerUrl = 'https://twitch.tv';
|
81 |
-
$html = '';
|
82 |
$src = '';
|
83 |
|
84 |
if (preg_match("{$this->urlRegexPattern}i", $url, $matches)) {
|
@@ -110,12 +109,16 @@ class Twitch extends ProviderAdapter implements ProviderInterface
|
|
110 |
break;
|
111 |
}
|
112 |
|
|
|
|
|
|
|
113 |
$pars_url = wp_parse_url(get_site_url());
|
114 |
$src = !empty($pars_url['host'])?$src.'&parent='.$pars_url['host']:$src;
|
115 |
-
$html = '<iframe src="' . $src . '" height="
|
116 |
|
117 |
$response = [
|
118 |
'type' => $type,
|
|
|
119 |
'provider_name' => 'Twitch',
|
120 |
'provider_url' => $providerUrl,
|
121 |
'url' => $url,
|
78 |
{
|
79 |
$url = $this->getUrl();
|
80 |
$providerUrl = 'https://twitch.tv';
|
|
|
81 |
$src = '';
|
82 |
|
83 |
if (preg_match("{$this->urlRegexPattern}i", $url, $matches)) {
|
109 |
break;
|
110 |
}
|
111 |
|
112 |
+
$width = isset( $this->config['maxwidth']) ? $this->config['maxwidth']: 800;
|
113 |
+
$height = isset( $this->config['maxheight']) ? $this->config['maxheight']: 400;
|
114 |
+
|
115 |
$pars_url = wp_parse_url(get_site_url());
|
116 |
$src = !empty($pars_url['host'])?$src.'&parent='.$pars_url['host']:$src;
|
117 |
+
$html = '<iframe src="' . $src . '" height="'.$height.'" width="'.$width.'" ' . $attrs . '></iframe>';
|
118 |
|
119 |
$response = [
|
120 |
'type' => $type,
|
121 |
+
'content_id' => $channelName,
|
122 |
'provider_name' => 'Twitch',
|
123 |
'provider_url' => $providerUrl,
|
124 |
'url' => $url,
|
EmbedPress/Shortcode.php
CHANGED
@@ -28,6 +28,17 @@ class Shortcode {
|
|
28 |
* @var WP_oEmbed $oEmbedInstance
|
29 |
*/
|
30 |
private static $oEmbedInstance = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
/**
|
32 |
* The DefaultProviderCollection class instance.
|
33 |
*
|
@@ -39,7 +50,10 @@ class Shortcode {
|
|
39 |
*/
|
40 |
private static $collection = null;
|
41 |
|
42 |
-
|
|
|
|
|
|
|
43 |
* Register the plugin's shortcode into WordPress.
|
44 |
*
|
45 |
* @return void
|
@@ -95,201 +109,59 @@ class Shortcode {
|
|
95 |
if ( empty( $customAttributes ) ) {
|
96 |
$customAttributes = self::parseContentAttributesFromString( $subject );
|
97 |
}
|
98 |
-
|
99 |
-
$
|
100 |
"", $subject );
|
101 |
|
102 |
// Converts any special HTML entities back to characters.
|
103 |
-
$
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
global $wp_version;
|
108 |
-
if ( version_compare( $wp_version, '5.3.0', '>=' ) ) {
|
109 |
-
require_once ABSPATH . 'wp-includes/class-wp-oembed.php';
|
110 |
-
} else {
|
111 |
-
require_once ABSPATH . 'wp-includes/class-oembed.php';
|
112 |
-
}
|
113 |
-
self::$oEmbedInstance = _wp_oembed_get_object();
|
114 |
-
};
|
115 |
-
if ( !empty( self::get_access_token() ) ) {
|
116 |
-
self::$oEmbedInstance->providers = array_merge( self::$oEmbedInstance->providers,
|
117 |
-
self::get_modified_provider( self::get_access_token() ) );
|
118 |
-
}
|
119 |
-
$emberaInstanceSettings = [
|
120 |
-
];
|
121 |
-
|
122 |
-
$content_uid = md5( $content );
|
123 |
-
|
124 |
-
$attributes = self::parseContentAttributes( $customAttributes, $content_uid );
|
125 |
-
if ( isset( $attributes[ 'width' ] ) || isset( $attributes[ 'height' ] ) ) {
|
126 |
-
if ( isset( $attributes[ 'width' ] ) ) {
|
127 |
-
$emberaInstanceSettings[ 'maxwidth' ] = $attributes[ 'width' ];
|
128 |
-
unset( $attributes[ 'width' ] );
|
129 |
-
}
|
130 |
-
|
131 |
-
if ( isset( $attributes[ 'height' ] ) ) {
|
132 |
-
$emberaInstanceSettings[ 'maxheight' ] = $attributes[ 'height' ];
|
133 |
-
unset( $attributes[ 'height' ] );
|
134 |
-
}
|
135 |
-
}
|
136 |
|
137 |
// Identify what service provider the shortcode's link belongs to
|
138 |
-
$serviceProvider = self
|
139 |
-
|
140 |
-
// Check if OEmbed was unable to detect the url service provider.
|
141 |
-
if ( empty( $serviceProvider ) ) {
|
142 |
-
// Attempt to do the same using Embera.
|
143 |
-
// Add support to the user's custom service providers
|
144 |
-
$additionalServiceProviders = Core::getAdditionalServiceProviders();
|
145 |
-
if ( !empty( $additionalServiceProviders ) ) {
|
146 |
-
foreach ( $additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls ) {
|
147 |
-
self::addServiceProvider( $serviceProviderClassName, $serviceProviderUrls );
|
148 |
-
}
|
149 |
-
unset( $serviceProviderUrls, $serviceProviderClassName );
|
150 |
-
}
|
151 |
-
|
152 |
-
// Attempt to fetch more info about the url-embed.
|
153 |
-
$emberaInstance = new Embera( $emberaInstanceSettings, self::$collection );
|
154 |
-
$urlData = $emberaInstance->getUrlData( $content );
|
155 |
-
} else {
|
156 |
-
// Attempt to fetch more info about the url-embed.
|
157 |
-
$urlData = self::$oEmbedInstance->fetch( $serviceProvider, $content, $attributes );
|
158 |
-
}
|
159 |
|
160 |
-
|
161 |
// Sanitize the data
|
162 |
$urlData = self::sanitizeUrlData( $urlData );
|
163 |
// Stores the original content
|
164 |
if ( is_object( $urlData ) ) {
|
165 |
-
$urlData->originalContent = $
|
166 |
}
|
167 |
|
168 |
$eventResults = apply_filters( 'embedpress:onBeforeEmbed', $urlData );
|
169 |
if ( empty( $eventResults ) ) {
|
170 |
-
// EmbedPress seems unable to embed the url.
|
171 |
return $subject;
|
172 |
}
|
173 |
|
174 |
// Transform all shortcode attributes into html form. I.e.: {foo: "joe"} -> foo="joe"
|
175 |
-
$attributesHtml = [];
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
// Check if $content is a google shortened url and tries to extract from it which Google service it refers to.
|
184 |
-
if ( preg_match( '/http[s]?:\/\/goo\.gl\/(?:([a-z]+)\/)?[a-z0-9]+\/?$/i', $content, $matches ) ) {
|
185 |
-
// Fetch all headers from the short-url so we can know how to handle its original content depending on the service.
|
186 |
-
$headers = get_headers( $content );
|
187 |
-
|
188 |
-
$supportedServicesHeadersPatterns = [
|
189 |
-
'maps' => '/^Location:\s+(http[s]?:\/\/.+)$/i',
|
190 |
-
];
|
191 |
-
|
192 |
-
$service = isset( $matches[ 1 ] ) ? strtolower( $matches[ 1 ] ) : null;
|
193 |
-
// No specific service was found in the url.
|
194 |
-
if ( empty( $service ) ) {
|
195 |
-
// Let's try to guess which service the original url belongs to.
|
196 |
-
foreach ( $headers as $header ) {
|
197 |
-
// Check if the short-url reffers to a Google Maps url.
|
198 |
-
if ( preg_match( $supportedServicesHeadersPatterns[ 'maps' ], $header, $matches ) ) {
|
199 |
-
// Replace the shortened url with its original url.
|
200 |
-
$content = $matches[ 1 ];
|
201 |
-
break;
|
202 |
-
}
|
203 |
-
}
|
204 |
-
unset( $header );
|
205 |
-
} else {
|
206 |
-
// Check if the Google service is supported atm.
|
207 |
-
if ( isset( $supportedServicesHeadersPatterns[ $service ] ) ) {
|
208 |
-
// Tries to extract the url based on its headers.
|
209 |
-
$originalUrl = self::extractContentFromHeaderAsArray( $supportedServicesHeadersPatterns[ $service ],
|
210 |
-
$headers );
|
211 |
-
// Replace the shortened url with its original url if the specific header was found.
|
212 |
-
if ( !empty( $originalUrl ) ) {
|
213 |
-
$content = $originalUrl;
|
214 |
-
}
|
215 |
-
unset( $originalUrl );
|
216 |
-
}
|
217 |
-
}
|
218 |
-
unset( $service, $supportedServicesHeadersPatterns, $headers, $matches );
|
219 |
-
|
220 |
-
}
|
221 |
-
|
222 |
-
|
223 |
-
$parsedContent = self::$oEmbedInstance->get_html( $content, $attributes );
|
224 |
-
|
225 |
-
$provider_name = '';
|
226 |
-
if (isset( $urlData->provider_name )) {
|
227 |
-
$provider_name = isset( $urlData->provider_name );
|
228 |
-
}elseif ( is_array( $urlData ) && isset( $urlData[ $content ][ 'provider_name' ] ) ) {
|
229 |
-
$provider_name = $urlData[ $content ][ 'provider_name' ];
|
230 |
-
}
|
231 |
-
|
232 |
-
|
233 |
-
if ( !$parsedContent ) {
|
234 |
-
// If the embed couldn't be generated, we'll try to use Embera's API
|
235 |
-
if ( !isset( $emberaInstance ) ) {
|
236 |
-
// Add support to the user's custom service providers
|
237 |
-
$additionalServiceProviders = Core::getAdditionalServiceProviders();
|
238 |
-
if ( !empty( $additionalServiceProviders ) ) {
|
239 |
-
foreach ( $additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls ) {
|
240 |
-
self::addServiceProvider( $serviceProviderClassName, $serviceProviderUrls);
|
241 |
-
}
|
242 |
-
|
243 |
-
unset( $serviceProviderUrls, $serviceProviderClassName );
|
244 |
-
}
|
245 |
-
$emberaInstance = new Embera( $emberaInstanceSettings );
|
246 |
-
}
|
247 |
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
}
|
259 |
-
|
260 |
-
if ( !empty($provider_name) ) {
|
261 |
-
// NFB seems to always return their embed code with all HTML entities into their applicable characters string.
|
262 |
-
$PROVIDER_NAME_IN_CAP = strtoupper($provider_name);
|
263 |
-
if ( $PROVIDER_NAME_IN_CAP === "NATIONAL FILM BOARD OF CANADA" ) {
|
264 |
-
$parsedContent = html_entity_decode( $parsedContent );
|
265 |
-
} elseif ( $PROVIDER_NAME_IN_CAP === "FACEBOOK" ) {
|
266 |
-
$plgSettings = Core::getSettings();
|
267 |
-
|
268 |
-
// Check if the user wants to force a certain language into Facebook embeds.
|
269 |
-
$locale = isset( $plgSettings->fbLanguage ) && !empty( $plgSettings->fbLanguage ) ? $plgSettings->fbLanguage : false;
|
270 |
-
if ( !!$locale ) {
|
271 |
-
// Replace the automatically detected language by Facebook's API with the language chosen by the user.
|
272 |
-
$parsedContent = preg_replace( '/\/[a-z]{2}\_[a-z]{2}\/sdk\.js/i', "/{$locale}/sdk.js",
|
273 |
-
$parsedContent );
|
274 |
-
}
|
275 |
-
|
276 |
-
// Make sure `adapt_container_width` parameter is set to false. Setting to true, as it is by default, might cause Facebook to render embeds inside editors (in admin) with only 180px wide.
|
277 |
-
if ( is_admin() ) {
|
278 |
-
$parsedContent = preg_replace( '~data\-adapt\-container\-width=\"(?:true|1)\"~i',
|
279 |
-
'data-adapt-container-width="0"', $parsedContent );
|
280 |
-
}
|
281 |
-
|
282 |
-
unset( $locale, $plgSettings );
|
283 |
-
}
|
284 |
-
}
|
285 |
-
|
286 |
unset( $embedTemplate, $serviceProvider );
|
287 |
-
|
288 |
// This assure that the iframe has the same dimensions the user wants to
|
289 |
-
if ( isset(
|
290 |
-
if ( isset(
|
291 |
-
$customWidth = (int)
|
292 |
-
$customHeight = (int)
|
293 |
} else {
|
294 |
if ( preg_match( '~width="(\d+)"|width\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
295 |
$iframeWidth = (int)$matches[ 1 ];
|
@@ -302,27 +174,32 @@ class Shortcode {
|
|
302 |
if ( isset( $iframeWidth ) && isset( $iframeHeight ) && $iframeWidth > 0 && $iframeHeight > 0 ) {
|
303 |
$iframeRatio = ceil( $iframeWidth / $iframeHeight );
|
304 |
|
305 |
-
if ( isset(
|
306 |
-
$customWidth = (int)
|
307 |
$customHeight = ceil( $customWidth / $iframeRatio );
|
308 |
} else {
|
309 |
-
$customHeight = (int)
|
310 |
$customWidth = $iframeRatio * $customHeight;
|
311 |
}
|
312 |
}
|
313 |
}
|
314 |
-
|
315 |
if ( isset( $customWidth ) && isset( $customHeight ) ) {
|
316 |
if ( preg_match( '~width="(\d+)"~i', $parsedContent ) ) {
|
317 |
$parsedContent = preg_replace( '~width="(\d+)"~i', 'width="' . $customWidth . '"',
|
318 |
$parsedContent );
|
|
|
|
|
|
|
|
|
319 |
}
|
320 |
|
321 |
if ( preg_match( '~height="(\d+)"~i', $parsedContent ) ) {
|
322 |
-
error_log( 'hit parsed content custom height');
|
323 |
-
error_log( print_r( $parsedContent,1));
|
324 |
$parsedContent = preg_replace( '~height="(\d+)"~i', 'height="' . $customHeight . '"',
|
325 |
$parsedContent );
|
|
|
|
|
|
|
326 |
}
|
327 |
|
328 |
if ( preg_match( '~width\s+:\s+(\d+)~i', $parsedContent ) ) {
|
@@ -336,18 +213,35 @@ class Shortcode {
|
|
336 |
}
|
337 |
}
|
338 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
339 |
|
340 |
if ( $stripNewLine ) {
|
341 |
$parsedContent = preg_replace( '/\n/', '', $parsedContent );
|
342 |
}
|
|
|
343 |
|
344 |
-
$parsedContent = apply_filters( 'pp_embed_parsed_content', $parsedContent, $urlData,
|
345 |
|
346 |
if ( !empty( $parsedContent ) ) {
|
347 |
$embed = (object)array_merge( (array)$urlData, [
|
348 |
-
'attributes' => (object)
|
349 |
'embed' => $parsedContent,
|
350 |
-
'url' => $
|
351 |
] );
|
352 |
$embed = apply_filters( 'embedpress:onAfterEmbed', $embed );
|
353 |
return $embed;
|
@@ -357,6 +251,55 @@ class Shortcode {
|
|
357 |
return $subject;
|
358 |
}
|
359 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
/**
|
361 |
* Method that adds support to a given new service provider (SP).
|
362 |
*
|
@@ -427,7 +370,7 @@ class Shortcode {
|
|
427 |
*/
|
428 |
private static function parseContentAttributes( array $customAttributes, $content_uid = null ) {
|
429 |
$attributes = [
|
430 |
-
'class' => ["embedpress-wrapper"],
|
431 |
];
|
432 |
|
433 |
$embedShouldBeResponsive = true;
|
@@ -515,6 +458,27 @@ class Shortcode {
|
|
515 |
|
516 |
return $attributes;
|
517 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
518 |
|
519 |
/**
|
520 |
* Method that checks if a given value is/can be identified as (bool)false.
|
@@ -606,75 +570,119 @@ class Shortcode {
|
|
606 |
|
607 |
return $data;
|
608 |
}
|
609 |
-
|
610 |
-
public static function get_modified_provider( $access_token = null ) {
|
611 |
-
if ( empty( $access_token ) ) {
|
612 |
-
return [];
|
613 |
-
}
|
614 |
-
return [
|
615 |
-
'#https?://www\.facebook\.com/.*/posts/.*#i' => [
|
616 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
617 |
-
true
|
618 |
-
],
|
619 |
-
'#https?://www\.facebook\.com/.*/activity/.*#i' => [
|
620 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
621 |
-
true
|
622 |
-
],
|
623 |
-
'#https?://www\.facebook\.com/.*/photos/.*#i' => [
|
624 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
625 |
-
true
|
626 |
-
],
|
627 |
-
'#https?://www\.facebook\.com/photo(s/|\.php).*#i' => [
|
628 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
629 |
-
true
|
630 |
-
],
|
631 |
-
'#https?://www\.facebook\.com/permalink\.php.*#i' => [
|
632 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
633 |
-
true
|
634 |
-
],
|
635 |
-
'#https?://www\.facebook\.com/media/.*#i' => [
|
636 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
637 |
-
true
|
638 |
-
],
|
639 |
-
'#https?://www\.facebook\.com/questions/.*#i' => [
|
640 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
641 |
-
true
|
642 |
-
],
|
643 |
-
'#https?://www\.facebook\.com/notes/.*#i' => [
|
644 |
-
'https://graph.facebook.com/v8.0/oembed_post?access_token=' . $access_token,
|
645 |
-
true
|
646 |
-
],
|
647 |
-
'#https?://www\.facebook\.com/.*/videos/.*#i' => [
|
648 |
-
'https://graph.facebook.com/v8.0/oembed_video?access_token=' . $access_token,
|
649 |
-
true
|
650 |
-
],
|
651 |
-
'#https?://www\.facebook\.com/video\.php.*#i' => [
|
652 |
-
'https://graph.facebook.com/v8.0/oembed_video?access_token=' . $access_token,
|
653 |
-
true
|
654 |
-
],
|
655 |
-
'#https?://www\.facebook\.com/watch/?\?v=\d+#i' => [
|
656 |
-
'https://graph.facebook.com/v8.0/oembed_video?access_token=' . $access_token,
|
657 |
-
true
|
658 |
-
],
|
659 |
-
|
660 |
-
'#https?://(www\.)?instagr(\.am|am\.com)/(p|tv)/.*#i' => [
|
661 |
-
'https://graph.facebook.com/v8.0/instagram_oembed?access_token=' . $access_token,
|
662 |
-
true
|
663 |
-
]
|
664 |
-
];
|
665 |
-
}
|
666 |
-
|
667 |
-
public static function get_access_token() {
|
668 |
-
$plgSettings = Core::getSettings();
|
669 |
-
if ( !empty( $plgSettings->facebook_app_code ) && !empty( $plgSettings->facebook_app_secret ) ) {
|
670 |
-
return urlencode( $plgSettings->facebook_app_code . '|' . $plgSettings->facebook_app_secret );
|
671 |
-
} else {
|
672 |
-
return null;
|
673 |
-
}
|
674 |
-
}
|
675 |
|
676 |
public static function get_collection()
|
677 |
{
|
678 |
return self::$collection;
|
679 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
680 |
}
|
28 |
* @var WP_oEmbed $oEmbedInstance
|
29 |
*/
|
30 |
private static $oEmbedInstance = null;
|
31 |
+
|
32 |
+
/**
|
33 |
+
* The Embera class instance.
|
34 |
+
*
|
35 |
+
* @since 2.7.4
|
36 |
+
* @access private
|
37 |
+
* @static
|
38 |
+
*
|
39 |
+
* @var Embera $embera_instance
|
40 |
+
*/
|
41 |
+
private static $embera_instance = null;
|
42 |
/**
|
43 |
* The DefaultProviderCollection class instance.
|
44 |
*
|
50 |
*/
|
51 |
private static $collection = null;
|
52 |
|
53 |
+
private static $emberaInstanceSettings = [];
|
54 |
+
private static $ombed_attributes;
|
55 |
+
|
56 |
+
/**
|
57 |
* Register the plugin's shortcode into WordPress.
|
58 |
*
|
59 |
* @return void
|
109 |
if ( empty( $customAttributes ) ) {
|
110 |
$customAttributes = self::parseContentAttributesFromString( $subject );
|
111 |
}
|
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 );
|
119 |
+
self::$ombed_attributes = self::parseContentAttributes( $customAttributes, $content_uid );
|
120 |
+
self::set_embera_settings(self::$ombed_attributes);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
121 |
|
122 |
// Identify what service provider the shortcode's link belongs to
|
123 |
+
$serviceProvider = self::get_oembed()->get_provider( $url );
|
124 |
+
$urlData = self::get_url_data( $url, self::$ombed_attributes, $serviceProvider);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
|
|
|
126 |
// Sanitize the data
|
127 |
$urlData = self::sanitizeUrlData( $urlData );
|
128 |
// Stores the original content
|
129 |
if ( is_object( $urlData ) ) {
|
130 |
+
$urlData->originalContent = $url;
|
131 |
}
|
132 |
|
133 |
$eventResults = apply_filters( 'embedpress:onBeforeEmbed', $urlData );
|
134 |
if ( empty( $eventResults ) ) {
|
|
|
135 |
return $subject;
|
136 |
}
|
137 |
|
138 |
// Transform all shortcode attributes into html form. I.e.: {foo: "joe"} -> foo="joe"
|
139 |
+
$attributesHtml = ['class="ose-{provider_alias} ose-uid-' . $content_uid.' ose-embedpress-responsive"'];
|
140 |
+
//$attributesHtml = [];
|
141 |
+
//foreach ( self::$ombed_attributes as $attrName => $attrValue ) {
|
142 |
+
// $attributesHtml[] = $attrName . '="' . $attrValue . '"';
|
143 |
+
//}
|
144 |
+
if ( isset( $customAttributes['width'])) {
|
145 |
+
$attributesHtml[] = "style=\"width:{$customAttributes['width']}px; max-width:100%; height: auto\"";
|
146 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
147 |
|
148 |
+
// Check if $url is a google shortened url and tries to extract from it which Google service it refers to.
|
149 |
+
self::check_for_google_url($url);
|
150 |
+
$provider_name = self::get_provider_name($urlData, $url);
|
151 |
+
$embedTemplate = '<div ' . implode( ' ', $attributesHtml ) . '>{html}</div>';
|
152 |
+
$parsedContent = self::get_content_from_template($url, $embedTemplate);
|
153 |
+
// Replace all single quotes to double quotes. I.e: foo='joe' -> foo="joe"
|
154 |
+
$parsedContent = str_replace( "'", '"', $parsedContent );
|
155 |
+
$parsedContent = str_replace( "{provider_alias}", $provider_name , $parsedContent );
|
156 |
+
self::purify_html_content( $parsedContent);
|
157 |
+
self::modify_content_for_fb_and_canada( $provider_name, $parsedContent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
unset( $embedTemplate, $serviceProvider );
|
159 |
+
|
160 |
// This assure that the iframe has the same dimensions the user wants to
|
161 |
+
if ( isset( self::$emberaInstanceSettings[ 'maxwidth' ] ) || isset( self::$emberaInstanceSettings[ 'maxheight' ] ) ) {
|
162 |
+
if ( isset( self::$emberaInstanceSettings[ 'maxwidth' ] ) && isset( self::$emberaInstanceSettings[ 'maxheight' ] ) ) {
|
163 |
+
$customWidth = (int)self::$emberaInstanceSettings[ 'maxwidth' ];
|
164 |
+
$customHeight = (int)self::$emberaInstanceSettings[ 'maxheight' ];
|
165 |
} else {
|
166 |
if ( preg_match( '~width="(\d+)"|width\s+:\s+(\d+)~i', $parsedContent, $matches ) ) {
|
167 |
$iframeWidth = (int)$matches[ 1 ];
|
174 |
if ( isset( $iframeWidth ) && isset( $iframeHeight ) && $iframeWidth > 0 && $iframeHeight > 0 ) {
|
175 |
$iframeRatio = ceil( $iframeWidth / $iframeHeight );
|
176 |
|
177 |
+
if ( isset( self::$emberaInstanceSettings[ 'maxwidth' ] ) ) {
|
178 |
+
$customWidth = (int)self::$emberaInstanceSettings[ 'maxwidth' ];
|
179 |
$customHeight = ceil( $customWidth / $iframeRatio );
|
180 |
} else {
|
181 |
+
$customHeight = (int)self::$emberaInstanceSettings[ 'maxheight' ];
|
182 |
$customWidth = $iframeRatio * $customHeight;
|
183 |
}
|
184 |
}
|
185 |
}
|
186 |
+
|
187 |
if ( isset( $customWidth ) && isset( $customHeight ) ) {
|
188 |
if ( preg_match( '~width="(\d+)"~i', $parsedContent ) ) {
|
189 |
$parsedContent = preg_replace( '~width="(\d+)"~i', 'width="' . $customWidth . '"',
|
190 |
$parsedContent );
|
191 |
+
} elseif ( preg_match( '~width="({.+})"~i', $parsedContent ) ){
|
192 |
+
// this block was needed for twitch that has width="{width}" in iframe
|
193 |
+
$parsedContent = preg_replace( '~width="({.+})"~i', 'width="' . $customWidth . '"',
|
194 |
+
$parsedContent );
|
195 |
}
|
196 |
|
197 |
if ( preg_match( '~height="(\d+)"~i', $parsedContent ) ) {
|
|
|
|
|
198 |
$parsedContent = preg_replace( '~height="(\d+)"~i', 'height="' . $customHeight . '"',
|
199 |
$parsedContent );
|
200 |
+
} elseif ( preg_match( '~height="({.+})"~i', $parsedContent ) ){
|
201 |
+
$parsedContent = preg_replace( '~height="({.+})"~i', 'height="' . $customHeight . '"',
|
202 |
+
$parsedContent );
|
203 |
}
|
204 |
|
205 |
if ( preg_match( '~width\s+:\s+(\d+)~i', $parsedContent ) ) {
|
213 |
}
|
214 |
}
|
215 |
}
|
216 |
+
|
217 |
+
if ( 'the-new-york-times' === $provider_name && isset( $customAttributes['height']) && isset( $customAttributes['width']) ) {
|
218 |
+
$styles = <<<KAMAL
|
219 |
+
<style>
|
220 |
+
.ose-the-new-york-times iframe{
|
221 |
+
min-height: auto;
|
222 |
+
height: {height}px;
|
223 |
+
width: {width}px;
|
224 |
+
max-width:100%
|
225 |
+
max-height: 100%;
|
226 |
+
}
|
227 |
+
</style>
|
228 |
+
KAMAL;
|
229 |
+
$styles = str_replace( ['{height}', '{width}'], [$customAttributes['height'], $customAttributes['width']], $styles);
|
230 |
+
$parsedContent = $styles.$parsedContent;
|
231 |
+
}
|
232 |
|
233 |
if ( $stripNewLine ) {
|
234 |
$parsedContent = preg_replace( '/\n/', '', $parsedContent );
|
235 |
}
|
236 |
+
|
237 |
|
238 |
+
$parsedContent = apply_filters( 'pp_embed_parsed_content', $parsedContent, $urlData, self::get_oembed_attributes() );
|
239 |
|
240 |
if ( !empty( $parsedContent ) ) {
|
241 |
$embed = (object)array_merge( (array)$urlData, [
|
242 |
+
'attributes' => (object) self::get_oembed_attributes(),
|
243 |
'embed' => $parsedContent,
|
244 |
+
'url' => $url,
|
245 |
] );
|
246 |
$embed = apply_filters( 'embedpress:onAfterEmbed', $embed );
|
247 |
return $embed;
|
251 |
return $subject;
|
252 |
}
|
253 |
|
254 |
+
protected static function get_oembed() {
|
255 |
+
if ( !self::$oEmbedInstance ) {
|
256 |
+
global $wp_version;
|
257 |
+
if ( version_compare( $wp_version, '5.3.0', '>=' ) ) {
|
258 |
+
require_once ABSPATH . 'wp-includes/class-wp-oembed.php';
|
259 |
+
} else {
|
260 |
+
require_once ABSPATH . 'wp-includes/class-oembed.php';
|
261 |
+
}
|
262 |
+
self::$oEmbedInstance = _wp_oembed_get_object();
|
263 |
+
}
|
264 |
+
return self::$oEmbedInstance;
|
265 |
+
}
|
266 |
+
|
267 |
+
protected static function set_default_size( &$customAttributes ) {
|
268 |
+
if (empty( $customAttributes['width'])) {
|
269 |
+
$customAttributes['width'] = 600;
|
270 |
+
}
|
271 |
+
if (empty( $customAttributes['height'])) {
|
272 |
+
$customAttributes['height'] = 550;
|
273 |
+
}
|
274 |
+
}
|
275 |
+
|
276 |
+
protected static function get_url_data( $url, $attributes = [], $serviceProvider = '' ) {
|
277 |
+
if ( !empty( $serviceProvider ) ) {
|
278 |
+
$urlData = self::get_oembed()->fetch( $serviceProvider, $url, $attributes );
|
279 |
+
} else {
|
280 |
+
$urlData = self::get_embera_instance()->getUrlData( $url );
|
281 |
+
}
|
282 |
+
return $urlData;
|
283 |
+
}
|
284 |
+
|
285 |
+
/**
|
286 |
+
* @return null|Embera
|
287 |
+
*/
|
288 |
+
public static function get_embera_instance() {
|
289 |
+
if ( !self::$embera_instance) {
|
290 |
+
$additionalServiceProviders = Core::getAdditionalServiceProviders();
|
291 |
+
if ( !empty( $additionalServiceProviders ) ) {
|
292 |
+
foreach ( $additionalServiceProviders as $serviceProviderClassName => $serviceProviderUrls ) {
|
293 |
+
self::addServiceProvider( $serviceProviderClassName, $serviceProviderUrls );
|
294 |
+
}
|
295 |
+
unset( $serviceProviderUrls, $serviceProviderClassName );
|
296 |
+
}
|
297 |
+
self::$embera_instance = new Embera( self::get_embera_settings(), self::get_collection() );
|
298 |
+
}
|
299 |
+
|
300 |
+
return self::$embera_instance;
|
301 |
+
}
|
302 |
+
|
303 |
/**
|
304 |
* Method that adds support to a given new service provider (SP).
|
305 |
*
|
370 |
*/
|
371 |
private static function parseContentAttributes( array $customAttributes, $content_uid = null ) {
|
372 |
$attributes = [
|
373 |
+
'class' => ["embedpress-wrapper ose-embedpress-responsive"],
|
374 |
];
|
375 |
|
376 |
$embedShouldBeResponsive = true;
|
458 |
|
459 |
return $attributes;
|
460 |
}
|
461 |
+
|
462 |
+
protected static function set_embera_settings(&$attributes) {
|
463 |
+
if ( isset( $attributes[ 'width' ] ) || isset( $attributes[ 'height' ] ) ) {
|
464 |
+
if ( isset( $attributes[ 'width' ] ) ) {
|
465 |
+
self::$emberaInstanceSettings[ 'maxwidth' ] = $attributes[ 'width' ];
|
466 |
+
self::$emberaInstanceSettings[ 'width' ] = $attributes[ 'width' ];
|
467 |
+
unset( $attributes[ 'width' ] );
|
468 |
+
}
|
469 |
+
|
470 |
+
if ( isset( $attributes[ 'height' ] ) ) {
|
471 |
+
self::$emberaInstanceSettings[ 'maxheight' ] = $attributes[ 'height' ];
|
472 |
+
self::$emberaInstanceSettings[ 'height' ] = $attributes[ 'height' ];
|
473 |
+
unset( $attributes[ 'height' ] );
|
474 |
+
}
|
475 |
+
}
|
476 |
+
|
477 |
+
}
|
478 |
+
|
479 |
+
protected static function get_embera_settings() {
|
480 |
+
return self::$emberaInstanceSettings;
|
481 |
+
}
|
482 |
|
483 |
/**
|
484 |
* Method that checks if a given value is/can be identified as (bool)false.
|
570 |
|
571 |
return $data;
|
572 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
573 |
|
574 |
public static function get_collection()
|
575 |
{
|
576 |
return self::$collection;
|
577 |
}
|
578 |
+
|
579 |
+
protected static function purify_html_content( &$html ) {
|
580 |
+
if ( !class_exists( '\simple_html_dom') ) {
|
581 |
+
include_once EMBEDPRESS_PATH_CORE . 'simple_html_dom.php';
|
582 |
+
}
|
583 |
+
|
584 |
+
$dom = str_get_html($html);
|
585 |
+
$ifDom = $dom->find( 'iframe', 0);
|
586 |
+
if (!empty( $ifDom) && is_object( $ifDom)){
|
587 |
+
$ifDom->removeAttribute( 'sandbox');
|
588 |
+
}
|
589 |
+
|
590 |
+
ob_start();
|
591 |
+
echo $dom;
|
592 |
+
return ob_get_clean();
|
593 |
+
}
|
594 |
+
|
595 |
+
protected static function get_content_from_template( $url, $template ) {
|
596 |
+
$html = self::get_oembed()->get_html( $url, self::get_oembed_attributes() );
|
597 |
+
if ( !$html ) {
|
598 |
+
$html = str_replace( '{html}', self::get_embera_instance()->autoEmbed($url), $template );
|
599 |
+
}
|
600 |
+
return $html = str_replace( '{html}', $html, $template );
|
601 |
+
}
|
602 |
+
|
603 |
+
protected static function get_oembed_attributes() {
|
604 |
+
return self::$ombed_attributes;
|
605 |
+
}
|
606 |
+
protected static function set_oembed_attributes( $atts) {
|
607 |
+
self::$ombed_attributes = $atts;
|
608 |
+
}
|
609 |
+
|
610 |
+
protected static function check_for_google_url(&$url) {
|
611 |
+
if ( preg_match( '/http[s]?:\/\/goo\.gl\/(?:([a-z]+)\/)?[a-z0-9]+\/?$/i', $url, $matches ) ) {
|
612 |
+
// Fetch all headers from the short-url so we can know how to handle its original content depending on the service.
|
613 |
+
$headers = get_headers( $url );
|
614 |
+
|
615 |
+
$supportedServicesHeadersPatterns = [
|
616 |
+
'maps' => '/^Location:\s+(http[s]?:\/\/.+)$/i',
|
617 |
+
];
|
618 |
+
|
619 |
+
$service = isset( $matches[ 1 ] ) ? strtolower( $matches[ 1 ] ) : null;
|
620 |
+
// No specific service was found in the url.
|
621 |
+
if ( empty( $service ) ) {
|
622 |
+
// Let's try to guess which service the original url belongs to.
|
623 |
+
foreach ( $headers as $header ) {
|
624 |
+
// Check if the short-url reffers to a Google Maps url.
|
625 |
+
if ( preg_match( $supportedServicesHeadersPatterns[ 'maps' ], $header, $matches ) ) {
|
626 |
+
// Replace the shortened url with its original url.
|
627 |
+
$url = $matches[ 1 ];
|
628 |
+
break;
|
629 |
+
}
|
630 |
+
}
|
631 |
+
unset( $header );
|
632 |
+
} else {
|
633 |
+
// Check if the Google service is supported atm.
|
634 |
+
if ( isset( $supportedServicesHeadersPatterns[ $service ] ) ) {
|
635 |
+
// Tries to extract the url based on its headers.
|
636 |
+
$originalUrl = self::extractContentFromHeaderAsArray( $supportedServicesHeadersPatterns[ $service ],
|
637 |
+
$headers );
|
638 |
+
// Replace the shortened url with its original url if the specific header was found.
|
639 |
+
if ( !empty( $originalUrl ) ) {
|
640 |
+
$url = $originalUrl;
|
641 |
+
}
|
642 |
+
unset( $originalUrl );
|
643 |
+
}
|
644 |
+
}
|
645 |
+
unset( $service, $supportedServicesHeadersPatterns, $headers, $matches );
|
646 |
+
|
647 |
+
}
|
648 |
+
|
649 |
+
}
|
650 |
+
|
651 |
+
protected static function get_provider_name( $urlData, $url ) {
|
652 |
+
$provider_name = '';
|
653 |
+
if (isset( $urlData->provider_name )) {
|
654 |
+
$provider_name = str_replace( [' ', ','], '-', strtolower( $urlData->provider_name));
|
655 |
+
}elseif ( is_array( $urlData ) && isset( $urlData[ $url ][ 'provider_name' ] ) ) {
|
656 |
+
$provider_name = str_replace( [' ', ','], '-', strtolower( $urlData[ $url ][ 'provider_name' ]));
|
657 |
+
}
|
658 |
+
return $provider_name;
|
659 |
+
}
|
660 |
+
|
661 |
+
protected static function modify_content_for_fb_and_canada( $provider_name, &$html ) {
|
662 |
+
if ( !empty($provider_name) ) {
|
663 |
+
// NFB seems to always return their embed code with all HTML entities into their applicable characters string.
|
664 |
+
$PROVIDER_NAME_IN_CAP = strtoupper($provider_name);
|
665 |
+
if ( $PROVIDER_NAME_IN_CAP === "NATIONAL FILM BOARD OF CANADA" ) {
|
666 |
+
$html = html_entity_decode( $html );
|
667 |
+
} elseif ( $PROVIDER_NAME_IN_CAP === "FACEBOOK" ) {
|
668 |
+
$plgSettings = Core::getSettings();
|
669 |
+
|
670 |
+
// Check if the user wants to force a certain language into Facebook embeds.
|
671 |
+
$locale = isset( $plgSettings->fbLanguage ) && !empty( $plgSettings->fbLanguage ) ? $plgSettings->fbLanguage : false;
|
672 |
+
if ( !!$locale ) {
|
673 |
+
// Replace the automatically detected language by Facebook's API with the language chosen by the user.
|
674 |
+
$html = preg_replace( '/\/[a-z]{2}\_[a-z]{2}\/sdk\.js/i', "/{$locale}/sdk.js",
|
675 |
+
$html );
|
676 |
+
}
|
677 |
+
|
678 |
+
// Make sure `adapt_container_width` parameter is set to false. Setting to true, as it is by default, might cause Facebook to render embeds inside editors (in admin) with only 180px wide.
|
679 |
+
if ( is_admin() ) {
|
680 |
+
$html = preg_replace( '~data\-adapt\-container\-width=\"(?:true|1)\"~i',
|
681 |
+
'data-adapt-container-width="0"', $html );
|
682 |
+
}
|
683 |
+
|
684 |
+
unset( $locale, $plgSettings );
|
685 |
+
}
|
686 |
+
}
|
687 |
+
}
|
688 |
}
|
EmbedPress/simple_html_dom.php
ADDED
@@ -0,0 +1,2398 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Website: http://sourceforge.net/projects/simplehtmldom/
|
4 |
+
* Additional projects: http://sourceforge.net/projects/debugobject/
|
5 |
+
* Acknowledge: Jose Solorzano (https://sourceforge.net/projects/php-html/)
|
6 |
+
*
|
7 |
+
* Licensed under The MIT License
|
8 |
+
* See the LICENSE file in the project root for more information.
|
9 |
+
*
|
10 |
+
* Authors:
|
11 |
+
* S.C. Chen
|
12 |
+
* John Schlick
|
13 |
+
* Rus Carroll
|
14 |
+
* logmanoriginal
|
15 |
+
*
|
16 |
+
* Contributors:
|
17 |
+
* Yousuke Kumakura
|
18 |
+
* Vadim Voituk
|
19 |
+
* Antcs
|
20 |
+
*
|
21 |
+
* Version Rev. 1.9.1 (291)
|
22 |
+
*/
|
23 |
+
|
24 |
+
define('HDOM_TYPE_ELEMENT', 1);
|
25 |
+
define('HDOM_TYPE_COMMENT', 2);
|
26 |
+
define('HDOM_TYPE_TEXT', 3);
|
27 |
+
define('HDOM_TYPE_ENDTAG', 4);
|
28 |
+
define('HDOM_TYPE_ROOT', 5);
|
29 |
+
define('HDOM_TYPE_UNKNOWN', 6);
|
30 |
+
define('HDOM_QUOTE_DOUBLE', 0);
|
31 |
+
define('HDOM_QUOTE_SINGLE', 1);
|
32 |
+
define('HDOM_QUOTE_NO', 3);
|
33 |
+
define('HDOM_INFO_BEGIN', 0);
|
34 |
+
define('HDOM_INFO_END', 1);
|
35 |
+
define('HDOM_INFO_QUOTE', 2);
|
36 |
+
define('HDOM_INFO_SPACE', 3);
|
37 |
+
define('HDOM_INFO_TEXT', 4);
|
38 |
+
define('HDOM_INFO_INNER', 5);
|
39 |
+
define('HDOM_INFO_OUTER', 6);
|
40 |
+
define('HDOM_INFO_ENDSPACE', 7);
|
41 |
+
|
42 |
+
defined('DEFAULT_TARGET_CHARSET') || define('DEFAULT_TARGET_CHARSET', 'UTF-8');
|
43 |
+
defined('DEFAULT_BR_TEXT') || define('DEFAULT_BR_TEXT', "\r\n");
|
44 |
+
defined('DEFAULT_SPAN_TEXT') || define('DEFAULT_SPAN_TEXT', ' ');
|
45 |
+
defined('MAX_FILE_SIZE') || define('MAX_FILE_SIZE', 600000);
|
46 |
+
define('HDOM_SMARTY_AS_TEXT', 1);
|
47 |
+
|
48 |
+
/**
|
49 |
+
* @param $url
|
50 |
+
* @param false $use_include_path
|
51 |
+
* @param null $context
|
52 |
+
* @param int $offset
|
53 |
+
* @param int $maxLen
|
54 |
+
* @param bool $lowercase
|
55 |
+
* @param bool $forceTagsClosed
|
56 |
+
* @param string $target_charset
|
57 |
+
* @param bool $stripRN
|
58 |
+
* @param string $defaultBRText
|
59 |
+
* @param string $defaultSpanText
|
60 |
+
*
|
61 |
+
* @return $this|false
|
62 |
+
*/
|
63 |
+
function file_get_html(
|
64 |
+
$url,
|
65 |
+
$use_include_path = false,
|
66 |
+
$context = null,
|
67 |
+
$offset = 0,
|
68 |
+
$maxLen = -1,
|
69 |
+
$lowercase = true,
|
70 |
+
$forceTagsClosed = true,
|
71 |
+
$target_charset = DEFAULT_TARGET_CHARSET,
|
72 |
+
$stripRN = true,
|
73 |
+
$defaultBRText = DEFAULT_BR_TEXT,
|
74 |
+
$defaultSpanText = DEFAULT_SPAN_TEXT)
|
75 |
+
{
|
76 |
+
if($maxLen <= 0) { $maxLen = MAX_FILE_SIZE; }
|
77 |
+
|
78 |
+
$dom = new simple_html_dom(
|
79 |
+
null,
|
80 |
+
$lowercase,
|
81 |
+
$forceTagsClosed,
|
82 |
+
$target_charset,
|
83 |
+
$stripRN,
|
84 |
+
$defaultBRText,
|
85 |
+
$defaultSpanText
|
86 |
+
);
|
87 |
+
|
88 |
+
/**
|
89 |
+
* For sourceforge users: uncomment the next line and comment the
|
90 |
+
* retrieve_url_contents line 2 lines down if it is not already done.
|
91 |
+
*/
|
92 |
+
$contents = file_get_contents(
|
93 |
+
$url,
|
94 |
+
$use_include_path,
|
95 |
+
$context,
|
96 |
+
$offset,
|
97 |
+
$maxLen
|
98 |
+
);
|
99 |
+
// $contents = retrieve_url_contents($url);
|
100 |
+
|
101 |
+
if (empty($contents) || strlen($contents) > $maxLen) {
|
102 |
+
$dom->clear();
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
return $dom->load($contents, $lowercase, $stripRN);
|
107 |
+
}
|
108 |
+
|
109 |
+
/**
|
110 |
+
* @param $str
|
111 |
+
* @param bool $lowercase
|
112 |
+
* @param bool $forceTagsClosed
|
113 |
+
* @param string $target_charset
|
114 |
+
* @param bool $stripRN
|
115 |
+
* @param string $defaultBRText
|
116 |
+
* @param string $defaultSpanText
|
117 |
+
*
|
118 |
+
* @return simple_html_dom|false
|
119 |
+
*/
|
120 |
+
function str_get_html(
|
121 |
+
$str,
|
122 |
+
$lowercase = true,
|
123 |
+
$forceTagsClosed = true,
|
124 |
+
$target_charset = DEFAULT_TARGET_CHARSET,
|
125 |
+
$stripRN = true,
|
126 |
+
$defaultBRText = DEFAULT_BR_TEXT,
|
127 |
+
$defaultSpanText = DEFAULT_SPAN_TEXT)
|
128 |
+
{
|
129 |
+
$dom = new simple_html_dom(
|
130 |
+
null,
|
131 |
+
$lowercase,
|
132 |
+
$forceTagsClosed,
|
133 |
+
$target_charset,
|
134 |
+
$stripRN,
|
135 |
+
$defaultBRText,
|
136 |
+
$defaultSpanText
|
137 |
+
);
|
138 |
+
|
139 |
+
if (empty($str) || strlen($str) > MAX_FILE_SIZE) {
|
140 |
+
$dom->clear();
|
141 |
+
return false;
|
142 |
+
}
|
143 |
+
|
144 |
+
return $dom->load($str, $lowercase, $stripRN);
|
145 |
+
}
|
146 |
+
|
147 |
+
function dump_html_tree($node, $show_attr = true, $deep = 0)
|
148 |
+
{
|
149 |
+
$node->dump($node);
|
150 |
+
}
|
151 |
+
|
152 |
+
class simple_html_dom_node
|
153 |
+
{
|
154 |
+
public $nodetype = HDOM_TYPE_TEXT;
|
155 |
+
public $tag = 'text';
|
156 |
+
public $attr = array();
|
157 |
+
public $children = array();
|
158 |
+
public $nodes = array();
|
159 |
+
public $parent = null;
|
160 |
+
public $_ = array();
|
161 |
+
public $tag_start = 0;
|
162 |
+
private $dom = null;
|
163 |
+
|
164 |
+
function __construct($dom)
|
165 |
+
{
|
166 |
+
$this->dom = $dom;
|
167 |
+
$dom->nodes[] = $this;
|
168 |
+
}
|
169 |
+
|
170 |
+
function __destruct()
|
171 |
+
{
|
172 |
+
$this->clear();
|
173 |
+
}
|
174 |
+
|
175 |
+
function __toString()
|
176 |
+
{
|
177 |
+
return $this->outertext();
|
178 |
+
}
|
179 |
+
|
180 |
+
function clear()
|
181 |
+
{
|
182 |
+
$this->dom = null;
|
183 |
+
$this->nodes = null;
|
184 |
+
$this->parent = null;
|
185 |
+
$this->children = null;
|
186 |
+
}
|
187 |
+
|
188 |
+
function dump($show_attr = true, $depth = 0)
|
189 |
+
{
|
190 |
+
echo str_repeat("\t", $depth) . $this->tag;
|
191 |
+
|
192 |
+
if ($show_attr && count($this->attr) > 0) {
|
193 |
+
echo '(';
|
194 |
+
foreach ($this->attr as $k => $v) {
|
195 |
+
echo "[$k]=>\"$v\", ";
|
196 |
+
}
|
197 |
+
echo ')';
|
198 |
+
}
|
199 |
+
|
200 |
+
echo "\n";
|
201 |
+
|
202 |
+
if ($this->nodes) {
|
203 |
+
foreach ($this->nodes as $node) {
|
204 |
+
$node->dump($show_attr, $depth + 1);
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
|
209 |
+
function dump_node($echo = true)
|
210 |
+
{
|
211 |
+
$string = $this->tag;
|
212 |
+
|
213 |
+
if (count($this->attr) > 0) {
|
214 |
+
$string .= '(';
|
215 |
+
foreach ($this->attr as $k => $v) {
|
216 |
+
$string .= "[$k]=>\"$v\", ";
|
217 |
+
}
|
218 |
+
$string .= ')';
|
219 |
+
}
|
220 |
+
|
221 |
+
if (count($this->_) > 0) {
|
222 |
+
$string .= ' $_ (';
|
223 |
+
foreach ($this->_ as $k => $v) {
|
224 |
+
if (is_array($v)) {
|
225 |
+
$string .= "[$k]=>(";
|
226 |
+
foreach ($v as $k2 => $v2) {
|
227 |
+
$string .= "[$k2]=>\"$v2\", ";
|
228 |
+
}
|
229 |
+
$string .= ')';
|
230 |
+
} else {
|
231 |
+
$string .= "[$k]=>\"$v\", ";
|
232 |
+
}
|
233 |
+
}
|
234 |
+
$string .= ')';
|
235 |
+
}
|
236 |
+
|
237 |
+
if (isset($this->text)) {
|
238 |
+
$string .= " text: ({$this->text})";
|
239 |
+
}
|
240 |
+
|
241 |
+
$string .= ' HDOM_INNER_INFO: ';
|
242 |
+
|
243 |
+
if (isset($node->_[HDOM_INFO_INNER])) {
|
244 |
+
$string .= "'" . $node->_[HDOM_INFO_INNER] . "'";
|
245 |
+
} else {
|
246 |
+
$string .= ' NULL ';
|
247 |
+
}
|
248 |
+
|
249 |
+
$string .= ' children: ' . count($this->children);
|
250 |
+
$string .= ' nodes: ' . count($this->nodes);
|
251 |
+
$string .= ' tag_start: ' . $this->tag_start;
|
252 |
+
$string .= "\n";
|
253 |
+
|
254 |
+
if ($echo) {
|
255 |
+
echo $string;
|
256 |
+
return;
|
257 |
+
} else {
|
258 |
+
return $string;
|
259 |
+
}
|
260 |
+
}
|
261 |
+
|
262 |
+
function parent($parent = null)
|
263 |
+
{
|
264 |
+
// I am SURE that this doesn't work properly.
|
265 |
+
// It fails to unset the current node from it's current parents nodes or
|
266 |
+
// children list first.
|
267 |
+
if ($parent !== null) {
|
268 |
+
$this->parent = $parent;
|
269 |
+
$this->parent->nodes[] = $this;
|
270 |
+
$this->parent->children[] = $this;
|
271 |
+
}
|
272 |
+
|
273 |
+
return $this->parent;
|
274 |
+
}
|
275 |
+
|
276 |
+
function has_child()
|
277 |
+
{
|
278 |
+
return !empty($this->children);
|
279 |
+
}
|
280 |
+
|
281 |
+
function children($idx = -1)
|
282 |
+
{
|
283 |
+
if ($idx === -1) {
|
284 |
+
return $this->children;
|
285 |
+
}
|
286 |
+
|
287 |
+
if (isset($this->children[$idx])) {
|
288 |
+
return $this->children[$idx];
|
289 |
+
}
|
290 |
+
|
291 |
+
return null;
|
292 |
+
}
|
293 |
+
|
294 |
+
function first_child()
|
295 |
+
{
|
296 |
+
if (count($this->children) > 0) {
|
297 |
+
return $this->children[0];
|
298 |
+
}
|
299 |
+
return null;
|
300 |
+
}
|
301 |
+
|
302 |
+
function last_child()
|
303 |
+
{
|
304 |
+
if (count($this->children) > 0) {
|
305 |
+
return end($this->children);
|
306 |
+
}
|
307 |
+
return null;
|
308 |
+
}
|
309 |
+
|
310 |
+
function next_sibling()
|
311 |
+
{
|
312 |
+
if ($this->parent === null) {
|
313 |
+
return null;
|
314 |
+
}
|
315 |
+
|
316 |
+
$idx = array_search($this, $this->parent->children, true);
|
317 |
+
|
318 |
+
if ($idx !== false && isset($this->parent->children[$idx + 1])) {
|
319 |
+
return $this->parent->children[$idx + 1];
|
320 |
+
}
|
321 |
+
|
322 |
+
return null;
|
323 |
+
}
|
324 |
+
|
325 |
+
function prev_sibling()
|
326 |
+
{
|
327 |
+
if ($this->parent === null) {
|
328 |
+
return null;
|
329 |
+
}
|
330 |
+
|
331 |
+
$idx = array_search($this, $this->parent->children, true);
|
332 |
+
|
333 |
+
if ($idx !== false && $idx > 0) {
|
334 |
+
return $this->parent->children[$idx - 1];
|
335 |
+
}
|
336 |
+
|
337 |
+
return null;
|
338 |
+
}
|
339 |
+
|
340 |
+
function find_ancestor_tag($tag)
|
341 |
+
{
|
342 |
+
global $debug_object;
|
343 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
344 |
+
|
345 |
+
if ($this->parent === null) {
|
346 |
+
return null;
|
347 |
+
}
|
348 |
+
|
349 |
+
$ancestor = $this->parent;
|
350 |
+
|
351 |
+
while (!is_null($ancestor)) {
|
352 |
+
if (is_object($debug_object)) {
|
353 |
+
$debug_object->debug_log(2, 'Current tag is: ' . $ancestor->tag);
|
354 |
+
}
|
355 |
+
|
356 |
+
if ($ancestor->tag === $tag) {
|
357 |
+
break;
|
358 |
+
}
|
359 |
+
|
360 |
+
$ancestor = $ancestor->parent;
|
361 |
+
}
|
362 |
+
|
363 |
+
return $ancestor;
|
364 |
+
}
|
365 |
+
|
366 |
+
function innertext()
|
367 |
+
{
|
368 |
+
if (isset($this->_[HDOM_INFO_INNER])) {
|
369 |
+
return $this->_[HDOM_INFO_INNER];
|
370 |
+
}
|
371 |
+
|
372 |
+
if (isset($this->_[HDOM_INFO_TEXT])) {
|
373 |
+
return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
374 |
+
}
|
375 |
+
|
376 |
+
$ret = '';
|
377 |
+
|
378 |
+
foreach ($this->nodes as $n) {
|
379 |
+
$ret .= $n->outertext();
|
380 |
+
}
|
381 |
+
|
382 |
+
return $ret;
|
383 |
+
}
|
384 |
+
|
385 |
+
function outertext()
|
386 |
+
{
|
387 |
+
global $debug_object;
|
388 |
+
|
389 |
+
if (is_object($debug_object)) {
|
390 |
+
$text = '';
|
391 |
+
|
392 |
+
if ($this->tag === 'text') {
|
393 |
+
if (!empty($this->text)) {
|
394 |
+
$text = ' with text: ' . $this->text;
|
395 |
+
}
|
396 |
+
}
|
397 |
+
|
398 |
+
$debug_object->debug_log(1, 'Innertext of tag: ' . $this->tag . $text);
|
399 |
+
}
|
400 |
+
|
401 |
+
if ($this->tag === 'root') {
|
402 |
+
return $this->innertext();
|
403 |
+
}
|
404 |
+
|
405 |
+
// todo: What is the use of this callback? Remove?
|
406 |
+
if ($this->dom && $this->dom->callback !== null) {
|
407 |
+
call_user_func_array($this->dom->callback, array($this));
|
408 |
+
}
|
409 |
+
|
410 |
+
if (isset($this->_[HDOM_INFO_OUTER])) {
|
411 |
+
return $this->_[HDOM_INFO_OUTER];
|
412 |
+
}
|
413 |
+
|
414 |
+
if (isset($this->_[HDOM_INFO_TEXT])) {
|
415 |
+
return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
416 |
+
}
|
417 |
+
|
418 |
+
$ret = '';
|
419 |
+
|
420 |
+
if ($this->dom && $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]) {
|
421 |
+
$ret = $this->dom->nodes[$this->_[HDOM_INFO_BEGIN]]->makeup();
|
422 |
+
}
|
423 |
+
|
424 |
+
if (isset($this->_[HDOM_INFO_INNER])) {
|
425 |
+
// todo: <br> should either never have HDOM_INFO_INNER or always
|
426 |
+
if ($this->tag !== 'br') {
|
427 |
+
$ret .= $this->_[HDOM_INFO_INNER];
|
428 |
+
}
|
429 |
+
} elseif ($this->nodes) {
|
430 |
+
foreach ($this->nodes as $n) {
|
431 |
+
$ret .= $this->convert_text($n->outertext());
|
432 |
+
}
|
433 |
+
}
|
434 |
+
|
435 |
+
if (isset($this->_[HDOM_INFO_END]) && $this->_[HDOM_INFO_END] != 0) {
|
436 |
+
$ret .= '</' . $this->tag . '>';
|
437 |
+
}
|
438 |
+
|
439 |
+
return $ret;
|
440 |
+
}
|
441 |
+
|
442 |
+
function text()
|
443 |
+
{
|
444 |
+
if (isset($this->_[HDOM_INFO_INNER])) {
|
445 |
+
return $this->_[HDOM_INFO_INNER];
|
446 |
+
}
|
447 |
+
|
448 |
+
switch ($this->nodetype) {
|
449 |
+
case HDOM_TYPE_TEXT: return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
450 |
+
case HDOM_TYPE_COMMENT: return '';
|
451 |
+
case HDOM_TYPE_UNKNOWN: return '';
|
452 |
+
}
|
453 |
+
|
454 |
+
if (strcasecmp($this->tag, 'script') === 0) { return ''; }
|
455 |
+
if (strcasecmp($this->tag, 'style') === 0) { return ''; }
|
456 |
+
|
457 |
+
$ret = '';
|
458 |
+
|
459 |
+
// In rare cases, (always node type 1 or HDOM_TYPE_ELEMENT - observed
|
460 |
+
// for some span tags, and some p tags) $this->nodes is set to NULL.
|
461 |
+
// NOTE: This indicates that there is a problem where it's set to NULL
|
462 |
+
// without a clear happening.
|
463 |
+
// WHY is this happening?
|
464 |
+
if (!is_null($this->nodes)) {
|
465 |
+
foreach ($this->nodes as $n) {
|
466 |
+
// Start paragraph after a blank line
|
467 |
+
if ($n->tag === 'p') {
|
468 |
+
$ret = trim($ret) . "\n\n";
|
469 |
+
}
|
470 |
+
|
471 |
+
$ret .= $this->convert_text($n->text());
|
472 |
+
|
473 |
+
// If this node is a span... add a space at the end of it so
|
474 |
+
// multiple spans don't run into each other. This is plaintext
|
475 |
+
// after all.
|
476 |
+
if ($n->tag === 'span') {
|
477 |
+
$ret .= $this->dom->default_span_text;
|
478 |
+
}
|
479 |
+
}
|
480 |
+
}
|
481 |
+
return $ret;
|
482 |
+
}
|
483 |
+
|
484 |
+
function xmltext()
|
485 |
+
{
|
486 |
+
$ret = $this->innertext();
|
487 |
+
$ret = str_ireplace('<![CDATA[', '', $ret);
|
488 |
+
$ret = str_replace(']]>', '', $ret);
|
489 |
+
return $ret;
|
490 |
+
}
|
491 |
+
|
492 |
+
function makeup()
|
493 |
+
{
|
494 |
+
// text, comment, unknown
|
495 |
+
if (isset($this->_[HDOM_INFO_TEXT])) {
|
496 |
+
return $this->dom->restore_noise($this->_[HDOM_INFO_TEXT]);
|
497 |
+
}
|
498 |
+
|
499 |
+
$ret = '<' . $this->tag;
|
500 |
+
$i = -1;
|
501 |
+
|
502 |
+
foreach ($this->attr as $key => $val) {
|
503 |
+
++$i;
|
504 |
+
|
505 |
+
// skip removed attribute
|
506 |
+
if ($val === null || $val === false) { continue; }
|
507 |
+
|
508 |
+
$ret .= $this->_[HDOM_INFO_SPACE][$i][0];
|
509 |
+
|
510 |
+
//no value attr: nowrap, checked selected...
|
511 |
+
if ($val === true) {
|
512 |
+
$ret .= $key;
|
513 |
+
} else {
|
514 |
+
switch ($this->_[HDOM_INFO_QUOTE][$i])
|
515 |
+
{
|
516 |
+
case HDOM_QUOTE_DOUBLE: $quote = '"'; break;
|
517 |
+
case HDOM_QUOTE_SINGLE: $quote = '\''; break;
|
518 |
+
default: $quote = '';
|
519 |
+
}
|
520 |
+
|
521 |
+
$ret .= $key
|
522 |
+
. $this->_[HDOM_INFO_SPACE][$i][1]
|
523 |
+
. '='
|
524 |
+
. $this->_[HDOM_INFO_SPACE][$i][2]
|
525 |
+
. $quote
|
526 |
+
. $val
|
527 |
+
. $quote;
|
528 |
+
}
|
529 |
+
}
|
530 |
+
|
531 |
+
$ret = $this->dom->restore_noise($ret);
|
532 |
+
return $ret . $this->_[HDOM_INFO_ENDSPACE] . '>';
|
533 |
+
}
|
534 |
+
|
535 |
+
function find($selector, $idx = null, $lowercase = false)
|
536 |
+
{
|
537 |
+
$selectors = $this->parse_selector($selector);
|
538 |
+
if (($count = count($selectors)) === 0) { return array(); }
|
539 |
+
$found_keys = array();
|
540 |
+
|
541 |
+
// find each selector
|
542 |
+
for ($c = 0; $c < $count; ++$c) {
|
543 |
+
// The change on the below line was documented on the sourceforge
|
544 |
+
// code tracker id 2788009
|
545 |
+
// used to be: if (($levle=count($selectors[0]))===0) return array();
|
546 |
+
if (($levle = count($selectors[$c])) === 0) { return array(); }
|
547 |
+
if (!isset($this->_[HDOM_INFO_BEGIN])) { return array(); }
|
548 |
+
|
549 |
+
$head = array($this->_[HDOM_INFO_BEGIN] => 1);
|
550 |
+
$cmd = ' '; // Combinator
|
551 |
+
|
552 |
+
// handle descendant selectors, no recursive!
|
553 |
+
for ($l = 0; $l < $levle; ++$l) {
|
554 |
+
$ret = array();
|
555 |
+
|
556 |
+
foreach ($head as $k => $v) {
|
557 |
+
$n = ($k === -1) ? $this->dom->root : $this->dom->nodes[$k];
|
558 |
+
//PaperG - Pass this optional parameter on to the seek function.
|
559 |
+
$n->seek($selectors[$c][$l], $ret, $cmd, $lowercase);
|
560 |
+
}
|
561 |
+
|
562 |
+
$head = $ret;
|
563 |
+
$cmd = $selectors[$c][$l][4]; // Next Combinator
|
564 |
+
}
|
565 |
+
|
566 |
+
foreach ($head as $k => $v) {
|
567 |
+
if (!isset($found_keys[$k])) {
|
568 |
+
$found_keys[$k] = 1;
|
569 |
+
}
|
570 |
+
}
|
571 |
+
}
|
572 |
+
|
573 |
+
// sort keys
|
574 |
+
ksort($found_keys);
|
575 |
+
|
576 |
+
$found = array();
|
577 |
+
foreach ($found_keys as $k => $v) {
|
578 |
+
$found[] = $this->dom->nodes[$k];
|
579 |
+
}
|
580 |
+
|
581 |
+
// return nth-element or array
|
582 |
+
if (is_null($idx)) { return $found; }
|
583 |
+
elseif ($idx < 0) { $idx = count($found) + $idx; }
|
584 |
+
return (isset($found[$idx])) ? $found[$idx] : null;
|
585 |
+
}
|
586 |
+
|
587 |
+
protected function seek($selector, &$ret, $parent_cmd, $lowercase = false)
|
588 |
+
{
|
589 |
+
global $debug_object;
|
590 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
591 |
+
|
592 |
+
list($tag, $id, $class, $attributes, $cmb) = $selector;
|
593 |
+
$nodes = array();
|
594 |
+
|
595 |
+
if ($parent_cmd === ' ') { // Descendant Combinator
|
596 |
+
// Find parent closing tag if the current element doesn't have a closing
|
597 |
+
// tag (i.e. void element)
|
598 |
+
$end = (!empty($this->_[HDOM_INFO_END])) ? $this->_[HDOM_INFO_END] : 0;
|
599 |
+
if ($end == 0) {
|
600 |
+
$parent = $this->parent;
|
601 |
+
while (!isset($parent->_[HDOM_INFO_END]) && $parent !== null) {
|
602 |
+
$end -= 1;
|
603 |
+
$parent = $parent->parent;
|
604 |
+
}
|
605 |
+
$end += $parent->_[HDOM_INFO_END];
|
606 |
+
}
|
607 |
+
|
608 |
+
// Get list of target nodes
|
609 |
+
$nodes_start = $this->_[HDOM_INFO_BEGIN] + 1;
|
610 |
+
$nodes_count = $end - $nodes_start;
|
611 |
+
$nodes = array_slice($this->dom->nodes, $nodes_start, $nodes_count, true);
|
612 |
+
} elseif ($parent_cmd === '>') { // Child Combinator
|
613 |
+
$nodes = $this->children;
|
614 |
+
} elseif ($parent_cmd === '+'
|
615 |
+
&& $this->parent
|
616 |
+
&& in_array($this, $this->parent->children)) { // Next-Sibling Combinator
|
617 |
+
$index = array_search($this, $this->parent->children, true) + 1;
|
618 |
+
if ($index < count($this->parent->children))
|
619 |
+
$nodes[] = $this->parent->children[$index];
|
620 |
+
} elseif ($parent_cmd === '~'
|
621 |
+
&& $this->parent
|
622 |
+
&& in_array($this, $this->parent->children)) { // Subsequent Sibling Combinator
|
623 |
+
$index = array_search($this, $this->parent->children, true);
|
624 |
+
$nodes = array_slice($this->parent->children, $index);
|
625 |
+
}
|
626 |
+
|
627 |
+
// Go throgh each element starting at this element until the end tag
|
628 |
+
// Note: If this element is a void tag, any previous void element is
|
629 |
+
// skipped.
|
630 |
+
foreach($nodes as $node) {
|
631 |
+
$pass = true;
|
632 |
+
|
633 |
+
// Skip root nodes
|
634 |
+
if(!$node->parent) {
|
635 |
+
$pass = false;
|
636 |
+
}
|
637 |
+
|
638 |
+
// Handle 'text' selector
|
639 |
+
if($pass && $tag === 'text' && $node->tag === 'text') {
|
640 |
+
$ret[array_search($node, $this->dom->nodes, true)] = 1;
|
641 |
+
unset($node);
|
642 |
+
continue;
|
643 |
+
}
|
644 |
+
|
645 |
+
// Skip if node isn't a child node (i.e. text nodes)
|
646 |
+
if($pass && !in_array($node, $node->parent->children, true)) {
|
647 |
+
$pass = false;
|
648 |
+
}
|
649 |
+
|
650 |
+
// Skip if tag doesn't match
|
651 |
+
if ($pass && $tag !== '' && $tag !== $node->tag && $tag !== '*') {
|
652 |
+
$pass = false;
|
653 |
+
}
|
654 |
+
|
655 |
+
// Skip if ID doesn't exist
|
656 |
+
if ($pass && $id !== '' && !isset($node->attr['id'])) {
|
657 |
+
$pass = false;
|
658 |
+
}
|
659 |
+
|
660 |
+
// Check if ID matches
|
661 |
+
if ($pass && $id !== '' && isset($node->attr['id'])) {
|
662 |
+
// Note: Only consider the first ID (as browsers do)
|
663 |
+
$node_id = explode(' ', trim($node->attr['id']))[0];
|
664 |
+
|
665 |
+
if($id !== $node_id) { $pass = false; }
|
666 |
+
}
|
667 |
+
|
668 |
+
// Check if all class(es) exist
|
669 |
+
if ($pass && $class !== '' && is_array($class) && !empty($class)) {
|
670 |
+
if (isset($node->attr['class'])) {
|
671 |
+
$node_classes = explode(' ', $node->attr['class']);
|
672 |
+
|
673 |
+
if ($lowercase) {
|
674 |
+
$node_classes = array_map('strtolower', $node_classes);
|
675 |
+
}
|
676 |
+
|
677 |
+
foreach($class as $c) {
|
678 |
+
if(!in_array($c, $node_classes)) {
|
679 |
+
$pass = false;
|
680 |
+
break;
|
681 |
+
}
|
682 |
+
}
|
683 |
+
} else {
|
684 |
+
$pass = false;
|
685 |
+
}
|
686 |
+
}
|
687 |
+
|
688 |
+
// Check attributes
|
689 |
+
if ($pass
|
690 |
+
&& $attributes !== ''
|
691 |
+
&& is_array($attributes)
|
692 |
+
&& !empty($attributes)) {
|
693 |
+
foreach($attributes as $a) {
|
694 |
+
list (
|
695 |
+
$att_name,
|
696 |
+
$att_expr,
|
697 |
+
$att_val,
|
698 |
+
$att_inv,
|
699 |
+
$att_case_sensitivity
|
700 |
+
) = $a;
|
701 |
+
|
702 |
+
// Handle indexing attributes (i.e. "[2]")
|
703 |
+
/**
|
704 |
+
* Note: This is not supported by the CSS Standard but adds
|
705 |
+
* the ability to select items compatible to XPath (i.e.
|
706 |
+
* the 3rd element within it's parent).
|
707 |
+
*
|
708 |
+
* Note: This doesn't conflict with the CSS Standard which
|
709 |
+
* doesn't work on numeric attributes anyway.
|
710 |
+
*/
|
711 |
+
if (is_numeric($att_name)
|
712 |
+
&& $att_expr === ''
|
713 |
+
&& $att_val === '') {
|
714 |
+
$count = 0;
|
715 |
+
|
716 |
+
// Find index of current element in parent
|
717 |
+
foreach ($node->parent->children as $c) {
|
718 |
+
if ($c->tag === $node->tag) ++$count;
|
719 |
+
if ($c === $node) break;
|
720 |
+
}
|
721 |
+
|
722 |
+
// If this is the correct node, continue with next
|
723 |
+
// attribute
|
724 |
+
if ($count === (int)$att_name) continue;
|
725 |
+
}
|
726 |
+
|
727 |
+
// Check attribute availability
|
728 |
+
if ($att_inv) { // Attribute should NOT be set
|
729 |
+
if (isset($node->attr[$att_name])) {
|
730 |
+
$pass = false;
|
731 |
+
break;
|
732 |
+
}
|
733 |
+
} else { // Attribute should be set
|
734 |
+
// todo: "plaintext" is not a valid CSS selector!
|
735 |
+
if ($att_name !== 'plaintext'
|
736 |
+
&& !isset($node->attr[$att_name])) {
|
737 |
+
$pass = false;
|
738 |
+
break;
|
739 |
+
}
|
740 |
+
}
|
741 |
+
|
742 |
+
// Continue with next attribute if expression isn't defined
|
743 |
+
if ($att_expr === '') continue;
|
744 |
+
|
745 |
+
// If they have told us that this is a "plaintext"
|
746 |
+
// search then we want the plaintext of the node - right?
|
747 |
+
// todo "plaintext" is not a valid CSS selector!
|
748 |
+
if ($att_name === 'plaintext') {
|
749 |
+
$nodeKeyValue = $node->text();
|
750 |
+
} else {
|
751 |
+
$nodeKeyValue = $node->attr[$att_name];
|
752 |
+
}
|
753 |
+
|
754 |
+
if (is_object($debug_object)) {
|
755 |
+
$debug_object->debug_log(2,
|
756 |
+
'testing node: '
|
757 |
+
. $node->tag
|
758 |
+
. ' for attribute: '
|
759 |
+
. $att_name
|
760 |
+
. $att_expr
|
761 |
+
. $att_val
|
762 |
+
. ' where nodes value is: '
|
763 |
+
. $nodeKeyValue
|
764 |
+
);
|
765 |
+
}
|
766 |
+
|
767 |
+
// If lowercase is set, do a case insensitive test of
|
768 |
+
// the value of the selector.
|
769 |
+
if ($lowercase) {
|
770 |
+
$check = $this->match(
|
771 |
+
$att_expr,
|
772 |
+
strtolower($att_val),
|
773 |
+
strtolower($nodeKeyValue),
|
774 |
+
$att_case_sensitivity
|
775 |
+
);
|
776 |
+
} else {
|
777 |
+
$check = $this->match(
|
778 |
+
$att_expr,
|
779 |
+
$att_val,
|
780 |
+
$nodeKeyValue,
|
781 |
+
$att_case_sensitivity
|
782 |
+
);
|
783 |
+
}
|
784 |
+
|
785 |
+
if (is_object($debug_object)) {
|
786 |
+
$debug_object->debug_log(2,
|
787 |
+
'after match: '
|
788 |
+
. ($check ? 'true' : 'false')
|
789 |
+
);
|
790 |
+
}
|
791 |
+
|
792 |
+
if (!$check) {
|
793 |
+
$pass = false;
|
794 |
+
break;
|
795 |
+
}
|
796 |
+
}
|
797 |
+
}
|
798 |
+
|
799 |
+
// Found a match. Add to list and clear node
|
800 |
+
if ($pass) $ret[$node->_[HDOM_INFO_BEGIN]] = 1;
|
801 |
+
unset($node);
|
802 |
+
}
|
803 |
+
// It's passed by reference so this is actually what this function returns.
|
804 |
+
if (is_object($debug_object)) {
|
805 |
+
$debug_object->debug_log(1, 'EXIT - ret: ', $ret);
|
806 |
+
}
|
807 |
+
}
|
808 |
+
|
809 |
+
protected function match($exp, $pattern, $value, $case_sensitivity)
|
810 |
+
{
|
811 |
+
global $debug_object;
|
812 |
+
if (is_object($debug_object)) {$debug_object->debug_log_entry(1);}
|
813 |
+
|
814 |
+
if ($case_sensitivity === 'i') {
|
815 |
+
$pattern = strtolower($pattern);
|
816 |
+
$value = strtolower($value);
|
817 |
+
}
|
818 |
+
|
819 |
+
switch ($exp) {
|
820 |
+
case '=':
|
821 |
+
return ($value === $pattern);
|
822 |
+
case '!=':
|
823 |
+
return ($value !== $pattern);
|
824 |
+
case '^=':
|
825 |
+
return preg_match('/^' . preg_quote($pattern, '/') . '/', $value);
|
826 |
+
case '$=':
|
827 |
+
return preg_match('/' . preg_quote($pattern, '/') . '$/', $value);
|
828 |
+
case '*=':
|
829 |
+
return preg_match('/' . preg_quote($pattern, '/') . '/', $value);
|
830 |
+
case '|=':
|
831 |
+
/**
|
832 |
+
* [att|=val]
|
833 |
+
*
|
834 |
+
* Represents an element with the att attribute, its value
|
835 |
+
* either being exactly "val" or beginning with "val"
|
836 |
+
* immediately followed by "-" (U+002D).
|
837 |
+
*/
|
838 |
+
return strpos($value, $pattern) === 0;
|
839 |
+
case '~=':
|
840 |
+
/**
|
841 |
+
* [att~=val]
|
842 |
+
*
|
843 |
+
* Represents an element with the att attribute whose value is a
|
844 |
+
* whitespace-separated list of words, one of which is exactly
|
845 |
+
* "val". If "val" contains whitespace, it will never represent
|
846 |
+
* anything (since the words are separated by spaces). Also if
|
847 |
+
* "val" is the empty string, it will never represent anything.
|
848 |
+
*/
|
849 |
+
return in_array($pattern, explode(' ', trim($value)), true);
|
850 |
+
}
|
851 |
+
return false;
|
852 |
+
}
|
853 |
+
|
854 |
+
protected function parse_selector($selector_string)
|
855 |
+
{
|
856 |
+
global $debug_object;
|
857 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
858 |
+
|
859 |
+
/**
|
860 |
+
* Pattern of CSS selectors, modified from mootools (https://mootools.net/)
|
861 |
+
*
|
862 |
+
* Paperg: Add the colon to the attribute, so that it properly finds
|
863 |
+
* <tag attr:ibute="something" > like google does.
|
864 |
+
*
|
865 |
+
* Note: if you try to look at this attribute, you MUST use getAttribute
|
866 |
+
* since $dom->x:y will fail the php syntax check.
|
867 |
+
*
|
868 |
+
* Notice the \[ starting the attribute? and the @? following? This
|
869 |
+
* implies that an attribute can begin with an @ sign that is not
|
870 |
+
* captured. This implies that an html attribute specifier may start
|
871 |
+
* with an @ sign that is NOT captured by the expression. Farther study
|
872 |
+
* is required to determine of this should be documented or removed.
|
873 |
+
*
|
874 |
+
* Matches selectors in this order:
|
875 |
+
*
|
876 |
+
* [0] - full match
|
877 |
+
*
|
878 |
+
* [1] - tag name
|
879 |
+
* ([\w:\*-]*)
|
880 |
+
* Matches the tag name consisting of zero or more words, colons,
|
881 |
+
* asterisks and hyphens.
|
882 |
+
*
|
883 |
+
* [2] - id name
|
884 |
+
* (?:\#([\w-]+))
|
885 |
+
* Optionally matches a id name, consisting of an "#" followed by
|
886 |
+
* the id name (one or more words and hyphens).
|
887 |
+
*
|
888 |
+
* [3] - class names (including dots)
|
889 |
+
* (?:\.([\w\.-]+))?
|
890 |
+
* Optionally matches a list of classs, consisting of an "."
|
891 |
+
* followed by the class name (one or more words and hyphens)
|
892 |
+
* where multiple classes can be chained (i.e. ".foo.bar.baz")
|
893 |
+
*
|
894 |
+
* [4] - attributes
|
895 |
+
* ((?:\[@?(?:!?[\w:-]+)(?:(?:[!*^$|~]?=)[\"']?(?:.*?)[\"']?)?(?:\s*?(?:[iIsS])?)?\])+)?
|
896 |
+
* Optionally matches the attributes list
|
897 |
+
*
|
898 |
+
* [5] - separator
|
899 |
+
* ([\/, >+~]+)
|
900 |
+
* Matches the selector list separator
|
901 |
+
*/
|
902 |
+
// phpcs:ignore Generic.Files.LineLength
|
903 |
+
$pattern = "/([\w:\*-]*)(?:\#([\w-]+))?(?:|\.([\w\.-]+))?((?:\[@?(?:!?[\w:-]+)(?:(?:[!*^$|~]?=)[\"']?(?:.*?)[\"']?)?(?:\s*?(?:[iIsS])?)?\])+)?([\/, >+~]+)/is";
|
904 |
+
|
905 |
+
preg_match_all(
|
906 |
+
$pattern,
|
907 |
+
trim($selector_string) . ' ', // Add final ' ' as pseudo separator
|
908 |
+
$matches,
|
909 |
+
PREG_SET_ORDER
|
910 |
+
);
|
911 |
+
|
912 |
+
if (is_object($debug_object)) {
|
913 |
+
$debug_object->debug_log(2, 'Matches Array: ', $matches);
|
914 |
+
}
|
915 |
+
|
916 |
+
$selectors = array();
|
917 |
+
$result = array();
|
918 |
+
|
919 |
+
foreach ($matches as $m) {
|
920 |
+
$m[0] = trim($m[0]);
|
921 |
+
|
922 |
+
// Skip NoOps
|
923 |
+
if ($m[0] === '' || $m[0] === '/' || $m[0] === '//') { continue; }
|
924 |
+
|
925 |
+
// Convert to lowercase
|
926 |
+
if ($this->dom->lowercase) {
|
927 |
+
$m[1] = strtolower($m[1]);
|
928 |
+
}
|
929 |
+
|
930 |
+
// Extract classes
|
931 |
+
if ($m[3] !== '') { $m[3] = explode('.', $m[3]); }
|
932 |
+
|
933 |
+
/* Extract attributes (pattern based on the pattern above!)
|
934 |
+
|
935 |
+
* [0] - full match
|
936 |
+
* [1] - attribute name
|
937 |
+
* [2] - attribute expression
|
938 |
+
* [3] - attribute value
|
939 |
+
* [4] - case sensitivity
|
940 |
+
*
|
941 |
+
* Note: Attributes can be negated with a "!" prefix to their name
|
942 |
+
*/
|
943 |
+
if($m[4] !== '') {
|
944 |
+
preg_match_all(
|
945 |
+
"/\[@?(!?[\w:-]+)(?:([!*^$|~]?=)[\"']?(.*?)[\"']?)?(?:\s+?([iIsS])?)?\]/is",
|
946 |
+
trim($m[4]),
|
947 |
+
$attributes,
|
948 |
+
PREG_SET_ORDER
|
949 |
+
);
|
950 |
+
|
951 |
+
// Replace element by array
|
952 |
+
$m[4] = array();
|
953 |
+
|
954 |
+
foreach($attributes as $att) {
|
955 |
+
// Skip empty matches
|
956 |
+
if(trim($att[0]) === '') { continue; }
|
957 |
+
|
958 |
+
$inverted = (isset($att[1][0]) && $att[1][0] === '!');
|
959 |
+
$m[4][] = array(
|
960 |
+
$inverted ? substr($att[1], 1) : $att[1], // Name
|
961 |
+
(isset($att[2])) ? $att[2] : '', // Expression
|
962 |
+
(isset($att[3])) ? $att[3] : '', // Value
|
963 |
+
$inverted, // Inverted Flag
|
964 |
+
(isset($att[4])) ? strtolower($att[4]) : '', // Case-Sensitivity
|
965 |
+
);
|
966 |
+
}
|
967 |
+
}
|
968 |
+
|
969 |
+
// Sanitize Separator
|
970 |
+
if ($m[5] !== '' && trim($m[5]) === '') { // Descendant Separator
|
971 |
+
$m[5] = ' ';
|
972 |
+
} else { // Other Separator
|
973 |
+
$m[5] = trim($m[5]);
|
974 |
+
}
|
975 |
+
|
976 |
+
// Clear Separator if it's a Selector List
|
977 |
+
if ($is_list = ($m[5] === ',')) { $m[5] = ''; }
|
978 |
+
|
979 |
+
// Remove full match before adding to results
|
980 |
+
array_shift($m);
|
981 |
+
$result[] = $m;
|
982 |
+
|
983 |
+
if ($is_list) { // Selector List
|
984 |
+
$selectors[] = $result;
|
985 |
+
$result = array();
|
986 |
+
}
|
987 |
+
}
|
988 |
+
|
989 |
+
if (count($result) > 0) { $selectors[] = $result; }
|
990 |
+
return $selectors;
|
991 |
+
}
|
992 |
+
|
993 |
+
function __get($name)
|
994 |
+
{
|
995 |
+
if (isset($this->attr[$name])) {
|
996 |
+
return $this->convert_text($this->attr[$name]);
|
997 |
+
}
|
998 |
+
switch ($name) {
|
999 |
+
case 'outertext': return $this->outertext();
|
1000 |
+
case 'innertext': return $this->innertext();
|
1001 |
+
case 'plaintext': return $this->text();
|
1002 |
+
case 'xmltext': return $this->xmltext();
|
1003 |
+
default: return array_key_exists($name, $this->attr);
|
1004 |
+
}
|
1005 |
+
}
|
1006 |
+
|
1007 |
+
function __set($name, $value)
|
1008 |
+
{
|
1009 |
+
global $debug_object;
|
1010 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
1011 |
+
|
1012 |
+
switch ($name) {
|
1013 |
+
case 'outertext': return $this->_[HDOM_INFO_OUTER] = $value;
|
1014 |
+
case 'innertext':
|
1015 |
+
if (isset($this->_[HDOM_INFO_TEXT])) {
|
1016 |
+
return $this->_[HDOM_INFO_TEXT] = $value;
|
1017 |
+
}
|
1018 |
+
return $this->_[HDOM_INFO_INNER] = $value;
|
1019 |
+
}
|
1020 |
+
|
1021 |
+
if (!isset($this->attr[$name])) {
|
1022 |
+
$this->_[HDOM_INFO_SPACE][] = array(' ', '', '');
|
1023 |
+
$this->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_DOUBLE;
|
1024 |
+
}
|
1025 |
+
|
1026 |
+
$this->attr[$name] = $value;
|
1027 |
+
}
|
1028 |
+
|
1029 |
+
function __isset($name)
|
1030 |
+
{
|
1031 |
+
switch ($name) {
|
1032 |
+
case 'outertext': return true;
|
1033 |
+
case 'innertext': return true;
|
1034 |
+
case 'plaintext': return true;
|
1035 |
+
}
|
1036 |
+
//no value attr: nowrap, checked selected...
|
1037 |
+
return (array_key_exists($name, $this->attr)) ? true : isset($this->attr[$name]);
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
function __unset($name)
|
1041 |
+
{
|
1042 |
+
if (isset($this->attr[$name])) { unset($this->attr[$name]); }
|
1043 |
+
}
|
1044 |
+
|
1045 |
+
function convert_text($text)
|
1046 |
+
{
|
1047 |
+
global $debug_object;
|
1048 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
1049 |
+
|
1050 |
+
$converted_text = $text;
|
1051 |
+
|
1052 |
+
$sourceCharset = '';
|
1053 |
+
$targetCharset = '';
|
1054 |
+
|
1055 |
+
if ($this->dom) {
|
1056 |
+
$sourceCharset = strtoupper($this->dom->_charset);
|
1057 |
+
$targetCharset = strtoupper($this->dom->_target_charset);
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
if (is_object($debug_object)) {
|
1061 |
+
$debug_object->debug_log(3,
|
1062 |
+
'source charset: '
|
1063 |
+
. $sourceCharset
|
1064 |
+
. ' target charaset: '
|
1065 |
+
. $targetCharset
|
1066 |
+
);
|
1067 |
+
}
|
1068 |
+
|
1069 |
+
if (!empty($sourceCharset)
|
1070 |
+
&& !empty($targetCharset)
|
1071 |
+
&& (strcasecmp($sourceCharset, $targetCharset) != 0)) {
|
1072 |
+
// Check if the reported encoding could have been incorrect and the text is actually already UTF-8
|
1073 |
+
if ((strcasecmp($targetCharset, 'UTF-8') == 0)
|
1074 |
+
&& ($this->is_utf8($text))) {
|
1075 |
+
$converted_text = $text;
|
1076 |
+
} else {
|
1077 |
+
$converted_text = iconv($sourceCharset, $targetCharset, $text);
|
1078 |
+
}
|
1079 |
+
}
|
1080 |
+
|
1081 |
+
// Lets make sure that we don't have that silly BOM issue with any of the utf-8 text we output.
|
1082 |
+
if ($targetCharset === 'UTF-8') {
|
1083 |
+
if (substr($converted_text, 0, 3) === "\xef\xbb\xbf") {
|
1084 |
+
$converted_text = substr($converted_text, 3);
|
1085 |
+
}
|
1086 |
+
|
1087 |
+
if (substr($converted_text, -3) === "\xef\xbb\xbf") {
|
1088 |
+
$converted_text = substr($converted_text, 0, -3);
|
1089 |
+
}
|
1090 |
+
}
|
1091 |
+
|
1092 |
+
return $converted_text;
|
1093 |
+
}
|
1094 |
+
|
1095 |
+
static function is_utf8($str)
|
1096 |
+
{
|
1097 |
+
$c = 0; $b = 0;
|
1098 |
+
$bits = 0;
|
1099 |
+
$len = strlen($str);
|
1100 |
+
for($i = 0; $i < $len; $i++) {
|
1101 |
+
$c = ord($str[$i]);
|
1102 |
+
if($c > 128) {
|
1103 |
+
if(($c >= 254)) { return false; }
|
1104 |
+
elseif($c >= 252) { $bits = 6; }
|
1105 |
+
elseif($c >= 248) { $bits = 5; }
|
1106 |
+
elseif($c >= 240) { $bits = 4; }
|
1107 |
+
elseif($c >= 224) { $bits = 3; }
|
1108 |
+
elseif($c >= 192) { $bits = 2; }
|
1109 |
+
else { return false; }
|
1110 |
+
if(($i + $bits) > $len) { return false; }
|
1111 |
+
while($bits > 1) {
|
1112 |
+
$i++;
|
1113 |
+
$b = ord($str[$i]);
|
1114 |
+
if($b < 128 || $b > 191) { return false; }
|
1115 |
+
$bits--;
|
1116 |
+
}
|
1117 |
+
}
|
1118 |
+
}
|
1119 |
+
return true;
|
1120 |
+
}
|
1121 |
+
|
1122 |
+
function get_display_size()
|
1123 |
+
{
|
1124 |
+
global $debug_object;
|
1125 |
+
|
1126 |
+
$width = -1;
|
1127 |
+
$height = -1;
|
1128 |
+
|
1129 |
+
if ($this->tag !== 'img') {
|
1130 |
+
return false;
|
1131 |
+
}
|
1132 |
+
|
1133 |
+
// See if there is aheight or width attribute in the tag itself.
|
1134 |
+
if (isset($this->attr['width'])) {
|
1135 |
+
$width = $this->attr['width'];
|
1136 |
+
}
|
1137 |
+
|
1138 |
+
if (isset($this->attr['height'])) {
|
1139 |
+
$height = $this->attr['height'];
|
1140 |
+
}
|
1141 |
+
|
1142 |
+
// Now look for an inline style.
|
1143 |
+
if (isset($this->attr['style'])) {
|
1144 |
+
// Thanks to user gnarf from stackoverflow for this regular expression.
|
1145 |
+
$attributes = array();
|
1146 |
+
|
1147 |
+
preg_match_all(
|
1148 |
+
'/([\w-]+)\s*:\s*([^;]+)\s*;?/',
|
1149 |
+
$this->attr['style'],
|
1150 |
+
$matches,
|
1151 |
+
PREG_SET_ORDER
|
1152 |
+
);
|
1153 |
+
|
1154 |
+
foreach ($matches as $match) {
|
1155 |
+
$attributes[$match[1]] = $match[2];
|
1156 |
+
}
|
1157 |
+
|
1158 |
+
// If there is a width in the style attributes:
|
1159 |
+
if (isset($attributes['width']) && $width == -1) {
|
1160 |
+
// check that the last two characters are px (pixels)
|
1161 |
+
if (strtolower(substr($attributes['width'], -2)) === 'px') {
|
1162 |
+
$proposed_width = substr($attributes['width'], 0, -2);
|
1163 |
+
// Now make sure that it's an integer and not something stupid.
|
1164 |
+
if (filter_var($proposed_width, FILTER_VALIDATE_INT)) {
|
1165 |
+
$width = $proposed_width;
|
1166 |
+
}
|
1167 |
+
}
|
1168 |
+
}
|
1169 |
+
|
1170 |
+
// If there is a width in the style attributes:
|
1171 |
+
if (isset($attributes['height']) && $height == -1) {
|
1172 |
+
// check that the last two characters are px (pixels)
|
1173 |
+
if (strtolower(substr($attributes['height'], -2)) == 'px') {
|
1174 |
+
$proposed_height = substr($attributes['height'], 0, -2);
|
1175 |
+
// Now make sure that it's an integer and not something stupid.
|
1176 |
+
if (filter_var($proposed_height, FILTER_VALIDATE_INT)) {
|
1177 |
+
$height = $proposed_height;
|
1178 |
+
}
|
1179 |
+
}
|
1180 |
+
}
|
1181 |
+
|
1182 |
+
}
|
1183 |
+
|
1184 |
+
// Future enhancement:
|
1185 |
+
// Look in the tag to see if there is a class or id specified that has
|
1186 |
+
// a height or width attribute to it.
|
1187 |
+
|
1188 |
+
// Far future enhancement
|
1189 |
+
// Look at all the parent tags of this image to see if they specify a
|
1190 |
+
// class or id that has an img selector that specifies a height or width
|
1191 |
+
// Note that in this case, the class or id will have the img subselector
|
1192 |
+
// for it to apply to the image.
|
1193 |
+
|
1194 |
+
// ridiculously far future development
|
1195 |
+
// If the class or id is specified in a SEPARATE css file thats not on
|
1196 |
+
// the page, go get it and do what we were just doing for the ones on
|
1197 |
+
// the page.
|
1198 |
+
|
1199 |
+
$result = array(
|
1200 |
+
'height' => $height,
|
1201 |
+
'width' => $width
|
1202 |
+
);
|
1203 |
+
|
1204 |
+
return $result;
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
function save($filepath = '')
|
1208 |
+
{
|
1209 |
+
$ret = $this->outertext();
|
1210 |
+
|
1211 |
+
if ($filepath !== '') {
|
1212 |
+
file_put_contents($filepath, $ret, LOCK_EX);
|
1213 |
+
}
|
1214 |
+
|
1215 |
+
return $ret;
|
1216 |
+
}
|
1217 |
+
|
1218 |
+
function addClass($class)
|
1219 |
+
{
|
1220 |
+
if (is_string($class)) {
|
1221 |
+
$class = explode(' ', $class);
|
1222 |
+
}
|
1223 |
+
|
1224 |
+
if (is_array($class)) {
|
1225 |
+
foreach($class as $c) {
|
1226 |
+
if (isset($this->class)) {
|
1227 |
+
if ($this->hasClass($c)) {
|
1228 |
+
continue;
|
1229 |
+
} else {
|
1230 |
+
$this->class .= ' ' . $c;
|
1231 |
+
}
|
1232 |
+
} else {
|
1233 |
+
$this->class = $c;
|
1234 |
+
}
|
1235 |
+
}
|
1236 |
+
} else {
|
1237 |
+
|
1238 |
+
if (isset( $debug_object) && is_object($debug_object)) {
|
1239 |
+
$debug_object->debug_log(2, 'Invalid type: ', gettype($class));
|
1240 |
+
}
|
1241 |
+
}
|
1242 |
+
}
|
1243 |
+
|
1244 |
+
function hasClass($class)
|
1245 |
+
{
|
1246 |
+
if (is_string($class)) {
|
1247 |
+
if (isset($this->class)) {
|
1248 |
+
return in_array($class, explode(' ', $this->class), true);
|
1249 |
+
}
|
1250 |
+
} else {
|
1251 |
+
if (isset( $debug_object) && is_object($debug_object)) {
|
1252 |
+
$debug_object->debug_log(2, 'Invalid type: ', gettype($class));
|
1253 |
+
}
|
1254 |
+
}
|
1255 |
+
|
1256 |
+
return false;
|
1257 |
+
}
|
1258 |
+
|
1259 |
+
function removeClass($class = null)
|
1260 |
+
{
|
1261 |
+
if (!isset($this->class)) {
|
1262 |
+
return;
|
1263 |
+
}
|
1264 |
+
|
1265 |
+
if (is_null($class)) {
|
1266 |
+
$this->removeAttribute('class');
|
1267 |
+
return;
|
1268 |
+
}
|
1269 |
+
|
1270 |
+
if (is_string($class)) {
|
1271 |
+
$class = explode(' ', $class);
|
1272 |
+
}
|
1273 |
+
|
1274 |
+
if (is_array($class)) {
|
1275 |
+
$class = array_diff(explode(' ', $this->class), $class);
|
1276 |
+
if (empty($class)) {
|
1277 |
+
$this->removeAttribute('class');
|
1278 |
+
} else {
|
1279 |
+
$this->class = implode(' ', $class);
|
1280 |
+
}
|
1281 |
+
}
|
1282 |
+
}
|
1283 |
+
|
1284 |
+
function getAllAttributes()
|
1285 |
+
{
|
1286 |
+
return $this->attr;
|
1287 |
+
}
|
1288 |
+
|
1289 |
+
function getAttribute($name)
|
1290 |
+
{
|
1291 |
+
return $this->__get($name);
|
1292 |
+
}
|
1293 |
+
|
1294 |
+
function setAttribute($name, $value)
|
1295 |
+
{
|
1296 |
+
$this->__set($name, $value);
|
1297 |
+
}
|
1298 |
+
|
1299 |
+
function hasAttribute($name)
|
1300 |
+
{
|
1301 |
+
return $this->__isset($name);
|
1302 |
+
}
|
1303 |
+
|
1304 |
+
function removeAttribute($name)
|
1305 |
+
{
|
1306 |
+
$this->__set($name, null);
|
1307 |
+
}
|
1308 |
+
|
1309 |
+
function remove()
|
1310 |
+
{
|
1311 |
+
if ($this->parent) {
|
1312 |
+
$this->parent->removeChild($this);
|
1313 |
+
}
|
1314 |
+
}
|
1315 |
+
|
1316 |
+
function removeChild($node)
|
1317 |
+
{
|
1318 |
+
$nidx = array_search($node, $this->nodes, true);
|
1319 |
+
$cidx = array_search($node, $this->children, true);
|
1320 |
+
$didx = array_search($node, $this->dom->nodes, true);
|
1321 |
+
|
1322 |
+
if ($nidx !== false && $cidx !== false && $didx !== false) {
|
1323 |
+
|
1324 |
+
foreach($node->children as $child) {
|
1325 |
+
$node->removeChild($child);
|
1326 |
+
}
|
1327 |
+
|
1328 |
+
foreach($node->nodes as $entity) {
|
1329 |
+
$enidx = array_search($entity, $node->nodes, true);
|
1330 |
+
$edidx = array_search($entity, $node->dom->nodes, true);
|
1331 |
+
|
1332 |
+
if ($enidx !== false && $edidx !== false) {
|
1333 |
+
unset($node->nodes[$enidx]);
|
1334 |
+
unset($node->dom->nodes[$edidx]);
|
1335 |
+
}
|
1336 |
+
}
|
1337 |
+
|
1338 |
+
unset($this->nodes[$nidx]);
|
1339 |
+
unset($this->children[$cidx]);
|
1340 |
+
unset($this->dom->nodes[$didx]);
|
1341 |
+
|
1342 |
+
$node->clear();
|
1343 |
+
|
1344 |
+
}
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
function getElementById($id)
|
1348 |
+
{
|
1349 |
+
return $this->find("#$id", 0);
|
1350 |
+
}
|
1351 |
+
|
1352 |
+
function getElementsById($id, $idx = null)
|
1353 |
+
{
|
1354 |
+
return $this->find("#$id", $idx);
|
1355 |
+
}
|
1356 |
+
|
1357 |
+
function getElementByTagName($name)
|
1358 |
+
{
|
1359 |
+
return $this->find($name, 0);
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
function getElementsByTagName($name, $idx = null)
|
1363 |
+
{
|
1364 |
+
return $this->find($name, $idx);
|
1365 |
+
}
|
1366 |
+
|
1367 |
+
function parentNode()
|
1368 |
+
{
|
1369 |
+
return $this->parent();
|
1370 |
+
}
|
1371 |
+
|
1372 |
+
function childNodes($idx = -1)
|
1373 |
+
{
|
1374 |
+
return $this->children($idx);
|
1375 |
+
}
|
1376 |
+
|
1377 |
+
function firstChild()
|
1378 |
+
{
|
1379 |
+
return $this->first_child();
|
1380 |
+
}
|
1381 |
+
|
1382 |
+
function lastChild()
|
1383 |
+
{
|
1384 |
+
return $this->last_child();
|
1385 |
+
}
|
1386 |
+
|
1387 |
+
function nextSibling()
|
1388 |
+
{
|
1389 |
+
return $this->next_sibling();
|
1390 |
+
}
|
1391 |
+
|
1392 |
+
function previousSibling()
|
1393 |
+
{
|
1394 |
+
return $this->prev_sibling();
|
1395 |
+
}
|
1396 |
+
|
1397 |
+
function hasChildNodes()
|
1398 |
+
{
|
1399 |
+
return $this->has_child();
|
1400 |
+
}
|
1401 |
+
|
1402 |
+
function nodeName()
|
1403 |
+
{
|
1404 |
+
return $this->tag;
|
1405 |
+
}
|
1406 |
+
|
1407 |
+
function appendChild($node)
|
1408 |
+
{
|
1409 |
+
$node->parent($this);
|
1410 |
+
return $node;
|
1411 |
+
}
|
1412 |
+
|
1413 |
+
}
|
1414 |
+
|
1415 |
+
class simple_html_dom
|
1416 |
+
{
|
1417 |
+
/** @var null | simple_html_dom_node */
|
1418 |
+
public $root = null;
|
1419 |
+
public $nodes = array();
|
1420 |
+
public $callback = null;
|
1421 |
+
public $lowercase = false;
|
1422 |
+
public $original_size;
|
1423 |
+
public $size;
|
1424 |
+
|
1425 |
+
protected $pos;
|
1426 |
+
protected $doc;
|
1427 |
+
protected $char;
|
1428 |
+
|
1429 |
+
protected $cursor;
|
1430 |
+
protected $parent;
|
1431 |
+
protected $noise = array();
|
1432 |
+
protected $token_blank = " \t\r\n";
|
1433 |
+
protected $token_equal = ' =/>';
|
1434 |
+
protected $token_slash = " />\r\n\t";
|
1435 |
+
protected $token_attr = ' >';
|
1436 |
+
|
1437 |
+
public $_charset = '';
|
1438 |
+
public $_target_charset = '';
|
1439 |
+
|
1440 |
+
protected $default_br_text = '';
|
1441 |
+
|
1442 |
+
public $default_span_text = '';
|
1443 |
+
|
1444 |
+
protected $self_closing_tags = array(
|
1445 |
+
'area' => 1,
|
1446 |
+
'base' => 1,
|
1447 |
+
'br' => 1,
|
1448 |
+
'col' => 1,
|
1449 |
+
'embed' => 1,
|
1450 |
+
'hr' => 1,
|
1451 |
+
'img' => 1,
|
1452 |
+
'input' => 1,
|
1453 |
+
'link' => 1,
|
1454 |
+
'meta' => 1,
|
1455 |
+
'param' => 1,
|
1456 |
+
'source' => 1,
|
1457 |
+
'track' => 1,
|
1458 |
+
'wbr' => 1
|
1459 |
+
);
|
1460 |
+
protected $block_tags = array(
|
1461 |
+
'body' => 1,
|
1462 |
+
'div' => 1,
|
1463 |
+
'form' => 1,
|
1464 |
+
'root' => 1,
|
1465 |
+
'span' => 1,
|
1466 |
+
'table' => 1
|
1467 |
+
);
|
1468 |
+
protected $optional_closing_tags = array(
|
1469 |
+
// Not optional, see
|
1470 |
+
// https://www.w3.org/TR/html/textlevel-semantics.html#the-b-element
|
1471 |
+
'b' => array('b' => 1),
|
1472 |
+
'dd' => array('dd' => 1, 'dt' => 1),
|
1473 |
+
// Not optional, see
|
1474 |
+
// https://www.w3.org/TR/html/grouping-content.html#the-dl-element
|
1475 |
+
'dl' => array('dd' => 1, 'dt' => 1),
|
1476 |
+
'dt' => array('dd' => 1, 'dt' => 1),
|
1477 |
+
'li' => array('li' => 1),
|
1478 |
+
'optgroup' => array('optgroup' => 1, 'option' => 1),
|
1479 |
+
'option' => array('optgroup' => 1, 'option' => 1),
|
1480 |
+
'p' => array('p' => 1),
|
1481 |
+
'rp' => array('rp' => 1, 'rt' => 1),
|
1482 |
+
'rt' => array('rp' => 1, 'rt' => 1),
|
1483 |
+
'td' => array('td' => 1, 'th' => 1),
|
1484 |
+
'th' => array('td' => 1, 'th' => 1),
|
1485 |
+
'tr' => array('td' => 1, 'th' => 1, 'tr' => 1),
|
1486 |
+
);
|
1487 |
+
|
1488 |
+
function __construct(
|
1489 |
+
$str = null,
|
1490 |
+
$lowercase = true,
|
1491 |
+
$forceTagsClosed = true,
|
1492 |
+
$target_charset = DEFAULT_TARGET_CHARSET,
|
1493 |
+
$stripRN = true,
|
1494 |
+
$defaultBRText = DEFAULT_BR_TEXT,
|
1495 |
+
$defaultSpanText = DEFAULT_SPAN_TEXT,
|
1496 |
+
$options = 0)
|
1497 |
+
{
|
1498 |
+
if ($str) {
|
1499 |
+
if (preg_match('/^http:\/\//i', $str) || is_file($str)) {
|
1500 |
+
$this->load_file($str);
|
1501 |
+
} else {
|
1502 |
+
$this->load(
|
1503 |
+
$str,
|
1504 |
+
$lowercase,
|
1505 |
+
$stripRN,
|
1506 |
+
$defaultBRText,
|
1507 |
+
$defaultSpanText,
|
1508 |
+
$options
|
1509 |
+
);
|
1510 |
+
}
|
1511 |
+
}
|
1512 |
+
// Forcing tags to be closed implies that we don't trust the html, but
|
1513 |
+
// it can lead to parsing errors if we SHOULD trust the html.
|
1514 |
+
if (!$forceTagsClosed) {
|
1515 |
+
$this->optional_closing_array = array();
|
1516 |
+
}
|
1517 |
+
|
1518 |
+
$this->_target_charset = $target_charset;
|
1519 |
+
}
|
1520 |
+
|
1521 |
+
function __destruct()
|
1522 |
+
{
|
1523 |
+
$this->clear();
|
1524 |
+
}
|
1525 |
+
|
1526 |
+
/**
|
1527 |
+
* @param $str
|
1528 |
+
* @param bool $lowercase
|
1529 |
+
* @param bool $stripRN
|
1530 |
+
* @param string $defaultBRText
|
1531 |
+
* @param string $defaultSpanText
|
1532 |
+
* @param int $options
|
1533 |
+
*
|
1534 |
+
* @return $this
|
1535 |
+
*/
|
1536 |
+
function load(
|
1537 |
+
$str,
|
1538 |
+
$lowercase = true,
|
1539 |
+
$stripRN = true,
|
1540 |
+
$defaultBRText = DEFAULT_BR_TEXT,
|
1541 |
+
$defaultSpanText = DEFAULT_SPAN_TEXT,
|
1542 |
+
$options = 0)
|
1543 |
+
{
|
1544 |
+
global $debug_object;
|
1545 |
+
|
1546 |
+
// prepare
|
1547 |
+
$this->prepare($str, $lowercase, $defaultBRText, $defaultSpanText);
|
1548 |
+
|
1549 |
+
// Per sourceforge http://sourceforge.net/tracker/?func=detail&aid=2949097&group_id=218559&atid=1044037
|
1550 |
+
// Script tags removal now preceeds style tag removal.
|
1551 |
+
// strip out <script> tags
|
1552 |
+
$this->remove_noise("'<\s*script[^>]*[^/]>(.*?)<\s*/\s*script\s*>'is");
|
1553 |
+
$this->remove_noise("'<\s*script\s*>(.*?)<\s*/\s*script\s*>'is");
|
1554 |
+
|
1555 |
+
// strip out the \r \n's if we are told to.
|
1556 |
+
if ($stripRN) {
|
1557 |
+
$this->doc = str_replace("\r", ' ', $this->doc);
|
1558 |
+
$this->doc = str_replace("\n", ' ', $this->doc);
|
1559 |
+
|
1560 |
+
// set the length of content since we have changed it.
|
1561 |
+
$this->size = strlen($this->doc);
|
1562 |
+
}
|
1563 |
+
|
1564 |
+
// strip out cdata
|
1565 |
+
$this->remove_noise("'<!\[CDATA\[(.*?)\]\]>'is", true);
|
1566 |
+
// strip out comments
|
1567 |
+
$this->remove_noise("'<!--(.*?)-->'is");
|
1568 |
+
// strip out <style> tags
|
1569 |
+
$this->remove_noise("'<\s*style[^>]*[^/]>(.*?)<\s*/\s*style\s*>'is");
|
1570 |
+
$this->remove_noise("'<\s*style\s*>(.*?)<\s*/\s*style\s*>'is");
|
1571 |
+
// strip out preformatted tags
|
1572 |
+
$this->remove_noise("'<\s*(?:code)[^>]*>(.*?)<\s*/\s*(?:code)\s*>'is");
|
1573 |
+
// strip out server side scripts
|
1574 |
+
$this->remove_noise("'(<\?)(.*?)(\?>)'s", true);
|
1575 |
+
|
1576 |
+
if($options & HDOM_SMARTY_AS_TEXT) { // Strip Smarty scripts
|
1577 |
+
$this->remove_noise("'(\{\w)(.*?)(\})'s", true);
|
1578 |
+
}
|
1579 |
+
|
1580 |
+
// parsing
|
1581 |
+
$this->parse();
|
1582 |
+
// end
|
1583 |
+
$this->root->_[HDOM_INFO_END] = $this->cursor;
|
1584 |
+
$this->parse_charset();
|
1585 |
+
|
1586 |
+
// make load function chainable
|
1587 |
+
return $this;
|
1588 |
+
}
|
1589 |
+
|
1590 |
+
function load_file()
|
1591 |
+
{
|
1592 |
+
$args = func_get_args();
|
1593 |
+
|
1594 |
+
if(($doc = call_user_func_array('file_get_contents', $args)) !== false) {
|
1595 |
+
$this->load($doc, true);
|
1596 |
+
} else {
|
1597 |
+
return false;
|
1598 |
+
}
|
1599 |
+
}
|
1600 |
+
|
1601 |
+
function set_callback($function_name)
|
1602 |
+
{
|
1603 |
+
$this->callback = $function_name;
|
1604 |
+
}
|
1605 |
+
|
1606 |
+
function remove_callback()
|
1607 |
+
{
|
1608 |
+
$this->callback = null;
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
function save($filepath = '')
|
1612 |
+
{
|
1613 |
+
$ret = $this->root->innertext();
|
1614 |
+
if ($filepath !== '') { file_put_contents($filepath, $ret, LOCK_EX); }
|
1615 |
+
return $ret;
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
/**
|
1619 |
+
* @param $selector
|
1620 |
+
* @param null $idx
|
1621 |
+
* @param false $lowercase
|
1622 |
+
*
|
1623 |
+
* @return simple_html_dom_node | mixed
|
1624 |
+
*/
|
1625 |
+
function find($selector, $idx = null, $lowercase = false)
|
1626 |
+
{
|
1627 |
+
return $this->root->find($selector, $idx, $lowercase);
|
1628 |
+
}
|
1629 |
+
|
1630 |
+
function clear()
|
1631 |
+
{
|
1632 |
+
if (isset($this->nodes)) {
|
1633 |
+
foreach ($this->nodes as $n) {
|
1634 |
+
$n->clear();
|
1635 |
+
$n = null;
|
1636 |
+
}
|
1637 |
+
}
|
1638 |
+
|
1639 |
+
// This add next line is documented in the sourceforge repository.
|
1640 |
+
// 2977248 as a fix for ongoing memory leaks that occur even with the
|
1641 |
+
// use of clear.
|
1642 |
+
if (isset($this->children)) {
|
1643 |
+
foreach ($this->children as $n) {
|
1644 |
+
$n->clear();
|
1645 |
+
$n = null;
|
1646 |
+
}
|
1647 |
+
}
|
1648 |
+
|
1649 |
+
if (isset($this->parent)) {
|
1650 |
+
$this->parent->clear();
|
1651 |
+
unset($this->parent);
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
if (isset($this->root)) {
|
1655 |
+
$this->root->clear();
|
1656 |
+
unset($this->root);
|
1657 |
+
}
|
1658 |
+
|
1659 |
+
unset($this->doc);
|
1660 |
+
unset($this->noise);
|
1661 |
+
}
|
1662 |
+
|
1663 |
+
function dump($show_attr = true)
|
1664 |
+
{
|
1665 |
+
$this->root->dump($show_attr);
|
1666 |
+
}
|
1667 |
+
|
1668 |
+
protected function prepare(
|
1669 |
+
$str, $lowercase = true,
|
1670 |
+
$defaultBRText = DEFAULT_BR_TEXT,
|
1671 |
+
$defaultSpanText = DEFAULT_SPAN_TEXT)
|
1672 |
+
{
|
1673 |
+
$this->clear();
|
1674 |
+
|
1675 |
+
$this->doc = trim($str);
|
1676 |
+
$this->size = strlen($this->doc);
|
1677 |
+
$this->original_size = $this->size; // original size of the html
|
1678 |
+
$this->pos = 0;
|
1679 |
+
$this->cursor = 1;
|
1680 |
+
$this->noise = array();
|
1681 |
+
$this->nodes = array();
|
1682 |
+
$this->lowercase = $lowercase;
|
1683 |
+
$this->default_br_text = $defaultBRText;
|
1684 |
+
$this->default_span_text = $defaultSpanText;
|
1685 |
+
$this->root = new simple_html_dom_node($this);
|
1686 |
+
$this->root->tag = 'root';
|
1687 |
+
$this->root->_[HDOM_INFO_BEGIN] = -1;
|
1688 |
+
$this->root->nodetype = HDOM_TYPE_ROOT;
|
1689 |
+
$this->parent = $this->root;
|
1690 |
+
if ($this->size > 0) { $this->char = $this->doc[0]; }
|
1691 |
+
}
|
1692 |
+
|
1693 |
+
protected function parse()
|
1694 |
+
{
|
1695 |
+
while (true) {
|
1696 |
+
// Read next tag if there is no text between current position and the
|
1697 |
+
// next opening tag.
|
1698 |
+
if (($s = $this->copy_until_char('<')) === '') {
|
1699 |
+
if($this->read_tag()) {
|
1700 |
+
continue;
|
1701 |
+
} else {
|
1702 |
+
return true;
|
1703 |
+
}
|
1704 |
+
}
|
1705 |
+
|
1706 |
+
// Add a text node for text between tags
|
1707 |
+
$node = new simple_html_dom_node($this);
|
1708 |
+
++$this->cursor;
|
1709 |
+
$node->_[HDOM_INFO_TEXT] = $s;
|
1710 |
+
$this->link_nodes($node, false);
|
1711 |
+
}
|
1712 |
+
}
|
1713 |
+
|
1714 |
+
protected function parse_charset()
|
1715 |
+
{
|
1716 |
+
global $debug_object;
|
1717 |
+
|
1718 |
+
$charset = null;
|
1719 |
+
|
1720 |
+
if (function_exists('get_last_retrieve_url_contents_content_type')) {
|
1721 |
+
$contentTypeHeader = get_last_retrieve_url_contents_content_type();
|
1722 |
+
$success = preg_match('/charset=(.+)/', $contentTypeHeader, $matches);
|
1723 |
+
if ($success) {
|
1724 |
+
$charset = $matches[1];
|
1725 |
+
if (is_object($debug_object)) {
|
1726 |
+
$debug_object->debug_log(2,
|
1727 |
+
'header content-type found charset of: '
|
1728 |
+
. $charset
|
1729 |
+
);
|
1730 |
+
}
|
1731 |
+
}
|
1732 |
+
}
|
1733 |
+
|
1734 |
+
if (empty($charset)) {
|
1735 |
+
// https://www.w3.org/TR/html/document-metadata.html#statedef-http-equiv-content-type
|
1736 |
+
$el = $this->root->find('meta[http-equiv=Content-Type]', 0, true);
|
1737 |
+
|
1738 |
+
if (!empty($el)) {
|
1739 |
+
$fullvalue = $el->content;
|
1740 |
+
if (is_object($debug_object)) {
|
1741 |
+
$debug_object->debug_log(2,
|
1742 |
+
'meta content-type tag found'
|
1743 |
+
. $fullvalue
|
1744 |
+
);
|
1745 |
+
}
|
1746 |
+
|
1747 |
+
if (!empty($fullvalue)) {
|
1748 |
+
$success = preg_match(
|
1749 |
+
'/charset=(.+)/i',
|
1750 |
+
$fullvalue,
|
1751 |
+
$matches
|
1752 |
+
);
|
1753 |
+
|
1754 |
+
if ($success) {
|
1755 |
+
$charset = $matches[1];
|
1756 |
+
} else {
|
1757 |
+
// If there is a meta tag, and they don't specify the
|
1758 |
+
// character set, research says that it's typically
|
1759 |
+
// ISO-8859-1
|
1760 |
+
if (is_object($debug_object)) {
|
1761 |
+
$debug_object->debug_log(2,
|
1762 |
+
'meta content-type tag couldn\'t be parsed. using iso-8859 default.'
|
1763 |
+
);
|
1764 |
+
}
|
1765 |
+
|
1766 |
+
$charset = 'ISO-8859-1';
|
1767 |
+
}
|
1768 |
+
}
|
1769 |
+
}
|
1770 |
+
}
|
1771 |
+
|
1772 |
+
if (empty($charset)) {
|
1773 |
+
// https://www.w3.org/TR/html/document-metadata.html#character-encoding-declaration
|
1774 |
+
if ($meta = $this->root->find('meta[charset]', 0)) {
|
1775 |
+
$charset = $meta->charset;
|
1776 |
+
if (is_object($debug_object)) {
|
1777 |
+
$debug_object->debug_log(2, 'meta charset: ' . $charset);
|
1778 |
+
}
|
1779 |
+
}
|
1780 |
+
}
|
1781 |
+
|
1782 |
+
if (empty($charset)) {
|
1783 |
+
// Try to guess the charset based on the content
|
1784 |
+
// Requires Multibyte String (mbstring) support (optional)
|
1785 |
+
if (function_exists('mb_detect_encoding')) {
|
1786 |
+
/**
|
1787 |
+
* mb_detect_encoding() is not intended to distinguish between
|
1788 |
+
* charsets, especially single-byte charsets. Its primary
|
1789 |
+
* purpose is to detect which multibyte encoding is in use,
|
1790 |
+
* i.e. UTF-8, UTF-16, shift-JIS, etc.
|
1791 |
+
*
|
1792 |
+
* -- https://bugs.php.net/bug.php?id=38138
|
1793 |
+
*
|
1794 |
+
* Adding both CP1251/ISO-8859-5 and CP1252/ISO-8859-1 will
|
1795 |
+
* always result in CP1251/ISO-8859-5 and vice versa.
|
1796 |
+
*
|
1797 |
+
* Thus, only detect if it's either UTF-8 or CP1252/ISO-8859-1
|
1798 |
+
* to stay compatible.
|
1799 |
+
*/
|
1800 |
+
$encoding = mb_detect_encoding(
|
1801 |
+
$this->doc,
|
1802 |
+
array( 'UTF-8', 'CP1252', 'ISO-8859-1' )
|
1803 |
+
);
|
1804 |
+
|
1805 |
+
if ($encoding === 'CP1252' || $encoding === 'ISO-8859-1') {
|
1806 |
+
// Due to a limitation of mb_detect_encoding
|
1807 |
+
// 'CP1251'/'ISO-8859-5' will be detected as
|
1808 |
+
// 'CP1252'/'ISO-8859-1'. This will cause iconv to fail, in
|
1809 |
+
// which case we can simply assume it is the other charset.
|
1810 |
+
if (!@iconv('CP1252', 'UTF-8', $this->doc)) {
|
1811 |
+
$encoding = 'CP1251';
|
1812 |
+
}
|
1813 |
+
}
|
1814 |
+
|
1815 |
+
if ($encoding !== false) {
|
1816 |
+
$charset = $encoding;
|
1817 |
+
if (is_object($debug_object)) {
|
1818 |
+
$debug_object->debug_log(2, 'mb_detect: ' . $charset);
|
1819 |
+
}
|
1820 |
+
}
|
1821 |
+
}
|
1822 |
+
}
|
1823 |
+
|
1824 |
+
if (empty($charset)) {
|
1825 |
+
// Assume it's UTF-8 as it is the most likely charset to be used
|
1826 |
+
$charset = 'UTF-8';
|
1827 |
+
if (is_object($debug_object)) {
|
1828 |
+
$debug_object->debug_log(2, 'No match found, assume ' . $charset);
|
1829 |
+
}
|
1830 |
+
}
|
1831 |
+
|
1832 |
+
// Since CP1252 is a superset, if we get one of it's subsets, we want
|
1833 |
+
// it instead.
|
1834 |
+
if ((strtolower($charset) == 'iso-8859-1')
|
1835 |
+
|| (strtolower($charset) == 'latin1')
|
1836 |
+
|| (strtolower($charset) == 'latin-1')) {
|
1837 |
+
$charset = 'CP1252';
|
1838 |
+
if (is_object($debug_object)) {
|
1839 |
+
$debug_object->debug_log(2,
|
1840 |
+
'replacing ' . $charset . ' with CP1252 as its a superset'
|
1841 |
+
);
|
1842 |
+
}
|
1843 |
+
}
|
1844 |
+
|
1845 |
+
if (is_object($debug_object)) {
|
1846 |
+
$debug_object->debug_log(1, 'EXIT - ' . $charset);
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
return $this->_charset = $charset;
|
1850 |
+
}
|
1851 |
+
|
1852 |
+
protected function read_tag()
|
1853 |
+
{
|
1854 |
+
// Set end position if no further tags found
|
1855 |
+
if ($this->char !== '<') {
|
1856 |
+
$this->root->_[HDOM_INFO_END] = $this->cursor;
|
1857 |
+
return false;
|
1858 |
+
}
|
1859 |
+
|
1860 |
+
$begin_tag_pos = $this->pos;
|
1861 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
1862 |
+
|
1863 |
+
// end tag
|
1864 |
+
if ($this->char === '/') {
|
1865 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
1866 |
+
|
1867 |
+
// Skip whitespace in end tags (i.e. in "</ html>")
|
1868 |
+
$this->skip($this->token_blank);
|
1869 |
+
$tag = $this->copy_until_char('>');
|
1870 |
+
|
1871 |
+
// Skip attributes in end tags
|
1872 |
+
if (($pos = strpos($tag, ' ')) !== false) {
|
1873 |
+
$tag = substr($tag, 0, $pos);
|
1874 |
+
}
|
1875 |
+
|
1876 |
+
$parent_lower = strtolower($this->parent->tag);
|
1877 |
+
$tag_lower = strtolower($tag);
|
1878 |
+
|
1879 |
+
// The end tag is supposed to close the parent tag. Handle situations
|
1880 |
+
// when it doesn't
|
1881 |
+
if ($parent_lower !== $tag_lower) {
|
1882 |
+
// Parent tag does not have to be closed necessarily (optional closing tag)
|
1883 |
+
// Current tag is a block tag, so it may close an ancestor
|
1884 |
+
if (isset($this->optional_closing_tags[$parent_lower])
|
1885 |
+
&& isset($this->block_tags[$tag_lower])) {
|
1886 |
+
|
1887 |
+
$this->parent->_[HDOM_INFO_END] = 0;
|
1888 |
+
$org_parent = $this->parent;
|
1889 |
+
|
1890 |
+
// Traverse ancestors to find a matching opening tag
|
1891 |
+
// Stop at root node
|
1892 |
+
while (($this->parent->parent)
|
1893 |
+
&& strtolower($this->parent->tag) !== $tag_lower
|
1894 |
+
){
|
1895 |
+
$this->parent = $this->parent->parent;
|
1896 |
+
}
|
1897 |
+
|
1898 |
+
// If we don't have a match add current tag as text node
|
1899 |
+
if (strtolower($this->parent->tag) !== $tag_lower) {
|
1900 |
+
$this->parent = $org_parent; // restore origonal parent
|
1901 |
+
|
1902 |
+
if ($this->parent->parent) {
|
1903 |
+
$this->parent = $this->parent->parent;
|
1904 |
+
}
|
1905 |
+
|
1906 |
+
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
1907 |
+
return $this->as_text_node($tag);
|
1908 |
+
}
|
1909 |
+
} elseif (($this->parent->parent)
|
1910 |
+
&& isset($this->block_tags[$tag_lower])
|
1911 |
+
) {
|
1912 |
+
// Grandparent exists and current tag is a block tag, so our
|
1913 |
+
// parent doesn't have an end tag
|
1914 |
+
$this->parent->_[HDOM_INFO_END] = 0; // No end tag
|
1915 |
+
$org_parent = $this->parent;
|
1916 |
+
|
1917 |
+
// Traverse ancestors to find a matching opening tag
|
1918 |
+
// Stop at root node
|
1919 |
+
while (($this->parent->parent)
|
1920 |
+
&& strtolower($this->parent->tag) !== $tag_lower
|
1921 |
+
) {
|
1922 |
+
$this->parent = $this->parent->parent;
|
1923 |
+
}
|
1924 |
+
|
1925 |
+
// If we don't have a match add current tag as text node
|
1926 |
+
if (strtolower($this->parent->tag) !== $tag_lower) {
|
1927 |
+
$this->parent = $org_parent; // restore origonal parent
|
1928 |
+
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
1929 |
+
return $this->as_text_node($tag);
|
1930 |
+
}
|
1931 |
+
} elseif (($this->parent->parent)
|
1932 |
+
&& strtolower($this->parent->parent->tag) === $tag_lower
|
1933 |
+
) { // Grandparent exists and current tag closes it
|
1934 |
+
$this->parent->_[HDOM_INFO_END] = 0;
|
1935 |
+
$this->parent = $this->parent->parent;
|
1936 |
+
} else { // Random tag, add as text node
|
1937 |
+
return $this->as_text_node($tag);
|
1938 |
+
}
|
1939 |
+
}
|
1940 |
+
|
1941 |
+
// Set end position of parent tag to current cursor position
|
1942 |
+
$this->parent->_[HDOM_INFO_END] = $this->cursor;
|
1943 |
+
|
1944 |
+
if ($this->parent->parent) {
|
1945 |
+
$this->parent = $this->parent->parent;
|
1946 |
+
}
|
1947 |
+
|
1948 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
1949 |
+
return true;
|
1950 |
+
}
|
1951 |
+
|
1952 |
+
// start tag
|
1953 |
+
$node = new simple_html_dom_node($this);
|
1954 |
+
$node->_[HDOM_INFO_BEGIN] = $this->cursor;
|
1955 |
+
++$this->cursor;
|
1956 |
+
$tag = $this->copy_until($this->token_slash); // Get tag name
|
1957 |
+
$node->tag_start = $begin_tag_pos;
|
1958 |
+
|
1959 |
+
// doctype, cdata & comments...
|
1960 |
+
// <!DOCTYPE html>
|
1961 |
+
// <![CDATA[ ... ]]>
|
1962 |
+
// <!-- Comment -->
|
1963 |
+
if (isset($tag[0]) && $tag[0] === '!') {
|
1964 |
+
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until_char('>');
|
1965 |
+
|
1966 |
+
if (isset($tag[2]) && $tag[1] === '-' && $tag[2] === '-') { // Comment ("<!--")
|
1967 |
+
$node->nodetype = HDOM_TYPE_COMMENT;
|
1968 |
+
$node->tag = 'comment';
|
1969 |
+
} else { // Could be doctype or CDATA but we don't care
|
1970 |
+
$node->nodetype = HDOM_TYPE_UNKNOWN;
|
1971 |
+
$node->tag = 'unknown';
|
1972 |
+
}
|
1973 |
+
|
1974 |
+
if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
|
1975 |
+
|
1976 |
+
$this->link_nodes($node, true);
|
1977 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
1978 |
+
return true;
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
// The start tag cannot contain another start tag, if so add as text
|
1982 |
+
// i.e. "<<html>"
|
1983 |
+
if ($pos = strpos($tag, '<') !== false) {
|
1984 |
+
$tag = '<' . substr($tag, 0, -1);
|
1985 |
+
$node->_[HDOM_INFO_TEXT] = $tag;
|
1986 |
+
$this->link_nodes($node, false);
|
1987 |
+
$this->char = $this->doc[--$this->pos]; // prev
|
1988 |
+
return true;
|
1989 |
+
}
|
1990 |
+
|
1991 |
+
// Handle invalid tag names (i.e. "<html#doc>")
|
1992 |
+
if (!preg_match('/^\w[\w:-]*$/', $tag)) {
|
1993 |
+
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $this->copy_until('<>');
|
1994 |
+
|
1995 |
+
// Next char is the beginning of a new tag, don't touch it.
|
1996 |
+
if ($this->char === '<') {
|
1997 |
+
$this->link_nodes($node, false);
|
1998 |
+
return true;
|
1999 |
+
}
|
2000 |
+
|
2001 |
+
// Next char closes current tag, add and be done with it.
|
2002 |
+
if ($this->char === '>') { $node->_[HDOM_INFO_TEXT] .= '>'; }
|
2003 |
+
$this->link_nodes($node, false);
|
2004 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2005 |
+
return true;
|
2006 |
+
}
|
2007 |
+
|
2008 |
+
// begin tag, add new node
|
2009 |
+
$node->nodetype = HDOM_TYPE_ELEMENT;
|
2010 |
+
$tag_lower = strtolower($tag);
|
2011 |
+
$node->tag = ($this->lowercase) ? $tag_lower : $tag;
|
2012 |
+
|
2013 |
+
// handle optional closing tags
|
2014 |
+
if (isset($this->optional_closing_tags[$tag_lower])) {
|
2015 |
+
// Traverse ancestors to close all optional closing tags
|
2016 |
+
while (isset($this->optional_closing_tags[$tag_lower][strtolower($this->parent->tag)])) {
|
2017 |
+
$this->parent->_[HDOM_INFO_END] = 0;
|
2018 |
+
$this->parent = $this->parent->parent;
|
2019 |
+
}
|
2020 |
+
$node->parent = $this->parent;
|
2021 |
+
}
|
2022 |
+
|
2023 |
+
$guard = 0; // prevent infinity loop
|
2024 |
+
|
2025 |
+
// [0] Space between tag and first attribute
|
2026 |
+
$space = array($this->copy_skip($this->token_blank), '', '');
|
2027 |
+
|
2028 |
+
// attributes
|
2029 |
+
do {
|
2030 |
+
// Everything until the first equal sign should be the attribute name
|
2031 |
+
$name = $this->copy_until($this->token_equal);
|
2032 |
+
|
2033 |
+
if ($name === '' && $this->char !== null && $space[0] === '') {
|
2034 |
+
break;
|
2035 |
+
}
|
2036 |
+
|
2037 |
+
if ($guard === $this->pos) { // Escape infinite loop
|
2038 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2039 |
+
continue;
|
2040 |
+
}
|
2041 |
+
|
2042 |
+
$guard = $this->pos;
|
2043 |
+
|
2044 |
+
// handle endless '<'
|
2045 |
+
// Out of bounds before the tag ended
|
2046 |
+
if ($this->pos >= $this->size - 1 && $this->char !== '>') {
|
2047 |
+
$node->nodetype = HDOM_TYPE_TEXT;
|
2048 |
+
$node->_[HDOM_INFO_END] = 0;
|
2049 |
+
$node->_[HDOM_INFO_TEXT] = '<' . $tag . $space[0] . $name;
|
2050 |
+
$node->tag = 'text';
|
2051 |
+
$this->link_nodes($node, false);
|
2052 |
+
return true;
|
2053 |
+
}
|
2054 |
+
|
2055 |
+
// handle mismatch '<'
|
2056 |
+
// Attributes cannot start after opening tag
|
2057 |
+
if ($this->doc[$this->pos - 1] == '<') {
|
2058 |
+
$node->nodetype = HDOM_TYPE_TEXT;
|
2059 |
+
$node->tag = 'text';
|
2060 |
+
$node->attr = array();
|
2061 |
+
$node->_[HDOM_INFO_END] = 0;
|
2062 |
+
$node->_[HDOM_INFO_TEXT] = substr(
|
2063 |
+
$this->doc,
|
2064 |
+
$begin_tag_pos,
|
2065 |
+
$this->pos - $begin_tag_pos - 1
|
2066 |
+
);
|
2067 |
+
$this->pos -= 2;
|
2068 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2069 |
+
$this->link_nodes($node, false);
|
2070 |
+
return true;
|
2071 |
+
}
|
2072 |
+
|
2073 |
+
if ($name !== '/' && $name !== '') { // this is a attribute name
|
2074 |
+
// [1] Whitespace after attribute name
|
2075 |
+
$space[1] = $this->copy_skip($this->token_blank);
|
2076 |
+
|
2077 |
+
$name = $this->restore_noise($name); // might be a noisy name
|
2078 |
+
|
2079 |
+
if ($this->lowercase) { $name = strtolower($name); }
|
2080 |
+
|
2081 |
+
if ($this->char === '=') { // attribute with value
|
2082 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2083 |
+
$this->parse_attr($node, $name, $space); // get attribute value
|
2084 |
+
} else {
|
2085 |
+
//no value attr: nowrap, checked selected...
|
2086 |
+
$node->_[HDOM_INFO_QUOTE][] = HDOM_QUOTE_NO;
|
2087 |
+
$node->attr[$name] = true;
|
2088 |
+
if ($this->char != '>') { $this->char = $this->doc[--$this->pos]; } // prev
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
$node->_[HDOM_INFO_SPACE][] = $space;
|
2092 |
+
|
2093 |
+
// prepare for next attribute
|
2094 |
+
$space = array(
|
2095 |
+
$this->copy_skip($this->token_blank),
|
2096 |
+
'',
|
2097 |
+
''
|
2098 |
+
);
|
2099 |
+
} else { // no more attributes
|
2100 |
+
break;
|
2101 |
+
}
|
2102 |
+
} while ($this->char !== '>' && $this->char !== '/'); // go until the tag ended
|
2103 |
+
|
2104 |
+
$this->link_nodes($node, true);
|
2105 |
+
$node->_[HDOM_INFO_ENDSPACE] = $space[0];
|
2106 |
+
|
2107 |
+
// handle empty tags (i.e. "<div/>")
|
2108 |
+
if ($this->copy_until_char('>') === '/') {
|
2109 |
+
$node->_[HDOM_INFO_ENDSPACE] .= '/';
|
2110 |
+
$node->_[HDOM_INFO_END] = 0;
|
2111 |
+
} else {
|
2112 |
+
// reset parent
|
2113 |
+
if (!isset($this->self_closing_tags[strtolower($node->tag)])) {
|
2114 |
+
$this->parent = $node;
|
2115 |
+
}
|
2116 |
+
}
|
2117 |
+
|
2118 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2119 |
+
|
2120 |
+
// If it's a BR tag, we need to set it's text to the default text.
|
2121 |
+
// This way when we see it in plaintext, we can generate formatting that the user wants.
|
2122 |
+
// since a br tag never has sub nodes, this works well.
|
2123 |
+
if ($node->tag === 'br') {
|
2124 |
+
$node->_[HDOM_INFO_INNER] = $this->default_br_text;
|
2125 |
+
}
|
2126 |
+
|
2127 |
+
return true;
|
2128 |
+
}
|
2129 |
+
|
2130 |
+
protected function parse_attr($node, $name, &$space)
|
2131 |
+
{
|
2132 |
+
$is_duplicate = isset($node->attr[$name]);
|
2133 |
+
|
2134 |
+
if (!$is_duplicate) // Copy whitespace between "=" and value
|
2135 |
+
$space[2] = $this->copy_skip($this->token_blank);
|
2136 |
+
|
2137 |
+
switch ($this->char) {
|
2138 |
+
case '"':
|
2139 |
+
$quote_type = HDOM_QUOTE_DOUBLE;
|
2140 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2141 |
+
$value = $this->copy_until_char('"');
|
2142 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2143 |
+
break;
|
2144 |
+
case '\'':
|
2145 |
+
$quote_type = HDOM_QUOTE_SINGLE;
|
2146 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2147 |
+
$value = $this->copy_until_char('\'');
|
2148 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2149 |
+
break;
|
2150 |
+
default:
|
2151 |
+
$quote_type = HDOM_QUOTE_NO;
|
2152 |
+
$value = $this->copy_until($this->token_attr);
|
2153 |
+
}
|
2154 |
+
|
2155 |
+
$value = $this->restore_noise($value);
|
2156 |
+
|
2157 |
+
// PaperG: Attributes should not have \r or \n in them, that counts as
|
2158 |
+
// html whitespace.
|
2159 |
+
$value = str_replace("\r", '', $value);
|
2160 |
+
$value = str_replace("\n", '', $value);
|
2161 |
+
|
2162 |
+
// PaperG: If this is a "class" selector, lets get rid of the preceeding
|
2163 |
+
// and trailing space since some people leave it in the multi class case.
|
2164 |
+
if ($name === 'class') {
|
2165 |
+
$value = trim($value);
|
2166 |
+
}
|
2167 |
+
|
2168 |
+
if (!$is_duplicate) {
|
2169 |
+
$node->_[HDOM_INFO_QUOTE][] = $quote_type;
|
2170 |
+
$node->attr[$name] = $value;
|
2171 |
+
}
|
2172 |
+
}
|
2173 |
+
|
2174 |
+
protected function link_nodes(&$node, $is_child)
|
2175 |
+
{
|
2176 |
+
$node->parent = $this->parent;
|
2177 |
+
$this->parent->nodes[] = $node;
|
2178 |
+
if ($is_child) {
|
2179 |
+
$this->parent->children[] = $node;
|
2180 |
+
}
|
2181 |
+
}
|
2182 |
+
|
2183 |
+
protected function as_text_node($tag)
|
2184 |
+
{
|
2185 |
+
$node = new simple_html_dom_node($this);
|
2186 |
+
++$this->cursor;
|
2187 |
+
$node->_[HDOM_INFO_TEXT] = '</' . $tag . '>';
|
2188 |
+
$this->link_nodes($node, false);
|
2189 |
+
$this->char = (++$this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2190 |
+
return true;
|
2191 |
+
}
|
2192 |
+
|
2193 |
+
protected function skip($chars)
|
2194 |
+
{
|
2195 |
+
$this->pos += strspn($this->doc, $chars, $this->pos);
|
2196 |
+
$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2197 |
+
}
|
2198 |
+
|
2199 |
+
protected function copy_skip($chars)
|
2200 |
+
{
|
2201 |
+
$pos = $this->pos;
|
2202 |
+
$len = strspn($this->doc, $chars, $pos);
|
2203 |
+
$this->pos += $len;
|
2204 |
+
$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2205 |
+
if ($len === 0) { return ''; }
|
2206 |
+
return substr($this->doc, $pos, $len);
|
2207 |
+
}
|
2208 |
+
|
2209 |
+
protected function copy_until($chars)
|
2210 |
+
{
|
2211 |
+
$pos = $this->pos;
|
2212 |
+
$len = strcspn($this->doc, $chars, $pos);
|
2213 |
+
$this->pos += $len;
|
2214 |
+
$this->char = ($this->pos < $this->size) ? $this->doc[$this->pos] : null; // next
|
2215 |
+
return substr($this->doc, $pos, $len);
|
2216 |
+
}
|
2217 |
+
|
2218 |
+
protected function copy_until_char($char)
|
2219 |
+
{
|
2220 |
+
if ($this->char === null) { return ''; }
|
2221 |
+
|
2222 |
+
if (($pos = strpos($this->doc, $char, $this->pos)) === false) {
|
2223 |
+
$ret = substr($this->doc, $this->pos, $this->size - $this->pos);
|
2224 |
+
$this->char = null;
|
2225 |
+
$this->pos = $this->size;
|
2226 |
+
return $ret;
|
2227 |
+
}
|
2228 |
+
|
2229 |
+
if ($pos === $this->pos) { return ''; }
|
2230 |
+
|
2231 |
+
$pos_old = $this->pos;
|
2232 |
+
$this->char = $this->doc[$pos];
|
2233 |
+
$this->pos = $pos;
|
2234 |
+
return substr($this->doc, $pos_old, $pos - $pos_old);
|
2235 |
+
}
|
2236 |
+
|
2237 |
+
protected function remove_noise($pattern, $remove_tag = false)
|
2238 |
+
{
|
2239 |
+
global $debug_object;
|
2240 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
2241 |
+
|
2242 |
+
$count = preg_match_all(
|
2243 |
+
$pattern,
|
2244 |
+
$this->doc,
|
2245 |
+
$matches,
|
2246 |
+
PREG_SET_ORDER | PREG_OFFSET_CAPTURE
|
2247 |
+
);
|
2248 |
+
|
2249 |
+
for ($i = $count - 1; $i > -1; --$i) {
|
2250 |
+
$key = '___noise___' . sprintf('% 5d', count($this->noise) + 1000);
|
2251 |
+
|
2252 |
+
if (is_object($debug_object)) {
|
2253 |
+
$debug_object->debug_log(2, 'key is: ' . $key);
|
2254 |
+
}
|
2255 |
+
|
2256 |
+
$idx = ($remove_tag) ? 0 : 1; // 0 = entire match, 1 = submatch
|
2257 |
+
$this->noise[$key] = $matches[$i][$idx][0];
|
2258 |
+
$this->doc = substr_replace($this->doc, $key, $matches[$i][$idx][1], strlen($matches[$i][$idx][0]));
|
2259 |
+
}
|
2260 |
+
|
2261 |
+
// reset the length of content
|
2262 |
+
$this->size = strlen($this->doc);
|
2263 |
+
|
2264 |
+
if ($this->size > 0) {
|
2265 |
+
$this->char = $this->doc[0];
|
2266 |
+
}
|
2267 |
+
}
|
2268 |
+
|
2269 |
+
function restore_noise($text)
|
2270 |
+
{
|
2271 |
+
global $debug_object;
|
2272 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
2273 |
+
|
2274 |
+
while (($pos = strpos($text, '___noise___')) !== false) {
|
2275 |
+
// Sometimes there is a broken piece of markup, and we don't GET the
|
2276 |
+
// pos+11 etc... token which indicates a problem outside of us...
|
2277 |
+
|
2278 |
+
// todo: "___noise___1000" (or any number with four or more digits)
|
2279 |
+
// in the DOM causes an infinite loop which could be utilized by
|
2280 |
+
// malicious software
|
2281 |
+
if (strlen($text) > $pos + 15) {
|
2282 |
+
$key = '___noise___'
|
2283 |
+
. $text[$pos + 11]
|
2284 |
+
. $text[$pos + 12]
|
2285 |
+
. $text[$pos + 13]
|
2286 |
+
. $text[$pos + 14]
|
2287 |
+
. $text[$pos + 15];
|
2288 |
+
|
2289 |
+
if (is_object($debug_object)) {
|
2290 |
+
$debug_object->debug_log(2, 'located key of: ' . $key);
|
2291 |
+
}
|
2292 |
+
|
2293 |
+
if (isset($this->noise[$key])) {
|
2294 |
+
$text = substr($text, 0, $pos)
|
2295 |
+
. $this->noise[$key]
|
2296 |
+
. substr($text, $pos + 16);
|
2297 |
+
} else {
|
2298 |
+
// do this to prevent an infinite loop.
|
2299 |
+
$text = substr($text, 0, $pos)
|
2300 |
+
. 'UNDEFINED NOISE FOR KEY: '
|
2301 |
+
. $key
|
2302 |
+
. substr($text, $pos + 16);
|
2303 |
+
}
|
2304 |
+
} else {
|
2305 |
+
// There is no valid key being given back to us... We must get
|
2306 |
+
// rid of the ___noise___ or we will have a problem.
|
2307 |
+
$text = substr($text, 0, $pos)
|
2308 |
+
. 'NO NUMERIC NOISE KEY'
|
2309 |
+
. substr($text, $pos + 11);
|
2310 |
+
}
|
2311 |
+
}
|
2312 |
+
return $text;
|
2313 |
+
}
|
2314 |
+
|
2315 |
+
function search_noise($text)
|
2316 |
+
{
|
2317 |
+
global $debug_object;
|
2318 |
+
if (is_object($debug_object)) { $debug_object->debug_log_entry(1); }
|
2319 |
+
|
2320 |
+
foreach($this->noise as $noiseElement) {
|
2321 |
+
if (strpos($noiseElement, $text) !== false) {
|
2322 |
+
return $noiseElement;
|
2323 |
+
}
|
2324 |
+
}
|
2325 |
+
}
|
2326 |
+
|
2327 |
+
function __toString()
|
2328 |
+
{
|
2329 |
+
return $this->root->innertext();
|
2330 |
+
}
|
2331 |
+
|
2332 |
+
function __get($name)
|
2333 |
+
{
|
2334 |
+
switch ($name) {
|
2335 |
+
case 'outertext':
|
2336 |
+
return $this->root->innertext();
|
2337 |
+
case 'innertext':
|
2338 |
+
return $this->root->innertext();
|
2339 |
+
case 'plaintext':
|
2340 |
+
return $this->root->text();
|
2341 |
+
case 'charset':
|
2342 |
+
return $this->_charset;
|
2343 |
+
case 'target_charset':
|
2344 |
+
return $this->_target_charset;
|
2345 |
+
}
|
2346 |
+
}
|
2347 |
+
|
2348 |
+
function childNodes($idx = -1)
|
2349 |
+
{
|
2350 |
+
return $this->root->childNodes($idx);
|
2351 |
+
}
|
2352 |
+
|
2353 |
+
function firstChild()
|
2354 |
+
{
|
2355 |
+
return $this->root->first_child();
|
2356 |
+
}
|
2357 |
+
|
2358 |
+
function lastChild()
|
2359 |
+
{
|
2360 |
+
return $this->root->last_child();
|
2361 |
+
}
|
2362 |
+
|
2363 |
+
function createElement($name, $value = null)
|
2364 |
+
{
|
2365 |
+
return @str_get_html("<$name>$value</$name>")->firstChild();
|
2366 |
+
}
|
2367 |
+
|
2368 |
+
function createTextNode($value)
|
2369 |
+
{
|
2370 |
+
return @end(str_get_html($value)->nodes);
|
2371 |
+
}
|
2372 |
+
|
2373 |
+
function getElementById($id)
|
2374 |
+
{
|
2375 |
+
return $this->find("#$id", 0);
|
2376 |
+
}
|
2377 |
+
|
2378 |
+
function getElementsById($id, $idx = null)
|
2379 |
+
{
|
2380 |
+
return $this->find("#$id", $idx);
|
2381 |
+
}
|
2382 |
+
|
2383 |
+
function getElementByTagName($name)
|
2384 |
+
{
|
2385 |
+
return $this->find($name, 0);
|
2386 |
+
}
|
2387 |
+
|
2388 |
+
function getElementsByTagName($name, $idx = -1)
|
2389 |
+
{
|
2390 |
+
return $this->find($name, $idx);
|
2391 |
+
}
|
2392 |
+
|
2393 |
+
function loadFile()
|
2394 |
+
{
|
2395 |
+
$args = func_get_args();
|
2396 |
+
$this->load_file($args);
|
2397 |
+
}
|
2398 |
+
}
|
Gutenberg/dist/blocks.build.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";n.d(t,"c",function(){return l}),n.d(t,"h",function(){return c}),n.d(t,"g",function(){return s}),n.d(t,"e",function(){return u}),n.d(t,"d",function(){return p}),n.d(t,"f",function(){return m}),n.d(t,"i",function(){return f}),n.d(t,"j",function(){return d}),n.d(t,"k",function(){return h}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return b});var r=wp.components,i=r.G,o=r.Path,a=(r.Polygon,r.SVG),l=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#2196F3"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#BBDEFB"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#1565C0"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 23 L 33 23 L 33 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 27 L 33 27 L 33 29 L 15 29 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 31 L 33 31 L 33 33 L 15 33 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 35 L 25 35 L 25 37 L 15 37 Z "}))),c=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",enableBackground:"new 0 0 24 24",id:"Layer_2",version:"1.1",viewBox:"0 0 24 24"},wp.element.createElement(i,null,wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z",style:{fill:"#FFC720"}}),wp.element.createElement(o,{d:"M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z",style:{fill:"url(#SVGID_1_)"}}),wp.element.createElement(o,{d:"M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z",style:{fill:"#FFE083"}}),wp.element.createElement(o,{d:"M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10",style:{fill:"#FFFFFF",opacity:"0.2"}}),wp.element.createElement(o,{d:"M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z",style:{fill:"#FFFFFF"}}),wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z",style:{fill:"url(#SVGID_2_)"}}))),s=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#43A047"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C8E6C9"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "}))),u=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#7850C1"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C2ABE1"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 23 L 33 23 L 33 25 L 19 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 28 L 33 28 L 33 30 L 19 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 33 L 33 33 L 33 35 L 19 35 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 23 L 17 23 L 17 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 28 L 17 28 L 17 30 L 15 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 33 L 17 33 L 17 35 L 15 35 Z "}))),p=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#DE5245"},d:"M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"}),wp.element.createElement(o,{style:{fill:"#EEA6A0"},d:"M40,13H30V3L40,13z"}),wp.element.createElement(o,{style:{fill:"#B3433A"},d:"M30,13l10,10V13H30z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"}))),m=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#1C9957"},d:"M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#3E7BF1"},d:"M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "}),wp.element.createElement(o,{style:{fill:"#CBCCC9"},d:"M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#EFEFEF"},d:"M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "}),wp.element.createElement(o,{style:{fill:"#FFD73D"},d:"M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "}),wp.element.createElement(o,{style:{fill:"#D73F35"},d:"M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "}),wp.element.createElement(o,{style:{fill:"#752622"},d:"M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "}))),f=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 32 25 L 27 25 L 27 15 L 32 15 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 24 25 L 19 25 L 19 15 L 24 15 Z "}))),d=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 769 598",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#148ee0"},d:"M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z"}),wp.element.createElement(o,{style:{fill:"#54bbff"},d:"M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z"}))),h=wp.element.createElement(a,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",role:"img","aria-hidden":"true",focusable:"false"},wp.element.createElement(o,{d:"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"})),w=(wp.element.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 56 23"},wp.element.createElement("g",null,wp.element.createElement("g",null,wp.element.createElement("path",{style:{fill:"#DA2B28"},className:"st0",d:"M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4 c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8 c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1 c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8 c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2 c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2 c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1 c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"}),wp.element.createElement("path",{className:"st0",d:"M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7 C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"}),wp.element.createElement("path",{className:"st0",d:"M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"})),wp.element.createElement("g",null,wp.element.createElement("path",{d:"M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"}),wp.element.createElement("path",{d:"M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1 c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11 c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"}),wp.element.createElement("path",{d:"M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2 v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"})))),wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 276 340"},wp.element.createElement("path",{d:"M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z",fill:"#e94848"}),wp.element.createElement("path",{d:"M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z",fill:"#f19191"}),wp.element.createElement("linearGradient",{id:"A",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"77.111",x2:"116.568",y2:"77.111"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z",fill:"url(#A)"}),wp.element.createElement("linearGradient",{id:"B",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.016",x2:"233.927",y2:"136.016"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",opacity:".8",fill:"url(#B)"}),wp.element.createElement("linearGradient",{id:"C",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.993",x2:"233.927",y2:"135.993"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"33.6",opacity:".7",fill:"url(#C)"}),wp.element.createElement("linearGradient",{id:"D",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.969",x2:"233.927",y2:"135.969"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"67.2",opacity:".6",fill:"url(#D)"}),wp.element.createElement("linearGradient",{id:"E",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.045",x2:"233.927",y2:"136.045"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"100.7",opacity:".4",fill:"url(#E)"}),wp.element.createElement("linearGradient",{id:"F",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"270.322",x2:"174.778",y2:"270.322"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z",opacity:".3",fill:"url(#F)"}),wp.element.createElement("defs",null,wp.element.createElement("path",{id:"H",d:"M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"})))),b=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270",role:"img",focusable:"false"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})))},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.components.Spinner,i=function(){return wp.element.createElement("div",{className:"wp-block-embed is-loading"},wp.element.createElement(r,null),wp.element.createElement("p",null,__("Embedding\u2026")))};t.a=i},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.element.Fragment,i=wp.components,o=i.IconButton,a=i.Toolbar,l=wp.editor.BlockControls,c=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return wp.element.createElement(r,null,wp.element.createElement(l,null,wp.element.createElement(a,null,t&&wp.element.createElement(o,{className:"components-toolbar__control",label:__("Edit URL"),icon:"edit",onClick:n}))))};t.a=c},function(e,t,n){"use strict";var r=n(11),i=n.n(r),o=wp.i18n,__=o.__,_x=o._x,a=wp.components,l=a.Button,c=a.Placeholder,s=a.ExternalLink,u=wp.blockEditor.BlockIcon,p=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,a=e.onChange,p=e.cannotEmbed,m=e.docLink,f=e.DocTitle,d=i()("wp-block-embed",{});return wp.element.createElement("div",null,wp.element.createElement(c,{icon:wp.element.createElement(u,{icon:t,showColors:!0}),label:n,className:d},wp.element.createElement("form",{onSubmit:o},wp.element.createElement("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:__("Enter URL to embed here\u2026"),onChange:a}),wp.element.createElement(l,{isSmall:!0,type:"submit"},_x("Embed","button label")),p&&wp.element.createElement("p",{className:"components-placeholder__error"},__("Sorry, we could not embed that content."),wp.element.createElement("br",null))),m&&wp.element.createElement("div",{className:"components-placeholder__learn-more"},wp.element.createElement(s,{href:m},f))))};t.a=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("iframe",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(7),n(12),n(16),n(20),n(24),n(28),n(32),n(36),n(40),n(44),n(48);!function(){var e=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})));wp.blocks.updateCategory("embedpress",{icon:e})}()},function(e,t,n){"use strict";var r=n(8),i=(n.n(r),n(9)),o=(n.n(i),n(10)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-docs-block",{title:__("Google Docs"),icon:a.c,category:"embedpress",keywords:[__("embedpress"),__("google"),__("docs")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("figure",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element.Component,f=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.updateAlignment=e.updateAlignment.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"updateAlignment",value:function(e){var t=this.props.setAttributes,n=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};t(Object.assign({},n,{align:e}))}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"document"===a?(r.match(/([?&])embedded=true/i)||(r.indexOf("?")>-1?r+="&embedded=true":r+="?embedded=true"),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Docs URL");return!m||r?wp.element.createElement("div",null,wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.c,DocTitle:__("Learn more about Google doc embed"),docLink:"https://embedpress.com/docs/embed-google-docs-wordpress/"})):wp.element.createElement("div",null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onMouseUp:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameBorder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(m);t.a=f},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=n.apply(null,r);a&&e.push(a)}else if("object"===i)for(var l in r)o.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){"use strict";var r=n(13),i=(n.n(r),n(14)),o=(n.n(i),n(15)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-slides-block",{title:__("Google Slides"),icon:a.h,category:"embedpress",keywords:[__("embedpress"),__("google"),__("slides")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-presentation"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"presentation"==a?(r.match(/pub\?/i)&&(r=r.replace("/pub?","/embed?")),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Slides URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.h,DocTitle:__("Learn more about Google slides embed"),docLink:"https://embedpress.com/docs/embed-google-slides-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(17),i=(n.n(r),n(18)),o=(n.n(i),n(19)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-sheets-block",{title:__("Google Sheets"),icon:a.g,category:"embedpress",keywords:[__("embedpress"),__("google"),__("sheets")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];if(a&&"spreadsheets"==a){if(r.indexOf("?")>-1){var l=r.split("?");if(l=l[1],l=l.split("&"),console.log(l),l.length>0){var c=!1,s=!1;l.map(function(e){e.indexOf("widget=")?s=!0:e.indexOf("headers=")&&(c=!0)}),s||(r+="&widget=true"),c||(r+="&headers=false")}}else r+="?widget=true&headers=false";this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Sheets URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.g,DocTitle:__("Learn more about Google sheet embed"),docLink:"https://embedpress.com/docs/embed-google-sheets-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(21),i=(n.n(r),n(22)),o=(n.n(i),n(23)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-forms-block",{title:__("Google Forms"),icon:a.e,category:"embedpress",keywords:[__("embedpress"),__("google"),__("forms")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-forms"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=(wp.components.Disabled,function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"forms"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Forms URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.e,DocTitle:__("Learn more about Google forms embed"),docLink:"https://embedpress.com/docs/embed-google-forms-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f));t.a=h},function(e,t,n){"use strict";var r=n(25),i=(n.n(r),n(26)),o=(n.n(i),n(27)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-drawings-block",{title:__("Google Drawings"),icon:a.d,category:"embedpress",keywords:[__("embedpress"),__("google"),__("drawings")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-drawings"},wp.element.createElement("img",{src:t,width:"960",height:"720"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(0),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.element,m=p.Component,f=p.Fragment,d=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1},e}return o(t,e),u(t,[{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"drawings"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,u=this.props.attributes.iframeSrc,p=__("Google Drawings URL (Get your link from File -> Publish to the web -> Link)");return!u||r?wp.element.createElement(c.a,{label:p,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:s.d,DocTitle:__("Learn more about Google drawing embed"),docLink:"https://embedpress.com/docs/embed-google-drawings-wordpress/"}):wp.element.createElement(f,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("img",{src:u,onLoad:this.onLoad,style:{display:i?"none":""},width:"960",height:"720"}),wp.element.createElement(a.a,{showEditButton:u&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}]),t}(m);t.a=d},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(29),o=(n.n(i),n(30)),a=(n.n(o),n(31)),l=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-maps-block",{title:__("Google Maps"),icon:l.f,category:"embedpress",keywords:[__("embedpress"),__("google"),__("maps")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:a.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-maps"},wp.element.createElement("iframe",r({src:t,frameborder:"0",width:"600",height:"450"},"frameborder","0")))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)){var r=this.decodeHTMLEntities(t);if(t.match("~(maps/embed|output=embed)~i"));else{var i=/@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i,o=i.exec(r);o&&o.length>1&&o[1]&&o[2]?r="https://maps.google.com/maps?hl=en&ie=UTF8&ll="+o[1]+"&spn="+o[1]+"&t=m&z="+Math.round(parseInt(o[2]))+"&output=embed":this.setState({cannotEmbed:!0,editingURL:!0})}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Maps URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.f,DocTitle:__("Learn more about Google map embed"),docLink:"https://embedpress.com/docs/embed-google-maps-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(33),i=(n.n(r),n(34)),o=(n.n(i),n(35)),a=n(0),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/twitch-block",{title:__("Twitch"),icon:a.i,category:"embedpress",keywords:[__("embedpress"),__("twitch")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""},attrs:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes,n=t.iframeSrc,r=t.attrs,i=n+"&parent="+embedpressObj.twitch_host;return wp.element.createElement("figure",{className:"ose-twitch-presentation"},wp.element.createElement("iframe",l({src:i},r,{frameborder:"0",width:"600",height:"450"})))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=/http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/;if(t&&t.match(r)){var i=this.decodeHTMLEntities(t),o=r.exec(i),a=o[1];console.log(a);var l,c="channel";switch(t.indexOf("clips.twitch.tv")>-1?c="clip":t.indexOf("/videos/")>-1?c="video":t.indexOf("#/chat$#")>-1&&(c="chat"),console.log(c),c){case"channel":i="https://player.twitch.tv/?channel="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"clip":i="https://clips.twitch.tv/embed?clip="+a+"&autoplay=false",l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"video":a=o[2],i="https://player.twitch.tv/?video="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"chat":i="http://www.twitch.tv/embed/"+a+"/chat",l={scrolling:"yes",frameborder:"0",allowfullscreen:"true",id:"'"+a+"'"}}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:i,attrs:l})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Twitch URL");if(!d||r)return wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.i,DocTitle:__("Learn more about twitch embed"),docLink:"https://embedpress.com/docs/embed-twitch-streams-chat/"});var y=d+"&parent="+embedpressObj.twitch_host;return wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:y},w,{onLoad:this.onLoad,style:{display:i?"none":""},onFocus:this.hideOverlay,width:"600",height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(37),i=(n.n(r),n(38)),o=(n.n(i),n(39)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/wistia-block",{title:__("Wistia"),icon:a.j,category:"embedpress",keywords:[__("embedpress"),__("wistia")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(e){return null},deprecated:[{attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("div",{class:"ose-wistia"},wp.element.createElement("iframe",{src:t,allowtransparency:"true",frameborder:"0",class:"wistia_embed",name:"wistia_embed",width:"600",height:"330"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1,mediaId:null},e.setUrl(),e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentDidMount",value:function(){if(this.props.attributes.url){var e=this.props.attributes.url.match(/medias\/(.*)/),t=e[1];this.setState(Object.assign({},this.state,{mediaId:t}))}}},{key:"onLoad",value:function(){if(this.setState({fetching:!1}),embedpressObj.wisita_options){var e=Object.assign({},this.state);setTimeout(function(){var e=document.createElement("script");e.src="https://fast.wistia.com/assets/external/E-v1.js",e.charset="ISO-8859-1",document.body.appendChild(e)},100),setTimeout(function(){var t=document.createElement("script");t.type="text/javascript",t.innerHTML="window.pp_embed_wistia_labels = "+embedpressObj.wistia_labels,document.body.appendChild(t),t=document.createElement("script"),t.type="text/javascript",t.innerHTML='wistiaEmbed = Wistia.embed( "'+e.mediaId+'", '+embedpressObj.wisita_options+" );",document.body.appendChild(t)},400)}}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&(t.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i)||t.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))){var r=t.match(/medias\/(.*)/),i=r[1],o="//fast.wistia.net/embed/iframe/"+i;this.setState({editingURL:!1,cannotEmbed:!1,mediaId:i}),n({iframeSrc:o})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Wistia URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.j,DocTitle:__("Learn more about Wistia embed"),docLink:"https://embedpress.com/docs/embed-wistia-videos-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("div",{className:"ose-wistia",id:"wistia_"+this.state.mediaId},wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"330"})),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(41),i=(n.n(r),n(42)),o=(n.n(i),n(43)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/youtube-block",{title:__("Youtube"),icon:a.k,category:"embedpress",keywords:[__("embedpress"),__("youtube")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentWillMount",value:function(){this.state.url&&this.setUrl()}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=t.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);if(t&&r){var i=r[1],o="https://www.youtube.com/embed/"+i,a=new URL(o);if("undefined"!==typeof embedpressProObj)for(var l in embedpressProObj.youtubeParams)a.searchParams.set(l,embedpressProObj.youtubeParams[l]);this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:a.href,mediaId:i})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Youtube URL");return!d||r?wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.k,DocTitle:__("Learn More About Youtube Embed"),docLink:"https://embedpress.com/docs/embed-youtube-wordpress/"}):wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:d},w,{onLoad:this.onLoad,style:{display:i?"none":""},width:"640",onFocus:this.hideOverlay,height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(45),i=(n.n(r),n(46)),o=(n.n(i),n(47)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/document",{title:__("Document"),icon:a.a,category:"embedpress",keywords:[__("embedpress"),__("pdf"),__("doc"),__("ppt")],supports:{align:["wide","full","right","left"],default:""},attributes:{id:{type:"string"},href:{type:"string"},powered_by:{type:"boolean",default:!0},width:{type:"number",default:600},height:{type:"number",default:600},fileName:{type:"string"},mime:{type:"string"}},edit:o.a,save:function(e){var t=e.attributes,n=t.href,r=t.mime,i=t.id,o=t.width,a=t.height,l=t.powered_by,c="//view.officeapps.live.com/op/embed.aspx?src="+n;return wp.element.createElement("figure",{className:"embedpress-embed-document"},"application/pdf"===r&&wp.element.createElement("div",{style:{height:a,width:o},className:"embedpress-embed-document-pdf "+i,"data-emid":i,"data-emsrc":n}),"application/pdf"!==r&&wp.element.createElement("iframe",{style:{height:a,width:o},src:c,mozallowfullscreen:"true",webkitallowfullscreen:"true"}),l&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),l=n(1),c=n(0),s=function(){function e(e,t){var n=[],_n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(_n=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,i=e}finally{try{!_n&&a.return&&a.return()}finally{if(r)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.blob,m=p.getBlobByURL,f=p.isBlobURL,d=p.revokeBlobURL,h=wp.editor,w=h.BlockIcon,b=h.MediaPlaceholder,y=h.InspectorControls,v=wp.element,g=v.Component,E=v.Fragment,L=wp.components,k=L.RangeControl,_=L.PanelBody,O=L.ExternalLink,S=L.ToggleControl,U=["application/pdf","application/msword","application/vnd.ms-powerpoint","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"],R=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.onSelectFile=e.onSelectFile.bind(e),e.onUploadError=e.onUploadError.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={hasError:!1,fetching:!1,interactive:!1,loadPdf:!0},e}return o(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,r=t.mediaUpload,i=t.noticeOperations,o=n.href;if(f(o)){r({filesList:[m(o)],onFileChange:function(t){var n=s(t,1),r=n[0];return e.onSelectFile(r)},onError:function(t){e.setState({hasError:!0}),i.createErrorNotice(t)}}),d(o)}this.props.attributes.href&&"application/pdf"===this.props.attributes.mime&&this.state.loadPdf&&(this.setState({loadPdf:!1}),PDFObject.embed(this.props.attributes.href,"."+this.props.attributes.id))}},{key:"componentDidUpdate",value:function(e){e.isSelected&&!this.props.isSelected&&this.setState({showCopyConfirmation:!1})}},{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"onSelectFile",value:function(e){e&&e.url&&(this.setState({hasError:!1}),this.props.setAttributes({href:e.url,fileName:e.title,id:"embedpress-pdf-"+Date.now(),mime:e.mime}),embedpressObj.embedpress_pro&&this.props.setAttributes({powered_by:!1}),"application/pdf"===e.mime&&(this.setState({loadPdf:!1}),PDFObject.embed(e.url,"."+this.props.attributes.id)))}},{key:"onUploadError",value:function(e){var t=this.props.noticeOperations;t.removeAllNotices(),t.createErrorNotice(e)}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.noticeUI,r=e.setAttributes,i=t.href,o=t.mime,s=t.id,u=t.width,p=t.height,m=t.powered_by,f=this.state,d=f.hasError,h=f.interactive,v=f.fetching,g=f.loadPdf;if(!i||d)return wp.element.createElement("div",{className:"embedpress-document-editmode"},wp.element.createElement(b,{icon:wp.element.createElement(w,{icon:c.a}),labels:{title:__("Document"),instructions:__("Upload a file or pick one from your media library for embed.")},onSelect:this.onSelectFile,notices:n,allowedTypes:U,onError:this.onUploadError},wp.element.createElement("div",{style:{width:"100%"},className:"components-placeholder__learn-more embedpress-doc-link"},wp.element.createElement(O,{href:"https://embedpress.com/docs/embed-docuemnt/"},"Learn more about Embedded document "))));var L="//view.officeapps.live.com/op/embed.aspx?src="+i;return wp.element.createElement(E,null,v&&"application/pdf"!==o?wp.element.createElement(l.a,null):null,"application/pdf"===o&&wp.element.createElement("div",{style:{height:p,width:u},className:"embedpress-embed-document-pdf "+s,"data-emid":s,"data-emsrc":i}),"application/pdf"!==o&&wp.element.createElement(a.a,{onMouseUponMouseUp:this.hideOverlay,style:{height:p,width:u,display:v||!g?"none":""},onLoad:this.onLoad,src:L}),!h&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),m&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"),wp.element.createElement(y,{key:"inspector"},wp.element.createElement(_,{title:__("Embed Size","embedpress")},wp.element.createElement(k,{label:__("Width","embedpress"),value:u,onChange:function(e){return r({width:e})},max:1e3,min:1}),wp.element.createElement(k,{label:__("Height","embedpress"),value:p,onChange:function(e){return r({height:e})},max:1e3,min:1}),wp.element.createElement(S,{label:__("Powered By"),onChange:function(e){return r({powered_by:e})},checked:m}))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(g);t.a=R},function(e,t,n){"use strict";var r=n(49),i=(n.n(r),n(50)),o=(n.n(i),n(51)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/embedpress",{title:__("EmbedPress"),icon:a.b,category:"embedpress",keywords:["embedpress","embed","google","youtube","docs"],supports:{align:["wide","full","right","left"],default:"",html:!0},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""},embedHTML:{type:"string",default:""},height:{type:"string",default:"360"},width:{type:"string",default:"600"},editingURL:{type:"boolean",default:!1},fetching:{type:"boolean",default:!0},cannotEmbed:{type:"boolean",default:!1},interactive:{type:"boolean",default:!1}},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(i,o){try{var a=t[i](o),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}function i(e){function t(){m({editingURL:!0})}function n(e){var t=this;if(e&&e.preventDefault(),b){(function(){var e=r(a.a.mark(function e(n){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return m({fetching:!0}),e.next=3,fetch(embedpressObj.site_url+"/wp-json/embedpress/v1/oembed/embedpress?url="+n+"&width="+k+"&height="+L).then(function(e){return e.json()});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e,t)}));return function(_x){return e.apply(this,arguments)}})()(b).then(function(e){m({fetching:!1}),m(e.data&&404===e.data.status||!e.embed?{cannotEmbed:!0,editingURL:!0}:{embedHTML:e.embed,cannotEmbed:!1,editingURL:!1})})}else m({cannotEmbed:!0,editingURL:!0})}var i=e.attributes,o=e.className,m=e.setAttributes,b=i.url,y=i.editingURL,v=i.fetching,g=i.cannotEmbed,E=(i.interactive,i.embedHTML),L=i.height,k=i.width;return wp.element.createElement(w,null,wp.element.createElement(h,null,wp.element.createElement(d,{title:__("Customize Embedded Link")},wp.element.createElement(f,{label:__("Width"),value:k,onChange:function(e){return m({width:e})}}),wp.element.createElement(f,{label:__("Height"),value:L,onChange:function(e){return m({height:e})}}))),(!E||y)&&wp.element.createElement(s.a,{label:__("EmbedPress - Embed anything from 100+ sites"),onSubmit:n,value:b,cannotEmbed:g,onChange:function(e){return m({url:e.target.value})},icon:p.b,DocTitle:__("Learn more about EmbedPress"),docLink:"https://embedpress.com/docs/"}),E&&!y&&wp.element.createElement("div",{className:o},v?wp.element.createElement(c.a,null):null,wp.element.createElement(u.a,{style:{display:v?"none":""},dangerouslySetInnerHTML:{__html:E}}),wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:m({interactive:!0})}),wp.element.createElement(l.a,{showEditButton:E&&!g,switchBackToURLInput:t})))}t.a=i;var o=n(52),a=n.n(o),l=n(2),c=n(1),s=n(3),u=n(55),p=n(0),__=wp.i18n.__,m=wp.components,f=m.TextControl,d=m.PanelBody,h=wp.blockEditor.InspectorControls,w=wp.element.Fragment},function(e,t,n){e.exports=n(53)},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(54),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new f(r||[]);return a._invoke=s(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&y.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(s).then(function(e){c.value=e,o(c)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function s(e,t,n){var i=O;return function(o,a){if(i===U)throw new Error("Generator is already running");if(i===R){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===C)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===O)throw i=R,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=U;var s=r(e,t,n);if("normal"===s.type){if(i=n.done?R:S,s.arg===C)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=R,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===w){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=w,u(e,t),"throw"===t.method))return C;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,C;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=w),t.delegate=null,C):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,C)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[g];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=w,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:w,done:!0}}var w,b=Object.prototype,y=b.hasOwnProperty,v="function"===typeof Symbol?Symbol:{},g=v.iterator||"@@iterator",E=v.asyncIterator||"@@asyncIterator",L=v.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var O="suspendedStart",S="suspendedYield",U="executing",R="completed",C={},x={};x[g]=function(){return this};var M=Object.getPrototypeOf,T=M&&M(M(d([])));T&&T!==b&&y.call(T,g)&&(x=T);var j=a.prototype=i.prototype=Object.create(x);o.prototype=j.constructor=a,a.constructor=o,a[L]=o.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,L in e||(e[L]="GeneratorFunction")),e.prototype=Object.create(j),e},_.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,i){var o=new c(n(e,t,r,i));return _.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(j),j[L]="Generator",j[g]=function(){return this},j.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=w,this.done=!1,this.delegate=null,this.method="next",this.arg=w,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=w)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=w),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,C):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=w),C}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("div",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p}]);
|
1 |
+
!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";n.d(t,"c",function(){return l}),n.d(t,"h",function(){return c}),n.d(t,"g",function(){return s}),n.d(t,"e",function(){return u}),n.d(t,"d",function(){return p}),n.d(t,"f",function(){return m}),n.d(t,"i",function(){return f}),n.d(t,"j",function(){return d}),n.d(t,"k",function(){return h}),n.d(t,"a",function(){return w}),n.d(t,"b",function(){return b});var r=wp.components,i=r.G,o=r.Path,a=(r.Polygon,r.SVG),l=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#2196F3"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#BBDEFB"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#1565C0"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 23 L 33 23 L 33 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 27 L 33 27 L 33 29 L 15 29 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 31 L 33 31 L 33 33 L 15 33 Z "}),wp.element.createElement(o,{style:{fill:"#E3F2FD"},d:"M 15 35 L 25 35 L 25 37 L 15 37 Z "}))),c=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",enableBackground:"new 0 0 24 24",id:"Layer_2",version:"1.1",viewBox:"0 0 24 24"},wp.element.createElement(i,null,wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z",style:{fill:"#FFC720"}}),wp.element.createElement(o,{d:"M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z",style:{fill:"url(#SVGID_1_)"}}),wp.element.createElement(o,{d:"M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z",style:{fill:"#FFE083"}}),wp.element.createElement(o,{d:"M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z",style:{opacity:"0.1"}}),wp.element.createElement(o,{d:"M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10",style:{fill:"#FFFFFF",opacity:"0.2"}}),wp.element.createElement(o,{d:"M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z",style:{fill:"#FFFFFF"}}),wp.element.createElement(o,{d:"M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z",style:{fill:"url(#SVGID_2_)"}}))),s=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#43A047"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C8E6C9"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "}))),u=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#7850C1"},d:"M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "}),wp.element.createElement(o,{style:{fill:"#C2ABE1"},d:"M 40 13 L 30 13 L 30 3 Z "}),wp.element.createElement(o,{style:{fill:"#2E7D32"},d:"M 30 13 L 40 23 L 40 13 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 23 L 33 23 L 33 25 L 19 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 28 L 33 28 L 33 30 L 19 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 19 33 L 33 33 L 33 35 L 19 35 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 23 L 17 23 L 17 25 L 15 25 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 28 L 17 28 L 17 30 L 15 30 Z "}),wp.element.createElement(o,{style:{fill:"#E8F5E9"},d:"M 15 33 L 17 33 L 17 35 L 15 35 Z "}))),p=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#DE5245"},d:"M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"}),wp.element.createElement(o,{style:{fill:"#EEA6A0"},d:"M40,13H30V3L40,13z"}),wp.element.createElement(o,{style:{fill:"#B3433A"},d:"M30,13l10,10V13H30z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"}))),m=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#1C9957"},d:"M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#3E7BF1"},d:"M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "}),wp.element.createElement(o,{style:{fill:"#CBCCC9"},d:"M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "}),wp.element.createElement(o,{style:{fill:"#EFEFEF"},d:"M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "}),wp.element.createElement(o,{style:{fill:"#FFD73D"},d:"M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "}),wp.element.createElement(o,{style:{fill:"#D73F35"},d:"M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "}),wp.element.createElement(o,{style:{fill:"#752622"},d:"M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "}),wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "}))),f=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 48 48",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#FFFFFF"},d:"M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 32 25 L 27 25 L 27 15 L 32 15 Z "}),wp.element.createElement(o,{style:{fill:"#8E24AA"},d:"M 24 25 L 19 25 L 19 15 L 24 15 Z "}))),d=wp.element.createElement(a,{xmlns:"http://www.w3.org/1999/xlink",viewBox:"0 0 769 598",version:"1.1"},wp.element.createElement(i,null,wp.element.createElement(o,{style:{fill:"#148ee0"},d:"M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z"}),wp.element.createElement(o,{style:{fill:"#54bbff"},d:"M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z"}))),h=wp.element.createElement(a,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",role:"img","aria-hidden":"true",focusable:"false"},wp.element.createElement(o,{d:"M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z"})),w=(wp.element.createElement("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 56 23"},wp.element.createElement("g",null,wp.element.createElement("g",null,wp.element.createElement("path",{style:{fill:"#DA2B28"},className:"st0",d:"M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4 c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8 c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1 c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8 c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2 c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2 c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1 c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"}),wp.element.createElement("path",{className:"st0",d:"M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7 C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"}),wp.element.createElement("path",{className:"st0",d:"M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"})),wp.element.createElement("g",null,wp.element.createElement("path",{d:"M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"}),wp.element.createElement("path",{d:"M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1 c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11 c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"}),wp.element.createElement("path",{d:"M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2 v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"})))),wp.element.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 276 340"},wp.element.createElement("path",{d:"M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z",fill:"#e94848"}),wp.element.createElement("path",{d:"M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z",fill:"#f19191"}),wp.element.createElement("linearGradient",{id:"A",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"77.111",x2:"116.568",y2:"77.111"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z",fill:"url(#A)"}),wp.element.createElement("linearGradient",{id:"B",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.016",x2:"233.927",y2:"136.016"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",opacity:".8",fill:"url(#B)"}),wp.element.createElement("linearGradient",{id:"C",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.993",x2:"233.927",y2:"135.993"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"33.6",opacity:".7",fill:"url(#C)"}),wp.element.createElement("linearGradient",{id:"D",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"135.969",x2:"233.927",y2:"135.969"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"67.2",opacity:".6",fill:"url(#D)"}),wp.element.createElement("linearGradient",{id:"E",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"136.045",x2:"233.927",y2:"136.045"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("use",{href:"#H",y:"100.7",opacity:".4",fill:"url(#E)"}),wp.element.createElement("linearGradient",{id:"F",gradientUnits:"userSpaceOnUse",x1:"44.744",y1:"270.322",x2:"174.778",y2:"270.322"},wp.element.createElement("stop",{offset:"0",stopColor:"#fff"}),wp.element.createElement("stop",{offset:"1",stopColor:"#fff0f0"})),wp.element.createElement("path",{d:"M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z",opacity:".3",fill:"url(#F)"}),wp.element.createElement("defs",null,wp.element.createElement("path",{id:"H",d:"M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"})))),b=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270",role:"img",focusable:"false"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})))},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.components.Spinner,i=function(){return wp.element.createElement("div",{className:"wp-block-embed is-loading"},wp.element.createElement(r,null),wp.element.createElement("p",null,__("Embedding\u2026")))};t.a=i},function(e,t,n){"use strict";var __=wp.i18n.__,r=wp.element.Fragment,i=wp.components,o=i.IconButton,a=i.Toolbar,l=wp.editor.BlockControls,c=function(e){var t=e.showEditButton,n=e.switchBackToURLInput;return wp.element.createElement(r,null,wp.element.createElement(l,null,wp.element.createElement(a,null,t&&wp.element.createElement(o,{className:"components-toolbar__control",label:__("Edit URL"),icon:"edit",onClick:n}))))};t.a=c},function(e,t,n){"use strict";var r=n(11),i=n.n(r),o=wp.i18n,__=o.__,_x=o._x,a=wp.components,l=a.Button,c=a.Placeholder,s=a.ExternalLink,u=wp.blockEditor.BlockIcon,p=function(e){var t=e.icon,n=e.label,r=e.value,o=e.onSubmit,a=e.onChange,p=e.cannotEmbed,m=e.docLink,f=e.DocTitle,d=i()("wp-block-embed",{});return wp.element.createElement("div",null,wp.element.createElement(c,{icon:wp.element.createElement(u,{icon:t,showColors:!0}),label:n,className:d},wp.element.createElement("form",{onSubmit:o},wp.element.createElement("input",{type:"url",value:r||"",className:"components-placeholder__input","aria-label":n,placeholder:__("Enter URL to embed here\u2026"),onChange:a}),wp.element.createElement(l,{isSmall:!0,type:"submit"},_x("Embed","button label")),p&&wp.element.createElement("p",{className:"components-placeholder__error"},__("Sorry, we could not embed that content."),wp.element.createElement("br",null))),m&&wp.element.createElement("div",{className:"components-placeholder__learn-more"},wp.element.createElement(s,{href:m},f))))};t.a=p},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("iframe",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=ReactDOM},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});n(7),n(12),n(16),n(20),n(24),n(28),n(32),n(36),n(40),n(44),n(48);!function(){var e=wp.element.createElement("svg",{width:"33",height:"20",version:"1.1",id:"Layer_1",xmlns:"http://www.w3.org/2000/svg",x:"0px",y:"0px",viewBox:"0 0 270 270"},wp.element.createElement("g",null,wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"0,0 0,52 15,52 15,15 52,15 52,0 \t"}),wp.element.createElement("polygon",{className:"st0",fill:"#9595C1",points:"255,218 255,255 218,255 218,270 270,270 270,218 \t"}),wp.element.createElement("path",{fill:"#5B4E96",d:"M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"})));wp.blocks.updateCategory("embedpress",{icon:e})}()},function(e,t,n){"use strict";var r=n(8),i=(n.n(r),n(9)),o=(n.n(i),n(10)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-docs-block",{title:__("Google Docs"),icon:a.c,category:"embedpress",keywords:[__("embedpress"),__("google"),__("docs")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("figure",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-document"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element.Component,f=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.updateAlignment=e.updateAlignment.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"updateAlignment",value:function(e){var t=this.props.setAttributes,n=-1!==["wide","full"].indexOf(e)?{width:void 0,height:void 0}:{};t(Object.assign({},n,{align:e}))}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"document"===a?(r.match(/([?&])embedded=true/i)||(r.indexOf("?")>-1?r+="&embedded=true":r+="?embedded=true"),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Docs URL");return!m||r?wp.element.createElement("div",null,wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.c,DocTitle:__("Learn more about Google doc embed"),docLink:"https://embedpress.com/docs/embed-google-docs-wordpress/"})):wp.element.createElement("div",null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onMouseUp:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameBorder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(m);t.a=f},function(e,t,n){var r,i;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=n.apply(null,r);a&&e.push(a)}else if("object"===i)for(var l in r)o.call(r,l)&&r[l]&&e.push(l)}}return e.join(" ")}var o={}.hasOwnProperty;"undefined"!==typeof e&&e.exports?(n.default=n,e.exports=n):(r=[],void 0!==(i=function(){return n}.apply(t,r))&&(e.exports=i))}()},function(e,t,n){"use strict";var r=n(13),i=(n.n(r),n(14)),o=(n.n(i),n(15)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-slides-block",{title:__("Google Slides"),icon:a.h,category:"embedpress",keywords:[__("embedpress"),__("google"),__("slides")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-presentation"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"presentation"==a?(r.match(/pub\?/i)&&(r=r.replace("/pub?","/embed?")),this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Slides URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.h,DocTitle:__("Learn more about Google slides embed"),docLink:"https://embedpress.com/docs/embed-google-slides-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(17),i=(n.n(r),n(18)),o=(n.n(i),n(19)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-sheets-block",{title:__("Google Sheets"),icon:a.g,category:"embedpress",keywords:[__("embedpress"),__("google"),__("sheets")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))},deprecated:[{attributes:{align:{type:"string",enum:["left","center","right","wide","full"]}},save:function(e){var t=e.attributes.iframeSrc;if(t)return wp.element.createElement("div",{className:"ose-google-docs-spreadsheets"},wp.element.createElement("iframe",{src:t,frameBorder:"0",width:"600",height:"450",allowFullScreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];if(a&&"spreadsheets"==a){if(r.indexOf("?")>-1){var l=r.split("?");if(l=l[1],l=l.split("&"),console.log(l),l.length>0){var c=!1,s=!1;l.map(function(e){e.indexOf("widget=")?s=!0:e.indexOf("headers=")&&(c=!0)}),s||(r+="&widget=true"),c||(r+="&headers=false")}}else r+="?widget=true&headers=false";this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Sheets URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.g,DocTitle:__("Learn more about Google sheet embed"),docLink:"https://embedpress.com/docs/embed-google-sheets-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(21),i=(n.n(r),n(22)),o=(n.n(i),n(23)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-forms-block",{title:__("Google Forms"),icon:a.e,category:"embedpress",keywords:[__("embedpress"),__("google"),__("forms")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-forms"},wp.element.createElement("iframe",{src:t,frameborder:"0",width:"600",height:"450",allowfullscreen:"true",mozallowfullscreen:"true",webkitallowfullscreen:"true"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=(wp.components.Disabled,function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"forms"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Forms URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.e,DocTitle:__("Learn more about Google forms embed"),docLink:"https://embedpress.com/docs/embed-google-forms-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f));t.a=h},function(e,t,n){"use strict";var r=n(25),i=(n.n(r),n(26)),o=(n.n(i),n(27)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-drawings-block",{title:__("Google Drawings"),icon:a.d,category:"embedpress",keywords:[__("embedpress"),__("google"),__("drawings")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-docs-drawings"},wp.element.createElement("img",{src:t,width:"960",height:"720"}))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(0),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.element,m=p.Component,f=p.Fragment,d=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1},e}return o(t,e),u(t,[{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){var r=this.decodeHTMLEntities(t),i=/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i,o=i.exec(r),a=o[1];a&&"drawings"==a?(this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})):this.setState({cannotEmbed:!0,editingURL:!0})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,u=this.props.attributes.iframeSrc,p=__("Google Drawings URL (Get your link from File -> Publish to the web -> Link)");return!u||r?wp.element.createElement(c.a,{label:p,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:s.d,DocTitle:__("Learn more about Google drawing embed"),docLink:"https://embedpress.com/docs/embed-google-drawings-wordpress/"}):wp.element.createElement(f,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("img",{src:u,onLoad:this.onLoad,style:{display:i?"none":""},width:"960",height:"720"}),wp.element.createElement(a.a,{showEditButton:u&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}]),t}(m);t.a=d},function(e,t,n){"use strict";function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var i=n(29),o=(n.n(i),n(30)),a=(n.n(o),n(31)),l=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/google-maps-block",{title:__("Google Maps"),icon:l.f,category:"embedpress",keywords:[__("embedpress"),__("google"),__("maps")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:a.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("figure",{className:"ose-google-maps"},wp.element.createElement("iframe",r({src:t,frameborder:"0",width:"600",height:"450"},"frameborder","0")))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&t.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)){var r=this.decodeHTMLEntities(t);if(t.match("~(maps/embed|output=embed)~i"));else{var i=/@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i,o=i.exec(r);o&&o.length>1&&o[1]&&o[2]?r="https://maps.google.com/maps?hl=en&ie=UTF8&ll="+o[1]+"&spn="+o[1]+"&t=m&z="+Math.round(parseInt(o[2]))+"&output=embed":this.setState({cannotEmbed:!0,editingURL:!0})}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:r})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Google Maps URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.f,DocTitle:__("Learn more about Google map embed"),docLink:"https://embedpress.com/docs/embed-google-maps-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"450"}),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(33),i=(n.n(r),n(34)),o=(n.n(i),n(35)),a=n(0),l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/twitch-block",{title:__("Twitch"),icon:a.i,category:"embedpress",keywords:[__("embedpress"),__("twitch")],supports:{align:["wide","full","right","left"],default:""},attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""},attrs:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes,n=t.iframeSrc,r=t.attrs,i=n+"&parent="+embedpressObj.twitch_host;return wp.element.createElement("figure",{className:"ose-twitch-presentation"},wp.element.createElement("iframe",l({src:i},r,{frameborder:"0",width:"600",height:"450"})))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=/http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/;if(t&&t.match(r)){var i=this.decodeHTMLEntities(t),o=r.exec(i),a=o[1];console.log(a);var l,c="channel";switch(t.indexOf("clips.twitch.tv")>-1?c="clip":t.indexOf("/videos/")>-1?c="video":t.indexOf("#/chat$#")>-1&&(c="chat"),console.log(c),c){case"channel":i="https://player.twitch.tv/?channel="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"clip":i="https://clips.twitch.tv/embed?clip="+a+"&autoplay=false",l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"video":a=o[2],i="https://player.twitch.tv/?video="+a,l={scrolling:"no",frameborder:"0",allowfullscreen:"true"};break;case"chat":i="http://www.twitch.tv/embed/"+a+"/chat",l={scrolling:"yes",frameborder:"0",allowfullscreen:"true",id:"'"+a+"'"}}this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:i,attrs:l})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Twitch URL");if(!d||r)return wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.i,DocTitle:__("Learn more about twitch embed"),docLink:"https://embedpress.com/docs/embed-twitch-streams-chat/"});var y=d+"&parent="+embedpressObj.twitch_host;return wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:y},w,{onLoad:this.onLoad,style:{display:i?"none":""},onFocus:this.hideOverlay,width:"600",height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(37),i=(n.n(r),n(38)),o=(n.n(i),n(39)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/wistia-block",{title:__("Wistia"),icon:a.j,category:"embedpress",keywords:[__("embedpress"),__("wistia")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(e){return null},deprecated:[{attributes:{url:{type:"string",default:""},iframeSrc:{type:"string",default:""}},edit:o.a,save:function(e){var t=e.attributes.iframeSrc;return wp.element.createElement("div",{class:"ose-wistia"},wp.element.createElement("iframe",{src:t,allowtransparency:"true",frameborder:"0",class:"wistia_embed",name:"wistia_embed",width:"600",height:"330"}))}}]})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,m=wp.element,f=m.Component,d=m.Fragment,h=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1,mediaId:null},e.setUrl(),e}return o(t,e),p(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentDidMount",value:function(){if(this.props.attributes.url){var e=this.props.attributes.url.match(/medias\/(.*)/),t=e[1];this.setState(Object.assign({},this.state,{mediaId:t}))}}},{key:"onLoad",value:function(){if(this.setState({fetching:!1}),embedpressObj.wisita_options){var e=Object.assign({},this.state);setTimeout(function(){var e=document.createElement("script");e.src="https://fast.wistia.com/assets/external/E-v1.js",e.charset="ISO-8859-1",document.body.appendChild(e)},100),setTimeout(function(){var t=document.createElement("script");t.type="text/javascript",t.innerHTML="window.pp_embed_wistia_labels = "+embedpressObj.wistia_labels,document.body.appendChild(t),t=document.createElement("script"),t.type="text/javascript",t.innerHTML='wistiaEmbed = Wistia.embed( "'+e.mediaId+'", '+embedpressObj.wisita_options+" );",document.body.appendChild(t)},400)}}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;if(n({url:t}),t&&(t.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i)||t.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))){var r=t.match(/medias\/(.*)/),i=r[1],o="//fast.wistia.net/embed/iframe/"+i;this.setState({editingURL:!1,cannotEmbed:!1,mediaId:i}),n({iframeSrc:o})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,p=t.interactive,m=this.props.attributes.iframeSrc,f=__("Wistia URL");return!m||r?wp.element.createElement(c.a,{label:f,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.j,DocTitle:__("Learn more about Wistia embed"),docLink:"https://embedpress.com/docs/embed-wistia-videos-wordpress/"}):wp.element.createElement(d,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement("div",{className:"ose-wistia",id:"wistia_"+this.state.mediaId},wp.element.createElement(s.a,{src:m,onFocus:this.hideOverlay,onLoad:this.onLoad,style:{display:i?"none":""},frameborder:"0",width:"600",height:"330"})),!p&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:m&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(f);t.a=h},function(e,t,n){"use strict";var r=n(41),i=(n.n(r),n(42)),o=(n.n(i),n(43)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/youtube-block",{title:__("Youtube"),icon:a.k,category:"embedpress",keywords:[__("embedpress"),__("youtube")],supports:{align:["wide","full","right","left"],default:""},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(2),l=n(1),c=n(3),s=n(4),u=n(0),p=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},m=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,f=wp.element,d=f.Component,h=f.Fragment,w=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.switchBackToURLInput=e.switchBackToURLInput.bind(e),e.setUrl=e.setUrl.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={editingURL:!1,url:e.props.attributes.url,fetching:!0,cannotEmbed:!1,interactive:!1},e}return o(t,e),m(t,[{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"componentWillMount",value:function(){this.state.url&&this.setUrl()}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"decodeHTMLEntities",value:function(e){return e&&"string"===typeof e&&(e=e.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim,""),e=e.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim,"")),e}},{key:"setUrl",value:function(e){e&&e.preventDefault();var t=this.state.url,n=this.props.setAttributes;n({url:t});var r=t.match(/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/);if(t&&r){var i=r[1],o="https://www.youtube.com/embed/"+i,a=new URL(o);if("undefined"!==typeof embedpressProObj)for(var l in embedpressProObj.youtubeParams)a.searchParams.set(l,embedpressProObj.youtubeParams[l]);this.setState({editingURL:!1,cannotEmbed:!1}),n({iframeSrc:a.href,mediaId:i})}else this.setState({cannotEmbed:!0,editingURL:!0})}},{key:"switchBackToURLInput",value:function(){this.setState({editingURL:!0})}},{key:"render",value:function(){var e=this,t=this.state,n=t.url,r=t.editingURL,i=t.fetching,o=t.cannotEmbed,m=t.interactive,f=this.props.attributes,d=f.iframeSrc,w=f.attrs,b=__("Youtube URL");return!d||r?wp.element.createElement(c.a,{label:b,onSubmit:this.setUrl,value:n,cannotEmbed:o,onChange:function(t){return e.setState({url:t.target.value})},icon:u.k,DocTitle:__("Learn More About Youtube Embed"),docLink:"https://embedpress.com/docs/embed-youtube-wordpress/"}):wp.element.createElement(h,null,i?wp.element.createElement(l.a,null):null,wp.element.createElement(s.a,p({src:d},w,{onLoad:this.onLoad,style:{display:i?"none":""},width:"640",onFocus:this.hideOverlay,height:"450"})),!m&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),wp.element.createElement(a.a,{showEditButton:d&&!o,switchBackToURLInput:this.switchBackToURLInput}))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(d);t.a=w},function(e,t,n){"use strict";var r=n(45),i=(n.n(r),n(46)),o=(n.n(i),n(47)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/document",{title:__("Document"),icon:a.a,category:"embedpress",keywords:[__("embedpress"),__("pdf"),__("doc"),__("ppt")],supports:{align:["wide","full","right","left"],default:""},attributes:{id:{type:"string"},href:{type:"string"},powered_by:{type:"boolean",default:!0},width:{type:"number",default:600},height:{type:"number",default:600},fileName:{type:"string"},mime:{type:"string"}},edit:o.a,save:function(e){var t=e.attributes,n=t.href,r=t.mime,i=t.id,o=t.width,a=t.height,l=t.powered_by,c="//view.officeapps.live.com/op/embed.aspx?src="+n;return wp.element.createElement("figure",{className:"embedpress-embed-document"},"application/pdf"===r&&wp.element.createElement("div",{style:{height:a,width:o},className:"embedpress-embed-document-pdf "+i,"data-emid":i,"data-emsrc":n}),"application/pdf"!==r&&wp.element.createElement("iframe",{style:{height:a,width:o},src:c,mozallowfullscreen:"true",webkitallowfullscreen:"true"}),l&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"))}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(4),l=n(1),c=n(0),s=function(){function e(e,t){var n=[],_n=!0,r=!1,i=void 0;try{for(var o,a=e[Symbol.iterator]();!(_n=(o=a.next()).done)&&(n.push(o.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,i=e}finally{try{!_n&&a.return&&a.return()}finally{if(r)throw i}}return n}return function(t,n){if(Array.isArray(t))return t;if(Symbol.iterator in Object(t))return e(t,n);throw new TypeError("Invalid attempt to destructure non-iterable instance")}}(),u=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),__=wp.i18n.__,p=wp.blob,m=p.getBlobByURL,f=p.isBlobURL,d=p.revokeBlobURL,h=wp.editor,w=h.BlockIcon,b=h.MediaPlaceholder,y=h.InspectorControls,v=wp.element,g=v.Component,E=v.Fragment,L=wp.components,k=L.RangeControl,_=L.PanelBody,O=L.ExternalLink,S=L.ToggleControl,U=["application/pdf","application/msword","application/vnd.ms-powerpoint","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.openxmlformats-officedocument.presentationml.presentation"],R=function(e){function t(){r(this,t);var e=i(this,(t.__proto__||Object.getPrototypeOf(t)).apply(this,arguments));return e.onSelectFile=e.onSelectFile.bind(e),e.onUploadError=e.onUploadError.bind(e),e.onLoad=e.onLoad.bind(e),e.hideOverlay=e.hideOverlay.bind(e),e.state={hasError:!1,fetching:!1,interactive:!1,loadPdf:!0},e}return o(t,e),u(t,[{key:"componentDidMount",value:function(){var e=this,t=this.props,n=t.attributes,r=t.mediaUpload,i=t.noticeOperations,o=n.href;if(f(o)){r({filesList:[m(o)],onFileChange:function(t){var n=s(t,1),r=n[0];return e.onSelectFile(r)},onError:function(t){e.setState({hasError:!0}),i.createErrorNotice(t)}}),d(o)}this.props.attributes.href&&"application/pdf"===this.props.attributes.mime&&this.state.loadPdf&&(this.setState({loadPdf:!1}),PDFObject.embed(this.props.attributes.href,"."+this.props.attributes.id))}},{key:"componentDidUpdate",value:function(e){e.isSelected&&!this.props.isSelected&&this.setState({showCopyConfirmation:!1})}},{key:"hideOverlay",value:function(){this.setState({interactive:!0})}},{key:"onLoad",value:function(){this.setState({fetching:!1})}},{key:"onSelectFile",value:function(e){e&&e.url&&(this.setState({hasError:!1}),this.props.setAttributes({href:e.url,fileName:e.title,id:"embedpress-pdf-"+Date.now(),mime:e.mime}),embedpressObj.embedpress_pro&&this.props.setAttributes({powered_by:!1}),"application/pdf"===e.mime&&(this.setState({loadPdf:!1}),PDFObject.embed(e.url,"."+this.props.attributes.id)))}},{key:"onUploadError",value:function(e){var t=this.props.noticeOperations;t.removeAllNotices(),t.createErrorNotice(e)}},{key:"render",value:function(){var e=this.props,t=e.attributes,n=e.noticeUI,r=e.setAttributes,i=t.href,o=t.mime,s=t.id,u=t.width,p=t.height,m=t.powered_by,f=this.state,d=f.hasError,h=f.interactive,v=f.fetching,g=f.loadPdf;if(!i||d)return wp.element.createElement("div",{className:"embedpress-document-editmode"},wp.element.createElement(b,{icon:wp.element.createElement(w,{icon:c.a}),labels:{title:__("Document"),instructions:__("Upload a file or pick one from your media library for embed.")},onSelect:this.onSelectFile,notices:n,allowedTypes:U,onError:this.onUploadError},wp.element.createElement("div",{style:{width:"100%"},className:"components-placeholder__learn-more embedpress-doc-link"},wp.element.createElement(O,{href:"https://embedpress.com/docs/embed-docuemnt/"},"Learn more about Embedded document "))));var L="//view.officeapps.live.com/op/embed.aspx?src="+i;return wp.element.createElement(E,null,v&&"application/pdf"!==o?wp.element.createElement(l.a,null):null,"application/pdf"===o&&wp.element.createElement("div",{style:{height:p,width:u},className:"embedpress-embed-document-pdf "+s,"data-emid":s,"data-emsrc":i}),"application/pdf"!==o&&wp.element.createElement(a.a,{onMouseUponMouseUp:this.hideOverlay,style:{height:p,width:u,display:v||!g?"none":""},onLoad:this.onLoad,src:L}),!h&&wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:this.hideOverlay}),m&&wp.element.createElement("p",{className:"embedpress-el-powered"},"Powered By EmbedPress"),wp.element.createElement(y,{key:"inspector"},wp.element.createElement(_,{title:__("Embed Size","embedpress")},wp.element.createElement(k,{label:__("Width","embedpress"),value:u,onChange:function(e){return r({width:e})},max:1e3,min:1}),wp.element.createElement(k,{label:__("Height","embedpress"),value:p,onChange:function(e){return r({height:e})},max:1e3,min:1}),wp.element.createElement(S,{label:__("Powered By"),onChange:function(e){return r({powered_by:e})},checked:m}))))}}],[{key:"getDerivedStateFromProps",value:function(e,t){return!e.isSelected&&t.interactive?{interactive:!1}:null}}]),t}(g);t.a=R},function(e,t,n){"use strict";var r=n(49),i=(n.n(r),n(50)),o=(n.n(i),n(51)),a=n(0),__=wp.i18n.__;(0,wp.blocks.registerBlockType)("embedpress/embedpress",{title:__("EmbedPress"),icon:a.b,category:"embedpress",keywords:["embedpress","embed","google","youtube","docs"],supports:{align:["right","left","center"],default:"center",lightBlockWrapper:!0},attributes:{url:{type:"string",default:""},embedHTML:{type:"string",default:""},height:{type:"string",default:"450"},width:{type:"string",default:"600"},editingURL:{type:"boolean",default:!1},fetching:{type:"boolean",default:!1},cannotEmbed:{type:"boolean",default:!1},interactive:{type:"boolean",default:!1},align:{type:"string",default:"center"}},edit:o.a,save:function(){return null}})},function(e,t){},function(e,t){},function(e,t,n){"use strict";function r(e){return function(){var t=e.apply(this,arguments);return new Promise(function(e,n){function r(i,o){try{var a=t[i](o),l=a.value}catch(e){return void n(e)}if(!a.done)return Promise.resolve(l).then(function(e){r("next",e)},function(e){r("throw",e)});e(l)}return r("next")})}}function i(e){function t(){f({editingURL:!0})}function n(e){var t=this;if(e&&e.preventDefault(),b){f({fetching:!0}),console.log("test");(function(){var e=r(a.a.mark(function e(n){return a.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(embedpressObj.site_url+"/wp-json/embedpress/v1/oembed/embedpress?url="+n+"&width="+k+"&height="+L).then(function(e){return e.json()});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,t)}));return function(_x){return e.apply(this,arguments)}})()(b).then(function(e){f({fetching:!1}),f(e.data&&404===e.data.status||!e.embed?{cannotEmbed:!0,editingURL:!0}:{embedHTML:e.embed,cannotEmbed:!1,editingURL:!1})})}else f({cannotEmbed:!0,fetching:!1,editingURL:!0})}var i=e.attributes,o=e.className,f=e.setAttributes,b=i.url,y=i.editingURL,v=i.fetching,g=i.cannotEmbed,E=(i.interactive,i.embedHTML),L=i.height,k=i.width;return wp.element.createElement(w,null,wp.element.createElement(m.InspectorControls,null,wp.element.createElement(h,{title:__("Customize Embedded Link")},wp.element.createElement("p",null,__("You can adjust the width and height of embedded content.")),wp.element.createElement(d,{label:__("Width"),value:k,onChange:function(e){return f({width:e})}}),wp.element.createElement(d,{label:__("Height"),value:L,onChange:function(e){return f({height:e})}}),E&&!y&&wp.element.createElement("button",{onClick:n},__("Apply")))),(!E||y)&&!v&&wp.element.createElement(s.a,{label:__("EmbedPress - Embed anything from 100+ sites"),onSubmit:n,value:b,cannotEmbed:g,onChange:function(e){return f({url:e.target.value})},icon:p.b,DocTitle:__("Learn more about EmbedPress"),docLink:"https://embedpress.com/docs/"}),v?wp.element.createElement("div",{className:o},wp.element.createElement(c.a,null)," "):null,E&&!y&&!v&&wp.element.createElement("figure",Object(m.useBlockProps)(),wp.element.createElement(u.a,{style:{display:v?"none":""},dangerouslySetInnerHTML:{__html:E}}),wp.element.createElement("div",{className:"block-library-embed__interactive-overlay",onMouseUp:f({interactive:!0})}),wp.element.createElement(l.a,{showEditButton:E&&!g,switchBackToURLInput:t})))}t.a=i;var o=n(52),a=n.n(o),l=n(2),c=n(1),s=n(3),u=n(55),p=n(0),m=n(56),__=(n.n(m),wp.i18n.__),f=wp.components,d=f.TextControl,h=f.PanelBody,w=wp.element.Fragment},function(e,t,n){e.exports=n(53)},function(e,t,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,e.exports=n(54),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(e){r.regeneratorRuntime=void 0}},function(e,t){!function(t){"use strict";function n(e,t,n,r){var o=t&&t.prototype instanceof i?t:i,a=Object.create(o.prototype),l=new f(r||[]);return a._invoke=s(e,n,l),a}function r(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}function i(){}function o(){}function a(){}function l(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function c(e){function t(n,i,o,a){var l=r(e[n],e,i);if("throw"!==l.type){var c=l.arg,s=c.value;return s&&"object"===typeof s&&y.call(s,"__await")?Promise.resolve(s.__await).then(function(e){t("next",e,o,a)},function(e){t("throw",e,o,a)}):Promise.resolve(s).then(function(e){c.value=e,o(c)},a)}a(l.arg)}function n(e,n){function r(){return new Promise(function(r,i){t(e,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function s(e,t,n){var i=O;return function(o,a){if(i===U)throw new Error("Generator is already running");if(i===R){if("throw"===o)throw a;return h()}for(n.method=o,n.arg=a;;){var l=n.delegate;if(l){var c=u(l,n);if(c){if(c===C)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===O)throw i=R,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=U;var s=r(e,t,n);if("normal"===s.type){if(i=n.done?R:S,s.arg===C)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(i=R,n.method="throw",n.arg=s.arg)}}}function u(e,t){var n=e.iterator[t.method];if(n===w){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=w,u(e,t),"throw"===t.method))return C;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return C}var i=r(n,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,C;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=w),t.delegate=null,C):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,C)}function p(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function m(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function f(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(p,this),this.reset(!0)}function d(e){if(e){var t=e[g];if(t)return t.call(e);if("function"===typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(y.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=w,t.done=!0,t};return r.next=r}}return{next:h}}function h(){return{value:w,done:!0}}var w,b=Object.prototype,y=b.hasOwnProperty,v="function"===typeof Symbol?Symbol:{},g=v.iterator||"@@iterator",E=v.asyncIterator||"@@asyncIterator",L=v.toStringTag||"@@toStringTag",k="object"===typeof e,_=t.regeneratorRuntime;if(_)return void(k&&(e.exports=_));_=t.regeneratorRuntime=k?e.exports:{},_.wrap=n;var O="suspendedStart",S="suspendedYield",U="executing",R="completed",C={},x={};x[g]=function(){return this};var M=Object.getPrototypeOf,T=M&&M(M(d([])));T&&T!==b&&y.call(T,g)&&(x=T);var j=a.prototype=i.prototype=Object.create(x);o.prototype=j.constructor=a,a.constructor=o,a[L]=o.displayName="GeneratorFunction",_.isGeneratorFunction=function(e){var t="function"===typeof e&&e.constructor;return!!t&&(t===o||"GeneratorFunction"===(t.displayName||t.name))},_.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,a):(e.__proto__=a,L in e||(e[L]="GeneratorFunction")),e.prototype=Object.create(j),e},_.awrap=function(e){return{__await:e}},l(c.prototype),c.prototype[E]=function(){return this},_.AsyncIterator=c,_.async=function(e,t,r,i){var o=new c(n(e,t,r,i));return _.isGeneratorFunction(t)?o:o.next().then(function(e){return e.done?e.value:o.next()})},l(j),j[L]="Generator",j[g]=function(){return this},j.toString=function(){return"[object Generator]"},_.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},_.values=d,f.prototype={constructor:f,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=w,this.done=!1,this.delegate=null,this.method="next",this.arg=w,this.tryEntries.forEach(m),!e)for(var t in this)"t"===t.charAt(0)&&y.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=w)},stop:function(){this.done=!0;var e=this.tryEntries[0],t=e.completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){function t(t,r){return o.type="throw",o.arg=e,n.next=t,r&&(n.method="next",n.arg=w),!!r}if(this.done)throw e;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return t("end");if(i.tryLoc<=this.prev){var a=y.call(i,"catchLoc"),l=y.call(i,"finallyLoc");if(a&&l){if(this.prev<i.catchLoc)return t(i.catchLoc,!0);if(this.prev<i.finallyLoc)return t(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return t(i.catchLoc,!0)}else{if(!l)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return t(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&y.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,C):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),C},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),m(n),C}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;m(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:d(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=w),C}}}(function(){return this}()||Function("return this")())},function(e,t,n){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!==typeof t&&"function"!==typeof t?e:t}function o(e,t){if("function"!==typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}var a=n(5),l=n.n(a),c=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},s=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=wp.element.Component,p=function(e){function t(e){r(this,t);var n=i(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return n.myRef=React.createRef(),n}return o(t,e),s(t,[{key:"componentDidMount",value:function(){l.a.findDOMNode(this.myRef.current).addEventListener("load",this.props.onLoad)}},{key:"render",value:function(){return wp.element.createElement("div",c({ref:this.myRef},this.props))}}]),t}(u);t.a=p},function(e,t){e.exports=wp.blockEditor}]);
|
Gutenberg/dist/blocks.editor.build.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
.embedpress-document-editmode .components-placeholder__instructions:after{content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";white-space:pre}
|
2 |
-
.wp-block-embedpress-embedpress iframe{width:100
|
1 |
.embedpress-document-editmode .components-placeholder__instructions:after{content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";white-space:pre}
|
2 |
+
.wp-block-embedpress-embedpress iframe{max-width:100%}.ose-the-new-york-times iframe{min-height:500px;max-height:100%}
|
Gutenberg/dist/blocks.style.build.css
CHANGED
@@ -1,2 +1,2 @@
|
|
1 |
.pdfobject-container{height:600px;width:600px;margin:0 auto}.embedpress-el-powered{text-align:center;margin-top:0 !important;font-size:16px !important;font-weight:700}.embedpress-embed-document iframe,[data-type="embedpress/document"] iframe{margin:0 auto;display:block}.embedpress-document-editmode .components-form-file-upload{display:none !important}
|
2 |
-
.embedpress-gutenberg-wrapper iframe{width:100
|
1 |
.pdfobject-container{height:600px;width:600px;margin:0 auto}.embedpress-el-powered{text-align:center;margin-top:0 !important;font-size:16px !important;font-weight:700}.embedpress-embed-document iframe,[data-type="embedpress/document"] iframe{margin:0 auto;display:block}.embedpress-document-editmode .components-form-file-upload{display:none !important}
|
2 |
+
.embedpress-gutenberg-wrapper{margin:30px auto}.embedpress-gutenberg-wrapper iframe{max-width:100%}.ose-the-new-york-times iframe{min-height:500px;max-height:100%}
|
Gutenberg/src/blocks.js
DELETED
@@ -1,44 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Gutenberg Blocks
|
3 |
-
*
|
4 |
-
* All blocks related JavaScript files should be imported here.
|
5 |
-
* You can create a new block folder in this dir and include code
|
6 |
-
* for that block here as well.
|
7 |
-
*
|
8 |
-
* All blocks should be included here since this is the file that
|
9 |
-
* Webpack is compiling as the input file.
|
10 |
-
*/
|
11 |
-
|
12 |
-
import './google-docs/index.js';
|
13 |
-
import './google-slides/index.js';
|
14 |
-
import './google-sheets/index.js';
|
15 |
-
import './google-forms/index.js';
|
16 |
-
import './google-drawings/index.js';
|
17 |
-
import './google-maps/index.js';
|
18 |
-
import './twitch/index.js';
|
19 |
-
import './wistia/index.js';
|
20 |
-
import './youtube/index.js';
|
21 |
-
import './document/index.js';
|
22 |
-
import './embedpress/index.js';
|
23 |
-
|
24 |
-
( function() {
|
25 |
-
let a = <svg width="33" height="20" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0px" y="0px"
|
26 |
-
viewBox="0 0 270 270">
|
27 |
-
<g>
|
28 |
-
<polygon className="st0" fill="#9595C1" points="0,0 0,52 15,52 15,15 52,15 52,0 "/>
|
29 |
-
<polygon className="st0" fill="#9595C1" points="255,218 255,255 218,255 218,270 270,270 270,218 "/>
|
30 |
-
<path fill="#5B4E96" d="M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2
|
31 |
-
C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2
|
32 |
-
c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1
|
33 |
-
c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4
|
34 |
-
c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3
|
35 |
-
c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5
|
36 |
-
c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91
|
37 |
-
l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1
|
38 |
-
c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4
|
39 |
-
c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0
|
40 |
-
c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"/>
|
41 |
-
</g>
|
42 |
-
</svg>
|
43 |
-
wp.blocks.updateCategory( 'embedpress', { icon: a } );
|
44 |
-
} )();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common.scss
DELETED
@@ -1,13 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Common SCSS
|
3 |
-
*
|
4 |
-
* Can include things like variables and mixins
|
5 |
-
* that are used across the project.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Colors.
|
9 |
-
$black: rgb(41, 41, 41);
|
10 |
-
$white: #f4f4f4;
|
11 |
-
$gray: #dedede;
|
12 |
-
$green: #bada55;
|
13 |
-
$red: orangered;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/Iframe.js
DELETED
@@ -1,31 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
|
3 |
-
JSX USAGE: <Iframe src='http://web.site' onLoad={myOnloadFunction}/>
|
4 |
-
*/
|
5 |
-
import ReactDOM from 'react-dom'
|
6 |
-
const { Component } = wp.element;
|
7 |
-
|
8 |
-
class Iframe extends Component {
|
9 |
-
constructor(props) {
|
10 |
-
super(props);
|
11 |
-
this.myRef = React.createRef();
|
12 |
-
}
|
13 |
-
componentDidMount () {
|
14 |
-
let iframe = ReactDOM.findDOMNode(this.myRef.current)
|
15 |
-
iframe.addEventListener('load', this.props.onLoad);
|
16 |
-
}
|
17 |
-
|
18 |
-
render () {
|
19 |
-
|
20 |
-
return (
|
21 |
-
<iframe
|
22 |
-
ref={this.myRef}
|
23 |
-
{...this.props}
|
24 |
-
|
25 |
-
/>
|
26 |
-
)
|
27 |
-
}
|
28 |
-
|
29 |
-
}
|
30 |
-
|
31 |
-
export default Iframe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/core-embeds.js
DELETED
@@ -1,25 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import { googleDocsIcon } from './icons';
|
5 |
-
/**
|
6 |
-
* WordPress dependencies
|
7 |
-
*/
|
8 |
-
const { __ } = wp.i18n;
|
9 |
-
|
10 |
-
export const common = [
|
11 |
-
{
|
12 |
-
name: 'embedpress-blocks/google',
|
13 |
-
settings: {
|
14 |
-
title: 'Google Docs',
|
15 |
-
icon: googleDocsIcon,
|
16 |
-
keywords: [ 'google' , 'docs' ],
|
17 |
-
description: __( 'Embed a google document.' ),
|
18 |
-
},
|
19 |
-
patterns: [ /^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)\/. +/i ]
|
20 |
-
},
|
21 |
-
];
|
22 |
-
|
23 |
-
export const others = [
|
24 |
-
|
25 |
-
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-controls.js
DELETED
@@ -1,33 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const { __ } = wp.i18n;
|
5 |
-
const { Fragment } = wp.element;
|
6 |
-
const { IconButton, Toolbar } = wp.components;
|
7 |
-
const { BlockControls } = wp.editor;
|
8 |
-
|
9 |
-
const EmbedControls = ( props ) => {
|
10 |
-
const {
|
11 |
-
showEditButton,
|
12 |
-
switchBackToURLInput
|
13 |
-
} = props;
|
14 |
-
return (
|
15 |
-
<Fragment>
|
16 |
-
<BlockControls>
|
17 |
-
<Toolbar>
|
18 |
-
{ showEditButton && (
|
19 |
-
<IconButton
|
20 |
-
className="components-toolbar__control"
|
21 |
-
label={ __( 'Edit URL' ) }
|
22 |
-
icon="edit"
|
23 |
-
onClick={ switchBackToURLInput }
|
24 |
-
/>
|
25 |
-
) }
|
26 |
-
</Toolbar>
|
27 |
-
</BlockControls>
|
28 |
-
|
29 |
-
</Fragment>
|
30 |
-
);
|
31 |
-
};
|
32 |
-
|
33 |
-
export default EmbedControls;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-loading.js
DELETED
@@ -1,14 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const { __ } = wp.i18n;
|
5 |
-
const { Spinner } = wp.components;
|
6 |
-
|
7 |
-
const EmbedLoading = () => (
|
8 |
-
<div className="wp-block-embed is-loading">
|
9 |
-
<Spinner />
|
10 |
-
<p>{ __( 'Embedding…' ) }</p>
|
11 |
-
</div>
|
12 |
-
);
|
13 |
-
|
14 |
-
export default EmbedLoading;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-placeholder.js
DELETED
@@ -1,49 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const {__, _x} = wp.i18n;
|
5 |
-
import classnames from 'classnames';
|
6 |
-
const {Button, Placeholder, ExternalLink} = wp.components;
|
7 |
-
const {BlockIcon} = wp.blockEditor;
|
8 |
-
|
9 |
-
const EmbedPlaceholder = (props) => {
|
10 |
-
const {icon, label, value, onSubmit, onChange, cannotEmbed, docLink, DocTitle} = props;
|
11 |
-
const classes = classnames( 'wp-block-embed', {} );
|
12 |
-
return (
|
13 |
-
<div>
|
14 |
-
<Placeholder icon={<BlockIcon icon={icon} showColors/>} label={label} className={classes}>
|
15 |
-
|
16 |
-
<form onSubmit={onSubmit}>
|
17 |
-
<input
|
18 |
-
type="url"
|
19 |
-
value={value || ''}
|
20 |
-
className="components-placeholder__input"
|
21 |
-
aria-label={label}
|
22 |
-
placeholder={__('Enter URL to embed here…')}
|
23 |
-
onChange={onChange}/>
|
24 |
-
<Button
|
25 |
-
isSmall
|
26 |
-
type="submit">
|
27 |
-
{_x('Embed', 'button label')}
|
28 |
-
</Button>
|
29 |
-
|
30 |
-
{cannotEmbed &&
|
31 |
-
<p className="components-placeholder__error">
|
32 |
-
{__('Sorry, we could not embed that content.')}<br/>
|
33 |
-
</p>
|
34 |
-
}
|
35 |
-
|
36 |
-
</form>
|
37 |
-
{docLink &&
|
38 |
-
<div className="components-placeholder__learn-more">
|
39 |
-
<ExternalLink href={docLink}>{DocTitle}</ExternalLink>
|
40 |
-
</div>
|
41 |
-
}
|
42 |
-
|
43 |
-
</Placeholder>
|
44 |
-
</div>
|
45 |
-
|
46 |
-
);
|
47 |
-
};
|
48 |
-
|
49 |
-
export default EmbedPlaceholder;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/embed-wrap.js
DELETED
@@ -1,28 +0,0 @@
|
|
1 |
-
/*
|
2 |
-
INIT: ensure Babel/Eslint/Flow is configured for ES Class Fields & Static Properties
|
3 |
-
JSX USAGE: <Epwrap src='http://web.site' onLoad={myOnloadFunction}/>
|
4 |
-
*/
|
5 |
-
import ReactDOM from 'react-dom'
|
6 |
-
const { Component } = wp.element;
|
7 |
-
|
8 |
-
export default class EmbedWrap extends Component {
|
9 |
-
constructor(props) {
|
10 |
-
super(props);
|
11 |
-
this.myRef = React.createRef();
|
12 |
-
}
|
13 |
-
componentDidMount () {
|
14 |
-
let wrap = ReactDOM.findDOMNode(this.myRef.current)
|
15 |
-
wrap.addEventListener('load', this.props.onLoad);
|
16 |
-
}
|
17 |
-
|
18 |
-
render () {
|
19 |
-
|
20 |
-
return (
|
21 |
-
<div
|
22 |
-
ref={this.myRef}
|
23 |
-
{...this.props}
|
24 |
-
></div>
|
25 |
-
)
|
26 |
-
}
|
27 |
-
|
28 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/common/icons.js
DELETED
@@ -1,211 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* WordPress dependencies
|
3 |
-
*/
|
4 |
-
const {
|
5 |
-
G,
|
6 |
-
Path,
|
7 |
-
Polygon,
|
8 |
-
SVG,
|
9 |
-
} = wp.components;
|
10 |
-
export const googleDocsIcon =
|
11 |
-
<SVG xmlns="http://www.w3.org/1999/xlink"
|
12 |
-
viewBox="0 0 48 48"
|
13 |
-
>
|
14 |
-
<G>
|
15 |
-
<Path style= {{ fill: '#2196F3' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
16 |
-
<Path style= {{ fill: '#BBDEFB' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
17 |
-
<Path style= {{ fill: '#1565C0' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
18 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 23 L 33 23 L 33 25 L 15 25 Z "/>
|
19 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 27 L 33 27 L 33 29 L 15 29 Z "/>
|
20 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 31 L 33 31 L 33 33 L 15 33 Z "/>
|
21 |
-
<Path style= {{ fill: '#E3F2FD' }} d="M 15 35 L 25 35 L 25 37 L 15 37 Z "/>
|
22 |
-
</G>
|
23 |
-
</SVG>
|
24 |
-
export const googleSlidesIcon =
|
25 |
-
<SVG
|
26 |
-
xmlns="http://www.w3.org/1999/xlink"
|
27 |
-
enableBackground="new 0 0 24 24" id="Layer_2"
|
28 |
-
version="1.1"
|
29 |
-
viewBox="0 0 24 24">
|
30 |
-
<G>
|
31 |
-
<Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14c1.1045704,0,2-0.8954296,2-2 V6z"
|
32 |
-
style={{ fill: "#FFC720" }}/>
|
33 |
-
|
34 |
-
<Path d="M17,6c-0.5444336,0-1.0367432-0.2190552-1.3973999-0.5719604L21,10.8254395V6H17z"
|
35 |
-
style={{ fill: "url(#SVGID_1_)" }} />
|
36 |
-
<Path d="M19,23.75H5c-1.1045532,0-2-0.8954468-2-2V22c0,1.1045532,0.8954468,2,2,2h14c1.1045532,0,2-0.8954468,2-2 v-0.25C21,22.8545532,20.1045532,23.75,19,23.75z"
|
37 |
-
style={{ opacity: "0.1" }} />
|
38 |
-
<Path d="M15,0v4c0,1.1045694,0.8954306,2,2,2h4L15,0z" style= {{ fill: "#FFE083" }} />
|
39 |
-
<Path d="M17,5.75c-1.1045532,0-2-0.8954468-2-2V4c0,1.1045532,0.8954468,2,2,2h4l-0.25-0.25H17z" style={{ opacity:"0.1" }} />
|
40 |
-
<Path d="M15,0H5C3.8954468,0,3,0.8953857,3,2v0.25c0-1.1046143,0.8954468-2,2-2h10" style={{ fill: "#FFFFFF", opacity: "0.2" }} />
|
41 |
-
<Path d="M15.5,9h-7C7.6728516,9,7,9.6728516,7,10.5v6C7,17.3271484,7.6728516,18,8.5,18h7 c0.8271484,0,1.5-0.6728516,1.5-1.5v-6C17,9.6728516,16.3271484,9,15.5,9z M8,15.5V11h8v4.5H8z"
|
42 |
-
style={{ fill: "#FFFFFF" }} />
|
43 |
-
|
44 |
-
<Path d="M21,6l-6-6H5C3.8954306,0,3,0.8954305,3,2v20c0,1.1045704,0.8954306,2,2,2h14 c1.1045704,0,2-0.8954296,2-2V6z" style={{ fill: "url(#SVGID_2_)" }} />
|
45 |
-
</G>
|
46 |
-
</SVG>
|
47 |
-
|
48 |
-
export const googleSheetsIcon =
|
49 |
-
<SVG
|
50 |
-
xmlns="http://www.w3.org/1999/xlink"
|
51 |
-
viewBox="0 0 48 48"
|
52 |
-
version="1.1">
|
53 |
-
<G>
|
54 |
-
<Path style={{ fill: '#43A047' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
55 |
-
<Path style={{ fill: '#C8E6C9' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
56 |
-
<Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
57 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 31 23 L 15 23 L 15 37 L 33 37 L 33 23 Z M 17 25 L 21 25 L 21 27 L 17 27 Z M 17 29 L 21 29 L 21 31 L 17 31 Z M 17 33 L 21 33 L 21 35 L 17 35 Z M 31 35 L 23 35 L 23 33 L 31 33 Z M 31 31 L 23 31 L 23 29 L 31 29 Z M 31 27 L 23 27 L 23 25 L 31 25 Z "/>
|
58 |
-
</G>
|
59 |
-
</SVG>
|
60 |
-
|
61 |
-
export const googleFormsIcon =
|
62 |
-
<SVG
|
63 |
-
xmlns="http://www.w3.org/1999/xlink"
|
64 |
-
viewBox="0 0 48 48"
|
65 |
-
version="1.1"
|
66 |
-
>
|
67 |
-
<G>
|
68 |
-
<Path style={{ fill: '#7850C1' }} d="M 37 45 L 11 45 C 9.34375 45 8 43.65625 8 42 L 8 6 C 8 4.34375 9.34375 3 11 3 L 30 3 L 40 13 L 40 42 C 40 43.65625 38.65625 45 37 45 Z "/>
|
69 |
-
<Path style={{ fill: '#C2ABE1' }} d="M 40 13 L 30 13 L 30 3 Z "/>
|
70 |
-
<Path style={{ fill: '#2E7D32' }} d="M 30 13 L 40 23 L 40 13 Z "/>
|
71 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 23 L 33 23 L 33 25 L 19 25 Z "/>
|
72 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 28 L 33 28 L 33 30 L 19 30 Z "/>
|
73 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 19 33 L 33 33 L 33 35 L 19 35 Z "/>
|
74 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 23 L 17 23 L 17 25 L 15 25 Z "/>
|
75 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 28 L 17 28 L 17 30 L 15 30 Z "/>
|
76 |
-
<Path style={{ fill: '#E8F5E9' }} d="M 15 33 L 17 33 L 17 35 L 15 35 Z "/>
|
77 |
-
</G>
|
78 |
-
</SVG>
|
79 |
-
|
80 |
-
export const googleDrawingsIcon=
|
81 |
-
<SVG
|
82 |
-
xmlns="http://www.w3.org/1999/xlink"
|
83 |
-
viewBox="0 0 48 48"
|
84 |
-
version="1.1"
|
85 |
-
>
|
86 |
-
<G>
|
87 |
-
<Path style={{ fill: '#DE5245' }} d="M37,45H11c-1.7,0-3-1.3-3-3V6c0-1.7,1.3-3,3-3h19l10,10v29C40,43.7,38.7,45,37,45z"/>
|
88 |
-
<Path style={{ fill: '#EEA6A0' }} d="M40,13H30V3L40,13z"/>
|
89 |
-
<Path style={{ fill: '#B3433A' }} d="M30,13l10,10V13H30z"/>
|
90 |
-
<Path style={{ fill: '#FFFFFF' }} d="M20.5,32c-3,0-5.5-2.5-5.5-5.5c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C26,29.5,23.5,32,20.5,32z M20.5,23c-1.9,0-3.5,1.6-3.5,3.5s1.6,3.5,3.5,3.5s3.5-1.6,3.5-3.5S22.4,23,20.5,23z"/>
|
91 |
-
<Path style={{ fill: '#FFFFFF' }} d="M27.6,29c-0.6,1.8-1.9,3.3-3.6,4.1V38h9v-9H27.6z"/>
|
92 |
-
</G>
|
93 |
-
</SVG>
|
94 |
-
|
95 |
-
export const googleMapsIcon=
|
96 |
-
<SVG
|
97 |
-
xmlns="http://www.w3.org/1999/xlink"
|
98 |
-
viewBox="0 0 48 48"
|
99 |
-
version="1.1"
|
100 |
-
>
|
101 |
-
<G>
|
102 |
-
<Path style={{ fill: '#1C9957' }} d="M 42 39 L 42 9 C 42 7.34375 40.65625 6 39 6 L 9 6 C 7.34375 6 6 7.34375 6 9 L 6 39 C 6 40.65625 7.34375 42 9 42 L 39 42 C 40.65625 42 42 40.65625 42 39 Z "/>
|
103 |
-
<Path style={{ fill: '#3E7BF1' }} d="M 9 42 L 39 42 C 40.65625 42 24 26 24 26 C 24 26 7.34375 42 9 42 Z "/>
|
104 |
-
<Path style={{ fill: '#CBCCC9' }} d="M 42 39 L 42 9 C 42 7.34375 26 24 26 24 C 26 24 42 40.65625 42 39 Z "/>
|
105 |
-
<Path style={{ fill: '#EFEFEF' }} d="M 39 42 C 40.65625 42 42 40.65625 42 39 L 42 38.753906 L 26.246094 23 L 23 26.246094 L 38.753906 42 Z "/>
|
106 |
-
<Path style={{ fill: '#FFD73D' }} d="M 42 9 C 42 7.34375 40.65625 6 39 6 L 38.753906 6 L 6 38.753906 L 6 39 C 6 40.65625 7.34375 42 9 42 L 9.246094 42 L 42 9.246094 Z "/>
|
107 |
-
<Path style={{ fill: '#D73F35' }} d="M 36 2 C 30.476563 2 26 6.476563 26 12 C 26 18.8125 33.664063 21.296875 35.332031 31.851563 C 35.441406 32.53125 35.449219 33 36 33 C 36.550781 33 36.558594 32.53125 36.667969 31.851563 C 38.335938 21.296875 46 18.8125 46 12 C 46 6.476563 41.523438 2 36 2 Z "/>
|
108 |
-
<Path style={{ fill: '#752622' }} d="M 39.5 12 C 39.5 13.933594 37.933594 15.5 36 15.5 C 34.066406 15.5 32.5 13.933594 32.5 12 C 32.5 10.066406 34.066406 8.5 36 8.5 C 37.933594 8.5 39.5 10.066406 39.5 12 Z "/>
|
109 |
-
<Path style={{ fill: '#FFFFFF' }} d="M 14.492188 12.53125 L 14.492188 14.632813 L 17.488281 14.632813 C 17.09375 15.90625 16.03125 16.816406 14.492188 16.816406 C 12.660156 16.816406 11.175781 15.332031 11.175781 13.5 C 11.175781 11.664063 12.660156 10.179688 14.492188 10.179688 C 15.316406 10.179688 16.070313 10.484375 16.648438 10.980469 L 18.195313 9.433594 C 17.21875 8.542969 15.921875 8 14.492188 8 C 11.453125 8 8.992188 10.464844 8.992188 13.5 C 8.992188 16.535156 11.453125 19 14.492188 19 C 19.304688 19 20.128906 14.683594 19.675781 12.539063 Z "/>
|
110 |
-
</G>
|
111 |
-
</SVG>
|
112 |
-
|
113 |
-
export const twitchIcon =
|
114 |
-
<SVG
|
115 |
-
xmlns="http://www.w3.org/1999/xlink"
|
116 |
-
viewBox="0 0 48 48"
|
117 |
-
version="1.1"
|
118 |
-
>
|
119 |
-
<G>
|
120 |
-
<Path style={{ fill: '#FFFFFF' }} d="M 12 32 L 12 8 L 39 8 L 39 26 L 33 32 L 24 32 L 18 38 L 18 32 Z "/>
|
121 |
-
<Path style={{ fill: '#8E24AA' }} d="M 9 5 L 6 12.121094 L 6 38 L 15 38 L 15 43 L 20 43 L 25 38 L 32 38 L 42 28 L 42 5 Z M 38 26 L 33 31 L 24 31 L 19 36 L 19 31 L 13 31 L 13 9 L 38 9 Z "/>
|
122 |
-
<Path style={{ fill: '#8E24AA' }} d="M 32 25 L 27 25 L 27 15 L 32 15 Z "/>
|
123 |
-
<Path style={{ fill: '#8E24AA' }} d="M 24 25 L 19 25 L 19 15 L 24 15 Z "/>
|
124 |
-
</G>
|
125 |
-
</SVG>
|
126 |
-
|
127 |
-
export const wistiaIcon =
|
128 |
-
<SVG
|
129 |
-
xmlns="http://www.w3.org/1999/xlink"
|
130 |
-
viewBox="0 0 769 598"
|
131 |
-
version="1.1"
|
132 |
-
>
|
133 |
-
<G>
|
134 |
-
<Path style={{ fill: '#148ee0' }} d="M766.89,229.17c0,0 -17.78,35.38 -106.5,91.3c-37.82,23.79 -116.36,49.1 -217.33,58.86c-54.52,5.29 -154.9,0.99 -197.96,0.99c-43.29,0 -63.13,9.12 -101.95,52.84c-143.15,161.36 -143.15,161.36 -143.15,161.36c0,0 49.57,0.24 87.01,0.24c37.43,0 271.55,13.59 375.43,-14.98c337.36,-92.72 304.46,-350.62 304.46,-350.62z" />
|
135 |
-
<Path style={{ fill: '#54bbff' }} d="M757.84,126.66c16.23,-98.97 -39.68,-126.16 -39.68,-126.16c0,0 2.36,80.57 -145.7,97.65c-131.42,15.16 -572.46,3.74 -572.46,3.74c0,0 0,0 141.74,162.54c38.39,44.06 58.76,49.17 101.92,52.22c43.16,2.89 138.42,1.86 202.99,-3.05c70.58,-5.41 171.17,-28.43 239.19,-81.11c34.88,-26.98 65.21,-64.48 72,-105.83z" />
|
136 |
-
</G>
|
137 |
-
</SVG>
|
138 |
-
|
139 |
-
export const youtubeIcon =
|
140 |
-
<SVG
|
141 |
-
xmlns="http://www.w3.org/2000/svg"
|
142 |
-
width="24"
|
143 |
-
height="24"
|
144 |
-
viewBox="0 0 24 24"
|
145 |
-
role="img"
|
146 |
-
aria-hidden="true"
|
147 |
-
focusable="false"
|
148 |
-
>
|
149 |
-
<Path d="M21.8 8s-.195-1.377-.795-1.984c-.76-.797-1.613-.8-2.004-.847-2.798-.203-6.996-.203-6.996-.203h-.01s-4.197 0-6.996.202c-.39.046-1.242.05-2.003.846C2.395 6.623 2.2 8 2.2 8S2 9.62 2 11.24v1.517c0 1.618.2 3.237.2 3.237s.195 1.378.795 1.985c.76.797 1.76.77 2.205.855 1.6.153 6.8.2 6.8.2s4.203-.005 7-.208c.392-.047 1.244-.05 2.005-.847.6-.607.795-1.985.795-1.985s.2-1.618.2-3.237v-1.517C22 9.62 21.8 8 21.8 8zM9.935 14.595v-5.62l5.403 2.82-5.403 2.8z" />
|
150 |
-
</SVG>
|
151 |
-
|
152 |
-
export const youtubeNewIcon =
|
153 |
-
<svg version="1.1"
|
154 |
-
xmlns="http://www.w3.org/2000/svg"
|
155 |
-
viewBox="0 0 56 23"
|
156 |
-
>
|
157 |
-
<g>
|
158 |
-
<g>
|
159 |
-
<path style={{ fill: '#DA2B28' }} className="st0" d="M55.4,3.7c-0.2-0.9-0.6-1.6-1.3-2.2c-0.7-0.6-1.4-0.9-2.3-1c-2.7-0.3-6.8-0.4-12.3-0.4
|
160 |
-
c-5.5,0-9.6,0.1-12.3,0.4c-0.9,0.1-1.6,0.5-2.3,1c-0.7,0.6-1.1,1.3-1.3,2.2c-0.4,1.7-0.6,4.3-0.6,7.8c0,3.5,0.2,6.1,0.6,7.8
|
161 |
-
c0.2,0.9,0.6,1.6,1.3,2.2c0.7,0.6,1.4,0.9,2.3,1c2.7,0.3,6.8,0.5,12.3,0.5c5.5,0,9.6-0.2,12.3-0.5c0.9-0.1,1.6-0.4,2.3-1
|
162 |
-
c0.7-0.6,1.1-1.3,1.3-2.2c0.4-1.7,0.6-4.3,0.6-7.8C56,8,55.8,5.4,55.4,3.7L55.4,3.7z M32.5,6h-2.4v12.6h-2.2V6h-2.3V3.9h6.9V6z
|
163 |
-
M38.5,18.6h-2v-1.2c-0.8,0.9-1.6,1.4-2.3,1.4c-0.7,0-1.1-0.3-1.3-0.8c-0.1-0.4-0.2-0.9-0.2-1.6V7.6h2v8.1c0,0.5,0,0.7,0,0.8
|
164 |
-
c0,0.3,0.2,0.5,0.5,0.5c0.4,0,0.8-0.3,1.3-0.9V7.6h2V18.6z M46.1,15.3c0,1.1-0.1,1.8-0.2,2.2c-0.3,0.8-0.8,1.2-1.6,1.2
|
165 |
-
c-0.7,0-1.4-0.4-2.1-1.2v1.1h-2V3.9h2v4.8c0.6-0.8,1.3-1.2,2.1-1.2c0.8,0,1.3,0.4,1.6,1.2c0.1,0.4,0.2,1.1,0.2,2.2V15.3z
|
166 |
-
M53.5,13.5h-4v1.9c0,1,0.3,1.5,1,1.5c0.5,0,0.8-0.3,0.9-0.8c0-0.1,0-0.6,0-1.4h2v0.3c0,0.7,0,1.2,0,1.3c0,0.4-0.2,0.8-0.5,1.2
|
167 |
-
c-0.5,0.8-1.3,1.2-2.4,1.2c-1,0-1.8-0.4-2.4-1.1c-0.4-0.5-0.6-1.4-0.6-2.6v-3.8c0-1.2,0.2-2,0.6-2.6c0.6-0.8,1.4-1.1,2.4-1.1
|
168 |
-
c1,0,1.8,0.4,2.3,1.1c0.4,0.5,0.6,1.4,0.6,2.6V13.5z M53.5,13.5"/>
|
169 |
-
<path className="st0" d="M43.2,9.3c-0.3,0-0.7,0.2-1,0.5v6.7c0.3,0.3,0.7,0.5,1,0.5c0.6,0,0.9-0.5,0.9-1.5v-4.7
|
170 |
-
C44.1,9.8,43.8,9.3,43.2,9.3L43.2,9.3z M43.2,9.3"/>
|
171 |
-
<path className="st0" d="M50.6,9.3c-0.7,0-1,0.5-1,1.5v1h2v-1C51.6,9.8,51.2,9.3,50.6,9.3L50.6,9.3z M50.6,9.3"/>
|
172 |
-
</g>
|
173 |
-
<g>
|
174 |
-
<path
|
175 |
-
d="M2.8,12.8v6h2.2v-6L7.7,4H5.5L4,9.8L2.4,4H0.1c0.4,1.2,0.9,2.6,1.4,4.1C2.2,10.2,2.6,11.7,2.8,12.8L2.8,12.8z M2.8,12.8"
|
176 |
-
/>
|
177 |
-
<path d="M10.7,19c1,0,1.8-0.4,2.3-1.1c0.4-0.5,0.6-1.4,0.6-2.6v-3.9c0-1.2-0.2-2-0.6-2.6c-0.5-0.8-1.3-1.1-2.3-1.1
|
178 |
-
c-1,0-1.8,0.4-2.3,1.1C8,9.3,7.8,10.2,7.8,11.4v3.9c0,1.2,0.2,2.1,0.6,2.6C8.9,18.6,9.7,19,10.7,19L10.7,19z M9.8,11
|
179 |
-
c0-1,0.3-1.5,1-1.5c0.6,0,1,0.5,1,1.5v4.7c0,1-0.3,1.6-1,1.6c-0.6,0-1-0.5-1-1.6V11z M9.8,11"/>
|
180 |
-
<path d="M16.8,19c0.7,0,1.5-0.5,2.3-1.4v1.2h2V7.8h-2v8.4c-0.4,0.6-0.9,1-1.3,1c-0.3,0-0.4-0.2-0.5-0.5c0,0,0-0.3,0-0.8V7.8h-2
|
181 |
-
v8.7c0,0.8,0.1,1.3,0.2,1.7C15.7,18.7,16.1,19,16.8,19L16.8,19z M16.8,19"/>
|
182 |
-
</g>
|
183 |
-
</g>
|
184 |
-
</svg>;
|
185 |
-
|
186 |
-
export const DocumentIcon = <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 276 340" ><path d="M196.7.6H24.3C11.1.6.4 11.3.4 24.6v292.9c0 12.3 10 22.2 22.2 22.2H252c13.3 0 23.9-10.7 23.9-23.9V80.9L196.7.6z" fill="#e94848"/><path d="M196.7 57c0 13.3 10.7 23.9 23.9 23.9H276L196.7.6V57z" fill="#f19191"/><linearGradient id="A" gradientUnits="userSpaceOnUse" x1="44.744" y1="77.111" x2="116.568" y2="77.111"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><path d="M113 84.5H48.3c-1.9 0-3.5-1.6-3.5-3.5v-7.7c0-1.9 1.6-3.5 3.5-3.5H113c1.9 0 3.5 1.6 3.5 3.5V81c.1 1.9-1.5 3.5-3.5 3.5z" fill="url(#A)"/><linearGradient id="B" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.016" x2="233.927" y2="136.016"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" opacity=".8" fill="url(#B)"/><linearGradient id="C" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.993" x2="233.927" y2="135.993"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="33.6" opacity=".7" fill="url(#C)"/><linearGradient id="D" gradientUnits="userSpaceOnUse" x1="44.744" y1="135.969" x2="233.927" y2="135.969"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="67.2" opacity=".6" fill="url(#D)"/><linearGradient id="E" gradientUnits="userSpaceOnUse" x1="44.744" y1="136.045" x2="233.927" y2="136.045"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><use href="#H" y="100.7" opacity=".4" fill="url(#E)"/><linearGradient id="F" gradientUnits="userSpaceOnUse" x1="44.744" y1="270.322" x2="174.778" y2="270.322"><stop offset="0" stopColor="#fff"/><stop offset="1" stopColor="#fff0f0"/></linearGradient><path d="M171.9 277.7H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9h124.3c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z" opacity=".3" fill="url(#F)"/><defs ><path id="H" d="M231 143.4H47.6c-1.6 0-2.9-1.3-2.9-2.9v-9c0-1.6 1.3-2.9 2.9-2.9H231c1.6 0 2.9 1.3 2.9 2.9v9c0 1.6-1.3 2.9-2.9 2.9z"/></defs></svg>;
|
187 |
-
export const embedPressIcon =<svg
|
188 |
-
width="33"
|
189 |
-
height="20"
|
190 |
-
version="1.1"
|
191 |
-
id="Layer_1"
|
192 |
-
xmlns="http://www.w3.org/2000/svg"
|
193 |
-
x="0px"
|
194 |
-
y="0px"
|
195 |
-
viewBox="0 0 270 270"
|
196 |
-
role="img"
|
197 |
-
focusable="false">
|
198 |
-
<g>
|
199 |
-
<polygon
|
200 |
-
className="st0"
|
201 |
-
fill="#9595C1"
|
202 |
-
points="0,0 0,52 15,52 15,15 52,15 52,0 "></polygon>
|
203 |
-
<polygon
|
204 |
-
className="st0"
|
205 |
-
fill="#9595C1"
|
206 |
-
points="255,218 255,255 218,255 218,270 270,270 270,218 "></polygon>
|
207 |
-
<path
|
208 |
-
fill="#5B4E96"
|
209 |
-
d="M260.7,68.1c-10.4-18.6-29.3-31.2-50.6-33.6c-12.4-1.4-25,0.6-36.3,6c-1.3,0.6-2.6,1.3-3.9,2 C154.5,51,143,65.3,138.3,81.7l0,0.1l-36.4,103.8c-3.1,9.4-9.1,17-17.1,21.4c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.5,3.2 c-11.5-1.3-21.6-8.1-27.2-18.1c-4.6-8.3-5.7-18-3.1-27.2c2.6-9.2,8.7-16.9,17.1-21.5c0.7-0.4,1.4-0.8,2.1-1.1 c6.1-2.9,12.7-4,19.6-3.2c0.3,0,0.5,0.1,0.8,0.1L64.9,162c-0.5,1.5,0.3,3.1,1.8,3.6l19.4,6.3c1.5,0.5,3-0.3,3.5-1.7l16.7-47.4 c0.4-1.2,0.3-2.5-0.3-3.6c-0.6-1.1-1.6-2-2.8-2.4l-17.6-5.1c-0.4-0.1-0.8-0.2-1.2-0.3l-1.6-0.5l0,0.1c-2.5-0.6-5-1.1-7.5-1.3 c-12.5-1.4-25.1,0.6-36.4,6c-1.3,0.6-2.6,1.3-3.9,2c-15.6,8.7-27,22.9-31.9,40.1c-4.9,17.1-2.8,35.1,5.8,50.5 c10.4,18.6,29.3,31.2,50.6,33.6c12.4,1.4,25-0.6,36.3-6c1.3-0.6,2.6-1.3,3.9-2c15.3-8.5,26.8-22.8,31.6-39.2l0-0.1L167.8,91 l0.1-0.2l0-0.1c4.1-10.5,9.3-17,17-21.3c0.7-0.4,1.4-0.7,2.1-1.1c6.1-2.9,12.8-4,19.5-3.2c11.5,1.3,21.6,8.1,27.2,18.1 c9.6,17.2,3.3,39.1-14,48.7c-0.7,0.4-1.4,0.7-2.1,1.1c-6.1,2.9-12.8,4-19.7,3.2c-2-0.2-4.1-0.6-6.1-1.2l-0.2-0.1l-11.3-3.4 c-1.2-0.4-2.5,0.3-2.9,1.5l-8.8,24.8c-0.5,1.3,0.3,2.7,1.6,3.1l13.9,4c3.4,0.9,6.8,1.6,10.3,2c12.4,1.4,25-0.6,36.3-6l0.1,0 c1.3-0.6,2.6-1.3,3.9-2C266.8,140.8,278.5,100.1,260.7,68.1z"></path>
|
210 |
-
</g>
|
211 |
-
</svg>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/edit.js
DELETED
@@ -1,235 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
|
5 |
-
import Iframe from '../common/Iframe';
|
6 |
-
import EmbedLoading from '../common/embed-loading';
|
7 |
-
/**
|
8 |
-
* WordPress dependencies
|
9 |
-
*/
|
10 |
-
|
11 |
-
const {__} = wp.i18n;
|
12 |
-
const {getBlobByURL, isBlobURL, revokeBlobURL} = wp.blob;
|
13 |
-
const {BlockIcon, MediaPlaceholder ,InspectorControls} = wp.editor;
|
14 |
-
const {Component, Fragment} = wp.element;
|
15 |
-
const { RangeControl,PanelBody, ExternalLink,ToggleControl } = wp.components;
|
16 |
-
import {DocumentIcon} from '../common/icons'
|
17 |
-
|
18 |
-
const ALLOWED_MEDIA_TYPES = [
|
19 |
-
'application/pdf',
|
20 |
-
'application/msword',
|
21 |
-
'application/vnd.ms-powerpoint',
|
22 |
-
'application/vnd.ms-excel',
|
23 |
-
'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
24 |
-
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
25 |
-
'application/vnd.openxmlformats-officedocument.presentationml.presentation'
|
26 |
-
];
|
27 |
-
|
28 |
-
class DocumentEdit extends Component {
|
29 |
-
constructor() {
|
30 |
-
super(...arguments);
|
31 |
-
this.onSelectFile = this.onSelectFile.bind(this);
|
32 |
-
|
33 |
-
this.onUploadError = this.onUploadError.bind(this);
|
34 |
-
this.onLoad = this.onLoad.bind(this);
|
35 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
36 |
-
this.state = {
|
37 |
-
hasError: false,
|
38 |
-
fetching:false,
|
39 |
-
interactive: false,
|
40 |
-
loadPdf: true,
|
41 |
-
};
|
42 |
-
}
|
43 |
-
|
44 |
-
|
45 |
-
componentDidMount() {
|
46 |
-
const {
|
47 |
-
attributes,
|
48 |
-
mediaUpload,
|
49 |
-
noticeOperations
|
50 |
-
} = this.props;
|
51 |
-
const {href} = attributes;
|
52 |
-
|
53 |
-
// Upload a file drag-and-dropped into the editor
|
54 |
-
if (isBlobURL(href)) {
|
55 |
-
const file = getBlobByURL(href);
|
56 |
-
|
57 |
-
mediaUpload({
|
58 |
-
filesList: [file],
|
59 |
-
onFileChange: ([media]) => this.onSelectFile(media),
|
60 |
-
onError: (message) => {
|
61 |
-
this.setState({hasError: true});
|
62 |
-
noticeOperations.createErrorNotice(message);
|
63 |
-
},
|
64 |
-
});
|
65 |
-
|
66 |
-
revokeBlobURL(href);
|
67 |
-
}
|
68 |
-
|
69 |
-
if(this.props.attributes.href && this.props.attributes.mime === 'application/pdf' && this.state.loadPdf){
|
70 |
-
this.setState({loadPdf: false});
|
71 |
-
PDFObject.embed(this.props.attributes.href, "."+this.props.attributes.id);
|
72 |
-
}
|
73 |
-
|
74 |
-
}
|
75 |
-
|
76 |
-
componentDidUpdate(prevProps) {
|
77 |
-
|
78 |
-
// Reset copy confirmation state when block is deselected
|
79 |
-
if (prevProps.isSelected && !this.props.isSelected) {
|
80 |
-
this.setState({showCopyConfirmation: false});
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
static getDerivedStateFromProps(nextProps, state) {
|
86 |
-
if (!nextProps.isSelected && state.interactive) {
|
87 |
-
return {interactive: false};
|
88 |
-
}
|
89 |
-
|
90 |
-
return null;
|
91 |
-
}
|
92 |
-
|
93 |
-
hideOverlay() {
|
94 |
-
this.setState({interactive: true});
|
95 |
-
}
|
96 |
-
|
97 |
-
onLoad() {
|
98 |
-
this.setState({
|
99 |
-
fetching:false
|
100 |
-
})
|
101 |
-
}
|
102 |
-
|
103 |
-
onSelectFile(media) {
|
104 |
-
if (media && media.url) {
|
105 |
-
this.setState({hasError: false});
|
106 |
-
this.props.setAttributes({
|
107 |
-
href: media.url,
|
108 |
-
fileName: media.title,
|
109 |
-
id: 'embedpress-pdf-'+Date.now(),
|
110 |
-
mime: media.mime,
|
111 |
-
});
|
112 |
-
|
113 |
-
if(embedpressObj.embedpress_pro){
|
114 |
-
this.props.setAttributes({
|
115 |
-
powered_by: false
|
116 |
-
});
|
117 |
-
}
|
118 |
-
if(media.mime === 'application/pdf'){
|
119 |
-
this.setState({loadPdf: false});
|
120 |
-
PDFObject.embed(media.url, "."+this.props.attributes.id);
|
121 |
-
}
|
122 |
-
}
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
onUploadError(message) {
|
127 |
-
const {noticeOperations} = this.props;
|
128 |
-
noticeOperations.removeAllNotices();
|
129 |
-
noticeOperations.createErrorNotice(message);
|
130 |
-
}
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
render() {
|
136 |
-
const {attributes, noticeUI,setAttributes} = this.props;
|
137 |
-
const {href,mime,id,width,height,powered_by} = attributes;
|
138 |
-
const {hasError,interactive,fetching,loadPdf} = this.state;
|
139 |
-
const min = 1;
|
140 |
-
const max = 1000;
|
141 |
-
const docLink = 'https://embedpress.com/docs/embed-docuemnt/'
|
142 |
-
if (!href || hasError) {
|
143 |
-
|
144 |
-
return (
|
145 |
-
<div className={"embedpress-document-editmode"}>
|
146 |
-
<MediaPlaceholder
|
147 |
-
icon={<BlockIcon icon={DocumentIcon}/>}
|
148 |
-
labels={{
|
149 |
-
title: __('Document'),
|
150 |
-
instructions: __(
|
151 |
-
'Upload a file or pick one from your media library for embed.'
|
152 |
-
),
|
153 |
-
}}
|
154 |
-
onSelect={this.onSelectFile}
|
155 |
-
notices={noticeUI}
|
156 |
-
allowedTypes={ALLOWED_MEDIA_TYPES}
|
157 |
-
onError={this.onUploadError}
|
158 |
-
|
159 |
-
>
|
160 |
-
|
161 |
-
<div style={{width:'100%'}} className="components-placeholder__learn-more embedpress-doc-link">
|
162 |
-
<ExternalLink href={docLink}>Learn more about Embedded document </ExternalLink>
|
163 |
-
</div>
|
164 |
-
</MediaPlaceholder>
|
165 |
-
|
166 |
-
</div>
|
167 |
-
|
168 |
-
);
|
169 |
-
} else {
|
170 |
-
const url = '//view.officeapps.live.com/op/embed.aspx?src='+href;
|
171 |
-
return (
|
172 |
-
<Fragment>
|
173 |
-
{(fetching && mime !== 'application/pdf') ? <EmbedLoading/> : null}
|
174 |
-
{ mime === 'application/pdf' && (
|
175 |
-
<div style={{height:height,width:width}} className={'embedpress-embed-document-pdf'+' '+id} data-emid={id} data-emsrc={href}></div>
|
176 |
-
|
177 |
-
) }
|
178 |
-
{ mime !== 'application/pdf' && (
|
179 |
-
<Iframe onMouseUponMouseUp={ this.hideOverlay } style={{height:height,width:width,display: fetching || !loadPdf ? 'none' : ''}} onLoad={this.onLoad} src={url}/>
|
180 |
-
) }
|
181 |
-
{ ! interactive && (
|
182 |
-
<div
|
183 |
-
className="block-library-embed__interactive-overlay"
|
184 |
-
onMouseUp={ this.hideOverlay }
|
185 |
-
/>
|
186 |
-
) }
|
187 |
-
{ powered_by && (
|
188 |
-
<p className="embedpress-el-powered">Powered By EmbedPress</p>
|
189 |
-
)}
|
190 |
-
|
191 |
-
<InspectorControls key="inspector">
|
192 |
-
<PanelBody
|
193 |
-
title={ __( 'Embed Size', 'embedpress' ) }
|
194 |
-
>
|
195 |
-
<RangeControl
|
196 |
-
label={ __(
|
197 |
-
'Width',
|
198 |
-
'embedpress'
|
199 |
-
) }
|
200 |
-
value={ width }
|
201 |
-
onChange={ ( width ) =>
|
202 |
-
setAttributes( { width } )
|
203 |
-
}
|
204 |
-
max={ max }
|
205 |
-
min={ min }
|
206 |
-
/>
|
207 |
-
<RangeControl
|
208 |
-
label={ __(
|
209 |
-
'Height',
|
210 |
-
'embedpress'
|
211 |
-
) }
|
212 |
-
value={height }
|
213 |
-
onChange={ ( height ) =>
|
214 |
-
setAttributes( { height } )
|
215 |
-
}
|
216 |
-
max={ max }
|
217 |
-
min={ min }
|
218 |
-
/>
|
219 |
-
<ToggleControl
|
220 |
-
label={ __( 'Powered By' ) }
|
221 |
-
onChange={ ( powered_by ) =>
|
222 |
-
setAttributes( { powered_by } )
|
223 |
-
}
|
224 |
-
checked={ powered_by }
|
225 |
-
/>
|
226 |
-
</PanelBody>
|
227 |
-
</InspectorControls>
|
228 |
-
</Fragment>
|
229 |
-
);
|
230 |
-
}
|
231 |
-
|
232 |
-
}
|
233 |
-
|
234 |
-
};
|
235 |
-
export default DocumentEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/editor.scss
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
|
8 |
-
.embedpress-document-editmode .components-placeholder__instructions:after {
|
9 |
-
content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";
|
10 |
-
white-space: pre;
|
11 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/index.js
DELETED
@@ -1,109 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {DocumentIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
|
18 |
-
/**
|
19 |
-
* Register: aa Gutenberg Block.
|
20 |
-
*
|
21 |
-
* Registers a new block provided a unique name and an object defining its
|
22 |
-
* behavior. Once registered, the block is made editor as an option to any
|
23 |
-
* editor interface where blocks are implemented.
|
24 |
-
*
|
25 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
26 |
-
* @param {string} name Block name.
|
27 |
-
* @param {Object} settings Block settings.
|
28 |
-
* @return {?WPBlock} The block, if it has been successfully
|
29 |
-
* registered; otherwise `undefined`.
|
30 |
-
*/
|
31 |
-
registerBlockType('embedpress/document', {
|
32 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
33 |
-
title: __('Document'), // Block title.
|
34 |
-
icon: DocumentIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
35 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
36 |
-
keywords: [
|
37 |
-
__('embedpress'),
|
38 |
-
__('pdf'),
|
39 |
-
__('doc'),
|
40 |
-
__('ppt'),
|
41 |
-
],
|
42 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
43 |
-
attributes: {
|
44 |
-
id: {
|
45 |
-
type: "string"
|
46 |
-
},
|
47 |
-
href: {
|
48 |
-
type: "string"
|
49 |
-
},
|
50 |
-
powered_by: {
|
51 |
-
type: "boolean",
|
52 |
-
default: true,
|
53 |
-
},
|
54 |
-
width: {
|
55 |
-
type: 'number',
|
56 |
-
default: 600,
|
57 |
-
},
|
58 |
-
height: {
|
59 |
-
type: 'number',
|
60 |
-
default: 600,
|
61 |
-
},
|
62 |
-
fileName: {
|
63 |
-
type: "string",
|
64 |
-
},
|
65 |
-
mime: {
|
66 |
-
type: "string",
|
67 |
-
}
|
68 |
-
},
|
69 |
-
/**
|
70 |
-
* The edit function describes the structure of your block in the context of the editor.
|
71 |
-
* This represents what the editor will render when the block is used.
|
72 |
-
*
|
73 |
-
* The "edit" property must be a valid function.
|
74 |
-
*
|
75 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
76 |
-
*/
|
77 |
-
edit,
|
78 |
-
|
79 |
-
/**
|
80 |
-
* The save function defines the way in which the different attributes should be combined
|
81 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
82 |
-
*
|
83 |
-
* The "save" property must be specified and must be a valid function.
|
84 |
-
*
|
85 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
86 |
-
*/
|
87 |
-
//save
|
88 |
-
save: function (props) {
|
89 |
-
const {href, mime, id, width, height, powered_by} = props.attributes
|
90 |
-
const iframeSrc = '//view.officeapps.live.com/op/embed.aspx?src='+href;
|
91 |
-
const defaultClass = "embedpress-embed-document"
|
92 |
-
return (
|
93 |
-
<figure className={defaultClass}>
|
94 |
-
{mime === 'application/pdf' && (
|
95 |
-
<div style={{height: height, width: width}} className={'embedpress-embed-document-pdf' + ' ' + id}
|
96 |
-
data-emid={id} data-emsrc={href}></div>
|
97 |
-
)}
|
98 |
-
{mime !== 'application/pdf' && (
|
99 |
-
<iframe style={{height: height, width: width}} src={iframeSrc} mozallowfullscreen="true"
|
100 |
-
webkitallowfullscreen="true"/>
|
101 |
-
)}
|
102 |
-
{powered_by && (
|
103 |
-
<p className="embedpress-el-powered">Powered By EmbedPress</p>
|
104 |
-
)}
|
105 |
-
</figure>
|
106 |
-
);
|
107 |
-
},
|
108 |
-
|
109 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/document/style.scss
DELETED
@@ -1,29 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
7 |
-
|
8 |
-
.pdfobject-container {
|
9 |
-
height: 600px;
|
10 |
-
width:600px;
|
11 |
-
margin: 0 auto;
|
12 |
-
}
|
13 |
-
|
14 |
-
.embedpress-el-powered {
|
15 |
-
text-align: center;
|
16 |
-
margin-top: 0 !important;
|
17 |
-
font-size: 16px !important;
|
18 |
-
font-weight: 700;
|
19 |
-
}
|
20 |
-
.embedpress-embed-document iframe ,
|
21 |
-
[data-type="embedpress/document"] iframe{
|
22 |
-
margin: 0 auto;
|
23 |
-
display: block;
|
24 |
-
}
|
25 |
-
.embedpress-document-editmode .components-form-file-upload {
|
26 |
-
display: none !important;
|
27 |
-
}
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/edit.js
DELETED
@@ -1,115 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import EmbedWrap from '../common/embed-wrap';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
import {embedPressIcon} from '../common/icons';
|
14 |
-
const {TextControl, PanelBody} = wp.components;
|
15 |
-
const { InspectorControls } = wp.blockEditor;
|
16 |
-
const { Fragment } = wp.element;
|
17 |
-
|
18 |
-
export default function EmbedPress({attributes, className, setAttributes}){
|
19 |
-
const {url, editingURL, fetching, cannotEmbed, interactive, embedHTML, height, width} = attributes;
|
20 |
-
|
21 |
-
function switchBackToURLInput() {
|
22 |
-
setAttributes( {editingURL: true});
|
23 |
-
}
|
24 |
-
function onLoad() {
|
25 |
-
setAttributes( {fetching: false});
|
26 |
-
}
|
27 |
-
|
28 |
-
function embed(event) {
|
29 |
-
if (event) event.preventDefault();
|
30 |
-
if (url) {
|
31 |
-
// send api request to get iframe url
|
32 |
-
let fetchData = async (url) => {
|
33 |
-
setAttributes({
|
34 |
-
fetching: true
|
35 |
-
});
|
36 |
-
return await fetch(`${embedpressObj.site_url}/wp-json/embedpress/v1/oembed/embedpress?url=${url}&width=${width}&height=${height}`).then(response => response.json());
|
37 |
-
}
|
38 |
-
fetchData(url).then(data => {
|
39 |
-
setAttributes({
|
40 |
-
fetching: false
|
41 |
-
});
|
42 |
-
if ((data.data && data.data.status === 404) || !data.embed){
|
43 |
-
setAttributes({
|
44 |
-
cannotEmbed: true,
|
45 |
-
editingURL: true,
|
46 |
-
})
|
47 |
-
}else{
|
48 |
-
setAttributes({
|
49 |
-
embedHTML: data.embed,
|
50 |
-
cannotEmbed: false,
|
51 |
-
editingURL: false,
|
52 |
-
});
|
53 |
-
}
|
54 |
-
});
|
55 |
-
|
56 |
-
|
57 |
-
} else {
|
58 |
-
setAttributes({
|
59 |
-
cannotEmbed: true,
|
60 |
-
editingURL: true
|
61 |
-
})
|
62 |
-
}
|
63 |
-
}
|
64 |
-
return (
|
65 |
-
<Fragment>
|
66 |
-
<InspectorControls>
|
67 |
-
<PanelBody title={__("Customize Embedded Link")}>
|
68 |
-
<TextControl
|
69 |
-
label={__("Width")}
|
70 |
-
value={ width }
|
71 |
-
onChange={ ( width ) => setAttributes( { width } ) }
|
72 |
-
/>
|
73 |
-
<TextControl
|
74 |
-
label={__("Height")}
|
75 |
-
value={ height }
|
76 |
-
onChange={ ( height ) => setAttributes( { height } ) }
|
77 |
-
/>
|
78 |
-
</PanelBody>
|
79 |
-
</InspectorControls>
|
80 |
-
|
81 |
-
{ (!embedHTML || editingURL) && <EmbedPlaceholder
|
82 |
-
label={__('EmbedPress - Embed anything from 100+ sites')}
|
83 |
-
onSubmit={embed}
|
84 |
-
value={url}
|
85 |
-
cannotEmbed={cannotEmbed}
|
86 |
-
onChange={(event) => setAttributes({url: event.target.value})}
|
87 |
-
icon={embedPressIcon}
|
88 |
-
DocTitle={__('Learn more about EmbedPress')}
|
89 |
-
docLink={'https://embedpress.com/docs/'}
|
90 |
-
/> }
|
91 |
-
|
92 |
-
{(embedHTML && !editingURL) && <div className={className}>
|
93 |
-
{fetching ? <EmbedLoading/> : null}
|
94 |
-
<EmbedWrap style={{display: fetching ? 'none' : ''}} dangerouslySetInnerHTML={{
|
95 |
-
__html: embedHTML
|
96 |
-
}}></EmbedWrap>
|
97 |
-
|
98 |
-
<div
|
99 |
-
className="block-library-embed__interactive-overlay"
|
100 |
-
onMouseUp={ setAttributes({interactive: true}) }
|
101 |
-
/>
|
102 |
-
|
103 |
-
<EmbedControls
|
104 |
-
showEditButton={embedHTML && !cannotEmbed}
|
105 |
-
switchBackToURLInput={switchBackToURLInput}
|
106 |
-
/>
|
107 |
-
</div>}
|
108 |
-
|
109 |
-
</Fragment>
|
110 |
-
|
111 |
-
);
|
112 |
-
|
113 |
-
}
|
114 |
-
|
115 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/editor.scss
DELETED
@@ -1,10 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
.wp-block-embedpress-embedpress iframe{
|
8 |
-
width: 100%;
|
9 |
-
height: 100%;
|
10 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/index.js
DELETED
@@ -1,100 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {embedPressIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/embedpress', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('EmbedPress'), // Block title.
|
33 |
-
icon: embedPressIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
'embedpress',
|
37 |
-
'embed',
|
38 |
-
'google',
|
39 |
-
'youtube',
|
40 |
-
'docs',
|
41 |
-
],
|
42 |
-
supports: {align: ["wide", "full","right","left"], default: '', html:true},
|
43 |
-
attributes: {
|
44 |
-
url: {
|
45 |
-
type: 'string',
|
46 |
-
default: ''
|
47 |
-
},
|
48 |
-
iframeSrc: {
|
49 |
-
type: 'string',
|
50 |
-
default: ''
|
51 |
-
},
|
52 |
-
embedHTML: {
|
53 |
-
type: 'string',
|
54 |
-
default: ''
|
55 |
-
},
|
56 |
-
height: {
|
57 |
-
type: 'string',
|
58 |
-
default: '360'
|
59 |
-
},
|
60 |
-
width: {
|
61 |
-
type: 'string',
|
62 |
-
default: '600'
|
63 |
-
},
|
64 |
-
editingURL: {
|
65 |
-
type: 'boolean',
|
66 |
-
default: false
|
67 |
-
},
|
68 |
-
fetching: {
|
69 |
-
type: 'boolean',
|
70 |
-
default: true
|
71 |
-
},
|
72 |
-
cannotEmbed: {
|
73 |
-
type: 'boolean',
|
74 |
-
default: false
|
75 |
-
},
|
76 |
-
interactive: {
|
77 |
-
type: 'boolean',
|
78 |
-
default: false
|
79 |
-
},
|
80 |
-
},
|
81 |
-
/**
|
82 |
-
* The edit function describes the structure of your block in the context of the editor.
|
83 |
-
* This represents what the editor will render when the block is used.
|
84 |
-
*
|
85 |
-
* The "edit" property must be a valid function.
|
86 |
-
*
|
87 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
88 |
-
*/
|
89 |
-
edit,
|
90 |
-
|
91 |
-
/**
|
92 |
-
* The save function defines the way in which the different attributes should be combined
|
93 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
94 |
-
*
|
95 |
-
* The "save" property must be specified and must be a valid function.
|
96 |
-
*
|
97 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
98 |
-
*/
|
99 |
-
save: () => null,
|
100 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/index.php
DELETED
@@ -1,21 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
// Exit if accessed directly.
|
3 |
-
if ( ! defined( 'ABSPATH' ) ) {
|
4 |
-
exit;
|
5 |
-
}
|
6 |
-
/**
|
7 |
-
* It renders gutenberg block of embedpress on the frontend
|
8 |
-
* @param array $attributes
|
9 |
-
*/
|
10 |
-
function embedpress_render_block($attributes){
|
11 |
-
if ( !empty( $attributes['embedHTML']) ) {
|
12 |
-
$embed = apply_filters( 'embedpress_gutenberg_embed', $attributes['embedHTML'], $attributes );
|
13 |
-
ob_start();
|
14 |
-
?>
|
15 |
-
<div class="embedpress-gutenberg-wrapper">
|
16 |
-
<?php echo $embed; ?>
|
17 |
-
</div>
|
18 |
-
<?php
|
19 |
-
return ob_get_clean();
|
20 |
-
}
|
21 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/embedpress/style.scss
DELETED
@@ -1,9 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
.embedpress-gutenberg-wrapper iframe{
|
7 |
-
width: 100%;
|
8 |
-
height: 100%;
|
9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/edit.js
DELETED
@@ -1,161 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component} = wp.element;
|
14 |
-
import {googleDocsIcon} from '../common/icons';
|
15 |
-
|
16 |
-
class GoogleDocsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.updateAlignment = this.updateAlignment.bind(this);
|
22 |
-
this.onLoad = this.onLoad.bind(this);
|
23 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
24 |
-
this.state = {
|
25 |
-
editingURL: false,
|
26 |
-
url: this.props.attributes.url,
|
27 |
-
fetching: true,
|
28 |
-
cannotEmbed: false,
|
29 |
-
interactive: false
|
30 |
-
};
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps(nextProps, state) {
|
34 |
-
if (!nextProps.isSelected && state.interactive) {
|
35 |
-
return {interactive: false};
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState({interactive: true});
|
43 |
-
}
|
44 |
-
|
45 |
-
onLoad() {
|
46 |
-
this.setState({
|
47 |
-
fetching: false
|
48 |
-
})
|
49 |
-
}
|
50 |
-
|
51 |
-
decodeHTMLEntities(str) {
|
52 |
-
if (str && typeof str === 'string') {
|
53 |
-
// strip script/html tags
|
54 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
55 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
56 |
-
|
57 |
-
}
|
58 |
-
return str;
|
59 |
-
}
|
60 |
-
|
61 |
-
updateAlignment(nextAlign) {
|
62 |
-
const {setAttributes} = this.props;
|
63 |
-
const extraUpdatedAttributes =
|
64 |
-
['wide', 'full'].indexOf(nextAlign) !== -1
|
65 |
-
? {width: undefined, height: undefined}
|
66 |
-
: {};
|
67 |
-
setAttributes({
|
68 |
-
...extraUpdatedAttributes,
|
69 |
-
align: nextAlign,
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
|
74 |
-
setUrl(event) {
|
75 |
-
if (event) {
|
76 |
-
event.preventDefault();
|
77 |
-
}
|
78 |
-
const {url} = this.state;
|
79 |
-
const {setAttributes} = this.props;
|
80 |
-
setAttributes({url});
|
81 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
82 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
83 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
84 |
-
var match = regEx.exec(iframeSrc);
|
85 |
-
var type = match[1];
|
86 |
-
if (type && type === 'document') {
|
87 |
-
if (!iframeSrc.match(/([?&])embedded=true/i)) {
|
88 |
-
if (iframeSrc.indexOf('?') > -1) {
|
89 |
-
iframeSrc += '&embedded=true';
|
90 |
-
} else {
|
91 |
-
iframeSrc += '?embedded=true'
|
92 |
-
}
|
93 |
-
}
|
94 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
95 |
-
setAttributes({iframeSrc: iframeSrc})
|
96 |
-
} else {
|
97 |
-
this.setState({
|
98 |
-
cannotEmbed: true,
|
99 |
-
editingURL: true
|
100 |
-
})
|
101 |
-
}
|
102 |
-
} else {
|
103 |
-
this.setState({
|
104 |
-
cannotEmbed: true,
|
105 |
-
editingURL: true
|
106 |
-
})
|
107 |
-
}
|
108 |
-
}
|
109 |
-
|
110 |
-
switchBackToURLInput() {
|
111 |
-
this.setState({editingURL: true});
|
112 |
-
}
|
113 |
-
|
114 |
-
render() {
|
115 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
116 |
-
const {iframeSrc} = this.props.attributes;
|
117 |
-
const label = __('Google Docs URL');
|
118 |
-
|
119 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
120 |
-
if (!iframeSrc || editingURL) {
|
121 |
-
return (
|
122 |
-
<div>
|
123 |
-
<EmbedPlaceholder
|
124 |
-
label={label}
|
125 |
-
onSubmit={this.setUrl}
|
126 |
-
value={url}
|
127 |
-
cannotEmbed={cannotEmbed}
|
128 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
129 |
-
icon={googleDocsIcon}
|
130 |
-
DocTitle={__('Learn more about Google doc embed')}
|
131 |
-
docLink={'https://embedpress.com/docs/embed-google-docs-wordpress/'}
|
132 |
-
/>
|
133 |
-
</div>
|
134 |
-
|
135 |
-
);
|
136 |
-
} else {
|
137 |
-
return (
|
138 |
-
<div>
|
139 |
-
{fetching ? <EmbedLoading/> : null}
|
140 |
-
|
141 |
-
<Iframe src={iframeSrc} onMouseUp={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
142 |
-
frameBorder="0" width="600" height="450"/>
|
143 |
-
|
144 |
-
{ ! interactive && (
|
145 |
-
<div
|
146 |
-
className="block-library-embed__interactive-overlay"
|
147 |
-
onMouseUp={ this.hideOverlay }
|
148 |
-
/>
|
149 |
-
) }
|
150 |
-
|
151 |
-
<EmbedControls
|
152 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
153 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
154 |
-
/>
|
155 |
-
</div>
|
156 |
-
)
|
157 |
-
}
|
158 |
-
|
159 |
-
}
|
160 |
-
};
|
161 |
-
export default GoogleDocsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/index.js
DELETED
@@ -1,110 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleDocsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-docs-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Docs'), // Block title.
|
33 |
-
icon: googleDocsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('docs'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-document'
|
72 |
-
if (iframeSrc) {
|
73 |
-
return (
|
74 |
-
<figure className={defaultClass}>
|
75 |
-
|
76 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
77 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
78 |
-
|
79 |
-
</figure>
|
80 |
-
|
81 |
-
);
|
82 |
-
}
|
83 |
-
},
|
84 |
-
deprecated: [
|
85 |
-
{
|
86 |
-
attributes: {
|
87 |
-
align: {
|
88 |
-
type: "string",
|
89 |
-
enum: ["left", "center", "right", "wide", "full"]
|
90 |
-
},
|
91 |
-
},
|
92 |
-
|
93 |
-
save: function (props) {
|
94 |
-
const {iframeSrc} = props.attributes
|
95 |
-
if (iframeSrc) {
|
96 |
-
return (
|
97 |
-
<div className="ose-google-docs-document">
|
98 |
-
|
99 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
100 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
101 |
-
|
102 |
-
</div>
|
103 |
-
|
104 |
-
);
|
105 |
-
}
|
106 |
-
},
|
107 |
-
}
|
108 |
-
]
|
109 |
-
|
110 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-docs/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/edit.js
DELETED
@@ -1,116 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
|
8 |
-
/**
|
9 |
-
* WordPress dependencies
|
10 |
-
*/
|
11 |
-
const {__} = wp.i18n;
|
12 |
-
const {Component, Fragment} = wp.element;
|
13 |
-
import {googleDrawingsIcon} from '../common/icons';
|
14 |
-
|
15 |
-
class GoogleDrawingEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super(...arguments);
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
19 |
-
this.setUrl = this.setUrl.bind(this);
|
20 |
-
this.onLoad = this.onLoad.bind(this);
|
21 |
-
this.state = {
|
22 |
-
editingURL: false,
|
23 |
-
url: this.props.attributes.url,
|
24 |
-
fetching: true,
|
25 |
-
cannotEmbed: false
|
26 |
-
};
|
27 |
-
}
|
28 |
-
|
29 |
-
onLoad() {
|
30 |
-
this.setState({
|
31 |
-
fetching: false
|
32 |
-
})
|
33 |
-
}
|
34 |
-
|
35 |
-
decodeHTMLEntities(str) {
|
36 |
-
if (str && typeof str === 'string') {
|
37 |
-
// strip script/html tags
|
38 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
39 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
40 |
-
|
41 |
-
}
|
42 |
-
return str;
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
setUrl(event) {
|
47 |
-
if (event) {
|
48 |
-
event.preventDefault();
|
49 |
-
}
|
50 |
-
const {url} = this.state;
|
51 |
-
const {setAttributes} = this.props;
|
52 |
-
setAttributes({url});
|
53 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
54 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
55 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
56 |
-
var match = regEx.exec(iframeSrc);
|
57 |
-
var type = match[1];
|
58 |
-
if (type && type == 'drawings') {
|
59 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
60 |
-
setAttributes({iframeSrc: iframeSrc})
|
61 |
-
} else {
|
62 |
-
this.setState({
|
63 |
-
cannotEmbed: true,
|
64 |
-
editingURL: true
|
65 |
-
})
|
66 |
-
}
|
67 |
-
} else {
|
68 |
-
this.setState({
|
69 |
-
cannotEmbed: true,
|
70 |
-
editingURL: true
|
71 |
-
})
|
72 |
-
}
|
73 |
-
}
|
74 |
-
|
75 |
-
switchBackToURLInput() {
|
76 |
-
this.setState({editingURL: true});
|
77 |
-
}
|
78 |
-
|
79 |
-
render() {
|
80 |
-
const {url, editingURL, fetching, cannotEmbed} = this.state;
|
81 |
-
const {iframeSrc} = this.props.attributes;
|
82 |
-
|
83 |
-
const label = __('Google Drawings URL (Get your link from File -> Publish to the web -> Link)');
|
84 |
-
|
85 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
86 |
-
if (!iframeSrc || editingURL) {
|
87 |
-
return (
|
88 |
-
<EmbedPlaceholder
|
89 |
-
label={label}
|
90 |
-
onSubmit={this.setUrl}
|
91 |
-
value={url}
|
92 |
-
cannotEmbed={cannotEmbed}
|
93 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
94 |
-
icon={googleDrawingsIcon}
|
95 |
-
DocTitle={__('Learn more about Google drawing embed')}
|
96 |
-
docLink={'https://embedpress.com/docs/embed-google-drawings-wordpress/'}
|
97 |
-
/>
|
98 |
-
);
|
99 |
-
} else {
|
100 |
-
|
101 |
-
return (
|
102 |
-
<Fragment>
|
103 |
-
{fetching ? <EmbedLoading/> : null}
|
104 |
-
<img src={iframeSrc} onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}} width="960"
|
105 |
-
height="720"/>
|
106 |
-
<EmbedControls
|
107 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
108 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
109 |
-
/>
|
110 |
-
</Fragment>
|
111 |
-
|
112 |
-
)
|
113 |
-
}
|
114 |
-
}
|
115 |
-
};
|
116 |
-
export default GoogleDrawingEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/index.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleDrawingsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-drawings-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Drawings'), // Block title.
|
33 |
-
icon: googleDrawingsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('drawings'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-drawings'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<img src={iframeSrc} width="960" height="720"/>
|
75 |
-
</figure>
|
76 |
-
);
|
77 |
-
},
|
78 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-drawings/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/edit.js
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
import {googleDrawingsIcon} from "../common/icons";
|
9 |
-
|
10 |
-
/**
|
11 |
-
* WordPress dependencies
|
12 |
-
*/
|
13 |
-
const {__} = wp.i18n;
|
14 |
-
const {Component, Fragment} = wp.element;
|
15 |
-
import {googleFormsIcon} from '../common/icons';
|
16 |
-
|
17 |
-
const {Disabled} = wp.components;
|
18 |
-
|
19 |
-
class GoogleFormsEdit extends Component {
|
20 |
-
constructor() {
|
21 |
-
super(...arguments);
|
22 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
23 |
-
this.setUrl = this.setUrl.bind(this);
|
24 |
-
this.onLoad = this.onLoad.bind(this);
|
25 |
-
this.state = {
|
26 |
-
editingURL: false,
|
27 |
-
url: this.props.attributes.url,
|
28 |
-
fetching: true,
|
29 |
-
cannotEmbed: false,
|
30 |
-
interactive: false
|
31 |
-
};
|
32 |
-
}
|
33 |
-
|
34 |
-
static getDerivedStateFromProps(nextProps, state) {
|
35 |
-
if (!nextProps.isSelected && state.interactive) {
|
36 |
-
return {interactive: false};
|
37 |
-
}
|
38 |
-
|
39 |
-
return null;
|
40 |
-
}
|
41 |
-
|
42 |
-
hideOverlay() {
|
43 |
-
this.setState({interactive: true});
|
44 |
-
}
|
45 |
-
|
46 |
-
onLoad() {
|
47 |
-
this.setState({
|
48 |
-
fetching: false
|
49 |
-
})
|
50 |
-
}
|
51 |
-
|
52 |
-
decodeHTMLEntities(str) {
|
53 |
-
if (str && typeof str === 'string') {
|
54 |
-
// strip script/html tags
|
55 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
56 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
57 |
-
|
58 |
-
}
|
59 |
-
return str;
|
60 |
-
}
|
61 |
-
|
62 |
-
|
63 |
-
setUrl(event) {
|
64 |
-
if (event) {
|
65 |
-
event.preventDefault();
|
66 |
-
}
|
67 |
-
const {url} = this.state;
|
68 |
-
const {setAttributes} = this.props;
|
69 |
-
setAttributes({url});
|
70 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
71 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
72 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
73 |
-
var match = regEx.exec(iframeSrc);
|
74 |
-
var type = match[1];
|
75 |
-
if (type && type == 'forms') {
|
76 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
77 |
-
setAttributes({iframeSrc: iframeSrc})
|
78 |
-
} else {
|
79 |
-
this.setState({
|
80 |
-
cannotEmbed: true,
|
81 |
-
editingURL: true
|
82 |
-
})
|
83 |
-
}
|
84 |
-
} else {
|
85 |
-
this.setState({
|
86 |
-
cannotEmbed: true,
|
87 |
-
editingURL: true
|
88 |
-
})
|
89 |
-
}
|
90 |
-
}
|
91 |
-
|
92 |
-
switchBackToURLInput() {
|
93 |
-
this.setState({editingURL: true});
|
94 |
-
}
|
95 |
-
|
96 |
-
render() {
|
97 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
98 |
-
const {iframeSrc} = this.props.attributes;
|
99 |
-
|
100 |
-
const label = __('Google Forms URL');
|
101 |
-
|
102 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
103 |
-
if (!iframeSrc || editingURL) {
|
104 |
-
return (
|
105 |
-
<EmbedPlaceholder
|
106 |
-
label={label}
|
107 |
-
onSubmit={this.setUrl}
|
108 |
-
value={url}
|
109 |
-
cannotEmbed={cannotEmbed}
|
110 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
111 |
-
icon={googleFormsIcon}
|
112 |
-
DocTitle={__('Learn more about Google forms embed')}
|
113 |
-
docLink={'https://embedpress.com/docs/embed-google-forms-wordpress/'}
|
114 |
-
/>
|
115 |
-
);
|
116 |
-
} else {
|
117 |
-
|
118 |
-
return (
|
119 |
-
<Fragment>
|
120 |
-
{fetching ? <EmbedLoading/> : null}
|
121 |
-
|
122 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
123 |
-
frameborder="0" width="600" height="450"/>
|
124 |
-
|
125 |
-
{ ! interactive && (
|
126 |
-
<div
|
127 |
-
className="block-library-embed__interactive-overlay"
|
128 |
-
onMouseUp={ this.hideOverlay }
|
129 |
-
/>
|
130 |
-
) }
|
131 |
-
|
132 |
-
<EmbedControls
|
133 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
134 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
135 |
-
/>
|
136 |
-
</Fragment>
|
137 |
-
|
138 |
-
)
|
139 |
-
}
|
140 |
-
}
|
141 |
-
};
|
142 |
-
export default GoogleFormsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/index.js
DELETED
@@ -1,79 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleFormsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-forms-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Forms'), // Block title.
|
33 |
-
icon: googleFormsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('forms'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-docs-forms'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true"
|
75 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
76 |
-
</figure>
|
77 |
-
);
|
78 |
-
},
|
79 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-forms/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/edit.js
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {googleMapsIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class GoogleMapsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false
|
28 |
-
};
|
29 |
-
}
|
30 |
-
|
31 |
-
static getDerivedStateFromProps(nextProps, state) {
|
32 |
-
if (!nextProps.isSelected && state.interactive) {
|
33 |
-
return {interactive: false};
|
34 |
-
}
|
35 |
-
|
36 |
-
return null;
|
37 |
-
}
|
38 |
-
|
39 |
-
hideOverlay() {
|
40 |
-
this.setState({interactive: true});
|
41 |
-
}
|
42 |
-
|
43 |
-
onLoad() {
|
44 |
-
this.setState({
|
45 |
-
fetching: false
|
46 |
-
})
|
47 |
-
}
|
48 |
-
|
49 |
-
decodeHTMLEntities(str) {
|
50 |
-
if (str && typeof str === 'string') {
|
51 |
-
// strip script/html tags
|
52 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
53 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
54 |
-
|
55 |
-
}
|
56 |
-
return str;
|
57 |
-
}
|
58 |
-
|
59 |
-
|
60 |
-
setUrl(event) {
|
61 |
-
if (event) {
|
62 |
-
event.preventDefault();
|
63 |
-
}
|
64 |
-
const {url} = this.state;
|
65 |
-
const {setAttributes} = this.props;
|
66 |
-
setAttributes({url});
|
67 |
-
if (url && url.match(/^http[s]?:\/\/(?:(?:(?:www\.|maps\.)?(?:google\.com?))|(?:goo\.gl))(?:\.[a-z]{2})?\/(?:maps\/)?(?:place\/)?(?:[a-z0-9\/%+\-_]*)?([a-z0-9\/%,+\-_=!:@\.&*\$#?\']*)/i)) {
|
68 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
69 |
-
/google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
70 |
-
if (url.match('~(maps/embed|output=embed)~i')) {
|
71 |
-
//do something
|
72 |
-
} else {
|
73 |
-
var regEx = /@(-?[0-9\.]+,-?[0-9\.]+).+,([0-9\.]+[a-z])/i;
|
74 |
-
var match = regEx.exec(iframeSrc);
|
75 |
-
if (match && match.length > 1 && match[1] && match[2]) {
|
76 |
-
iframeSrc = 'https://maps.google.com/maps?hl=en&ie=UTF8&ll=' + match[1] + '&spn=' + match[1] + '&t=m&z=' + Math.round(parseInt(match[2])) + '&output=embed';
|
77 |
-
} else {
|
78 |
-
this.setState({
|
79 |
-
cannotEmbed: true,
|
80 |
-
editingURL: true
|
81 |
-
})
|
82 |
-
}
|
83 |
-
|
84 |
-
}
|
85 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
86 |
-
setAttributes({iframeSrc: iframeSrc})
|
87 |
-
} else {
|
88 |
-
this.setState({
|
89 |
-
cannotEmbed: true,
|
90 |
-
editingURL: true
|
91 |
-
})
|
92 |
-
}
|
93 |
-
}
|
94 |
-
|
95 |
-
switchBackToURLInput() {
|
96 |
-
this.setState({editingURL: true});
|
97 |
-
}
|
98 |
-
|
99 |
-
render() {
|
100 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
101 |
-
const {iframeSrc} = this.props.attributes;
|
102 |
-
|
103 |
-
const label = __('Google Maps URL');
|
104 |
-
|
105 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
106 |
-
if (!iframeSrc || editingURL) {
|
107 |
-
return (
|
108 |
-
<EmbedPlaceholder
|
109 |
-
label={label}
|
110 |
-
onSubmit={this.setUrl}
|
111 |
-
value={url}
|
112 |
-
cannotEmbed={cannotEmbed}
|
113 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
114 |
-
icon={googleMapsIcon}
|
115 |
-
DocTitle={__('Learn more about Google map embed')}
|
116 |
-
docLink={'https://embedpress.com/docs/embed-google-maps-wordpress/'}
|
117 |
-
/>
|
118 |
-
);
|
119 |
-
} else {
|
120 |
-
|
121 |
-
return (
|
122 |
-
<Fragment>
|
123 |
-
{fetching ? <EmbedLoading/> : null}
|
124 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
125 |
-
frameborder="0" width="600" height="450"/>
|
126 |
-
|
127 |
-
{ ! interactive && (
|
128 |
-
<div
|
129 |
-
className="block-library-embed__interactive-overlay"
|
130 |
-
onMouseUp={ this.hideOverlay }
|
131 |
-
/>
|
132 |
-
) }
|
133 |
-
|
134 |
-
<EmbedControls
|
135 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
136 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
137 |
-
/>
|
138 |
-
</Fragment>
|
139 |
-
|
140 |
-
)
|
141 |
-
}
|
142 |
-
}
|
143 |
-
};
|
144 |
-
export default GoogleMapsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/index.js
DELETED
@@ -1,78 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {googleMapsIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/google-maps-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Google Maps'), // Block title.
|
33 |
-
icon: googleMapsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('google'),
|
38 |
-
__('maps'),
|
39 |
-
],
|
40 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
41 |
-
attributes: {
|
42 |
-
url: {
|
43 |
-
type: 'string',
|
44 |
-
default: ''
|
45 |
-
},
|
46 |
-
iframeSrc: {
|
47 |
-
type: 'string',
|
48 |
-
default: ''
|
49 |
-
}
|
50 |
-
},
|
51 |
-
/**
|
52 |
-
* The edit function describes the structure of your block in the context of the editor.
|
53 |
-
* This represents what the editor will render when the block is used.
|
54 |
-
*
|
55 |
-
* The "edit" property must be a valid function.
|
56 |
-
*
|
57 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
58 |
-
*/
|
59 |
-
edit,
|
60 |
-
|
61 |
-
/**
|
62 |
-
* The save function defines the way in which the different attributes should be combined
|
63 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
64 |
-
*
|
65 |
-
* The "save" property must be specified and must be a valid function.
|
66 |
-
*
|
67 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
68 |
-
*/
|
69 |
-
save: function (props) {
|
70 |
-
const {iframeSrc} = props.attributes
|
71 |
-
const defaultClass = 'ose-google-maps'
|
72 |
-
return (
|
73 |
-
<figure className={defaultClass}>
|
74 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" frameborder="0"></iframe>
|
75 |
-
</figure>
|
76 |
-
);
|
77 |
-
},
|
78 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-maps/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/edit.js
DELETED
@@ -1,165 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {googleSheetsIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class GoogleSheetsEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.hideOverlay = this.hideOverlay.bind(this)
|
23 |
-
this.state = {
|
24 |
-
editingURL: false,
|
25 |
-
url: this.props.attributes.url,
|
26 |
-
fetching: true,
|
27 |
-
cannotEmbed: false,
|
28 |
-
interactive:false
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
static getDerivedStateFromProps(nextProps, state) {
|
33 |
-
if (!nextProps.isSelected && state.interactive) {
|
34 |
-
return {interactive: false};
|
35 |
-
}
|
36 |
-
|
37 |
-
return null;
|
38 |
-
}
|
39 |
-
|
40 |
-
hideOverlay() {
|
41 |
-
this.setState({interactive: true});
|
42 |
-
}
|
43 |
-
|
44 |
-
onLoad() {
|
45 |
-
this.setState({
|
46 |
-
fetching: false
|
47 |
-
})
|
48 |
-
}
|
49 |
-
|
50 |
-
decodeHTMLEntities(str) {
|
51 |
-
if (str && typeof str === 'string') {
|
52 |
-
// strip script/html tags
|
53 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
54 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
55 |
-
|
56 |
-
}
|
57 |
-
return str;
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
setUrl(event) {
|
62 |
-
if (event) {
|
63 |
-
event.preventDefault();
|
64 |
-
}
|
65 |
-
const {url} = this.state;
|
66 |
-
const {setAttributes} = this.props;
|
67 |
-
setAttributes({url});
|
68 |
-
if (url && url.match(/^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)) {
|
69 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
70 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
71 |
-
var match = regEx.exec(iframeSrc);
|
72 |
-
var type = match[1];
|
73 |
-
if (type && type == 'spreadsheets') {
|
74 |
-
if (iframeSrc.indexOf('?') > -1) {
|
75 |
-
var query = iframeSrc.split('?');
|
76 |
-
query = query[1];
|
77 |
-
query = query.split('&');
|
78 |
-
console.log(query)
|
79 |
-
if (query.length > 0) {
|
80 |
-
var hasHeadersParam = false;
|
81 |
-
var hasWidgetParam = false;
|
82 |
-
query.map(param => {
|
83 |
-
if (param.indexOf('widget=')) {
|
84 |
-
hasWidgetParam = true;
|
85 |
-
} else if (param.indexOf('headers=')) {
|
86 |
-
hasHeadersParam = true;
|
87 |
-
}
|
88 |
-
})
|
89 |
-
if (!hasWidgetParam) {
|
90 |
-
iframeSrc += '&widget=true';
|
91 |
-
}
|
92 |
-
|
93 |
-
if (!hasHeadersParam) {
|
94 |
-
iframeSrc += '&headers=false';
|
95 |
-
}
|
96 |
-
}
|
97 |
-
} else {
|
98 |
-
iframeSrc += '?widget=true&headers=false';
|
99 |
-
}
|
100 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
101 |
-
setAttributes({iframeSrc: iframeSrc})
|
102 |
-
} else {
|
103 |
-
this.setState({
|
104 |
-
cannotEmbed: true,
|
105 |
-
editingURL: true
|
106 |
-
})
|
107 |
-
}
|
108 |
-
} else {
|
109 |
-
this.setState({
|
110 |
-
cannotEmbed: true,
|
111 |
-
editingURL: true
|
112 |
-
})
|
113 |
-
}
|
114 |
-
}
|
115 |
-
|
116 |
-
switchBackToURLInput() {
|
117 |
-
this.setState({editingURL: true});
|
118 |
-
}
|
119 |
-
|
120 |
-
render() {
|
121 |
-
const {url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
122 |
-
const {iframeSrc} = this.props.attributes;
|
123 |
-
|
124 |
-
const label = __('Google Sheets URL');
|
125 |
-
|
126 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
127 |
-
if (!iframeSrc || editingURL) {
|
128 |
-
return (
|
129 |
-
<EmbedPlaceholder
|
130 |
-
label={label}
|
131 |
-
onSubmit={this.setUrl}
|
132 |
-
value={url}
|
133 |
-
cannotEmbed={cannotEmbed}
|
134 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
135 |
-
icon={googleSheetsIcon}
|
136 |
-
DocTitle={__('Learn more about Google sheet embed')}
|
137 |
-
docLink={'https://embedpress.com/docs/embed-google-sheets-wordpress/'}
|
138 |
-
/>
|
139 |
-
);
|
140 |
-
} else {
|
141 |
-
|
142 |
-
return (
|
143 |
-
<Fragment>
|
144 |
-
{fetching ? <EmbedLoading/> : null}
|
145 |
-
|
146 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
147 |
-
frameborder="0" width="600" height="450"/>
|
148 |
-
{ ! interactive && (
|
149 |
-
<div
|
150 |
-
className="block-library-embed__interactive-overlay"
|
151 |
-
onMouseUp={ this.hideOverlay }
|
152 |
-
/>
|
153 |
-
) }
|
154 |
-
|
155 |
-
<EmbedControls
|
156 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
157 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
158 |
-
/>
|
159 |
-
</Fragment>
|
160 |
-
|
161 |
-
)
|
162 |
-
}
|
163 |
-
}
|
164 |
-
};
|
165 |
-
export default GoogleSheetsEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/index.js
DELETED
@@ -1,102 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { googleSheetsIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/google-sheets-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Google Sheets' ), // Block title.
|
32 |
-
icon: googleSheetsIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'google' ),
|
37 |
-
__( 'sheets' ),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
}
|
49 |
-
},
|
50 |
-
/**
|
51 |
-
* The edit function describes the structure of your block in the context of the editor.
|
52 |
-
* This represents what the editor will render when the block is used.
|
53 |
-
*
|
54 |
-
* The "edit" property must be a valid function.
|
55 |
-
*
|
56 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
57 |
-
*/
|
58 |
-
edit,
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The save function defines the way in which the different attributes should be combined
|
62 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
63 |
-
*
|
64 |
-
* The "save" property must be specified and must be a valid function.
|
65 |
-
*
|
66 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
67 |
-
*/
|
68 |
-
save: function( props ) {
|
69 |
-
const { iframeSrc } = props.attributes
|
70 |
-
const defaultClass = 'ose-google-docs-spreadsheets'
|
71 |
-
return (
|
72 |
-
<figure className={defaultClass}>
|
73 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
74 |
-
</figure>
|
75 |
-
);
|
76 |
-
},
|
77 |
-
deprecated: [
|
78 |
-
{
|
79 |
-
attributes: {
|
80 |
-
align: {
|
81 |
-
type: "string",
|
82 |
-
enum: ["left", "center", "right", "wide", "full"]
|
83 |
-
},
|
84 |
-
},
|
85 |
-
|
86 |
-
save: function (props) {
|
87 |
-
const {iframeSrc} = props.attributes
|
88 |
-
if (iframeSrc) {
|
89 |
-
return (
|
90 |
-
<div className="ose-google-docs-spreadsheets">
|
91 |
-
|
92 |
-
<iframe src={iframeSrc} frameBorder="0" width="600" height="450" allowFullScreen="true"
|
93 |
-
mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
94 |
-
|
95 |
-
</div>
|
96 |
-
|
97 |
-
);
|
98 |
-
}
|
99 |
-
},
|
100 |
-
}
|
101 |
-
]
|
102 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-sheets/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/edit.js
DELETED
@@ -1,142 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const { __ } = wp.i18n;
|
13 |
-
const { Component, Fragment } = wp.element;
|
14 |
-
import { googleSlidesIcon} from '../common/icons'
|
15 |
-
class GoogleSlidesEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super( ...arguments );
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind( this );
|
19 |
-
this.setUrl = this.setUrl.bind( this );
|
20 |
-
this.onLoad = this.onLoad.bind( this );
|
21 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false
|
28 |
-
};
|
29 |
-
}
|
30 |
-
|
31 |
-
static getDerivedStateFromProps(nextProps, state) {
|
32 |
-
if (!nextProps.isSelected && state.interactive) {
|
33 |
-
return {interactive: false};
|
34 |
-
}
|
35 |
-
|
36 |
-
return null;
|
37 |
-
}
|
38 |
-
|
39 |
-
hideOverlay() {
|
40 |
-
this.setState({interactive: true});
|
41 |
-
}
|
42 |
-
|
43 |
-
onLoad() {
|
44 |
-
this.setState({
|
45 |
-
fetching: false
|
46 |
-
})
|
47 |
-
}
|
48 |
-
decodeHTMLEntities (str) {
|
49 |
-
if(str && typeof str === 'string') {
|
50 |
-
// strip script/html tags
|
51 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
52 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
53 |
-
|
54 |
-
}
|
55 |
-
return str;
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
setUrl( event ) {
|
60 |
-
if ( event ) {
|
61 |
-
event.preventDefault();
|
62 |
-
}
|
63 |
-
const { url } = this.state;
|
64 |
-
const { setAttributes } = this.props;
|
65 |
-
setAttributes( { url } );
|
66 |
-
if(url && url.match( /^http[s]?:\/\/((?:www\.)?docs\.google\.com(?:.*)?(?:document|presentation|spreadsheets|forms|drawings)\/[a-z0-9\/\?=_\-\.\,&%\$#\@\!\+]*)/i)){
|
67 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
68 |
-
var regEx = /google\.com(?:.+)?(document|presentation|spreadsheets|forms|drawings)/i;
|
69 |
-
var match = regEx.exec(iframeSrc);
|
70 |
-
var type = match[1];
|
71 |
-
if(type && type == 'presentation') {
|
72 |
-
if(iframeSrc.match( /pub\?/i )) {
|
73 |
-
iframeSrc = iframeSrc.replace('/pub?', '/embed?');
|
74 |
-
}
|
75 |
-
this.setState( { editingURL: false, cannotEmbed: false } );
|
76 |
-
setAttributes( {iframeSrc: iframeSrc })
|
77 |
-
}
|
78 |
-
else {
|
79 |
-
this.setState({
|
80 |
-
cannotEmbed: true,
|
81 |
-
editingURL: true
|
82 |
-
})
|
83 |
-
}
|
84 |
-
}
|
85 |
-
else {
|
86 |
-
this.setState({
|
87 |
-
cannotEmbed: true,
|
88 |
-
editingURL: true
|
89 |
-
})
|
90 |
-
}
|
91 |
-
}
|
92 |
-
|
93 |
-
switchBackToURLInput() {
|
94 |
-
this.setState( { editingURL: true } );
|
95 |
-
}
|
96 |
-
|
97 |
-
render() {
|
98 |
-
const { url, editingURL, fetching, cannotEmbed, interactive} = this.state;
|
99 |
-
const { iframeSrc } = this.props.attributes;
|
100 |
-
|
101 |
-
const label = __( 'Google Slides URL');
|
102 |
-
|
103 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
104 |
-
if ( !iframeSrc || editingURL ) {
|
105 |
-
return (
|
106 |
-
<EmbedPlaceholder
|
107 |
-
label={ label }
|
108 |
-
onSubmit={ this.setUrl }
|
109 |
-
value={ url }
|
110 |
-
cannotEmbed={ cannotEmbed }
|
111 |
-
onChange={ ( event ) => this.setState( { url: event.target.value } ) }
|
112 |
-
icon={googleSlidesIcon}
|
113 |
-
DocTitle={__('Learn more about Google slides embed')}
|
114 |
-
docLink={'https://embedpress.com/docs/embed-google-slides-wordpress/'}
|
115 |
-
/>
|
116 |
-
);
|
117 |
-
}
|
118 |
-
else {
|
119 |
-
|
120 |
-
return (
|
121 |
-
<Fragment>
|
122 |
-
{fetching ? <EmbedLoading /> : null}
|
123 |
-
|
124 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{ display: fetching ? 'none' : '' }} frameborder="0" width="600" height="450" />
|
125 |
-
{ ! interactive && (
|
126 |
-
<div
|
127 |
-
className="block-library-embed__interactive-overlay"
|
128 |
-
onMouseUp={ this.hideOverlay }
|
129 |
-
/>
|
130 |
-
) }
|
131 |
-
|
132 |
-
<EmbedControls
|
133 |
-
showEditButton={ iframeSrc && ! cannotEmbed }
|
134 |
-
switchBackToURLInput={ this.switchBackToURLInput }
|
135 |
-
/>
|
136 |
-
</Fragment>
|
137 |
-
|
138 |
-
)
|
139 |
-
}
|
140 |
-
}
|
141 |
-
};
|
142 |
-
export default GoogleSlidesEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/index.js
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { googleSlidesIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/google-slides-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Google Slides' ), // Block title.
|
32 |
-
icon: googleSlidesIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'google' ),
|
37 |
-
__( 'slides' ),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
}
|
49 |
-
},
|
50 |
-
/**
|
51 |
-
* The edit function describes the structure of your block in the context of the editor.
|
52 |
-
* This represents what the editor will render when the block is used.
|
53 |
-
*
|
54 |
-
* The "edit" property must be a valid function.
|
55 |
-
*
|
56 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
57 |
-
*/
|
58 |
-
edit,
|
59 |
-
|
60 |
-
/**
|
61 |
-
* The save function defines the way in which the different attributes should be combined
|
62 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
63 |
-
*
|
64 |
-
* The "save" property must be specified and must be a valid function.
|
65 |
-
*
|
66 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
67 |
-
*/
|
68 |
-
save: function( props ) {
|
69 |
-
const { iframeSrc } = props.attributes
|
70 |
-
const defaultClass = "ose-google-docs-presentation"
|
71 |
-
return (
|
72 |
-
<figure className={defaultClass}>
|
73 |
-
<iframe src={iframeSrc} frameborder="0" width="600" height="450" allowfullscreen="true" mozallowfullscreen="true" webkitallowfullscreen="true"></iframe>
|
74 |
-
</figure>
|
75 |
-
);
|
76 |
-
},
|
77 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/google-slides/style.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/init.php
DELETED
@@ -1,130 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Blocks Initializer
|
4 |
-
*
|
5 |
-
* Enqueue CSS/JS of all the blocks.
|
6 |
-
*
|
7 |
-
* @since 1.0.0
|
8 |
-
* @package CGB
|
9 |
-
*/
|
10 |
-
|
11 |
-
// Exit if accessed directly.
|
12 |
-
if ( !defined( 'ABSPATH' ) ) {
|
13 |
-
exit;
|
14 |
-
}
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Enqueue Gutenberg block assets for both frontend + backend.
|
18 |
-
*
|
19 |
-
* @uses {wp-editor} for WP editor styles.
|
20 |
-
* @since 1.0.0
|
21 |
-
*/
|
22 |
-
function embedpress_blocks_cgb_block_assets() { // phpcs:ignore
|
23 |
-
// Styles.
|
24 |
-
wp_enqueue_style(
|
25 |
-
'embedpress_blocks-cgb-style-css', // Handle.
|
26 |
-
plugins_url( 'dist/blocks.style.build.css', dirname( __FILE__ ) ), // Block style CSS.
|
27 |
-
is_admin() ? array( 'wp-editor' ) : null, // Dependency to include the CSS after it.
|
28 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
|
29 |
-
);
|
30 |
-
}
|
31 |
-
|
32 |
-
// Hook: Frontend assets.
|
33 |
-
add_action( 'enqueue_block_assets', 'embedpress_blocks_cgb_block_assets' );
|
34 |
-
|
35 |
-
/**
|
36 |
-
* Enqueue Gutenberg block assets for backend editor.
|
37 |
-
*
|
38 |
-
* @uses {wp-blocks} for block type registration & related functions.
|
39 |
-
* @uses {wp-element} for WP Element abstraction — structure of blocks.
|
40 |
-
* @uses {wp-i18n} to internationalize the block's text.
|
41 |
-
* @uses {wp-editor} for WP editor styles.
|
42 |
-
* @since 1.0.0
|
43 |
-
*/
|
44 |
-
function embedpress_blocks_cgb_editor_assets() { // phpcs:ignore
|
45 |
-
// Scripts.
|
46 |
-
wp_enqueue_script(
|
47 |
-
'embedpress_blocks-cgb-block-js', // Handle.
|
48 |
-
plugins_url( '/dist/blocks.build.js', dirname( __FILE__ ) ), // Block.build.js: We register the block here. Built with Webpack.
|
49 |
-
array( 'wp-blocks', 'wp-i18n', 'wp-element', 'wp-editor','wp-components', 'embedpress-pdfobject' ), // Dependencies, defined above.
|
50 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.build.js' ), // Version: File modification time.
|
51 |
-
true // Enqueue the script in the footer.
|
52 |
-
);
|
53 |
-
$wistia_labels = array(
|
54 |
-
'watch_from_beginning' => __( 'Watch from the beginning', 'embedpress-wistia' ),
|
55 |
-
'skip_to_where_you_left_off' => __( 'Skip to where you left off', 'embedpress-wistia' ),
|
56 |
-
'you_have_watched_it_before' => __( 'It looks like you\'ve watched<br />part of this video before!', 'embedpress-wistia' ),
|
57 |
-
);
|
58 |
-
$wistia_labels = json_encode( $wistia_labels );
|
59 |
-
$wistia_options = null;
|
60 |
-
if ( function_exists( 'embedpress_wisita_pro_get_options' ) ):
|
61 |
-
$wistia_options = embedpress_wisita_pro_get_options();
|
62 |
-
endif;
|
63 |
-
$pars_url = wp_parse_url(get_site_url());
|
64 |
-
wp_localize_script( 'embedpress_blocks-cgb-block-js', 'embedpressObj', array(
|
65 |
-
'wistia_labels' => $wistia_labels,
|
66 |
-
'wisita_options' => $wistia_options,
|
67 |
-
'embedpress_powered_by' => apply_filters('embedpress_document_block_powered_by',true),
|
68 |
-
'embedpress_pro' => defined('EMBEDPRESS_PRO_PLUGIN_FILE'),
|
69 |
-
'twitch_host' => !empty($pars_url['host'])?$pars_url['host']:'',
|
70 |
-
'site_url' => site_url(),
|
71 |
-
) );
|
72 |
-
|
73 |
-
// Styles.
|
74 |
-
wp_enqueue_style(
|
75 |
-
'embedpress_blocks-cgb-block-editor-css', // Handle.
|
76 |
-
plugins_url( 'dist/blocks.editor.build.css', dirname( __FILE__ ) ), // Block editor CSS.
|
77 |
-
array( 'wp-edit-blocks' ), // Dependency to include the CSS after it.
|
78 |
-
filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.editor.build.css' ) // Version: File modification time.
|
79 |
-
);
|
80 |
-
}
|
81 |
-
|
82 |
-
// Hook: Editor assets.
|
83 |
-
add_action( 'enqueue_block_editor_assets', 'embedpress_blocks_cgb_editor_assets' );
|
84 |
-
|
85 |
-
|
86 |
-
function embedpress_block_category( $categories, $post ) {
|
87 |
-
return array_merge(
|
88 |
-
$categories,
|
89 |
-
array(
|
90 |
-
array(
|
91 |
-
'slug' => 'embedpress',
|
92 |
-
'title' => 'EmbedPress',
|
93 |
-
'icon' => '',
|
94 |
-
),
|
95 |
-
)
|
96 |
-
);
|
97 |
-
|
98 |
-
}
|
99 |
-
|
100 |
-
add_filter( 'block_categories', 'embedpress_block_category', 10, 2 );
|
101 |
-
|
102 |
-
/**
|
103 |
-
* Registers the embedpress gutneberg block on server.
|
104 |
-
*/
|
105 |
-
|
106 |
-
function embedpress_gutenberg_register_all_block() {
|
107 |
-
if ( function_exists( 'register_block_type' ) ) :
|
108 |
-
require_once plugin_dir_path( __FILE__ ) . 'embedpress/index.php';
|
109 |
-
register_block_type( 'embedpress/twitch-block' );
|
110 |
-
register_block_type( 'embedpress/google-slides-block' );
|
111 |
-
register_block_type( 'embedpress/google-sheets-block' );
|
112 |
-
register_block_type( 'embedpress/google-maps-block' );
|
113 |
-
register_block_type( 'embedpress/google-forms-block' );
|
114 |
-
register_block_type( 'embedpress/google-drawings-block' );
|
115 |
-
register_block_type( 'embedpress/google-docs-block' );
|
116 |
-
register_block_type( 'embedpress/embedpress', [
|
117 |
-
'render_callback' => 'embedpress_render_block',
|
118 |
-
]);
|
119 |
-
|
120 |
-
endif;
|
121 |
-
}
|
122 |
-
|
123 |
-
add_action( 'init', 'embedpress_gutenberg_register_all_block' );
|
124 |
-
|
125 |
-
|
126 |
-
foreach ( glob( plugin_dir_path( __FILE__ ) . '*/index.php' ) as $block_logic ) {
|
127 |
-
require $block_logic;
|
128 |
-
}
|
129 |
-
|
130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/edit.js
DELETED
@@ -1,187 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {twitchIcon} from '../common/icons'
|
15 |
-
|
16 |
-
class TwitchEdit extends Component {
|
17 |
-
constructor() {
|
18 |
-
super(...arguments);
|
19 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
20 |
-
this.setUrl = this.setUrl.bind(this);
|
21 |
-
this.onLoad = this.onLoad.bind(this);
|
22 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
23 |
-
this.state = {
|
24 |
-
editingURL: false,
|
25 |
-
url: this.props.attributes.url,
|
26 |
-
fetching: true,
|
27 |
-
cannotEmbed: false,
|
28 |
-
interactive: false
|
29 |
-
};
|
30 |
-
}
|
31 |
-
|
32 |
-
static getDerivedStateFromProps(nextProps, state) {
|
33 |
-
if (!nextProps.isSelected && state.interactive) {
|
34 |
-
return {interactive: false};
|
35 |
-
}
|
36 |
-
|
37 |
-
return null;
|
38 |
-
}
|
39 |
-
|
40 |
-
hideOverlay() {
|
41 |
-
this.setState({interactive: true});
|
42 |
-
}
|
43 |
-
|
44 |
-
onLoad() {
|
45 |
-
this.setState({
|
46 |
-
fetching: false
|
47 |
-
})
|
48 |
-
}
|
49 |
-
|
50 |
-
decodeHTMLEntities(str) {
|
51 |
-
if (str && typeof str === 'string') {
|
52 |
-
// strip script/html tags
|
53 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
54 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
55 |
-
|
56 |
-
}
|
57 |
-
return str;
|
58 |
-
}
|
59 |
-
|
60 |
-
|
61 |
-
setUrl(event) {
|
62 |
-
if (event) {
|
63 |
-
event.preventDefault();
|
64 |
-
}
|
65 |
-
const {url} = this.state;
|
66 |
-
const {setAttributes} = this.props;
|
67 |
-
setAttributes({url});
|
68 |
-
var regEx = /http[s]?:\/\/(?:www\.|clips\.)twitch\.tv\/([0-9a-zA-Z\-\_]+)\/?(chat\/?$|[0-9a-z\-\_]*)?/
|
69 |
-
if (url && url.match(regEx)) {
|
70 |
-
var iframeSrc = this.decodeHTMLEntities(url);
|
71 |
-
var match = regEx.exec(iframeSrc);
|
72 |
-
var channelName = match[1];
|
73 |
-
console.log(channelName);
|
74 |
-
var type = "channel";
|
75 |
-
var attrs;
|
76 |
-
if (url.indexOf('clips.twitch.tv') > -1) {
|
77 |
-
type = 'clip';
|
78 |
-
} else if (url.indexOf('/videos/') > -1) {
|
79 |
-
type = 'video';
|
80 |
-
} else if (url.indexOf('#/chat$#') > -1) {
|
81 |
-
type = 'chat';
|
82 |
-
}
|
83 |
-
console.log(type)
|
84 |
-
switch (type) {
|
85 |
-
case 'channel':
|
86 |
-
iframeSrc = 'https://player.twitch.tv/?channel=' + channelName;
|
87 |
-
attrs = {
|
88 |
-
scrolling: "no",
|
89 |
-
frameborder: "0",
|
90 |
-
allowfullscreen: "true"
|
91 |
-
};
|
92 |
-
break;
|
93 |
-
|
94 |
-
case 'clip':
|
95 |
-
iframeSrc = 'https://clips.twitch.tv/embed?clip=' + channelName + '&autoplay=false';
|
96 |
-
attrs = {
|
97 |
-
scrolling: "no",
|
98 |
-
frameborder: "0",
|
99 |
-
allowfullscreen: "true"
|
100 |
-
};
|
101 |
-
break;
|
102 |
-
|
103 |
-
case 'video':
|
104 |
-
channelName = match[2];
|
105 |
-
iframeSrc = 'https://player.twitch.tv/?video=' + channelName;
|
106 |
-
attrs = {
|
107 |
-
scrolling: "no",
|
108 |
-
frameborder: "0",
|
109 |
-
allowfullscreen: "true"
|
110 |
-
};
|
111 |
-
break;
|
112 |
-
|
113 |
-
case 'chat':
|
114 |
-
iframeSrc = 'http://www.twitch.tv/embed/' + channelName + '/chat';
|
115 |
-
attrs = {
|
116 |
-
scrolling: "yes",
|
117 |
-
frameborder: "0",
|
118 |
-
allowfullscreen: "true",
|
119 |
-
id: "'" + channelName + "'"
|
120 |
-
|
121 |
-
}
|
122 |
-
break;
|
123 |
-
}
|
124 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
125 |
-
setAttributes({iframeSrc, attrs})
|
126 |
-
} else {
|
127 |
-
this.setState({
|
128 |
-
cannotEmbed: true,
|
129 |
-
editingURL: true
|
130 |
-
})
|
131 |
-
}
|
132 |
-
}
|
133 |
-
|
134 |
-
switchBackToURLInput() {
|
135 |
-
this.setState({editingURL: true});
|
136 |
-
}
|
137 |
-
|
138 |
-
render() {
|
139 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
140 |
-
const {iframeSrc, attrs} = this.props.attributes;
|
141 |
-
|
142 |
-
const label = __('Twitch URL');
|
143 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
144 |
-
if (!iframeSrc || editingURL) {
|
145 |
-
return (
|
146 |
-
<EmbedPlaceholder
|
147 |
-
label={label}
|
148 |
-
onSubmit={this.setUrl}
|
149 |
-
value={url}
|
150 |
-
cannotEmbed={cannotEmbed}
|
151 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
152 |
-
icon={twitchIcon}
|
153 |
-
DocTitle={__('Learn more about twitch embed')}
|
154 |
-
docLink={'https://embedpress.com/docs/embed-twitch-streams-chat/'}
|
155 |
-
/>
|
156 |
-
);
|
157 |
-
} else {
|
158 |
-
const IframeUrl = iframeSrc+'&parent='+embedpressObj.twitch_host;
|
159 |
-
return (
|
160 |
-
<Fragment>
|
161 |
-
{fetching ? <EmbedLoading/> : null}
|
162 |
-
|
163 |
-
<Iframe src={IframeUrl} {...attrs}
|
164 |
-
onLoad={this.onLoad}
|
165 |
-
style={{display: fetching ? 'none' : ''}}
|
166 |
-
onFocus={this.hideOverlay}
|
167 |
-
width="600"
|
168 |
-
height="450"/>
|
169 |
-
|
170 |
-
{ ! interactive && (
|
171 |
-
<div
|
172 |
-
className="block-library-embed__interactive-overlay"
|
173 |
-
onMouseUp={ this.hideOverlay }
|
174 |
-
/>
|
175 |
-
) }
|
176 |
-
|
177 |
-
<EmbedControls
|
178 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
179 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
180 |
-
/>
|
181 |
-
</Fragment>
|
182 |
-
|
183 |
-
)
|
184 |
-
}
|
185 |
-
}
|
186 |
-
};
|
187 |
-
export default TwitchEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/editor.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/index.js
DELETED
@@ -1,82 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import {twitchIcon} from '../common/icons';
|
13 |
-
|
14 |
-
const {__} = wp.i18n; // Import __() from wp.i18n
|
15 |
-
const {registerBlockType} = wp.blocks; // Import registerBlockType() from wp.blocks
|
16 |
-
|
17 |
-
/**
|
18 |
-
* Register: aa Gutenberg Block.
|
19 |
-
*
|
20 |
-
* Registers a new block provided a unique name and an object defining its
|
21 |
-
* behavior. Once registered, the block is made editor as an option to any
|
22 |
-
* editor interface where blocks are implemented.
|
23 |
-
*
|
24 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
25 |
-
* @param {string} name Block name.
|
26 |
-
* @param {Object} settings Block settings.
|
27 |
-
* @return {?WPBlock} The block, if it has been successfully
|
28 |
-
* registered; otherwise `undefined`.
|
29 |
-
*/
|
30 |
-
registerBlockType('embedpress/twitch-block', {
|
31 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
32 |
-
title: __('Twitch'), // Block title.
|
33 |
-
icon: twitchIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
34 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
35 |
-
keywords: [
|
36 |
-
__('embedpress'),
|
37 |
-
__('twitch'),
|
38 |
-
],
|
39 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
40 |
-
attributes: {
|
41 |
-
url: {
|
42 |
-
type: 'string',
|
43 |
-
default: ''
|
44 |
-
},
|
45 |
-
iframeSrc: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
},
|
49 |
-
attrs: {
|
50 |
-
type: 'string',
|
51 |
-
default: ''
|
52 |
-
}
|
53 |
-
},
|
54 |
-
/**
|
55 |
-
* The edit function describes the structure of your block in the context of the editor.
|
56 |
-
* This represents what the editor will render when the block is used.
|
57 |
-
*
|
58 |
-
* The "edit" property must be a valid function.
|
59 |
-
*
|
60 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
61 |
-
*/
|
62 |
-
edit,
|
63 |
-
|
64 |
-
/**
|
65 |
-
* The save function defines the way in which the different attributes should be combined
|
66 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
67 |
-
*
|
68 |
-
* The "save" property must be specified and must be a valid function.
|
69 |
-
*
|
70 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
71 |
-
*/
|
72 |
-
save: function (props) {
|
73 |
-
const {iframeSrc, attrs} = props.attributes
|
74 |
-
const defaultClass = "ose-twitch-presentation"
|
75 |
-
const IframeUrl = iframeSrc+'&parent='+embedpressObj.twitch_host;
|
76 |
-
return (
|
77 |
-
<figure className={ defaultClass }>
|
78 |
-
<iframe src={IframeUrl} {...attrs} frameborder="0" width="600" height="450"></iframe>
|
79 |
-
</figure>
|
80 |
-
);
|
81 |
-
},
|
82 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/twitch/style.scss
DELETED
@@ -1,5 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/edit.js
DELETED
@@ -1,168 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from '../common/embed-controls';
|
5 |
-
import EmbedLoading from '../common/embed-loading';
|
6 |
-
import EmbedPlaceholder from '../common/embed-placeholder';
|
7 |
-
import Iframe from '../common/Iframe';
|
8 |
-
|
9 |
-
/**
|
10 |
-
* WordPress dependencies
|
11 |
-
*/
|
12 |
-
const {__} = wp.i18n;
|
13 |
-
const {Component, Fragment} = wp.element;
|
14 |
-
import {wistiaIcon} from '../common/icons'
|
15 |
-
class WistiaEdit extends Component {
|
16 |
-
constructor() {
|
17 |
-
super(...arguments);
|
18 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
19 |
-
this.setUrl = this.setUrl.bind(this);
|
20 |
-
this.onLoad = this.onLoad.bind(this);
|
21 |
-
this.hideOverlay = this.hideOverlay.bind(this);
|
22 |
-
this.state = {
|
23 |
-
editingURL: false,
|
24 |
-
url: this.props.attributes.url,
|
25 |
-
fetching: true,
|
26 |
-
cannotEmbed: false,
|
27 |
-
interactive: false,
|
28 |
-
mediaId: null
|
29 |
-
};
|
30 |
-
this.setUrl();
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps(nextProps, state) {
|
34 |
-
if (!nextProps.isSelected && state.interactive) {
|
35 |
-
return {interactive: false};
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState({interactive: true});
|
43 |
-
}
|
44 |
-
|
45 |
-
|
46 |
-
componentDidMount() {
|
47 |
-
if (this.props.attributes.url) {
|
48 |
-
let mediaIdMatches = this.props.attributes.url.match(/medias\/(.*)/);
|
49 |
-
let mediaId = mediaIdMatches[1];
|
50 |
-
this.setState({
|
51 |
-
...this.state,
|
52 |
-
mediaId
|
53 |
-
});
|
54 |
-
}
|
55 |
-
}
|
56 |
-
|
57 |
-
onLoad() {
|
58 |
-
this.setState({
|
59 |
-
fetching: false
|
60 |
-
});
|
61 |
-
if (embedpressObj['wisita_options']) {
|
62 |
-
let $state = {...this.state}
|
63 |
-
setTimeout(function () {
|
64 |
-
let script = document.createElement("script");
|
65 |
-
script.src = "https://fast.wistia.com/assets/external/E-v1.js";
|
66 |
-
script.charset = "ISO-8859-1"
|
67 |
-
document.body.appendChild(script);
|
68 |
-
}, 100);
|
69 |
-
|
70 |
-
setTimeout(function () {
|
71 |
-
let script = document.createElement("script");
|
72 |
-
script.type = 'text/javascript';
|
73 |
-
script.innerHTML = 'window.pp_embed_wistia_labels = ' + embedpressObj['wistia_labels'];
|
74 |
-
document.body.appendChild(script);
|
75 |
-
|
76 |
-
script = document.createElement("script");
|
77 |
-
script.type = 'text/javascript';
|
78 |
-
script.innerHTML = 'wistiaEmbed = Wistia.embed( \"' + $state.mediaId + '\", ' + embedpressObj.wisita_options + ' );';
|
79 |
-
document.body.appendChild(script);
|
80 |
-
}, 400);
|
81 |
-
}
|
82 |
-
|
83 |
-
}
|
84 |
-
|
85 |
-
decodeHTMLEntities(str) {
|
86 |
-
if (str && typeof str === 'string') {
|
87 |
-
// strip script/html tags
|
88 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gmi, '');
|
89 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gmi, '');
|
90 |
-
|
91 |
-
}
|
92 |
-
return str;
|
93 |
-
}
|
94 |
-
|
95 |
-
|
96 |
-
setUrl(event) {
|
97 |
-
if (event) {
|
98 |
-
event.preventDefault();
|
99 |
-
}
|
100 |
-
const {url} = this.state;
|
101 |
-
const {setAttributes} = this.props;
|
102 |
-
setAttributes({url});
|
103 |
-
if (url && (url.match(/^http[s]?:\/\/(?:www\.)?wistia\.com\/medias/i) || url.match(/^http[s]?:\/\/(?:www\.)?fast\/.wistia\.com\/embed\/medias/i.jsonp))) {
|
104 |
-
let mediaIdMatches = url.match(/medias\/(.*)/);
|
105 |
-
let mediaId = mediaIdMatches[1];
|
106 |
-
let iframeSrc = '//fast.wistia.net/embed/iframe/' + mediaId;
|
107 |
-
|
108 |
-
this.setState({editingURL: false, cannotEmbed: false, mediaId});
|
109 |
-
setAttributes({iframeSrc});
|
110 |
-
} else {
|
111 |
-
this.setState({
|
112 |
-
cannotEmbed: true,
|
113 |
-
editingURL: true
|
114 |
-
})
|
115 |
-
}
|
116 |
-
}
|
117 |
-
|
118 |
-
switchBackToURLInput() {
|
119 |
-
this.setState({editingURL: true});
|
120 |
-
}
|
121 |
-
|
122 |
-
render() {
|
123 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
124 |
-
const {iframeSrc} = this.props.attributes;
|
125 |
-
|
126 |
-
const label = __('Wistia URL');
|
127 |
-
|
128 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
129 |
-
if (!iframeSrc || editingURL) {
|
130 |
-
return (
|
131 |
-
<EmbedPlaceholder
|
132 |
-
label={label}
|
133 |
-
onSubmit={this.setUrl}
|
134 |
-
value={url}
|
135 |
-
cannotEmbed={cannotEmbed}
|
136 |
-
onChange={(event) => this.setState({url: event.target.value})}
|
137 |
-
icon={wistiaIcon}
|
138 |
-
DocTitle={__('Learn more about Wistia embed')}
|
139 |
-
docLink={'https://embedpress.com/docs/embed-wistia-videos-wordpress/'}
|
140 |
-
/>
|
141 |
-
);
|
142 |
-
} else {
|
143 |
-
return (
|
144 |
-
<Fragment>
|
145 |
-
{fetching ? <EmbedLoading/> : null}
|
146 |
-
|
147 |
-
<div className="ose-wistia" id={"wistia_" + this.state.mediaId}>
|
148 |
-
<Iframe src={iframeSrc} onFocus={ this.hideOverlay } onLoad={this.onLoad} style={{display: fetching ? 'none' : ''}}
|
149 |
-
frameborder="0" width="600" height="330"/>
|
150 |
-
</div>
|
151 |
-
|
152 |
-
{ ! interactive && (
|
153 |
-
<div
|
154 |
-
className="block-library-embed__interactive-overlay"
|
155 |
-
onMouseUp={ this.hideOverlay }
|
156 |
-
/>
|
157 |
-
) }
|
158 |
-
|
159 |
-
<EmbedControls
|
160 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
161 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
162 |
-
/>
|
163 |
-
</Fragment>
|
164 |
-
);
|
165 |
-
}
|
166 |
-
}
|
167 |
-
};
|
168 |
-
export default WistiaEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/editor.scss
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Editor Styles
|
3 |
-
*
|
4 |
-
* CSS for just Backend enqueued after style.scss
|
5 |
-
* which makes it higher in priority.
|
6 |
-
*/
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/index.js
DELETED
@@ -1,77 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { wistiaIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType('embedpress/wistia-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __('Wistia'), // Block title.
|
32 |
-
icon: wistiaIcon, // Block icon from Dashicons → https://developer.wordpress.org/resource/dashicons/.
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__('embedpress'),
|
36 |
-
__('wistia'),
|
37 |
-
],
|
38 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
39 |
-
edit,
|
40 |
-
save: function(props) {
|
41 |
-
return null;
|
42 |
-
},
|
43 |
-
deprecated: [{
|
44 |
-
attributes: {
|
45 |
-
url: {
|
46 |
-
type: 'string',
|
47 |
-
default: ''
|
48 |
-
},
|
49 |
-
iframeSrc: {
|
50 |
-
type: 'string',
|
51 |
-
default: ''
|
52 |
-
}
|
53 |
-
},
|
54 |
-
edit,
|
55 |
-
/**
|
56 |
-
* The save function defines the way in which the different attributes should be combined
|
57 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
58 |
-
*
|
59 |
-
* The "save" property must be specified and must be a valid function.
|
60 |
-
*
|
61 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
62 |
-
*/
|
63 |
-
save: function (props) {
|
64 |
-
const { iframeSrc } = props.attributes
|
65 |
-
return (
|
66 |
-
<div class="ose-wistia">
|
67 |
-
<iframe src={iframeSrc}
|
68 |
-
allowtransparency="true"
|
69 |
-
frameborder="0"
|
70 |
-
class="wistia_embed"
|
71 |
-
name="wistia_embed"
|
72 |
-
width="600" height="330"></iframe>
|
73 |
-
</div>
|
74 |
-
);
|
75 |
-
},
|
76 |
-
}]
|
77 |
-
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/index.php
DELETED
@@ -1,54 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Renders the `unity-gutenberg/post-slider` block on server.
|
5 |
-
*
|
6 |
-
* @param array $attributes The block attributes.
|
7 |
-
*
|
8 |
-
* @return string Returns the post slider.
|
9 |
-
*/
|
10 |
-
function embedpress_gutenberg_render_block_wistia( $attributes )
|
11 |
-
{
|
12 |
-
ob_start();
|
13 |
-
if ( !empty( $attributes ) && !empty( $attributes[ 'url' ] ) ) :
|
14 |
-
preg_match( '~medias/(.*)~i', $attributes[ 'url' ], $matches );
|
15 |
-
$id = false;
|
16 |
-
if ( isset( $matches[ 1 ] ) ) {
|
17 |
-
$id = $matches[ 1 ];
|
18 |
-
}
|
19 |
-
$align = 'align' . ( isset( $attributes[ 'align' ] ) ? $attributes[ 'align' ] : 'center' );
|
20 |
-
if ( !empty( $id ) ) :
|
21 |
-
?>
|
22 |
-
<div class="ose-wistia wp-block-embed-youtube <?php echo $align; ?>" id="wistia_<?php echo $id; ?>">
|
23 |
-
<iframe src="<?php echo $attributes[ 'iframeSrc' ]; ?>" allowtransparency="true" frameborder="0"
|
24 |
-
class="wistia_embed" name="wistia_embed" width="600" height="330"></iframe>
|
25 |
-
<?php
|
26 |
-
do_action( 'embedpress_gutenberg_wistia_block_after_embed', $attributes ); ?>
|
27 |
-
</div>
|
28 |
-
<?php
|
29 |
-
endif;
|
30 |
-
endif;
|
31 |
-
return ob_get_clean();
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Registers the `embedpress/wistia-block` block on server.
|
36 |
-
*/
|
37 |
-
function embedpress_gutenberg_register_block_wistia()
|
38 |
-
{
|
39 |
-
if ( function_exists( 'register_block_type' ) ) :
|
40 |
-
register_block_type( 'embedpress/wistia-block', [
|
41 |
-
'attributes' => [
|
42 |
-
'url' => [
|
43 |
-
'type' => 'string',
|
44 |
-
],
|
45 |
-
'iframeSrc' => [
|
46 |
-
'type' => 'string',
|
47 |
-
],
|
48 |
-
],
|
49 |
-
'render_callback' => 'embedpress_gutenberg_render_block_wistia',
|
50 |
-
] );
|
51 |
-
endif;
|
52 |
-
}
|
53 |
-
|
54 |
-
add_action( 'init', 'embedpress_gutenberg_register_block_wistia' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/wistia/style.scss
DELETED
@@ -1,6 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* #.# Styles
|
3 |
-
*
|
4 |
-
* CSS for both Frontend+Backend.
|
5 |
-
*/
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/edit.js
DELETED
@@ -1,155 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* Internal dependencies
|
3 |
-
*/
|
4 |
-
import EmbedControls from "../common/embed-controls";
|
5 |
-
import EmbedLoading from "../common/embed-loading";
|
6 |
-
import EmbedPlaceholder from "../common/embed-placeholder";
|
7 |
-
import Iframe from "../common/Iframe";
|
8 |
-
import {youtubeIcon} from "../common/icons";
|
9 |
-
|
10 |
-
|
11 |
-
/**
|
12 |
-
* WordPress dependencies
|
13 |
-
*/
|
14 |
-
const {__} = wp.i18n;
|
15 |
-
const {Component, Fragment} = wp.element;
|
16 |
-
|
17 |
-
class YoutubeEdit extends Component {
|
18 |
-
constructor() {
|
19 |
-
super(...arguments);
|
20 |
-
this.switchBackToURLInput = this.switchBackToURLInput.bind(this);
|
21 |
-
this.setUrl = this.setUrl.bind(this);
|
22 |
-
this.onLoad = this.onLoad.bind(this);
|
23 |
-
this.hideOverlay = this.hideOverlay.bind( this );
|
24 |
-
this.state = {
|
25 |
-
editingURL: false,
|
26 |
-
url: this.props.attributes.url,
|
27 |
-
fetching: true,
|
28 |
-
cannotEmbed: false,
|
29 |
-
interactive: false
|
30 |
-
};
|
31 |
-
}
|
32 |
-
|
33 |
-
static getDerivedStateFromProps( nextProps, state ) {
|
34 |
-
if ( ! nextProps.isSelected && state.interactive ) {
|
35 |
-
return { interactive: false };
|
36 |
-
}
|
37 |
-
|
38 |
-
return null;
|
39 |
-
}
|
40 |
-
|
41 |
-
hideOverlay() {
|
42 |
-
this.setState( { interactive: true } );
|
43 |
-
}
|
44 |
-
|
45 |
-
componentWillMount() {
|
46 |
-
if (this.state.url) {
|
47 |
-
this.setUrl();
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
onLoad() {
|
52 |
-
this.setState({
|
53 |
-
fetching: false
|
54 |
-
});
|
55 |
-
}
|
56 |
-
|
57 |
-
decodeHTMLEntities(str) {
|
58 |
-
if (str && typeof str === "string") {
|
59 |
-
// strip script/html tags
|
60 |
-
str = str.replace(/<script[^>]*>([\S\s]*?)<\/script>/gim, "");
|
61 |
-
str = str.replace(/<\/?\w(?:[^"'>]|"[^"]*"|'[^']*')*>/gim, "");
|
62 |
-
}
|
63 |
-
return str;
|
64 |
-
}
|
65 |
-
|
66 |
-
setUrl(event) {
|
67 |
-
if (event) {
|
68 |
-
event.preventDefault();
|
69 |
-
}
|
70 |
-
const {url} = this.state;
|
71 |
-
const {setAttributes} = this.props;
|
72 |
-
setAttributes({url});
|
73 |
-
const matches = url.match(
|
74 |
-
/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/
|
75 |
-
);
|
76 |
-
if (url && matches) {
|
77 |
-
let mediaId = matches[1];
|
78 |
-
let iframeSrc = "https://www.youtube.com/embed/" + mediaId;
|
79 |
-
let iframeUrl = new URL(iframeSrc);
|
80 |
-
|
81 |
-
// // If your expected result is "http://foo.bar/?x=42&y=2"
|
82 |
-
if (typeof embedpressProObj !== 'undefined') {
|
83 |
-
for (var key in embedpressProObj.youtubeParams) {
|
84 |
-
iframeUrl.searchParams.set(
|
85 |
-
key,
|
86 |
-
embedpressProObj.youtubeParams[key]
|
87 |
-
);
|
88 |
-
}
|
89 |
-
}
|
90 |
-
|
91 |
-
this.setState({editingURL: false, cannotEmbed: false});
|
92 |
-
setAttributes({iframeSrc: iframeUrl.href, mediaId});
|
93 |
-
} else {
|
94 |
-
this.setState({
|
95 |
-
cannotEmbed: true,
|
96 |
-
editingURL: true
|
97 |
-
});
|
98 |
-
}
|
99 |
-
}
|
100 |
-
|
101 |
-
switchBackToURLInput() {
|
102 |
-
this.setState({editingURL: true});
|
103 |
-
}
|
104 |
-
|
105 |
-
render() {
|
106 |
-
const {url, editingURL, fetching, cannotEmbed,interactive} = this.state;
|
107 |
-
const {iframeSrc, attrs} = this.props.attributes;
|
108 |
-
const label = __("Youtube URL");
|
109 |
-
// No preview, or we can't embed the current URL, or we've clicked the edit button.
|
110 |
-
if (!iframeSrc || editingURL) {
|
111 |
-
return (
|
112 |
-
<EmbedPlaceholder
|
113 |
-
label={label}
|
114 |
-
onSubmit={this.setUrl}
|
115 |
-
value={url}
|
116 |
-
cannotEmbed={cannotEmbed}
|
117 |
-
onChange={event => this.setState({url: event.target.value})}
|
118 |
-
icon={youtubeIcon}
|
119 |
-
DocTitle={__('Learn More About Youtube Embed')}
|
120 |
-
docLink={'https://embedpress.com/docs/embed-youtube-wordpress/'}
|
121 |
-
|
122 |
-
/>
|
123 |
-
);
|
124 |
-
} else {
|
125 |
-
return (
|
126 |
-
<Fragment>
|
127 |
-
{fetching ? <EmbedLoading/> : null}
|
128 |
-
|
129 |
-
<Iframe
|
130 |
-
src={iframeSrc}
|
131 |
-
{...attrs}
|
132 |
-
onLoad={this.onLoad}
|
133 |
-
style={{display: fetching ? "none" : ""}}
|
134 |
-
width="640"
|
135 |
-
onFocus={ this.hideOverlay }
|
136 |
-
height="450"
|
137 |
-
/>
|
138 |
-
{ ! interactive && (
|
139 |
-
<div
|
140 |
-
className="block-library-embed__interactive-overlay"
|
141 |
-
onMouseUp={ this.hideOverlay }
|
142 |
-
/>
|
143 |
-
) }
|
144 |
-
|
145 |
-
<EmbedControls
|
146 |
-
showEditButton={iframeSrc && !cannotEmbed}
|
147 |
-
switchBackToURLInput={this.switchBackToURLInput}
|
148 |
-
/>
|
149 |
-
</Fragment>
|
150 |
-
);
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
|
155 |
-
export default YoutubeEdit;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/editor.scss
DELETED
File without changes
|
Gutenberg/src/youtube/index.js
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
/**
|
2 |
-
* BLOCK: embedpress-blocks
|
3 |
-
*
|
4 |
-
* Registering a basic block with Gutenberg.
|
5 |
-
* Simple block, renders and saves the same content without any interactivity.
|
6 |
-
*/
|
7 |
-
|
8 |
-
// Import CSS.
|
9 |
-
import './style.scss';
|
10 |
-
import './editor.scss';
|
11 |
-
import edit from './edit';
|
12 |
-
import { youtubeIcon } from '../common/icons';
|
13 |
-
const { __ } = wp.i18n; // Import __() from wp.i18n
|
14 |
-
const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
|
15 |
-
|
16 |
-
/**
|
17 |
-
* Register: aa Gutenberg Block.
|
18 |
-
*
|
19 |
-
* Registers a new block provided a unique name and an object defining its
|
20 |
-
* behavior. Once registered, the block is made editor as an option to any
|
21 |
-
* editor interface where blocks are implemented.
|
22 |
-
*
|
23 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/
|
24 |
-
* @param {string} name Block name.
|
25 |
-
* @param {Object} settings Block settings.
|
26 |
-
* @return {?WPBlock} The block, if it has been successfully
|
27 |
-
* registered; otherwise `undefined`.
|
28 |
-
*/
|
29 |
-
registerBlockType( 'embedpress/youtube-block', {
|
30 |
-
// Block name. Block names must be string that contains a namespace prefix. Example: my-plugin/my-custom-block.
|
31 |
-
title: __( 'Youtube' ), // Block title.
|
32 |
-
icon: youtubeIcon,
|
33 |
-
category: 'embedpress', // Block category — Group blocks together based on common traits E.g. common, formatting, layout Widgets, embed.
|
34 |
-
keywords: [
|
35 |
-
__( 'embedpress' ),
|
36 |
-
__( 'youtube' ),
|
37 |
-
],
|
38 |
-
supports: {align: ["wide", "full","right","left"], default: ''},
|
39 |
-
/**
|
40 |
-
* The edit function describes the structure of your block in the context of the editor.
|
41 |
-
* This represents what the editor will render when the block is used.
|
42 |
-
*
|
43 |
-
* The "edit" property must be a valid function.
|
44 |
-
*
|
45 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
46 |
-
*/
|
47 |
-
edit,
|
48 |
-
|
49 |
-
/**
|
50 |
-
* The save function defines the way in which the different attributes should be combined
|
51 |
-
* into the final markup, which is then serialized by Gutenberg into post_content.
|
52 |
-
*
|
53 |
-
* The "save" property must be specified and must be a valid function.
|
54 |
-
*
|
55 |
-
* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
|
56 |
-
*/
|
57 |
-
save: () => {
|
58 |
-
return null
|
59 |
-
}
|
60 |
-
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/index.php
DELETED
@@ -1,66 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Renders the `embedpress/youtube` block on server.
|
6 |
-
*
|
7 |
-
* @param array $attributes The block attributes.
|
8 |
-
*
|
9 |
-
* @return false|string
|
10 |
-
*/
|
11 |
-
function embedpress_gutenberg_render_block_youtube( $attributes )
|
12 |
-
{
|
13 |
-
ob_start();
|
14 |
-
$align = 'align' . ( isset( $attributes[ 'align' ] ) ? $attributes[ 'align' ] : 'center' );
|
15 |
-
$youtube_params = apply_filters( 'embedpress_gutenberg_youtube_params', [] );
|
16 |
-
$iframeUrl = $attributes[ 'iframeSrc' ];
|
17 |
-
foreach ( $youtube_params as $param => $value ) {
|
18 |
-
$iframeUrl = add_query_arg( $param, $value, $iframeUrl );
|
19 |
-
}
|
20 |
-
|
21 |
-
?>
|
22 |
-
<div class="ose-youtube wp-block-embed-youtube <?php echo $align; ?>">
|
23 |
-
<iframe src="<?php echo $iframeUrl; ?>"
|
24 |
-
allowtransparency="true"
|
25 |
-
allowfullscreen="true"
|
26 |
-
frameborder="0"
|
27 |
-
width="640" height="360">
|
28 |
-
</iframe>
|
29 |
-
</div>
|
30 |
-
<?php
|
31 |
-
return ob_get_clean();
|
32 |
-
}
|
33 |
-
|
34 |
-
/**
|
35 |
-
* Registers the `embedpress/youtube-block` block on server.
|
36 |
-
*/
|
37 |
-
function embedpress_gutenberg_register_block_youtube()
|
38 |
-
{
|
39 |
-
if ( function_exists( 'register_block_type' ) ) :
|
40 |
-
register_block_type( 'embedpress/youtube-block', [
|
41 |
-
'style' => 'embedpress_youtube-cgb-style-css',
|
42 |
-
// Enqueue blocks.build.js in the editor only.
|
43 |
-
'editor_script' => 'embedpress_youtube-cgb-block-js',
|
44 |
-
// Enqueue blocks.editor.build.css in the editor only.
|
45 |
-
'editor_style' => 'embedpress_youtube-cgb-block-editor-css',
|
46 |
-
|
47 |
-
'attributes' => [
|
48 |
-
'url' => [
|
49 |
-
'type' => 'string',
|
50 |
-
'default' => ''
|
51 |
-
],
|
52 |
-
'iframeSrc' => [
|
53 |
-
'type' => 'string',
|
54 |
-
'default' => ''
|
55 |
-
],
|
56 |
-
'mediaId' => [
|
57 |
-
'type' => 'string',
|
58 |
-
'default' => ''
|
59 |
-
]
|
60 |
-
],
|
61 |
-
'render_callback' => 'embedpress_gutenberg_render_block_youtube',
|
62 |
-
] );
|
63 |
-
endif;
|
64 |
-
}
|
65 |
-
|
66 |
-
add_action( 'init', 'embedpress_gutenberg_register_block_youtube' );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gutenberg/src/youtube/style.scss
DELETED
File without changes
|
assets/js/preview.js
CHANGED
@@ -1294,14 +1294,16 @@
|
|
1294 |
if (!embedItem.length) {
|
1295 |
embedItem = null;
|
1296 |
}
|
1297 |
-
|
1298 |
-
|
1299 |
-
|
1300 |
-
|
1301 |
-
|
|
|
1302 |
}
|
1303 |
-
}
|
1304 |
-
}
|
|
|
1305 |
|
1306 |
var embedWidth = (((embedItem && embedItem.width()) || $embedInnerWrapper.data('width')) || $embedInnerWrapper.width()) || '';
|
1307 |
var embedHeight = (((embedItem && embedItem.height()) || $embedInnerWrapper.data('height')) || $embedInnerWrapper.height()) || '';
|
1294 |
if (!embedItem.length) {
|
1295 |
embedItem = null;
|
1296 |
}
|
1297 |
+
if ($embedInnerWrapper.length > 1){
|
1298 |
+
$.each($embedInnerWrapper[0].attributes, function () {
|
1299 |
+
if (this.specified) {
|
1300 |
+
if (this.name !== 'class') {
|
1301 |
+
customAttributes[this.name.replace('data-', '').toLowerCase()] = this.value;
|
1302 |
+
}
|
1303 |
}
|
1304 |
+
});
|
1305 |
+
}
|
1306 |
+
|
1307 |
|
1308 |
var embedWidth = (((embedItem && embedItem.width()) || $embedInnerWrapper.data('width')) || $embedInnerWrapper.width()) || '';
|
1309 |
var embedHeight = (((embedItem && embedItem.height()) || $embedInnerWrapper.data('height')) || $embedInnerWrapper.height()) || '';
|
embedpress.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and uplaoad 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.net
|
8 |
-
* Version: 2.7.
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and uplaoad 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.net
|
8 |
+
* Version: 2.7.3
|
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', "2.7.
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
@@ -30,7 +30,7 @@ if ( ! defined('EMBEDPRESS_VERSION')) {
|
|
30 |
}
|
31 |
|
32 |
if ( ! defined('EMBEDPRESS_PRO_VERSION')) {
|
33 |
-
define('EMBEDPRESS_PRO_VERSION', "2.4.
|
34 |
}
|
35 |
|
36 |
if ( ! defined('EMBEDPRESS_ROOT')) {
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
+
define('EMBEDPRESS_VERSION', "2.7.3");
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
30 |
}
|
31 |
|
32 |
if ( ! defined('EMBEDPRESS_PRO_VERSION')) {
|
33 |
+
define('EMBEDPRESS_PRO_VERSION', "2.4.5");
|
34 |
}
|
35 |
|
36 |
if ( ! defined('EMBEDPRESS_ROOT')) {
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Author: WPDeveloper
|
|
4 |
Author URI: https://wpdeveloper.net
|
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
|
6 |
Requires at least: 4.6
|
7 |
-
Tested up to: 5.
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 2.7.
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
@@ -299,6 +299,15 @@ Not at all. You can set up everything your team needs without any coding knowled
|
|
299 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
300 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
302 |
= [2.7.2] - 2021-02-18 =
|
303 |
* Added: New Gutenberg block 'EmbedPress' that supports 100+ sites.
|
304 |
* Added: Controls in elementor widget like height width, color etc
|
4 |
Author URI: https://wpdeveloper.net
|
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
|
6 |
Requires at least: 4.6
|
7 |
+
Tested up to: 5.7
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 2.7.3
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
299 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
300 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
301 |
|
302 |
+
= [2.7.3] - 2021-03-23 =
|
303 |
+
* Added: Dedicated button to apply height width on Block Editor.
|
304 |
+
* Improved: Facebook and Instagram works without APP key
|
305 |
+
* Fixed: Responsive issues for Gutenberg
|
306 |
+
* Fixed: New York Times Video not embedding issue
|
307 |
+
* Fixed: Sutori Content not embedding issue
|
308 |
+
* Removed: Unused options from the settings page
|
309 |
+
* Few minor bug fix and improvements
|
310 |
+
|
311 |
= [2.7.2] - 2021-02-18 =
|
312 |
* Added: New Gutenberg block 'EmbedPress' that supports 100+ sites.
|
313 |
* Added: Controls in elementor widget like height width, color etc
|
vendor/autoload.php
CHANGED
@@ -4,4 +4,4 @@
|
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
-
return
|
4 |
|
5 |
require_once __DIR__ . '/composer/autoload_real.php';
|
6 |
|
7 |
+
return ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51::getLoader();
|
vendor/composer/ClassLoader.php
CHANGED
@@ -37,8 +37,8 @@ namespace Composer\Autoload;
|
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
-
* @see
|
41 |
-
* @see
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
@@ -60,7 +60,7 @@ class ClassLoader
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
-
return call_user_func_array('array_merge', $this->prefixesPsr0);
|
64 |
}
|
65 |
|
66 |
return array();
|
37 |
*
|
38 |
* @author Fabien Potencier <fabien@symfony.com>
|
39 |
* @author Jordi Boggiano <j.boggiano@seld.be>
|
40 |
+
* @see https://www.php-fig.org/psr/psr-0/
|
41 |
+
* @see https://www.php-fig.org/psr/psr-4/
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
63 |
+
return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
|
64 |
}
|
65 |
|
66 |
return array();
|
vendor/composer/InstalledVersions.php
ADDED
@@ -0,0 +1,228 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
|
6 |
+
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
namespace Composer;
|
14 |
+
|
15 |
+
use Composer\Semver\VersionParser;
|
16 |
+
|
17 |
+
|
18 |
+
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
class InstalledVersions
|
23 |
+
{
|
24 |
+
private static $installed = array (
|
25 |
+
'root' =>
|
26 |
+
array (
|
27 |
+
'pretty_version' => 'dev-master',
|
28 |
+
'version' => 'dev-master',
|
29 |
+
'aliases' =>
|
30 |
+
array (
|
31 |
+
),
|
32 |
+
'reference' => 'ce096bb496cd88d9c2ebadc239310813a7be244d',
|
33 |
+
'name' => 'embedpress/embedpress',
|
34 |
+
),
|
35 |
+
'versions' =>
|
36 |
+
array (
|
37 |
+
'embedpress/embedpress' =>
|
38 |
+
array (
|
39 |
+
'pretty_version' => 'dev-master',
|
40 |
+
'version' => 'dev-master',
|
41 |
+
'aliases' =>
|
42 |
+
array (
|
43 |
+
),
|
44 |
+
'reference' => 'ce096bb496cd88d9c2ebadc239310813a7be244d',
|
45 |
+
),
|
46 |
+
'wpdevelopers/embera' =>
|
47 |
+
array (
|
48 |
+
'pretty_version' => '2.0.17',
|
49 |
+
'version' => '2.0.17.0',
|
50 |
+
'aliases' =>
|
51 |
+
array (
|
52 |
+
),
|
53 |
+
'reference' => '5f521fbe77fdfc992dc399ee39e5fdb338ea1f04',
|
54 |
+
),
|
55 |
+
),
|
56 |
+
);
|
57 |
+
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
public static function getInstalledPackages()
|
65 |
+
{
|
66 |
+
return array_keys(self::$installed['versions']);
|
67 |
+
}
|
68 |
+
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
public static function isInstalled($packageName)
|
78 |
+
{
|
79 |
+
return isset(self::$installed['versions'][$packageName]);
|
80 |
+
}
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
|
89 |
+
|
90 |
+
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
96 |
+
{
|
97 |
+
$constraint = $parser->parseConstraints($constraint);
|
98 |
+
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
99 |
+
|
100 |
+
return $provided->matches($constraint);
|
101 |
+
}
|
102 |
+
|
103 |
+
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
|
110 |
+
|
111 |
+
|
112 |
+
public static function getVersionRanges($packageName)
|
113 |
+
{
|
114 |
+
if (!isset(self::$installed['versions'][$packageName])) {
|
115 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
116 |
+
}
|
117 |
+
|
118 |
+
$ranges = array();
|
119 |
+
if (isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
120 |
+
$ranges[] = self::$installed['versions'][$packageName]['pretty_version'];
|
121 |
+
}
|
122 |
+
if (array_key_exists('aliases', self::$installed['versions'][$packageName])) {
|
123 |
+
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['aliases']);
|
124 |
+
}
|
125 |
+
if (array_key_exists('replaced', self::$installed['versions'][$packageName])) {
|
126 |
+
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['replaced']);
|
127 |
+
}
|
128 |
+
if (array_key_exists('provided', self::$installed['versions'][$packageName])) {
|
129 |
+
$ranges = array_merge($ranges, self::$installed['versions'][$packageName]['provided']);
|
130 |
+
}
|
131 |
+
|
132 |
+
return implode(' || ', $ranges);
|
133 |
+
}
|
134 |
+
|
135 |
+
|
136 |
+
|
137 |
+
|
138 |
+
|
139 |
+
public static function getVersion($packageName)
|
140 |
+
{
|
141 |
+
if (!isset(self::$installed['versions'][$packageName])) {
|
142 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
143 |
+
}
|
144 |
+
|
145 |
+
if (!isset(self::$installed['versions'][$packageName]['version'])) {
|
146 |
+
return null;
|
147 |
+
}
|
148 |
+
|
149 |
+
return self::$installed['versions'][$packageName]['version'];
|
150 |
+
}
|
151 |
+
|
152 |
+
|
153 |
+
|
154 |
+
|
155 |
+
|
156 |
+
public static function getPrettyVersion($packageName)
|
157 |
+
{
|
158 |
+
if (!isset(self::$installed['versions'][$packageName])) {
|
159 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
160 |
+
}
|
161 |
+
|
162 |
+
if (!isset(self::$installed['versions'][$packageName]['pretty_version'])) {
|
163 |
+
return null;
|
164 |
+
}
|
165 |
+
|
166 |
+
return self::$installed['versions'][$packageName]['pretty_version'];
|
167 |
+
}
|
168 |
+
|
169 |
+
|
170 |
+
|
171 |
+
|
172 |
+
|
173 |
+
public static function getReference($packageName)
|
174 |
+
{
|
175 |
+
if (!isset(self::$installed['versions'][$packageName])) {
|
176 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
177 |
+
}
|
178 |
+
|
179 |
+
if (!isset(self::$installed['versions'][$packageName]['reference'])) {
|
180 |
+
return null;
|
181 |
+
}
|
182 |
+
|
183 |
+
return self::$installed['versions'][$packageName]['reference'];
|
184 |
+
}
|
185 |
+
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
public static function getRootPackage()
|
191 |
+
{
|
192 |
+
return self::$installed['root'];
|
193 |
+
}
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
|
199 |
+
|
200 |
+
|
201 |
+
public static function getRawData()
|
202 |
+
{
|
203 |
+
return self::$installed;
|
204 |
+
}
|
205 |
+
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
+
|
210 |
+
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
|
215 |
+
|
216 |
+
|
217 |
+
|
218 |
+
|
219 |
+
|
220 |
+
|
221 |
+
|
222 |
+
|
223 |
+
|
224 |
+
public static function reload($data)
|
225 |
+
{
|
226 |
+
self::$installed = $data;
|
227 |
+
}
|
228 |
+
}
|
vendor/composer/autoload_classmap.php
CHANGED
@@ -6,4 +6,5 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
|
10 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
-
class
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
@@ -22,15 +22,17 @@ class ComposerAutoloaderInitfa112be3a45897b53eb16b7ddc526d6f
|
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
-
|
|
|
|
|
26 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
27 |
-
spl_autoload_unregister(array('
|
28 |
|
29 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
30 |
if ($useStaticLoader) {
|
31 |
-
|
32 |
|
33 |
-
call_user_func(\Composer\Autoload\
|
34 |
} else {
|
35 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
36 |
foreach ($map as $namespace => $path) {
|
2 |
|
3 |
// autoload_real.php @generated by Composer
|
4 |
|
5 |
+
class ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51
|
6 |
{
|
7 |
private static $loader;
|
8 |
|
22 |
return self::$loader;
|
23 |
}
|
24 |
|
25 |
+
require __DIR__ . '/platform_check.php';
|
26 |
+
|
27 |
+
spl_autoload_register(array('ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51', 'loadClassLoader'), true, true);
|
28 |
self::$loader = $loader = new \Composer\Autoload\ClassLoader();
|
29 |
+
spl_autoload_unregister(array('ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51', 'loadClassLoader'));
|
30 |
|
31 |
$useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
|
32 |
if ($useStaticLoader) {
|
33 |
+
require __DIR__ . '/autoload_static.php';
|
34 |
|
35 |
+
call_user_func(\Composer\Autoload\ComposerStaticInit892912675c615e61d62bcd5adc416c51::getInitializer($loader));
|
36 |
} else {
|
37 |
$map = require __DIR__ . '/autoload_namespaces.php';
|
38 |
foreach ($map as $namespace => $path) {
|
vendor/composer/autoload_static.php
CHANGED
@@ -4,7 +4,7 @@
|
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
-
class
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'E' =>
|
@@ -20,11 +20,16 @@ class ComposerStaticInitfa112be3a45897b53eb16b7ddc526d6f
|
|
20 |
),
|
21 |
);
|
22 |
|
|
|
|
|
|
|
|
|
23 |
public static function getInitializer(ClassLoader $loader)
|
24 |
{
|
25 |
return \Closure::bind(function () use ($loader) {
|
26 |
-
$loader->prefixLengthsPsr4 =
|
27 |
-
$loader->prefixDirsPsr4 =
|
|
|
28 |
|
29 |
}, null, ClassLoader::class);
|
30 |
}
|
4 |
|
5 |
namespace Composer\Autoload;
|
6 |
|
7 |
+
class ComposerStaticInit892912675c615e61d62bcd5adc416c51
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
'E' =>
|
20 |
),
|
21 |
);
|
22 |
|
23 |
+
public static $classMap = array (
|
24 |
+
'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
|
25 |
+
);
|
26 |
+
|
27 |
public static function getInitializer(ClassLoader $loader)
|
28 |
{
|
29 |
return \Closure::bind(function () use ($loader) {
|
30 |
+
$loader->prefixLengthsPsr4 = ComposerStaticInit892912675c615e61d62bcd5adc416c51::$prefixLengthsPsr4;
|
31 |
+
$loader->prefixDirsPsr4 = ComposerStaticInit892912675c615e61d62bcd5adc416c51::$prefixDirsPsr4;
|
32 |
+
$loader->classMap = ComposerStaticInit892912675c615e61d62bcd5adc416c51::$classMap;
|
33 |
|
34 |
}, null, ClassLoader::class);
|
35 |
}
|
vendor/composer/installed.json
CHANGED
@@ -1,66 +1,71 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
"
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
"
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
"
|
17 |
-
|
18 |
-
|
19 |
-
"
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
"
|
26 |
-
"
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
"
|
31 |
-
"
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
"
|
36 |
-
"
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
"
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
"
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"packages": [
|
3 |
+
{
|
4 |
+
"name": "wpdevelopers/embera",
|
5 |
+
"version": "2.0.17",
|
6 |
+
"version_normalized": "2.0.17.0",
|
7 |
+
"source": {
|
8 |
+
"type": "git",
|
9 |
+
"url": "https://github.com/WPDevelopers/Embera",
|
10 |
+
"reference": "5f521fbe77fdfc992dc399ee39e5fdb338ea1f04"
|
11 |
+
},
|
12 |
+
"require": {
|
13 |
+
"ext-json": "*",
|
14 |
+
"php": ">=5.6"
|
15 |
+
},
|
16 |
+
"require-dev": {
|
17 |
+
"phpunit/phpunit": "^8.3"
|
18 |
+
},
|
19 |
+
"suggest": {
|
20 |
+
"ext-curl": "Allow to fetch data using curl instead of using file_get_contents"
|
21 |
+
},
|
22 |
+
"time": "2021-01-28T07:14:10+00:00",
|
23 |
+
"type": "library",
|
24 |
+
"installation-source": "source",
|
25 |
+
"autoload": {
|
26 |
+
"psr-4": {
|
27 |
+
"Embera\\": "src/Embera"
|
28 |
+
}
|
29 |
+
},
|
30 |
+
"autoload-dev": {
|
31 |
+
"psr-4": {
|
32 |
+
"Embera\\": "tests/Embera"
|
33 |
+
}
|
34 |
+
},
|
35 |
+
"scripts": {
|
36 |
+
"test": [
|
37 |
+
"phpunit"
|
38 |
+
]
|
39 |
+
},
|
40 |
+
"license": [
|
41 |
+
"MIT"
|
42 |
+
],
|
43 |
+
"authors": [
|
44 |
+
{
|
45 |
+
"name": "Michael Pratt",
|
46 |
+
"email": "yo@michael-pratt.com",
|
47 |
+
"homepage": "http://www.michael-pratt.com",
|
48 |
+
"role": "Author/Developer"
|
49 |
+
}
|
50 |
+
],
|
51 |
+
"description": "Oembed consumer library. Converts urls into their html embed code. Supports 150+ sites, such as Youtube, Twitter, vimeo, Instagram etc.",
|
52 |
+
"homepage": "https://github.com/WPDevelopers/Embera",
|
53 |
+
"keywords": [
|
54 |
+
"Auto embed",
|
55 |
+
"Embed",
|
56 |
+
"Embed Text",
|
57 |
+
"Instagram",
|
58 |
+
"Oembed",
|
59 |
+
"Responsive Embeds",
|
60 |
+
"Twitter",
|
61 |
+
"Url Embed",
|
62 |
+
"Vimeo",
|
63 |
+
"Vine",
|
64 |
+
"Youtube"
|
65 |
+
],
|
66 |
+
"install-path": "../wpdevelopers/embera"
|
67 |
+
}
|
68 |
+
],
|
69 |
+
"dev": true,
|
70 |
+
"dev-package-names": []
|
71 |
+
}
|
vendor/composer/installed.php
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php return array (
|
2 |
+
'root' =>
|
3 |
+
array (
|
4 |
+
'pretty_version' => 'dev-master',
|
5 |
+
'version' => 'dev-master',
|
6 |
+
'aliases' =>
|
7 |
+
array (
|
8 |
+
),
|
9 |
+
'reference' => 'ce096bb496cd88d9c2ebadc239310813a7be244d',
|
10 |
+
'name' => 'embedpress/embedpress',
|
11 |
+
),
|
12 |
+
'versions' =>
|
13 |
+
array (
|
14 |
+
'embedpress/embedpress' =>
|
15 |
+
array (
|
16 |
+
'pretty_version' => 'dev-master',
|
17 |
+
'version' => 'dev-master',
|
18 |
+
'aliases' =>
|
19 |
+
array (
|
20 |
+
),
|
21 |
+
'reference' => 'ce096bb496cd88d9c2ebadc239310813a7be244d',
|
22 |
+
),
|
23 |
+
'wpdevelopers/embera' =>
|
24 |
+
array (
|
25 |
+
'pretty_version' => '2.0.17',
|
26 |
+
'version' => '2.0.17.0',
|
27 |
+
'aliases' =>
|
28 |
+
array (
|
29 |
+
),
|
30 |
+
'reference' => '5f521fbe77fdfc992dc399ee39e5fdb338ea1f04',
|
31 |
+
),
|
32 |
+
),
|
33 |
+
);
|
vendor/composer/platform_check.php
ADDED
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// platform_check.php @generated by Composer
|
4 |
+
|
5 |
+
$issues = array();
|
6 |
+
|
7 |
+
if (!(PHP_VERSION_ID >= 50600)) {
|
8 |
+
$issues[] = 'Your Composer dependencies require a PHP version ">= 5.6.0". You are running ' . PHP_VERSION . '.';
|
9 |
+
}
|
10 |
+
|
11 |
+
if ($issues) {
|
12 |
+
if (!headers_sent()) {
|
13 |
+
header('HTTP/1.1 500 Internal Server Error');
|
14 |
+
}
|
15 |
+
if (!ini_get('display_errors')) {
|
16 |
+
if (PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') {
|
17 |
+
fwrite(STDERR, 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . implode(PHP_EOL, $issues) . PHP_EOL.PHP_EOL);
|
18 |
+
} elseif (!headers_sent()) {
|
19 |
+
echo 'Composer detected issues in your platform:' . PHP_EOL.PHP_EOL . str_replace('You are running '.PHP_VERSION.'.', '', implode(PHP_EOL, $issues)) . PHP_EOL.PHP_EOL;
|
20 |
+
}
|
21 |
+
}
|
22 |
+
trigger_error(
|
23 |
+
'Composer detected issues in your platform: ' . implode(' ', $issues),
|
24 |
+
E_USER_ERROR
|
25 |
+
);
|
26 |
+
}
|