Version Description
- 2022-11-21
- Replaced Google Fonts with GDPR Compatible Bunny Fonts
- Minor security fixes
Download this release
Release Info
Developer | WebFactory |
Plugin | Simple Author Box |
Version | 2.49 |
Comparing to | |
See all releases |
Code changes from version 2.48 to 2.49
- assets/js/sab-preview.js +10 -10
- assets/js/sab_gutenberg_editor_script.js +9 -9
- assets/js/webfont.js +45 -0
- assets/src/js/components/edit.js +9 -9
- inc/class-simple-author-box-admin-page.php +25 -19
- inc/class-simple-author-box-helper.php +4 -3
- inc/class-simple-author-box-previewer.php +8 -8
- inc/class-simple-author-box-user-profile.php +9 -3
- inc/class-simple-author-box-widget.php +3 -3
- inc/class-simple-author-box.php +15 -17
- inc/elementor/class-simple-author-box-elementor-check.php +2 -2
- inc/elementor/widgets/class-simple-author-box-elementor.php +3 -3
- inc/functions.php +408 -55
- readme.txt +11 -1
- simple-author-box.php +6 -3
- template/template-sab.php +12 -13
- wf-flyout/config.php +23 -0
- wf-flyout/icons/301-logo.png +0 -0
- wf-flyout/icons/sab.png +0 -0
- wf-flyout/icons/ucp.png +0 -0
- wf-flyout/icons/wp-reset.png +0 -0
- wf-flyout/icons/wp-ssl.png +0 -0
- wf-flyout/wf-flyout.css +200 -0
- wf-flyout/wf-flyout.js +24 -0
- wf-flyout/wf-flyout.php +166 -0
assets/js/sab-preview.js
CHANGED
@@ -45,7 +45,7 @@ wp.SAB.views.Settings = Backbone.View.extend({
|
|
45 |
initialize: function( args ) {
|
46 |
|
47 |
// Check for Google Fonts
|
48 |
-
this.
|
49 |
|
50 |
this.listenTo( this.model, 'change:sab_email', this.emailVisibility );
|
51 |
|
@@ -291,7 +291,7 @@ wp.SAB.views.Settings = Backbone.View.extend({
|
|
291 |
if ( '' == font || 'None' == font ) {
|
292 |
font = 'inherit';
|
293 |
}else{
|
294 |
-
this.
|
295 |
}
|
296 |
|
297 |
|
@@ -353,7 +353,7 @@ wp.SAB.views.Settings = Backbone.View.extend({
|
|
353 |
if ( '' == font || 'None' == font ) {
|
354 |
font = 'inherit';
|
355 |
}else{
|
356 |
-
this.
|
357 |
}
|
358 |
|
359 |
|
@@ -379,7 +379,7 @@ wp.SAB.views.Settings = Backbone.View.extend({
|
|
379 |
if ( '' == font || 'None' == font ) {
|
380 |
font = 'inherit';
|
381 |
}else{
|
382 |
-
this.
|
383 |
}
|
384 |
|
385 |
if ( '0' == style ) {
|
@@ -455,30 +455,30 @@ wp.SAB.views.Settings = Backbone.View.extend({
|
|
455 |
|
456 |
},
|
457 |
|
458 |
-
|
459 |
var authorFont = this.model.getAttribute( 'sab_box_name_font' ),
|
460 |
webFont = this.model.getAttribute( 'sab_box_web_font' ),
|
461 |
descriptionFont = this.model.getAttribute( 'sab_box_desc_font' );
|
462 |
|
463 |
if ( '' != authorFont && 'None' != authorFont ) {
|
464 |
-
this.
|
465 |
}
|
466 |
|
467 |
if ( '' != webFont && 'None' != webFont ) {
|
468 |
-
this.
|
469 |
}
|
470 |
|
471 |
if ( '' != descriptionFont && 'None' != descriptionFont ) {
|
472 |
-
this.
|
473 |
}
|
474 |
|
475 |
},
|
476 |
|
477 |
-
|
478 |
if ( ! wp.SAB.Fonts.includes( font ) ) {
|
479 |
wp.SAB.Fonts.push( font );
|
480 |
WebFont.load({
|
481 |
-
|
482 |
families: [ font ]
|
483 |
}
|
484 |
});
|
45 |
initialize: function( args ) {
|
46 |
|
47 |
// Check for Google Fonts
|
48 |
+
this.checkBunnyFonts();
|
49 |
|
50 |
this.listenTo( this.model, 'change:sab_email', this.emailVisibility );
|
51 |
|
291 |
if ( '' == font || 'None' == font ) {
|
292 |
font = 'inherit';
|
293 |
}else{
|
294 |
+
this.loadBunnyFonts( font );
|
295 |
}
|
296 |
|
297 |
|
353 |
if ( '' == font || 'None' == font ) {
|
354 |
font = 'inherit';
|
355 |
}else{
|
356 |
+
this.loadBunnyFonts( font );
|
357 |
}
|
358 |
|
359 |
|
379 |
if ( '' == font || 'None' == font ) {
|
380 |
font = 'inherit';
|
381 |
}else{
|
382 |
+
this.loadBunnyFonts( font );
|
383 |
}
|
384 |
|
385 |
if ( '0' == style ) {
|
455 |
|
456 |
},
|
457 |
|
458 |
+
checkBunnyFonts: function() {
|
459 |
var authorFont = this.model.getAttribute( 'sab_box_name_font' ),
|
460 |
webFont = this.model.getAttribute( 'sab_box_web_font' ),
|
461 |
descriptionFont = this.model.getAttribute( 'sab_box_desc_font' );
|
462 |
|
463 |
if ( '' != authorFont && 'None' != authorFont ) {
|
464 |
+
this.loadBunnyFonts( authorFont );
|
465 |
}
|
466 |
|
467 |
if ( '' != webFont && 'None' != webFont ) {
|
468 |
+
this.loadBunnyFonts( webFont );
|
469 |
}
|
470 |
|
471 |
if ( '' != descriptionFont && 'None' != descriptionFont ) {
|
472 |
+
this.loadBunnyFonts( descriptionFont );
|
473 |
}
|
474 |
|
475 |
},
|
476 |
|
477 |
+
loadBunnyFonts: function( font ) {
|
478 |
if ( ! wp.SAB.Fonts.includes( font ) ) {
|
479 |
wp.SAB.Fonts.push( font );
|
480 |
WebFont.load({
|
481 |
+
bunny: {
|
482 |
families: [ font ]
|
483 |
}
|
484 |
});
|
assets/js/sab_gutenberg_editor_script.js
CHANGED
@@ -417,32 +417,32 @@ var Edit = function (_Component) {
|
|
417 |
sab_subset = '&subset=latin';
|
418 |
}
|
419 |
|
420 |
-
var
|
421 |
|
422 |
if ('None' != sabVars.sab_box_name_font) {
|
423 |
-
|
424 |
}
|
425 |
|
426 |
if ('None' != sabVars.sab_box_desc_font) {
|
427 |
-
|
428 |
}
|
429 |
|
430 |
if ('None' != sabVars.sab_box_web_font) {
|
431 |
-
|
432 |
}
|
433 |
|
434 |
function onlyUnique(value, index, self) {
|
435 |
return self.indexOf(value) === index;
|
436 |
}
|
437 |
-
|
438 |
|
439 |
-
if (
|
440 |
|
441 |
-
|
442 |
-
|
443 |
});
|
444 |
|
445 |
-
return React.createElement('link', { href: 'https://fonts.
|
446 |
}
|
447 |
}
|
448 |
}, {
|
417 |
sab_subset = '&subset=latin';
|
418 |
}
|
419 |
|
420 |
+
var bunny_fonts = [];
|
421 |
|
422 |
if ('None' != sabVars.sab_box_name_font) {
|
423 |
+
bunny_fonts.push(sabVars.sab_box_name_font.replace(' ', '+'));
|
424 |
}
|
425 |
|
426 |
if ('None' != sabVars.sab_box_desc_font) {
|
427 |
+
bunny_fonts.push(sabVars.sab_box_desc_font.replace(' ', '+'));
|
428 |
}
|
429 |
|
430 |
if ('None' != sabVars.sab_box_web_font) {
|
431 |
+
bunny_fonts.push(sabVars.sab_box_web_font.replace(' ', '+'));
|
432 |
}
|
433 |
|
434 |
function onlyUnique(value, index, self) {
|
435 |
return self.indexOf(value) === index;
|
436 |
}
|
437 |
+
bunny_fonts = bunny_fonts.filter(onlyUnique);
|
438 |
|
439 |
+
if (bunny_fonts.length > 0) {
|
440 |
|
441 |
+
bunny_fonts.forEach(function (entry, index) {
|
442 |
+
bunny_fonts[index] = entry + ':400,700,400italic,700italic';
|
443 |
});
|
444 |
|
445 |
+
return React.createElement('link', { href: 'https://fonts.bunny.net/css?family=' + bunny_fonts.join('|') + sab_subset, rel: 'stylesheet' });
|
446 |
}
|
447 |
}
|
448 |
}, {
|
assets/js/webfont.js
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
*
|
3 |
+
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
4 |
+
* use this file except in compliance with the License. You may obtain a copy of
|
5 |
+
* the License at
|
6 |
+
*
|
7 |
+
* http://www.apache.org/licenses/LICENSE-2.0
|
8 |
+
*
|
9 |
+
* Unless required by applicable law or agreed to in writing, software
|
10 |
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
11 |
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
12 |
+
* License for the specific language governing permissions and limitations under
|
13 |
+
* the License.
|
14 |
+
*/
|
15 |
+
;(function(window,document,undefined){
|
16 |
+
var j=void 0,k=!0,l=null,p=!1;function q(a){return function(){return this[a]}}var aa=this;function ba(a,b){var c=a.split("."),d=aa;!(c[0]in d)&&d.execScript&&d.execScript("var "+c[0]);for(var e;c.length&&(e=c.shift());)!c.length&&b!==j?d[e]=b:d=d[e]?d[e]:d[e]={}}aa.Ba=k;function ca(a,b,c){return a.call.apply(a.bind,arguments)}
|
17 |
+
function da(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function s(a,b,c){s=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ca:da;return s.apply(l,arguments)}var ea=Date.now||function(){return+new Date};function fa(a,b){this.G=a;this.u=b||a;this.z=this.u.document;this.R=j}fa.prototype.createElement=function(a,b,c){a=this.z.createElement(a);if(b)for(var d in b)if(b.hasOwnProperty(d))if("style"==d){var e=a,f=b[d];ga(this)?e.setAttribute("style",f):e.style.cssText=f}else a.setAttribute(d,b[d]);c&&a.appendChild(this.z.createTextNode(c));return a};function t(a,b,c){a=a.z.getElementsByTagName(b)[0];a||(a=document.documentElement);a&&a.lastChild&&a.insertBefore(c,a.lastChild)}
|
18 |
+
function u(a,b){return a.createElement("link",{rel:"stylesheet",href:b})}function ha(a,b){return a.createElement("script",{src:b})}function v(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return;c.push(b);a.className=c.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}function w(a,b){for(var c=a.className.split(/\s+/),d=[],e=0,f=c.length;e<f;e++)c[e]!=b&&d.push(c[e]);a.className=d.join(" ").replace(/\s+/g," ").replace(/^\s+|\s+$/,"")}
|
19 |
+
function ia(a,b){for(var c=a.className.split(/\s+/),d=0,e=c.length;d<e;d++)if(c[d]==b)return k;return p}function ga(a){if(a.R===j){var b=a.z.createElement("p");b.innerHTML='<a style="top:1px;">w</a>';a.R=/top/.test(b.getElementsByTagName("a")[0].getAttribute("style"))}return a.R}function x(a){var b=a.u.location.protocol;"about:"==b&&(b=a.G.location.protocol);return"https:"==b?"https:":"http:"};function y(a,b,c){this.w=a;this.T=b;this.Aa=c}ba("webfont.BrowserInfo",y);y.prototype.qa=q("w");y.prototype.hasWebFontSupport=y.prototype.qa;y.prototype.ra=q("T");y.prototype.hasWebKitFallbackBug=y.prototype.ra;y.prototype.sa=q("Aa");y.prototype.hasWebKitMetricsBug=y.prototype.sa;function z(a,b,c,d){this.e=a!=l?a:l;this.o=b!=l?b:l;this.ba=c!=l?c:l;this.f=d!=l?d:l}var ja=/^([0-9]+)(?:[\._-]([0-9]+))?(?:[\._-]([0-9]+))?(?:[\._+-]?(.*))?$/;z.prototype.toString=function(){return[this.e,this.o||"",this.ba||"",this.f||""].join("")};
|
20 |
+
function A(a){a=ja.exec(a);var b=l,c=l,d=l,e=l;a&&(a[1]!==l&&a[1]&&(b=parseInt(a[1],10)),a[2]!==l&&a[2]&&(c=parseInt(a[2],10)),a[3]!==l&&a[3]&&(d=parseInt(a[3],10)),a[4]!==l&&a[4]&&(e=/^[0-9]+$/.test(a[4])?parseInt(a[4],10):a[4]));return new z(b,c,d,e)};function B(a,b,c,d,e,f,g,h,n,m,r){this.J=a;this.Ha=b;this.za=c;this.ga=d;this.Fa=e;this.fa=f;this.xa=g;this.Ga=h;this.wa=n;this.ea=m;this.k=r}ba("webfont.UserAgent",B);B.prototype.getName=q("J");B.prototype.getName=B.prototype.getName;B.prototype.pa=q("za");B.prototype.getVersion=B.prototype.pa;B.prototype.la=q("ga");B.prototype.getEngine=B.prototype.la;B.prototype.ma=q("fa");B.prototype.getEngineVersion=B.prototype.ma;B.prototype.na=q("xa");B.prototype.getPlatform=B.prototype.na;B.prototype.oa=q("wa");
|
21 |
+
B.prototype.getPlatformVersion=B.prototype.oa;B.prototype.ka=q("ea");B.prototype.getDocumentMode=B.prototype.ka;B.prototype.ja=q("k");B.prototype.getBrowserInfo=B.prototype.ja;function C(a,b){this.a=a;this.H=b}var ka=new B("Unknown",new z,"Unknown","Unknown",new z,"Unknown","Unknown",new z,"Unknown",j,new y(p,p,p));
|
22 |
+
C.prototype.parse=function(){var a;if(-1!=this.a.indexOf("MSIE")){a=D(this);var b=E(this),c=A(b),d=F(this.a,/MSIE ([\d\w\.]+)/,1),e=A(d);a=new B("MSIE",e,d,"MSIE",e,d,a,c,b,G(this.H),new y("Windows"==a&&6<=e.e||"Windows Phone"==a&&8<=c.e,p,p))}else if(-1!=this.a.indexOf("Opera"))a:{a="Unknown";var b=F(this.a,/Presto\/([\d\w\.]+)/,1),c=A(b),d=E(this),e=A(d),f=G(this.H);c.e!==l?a="Presto":(-1!=this.a.indexOf("Gecko")&&(a="Gecko"),b=F(this.a,/rv:([^\)]+)/,1),c=A(b));if(-1!=this.a.indexOf("Opera Mini/")){var g=
|
23 |
+
F(this.a,/Opera Mini\/([\d\.]+)/,1),h=A(g);a=new B("OperaMini",h,g,a,c,b,D(this),e,d,f,new y(p,p,p))}else{if(-1!=this.a.indexOf("Version/")&&(g=F(this.a,/Version\/([\d\.]+)/,1),h=A(g),h.e!==l)){a=new B("Opera",h,g,a,c,b,D(this),e,d,f,new y(10<=h.e,p,p));break a}g=F(this.a,/Opera[\/ ]([\d\.]+)/,1);h=A(g);a=h.e!==l?new B("Opera",h,g,a,c,b,D(this),e,d,f,new y(10<=h.e,p,p)):new B("Opera",new z,"Unknown",a,c,b,D(this),e,d,f,new y(p,p,p))}}else if(/AppleWeb(K|k)it/.test(this.a)){a=D(this);var b=E(this),
|
24 |
+
c=A(b),d=F(this.a,/AppleWeb(?:K|k)it\/([\d\.\+]+)/,1),e=A(d),f="Unknown",g=new z,h="Unknown",n=p;-1!=this.a.indexOf("Chrome")||-1!=this.a.indexOf("CrMo")||-1!=this.a.indexOf("CriOS")?f="Chrome":/Silk\/\d/.test(this.a)?f="Silk":"BlackBerry"==a||"Android"==a?f="BuiltinBrowser":-1!=this.a.indexOf("Safari")?f="Safari":-1!=this.a.indexOf("AdobeAIR")&&(f="AdobeAIR");"BuiltinBrowser"==f?h="Unknown":"Silk"==f?h=F(this.a,/Silk\/([\d\._]+)/,1):"Chrome"==f?h=F(this.a,/(Chrome|CrMo|CriOS)\/([\d\.]+)/,2):-1!=
|
25 |
+
this.a.indexOf("Version/")?h=F(this.a,/Version\/([\d\.\w]+)/,1):"AdobeAIR"==f&&(h=F(this.a,/AdobeAIR\/([\d\.]+)/,1));g=A(h);n="AdobeAIR"==f?2<g.e||2==g.e&&5<=g.o:"BlackBerry"==a?10<=c.e:"Android"==a?2<c.e||2==c.e&&1<c.o:526<=e.e||525<=e.e&&13<=e.o;a=new B(f,g,h,"AppleWebKit",e,d,a,c,b,G(this.H),new y(n,536>e.e||536==e.e&&11>e.o,"iPhone"==a||"iPad"==a||"iPod"==a||"Macintosh"==a))}else-1!=this.a.indexOf("Gecko")?(a="Unknown",b=new z,c="Unknown",d=E(this),e=A(d),f=p,-1!=this.a.indexOf("Firefox")?(a=
|
26 |
+
"Firefox",c=F(this.a,/Firefox\/([\d\w\.]+)/,1),b=A(c),f=3<=b.e&&5<=b.o):-1!=this.a.indexOf("Mozilla")&&(a="Mozilla"),g=F(this.a,/rv:([^\)]+)/,1),h=A(g),f||(f=1<h.e||1==h.e&&9<h.o||1==h.e&&9==h.o&&2<=h.ba||g.match(/1\.9\.1b[123]/)!=l||g.match(/1\.9\.1\.[\d\.]+/)!=l),a=new B(a,b,c,"Gecko",h,g,D(this),e,d,G(this.H),new y(f,p,p))):a=ka;return a};
|
27 |
+
function D(a){var b=F(a.a,/(iPod|iPad|iPhone|Android|Windows Phone|BB\d{2}|BlackBerry)/,1);if(""!=b)return/BB\d{2}/.test(b)&&(b="BlackBerry"),b;a=F(a.a,/(Linux|Mac_PowerPC|Macintosh|Windows|CrOS)/,1);return""!=a?("Mac_PowerPC"==a&&(a="Macintosh"),a):"Unknown"}
|
28 |
+
function E(a){var b=F(a.a,/(OS X|Windows NT|Android) ([^;)]+)/,2);if(b||(b=F(a.a,/Windows Phone( OS)? ([^;)]+)/,2))||(b=F(a.a,/(iPhone )?OS ([\d_]+)/,2)))return b;if(b=F(a.a,/(?:Linux|CrOS) ([^;)]+)/,1))for(var b=b.split(/\s/),c=0;c<b.length;c+=1)if(/^[\d\._]+$/.test(b[c]))return b[c];return(a=F(a.a,/(BB\d{2}|BlackBerry).*?Version\/([^\s]*)/,2))?a:"Unknown"}function F(a,b,c){return(a=a.match(b))&&a[c]?a[c]:""}function G(a){if(a.documentMode)return a.documentMode};function la(a){this.va=a||"-"}la.prototype.f=function(a){for(var b=[],c=0;c<arguments.length;c++)b.push(arguments[c].replace(/[\W_]+/g,"").toLowerCase());return b.join(this.va)};function H(a,b){this.J=a;this.U=4;this.K="n";var c=(b||"n4").match(/^([nio])([1-9])$/i);c&&(this.K=c[1],this.U=parseInt(c[2],10))}H.prototype.getName=q("J");function I(a){return a.K+a.U}function ma(a){var b=4,c="n",d=l;a&&((d=a.match(/(normal|oblique|italic)/i))&&d[1]&&(c=d[1].substr(0,1).toLowerCase()),(d=a.match(/([1-9]00|normal|bold)/i))&&d[1]&&(/bold/i.test(d[1])?b=7:/[1-9]00/.test(d[1])&&(b=parseInt(d[1].substr(0,1),10))));return c+b};function na(a,b,c){this.c=a;this.h=b;this.M=c;this.j="wf";this.g=new la("-")}function pa(a){v(a.h,a.g.f(a.j,"loading"));J(a,"loading")}function K(a){w(a.h,a.g.f(a.j,"loading"));ia(a.h,a.g.f(a.j,"active"))||v(a.h,a.g.f(a.j,"inactive"));J(a,"inactive")}function J(a,b,c){if(a.M[b])if(c)a.M[b](c.getName(),I(c));else a.M[b]()};function L(a,b){this.c=a;this.C=b;this.s=this.c.createElement("span",{"aria-hidden":"true"},this.C)}
|
29 |
+
function M(a,b){var c=a.s,d;d=[];for(var e=b.J.split(/,\s*/),f=0;f<e.length;f++){var g=e[f].replace(/['"]/g,"");-1==g.indexOf(" ")?d.push(g):d.push("'"+g+"'")}d=d.join(",");e="normal";f=b.U+"00";"o"===b.K?e="oblique":"i"===b.K&&(e="italic");d="position:absolute;top:-999px;left:-999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:"+d+";"+("font-style:"+e+";font-weight:"+f+";");ga(a.c)?c.setAttribute("style",d):c.style.cssText=
|
30 |
+
d}function N(a){t(a.c,"body",a.s)}L.prototype.remove=function(){var a=this.s;a.parentNode&&a.parentNode.removeChild(a)};function qa(a,b,c,d,e,f,g,h){this.V=a;this.ta=b;this.c=c;this.q=d;this.C=h||"BESbswy";this.k=e;this.F={};this.S=f||5E3;this.Z=g||l;this.B=this.A=l;a=new L(this.c,this.C);N(a);for(var n in O)O.hasOwnProperty(n)&&(M(a,new H(O[n],I(this.q))),this.F[O[n]]=a.s.offsetWidth);a.remove()}var O={Ea:"serif",Da:"sans-serif",Ca:"monospace"};
|
31 |
+
qa.prototype.start=function(){this.A=new L(this.c,this.C);N(this.A);this.B=new L(this.c,this.C);N(this.B);this.ya=ea();M(this.A,new H(this.q.getName()+",serif",I(this.q)));M(this.B,new H(this.q.getName()+",sans-serif",I(this.q)));ra(this)};function sa(a,b,c){for(var d in O)if(O.hasOwnProperty(d)&&b===a.F[O[d]]&&c===a.F[O[d]])return k;return p}
|
32 |
+
function ra(a){var b=a.A.s.offsetWidth,c=a.B.s.offsetWidth;b===a.F.serif&&c===a.F["sans-serif"]||a.k.T&&sa(a,b,c)?ea()-a.ya>=a.S?a.k.T&&sa(a,b,c)&&(a.Z===l||a.Z.hasOwnProperty(a.q.getName()))?P(a,a.V):P(a,a.ta):setTimeout(s(function(){ra(this)},a),25):P(a,a.V)}function P(a,b){a.A.remove();a.B.remove();b(a.q)};function R(a,b,c,d){this.c=b;this.t=c;this.N=0;this.ca=this.Y=p;this.S=d;this.k=a.k}function ta(a,b,c,d,e){if(0===b.length&&e)K(a.t);else{a.N+=b.length;e&&(a.Y=e);for(e=0;e<b.length;e++){var f=b[e],g=c[f.getName()],h=a.t,n=f;v(h.h,h.g.f(h.j,n.getName(),I(n).toString(),"loading"));J(h,"fontloading",n);(new qa(s(a.ha,a),s(a.ia,a),a.c,f,a.k,a.S,d,g)).start()}}}
|
33 |
+
R.prototype.ha=function(a){var b=this.t;w(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"loading"));w(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"inactive"));v(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"active"));J(b,"fontactive",a);this.ca=k;ua(this)};R.prototype.ia=function(a){var b=this.t;w(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"loading"));ia(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"active"))||v(b.h,b.g.f(b.j,a.getName(),I(a).toString(),"inactive"));J(b,"fontinactive",a);ua(this)};
|
34 |
+
function ua(a){0==--a.N&&a.Y&&(a.ca?(a=a.t,w(a.h,a.g.f(a.j,"loading")),w(a.h,a.g.f(a.j,"inactive")),v(a.h,a.g.f(a.j,"active")),J(a,"active")):K(a.t))};function S(a,b,c){this.G=a;this.W=b;this.a=c;this.O=this.P=0}function T(a,b){U.W.$[a]=b}S.prototype.load=function(a){var b=a.context||this.G;this.c=new fa(this.G,b);b=new na(this.c,b.document.documentElement,a);if(this.a.k.w){var c=this.W,d=this.c,e=[],f;for(f in a)if(a.hasOwnProperty(f)){var g=c.$[f];g&&e.push(g(a[f],d))}a=a.timeout;this.O=this.P=e.length;a=new R(this.a,this.c,b,a);f=0;for(c=e.length;f<c;f++)d=e[f],d.v(this.a,s(this.ua,this,d,b,a))}else K(b)};
|
35 |
+
S.prototype.ua=function(a,b,c,d){var e=this;d?a.load(function(a,d,h){var n=0==--e.P;n&&pa(b);setTimeout(function(){ta(c,a,d||{},h||l,n)},0)}):(a=0==--this.P,this.O--,a&&(0==this.O?K(b):pa(b)),ta(c,[],{},l,a))};var va=window,wa=(new C(navigator.userAgent,document)).parse(),U=va.WebFont=new S(window,new function(){this.$={}},wa);U.load=U.load;function V(a,b){this.c=a;this.d=b}V.prototype.load=function(a){var b,c,d=this.d.urls||[],e=this.d.families||[];b=0;for(c=d.length;b<c;b++)t(this.c,"head",u(this.c,d[b]));d=[];b=0;for(c=e.length;b<c;b++){var f=e[b].split(":");if(f[1])for(var g=f[1].split(","),h=0;h<g.length;h+=1)d.push(new H(f[0],g[h]));else d.push(new H(f[0]))}a(d)};V.prototype.v=function(a,b){return b(a.k.w)};T("custom",function(a,b){return new V(b,a)});function W(a,b){this.c=a;this.d=b}var xa={regular:"n4",bold:"n7",italic:"i4",bolditalic:"i7",r:"n4",b:"n7",i:"i4",bi:"i7"};W.prototype.v=function(a,b){return b(a.k.w)};W.prototype.load=function(a){t(this.c,"head",u(this.c,x(this.c)+"//webfonts.fontslive.com/css/"+this.d.key+".css"));for(var b=this.d.families,c=[],d=0,e=b.length;d<e;d++)c.push.apply(c,ya(b[d]));a(c)};
|
36 |
+
function ya(a){var b=a.split(":");a=b[0];if(b[1]){for(var c=b[1].split(","),b=[],d=0,e=c.length;d<e;d++){var f=c[d];if(f){var g=xa[f];b.push(g?g:f)}}c=[];for(d=0;d<b.length;d+=1)c.push(new H(a,b[d]));return c}return[new H(a)]}T("ascender",function(a,b){return new W(b,a)});function X(a,b,c){this.a=a;this.c=b;this.d=c;this.m=[]}
|
37 |
+
X.prototype.v=function(a,b){var c=this,d=c.d.projectId,e=c.d.version;if(d){var f=c.c.u,g=c.c.createElement("script");g.id="__MonotypeAPIScript__"+d;var h=p;g.onload=g.onreadystatechange=function(){if(!h&&(!this.readyState||"loaded"===this.readyState||"complete"===this.readyState)){h=k;if(f["__mti_fntLst"+d]){var e=f["__mti_fntLst"+d]();if(e)for(var m=0;m<e.length;m++)c.m.push(new H(e[m].fontfamily))}b(a.k.w);g.onload=g.onreadystatechange=l}};g.src=c.D(d,e);t(this.c,"head",g)}else b(k)};
|
38 |
+
X.prototype.D=function(a,b){var c=x(this.c),d=(this.d.api||"fast.fonts.com/jsapi").replace(/^.*http(s?):(\/\/)?/,"");return c+"//"+d+"/"+a+".js"+(b?"?v="+b:"")};X.prototype.load=function(a){a(this.m)};T("monotype",function(a,b){var c=(new C(navigator.userAgent,document)).parse();return new X(c,b,a)});function Y(a,b){this.c=a;this.d=b;this.m=[]}Y.prototype.D=function(a){var b=x(this.c);return(this.d.api||b+"//use.typekit.net")+"/"+a+".js"};
|
39 |
+
Y.prototype.v=function(a,b){var c=this.d.id,d=this.d,e=this.c.u,f=this;c?(e.__webfonttypekitmodule__||(e.__webfonttypekitmodule__={}),e.__webfonttypekitmodule__[c]=function(c){c(a,d,function(a,c,d){for(var e=0;e<c.length;e+=1){var g=d[c[e]];if(g)for(var Q=0;Q<g.length;Q+=1)f.m.push(new H(c[e],g[Q]));else f.m.push(new H(c[e]))}b(a)})},c=ha(this.c,this.D(c)),t(this.c,"head",c)):b(k)};Y.prototype.load=function(a){a(this.m)};T("typekit",function(a,b){return new Y(b,a)});function za(a,b,c){this.L=a?a:b+Aa;this.p=[];this.Q=[];this.da=c||""}var Aa="//fonts.bunny.net/css";za.prototype.f=function(){if(0==this.p.length)throw Error("No fonts to load !");if(-1!=this.L.indexOf("kit="))return this.L;for(var a=this.p.length,b=[],c=0;c<a;c++)b.push(this.p[c].replace(/ /g,"+"));a=this.L+"?family="+b.join("%7C");0<this.Q.length&&(a+="&subset="+this.Q.join(","));0<this.da.length&&(a+="&text="+encodeURIComponent(this.da));return a};function Ba(a){this.p=a;this.aa=[];this.I={}}
|
40 |
+
var Ca={latin:"BESbswy",cyrillic:"йяЖ",greek:"αβΣ",khmer:"កខគ",Hanuman:"កខគ"},Da={thin:"1",extralight:"2","extra-light":"2",ultralight:"2","ultra-light":"2",light:"3",regular:"4",book:"4",medium:"5","semi-bold":"6",semibold:"6","demi-bold":"6",demibold:"6",bold:"7","extra-bold":"8",extrabold:"8","ultra-bold":"8",ultrabold:"8",black:"9",heavy:"9",l:"3",r:"4",b:"7"},Ea={i:"i",italic:"i",n:"n",normal:"n"},Fa=RegExp("^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$");
|
41 |
+
Ba.prototype.parse=function(){for(var a=this.p.length,b=0;b<a;b++){var c=this.p[b].split(":"),d=c[0].replace(/\+/g," "),e=["n4"];if(2<=c.length){var f;var g=c[1];f=[];if(g)for(var g=g.split(","),h=g.length,n=0;n<h;n++){var m;m=g[n];if(m.match(/^[\w]+$/)){m=Fa.exec(m.toLowerCase());var r=j;if(m==l)r="";else{r=j;r=m[1];if(r==l||""==r)r="4";else var oa=Da[r],r=oa?oa:isNaN(r)?"4":r.substr(0,1);r=[m[2]==l||""==m[2]?"n":Ea[m[2]],r].join("")}m=r}else m="";m&&f.push(m)}0<f.length&&(e=f);3==c.length&&(c=c[2],
|
42 |
+
f=[],c=!c?f:c.split(","),0<c.length&&(c=Ca[c[0]])&&(this.I[d]=c))}this.I[d]||(c=Ca[d])&&(this.I[d]=c);for(c=0;c<e.length;c+=1)this.aa.push(new H(d,e[c]))}};function Z(a,b,c){this.a=a;this.c=b;this.d=c}var Ga={Arimo:k,Cousine:k,Tinos:k};Z.prototype.v=function(a,b){b(a.k.w)};Z.prototype.load=function(a){var b=this.c;if("MSIE"==this.a.getName()&&this.d.blocking!=k){var c=s(this.X,this,a),d=function(){b.z.body?c():setTimeout(d,0)};d()}else this.X(a)};
|
43 |
+
Z.prototype.X=function(a){for(var b=this.c,c=new za(this.d.api,x(b),this.d.text),d=this.d.families,e=d.length,f=0;f<e;f++){var g=d[f].split(":");3==g.length&&c.Q.push(g.pop());var h="";2==g.length&&""!=g[1]&&(h=":");c.p.push(g.join(h))}d=new Ba(d);d.parse();t(b,"head",u(b,c.f()));a(d.aa,d.I,Ga)};T("bunny",function(a,b){var c=(new C(navigator.userAgent,document)).parse();return new Z(c,b,a)});function $(a,b){this.c=a;this.d=b;this.m=[]}$.prototype.D=function(a){return x(this.c)+(this.d.api||"//f.fontdeck.com/s/css/js/")+(this.c.u.location.hostname||this.c.G.location.hostname)+"/"+a+".js"};
|
44 |
+
$.prototype.v=function(a,b){var c=this.d.id,d=this.c.u,e=this;c?(d.__webfontfontdeckmodule__||(d.__webfontfontdeckmodule__={}),d.__webfontfontdeckmodule__[c]=function(a,c){for(var d=0,n=c.fonts.length;d<n;++d){var m=c.fonts[d];e.m.push(new H(m.name,ma("font-weight:"+m.weight+";font-style:"+m.style)))}b(a)},c=ha(this.c,this.D(c)),t(this.c,"head",c)):b(k)};$.prototype.load=function(a){a(this.m)};T("fontdeck",function(a,b){return new $(b,a)});window.WebFontConfig&&U.load(window.WebFontConfig);
|
45 |
+
})(this,document);
|
assets/src/js/components/edit.js
CHANGED
@@ -214,32 +214,32 @@ export default class Edit extends Component {
|
|
214 |
sab_subset = '&subset=latin';
|
215 |
}
|
216 |
|
217 |
-
let
|
218 |
|
219 |
if ( 'None' != sabVars.sab_box_name_font ) {
|
220 |
-
|
221 |
}
|
222 |
|
223 |
if ( 'None' != sabVars.sab_box_desc_font ) {
|
224 |
-
|
225 |
}
|
226 |
|
227 |
if ( 'None' != sabVars.sab_box_web_font ) {
|
228 |
-
|
229 |
}
|
230 |
|
231 |
function onlyUnique(value, index, self) {
|
232 |
return self.indexOf(value) === index;
|
233 |
}
|
234 |
-
|
235 |
|
236 |
-
if (
|
237 |
|
238 |
-
|
239 |
-
|
240 |
});
|
241 |
|
242 |
-
return <link href={ 'https://fonts.
|
243 |
|
244 |
}
|
245 |
|
214 |
sab_subset = '&subset=latin';
|
215 |
}
|
216 |
|
217 |
+
let bunny_fonts = [];
|
218 |
|
219 |
if ( 'None' != sabVars.sab_box_name_font ) {
|
220 |
+
bunny_fonts.push( sabVars.sab_box_name_font.replace(' ', '+') );
|
221 |
}
|
222 |
|
223 |
if ( 'None' != sabVars.sab_box_desc_font ) {
|
224 |
+
bunny_fonts.push( sabVars.sab_box_desc_font.replace(' ', '+') );
|
225 |
}
|
226 |
|
227 |
if ( 'None' != sabVars.sab_box_web_font ) {
|
228 |
+
bunny_fonts.push( sabVars.sab_box_web_font.replace(' ', '+') );
|
229 |
}
|
230 |
|
231 |
function onlyUnique(value, index, self) {
|
232 |
return self.indexOf(value) === index;
|
233 |
}
|
234 |
+
bunny_fonts = bunny_fonts.filter( onlyUnique );
|
235 |
|
236 |
+
if ( bunny_fonts.length > 0 ) {
|
237 |
|
238 |
+
bunny_fonts.forEach(function(entry,index) {
|
239 |
+
bunny_fonts[index] = entry + ':400,700,400italic,700italic';
|
240 |
});
|
241 |
|
242 |
+
return <link href={ 'https://fonts.bunny.net/css?family=' + bunny_fonts.join('|') + sab_subset } rel="stylesheet"/>
|
243 |
|
244 |
}
|
245 |
|
inc/class-simple-author-box-admin-page.php
CHANGED
@@ -458,24 +458,24 @@ class Simple_Author_Box_Admin_Page
|
|
458 |
),
|
459 |
'typography-options' => array(
|
460 |
'sab_box_subset' => array(
|
461 |
-
'label' => __('
|
462 |
-
'description' => __('Some
|
463 |
'type' => 'select',
|
464 |
-
'choices' => Simple_Author_Box_Helper::
|
465 |
'default' => 'none',
|
466 |
),
|
467 |
'sab_box_name_font' => array(
|
468 |
'label' => __('Author name font family', 'simple-author-box'),
|
469 |
'description' => __('Select the font family for the author\'s name', 'simple-author-box'),
|
470 |
'type' => 'select',
|
471 |
-
'choices' => Simple_Author_Box_Helper::
|
472 |
'default' => 'None',
|
473 |
),
|
474 |
'sab_box_job_font' => array(
|
475 |
'label' => __('Author job title font family', 'simple-author-box'),
|
476 |
'description' => __('Select the font family for the author\'s job title', 'simple-author-box'),
|
477 |
'type' => 'select',
|
478 |
-
'choices' => Simple_Author_Box_Helper::
|
479 |
'default' => 'None',
|
480 |
'profeature' => true,
|
481 |
),
|
@@ -483,7 +483,7 @@ class Simple_Author_Box_Admin_Page
|
|
483 |
'label' => __('Author website font family', 'simple-author-box'),
|
484 |
'description' => __('Select the font family for the author\'s website', 'simple-author-box'),
|
485 |
'type' => 'select',
|
486 |
-
'choices' => Simple_Author_Box_Helper::
|
487 |
'default' => 'None',
|
488 |
'condition' => 'sab_web',
|
489 |
),
|
@@ -491,7 +491,7 @@ class Simple_Author_Box_Admin_Page
|
|
491 |
'label' => __('Author description font family', 'simple-author-box'),
|
492 |
'description' => __('Select the font family for the author\'s description', 'simple-author-box'),
|
493 |
'type' => 'select',
|
494 |
-
'choices' => Simple_Author_Box_Helper::
|
495 |
'default' => 'None',
|
496 |
),
|
497 |
'sab_box_name_size' => array(
|
@@ -808,7 +808,7 @@ class Simple_Author_Box_Admin_Page
|
|
808 |
<div class="sabox-masthead-left">
|
809 |
<div class="wp-heading-inline">
|
810 |
<?php
|
811 |
-
echo '<img src="' . SIMPLE_AUTHOR_BOX_ASSETS . 'img/simple-author-box-logo.png' . '" title="' .
|
812 |
?>
|
813 |
</div>
|
814 |
</div>
|
@@ -822,7 +822,7 @@ class Simple_Author_Box_Admin_Page
|
|
822 |
<?php
|
823 |
|
824 |
if (get_transient('sab_error_msg')) {
|
825 |
-
|
826 |
}
|
827 |
?>
|
828 |
<div class="sabox-left">
|
@@ -875,7 +875,12 @@ class Simple_Author_Box_Admin_Page
|
|
875 |
}
|
876 |
|
877 |
echo '<div class="epfw-turn-into-tab" id="' . esc_attr($tab_name) . '-tab">';
|
878 |
-
echo '<h3 class="sab-tab-title">'
|
|
|
|
|
|
|
|
|
|
|
879 |
|
880 |
if($tab_name == 'typography-options' || $tab_name == 'appearance-options' || $tab_name == 'visibility') {
|
881 |
echo '<div class="sab-tab-save">';
|
@@ -907,7 +912,7 @@ class Simple_Author_Box_Admin_Page
|
|
907 |
</div><!-- sabox-content -->
|
908 |
|
909 |
<?php
|
910 |
-
|
911 |
}
|
912 |
|
913 |
function pro_dialog()
|
@@ -1258,12 +1263,12 @@ class Simple_Author_Box_Admin_Page
|
|
1258 |
}
|
1259 |
|
1260 |
if ($field_name == 'themes') {
|
1261 |
-
|
1262 |
return;
|
1263 |
}
|
1264 |
|
1265 |
if ($field_name == 'advanced') {
|
1266 |
-
|
1267 |
return;
|
1268 |
}
|
1269 |
|
@@ -1281,7 +1286,7 @@ class Simple_Author_Box_Admin_Page
|
|
1281 |
|
1282 |
if ($field['type'] == 'hidden') {
|
1283 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : 'none';
|
1284 |
-
echo '<input type="hidden" class="sabox-text" id="' . esc_attr($field_name) . '" name="' . esc_attr($name) . '" value="' . $value . '" />';
|
1285 |
return;
|
1286 |
}
|
1287 |
echo '<th scope="row">';
|
@@ -1302,7 +1307,7 @@ class Simple_Author_Box_Admin_Page
|
|
1302 |
}
|
1303 |
|
1304 |
if($profeature){
|
1305 |
-
echo '<div class="open-upsell open-upsell-block" data-feature="' . $field_name . '">';
|
1306 |
}
|
1307 |
switch ($field['type']) {
|
1308 |
case 'toggle':
|
@@ -1332,11 +1337,11 @@ class Simple_Author_Box_Admin_Page
|
|
1332 |
break;
|
1333 |
case 'text':
|
1334 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : $field['default'];
|
1335 |
-
echo '<input type="text" class="sabox-text" id="' . esc_attr($field_name) . '" name="' . esc_attr($name) . '" value="' . $value . '" ' . ($profeature?'disabled':'') . ' />';
|
1336 |
break;
|
1337 |
case 'textarea':
|
1338 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : $field['default'];
|
1339 |
-
echo '<textarea rows="3" cols="50" id="' . esc_attr($field_name) . '" value="' . esc_attr($value) . '" name="' . esc_attr($name) . '" class="saboxfield sabox-text" ' . ($profeature?'disabled':'') . '>' . $value . '</textarea>';
|
1340 |
break;
|
1341 |
case 'readonly':
|
1342 |
echo '<textarea clas="regular-text" rows="3" cols="50" onclick="this.focus();this.select();" readonly="readonly">' . esc_attr($field['value']) . '</textarea>';
|
@@ -1365,7 +1370,7 @@ class Simple_Author_Box_Admin_Page
|
|
1365 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : '';
|
1366 |
echo '<div class="sab-element-image-wrapper">';
|
1367 |
if (!empty($value)) {
|
1368 |
-
echo '<span class="sabox-preview-area" id="background-preview"><img src="' . $value . '" /> <a href="javascript: void(0);" class="sab-remove-image">Remove Image</a></span>';
|
1369 |
} else {
|
1370 |
echo '<span class="sabox-preview-area" id="background-preview"><span class="sabox-preview-area-placeholder">Select an image from our 400,000+ images gallery, or upload your own</span></span>';
|
1371 |
}
|
@@ -1400,7 +1405,8 @@ class Simple_Author_Box_Admin_Page
|
|
1400 |
|
1401 |
foreach ($field['choices'] as $key => $choice) {
|
1402 |
echo '<div>';
|
1403 |
-
echo '<input id="' . $key . '-' . $field_name . '" type="checkbox" value="' . $key . '" ' . checked(1, in_array($key, $checked), false) . ' name="' . esc_attr($name) . '[]"
|
|
|
1404 |
echo '</div>';
|
1405 |
}
|
1406 |
echo '</div>';
|
458 |
),
|
459 |
'typography-options' => array(
|
460 |
'sab_box_subset' => array(
|
461 |
+
'label' => __('Bunny font characters subset', 'simple-author-box'),
|
462 |
+
'description' => __('Some Bunny Fonts do not support all non-latin character subsets', 'simple-author-box'),
|
463 |
'type' => 'select',
|
464 |
+
'choices' => Simple_Author_Box_Helper::get_bunny_font_subsets(),
|
465 |
'default' => 'none',
|
466 |
),
|
467 |
'sab_box_name_font' => array(
|
468 |
'label' => __('Author name font family', 'simple-author-box'),
|
469 |
'description' => __('Select the font family for the author\'s name', 'simple-author-box'),
|
470 |
'type' => 'select',
|
471 |
+
'choices' => Simple_Author_Box_Helper::get_bunny_fonts(),
|
472 |
'default' => 'None',
|
473 |
),
|
474 |
'sab_box_job_font' => array(
|
475 |
'label' => __('Author job title font family', 'simple-author-box'),
|
476 |
'description' => __('Select the font family for the author\'s job title', 'simple-author-box'),
|
477 |
'type' => 'select',
|
478 |
+
'choices' => Simple_Author_Box_Helper::get_bunny_fonts(),
|
479 |
'default' => 'None',
|
480 |
'profeature' => true,
|
481 |
),
|
483 |
'label' => __('Author website font family', 'simple-author-box'),
|
484 |
'description' => __('Select the font family for the author\'s website', 'simple-author-box'),
|
485 |
'type' => 'select',
|
486 |
+
'choices' => Simple_Author_Box_Helper::get_bunny_fonts(),
|
487 |
'default' => 'None',
|
488 |
'condition' => 'sab_web',
|
489 |
),
|
491 |
'label' => __('Author description font family', 'simple-author-box'),
|
492 |
'description' => __('Select the font family for the author\'s description', 'simple-author-box'),
|
493 |
'type' => 'select',
|
494 |
+
'choices' => Simple_Author_Box_Helper::get_bunny_fonts(),
|
495 |
'default' => 'None',
|
496 |
),
|
497 |
'sab_box_name_size' => array(
|
808 |
<div class="sabox-masthead-left">
|
809 |
<div class="wp-heading-inline">
|
810 |
<?php
|
811 |
+
echo '<img src="' . esc_url(SIMPLE_AUTHOR_BOX_ASSETS) . 'img/simple-author-box-logo.png' . '" title="' . esc_html__('Simple Author Box', 'simple-author-box') . '" class="sab-logo">';
|
812 |
?>
|
813 |
</div>
|
814 |
</div>
|
822 |
<?php
|
823 |
|
824 |
if (get_transient('sab_error_msg')) {
|
825 |
+
wpsabox_wp_kses_wf(get_transient('sab_error_msg'));
|
826 |
}
|
827 |
?>
|
828 |
<div class="sabox-left">
|
875 |
}
|
876 |
|
877 |
echo '<div class="epfw-turn-into-tab" id="' . esc_attr($tab_name) . '-tab">';
|
878 |
+
echo '<h3 class="sab-tab-title">';
|
879 |
+
echo esc_html($this->sections[$tab_name]['label']);
|
880 |
+
if($tab_name == 'themes'){
|
881 |
+
esc_html($this->generate_pro_label('themes'));
|
882 |
+
}
|
883 |
+
echo '</h3>';
|
884 |
|
885 |
if($tab_name == 'typography-options' || $tab_name == 'appearance-options' || $tab_name == 'visibility') {
|
886 |
echo '<div class="sab-tab-save">';
|
912 |
</div><!-- sabox-content -->
|
913 |
|
914 |
<?php
|
915 |
+
wpsabox_wp_kses_wf($this->pro_dialog());
|
916 |
}
|
917 |
|
918 |
function pro_dialog()
|
1263 |
}
|
1264 |
|
1265 |
if ($field_name == 'themes') {
|
1266 |
+
wpsabox_wp_kses_wf('<td colspan="2">' . $this->themes_tab() . '</td>');
|
1267 |
return;
|
1268 |
}
|
1269 |
|
1270 |
if ($field_name == 'advanced') {
|
1271 |
+
wpsabox_wp_kses_wf('<td colspan="2">' . $this->advanced_tab() . '</td>');
|
1272 |
return;
|
1273 |
}
|
1274 |
|
1286 |
|
1287 |
if ($field['type'] == 'hidden') {
|
1288 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : 'none';
|
1289 |
+
echo '<input type="hidden" class="sabox-text" id="' . esc_attr($field_name) . '" name="' . esc_attr($name) . '" value="' . esc_attr($value) . '" />';
|
1290 |
return;
|
1291 |
}
|
1292 |
echo '<th scope="row">';
|
1307 |
}
|
1308 |
|
1309 |
if($profeature){
|
1310 |
+
echo '<div class="open-upsell open-upsell-block" data-feature="' . esc_attr($field_name) . '">';
|
1311 |
}
|
1312 |
switch ($field['type']) {
|
1313 |
case 'toggle':
|
1337 |
break;
|
1338 |
case 'text':
|
1339 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : $field['default'];
|
1340 |
+
echo '<input type="text" class="sabox-text" id="' . esc_attr($field_name) . '" name="' . esc_attr($name) . '" value="' . esc_attr($value) . '" ' . ($profeature?'disabled':'') . ' />';
|
1341 |
break;
|
1342 |
case 'textarea':
|
1343 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : $field['default'];
|
1344 |
+
echo '<textarea rows="3" cols="50" id="' . esc_attr($field_name) . '" value="' . esc_attr($value) . '" name="' . esc_attr($name) . '" class="saboxfield sabox-text" ' . ($profeature?'disabled':'') . '>' . esc_textarea($value) . '</textarea>';
|
1345 |
break;
|
1346 |
case 'readonly':
|
1347 |
echo '<textarea clas="regular-text" rows="3" cols="50" onclick="this.focus();this.select();" readonly="readonly">' . esc_attr($field['value']) . '</textarea>';
|
1370 |
$value = isset($this->options[$field_name]) ? $this->options[$field_name] : '';
|
1371 |
echo '<div class="sab-element-image-wrapper">';
|
1372 |
if (!empty($value)) {
|
1373 |
+
echo '<span class="sabox-preview-area" id="background-preview"><img src="' . esc_url($value) . '" /> <a href="javascript: void(0);" class="sab-remove-image">Remove Image</a></span>';
|
1374 |
} else {
|
1375 |
echo '<span class="sabox-preview-area" id="background-preview"><span class="sabox-preview-area-placeholder">Select an image from our 400,000+ images gallery, or upload your own</span></span>';
|
1376 |
}
|
1405 |
|
1406 |
foreach ($field['choices'] as $key => $choice) {
|
1407 |
echo '<div>';
|
1408 |
+
echo '<input id="' . esc_attr($key) . '-' . esc_attr($field_name) . '" type="checkbox" value="' . esc_attr($key) . '" ' . esc_html(checked(1, in_array($key, $checked), false)) . ' name="' . esc_attr($name) . '[]">';
|
1409 |
+
echo '<label for="' . esc_attr($key) . '-' . esc_attr($field_name) . '" class="checkbox-label">' . esc_attr($choice) . '</label>';
|
1410 |
echo '</div>';
|
1411 |
}
|
1412 |
echo '</div>';
|
inc/class-simple-author-box-helper.php
CHANGED
@@ -172,7 +172,7 @@ class Simple_Author_Box_Helper
|
|
172 |
return $social_links;
|
173 |
}
|
174 |
|
175 |
-
public static function
|
176 |
{
|
177 |
return array(
|
178 |
'none' => 'None',
|
@@ -195,7 +195,7 @@ class Simple_Author_Box_Helper
|
|
195 |
return $url;
|
196 |
}
|
197 |
|
198 |
-
public static function
|
199 |
{
|
200 |
$fonts = array(
|
201 |
'None',
|
@@ -919,7 +919,8 @@ class Simple_Author_Box_Helper
|
|
919 |
|
920 |
public static function get_template($template_name = 'template-sab.php')
|
921 |
{
|
922 |
-
|
|
|
923 |
$template = '';
|
924 |
|
925 |
if (!$template) {
|
172 |
return $social_links;
|
173 |
}
|
174 |
|
175 |
+
public static function get_bunny_font_subsets()
|
176 |
{
|
177 |
return array(
|
178 |
'none' => 'None',
|
195 |
return $url;
|
196 |
}
|
197 |
|
198 |
+
public static function get_bunny_fonts()
|
199 |
{
|
200 |
$fonts = array(
|
201 |
'None',
|
919 |
|
920 |
public static function get_template($template_name = 'template-sab.php')
|
921 |
{
|
922 |
+
global $simple_author_box;
|
923 |
+
|
924 |
$template = '';
|
925 |
|
926 |
if (!$template) {
|
inc/class-simple-author-box-previewer.php
CHANGED
@@ -56,7 +56,7 @@ class Simple_Author_Box_Previewer
|
|
56 |
// loaded only on plugin page
|
57 |
if ('appearance_page_simple-author-box' == $hook) {
|
58 |
|
59 |
-
wp_enqueue_script('sabox-webfont', '
|
60 |
wp_enqueue_script('sabox-previewer', SIMPLE_AUTHOR_BOX_ASSETS . 'js/sab-preview.js', array(
|
61 |
'jquery',
|
62 |
'backbone',
|
@@ -70,7 +70,7 @@ class Simple_Author_Box_Previewer
|
|
70 |
$this->options = Simple_Author_Box_Helper::get_option('saboxplugin_options');
|
71 |
|
72 |
echo '<style type="text/css">';
|
73 |
-
|
74 |
echo '</style>';
|
75 |
|
76 |
echo '<div class="saboxplugin-wrap" style="max-width:656px;margin:0 auto;width:100%;">'; // start saboxplugin-wrap div
|
@@ -108,14 +108,14 @@ class Simple_Author_Box_Previewer
|
|
108 |
break;
|
109 |
}
|
110 |
|
111 |
-
echo '<div class="' . $avatar_classes . '">';
|
112 |
echo get_avatar(1, 264, 'mystery', '', array('force_default' => true));
|
113 |
|
114 |
echo '</div>';
|
115 |
|
116 |
// author box name
|
117 |
echo '<div class="saboxplugin-authorname">';
|
118 |
-
|
119 |
echo '</div>';
|
120 |
|
121 |
|
@@ -157,7 +157,7 @@ class Simple_Author_Box_Previewer
|
|
157 |
$extra_class .= ' sab-icons-with-border';
|
158 |
}
|
159 |
|
160 |
-
echo '<div class="saboxplugin-socials sabox-colored' . $extra_class . '" style="' . ('1' == $this->options['sab_hide_socials'] ? 'display:none;' : '') . '">';
|
161 |
$simple_icons_html = '';
|
162 |
$circle_icons_html = '';
|
163 |
$square_icons_html = '';
|
@@ -170,9 +170,9 @@ class Simple_Author_Box_Previewer
|
|
170 |
$square_icons_html .= sprintf($link, 'saboxplugin-icon-color', Simple_Author_Box_Social::icon_to_svg($social_platform, 'square'));
|
171 |
}
|
172 |
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
|
177 |
|
178 |
echo '</div>';
|
56 |
// loaded only on plugin page
|
57 |
if ('appearance_page_simple-author-box' == $hook) {
|
58 |
|
59 |
+
wp_enqueue_script('sabox-webfont', SIMPLE_AUTHOR_BOX_ASSETS . 'js/webfont.js', array(), false, true);
|
60 |
wp_enqueue_script('sabox-previewer', SIMPLE_AUTHOR_BOX_ASSETS . 'js/sab-preview.js', array(
|
61 |
'jquery',
|
62 |
'backbone',
|
70 |
$this->options = Simple_Author_Box_Helper::get_option('saboxplugin_options');
|
71 |
|
72 |
echo '<style type="text/css">';
|
73 |
+
wpsabox_wp_kses_wf($this->generate_inline_css());
|
74 |
echo '</style>';
|
75 |
|
76 |
echo '<div class="saboxplugin-wrap" style="max-width:656px;margin:0 auto;width:100%;">'; // start saboxplugin-wrap div
|
108 |
break;
|
109 |
}
|
110 |
|
111 |
+
echo '<div class="' . esc_attr($avatar_classes) . '">';
|
112 |
echo get_avatar(1, 264, 'mystery', '', array('force_default' => true));
|
113 |
|
114 |
echo '</div>';
|
115 |
|
116 |
// author box name
|
117 |
echo '<div class="saboxplugin-authorname">';
|
118 |
+
wpsabox_wp_kses_wf(apply_filters('sabox_preview_author_html', '<a href="#" class="vcard author"><span class="fn">John Doe</span></a>'));
|
119 |
echo '</div>';
|
120 |
|
121 |
|
157 |
$extra_class .= ' sab-icons-with-border';
|
158 |
}
|
159 |
|
160 |
+
echo '<div class="saboxplugin-socials sabox-colored' . esc_attr($extra_class) . '" style="' . ('1' == $this->options['sab_hide_socials'] ? 'display:none;' : '') . '">';
|
161 |
$simple_icons_html = '';
|
162 |
$circle_icons_html = '';
|
163 |
$square_icons_html = '';
|
170 |
$square_icons_html .= sprintf($link, 'saboxplugin-icon-color', Simple_Author_Box_Social::icon_to_svg($social_platform, 'square'));
|
171 |
}
|
172 |
|
173 |
+
wpsabox_wp_kses_wf('<div class="sab-simple-icons">' . $simple_icons_html . '</div>');
|
174 |
+
wpsabox_wp_kses_wf('<div class="sab-circle-icons">' . $circle_icons_html . '</div>');
|
175 |
+
wpsabox_wp_kses_wf('<div class="sab-square-icons">' . $square_icons_html . '</div>');
|
176 |
|
177 |
|
178 |
echo '</div>';
|
inc/class-simple-author-box-user-profile.php
CHANGED
@@ -56,7 +56,13 @@ class Simple_Author_Box_User_Profile {
|
|
56 |
<input name="sabox-social-links[]"
|
57 |
type="<?php echo ('whatsapp' == $social_platform || 'phone' == $social_platform) ? 'tel' : 'text'; ?>"
|
58 |
class="regular-text"
|
59 |
-
value="<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
<span class="dashicons dashicons-trash"></span>
|
61 |
<td>
|
62 |
</tr>
|
@@ -113,8 +119,8 @@ class Simple_Author_Box_User_Profile {
|
|
113 |
<td>
|
114 |
<div id="sab-current-image">
|
115 |
<?php wp_nonce_field('sabox-profile-image', 'sabox-profile-nonce'); ?>
|
116 |
-
<img data-default="<?php echo
|
117 |
-
src="<?php echo '' != $image ?
|
118 |
<input type="text" name="sabox-custom-image" id="sabox-custom-image" class="regular-text"
|
119 |
value="<?php echo esc_attr($image); ?>">
|
120 |
</div>
|
56 |
<input name="sabox-social-links[]"
|
57 |
type="<?php echo ('whatsapp' == $social_platform || 'phone' == $social_platform) ? 'tel' : 'text'; ?>"
|
58 |
class="regular-text"
|
59 |
+
value="<?php
|
60 |
+
if( 'whatsapp' == $social_platform || 'telegram' == $social_platform || 'skype' == $social_platform || 'phone' == $social_platform ){
|
61 |
+
echo esc_attr($social_link);
|
62 |
+
} else {
|
63 |
+
esc_url($social_link);
|
64 |
+
}
|
65 |
+
?>">
|
66 |
<span class="dashicons dashicons-trash"></span>
|
67 |
<td>
|
68 |
</tr>
|
119 |
<td>
|
120 |
<div id="sab-current-image">
|
121 |
<?php wp_nonce_field('sabox-profile-image', 'sabox-profile-nonce'); ?>
|
122 |
+
<img data-default="<?php echo esc_url($default_url); ?>"
|
123 |
+
src="<?php echo '' != $image ? esc_url($image) : esc_url($default_url); ?>"><br>
|
124 |
<input type="text" name="sabox-custom-image" id="sabox-custom-image" class="regular-text"
|
125 |
value="<?php echo esc_attr($image); ?>">
|
126 |
</div>
|
inc/class-simple-author-box-widget.php
CHANGED
@@ -39,12 +39,12 @@ class Simple_Author_Box_Widget_LITE extends WP_Widget {
|
|
39 |
}
|
40 |
}
|
41 |
|
42 |
-
|
43 |
if ( '' != $instance['title'] ) {
|
44 |
-
|
45 |
}
|
46 |
include($template);
|
47 |
-
|
48 |
|
49 |
}
|
50 |
|
39 |
}
|
40 |
}
|
41 |
|
42 |
+
wpsabox_wp_kses_wf($args['before_widget']);
|
43 |
if ( '' != $instance['title'] ) {
|
44 |
+
wpsabox_wp_kses_wf($args['before_title'] . esc_html($instance['title']) . $args['after_title']);
|
45 |
}
|
46 |
include($template);
|
47 |
+
wpsabox_wp_kses_wf($args['after_widget']);
|
48 |
|
49 |
}
|
50 |
|
inc/class-simple-author-box.php
CHANGED
@@ -343,7 +343,7 @@ class Simple_Author_Box
|
|
343 |
public function settings_link($links)
|
344 |
{
|
345 |
if (is_array($links)) {
|
346 |
-
$sab = sprintf('<a href="%s">%s</a>', admin_url('themes.php?page=simple-author-box'), __('Configure Author Box', '
|
347 |
array_unshift($links, $sab);
|
348 |
}
|
349 |
|
@@ -371,11 +371,9 @@ class Simple_Author_Box
|
|
371 |
|
372 |
// Styles
|
373 |
wp_enqueue_style('saboxplugin-admin-style', SIMPLE_AUTHOR_BOX_ASSETS . 'css/sabox-admin-style' . $suffix . '.css', array(), SIMPLE_AUTHOR_BOX_VERSION);
|
374 |
-
wp_enqueue_style('saboxplugin-admin-font', 'https://fonts.
|
375 |
|
376 |
wp_enqueue_style('wp-color-picker');
|
377 |
-
//wp_enqueue_style('jquery-ui', SIMPLE_AUTHOR_BOX_ASSETS . 'css/jquery-ui.min.css');
|
378 |
-
//wp_enqueue_media();
|
379 |
wp_enqueue_style('saboxplugin-sweetalert', SIMPLE_AUTHOR_BOX_ASSETS . 'css/sweetalert2.min.css', array(), SIMPLE_AUTHOR_BOX_VERSION);
|
380 |
|
381 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
@@ -508,32 +506,32 @@ class Simple_Author_Box
|
|
508 |
$sab_desc_font = Simple_Author_Box_Helper::get_option('sab_box_desc_font');
|
509 |
$sab_web_font = Simple_Author_Box_Helper::get_option('sab_box_web_font');
|
510 |
|
511 |
-
$
|
512 |
|
513 |
if ($sab_author_font && 'none' != strtolower($sab_author_font)) {
|
514 |
-
$
|
515 |
}
|
516 |
|
517 |
if ($sab_desc_font && 'none' != strtolower($sab_desc_font)) {
|
518 |
-
$
|
519 |
}
|
520 |
|
521 |
if ('1' == $this->options['sab_web'] && $sab_web_font && 'none' != strtolower($sab_web_font)) {
|
522 |
-
$
|
523 |
}
|
524 |
|
525 |
-
$
|
526 |
|
527 |
-
$
|
528 |
|
529 |
-
if (!empty($
|
530 |
-
$
|
531 |
|
532 |
-
foreach ($
|
533 |
-
$
|
534 |
}
|
535 |
|
536 |
-
wp_register_style('sab-font', $sab_protocol . '://fonts.
|
537 |
}
|
538 |
/**
|
539 |
* end changes introduced in 2.0.4
|
@@ -543,7 +541,7 @@ class Simple_Author_Box
|
|
543 |
return;
|
544 |
}
|
545 |
|
546 |
-
if (!empty($
|
547 |
wp_enqueue_style('sab-font');
|
548 |
}
|
549 |
}
|
@@ -560,7 +558,7 @@ class Simple_Author_Box
|
|
560 |
$style .= Simple_Author_Box_Helper::generate_inline_css();
|
561 |
$style .= '</style>';
|
562 |
|
563 |
-
|
564 |
}
|
565 |
|
566 |
public function shortcode($atts)
|
343 |
public function settings_link($links)
|
344 |
{
|
345 |
if (is_array($links)) {
|
346 |
+
$sab = sprintf('<a href="%s">%s</a>', admin_url('themes.php?page=simple-author-box'), __('Configure Author Box', 'simple-author-box'));
|
347 |
array_unshift($links, $sab);
|
348 |
}
|
349 |
|
371 |
|
372 |
// Styles
|
373 |
wp_enqueue_style('saboxplugin-admin-style', SIMPLE_AUTHOR_BOX_ASSETS . 'css/sabox-admin-style' . $suffix . '.css', array(), SIMPLE_AUTHOR_BOX_VERSION);
|
374 |
+
wp_enqueue_style('saboxplugin-admin-font', 'https://fonts.bunny.net/css2?family=Ubuntu:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&display=swap');
|
375 |
|
376 |
wp_enqueue_style('wp-color-picker');
|
|
|
|
|
377 |
wp_enqueue_style('saboxplugin-sweetalert', SIMPLE_AUTHOR_BOX_ASSETS . 'css/sweetalert2.min.css', array(), SIMPLE_AUTHOR_BOX_VERSION);
|
378 |
|
379 |
wp_enqueue_style('wp-jquery-ui-dialog');
|
506 |
$sab_desc_font = Simple_Author_Box_Helper::get_option('sab_box_desc_font');
|
507 |
$sab_web_font = Simple_Author_Box_Helper::get_option('sab_box_web_font');
|
508 |
|
509 |
+
$bunny_fonts = array();
|
510 |
|
511 |
if ($sab_author_font && 'none' != strtolower($sab_author_font)) {
|
512 |
+
$bunny_fonts[] = str_replace(' ', '+', esc_attr($sab_author_font));
|
513 |
}
|
514 |
|
515 |
if ($sab_desc_font && 'none' != strtolower($sab_desc_font)) {
|
516 |
+
$bunny_fonts[] = str_replace(' ', '+', esc_attr($sab_desc_font));
|
517 |
}
|
518 |
|
519 |
if ('1' == $this->options['sab_web'] && $sab_web_font && 'none' != strtolower($sab_web_font)) {
|
520 |
+
$bunny_fonts[] = str_replace(' ', '+', esc_attr($sab_web_font));
|
521 |
}
|
522 |
|
523 |
+
$bunny_fonts = apply_filters('sabox_bunny_fonts', $bunny_fonts);
|
524 |
|
525 |
+
$bunny_fonts = array_unique($bunny_fonts);
|
526 |
|
527 |
+
if (!empty($bunny_fonts)) { // let's check the array's not empty before actually loading; we want to avoid loading 'none' font-familes
|
528 |
+
$final_bunny_fonts = array();
|
529 |
|
530 |
+
foreach ($bunny_fonts as $v) {
|
531 |
+
$final_bunny_fonts[] = $v . ':400,700,400italic,700italic';
|
532 |
}
|
533 |
|
534 |
+
wp_register_style('sab-font', $sab_protocol . '://fonts.bunny.net/css?family=' . implode('|', $final_bunny_fonts) . $sab_subset, array(), null);
|
535 |
}
|
536 |
/**
|
537 |
* end changes introduced in 2.0.4
|
541 |
return;
|
542 |
}
|
543 |
|
544 |
+
if (!empty($bunny_fonts)) {
|
545 |
wp_enqueue_style('sab-font');
|
546 |
}
|
547 |
}
|
558 |
$style .= Simple_Author_Box_Helper::generate_inline_css();
|
559 |
$style .= '</style>';
|
560 |
|
561 |
+
wpsabox_wp_kses_wf($style);
|
562 |
}
|
563 |
|
564 |
public function shortcode($atts)
|
inc/elementor/class-simple-author-box-elementor-check.php
CHANGED
@@ -83,7 +83,7 @@ final class SAB_Elementor_Check {
|
|
83 |
self::MINIMUM_ELEMENTOR_VERSION
|
84 |
);
|
85 |
|
86 |
-
|
87 |
}
|
88 |
|
89 |
/**
|
@@ -106,7 +106,7 @@ final class SAB_Elementor_Check {
|
|
106 |
self::MINIMUM_PHP_VERSION
|
107 |
);
|
108 |
|
109 |
-
|
110 |
}
|
111 |
}
|
112 |
|
83 |
self::MINIMUM_ELEMENTOR_VERSION
|
84 |
);
|
85 |
|
86 |
+
wpsabox_wp_kses_wf('<div class="notice notice-warning is-dismissible"><p>' . $message . '</p></div>');
|
87 |
}
|
88 |
|
89 |
/**
|
106 |
self::MINIMUM_PHP_VERSION
|
107 |
);
|
108 |
|
109 |
+
wpsabox_wp_kses_wf('<div class="notice notice-warning is-dismissible"><p>' . $message . '</p></div>');
|
110 |
}
|
111 |
}
|
112 |
|
inc/elementor/widgets/class-simple-author-box-elementor.php
CHANGED
@@ -54,15 +54,15 @@ class SAB_Elementor_Widget extends \Elementor\Widget_Base {
|
|
54 |
$settings = $this->get_settings_for_display();
|
55 |
$author = $settings['sab_author'];
|
56 |
if ('auto' != $author) {
|
57 |
-
|
58 |
} else {
|
59 |
-
|
60 |
}
|
61 |
|
62 |
}
|
63 |
|
64 |
protected function _content_template() {
|
65 |
-
|
66 |
}
|
67 |
|
68 |
public function sab_get_authors() {
|
54 |
$settings = $this->get_settings_for_display();
|
55 |
$author = $settings['sab_author'];
|
56 |
if ('auto' != $author) {
|
57 |
+
wpsabox_wp_kses_wf(do_shortcode('[simple-author-box ids="' . esc_attr($author) . '"]'));
|
58 |
} else {
|
59 |
+
wpsabox_wp_kses_wf(wpsabox_author_box());
|
60 |
}
|
61 |
|
62 |
}
|
63 |
|
64 |
protected function _content_template() {
|
65 |
+
wpsabox_wp_kses_wf(wpsabox_author_box());
|
66 |
}
|
67 |
|
68 |
public function sab_get_authors() {
|
inc/functions.php
CHANGED
@@ -1,97 +1,450 @@
|
|
1 |
<?php
|
2 |
|
3 |
// If this file is called directly, busted!
|
4 |
-
if (
|
5 |
-
|
6 |
}
|
7 |
|
8 |
/*----------------------------------------------------------------------------------------------------------
|
9 |
Adding the author box to the end of your single post
|
10 |
-----------------------------------------------------------------------------------------------------------*/
|
11 |
-
if (
|
12 |
|
13 |
|
14 |
-
|
|
|
15 |
global $post;
|
16 |
-
$sabox_options = Simple_Author_Box_Helper::get_option(
|
17 |
|
18 |
-
|
19 |
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
|
26 |
-
if(is_archive()){
|
27 |
-
|
28 |
}
|
29 |
|
30 |
-
|
31 |
|
32 |
global $post;
|
33 |
-
|
34 |
-
$template = Simple_Author_Box_Helper::get_template();
|
35 |
|
36 |
-
|
37 |
-
$sabox_options = Simple_Author_Box_Helper::get_option( 'saboxplugin_options' );
|
38 |
-
$sabox_author_id = $user_id ? $user_id : $post->post_author;
|
39 |
-
$show_post_author_box = apply_filters( 'sabox_check_if_show_post_author_box', true, $sabox_options );
|
40 |
|
41 |
-
|
|
|
|
|
|
|
42 |
|
43 |
-
|
44 |
-
include( $template );
|
45 |
-
}
|
46 |
|
47 |
-
|
|
|
|
|
48 |
|
49 |
-
|
50 |
-
$return = $saboxmeta . $sabox;
|
51 |
|
52 |
-
|
53 |
-
|
54 |
|
55 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
-
|
58 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
}
|
60 |
|
61 |
//return notice if user hasn't filled Biographical Info
|
62 |
-
function sab_user_description_notice()
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
|
|
70 |
<div class="notice notice-info is-dismissible">
|
71 |
-
<p><?php
|
72 |
</div>
|
73 |
-
|
74 |
-
|
75 |
}
|
76 |
|
77 |
-
add_action(
|
78 |
|
79 |
|
80 |
//return notice if user hasn't filled any social profiles
|
81 |
-
function sab_user_social_notice()
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
|
|
86 |
|
87 |
-
|
88 |
|
89 |
-
|
90 |
<div class="notice notice-info is-dismissible">
|
91 |
-
<p><?php
|
92 |
</div>
|
93 |
-
|
94 |
-
|
95 |
}
|
96 |
|
97 |
-
add_action(
|
1 |
<?php
|
2 |
|
3 |
// If this file is called directly, busted!
|
4 |
+
if (!defined('ABSPATH')) {
|
5 |
+
exit;
|
6 |
}
|
7 |
|
8 |
/*----------------------------------------------------------------------------------------------------------
|
9 |
Adding the author box to the end of your single post
|
10 |
-----------------------------------------------------------------------------------------------------------*/
|
11 |
+
if (!function_exists('wpsabox_author_box')) {
|
12 |
|
13 |
|
14 |
+
function wpsabox_author_box($saboxmeta = null, $user_id = null)
|
15 |
+
{
|
16 |
global $post;
|
17 |
+
$sabox_options = Simple_Author_Box_Helper::get_option('saboxplugin_options');
|
18 |
|
19 |
+
$show = (is_single() && isset($post->post_type) && $post->post_type == 'post') || is_author() || (is_archive() && 1 != $sabox_options['sab_hide_on_archive']);
|
20 |
|
21 |
+
/**
|
22 |
+
* Hook: sabox_check_if_show.
|
23 |
+
*
|
24 |
+
* @hooked Simple_Author_Box::check_if_show_archive - 10
|
25 |
+
*/
|
26 |
|
27 |
+
if (is_archive()) {
|
28 |
+
$show = apply_filters('sabox_check_if_show', $show);
|
29 |
}
|
30 |
|
31 |
+
if ($show) {
|
32 |
|
33 |
global $post;
|
|
|
|
|
34 |
|
35 |
+
$template = Simple_Author_Box_Helper::get_template();
|
|
|
|
|
|
|
36 |
|
37 |
+
ob_start();
|
38 |
+
$sabox_options = Simple_Author_Box_Helper::get_option('saboxplugin_options');
|
39 |
+
$sabox_author_id = $user_id ? $user_id : $post->post_author;
|
40 |
+
$show_post_author_box = apply_filters('sabox_check_if_show_post_author_box', true, $sabox_options);
|
41 |
|
42 |
+
do_action('sabox_before_author_box', $sabox_options);
|
|
|
|
|
43 |
|
44 |
+
if ($show_post_author_box) {
|
45 |
+
include($template);
|
46 |
+
}
|
47 |
|
48 |
+
do_action('sabox_after_author_box', $sabox_options);
|
|
|
49 |
|
50 |
+
$sabox = ob_get_clean();
|
51 |
+
$return = $saboxmeta . $sabox;
|
52 |
|
53 |
+
// Filter returning HTML of the Author Box
|
54 |
+
$saboxmeta = apply_filters('sabox_return_html', $return, $sabox, $saboxmeta);
|
55 |
+
}
|
56 |
+
|
57 |
+
return $saboxmeta;
|
58 |
+
}
|
59 |
+
}
|
60 |
+
|
61 |
+
function wpsabox_wp_kses_wf($html)
|
62 |
+
{
|
63 |
+
add_filter('safe_style_css', function ($styles) {
|
64 |
+
$styles_wf = array(
|
65 |
+
'text-align',
|
66 |
+
'margin',
|
67 |
+
'color',
|
68 |
+
'float',
|
69 |
+
'border',
|
70 |
+
'background',
|
71 |
+
'background-color',
|
72 |
+
'border-bottom',
|
73 |
+
'border-bottom-color',
|
74 |
+
'border-bottom-style',
|
75 |
+
'border-bottom-width',
|
76 |
+
'border-collapse',
|
77 |
+
'border-color',
|
78 |
+
'border-left',
|
79 |
+
'border-left-color',
|
80 |
+
'border-left-style',
|
81 |
+
'border-left-width',
|
82 |
+
'border-right',
|
83 |
+
'border-right-color',
|
84 |
+
'border-right-style',
|
85 |
+
'border-right-width',
|
86 |
+
'border-spacing',
|
87 |
+
'border-style',
|
88 |
+
'border-top',
|
89 |
+
'border-top-color',
|
90 |
+
'border-top-style',
|
91 |
+
'border-top-width',
|
92 |
+
'border-width',
|
93 |
+
'caption-side',
|
94 |
+
'clear',
|
95 |
+
'cursor',
|
96 |
+
'direction',
|
97 |
+
'font',
|
98 |
+
'font-family',
|
99 |
+
'font-size',
|
100 |
+
'font-style',
|
101 |
+
'font-variant',
|
102 |
+
'font-weight',
|
103 |
+
'height',
|
104 |
+
'letter-spacing',
|
105 |
+
'line-height',
|
106 |
+
'margin-bottom',
|
107 |
+
'margin-left',
|
108 |
+
'margin-right',
|
109 |
+
'margin-top',
|
110 |
+
'overflow',
|
111 |
+
'padding',
|
112 |
+
'padding-bottom',
|
113 |
+
'padding-left',
|
114 |
+
'padding-right',
|
115 |
+
'padding-top',
|
116 |
+
'text-decoration',
|
117 |
+
'text-indent',
|
118 |
+
'vertical-align',
|
119 |
+
'width',
|
120 |
+
'display',
|
121 |
+
);
|
122 |
+
|
123 |
+
foreach ($styles_wf as $style_wf) {
|
124 |
+
$styles[] = $style_wf;
|
125 |
+
}
|
126 |
+
return $styles;
|
127 |
+
});
|
128 |
+
|
129 |
+
$allowed_tags = wp_kses_allowed_html('post');
|
130 |
+
$allowed_tags['input'] = array(
|
131 |
+
'type' => true,
|
132 |
+
'style' => true,
|
133 |
+
'class' => true,
|
134 |
+
'id' => true,
|
135 |
+
'checked' => true,
|
136 |
+
'disabled' => true,
|
137 |
+
'name' => true,
|
138 |
+
'size' => true,
|
139 |
+
'placeholder' => true,
|
140 |
+
'value' => true,
|
141 |
+
'data-*' => true,
|
142 |
+
'size' => true,
|
143 |
+
'disabled' => true
|
144 |
+
);
|
145 |
+
|
146 |
+
$allowed_tags['textarea'] = array(
|
147 |
+
'type' => true,
|
148 |
+
'style' => true,
|
149 |
+
'class' => true,
|
150 |
+
'id' => true,
|
151 |
+
'checked' => true,
|
152 |
+
'disabled' => true,
|
153 |
+
'name' => true,
|
154 |
+
'size' => true,
|
155 |
+
'placeholder' => true,
|
156 |
+
'value' => true,
|
157 |
+
'data-*' => true,
|
158 |
+
'cols' => true,
|
159 |
+
'rows' => true,
|
160 |
+
'disabled' => true,
|
161 |
+
'autocomplete' => true
|
162 |
+
);
|
163 |
+
|
164 |
+
$allowed_tags['select'] = array(
|
165 |
+
'type' => true,
|
166 |
+
'style' => true,
|
167 |
+
'class' => true,
|
168 |
+
'id' => true,
|
169 |
+
'checked' => true,
|
170 |
+
'disabled' => true,
|
171 |
+
'name' => true,
|
172 |
+
'size' => true,
|
173 |
+
'placeholder' => true,
|
174 |
+
'value' => true,
|
175 |
+
'data-*' => true,
|
176 |
+
'multiple' => true,
|
177 |
+
'disabled' => true
|
178 |
+
);
|
179 |
+
|
180 |
+
$allowed_tags['option'] = array(
|
181 |
+
'type' => true,
|
182 |
+
'style' => true,
|
183 |
+
'class' => true,
|
184 |
+
'id' => true,
|
185 |
+
'checked' => true,
|
186 |
+
'disabled' => true,
|
187 |
+
'name' => true,
|
188 |
+
'size' => true,
|
189 |
+
'placeholder' => true,
|
190 |
+
'value' => true,
|
191 |
+
'selected' => true,
|
192 |
+
'data-*' => true
|
193 |
+
);
|
194 |
+
$allowed_tags['optgroup'] = array(
|
195 |
+
'type' => true,
|
196 |
+
'style' => true,
|
197 |
+
'class' => true,
|
198 |
+
'id' => true,
|
199 |
+
'checked' => true,
|
200 |
+
'disabled' => true,
|
201 |
+
'name' => true,
|
202 |
+
'size' => true,
|
203 |
+
'placeholder' => true,
|
204 |
+
'value' => true,
|
205 |
+
'selected' => true,
|
206 |
+
'data-*' => true,
|
207 |
+
'label' => true
|
208 |
+
);
|
209 |
+
|
210 |
+
$allowed_tags['a'] = array(
|
211 |
+
'href' => true,
|
212 |
+
'data-*' => true,
|
213 |
+
'class' => true,
|
214 |
+
'style' => true,
|
215 |
+
'id' => true,
|
216 |
+
'target' => true,
|
217 |
+
'data-*' => true,
|
218 |
+
'role' => true,
|
219 |
+
'aria-controls' => true,
|
220 |
+
'aria-selected' => true,
|
221 |
+
'disabled' => true
|
222 |
+
);
|
223 |
+
|
224 |
+
$allowed_tags['div'] = array(
|
225 |
+
'style' => true,
|
226 |
+
'class' => true,
|
227 |
+
'id' => true,
|
228 |
+
'data-*' => true,
|
229 |
+
'role' => true,
|
230 |
+
'aria-labelledby' => true,
|
231 |
+
'value' => true,
|
232 |
+
'aria-modal' => true,
|
233 |
+
'tabindex' => true
|
234 |
+
);
|
235 |
+
|
236 |
+
$allowed_tags['li'] = array(
|
237 |
+
'style' => true,
|
238 |
+
'class' => true,
|
239 |
+
'id' => true,
|
240 |
+
'data-*' => true,
|
241 |
+
'role' => true,
|
242 |
+
'aria-labelledby' => true,
|
243 |
+
'value' => true,
|
244 |
+
'aria-modal' => true,
|
245 |
+
'tabindex' => true
|
246 |
+
);
|
247 |
+
|
248 |
+
$allowed_tags['span'] = array(
|
249 |
+
'style' => true,
|
250 |
+
'class' => true,
|
251 |
+
'id' => true,
|
252 |
+
'data-*' => true,
|
253 |
+
'aria-hidden' => true
|
254 |
+
);
|
255 |
+
|
256 |
+
$allowed_tags['style'] = array(
|
257 |
+
'class' => true,
|
258 |
+
'id' => true,
|
259 |
+
'type' => true
|
260 |
+
);
|
261 |
|
262 |
+
$allowed_tags['fieldset'] = array(
|
263 |
+
'class' => true,
|
264 |
+
'id' => true,
|
265 |
+
'type' => true
|
266 |
+
);
|
267 |
+
|
268 |
+
$allowed_tags['link'] = array(
|
269 |
+
'class' => true,
|
270 |
+
'id' => true,
|
271 |
+
'type' => true,
|
272 |
+
'rel' => true,
|
273 |
+
'href' => true,
|
274 |
+
'media' => true
|
275 |
+
);
|
276 |
+
|
277 |
+
$allowed_tags['form'] = array(
|
278 |
+
'style' => true,
|
279 |
+
'class' => true,
|
280 |
+
'id' => true,
|
281 |
+
'method' => true,
|
282 |
+
'action' => true,
|
283 |
+
'data-*' => true
|
284 |
+
);
|
285 |
+
|
286 |
+
$allowed_tags['script'] = array(
|
287 |
+
'class' => true,
|
288 |
+
'id' => true,
|
289 |
+
'type' => true,
|
290 |
+
'src' => true
|
291 |
+
);
|
292 |
+
|
293 |
+
$allowed_tags['path'] = array(
|
294 |
+
'class' => true,
|
295 |
+
'id' => true,
|
296 |
+
'fill' => true,
|
297 |
+
'd' => true
|
298 |
+
);
|
299 |
+
|
300 |
+
$allowed_tags['svg'] = array(
|
301 |
+
'class' => true,
|
302 |
+
'id' => true,
|
303 |
+
'aria-hidden' => true,
|
304 |
+
'role' => true,
|
305 |
+
'xmlns' => true,
|
306 |
+
'viewBox' => true,
|
307 |
+
'viewbox' => true,
|
308 |
+
'width' => true,
|
309 |
+
'height' => true,
|
310 |
+
'focusable' => true,
|
311 |
+
'style' => true,
|
312 |
+
'xml:space' => true
|
313 |
+
);
|
314 |
+
|
315 |
+
$allowed_tags['defs'] = array(
|
316 |
+
'class' => true,
|
317 |
+
'id' => true,
|
318 |
+
);
|
319 |
+
|
320 |
+
$allowed_tags['filter'] = array(
|
321 |
+
'class' => true,
|
322 |
+
'id' => true,
|
323 |
+
);
|
324 |
+
|
325 |
+
$allowed_tags['rect'] = array(
|
326 |
+
'class' => true,
|
327 |
+
'x' => true,
|
328 |
+
'y' => true,
|
329 |
+
'width' => true,
|
330 |
+
'height' => true,
|
331 |
+
'fill' => true
|
332 |
+
);
|
333 |
+
|
334 |
+
$allowed_tags['polygon'] = array(
|
335 |
+
'class' => true,
|
336 |
+
'points' => true,
|
337 |
+
'width' => true,
|
338 |
+
'height' => true,
|
339 |
+
'fill' => true
|
340 |
+
);
|
341 |
+
|
342 |
+
echo wp_kses($html, $allowed_tags);
|
343 |
+
|
344 |
+
add_filter('safe_style_css', function ($styles) {
|
345 |
+
$styles_wf = array(
|
346 |
+
'text-align',
|
347 |
+
'margin',
|
348 |
+
'color',
|
349 |
+
'float',
|
350 |
+
'border',
|
351 |
+
'background',
|
352 |
+
'background-color',
|
353 |
+
'border-bottom',
|
354 |
+
'border-bottom-color',
|
355 |
+
'border-bottom-style',
|
356 |
+
'border-bottom-width',
|
357 |
+
'border-collapse',
|
358 |
+
'border-color',
|
359 |
+
'border-left',
|
360 |
+
'border-left-color',
|
361 |
+
'border-left-style',
|
362 |
+
'border-left-width',
|
363 |
+
'border-right',
|
364 |
+
'border-right-color',
|
365 |
+
'border-right-style',
|
366 |
+
'border-right-width',
|
367 |
+
'border-spacing',
|
368 |
+
'border-style',
|
369 |
+
'border-top',
|
370 |
+
'border-top-color',
|
371 |
+
'border-top-style',
|
372 |
+
'border-top-width',
|
373 |
+
'border-width',
|
374 |
+
'caption-side',
|
375 |
+
'clear',
|
376 |
+
'cursor',
|
377 |
+
'direction',
|
378 |
+
'font',
|
379 |
+
'font-family',
|
380 |
+
'font-size',
|
381 |
+
'font-style',
|
382 |
+
'font-variant',
|
383 |
+
'font-weight',
|
384 |
+
'height',
|
385 |
+
'letter-spacing',
|
386 |
+
'line-height',
|
387 |
+
'margin-bottom',
|
388 |
+
'margin-left',
|
389 |
+
'margin-right',
|
390 |
+
'margin-top',
|
391 |
+
'overflow',
|
392 |
+
'padding',
|
393 |
+
'padding-bottom',
|
394 |
+
'padding-left',
|
395 |
+
'padding-right',
|
396 |
+
'padding-top',
|
397 |
+
'text-decoration',
|
398 |
+
'text-indent',
|
399 |
+
'vertical-align',
|
400 |
+
'width'
|
401 |
+
);
|
402 |
+
|
403 |
+
foreach ($styles_wf as $style_wf) {
|
404 |
+
if (($key = array_search($style_wf, $styles)) !== false) {
|
405 |
+
unset($styles[$key]);
|
406 |
+
}
|
407 |
+
}
|
408 |
+
return $styles;
|
409 |
+
});
|
410 |
}
|
411 |
|
412 |
//return notice if user hasn't filled Biographical Info
|
413 |
+
function sab_user_description_notice()
|
414 |
+
{
|
415 |
+
$user_id = get_current_user_id();
|
416 |
+
$user = get_userdata($user_id);
|
417 |
+
$user_descrition = $user->description;
|
418 |
+
$user_roles = $user->roles;
|
419 |
+
if (!$user_descrition && in_array('author', $user_roles)) {
|
420 |
+
|
421 |
+
?>
|
422 |
<div class="notice notice-info is-dismissible">
|
423 |
+
<p><?php esc_html_e('Please complete Biographical Info', 'simple-author-box'); ?></p>
|
424 |
</div>
|
425 |
+
<?php
|
426 |
+
}
|
427 |
}
|
428 |
|
429 |
+
add_action('admin_notices', 'sab_user_description_notice');
|
430 |
|
431 |
|
432 |
//return notice if user hasn't filled any social profiles
|
433 |
+
function sab_user_social_notice()
|
434 |
+
{
|
435 |
+
$user_id = get_current_user_id();
|
436 |
+
$user_social = get_user_meta($user_id, 'sabox_social_links');
|
437 |
+
$user = get_userdata($user_id);
|
438 |
+
$user_roles = $user->roles;
|
439 |
|
440 |
+
if (!$user_social && in_array('author', $user_roles)) {
|
441 |
|
442 |
+
?>
|
443 |
<div class="notice notice-info is-dismissible">
|
444 |
+
<p><?php esc_html_e('Please enter a social profile', 'simple-author-box'); ?></p>
|
445 |
</div>
|
446 |
+
<?php
|
447 |
+
}
|
448 |
}
|
449 |
|
450 |
+
add_action('admin_notices', 'sab_user_social_notice');
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: author box, responsive author box, author profile fields, author social ic
|
|
4 |
Requires at least: 4.6
|
5 |
Requires PHP: 5.6
|
6 |
Tested up to: 6.1
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
@@ -24,6 +24,7 @@ Add a responsive author box with social icons to any post. Great author box for
|
|
24 |
* Simple Author Box has RTL support
|
25 |
* Simple Author Box has AMP support
|
26 |
* Great for guest posts, and guest authors
|
|
|
27 |
|
28 |
= Simple Author Box Pro Features =
|
29 |
|
@@ -46,8 +47,17 @@ Add a responsive author box with social icons to any post. Great author box for
|
|
46 |
|
47 |
<a href="https://wpauthorbox.com/">Read more</a> about the Simple Author Box advanced features.
|
48 |
|
|
|
|
|
|
|
|
|
49 |
|
50 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
51 |
= 2.48 =
|
52 |
* 2022-04-14
|
53 |
* Fixed author box showing on all post types in some cases
|
4 |
Requires at least: 4.6
|
5 |
Requires PHP: 5.6
|
6 |
Tested up to: 6.1
|
7 |
+
Stable tag: 2.49
|
8 |
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
10 |
|
24 |
* Simple Author Box has RTL support
|
25 |
* Simple Author Box has AMP support
|
26 |
* Great for guest posts, and guest authors
|
27 |
+
* GDPR compatible Bunny Fonts
|
28 |
|
29 |
= Simple Author Box Pro Features =
|
30 |
|
47 |
|
48 |
<a href="https://wpauthorbox.com/">Read more</a> about the Simple Author Box advanced features.
|
49 |
|
50 |
+
= GDPR Compatibility =
|
51 |
+
We are not lawyers. Please do not take any of the following as legal advice.
|
52 |
+
Simple Author Box does not track, collect or process any user data. If you opt to use Bunny Fonts they will be loaded from a 3rd party CDN. In that case user data will be processed according to their terms of service. Based on that, we feel it's GDPR compatible, but again, please, don't take this as legal advice.
|
53 |
+
|
54 |
|
55 |
== Changelog ==
|
56 |
+
= 2.49 =
|
57 |
+
* 2022-11-21
|
58 |
+
* Replaced Google Fonts with GDPR Compatible Bunny Fonts
|
59 |
+
* Minor security fixes
|
60 |
+
|
61 |
= 2.48 =
|
62 |
* 2022-04-14
|
63 |
* Fixed author box showing on all post types in some cases
|
simple-author-box.php
CHANGED
@@ -3,19 +3,19 @@
|
|
3 |
* Plugin Name: Simple Author Box
|
4 |
* Plugin URI: https://wpauthorbox.com/
|
5 |
* Description: Adds a responsive author box with social icons on any post.
|
6 |
-
* Version: 2.
|
7 |
* Author: WebFactory Ltd
|
8 |
* Author URI: https://www.webfactoryltd.com/
|
9 |
* Requires: 4.6
|
10 |
* License: GPLv3 or later
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
* Requires PHP: 5.6
|
13 |
-
* Tested up to: 6.
|
14 |
|
15 |
*
|
16 |
* Copyright 2014-2017 Tiguan office@tiguandesign.com
|
17 |
* Copyright 2017-2019 MachoThemes office@machothemes.com
|
18 |
-
* Copyright 2019 GreenTreeLabs diego@greentreelabs.net
|
19 |
* Copyright 2019-2022 WebFactory Ltd support@webfactoryltd.com
|
20 |
*
|
21 |
* This program is free software; you can redistribute it and/or modify
|
@@ -49,5 +49,8 @@ $plugin_data = get_file_data(__FILE__, array('version' => 'Version'), 'plugin');
|
|
49 |
define('SIMPLE_AUTHOR_BOX_VERSION', $plugin_data['version']);
|
50 |
require_once SIMPLE_AUTHOR_BOX_PATH . 'inc/class-simple-author-box.php';
|
51 |
|
|
|
|
|
|
|
52 |
global $simple_author_box;
|
53 |
$simple_author_box = Simple_Author_Box::get_instance();
|
3 |
* Plugin Name: Simple Author Box
|
4 |
* Plugin URI: https://wpauthorbox.com/
|
5 |
* Description: Adds a responsive author box with social icons on any post.
|
6 |
+
* Version: 2.49
|
7 |
* Author: WebFactory Ltd
|
8 |
* Author URI: https://www.webfactoryltd.com/
|
9 |
* Requires: 4.6
|
10 |
* License: GPLv3 or later
|
11 |
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
12 |
* Requires PHP: 5.6
|
13 |
+
* Tested up to: 6.1
|
14 |
|
15 |
*
|
16 |
* Copyright 2014-2017 Tiguan office@tiguandesign.com
|
17 |
* Copyright 2017-2019 MachoThemes office@machothemes.com
|
18 |
+
* Copyright 2019-2019 GreenTreeLabs diego@greentreelabs.net
|
19 |
* Copyright 2019-2022 WebFactory Ltd support@webfactoryltd.com
|
20 |
*
|
21 |
* This program is free software; you can redistribute it and/or modify
|
49 |
define('SIMPLE_AUTHOR_BOX_VERSION', $plugin_data['version']);
|
50 |
require_once SIMPLE_AUTHOR_BOX_PATH . 'inc/class-simple-author-box.php';
|
51 |
|
52 |
+
require_once dirname(__FILE__) . '/wf-flyout/wf-flyout.php';
|
53 |
+
new wf_flyout(__FILE__);
|
54 |
+
|
55 |
global $simple_author_box;
|
56 |
$simple_author_box = Simple_Author_Box::get_instance();
|
template/template-sab.php
CHANGED
@@ -18,10 +18,9 @@ if (isset($sabox_options['sab_web_target']) && '1' == $sabox_options['sab_web_ta
|
|
18 |
$sab_web_target = '_self';
|
19 |
}
|
20 |
|
|
|
21 |
if (isset($sabox_options['sab_web_rel']) && '1' == $sabox_options['sab_web_rel']) {
|
22 |
-
$sab_web_rel =
|
23 |
-
} else {
|
24 |
-
$sab_web_rel = '';
|
25 |
}
|
26 |
|
27 |
$sab_author_link = sprintf('<a href="%s" class="vcard author" rel="author" itemprop="url"><span class="fn" itemprop="name">%s</span></a>', esc_url(get_author_posts_url($sabox_author_id)), esc_html(get_the_author_meta('display_name', $sabox_author_id)));
|
@@ -46,7 +45,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
46 |
$alt = $mediaid ? get_post_meta($mediaid, '_wp_attachment_image_alt', true) : get_the_author_meta('display_name', $sabox_author_id);
|
47 |
|
48 |
$link = null;
|
49 |
-
$nofollow =
|
50 |
if (isset($sabox_options['sab_author_link'])) {
|
51 |
if ('author-page' == $sabox_options['sab_author_link']) {
|
52 |
|
@@ -55,7 +54,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
55 |
$link = get_author_posts_url($sabox_author_id);
|
56 |
} elseif ('author-website' == $sabox_options['sab_author_link']) {
|
57 |
if (isset($sabox_options['sab_author_link_noffolow']) && '1' == $sabox_options['sab_author_link_noffolow']) {
|
58 |
-
$nofollow =
|
59 |
}
|
60 |
|
61 |
$link = get_the_author_meta('user_url', $sabox_author_id);
|
@@ -63,9 +62,9 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
63 |
}
|
64 |
|
65 |
if ($link != null)
|
66 |
-
echo "<a $nofollow href='" . $link . "'>";
|
67 |
|
68 |
-
echo '<img src="' . esc_url($custom_profile_image) . '" width="' . $sabox_options['sab_avatar_size'] . '" height="' . $sabox_options['sab_avatar_size'] . '" alt="' . esc_attr($alt) . '" itemprop="image">';
|
69 |
|
70 |
if ($link != null)
|
71 |
echo "</a>";
|
@@ -77,9 +76,9 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
77 |
|
78 |
// author box name
|
79 |
echo '<div class="saboxplugin-authorname">';
|
80 |
-
|
81 |
if (is_user_logged_in() && get_current_user_id() == $sabox_author_id) {
|
82 |
-
echo '<a class="sab-profile-edit" target="_blank" href="' . get_edit_user_link() . '"> ' . esc_html__('Edit profile', 'simple-author-box') . '</a>';
|
83 |
}
|
84 |
echo '</div>';
|
85 |
|
@@ -89,7 +88,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
89 |
|
90 |
$author_description = wptexturize($author_description);
|
91 |
$author_description = wpautop($author_description);
|
92 |
-
|
93 |
if ('' == $author_description && is_user_logged_in() && $sabox_author_id == get_current_user_id()) {
|
94 |
echo '<a target="_blank" href="' . admin_url() . 'profile.php?#wp-description-wrap">' . esc_html__('Add Biographical Info', 'simple-author-box') . '</a>';
|
95 |
}
|
@@ -99,7 +98,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
99 |
if (is_single() || is_page()) {
|
100 |
if (get_the_author_meta('user_url') != '' && '1' == $sabox_options['sab_web']) { // author website on single
|
101 |
echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
|
102 |
-
echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . $sab_web_rel . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
|
103 |
echo '</div>';
|
104 |
}
|
105 |
}
|
@@ -108,7 +107,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
108 |
if (is_author() || is_archive()) {
|
109 |
if (get_the_author_meta('user_url') != '') { // force show author website on author.php or archive.php
|
110 |
echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
|
111 |
-
echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . $sab_web_rel . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
|
112 |
echo '</div>';
|
113 |
}
|
114 |
}
|
@@ -160,7 +159,7 @@ if ('' != $author_description || isset($sabox_options['sab_no_description']) &&
|
|
160 |
}
|
161 |
|
162 |
if (!empty($social_link)) {
|
163 |
-
|
164 |
}
|
165 |
}
|
166 |
|
18 |
$sab_web_target = '_self';
|
19 |
}
|
20 |
|
21 |
+
$sab_web_rel = false;
|
22 |
if (isset($sabox_options['sab_web_rel']) && '1' == $sabox_options['sab_web_rel']) {
|
23 |
+
$sab_web_rel = true;
|
|
|
|
|
24 |
}
|
25 |
|
26 |
$sab_author_link = sprintf('<a href="%s" class="vcard author" rel="author" itemprop="url"><span class="fn" itemprop="name">%s</span></a>', esc_url(get_author_posts_url($sabox_author_id)), esc_html(get_the_author_meta('display_name', $sabox_author_id)));
|
45 |
$alt = $mediaid ? get_post_meta($mediaid, '_wp_attachment_image_alt', true) : get_the_author_meta('display_name', $sabox_author_id);
|
46 |
|
47 |
$link = null;
|
48 |
+
$nofollow = false;
|
49 |
if (isset($sabox_options['sab_author_link'])) {
|
50 |
if ('author-page' == $sabox_options['sab_author_link']) {
|
51 |
|
54 |
$link = get_author_posts_url($sabox_author_id);
|
55 |
} elseif ('author-website' == $sabox_options['sab_author_link']) {
|
56 |
if (isset($sabox_options['sab_author_link_noffolow']) && '1' == $sabox_options['sab_author_link_noffolow']) {
|
57 |
+
$nofollow = true;
|
58 |
}
|
59 |
|
60 |
$link = get_the_author_meta('user_url', $sabox_author_id);
|
62 |
}
|
63 |
|
64 |
if ($link != null)
|
65 |
+
echo "<a " . ($nofollow?' rel="nofollow"':'') . " href='" . esc_url($link) . "'>";
|
66 |
|
67 |
+
echo '<img src="' . esc_url($custom_profile_image) . '" width="' . esc_attr($sabox_options['sab_avatar_size']) . '" height="' . esc_attr($sabox_options['sab_avatar_size']) . '" alt="' . esc_attr($alt) . '" itemprop="image">';
|
68 |
|
69 |
if ($link != null)
|
70 |
echo "</a>";
|
76 |
|
77 |
// author box name
|
78 |
echo '<div class="saboxplugin-authorname">';
|
79 |
+
wpsabox_wp_kses_wf(apply_filters('sabox_author_html', $sab_author_link, $sabox_options, $sabox_author_id));
|
80 |
if (is_user_logged_in() && get_current_user_id() == $sabox_author_id) {
|
81 |
+
echo '<a class="sab-profile-edit" target="_blank" href="' . esc_url(get_edit_user_link()) . '"> ' . esc_html__('Edit profile', 'simple-author-box') . '</a>';
|
82 |
}
|
83 |
echo '</div>';
|
84 |
|
88 |
|
89 |
$author_description = wptexturize($author_description);
|
90 |
$author_description = wpautop($author_description);
|
91 |
+
wpsabox_wp_kses_wf($author_description);
|
92 |
if ('' == $author_description && is_user_logged_in() && $sabox_author_id == get_current_user_id()) {
|
93 |
echo '<a target="_blank" href="' . admin_url() . 'profile.php?#wp-description-wrap">' . esc_html__('Add Biographical Info', 'simple-author-box') . '</a>';
|
94 |
}
|
98 |
if (is_single() || is_page()) {
|
99 |
if (get_the_author_meta('user_url') != '' && '1' == $sabox_options['sab_web']) { // author website on single
|
100 |
echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
|
101 |
+
echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . ($sab_web_rel?'rel="nofollow"':'') . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
|
102 |
echo '</div>';
|
103 |
}
|
104 |
}
|
107 |
if (is_author() || is_archive()) {
|
108 |
if (get_the_author_meta('user_url') != '') { // force show author website on author.php or archive.php
|
109 |
echo '<div class="saboxplugin-web ' . esc_attr($sab_web_align) . '">';
|
110 |
+
echo '<a href="' . esc_url(get_the_author_meta('user_url', $sabox_author_id)) . '" target="' . esc_attr($sab_web_target) . '" ' . ($sab_web_rel?'rel="nofollow"':'') . '>' . esc_html(Simple_Author_Box_Helper::strip_prot(get_the_author_meta('user_url', $sabox_author_id))) . '</a>';
|
111 |
echo '</div>';
|
112 |
}
|
113 |
}
|
159 |
}
|
160 |
|
161 |
if (!empty($social_link)) {
|
162 |
+
wpsabox_wp_kses_wf(Simple_Author_Box_Helper::get_sabox_social_icon($social_link, $social_platform));
|
163 |
}
|
164 |
}
|
165 |
|
wf-flyout/config.php
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$config = array();
|
3 |
+
|
4 |
+
$config['plugin_screen'] = 'appearance_page_simple-author-box';
|
5 |
+
$config['icon_border'] = '1px solid #00000099';
|
6 |
+
$config['icon_right'] = '35px';
|
7 |
+
$config['icon_bottom'] = '45px';
|
8 |
+
$config['icon_image'] = 'sab.png';
|
9 |
+
$config['icon_padding'] = '4px';
|
10 |
+
$config['icon_size'] = '55px';
|
11 |
+
$config['menu_accent_color'] = '#dd3036';
|
12 |
+
$config['custom_css'] = '#wf-flyout .ucp-icon .wff-icon img { max-width: 70%; } #wf-flyout .ucp-icon .wff-icon { line-height: 57px; } #wf-flyout .wp301-icon .wff-icon img { max-width: 70%; } #wf-flyout .wp301-icon .wff-icon { line-height: 57px; } #wf-flyout .wff-custom-icon.wff-menu-item-6 span.wff-icon { line-height: 63px; }';
|
13 |
+
|
14 |
+
$config['menu_items'] = array(
|
15 |
+
array('href' => 'https://wpauthorbox.com/?ref=wff-sab', 'label' => 'Get Simple Author Box PRO for only $39', 'icon' => 'sab.png', 'class' => ''),
|
16 |
+
array('href' => 'https://wpforcessl.com/?ref=wff-sab', 'label' => 'Fix all SSL problems & monitor site in real-time', 'icon' => 'wp-ssl.png', 'class' => 'wpfssl-icon'),
|
17 |
+
array('href' => 'https://wp301redirects.com/?ref=wff-sab&coupon=50off', 'label' => 'Get WP 301 Redirects PRO with 50% off', 'icon' => '301-logo.png', 'class' => 'wp301-icon'),
|
18 |
+
array('href' => 'https://wpreset.com/?ref=wff-sab', 'target' => '_blank', 'label' => 'Get WP Reset PRO with 50% off', 'icon' => 'wp-reset.png'),
|
19 |
+
array('href' => 'https://underconstructionpage.com/?ref=wff-sab&coupon=welcome', 'target' => '_blank', 'label' => 'Create the perfect Under Construction Page', 'icon' => 'ucp.png', 'class' => 'ucp-icon'),
|
20 |
+
array('href' => 'https://wpsticky.com/?ref=wff-sab', 'target' => '_blank', 'label' => 'Make any element sticky with WP Sticky', 'icon' => 'dashicons-admin-post'),
|
21 |
+
array('href' => 'https://wordpress.org/support/plugin/simple-author-box/reviews/#new-post', 'target' => '_blank', 'label' => 'Rate the Plugin', 'icon' => 'dashicons-thumbs-up'),
|
22 |
+
array('href' => 'https://wordpress.org/support/plugin/simple-author-box/#new-post', 'target' => '_blank', 'label' => 'Get Support', 'icon' => 'dashicons-sos'),
|
23 |
+
);
|
wf-flyout/icons/301-logo.png
ADDED
Binary file
|
wf-flyout/icons/sab.png
ADDED
Binary file
|
wf-flyout/icons/ucp.png
ADDED
Binary file
|
wf-flyout/icons/wp-reset.png
ADDED
Binary file
|
wf-flyout/icons/wp-ssl.png
ADDED
Binary file
|
wf-flyout/wf-flyout.css
ADDED
@@ -0,0 +1,200 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Universal fly-out menu for WebFactory plugins
|
3 |
+
* (c) WebFactory Ltd, 2022
|
4 |
+
*/
|
5 |
+
|
6 |
+
#wf-flyout {
|
7 |
+
position: fixed;
|
8 |
+
z-index: 100049;
|
9 |
+
transition: all 0.3s ease-in-out;
|
10 |
+
right: 40px;
|
11 |
+
bottom: 40px;
|
12 |
+
opacity: 1;
|
13 |
+
}
|
14 |
+
|
15 |
+
#wff-overlay {
|
16 |
+
background: #000;
|
17 |
+
opacity: 0.4;
|
18 |
+
filter: alpha(opacity=40);
|
19 |
+
position: fixed;
|
20 |
+
top: 0;
|
21 |
+
right: 0;
|
22 |
+
bottom: 0;
|
23 |
+
left: 0;
|
24 |
+
display: none;
|
25 |
+
z-index: 100049;
|
26 |
+
}
|
27 |
+
|
28 |
+
#wf-flyout a:focus {
|
29 |
+
outline: none;
|
30 |
+
box-shadow: none;
|
31 |
+
}
|
32 |
+
|
33 |
+
#wf-flyout #wff-button {
|
34 |
+
display: block;
|
35 |
+
}
|
36 |
+
|
37 |
+
#wf-flyout #wff-image-wrapper {
|
38 |
+
border: 3px solid #000000;
|
39 |
+
border-radius: 50%;
|
40 |
+
padding: 0;
|
41 |
+
display: block;
|
42 |
+
overflow: hidden;
|
43 |
+
background: #ffffff;
|
44 |
+
box-shadow: 0 3px 20px rgba(0, 0, 0, 0.2);
|
45 |
+
}
|
46 |
+
|
47 |
+
#wf-flyout #wff-button img {
|
48 |
+
width: 55px;
|
49 |
+
height: 55px;
|
50 |
+
display: block;
|
51 |
+
overflow: hidden;
|
52 |
+
padding: 2px;
|
53 |
+
background: #ffffff;
|
54 |
+
box-sizing: border-box;
|
55 |
+
}
|
56 |
+
|
57 |
+
#wf-flyout #wff-button:hover #wff-image-wrapper {
|
58 |
+
box-shadow: 0 3px 30px rgba(0, 0, 0, 0.25);
|
59 |
+
}
|
60 |
+
|
61 |
+
#wf-flyout:not(.opened) #wff-button:hover .wff-label {
|
62 |
+
opacity: 1;
|
63 |
+
margin-right: 0;
|
64 |
+
}
|
65 |
+
|
66 |
+
#wf-flyout .wff-label {
|
67 |
+
position: absolute;
|
68 |
+
display: block;
|
69 |
+
top: 50%;
|
70 |
+
right: calc(100% + 25px);
|
71 |
+
transform: translateY(-50%) scale(1);
|
72 |
+
-moz-transform: translateY(-50%);
|
73 |
+
-webkit-transform: translateY(-50%);
|
74 |
+
color: #fff;
|
75 |
+
background: #444 0 0 no-repeat padding-box;
|
76 |
+
font-size: 14px;
|
77 |
+
white-space: nowrap;
|
78 |
+
padding: 5px 10px;
|
79 |
+
height: auto !important;
|
80 |
+
line-height: initial;
|
81 |
+
transition: all 0.2s ease-out;
|
82 |
+
border-radius: 3px;
|
83 |
+
-moz-border-radius: 3px;
|
84 |
+
-webkit-border-radius: 3px;
|
85 |
+
opacity: 0;
|
86 |
+
margin-right: -50px;
|
87 |
+
}
|
88 |
+
|
89 |
+
#wf-flyout .wff-icon {
|
90 |
+
width: 40px;
|
91 |
+
height: 40px;
|
92 |
+
vertical-align: middle;
|
93 |
+
line-height: 60px;
|
94 |
+
text-align: center;
|
95 |
+
}
|
96 |
+
|
97 |
+
#wf-flyout .wff-icon img {
|
98 |
+
max-width: 80%;
|
99 |
+
filter: brightness(100);
|
100 |
+
}
|
101 |
+
|
102 |
+
#wf-flyout .wff-label.visible {
|
103 |
+
opacity: 1;
|
104 |
+
}
|
105 |
+
|
106 |
+
#wf-flyout .wff-menu-item {
|
107 |
+
position: absolute;
|
108 |
+
left: 10px;
|
109 |
+
width: 40px;
|
110 |
+
height: 40px;
|
111 |
+
opacity: 0;
|
112 |
+
visibility: hidden;
|
113 |
+
transform: scale(0);
|
114 |
+
border-radius: 50%;
|
115 |
+
box-shadow: 0 3px 20px rgba(0, 0, 0, 0.2);
|
116 |
+
background: #0071a1;
|
117 |
+
text-align: center;
|
118 |
+
vertical-align: middle;
|
119 |
+
text-decoration: none;
|
120 |
+
transition-timing-function: ease-in-out;
|
121 |
+
}
|
122 |
+
|
123 |
+
#wf-flyout .wff-menu-item.accent {
|
124 |
+
background: #ca4a1f;
|
125 |
+
}
|
126 |
+
|
127 |
+
#wf-flyout.opened .wff-menu-item {
|
128 |
+
opacity: 1;
|
129 |
+
visibility: visible;
|
130 |
+
transform: scale(1);
|
131 |
+
}
|
132 |
+
|
133 |
+
#wf-flyout .wff-menu-item:hover {
|
134 |
+
box-shadow: 0 3px 30px rgba(0, 0, 0, 0.25);
|
135 |
+
}
|
136 |
+
|
137 |
+
#wf-flyout .wff-menu-item:hover .wff-label {
|
138 |
+
right: calc(100% + 55px);
|
139 |
+
}
|
140 |
+
|
141 |
+
#wf-flyout .wff-menu-item .wff-label {
|
142 |
+
right: calc(100% + 70px);
|
143 |
+
}
|
144 |
+
|
145 |
+
#wf-flyout .wff-menu-item .dashicons {
|
146 |
+
line-height: 41px;
|
147 |
+
font-size: 23px;
|
148 |
+
color: #fff;
|
149 |
+
padding: 0px 3px 0px 0;
|
150 |
+
}
|
151 |
+
|
152 |
+
.wff-menu-item-1 {
|
153 |
+
bottom: 75px;
|
154 |
+
transition: transform 0.2s 30ms, background-color 0.2s;
|
155 |
+
}
|
156 |
+
|
157 |
+
.wff-menu-item-2 {
|
158 |
+
bottom: 130px;
|
159 |
+
transition: transform 0.2s 70ms, background-color 0.2s;
|
160 |
+
}
|
161 |
+
|
162 |
+
.wff-menu-item-3 {
|
163 |
+
bottom: 185px;
|
164 |
+
transition: transform 0.2s 110ms, background-color 0.2s;
|
165 |
+
}
|
166 |
+
|
167 |
+
.wff-menu-item-4 {
|
168 |
+
bottom: 240px;
|
169 |
+
transition: transform 0.2s 150ms, background-color 0.2s;
|
170 |
+
}
|
171 |
+
|
172 |
+
.wff-menu-item-5 {
|
173 |
+
bottom: 295px;
|
174 |
+
transition: transform 0.2s 190ms, background-color 0.2s;
|
175 |
+
}
|
176 |
+
|
177 |
+
.wff-menu-item-6 {
|
178 |
+
bottom: 350px;
|
179 |
+
transition: transform 0.2s 230ms, background-color 0.2s;
|
180 |
+
}
|
181 |
+
|
182 |
+
.wff-menu-item-7 {
|
183 |
+
bottom: 405px;
|
184 |
+
transition: transform 0.2s 270ms, background-color 0.2s;
|
185 |
+
}
|
186 |
+
|
187 |
+
.wff-menu-item-8 {
|
188 |
+
bottom: 460px;
|
189 |
+
transition: transform 0.2s 310ms, background-color 0.2s;
|
190 |
+
}
|
191 |
+
|
192 |
+
.wff-menu-item-9 {
|
193 |
+
bottom: 515px;
|
194 |
+
transition: transform 0.2s 350ms, background-color 0.2s;
|
195 |
+
}
|
196 |
+
|
197 |
+
.wff-menu-item-10 {
|
198 |
+
bottom: 570px;
|
199 |
+
transition: transform 0.2s 390ms, background-color 0.2s;
|
200 |
+
}
|
wf-flyout/wf-flyout.js
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/**
|
2 |
+
* Universal fly-out menu for WebFactory plugins
|
3 |
+
* (c) WebFactory Ltd, 2022
|
4 |
+
*/
|
5 |
+
|
6 |
+
jQuery(document).ready(function ($) {
|
7 |
+
$('#wff-button').on('click', function (e) {
|
8 |
+
e.preventDefault();
|
9 |
+
|
10 |
+
$('#wf-flyout').toggleClass('opened');
|
11 |
+
$('#wff-overlay').toggle();
|
12 |
+
|
13 |
+
return false;
|
14 |
+
}); // open/close menu
|
15 |
+
|
16 |
+
$('#wff-overlay').on('click', function (e) {
|
17 |
+
e.preventDefault();
|
18 |
+
|
19 |
+
$(this).hide();
|
20 |
+
$('#wf-flyout').removeClass('opened');
|
21 |
+
|
22 |
+
return false;
|
23 |
+
}); // click on overlay - hide menu
|
24 |
+
}); // jQuery ready
|
wf-flyout/wf-flyout.php
ADDED
@@ -0,0 +1,166 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Universal fly-out menu for WebFactory plugins
|
4 |
+
* (c) WebFactory Ltd, 2022
|
5 |
+
*/
|
6 |
+
|
7 |
+
|
8 |
+
if (false == class_exists('wf_flyout')) {
|
9 |
+
class wf_flyout
|
10 |
+
{
|
11 |
+
var $ver = 1.0;
|
12 |
+
var $plugin_file = '';
|
13 |
+
var $plugin_slug = '';
|
14 |
+
var $config = array();
|
15 |
+
|
16 |
+
|
17 |
+
function __construct($plugin_file)
|
18 |
+
{
|
19 |
+
$this->plugin_file = $plugin_file;
|
20 |
+
$this->plugin_slug = basename(dirname($plugin_file));
|
21 |
+
$this->load_config();
|
22 |
+
|
23 |
+
if (!is_admin()) {
|
24 |
+
return;
|
25 |
+
} else {
|
26 |
+
add_action('admin_init', array($this, 'init'));
|
27 |
+
}
|
28 |
+
} // __construct
|
29 |
+
|
30 |
+
|
31 |
+
function load_config()
|
32 |
+
{
|
33 |
+
$config = array();
|
34 |
+
require_once plugin_dir_path($this->plugin_file) . 'wf-flyout/config.php';
|
35 |
+
|
36 |
+
$defaults = array(
|
37 |
+
'plugin_screen' => '',
|
38 |
+
'icon_border' => '#0000ff',
|
39 |
+
'icon_right' => '40px',
|
40 |
+
'icon_bottom' => '40px',
|
41 |
+
'icon_image' => '',
|
42 |
+
'icon_padding' => '2px',
|
43 |
+
'icon_size' => '55px',
|
44 |
+
'menu_accent_color' => '#ca4a1f',
|
45 |
+
'custom_css' => '',
|
46 |
+
'menu_items' => array(),
|
47 |
+
);
|
48 |
+
|
49 |
+
$config = array_merge($defaults, $config);
|
50 |
+
if (!is_array($config['plugin_screen'])) {
|
51 |
+
$config['plugin_screen'] = array($config['plugin_screen']);
|
52 |
+
}
|
53 |
+
|
54 |
+
$this->config = $config;
|
55 |
+
} // load_config
|
56 |
+
|
57 |
+
|
58 |
+
function is_plugin_screen()
|
59 |
+
{
|
60 |
+
$screen = get_current_screen();
|
61 |
+
|
62 |
+
if (in_array($screen->id, $this->config['plugin_screen'])) {
|
63 |
+
return true;
|
64 |
+
} else {
|
65 |
+
return false;
|
66 |
+
}
|
67 |
+
} // is_plugin_screen
|
68 |
+
|
69 |
+
|
70 |
+
function init()
|
71 |
+
{
|
72 |
+
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'));
|
73 |
+
add_action('admin_head', array($this, 'admin_head'));
|
74 |
+
add_action('admin_footer', array($this, 'admin_footer'));
|
75 |
+
} // init
|
76 |
+
|
77 |
+
|
78 |
+
function admin_enqueue_scripts()
|
79 |
+
{
|
80 |
+
if (false === $this->is_plugin_screen()) {
|
81 |
+
return;
|
82 |
+
}
|
83 |
+
|
84 |
+
wp_enqueue_style('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.css', array(), $this->ver);
|
85 |
+
wp_enqueue_script('wf_flyout', plugin_dir_url($this->plugin_file) . 'wf-flyout/wf-flyout.js', array(), $this->ver, true);
|
86 |
+
} // admin_enqueue_scripts
|
87 |
+
|
88 |
+
|
89 |
+
function admin_head()
|
90 |
+
{
|
91 |
+
if (false === $this->is_plugin_screen()) {
|
92 |
+
return;
|
93 |
+
}
|
94 |
+
|
95 |
+
$out = '<style type="text/css">';
|
96 |
+
$out .= '#wf-flyout {
|
97 |
+
right: ' . sanitize_text_field($this->config['icon_right']) . ';
|
98 |
+
bottom: ' . sanitize_text_field($this->config['icon_bottom']) . ';
|
99 |
+
}';
|
100 |
+
$out .= '#wf-flyout #wff-image-wrapper {
|
101 |
+
border: ' . sanitize_text_field($this->config['icon_border']) . ';
|
102 |
+
}';
|
103 |
+
$out .= '#wf-flyout #wff-button img {
|
104 |
+
padding: ' . sanitize_text_field($this->config['icon_padding']) . ';
|
105 |
+
width: ' . sanitize_text_field($this->config['icon_size']) . ';
|
106 |
+
height: ' . sanitize_text_field($this->config['icon_size']) . ';
|
107 |
+
}';
|
108 |
+
$out .= '#wf-flyout .wff-menu-item.accent {
|
109 |
+
background: ' . sanitize_text_field($this->config['menu_accent_color']) . ';
|
110 |
+
}';
|
111 |
+
$out .= sanitize_text_field($this->config['custom_css']);
|
112 |
+
$out .= '</style>';
|
113 |
+
|
114 |
+
wpsabox_wp_kses_wf($out);
|
115 |
+
} // admin_head
|
116 |
+
|
117 |
+
|
118 |
+
function admin_footer()
|
119 |
+
{
|
120 |
+
if (false === $this->is_plugin_screen()) {
|
121 |
+
return;
|
122 |
+
}
|
123 |
+
|
124 |
+
$out = '';
|
125 |
+
$icons_url = plugin_dir_url($this->plugin_file) . 'wf-flyout/icons/';
|
126 |
+
$default_link_item = array('class' => '', 'href' => '#', 'target' => '_blank', 'label' => '', 'icon' => '', 'data' => '');
|
127 |
+
|
128 |
+
$out .= '<div id="wff-overlay"></div>';
|
129 |
+
|
130 |
+
$out .= '<div id="wf-flyout">';
|
131 |
+
|
132 |
+
$out .= '<a href="#" id="wff-button">';
|
133 |
+
$out .= '<span class="wff-label">Open Quick Links</span>';
|
134 |
+
$out .= '<span id="wff-image-wrapper">';
|
135 |
+
$out .= '<img src="' . esc_url($icons_url . $this->config['icon_image']) . '" alt="Open Quick Links" title="Open Quick Links">';
|
136 |
+
$out .= '</span>';
|
137 |
+
$out .= '</a>';
|
138 |
+
|
139 |
+
$out .= '<div id="wff-menu">';
|
140 |
+
$i = 0;
|
141 |
+
foreach (array_reverse($this->config['menu_items']) as $item) {
|
142 |
+
$i++;
|
143 |
+
$item = array_merge($default_link_item, $item);
|
144 |
+
|
145 |
+
if (!empty($item['icon']) && substr($item['icon'], 0, 9) != 'dashicons') {
|
146 |
+
$item['class'] .= ' wff-custom-icon';
|
147 |
+
$item['class'] = trim($item['class']);
|
148 |
+
}
|
149 |
+
|
150 |
+
$out .= '<a href="' . esc_url($item['href']) . '" class="wff-menu-item wff-menu-item-' . $i . ' ' . esc_attr($item['class']) . '" target="_blank">';
|
151 |
+
$out .= '<span class="wff-label visible">' . esc_html($item['label']) . '</span>';
|
152 |
+
if (substr($item['icon'], 0, 9) == 'dashicons') {
|
153 |
+
$out .= '<span class="dashicons ' . sanitize_text_field($item['icon']) . '"></span>';
|
154 |
+
} elseif (!empty($item['icon'])) {
|
155 |
+
$out .= '<span class="wff-icon"><img src="' . esc_url($icons_url . $item['icon']) . '"></span>';
|
156 |
+
}
|
157 |
+
$out .= '</a>';
|
158 |
+
} // foreach
|
159 |
+
$out .= '</div>'; // #wff-menu
|
160 |
+
|
161 |
+
$out .= '</div>'; // #wf-flyout
|
162 |
+
|
163 |
+
wpsabox_wp_kses_wf($out);
|
164 |
+
} // admin_footer
|
165 |
+
} // wf_flyout
|
166 |
+
} // if class exists
|