CMP – Coming Soon & Maintenance Plugin by NiteoThemes - Version 3.5.8

Version Description

Download this release

Release Info

Developer niteo
Plugin Icon 128x128 CMP – Coming Soon & Maintenance Plugin by NiteoThemes
Version 3.5.8
Comparing to
See all releases

Code changes from version 3.5.7 to 3.5.8

cmp-subscribers.php CHANGED
@@ -27,7 +27,6 @@ $cmp_subs_list_table->prepare_items();
27
  <form name="cmp_subscribe_form" method="post" action="admin.php?page=cmp-subscribers">
28
  <?php $cmp_subs_list_table->display(); ?>
29
  </form>
30
-
31
  <button id="export_csv" class="button"><?php _e('Export All Subscribers','cmp-coming-soon-maintenance');?></button>
32
  </div>
33
  <?php
27
  <form name="cmp_subscribe_form" method="post" action="admin.php?page=cmp-subscribers">
28
  <?php $cmp_subs_list_table->display(); ?>
29
  </form>
 
30
  <button id="export_csv" class="button"><?php _e('Export All Subscribers','cmp-coming-soon-maintenance');?></button>
31
  </div>
32
  <?php
inc/class-cmp-render_html.php CHANGED
@@ -735,8 +735,9 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
735
  let lastnameInput = document.getElementById(lastnameID); // Select lastname input by ID.
736
  let firstname = '';
737
  let lastname = '';
738
- selectButton.onclick = function(){ // If clicked on the button.
739
- if ( emailInput.value != '' ) {
 
740
  firstname = firstnameInput === null ? '' : firstnameInput.value;
741
  lastname = lastnameInput === null ? '' : lastnameInput.value;
742
 
@@ -755,13 +756,15 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
755
  })
756
  .then((data) => {
757
  selectResult.innerHTML = data.message; // Display the result inside result element.
758
- emailInput.value = '';
759
  selectForm.classList.add('-subscribed');
760
  if (data.status == 1) {
761
  selectForm.classList.remove('-subscribe-failed');
762
  selectForm.classList.add('-subscribe-successful');
763
-
 
 
764
  <?php do_action('cmp-successfull-subscribe-action'); ?>
 
765
  } else {
766
  selectForm.classList.add('-subscribe-failed');
767
  }
@@ -1560,12 +1563,11 @@ class CMP_Coming_Soon_and_Maintenance_Render_HTML extends CMP_Coming_Soon_and_Ma
1560
  <?php
1561
  } ?>
1562
 
1563
- <script>
1564
- /* <![CDATA[ */
1565
- var wpcf7 = {"apiSettings":{"root":"<?php echo $site_url;?>\/wp-json\/contact-form-7\/v1","namespace":"contact-form-7\/v1"},"recaptcha":{"messages":{"empty":"Please verify that you are not a robot."}}};
1566
- /* ]]> */
1567
  </script>
1568
-
1569
  <script src='<?php echo plugins_url('contact-form-7/includes/js/scripts.js?ver=5.0.1');?>'></script>
1570
  <?php
1571
  }
735
  let lastnameInput = document.getElementById(lastnameID); // Select lastname input by ID.
736
  let firstname = '';
737
  let lastname = '';
738
+ selectButton.onclick = function(e){ // If clicked on the button.
739
+
740
+ if ( emailInput.value !== '' ) {
741
  firstname = firstnameInput === null ? '' : firstnameInput.value;
742
  lastname = lastnameInput === null ? '' : lastnameInput.value;
743
 
756
  })
757
  .then((data) => {
758
  selectResult.innerHTML = data.message; // Display the result inside result element.
 
759
  selectForm.classList.add('-subscribed');
760
  if (data.status == 1) {
761
  selectForm.classList.remove('-subscribe-failed');
762
  selectForm.classList.add('-subscribe-successful');
763
+ emailInput.value = '';
764
+ firstnameInput ? firstnameInput.value = '' : null;
765
+ lastnameInput ? lastnameInput.value = '' : null;
766
  <?php do_action('cmp-successfull-subscribe-action'); ?>
767
+
768
  } else {
769
  selectForm.classList.add('-subscribe-failed');
770
  }
1563
  <?php
1564
  } ?>
1565
 
1566
+ <script type='text/javascript'>
1567
+ /* <![CDATA[ */
1568
+ var wpcf7 = {"apiSettings":{"root":"https:\/\/niteothemes.com\/dev\/index.php?rest_route=\/contact-form-7\/v1","namespace":"contact-form-7\/v1"}};
1569
+ /* ]]> */
1570
  </script>
 
1571
  <script src='<?php echo plugins_url('contact-form-7/includes/js/scripts.js?ver=5.0.1');?>'></script>
1572
  <?php
1573
  }
inc/settings/settings-background.php CHANGED
@@ -269,7 +269,7 @@ $gradient_array = array(
269
  <!-- Video mobile Thumbnail -->
270
  <div class="banner-video-source youtube local">
271
 
272
- <p><?php _e('Video backgrounds doesn`t work on mobile devices therefore only thumbnail video image will be displayed on mobile devices. Upload custom thumbnail image by pressing button below. ', 'cmp-coming-soon-maintenance');?></p>
273
  <input type="hidden" class="widefat" id="niteoCS-video-thumb-id" name="niteoCS_video_thumb" value="<?php echo esc_attr( $niteoCS_video_thumb ); ?>" />
274
  <input id="add-video-thumb" type="button" class="button" value="<?php _e('Media Library', 'cmp-coming-soon-maintenance');?>" /><br><br>
275
 
269
  <!-- Video mobile Thumbnail -->
270
  <div class="banner-video-source youtube local">
271
 
272
+ <p><?php _e('YouTube background doesn`t work on mobile devices therefore only thumbnail will be displayed on mobile devices. You can upload custom thumbnail image by pressing button below. ', 'cmp-coming-soon-maintenance');?></p>
273
  <input type="hidden" class="widefat" id="niteoCS-video-thumb-id" name="niteoCS_video_thumb" value="<?php echo esc_attr( $niteoCS_video_thumb ); ?>" />
274
  <input id="add-video-thumb" type="button" class="button" value="<?php _e('Media Library', 'cmp-coming-soon-maintenance');?>" /><br><br>
275
 
inc/settings/settings-subscribe.php CHANGED
@@ -27,6 +27,10 @@ if (isset($_POST['niteoCS_mailchimp_list_selected'])) {
27
  update_option('niteoCS_mailchimp_list_selected', sanitize_text_field($_POST['niteoCS_mailchimp_list_selected']));
28
  }
29
 
 
 
 
 
30
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
31
 
32
  if ( isset($_POST['niteoCS_mailchimp_double_opt']) ) {
@@ -49,6 +53,7 @@ $subscribe_method = get_option('niteoCS_subscribe_method', 'cmp');
49
  $mailchimp_apikey = get_option('niteoCS_mailchimp_apikey', '');
50
  $mailchimp_list_selected = get_option('niteoCS_mailchimp_list_selected');
51
  $mailchimp_lists = json_decode(get_option('niteoCS_mailchimp_lists', false), true);
 
52
 
53
  ?>
54
 
@@ -128,6 +133,7 @@ $mailchimp_lists = json_decode(get_option('niteoCS_mailchimp_lists', false),
128
  <select name="niteoCS_subscribe_method" id ="niteoCS_subscribe_method" class="subscribe-method">
129
  <option value="cmp" <?php selected( 'cmp', $subscribe_method ); ?>><?php _e('CMP Custom Subscribe List', 'cmp-coming-soon-maintenance');?></option>
130
  <option value="mailchimp" <?php selected( 'mailchimp', $subscribe_method ); ?>><?php _e('MailChimp Integration', 'cmp-coming-soon-maintenance');?></option>
 
131
  </select>
132
  </label>
133
 
@@ -141,13 +147,9 @@ $mailchimp_lists = json_decode(get_option('niteoCS_mailchimp_lists', false),
141
  <label for="niteoCS_mailchimp_apikey"><?php _e('MailChimp API key', 'cmp-coming-soon-maintenance');?>
142
  <input type="text" id="niteoCS_mailchimp_apikey" name="niteoCS_mailchimp_apikey" value="<?php echo esc_attr( $mailchimp_apikey );?>" class="regular-text code" placeholder="<?php _e('MailChimp API Key', 'cmp-coming-soon-maintenance');?>">
143
  </label><br><br>
144
-
145
  <button id="connect-mailchimp" class="button" data-security="<?php echo esc_attr($ajax_nonce);?>"><?php _e('Retrieve Lists', 'cmp-coming-soon-maintenance');?></button>
146
-
147
  <p><?php printf(__('You can find or create new API key in your %s.', 'cmp-coming-soon-maintenance'), '<a href="https://admin.mailchimp.com/account/api/" target="_blank">MailChimp Account</a>'); ?></p>
148
-
149
  <label for="niteoCS_mailchimp_list"><?php _e('Select MailChimp List to store emails.', 'cmp-coming-soon-maintenance');?>
150
-
151
  <select name="niteoCS_mailchimp_list_selected" id="niteoCS_mailchimp_list">
152
  <?php
153
  if ( is_array( $mailchimp_lists ) ) {
@@ -167,12 +169,40 @@ $mailchimp_lists = json_decode(get_option('niteoCS_mailchimp_lists', false),
167
  <?php
168
  } ?>
169
  </select>
170
-
171
  </label>
172
-
173
  <br><br>
174
-
175
  <label><input type="checkbox" name="niteoCS_mailchimp_double_opt" value="1" <?php checked( '1', get_option( 'niteoCS_mailchimp[double-opt]', '0' ) ); ?> class="regular-text code"><?php _e('Enable MailChimp Double Opt In', 'cmp-coming-soon-maintenance');?></label>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
176
 
177
  </div>
178
 
27
  update_option('niteoCS_mailchimp_list_selected', sanitize_text_field($_POST['niteoCS_mailchimp_list_selected']));
28
  }
29
 
30
+ if (isset($_POST['niteoCS_mailpoet_list_selected'])) {
31
+ update_option('niteoCS_mailpoet_list_selected', sanitize_text_field($_POST['niteoCS_mailpoet_list_selected']));
32
+ }
33
+
34
  if ( $_SERVER['REQUEST_METHOD'] == 'POST' ) {
35
 
36
  if ( isset($_POST['niteoCS_mailchimp_double_opt']) ) {
53
  $mailchimp_apikey = get_option('niteoCS_mailchimp_apikey', '');
54
  $mailchimp_list_selected = get_option('niteoCS_mailchimp_list_selected');
55
  $mailchimp_lists = json_decode(get_option('niteoCS_mailchimp_lists', false), true);
56
+ $mailpoet_list_selected = get_option('niteoCS_mailpoet_list_selected');
57
 
58
  ?>
59
 
133
  <select name="niteoCS_subscribe_method" id ="niteoCS_subscribe_method" class="subscribe-method">
134
  <option value="cmp" <?php selected( 'cmp', $subscribe_method ); ?>><?php _e('CMP Custom Subscribe List', 'cmp-coming-soon-maintenance');?></option>
135
  <option value="mailchimp" <?php selected( 'mailchimp', $subscribe_method ); ?>><?php _e('MailChimp Integration', 'cmp-coming-soon-maintenance');?></option>
136
+ <option value="mailpoet" <?php selected( 'mailpoet', $subscribe_method ); ?>><?php _e('MailPoet Integration', 'cmp-coming-soon-maintenance');?></option>
137
  </select>
138
  </label>
139
 
147
  <label for="niteoCS_mailchimp_apikey"><?php _e('MailChimp API key', 'cmp-coming-soon-maintenance');?>
148
  <input type="text" id="niteoCS_mailchimp_apikey" name="niteoCS_mailchimp_apikey" value="<?php echo esc_attr( $mailchimp_apikey );?>" class="regular-text code" placeholder="<?php _e('MailChimp API Key', 'cmp-coming-soon-maintenance');?>">
149
  </label><br><br>
 
150
  <button id="connect-mailchimp" class="button" data-security="<?php echo esc_attr($ajax_nonce);?>"><?php _e('Retrieve Lists', 'cmp-coming-soon-maintenance');?></button>
 
151
  <p><?php printf(__('You can find or create new API key in your %s.', 'cmp-coming-soon-maintenance'), '<a href="https://admin.mailchimp.com/account/api/" target="_blank">MailChimp Account</a>'); ?></p>
 
152
  <label for="niteoCS_mailchimp_list"><?php _e('Select MailChimp List to store emails.', 'cmp-coming-soon-maintenance');?>
 
153
  <select name="niteoCS_mailchimp_list_selected" id="niteoCS_mailchimp_list">
154
  <?php
155
  if ( is_array( $mailchimp_lists ) ) {
169
  <?php
170
  } ?>
171
  </select>
 
172
  </label>
 
173
  <br><br>
 
174
  <label><input type="checkbox" name="niteoCS_mailchimp_double_opt" value="1" <?php checked( '1', get_option( 'niteoCS_mailchimp[double-opt]', '0' ) ); ?> class="regular-text code"><?php _e('Enable MailChimp Double Opt In', 'cmp-coming-soon-maintenance');?></label>
175
+ </div>
176
+
177
+ <div class="subscribe-method mailpoet">
178
+
179
+ <?php
180
+ $mailpoet_lists = null;
181
+ // get MailPoet Lists
182
+ if (class_exists(\MailPoet\API\API::class)) {
183
+ // Get MailPoet API instance
184
+ $mailpoet_api = \MailPoet\API\API::MP('v1');
185
+ // Get available list so that a subscriber can choose in which to subscribe
186
+ $mailpoet_lists = $mailpoet_api->getLists();
187
+ } ?>
188
+
189
+ <br>
190
+
191
+ <label for="niteoCS_mailpoet_list"><?php _e('Select MailPoet List to store emails.', 'cmp-coming-soon-maintenance');?>
192
+ <select name="niteoCS_mailpoet_list_selected" id="niteoCS_mailpoet_list">
193
+ <?php
194
+ if ( is_array( $mailpoet_lists ) ) {
195
+ foreach ( $mailpoet_lists as $list) { ?>
196
+ <option value="<?php echo esc_attr( $list['id'] );?>" <?php selected( $list['id'], $mailpoet_list_selected ); ?>><?php echo esc_attr( $list['name'] );?></option>
197
+ <?php
198
+ }
199
+
200
+ } else { ?>
201
+ <option value="error"><?php _e('Please install MailPoet plugin and make sure a subscribe list is created.', 'cmp-coming-soon-maintenance');?></option>
202
+ <?php
203
+ } ?>
204
+ </select>
205
+ </label>
206
 
207
  </div>
208
 
js/external/vidim.min.js CHANGED
@@ -1,8 +1,8 @@
1
- /*
2
- * vidim v1.0.1
3
- * 2017-03-13T17:00:04.439Z
4
- * https://github.com/OriginalEXE/vidim
5
- *
6
- * Made by Ante Sepic
7
- */
8
- !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.vidim=e()}(this,function(){"use strict";function t(t,e){return e={exports:{}},t(e,e.exports),e.exports}function e(t,e){var i=Object.keys(e);i.forEach(function(i){t.hasOwnProperty(i)||(t[i]=e[i])})}function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return"string"==typeof t?e.querySelector(t):t}function s(t,e){var i,s,o,n,r=0,a=function(){r=Date.now(),i=null,n=t.apply(s,o),i||(s=o=null)},l=function(){var l=Date.now();r||(r=l);var h=e-(l-r);return s=this,o=arguments,h<=0||h>e?(i&&(clearTimeout(i),i=null),r=l,n=t.apply(s,o),i||(s=o=null)):i||(i=setTimeout(a,h)),n};return l.cancel=function(){clearTimeout(i),r=0,i=s=o=null},l}function o(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}var n=t(function(t){function e(t){if(t)return i(t)}function i(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var s,o=0;o<i.length;o++)if(s=i[o],s===e||s.fn===e){i.splice(o,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i){i=i.slice(0);for(var s=0,o=i.length;s<o;++s)i[s].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),r=Object.freeze({setDefaults:e,getElement:i,throttle:s,ready:o}),a=function(t){var i={preload:"auto"},s={_initializeProvider:function(){e(this._options,i),this._constructPlayer(),this._dispatch(),this._listen()},_constructPlayer:function(){this.el=document.createElement("video"),this.el.setAttribute("playsinline",""),this._options.loop&&this.el.setAttribute("loop",""),this._options.autoplay&&this.el.setAttribute("autoplay",""),this._options.preload&&this.el.setAttribute("preload",this._options.preload),this._options.muted&&(this.el.muted=!0),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0";var t=this._options.src;if(t.length&&"string"!=typeof t)for(var e=0;e<t.length;e++){var i=document.createElement("source");i.setAttribute("type",t[e].type),i.setAttribute("src",t[e].src),this.el.appendChild(i)}this.wrapper.appendChild(this.el),this._options.startAt&&(this.el.currentTime=this._options.startAt),"function"==typeof this._options.onReady&&this._options.onReady(this),this.emit("ready"),this._constructOverlay(),this.resize()},_dispatch:function(){var t=this;this.el.addEventListener("play",function(){t.emit("play",t)},!1),this.el.addEventListener("pause",function(){t.emit("pause",t)},!1),this.el.addEventListener("ended",function(){t.emit("end",t)},!1),this.el.addEventListener("canplay",function(){t.emit("canplay",t)},!1),this.el.addEventListener("canplaythrough",function(){t.emit("canplaythrough",t)},!1)},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd&&this.on("end",function(){t.el.style.opacity="0"}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.el.play(),this},pause:function(){return this.el.pause(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.el.volume=parseFloat(t/100),this},getVolume:function(){return 100*this.el.volume},mute:function(){return this.el.muted=!0,this},unMute:function(){return this.el.muted=!1,this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.el.currentTime=t,this},getTime:function(){return this.el.currentTime},getDuration:function(){return this.el.duration},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.el.innerHTML="",t.length&&"string"!=typeof t)for(var i=0;i<t.length;i++){var s=document.createElement("source");s.setAttribute("type",t[i].type),s.setAttribute("src",t[i].src),this.el.appendChild(s)}if(this.el.load&&this.el.load(),this._options.startAt&&(this.el.currentTime=this._options.startAt),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.el.pause&&this.el.pause(),this.el.src="",this.el.load&&this.el.load();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}t.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth=""):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )"),this.emit("resize")}}};t.registerProvider("HTML5",s)},l=!1,h=function(t){var i={quality:"hd1080"},s={_initializeProvider:function(){var t=this;l?(e(this._options,i),this._constructPlayer(),this._listen()):window.addEventListener("vidimYouTubeAPIReady",function(){e(t._options,i),t._constructPlayer(),t._listen()},!1)},_constructPlayer:function(){var t=this;if(11===this._options.src.length)this.videoID=this._options.src;else{var e=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,i=this._options.src.match(e);if(!i||11!==i[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=i[2]}var s=document.createElement("div");this.wrapper.appendChild(s);var o={videoId:this.videoID,playerVars:{allowfullscreen:!1,controls:0,enablejsapi:1,disablekb:1,fs:0,iv_load_policy:3,modestbranding:1,origin:window.location.host,playsinline:1,rel:0,showinfo:0,start:this._options.startAt,autoplay:+this._options.autoplay},events:{onReady:function(){if(t._options.muted&&t.mute(),t.player.setPlaybackQuality(t._options.quality),"function"==typeof t._options.onReady&&t._options.onReady(t),t.emit("ready"),t._options.loop){var e=void 0;t.on("play",function(){e=setInterval(function(){(0===t.getTime()||t.getTime()+.15>t.getDuration())&&(t.setTime(0),t.play())},100)}),t.on("pause",function(){clearInterval(e)}),t.on("destroy",function(){clearInterval(e)})}},onStateChange:function(e){switch(e.data){case 0:t.emit("end",t);break;case 1:t.emit("play",t);break;case 2:t.emit("pause",t);break;case 3:t.emit("buffering",t)}}}};this._options.loop&&(o.playerVars.playlist=this.videoID,o.playerVars.loop=1),this.player=new YT.Player(s,o),this.el=this.player.getIframe(),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0",this._constructOverlay(),this.resize()},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd?this.on("end",function(){t.el.style.opacity="0"}):this.on("end",function(){t.player.seekTo(t.player.getDuration()),t.player.playVideo(),t.player.pauseVideo()}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.player.playVideo(),this},pause:function(){return this.player.pauseVideo(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.player.setVolume(t),this},getVolume:function(){return this.getVolume()},mute:function(){return this.player.mute(),this},unMute:function(){return this.player.unMute(),this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.player.seekTo(t,!0),this},getTime:function(){return this.player.getCurrentTime()},getDuration:function(){return this.player.getDuration()},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(11===t.length)this.videoID=t;else{var i=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,s=t.match(i);if(!s||11!==s[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=s[2]}if(this.player.loadPlaylist(this.videoID,0,this._options.startAt,this._options.quality),this.player.setLoop(this._options.loop),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.player.destroy();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}t.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth="",this.el.style.height="",this.el.style.width=this.el.offsetHeight*this._options.ratio+200+"px"):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )",this.el.style.height=this.el.offsetWidth/this._options.ratio+"px",this.el.style.width="",this.el.offsetHeight<this.wrapper.offsetHeight+140&&(this.el.style.height=this.el.offsetWidth/this._options.ratio+140+"px")),this.emit("resize")}}};t.registerProvider("YouTube",s)},p=document.createElement("script");p.src="https://www.youtube.com/iframe_api",document.querySelector("body").appendChild(p);var c=document.createEvent("Event");if(c.initEvent("vidimYouTubeAPIReady",!0,!0),"undefined"==typeof window.onYouTubeIframeAPIReady)window.onYouTubeIframeAPIReady=function(){window.vidimYouTubeAPIReady=!0,l=!0,window.dispatchEvent(c)};else{var u=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){u(),window.vidimYouTubeAPIReady=!0,l=!0,window.dispatchEvent(c)}}var d=function(t){function l(e,i){"function"==typeof i?g[e]=i.call(t,_):g[e]=i}function p(t){return m[t]?m[t]:null}function c(t){return t=i(t),"undefined"!=typeof t.vidimID&&m[t.vidimID]?m[t.vidimID]:null}function u(){for(var t in m)m[t].hasOwnProperty("destroy")&&m[t].destroy();m={}}function d(t){delete m[t]}function y(){var t=document.querySelectorAll("[data-vidim]");if(t.length)for(var e=0;e<t.length;e++){var i=t[e],s=i.getAttribute("data-vidim");if("undefined"==typeof i.vidimID)try{var o=/({|,)(?:\s*)(?:')?([A-Za-z_$\.][A-Za-z0-9_ \-\.$]*)(?:')?(?:\s*):/g,n=s.replace(o,'$1"$2":').replace(/:\s?'/g,':"').replace(/'\s?}/g,'"}').replace(/',"/g,'","'),r=JSON.parse(n);new f(i,r)}catch(t){}}}function f(t){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(s).forEach(function(t){w.push(t)}),e(s,_),s.src&&!g[s.type]?new Error("No provider can handle type: '"+s.type+"'"):("string"==typeof s.ratio&&("4/3"===s.ratio?s.ratio=4/3:s.ratio=16/9),this._options=s,this.container=i(t),this.container?(-1===w.indexOf("zIndex")&&"BODY"===this.container.nodeName&&(this._options.zIndex=-1),void this._initialize()):new Error("Could not find the container: "+t))}if("undefined"!=typeof t.document){var v=0,m={},_={wrapperClass:"",overlayClass:"",src:!1,type:"HTML5",ratio:1.7778,autoplay:!0,loop:!0,poster:"",showPosterBeforePlay:!0,showPosterOnEnd:!1,showPosterOnPause:!1,zIndex:0,autoResize:!0,muted:!0,startAt:0,onReady:!1},w=[],g={},b=f.prototype;return b._initialize=function(){if(this.vidimID=v++,this.container.vidimID=this.vidimID,m[this.vidimID]=this,n(this),!this._options.src&&this._options.poster)return this._constructWrapper(),void(this.destroy=function(){this.emit("destroy");try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}f.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()});var t=g[this._options.type];for(var e in t)this[e]=t[e];return"function"!=typeof this._initializeProvider?new Error("Provider is missing method: _initializeProvider"):(this._constructWrapper(),this._initializeProvider(),this._options.autoResize&&window.addEventListener("resize",s(this.resize,200).bind(this),!1),void this.resize())},b._constructWrapper=function(){var t=getComputedStyle(this.container,null);"static"===t.getPropertyValue("position")&&(this.container.style.position="relative"),this.wrapper=document.createElement("div"),"BODY"===this.container.nodeName?this.wrapper.style.position="fixed":this.wrapper.style.position="absolute",this._options.wrapperClass&&("function"==typeof this._options.wrapperClass?this.wrapper.classList.add(this._options.wrapperClass.call(this)):this.wrapper.classList.add(this._options.wrapperClass)),this.wrapper.style.left=0,this.wrapper.style.top=0,this.wrapper.style.height="100%",this.wrapper.style.width="100%",this.wrapper.style.overflow="hidden",this.wrapper.style.zIndex=parseInt(this._options.zIndex,10),this._options.poster&&(this.wrapper.style.backgroundSize="cover",this.wrapper.style.backgroundPosition="center center",this.wrapper.style.backgroundRepear="no-repeat",this._options.showPosterBeforePlay&&(this.wrapper.style.backgroundImage="url('"+this._options.poster+"')")),this.container.insertBefore(this.wrapper,this.container.firstChild)},b._constructOverlay=function(){this.overlay=document.createElement("div"),this.overlay.style.position="absolute",this._options.overlayClass&&("function"==typeof this._options.overlayClass?this.overlay.classList.add(this._options.overlayClass.call(this)):this.overlay.classList.add(this._options.overlayClass)),this.overlay.style.left=0,this.overlay.style.top=0,this.overlay.style.height="100%",this.overlay.style.width="100%",this.wrapper.appendChild(this.overlay)},f.getInstanceFromID=p,f.getInstanceFromElement=c,f.registerProvider=l,f.destroyAllInstances=u,f.deleteInstance=d,f.utility=r,f.scanDOM=y,a(f),h(f),o(y),f}}("undefined"!=typeof window?window:void 0);return d});
1
+ /*
2
+ * vidim v1.0.1
3
+ * 2018-08-24T13:55:53.385Z
4
+ * https://github.com/OriginalEXE/vidim
5
+ *
6
+ * Made by Ante Sepic
7
+ */
8
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.vidim=e()}(this,function(){"use strict";function t(t,e){Object.keys(e).forEach(function(i){t.hasOwnProperty(i)||(t[i]=e[i])})}function e(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document;return"string"==typeof t?e.querySelector(t):t}function i(t,e){var i,s,o,n,r=0,a=function(){r=Date.now(),i=null,n=t.apply(s,o),i||(s=o=null)},l=function(){var l=Date.now();r||(r=l);var h=e-(l-r);return s=this,o=arguments,h<=0||h>e?(i&&(clearTimeout(i),i=null),r=l,n=t.apply(s,o),i||(s=o=null)):i||(i=setTimeout(a,h)),n};return l.cancel=function(){clearTimeout(i),r=0,i=s=o=null},l}function s(t){"loading"!=document.readyState?t():document.addEventListener("DOMContentLoaded",t)}var o=function(t,e){return e={exports:{}},t(e,e.exports),e.exports}(function(t){function e(t){if(t)return i(t)}function i(t){for(var i in e.prototype)t[i]=e.prototype[i];return t}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function i(){this.off(t,i),e.apply(this,arguments)}return i.fn=e,this.on(t,i),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var s,o=0;o<i.length;o++)if((s=i[o])===e||s.fn===e){i.splice(o,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),i=this._callbacks["$"+t];if(i){i=i.slice(0);for(var s=0,o=i.length;s<o;++s)i[s].apply(this,e)}return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}}),n=Object.freeze({setDefaults:t,getElement:e,throttle:i,ready:s}),r=function(e){var i={preload:"auto"},s={_initializeProvider:function(){t(this._options,i),this._constructPlayer(),this._dispatch(),this._listen()},_constructPlayer:function(){this.el=document.createElement("video"),this.el.setAttribute("playsinline",""),this._options.loop&&this.el.setAttribute("loop",""),this._options.autoplay&&this.el.setAttribute("autoplay",""),this._options.preload&&this.el.setAttribute("preload",this._options.preload),this._options.muted&&(this.el.muted=!0),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0";var t=this._options.src;if(t.length&&"string"!=typeof t)for(var e=0;e<t.length;e++){var i=document.createElement("source");i.setAttribute("type",t[e].type),i.setAttribute("src",t[e].src),this.el.appendChild(i)}this.wrapper.appendChild(this.el),this._options.startAt&&(this.el.currentTime=this._options.startAt),"function"==typeof this._options.onReady&&this._options.onReady(this),this.emit("ready"),this._constructOverlay(),this.resize()},_dispatch:function(){var t=this;this.el.addEventListener("play",function(){t.emit("play",t)},!1),this.el.addEventListener("pause",function(){t.emit("pause",t)},!1),this.el.addEventListener("ended",function(){t.emit("end",t)},!1),this.el.addEventListener("canplay",function(){t.emit("canplay",t)},!1),this.el.addEventListener("canplaythrough",function(){t.emit("canplaythrough",t)},!1)},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd&&this.on("end",function(){t.el.style.opacity="0"}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.el.play(),this},pause:function(){return this.el.pause(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.el.volume=parseFloat(t/100),this},getVolume:function(){return 100*this.el.volume},mute:function(){return this.el.muted=!0,this},unMute:function(){return this.el.muted=!1,this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.el.currentTime=t,this},getTime:function(){return this.el.currentTime},getDuration:function(){return this.el.duration},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.el.innerHTML="",t.length&&"string"!=typeof t)for(var i=0;i<t.length;i++){var s=document.createElement("source");s.setAttribute("type",t[i].type),s.setAttribute("src",t[i].src),this.el.appendChild(s)}if(this.el.load&&this.el.load(),this._options.startAt&&(this.el.currentTime=this._options.startAt),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.el.pause&&this.el.pause(),this.el.src="",this.el.load&&this.el.load();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}e.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth=""):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )"),this.emit("resize")}}};e.registerProvider("HTML5",s)},a=!1,l=function(e){var i={quality:"hd1080"},s={_initializeProvider:function(){var e=this;a?(t(this._options,i),this._constructPlayer(),this._listen()):window.addEventListener("vidimYouTubeAPIReady",function(){t(e._options,i),e._constructPlayer(),e._listen()},!1)},_constructPlayer:function(){var t=this;if(11===this._options.src.length)this.videoID=this._options.src;else{var e=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,i=this._options.src.match(e);if(!i||11!==i[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=i[2]}var s=document.createElement("div");this.wrapper.appendChild(s);var o={videoId:this.videoID,playerVars:{allowfullscreen:!1,controls:0,enablejsapi:1,disablekb:1,fs:0,iv_load_policy:3,modestbranding:1,origin:void 0!==window.location.origin?window.location.origin:window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:""),playsinline:1,rel:0,showinfo:0,start:this._options.startAt,autoplay:+this._options.autoplay},events:{onReady:function(){if(t._options.muted&&t.mute(),t.player.setPlaybackQuality(t._options.quality),"function"==typeof t._options.onReady&&t._options.onReady(t),t.emit("ready"),t._options.loop){var e=void 0;t.on("play",function(){e=setInterval(function(){(0===t.getTime()||t.getTime()+.15>t.getDuration())&&(t.setTime(0),t.play())},100)}),t.on("pause",function(){clearInterval(e)}),t.on("destroy",function(){clearInterval(e)})}},onStateChange:function(e){switch(e.data){case 0:t.emit("end",t);break;case 1:t.emit("play",t);break;case 2:t.emit("pause",t);break;case 3:t.emit("buffering",t)}}}};this._options.loop&&(o.playerVars.playlist=this.videoID,o.playerVars.loop=1),this.player=new YT.Player(s,o),this.el=this.player.getIframe(),this.el.style.position="absolute",this.el.style.left="50%",this.el.style.top="50%",this.el.style.transform="translate(-50%, -50%)",this.el.style.webkitTransform="translate(-50%, -50%)",this.el.style.msTransform="translate(-50%, -50%)",this.el.style.oTransform="translate(-50%, -50%)",this.el.style.mozTransform="translate(-50%, -50%)",this.el.style.minWidth="calc( 100% + 2px )",this.el.style.minHeight="calc( 100% + 2px )",this.el.style.opacity="0",this._constructOverlay(),this.resize()},_listen:function(){var t=this;this.on("play",function(){t.el.style.opacity="1"}),this._options.showPosterBeforePlay||this.once("play",function(){t.wrapper.style.backgroundImage="url('"+t._options.poster+"')"}),this._options.showPosterOnEnd?this.on("end",function(){t.el.style.opacity="0"}):this.on("end",function(){t.player.seekTo(t.player.getDuration()),t.player.playVideo(),t.player.pauseVideo()}),this._options.showPosterOnPause&&this.on("pause",function(){t.el.style.opacity="0"})},play:function(){return this.player.playVideo(),this},pause:function(){return this.player.pauseVideo(),this},setVolume:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:100;return this.player.setVolume(t),this},getVolume:function(){return this.getVolume()},mute:function(){return this.player.mute(),this},unMute:function(){return this.player.unMute(),this},setTime:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.player.seekTo(t,!0),this},getTime:function(){return this.player.getCurrentTime()},getDuration:function(){return this.player.getDuration()},showPoster:function(){this.pause().el.style.opacity="0"},changeSource:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(11===t.length)this.videoID=t;else{var i=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=|\?v=)([^#\&\?]*).*/,s=t.match(i);if(!s||11!==s[2].length)return new Error("Provided source is not a valid YouTube url");this.videoID=s[2]}if(this.player.loadPlaylist(this.videoID,0,this._options.startAt,this._options.quality),this.player.setLoop(this._options.loop),e){var o=this._options.poster;-1!==this.wrapper.style.backgroundImage.indexOf(o)&&(this.wrapper.style.backgroundImage="url('"+e+"')"),this._options.poster=e}},destroy:function(){this.emit("destroy"),this.player.destroy();try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}e.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()},resize:function(){if(this.el){var t=this.container.offsetHeight,e=this.container.offsetWidth;"BODY"===this.container.nodeName&&(e=window.innerWidth,t=window.innerHeight),1<this._options.ratio&&e/t<this._options.ratio||1>this._options.ratio&&t/e<this._options.ratio?(this.el.style.maxHeight="calc( 100% + 2px )",this.el.style.maxWidth="",this.el.style.height="",this.el.style.width=this.el.offsetHeight*this._options.ratio+200+"px"):(this.el.style.maxHeight="",this.el.style.maxWidth="calc( 100% + 2px )",this.el.style.height=this.el.offsetWidth/this._options.ratio+"px",this.el.style.width="",this.el.offsetHeight<this.wrapper.offsetHeight+140&&(this.el.style.height=this.el.offsetWidth/this._options.ratio+140+"px")),this.emit("resize")}}};e.registerProvider("YouTube",s)},h=document.createElement("script");h.src="https://www.youtube.com/iframe_api",document.querySelector("body").appendChild(h);var p=document.createEvent("Event");if(p.initEvent("vidimYouTubeAPIReady",!0,!0),void 0===window.onYouTubeIframeAPIReady)window.onYouTubeIframeAPIReady=function(){window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(p)};else{var c=window.onYouTubeIframeAPIReady;window.onYouTubeIframeAPIReady=function(){c(),window.vidimYouTubeAPIReady=!0,a=!0,window.dispatchEvent(p)}}return function(a){function h(t,e){g[t]="function"==typeof e?e.call(a,w):e}function p(t){return m[t]?m[t]:null}function c(t){return t=e(t),void 0!==t.vidimID&&m[t.vidimID]?m[t.vidimID]:null}function u(){for(var t in m)m[t].hasOwnProperty("destroy")&&m[t].destroy();m={}}function d(t){delete m[t]}function y(){var t=document.querySelectorAll("[data-vidim]");if(t.length)for(var e=0;e<t.length;e++){var i=t[e],s=i.getAttribute("data-vidim");if(void 0===i.vidimID)try{var o=/({|,)(?:\s*)(?:')?([A-Za-z_$\.][A-Za-z0-9_ \-\.$]*)(?:')?(?:\s*):/g,n=s.replace(o,'$1"$2":').replace(/:\s?'/g,':"').replace(/'\s?}/g,'"}').replace(/',"/g,'","'),r=JSON.parse(n);new f(i,r)}catch(t){}}}function f(i){var s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return Object.keys(s).forEach(function(t){_.push(t)}),t(s,w),s.src&&!g[s.type]?new Error("No provider can handle type: '"+s.type+"'"):("string"==typeof s.ratio&&("4/3"===s.ratio?s.ratio=4/3:s.ratio=16/9),this._options=s,this.container=e(i),this.container?(-1===_.indexOf("zIndex")&&"BODY"===this.container.nodeName&&(this._options.zIndex=-1),void this._initialize()):new Error("Could not find the container: "+i))}if(void 0!==a.document){var v=0,m={},w={wrapperClass:"",overlayClass:"",src:!1,type:"HTML5",ratio:1.7778,autoplay:!0,loop:!0,poster:"",showPosterBeforePlay:!0,showPosterOnEnd:!1,showPosterOnPause:!1,zIndex:0,autoResize:!0,muted:!0,startAt:0,onReady:!1},_=[],g={},b=f.prototype;return b._initialize=function(){if(this.vidimID=v++,this.container.vidimID=this.vidimID,m[this.vidimID]=this,o(this),!this._options.src&&this._options.poster)return this._constructWrapper(),void(this.destroy=function(){this.emit("destroy");try{this.wrapper.parentNode.removeChild(this.wrapper)}catch(t){}f.deleteInstance(this.vidimID),delete this.container.vidimID,this.off()});var t=g[this._options.type];for(var e in t)this[e]=t[e];if("function"!=typeof this._initializeProvider)return new Error("Provider is missing method: _initializeProvider");this._constructWrapper(),this._initializeProvider(),this._options.autoResize&&window.addEventListener("resize",i(this.resize,200).bind(this),!1),this.resize()},b._constructWrapper=function(){"static"===getComputedStyle(this.container,null).getPropertyValue("position")&&(this.container.style.position="relative"),this.wrapper=document.createElement("div"),"BODY"===this.container.nodeName?this.wrapper.style.position="fixed":this.wrapper.style.position="absolute",this._options.wrapperClass&&("function"==typeof this._options.wrapperClass?this.wrapper.classList.add(this._options.wrapperClass.call(this)):this.wrapper.classList.add(this._options.wrapperClass)),this.wrapper.style.left=0,this.wrapper.style.top=0,this.wrapper.style.height="100%",this.wrapper.style.width="100%",this.wrapper.style.overflow="hidden",this.wrapper.style.zIndex=parseInt(this._options.zIndex,10),this._options.poster&&(this.wrapper.style.backgroundSize="cover",this.wrapper.style.backgroundPosition="center center",this.wrapper.style.backgroundRepear="no-repeat",this._options.showPosterBeforePlay&&(this.wrapper.style.backgroundImage="url('"+this._options.poster+"')")),this.container.insertBefore(this.wrapper,this.container.firstChild)},b._constructOverlay=function(){this.overlay=document.createElement("div"),this.overlay.style.position="absolute",this._options.overlayClass&&("function"==typeof this._options.overlayClass?this.overlay.classList.add(this._options.overlayClass.call(this)):this.overlay.classList.add(this._options.overlayClass)),this.overlay.style.left=0,this.overlay.style.top=0,this.overlay.style.height="100%",this.overlay.style.width="100%",this.wrapper.appendChild(this.overlay)},f.getInstanceFromID=p,f.getInstanceFromElement=c,f.registerProvider=h,f.destroyAllInstances=u,f.deleteInstance=d,f.utility=n,f.scanDOM=y,r(f),l(f),s(y),f}}("undefined"!=typeof window?window:void 0)});
niteo-cmp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
- Version: 3.5.7
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -24,7 +24,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
24
  * Main CMP Coming Soon and Maintenance class.
25
  *
26
  * @since 2.8
27
- */
28
  class CMP_Coming_Soon_and_Maintenance {
29
 
30
  /**
@@ -64,7 +64,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
64
 
65
  private function constants() {
66
  // define constants
67
- $this->define( 'CMP_VERSION', '3.5.7' );
68
  $this->define( 'CMP_DEBUG', FALSE );
69
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
70
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -1364,7 +1364,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1364
 
1365
  if ( is_email( $_POST['email'] ) ) {
1366
  // email already passed is_email, no need to sanitize
1367
- $email = $_POST['email'];
1368
 
1369
  // sanitize all inputs
1370
  $ip_address = ( isset( $_POST['lastname'] ) ) ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : '';
@@ -1406,7 +1406,6 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1406
  case 'mailchimp':
1407
  $api_key = esc_attr( get_option('niteoCS_mailchimp_apikey') );
1408
  $list_id = esc_attr( get_option('niteoCS_mailchimp_list_selected') );
1409
- $email = $_POST['email'];
1410
  $double_opt = get_option( 'niteoCS_mailchimp[double-opt]', '0' );
1411
  $status = ( $double_opt == '1') ? 'pending' : 'subscribed'; // subscribed, cleaned, pending
1412
 
@@ -1443,7 +1442,51 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1443
  $response = array( 'status' => '0', 'message' => $error);
1444
  }
1445
 
1446
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1447
 
1448
  default:
1449
  break;
@@ -1470,23 +1513,44 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1470
  $subscribers = get_option('niteoCS_subscribers_list');
1471
 
1472
  if( !empty($subscribers) ) {
1473
- $filename = 'subscribers-list-' . date('Y-m-d') . '.csv';
 
1474
  header('Content-Type: text/csv');
1475
  header('Content-Disposition: attachment;filename='.$filename);
 
1476
  $fp = fopen('php://output', 'w');
1477
- fputcsv($fp, array(__('Date','cmp-coming-soon-maintenance'),__('Email','cmp-coming-soon-maintenance')));
1478
- foreach ($subscribers as $key => $value) {
 
 
 
 
 
 
 
 
 
 
 
 
1479
  if ( isset( $value['ip_address'] ) ) {
1480
  unset($subscribers[$key]['ip_address']);
1481
  }
1482
- if ( isset( $value['id'] ) ) {
1483
- unset($subscribers[$key]['id']);
1484
- }
1485
 
1486
  if ( isset( $value['timestamp'] ) ) {
1487
  $format="Y-m-d H:i:s";
1488
  $subscribers[$key]['timestamp'] = date_i18n($format, $subscribers[$key]['timestamp']);
1489
  }
 
 
 
 
 
 
 
 
 
 
1490
  }
1491
 
1492
  foreach ( $subscribers as $key => $value ) {
3
  Plugin Name: CMP - Coming Soon & Maintenance Plugin
4
  Plugin URI: https://wordpress.org/plugins/cmp-coming-soon-maintenance/
5
  Description: Display customizable landing page for Coming Soon, Maintenance & Under Construction page.
6
+ Version: 3.5.8
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
24
  * Main CMP Coming Soon and Maintenance class.
25
  *
26
  * @since 2.8
27
+ */
28
  class CMP_Coming_Soon_and_Maintenance {
29
 
30
  /**
64
 
65
  private function constants() {
66
  // define constants
67
+ $this->define( 'CMP_VERSION', '3.5.8' );
68
  $this->define( 'CMP_DEBUG', FALSE );
69
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
70
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
1364
 
1365
  if ( is_email( $_POST['email'] ) ) {
1366
  // email already passed is_email, no need to sanitize
1367
+ $email = sanitize_email( $_POST['email'] );
1368
 
1369
  // sanitize all inputs
1370
  $ip_address = ( isset( $_POST['lastname'] ) ) ? sanitize_text_field($_SERVER['REMOTE_ADDR']) : '';
1406
  case 'mailchimp':
1407
  $api_key = esc_attr( get_option('niteoCS_mailchimp_apikey') );
1408
  $list_id = esc_attr( get_option('niteoCS_mailchimp_list_selected') );
 
1409
  $double_opt = get_option( 'niteoCS_mailchimp[double-opt]', '0' );
1410
  $status = ( $double_opt == '1') ? 'pending' : 'subscribed'; // subscribed, cleaned, pending
1411
 
1442
  $response = array( 'status' => '0', 'message' => $error);
1443
  }
1444
 
1445
+ break;
1446
+
1447
+ // MailPoet integration
1448
+ case 'mailpoet':
1449
+ $mailpoet_list = get_option('niteoCS_mailpoet_list_selected');
1450
+ $list_ids = array($mailpoet_list);
1451
+ $firstname = $firstname === '' ? null : $firstname;
1452
+ $lastname = $lastname === '' ? null : $lastname;
1453
+ $subscriber = array(
1454
+ 'email' => $email,
1455
+ 'first_name' => $firstname,
1456
+ 'last_name' => $lastname
1457
+ );
1458
+
1459
+ $response = array( 'status' => '0', 'message' => __('Something went wrong please try again later.', 'cmp-coming-soon-maintenance') );
1460
+
1461
+ if ( class_exists(\MailPoet\API\API::class) ) {
1462
+ // Get MailPoet API instance
1463
+ $mailpoet_api = \MailPoet\API\API::MP('v1');
1464
+
1465
+ // Check if subscriber exists. If subscriber doesn't exist an exception is thrown
1466
+ try {
1467
+ $subscribed = $mailpoet_api->getSubscriber($subscriber['email']);
1468
+ } catch (\Exception $e) {}
1469
+
1470
+ try {
1471
+ if (!$subscribed) {
1472
+ // Subscriber doesn't exist let's create one
1473
+ $mailpoet_api->addSubscriber($subscriber, $list_ids);
1474
+ $response = array( 'status' => '1', 'message' => $response_ok);
1475
+
1476
+ } else {
1477
+ // In case subscriber exists just add him to new lists
1478
+ $mailpoet_api->subscribeToLists($subscriber['email'], $list_ids);
1479
+ $response = array( 'status' => '1', 'message' => $response_ok);
1480
+
1481
+ }
1482
+ } catch (\Exception $e) {
1483
+ $error_message = $e->getMessage();
1484
+ $response = array( 'status' => '0', 'message' => $error_message);
1485
+ }
1486
+
1487
+ }
1488
+
1489
+ break;
1490
 
1491
  default:
1492
  break;
1513
  $subscribers = get_option('niteoCS_subscribers_list');
1514
 
1515
  if( !empty($subscribers) ) {
1516
+ $filename = 'cmp-subscribers-export-' . date('Y-m-d') . '.csv';
1517
+
1518
  header('Content-Type: text/csv');
1519
  header('Content-Disposition: attachment;filename='.$filename);
1520
+
1521
  $fp = fopen('php://output', 'w');
1522
+
1523
+ fputcsv($fp, array(
1524
+ __('ID','cmp-coming-soon-maintenance'),
1525
+ __('Date','cmp-coming-soon-maintenance'),
1526
+ __('Email','cmp-coming-soon-maintenance'),
1527
+ __('Firstname','cmp-coming-soon-maintenance'),
1528
+ __('Lastname','cmp-coming-soon-maintenance'),
1529
+ __('Fullname', 'cmp-coming-soon-maintenance')
1530
+ )
1531
+ );
1532
+ foreach ( $subscribers as $key => $value ) {
1533
+
1534
+
1535
+
1536
  if ( isset( $value['ip_address'] ) ) {
1537
  unset($subscribers[$key]['ip_address']);
1538
  }
 
 
 
1539
 
1540
  if ( isset( $value['timestamp'] ) ) {
1541
  $format="Y-m-d H:i:s";
1542
  $subscribers[$key]['timestamp'] = date_i18n($format, $subscribers[$key]['timestamp']);
1543
  }
1544
+
1545
+ $subscribers[$key]['Name'] = '';
1546
+
1547
+ if ( $value['firstname'] !== '' || $value['lastname'] !== '' ) {
1548
+ $subscribers[$key]['Name'] = $value['firstname'] . ' ' . $value['lastname'];
1549
+ }
1550
+
1551
+ $subscribers[$key]['Name'] = trim($subscribers[$key]['Name']);
1552
+
1553
+
1554
  }
1555
 
1556
  foreach ( $subscribers as $key => $value ) {
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: coming soon, landing page, launch page, maintenance mode, under constructi
5
  Requires at least: 3.0
6
  Requires PHP: 5.3
7
  Tested up to: 5.2
8
- Stable tag: 3.5.7
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -25,7 +25,7 @@ Packed with functions like Whitelist/Blacklist to enable CMP only on specific pa
25
  <ul>
26
  <li>You can choose from 3 bundled Themes (many more downloadable - freebies and premium) with completely different design. We try to develop new CPM Theme every month for you!</li>
27
  <li>Our Plugin works with any WordPress Theme and on all desktop or mobile devices (yes it is 100% responsive).</li>
28
- <li>Some of CMP themes supports custom Subscribe Form to store emails in your database or you can use your MailChimp account via MailChimp API integration.</li>
29
  <li>Fullscreen background media supports Video (YouTube, custom file video), Images or Image Slider (Unsplash library, custom images), Patterns, Color Gradients or Solid Colors.</li>
30
  <li>You can search from more than million of free beautiful professional photos from most popular <a href="http://unsplash.com" target="_blank">Unsplash source</a> with built-in search API (random images, search by keyword, category, etc).</li>
31
  <li>You can set custom Logo, choose from 100 most popular Google fonts and customize Font Weight, Letter Spacing and Line Height.</li>
@@ -47,6 +47,7 @@ Packed with functions like Whitelist/Blacklist to enable CMP only on specific pa
47
  <ul>
48
  <li><a href="https://wordpress.org/plugins/insert-headers-and-footers/" target="_blank>Insert Headers and Footers</a> fully compatible.</li>
49
  <li><a href="https://wordpress.org/plugins/simpleanalytics/" target="_blank>Simple Analytics</a> fully compatible.</li>
 
50
  <li>We are working on more plugins to be compatible with CMP - feel free to send us suggestions what plugin you might need together with CMP.</li>
51
  </ul>
52
 
@@ -143,6 +144,13 @@ https://www.youtube.com/watch?v=uxuJfHzwdtE
143
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
144
 
145
  == Changelog ==
 
 
 
 
 
 
 
146
  <h4>CMP 3.5.7 - 11-Jul-19</h4>
147
  <ul>
148
  <li>New Theme - Tempie - great for a small maintenance!</li>
5
  Requires at least: 3.0
6
  Requires PHP: 5.3
7
  Tested up to: 5.2
8
+ Stable tag: 3.5.8
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
25
  <ul>
26
  <li>You can choose from 3 bundled Themes (many more downloadable - freebies and premium) with completely different design. We try to develop new CPM Theme every month for you!</li>
27
  <li>Our Plugin works with any WordPress Theme and on all desktop or mobile devices (yes it is 100% responsive).</li>
28
+ <li>Some of CMP themes supports custom Subscribe Form to store emails in local database, MailChimp or MailPoet.</li>
29
  <li>Fullscreen background media supports Video (YouTube, custom file video), Images or Image Slider (Unsplash library, custom images), Patterns, Color Gradients or Solid Colors.</li>
30
  <li>You can search from more than million of free beautiful professional photos from most popular <a href="http://unsplash.com" target="_blank">Unsplash source</a> with built-in search API (random images, search by keyword, category, etc).</li>
31
  <li>You can set custom Logo, choose from 100 most popular Google fonts and customize Font Weight, Letter Spacing and Line Height.</li>
47
  <ul>
48
  <li><a href="https://wordpress.org/plugins/insert-headers-and-footers/" target="_blank>Insert Headers and Footers</a> fully compatible.</li>
49
  <li><a href="https://wordpress.org/plugins/simpleanalytics/" target="_blank>Simple Analytics</a> fully compatible.</li>
50
+ <li><a href="https://wordpress.org/plugins/mailpoet/" target="_blank>MailPoet – emails and newsletters in WordPress</a> fully integrated.</li>
51
  <li>We are working on more plugins to be compatible with CMP - feel free to send us suggestions what plugin you might need together with CMP.</li>
52
  </ul>
53
 
144
  <p>Nothing is better than a good feedback! Please go to <a href="https://wordpress.org/support/plugin/cmp-coming-soon-maintenance/reviews/">Plugin reviews</a> and rate it! Alternatively you can click on a Donate button too!:)</p>
145
 
146
  == Changelog ==
147
+ <h4>CMP 3.5.8 - 14-Jul-19</h4>
148
+ <ul>
149
+ <li>Added new Subscribe integration with MailPoet WordPress plugin.</li>
150
+ <li>Minor tweaks of Subscribe process.</li>
151
+ <li>Updated scripts to support latest version of Contact Form 7 plugin.</li>
152
+ </ul>
153
+
154
  <h4>CMP 3.5.7 - 11-Jul-19</h4>
155
  <ul>
156
  <li>New Theme - Tempie - great for a small maintenance!</li>