HEX
Server: LiteSpeed
System: Linux s383.bitcommand.com 5.14.0-687.24.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jul 9 18:14:06 EDT 2026 x86_64
User: pclast (1605)
PHP: 8.1.34
Disabled: exec,system,passthru,shell_exec,escapeshellarg,escapeshellcmd,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/pclast/www/wp-content/plugins/zhaket-updater/assets/admin/ai/editor-scripts.min.js
function zhAiGetString(e,t){return window.zhaketAIConfig&&window.zhaketAIConfig.lang?window.zhaketAIConfig.lang[e]||t||e:t||e}function checkImageExistsInMediaLibrary(e){return fetch(window.zhaketAIConfig?.ajaxUrl||"/wp-admin/admin-ajax.php",{method:"POST",body:(t=new FormData,t.append("action","zhaket_check_ai_image"),t.append("image_url",e),t.append("nonce",window.zhaketAIConfig?.ajaxNonce||""),t),credentials:"same-origin"}).then(function(e){return e.json()}).then(function(e){return e.success&&e.data&&e.data.id?e.data.id:null}).catch(function(){return null});var t}function uploadImageToMediaLibrary(e){return checkImageExistsInMediaLibrary(e).then(function(t){return t||fetch(e).then(function(e){if(!e.ok)throw new Error(zhAiGetString("failedToFetchImage","Failed to fetch image"));return e.blob()}).then(function(e){var t=new FormData;return t.append("file",e,"ai-generated-image.png"),t.append("action","zhaket_upload_ai_image"),t.append("nonce",window.zhaketAIConfig?.ajaxNonce||""),fetch(window.zhaketAIConfig?.ajaxUrl||"/wp-admin/admin-ajax.php",{method:"POST",body:t,credentials:"same-origin"})}).then(function(e){return e.json()}).then(function(e){if(e.success&&e.data&&e.data.id)return e.data.id;throw new Error(e.data?.message||zhAiGetString("uploadFailed","Upload failed"))})})}function zhAiGetSafeSelection(){let e=window.getSelection(),t=e?e.toString():"";if(!t){const n=document.querySelector('iframe[name="editor-canvas"]');if(n&&n.contentWindow)try{e=n.contentWindow.getSelection(),t=e?e.toString():""}catch(e){}}if(!t)try{const n=document.querySelectorAll("iframe");for(let i=0;i<n.length;i++)try{const o=n[i].contentWindow;if(o&&o.getSelection){const n=o.getSelection();if(n&&n.toString().trim()){e=n,t=n.toString().trim();break}}}catch(e){continue}}catch(e){}return{selection:e,text:t}}function getContentAttribute(e){return{"core/quote":"value","core/verse":"content","core/preformatted":"content","core/pullquote":"value","core/paragraph":"content","core/heading":"content","core/list":"values","core/list-item":"content"}[e]||"content"}function initZhaketAIModal(){return window.zhaketAIModalInstance?window.zhaketAIModalInstance:window.ZhaketAIModal&&window.zhaketAIConfig?(window.zhaketAIModalInstance=new window.ZhaketAIModal(window.zhaketAIConfig),window.zhaketAIModalInstance):null}function handleAIError(e,t){console.error(e),alert(zhAiGetString(t||"errorOccurredCheckConsole","Error occurred. Please check console."))}"undefined"!=typeof wp&&wp.domReady&&wp.domReady(function(){if(void 0===wp.data)return;const{select:e,dispatch:t,subscribe:n}=wp.data,i=["core/shortcode","core/html","core/code","core/embed"],o=e=>{if(!e)return!1;if(i.includes(e.name))return!1;const t=wp.blocks.getBlockType(e.name);return!!t&&("core/image"===e.name||"core/post-featured-image"===e.name||("text"===t.category||"core/post-excerpt"===t.name))},a=()=>{initZhaketAIModal();const t=e("core/block-editor");if(!t)return;const n=t.getSelectedBlock(),i=document.querySelector("#zhaket-ai-block-btn");if(i&&(!n||!o(n)))return void i.remove();if(!n||!o(n))return;const a=document.querySelector(".block-editor-block-card__description");if(!a||document.getElementById("zhaket-ai-block-btn"))return;const r="core/image"===n.name||"core/post-featured-image"===n.name,l=document.createElement("button"),s=r?zhAiGetString("generateImageWithAi","Generate Image with AI"):zhAiGetString("generateTextWithAi","Generate Text with AI");function g(e){if(!e)return null;if("string"==typeof e.className&&e.className.includes("-ai"))return e;const t=e.querySelectorAll("*");for(let e=0;e<t.length;e++)if("string"==typeof t[e].className&&t[e].className.includes("-ai"))return t[e];return null}l.id="zhaket-ai-block-btn",l.innerHTML=`<img src="${window?.zhaketAIConfig?.imagePath}zhaket-ai.svg" style="vertical-align:middle;margin-right:5px;"> ${s}`,l.className="components-button is-secondary zhaket-ai-cta-btn",l.style.marginTop="10px",l.style.width="100%",l.style.justifyContent="center",l.onclick=e=>"core/post-featured-image"===n.name?d(e):c(e,n);const u=a.previousElementSibling,m=u?g(u):null,h=a.firstElementChild,p=h?g(h):null;if(m){m.parentNode.insertBefore(l,m)}else if(p){p.parentNode.insertBefore(l,p)}else{const e=a.parentNode,t=e.lastElementChild;t&&"string"==typeof t.className&&t.className.includes("-ai")?e.insertBefore(l,t):e.insertBefore(l,a.nextSibling)}},r=()=>{const e=document.querySelector(".editor-post-excerpt");if(!e||document.getElementById("zhaket-ai-excerpt-btn"))return;const t=document.createElement("button");t.id="zhaket-ai-excerpt-btn",t.innerHTML=`<img src="${window?.zhaketAIConfig?.imagePath}zhaket-ai.svg" style="vertical-align:middle;margin-right:5px;"> ${zhAiGetString("generateTextWithAi","Generate Text with AI")}`,t.className="components-button is-secondary zhaket-ai-cta-btn",t.style.marginTop="10px",t.style.width="100%",t.onclick=e=>{e.preventDefault();const t=e.target.closest("button"),n=t.innerHTML,i=initZhaketAIModal();i?i.open("text",e=>{e.content&&(t.innerText=zhAiGetString("processing","Processing..."),t.disabled=!0,wp.data.dispatch("core/editor").editPost({excerpt:e.content}),t.innerHTML=n,t.disabled=!1)}):alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."))},e.appendChild(t)},l=()=>{const e=document.querySelector(".editor-post-featured-image");if(!e||document.getElementById("zhaket-ai-featured-btn"))return;const t=document.createElement("button");t.id="zhaket-ai-featured-btn",t.innerHTML=`<img src="${window?.zhaketAIConfig?.imagePath}zhaket-ai.svg" style="vertical-align:middle;margin-right:5px;"> ${zhAiGetString("generateImageWithAi","Generate Image with AI")}`,t.className="components-button is-secondary zhaket-ai-cta-btn",t.style.marginTop="10px",t.onclick=d;const n=e.lastElementChild;n&&"string"==typeof n.className&&n.className.includes("-ai")?e.insertBefore(t,n):e.appendChild(t)},c=(e,n)=>{e.preventDefault();const i=e.target.closest("button"),o=i.innerHTML,{text:a}=zhAiGetSafeSelection(),r="core/image"===n.name||"core/post-featured-image"===n.name,l=initZhaketAIModal();l?l.open(r?"image":"text",e=>{i.innerText=zhAiGetString("processing","Processing..."),i.disabled=!0;try{!r&&e.content?((e,n,i=null)=>{const o=e.name,a=getContentAttribute(o),r=e.attributes[a]||"";if("core/post-excerpt"===o)t("core/editor").editPost({excerpt:n.content});else if("core/list"===o&&Array.isArray(r)){const i=n.content.split("\n").filter(e=>e.trim()),o=[...r,...i];t("core/block-editor").updateBlockAttributes(e.clientId,{[a]:o})}else{let o="";i&&i.trim().length>0&&"string"==typeof r?(o=r.replace(i,n.content),o===r&&(o=`${r}\n\n${n.content}`)):o=r?`${r}\n\n${n.content}`:n.content,t("core/block-editor").updateBlockAttributes(e.clientId,{[a]:o})}})(n,e,a):r&&e.image_url&&t("core/block-editor").updateBlockAttributes(n.clientId,{url:e.image_url,alt:zhAiGetString("aiGenerated","Zhaket AI Generated")})}catch(e){handleAIError(e,"errorUpdatingBlock")}finally{i.innerHTML=o,i.disabled=!1}},a):alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."))},d=e=>{e.preventDefault();const n=e.target.closest("button"),i=n.innerHTML,o=initZhaketAIModal();o?o.open("image",e=>{e.image_url&&"function"==typeof uploadImageToMediaLibrary?(n.innerText=zhAiGetString("uploading","Uploading..."),n.disabled=!0,uploadImageToMediaLibrary(e.image_url).then(e=>{t("core/editor").editPost({featured_media:e}),n.innerHTML=i,n.disabled=!1}).catch(e=>{handleAIError(e,"uploadFailed"),n.innerHTML=i,n.disabled=!1})):alert(zhAiGetString("errorOrMissingUpload","Error or missing upload function"))}):alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."))};let s=null,g=null;n(()=>{const t=e("core/block-editor");if(!t)return;const n=t.getSelectedBlock(),i=n?n.clientId:null;g&&clearTimeout(g),g=setTimeout(()=>{if(i!==s){const e=document.getElementById("zhaket-ai-block-btn");e&&e.remove(),s=i}a(),l(),r()},50)}),setTimeout(()=>{a(),l(),r()},1e3),document.addEventListener("click",function(e){(e.target.closest(".editor-post-excerpt .components-panel__body-toggle")||e.target.closest(".editor-post-excerpt__dropdown > button"))&&(setTimeout(r,100),setTimeout(r,300))})}),"undefined"!=typeof wp&&function(e){if(!(e.compose&&e.element&&e.blockEditor&&e.components&&e.hooks))return;const{createHigherOrderComponent:t}=e.compose,{Fragment:n,createElement:i,useState:o}=e.element,{BlockControls:a}=e.blockEditor,{ToolbarGroup:r,ToolbarButton:l}=e.components,{addFilter:c}=e.hooks,d=i;c("editor.BlockEdit","my-plugin/ai-toolbar-sidebar",t(function(e){return function(t){const{name:i,attributes:c,setAttributes:s}=t,g=["core/paragraph","core/heading","core/quote","core/verse","core/preformatted","core/pullquote","core/list","core/list-item"].includes(i);const u="core/image"===i||"core/post-featured-image"===i,[m,h]=o(!1);return d(n,{},d(a,{group:"other"},d(r,{},d(l,{icon:d("img",{src:window?.zhaketAIConfig?.imagePath+"zhaket-ai2.svg",style:{width:"30px",height:"30px"}}),className:"zhaket-ai-toolbar-btn",label:u?zhAiGetString("generateImageWithAi","Generate Image with AI"):zhAiGetString("generateTextWithAi","Generate Text with AI"),onClick:function(){!async function(){const e=initZhaketAIModal();if(!e)return void alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."));const t=u?"image":"text",{text:n}=zhAiGetSafeSelection();h(!0),e.open(t,function(e){try{if(g&&e.content){const t=getContentAttribute(i),o=c[t]||"";if("core/list"===i&&Array.isArray(o)){const n=e.content.split("\n").filter(e=>e.trim()),i=[...o,...n];s({[t]:i})}else{let i="";n&&n.trim().length>0?(i=o.replace(n,e.content),i===o&&(i=`${o}\n\n${e.content}`)):i=o?`${o}\n\n${e.content}`:e.content,s({[t]:i})}}else u&&(e.image_url?s({url:e.image_url,alt:zhAiGetString("aiGeneratedImage","zhaket AI Generated Image")}):e.content&&s({alt:`${zhAiGetString("aiGenerated","AI Generated")}: ${e.content}`}));h(!1)}catch(e){handleAIError(e,"errorUpdatingBlock"),h(!1)}},n)}()},isActive:m,isDisabled:!1}))),d(e,t))}},"withAIToolbarAndSidebar"))}(window.wp),function(){var e=null;!function t(){(e=initZhaketAIModal())||setTimeout(t,100)}(),"undefined"!=typeof tinymce&&tinymce.PluginManager.add("ai_generator_plugin",function(t,n){t.addButton("ai_generator_btn",{text:"",icon:"zhaket-fa-icon",tooltip:zhAiGetString("generateContentWithAi","Generate Content with AI"),onclick:function(){t.setProgressState(!1);var n="";try{var i=t.getWin();if(i&&i.getSelection){var o=i.getSelection();if(o&&o.rangeCount>0)(a=o.getRangeAt(0))&&!a.collapsed&&(n=a.toString().trim())}}catch(e){}if(!n&&t.selection&&t.selection.getRng)try{var a;(a=t.selection.getRng())&&!a.collapsed&&(n=a.toString().trim())}catch(e){}if(!n&&t.selection&&t.selection.getContent)try{n=t.selection.getContent({format:"text"})||""}catch(e){}n||(n=zhAiGetSafeSelection().text||"");if(!e&&!(e=initZhaketAIModal()))return alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page.")),void t.setProgressState(!1);e.open("text",function(e){try{e.content?t.insertContent(e.content):alert(zhAiGetString("noContentGenerated","No content generated. Please try again."))}catch(e){handleAIError(e,"errorInsertingContent")}finally{t.setProgressState(!1)}},n)}})}),jQuery(document).ready(function(t){function n(){var i=t("#postimagediv .inside");if(!(i.find("#ai-classic-feat-btn").length>0)){var o=t(`<button type="button" id="ai-classic-feat-btn" class="zhaket-ai-cta-btn"><img src="${window?.zhaketAIConfig?.imagePath}zhaket-ai.svg" > ${zhAiGetString("generateImageWithAi","Generate Image with AI")}</button>`);o.on("click",function(i){if(i.preventDefault(),!e&&!(e=initZhaketAIModal()))return void alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."));var o=t(this);o.prop("disabled",!0);let a=t("#post_ID").val()||0;e.open("image",function(e){o.prop("disabled",!0),e.image_url?uploadImageToMediaLibrary(e.image_url).then(function(i){i?(t("#_thumbnail_id").val(i),t.ajax({url:window.zhaketAIConfig?.ajaxUrl||("undefined"!=typeof ajaxurl?ajaxurl:"/wp-admin/admin-ajax.php"),type:"POST",data:{action:"set-post-thumbnail",post_id:t("#post_ID").val()||0,thumbnail_id:i,_ajax_nonce:e.nonce||window.zhaketAIConfig?.postThumbnailNonce||""},success:function(e){var i="";if("string"==typeof e?i=e:e&&e.data?i="string"==typeof e.data?e.data:e.data.html||"":e&&e.html&&(i=e.html),!i)return console.warn("No HTML in response"),void o.prop("disabled",!1);var a=t("#ai-classic-feat-btn");if(a.length>0){var r=t("#postimagediv .inside");a.detach(),r.html(i),r.append(a)}else t("#postimagediv .inside").html(i),setTimeout(n,100)},error:function(){alert(zhAiGetString("imagePreviewError","Image uploaded but preview could not be updated. Please refresh the page."))},complete:function(){o.prop("disabled",!1)}})):(alert(zhAiGetString("imageUploadFailed","Image generated but could not be uploaded. Please try again.")),o.prop("disabled",!1))}).catch(function(e){handleAIError(e,"errorUploadingImage"),o.prop("disabled",!1)}):(alert(zhAiGetString("noImageUrl","No image URL received from AI generation.")),o.prop("disabled",!1))},a),setTimeout(function(){o.prop("disabled")&&o.prop("disabled",!1)},100)}),i.append(o)}}n(),t(document).ajaxComplete(function(e,t,i){i.data&&-1!==i.data.indexOf("action=get-post-thumbnail-html")&&setTimeout(n,100)})})}(),jQuery(window).on("elementor/init",function(){var e=jQuery,t=null;console.log("init elementor"),function e(){(t=initZhaketAIModal())||setTimeout(e,100)}();var n=[{widget:"heading",control:"title",type:"text",selector:".elementor-control-title"},{widget:"text-editor",control:"text",type:"text",selector:".elementor-control-text "},{widget:"text-editor",control:"editor",type:"tinymce",selector:".elementor-control-editor"},{widget:"image",control:"image",type:"image",selector:".elementor-control-image"}];function i(n,i){if(n.find(".zhaket-ai-content-cta-btn").length>0)return;var o=n.find(".elementor-control-input-wrapper");let a="image"===i.type?zhAiGetString("generateImageWithAi","Generate Image with AI"):zhAiGetString("generateTextWithAi","Generate Text with AI");var r=e(`<button type="button" class="zhaket-ai-content-cta-btn" onmousedown="event.preventDefault()"><img src="${window?.zhaketAIConfig?.imagePath}zhaket-ai.svg"> ${a}</button>`);r.on("click",function(e){e.preventDefault();var o=elementor.getPanelView().getCurrentPageView();!function(e,n,i){if(t||(t=initZhaketAIModal())){var o="image"===e.type?"image":"text";t.open(o,function(t){try{if("text"===e.type&&t.content){var o=i.find("input, textarea");o.length?o.val(t.content).trigger("input"):n.options.model.setSetting(e.control,t.content)}else if("tinymce"===e.type&&t.content){var a=i.find(".wp-editor-area").attr("id"),r=window.tinyMCE?window.tinyMCE.get(a):null;r&&!r.isHidden()?(r.setContent(t.content),r.save(),r.fire("change")):i.find("textarea.wp-editor-area").val(t.content).trigger("input").trigger("change"),n.options.model.setSetting(e.control,t.content)}else if("image"===e.type&&t.image_url){var l=i.find(".elementor-control-media__preview"),c=i.find(".elementor-control-media__preview img");i.find(".elementor-control-media").addClass("elementor-control-media-has-file"),c.length?c.attr("src",t.image_url):l.length&&l.css("background-image","url("+t.image_url+")"),uploadImageToMediaLibrary(t.image_url).then(function(i){var o={id:parseInt(i,10),url:t.image_url},a=null;n.options&&n.options.editedElementView?a=n.options.editedElementView.getContainer():elementor.selection&&elementor.selection.getElements().length&&(a=elementor.selection.getElements()[0].getContainer()),a&&window.$e&&window.$e.run?$e.run("document/elements/settings",{container:a,settings:{[e.control]:o}}):(n.options.model.setSetting(e.control,o),a&&a.panel&&a.panel.refresh(),n.render())}).catch(function(e){handleAIError(e,"errorUploadingImage")})}}catch(e){handleAIError(e,"errorUpdatingBlock")}})}else alert(zhAiGetString("modalNotInitialized","AI Modal is not initialized. Please refresh the page."))}(i,o,n)}),o.before(r)}var o=new MutationObserver(function(t){var o=e("#elementor-panel");n.forEach(function(e){var t=o.find(e.selector);t.length>0&&i(t,e)})}),a=setInterval(function(){var e=document.getElementById("elementor-panel");e&&(clearInterval(a),o.observe(e,{childList:!0,subtree:!0}))},500)});