Version Description
Download this release
Release Info
Developer | wpdevteam |
Plugin | EmbedPress – Embed Google Docs, YouTube, Maps, Vimeo, Wistia Videos & Upload PDF, PPT in Gutenberg & Elementor |
Version | 3.4.2 |
Comparing to | |
See all releases |
Code changes from version 3.4.1 to 3.4.2
- EmbedPress/Core.php +2 -1
- EmbedPress/CoreLegacy.php +4 -3
- EmbedPress/Elementor/Widgets/Embedpress_Elementor.php +2 -2
- EmbedPress/Ends/Back/Settings/templates/youtube.php +2 -2
- EmbedPress/Includes/Classes/EmbedPress_Notice.php +0 -112
- EmbedPress/Includes/Classes/EmbedPress_Plugin_Usage_Tracker.php +6 -1
- EmbedPress/Includes/Traits/Shared.php +112 -74
- Gutenberg/dist/blocks.editor.build.css +1 -1
- Gutenberg/dist/blocks.style.build.css +1 -1
- assets/css/admin-notices.css +128 -0
- assets/images/freedom30.png +0 -0
- embedpress.php +1 -1
- includes.php +1 -1
- readme.txt +7 -2
- vendor/composer/ClassLoader.php +139 -12
- vendor/composer/InstalledVersions.php +340 -218
- vendor/composer/autoload_psr4.php +1 -0
- vendor/composer/autoload_real.php +1 -1
- vendor/composer/autoload_static.php +8 -0
- vendor/composer/installed.json +36 -0
- vendor/composer/installed.php +40 -30
- vendor/priyomukul/wp-notice/src/Dismiss.php +151 -0
- vendor/priyomukul/wp-notice/src/Notice.php +257 -0
- vendor/priyomukul/wp-notice/src/Notices.php +113 -0
- vendor/priyomukul/wp-notice/src/Utils/Base.php +44 -0
- vendor/priyomukul/wp-notice/src/Utils/Helper.php +37 -0
- vendor/priyomukul/wp-notice/src/Utils/Storage.php +59 -0
EmbedPress/Core.php
CHANGED
@@ -124,6 +124,8 @@ class Core {
|
|
124 |
add_filter('oembed_providers', [$this, 'addOEmbedProviders']);
|
125 |
add_action('rest_api_init', [$this, 'registerOEmbedRestRoutes']);
|
126 |
|
|
|
|
|
127 |
if (is_admin()) {
|
128 |
new EmbedpressSettings();
|
129 |
$plgSettings = self::getSettings();
|
@@ -154,7 +156,6 @@ class Core {
|
|
154 |
// Add support for our embeds on Beaver Builder. Without this it only run the native embeds.
|
155 |
add_filter('fl_builder_before_render_shortcodes',
|
156 |
['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']);
|
157 |
-
$this->start_plugin_tracking();
|
158 |
$this->loaderInstance->run();
|
159 |
|
160 |
}
|
124 |
add_filter('oembed_providers', [$this, 'addOEmbedProviders']);
|
125 |
add_action('rest_api_init', [$this, 'registerOEmbedRestRoutes']);
|
126 |
|
127 |
+
$this->start_plugin_tracking();
|
128 |
+
|
129 |
if (is_admin()) {
|
130 |
new EmbedpressSettings();
|
131 |
$plgSettings = self::getSettings();
|
156 |
// Add support for our embeds on Beaver Builder. Without this it only run the native embeds.
|
157 |
add_filter('fl_builder_before_render_shortcodes',
|
158 |
['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']);
|
|
|
159 |
$this->loaderInstance->run();
|
160 |
|
161 |
}
|
EmbedPress/CoreLegacy.php
CHANGED
@@ -123,9 +123,11 @@ class CoreLegacy
|
|
123 |
{
|
124 |
global $wp_actions;
|
125 |
|
|
|
|
|
126 |
if (is_admin()) {
|
127 |
-
|
128 |
-
|
129 |
$this->admin_notice();
|
130 |
|
131 |
add_filter('plugin_action_links_embedpress/embedpress.php',
|
@@ -175,7 +177,6 @@ class CoreLegacy
|
|
175 |
add_filter('fl_builder_before_render_shortcodes',
|
176 |
['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']);
|
177 |
|
178 |
-
$this->start_plugin_tracking();
|
179 |
$this->loaderInstance->run();
|
180 |
}
|
181 |
|
123 |
{
|
124 |
global $wp_actions;
|
125 |
|
126 |
+
$this->start_plugin_tracking();
|
127 |
+
|
128 |
if (is_admin()) {
|
129 |
+
new EmbedpressSettings();
|
130 |
+
$plgSettings = self::getSettings();
|
131 |
$this->admin_notice();
|
132 |
|
133 |
add_filter('plugin_action_links_embedpress/embedpress.php',
|
177 |
add_filter('fl_builder_before_render_shortcodes',
|
178 |
['\\EmbedPress\\ThirdParty\\BeaverBuilder', 'before_render_shortcodes']);
|
179 |
|
|
|
180 |
$this->loaderInstance->run();
|
181 |
}
|
182 |
|
EmbedPress/Elementor/Widgets/Embedpress_Elementor.php
CHANGED
@@ -345,12 +345,12 @@ class Embedpress_Elementor extends Widget_Base {
|
|
345 |
'yt_sub_channel',
|
346 |
[
|
347 |
|
348 |
-
'label' => sprintf( __( 'Channel
|
349 |
'type' => Controls_Manager::TEXT,
|
350 |
'dynamic' => [
|
351 |
'active' => true,
|
352 |
],
|
353 |
-
'placeholder' => __( 'Enter Channel
|
354 |
'label_block' => true,
|
355 |
'condition' => $yt_condition,
|
356 |
'classes' => $this->pro_class,
|
345 |
'yt_sub_channel',
|
346 |
[
|
347 |
|
348 |
+
'label' => sprintf( __( 'Channel ID %s', 'embedpress' ), $this->pro_text),
|
349 |
'type' => Controls_Manager::TEXT,
|
350 |
'dynamic' => [
|
351 |
'active' => true,
|
352 |
],
|
353 |
+
'placeholder' => __( 'Enter Channel ID', 'embedpress' ),
|
354 |
'label_block' => true,
|
355 |
'condition' => $yt_condition,
|
356 |
'classes' => $this->pro_class,
|
EmbedPress/Ends/Back/Settings/templates/youtube.php
CHANGED
@@ -194,9 +194,9 @@ $yt_sub_count = isset( $yt_settings['yt_sub_count']) ? $yt_settings['yt_sub_coun
|
|
194 |
<h3><?php esc_html_e( "Subscription Button", "embedpress" ); ?></h3>
|
195 |
|
196 |
<div class="form__group">
|
197 |
-
<p class="form__label"><?php esc_html_e( "Channel
|
198 |
<div class="form__control__wrap <?php echo $pro_active ? '': 'isPro'; ?>">
|
199 |
-
<input type="text" class="form__control" data-default="<?php echo esc_attr( $yt_sub_channel ); ?>" value="<?php echo esc_attr( $yt_sub_channel ); ?>" name="yt_sub_channel" <?php echo $pro_active ? '' : 'disabled'; ?> placeholder="Enter Channel
|
200 |
|
201 |
<p><?php esc_html_e( "You can use either your channel link or channel ID to show the subscription button.", "embedpress" ); ?></p>
|
202 |
</div>
|
194 |
<h3><?php esc_html_e( "Subscription Button", "embedpress" ); ?></h3>
|
195 |
|
196 |
<div class="form__group">
|
197 |
+
<p class="form__label"><?php esc_html_e( "Channel ID", "embedpress" ); echo $pro_active ? '': ' <span class="isPro">PRO</span>'; ?> </p>
|
198 |
<div class="form__control__wrap <?php echo $pro_active ? '': 'isPro'; ?>">
|
199 |
+
<input type="text" class="form__control" data-default="<?php echo esc_attr( $yt_sub_channel ); ?>" value="<?php echo esc_attr( $yt_sub_channel ); ?>" name="yt_sub_channel" <?php echo $pro_active ? '' : 'disabled'; ?> placeholder="Enter Channel ID">
|
200 |
|
201 |
<p><?php esc_html_e( "You can use either your channel link or channel ID to show the subscription button.", "embedpress" ); ?></p>
|
202 |
</div>
|
EmbedPress/Includes/Classes/EmbedPress_Notice.php
CHANGED
@@ -357,119 +357,7 @@ class EmbedPress_Notice {
|
|
357 |
public function content(){
|
358 |
$options_data = $this->get_options_data();
|
359 |
$notice = current( $this->next_notice() );
|
360 |
-
?>
|
361 |
-
<style>
|
362 |
-
.wpdeveloper-review-notice {
|
363 |
-
padding: 10px;
|
364 |
-
background-color: #fff;
|
365 |
-
border-radius: 3px;
|
366 |
-
margin: 15px;
|
367 |
-
border-left: 4px solid transparent;
|
368 |
-
display: -webkit-box;
|
369 |
-
display: -ms-flexbox;
|
370 |
-
display: flex;
|
371 |
-
-webkit-box-align: center;
|
372 |
-
-ms-flex-align: center;
|
373 |
-
align-items: center;
|
374 |
-
}
|
375 |
-
.wpdeveloper-review-notice:after {
|
376 |
-
content: "";
|
377 |
-
display: table;
|
378 |
-
clear: both;
|
379 |
-
}
|
380 |
-
.wpdeveloper-update-notice{
|
381 |
-
margin-top: 20px;
|
382 |
-
}
|
383 |
-
.wpdeveloper-update-notice .notice-dismiss {
|
384 |
-
top: auto;
|
385 |
-
}
|
386 |
-
.wpdeveloper-notice-thumbnail {
|
387 |
-
width: 40px;
|
388 |
-
float: left;
|
389 |
-
padding: 5px 5px 5px 10px;
|
390 |
-
text-align: center;
|
391 |
-
border-right: 4px solid transparent;
|
392 |
-
}
|
393 |
-
.wpdeveloper-notice-thumbnail img {
|
394 |
-
width: 100%;
|
395 |
-
opacity: 0.85;
|
396 |
-
-webkit-transition: all 0.3s;
|
397 |
-
-o-transition: all 0.3s;
|
398 |
-
transition: all 0.3s;
|
399 |
-
}
|
400 |
-
.wpdeveloper-notice-thumbnail img:hover {
|
401 |
-
opacity: 1;
|
402 |
-
}
|
403 |
|
404 |
-
.wpdeveloper-notice-link {
|
405 |
-
margin: 8px 0 0 0;
|
406 |
-
padding: 0;
|
407 |
-
}
|
408 |
-
.wpdeveloper-notice-link li {
|
409 |
-
display: inline-block;
|
410 |
-
margin-right: 15px;
|
411 |
-
}
|
412 |
-
.wpdeveloper-notice-link li a {
|
413 |
-
display: inline-block;
|
414 |
-
color: #10738b;
|
415 |
-
text-decoration: none;
|
416 |
-
padding-left: 26px;
|
417 |
-
position: relative;
|
418 |
-
}
|
419 |
-
.wpdeveloper-notice-link li a span {
|
420 |
-
position: absolute;
|
421 |
-
left: 0;
|
422 |
-
top: -2px;
|
423 |
-
}
|
424 |
-
.wpdeveloper-notice-message {
|
425 |
-
padding: 10px;
|
426 |
-
}
|
427 |
-
.wpdeveloper-upsale-notice .wpdeveloper-notice-message {
|
428 |
-
display: -webkit-box;
|
429 |
-
display: -ms-flexbox;
|
430 |
-
display: flex;
|
431 |
-
-webkit-box-align: center;
|
432 |
-
-ms-flex-align: center;
|
433 |
-
align-items: center;
|
434 |
-
padding: 10px 0;
|
435 |
-
}
|
436 |
-
.wpdeveloper-upsale-notice .wpdeveloper-notice-message + .notice-dismiss {
|
437 |
-
top: 10px;
|
438 |
-
}
|
439 |
-
.wpdeveloper-upsale-notice #plugin-install-core {
|
440 |
-
margin-left: 10px;
|
441 |
-
}
|
442 |
-
.notice.notice-has-thumbnail {
|
443 |
-
padding-left: 0;
|
444 |
-
display: flex;
|
445 |
-
align-items: center;
|
446 |
-
}
|
447 |
-
.wpdeveloper-upsale-notice {
|
448 |
-
display: -webkit-box;
|
449 |
-
display: -ms-flexbox;
|
450 |
-
display: flex;
|
451 |
-
}
|
452 |
-
.wpdeveloper-upsale-notice .wpdeveloper-notice-thumbnail {
|
453 |
-
padding: 10px;
|
454 |
-
width: 40px;
|
455 |
-
}
|
456 |
-
.wpdeveloper-upsale-notice .wpdeveloper-notice-thumbnail img {
|
457 |
-
width: 32px;
|
458 |
-
}
|
459 |
-
.toplevel_page_eael-settings .wp-menu-image img {
|
460 |
-
max-width: 20px;
|
461 |
-
padding-top: 8px !important;
|
462 |
-
}
|
463 |
-
.wpdeveloper-upsale-notice .wpdeveloper-notice-message .button {
|
464 |
-
margin-left: 15px;
|
465 |
-
}
|
466 |
-
|
467 |
-
#embedpress-settings-wrapper a.embedpress-settings-link {
|
468 |
-
color: #0073aa;
|
469 |
-
}
|
470 |
-
|
471 |
-
</style>
|
472 |
-
<?php
|
473 |
switch( $notice ) {
|
474 |
case 'opt_in' :
|
475 |
do_action('wpdeveloper_optin_notice_for_' . $this->plugin_name );
|
357 |
public function content(){
|
358 |
$options_data = $this->get_options_data();
|
359 |
$notice = current( $this->next_notice() );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
361 |
switch( $notice ) {
|
362 |
case 'opt_in' :
|
363 |
do_action('wpdeveloper_optin_notice_for_' . $this->plugin_name );
|
EmbedPress/Includes/Classes/EmbedPress_Plugin_Usage_Tracker.php
CHANGED
@@ -602,6 +602,11 @@ if( ! class_exists('EmbedPress_Plugin_Usage_Tracker') ) :
|
|
602 |
if( isset( $block_notice[$this->plugin_name] ) ) {
|
603 |
return;
|
604 |
}
|
|
|
|
|
|
|
|
|
|
|
605 |
if ( ! current_user_can( 'manage_options' ) ) {
|
606 |
return;
|
607 |
}
|
@@ -620,7 +625,7 @@ if( ! class_exists('EmbedPress_Plugin_Usage_Tracker') ) :
|
|
620 |
$extra_notice_text = $this->notice_options['extra_notice'];
|
621 |
|
622 |
$output = '';
|
623 |
-
$output .= '<div class="
|
624 |
$output .= '<p>'. $notice_text .'</p>';
|
625 |
$output .= '<div class="wpinsights-data" style="display: none;">';
|
626 |
$output .= '<p>'. $extra_notice_text .'</p>';
|
602 |
if( isset( $block_notice[$this->plugin_name] ) ) {
|
603 |
return;
|
604 |
}
|
605 |
+
|
606 |
+
if( ! \function_exists('wp_get_current_user') ) {
|
607 |
+
require_once ABSPATH . "wp-includes/pluggable.php";
|
608 |
+
}
|
609 |
+
|
610 |
if ( ! current_user_can( 'manage_options' ) ) {
|
611 |
return;
|
612 |
}
|
625 |
$extra_notice_text = $this->notice_options['extra_notice'];
|
626 |
|
627 |
$output = '';
|
628 |
+
$output .= '<div class="embedpress-optin">';
|
629 |
$output .= '<p>'. $notice_text .'</p>';
|
630 |
$output .= '<div class="wpinsights-data" style="display: none;">';
|
631 |
$output .= '<p>'. $extra_notice_text .'</p>';
|
EmbedPress/Includes/Traits/Shared.php
CHANGED
@@ -8,8 +8,12 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
8 |
use \EmbedPress\Includes\Classes\EmbedPress_Plugin_Usage_Tracker;
|
9 |
use \EmbedPress\Includes\Classes\EmbedPress_Notice;
|
10 |
|
|
|
|
|
11 |
trait Shared {
|
12 |
|
|
|
|
|
13 |
|
14 |
/**
|
15 |
* Optional usage tracker
|
@@ -17,7 +21,7 @@ trait Shared {
|
|
17 |
* @since v1.0.0
|
18 |
*/
|
19 |
public function start_plugin_tracking() {
|
20 |
-
$tracker = EmbedPress_Plugin_Usage_Tracker::get_instance( EMBEDPRESS_FILE, [
|
21 |
'opt_in' => true,
|
22 |
'goodbye_form' => true,
|
23 |
'item_id' => '98ba0ac16a4f7b3b940d'
|
@@ -33,108 +37,142 @@ trait Shared {
|
|
33 |
}
|
34 |
|
35 |
public function admin_notice() {
|
36 |
-
$
|
37 |
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
43 |
|
44 |
/**
|
45 |
-
*
|
46 |
-
* Notice will show again in 7 days
|
47 |
*/
|
48 |
-
$
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
$url = $_SERVER['REQUEST_URI'] . $scheme;
|
54 |
-
$notice->links = [
|
55 |
-
'review' => array(
|
56 |
-
'later' => array(
|
57 |
'link' => 'https://wordpress.org/support/plugin/embedpress/reviews/',
|
58 |
'target' => '_blank',
|
59 |
-
'label' => __(
|
60 |
'icon_class' => 'dashicons dashicons-external',
|
61 |
),
|
62 |
-
'allready'
|
63 |
-
'
|
64 |
-
'label' => __( 'I already did', 'embedpress' ),
|
65 |
'icon_class' => 'dashicons dashicons-smiley',
|
66 |
-
'
|
67 |
-
'dismiss' => true
|
68 |
],
|
69 |
),
|
70 |
-
'maybe_later'
|
71 |
-
'
|
72 |
-
'label' => __( 'Maybe Later', 'embedpress' ),
|
73 |
'icon_class' => 'dashicons dashicons-calendar-alt',
|
74 |
-
'
|
75 |
-
'later' => true
|
76 |
],
|
77 |
),
|
78 |
-
'support'
|
79 |
-
'link'
|
80 |
-
'label'
|
81 |
'icon_class' => 'dashicons dashicons-sos',
|
82 |
),
|
83 |
'never_show_again' => array(
|
84 |
-
'
|
85 |
-
'label' => __( 'Never show again', 'embedpress' ),
|
86 |
'icon_class' => 'dashicons dashicons-dismiss',
|
87 |
-
'
|
88 |
-
'dismiss' => true
|
89 |
],
|
90 |
),
|
91 |
-
|
92 |
];
|
93 |
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
*/
|
104 |
-
$notice->classes( 'upsale', 'notice is-dismissible ' );
|
105 |
-
$notice->message( 'upsale', '<p>' . __( 'Thank you for relying on EmbedPress with 60,000 other websites. Checkout our Pro features.', $notice->text_domain ) . '</p>' );
|
106 |
-
|
107 |
-
// Update Notice For PRO Version
|
108 |
-
if ( $this->is_pro_active() && \version_compare( get_embedpress_pro_version(), '2.0.0', '<' ) ) {
|
109 |
-
$notice->classes( 'update', 'notice is-dismissible ' );
|
110 |
-
$notice->message( 'update', '<p>' . __( 'You are using an incompatible version of EmbedPress PRO. Please update to v3.4.0+. <a href="https://essential-addons.com/elementor/docs/manually-update-essential-addons-pro/" target="_blank">Follow manual update guide.</a>', 'embedpress' ) . '</p>' );
|
111 |
-
$notice->thumbnail( 'update', plugins_url( 'assets/images/icon-128x128.png', EMBEDPRESS_PLUGIN_BASENAME ) );
|
112 |
-
}
|
113 |
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
}
|
119 |
|
120 |
-
$
|
121 |
-
'
|
122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
);
|
124 |
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
);
|
133 |
-
if
|
134 |
-
$notice->options_args['notice_will_show']['update'] = $notice->timestamp;
|
135 |
}
|
136 |
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
public function is_pro_active() {
|
8 |
use \EmbedPress\Includes\Classes\EmbedPress_Plugin_Usage_Tracker;
|
9 |
use \EmbedPress\Includes\Classes\EmbedPress_Notice;
|
10 |
|
11 |
+
use PriyoMukul\WPNotice\Notices;
|
12 |
+
|
13 |
trait Shared {
|
14 |
|
15 |
+
private $insights = null;
|
16 |
+
|
17 |
|
18 |
/**
|
19 |
* Optional usage tracker
|
21 |
* @since v1.0.0
|
22 |
*/
|
23 |
public function start_plugin_tracking() {
|
24 |
+
$this->insights = $tracker = EmbedPress_Plugin_Usage_Tracker::get_instance( EMBEDPRESS_FILE, [
|
25 |
'opt_in' => true,
|
26 |
'goodbye_form' => true,
|
27 |
'item_id' => '98ba0ac16a4f7b3b940d'
|
37 |
}
|
38 |
|
39 |
public function admin_notice() {
|
40 |
+
$_assets_url = plugins_url( 'assets/', EMBEDPRESS_PLUGIN_BASENAME );
|
41 |
|
42 |
+
$notices = new Notices([
|
43 |
+
'id' => 'embedpress',
|
44 |
+
'store' => 'options',
|
45 |
+
'storage_key' => 'notices',
|
46 |
+
'version' => '1.0.0',
|
47 |
+
'lifetime' => 3,
|
48 |
+
'styles' => $_assets_url . 'css/admin-notices.css',
|
49 |
+
]);
|
50 |
|
51 |
/**
|
52 |
+
* This is review message and thumbnail.
|
|
|
53 |
*/
|
54 |
+
$_review_notice = [
|
55 |
+
'thumbnail' => $_assets_url . 'images/icon-128x128.png',
|
56 |
+
'html' => '<p>' . __( 'We hope you\'re enjoying EmbedPress! Could you please do us a BIG favor and give it a 5-star rating on WordPress to help us spread the word and boost our motivation?', 'embedpress' ) . '</p>',
|
57 |
+
'links' => [
|
58 |
+
'later' => array(
|
|
|
|
|
|
|
|
|
59 |
'link' => 'https://wordpress.org/support/plugin/embedpress/reviews/',
|
60 |
'target' => '_blank',
|
61 |
+
'label' => __('Ok, you deserve it!', 'wp-scheduled-posts'),
|
62 |
'icon_class' => 'dashicons dashicons-external',
|
63 |
),
|
64 |
+
'allready' => array(
|
65 |
+
'label' => __('I already did', 'wp-scheduled-posts'),
|
|
|
66 |
'icon_class' => 'dashicons dashicons-smiley',
|
67 |
+
'attributes' => [
|
68 |
+
'data-dismiss' => true
|
69 |
],
|
70 |
),
|
71 |
+
'maybe_later' => array(
|
72 |
+
'label' => __('Maybe Later', 'wp-scheduled-posts'),
|
|
|
73 |
'icon_class' => 'dashicons dashicons-calendar-alt',
|
74 |
+
'attributes' => [
|
75 |
+
'data-later' => true
|
76 |
],
|
77 |
),
|
78 |
+
'support' => array(
|
79 |
+
'link' => 'https://wpdeveloper.com/support',
|
80 |
+
'label' => __('I need help', 'wp-scheduled-posts'),
|
81 |
'icon_class' => 'dashicons dashicons-sos',
|
82 |
),
|
83 |
'never_show_again' => array(
|
84 |
+
'label' => __('Never show again', 'wp-scheduled-posts'),
|
|
|
85 |
'icon_class' => 'dashicons dashicons-dismiss',
|
86 |
+
'attributes' => [
|
87 |
+
'data-dismiss' => true
|
88 |
],
|
89 |
),
|
90 |
+
],
|
91 |
];
|
92 |
|
93 |
+
$notices->add(
|
94 |
+
'review',
|
95 |
+
$_review_notice,
|
96 |
+
[
|
97 |
+
'start' => $notices->strtotime( '+15 day' ),
|
98 |
+
'recurrence' => 30,
|
99 |
+
'dismissible' => true,
|
100 |
+
]
|
101 |
+
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
+
$_freedom30_notice= [
|
104 |
+
'thumbnail' => $_assets_url . 'images/freedom30.png',
|
105 |
+
'html' => '<p>'. __( 'Celebrate independence & upgrade to <strong>EmbedPress PRO</strong> with up to <strong>50% OFF</strong> to use all the premium features from today', 'embedpress' ) .' <a class="button button-primary btn-embedpress" target="_blank" href="https://embedpress.com/#pricing">Claim My Offer</a></p>',
|
106 |
+
];
|
|
|
107 |
|
108 |
+
$notices->add(
|
109 |
+
'freedom30',
|
110 |
+
$_freedom30_notice,
|
111 |
+
[
|
112 |
+
'start' => $notices->time(),
|
113 |
+
'expire' => strtotime( '5th July 2022 11:59:59 PM' ),
|
114 |
+
'recurrence' => false,
|
115 |
+
'dismissible' => true,
|
116 |
+
'display_if' => ! is_array( $notices->is_installed( 'embedpress-pro/embedpress-pro.php' ) )
|
117 |
+
]
|
118 |
);
|
119 |
|
120 |
+
ob_start();
|
121 |
+
$this->insights->notice();
|
122 |
+
$opt_in_content = ob_get_clean();
|
123 |
+
|
124 |
+
$notices->add(
|
125 |
+
'optin',
|
126 |
+
$opt_in_content,
|
127 |
+
[
|
128 |
+
'start' => $notices->strtotime( '+20 day' ),
|
129 |
+
'recurrence' => 30,
|
130 |
+
'dismissible' => true,
|
131 |
+
'display_if' => ! is_array( $notices->is_installed( 'embedpress-pro/embedpress-pro.php' ) )
|
132 |
+
]
|
133 |
);
|
134 |
+
if( ! empty( $opt_in_content ) ) {
|
|
|
135 |
}
|
136 |
|
137 |
+
|
138 |
+
$notices->init();
|
139 |
+
|
140 |
+
return;
|
141 |
+
|
142 |
+
/**
|
143 |
+
* This is upsale notice settings
|
144 |
+
* classes for wrapper,
|
145 |
+
* Message message for showing.
|
146 |
+
*/
|
147 |
+
// $notice->classes( 'upsale', 'notice is-dismissible ' );
|
148 |
+
// $notice->message( 'upsale', '<p>' . __( 'Thank you for relying on EmbedPress with 60,000 other websites. Checkout our Pro features.', $notice->text_domain ) . '</p>' );
|
149 |
+
|
150 |
+
// // Update Notice For PRO Version
|
151 |
+
// if ( $this->is_pro_active() && \version_compare( get_embedpress_pro_version(), '2.0.0', '<' ) ) {
|
152 |
+
// $notice->classes( 'update', 'notice is-dismissible ' );
|
153 |
+
// $notice->message( 'update', '<p>' . __( 'You are using an incompatible version of EmbedPress PRO. Please update to v3.4.0+. <a href="https://essential-addons.com/elementor/docs/manually-update-essential-addons-pro/" target="_blank">Follow manual update guide.</a>', 'embedpress' ) . '</p>' );
|
154 |
+
// $notice->thumbnail( 'update', plugins_url( 'assets/images/icon-128x128.png', EMBEDPRESS_PLUGIN_BASENAME ) );
|
155 |
+
// }
|
156 |
+
|
157 |
+
// if ( \version_compare( EMBEDPRESS_VERSION, '3.0.0', '=' ) ) {
|
158 |
+
// $notice->classes( 'update', 'notice is-dismissible ' );
|
159 |
+
// $notice->message( 'update', '<p>' . __( 'EmbedPress 3.0 is here with new features and options, read the details <a href="https://wpdeveloper.com/introducing-embedpress-3.0" target="_blank">here</a>, and check the new setting page. <a href="'. admin_url('admin.php?page=embedpress') .'">Click Here.</a>', 'embedpress' ) . '</p>' );
|
160 |
+
// $notice->thumbnail( 'update', plugins_url( 'assets/images/icon-128x128.png', EMBEDPRESS_PLUGIN_BASENAME ) );
|
161 |
+
// }
|
162 |
+
|
163 |
+
// $notice->upsale_args = array(
|
164 |
+
// 'href' => 'https://embedpress.com/?utm_source=plugin&utm_medium=free&utm_campaign=pro_upgrade#pricing',
|
165 |
+
// 'btn_text' => __( 'Learn More', 'embedpress' ),
|
166 |
+
// );
|
167 |
+
|
168 |
+
// $notice->options_args = array(
|
169 |
+
// 'notice_will_show' => [
|
170 |
+
// 'update' => $notice->timestamp,
|
171 |
+
// 'opt_in' => $notice->makeTime( $notice->timestamp, '3 Day' ),
|
172 |
+
// 'upsale' => $notice->makeTime( $notice->timestamp, '14 Day' ),
|
173 |
+
// 'review' => $notice->makeTime( $notice->timestamp, '7 Day' ), // after 3 days
|
174 |
+
// ],
|
175 |
+
// );
|
176 |
}
|
177 |
|
178 |
public function is_pro_active() {
|
Gutenberg/dist/blocks.editor.build.css
CHANGED
@@ -1,4 +1,4 @@
|
|
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%}.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{margin:0}@media screen and (max-width: 782px){.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{height:250px}}.embedpress-event .link{color:#0098ab}.embedpress-event .visibility--a11yHide{border:0;clip:rect(0 0 0 0);position:absolute;overflow:hidden;margin:-1px;padding:0;width:1px;height:1px}.embedpress-event .text--small{font-size:14px;margin:0}.embedpress-event .flex{display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box}.embedpress-event .flex--wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}.embedpress-event .flex--row{-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.embedpress-event .flex-item{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;width:auto;min-width:0;-webkit-box-sizing:border-box;box-sizing:border-box}.embedpress-event .flex-item--shrink{-ms-flex-preferred-size:auto;flex-basis:auto;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;width:auto}.embedpress-event .flex--row>.flex-item:first-child{padding-left:0}.embedpress-event .text--bold{font-weight:700}.embedpress-event h1,.embedpress-event h2,.embedpress-event h3,.embedpress-event h4,.embedpress-event h5,.embedpress-event h6{font-size:inherit}.embedpress-event .ep-event--title{font-size:32px;font-weight:700}.embedpress-event .ep-event--date{color:#757575;font-weight:400;font-size:16px}.embedpress-event .ep-event--host{margin-top:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:20px}.ep-event--host .avatar-print{border-radius:50%;height:50px;width:50px}.embedpress-event img.avatar--person{background-image:none !important;background-repeat:no-repeat;background-position:50%;background-size:cover;border-radius:50%;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.event-info-hosts-text{padding-left:20px;font-size:16px;font-weight:400}.embedpress-event .event-description{margin-top:20px}.text--sectionTitle{font-size:20px;line-height:28px}.ep-event--attendees{margin-top:50px}.ep-event--attendees>.flex{margin-bottom:20px}.ep-event--attendees .gridList{list-style:none;margin:0 -16px 0 0;padding:0}.ep-event--attendees .gridList-item{width:auto}.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.ep-event--attendees .groupMember-name{line-height:1.2 !important}.ep-event--attendees .avatar--person{margin-bottom:15px;display:inline-block;border-radius:50%}.ep-event--attendees img.avatar-print{border-radius:50%}.ep-event--attendees .groupMember-role{font-size:12px;color:#757575;padding-top:2px;margin:0}.ep-event--attendees .groupMember{min-height:100%;min-width:128px;padding-left:8px;padding-right:8px}.embedpress-event .align--center{text-align:center}.embedpress-event .card{background:#fff;background-clip:padding-box;background-size:cover;border:1px solid rgba(46,62,72,0.12);border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;min-height:100%;padding:16px 16px 18px;position:relative;white-space:normal}.embedpress-event .card--hasHoverShadow{-webkit-transition:-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);-o-transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}.embedpress-event .ep-event-group-link{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;background:#ffffff;border-radius:8px;padding:20px;margin-bottom:20px;border:1px solid rgba(46,62,72,0.12)}.embedpress-event .ep-event-group--name{padding-left:20px;font-size:14px;line-height:1.45;margin:0;width:70%;word-break:break-word}.embedpress-event .ep-event-group--image{-o-object-fit:cover;object-fit:cover;width:56px;height:56px;border-radius:4px}.embedpress-event .ep-event-time-location{background:#ffffff;border-radius:8px;padding:16px 20px 0 20px;border:1px solid rgba(46,62,72,0.12)}.embedpress-event .ep-event-time-location .ep-event-datetime,.embedpress-event .ep-event-time-location .ep-event-location{padding-bottom:20px}.embedpress-event .ep-event-location .wrap--singleLine--truncate,.embedpress-event .ep-event-time-location .ep-event-datetime{font-size:15px;line-height:1.5;color:#2e3e48;font-style:normal;margin:0}.embedpress-event .ep-event-location address{font-style:normal;margin:0}.embedpress-event .ep-event-location .venueDisplay-venue-address{font-style:normal;color:#757575;margin:0}.embedpress-event .ep-event-location p{line-height:20px}.ep-event--attendees .gridList-item{-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;font-size:1rem;margin:0;vertical-align:top;width:50%}.gridList-itemInner{-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;padding:0 16px 16px 0}@media only screen and (min-width: 530px){.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}}@media only screen and (min-width: 640px){.embedpress-event .card{padding:18px 18px 20px}.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}}.editor-block-list__block[data-align=right]>.editor-block-list__block-edit{float:right}.wp-block[data-align=left],.wp-block[data-align=right]{height:auto !important}@media only screen and (min-width: 482px){.editor-styles-wrapper .wp-block[data-align=right]>*,.editor-styles-wrapper .wp-block[data-align=left]>*{max-width:100% !important}}.editor-styles-wrapper .wp-block[data-align=center]{text-align:center}.editor-styles-wrapper .wp-block[data-align=center]>*{display:inline-block}.editor-styles-wrapper .wp-block::after,.clear::after{content:'';display:block;clear:both;min-height:1px}.alignleft{display:inline;float:left;margin-right:1.5em}.alignright{display:inline;float:right;margin-left:1.5em}.aligncenter{clear:both;display:block;margin-left:auto;margin-right:auto}
|
3 |
.embedpress-document-editmode .components-placeholder__instructions:after{content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";white-space:pre}.wp-block-embedpress-embedpress-pdf+*{clear:both}.embedpress-document-editmode .components-placeholder__instructions:after{display:none !important}
|
4 |
.wp-block-embedpress-embedpress iframe,.wp-block-embedpress-calendar iframe{max-width:100%}.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{margin:0}@media screen and (max-width: 782px){.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{height:250px}}.editor-block-list__block[data-align=right]>.editor-block-list__block-edit{float:right}.wp-block[data-align=left],.wp-block[data-align=right]{height:auto !important}@media only screen and (min-width: 482px){.editor-styles-wrapper .wp-block[data-align=right]>*,.editor-styles-wrapper .wp-block[data-align=left]>*{max-width:100% !important}}.editor-styles-wrapper .wp-block[data-align=center]{text-align:center}.editor-styles-wrapper .wp-block[data-align=center]>*{display:inline-block}.editor-styles-wrapper .wp-block::after,.clear::after{content:'';display:block;clear:both;min-height:1px}.alignleft{display:inline;float:left;margin-right:1.5em}.alignright{display:inline;float:right;margin-left:1.5em}.aligncenter{clear:both;display:block;margin-left:auto;margin-right:auto}
|
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%}.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{margin:0}@media screen and (max-width: 782px){.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{height:250px}}.wp-block-embedpress-embedpress .components-placeholder.wp-block-embed{min-width:550px}.editor-styles-wrapper .block-editor-block-list__layout.is-root-container>.wp-block-embedpress-embedpress{max-width:1200px !important}.wp-block-embedpress-embedpress{max-width:100% !important}.embedpress-event .link{color:#0098ab}.embedpress-event .visibility--a11yHide{border:0;clip:rect(0 0 0 0);position:absolute;overflow:hidden;margin:-1px;padding:0;width:1px;height:1px}.embedpress-event .text--small{font-size:14px;margin:0}.embedpress-event .flex{display:-ms-flexbox;display:flex;-webkit-box-sizing:border-box;box-sizing:border-box}.embedpress-event .flex--wrap{-ms-flex-wrap:wrap;flex-wrap:wrap}.embedpress-event .flex--row{-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;display:-ms-flexbox;display:flex;-ms-flex-pack:start;justify-content:flex-start;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:nowrap;flex-wrap:nowrap}.embedpress-event .flex-item{-ms-flex-preferred-size:0;flex-basis:0;-ms-flex-positive:1;flex-grow:1;width:auto;min-width:0;-webkit-box-sizing:border-box;box-sizing:border-box}.embedpress-event .flex-item--shrink{-ms-flex-preferred-size:auto;flex-basis:auto;-ms-flex-positive:0;flex-grow:0;-ms-flex-negative:0;flex-shrink:0;width:auto}.embedpress-event .flex--row>.flex-item:first-child{padding-left:0}.embedpress-event .text--bold{font-weight:700}.embedpress-event h1,.embedpress-event h2,.embedpress-event h3,.embedpress-event h4,.embedpress-event h5,.embedpress-event h6{font-size:inherit}.embedpress-event .ep-event--title{font-size:32px;font-weight:700}.embedpress-event .ep-event--date{color:#757575;font-weight:400;font-size:16px}.embedpress-event .ep-event--host{margin-top:20px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;margin-bottom:20px}.ep-event--host .avatar-print{border-radius:50%;height:50px;width:50px}.embedpress-event img.avatar--person{background-image:none !important;background-repeat:no-repeat;background-position:50%;background-size:cover;border-radius:50%;-webkit-box-sizing:border-box;box-sizing:border-box;vertical-align:middle}.event-info-hosts-text{padding-left:20px;font-size:16px;font-weight:400}.embedpress-event .event-description{margin-top:20px}.text--sectionTitle{font-size:20px;line-height:28px}.ep-event--attendees{margin-top:50px}.ep-event--attendees>.flex{margin-bottom:20px}.ep-event--attendees .gridList{list-style:none;margin:0 -16px 0 0;padding:0}.ep-event--attendees .gridList-item{width:auto}.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 50%;flex:0 0 50%;max-width:50%}.ep-event--attendees .groupMember-name{line-height:1.2 !important}.ep-event--attendees .avatar--person{margin-bottom:15px;display:inline-block;border-radius:50%}.ep-event--attendees img.avatar-print{border-radius:50%}.ep-event--attendees .groupMember-role{font-size:12px;color:#757575;padding-top:2px;margin:0}.ep-event--attendees .groupMember{min-height:100%;min-width:128px;padding-left:8px;padding-right:8px}.embedpress-event .align--center{text-align:center}.embedpress-event .card{background:#fff;background-clip:padding-box;background-size:cover;border:1px solid rgba(46,62,72,0.12);border-radius:8px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;min-height:100%;padding:16px 16px 18px;position:relative;white-space:normal}.embedpress-event .card--hasHoverShadow{-webkit-transition:-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);-o-transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);transition:box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),-webkit-transform 0.25s cubic-bezier(0.4, 0, 0.2, 1)}.embedpress-event .ep-event-group-link{display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-align:center;align-items:center;background:#ffffff;border-radius:8px;padding:20px;margin-bottom:20px;border:1px solid rgba(46,62,72,0.12)}.embedpress-event .ep-event-group--name{padding-left:20px;font-size:14px;line-height:1.45;margin:0;width:70%;word-break:break-word}.embedpress-event .ep-event-group--image{-o-object-fit:cover;object-fit:cover;width:56px;height:56px;border-radius:4px}.embedpress-event .ep-event-time-location{background:#ffffff;border-radius:8px;padding:16px 20px 0 20px;border:1px solid rgba(46,62,72,0.12)}.embedpress-event .ep-event-time-location .ep-event-datetime,.embedpress-event .ep-event-time-location .ep-event-location{padding-bottom:20px}.embedpress-event .ep-event-location .wrap--singleLine--truncate,.embedpress-event .ep-event-time-location .ep-event-datetime{font-size:15px;line-height:1.5;color:#2e3e48;font-style:normal;margin:0}.embedpress-event .ep-event-location address{font-style:normal;margin:0}.embedpress-event .ep-event-location .venueDisplay-venue-address{font-style:normal;color:#757575;margin:0}.embedpress-event .ep-event-location p{line-height:20px}.ep-event--attendees .gridList-item{-webkit-box-sizing:border-box;box-sizing:border-box;display:inline-block;font-size:1rem;margin:0;vertical-align:top;width:50%}.gridList-itemInner{-webkit-box-sizing:border-box;box-sizing:border-box;height:100%;padding:0 16px 16px 0}@media only screen and (min-width: 530px){.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 33.333333%;flex:0 0 33.333333%;max-width:33.333333%}}@media only screen and (min-width: 640px){.embedpress-event .card{padding:18px 18px 20px}.ep-event--attendees .gridList--autoHeight--has4>.gridList-item{-ms-flex:0 0 25%;flex:0 0 25%;max-width:25%}}.editor-block-list__block[data-align=right]>.editor-block-list__block-edit{float:right}.wp-block[data-align=left],.wp-block[data-align=right]{height:auto !important}@media only screen and (min-width: 482px){.editor-styles-wrapper .wp-block[data-align=right]>*,.editor-styles-wrapper .wp-block[data-align=left]>*{max-width:100% !important}}.editor-styles-wrapper .wp-block[data-align=center]{text-align:center}.editor-styles-wrapper .wp-block[data-align=center]>*{display:inline-block}.editor-styles-wrapper .wp-block::after,.clear::after{content:'';display:block;clear:both;min-height:1px}.alignleft{display:inline;float:left;margin-right:1.5em}.alignright{display:inline;float:right;margin-left:1.5em}.aligncenter{clear:both;display:block;margin-left:auto;margin-right:auto}
|
3 |
.embedpress-document-editmode .components-placeholder__instructions:after{content:"\ASupported File Type: PDF, DOC, PPT, XLS etc ";white-space:pre}.wp-block-embedpress-embedpress-pdf+*{clear:both}.embedpress-document-editmode .components-placeholder__instructions:after{display:none !important}
|
4 |
.wp-block-embedpress-embedpress iframe,.wp-block-embedpress-calendar iframe{max-width:100%}.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{margin:0}@media screen and (max-width: 782px){.block-editor-block-list__layout .wp-block figure,.block-editor-block-list__layout .wp-block iframe{height:250px}}.editor-block-list__block[data-align=right]>.editor-block-list__block-edit{float:right}.wp-block[data-align=left],.wp-block[data-align=right]{height:auto !important}@media only screen and (min-width: 482px){.editor-styles-wrapper .wp-block[data-align=right]>*,.editor-styles-wrapper .wp-block[data-align=left]>*{max-width:100% !important}}.editor-styles-wrapper .wp-block[data-align=center]{text-align:center}.editor-styles-wrapper .wp-block[data-align=center]>*{display:inline-block}.editor-styles-wrapper .wp-block::after,.clear::after{content:'';display:block;clear:both;min-height:1px}.alignleft{display:inline;float:left;margin-right:1.5em}.alignright{display:inline;float:right;margin-left:1.5em}.aligncenter{clear:both;display:block;margin-left:auto;margin-right:auto}
|
Gutenberg/dist/blocks.style.build.css
CHANGED
@@ -1,4 +1,4 @@
|
|
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%}.embedpress-gutenberg-wrapper.alignright{max-width:100%}.ose-the-new-york-times iframe{min-height:500px;max-height:100%}body.page .flexia-wrapper>.content-area{padding:0 !important}.flexia-wrapper.flexia-container>.content-area{margin:0 !important}.flexia-wrapper.flexia-container>.content-area .embedpress-gutenberg-wrapper{margin:0 auto}@media only screen and (min-width: 482px){.entry-content>.embedpress-gutenberg-wrapper.alignright,.entry-content>.embedpress-gutenberg-wrapper.alignleft,.embedpress-gutenberg-wrapper.alignright,.embedpress-gutenberg-wrapper.alignleft{max-width:100%}}.clear::after{content:'';display:block;clear:both;min-height:1px}.embedpress-gutenberg-wrapper .alignleft,.embedpress-gutenberg-wrapper .alignright,.embedpress-gutenberg-wrapper .aligncenter{float:none;display:block}.embedpress-gutenberg-wrapper .alignright{text-align:right}.embedpress-gutenberg-wrapper .alignleft{text-align:left}.embedpress-gutenberg-wrapper .aligncenter{clear:both;display:block;float:none;margin-right:auto;margin-left:auto;text-align:center}.embedpress-gutenberg-wrapper .ose-embedpress-responsive{display:inline-block}
|
3 |
.pdfobject-container{height:600px;width:600px;margin:0 auto}.embedpress-el-powered{text-align:center;margin-top:10px !important;font-size:16px !important;font-weight:700}.embedpress-embed-document iframe,[data-type="embedpress/document"] iframe{margin:0 auto;display:block}.embedpress-embed-document{max-width:100%}.embedpress-document-editmode .components-form-file-upload{display:none !important}.wp-block-embedpress-embedpress-pdf+*{clear:both}
|
4 |
.embedpress-calendar-gutenberg{margin:30px auto}.embedpress-calendar-gutenberg iframe{max-width:100%}.embedpress-calendar-gutenberg.alignright{max-width:100%}body.page .flexia-wrapper>.content-area{padding:0 !important}.flexia-wrapper.flexia-container>.content-area{margin:0 !important}.flexia-wrapper.flexia-container>.content-area .embedpress-calendar-gutenberg{margin:0 auto}@media only screen and (min-width: 482px){.entry-content>.embedpress-calendar-gutenberg.alignright,.entry-content>.embedpress-calendar-gutenberg.alignleft,.embedpress-calendar-gutenberg.alignright,.embedpress-calendar-gutenberg.alignleft{max-width:100%}}.clear::after{content:'';display:block;clear:both;min-height:1px}
|
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%}.embedpress-gutenberg-wrapper.alignright{max-width:100%}.ose-the-new-york-times iframe{min-height:500px;max-height:100%}body.page .flexia-wrapper>.content-area{padding:0 !important}.flexia-wrapper.flexia-container>.content-area{margin:0 !important}.flexia-wrapper.flexia-container>.content-area .embedpress-gutenberg-wrapper{margin:0 auto}@media only screen and (min-width: 482px){.entry-content>.embedpress-gutenberg-wrapper.alignright,.entry-content>.embedpress-gutenberg-wrapper.alignleft,.embedpress-gutenberg-wrapper.alignright,.embedpress-gutenberg-wrapper.alignleft{max-width:100%}}.clear::after{content:'';display:block;clear:both;min-height:1px}.embedpress-gutenberg-wrapper .alignleft,.embedpress-gutenberg-wrapper .alignright,.embedpress-gutenberg-wrapper .aligncenter{float:none;display:block}.embedpress-gutenberg-wrapper .alignright{text-align:right}.embedpress-gutenberg-wrapper .alignleft{text-align:left}.embedpress-gutenberg-wrapper .aligncenter{clear:both;display:block;float:none;margin-right:auto;margin-left:auto;text-align:center}.embedpress-gutenberg-wrapper .ose-embedpress-responsive{display:inline-block}.embedpress-gutenberg-wrapper{max-width:100% !important}
|
3 |
.pdfobject-container{height:600px;width:600px;margin:0 auto}.embedpress-el-powered{text-align:center;margin-top:10px !important;font-size:16px !important;font-weight:700}.embedpress-embed-document iframe,[data-type="embedpress/document"] iframe{margin:0 auto;display:block}.embedpress-embed-document{max-width:100%}.embedpress-document-editmode .components-form-file-upload{display:none !important}.wp-block-embedpress-embedpress-pdf+*{clear:both}
|
4 |
.embedpress-calendar-gutenberg{margin:30px auto}.embedpress-calendar-gutenberg iframe{max-width:100%}.embedpress-calendar-gutenberg.alignright{max-width:100%}body.page .flexia-wrapper>.content-area{padding:0 !important}.flexia-wrapper.flexia-container>.content-area{margin:0 !important}.flexia-wrapper.flexia-container>.content-area .embedpress-calendar-gutenberg{margin:0 auto}@media only screen and (min-width: 482px){.entry-content>.embedpress-calendar-gutenberg.alignright,.entry-content>.embedpress-calendar-gutenberg.alignleft,.embedpress-calendar-gutenberg.alignright,.embedpress-calendar-gutenberg.alignleft{max-width:100%}}.clear::after{content:'';display:block;clear:both;min-height:1px}
|
assets/css/admin-notices.css
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#wpnotice-embedpress-optin {
|
2 |
+
display: block !important;
|
3 |
+
}
|
4 |
+
|
5 |
+
.wpnotice-content-wrapper > p {
|
6 |
+
margin-top: 0px;
|
7 |
+
margin-bottom: 0px;
|
8 |
+
}
|
9 |
+
|
10 |
+
#wpnotice-embedpress-freedom30 .wpnotice-thumbnail-wrapper {
|
11 |
+
padding: 10px 0px 10px 0px !important;
|
12 |
+
}
|
13 |
+
|
14 |
+
.wpnotice-thumbnail-wrapper img {
|
15 |
+
display: block;
|
16 |
+
}
|
17 |
+
|
18 |
+
.button.button-primary.btn-embedpress {
|
19 |
+
background-color: #5B4E96;
|
20 |
+
}
|
21 |
+
|
22 |
+
.btn-embedpress:focus {
|
23 |
+
outline: none;
|
24 |
+
box-shadow: none;
|
25 |
+
}
|
26 |
+
|
27 |
+
|
28 |
+
.notice-embedpress-review {
|
29 |
+
padding: 10px;
|
30 |
+
background-color: #fff;
|
31 |
+
border-radius: 3px;
|
32 |
+
margin: 15px;
|
33 |
+
display: -webkit-box;
|
34 |
+
display: -ms-flexbox;
|
35 |
+
display: flex;
|
36 |
+
-webkit-box-align: center;
|
37 |
+
-ms-flex-align: center;
|
38 |
+
align-items: center;
|
39 |
+
}
|
40 |
+
.notice-embedpress-review:after {
|
41 |
+
content: "";
|
42 |
+
display: table;
|
43 |
+
clear: both;
|
44 |
+
}
|
45 |
+
.wpdeveloper-update-notice{
|
46 |
+
margin-top: 20px;
|
47 |
+
}
|
48 |
+
.wpdeveloper-update-notice .notice-dismiss {
|
49 |
+
top: auto;
|
50 |
+
}
|
51 |
+
.wpdeveloper-notice-thumbnail {
|
52 |
+
width: 40px;
|
53 |
+
float: left;
|
54 |
+
padding: 5px 5px 5px 10px;
|
55 |
+
text-align: center;
|
56 |
+
border-right: 4px solid transparent;
|
57 |
+
}
|
58 |
+
.wpdeveloper-notice-thumbnail img {
|
59 |
+
width: 100%;
|
60 |
+
opacity: 0.85;
|
61 |
+
-webkit-transition: all 0.3s;
|
62 |
+
-o-transition: all 0.3s;
|
63 |
+
transition: all 0.3s;
|
64 |
+
}
|
65 |
+
.wpdeveloper-notice-thumbnail img:hover {
|
66 |
+
opacity: 1;
|
67 |
+
}
|
68 |
+
|
69 |
+
.notice-links {
|
70 |
+
margin: 8px 0 0 0;
|
71 |
+
padding: 0;
|
72 |
+
}
|
73 |
+
.notice-links li {
|
74 |
+
display: inline-block;
|
75 |
+
margin-right: 15px;
|
76 |
+
}
|
77 |
+
.notice-links li a {
|
78 |
+
display: inline-block;
|
79 |
+
text-decoration: none;
|
80 |
+
position: relative;
|
81 |
+
}
|
82 |
+
|
83 |
+
.wpdeveloper-notice-message {
|
84 |
+
padding: 10px;
|
85 |
+
}
|
86 |
+
.wpdeveloper-upsale-notice .wpdeveloper-notice-message {
|
87 |
+
display: -webkit-box;
|
88 |
+
display: -ms-flexbox;
|
89 |
+
display: flex;
|
90 |
+
-webkit-box-align: center;
|
91 |
+
-ms-flex-align: center;
|
92 |
+
align-items: center;
|
93 |
+
padding: 10px 0;
|
94 |
+
}
|
95 |
+
.wpdeveloper-upsale-notice .wpdeveloper-notice-message + .notice-dismiss {
|
96 |
+
top: 10px;
|
97 |
+
}
|
98 |
+
.wpdeveloper-upsale-notice #plugin-install-core {
|
99 |
+
margin-left: 10px;
|
100 |
+
}
|
101 |
+
.notice.notice-has-thumbnail {
|
102 |
+
padding-left: 0;
|
103 |
+
display: flex;
|
104 |
+
align-items: center;
|
105 |
+
}
|
106 |
+
.wpdeveloper-upsale-notice {
|
107 |
+
display: -webkit-box;
|
108 |
+
display: -ms-flexbox;
|
109 |
+
display: flex;
|
110 |
+
}
|
111 |
+
.wpdeveloper-upsale-notice .wpdeveloper-notice-thumbnail {
|
112 |
+
padding: 10px;
|
113 |
+
width: 40px;
|
114 |
+
}
|
115 |
+
.wpdeveloper-upsale-notice .wpdeveloper-notice-thumbnail img {
|
116 |
+
width: 32px;
|
117 |
+
}
|
118 |
+
.toplevel_page_eael-settings .wp-menu-image img {
|
119 |
+
max-width: 20px;
|
120 |
+
padding-top: 8px !important;
|
121 |
+
}
|
122 |
+
.wpdeveloper-upsale-notice .wpdeveloper-notice-message .button {
|
123 |
+
margin-left: 15px;
|
124 |
+
}
|
125 |
+
|
126 |
+
#embedpress-settings-wrapper a.embedpress-settings-link {
|
127 |
+
color: #0073aa;
|
128 |
+
}
|
assets/images/freedom30.png
ADDED
Binary file
|
embedpress.php
CHANGED
@@ -5,7 +5,7 @@
|
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.com
|
8 |
-
* Version: 3.4.
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
5 |
* Description: EmbedPress lets you embed videos, images, posts, audio, maps and upload PDF, DOC, PPT & all other types of content into your WordPress site with one-click and showcase it beautifully for the visitors. 100+ sources supported.
|
6 |
* Author: WPDeveloper
|
7 |
* Author URI: https://wpdeveloper.com
|
8 |
+
* Version: 3.4.2
|
9 |
* Text Domain: embedpress
|
10 |
* Domain Path: /languages
|
11 |
*
|
includes.php
CHANGED
@@ -22,7 +22,7 @@ if ( ! defined('EMBEDPRESS_PLG_NAME')) {
|
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
-
define('EMBEDPRESS_VERSION', "3.4.
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
22 |
}
|
23 |
|
24 |
if ( ! defined('EMBEDPRESS_VERSION')) {
|
25 |
+
define('EMBEDPRESS_VERSION', "3.4.2");
|
26 |
/**
|
27 |
* @deprecated 2.2.0
|
28 |
*/
|
readme.txt
CHANGED
@@ -6,7 +6,7 @@ Tags: embed, embed youtube, gutenberg embed, pdf, doc, docs, ppt, elementor embe
|
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 6.0
|
8 |
Requires PHP: 5.6
|
9 |
-
Stable tag: 3.4.
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
@@ -382,8 +382,13 @@ Not at all. You can set up everything your team needs without any coding knowled
|
|
382 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
383 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
384 |
|
|
|
|
|
|
|
|
|
|
|
385 |
= [3.4.1] - 2022-06-07 =
|
386 |
-
* Fixed: Fatal error if Elementor editor is deactivated.
|
387 |
|
388 |
= [3.4.0] - 2022-06-07 =
|
389 |
* Added: PDF embedding support in Classic and other editors.
|
6 |
Requires at least: 4.6
|
7 |
Tested up to: 6.0
|
8 |
Requires PHP: 5.6
|
9 |
+
Stable tag: 3.4.2
|
10 |
License: GPLv3 or later
|
11 |
License URI: https://opensource.org/licenses/GPL-3.0
|
12 |
|
382 |
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
383 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
384 |
|
385 |
+
= [3.4.2] - 2022-06-30 =
|
386 |
+
* Fixed: Hight-Width wasn’t working with WordPress default themes in Gutenberg.
|
387 |
+
* Fixed: Theme dependency with EmbedPress block in Gutenberg.
|
388 |
+
* Few minor bug fix and improvements.
|
389 |
+
|
390 |
= [3.4.1] - 2022-06-07 =
|
391 |
+
* Fixed: Fatal error if Elementor editor is deactivated.
|
392 |
|
393 |
= [3.4.0] - 2022-06-07 =
|
394 |
* Added: PDF embedding support in Classic and other editors.
|
vendor/composer/ClassLoader.php
CHANGED
@@ -42,21 +42,75 @@ namespace Composer\Autoload;
|
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
|
|
|
|
|
|
45 |
// PSR-4
|
|
|
|
|
|
|
|
|
46 |
private $prefixLengthsPsr4 = array();
|
|
|
|
|
|
|
|
|
47 |
private $prefixDirsPsr4 = array();
|
|
|
|
|
|
|
|
|
48 |
private $fallbackDirsPsr4 = array();
|
49 |
|
50 |
// PSR-0
|
|
|
|
|
|
|
|
|
51 |
private $prefixesPsr0 = array();
|
|
|
|
|
|
|
|
|
52 |
private $fallbackDirsPsr0 = array();
|
53 |
|
|
|
54 |
private $useIncludePath = false;
|
|
|
|
|
|
|
|
|
|
|
55 |
private $classMap = array();
|
|
|
|
|
56 |
private $classMapAuthoritative = false;
|
|
|
|
|
|
|
|
|
|
|
57 |
private $missingClasses = array();
|
|
|
|
|
58 |
private $apcuPrefix;
|
59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
public function getPrefixes()
|
61 |
{
|
62 |
if (!empty($this->prefixesPsr0)) {
|
@@ -66,28 +120,47 @@ class ClassLoader
|
|
66 |
return array();
|
67 |
}
|
68 |
|
|
|
|
|
|
|
|
|
69 |
public function getPrefixesPsr4()
|
70 |
{
|
71 |
return $this->prefixDirsPsr4;
|
72 |
}
|
73 |
|
|
|
|
|
|
|
|
|
74 |
public function getFallbackDirs()
|
75 |
{
|
76 |
return $this->fallbackDirsPsr0;
|
77 |
}
|
78 |
|
|
|
|
|
|
|
|
|
79 |
public function getFallbackDirsPsr4()
|
80 |
{
|
81 |
return $this->fallbackDirsPsr4;
|
82 |
}
|
83 |
|
|
|
|
|
|
|
|
|
84 |
public function getClassMap()
|
85 |
{
|
86 |
return $this->classMap;
|
87 |
}
|
88 |
|
89 |
/**
|
90 |
-
* @param
|
|
|
|
|
|
|
91 |
*/
|
92 |
public function addClassMap(array $classMap)
|
93 |
{
|
@@ -102,9 +175,11 @@ class ClassLoader
|
|
102 |
* Registers a set of PSR-0 directories for a given prefix, either
|
103 |
* appending or prepending to the ones previously set for this prefix.
|
104 |
*
|
105 |
-
* @param string
|
106 |
-
* @param
|
107 |
-
* @param bool
|
|
|
|
|
108 |
*/
|
109 |
public function add($prefix, $paths, $prepend = false)
|
110 |
{
|
@@ -147,11 +222,13 @@ class ClassLoader
|
|
147 |
* Registers a set of PSR-4 directories for a given namespace, either
|
148 |
* appending or prepending to the ones previously set for this namespace.
|
149 |
*
|
150 |
-
* @param string
|
151 |
-
* @param
|
152 |
-
* @param bool
|
153 |
*
|
154 |
* @throws \InvalidArgumentException
|
|
|
|
|
155 |
*/
|
156 |
public function addPsr4($prefix, $paths, $prepend = false)
|
157 |
{
|
@@ -195,8 +272,10 @@ class ClassLoader
|
|
195 |
* Registers a set of PSR-0 directories for a given prefix,
|
196 |
* replacing any others previously set for this prefix.
|
197 |
*
|
198 |
-
* @param string
|
199 |
-
* @param
|
|
|
|
|
200 |
*/
|
201 |
public function set($prefix, $paths)
|
202 |
{
|
@@ -211,10 +290,12 @@ class ClassLoader
|
|
211 |
* Registers a set of PSR-4 directories for a given namespace,
|
212 |
* replacing any others previously set for this namespace.
|
213 |
*
|
214 |
-
* @param string
|
215 |
-
* @param
|
216 |
*
|
217 |
* @throws \InvalidArgumentException
|
|
|
|
|
218 |
*/
|
219 |
public function setPsr4($prefix, $paths)
|
220 |
{
|
@@ -234,6 +315,8 @@ class ClassLoader
|
|
234 |
* Turns on searching the include path for class files.
|
235 |
*
|
236 |
* @param bool $useIncludePath
|
|
|
|
|
237 |
*/
|
238 |
public function setUseIncludePath($useIncludePath)
|
239 |
{
|
@@ -256,6 +339,8 @@ class ClassLoader
|
|
256 |
* that have not been registered with the class map.
|
257 |
*
|
258 |
* @param bool $classMapAuthoritative
|
|
|
|
|
259 |
*/
|
260 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
261 |
{
|
@@ -276,6 +361,8 @@ class ClassLoader
|
|
276 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
277 |
*
|
278 |
* @param string|null $apcuPrefix
|
|
|
|
|
279 |
*/
|
280 |
public function setApcuPrefix($apcuPrefix)
|
281 |
{
|
@@ -296,25 +383,44 @@ class ClassLoader
|
|
296 |
* Registers this instance as an autoloader.
|
297 |
*
|
298 |
* @param bool $prepend Whether to prepend the autoloader or not
|
|
|
|
|
299 |
*/
|
300 |
public function register($prepend = false)
|
301 |
{
|
302 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
303 |
}
|
304 |
|
305 |
/**
|
306 |
* Unregisters this instance as an autoloader.
|
|
|
|
|
307 |
*/
|
308 |
public function unregister()
|
309 |
{
|
310 |
spl_autoload_unregister(array($this, 'loadClass'));
|
|
|
|
|
|
|
|
|
311 |
}
|
312 |
|
313 |
/**
|
314 |
* Loads the given class or interface.
|
315 |
*
|
316 |
* @param string $class The name of the class
|
317 |
-
* @return
|
318 |
*/
|
319 |
public function loadClass($class)
|
320 |
{
|
@@ -323,6 +429,8 @@ class ClassLoader
|
|
323 |
|
324 |
return true;
|
325 |
}
|
|
|
|
|
326 |
}
|
327 |
|
328 |
/**
|
@@ -367,6 +475,21 @@ class ClassLoader
|
|
367 |
return $file;
|
368 |
}
|
369 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
370 |
private function findFileWithExtension($class, $ext)
|
371 |
{
|
372 |
// PSR-4 lookup
|
@@ -438,6 +561,10 @@ class ClassLoader
|
|
438 |
* Scope isolated include.
|
439 |
*
|
440 |
* Prevents access to $this/self from included files.
|
|
|
|
|
|
|
|
|
441 |
*/
|
442 |
function includeFile($file)
|
443 |
{
|
42 |
*/
|
43 |
class ClassLoader
|
44 |
{
|
45 |
+
/** @var ?string */
|
46 |
+
private $vendorDir;
|
47 |
+
|
48 |
// PSR-4
|
49 |
+
/**
|
50 |
+
* @var array[]
|
51 |
+
* @psalm-var array<string, array<string, int>>
|
52 |
+
*/
|
53 |
private $prefixLengthsPsr4 = array();
|
54 |
+
/**
|
55 |
+
* @var array[]
|
56 |
+
* @psalm-var array<string, array<int, string>>
|
57 |
+
*/
|
58 |
private $prefixDirsPsr4 = array();
|
59 |
+
/**
|
60 |
+
* @var array[]
|
61 |
+
* @psalm-var array<string, string>
|
62 |
+
*/
|
63 |
private $fallbackDirsPsr4 = array();
|
64 |
|
65 |
// PSR-0
|
66 |
+
/**
|
67 |
+
* @var array[]
|
68 |
+
* @psalm-var array<string, array<string, string[]>>
|
69 |
+
*/
|
70 |
private $prefixesPsr0 = array();
|
71 |
+
/**
|
72 |
+
* @var array[]
|
73 |
+
* @psalm-var array<string, string>
|
74 |
+
*/
|
75 |
private $fallbackDirsPsr0 = array();
|
76 |
|
77 |
+
/** @var bool */
|
78 |
private $useIncludePath = false;
|
79 |
+
|
80 |
+
/**
|
81 |
+
* @var string[]
|
82 |
+
* @psalm-var array<string, string>
|
83 |
+
*/
|
84 |
private $classMap = array();
|
85 |
+
|
86 |
+
/** @var bool */
|
87 |
private $classMapAuthoritative = false;
|
88 |
+
|
89 |
+
/**
|
90 |
+
* @var bool[]
|
91 |
+
* @psalm-var array<string, bool>
|
92 |
+
*/
|
93 |
private $missingClasses = array();
|
94 |
+
|
95 |
+
/** @var ?string */
|
96 |
private $apcuPrefix;
|
97 |
|
98 |
+
/**
|
99 |
+
* @var self[]
|
100 |
+
*/
|
101 |
+
private static $registeredLoaders = array();
|
102 |
+
|
103 |
+
/**
|
104 |
+
* @param ?string $vendorDir
|
105 |
+
*/
|
106 |
+
public function __construct($vendorDir = null)
|
107 |
+
{
|
108 |
+
$this->vendorDir = $vendorDir;
|
109 |
+
}
|
110 |
+
|
111 |
+
/**
|
112 |
+
* @return string[]
|
113 |
+
*/
|
114 |
public function getPrefixes()
|
115 |
{
|
116 |
if (!empty($this->prefixesPsr0)) {
|
120 |
return array();
|
121 |
}
|
122 |
|
123 |
+
/**
|
124 |
+
* @return array[]
|
125 |
+
* @psalm-return array<string, array<int, string>>
|
126 |
+
*/
|
127 |
public function getPrefixesPsr4()
|
128 |
{
|
129 |
return $this->prefixDirsPsr4;
|
130 |
}
|
131 |
|
132 |
+
/**
|
133 |
+
* @return array[]
|
134 |
+
* @psalm-return array<string, string>
|
135 |
+
*/
|
136 |
public function getFallbackDirs()
|
137 |
{
|
138 |
return $this->fallbackDirsPsr0;
|
139 |
}
|
140 |
|
141 |
+
/**
|
142 |
+
* @return array[]
|
143 |
+
* @psalm-return array<string, string>
|
144 |
+
*/
|
145 |
public function getFallbackDirsPsr4()
|
146 |
{
|
147 |
return $this->fallbackDirsPsr4;
|
148 |
}
|
149 |
|
150 |
+
/**
|
151 |
+
* @return string[] Array of classname => path
|
152 |
+
* @psalm-return array<string, string>
|
153 |
+
*/
|
154 |
public function getClassMap()
|
155 |
{
|
156 |
return $this->classMap;
|
157 |
}
|
158 |
|
159 |
/**
|
160 |
+
* @param string[] $classMap Class to filename map
|
161 |
+
* @psalm-param array<string, string> $classMap
|
162 |
+
*
|
163 |
+
* @return void
|
164 |
*/
|
165 |
public function addClassMap(array $classMap)
|
166 |
{
|
175 |
* Registers a set of PSR-0 directories for a given prefix, either
|
176 |
* appending or prepending to the ones previously set for this prefix.
|
177 |
*
|
178 |
+
* @param string $prefix The prefix
|
179 |
+
* @param string[]|string $paths The PSR-0 root directories
|
180 |
+
* @param bool $prepend Whether to prepend the directories
|
181 |
+
*
|
182 |
+
* @return void
|
183 |
*/
|
184 |
public function add($prefix, $paths, $prepend = false)
|
185 |
{
|
222 |
* Registers a set of PSR-4 directories for a given namespace, either
|
223 |
* appending or prepending to the ones previously set for this namespace.
|
224 |
*
|
225 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
226 |
+
* @param string[]|string $paths The PSR-4 base directories
|
227 |
+
* @param bool $prepend Whether to prepend the directories
|
228 |
*
|
229 |
* @throws \InvalidArgumentException
|
230 |
+
*
|
231 |
+
* @return void
|
232 |
*/
|
233 |
public function addPsr4($prefix, $paths, $prepend = false)
|
234 |
{
|
272 |
* Registers a set of PSR-0 directories for a given prefix,
|
273 |
* replacing any others previously set for this prefix.
|
274 |
*
|
275 |
+
* @param string $prefix The prefix
|
276 |
+
* @param string[]|string $paths The PSR-0 base directories
|
277 |
+
*
|
278 |
+
* @return void
|
279 |
*/
|
280 |
public function set($prefix, $paths)
|
281 |
{
|
290 |
* Registers a set of PSR-4 directories for a given namespace,
|
291 |
* replacing any others previously set for this namespace.
|
292 |
*
|
293 |
+
* @param string $prefix The prefix/namespace, with trailing '\\'
|
294 |
+
* @param string[]|string $paths The PSR-4 base directories
|
295 |
*
|
296 |
* @throws \InvalidArgumentException
|
297 |
+
*
|
298 |
+
* @return void
|
299 |
*/
|
300 |
public function setPsr4($prefix, $paths)
|
301 |
{
|
315 |
* Turns on searching the include path for class files.
|
316 |
*
|
317 |
* @param bool $useIncludePath
|
318 |
+
*
|
319 |
+
* @return void
|
320 |
*/
|
321 |
public function setUseIncludePath($useIncludePath)
|
322 |
{
|
339 |
* that have not been registered with the class map.
|
340 |
*
|
341 |
* @param bool $classMapAuthoritative
|
342 |
+
*
|
343 |
+
* @return void
|
344 |
*/
|
345 |
public function setClassMapAuthoritative($classMapAuthoritative)
|
346 |
{
|
361 |
* APCu prefix to use to cache found/not-found classes, if the extension is enabled.
|
362 |
*
|
363 |
* @param string|null $apcuPrefix
|
364 |
+
*
|
365 |
+
* @return void
|
366 |
*/
|
367 |
public function setApcuPrefix($apcuPrefix)
|
368 |
{
|
383 |
* Registers this instance as an autoloader.
|
384 |
*
|
385 |
* @param bool $prepend Whether to prepend the autoloader or not
|
386 |
+
*
|
387 |
+
* @return void
|
388 |
*/
|
389 |
public function register($prepend = false)
|
390 |
{
|
391 |
spl_autoload_register(array($this, 'loadClass'), true, $prepend);
|
392 |
+
|
393 |
+
if (null === $this->vendorDir) {
|
394 |
+
return;
|
395 |
+
}
|
396 |
+
|
397 |
+
if ($prepend) {
|
398 |
+
self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
|
399 |
+
} else {
|
400 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
401 |
+
self::$registeredLoaders[$this->vendorDir] = $this;
|
402 |
+
}
|
403 |
}
|
404 |
|
405 |
/**
|
406 |
* Unregisters this instance as an autoloader.
|
407 |
+
*
|
408 |
+
* @return void
|
409 |
*/
|
410 |
public function unregister()
|
411 |
{
|
412 |
spl_autoload_unregister(array($this, 'loadClass'));
|
413 |
+
|
414 |
+
if (null !== $this->vendorDir) {
|
415 |
+
unset(self::$registeredLoaders[$this->vendorDir]);
|
416 |
+
}
|
417 |
}
|
418 |
|
419 |
/**
|
420 |
* Loads the given class or interface.
|
421 |
*
|
422 |
* @param string $class The name of the class
|
423 |
+
* @return true|null True if loaded, null otherwise
|
424 |
*/
|
425 |
public function loadClass($class)
|
426 |
{
|
429 |
|
430 |
return true;
|
431 |
}
|
432 |
+
|
433 |
+
return null;
|
434 |
}
|
435 |
|
436 |
/**
|
475 |
return $file;
|
476 |
}
|
477 |
|
478 |
+
/**
|
479 |
+
* Returns the currently registered loaders indexed by their corresponding vendor directories.
|
480 |
+
*
|
481 |
+
* @return self[]
|
482 |
+
*/
|
483 |
+
public static function getRegisteredLoaders()
|
484 |
+
{
|
485 |
+
return self::$registeredLoaders;
|
486 |
+
}
|
487 |
+
|
488 |
+
/**
|
489 |
+
* @param string $class
|
490 |
+
* @param string $ext
|
491 |
+
* @return string|false
|
492 |
+
*/
|
493 |
private function findFileWithExtension($class, $ext)
|
494 |
{
|
495 |
// PSR-4 lookup
|
561 |
* Scope isolated include.
|
562 |
*
|
563 |
* Prevents access to $this/self from included files.
|
564 |
+
*
|
565 |
+
* @param string $file
|
566 |
+
* @return void
|
567 |
+
* @private
|
568 |
*/
|
569 |
function includeFile($file)
|
570 |
{
|
vendor/composer/InstalledVersions.php
CHANGED
@@ -1,228 +1,350 @@
|
|
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 |
-
|
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 |
-
return
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
return
|
101 |
-
}
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
$
|
119 |
-
|
120 |
-
|
121 |
-
}
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
{
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
{
|
192 |
-
return
|
193 |
-
}
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
return
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
228 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/*
|
4 |
+
* This file is part of Composer.
|
5 |
+
*
|
6 |
+
* (c) Nils Adermann <naderman@naderman.de>
|
7 |
+
* Jordi Boggiano <j.boggiano@seld.be>
|
8 |
+
*
|
9 |
+
* For the full copyright and license information, please view the LICENSE
|
10 |
+
* file that was distributed with this source code.
|
11 |
+
*/
|
12 |
|
13 |
namespace Composer;
|
14 |
|
15 |
+
use Composer\Autoload\ClassLoader;
|
16 |
use Composer\Semver\VersionParser;
|
17 |
|
18 |
+
/**
|
19 |
+
* This class is copied in every Composer installed project and available to all
|
20 |
+
*
|
21 |
+
* See also https://getcomposer.org/doc/07-runtime.md#installed-versions
|
22 |
+
*
|
23 |
+
* To require its presence, you can require `composer-runtime-api ^2.0`
|
24 |
+
*/
|
25 |
class InstalledVersions
|
26 |
{
|
27 |
+
/**
|
28 |
+
* @var mixed[]|null
|
29 |
+
* @psalm-var array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}|array{}|null
|
30 |
+
*/
|
31 |
+
private static $installed;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @var bool|null
|
35 |
+
*/
|
36 |
+
private static $canGetVendors;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* @var array[]
|
40 |
+
* @psalm-var array<string, array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
41 |
+
*/
|
42 |
+
private static $installedByVendor = array();
|
43 |
+
|
44 |
+
/**
|
45 |
+
* Returns a list of all package names which are present, either by being installed, replaced or provided
|
46 |
+
*
|
47 |
+
* @return string[]
|
48 |
+
* @psalm-return list<string>
|
49 |
+
*/
|
50 |
+
public static function getInstalledPackages()
|
51 |
+
{
|
52 |
+
$packages = array();
|
53 |
+
foreach (self::getInstalled() as $installed) {
|
54 |
+
$packages[] = array_keys($installed['versions']);
|
55 |
+
}
|
56 |
+
|
57 |
+
if (1 === \count($packages)) {
|
58 |
+
return $packages[0];
|
59 |
+
}
|
60 |
+
|
61 |
+
return array_keys(array_flip(\call_user_func_array('array_merge', $packages)));
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Returns a list of all package names with a specific type e.g. 'library'
|
66 |
+
*
|
67 |
+
* @param string $type
|
68 |
+
* @return string[]
|
69 |
+
* @psalm-return list<string>
|
70 |
+
*/
|
71 |
+
public static function getInstalledPackagesByType($type)
|
72 |
+
{
|
73 |
+
$packagesByType = array();
|
74 |
+
|
75 |
+
foreach (self::getInstalled() as $installed) {
|
76 |
+
foreach ($installed['versions'] as $name => $package) {
|
77 |
+
if (isset($package['type']) && $package['type'] === $type) {
|
78 |
+
$packagesByType[] = $name;
|
79 |
+
}
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
return $packagesByType;
|
84 |
+
}
|
85 |
+
|
86 |
+
/**
|
87 |
+
* Checks whether the given package is installed
|
88 |
+
*
|
89 |
+
* This also returns true if the package name is provided or replaced by another package
|
90 |
+
*
|
91 |
+
* @param string $packageName
|
92 |
+
* @param bool $includeDevRequirements
|
93 |
+
* @return bool
|
94 |
+
*/
|
95 |
+
public static function isInstalled($packageName, $includeDevRequirements = true)
|
96 |
+
{
|
97 |
+
foreach (self::getInstalled() as $installed) {
|
98 |
+
if (isset($installed['versions'][$packageName])) {
|
99 |
+
return $includeDevRequirements || empty($installed['versions'][$packageName]['dev_requirement']);
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
return false;
|
104 |
+
}
|
105 |
+
|
106 |
+
/**
|
107 |
+
* Checks whether the given package satisfies a version constraint
|
108 |
+
*
|
109 |
+
* e.g. If you want to know whether version 2.3+ of package foo/bar is installed, you would call:
|
110 |
+
*
|
111 |
+
* Composer\InstalledVersions::satisfies(new VersionParser, 'foo/bar', '^2.3')
|
112 |
+
*
|
113 |
+
* @param VersionParser $parser Install composer/semver to have access to this class and functionality
|
114 |
+
* @param string $packageName
|
115 |
+
* @param string|null $constraint A version constraint to check for, if you pass one you have to make sure composer/semver is required by your package
|
116 |
+
* @return bool
|
117 |
+
*/
|
118 |
+
public static function satisfies(VersionParser $parser, $packageName, $constraint)
|
119 |
+
{
|
120 |
+
$constraint = $parser->parseConstraints($constraint);
|
121 |
+
$provided = $parser->parseConstraints(self::getVersionRanges($packageName));
|
122 |
+
|
123 |
+
return $provided->matches($constraint);
|
124 |
+
}
|
125 |
+
|
126 |
+
/**
|
127 |
+
* Returns a version constraint representing all the range(s) which are installed for a given package
|
128 |
+
*
|
129 |
+
* It is easier to use this via isInstalled() with the $constraint argument if you need to check
|
130 |
+
* whether a given version of a package is installed, and not just whether it exists
|
131 |
+
*
|
132 |
+
* @param string $packageName
|
133 |
+
* @return string Version constraint usable with composer/semver
|
134 |
+
*/
|
135 |
+
public static function getVersionRanges($packageName)
|
136 |
+
{
|
137 |
+
foreach (self::getInstalled() as $installed) {
|
138 |
+
if (!isset($installed['versions'][$packageName])) {
|
139 |
+
continue;
|
140 |
+
}
|
141 |
+
|
142 |
+
$ranges = array();
|
143 |
+
if (isset($installed['versions'][$packageName]['pretty_version'])) {
|
144 |
+
$ranges[] = $installed['versions'][$packageName]['pretty_version'];
|
145 |
+
}
|
146 |
+
if (array_key_exists('aliases', $installed['versions'][$packageName])) {
|
147 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['aliases']);
|
148 |
+
}
|
149 |
+
if (array_key_exists('replaced', $installed['versions'][$packageName])) {
|
150 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['replaced']);
|
151 |
+
}
|
152 |
+
if (array_key_exists('provided', $installed['versions'][$packageName])) {
|
153 |
+
$ranges = array_merge($ranges, $installed['versions'][$packageName]['provided']);
|
154 |
+
}
|
155 |
+
|
156 |
+
return implode(' || ', $ranges);
|
157 |
+
}
|
158 |
+
|
159 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* @param string $packageName
|
164 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
165 |
+
*/
|
166 |
+
public static function getVersion($packageName)
|
167 |
+
{
|
168 |
+
foreach (self::getInstalled() as $installed) {
|
169 |
+
if (!isset($installed['versions'][$packageName])) {
|
170 |
+
continue;
|
171 |
+
}
|
172 |
+
|
173 |
+
if (!isset($installed['versions'][$packageName]['version'])) {
|
174 |
+
return null;
|
175 |
+
}
|
176 |
+
|
177 |
+
return $installed['versions'][$packageName]['version'];
|
178 |
+
}
|
179 |
+
|
180 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
181 |
+
}
|
182 |
+
|
183 |
+
/**
|
184 |
+
* @param string $packageName
|
185 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as version, use satisfies or getVersionRanges if you need to know if a given version is present
|
186 |
+
*/
|
187 |
+
public static function getPrettyVersion($packageName)
|
188 |
+
{
|
189 |
+
foreach (self::getInstalled() as $installed) {
|
190 |
+
if (!isset($installed['versions'][$packageName])) {
|
191 |
+
continue;
|
192 |
+
}
|
193 |
+
|
194 |
+
if (!isset($installed['versions'][$packageName]['pretty_version'])) {
|
195 |
+
return null;
|
196 |
+
}
|
197 |
+
|
198 |
+
return $installed['versions'][$packageName]['pretty_version'];
|
199 |
+
}
|
200 |
+
|
201 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* @param string $packageName
|
206 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as reference
|
207 |
+
*/
|
208 |
+
public static function getReference($packageName)
|
209 |
+
{
|
210 |
+
foreach (self::getInstalled() as $installed) {
|
211 |
+
if (!isset($installed['versions'][$packageName])) {
|
212 |
+
continue;
|
213 |
+
}
|
214 |
+
|
215 |
+
if (!isset($installed['versions'][$packageName]['reference'])) {
|
216 |
+
return null;
|
217 |
+
}
|
218 |
+
|
219 |
+
return $installed['versions'][$packageName]['reference'];
|
220 |
+
}
|
221 |
+
|
222 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* @param string $packageName
|
227 |
+
* @return string|null If the package is being replaced or provided but is not really installed, null will be returned as install path. Packages of type metapackages also have a null install path.
|
228 |
+
*/
|
229 |
+
public static function getInstallPath($packageName)
|
230 |
+
{
|
231 |
+
foreach (self::getInstalled() as $installed) {
|
232 |
+
if (!isset($installed['versions'][$packageName])) {
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
|
236 |
+
return isset($installed['versions'][$packageName]['install_path']) ? $installed['versions'][$packageName]['install_path'] : null;
|
237 |
+
}
|
238 |
+
|
239 |
+
throw new \OutOfBoundsException('Package "' . $packageName . '" is not installed');
|
240 |
+
}
|
241 |
+
|
242 |
+
/**
|
243 |
+
* @return array
|
244 |
+
* @psalm-return array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}
|
245 |
+
*/
|
246 |
+
public static function getRootPackage()
|
247 |
+
{
|
248 |
+
$installed = self::getInstalled();
|
249 |
+
|
250 |
+
return $installed[0]['root'];
|
251 |
+
}
|
252 |
+
|
253 |
+
/**
|
254 |
+
* Returns the raw installed.php data for custom implementations
|
255 |
+
*
|
256 |
+
* @deprecated Use getAllRawData() instead which returns all datasets for all autoloaders present in the process. getRawData only returns the first dataset loaded, which may not be what you expect.
|
257 |
+
* @return array[]
|
258 |
+
* @psalm-return array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}
|
259 |
+
*/
|
260 |
+
public static function getRawData()
|
261 |
+
{
|
262 |
+
@trigger_error('getRawData only returns the first dataset loaded, which may not be what you expect. Use getAllRawData() instead which returns all datasets for all autoloaders present in the process.', E_USER_DEPRECATED);
|
263 |
+
|
264 |
+
if (null === self::$installed) {
|
265 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
266 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
267 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
268 |
+
self::$installed = include __DIR__ . '/installed.php';
|
269 |
+
} else {
|
270 |
+
self::$installed = array();
|
271 |
+
}
|
272 |
+
}
|
273 |
+
|
274 |
+
return self::$installed;
|
275 |
+
}
|
276 |
+
|
277 |
+
/**
|
278 |
+
* Returns the raw data of all installed.php which are currently loaded for custom implementations
|
279 |
+
*
|
280 |
+
* @return array[]
|
281 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
282 |
+
*/
|
283 |
+
public static function getAllRawData()
|
284 |
+
{
|
285 |
+
return self::getInstalled();
|
286 |
+
}
|
287 |
+
|
288 |
+
/**
|
289 |
+
* Lets you reload the static array from another file
|
290 |
+
*
|
291 |
+
* This is only useful for complex integrations in which a project needs to use
|
292 |
+
* this class but then also needs to execute another project's autoloader in process,
|
293 |
+
* and wants to ensure both projects have access to their version of installed.php.
|
294 |
+
*
|
295 |
+
* A typical case would be PHPUnit, where it would need to make sure it reads all
|
296 |
+
* the data it needs from this class, then call reload() with
|
297 |
+
* `require $CWD/vendor/composer/installed.php` (or similar) as input to make sure
|
298 |
+
* the project in which it runs can then also use this class safely, without
|
299 |
+
* interference between PHPUnit's dependencies and the project's dependencies.
|
300 |
+
*
|
301 |
+
* @param array[] $data A vendor/composer/installed.php data set
|
302 |
+
* @return void
|
303 |
+
*
|
304 |
+
* @psalm-param array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>} $data
|
305 |
+
*/
|
306 |
+
public static function reload($data)
|
307 |
+
{
|
308 |
+
self::$installed = $data;
|
309 |
+
self::$installedByVendor = array();
|
310 |
+
}
|
311 |
+
|
312 |
+
/**
|
313 |
+
* @return array[]
|
314 |
+
* @psalm-return list<array{root: array{name: string, version: string, reference: string, pretty_version: string, aliases: string[], dev: bool, install_path: string, type: string}, versions: array<string, array{dev_requirement: bool, pretty_version?: string, version?: string, aliases?: string[], reference?: string, replaced?: string[], provided?: string[], install_path?: string, type?: string}>}>
|
315 |
+
*/
|
316 |
+
private static function getInstalled()
|
317 |
+
{
|
318 |
+
if (null === self::$canGetVendors) {
|
319 |
+
self::$canGetVendors = method_exists('Composer\Autoload\ClassLoader', 'getRegisteredLoaders');
|
320 |
+
}
|
321 |
+
|
322 |
+
$installed = array();
|
323 |
+
|
324 |
+
if (self::$canGetVendors) {
|
325 |
+
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
|
326 |
+
if (isset(self::$installedByVendor[$vendorDir])) {
|
327 |
+
$installed[] = self::$installedByVendor[$vendorDir];
|
328 |
+
} elseif (is_file($vendorDir.'/composer/installed.php')) {
|
329 |
+
$installed[] = self::$installedByVendor[$vendorDir] = require $vendorDir.'/composer/installed.php';
|
330 |
+
if (null === self::$installed && strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
|
331 |
+
self::$installed = $installed[count($installed) - 1];
|
332 |
+
}
|
333 |
+
}
|
334 |
+
}
|
335 |
+
}
|
336 |
+
|
337 |
+
if (null === self::$installed) {
|
338 |
+
// only require the installed.php file if this file is loaded from its dumped location,
|
339 |
+
// and not from its source location in the composer/composer package, see https://github.com/composer/composer/issues/9937
|
340 |
+
if (substr(__DIR__, -8, 1) !== 'C') {
|
341 |
+
self::$installed = require __DIR__ . '/installed.php';
|
342 |
+
} else {
|
343 |
+
self::$installed = array();
|
344 |
+
}
|
345 |
+
}
|
346 |
+
$installed[] = self::$installed;
|
347 |
+
|
348 |
+
return $installed;
|
349 |
+
}
|
350 |
}
|
vendor/composer/autoload_psr4.php
CHANGED
@@ -6,5 +6,6 @@ $vendorDir = dirname(dirname(__FILE__));
|
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
|
|
9 |
'Embera\\' => array($vendorDir . '/wpdevelopers/embera/src/Embera'),
|
10 |
);
|
6 |
$baseDir = dirname($vendorDir);
|
7 |
|
8 |
return array(
|
9 |
+
'PriyoMukul\\WPNotice\\' => array($vendorDir . '/priyomukul/wp-notice/src'),
|
10 |
'Embera\\' => array($vendorDir . '/wpdevelopers/embera/src/Embera'),
|
11 |
);
|
vendor/composer/autoload_real.php
CHANGED
@@ -25,7 +25,7 @@ class ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51
|
|
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());
|
25 |
require __DIR__ . '/platform_check.php';
|
26 |
|
27 |
spl_autoload_register(array('ComposerAutoloaderInit892912675c615e61d62bcd5adc416c51', 'loadClassLoader'), true, true);
|
28 |
+
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
|
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());
|
vendor/composer/autoload_static.php
CHANGED
@@ -7,6 +7,10 @@ namespace Composer\Autoload;
|
|
7 |
class ComposerStaticInit892912675c615e61d62bcd5adc416c51
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
|
|
|
|
|
|
|
|
10 |
'E' =>
|
11 |
array (
|
12 |
'Embera\\' => 7,
|
@@ -14,6 +18,10 @@ class ComposerStaticInit892912675c615e61d62bcd5adc416c51
|
|
14 |
);
|
15 |
|
16 |
public static $prefixDirsPsr4 = array (
|
|
|
|
|
|
|
|
|
17 |
'Embera\\' =>
|
18 |
array (
|
19 |
0 => __DIR__ . '/..' . '/wpdevelopers/embera/src/Embera',
|
7 |
class ComposerStaticInit892912675c615e61d62bcd5adc416c51
|
8 |
{
|
9 |
public static $prefixLengthsPsr4 = array (
|
10 |
+
'P' =>
|
11 |
+
array (
|
12 |
+
'PriyoMukul\\WPNotice\\' => 20,
|
13 |
+
),
|
14 |
'E' =>
|
15 |
array (
|
16 |
'Embera\\' => 7,
|
18 |
);
|
19 |
|
20 |
public static $prefixDirsPsr4 = array (
|
21 |
+
'PriyoMukul\\WPNotice\\' =>
|
22 |
+
array (
|
23 |
+
0 => __DIR__ . '/..' . '/priyomukul/wp-notice/src',
|
24 |
+
),
|
25 |
'Embera\\' =>
|
26 |
array (
|
27 |
0 => __DIR__ . '/..' . '/wpdevelopers/embera/src/Embera',
|
vendor/composer/installed.json
CHANGED
@@ -1,5 +1,41 @@
|
|
1 |
{
|
2 |
"packages": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
{
|
4 |
"name": "wpdevelopers/embera",
|
5 |
"version": "2.0.17",
|
1 |
{
|
2 |
"packages": [
|
3 |
+
{
|
4 |
+
"name": "priyomukul/wp-notice",
|
5 |
+
"version": "dev-main",
|
6 |
+
"version_normalized": "dev-main",
|
7 |
+
"source": {
|
8 |
+
"type": "git",
|
9 |
+
"url": "git@github.com:priyomukul/wp-notice.git",
|
10 |
+
"reference": "d6300563a1b06f61639864b4e3a03c675a688ae6"
|
11 |
+
},
|
12 |
+
"dist": {
|
13 |
+
"type": "zip",
|
14 |
+
"url": "https://api.github.com/repos/priyomukul/wp-notice/zipball/d6300563a1b06f61639864b4e3a03c675a688ae6",
|
15 |
+
"reference": "d6300563a1b06f61639864b4e3a03c675a688ae6",
|
16 |
+
"shasum": ""
|
17 |
+
},
|
18 |
+
"time": "2022-06-30T13:30:48+00:00",
|
19 |
+
"default-branch": true,
|
20 |
+
"type": "library",
|
21 |
+
"installation-source": "dist",
|
22 |
+
"autoload": {
|
23 |
+
"psr-4": {
|
24 |
+
"PriyoMukul\\WPNotice\\": "src/"
|
25 |
+
}
|
26 |
+
},
|
27 |
+
"authors": [
|
28 |
+
{
|
29 |
+
"name": "Priyo Mukul",
|
30 |
+
"email": "17237437+priyomukul@users.noreply.github.com"
|
31 |
+
}
|
32 |
+
],
|
33 |
+
"support": {
|
34 |
+
"source": "https://github.com/priyomukul/wp-notice/tree/main",
|
35 |
+
"issues": "https://github.com/priyomukul/wp-notice/issues"
|
36 |
+
},
|
37 |
+
"install-path": "../priyomukul/wp-notice"
|
38 |
+
},
|
39 |
{
|
40 |
"name": "wpdevelopers/embera",
|
41 |
"version": "2.0.17",
|
vendor/composer/installed.php
CHANGED
@@ -1,33 +1,43 @@
|
|
1 |
-
<?php return array
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
8 |
),
|
9 |
-
'
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
);
|
1 |
+
<?php return array(
|
2 |
+
'root' => array(
|
3 |
+
'pretty_version' => 'dev-main',
|
4 |
+
'version' => 'dev-main',
|
5 |
+
'type' => 'wordpress-plugin',
|
6 |
+
'install_path' => __DIR__ . '/../../',
|
7 |
+
'aliases' => array(),
|
8 |
+
'reference' => '52833a228000b5e0b71e8ea34ab16daee3357c87',
|
9 |
+
'name' => 'embedpress/embedpress',
|
10 |
+
'dev' => true,
|
11 |
),
|
12 |
+
'versions' => array(
|
13 |
+
'embedpress/embedpress' => array(
|
14 |
+
'pretty_version' => 'dev-main',
|
15 |
+
'version' => 'dev-main',
|
16 |
+
'type' => 'wordpress-plugin',
|
17 |
+
'install_path' => __DIR__ . '/../../',
|
18 |
+
'aliases' => array(),
|
19 |
+
'reference' => '52833a228000b5e0b71e8ea34ab16daee3357c87',
|
20 |
+
'dev_requirement' => false,
|
21 |
+
),
|
22 |
+
'priyomukul/wp-notice' => array(
|
23 |
+
'pretty_version' => 'dev-main',
|
24 |
+
'version' => 'dev-main',
|
25 |
+
'type' => 'library',
|
26 |
+
'install_path' => __DIR__ . '/../priyomukul/wp-notice',
|
27 |
+
'aliases' => array(
|
28 |
+
0 => '9999999-dev',
|
29 |
+
),
|
30 |
+
'reference' => 'd6300563a1b06f61639864b4e3a03c675a688ae6',
|
31 |
+
'dev_requirement' => false,
|
32 |
+
),
|
33 |
+
'wpdevelopers/embera' => array(
|
34 |
+
'pretty_version' => '2.0.17',
|
35 |
+
'version' => '2.0.17.0',
|
36 |
+
'type' => 'library',
|
37 |
+
'install_path' => __DIR__ . '/../wpdevelopers/embera',
|
38 |
+
'aliases' => array(),
|
39 |
+
'reference' => '5f521fbe77fdfc992dc399ee39e5fdb338ea1f04',
|
40 |
+
'dev_requirement' => false,
|
41 |
+
),
|
42 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
);
|
vendor/priyomukul/wp-notice/src/Dismiss.php
ADDED
@@ -0,0 +1,151 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice;
|
4 |
+
|
5 |
+
use PriyoMukul\WPNotice\Utils\Base;
|
6 |
+
use PriyoMukul\WPNotice\Utils\Helper;
|
7 |
+
use PriyoMukul\WPNotice\Utils\Storage;
|
8 |
+
|
9 |
+
class Dismiss extends Base {
|
10 |
+
use Helper;
|
11 |
+
|
12 |
+
private $id;
|
13 |
+
private $scope = 'user';
|
14 |
+
private $app = null;
|
15 |
+
private $hook = null;
|
16 |
+
|
17 |
+
public function __construct( $id, $options, $app ){
|
18 |
+
$this->id = $id;
|
19 |
+
$this->app = $app;
|
20 |
+
|
21 |
+
if( ! empty( $options ) ) {
|
22 |
+
foreach( $options as $key => $_value ) {
|
23 |
+
$this->{$key} = $_value;
|
24 |
+
}
|
25 |
+
}
|
26 |
+
|
27 |
+
$this->hook = $this->app->app .'_wpnotice_dismiss_notice';
|
28 |
+
|
29 |
+
add_action( 'wp_ajax_'. $this->hook, [ $this, 'ajax_maybe_dismiss_notice' ] );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* Print the script for dismissing the notice.
|
34 |
+
*
|
35 |
+
* @access public
|
36 |
+
* @since 1.0
|
37 |
+
* @return void
|
38 |
+
*/
|
39 |
+
public function print_script() {
|
40 |
+
$nonce = wp_create_nonce( 'wpnotice_dismiss_notice_' . $this->id );
|
41 |
+
$_id = '#wpnotice-' . esc_attr( $this->app->app ) . '-' . esc_attr( $this->id );
|
42 |
+
?>
|
43 |
+
<script>
|
44 |
+
window.addEventListener( 'load', function() {
|
45 |
+
var dismissBtn = document.querySelector( '<?php echo $_id ?> .notice-dismiss' );
|
46 |
+
var extraDismissBtn = document.querySelectorAll( '<?php echo $_id ?> .dismiss-btn' );
|
47 |
+
|
48 |
+
function wpNoticeDismissFunc( event ) {
|
49 |
+
event.preventDefault();
|
50 |
+
|
51 |
+
var httpRequest = new XMLHttpRequest(),
|
52 |
+
postData = '',
|
53 |
+
dismiss = event.target.dataset?.hasOwnProperty('dismiss') && event.target.dataset.dismiss || false,
|
54 |
+
later = event.target.dataset?.hasOwnProperty('later') && event.target.dataset.later || false;
|
55 |
+
|
56 |
+
if( dismiss || later ) {
|
57 |
+
jQuery(event.target.offsetParent).slideUp(200);
|
58 |
+
}
|
59 |
+
|
60 |
+
// Data has to be formatted as a string here.
|
61 |
+
postData += 'id=<?php echo esc_attr( rawurlencode( $this->id ) ); ?>';
|
62 |
+
postData += '&action=<?php echo esc_attr( $this->hook ); ?>';
|
63 |
+
if( dismiss ) {
|
64 |
+
postData += '&dismiss=' + dismiss;
|
65 |
+
}
|
66 |
+
if( later ) {
|
67 |
+
postData += '&later=' + later;
|
68 |
+
}
|
69 |
+
|
70 |
+
postData += '&nonce=<?php echo esc_html( $nonce ); ?>';
|
71 |
+
|
72 |
+
httpRequest.open( 'POST', '<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>' );
|
73 |
+
httpRequest.setRequestHeader( 'Content-Type', 'application/x-www-form-urlencoded' );
|
74 |
+
httpRequest.send( postData );
|
75 |
+
}
|
76 |
+
|
77 |
+
// Add an event listener to the dismiss button.
|
78 |
+
dismissBtn && dismissBtn.addEventListener( 'click', wpNoticeDismissFunc);
|
79 |
+
if( extraDismissBtn.length > 0 ) {
|
80 |
+
extraDismissBtn.forEach( btn => btn.addEventListener( 'click', wpNoticeDismissFunc))
|
81 |
+
}
|
82 |
+
});
|
83 |
+
</script>
|
84 |
+
<?php
|
85 |
+
}
|
86 |
+
|
87 |
+
|
88 |
+
/**
|
89 |
+
* Run check to see if we need to dismiss the notice.
|
90 |
+
* If all tests are successful then call the dismiss_notice() method.
|
91 |
+
*
|
92 |
+
* @access public
|
93 |
+
* @since 1.0
|
94 |
+
* @return void
|
95 |
+
*/
|
96 |
+
public function ajax_maybe_dismiss_notice() {
|
97 |
+
// Sanity check: Early exit if we're not on a wptrt_dismiss_notice action.
|
98 |
+
if ( ! isset( $_POST['action'] ) || $this->hook !== $_POST['action'] ) {
|
99 |
+
return;
|
100 |
+
}
|
101 |
+
|
102 |
+
// Sanity check: Early exit if the ID of the notice is not the one from this object.
|
103 |
+
if ( ! isset( $_POST['id'] ) || $this->id !== $_POST['id'] ) {
|
104 |
+
return;
|
105 |
+
}
|
106 |
+
|
107 |
+
// Security check: Make sure nonce is OK.
|
108 |
+
check_ajax_referer( 'wpnotice_dismiss_notice_' . $this->id, 'nonce', true );
|
109 |
+
|
110 |
+
if( isset( $_POST['later'] ) ) {
|
111 |
+
$_recurrence = intval( $this->recurrence ) || 15;
|
112 |
+
$_queue = $this->app->storage()->get();
|
113 |
+
$_queue[ $this->id ]['start'] = $this->strtotime( "+$_recurrence days" );
|
114 |
+
$_queue[ $this->id ]['expire'] = $this->strtotime( "+". ($_recurrence + 3) ." days" );
|
115 |
+
$this->app->storage()->save( $_queue );
|
116 |
+
return;
|
117 |
+
}
|
118 |
+
|
119 |
+
// If we got this far, we need to dismiss the notice.
|
120 |
+
$this->dismiss_notice();
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* Actually dismisses the notice.
|
125 |
+
*
|
126 |
+
* @access private
|
127 |
+
* @since 1.0
|
128 |
+
* @return void
|
129 |
+
*/
|
130 |
+
private function dismiss_notice() {
|
131 |
+
if ( 'user' === $this->scope ) {
|
132 |
+
return $this->app->storage()->save_meta( $this->id );
|
133 |
+
}
|
134 |
+
|
135 |
+
$_key = $this->app->app . '_' . $this->id . '_notice_dismissed';
|
136 |
+
return $this->app->storage()->save( $_key );
|
137 |
+
}
|
138 |
+
|
139 |
+
/**
|
140 |
+
* Check if is dismissed or not
|
141 |
+
* @return boolean
|
142 |
+
*/
|
143 |
+
public function is_dismissed(){
|
144 |
+
if ( 'user' === $this->scope ) {
|
145 |
+
return $this->app->storage()->get_meta( $this->id );
|
146 |
+
}
|
147 |
+
|
148 |
+
$_key = $this->app->app . '_' . $this->id . '_notice_dismissed';
|
149 |
+
return $this->app->storage()->get( $_key );
|
150 |
+
}
|
151 |
+
}
|
vendor/priyomukul/wp-notice/src/Notice.php
ADDED
@@ -0,0 +1,257 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice;
|
4 |
+
|
5 |
+
use PriyoMukul\WPNotice\Utils\Base;
|
6 |
+
use PriyoMukul\WPNotice\Utils\Storage;
|
7 |
+
use PriyoMukul\WPNotice\Utils\Helper;
|
8 |
+
|
9 |
+
use function property_exists;
|
10 |
+
|
11 |
+
class Notice extends Base {
|
12 |
+
use Helper;
|
13 |
+
|
14 |
+
private $app = null;
|
15 |
+
|
16 |
+
private $id = null;
|
17 |
+
private $content = null;
|
18 |
+
public $dismiss = null;
|
19 |
+
|
20 |
+
private $queue = [];
|
21 |
+
|
22 |
+
/**
|
23 |
+
* @var int start
|
24 |
+
* @var int expire
|
25 |
+
* @var int recurrence Meaning this notice will appear after 10, 20 days.
|
26 |
+
* @var string scope
|
27 |
+
* @var array screens
|
28 |
+
* @var string type Notice type
|
29 |
+
* @var string capability
|
30 |
+
* @var bool dismissible
|
31 |
+
*/
|
32 |
+
private $options = [
|
33 |
+
// 'start' => 192933, // timestamp
|
34 |
+
// 'expire' => 1029339, // timestamp
|
35 |
+
'classes' => '',
|
36 |
+
'recurrence' => false,
|
37 |
+
'scope' => 'user',
|
38 |
+
'screens' => null,
|
39 |
+
'type' => 'info',
|
40 |
+
'capability' => null,
|
41 |
+
'dismissible' => false,
|
42 |
+
];
|
43 |
+
|
44 |
+
public function __construct( ...$args ){
|
45 |
+
list( $id, $content, $options, $queue, $app ) = $args;
|
46 |
+
|
47 |
+
|
48 |
+
$this->app = $app;
|
49 |
+
$this->id = $id;
|
50 |
+
$this->content = $content;
|
51 |
+
$this->queue = $queue;
|
52 |
+
$this->options = wp_parse_args( $options, $this->options );
|
53 |
+
|
54 |
+
$this->dismiss = new Dismiss( $this->id, $this->options, $this->app );
|
55 |
+
|
56 |
+
if( ! isset( $queue[ $id ] ) ) {
|
57 |
+
$queue[ $id ] = [];
|
58 |
+
$_eligible_keys = ['start', 'expire', 'recurrence'];
|
59 |
+
array_walk($options, function( $value, $key ) use( $id, &$queue, $_eligible_keys ) {
|
60 |
+
if( in_array( $key, $_eligible_keys, true ) ) {
|
61 |
+
$queue[ $id ][ $key ] = $value;
|
62 |
+
}
|
63 |
+
});
|
64 |
+
|
65 |
+
$this->queue = $queue;
|
66 |
+
$this->app->storage()->save( $queue ); // saved in queue
|
67 |
+
} else {
|
68 |
+
$this->options = wp_parse_args( $queue[ $id ], $this->options );
|
69 |
+
}
|
70 |
+
}
|
71 |
+
|
72 |
+
|
73 |
+
public function display( $force = false ){
|
74 |
+
if ( ! $force && ! $this->show() ) {
|
75 |
+
return;
|
76 |
+
}
|
77 |
+
|
78 |
+
// Print the notice.
|
79 |
+
printf(
|
80 |
+
'<div style="display: grid; grid-template-columns: 50px 1fr; align-items: center;" id="%1$s" class="%2$s">%3$s<div class="wpnotice-content-wrapper">%4$s%5$s</div></div>',
|
81 |
+
'wpnotice-' . esc_attr( $this->app->app ) . '-' . esc_attr( $this->id ), // The ID.
|
82 |
+
esc_attr( $this->get_classes() ), // The classes.
|
83 |
+
! empty( $this->content['thumbnail'] ) ? $this->get_thumbnail( $this->content['thumbnail'] ) : '',
|
84 |
+
! empty( $this->content['html'] ) ? $this->content['html'] : $this->content,
|
85 |
+
! empty( $this->content['links'] ) ? $this->links( $this->content['links'] ) : ''
|
86 |
+
);
|
87 |
+
}
|
88 |
+
|
89 |
+
// 'later' => array(
|
90 |
+
// 'link' => 'https://wpdeveloper.com/review-notificationx',
|
91 |
+
// 'target' => '_blank',
|
92 |
+
// 'label' => __( 'Ok, you deserve it!', 'notificationx' ),
|
93 |
+
// 'icon_class' => 'dashicons dashicons-external',
|
94 |
+
// ),
|
95 |
+
public function links( $links ){
|
96 |
+
$_attributes = '';
|
97 |
+
$output = '<ul style="display: flex; width: 100%; align-items: center;" class="notice-links '. $this->app->app .'-notice-links">';
|
98 |
+
foreach( $links as $_key => $link ) {
|
99 |
+
$class = ! empty( $link['class'] ) ? $link['class'] : '';
|
100 |
+
|
101 |
+
if( ! empty( $link['attributes'] ) ) {
|
102 |
+
$link['attributes']['target'] = '_top';
|
103 |
+
$_attributes = $this->attributes( $link['attributes'] );
|
104 |
+
$link['link'] = '#';
|
105 |
+
}
|
106 |
+
|
107 |
+
$output .= '<li style="margin: 0 15px 0 0;" class="notice-link-item '. $class .'">';
|
108 |
+
$output .= ! empty( $link['link'] ) ? '<a href="' . esc_url( $link['link'] ) . '" '. $_attributes .'>' : '';
|
109 |
+
if ( isset( $link['icon_class'] ) ) {
|
110 |
+
$output .= '<span style="margin-right: 5px" class="' . esc_attr( $link['icon_class'] ) . '"></span>';
|
111 |
+
}
|
112 |
+
$output .= $link['label'];
|
113 |
+
$output .= ! empty( $link['link'] ) ? '</a>' : '';
|
114 |
+
$output .= '</li>';
|
115 |
+
}
|
116 |
+
|
117 |
+
$output .= '</ul>';
|
118 |
+
|
119 |
+
return $output;
|
120 |
+
}
|
121 |
+
|
122 |
+
public function attributes( $params = [] ){
|
123 |
+
$_attr = [];
|
124 |
+
|
125 |
+
$_attr[] = 'class="dismiss-btn"';
|
126 |
+
$_attr[] = 'target="_blank"';
|
127 |
+
if( ! empty( $params ) ) {
|
128 |
+
foreach( $params as $key => $value ) {
|
129 |
+
$_attr[] = "$key='$value'";
|
130 |
+
}
|
131 |
+
}
|
132 |
+
|
133 |
+
return \implode(' ', $_attr);
|
134 |
+
}
|
135 |
+
|
136 |
+
public function url( $params = [] ){
|
137 |
+
$nonce = wp_create_nonce( 'wpnotice_dismiss_notice_' . $this->id );
|
138 |
+
|
139 |
+
return esc_url( add_query_arg( [
|
140 |
+
'action' => 'wpnotice_dismiss_notice',
|
141 |
+
'id' => $this->id,
|
142 |
+
'nonce' => $nonce,
|
143 |
+
], admin_url( '/' ) ) );
|
144 |
+
}
|
145 |
+
/**
|
146 |
+
* Get the notice classes.
|
147 |
+
*
|
148 |
+
* @access public
|
149 |
+
* @since 1.0
|
150 |
+
* @return string
|
151 |
+
*/
|
152 |
+
public function get_classes() {
|
153 |
+
$classes = [ 'wpnotice-wrapper notice', $this->app->app ];
|
154 |
+
|
155 |
+
// Add the class for notice-type.
|
156 |
+
$classes[] = $this->options['classes'];
|
157 |
+
$classes[] = 'notice-' . $this->options['type'];
|
158 |
+
$classes[] = 'notice-' . $this->app->app . '-' . $this->id;
|
159 |
+
|
160 |
+
if( $this->options['dismissible'] ) {
|
161 |
+
$classes[] = 'is-dismissible';
|
162 |
+
}
|
163 |
+
|
164 |
+
// Combine classes to a string.
|
165 |
+
return implode( ' ', $classes );
|
166 |
+
}
|
167 |
+
|
168 |
+
/**
|
169 |
+
* Determine if the notice should be shown or not.
|
170 |
+
*
|
171 |
+
* @access public
|
172 |
+
* @since 1.0
|
173 |
+
* @return bool
|
174 |
+
*/
|
175 |
+
public function show() {
|
176 |
+
// External Condition Check
|
177 |
+
if( isset( $this->options['display_if'] ) && ! $this->options['display_if'] ) {
|
178 |
+
return false;
|
179 |
+
}
|
180 |
+
// Don't show if the user doesn't have the required capability.
|
181 |
+
if ( ! is_null( $this->options['capability'] ) && ! current_user_can( $this->options['capability'] ) ) {
|
182 |
+
return false;
|
183 |
+
}
|
184 |
+
|
185 |
+
// Don't show if we're not on the right screen.
|
186 |
+
if ( ! $this->is_screen() ) {
|
187 |
+
return false;
|
188 |
+
}
|
189 |
+
|
190 |
+
// Don't show if notice has been dismissed.
|
191 |
+
if ( $this->dismiss->is_dismissed() ) {
|
192 |
+
return false;
|
193 |
+
}
|
194 |
+
|
195 |
+
// Start and Expiration Check.
|
196 |
+
if( $this->time() <= $this->options['start'] ) {
|
197 |
+
return false;
|
198 |
+
}
|
199 |
+
|
200 |
+
if( $this->is_expired() ) {
|
201 |
+
if( $this->options['recurrence'] ) {
|
202 |
+
$_recurrence = intval( $this->options['recurrence'] );
|
203 |
+
$this->queue[ $this->id ]['start'] = $this->strtotime( "+$_recurrence days" );
|
204 |
+
$this->queue[ $this->id ]['expire'] = $this->strtotime( "+". ($_recurrence + 3) ." days" );
|
205 |
+
$this->app->storage()->save( $this->queue );
|
206 |
+
}
|
207 |
+
|
208 |
+
return false;
|
209 |
+
}
|
210 |
+
|
211 |
+
return true;
|
212 |
+
}
|
213 |
+
|
214 |
+
/**
|
215 |
+
* Evaluate if we're on the right place depending on the "screens" argument.
|
216 |
+
*
|
217 |
+
* @access private
|
218 |
+
* @since 1.0
|
219 |
+
* @return bool
|
220 |
+
*/
|
221 |
+
private function is_screen() {
|
222 |
+
// If screen is empty we want this shown on all screens.
|
223 |
+
if ( empty( $this->options['screens'] ) ) {
|
224 |
+
return true;
|
225 |
+
}
|
226 |
+
|
227 |
+
// Make sure the get_current_screen function exists.
|
228 |
+
if ( ! function_exists( 'get_current_screen' ) ) {
|
229 |
+
require_once ABSPATH . 'wp-admin/includes/screen.php';
|
230 |
+
}
|
231 |
+
|
232 |
+
/** @var \WP_Screen $current_screen */
|
233 |
+
$current_screen = get_current_screen();
|
234 |
+
return ( in_array( $current_screen->id, $this->options['screens'], true ) );
|
235 |
+
}
|
236 |
+
|
237 |
+
public function is_expired(){
|
238 |
+
if( isset( $this->options['expire'] ) && $this->time() >= $this->options['expire'] ) {
|
239 |
+
return true;
|
240 |
+
}
|
241 |
+
|
242 |
+
return false;
|
243 |
+
}
|
244 |
+
|
245 |
+
public function __call( $name, $args ){
|
246 |
+
if( property_exists( $this, $name ) ) {
|
247 |
+
return $this->$name[ $args[0] ];
|
248 |
+
}
|
249 |
+
}
|
250 |
+
|
251 |
+
public function get_thumbnail( $image ) {
|
252 |
+
$output = '<div style="padding: 10px 10px 10px 0px; box-sizing: border-box;" class="wpnotice-thumbnail-wrapper">';
|
253 |
+
$output .= '<img style="max-width: 100%;" src="' . esc_url( $image ) . '">';
|
254 |
+
$output .= '</div>';
|
255 |
+
return wp_kses_post( $output );
|
256 |
+
}
|
257 |
+
}
|
vendor/priyomukul/wp-notice/src/Notices.php
ADDED
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice;
|
4 |
+
|
5 |
+
use PriyoMukul\WPNotice\Utils\Base;
|
6 |
+
use PriyoMukul\WPNotice\Utils\Helper;
|
7 |
+
use PriyoMukul\WPNotice\Utils\Storage;
|
8 |
+
|
9 |
+
final class Notices extends Base {
|
10 |
+
use Helper;
|
11 |
+
|
12 |
+
public $system_id = 'wpnotice_system';
|
13 |
+
public $app = 'wpnotice';
|
14 |
+
public $version = '1.0.0';
|
15 |
+
|
16 |
+
private $args = [];
|
17 |
+
|
18 |
+
private $storage = null;
|
19 |
+
|
20 |
+
private $notices = [];
|
21 |
+
private $queue = [];
|
22 |
+
|
23 |
+
private $scripts = null;
|
24 |
+
|
25 |
+
public function __get( $name ){
|
26 |
+
if( property_exists( $this, $name ) ) {
|
27 |
+
return $this->$name;
|
28 |
+
}
|
29 |
+
}
|
30 |
+
|
31 |
+
public function __construct( $args ){
|
32 |
+
$this->system_id = ! empty( $args['id'] ) ? $args['id'] . '-notice-system' : $this->system_id;
|
33 |
+
$this->app = ! empty( $args['id'] ) ? $args['id'] : $this->app;
|
34 |
+
$this->version = ! empty( $args['version'] ) ? $args['version'] : '1.0.0';
|
35 |
+
$this->dev_mode = ! empty( $args['dev_mode'] ) ? $args['dev_mode'] : false;
|
36 |
+
|
37 |
+
$this->args = $args;
|
38 |
+
|
39 |
+
if( ! empty( $args['styles'] ) ) {
|
40 |
+
$this->scripts = $args['styles'];
|
41 |
+
unset( $args['styles'] );
|
42 |
+
}
|
43 |
+
|
44 |
+
$this->queue = $this->storage()->get( '', [] );
|
45 |
+
}
|
46 |
+
|
47 |
+
public function storage(){
|
48 |
+
return $this->database( $this->args );
|
49 |
+
}
|
50 |
+
|
51 |
+
public function init(){
|
52 |
+
add_action( 'admin_notices', [ $this, 'notices' ] );
|
53 |
+
add_action( 'admin_footer', [ $this, 'scripts' ] );
|
54 |
+
}
|
55 |
+
|
56 |
+
public function notices(){
|
57 |
+
wp_enqueue_style( $this->system_id, $this->scripts );
|
58 |
+
|
59 |
+
if( ! $this->dev_mode ) {
|
60 |
+
$current_notice = current( $this->eligible_notices() );
|
61 |
+
if( isset( $this->notices[ $current_notice ] ) ) {
|
62 |
+
$this->notices[ $current_notice ]->display();
|
63 |
+
}
|
64 |
+
} else {
|
65 |
+
foreach( $this->notices as $key => $notice ) {
|
66 |
+
$notice->display( true );
|
67 |
+
}
|
68 |
+
}
|
69 |
+
|
70 |
+
}
|
71 |
+
|
72 |
+
protected function eligible_notices(){
|
73 |
+
$_sorted_quque = [];
|
74 |
+
$_queue = empty( $this->queue ) ? $this->notices : $this->queue;
|
75 |
+
|
76 |
+
if( ! empty ( $_queue ) ) {
|
77 |
+
array_walk( $_queue, function( $value, $key ) use( &$_sorted_quque ) {
|
78 |
+
$notice = isset( $this->notices[ $key ] ) ? $this->notices[ $key ] : null;
|
79 |
+
if( ! is_null( $notice ) ) {
|
80 |
+
if( ! $notice->dismiss->is_dismissed() && ! $notice->is_expired() ) {
|
81 |
+
$_sorted_quque[ $notice->options('start') ] = $key;
|
82 |
+
}
|
83 |
+
}
|
84 |
+
});
|
85 |
+
}
|
86 |
+
|
87 |
+
ksort( $_sorted_quque );
|
88 |
+
|
89 |
+
return $_sorted_quque;
|
90 |
+
}
|
91 |
+
|
92 |
+
public function scripts(){
|
93 |
+
$current_notice = current( $this->eligible_notices() );
|
94 |
+
|
95 |
+
if( isset( $this->notices[ $current_notice ] ) && ! $this->dev_mode ) {
|
96 |
+
$notice = $this->notices[ $current_notice ];
|
97 |
+
if( $notice->show() ) {
|
98 |
+
$notice->dismiss->print_script();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
if( $this->dev_mode ) {
|
103 |
+
foreach( $this->notices as $key => $notice ) {
|
104 |
+
$notice->dismiss->print_script();
|
105 |
+
}
|
106 |
+
}
|
107 |
+
|
108 |
+
}
|
109 |
+
|
110 |
+
public function add( $id, $content, $options = [] ){
|
111 |
+
$this->notices[ $id ] = new Notice( $id, $content, $options, $this->queue, $this );
|
112 |
+
}
|
113 |
+
}
|
vendor/priyomukul/wp-notice/src/Utils/Base.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice\Utils;
|
4 |
+
|
5 |
+
abstract class Base {
|
6 |
+
/**
|
7 |
+
* Holds the plugin instance.
|
8 |
+
*
|
9 |
+
* @since 2.0.0
|
10 |
+
* @access protected
|
11 |
+
* @static
|
12 |
+
*
|
13 |
+
* @var Base
|
14 |
+
*/
|
15 |
+
private static $instances = [];
|
16 |
+
|
17 |
+
/**
|
18 |
+
* Sets up a single instance of the plugin.
|
19 |
+
*
|
20 |
+
* @since 1.0.0
|
21 |
+
* @access public
|
22 |
+
* @static
|
23 |
+
*
|
24 |
+
* @return static An instance of the class.
|
25 |
+
*/
|
26 |
+
public static function get_instance( ...$args ) {
|
27 |
+
$module = get_called_class();
|
28 |
+
$module_id = $module;
|
29 |
+
|
30 |
+
if( $module === 'PriyoMukul\WPNotice\Notice' || $module === 'PriyoMukul\WPNotice\Dismiss' ) {
|
31 |
+
$module_id = $module . '::' . $args[0];
|
32 |
+
}
|
33 |
+
|
34 |
+
if ( ! isset( self::$instances[ $module_id ] ) ) {
|
35 |
+
self::$instances[ $module_id ] = new $module( ...$args );
|
36 |
+
}
|
37 |
+
|
38 |
+
return self::$instances[ $module_id ];
|
39 |
+
}
|
40 |
+
|
41 |
+
protected function database( $args = null ){
|
42 |
+
return new Storage( $args );
|
43 |
+
}
|
44 |
+
}
|
vendor/priyomukul/wp-notice/src/Utils/Helper.php
ADDED
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice\Utils;
|
4 |
+
|
5 |
+
trait Helper {
|
6 |
+
|
7 |
+
public function is_installed( $plugin ){
|
8 |
+
if ( ! function_exists( 'get_plugins' ) ) {
|
9 |
+
require_once ABSPATH . 'wp-admin/includes/plugin.php';
|
10 |
+
}
|
11 |
+
$plugins = get_plugins();
|
12 |
+
|
13 |
+
return isset( $plugins[ $plugin ] ) ? $plugins[ $plugin ] : false;
|
14 |
+
}
|
15 |
+
|
16 |
+
/**
|
17 |
+
* Get current timestamp
|
18 |
+
* @return integer
|
19 |
+
*/
|
20 |
+
public function time(){
|
21 |
+
return intval( current_time( 'timestamp' ) );
|
22 |
+
}
|
23 |
+
|
24 |
+
/**
|
25 |
+
* Make timestamp for a number
|
26 |
+
*
|
27 |
+
* @param string $time
|
28 |
+
* @return void
|
29 |
+
*/
|
30 |
+
public function strtotime( $time = '+7 day' ){
|
31 |
+
return intval( strtotime( date( 'r', $this->time() ) . " $time" ) );
|
32 |
+
}
|
33 |
+
|
34 |
+
public function date( $time ){
|
35 |
+
return date( 'd-m-Y h:i:s', $time );
|
36 |
+
}
|
37 |
+
}
|
vendor/priyomukul/wp-notice/src/Utils/Storage.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace PriyoMukul\WPNotice\Utils;
|
4 |
+
|
5 |
+
use function property_exists;
|
6 |
+
|
7 |
+
class Storage extends Base {
|
8 |
+
private $app = 'wpnotice';
|
9 |
+
private $type = 'options';
|
10 |
+
private $version = '1.0.0';
|
11 |
+
private $storage_key = 'wpnotice_options';
|
12 |
+
|
13 |
+
public function __construct( $args ){
|
14 |
+
$this->app = ! empty( $args['id'] ) ? $args['id'] : $this->app;
|
15 |
+
$this->type = ! empty( $args['store'] ) ? $args['store'] : $this->type;
|
16 |
+
$this->version = ! empty( $args['version'] ) ? $args['version'] : $this->version;
|
17 |
+
$this->storage_key = ! empty( $args['storage_key'] ) ? $this->app . '_' . $args['storage_key'] : $this->storage_key;
|
18 |
+
}
|
19 |
+
|
20 |
+
public function __get( $name ){
|
21 |
+
return property_exists( $this, $name ) ? $this->$name : null;
|
22 |
+
}
|
23 |
+
|
24 |
+
public function save( $value, $key = '' ){
|
25 |
+
if( empty( $key ) ) {
|
26 |
+
$key = $this->storage_key;
|
27 |
+
$value['version'] = $this->version;
|
28 |
+
}
|
29 |
+
|
30 |
+
if( $this->type === 'options' ) {
|
31 |
+
return update_site_option( $key, $value );
|
32 |
+
}
|
33 |
+
|
34 |
+
return false;
|
35 |
+
}
|
36 |
+
|
37 |
+
public function get( $key = '', $default = false ){
|
38 |
+
$key = empty( $key ) ? $this->storage_key : $key;
|
39 |
+
|
40 |
+
if( $this->type === 'options' ) {
|
41 |
+
return get_site_option( $key, $default );
|
42 |
+
}
|
43 |
+
|
44 |
+
return $default;
|
45 |
+
}
|
46 |
+
|
47 |
+
public function save_meta( $id, $value = true ){
|
48 |
+
return update_user_meta( get_current_user_id(), "{$this->app}_{$id}_notice_dismissed", $value );
|
49 |
+
}
|
50 |
+
|
51 |
+
public function get_meta( $id ){
|
52 |
+
return boolval( get_user_meta( get_current_user_id(), "{$this->app}_{$id}_notice_dismissed", true ) );
|
53 |
+
}
|
54 |
+
|
55 |
+
public function remove_meta( $id ){
|
56 |
+
return delete_user_meta( get_current_user_id(), "{$this->app}_{$id}_notice_dismissed" );
|
57 |
+
}
|
58 |
+
|
59 |
+
}
|