├── .gitignore ├── README.md ├── assets ├── css │ └── prism.css └── js │ ├── prism.js │ └── script.js ├── elementor-widget-mentor.php ├── plugin.php └── widgets └── widget-mentor.php /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Elementor Widget Mentor 2 | 3 | Learn Elementor widget development by Elementor widget. 4 | 5 | Download it, install it and learn from it. 6 | 7 | It is quite simple! 8 | -------------------------------------------------------------------------------- /assets/css/prism.css: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.16.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+markup-templating+php&plugins=line-highlight+line-numbers+highlight-keywords+normalize-whitespace */ 3 | /** 4 | * prism.js tomorrow night eighties for JavaScript, CoffeeScript, CSS and HTML 5 | * Based on https://github.com/chriskempson/tomorrow-theme 6 | * @author Rose Pritchard 7 | */ 8 | 9 | code[class*="language-"], 10 | pre[class*="language-"] { 11 | color: #ccc; 12 | background: none; 13 | font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace; 14 | font-size: 1em; 15 | text-align: left; 16 | white-space: pre; 17 | word-spacing: normal; 18 | word-break: normal; 19 | word-wrap: normal; 20 | line-height: 1.5; 21 | 22 | -moz-tab-size: 4; 23 | -o-tab-size: 4; 24 | tab-size: 4; 25 | 26 | -webkit-hyphens: none; 27 | -moz-hyphens: none; 28 | -ms-hyphens: none; 29 | hyphens: none; 30 | 31 | } 32 | 33 | /* Code blocks */ 34 | pre[class*="language-"] { 35 | padding: 1em; 36 | margin: .5em 0; 37 | overflow: auto; 38 | } 39 | 40 | :not(pre) > code[class*="language-"], 41 | pre[class*="language-"] { 42 | background: #2d2d2d; 43 | } 44 | 45 | /* Inline code */ 46 | :not(pre) > code[class*="language-"] { 47 | padding: .1em; 48 | border-radius: .3em; 49 | white-space: normal; 50 | } 51 | 52 | .token.comment, 53 | .token.block-comment, 54 | .token.prolog, 55 | .token.doctype, 56 | .token.cdata { 57 | color: #999; 58 | } 59 | 60 | .token.punctuation { 61 | color: #ccc; 62 | } 63 | 64 | .token.tag, 65 | .token.attr-name, 66 | .token.namespace, 67 | .token.deleted { 68 | color: #e2777a; 69 | } 70 | 71 | .token.function-name { 72 | color: #6196cc; 73 | } 74 | 75 | .token.boolean, 76 | .token.number, 77 | .token.function { 78 | color: #f08d49; 79 | } 80 | 81 | .token.property, 82 | .token.class-name, 83 | .token.constant, 84 | .token.symbol { 85 | color: #f8c555; 86 | } 87 | 88 | .token.selector, 89 | .token.important, 90 | .token.atrule, 91 | .token.keyword, 92 | .token.builtin { 93 | color: #cc99cd; 94 | } 95 | 96 | .token.string, 97 | .token.char, 98 | .token.attr-value, 99 | .token.regex, 100 | .token.variable { 101 | color: #7ec699; 102 | } 103 | 104 | .token.operator, 105 | .token.entity, 106 | .token.url { 107 | color: #67cdcc; 108 | } 109 | 110 | .token.important, 111 | .token.bold { 112 | font-weight: bold; 113 | } 114 | .token.italic { 115 | font-style: italic; 116 | } 117 | 118 | .token.entity { 119 | cursor: help; 120 | } 121 | 122 | .token.inserted { 123 | color: green; 124 | } 125 | 126 | pre[data-line] { 127 | position: relative; 128 | padding: 1em 0 1em 3em; 129 | } 130 | 131 | .line-highlight { 132 | position: absolute; 133 | left: 0; 134 | right: 0; 135 | padding: inherit 0; 136 | margin-top: 1em; /* Same as .prism’s padding-top */ 137 | 138 | background: hsla(24, 20%, 50%,.08); 139 | background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0)); 140 | 141 | pointer-events: none; 142 | 143 | line-height: inherit; 144 | white-space: pre; 145 | } 146 | 147 | .line-highlight:before, 148 | .line-highlight[data-end]:after { 149 | content: attr(data-start); 150 | position: absolute; 151 | top: .4em; 152 | left: .6em; 153 | min-width: 1em; 154 | padding: 0 .5em; 155 | background-color: hsla(24, 20%, 50%,.4); 156 | color: hsl(24, 20%, 95%); 157 | font: bold 65%/1.5 sans-serif; 158 | text-align: center; 159 | vertical-align: .3em; 160 | border-radius: 999px; 161 | text-shadow: none; 162 | box-shadow: 0 1px white; 163 | } 164 | 165 | .line-highlight[data-end]:after { 166 | content: attr(data-end); 167 | top: auto; 168 | bottom: .4em; 169 | } 170 | 171 | .line-numbers .line-highlight:before, 172 | .line-numbers .line-highlight:after { 173 | content: none; 174 | } 175 | 176 | pre[class*="language-"].line-numbers { 177 | position: relative; 178 | padding-left: 3.8em; 179 | counter-reset: linenumber; 180 | } 181 | 182 | pre[class*="language-"].line-numbers > code { 183 | position: relative; 184 | white-space: inherit; 185 | } 186 | 187 | .line-numbers .line-numbers-rows { 188 | position: absolute; 189 | pointer-events: none; 190 | top: 0; 191 | font-size: 100%; 192 | left: -3.8em; 193 | width: 3em; /* works for line-numbers below 1000 lines */ 194 | letter-spacing: -1px; 195 | border-right: 1px solid #999; 196 | 197 | -webkit-user-select: none; 198 | -moz-user-select: none; 199 | -ms-user-select: none; 200 | user-select: none; 201 | 202 | } 203 | 204 | .line-numbers-rows > span { 205 | pointer-events: none; 206 | display: block; 207 | counter-increment: linenumber; 208 | } 209 | 210 | .line-numbers-rows > span:before { 211 | content: counter(linenumber); 212 | color: #999; 213 | display: block; 214 | padding-right: 0.8em; 215 | text-align: right; 216 | } 217 | 218 | -------------------------------------------------------------------------------- /assets/js/prism.js: -------------------------------------------------------------------------------- 1 | /* PrismJS 1.16.0 2 | https://prismjs.com/download.html#themes=prism-tomorrow&languages=markup+css+clike+javascript+markup-templating+php&plugins=line-highlight+line-numbers+highlight-keywords+normalize-whitespace */ 3 | var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(g){var c=/\blang(?:uage)?-([\w-]+)\b/i,a=0,C={manual:g.Prism&&g.Prism.manual,disableWorkerMessageHandler:g.Prism&&g.Prism.disableWorkerMessageHandler,util:{encode:function(e){return e instanceof M?new M(e.type,C.util.encode(e.content),e.alias):Array.isArray(e)?e.map(C.util.encode):e.replace(/&/g,"&").replace(/e.length)return;if(!(k instanceof M)){if(f&&y!=a.length-1){if(c.lastIndex=v,!(x=c.exec(e)))break;for(var b=x.index+(h?x[1].length:0),w=x.index+x[0].length,A=y,P=v,O=a.length;A"+n.content+""},!g.document)return g.addEventListener&&(C.disableWorkerMessageHandler||g.addEventListener("message",function(e){var a=JSON.parse(e.data),n=a.language,t=a.code,r=a.immediateClose;g.postMessage(C.highlight(t,C.languages[n],n)),r&&g.close()},!1)),C;var e=document.currentScript||[].slice.call(document.getElementsByTagName("script")).pop();return e&&(C.filename=e.src,C.manual||e.hasAttribute("data-manual")||("loading"!==document.readyState?window.requestAnimationFrame?window.requestAnimationFrame(C.highlightAll):window.setTimeout(C.highlightAll,16):document.addEventListener("DOMContentLoaded",C.highlightAll))),C}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism); 4 | Prism.languages.markup={comment://,prolog:/<\?[\s\S]+?\?>/,doctype://i,cdata://i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/i,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/i,inside:{punctuation:[/^=/,{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^$/i;var n={"included-cdata":{pattern://i,inside:s}};n["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var i={};i[a]={pattern:RegExp("(<__[\\s\\S]*?>)(?:\\s*|[\\s\\S])*?(?=<\\/__>)".replace(/__/g,a),"i"),lookbehind:!0,greedy:!0,inside:n},Prism.languages.insertBefore("markup","cdata",i)}}),Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup; 5 | !function(s){var e=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-]+?[\s\S]*?(?:;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:RegExp("url\\((?:"+e.source+"|.*?)\\)","i"),selector:RegExp("[^{}\\s](?:[^{};\"']|"+e.source+")*?(?=\\s*\\{)"),string:{pattern:e,greedy:!0},property:/[-_a-z\xA0-\uFFFF][-\w\xA0-\uFFFF]*(?=\s*:)/i,important:/!important\b/i,function:/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var a=s.languages.markup;a&&(a.tag.addInlined("style","css"),s.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|')(?:\\[\s\S]|(?!\1)[^\\])*\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:a.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:s.languages.css}},alias:"language-css"}},a.tag))}(Prism); 6 | Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+\.?\d*|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/}; 7 | Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])[_$A-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)(?:catch|finally)\b/,lookbehind:!0},{pattern:/(^|[^.])\b(?:as|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],number:/\b(?:(?:0[xX][\dA-Fa-f]+|0[bB][01]+|0[oO][0-7]+)n?|\d+n|NaN|Infinity)\b|(?:\b\d+\.?\d*|\B\.\d+)(?:[Ee][+-]?\d+)?/,function:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,operator:/-[-=]?|\+[+=]?|!=?=?|<>?>?=?|=(?:==?|>)?|&[&=]?|\|[|=]?|\*\*?=?|\/=?|~|\^=?|%=?|\?|\.{3}/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s])\s*)\/(\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[gimyus]{0,6}(?=\s*($|[\r\n,.;})\]]))/,lookbehind:!0,greedy:!0},"function-variable":{pattern:/[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|[_$a-zA-Z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*)?\s*\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/[_$a-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*(?=\s*=>)/i,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:[_$A-Za-z\xA0-\uFFFF][$\w\xA0-\uFFFF]*\s*)\(\s*)(?!\s)(?:[^()]|\([^()]*\))+?(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|[^\\`])*`/,greedy:!0,inside:{interpolation:{pattern:/\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.js=Prism.languages.javascript; 8 | !function(h){function v(e,n){return"___"+e.toUpperCase()+n+"___"}Object.defineProperties(h.languages["markup-templating"]={},{buildPlaceholders:{value:function(a,r,e,o){if(a.language===r){var c=a.tokenStack=[];a.code=a.code.replace(e,function(e){if("function"==typeof o&&!o(e))return e;for(var n,t=c.length;-1!==a.code.indexOf(n=v(r,t));)++t;return c[t]=e,n}),a.grammar=h.languages.markup}}},tokenizePlaceholders:{value:function(p,k){if(p.language===k&&p.tokenStack){p.grammar=h.languages[k];var m=0,d=Object.keys(p.tokenStack);!function e(n){for(var t=0;t=d.length);t++){var a=n[t];if("string"==typeof a||a.content&&"string"==typeof a.content){var r=d[m],o=p.tokenStack[r],c="string"==typeof a?a:a.content,i=v(k,r),u=c.indexOf(i);if(-1$|^<\?(?:php(?=\s)|=)?/i,alias:"important"}}),n.languages.insertBefore("php","keyword",{variable:/\$+(?:\w+\b|(?={))/i,package:{pattern:/(\\|namespace\s+|use\s+)[\w\\]+/,lookbehind:!0,inside:{punctuation:/\\/}}}),n.languages.insertBefore("php","operator",{property:{pattern:/(->)[\w]+/,lookbehind:!0}});var e={pattern:/{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[.+?]|->\w+)*)/,lookbehind:!0,inside:{rest:n.languages.php}};n.languages.insertBefore("php","string",{"nowdoc-string":{pattern:/<<<'([^']+)'(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;/,greedy:!0,alias:"string",inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},"heredoc-string":{pattern:/<<<(?:"([^"]+)"(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\1;|([a-z_]\w*)(?:\r\n?|\n)(?:.*(?:\r\n?|\n))*?\2;)/i,greedy:!0,alias:"string",inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:e}},"single-quoted-string":{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0,alias:"string"},"double-quoted-string":{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,alias:"string",inside:{interpolation:e}}}),delete n.languages.php.string,n.hooks.add("before-tokenize",function(e){if(/<\?/.test(e.code)){n.languages["markup-templating"].buildPlaceholders(e,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#)(?:[^?\n\r]|\?(?!>))*|\/\*[\s\S]*?(?:\*\/|$))*?(?:\?>|$)/gi)}}),n.hooks.add("after-tokenize",function(e){n.languages["markup-templating"].tokenizePlaceholders(e,"php")})}(Prism); 10 | !function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var t,h=function(){if(void 0===t){var e=document.createElement("div");e.style.fontSize="13px",e.style.lineHeight="1.5",e.style.padding=0,e.style.border=0,e.innerHTML=" 
 ",document.body.appendChild(e),t=38===e.offsetHeight,document.body.removeChild(e)}return t},l=0;Prism.hooks.add("before-sanity-check",function(e){var t=e.element.parentNode,n=t&&t.getAttribute("data-line");if(t&&n&&/pre/i.test(t.nodeName)){var i=0;r(".line-highlight",t).forEach(function(e){i+=e.textContent.length,e.parentNode.removeChild(e)}),i&&/^( \n)+$/.test(e.code.slice(-i))&&(e.code=e.code.slice(0,-i))}}),Prism.hooks.add("complete",function e(t){var n=t.element.parentNode,i=n&&n.getAttribute("data-line");if(n&&i&&/pre/i.test(n.nodeName)){clearTimeout(l);var r=Prism.plugins.lineNumbers,o=t.plugins&&t.plugins.lineNumbers;g(n,"line-numbers")&&r&&!o?Prism.hooks.add("line-numbers",e):(a(n,i),l=setTimeout(s,1))}}),window.addEventListener("hashchange",s),window.addEventListener("resize",function(){var e=document.querySelectorAll("pre[data-line]");Array.prototype.forEach.call(e,function(e){a(e)})})}function r(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function g(e,t){return t=" "+t+" ",-1<(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)}function a(e,t,n){for(var i,r=(t="string"==typeof t?t:e.getAttribute("data-line")).replace(/\s+/g,"").split(","),o=+e.getAttribute("data-line-offset")||0,l=(h()?parseInt:parseFloat)(getComputedStyle(e).lineHeight),a=g(e,"line-numbers"),s=0;i=r[s++];){var d=i.split("-"),u=+d[0],c=+d[1]||u,m=e.querySelector('.line-highlight[data-range="'+i+'"]')||document.createElement("div");if(m.setAttribute("aria-hidden","true"),m.setAttribute("data-range",i),m.className=(n||"")+" line-highlight",a&&Prism.plugins.lineNumbers){var p=Prism.plugins.lineNumbers.getLine(e,u),f=Prism.plugins.lineNumbers.getLine(e,c);p&&(m.style.top=p.offsetTop+"px"),f&&(m.style.height=f.offsetTop-p.offsetTop+f.offsetHeight+"px")}else m.setAttribute("data-start",u),u");(l=document.createElement("span")).setAttribute("aria-hidden","true"),l.className="line-numbers-rows",l.innerHTML=u,n.hasAttribute("data-start")&&(n.style.counterReset="linenumber "+(parseInt(n.getAttribute("data-start"),10)-1)),e.element.appendChild(l),m(n),Prism.hooks.run("line-numbers",e)}}}}),Prism.hooks.add("line-numbers",function(e){e.plugins=e.plugins||{},e.plugins.lineNumbers=!0}),Prism.plugins.lineNumbers={getLine:function(e,t){if("PRE"===e.tagName&&e.classList.contains(l)){var n=e.querySelector(".line-numbers-rows"),r=parseInt(e.getAttribute("data-start"),10)||1,s=r+(n.children.length-1);t=' ) ) { 101 | add_action( 'admin_notices', array( $this, 'admin_notice_minimum_elementor_version' ) ); 102 | return; 103 | } 104 | 105 | // Check for required PHP version 106 | if ( version_compare( PHP_VERSION, self::MINIMUM_PHP_VERSION, '<' ) ) { 107 | add_action( 'admin_notices', array( $this, 'admin_notice_minimum_php_version' ) ); 108 | return; 109 | } 110 | 111 | // Once we get here, We have passed all validation checks so we can safely include our plugin 112 | require_once( 'plugin.php' ); 113 | } 114 | 115 | /** 116 | * Admin notice 117 | * 118 | * Warning when the site doesn't have Elementor installed or activated. 119 | * 120 | * @since 1.0.0 121 | * @access public 122 | */ 123 | public function admin_notice_missing_main_plugin() { 124 | if ( isset( $_GET['activate'] ) ) { 125 | unset( $_GET['activate'] ); 126 | } 127 | 128 | $message = sprintf( 129 | /* translators: 1: Plugin name 2: Elementor */ 130 | esc_html__( '"%1$s" requires "%2$s" to be installed and activated.', 'widget-mentor' ), 131 | '' . esc_html__( 'Elementor Widget Mentor', 'widget-mentor' ) . '', 132 | '' . esc_html__( 'Elementor', 'widget-mentor' ) . '' 133 | ); 134 | 135 | printf( '

%1$s

', $message ); 136 | } 137 | 138 | /** 139 | * Admin notice 140 | * 141 | * Warning when the site doesn't have a minimum required Elementor version. 142 | * 143 | * @since 1.0.0 144 | * @access public 145 | */ 146 | public function admin_notice_minimum_elementor_version() { 147 | if ( isset( $_GET['activate'] ) ) { 148 | unset( $_GET['activate'] ); 149 | } 150 | 151 | $message = sprintf( 152 | /* translators: 1: Plugin name 2: Elementor 3: Required Elementor version */ 153 | esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'widget-mentor' ), 154 | '' . esc_html__( 'Elementor Widget Mentor', 'widget-mentor' ) . '', 155 | '' . esc_html__( 'Elementor', 'widget-mentor' ) . '', 156 | self::MINIMUM_ELEMENTOR_VERSION 157 | ); 158 | 159 | printf( '

%1$s

', $message ); 160 | } 161 | 162 | /** 163 | * Admin notice 164 | * 165 | * Warning when the site doesn't have a minimum required PHP version. 166 | * 167 | * @since 1.0.0 168 | * @access public 169 | */ 170 | public function admin_notice_minimum_php_version() { 171 | if ( isset( $_GET['activate'] ) ) { 172 | unset( $_GET['activate'] ); 173 | } 174 | 175 | $message = sprintf( 176 | /* translators: 1: Plugin name 2: PHP 3: Required PHP version */ 177 | esc_html__( '"%1$s" requires "%2$s" version %3$s or greater.', 'widget-mentor' ), 178 | '' . esc_html__( 'Elementor Widget Mentor', 'widget-mentor' ) . '', 179 | '' . esc_html__( 'PHP', 'widget-mentor' ) . '', 180 | self::MINIMUM_PHP_VERSION 181 | ); 182 | 183 | printf( '

%1$s

', $message ); 184 | } 185 | } 186 | 187 | // Instantiate Elementor_Hello_World. 188 | new ElementorWidgetMentor(); 189 | -------------------------------------------------------------------------------- /plugin.php: -------------------------------------------------------------------------------- 1 | include_widgets_files(); 94 | 95 | // Register Widgets 96 | //\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new Widgets\Widget_Mentor() ); 97 | $widget_manager->register_widget_type( new Widgets\Widget_Mentor() ); 98 | } 99 | 100 | /** 101 | * Plugin class constructor 102 | * 103 | * Register plugin action hooks and filters 104 | * 105 | * @since 1.0.0 106 | * @access public 107 | */ 108 | public function __construct() { 109 | // Register widget scripts 110 | add_action( 'elementor/frontend/after_register_scripts', [ $this, 'widget_scripts' ] ); 111 | 112 | // Register widgets 113 | add_action( 'elementor/widgets/widgets_registered', [ $this, 'register_widgets' ] ); 114 | } 115 | } 116 | 117 | // Instantiate Plugin Class 118 | Plugin::instance(); 119 | -------------------------------------------------------------------------------- /widgets/widget-mentor.php: -------------------------------------------------------------------------------- 1 | start_controls_section( 86 | '_section_index', 87 | [ 88 | 'label' => __( 'Topics', 'widget-mentor' ), 89 | ] 90 | ); 91 | 92 | $this->add_control( 93 | 'topic', 94 | [ 95 | 'show_label' => false, 96 | 'label_block' => true, 97 | 'type' => Controls_Manager::SELECT, 98 | 'default' => 'zero', 99 | 'options' => [ 100 | 'zero' => __( 'উইজেট পরিচিতি', 'widget-mentor' ), 101 | 'one' => __( 'Widget_Base - ডেভেলপমেন্টের শুরু এখানেই', 'widget-mentor' ), 102 | 'two' => __( 'উইজেট বেসিক কনফিগারেশন', 'widget-mentor' ), 103 | 'three' => __( 'উইজেট কন্ট্রোল রেজিস্টার করা', 'widget-mentor' ), 104 | 'four' => __( 'উইজেট কনটেন্ট রেন্ডার করা', 'widget-mentor' ), 105 | 'five' => __( 'রিফ্রেশলেস কনটেন্ট এডিটিং', 'widget-mentor' ), 106 | 'six' => __( 'ইনলাইন এডিটিং', 'widget-mentor' ), 107 | 'seven' => __( 'উইজেট রেজিস্টার করা', 'widget-mentor' ), 108 | 'eight' => __( 'শ্যাষ, ইলিমেন্টর বহুত ট্যাস', 'widget-mentor' ), 109 | ], 110 | ] 111 | ); 112 | 113 | $this->end_controls_section(); 114 | } 115 | 116 | protected static function get_topics_content() { 117 | $zero = << 'উইজেট পরিচিতি', 125 | [1] => 'Widget_Base - ডেভেলপমেন্টের শুরু এখানেই', 126 | [2] => 'উইজেট বেসিক কনফিগারেশন', 127 | [3] => 'উইজেট কন্ট্রোল রেজিস্টার করা', 128 | [4] => 'উইজেট কনটেন্ট রেন্ডার করা', 129 | [5] => 'রিফ্রেশলেস কনটেন্ট এডিটিং', 130 | [6] => 'ইনলাইন এডিটিং', 131 | [7] => 'উইজেট রেজিস্টার করা', 132 | [8] => 'শেষ, তবু শেষ হইয়াও হইলো না শেষ', 133 | ]; 134 | CONTENT; 135 | 136 | $one = <<start_controls_section( 177 | '_section_index', 178 | [ 179 | 'label' => __( 'Topics', 'widget-mentor' ), 180 | ] 181 | ); 182 | 183 | $this->add_control( 184 | 'topic', 185 | [ 186 | 'show_label' => false, 187 | 'label_block' => true, 188 | 'type' => Controls_Manager::SELECT, 189 | 'default' => 'zero', 190 | 'options' => [ 191 | 'zero' => __( 'উইজেট পরিচিতি', 'widget-mentor' ), 192 | 'one' => __( 'Widget_Base - ডেভেলপমেন্টের শুরু এখানেই', 'widget-mentor' ), 193 | 'two' => __( 'উইজেট বেসিক কনফিগারেশন', 'widget-mentor' ), 194 | 'three' => __( 'উইজেট কন্ট্রোল রেজিস্টার করা', 'widget-mentor' ), 195 | 'four' => __( 'উইজেট কনটেন্ট রেন্ডার করা', 'widget-mentor' ), 196 | 'five' => __( 'রিফ্রেশলেস কনটেন্ট এডিটিং', 'widget-mentor' ), 197 | 'six' => __( 'ইনলাইন এডিটিং', 'widget-mentor' ), 198 | 'seven' => __( 'উইজেট রেজিস্টার করা', 'widget-mentor' ), 199 | 'eight' => __( 'শ্যাষ, ইলিমেন্টর বহুত ট্যাস', 'widget-mentor' ), 200 | ], 201 | ] 202 | ); 203 | 204 | $this->end_controls_section(); 205 | } 206 | CONTENT; 207 | 208 | $four = <<get_settings_for_display(); 214 | $topics = self::get_topics_content(); 215 | ?> 216 | <pre> 217 | <code class="language-php"> 218 | <?php if ( isset( $topics[ $settings['topic'] ] ) ) : 219 | echo $topics[ $settings['topic'] ]; 220 | endif; ?> 221 | </code> 222 | </pre> 223 | <?php 224 | } 225 | CONTENT; 226 | 227 | $five = << 235 | <pre> 236 | <code class="language-php"> 237 | <# 238 | if (_.isObject(topics) && !_.isUndefined(topics[settings.topic])) { 239 | print(topics[settings.topic]); 240 | } 241 | #> 242 | </code> 243 | </pre> 244 | <?php 245 | } 246 | CONTENT; 247 | 248 | $six = <<add_inline_editing_attributes( 'title', 'none' ); // none, basic, advanced 253 | ?> 254 | <h2 <?php echo $this->get_render_attribute_string( 'title' ); ?>><?php echo $settings['title']; ?></h2> 255 | <?php 256 | 257 | // In JS 258 | <# view.addInlineEditingAttributes( 'title', 'none' ); // none, basic, advanced #> 259 | 260 | <h2 {{{ view.getRenderAttributeString( 'title' ) }}}>{{{ settings.title }}}</h2> 261 | CONTENT; 262 | 263 | $seven = <<widgets_manager->register_widget_type( new \ElementorWidgetMentor\Widgets\Widget_Mentor() ); 276 | } 277 | CONTENT; 278 | 279 | $eight = << $zero, 297 | 'one' => $one, 298 | 'two' => $two, 299 | 'three' => $three, 300 | 'four' => $four, 301 | 'five' => $five, 302 | 'six' => $six, 303 | 'seven' => $seven, 304 | 'eight' => $eight, 305 | ]; 306 | } 307 | 308 | /** 309 | * Render the widget output on the frontend. 310 | * 311 | * Written in PHP and used to generate the final HTML. 312 | * 313 | * @since 1.0.0 314 | * 315 | * @access protected 316 | */ 317 | protected function render() { 318 | $settings = $this->get_settings_for_display(); 319 | $topics = self::get_topics_content(); 320 | ?> 321 |
322 |             
323 |                 
326 |             
327 |         
328 | '; 342 | ?> 343 |
344 |             
345 |                 <#
346 |                 if (_.isObject(topics) && !_.isUndefined(topics[settings.topic])) {
347 |                     print(topics[settings.topic]);
348 |                 }
349 |                 #>
350 |             
351 |         
352 |