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

Version Description

Download this release

Release Info

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

Code changes from version 3.5 to 3.5.1

Files changed (4) hide show
  1. js/typography.js +65 -71
  2. js/typography.min.js +1 -1
  3. niteo-cmp.php +10 -23
  4. readme.txt +6 -1
js/typography.js CHANGED
@@ -367,7 +367,7 @@ jQuery(document).ready(function($){
367
  var security = $(this).data('security');
368
 
369
  var payload = {
370
- action: 'allow_mimes',
371
  files: []
372
  }
373
 
@@ -377,86 +377,80 @@ jQuery(document).ready(function($){
377
  payload: JSON.stringify(payload)
378
  };
379
 
380
- $.post(ajaxurl, data, function(response) {
381
-
382
- if ( response === 'success') {
383
- // If the media frame already exists, reopen it.
384
- if ( file_frame ) {
385
- file_frame.open();
386
- return;
387
- }
388
-
389
- // Create a new media frame
390
- file_frame = wp.media.frames.file_frame = wp.media({
391
- multiple: true // Set to true to allow multiple files to be selected
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
392
  });
393
-
394
- // When a file is selected in the media frame...
395
- file_frame.on( 'select', function() {
396
- // Get selected attachment
397
- var attachment = file_frame.state().get('selection').toJSON();
398
-
399
- if ( attachment.length ) {
400
- payload.action = 'upload_font';
401
- // create unique array of font names
402
- var titles = [];
403
-
404
- jQuery(attachment).each(function(i, value ) {
405
- if ( titles.indexOf(value.title) < 0 ) {
406
- titles.push(value.title);
407
- }
408
- });
409
-
410
- // loop trough Font titles
411
- jQuery(titles).each(function(i, title) {
412
-
413
- var urls = [];
414
- var ids = [];
415
- // get all urls of same font title
416
- jQuery(attachment).each(function(i, value ) {
417
- if ( value.title === title ) {
418
- urls.push(value.url);
419
- ids.push(value.id);
420
- }
421
- });
422
-
423
- // create payload object
424
- payload.files[i] = {
425
- id: title,
426
- text: title,
427
- urls: urls,
428
- ids: ids,
429
- variants: ['Not Applicable']
430
- }
431
- });
432
-
433
- data.payload = JSON.stringify(payload);
434
-
435
- $.post(ajaxurl, data, function(response) {
436
- for (var i = 0; i < payload.files.length; ++i) {
437
- fonts.google.unshift(payload.files[i])
438
- }
439
-
440
- $HeadingFont.select2({
441
- data: fonts.google
442
- });
443
-
444
- $contentFont.select2({
445
- data: fonts.google
446
- });
447
-
448
- alert('Following fonts have been added to Fonts Family selections: ' + titles.join(', '));
449
- });
450
 
 
 
 
 
 
451
  }
452
 
 
 
 
 
 
 
 
 
 
453
  });
454
 
455
- file_frame.open();
456
  }
457
 
458
  });
459
 
 
 
460
  });
461
 
462
  });
367
  var security = $(this).data('security');
368
 
369
  var payload = {
370
+ action: 'upload_font',
371
  files: []
372
  }
373
 
377
  payload: JSON.stringify(payload)
378
  };
379
 
380
+ // If the media frame already exists, reopen it.
381
+ if ( file_frame ) {
382
+ file_frame.open();
383
+ return;
384
+ }
385
+
386
+ // Create a new media frame
387
+ file_frame = wp.media.frames.file_frame = wp.media({
388
+ multiple: true // Set to true to allow multiple files to be selected
389
+ });
390
+
391
+ // When a file is selected in the media frame...
392
+ file_frame.on( 'select', function() {
393
+ // Get selected attachment
394
+ var attachment = file_frame.state().get('selection').toJSON();
395
+
396
+ if ( attachment.length ) {
397
+ payload.action = 'upload_font';
398
+ // create unique array of font names
399
+ var titles = [];
400
+
401
+ jQuery(attachment).each(function(i, value ) {
402
+ if ( titles.indexOf(value.title) < 0 ) {
403
+ titles.push(value.title);
404
+ }
405
+ });
406
+
407
+ // loop trough Font titles
408
+ jQuery(titles).each(function(i, title) {
409
+
410
+ var urls = [];
411
+ var ids = [];
412
+ // get all urls of same font title
413
+ jQuery(attachment).each(function(i, value ) {
414
+ if ( value.title === title ) {
415
+ urls.push(value.url);
416
+ ids.push(value.id);
417
+ }
418
+ });
419
+
420
+ // create payload object
421
+ payload.files[i] = {
422
+ id: title,
423
+ text: title,
424
+ urls: urls,
425
+ ids: ids,
426
+ variants: ['Not Applicable']
427
+ }
428
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
429
 
430
+ data.payload = JSON.stringify(payload);
431
+
432
+ $.post(ajaxurl, data, function(response) {
433
+ for (var i = 0; i < payload.files.length; ++i) {
434
+ fonts.google.unshift(payload.files[i])
435
  }
436
 
437
+ $HeadingFont.select2({
438
+ data: fonts.google
439
+ });
440
+
441
+ $contentFont.select2({
442
+ data: fonts.google
443
+ });
444
+
445
+ alert('Following fonts have been added to Fonts Family selections: ' + titles.join(', '));
446
  });
447
 
 
448
  }
449
 
450
  });
451
 
452
+ file_frame.open();
453
+
454
  });
455
 
456
  });
js/typography.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){headingVariant=jQuery(".cmp-coming-soon-maintenance .headings-google-font-variant").val(),contentVariant=jQuery(".cmp-coming-soon-maintenance .content-google-font-variant").val(),fontVariant=function(t){switch(t){case"100":return"Thin 100";case"100italic":return"Thin 100 Italic";case"200":return"Extra-light 200";case"200italic":return"Extra-light 200 Italic";case"300":return"Light 300";case"300italic":return"Light 300 Italic";case"400":case"regular":return"Regular 400";case"400italic":case"italic":return"Regular 400 Italic";case"500":return"Medium 500";case"500italic":return"Meidum 500 Italic";case"600":return"Semi-Bold 600";case"600italic":return"Semi-Bold 600 Italic";case"700":return"Bold 700";case"700italic":return"Bold 700 Italic";case"800":return"Extra-Bold 800";case"800italic":return"Extra-Bold Italic";case"900":return"Black 900";case"900italic":return"Black 900 Italic";case"Not Applicable":return"Not Applicable"}},loadCustomFont=function(t,e){newFontFace=Array.isArray(t)?t[0]:t;for(let t=0;t<newFontFace.urls.length;t++)if(newFontFace.urls[t].includes("woff"))var n=newFontFace.urls[t];var a=new FontFace(newFontFace.id,"url("+n+")"),i=document.getElementById(e+"-example"),o=document.getElementById("niteoCS-text-logo");a.load().then(function(t){document.fonts.add(t),i.style.fontFamily='"'+t.family+'"',"heading"===e&&(o.style.fontFamily='"'+t.family+'"')}).catch(function(t){console.log("Cannot load custom font: "+t)})};var e=fonts.google.filter(function(t){return t.id===jQuery(".cmp-coming-soon-maintenance .headings-google-font option:selected").val()}),n=fonts.google.filter(function(t){return t.id===jQuery(".cmp-coming-soon-maintenance .content-google-font option:selected").val()});if(e.length)var a=jQuery.map(e[0].variants,function(t){return{id:t,text:fontVariant(t)}});if(n.length)var i=jQuery.map(n[0].variants,function(t){return{id:t,text:fontVariant(t)}});$HeadingFont=jQuery(".cmp-coming-soon-maintenance .headings-google-font").select2({data:fonts.google,width:"100%"}),$contentFont=jQuery(".cmp-coming-soon-maintenance .content-google-font").select2({data:fonts.google,width:"100%"}),$HeadingFontVariant=jQuery(".cmp-coming-soon-maintenance .headings-google-font-variant").select2({data:a,width:"100%"}),$contentFontVariant=jQuery(".cmp-coming-soon-maintenance .content-google-font-variant").select2({data:i,width:"100%"}),e.length&&("Not Applicable"==e[0].variants[0]?loadCustomFont(e,"heading"):WebFont.load({google:{families:[e[0].id+":"+["variants"].join(",")]},active:function(){jQuery.isNumeric(headingVariant)?jQuery("#heading-example").css("font-weight",headingVariant).css("font-style","normal"):"regular"==headingVariant?jQuery("#heading-example").css("font-weight","400").css("font-style","normal"):"italic"==headingVariant?jQuery("#heading-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(headingVariant,10),jQuery("#heading-example").css("font-weight",fontweight).css("font-style","italic")),jQuery("#heading-example, #niteoCS-text-logo").css("font-family",e[0].id)}})),n.length&&("Not Applicable"==n[0].variants[0]?loadCustomFont(n,"content"):WebFont.load({google:{families:[n[0].id+":"+["variants"].join(",")]},active:function(){jQuery.isNumeric(contentVariant)?jQuery("#content-example").css("font-weight",contentVariant).css("font-style","normal"):"regular"==contentVariant?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):"italic"==contentVariant?jQuery("#content-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(contentVariant,10),jQuery("#content-example").css("font-weight",fontweight).css("font-style","italic")),jQuery("#content-example").css("font-family",n[0].id)}})),t("body").on("mouseenter",".select2-results__option.select2-results__option--highlighted",function(e){var n=t(this).data().data,a=n.element.parentNode.dataset.type;"content"!==a&&"heading"!==a||("Not Applicable"===n.variants[0]?loadCustomFont(n,a):WebFont.load({google:{families:[n.text]},active:function(){jQuery("#"+a+"-example, #niteoCS-text-logo").css("font-family",n.text)}}))}),$HeadingFont.on("select2:select",function(t){var e=$HeadingFontVariant.select2("data"),n=jQuery.map(t.params.data.variants,function(t){return{id:t,text:fontVariant(t)}});$HeadingFontVariant.empty(),$HeadingFontVariant.select2({data:n}),e[0].id&&("-1"==jQuery.inArray(e[0].id,t.params.data.variants)?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight","400").css("font-style","normal"):$HeadingFontVariant.val(e[0].id).trigger("change.select2"))}),$HeadingFontVariant.on("select2:select",function(t){headingVariant=t.params.data.id,jQuery.isNumeric(headingVariant)?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight",headingVariant).css("font-style","normal"):"regular"==headingVariant?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight","400").css("font-style","normal"):"italic"==headingVariant?jQuery("#heading-example, #niteoCS-text-logo").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(headingVariant,10),jQuery("#heading-example, #niteoCS-text-logo").css("font-weight",fontweight).css("font-style","italic"))}),$contentFont.on("select2:select",function(t){var e=$contentFontVariant.select2("data"),n=jQuery.map(t.params.data.variants,function(t){return{id:t,text:fontVariant(t)}});$contentFontVariant.empty(),$contentFontVariant.select2({data:n}),e[0].id&&("-1"==jQuery.inArray(e[0].id,t.params.data.variants)?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):$contentFontVariant.val(e[0].id).trigger("change.select2"))}),$contentFontVariant.on("select2:select",function(t){contentVariant=t.params.data.id,jQuery.isNumeric(contentVariant)?jQuery("#content-example").css("font-weight",contentVariant).css("font-style","normal"):"regular"==contentVariant?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):"italic"==contentVariant?jQuery("#content-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(contentVariant,10),jQuery("#content-example").css("font-weight",fontweight).css("font-style","italic"))}),jQuery(".cmp-coming-soon-maintenance .font-selector input[type=range]").on("input",function(){var t=jQuery(this).data("type"),e=jQuery(this).data("css"),n=jQuery(this).val();jQuery(this).parent().find("span").html(n),n="line-height"==e?n:n+"px","heading"==t?jQuery("#heading-example").css(e,n):jQuery("#content-example").css(e,n)}),jQuery("#cmp-install-font").click(function(e){var n;e.preventDefault(),t(document.body).on("click","#cmp-install-font",function(e){e.preventDefault();var a=t(this).data("security"),i={action:"allow_mimes",files:[]},o={action:"cmp_ajax_upload_font",security:a,payload:JSON.stringify(i)};t.post(ajaxurl,o,function(e){if("success"===e){if(n)return void n.open();(n=wp.media.frames.file_frame=wp.media({multiple:!0})).on("select",function(){var e=n.state().get("selection").toJSON();if(e.length){i.action="upload_font";var a=[];jQuery(e).each(function(t,e){a.indexOf(e.title)<0&&a.push(e.title)}),jQuery(a).each(function(t,n){var a=[],o=[];jQuery(e).each(function(t,e){e.title===n&&(a.push(e.url),o.push(e.id))}),i.files[t]={id:n,text:n,urls:a,ids:o,variants:["Not Applicable"]}}),o.payload=JSON.stringify(i),t.post(ajaxurl,o,function(t){for(var e=0;e<i.files.length;++e)fonts.google.unshift(i.files[e]);$HeadingFont.select2({data:fonts.google}),$contentFont.select2({data:fonts.google}),alert("Following fonts have been added to Fonts Family selections: "+a.join(", "))})}}),n.open()}})})})});
1
+ jQuery(document).ready(function(t){headingVariant=jQuery(".cmp-coming-soon-maintenance .headings-google-font-variant").val(),contentVariant=jQuery(".cmp-coming-soon-maintenance .content-google-font-variant").val(),fontVariant=function(t){switch(t){case"100":return"Thin 100";case"100italic":return"Thin 100 Italic";case"200":return"Extra-light 200";case"200italic":return"Extra-light 200 Italic";case"300":return"Light 300";case"300italic":return"Light 300 Italic";case"400":case"regular":return"Regular 400";case"400italic":case"italic":return"Regular 400 Italic";case"500":return"Medium 500";case"500italic":return"Meidum 500 Italic";case"600":return"Semi-Bold 600";case"600italic":return"Semi-Bold 600 Italic";case"700":return"Bold 700";case"700italic":return"Bold 700 Italic";case"800":return"Extra-Bold 800";case"800italic":return"Extra-Bold Italic";case"900":return"Black 900";case"900italic":return"Black 900 Italic";case"Not Applicable":return"Not Applicable"}},loadCustomFont=function(t,e){newFontFace=Array.isArray(t)?t[0]:t;for(let t=0;t<newFontFace.urls.length;t++)if(newFontFace.urls[t].includes("woff"))var n=newFontFace.urls[t];var a=new FontFace(newFontFace.id,"url("+n+")"),i=document.getElementById(e+"-example"),o=document.getElementById("niteoCS-text-logo");a.load().then(function(t){document.fonts.add(t),i.style.fontFamily='"'+t.family+'"',"heading"===e&&(o.style.fontFamily='"'+t.family+'"')}).catch(function(t){console.log("Cannot load custom font: "+t)})};var e=fonts.google.filter(function(t){return t.id===jQuery(".cmp-coming-soon-maintenance .headings-google-font option:selected").val()}),n=fonts.google.filter(function(t){return t.id===jQuery(".cmp-coming-soon-maintenance .content-google-font option:selected").val()});if(e.length)var a=jQuery.map(e[0].variants,function(t){return{id:t,text:fontVariant(t)}});if(n.length)var i=jQuery.map(n[0].variants,function(t){return{id:t,text:fontVariant(t)}});$HeadingFont=jQuery(".cmp-coming-soon-maintenance .headings-google-font").select2({data:fonts.google,width:"100%"}),$contentFont=jQuery(".cmp-coming-soon-maintenance .content-google-font").select2({data:fonts.google,width:"100%"}),$HeadingFontVariant=jQuery(".cmp-coming-soon-maintenance .headings-google-font-variant").select2({data:a,width:"100%"}),$contentFontVariant=jQuery(".cmp-coming-soon-maintenance .content-google-font-variant").select2({data:i,width:"100%"}),e.length&&("Not Applicable"==e[0].variants[0]?loadCustomFont(e,"heading"):WebFont.load({google:{families:[e[0].id+":"+["variants"].join(",")]},active:function(){jQuery.isNumeric(headingVariant)?jQuery("#heading-example").css("font-weight",headingVariant).css("font-style","normal"):"regular"==headingVariant?jQuery("#heading-example").css("font-weight","400").css("font-style","normal"):"italic"==headingVariant?jQuery("#heading-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(headingVariant,10),jQuery("#heading-example").css("font-weight",fontweight).css("font-style","italic")),jQuery("#heading-example, #niteoCS-text-logo").css("font-family",e[0].id)}})),n.length&&("Not Applicable"==n[0].variants[0]?loadCustomFont(n,"content"):WebFont.load({google:{families:[n[0].id+":"+["variants"].join(",")]},active:function(){jQuery.isNumeric(contentVariant)?jQuery("#content-example").css("font-weight",contentVariant).css("font-style","normal"):"regular"==contentVariant?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):"italic"==contentVariant?jQuery("#content-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(contentVariant,10),jQuery("#content-example").css("font-weight",fontweight).css("font-style","italic")),jQuery("#content-example").css("font-family",n[0].id)}})),t("body").on("mouseenter",".select2-results__option.select2-results__option--highlighted",function(e){var n=t(this).data().data,a=n.element.parentNode.dataset.type;"content"!==a&&"heading"!==a||("Not Applicable"===n.variants[0]?loadCustomFont(n,a):WebFont.load({google:{families:[n.text]},active:function(){jQuery("#"+a+"-example, #niteoCS-text-logo").css("font-family",n.text)}}))}),$HeadingFont.on("select2:select",function(t){var e=$HeadingFontVariant.select2("data"),n=jQuery.map(t.params.data.variants,function(t){return{id:t,text:fontVariant(t)}});$HeadingFontVariant.empty(),$HeadingFontVariant.select2({data:n}),e[0].id&&("-1"==jQuery.inArray(e[0].id,t.params.data.variants)?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight","400").css("font-style","normal"):$HeadingFontVariant.val(e[0].id).trigger("change.select2"))}),$HeadingFontVariant.on("select2:select",function(t){headingVariant=t.params.data.id,jQuery.isNumeric(headingVariant)?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight",headingVariant).css("font-style","normal"):"regular"==headingVariant?jQuery("#heading-example, #niteoCS-text-logo").css("font-weight","400").css("font-style","normal"):"italic"==headingVariant?jQuery("#heading-example, #niteoCS-text-logo").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(headingVariant,10),jQuery("#heading-example, #niteoCS-text-logo").css("font-weight",fontweight).css("font-style","italic"))}),$contentFont.on("select2:select",function(t){var e=$contentFontVariant.select2("data"),n=jQuery.map(t.params.data.variants,function(t){return{id:t,text:fontVariant(t)}});$contentFontVariant.empty(),$contentFontVariant.select2({data:n}),e[0].id&&("-1"==jQuery.inArray(e[0].id,t.params.data.variants)?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):$contentFontVariant.val(e[0].id).trigger("change.select2"))}),$contentFontVariant.on("select2:select",function(t){contentVariant=t.params.data.id,jQuery.isNumeric(contentVariant)?jQuery("#content-example").css("font-weight",contentVariant).css("font-style","normal"):"regular"==contentVariant?jQuery("#content-example").css("font-weight","400").css("font-style","normal"):"italic"==contentVariant?jQuery("#content-example").css("font-style","italic").css("font-weight","400"):(fontweight=parseInt(contentVariant,10),jQuery("#content-example").css("font-weight",fontweight).css("font-style","italic"))}),jQuery(".cmp-coming-soon-maintenance .font-selector input[type=range]").on("input",function(){var t=jQuery(this).data("type"),e=jQuery(this).data("css"),n=jQuery(this).val();jQuery(this).parent().find("span").html(n),n="line-height"==e?n:n+"px","heading"==t?jQuery("#heading-example").css(e,n):jQuery("#content-example").css(e,n)}),jQuery("#cmp-install-font").click(function(e){var n;e.preventDefault(),t(document.body).on("click","#cmp-install-font",function(e){e.preventDefault();var a=t(this).data("security"),i={action:"upload_font",files:[]},o={action:"cmp_ajax_upload_font",security:a,payload:JSON.stringify(i)};n?n.open():((n=wp.media.frames.file_frame=wp.media({multiple:!0})).on("select",function(){var e=n.state().get("selection").toJSON();if(e.length){i.action="upload_font";var a=[];jQuery(e).each(function(t,e){a.indexOf(e.title)<0&&a.push(e.title)}),jQuery(a).each(function(t,n){var a=[],o=[];jQuery(e).each(function(t,e){e.title===n&&(a.push(e.url),o.push(e.id))}),i.files[t]={id:n,text:n,urls:a,ids:o,variants:["Not Applicable"]}}),o.payload=JSON.stringify(i),t.post(ajaxurl,o,function(t){for(var e=0;e<i.files.length;++e)fonts.google.unshift(i.files[e]);$HeadingFont.select2({data:fonts.google}),$contentFont.select2({data:fonts.google}),alert("Following fonts have been added to Fonts Family selections: "+a.join(", "))})}}),n.open())})})});
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
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
@@ -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' );
68
  $this->define( 'CMP_DEBUG', FALSE );
69
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
70
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
@@ -103,8 +103,7 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
103
  add_action( 'wp_ajax_cmp_mailchimp_list_ajax', array( $this, 'cmp_mailchimp_list_ajax' ) );
104
  add_action( 'wp_ajax_cmp_ajax_upload_font', array( $this, 'cmp_ajax_upload_font' ) );
105
 
106
-
107
-
108
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this,'add_action_links' ) );
109
 
110
  register_activation_hook( __FILE__, array( $this, 'cmp_activate' ) );
@@ -1488,6 +1487,12 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1488
  public function cmp_allow_mimes( $mimes = array() ) {
1489
  // add your own extension here - as many as you like
1490
  $mimes['zip'] = 'application/zip';
 
 
 
 
 
 
1491
  $mimes['woff'] = 'application/x-font-woff';
1492
  $mimes['woff2'] = 'application/x-font-woff2';
1493
  $mimes['ttf'] = 'application/x-font-ttf';
@@ -1498,19 +1503,6 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
1498
  return $mimes;
1499
  }
1500
 
1501
- public function cmp_remove_mimes( $mimes = array() ) {
1502
- // remove zip mime
1503
- unset($mimes['zip']);
1504
- unset($mimes['woff']);
1505
- unset($mimes['woff2']);
1506
- unset($mimes['ttf']);
1507
- unset($mimes['svg']);
1508
- unset($mimes['eot']) ;
1509
- unset($mimes['otf']);
1510
-
1511
- return $mimes;
1512
- }
1513
-
1514
 
1515
  public function cmp_admin_notice() {
1516
  global $pagenow;
@@ -2269,14 +2261,10 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
2269
 
2270
 
2271
  if ( isset($_POST['payload']) ) {
 
2272
  $payload = json_decode( stripslashes($_POST['payload']), true );
2273
  $action = $payload['action'];
2274
 
2275
- if ( $action === 'allow_mimes' ) {
2276
- // allows font mimes to be uploaded
2277
- add_filter('upload_mimes', array( $this, 'cmp_allow_mimes' ));
2278
- }
2279
-
2280
  if ( $action === 'upload_font' ) {
2281
 
2282
  $new_fonts = $payload['files'];
@@ -2310,7 +2298,6 @@ if ( ! class_exists( 'CMP_Coming_Soon_and_Maintenance' ) ) :
2310
 
2311
  update_option( 'niteoCS_custom_fonts', json_encode( $new_fonts ) );
2312
 
2313
- add_filter('upload_mimes', array($this, 'cmp_remove_mimes'));
2314
  }
2315
 
2316
  }
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.1
7
  Author: NiteoThemes
8
  Author URI: https://www.niteothemes.com
9
  Text Domain: cmp-coming-soon-maintenance
64
 
65
  private function constants() {
66
  // define constants
67
+ $this->define( 'CMP_VERSION', '3.5.1' );
68
  $this->define( 'CMP_DEBUG', FALSE );
69
  $this->define( 'CMP_AUTHOR', 'NiteoThemes' );
70
  $this->define( 'CMP_AUTHOR_HOMEPAGE', 'https://niteothemes.com' );
103
  add_action( 'wp_ajax_cmp_mailchimp_list_ajax', array( $this, 'cmp_mailchimp_list_ajax' ) );
104
  add_action( 'wp_ajax_cmp_ajax_upload_font', array( $this, 'cmp_ajax_upload_font' ) );
105
 
106
+ add_filter('upload_mimes', array( $this, 'cmp_allow_font_mimes' ));
 
107
  add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), array( $this,'add_action_links' ) );
108
 
109
  register_activation_hook( __FILE__, array( $this, 'cmp_activate' ) );
1487
  public function cmp_allow_mimes( $mimes = array() ) {
1488
  // add your own extension here - as many as you like
1489
  $mimes['zip'] = 'application/zip';
1490
+
1491
+ return $mimes;
1492
+ }
1493
+
1494
+ public function cmp_allow_font_mimes( $mimes = array() ) {
1495
+ // add your own extension here - as many as you like
1496
  $mimes['woff'] = 'application/x-font-woff';
1497
  $mimes['woff2'] = 'application/x-font-woff2';
1498
  $mimes['ttf'] = 'application/x-font-ttf';
1503
  return $mimes;
1504
  }
1505
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1506
 
1507
  public function cmp_admin_notice() {
1508
  global $pagenow;
2261
 
2262
 
2263
  if ( isset($_POST['payload']) ) {
2264
+
2265
  $payload = json_decode( stripslashes($_POST['payload']), true );
2266
  $action = $payload['action'];
2267
 
 
 
 
 
 
2268
  if ( $action === 'upload_font' ) {
2269
 
2270
  $new_fonts = $payload['files'];
2298
 
2299
  update_option( 'niteoCS_custom_fonts', json_encode( $new_fonts ) );
2300
 
 
2301
  }
2302
 
2303
  }
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
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
@@ -135,6 +135,11 @@ https://www.youtube.com/watch?v=uxuJfHzwdtE
135
  <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>
136
 
137
  == Changelog ==
 
 
 
 
 
138
  <h4>CMP 3.5 - 29-May-19</h4>
139
  <ul>
140
  <li>Beautiful new CMP Theme: TimeX!</li>
5
  Requires at least: 3.0
6
  Requires PHP: 5.3
7
  Tested up to: 5.2
8
+ Stable tag: 3.5.1
9
  License: GPLv2 or later
10
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
11
 
135
  <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>
136
 
137
  == Changelog ==
138
+ <h4>CMP 3.5.1 - 30-May-19</h4>
139
+ <ul>
140
+ <li>Added mimes filter to alllow custom fonts to upload via media library.</li>
141
+ </ul>
142
+
143
  <h4>CMP 3.5 - 29-May-19</h4>
144
  <ul>
145
  <li>Beautiful new CMP Theme: TimeX!</li>