Duplicate Post - Version 1.1.8

Version Description

  • Performance adjustements for PHP 8
  • Plugin prepared for translation
  • Improvements for ACF plugin kind
  • Fixed activation/deactivation issues for Pro
Download this release

Release Info

Developer iclyde
Plugin Icon wp plugin Duplicate Post
Version 1.1.8
Comparing to
See all releases

Code changes from version 1.1.7 to 1.1.8

assets/js/cdp-bulk.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(o){$bulktop=o("#bulk-action-selector-top"),$bulkbot=o("#bulk-action-selector-bottom"),($bulktop.length>0||$bulkbot.length>0)&&(0==$bulktop.find('[value="cdp_bulk_copy"]').length&&$bulktop.append('<option value="cdp_bulk_copy">Copy</option>'),0==$bulkbot.find('[value="cdp_bulk_copy"]').length&&$bulkbot.append('<option value="cdp_bulk_copy">Copy</option>'),o("#cdp-current-post-id").remove())});
1
+ jQuery(document).ready(function(o){$bulktop=o("#bulk-action-selector-top"),$bulkbot=o("#bulk-action-selector-bottom"),($bulktop.length>0||$bulkbot.length>0)&&(0==$bulktop.find('[value="cdp_bulk_copy"]').length&&$bulktop.append('<option value="cdp_bulk_copy">'+cdpBulkJS.strOptCopy+"</option>"),0==$bulkbot.find('[value="cdp_bulk_copy"]').length&&$bulkbot.append('<option value="cdp_bulk_copy">'+cdpBulkJS.strOptCopy+"</option>"),o("#cdp-current-post-id").remove())});
assets/js/cdp-global.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){let e=t("#cdp-purl").val(),i=[];function o(){setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:token}).done(()=>{delete i[i.findIndex(t=>t===token)]}).fail(()=>{o(token)})},500*i.length)}function n(){let e=t(".cdp-dd-item").length,i=t(".cdp-dd-d").length,o=t(".cdp-dd-ud").length;i<=0?(t(".cdp-done-notis, .cdp-done-notis").addClass("cdp-noti-hide"),t(".cdp-done-hr").hide()):(t(".cdp-done-notis, .cdp-done-notis").removeClass("cdp-noti-hide"),t(".cdp-done-hr").show()),o<=0?(t(".cdp-undone-notis, .cdp-undone-notis").addClass("cdp-noti-hide"),t(".cdp-undone-hr").hide()):(t(".cdp-undone-notis, .cdp-undone-notis").removeClass("cdp-noti-hide"),t(".cdp-undone-hr").show()),e<=0?t(".cdp-admin-bar-noti").addClass("cdp-noti-hide"):t(".cdp-admin-bar-noti").removeClass("cdp-noti-hide"),t(".cdp-notis-counter").text(t(".cdp-bnew-notis").length)}if(t("body").on("click",".cdp-notification .cdp-times-button",t.cdpRemoveNotifiaction),t("body").on("mouseover",".cdp-bnew-notis",function(){let e=parseInt(t(".cdp-notis-counter").text()),n=t(".cdp-bnew-notis").length,s=t(this).attr("data-token");t(this).hasClass("cdp-bnew-notis")&&e-1>=0&&(t(this).removeClass("cdp-bnew-notis"),t(".cdp-notis-counter").text(e-1));(e>0||n>0)&&(i.push(s),setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:s}).done(()=>{delete i[i.findIndex(t=>t===s)]}).fail(()=>{o()})},500*i.length))}),t("body").on("mouseover",".cdp-dropdown-left",function(){if(!t(this).hasClass("tooltipstered")){let e=t(t(this).parents(".cdp-dd-d")[0]),i=e.attr("data-fdate");if(fdate=e.attr("data-ftext"),!fdate)return;i=i?`<br>${i}`:"",t(this).tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"left",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:`${fdate}${i}`,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t(this).tooltipster("open")}}),t("body").on("click",".cdp-dropdown-clear-all-notis",function(e){e.preventDefault(),t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"clear_crons"}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status){let e=t(".cdp-dd-item");e.hide(300),setTimeout(()=>{e.remove(),n()},300),t.cdpNotification("success","Tasks cleared!")}else"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error","We couldn't update task list, please try again later or kill tasks individualy.")}).fail(e=>{t.cdpNotification("error","We couldn't update task list, please try again later or kill tasks individualy.")})}),t("body").on("click",".cdp-noti-hide-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_hide_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success","The task has been hidden")):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error","There was an error and we couldn't hide the task.")}).fail(()=>{t.cdpNotification("error","There was an error and we couldn't hide the task.")})}),t("body").on("click",".cdp-noti-kill-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_kill_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success","The task has been killed")):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error","There was an error and we couldn't kill the task.")}).fail(()=>{t.cdpNotification("error","There was an error and we couldn't kill the task.")})}),t("body").on("click",".cdp-review-button",function(){function e(){t("#cdp-review-notice").css({"max-height":`${t("#cdp-review-notice").height()}px`,opacity:1}),t("#cdp-review-notice").animate({"max-height":"0px",opacity:0},300)}function i(i){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"review_dismiss",decision:i}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),"success"!=i.status&&t.cdpNotification("warning","There was an issue while dismissing banner, please do it next time again."),e()}).fail(i=>{t.cdpNotification("error","Cannot send dismiss request. Are you connected to the internet?"),e()})}"cdp-review-review"==t(this).attr("id")?(i("hide"),t.cdpNotification("success","Thank you very much for the review, this banner will not appear again!")):"cdp-review-already"==t(this).attr("id")?(i("hide"),t.cdpNotification("success","Thank you very much for the review, this banner will not appear again!")):"cdp-review-later"==t(this).attr("id")?(i("remind"),t.cdpNotification("success","Alright! We will ask you again in 14 days!")):(i("hide"),t.cdpNotification("success","This banner will not appear again, if any feature is missing you can ask for it on our support forum!"))}),t("body").on("mouseenter","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:1})}),t("body").on("mouseleave","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:0})}),t(".cdp-copy-loader-overlay").length>0&&t(".cdp-copy-loader-overlay").prependTo("body"),t("#cdp-show-copy-banner").length>0&&(t(".cdp-copy-alert-success").prependTo("body"),setTimeout(()=>{"-28"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3)},110)),t(".cdp-preloader-c").hasClass("cdp_is_cool_installed")&&setTimeout(()=>{t.cdpNotification("info","Plugin has been installed successfully, feel free to check those awesome features!",3e3)},500),"undefined"!=typeof pagenow&&["toplevel_page_copy-delete-posts","plugins"].includes(pagenow)){let i=`background:url('${`${e}/assets/imgs/stars.gif`}')`;t('[data-slug="copy-delete-posts-premium"]').find("strong").html(`<span style="">Copy & Delete Posts <b style="color: orange; ${i}">Premium</b></span>`)}t.cdpTooltipsTop(),t("#cdp-review-notice").find(".notice-dismiss").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!1,distance:-4,side:"top",contentAsHTML:!0,maxWidth:800,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:"It will hide this banner just for now.",theme:["tooltipster-noir","tooltipster-noir-customized","cdp-banner","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t("#cdp-copy-modal-global").length>0&&t("#cdp-copy-modal-global").appendTo("body")}),function(t){t.extend({cdpNotification:function(e="default",i="There was an error with this notification.",o=7e3){t(".cdp-notification-box").length<=0&&t("body").prepend(t('<div class="cdp-notification-box"></div>')),e="default"==e?"":"success"==e?" is-success":"warning"==e?" is-warning":"error"==e?" is-danger":" is-info";let n=Math.floor(Math.random()*Math.floor(64e3)),s=`<div style="display: none;" id="ntf-${n}" class="cdp-notification${e}">\n <button class="cdp-times-button">&times;</button>\n <div class="cdp-cf">\n <div class="cdp-left cdp-alert-icon"><div class="cdp-icon-bg"></div></div>\n <div class="cdp-left cdp-alert-msg-title">\n <div class="cdp-title${e}">Copy & Delete Posts</div>\n <div>${i}</div>\n </div>\n </div>\n </div>`;t(".cdp-notification-box").prepend(s);let a=t(`#ntf-${n}`);a.css({opacity:0,display:"block"});let c=a.outerWidth();a.outerHeight();a.css({right:"-35vw","font-size":"0px",width:0,padding:0,opacity:"0"}),a.animate({right:"15px",width:c,padding:"1rem 2rem 1rem 1.5rem",opacity:"1"},{duration:200,queue:!1}),a.animate({"font-size":"16px"},{duration:300,queue:!1}),setTimeout(()=>{t(`#ntf-${n}`).css({width:""})},250),setTimeout(()=>{a.animate({"font-size":"0px"},{duration:200,queue:!1}),a.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){a.remove()})},o)},cdpRemoveNotifiaction:function(){let e=t(this).parents(".cdp-notification");e.animate({"font-size":"0px"},{duration:200,queue:!1}),e.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){e.remove()})},tooltipReposition:function(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)},cdpTooltipsTop:function(){t(".cdp-tooltip-top").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"top",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}})},isJsonString:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return!0}return!1}return!0},cdpReverseString:function(e){return"string"==typeof e?""===e?"":t.cdpReverseString(e.substr(1))+e.charAt(0):e},cdpParse:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return JSON.parse(e)}return!1}return JSON.parse(e)},cdpModal:function(e){let i;(i=t("string"==typeof e?`#${e}`:`#${t(this).attr("data-modal-name")}`)).is(":hidden")&&($content=t(i.find(".cdp-modal-content")),i.css({opacity:0}),$content.css({opacity:0,top:"60%"}),i.show(),i.animate({opacity:1},300),$content.animate({opacity:1,top:"50%"},300))},cdpModalClose:function(e){let i,o=e.target,n="string"==typeof e;(o&&(t(o).hasClass("cdp-modal-times")||t(o).hasClass("cdp-modal"))||n)&&((i=n?t(`#${e}`):t(this).hasClass("cdp-modal")?t(this):t(this).parents(".cdp-modal")).is(":hidden")||($content=t(i.find(".cdp-modal-content")),i.animate({opacity:0},300),$content.animate({opacity:0,top:"60%"},300,function(){i.hide()})))}})}(jQuery);
1
+ jQuery(document).ready(function(t){let e=t("#cdp-purl").val(),i=[];function o(){setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:token}).done(()=>{delete i[i.findIndex(t=>t===token)]}).fail(()=>{o(token)})},500*i.length)}function n(){let e=t(".cdp-dd-item").length,i=t(".cdp-dd-d").length,o=t(".cdp-dd-ud").length;i<=0?(t(".cdp-done-notis, .cdp-done-notis").addClass("cdp-noti-hide"),t(".cdp-done-hr").hide()):(t(".cdp-done-notis, .cdp-done-notis").removeClass("cdp-noti-hide"),t(".cdp-done-hr").show()),o<=0?(t(".cdp-undone-notis, .cdp-undone-notis").addClass("cdp-noti-hide"),t(".cdp-undone-hr").hide()):(t(".cdp-undone-notis, .cdp-undone-notis").removeClass("cdp-noti-hide"),t(".cdp-undone-hr").show()),e<=0?t(".cdp-admin-bar-noti").addClass("cdp-noti-hide"):t(".cdp-admin-bar-noti").removeClass("cdp-noti-hide"),t(".cdp-notis-counter").text(t(".cdp-bnew-notis").length)}if(t("body").on("click",".cdp-notification .cdp-times-button",t.cdpRemoveNotifiaction),t("body").on("mouseover",".cdp-bnew-notis",function(){let e=parseInt(t(".cdp-notis-counter").text()),n=t(".cdp-bnew-notis").length,s=t(this).attr("data-token");t(this).hasClass("cdp-bnew-notis")&&e-1>=0&&(t(this).removeClass("cdp-bnew-notis"),t(".cdp-notis-counter").text(e-1));(e>0||n>0)&&(i.push(s),setTimeout(()=>{t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_saw_this_noti",noti_token:s}).done(()=>{delete i[i.findIndex(t=>t===s)]}).fail(()=>{o()})},500*i.length))}),t("body").on("mouseover",".cdp-dropdown-left",function(){if(!t(this).hasClass("tooltipstered")){let e=t(t(this).parents(".cdp-dd-d")[0]),i=e.attr("data-fdate");if(fdate=e.attr("data-ftext"),!fdate)return;i=i?`<br>${i}`:"",t(this).tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"left",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:`${fdate}${i}`,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t(this).tooltipster("open")}}),t("body").on("click",".cdp-dropdown-clear-all-notis",function(e){e.preventDefault(),t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"clear_crons"}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status){let e=t(".cdp-dd-item");e.hide(300),setTimeout(()=>{e.remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTasksCleared)}else"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTasksUpdateIssue)}).fail(e=>{t.cdpNotification("error",cdpGlobalJS.strTasksUpdateIssue2)})}),t("body").on("click",".cdp-noti-hide-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_hide_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTaskHide)):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTaskHideIssue)}).fail(()=>{t.cdpNotification("error",cdpGlobalJS.strTaskHideIssue2)})}),t("body").on("click",".cdp-noti-kill-btn",function(){let e=t(this).parents(".ab-item").attr("data-token");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"try_to_kill_the_tasks",task:e}).done(e=>{t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status?(t(this).parents(".ab-item").hide(300),setTimeout(()=>{t(this).parents(".ab-item").remove(),n()},300),t.cdpNotification("success",cdpGlobalJS.strTaskKill)):"fail"==e.status?t.cdpNotification(e.type,e.msg):t.cdpNotification("error",cdpGlobalJS.strTaskKillIssue)}).fail(()=>{t.cdpNotification("error",cdpGlobalJS.strTaskKillIssue2)})}),t("body").on("click",".cdp-review-button",function(){function e(){t("#cdp-review-notice").css({"max-height":`${t("#cdp-review-notice").height()}px`,opacity:1}),t("#cdp-review-notice").animate({"max-height":"0px",opacity:0},300)}function i(i){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"review_dismiss",decision:i}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),"success"!=i.status&&t.cdpNotification("warning",cdpGlobalJS.strDissmisIssue),e()}).fail(i=>{t.cdpNotification("error",cdpGlobalJS.strDissmisRequestIssue),e()})}"cdp-review-review"==t(this).attr("id")?(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewReview)):"cdp-review-already"==t(this).attr("id")?(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewAlready)):"cdp-review-later"==t(this).attr("id")?(i("remind"),t.cdpNotification("success",cdpGlobalJS.strReviewLater)):(i("hide"),t.cdpNotification("success",cdpGlobalJS.strReviewDefault))}),t("body").on("mouseenter","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:1})}),t("body").on("mouseleave","#cdp-review-no",function(){t("#cdp-review-sad").css({opacity:0})}),t(".cdp-copy-loader-overlay").length>0&&t(".cdp-copy-loader-overlay").prependTo("body"),t("#cdp-show-copy-banner").length>0&&(t(".cdp-copy-alert-success").prependTo("body"),setTimeout(()=>{"-28"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3)},110)),t(".cdp-preloader-c").hasClass("cdp_is_cool_installed")&&setTimeout(()=>{t.cdpNotification("info",cdpGlobalJS.strCDPInstallSuccess,3e3)},500),"undefined"!=typeof pagenow&&["toplevel_page_copy-delete-posts","plugins"].includes(pagenow)){let i=`background:url('${`${e}/assets/imgs/stars.gif`}')`;t('[data-slug="copy-delete-posts-premium"]').find("strong").html('<span style="">'+cdpGlobalJS.strCDPInfo+` <b style="color: orange; ${i}">`+cdpGlobalJS.strCDPInfoPremium+"</b></span>")}t.cdpTooltipsTop(),t("#cdp-review-notice").find(".notice-dismiss").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!1,distance:-4,side:"top",contentAsHTML:!0,maxWidth:800,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},content:cdpGlobalJS.strHideBannerNow,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-banner","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}}),t("#cdp-copy-modal-global").length>0&&t("#cdp-copy-modal-global").appendTo("body")}),function(t){t.extend({cdpNotification:function(e="default",i=cdpGlobalJS.strErrWithNotif,o=7e3){t(".cdp-notification-box").length<=0&&t("body").prepend(t('<div class="cdp-notification-box"></div>')),e="default"==e?"":"success"==e?" is-success":"warning"==e?" is-warning":"error"==e?" is-danger":" is-info";let n=Math.floor(Math.random()*Math.floor(64e3)),s=`<div style="display: none;" id="ntf-${n}" class="cdp-notification${e}">\n <button class="cdp-times-button">&times;</button>\n <div class="cdp-cf">\n <div class="cdp-left cdp-alert-icon"><div class="cdp-icon-bg"></div></div>\n <div class="cdp-left cdp-alert-msg-title">\n <div class="cdp-title${e}">`+cdpGlobalJS.strCDPInfo2+`</div>\n <div>${i}</div>\n </div>\n </div>\n </div>`;t(".cdp-notification-box").prepend(s);let c=t(`#ntf-${n}`);c.css({opacity:0,display:"block"});let d=c.outerWidth();c.outerHeight();c.css({right:"-35vw","font-size":"0px",width:0,padding:0,opacity:"0"}),c.animate({right:"15px",width:d,padding:"1rem 2rem 1rem 1.5rem",opacity:"1"},{duration:200,queue:!1}),c.animate({"font-size":"16px"},{duration:300,queue:!1}),setTimeout(()=>{t(`#ntf-${n}`).css({width:""})},250),setTimeout(()=>{c.animate({"font-size":"0px"},{duration:200,queue:!1}),c.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){c.remove()})},o)},cdpRemoveNotifiaction:function(){let e=t(this).parents(".cdp-notification");e.animate({"font-size":"0px"},{duration:200,queue:!1}),e.animate({right:"-35vw",height:0,width:0,margin:0,padding:0,opacity:"0"},300,function(){e.remove()})},tooltipReposition:function(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)},cdpTooltipsTop:function(){t(".cdp-tooltip-top").tooltipster({delay:30,animationDuration:350,debug:!1,timer:30,delayTouch:[100,200],interactive:!0,distance:6,side:"top",contentAsHTML:!0,maxWidth:340,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0,functionReady:function(){setTimeout(()=>{t.tooltipReposition()},150)}})},isJsonString:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return!0}return!1}return!0},cdpReverseString:function(e){return"string"==typeof e?""===e?"":t.cdpReverseString(e.substr(1))+e.charAt(0):e},cdpParse:function(e){try{JSON.parse(e)}catch(i){if("string"==typeof e){let i=t.cdpReverseString(e).indexOf("}");i=0==i?e.length:-i,e=e.slice(e.indexOf("{"),i);try{JSON.parse(e)}catch(t){return!1}return JSON.parse(e)}return!1}return JSON.parse(e)},cdpModal:function(e){let i;(i=t("string"==typeof e?`#${e}`:`#${t(this).attr("data-modal-name")}`)).is(":hidden")&&($content=t(i.find(".cdp-modal-content")),i.css({opacity:0}),$content.css({opacity:0,top:"60%"}),i.show(),i.animate({opacity:1},300),$content.animate({opacity:1,top:"50%"},300))},cdpModalClose:function(e){let i,o=e.target,n="string"==typeof e;(o&&(t(o).hasClass("cdp-modal-times")||t(o).hasClass("cdp-modal"))||n)&&((i=n?t(`#${e}`):t(this).hasClass("cdp-modal")?t(this):t(this).parents(".cdp-modal")).is(":hidden")||($content=t(i.find(".cdp-modal-content")),i.animate({opacity:0},300),$content.animate({opacity:0,top:"60%"},300,function(){i.hide()})))}})}(jQuery);
assets/js/cdp-gutenberg.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(t){function e(e=100){"number"!=typeof e&&(e=100),setTimeout(()=>{0==t(".cdp-editor-gutenberg-copy").length&&($parent=t(".editor-post-trash").parents(".components-panel__row"),$html='<button type="button" class="components-button cdp-editor-gutenberg-copy is-button is-default is-large">Copy this</button>',t($parent).prepend($html))},e)}t(document).on("readystatechange",function(){if(e(10),$button=t(t(".edit-post-header__settings").find('.components-button.components-icon-button[aria-label="Settings"]')[0]),$button.on("click",e),t(".edit-post-sidebar__panel-tab").on("click",e),t("#cdp-original-post").length>0){let e=t("#cdp-original-post").attr("data-cdp-parent"),n=t("#cdp-original-post").attr("data-cdp-parent-url");t(".edit-post-header-toolbar").append(t(`<div class="cdp-original-info-b">This post is a duplicate of <a href="${n}" target="_blank">${e}</a></div>`))}setInterval(()=>{t(".cdp-editor-gutenberg-copy").length<=0&&e(10)},5e3),t(window).on("resize",e)})});
1
+ jQuery(document).ready(function(t){function e(e=100){"number"!=typeof e&&(e=100),setTimeout(()=>{0==t(".cdp-editor-gutenberg-copy").length&&($parent=t(".editor-post-trash").parents(".components-panel__row"),$html='<button type="button" class="components-button cdp-editor-gutenberg-copy is-button is-default is-large">'+cdpGutenbergJS.cdpCopy+"</button>",t($parent).prepend($html))},e)}t(document).on("readystatechange",function(){if(e(10),$button=t(t(".edit-post-header__settings").find('.components-button.components-icon-button[aria-label="Settings"]')[0]),$button.on("click",e),t(".edit-post-sidebar__panel-tab").on("click",e),t("#cdp-original-post").length>0){let e=t("#cdp-original-post").attr("data-cdp-parent"),n=t("#cdp-original-post").attr("data-cdp-parent-url");t(".edit-post-header-toolbar").append(t(`<div class="cdp-original-info-b">This post is a duplicate of <a href="${n}" target="_blank">${e}</a></div>`))}setInterval(()=>{t(".cdp-editor-gutenberg-copy").length<=0&&e(10)},5e3),t(window).on("resize",e)})});
assets/js/cdp-modal.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(o){o("#cdp-purl").val();let t="default";function e(){o.cdpModal("cdp-copy-modal-global");let t=o(".cdp-modal-input-profiles-r").val();o('[name="tooltip-which-profile-second"]').val(t),o('.cdp-input-dynamic[name="tooltip-which-profile-second"]').trigger("change")}function n(){if(o("#cdp-current-post-id").length>0)return[o("#cdp-current-post-id").val()];$rows=o("#the-list").find("tr"),$ids=[];for(var t=0;t<$rows.length;t++){let e=o($rows[t]);e.find('input[name="post[]"]').is(":checked")&&$ids.push(e.find('input[name="post[]"]').attr("value"))}return $ids}function c(t=(()=>{})){window.onbeforeunload=null,$e=o(".cdp-copy-loader-overlay"),$e.is(":hidden")||$e.animate({opacity:0},300,function(){$e.hide(),t(!0)})}o(".cdp-admin-bar-copy").on("click",e),o("body").on("click",".cdp-editor-gutenberg-copy",e),o("body").on("click",".cdp-copy-btn-editor",e),o("body").on("click",".cdp-copy-modal-button",function(){let e=o(this).attr("data-cdp-btn"),i=["copy-quick","copy-custom","copy-custom-link"];if(i.includes(e)){let a={type:e},p=n(),l=o(".cdp-modal-checkboxes").find(".cdp-modal-option-r");if(p.length<=0)return void o.cdpNotification("warning","Please select at least one row to copy and try again.");let d=o(".cdp-modal-input-profiles-r").val();a.custom={},a.times=o(".cdp-modal-input-times").val(),a.site=o(".cdp-modal-input-site").val(),a.swap="2"==o(".cdp-swap").val()?"true":"false",a.profile=d;let s=["clear","custom","custom_named","null","undefined",null,void 0];if(d&&!s.includes(d)&&(t=d),!a.profile){if(!t||s.includes(t))return o.cdpNotification("warning","Please select basic settings for this copy."),void c();a.profile=t}for(let t=0;t<l.length;++t)a.custom[o(l[t]).attr("name")]=o(l[t]).is(":checked");setTimeout(()=>{let t=o.tooltipster.instances();for(instance in t)t[instance].close()},10),function(t=(()=>{})){window.onbeforeunload=(()=>"Copy in progress..."),$e=o(".cdp-copy-loader-overlay"),$e.is(":hidden")&&($e.show(),$e.animate({opacity:1},300,function(){t(!0)}))}(()=>{o.ajax({type:"POST",url:ajaxurl,data:{action:"cdp_action_handling",token:"cdp",f:"copy_post",origin:"modal",id:p,data:a},timeout:0}).done(function(t){o.isJsonString(t)&&(t=o.cdpParse(t));"error"==t.status?o.cdpNotification("error","Something went wrong and we couldn't copy this post – please try again!"):(c(),e==i[2]||t.link&&t.link.length>0?"pConv"==t.link?(o.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3),o.cdpModalClose("cdp-copy-modal-global")):window.location.href=t.link:"undefined"==typeof pagenow||"post"==pagenow||"page"==pagenow?(o.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3),o.cdpModalClose("cdp-copy-modal-global")):location.reload())}).fail(function(t){o.cdpNotification("error","Something went wrong and we couldn't copy this post. – See dev console for more info."),c(),console.log(t),console.log(t.responseText)})})}else o.cdpNotification("Couldn't recognize that button, please try again.")}),o("body").on("change",".cdp-modal-input-profiles-r",function(){let e=["clear","custom","custom_named","null","undefined",null,void 0];o(this).val()&&!e.includes(o(this).val())&&(t=o(this).val())}),o("#posts-filter").on("submit",function(t){"cdp_bulk_copy"==o("#bulk-action-selector-top").val()&&(t.preventDefault(),$ids=n(),$ids.length<=0?o.cdpNotification("warning","Please select at least one row to copy."):e())})});
1
+ jQuery(document).ready(function(o){o("#cdp-purl").val();let t="default";function e(){o.cdpModal("cdp-copy-modal-global");let t=o(".cdp-modal-input-profiles-r").val();o('[name="tooltip-which-profile-second"]').val(t),o('.cdp-input-dynamic[name="tooltip-which-profile-second"]').trigger("change")}function c(){if(o("#cdp-current-post-id").length>0)return[o("#cdp-current-post-id").val()];$rows=o("#the-list").find("tr"),$ids=[];for(var t=0;t<$rows.length;t++){let e=o($rows[t]);e.find('input[name="post[]"]').is(":checked")&&$ids.push(e.find('input[name="post[]"]').attr("value"))}return $ids}function i(t=(()=>{})){window.onbeforeunload=null,$e=o(".cdp-copy-loader-overlay"),$e.is(":hidden")||$e.animate({opacity:0},300,function(){$e.hide(),t(!0)})}o(".cdp-admin-bar-copy").on("click",e),o("body").on("click",".cdp-editor-gutenberg-copy",e),o("body").on("click",".cdp-copy-btn-editor",e),o("body").on("click",".cdp-copy-modal-button",function(){let e=o(this).attr("data-cdp-btn"),n=["copy-quick","copy-custom","copy-custom-link"];if(n.includes(e)){let p={type:e},a=c(),d=o(".cdp-modal-checkboxes").find(".cdp-modal-option-r");if(a.length<=0)return void o.cdpNotification("warning",cdpModalJS.strRowCopyTryAgain);let l=o(".cdp-modal-input-profiles-r").val();p.custom={},p.times=o(".cdp-modal-input-times").val(),p.site=o(".cdp-modal-input-site").val(),p.swap="2"==o(".cdp-swap").val()?"true":"false",p.profile=l;let s=["clear","custom","custom_named","null","undefined",null,void 0];if(l&&!s.includes(l)&&(t=l),!p.profile){if(!t||s.includes(t))return o.cdpNotification("warning",cdpModalJS.strSettCopyIssue),void i();p.profile=t}for(let t=0;t<d.length;++t)p.custom[o(d[t]).attr("name")]=o(d[t]).is(":checked");setTimeout(()=>{let t=o.tooltipster.instances();for(instance in t)t[instance].close()},10),function(t=(()=>{})){window.onbeforeunload=(()=>cdpModalJS.strCopyInProgress),$e=o(".cdp-copy-loader-overlay"),$e.is(":hidden")&&($e.show(),$e.animate({opacity:1},300,function(){t(!0)}))}(()=>{o.ajax({type:"POST",url:ajaxurl,data:{action:"cdp_action_handling",token:"cdp",f:"copy_post",origin:"modal",id:a,data:p},timeout:0}).done(function(t){o.isJsonString(t)&&(t=o.cdpParse(t));"error"==t.status?o.cdpNotification("error",cdpModalJS.strPostCopyIssue):(i(),e==n[2]||t.link&&t.link.length>0?"pConv"==t.link?(o.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3),o.cdpModalClose("cdp-copy-modal-global")):window.location.href=t.link:"undefined"==typeof pagenow||"post"==pagenow||"page"==pagenow?(o.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==o(".cdp-copy-alert-success").position().top&&o(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3),o.cdpModalClose("cdp-copy-modal-global")):location.reload())}).fail(function(t){o.cdpNotification("error",cdpModalJS.strPostCopyIssueConsoleInfo),i(),console.log(t),console.log(t.responseText)})})}else o.cdpNotification(cdpModalJS.strRecogBtnIssue)}),o("body").on("change",".cdp-modal-input-profiles-r",function(){let e=["clear","custom","custom_named","null","undefined",null,void 0];o(this).val()&&!e.includes(o(this).val())&&(t=o(this).val())}),o("#posts-filter").on("submit",function(t){"cdp_bulk_copy"==o("#bulk-action-selector-top").val()&&(t.preventDefault(),$ids=c(),$ids.length<=0?o.cdpNotification("warning",cdpModalJS.strRowCopyIssue):e())})});
assets/js/cdp.min.js CHANGED
@@ -1 +1 @@
1
- function cdp_tooltips_update_content(){if(jQuery("select").niceSelect("update"),!(void 0!==jQuery.cdp&&void 0!==jQuery.cdp.isPremium)||!jQuery.cdp.isPremium()){jQuery(".cdp-premium-in-select").find('.option[data-value="premium"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-option-premium").find('.option[data-value="3"]').addClass("cdp-tooltip-premium disabled"),$prems=jQuery(".cdp-tooltip-premium");for(let t=0;t<$prems.length;t++){let e=$prems[t],o=-15;isNaN(parseInt(jQuery(e).attr("data-top")))||(o=parseInt(jQuery(e).attr("data-top"))),jQuery(e).tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:o,side:"top",content:'This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0})}jQuery(".cdp-tooltip-premium-dc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:'This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0})}}function cdp_totally_know_what_i_am_doing(t){if("really"!=t)return"Are you REALLY sure?";console.log("You're crazy! – Here is the output:");let e=jQuery;e("#cdp-purl").val();e.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"debug_function"}).done(t=>{console.log(t),console.log("–––––––––––––- END OF THE DEBUG OUTPUT –––––––––––––- ")})}jQuery(document).ready(function(t){t("#cdp-purl").val();let e=null,o="default",i=null,c=null,n=null,d=null,p=null,s=null,a=null;const l=void 0!==t.cdp&&void 0!==t.cdp.isPremium;function r(e=null,o=!1){let i=this;"string"==typeof e&&(i=`.${e}`),0!=o&&(i=o),$parent=t(t(i).parents(".cdp-collapsible")[0]),$arrow=$parent.find(".cdp-arrow"),$body=$parent.find(".cdp-collapsible-content"),$title=$parent.find(".cdp-collapsible-title"),$titles=t(".cdp-collapsible-title"),group=$parent.attr("data-cdp-group"),height=$body.prop("scrollHeight"),$oArrows=t(`.cdp-collapsible[data-cdp-group="${group}"]`).not($parent).find(".cdp-arrow"),$oBodies=t(`.cdp-collapsible[data-cdp-group="${group}"]`).not($parent).find(".cdp-collapsible-content"),$body.hasClass("cdp-active")?($body.removeClass("cdp-active"),$titles.removeClass("cdp-active"),$oBodies.removeClass("cdp-active"),$arrow.removeClass("cdp-arrow-down").addClass("cdp-arrow-left"),$body.css({"max-height":""})):($titles.removeClass("cdp-active"),$body.addClass("cdp-active"),$title.addClass("cdp-active"),$oBodies.removeClass("cdp-active"),$arrow.removeClass("cdp-arrow-left").addClass("cdp-arrow-down"),$oArrows.removeClass("cdp-arrow-down").addClass("cdp-arrow-left"),$body.css({"max-height":`${height+30}px`}),$oBodies.css({"max-height":""}))}function u(){let e=t(".cdp-names-prefix").text(),o=t(".cdp-names-suffix").text(),i={year:(c=new Date).getFullYear(),month:("0"+(c.getMonth()+1)).slice(-2),day:c.getDate()<=9?"0"+c.getDate():c.getDate(),hour:c.getHours()<=9?"0"+c.getHours():c.getHours(),minute:c.getMinutes()<=9?"0"+c.getMinutes():c.getMinutes(),second:c.getSeconds()<=9?"0"+c.getSeconds():c.getSeconds(),week:c.getDay()};var c;let n="(blank)"==t(".cdp-togglable-name-b").text()?"":"(Name of original)",d=`${e.trim()} ${n} ${o.trim()}`;d=d.replace(/\[Counter\]/g,"2");let p=t(".cdp-date-picked").val();"1"==p?d=d.replace(/\[CurrentDate\]/g,`${i.month}/${i.day}/${i.year}`):"2"==p?d=d.replace(/\[CurrentDate\]/g,`${i.day}/${i.month}/${i.year}`):"3"==p&&function(e){let o=t(".cdp-custom-date-picking").val();t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_formatted_time",format:o}).done(t=>{e(t)}).fail(()=>{e(!1)})}(e=>{d=d.replace(/\[CurrentDate\]/g,`${e}`),t(".cdp-example-name").text(d),d=(d=d.replace(/\[CurrentTime\]/g,`${i.hour}:${i.minute}:${i.second}`)).replace(/\s+/gim," "),t(".cdp-example-name").text(d)}),"3"!=p&&(d=(d=d.replace(/\[CurrentTime\]/g,`${i.hour}:${i.minute}:${i.second}`)).replace(/\s+/gim," "),t(".cdp-example-name").text(d))}function h(e=""){before=t(e).html(),text=t(e).html(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],text=text.replace(/\[Counter\]/g,$picks[0]),text=text.replace(/\[CurrentDate\]/g,$picks[2]),text=text.replace(/\[CurrentTime\]/g,$picks[1]),text!=before&&t(e).html(text)}function m(){val=t('.cdp-other-options[name="after_copy"]').val(),2==val?t(".cdp-if-edit-page-selected").show(300):t(".cdp-if-edit-page-selected").is(":hidden")||t(".cdp-if-edit-page-selected").hide(300),setTimeout(()=>{jQuery(".cdp-oth-section").css({"max-height":""}),jQuery(".cdp-oth-section").css({"max-height":jQuery(".cdp-oth-section").height()})},310)}function f(i=!1){let c=t(this).attr("data-cdp-btn");1==i&&(c="copy-quick");let n=["copy-quick","copy-custom","copy-custom-link"],d=t(".cdp-modal-checkboxes").find(".cdp-input-dynamic");if(n.includes(c)){let i={type:c};if(c==n[0]){if(i.times=t(".cdp-modal-input-times-tooltip").val(),i.site=t('.cdp-input-dynamic[name="tooltip-which-site-first"]').val(),i.profile=t('.cdp-input-dynamic[name="tooltip-which-profile-first"]').val(),i.swap="2"==t(".cdp-swap").val()?"true":"false",!i.profile||"custom"==i.profile)return t.cdpNotification("warning","Please select settings for this copy."),void w()}else if(c==n[1]||c==n[2]){i.times=t('.cdp-modal-input-times[name="tooltip-which-times-second"]').val(),i.site=t('.cdp-input-dynamic[name="tooltip-which-site-second"]').val(),i.profile=t('.cdp-input-dynamic[name="tooltip-which-profile-second"]').val(),i.swap="2"==t(".cdp-swap").val()?"true":"false",i.custom={};for(let e=0;e<d.length;++e)i.custom[t(d[e]).attr("name")]=t(d[e]).is(":checked")}if(isNaN(parseInt(i.times))||parseInt(i.times)<=0)return void t.cdpNotification("warning","You need to insert positive number for copies.");i.profile&&!["custom","clear","custom_named"].includes(i.profile)||(i.profile=o),z(),function(e=(()=>{})){window.onbeforeunload=(()=>"Copy in progress..."),$e=t(".cdp-copy-loader-overlay"),$e.is(":hidden")&&($e.show(),$e.animate({opacity:1},300,function(){e(!0)}))}(()=>{t.ajax({type:"POST",url:ajaxurl,data:{action:"cdp_action_handling",token:"cdp",f:"copy_post",origin:"tooltip",id:[e],data:i},timeout:0}).done(function(e){w(),t.isJsonString(e)&&(e=t.cdpParse(e)),"error"==e.status?t.cdpNotification("error","Something went wrong and we couldn't copy this post – please try again!"):c==n[2]||void 0!==e.link&&e.link.length>0?"pConv"==e.link?(t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3)):window.location.href=e.link:location.reload()}).fail(function(e){t.cdpNotification("error","Something went wrong and we couldn't copy this post. – See dev console for more info."),w(),console.log(e),console.log(e.responseText)})})}else t.cdpNotification("Couldn't recognize that button, please try again.")}function g(e,i=!1){let c=t('.cdp-input-dynamic[name="tooltip-which-profile-second"]'),n=t(".cdp-modal-checkboxes").find(".cdp-input-dynamic"),d=c.length>1?t(t(c[1])):t(t(c[0]));t(c[1])&&t(c[1])||(null==t(c[1])&&t(c[0])?d=t(t(c[0])):null==t(c[0])&&t(c[1])&&(d=t(t(c[1]))));let p=d.val();0==e&&(p=i),"custom_named"==p?c.val("custom_named"):"custom"==p||null==p||null==p?c.val("custom"):"clear"==p?(0!=e&&e.preventDefault(),n.prop("checked",!1),c.val("custom")):!["clear","custom","custom_named"].includes(p)&&p.length>=1?v(p,function(e){for(let o in e)"object"!=typeof o&&t(`.cdp-input-dynamic[name="${o}"]`).prop("checked",y(e[o]))}):(0!=e&&e.preventDefault(),t.cdpNotification("warning","Unable to recognize selected profile, please try again.")),0==e&&c.val(p),["clear","custom","custom_named"].includes(p)||(o=p),cdp_tooltips_update_content()}function y(t){return"string"==typeof t&&"true"==t.trim().toLowerCase()}function v(e="default",o){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_settings",profile:e}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),e.status&&"error_no_exists"==e.status){t.cdpNotification("warning","Profile you selected is just empty, please update this profile or use custom settings!");let e={},i=t(".cdp-modal-option-r");for(let o=0;o<i.length;o++)e[t(i[o]).attr("name")]=t(i[o]).is(":checked");o(!1)}else o(e)}).fail(e=>{t.cdpNotification("error","Something went wrong and we couldn't get profile settings. – Check console for more details"),console.log("Copy & Delete Post – Error"),console.log(e),console.log("––––––––––––––––––––––––––"),o(!1)})}function b(){t(this).attr("class");let e=parseInt(t(this).val());e<=0&&(e=1),e>9999&&(e=9999),isNaN(e)&&(e=1),e||(e=1),t(".cdp-modal-input-times").val(e),t(".cdp-modal-input-times-tooltip").val(e),e>50?(t(".cdp-error-span-tooltip").show(300),t(".cdp-tooltip-before").attr("style","height: calc(225px - 20px - 16px) !important")):(t(".cdp-error-span-tooltip").hide(300),t(".cdp-tooltip-before").attr("style","")),e>1?(t(".cdp-multiple-tooltip-count").animate({opacity:1},200),t('.cdp-tooltip-btn-copy[data-cdp-btn="copy-custom-link"]').hide()):(t(".cdp-multiple-tooltip-count").animate({opacity:0},200),t('.cdp-tooltip-btn-copy[data-cdp-btn="copy-custom-link"]').show()),setTimeout(()=>{L()},310)}function w(e=(()=>{})){window.onbeforeunload=null,$e=t(".cdp-copy-loader-overlay"),$e.is(":hidden")||$e.animate({opacity:0},300,function(){$e.hide(),e(!0)})}function x(){let e=t(".cdp-profile-selected").val();var o,i;v(e,c=>{if(t.isJsonString(c)||"object"==typeof c){"object"!=typeof c&&(c=JSON.parse(c));let n=["usmplugin","yoast","woo"];for(k in c)"names"==k?(t(".cdp-names-prefix").html(c[k].prefix),t(".cdp-names-suffix").html(c[k].suffix),"3"!=c[k].format||l||(c[k].format="1"),t(".cdp-date-picked").val(c[k].format),t(".cdp-custom-date-picking").val(c[k].custom)):(!n.includes(k)||n.includes(k)&&l&&t.cdp.isPremium())&&t(`.cdp-data-set[data-cdp-opt="${k}"]`).prop("checked","true"==c[k]);cdp_tooltips_update_content(),u(),m(),l&&t.cdp.isPremium()&&t.cdp.premium.detectChangeOfCustom(),T(),h(".cdp-names-prefix"),h(".cdp-names-suffix"),o=e,i=(()=>{}),t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"set_default_profile",selection:o}).done(t=>{i(t)}).fail(()=>{i(!1)})}else t.cdpNotification("warning","There was an error while getting data from server, please try again.")})}function $(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=t(".cdp-input-d-id").length,o=t(".cdp-input-d-id:checked").length;o==e?t(".cdp-d-select-all").text("Deselect all"):t(".cdp-d-select-all").text("Select all"),t(".cdp-t-d-ct").text(o),$visible=t(".cdp-input-d-id:visible").length,$visible_checked=t(".cdp-input-d-id:checked:visible").length,$visible==$visible_checked?t(".cdp-d-checkbox-all").prop("checked",!0):t(".cdp-d-checkbox-all").prop("checked",!1),function(){let e=t(".cdp-input-d-id").parents("tr"),o=t(".cdp-input-d-id:checked").parents("tr");e.removeClass("cdp-del"),o.addClass("cdp-del")}()}function _(e){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"give_me_current_tasks"}).done(o=>{t.isJsonString(o)&&(o=t.cdpParse(o)),"success"==o.status&&e(o.tasks)})}function C(e){let o=0,i=+new Date/1e3,c=t(".cdp-dd-item");for(let i=0;i<c.length;++i){e[t(c[i]).attr("data-token")]||t(c[i]).remove(),o++}for(task in e){let c=e[task],n=t(t(`.cdp-dd-item[data-token="${task}"]`)[0]);if(0==c.done){if(n.hasClass("cdp-dd-ud"))continue;{n.remove();let e=i-c.done>=86400;t(".cdp-dd-undone-list").append(P(c.shown,task,e,c.f)),o++}}else{if(n.hasClass("cdp-dd-d"))continue;n.remove(),t(".cdp-dd-done-list").append(S(c.data,c.shown,task,c.f)),o++}}(o>0||0==c.length)&&function(){let e=t(".cdp-dd-item").length,o=t(".cdp-dd-d").length,i=t(".cdp-dd-ud").length;o<=0?(t(".cdp-done-notis, .cdp-done-notis").addClass("cdp-noti-hide"),t(".cdp-done-hr, .cdp-done-notis").hide()):(t(".cdp-done-notis, .cdp-done-notis").removeClass("cdp-noti-hide"),t(".cdp-done-hr, .cdp-done-notis").show()),i<=0?(t(".cdp-undone-notis, .cdp-undone-notis").addClass("cdp-noti-hide"),t(".cdp-undone-hr, .cdp-undone-notis").hide()):(t(".cdp-undone-notis, .cdp-undone-notis").removeClass("cdp-noti-hide"),t(".cdp-undone-hr, .cdp-undone-notis").show()),e<=0?t(".cdp-admin-bar-noti").addClass("cdp-noti-hide"):t(".cdp-admin-bar-noti").removeClass("cdp-noti-hide"),t(".cdp-notis-counter").text(t(".cdp-bnew-notis").length)}()}function T(){$trs=t(".cdp-table tbody.cdp-ff-b1").find("tr");for(let e=0;e<$trs.length;e++){let o=t($trs[e]);o.find("input").is(":checked")?o.addClass("cdp-selected-tr-opt"):o.removeClass("cdp-selected-tr-opt")}}function j(e){if(t(".cdp-modal").is(":visible"))return;let o=window;0!=t("#wpbody").scrollTop()&&(o="#wpbody");let i=t(o).scrollTop()+2;i<=0&&(i=2),"click"!=e.type&&t(".nice-select, .nice-select .list").css({transition:"all 0s"}),t(".nice-select .list").css({"margin-top":`${-i}px`}),t("#cdpp-af-author").length>0&&(t(".ui-autocomplete").css({top:`${t("#cdpp-af-author").offset().top+40}px`}),t(".cdp-cool-datepicker").css({top:`${t(".cdpp-input-a").offset().top+40}px`})),clearTimeout(d),d=setTimeout(()=>{t(".nice-select .list").css({transition:""})},100),clearTimeout(n),n=setTimeout(()=>{let i=t(o).scrollTop()+2;i<=0&&(i=2),"click"!=e.type&&t(".nice-select .list").css({transition:"all 0s !important"}),t(".nice-select .list").css({"margin-top":`${-i}px`}),t("#cdpp-af-author").length>0&&(t(".ui-autocomplete").css({top:`${t("#cdpp-af-author").offset().top+40}px`}),t(".cdp-cool-datepicker").css({top:`${t(".cdpp-input-a").offset().top+40}px`})),clearTimeout(d),d=setTimeout(()=>{t(".nice-select .list").css({transition:""})},100)},100)}function N(){let e=t('.cdp-d-option[name="cdp-d-b-title"]').is(":checked"),o=t('.cdp-d-option[name="cdp-d-b-slug"]').is(":checked");e||o?t(".cdp-no-empty-text").html("<b>including</b> empty"):t(".cdp-no-empty-text").html("only if <u><b>not</b></u> empty")}function D(e){e.preventDefault(),$parent=t(this).parents(".cdp-collapsible"),$col=t(t($parent[0]).find(".cdp-collapsible-title")[0]),r("true",$col)}t(".cdp-intro-button").on("click",function(){let e=t(".cdp-intro").height();t(".cdp-intro").css({height:e+"px"}),t(".cdp-intro").animate({opacity:0,height:0},300,function(){t(".cdp-intro").hide(10),t("#cdp-never-intro").is(":checked")&&t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"no_intro"}).done(e=>{"error"==e&&t.cdpNotification("error","Something went wrong and we couldn't save intro settings!")}).fail(e=>{t.cdpNotification("error","Something went wrong and we couldn't save intro settings.")})}),t(".cdp-s-i-a").show(),t(".cdp-s-i-a").animate({opacity:1},300)}),t(".cdp-save-options").on("click",function(){let e=t(".cdp-data-set"),o=t(".cdp-other-inputs"),i=t(".cdp-profile-selected").val(),c=t(".cdp-names-prefix").text().replace(/\s+/g," ").trim(),n=t(".cdp-names-suffix").text().replace(/\s+/g," ").trim(),d={names:{prefix:c,suffix:n,format:t(".cdp-date-picked").val(),custom:t(".cdp-custom-date-picking").val(),display:t(t(`option[value="${t(".cdp-profile-selected").val()}"]`)[0]).text()}},p={afterCopy:t('.cdp-other-options[name="after_copy"]').val(),postConverter:t('.cdp-other-options[name="post_converter"]').val(),others:{}},s={},a=t(".cdp-other-roles");for(let e=0;e<a.length;e++)s[t(a[e]).attr("name")]=t(a[e]).is(":checked");p.roles=s;for(let o=0;o<e.length;o++)d[t(e[o]).attr("data-cdp-opt")]=!!t(e[o]).is(":checked");for(let e=0;e<o.length;e++)p.others[t(o[e]).attr("name")]=!!t(o[e]).is(":checked");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"save_options",options:d,profile:i,entire:p}).done(e=>{"success"==e?t.cdpNotification("success","All your settings were saved!",2e3):"error"==e?t.cdpNotification("error","Something went wrong and we couldn't save your settings."):t.cdpNotification("success","All your settings were saved!",2e3)}).fail(e=>{t.cdpNotification("error","Something went wrong and we couldn't save your settings. – Please check console for more info."),console.log(e)})}),t("#cdp-show-into-again").on("click",function(){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"intro_again"}).done(e=>{"error"==e&&t.cdpNotification("error","Something went wrong and we couldn't update intro settings – try again!")}).fail(e=>{t.cdpNotification("error","Something went wrong and we couldn't update intro settings. – Please check console for more info.")}),t(".cdp-s-i-a").animate({opacity:0},300,function(){t(".cdp-s-i-a").hide()}),function(){t(".cdp-intro").show().css({height:""});let e=t(".cdp-intro").height();t(".cdp-intro").css({height:"0px"}),t(".cdp-intro").animate({opacity:1,height:e+"px"},300,function(){})}()}),t(".cdp-show-projects").on("click",function(){t(".cdp-projects").is(":hidden")&&t(".cdp-projects").show(300);t(".cdp-show-projects").removeClass("cdp-pointer").animate({opacity:.5},300)}),t(".cdp-project-box").on("mouseenter",function(){t(".cdp-project-box").not(t(this)).addClass("cdp-half-opacity")}),t(".cdp-project-box").on("mouseleave",function(){t(".cdp-project-box").removeClass("cdp-half-opacity")}),t(".cdp-collapsible-title").on("click",r),t(".cdp-magic-input").on("keyup change",function(){before=t(this).html(),text=t(this).html(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],text=text.replace(/\[Counter\]/g,$picks[0]),text=text.replace(/\[CurrentDate\]/g,$picks[2]),text=text.replace(/\[CurrentTime\]/g,$picks[1]),text!=before&&t(this).html(text)}),t(".cdp-magic-input").on("focus",function(e,o){if(o)return;let i=t(this).text();" "!=i[0]&&(i="&nbsp;"+i);" "!=i[i.length-1]&&(i+="&nbsp;");t(this).html(i),h(this)}),t(".cdp-magic-input").on("mouseup",".cdp-name-box-small",function(){t(this).hide(300),setTimeout(()=>{t(this).remove(),u()},300)}),t(".cdp-support-animated").on("mouseenter",function(){t(".cdp-support-animated").not(t(this)).addClass("cdp-half-opacity")}),t(".cdp-name-clickable").on("mouseup",function(e){if(e.preventDefault(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],$box={1:".cdp-names-prefix",2:".cdp-names-real-input",3:".cdp-names-suffix"},t($box[e.which]).append($picks[t(this).attr("data-cdp-val")]),u(),e.which==e)return!1}),t(".cdp-support-animated").on("mouseleave",function(){t(".cdp-support-animated").removeClass("cdp-half-opacity")}),t(".cdp-f-einput-n").on("click","button",function(){let e=t(t(this).parents(".cdp-cf")[0]).find("input"),o=t(this).text(),i="12";"V"==o[0]?i="-51":"D"==o[0]&&(i="23");if(e.val().trim().length<=0)return void t.cdpNotification("warning","Please enter license key, currently it is empty.");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_love_squirrels",rat:e.val(),m:i}).done(o=>{t.isJsonString(o)&&(o=t.cdpParse(o)),"success"==o.status?"valid"==o.data.license?(t.cdpNotification("success","License is already active, let us reload the page!"),setTimeout(()=>{window.location.reload()},2e3)):"site_inactive"==o.data.license?(t.cdpNotification("success","License is valid, press the button again to activate!"),e.prop("disabled",!0),t(this).text("Activate")):void 0!==o.data&&void 0!==o.data.msg?(t.cdpNotification("success",o.data.msg),setTimeout(()=>{window.location.reload()},2e3)):t.cdpNotification("warning","Unknown response, please try refresh the page!"):"fail"==o.status?t.cdpNotification(o.fail.type,o.fail.msg):t.cdpNotification("error","Something went wrong and we couldn't send request, please try refresh page and try again.")}).fail(e=>{t.cdpNotification("error","Something went wrong and we couldn't send request, are you connected to the internet?")})}),t(".cdp-names-real-input, .cdp-date-picked").on("keyup change",u),t('.cdp-other-options[name="after_copy"]').on("change",m),t("body").on("change keyup",".cdp-input-dynamic",function(){$input=t(t(".cdp-tooltip-content, .cdp-modal-content").find(`[name="${t(this).attr("name")}"]`)),"checkbox"==t(this).attr("type")?$input.prop("checked",t(this).is(":checked")):t($input).is("select")?($input.val(t(this).val()),t($input).hasClass("cdp-modal-input-profiles-r")&&g(!1,t(this).val())):$input.val(t(this).val());if(cdp_tooltips_update_content(),t($input).is("select")&&t($input).hasClass("cdp-premium-modal-dropdown")){let e=t("div.cdp-premium-modal-dropdown"),o=t(t(this).parents("div")[0]).find("div.cdp-premium-modal-dropdown");"2"==o.find("li.selected").data("value")?(e.find("span.current").addClass("cdp-relative"),e.find("span.current").html('Change the type of this copy <span class="cdp-premium-icon cdp-big-icon"></span>')):e.find("span.current").removeClass("cdp-relative")}}),t("body").on("click",".cdp-tooltip-before-button",function(){let e=t('.cdp-input-dynamic[name="tooltip-which-profile-first"]').val();"custom"!=e&&g(!1,e);t(".cdp-tooltip-before-options").hide(200),setTimeout(()=>{t(".cdp-tooltip-full-options").show(200),setTimeout(()=>{L()},200)},200)}),t("body").on("click",".cdp-tooltip-btn-copy",f),t("body").on("change",'.cdp-input-dynamic[name="tooltip-which-profile-second"]',g),t("body").on("change",'.cdp-input-dynamic[name="tooltip-which-profile-first"]',function(){g(!1,t(this).val())}),t("body").on("change",".cdp-modal-checkboxes .cdp-input-dynamic",function(){t('.cdp-input-dynamic[name="tooltip-which-profile-second"]').val("custom_named"),cdp_tooltips_update_content(),g(!1,"custom_named")}),t("body").on("change",".cdp-modal-input-times-tooltip",b),t("body").on("change",".cdp-modal-input-times",b),t("body").on("click",".cdp-modal-times, .cdp-modal",t.cdpModalClose),t("body").on("click",".cdp-modal-open",t.cdpModal),t("body").on("change",".cdp-profile-selected",x),t("body").on("click",".cdp-show-more-d-title",function(e){e.preventDefault(),t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-more-d-title").is(":hidden")?(t(".cdp-more-d-title").show(300),t(this).text("(hide more options)")):(t(".cdp-more-d-title").hide(300),t(this).text("(show more options)"));setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-d-first-chapter-cb",function(){t(".cdp-d-section").css({"max-height":"",height:""});let e=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")+0,o=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")+0,i=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")+0;e+o+i>1?t(".cdp-d-option-select-parent").show(300):t(".cdp-d-option-select-parent").hide(300);setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("click",".cdp-d-search",function(){let e=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")?1:0,o=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")?1:0,n=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")?1:0;e+o+n<=0?t.cdpNotification("error","Please, check for: which duplicates you are looking for"):null==c?function(e=function(){}){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_all_posts"}).done(o=>{t.isJsonString(o)&&(o=t.cdpParse(o)),e(o)}).fail(o=>{t.cdpNotification("error","Something went wrong and we couldn't get post list. – Please check console for more info."),console.log(o),e(!1)})}(t=>{0!=t&&p(t)}):p(c);function d(t,e){let o=parseInt(e[e.length-1]);for(let i=e.length;i>0&&(o=parseInt(e[i-1]),ext=!1,t.posts.findIndex(t=>t.ID==o)>=0?ext=!0:t.pages.findIndex(t=>t.ID==o)>=0?ext=!0:t.custom.findIndex(t=>t.ID==o)>=0?ext=!0:o=!1,1!=ext);--i);return o}function p(e){let o={posts:[],pages:[],custom:[]},n={},p={};null!=c&&(o=c);let h=!!t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked"),m=!!t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked"),f=!!t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked"),g=!!t('.cdp-d-option[name="cdp-d-b-title"]').is(":checked"),y=!!t('.cdp-d-option[name="cdp-d-b-slug"]').is(":checked"),v=!!t('.cdp-d-option[name="cdp-d-c-excerpt"]').is(":checked"),b=!!t('.cdp-d-option[name="cdp-d-c-count"]').is(":checked"),w=t('.cdp-d-option-select[name="cdp-d-d-sel-which"]').val(),k=null,x=null;if(h+m+f>1&&(k=t('.cdp-d-option-select[name="cdp-d-sels-diftyp"]').val()),1==g&&(x="1"==t('.cdp-d-option[name="cdp-radio-btn-dtitles"]:checked').val()),null==c)for(post_type in e)if("meta"!=post_type)for(post in e[post_type]){post=e[post_type][post],post.post_type=post.post_type[0].toUpperCase()+post.post_type.slice(1);let i=e.meta[post.ID]._cdp_origin,c=e.meta[post.ID]._cdp_counter,n=e.meta[post.ID]._cdp_origin_title,s=r(post.post_content),a={id:post.ID,url:post.guid,slug:post.post_name,type:post.post_type,date:post.post_date,title:post.post_title,status:post.post_status,edit:post.post_modified,excerpt:post.post_excerpt,words:u(s),origin:"object"==typeof i&&d(e,i),counter:"object"==typeof c&&c[c.length-1],origin_title:"object"==typeof n&&n[0]};if(l&&t.cdp.isPremium()&&(a.content=t.cdp.premium.prepareAdvanced(s),a.author=t.cdp.premium.prepareAdvanced(post.post_author)),"object"==typeof i){let t=parseInt(i[i.length-1]);void 0===p[t]?p[t]=1:p[t]++}o[post_type].push(a)}o=function(t){let e=JSON.parse(JSON.stringify(t));return e.posts.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e.pages.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e.custom.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e}(o),null==c&&(c=o);let _=[],C=[],T=!1,j=0,N=0,D=[],P=[],S=[];if("2"==k){j=1;let t=[],e=[],i=[];1==h&&(t=o.posts),1==m&&(e=o.pages),1==f&&(i=o.custom),_=(_=[].concat(t,e,i)).sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),C=M(_)}else{let t=[],e=[],i=[];1==h&&(j+=1),1==m&&(j+=1),1==f&&(j+=1),o.posts=o.posts.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==h&&(t=M(o.posts)),o.pages=o.pages.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==m&&(e=M(o.pages)),o.custom=o.custom.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==f&&(i=M(o.custom)),C=[].concat(t,e,i)}function Q(e){1==++N&&(D=e),2==N&&(P=e),3==N&&(S=e),N==j&&function(e){for(post in $tbody=t("#cdp-d-table-tbody"),$tbody.html(""),e)$tbody.append((o=e[post],t(`<tr data-id="${o.id}">\n <td><input type="checkbox" id="cdp_in_${o.id}" class="cdp-input-d-id" name="${o.id}"/></td>\n <td><label for="cdp_in_${o.id}">${o.title}</label></td>\n <td><a href="${o.url}" target="_blank">${""!=o.slug?o.slug:o.url}</a></td>\n <td>${o.type}</td>\n <td>${o.date.slice(0,-8)}</td>\n <td>${o.words}</td>\n </tr>`)));var o;if("1"==w)for(parent in n)for(child in n[parent])t(`.cdp-input-d-id[name="${n[parent][child]}"]`).prop("checked",!0);else if("2"==w)for(parent in n){t(`.cdp-input-d-id[name="${parent}"]`).prop("checked",!0);let e=Math.max(...n[parent]);for(child in n[parent])n[parent][child]!=e&&t(`.cdp-input-d-id[name="${n[parent][child]}"]`).prop("checked",!0)}else"3"==w&&t(".cdp-input-d-id").prop("checked",!0);s=n,a=w;let c=!(g||y||v||b),d=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")+0,p=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")+0,l=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")+0;c&&d+p+l>0&&e.length>0?(t("#cdp-d-table-tbody").find("tr").attr("data-ignore",!0),i.refresh(),t(".cdp-delete-info").hide(300),t('[data-empty-info="true"]').find("div").html('You did not select any filter.<br>Click <a href="#" class="cdp-show-the-copies">here</a> to show all copies (of the selected post type) made by this plugin.'),t('[data-empty-info="true"]').addClass("cdp-customized")):i.refresh();t(".cdp-d-searchbox-c").val(""),$(),0==e.length?(t.cdpNotification("warning","No posts/pages meeting the current filter conditions."),t(".cdp-delete-info").hide(300)):t(".cdp-not-yet-search").is(":visible")||(t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-not-yet-search").show(300),t('[data-empty-info="true"]').hasClass("cdp-customized")||t(".cdp-delete-info").show(300),setTimeout(()=>{t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-d-section").css({"max-height":`${t(".cdp-d-section").height()}px`})},320))}(C=[].concat(D,P,S))}function M(e){let o=[],i=[],c=!(g||y||v||b);if(!e)return o;function d(t,e){if(t.id==e.origin&&0!=e.origin_title){let t=e.origin_title.replace(/\[Counter\]/g,e.counter);if(e.title==t)return!0}return!1}function p(t){for(let e=0;e<t.length;e++){let o=t[e];if(!i.includes(o.id))for(let n=c?0:e;n<t.length;n++){if(!t[n])continue;if(i.includes(t[n].id))continue;if(n==e)continue;let p=1==g&&(o.title==t[n].title||1==x&&d(o,t[n])),a=1==y&&I(o.slug,t[n].slug)>=.85,l=!1;l=1==p||1==a?1==v&&(""==o.excerpt||o.excerpt==t[n].excerpt):1==v&&""!=o.excerpt&&o.excerpt==t[n].excerpt;let r=1==b&&o.words==t[n].words,u=1==c&&o.id==t[n].origin&&t.findIndex(e=>e.origin==t[n].id)<=-1;!p&&g||!a&&y||!l&&v||!r&&b||!u&&c||(s(o,!0,!1),s(t[n],!1,o.id))}}Q(o)}function s(t,e=!1,c=!1){i.includes(t.id)||(1==e?n[t.id]=[]:0!=c&&n[c].push(t.id),i.push(t.id),o.push(t))}l&&t.cdp.isPremium()?t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_authors"}).done(o=>{if(t.isJsonString(o)&&(o=t.cdpParse(o)),"success"===o.status){let i=o.users;p(e=t.cdp.premium.advancedfilter(e,i))}else!1===T&&(t.cdpNotification("info","Cannot connect to the server, premium filters will not be applied."),T=!0),p(e)}).fail(()=>{!1===T&&(t.cdpNotification("info","Cannot connect to the server, premium filters will not be applied."),T=!0),p(e)}):p(e)}}function r(t){return(t=(t=(t=t.replace(/\<\!\-\-(.*?)\-\-\>/gim,"")).replace(/<[^>]*>/gim," ")).replace(/\s+/gim," ")).trim()}function u(t){return(t=t.split(" ")).length}}),t("body").on("change",".cdp-input-d-id",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),o=parseInt(t(".cdp-t-d-ct").text());t(this).is(":checked")?(o++,t(this).parents("tr").addClass("cdp-del")):(o--,t(this).parents("tr").removeClass("cdp-del"));if(t(".cdp-t-d-ct").text(o),o==e)t(".cdp-d-select-all").text("Deselect all"),t(".cdp-d-checkbox-all").prop("checked",!0);else{t(".cdp-d-select-all").text("Select all");let e=t(".cdp-input-d-id:visible");for(let o=0;o<e.length;++o){if(!t(e[o]).is(":checked")){t(".cdp-d-checkbox-all").prop("checked",!1);break}o==e.length-1&&t(".cdp-d-checkbox-all").prop("checked",!0)}}}),t("body").on("change",".cdp-d-checkbox-all",function(e){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return e.preventDefault(),void t(this).prop("checked",!1);let o=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),i=t(".cdp-d-checkbox-all").is(":checked"),c=t(".cdp-input-d-id:visible"),n=0;for(let e=0;e<c.length;++e)t(c[e]).is(":checked")&&!i?n--:!t(c[e]).is(":checked")&&i&&n++,t(c[e]).prop("checked",i);let d=parseInt(t(".cdp-t-d-ct").text())+n;t(".cdp-t-d-ct").text(d),d==o?t(".cdp-d-select-all").text("Deselect all"):t(".cdp-d-select-all").text("Select all");let p=t(".cdp-input-d-id:visible").parents("tr"),s=t(".cdp-input-d-id:visible:checked").parents("tr");p.removeClass("cdp-del"),s.addClass("cdp-del")}),t("body").on("click",".cdp-d-select-all",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),o=parseInt(t(".cdp-t-d-ct").text()),i=!0;e==o&&(i=!1);$chbs=t(".cdp-input-d-id");for(let e=0;e<$chbs.length;++e)t($chbs[e]).prop("checked",i);t(".cdp-t-d-ct").text(1==i?e:"0"),0==i?(t(".cdp-d-select-all").text("Select all"),t(".cdp-d-checkbox-all").prop("checked",!1),t(".cdp-input-d-id").parents("tr").removeClass("cdp-del")):(t(".cdp-d-checkbox-all").prop("checked",!0),t(".cdp-d-select-all").text("Deselect all"),t(".cdp-input-d-id").parents("tr").addClass("cdp-del"))}),t("body").on("click",".prev_page, .next_page, .page_link",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;t(".cdp-input-d-id:visible:checked").length==t(".cdp-input-d-id:visible").length?t(".cdp-d-checkbox-all").prop("checked",!0):t(".cdp-d-checkbox-all").prop("checked",!1)}),t("body").on("click",".cdp-d-real-delete",function e(o=!1,n=null,d=0){if(!t(".cdp-d-just-check-it").is(":checked"))return void t.cdpNotification("warning","Please check that you completed all steps, before this task!");let p=[];if(null===n){let e=t(".cdp-input-d-id:checked");for(let o=0;o<e.length;++o)p.push(parseInt(t(e[o]).attr("name")));if(0==p.length)return void t.cdpNotification("warning","Nothing to do here, please select at least one post to delete.")}else p=n;let u=t(".cdp-d-throttling").val(),h=t(".cdp-d-throttling-count").val(),m=t(".cdp-p-redirections").val(),f=!!t(".cdp-p-just-trash-them").is(":checked"),g=null,y="1"==t('.cdp-dis-en-opt[name="cdp-redirections"]').val();if("1"==u&&(!h||0==h||""==h))return void t.cdpNotification("warning","You have wrong count in throttling field, please fix.");l&&t.cdp.isPremium()&&(g=t.cdp.premium.auitd(a,s));if(p.length>801&&!0!==o){let t=Math.ceil(p.length/800);for(let o=0,i=!0;o<t;++o)o==t-1&&(i=!1),e(i,p.slice(800*o,800*o+800),o);return}t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_them",ids:p,throttling:u,thc:h,redi:m,thrs:f,auit:y,auitd:g}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status){t("#cdp-d-table-tbody").find(".cdp-del").remove();let e=c.posts.filter(t=>!p.includes(t.id)),n=c.pages.filter(t=>!p.includes(t.id)),s=c.custom.filter(t=>!p.includes(t.id));c={posts:e,pages:n,custom:s},!0!==o&&i.refresh(),$(),0==d&&t.cdpNotification("success","Deletion process started, you can close this page now and wait till the process ends!"),_(C),!0!==o&&($parent=t(".cdp-d-section").parents(".cdp-collapsible"),$col=t(t($parent[0]).find(".cdp-collapsible-title")[0]),r("true",$col))}else!0!==o&&t.cdpNotification("error",`Something went wrong and we couldn't setup the deletion task. ${"1"==u?"– Please try without throttling.":""}`)}).fail(e=>{!0!==o&&t.cdpNotification("error","Something went wrong and we couldn't setup the deletion task. – Please check console for more info."),console.log(e)})}),t("body").on("change",".cdp-d-throttling",function(){t(".cdp-d-section").css({"max-height":"",height:""}),"1"==t(this).val()?t(".cdp-d-throttling-count-p, .cdp-even-more-th-info").show(300):t(".cdp-d-throttling-count-p, .cdp-even-more-th-info").hide(300);setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-d-throttling-count",function(){let e=parseInt(t(this).val());isNaN(e)?t(this).val(1):e>=1&&e<=10240?e>=1&&e<=1&&t(this).val(1):e<1?t(this).val(1):t(this).val(10240)}),t("body").on("change",".cdp-custom-date-picking",u),t("body").on("mouseover",".cdp-tooltip-copy",function(){t(this).hasClass("tooltipstered")||(t(this).tooltipster({delay:100,timer:400,debug:!1,delayTouch:[100,200],interactive:!0,distance:4,side:"bottom",contentAsHTML:!0,content:t(".cdp-tooltip-content").html(),repositionOnScroll:!0,selfDestruction:!1,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},functionBefore:Q,functionReady:M,functionAfter:A,functionFormat:O}),t(this).tooltipster("open"),t("#cdp-hideTT").length>0&&t(".tooltipster-base").hide())}),t("body").on("keyup",".cdp-d-searchbox-c",function(){if(t('[data-empty-info="true"].cdp-customized').length>0)return;let e=t(this).val();e.length>100&&(e=e.substr(0,100));if(e=(e=e.trim().replace(/\s+/gim," ").toLowerCase()).split(" "),$trs=t("#cdp-d-table-tbody").find("tr"),$trs.length<=0)return;$trs.removeAttr("data-ignore");for(let o=0;o<$trs.length;++o){$tr=t($trs[o]),$title=t($tr.find("td")[1]).text().toLowerCase(),$url=t($tr.find("td")[2]).text().toLowerCase();let i=!1;for(let t=0;t<e.length;++t)if($title.includes(e[t]))i=!0;else{if(!$url.includes(e[t])){i=!1;break}i=!0}0==i&&$tr.attr("data-ignore","true")}clearTimeout(p),p=setTimeout(()=>{i.refresh()},20)}),t("body").on("change",".cdp-data-set",T),t("#wpbody").on("scroll",j),t(window).on("scroll",j),t("body").on("click",".nice-select",j),t("body").on("click",".cdp-show-the-copies",function(e){e.preventDefault(),t(".cdp-d-section").css({"max-height":"",height:""}),t("#cdp-d-table-tbody").find("tr").not('[data-empty-info="true"]').removeAttr("data-ignore"),t(".cdp-d-searchbox-c").val(""),t('[data-empty-info="true"]').addClass("cdp-customized"),i.refresh(),$(),t(".cdp-d-section").css({"max-height":"",height:""}),parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text())>0&&t(".cdp-delete-info").show(300);t(".cdp-not-yet-search").is(":visible")||(t(".cdp-not-yet-search").show(300),t('[data-empty-info="true"]').hasClass("cdp-customized")||t(".cdp-delete-info").show(300));setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-per-page-select-show",function(){let e=t(this).val();i.changePageSize(e)}),t("body").on("change",'.cdp-d-option[name="cdp-d-b-title"]',N),t("body").on("change",'.cdp-d-option[name="cdp-d-b-slug"]',N),t("body").on("click",".cdp-tab-element",function(){if(t(this).hasClass("cdp-tab-active"))return;if("true"==t(this).attr("data-disabled"))return;let e=t(t(`#${t(this).attr("data-box")}`)[0]),o=t(t(`#${t(".cdp-tab-active").attr("data-box")}`)[0]);if(!e||e.length<=0)return;t(".cdp-tab-active").removeClass("cdp-tab-active"),t(this).addClass("cdp-tab-active"),e.show(),e.css({"max-height":"",height:""});let i=e.height();e.css({"max-height":"0px",opacity:0}),e.animate({"max-height":i+"px",opacity:1},500,function(){let e=t(".cdp-d-section").height();t(".cdp-d-section").css({height:e+"px","max-height":e+"px"})}),t(".cdp-d-section").css({height:"","max-height":""}),o.css({"max-height":o.height()+"px",opacity:1}),o.animate({"max-height":"0px",opacity:0},500,function(){o.hide()}),setTimeout(()=>{o.css({"max-height":"",height:""}),e.css({"max-height":"",height:""})},510);let c=parseInt(t(window).height()/8);t("#wpbody").animate({scrollTop:jQuery(".cdp-d-section")[0].offsetTop-c},500)}),t("body").on("click",".cdp-premium-element",function(t){t.preventDefault()}),t("body").on("click",".cdp-go-to-names-chapter",function(e){e.preventDefault(),z(),r("cdp-name-section-cnx"),setTimeout(()=>{let e=parseInt(t(window).height()/4);t("#wpbody").animate({scrollTop:t(".cdp-name-section-cnx")[0].offsetTop-e},500)},400)}),t("body").on("click",".cdp-close-chapter",D),t("body").on("click",".cdp-save-options",D),t("body").on("click",".cdp-togglable-name-b",function(){"(Name of original)"==t(".cdp-togglable-name-b").text()?(t(".cdp-togglable-name-b").text("(blank)"),t(".cdp-togglable-name-b").tooltipster("content","Change it to (Name of original)")):(t(".cdp-togglable-name-b").text("(Name of original)"),t(".cdp-togglable-name-b").tooltipster("content","Change it to blank"));u()}),t("#cdp_jvlabelWrap-fake").on("click",function(){if(0===t("#support-cdp").length){t(t(".cdp-container")[0]).append('<script id="support-cdp" src="//code.jivosite.com/widget/MoP3Jphzts" async><\/script>'),setTimeout(function(){t("#cdp_jvlabelWrap-fake").hide()},100);var e=!1;let o=setInterval(function(){1==e&&clearInterval(o),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t(".cdp-select").niceSelect(),t(".cdp-tooltip").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:4,side:"top",contentAsHTML:!0,maxWidth:600,triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["tooltipster-noir","tooltipster-noir-customized"],repositionOnScroll:!0,functionReady:L}),t("#cdp-d-table").length>0&&(i=new IcPagination(t("#cdp-d-table"),"#cdp-d-table-pagi",{itemsOnPage:25,useParams:!1,emptylist:'<div class="cdp-center">No items to show, try with other filters!</div>'})),t(".cdp-copy-button").on("mouseup",function(){f(!0)});let P=(e,o,i,c)=>t(`<a class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-ud${0==e?" cdp-bnew-notis":""}" data-token="${o}">\n <div style="display: block; width: calc(100% - 3px);">\n <div class="cdp-dropdown-left${1==i?" cdp-red":""}">${"delete"==c?"Deleting Posts":"Auto Cleaning-up"}</div>\n <div class="cdp-dropdown-right cdp-noti-kill-btn">Kill</div>\n </div>\n </a>`),S=(e,o,i,c)=>{let n="",d="";return void 0!==e&&(void 0!==e["formated-date"]&&(n=e["formated-date"]),void 0!==e.text&&(d=e.text),""!=d&&(d='data-ftext="'+d+'" '),""!=n&&(n='data-fdate="Completed at '+n+'" ')),t(`<a ${n}${d}class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-d${0==o?" cdp-bnew-notis":""}" data-token="${i}">\n <div style="display: block; width: calc(100% - 3px);">\n <div class="cdp-dropdown-left">${"delete"==c?"Deleted Posts":"Auto Cleaned-up"}</div>\n <div class="cdp-dropdown-right cdp-noti-hide-btn">Hide</div>\n </div>\n </a>`)};function I(t,e){let o=t,i=e;t.length<e.length&&(o=e,i=t);let c=o.length;return 0==c?1:(c-function(t,e){t=t.toLowerCase(),e=e.toLowerCase();let o=new Array;for(let i=0;i<=t.length;i++){let c=i;for(let n=0;n<=e.length;n++)if(0==i)o[n]=n;else if(n>0){let d=o[n-1];t.charAt(i-1)!=e.charAt(n-1)&&(d=Math.min(Math.min(d,c),o[n])+1),o[n-1]=c,c=d}i>0&&(o[e.length]=c)}return o[e.length]}(o,i))/parseFloat(c)}function Q(o,i){z(!0),t(".cdp-tooltip-before-options").show(),t(".cdp-tooltip-full-options").hide(),$inputs=t(t(".cdp-tooltip-content").find("input, select"));for(let e=0;e<$inputs.length;++e){let o=t($inputs[e]);if("checkbox"==o.attr("type"))o.is(":checked")?o.attr("checked","checked"):o.removeAttr("checked");else if(t(o).is("select"))if("tooltip-which-profile-first"==t(o).attr("name")){let e=t(t('[name="tooltip-which-profile-first"]')[0]).val();"custom"==e||null==e?setTimeout(()=>{t('[name="tooltip-which-profile-first"]').val("custom")},50):setTimeout(()=>{t('[name="tooltip-which-profile-first"]').val(e)},50)}else{let e=t('[name="tooltip-which-profile-second"] option:selected').map(function(t,e){return this.value}).get()[0];"custom"==e||null==e?setTimeout(()=>{t('[name="tooltip-which-profile-second"]').val("custom")},50):setTimeout(()=>{t('[name="tooltip-which-profile-second"]').val(e)},50)}else o.attr("value",o.val())}return cdp_tooltips_update_content(),e=t(i.origin).attr("data-cdp-id"),!0}function M(e,o){$parent=t(o.origin).parents(".row-actions"),$parent.css({left:0});let i=t(t("a.menu-top.toplevel_page_copy-delete-posts")[0]).attr("href");t(".cdp-tooltip-info-intt").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:6,side:"top",contentAsHTML:!0,content:`Define your copy settings <a href="${i}">here</a>.`,maxWidth:400,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0}),l&&jQuery.cdp.isPremium()?t(".cdp-tooltip-premium-spc-3").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:"If you’re on a multisite you can copy it to other sites.",contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}):(t(".cdp-tooltip-premium-spc-2").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:'If you’re on a multisite you can copy it to other sites with the Premium Plugin. <a href="https://sellcodes.com/CylMIdJD" target="_blank">Order it now!</a>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t(".cdp-tooltip-premium-spc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:'This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").addClass("cdp-premium-element"),t(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").find("input, select").prop("disabled",!0),t(".cdp-tooltip-premium-spc-4").tooltipster("content",'You can copy it to other sites with the Premium Plugin.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Pre-order it now</a>'),L(),cdp_tooltips_update_content())}function A(e,o){return $parent=t(o.origin).parents(".row-actions"),$parent.css({left:""}),!1}function O(){return t(t(".cdp-tooltip-content").html())}function L(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)}function z(e=!1){if(e){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}else setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].close()},10)}if(t(".cdp-admin-bar-noti").length>0&&setInterval(()=>{_(t=>{C(t)})},7e3),t(".cdp-drag-name").draggable({containment:".cdp-drags-cont",scroll:!1,helper:"clone",revert:"invalid"}),t(".cdp-names-real-input").droppable({drop:function(e,o){$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],t(this).html(`${t(this).html()}${$picks[t(o.helper).attr("data-cdp-val")]}`),u()}}),"undefined"!=typeof pagenow&&["edit-page","edit-post"].includes(pagenow)&&t(".column-cb, .check-column").find("input").prop("checked",!1),t("#titlediv").find(".inside").length>0&&t("#cdp-original-post").length>0){let e=t("#cdp-original-post").attr("data-cdp-parent"),o=t("#cdp-original-post").attr("data-cdp-parent-url");t("#titlediv").find(".inside").append(t(`<div style="padding-left: 10px">This post is a duplicate of <a href="${o}" target="_blank">${e}</a></div>`))}t(".cdp-preloader-c").length>0&&(u(),m(),x(),setTimeout(()=>{h(".cdp-names-prefix"),h(".cdp-names-suffix")},1e3),function(){let e=t(".cdp-tab-active");for(let o=0;o<e.length;o++){let i=t(`#${t(e[o]).attr("data-box")}`);i.show(),i.css({"max-height":"",height:""});let c=i.height();t(c).css({"max-height":c+"px",height:c+"px"})}}()),setTimeout(()=>{t(".cdp-container").is(":hidden")&&t(".cdp-container").length>0&&setTimeout(()=>{jQuery(".cdp-preloader-c").hide(),jQuery(".cdp-container").css({opacity:0}),jQuery(".cdp-container").show(),jQuery("#wpfooter").show(300),jQuery(".cdp-container").animate({opacity:1},300)},400)},5e3)}),jQuery(window).on("load",function(){setTimeout(()=>{jQuery(".cdp-container").length>0&&(jQuery(".cdp-preloader-c").hide(),jQuery(".cdp-container").css({opacity:0}),jQuery(".cdp-container").show(),jQuery("#wpfooter").show(300),jQuery(".cdp-container").animate({opacity:1},300));const t=void 0!==jQuery.cdp&&void 0!==jQuery.cdp.isPremium;jQuery(".cdp-tooltip-premium-dc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:'This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t&&jQuery.cdp.isPremium()?(jQuery(".cdp-tooltip-premium-spc-3").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:"If you’re on a multisite you can copy it to other sites.",contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),jQuery(".cdp-tooltip-premium-spc-3").addClass("cdp-premium-element"),jQuery(".cdp-tooltip-premium-spc-3").find("input, select").prop("disabled",!0)):(jQuery('.cdp-option-premium [value="3"]').prop("disabled",!0),setTimeout(()=>{jQuery(".cdp-premium-in-select").find('.option[data-value="premium"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-option-premium").find('.option[data-value="3"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-tooltip-premium-spc-2").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:'If you’re on a multisite you can copy it to other sites with the Premium Plugin. <a href="https://sellcodes.com/CylMIdJD" target="_blank">Order it now!</a>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),jQuery(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").addClass("cdp-premium-element"),jQuery(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").find("input, select").prop("disabled",!0),jQuery(".cdp-tooltip-premium-spc-4").tooltipster("content",'You can copy it to other sites with the Premium Plugin.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Pre-order it now</a>'),function(t){let e=void 0!==t?t:".cdp-tooltip-premium",o=-15;isNaN(parseInt(jQuery(e).attr("data-top")))||(o=parseInt(jQuery(e).attr("data-top")));jQuery(e).tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:o,side:"top",content:'This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>',contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),i=e,jQuery(i).addClass("cdp-premium-element"),jQuery(i).find("input, select").prop("disabled",!0);var i}(),cdp_tooltips_update_content()},1e3))},400)}),function(t){function e(t,e){if(!(t.originalEvent.touches.length>1)){t.preventDefault();let o=t.originalEvent.changedTouches[0],i=document.createEvent("MouseEvents");i.initMouseEvent(e,!0,!0,window,1,o.screenX,o.screenY,o.clientX,o.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(i)}}if(t.support.touch="ontouchend"in document,t.support.touch){let o,i=t.ui.mouse.prototype,c=i._mouseInit,n=i._mouseDestroy;i._touchStart=function(t){!o&&this._mouseCapture(t.originalEvent.changedTouches[0])&&(o=!0,this._touchMoved=!1,e(t,"mouseover"),e(t,"mousemove"),e(t,"mousedown"))},i._touchMove=function(t){o&&(this._touchMoved=!0,e(t,"mousemove"))},i._touchEnd=function(t){o&&(e(t,"mouseup"),e(t,"mouseout"),this._touchMoved||e(t,"click"),o=!1)},i._mouseInit=function(){let e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),c.call(e)},i._mouseDestroy=function(){let e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),n.call(e)}}}(jQuery);
1
+ function cdp_tooltips_update_content(){if(jQuery("select").niceSelect("update"),!(void 0!==jQuery.cdp&&void 0!==jQuery.cdp.isPremium)||!jQuery.cdp.isPremium()){jQuery(".cdp-premium-in-select").find('.option[data-value="premium"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-option-premium").find('.option[data-value="3"]').addClass("cdp-tooltip-premium disabled"),$prems=jQuery(".cdp-tooltip-premium");for(let t=0;t<$prems.length;t++){let e=$prems[t],i=-15;isNaN(parseInt(jQuery(e).attr("data-top")))||(i=parseInt(jQuery(e).attr("data-top"))),jQuery(e).tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:i,side:"top",content:cdpJS.strPremFeatureHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0})}jQuery(".cdp-tooltip-premium-dc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strPremFeatureHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0})}}function cdp_totally_know_what_i_am_doing(t){if("really"!=t)return cdpJS.strAreYouSure;console.log(cdpJS.strYouAreCrazy);let e=jQuery;e("#cdp-purl").val();e.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"debug_function"}).done(t=>{console.log(t),console.log(cdpJS.strDebugOutputEnd)})}jQuery(document).ready(function(t){t("#cdp-purl").val();let e=null,i="default",o=null,c=null,d=null,n=null,p=null,s=null,a=null;const l=void 0!==t.cdp&&void 0!==t.cdp.isPremium;function r(e=null,i=!1){let o=this;"string"==typeof e&&(o=`.${e}`),0!=i&&(o=i),$parent=t(t(o).parents(".cdp-collapsible")[0]),$arrow=$parent.find(".cdp-arrow"),$body=$parent.find(".cdp-collapsible-content"),$title=$parent.find(".cdp-collapsible-title"),$titles=t(".cdp-collapsible-title"),group=$parent.attr("data-cdp-group"),height=$body.prop("scrollHeight"),$oArrows=t(`.cdp-collapsible[data-cdp-group="${group}"]`).not($parent).find(".cdp-arrow"),$oBodies=t(`.cdp-collapsible[data-cdp-group="${group}"]`).not($parent).find(".cdp-collapsible-content"),$body.hasClass("cdp-active")?($body.removeClass("cdp-active"),$titles.removeClass("cdp-active"),$oBodies.removeClass("cdp-active"),$arrow.removeClass("cdp-arrow-down").addClass("cdp-arrow-left"),$body.css({"max-height":""})):($titles.removeClass("cdp-active"),$body.addClass("cdp-active"),$title.addClass("cdp-active"),$oBodies.removeClass("cdp-active"),$arrow.removeClass("cdp-arrow-left").addClass("cdp-arrow-down"),$oArrows.removeClass("cdp-arrow-down").addClass("cdp-arrow-left"),$body.css({"max-height":`${height+30}px`}),$oBodies.css({"max-height":""}))}function u(){let e=t(".cdp-names-prefix").text(),i=t(".cdp-names-suffix").text(),o={year:(c=new Date).getFullYear(),month:("0"+(c.getMonth()+1)).slice(-2),day:c.getDate()<=9?"0"+c.getDate():c.getDate(),hour:c.getHours()<=9?"0"+c.getHours():c.getHours(),minute:c.getMinutes()<=9?"0"+c.getMinutes():c.getMinutes(),second:c.getSeconds()<=9?"0"+c.getSeconds():c.getSeconds(),week:c.getDay()};var c;let d="(blank)"==t(".cdp-togglable-name-b").text()?"":cdpJS.strTogglableName,n=`${e.trim()} ${d} ${i.trim()}`;n=n.replace(/\[Counter\]/g,"2");let p=t(".cdp-date-picked").val();"1"==p?n=n.replace(/\[CurrentDate\]/g,`${o.month}/${o.day}/${o.year}`):"2"==p?n=n.replace(/\[CurrentDate\]/g,`${o.day}/${o.month}/${o.year}`):"3"==p&&function(e){let i=t(".cdp-custom-date-picking").val();t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_formatted_time",format:i}).done(t=>{e(t)}).fail(()=>{e(!1)})}(e=>{n=n.replace(/\[CurrentDate\]/g,`${e}`),t(".cdp-example-name").text(n),n=(n=n.replace(/\[CurrentTime\]/g,`${o.hour}:${o.minute}:${o.second}`)).replace(/\s+/gim," "),t(".cdp-example-name").text(n)}),"3"!=p&&(n=(n=n.replace(/\[CurrentTime\]/g,`${o.hour}:${o.minute}:${o.second}`)).replace(/\s+/gim," "),t(".cdp-example-name").text(n))}function m(e=""){before=t(e).html(),text=t(e).html(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],text=text.replace(/\[Counter\]/g,$picks[0]),text=text.replace(/\[CurrentDate\]/g,$picks[2]),text=text.replace(/\[CurrentTime\]/g,$picks[1]),text!=before&&t(e).html(text)}function h(){val=t('.cdp-other-options[name="after_copy"]').val(),2==val?t(".cdp-if-edit-page-selected").show(300):t(".cdp-if-edit-page-selected").is(":hidden")||t(".cdp-if-edit-page-selected").hide(300),setTimeout(()=>{jQuery(".cdp-oth-section").css({"max-height":""}),jQuery(".cdp-oth-section").css({"max-height":jQuery(".cdp-oth-section").height()})},310)}function f(o=!1){let c=t(this).attr("data-cdp-btn");1==o&&(c="copy-quick");let d=["copy-quick","copy-custom","copy-custom-link"],n=t(".cdp-modal-checkboxes").find(".cdp-input-dynamic");if(d.includes(c)){let o={type:c};if(c==d[0]){if(o.times=t(".cdp-modal-input-times-tooltip").val(),o.site=t('.cdp-input-dynamic[name="tooltip-which-site-first"]').val(),o.profile=t('.cdp-input-dynamic[name="tooltip-which-profile-first"]').val(),o.swap="2"==t(".cdp-swap").val()?"true":"false",!o.profile||"custom"==o.profile)return t.cdpNotification("warning","Please select settings for this copy."),void x()}else if(c==d[1]||c==d[2]){o.times=t('.cdp-modal-input-times[name="tooltip-which-times-second"]').val(),o.site=t('.cdp-input-dynamic[name="tooltip-which-site-second"]').val(),o.profile=t('.cdp-input-dynamic[name="tooltip-which-profile-second"]').val(),o.swap="2"==t(".cdp-swap").val()?"true":"false",o.custom={};for(let e=0;e<n.length;++e)o.custom[t(n[e]).attr("name")]=t(n[e]).is(":checked")}if(isNaN(parseInt(o.times))||parseInt(o.times)<=0)return void t.cdpNotification("warning",cdpJS.strCopyNumIssue);o.profile&&!["custom","clear","custom_named"].includes(o.profile)||(o.profile=i),O(),function(e=(()=>{})){window.onbeforeunload=(()=>cdpJS.strCopyInProgress),$e=t(".cdp-copy-loader-overlay"),$e.is(":hidden")&&($e.show(),$e.animate({opacity:1},300,function(){e(!0)}))}(()=>{t.ajax({type:"POST",url:ajaxurl,data:{action:"cdp_action_handling",token:"cdp",f:"copy_post",origin:"tooltip",id:[e],data:o},timeout:0}).done(function(e){x(),t.isJsonString(e)&&(e=t.cdpParse(e)),"error"==e.status?t.cdpNotification("error",cdpJS.strCopyPostIssue):c==d[2]||void 0!==e.link&&e.link.length>0?"pConv"==e.link?(t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_success_img"}),"-28"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"32px",opacity:1},300),setTimeout(()=>{"32"==t(".cdp-copy-alert-success").position().top&&t(".cdp-copy-alert-success").animate({top:"-28px",opacity:0},300)},3e3)):window.location.href=e.link:location.reload()}).fail(function(e){t.cdpNotification("error",cdpJS.strCopyPostIssueConsInfo),x(),console.log(e),console.log(e.responseText)})})}else t.cdpNotification(cdpJS.strTooltipBtnIssue)}function g(e,o=!1){let c=t('.cdp-input-dynamic[name="tooltip-which-profile-second"]'),d=t(".cdp-modal-checkboxes").find(".cdp-input-dynamic"),n=c.length>1?t(t(c[1])):t(t(c[0]));t(c[1])&&t(c[1])||(null==t(c[1])&&t(c[0])?n=t(t(c[0])):null==t(c[0])&&t(c[1])&&(n=t(t(c[1]))));let p=n.val();0==e&&(p=o),"custom_named"==p?c.val("custom_named"):"custom"==p||null==p||null==p?c.val("custom"):"clear"==p?(0!=e&&e.preventDefault(),d.prop("checked",!1),c.val("custom")):!["clear","custom","custom_named"].includes(p)&&p.length>=1?y(p,function(e){for(let i in e)"object"!=typeof i&&t(`.cdp-input-dynamic[name="${i}"]`).prop("checked",v(e[i]))}):(0!=e&&e.preventDefault(),t.cdpNotification("warning",cdpJS.strSelectedProfIssue)),0==e&&c.val(p),["clear","custom","custom_named"].includes(p)||(i=p),cdp_tooltips_update_content()}function v(t){return"string"==typeof t&&"true"==t.trim().toLowerCase()}function y(e="default",i){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_settings",profile:e}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),e.status&&"error_no_exists"==e.status){t.cdpNotification("warning",cdpJS.strSelectedProfEmpty);let e={},o=t(".cdp-modal-option-r");for(let i=0;i<o.length;i++)e[t(o[i]).attr("name")]=t(o[i]).is(":checked");i(!1)}else i(e)}).fail(e=>{t.cdpNotification("error",cdpJS.strSelectedProfGetIssue),console.log(cdpJS.strConsLogErr),console.log(e),console.log("––––––––––––––––––––––––––"),i(!1)})}function b(){t(this).attr("class");let e=parseInt(t(this).val());e<=0&&(e=1),e>9999&&(e=9999),isNaN(e)&&(e=1),e||(e=1),t(".cdp-modal-input-times").val(e),t(".cdp-modal-input-times-tooltip").val(e),e>50?(t(".cdp-error-span-tooltip").show(300),t(".cdp-tooltip-before").attr("style","height: calc(225px - 20px - 16px) !important")):(t(".cdp-error-span-tooltip").hide(300),t(".cdp-tooltip-before").attr("style","")),e>1?(t(".cdp-multiple-tooltip-count").animate({opacity:1},200),t('.cdp-tooltip-btn-copy[data-cdp-btn="copy-custom-link"]').hide()):(t(".cdp-multiple-tooltip-count").animate({opacity:0},200),t('.cdp-tooltip-btn-copy[data-cdp-btn="copy-custom-link"]').show()),setTimeout(()=>{H()},310)}function x(e=(()=>{})){window.onbeforeunload=null,$e=t(".cdp-copy-loader-overlay"),$e.is(":hidden")||$e.animate({opacity:0},300,function(){$e.hide(),e(!0)})}function w(){let e=t(".cdp-profile-selected").val();var i,o;y(e,c=>{if(t.isJsonString(c)||"object"==typeof c){"object"!=typeof c&&(c=JSON.parse(c));let d=["usmplugin","yoast","woo"];for(k in c)"names"==k?(t(".cdp-names-prefix").html(c[k].prefix),t(".cdp-names-suffix").html(c[k].suffix),"3"!=c[k].format||l||(c[k].format="1"),t(".cdp-date-picked").val(c[k].format),t(".cdp-custom-date-picking").val(c[k].custom)):(!d.includes(k)||d.includes(k)&&l&&t.cdp.isPremium())&&t(`.cdp-data-set[data-cdp-opt="${k}"]`).prop("checked","true"==c[k]);cdp_tooltips_update_content(),u(),h(),l&&t.cdp.isPremium()&&t.cdp.premium.detectChangeOfCustom(),C(),m(".cdp-names-prefix"),m(".cdp-names-suffix"),i=e,o=(()=>{}),t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"set_default_profile",selection:i}).done(t=>{o(t)}).fail(()=>{o(!1)})}else t.cdpNotification("warning",cdpJS.strServerDataIssue)})}function $(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=t(".cdp-input-d-id").length,i=t(".cdp-input-d-id:checked").length;i==e?t(".cdp-d-select-all").text("Deselect all"):t(".cdp-d-select-all").text("Select all"),t(".cdp-t-d-ct").text(i),$visible=t(".cdp-input-d-id:visible").length,$visible_checked=t(".cdp-input-d-id:checked:visible").length,$visible==$visible_checked?t(".cdp-d-checkbox-all").prop("checked",!0):t(".cdp-d-checkbox-all").prop("checked",!1),function(){let e=t(".cdp-input-d-id").parents("tr"),i=t(".cdp-input-d-id:checked").parents("tr");e.removeClass("cdp-del"),i.addClass("cdp-del")}()}function _(e){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"give_me_current_tasks"}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),"success"==i.status&&e(i.tasks)})}function S(e){let i=0,o=+new Date/1e3,c=t(".cdp-dd-item");for(let o=0;o<c.length;++o){e[t(c[o]).attr("data-token")]||t(c[o]).remove(),i++}for(task in e){let c=e[task],d=t(t(`.cdp-dd-item[data-token="${task}"]`)[0]);if(0==c.done){if(d.hasClass("cdp-dd-ud"))continue;{d.remove();let e=o-c.done>=86400;t(".cdp-dd-undone-list").append(I(c.shown,task,e,c.f)),i++}}else{if(d.hasClass("cdp-dd-d"))continue;d.remove(),t(".cdp-dd-done-list").append(N(c.data,c.shown,task,c.f)),i++}}(i>0||0==c.length)&&function(){let e=t(".cdp-dd-item").length,i=t(".cdp-dd-d").length,o=t(".cdp-dd-ud").length;i<=0?(t(".cdp-done-notis, .cdp-done-notis").addClass("cdp-noti-hide"),t(".cdp-done-hr, .cdp-done-notis").hide()):(t(".cdp-done-notis, .cdp-done-notis").removeClass("cdp-noti-hide"),t(".cdp-done-hr, .cdp-done-notis").show()),o<=0?(t(".cdp-undone-notis, .cdp-undone-notis").addClass("cdp-noti-hide"),t(".cdp-undone-hr, .cdp-undone-notis").hide()):(t(".cdp-undone-notis, .cdp-undone-notis").removeClass("cdp-noti-hide"),t(".cdp-undone-hr, .cdp-undone-notis").show()),e<=0?t(".cdp-admin-bar-noti").addClass("cdp-noti-hide"):t(".cdp-admin-bar-noti").removeClass("cdp-noti-hide"),t(".cdp-notis-counter").text(t(".cdp-bnew-notis").length)}()}function C(){$trs=t(".cdp-table tbody.cdp-ff-b1").find("tr");for(let e=0;e<$trs.length;e++){let i=t($trs[e]);i.find("input").is(":checked")?i.addClass("cdp-selected-tr-opt"):i.removeClass("cdp-selected-tr-opt")}}function T(e){if(t(".cdp-modal").is(":visible"))return;let i=window;0!=t("#wpbody").scrollTop()&&(i="#wpbody");let o=t(i).scrollTop()+2;o<=0&&(o=2),"click"!=e.type&&t(".nice-select, .nice-select .list").css({transition:"all 0s"}),t(".nice-select .list").css({"margin-top":`${-o}px`}),t("#cdpp-af-author").length>0&&(t(".ui-autocomplete").css({top:`${t("#cdpp-af-author").offset().top+40}px`}),t(".cdp-cool-datepicker").css({top:`${t(".cdpp-input-a").offset().top+40}px`})),clearTimeout(n),n=setTimeout(()=>{t(".nice-select .list").css({transition:""})},100),clearTimeout(d),d=setTimeout(()=>{let o=t(i).scrollTop()+2;o<=0&&(o=2),"click"!=e.type&&t(".nice-select .list").css({transition:"all 0s !important"}),t(".nice-select .list").css({"margin-top":`${-o}px`}),t("#cdpp-af-author").length>0&&(t(".ui-autocomplete").css({top:`${t("#cdpp-af-author").offset().top+40}px`}),t(".cdp-cool-datepicker").css({top:`${t(".cdpp-input-a").offset().top+40}px`})),clearTimeout(n),n=setTimeout(()=>{t(".nice-select .list").css({transition:""})},100)},100)}function j(){let e=t('.cdp-d-option[name="cdp-d-b-title"]').is(":checked"),i=t('.cdp-d-option[name="cdp-d-b-slug"]').is(":checked");e||i?t(".cdp-no-empty-text").html(cdpJS.strIncludingHtml):t(".cdp-no-empty-text").html(cdpJS.strIncludingHtml2)}function J(e){e.preventDefault(),$parent=t(this).parents(".cdp-collapsible"),$col=t(t($parent[0]).find(".cdp-collapsible-title")[0]),r("true",$col)}t(".cdp-intro-button").on("click",function(){let e=t(".cdp-intro").height();t(".cdp-intro").css({height:e+"px"}),t(".cdp-intro").animate({opacity:0,height:0},300,function(){t(".cdp-intro").hide(10),t("#cdp-never-intro").is(":checked")&&t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"no_intro"}).done(e=>{"error"==e&&t.cdpNotification("error",cdpJS.strIntroSaveIssue)}).fail(e=>{t.cdpNotification("error",cdpJS.strIntroSaveIssue2)})}),t(".cdp-s-i-a").show(),t(".cdp-s-i-a").animate({opacity:1},300)}),t(".cdp-save-options").on("click",function(){let e=t(".cdp-data-set"),i=t(".cdp-other-inputs"),o=t(".cdp-profile-selected").val(),c=t(".cdp-names-prefix").text().replace(/\s+/g," ").trim(),d=t(".cdp-names-suffix").text().replace(/\s+/g," ").trim(),n={names:{prefix:c,suffix:d,format:t(".cdp-date-picked").val(),custom:t(".cdp-custom-date-picking").val(),display:t(t(`option[value="${t(".cdp-profile-selected").val()}"]`)[0]).text()}},p={afterCopy:t('.cdp-other-options[name="after_copy"]').val(),postConverter:t('.cdp-other-options[name="post_converter"]').val(),others:{}},s={},a=t(".cdp-other-roles");for(let e=0;e<a.length;e++)s[t(a[e]).attr("name")]=t(a[e]).is(":checked");p.roles=s;for(let i=0;i<e.length;i++)n[t(e[i]).attr("data-cdp-opt")]=!!t(e[i]).is(":checked");for(let e=0;e<i.length;e++)p.others[t(i[e]).attr("name")]=!!t(i[e]).is(":checked");t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"save_options",options:n,profile:o,entire:p}).done(e=>{"success"==e?t.cdpNotification("success",cdpJS.strSettingsSaved,2e3):"error"==e?t.cdpNotification("error",cdpJS.strSettingsSaveIssue):t.cdpNotification("success",cdpJS.strSettingsSaved,2e3)}).fail(e=>{t.cdpNotification("error",cdpJS.strSettingsSaveIssue2),console.log(e)})}),t("#cdp-show-into-again").on("click",function(){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"intro_again"}).done(e=>{"error"==e&&t.cdpNotification("error",cdpJS.strIntroUpdateIssue)}).fail(e=>{t.cdpNotification("error",cdpJS.strIntroUpdateIssue2)}),t(".cdp-s-i-a").animate({opacity:0},300,function(){t(".cdp-s-i-a").hide()}),function(){t(".cdp-intro").show().css({height:""});let e=t(".cdp-intro").height();t(".cdp-intro").css({height:"0px"}),t(".cdp-intro").animate({opacity:1,height:e+"px"},300,function(){})}()}),t(".cdp-show-projects").on("click",function(){t(".cdp-projects").is(":hidden")&&t(".cdp-projects").show(300);t(".cdp-show-projects").removeClass("cdp-pointer").animate({opacity:.5},300)}),t(".cdp-project-box").on("mouseenter",function(){t(".cdp-project-box").not(t(this)).addClass("cdp-half-opacity")}),t(".cdp-project-box").on("mouseleave",function(){t(".cdp-project-box").removeClass("cdp-half-opacity")}),t(".cdp-collapsible-title").on("click",r),t(".cdp-magic-input").on("keyup change",function(){before=t(this).html(),text=t(this).html(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],text=text.replace(/\[Counter\]/g,$picks[0]),text=text.replace(/\[CurrentDate\]/g,$picks[2]),text=text.replace(/\[CurrentTime\]/g,$picks[1]),text!=before&&t(this).html(text)}),t(".cdp-magic-input").on("focus",function(e,i){if(i)return;let o=t(this).text();" "!=o[0]&&(o="&nbsp;"+o);" "!=o[o.length-1]&&(o+="&nbsp;");t(this).html(o),m(this)}),t(".cdp-magic-input").on("mouseup",".cdp-name-box-small",function(){t(this).hide(300),setTimeout(()=>{t(this).remove(),u()},300)}),t(".cdp-support-animated").on("mouseenter",function(){t(".cdp-support-animated").not(t(this)).addClass("cdp-half-opacity")}),t(".cdp-name-clickable").on("mouseup",function(e){if(e.preventDefault(),$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],$box={1:".cdp-names-prefix",2:".cdp-names-real-input",3:".cdp-names-suffix"},t($box[e.which]).append($picks[t(this).attr("data-cdp-val")]),u(),e.which==e)return!1}),t(".cdp-support-animated").on("mouseleave",function(){t(".cdp-support-animated").removeClass("cdp-half-opacity")}),t(".cdp-f-einput-n").on("click","button",function(){let e=t(t(this).parents(".cdp-cf")[0]).find("input"),i=t(this).text(),o="12";"V"==i[0]?o="-51":"D"==i[0]&&(o="23");if(e.val().trim().length<=0)return void t.cdpNotification("warning",cdpJS.strLicenseKeyEmpty);t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"i_love_squirrels",rat:e.val(),m:o}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),"success"==i.status?"valid"==i.data.license?(t.cdpNotification("success",cdpJS.strLicenseActiveReloading),setTimeout(()=>{window.location.reload()},2e3)):"site_inactive"==i.data.license?(t.cdpNotification("success",cdpJS.strLicenseValidPressBtn),e.prop("disabled",!0),t(this).text("Activate")):void 0!==i.data&&void 0!==i.data.msg?(t.cdpNotification("success",i.data.msg),setTimeout(()=>{window.location.reload()},2e3)):t.cdpNotification("warning",cdpJS.strUnknownRespRefreshPage):"fail"==i.status?t.cdpNotification(i.fail.type,i.fail.msg):t.cdpNotification("error",cdpJS.strSendRequestIssue)}).fail(e=>{t.cdpNotification("error",cdpJS.strSendRequestIssue2)})}),t(".cdp-names-real-input, .cdp-date-picked").on("keyup change",u),t('.cdp-other-options[name="after_copy"]').on("change",h),t("body").on("change keyup",".cdp-input-dynamic",function(){$input=t(t(".cdp-tooltip-content, .cdp-modal-content").find(`[name="${t(this).attr("name")}"]`)),"checkbox"==t(this).attr("type")?$input.prop("checked",t(this).is(":checked")):t($input).is("select")?($input.val(t(this).val()),t($input).hasClass("cdp-modal-input-profiles-r")&&g(!1,t(this).val())):$input.val(t(this).val());if(cdp_tooltips_update_content(),t($input).is("select")&&t($input).hasClass("cdp-premium-modal-dropdown")){let e=t("div.cdp-premium-modal-dropdown"),i=t(t(this).parents("div")[0]).find("div.cdp-premium-modal-dropdown");"2"==i.find("li.selected").data("value")?(e.find("span.current").addClass("cdp-relative"),e.find("span.current").html(cdpJS.strChangeTypeOfCopy)):e.find("span.current").removeClass("cdp-relative")}}),t("body").on("click",".cdp-tooltip-before-button",function(){let e=t('.cdp-input-dynamic[name="tooltip-which-profile-first"]').val();"custom"!=e&&g(!1,e);t(".cdp-tooltip-before-options").hide(200),setTimeout(()=>{t(".cdp-tooltip-full-options").show(200),setTimeout(()=>{H()},200)},200)}),t("body").on("click",".cdp-tooltip-btn-copy",f),t("body").on("change",'.cdp-input-dynamic[name="tooltip-which-profile-second"]',g),t("body").on("change",'.cdp-input-dynamic[name="tooltip-which-profile-first"]',function(){g(!1,t(this).val())}),t("body").on("change",".cdp-modal-checkboxes .cdp-input-dynamic",function(){t('.cdp-input-dynamic[name="tooltip-which-profile-second"]').val("custom_named"),cdp_tooltips_update_content(),g(!1,"custom_named")}),t("body").on("change",".cdp-modal-input-times-tooltip",b),t("body").on("change",".cdp-modal-input-times",b),t("body").on("click",".cdp-modal-times, .cdp-modal",t.cdpModalClose),t("body").on("click",".cdp-modal-open",t.cdpModal),t("body").on("change",".cdp-profile-selected",w),t("body").on("click",".cdp-show-more-d-title",function(e){e.preventDefault(),t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-more-d-title").is(":hidden")?(t(".cdp-more-d-title").show(300),t(this).text("(hide more options)")):(t(".cdp-more-d-title").hide(300),t(this).text("(show more options)"));setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-d-first-chapter-cb",function(){t(".cdp-d-section").css({"max-height":"",height:""});let e=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")+0,i=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")+0,o=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")+0;e+i+o>1?t(".cdp-d-option-select-parent").show(300):t(".cdp-d-option-select-parent").hide(300);setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("click",".cdp-d-search",function(){let e=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")?1:0,i=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")?1:0,d=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")?1:0;e+i+d<=0?t.cdpNotification("error",cdpJS.strCheckDuplicatesSearch):null==c?function(e=function(){}){t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_all_posts"}).done(i=>{t.isJsonString(i)&&(i=t.cdpParse(i)),e(i)}).fail(i=>{t.cdpNotification("error",cdpJS.strPostListIssue),console.log(i),e(!1)})}(t=>{0!=t&&p(t)}):p(c);function n(t,e){let i=parseInt(e[e.length-1]);for(let o=e.length;o>0&&(i=parseInt(e[o-1]),ext=!1,t.posts.findIndex(t=>t.ID==i)>=0?ext=!0:t.pages.findIndex(t=>t.ID==i)>=0?ext=!0:t.custom.findIndex(t=>t.ID==i)>=0?ext=!0:i=!1,1!=ext);--o);return i}function p(e){let i={posts:[],pages:[],custom:[]},d={},p={};null!=c&&(i=c);let m=!!t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked"),h=!!t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked"),f=!!t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked"),g=!!t('.cdp-d-option[name="cdp-d-b-title"]').is(":checked"),v=!!t('.cdp-d-option[name="cdp-d-b-slug"]').is(":checked"),y=!!t('.cdp-d-option[name="cdp-d-c-excerpt"]').is(":checked"),b=!!t('.cdp-d-option[name="cdp-d-c-count"]').is(":checked"),x=t('.cdp-d-option-select[name="cdp-d-d-sel-which"]').val(),k=null,w=null;if(m+h+f>1&&(k=t('.cdp-d-option-select[name="cdp-d-sels-diftyp"]').val()),1==g&&(w="1"==t('.cdp-d-option[name="cdp-radio-btn-dtitles"]:checked').val()),null==c)for(post_type in e)if("meta"!=post_type)for(post in e[post_type]){post=e[post_type][post],post.post_type=post.post_type[0].toUpperCase()+post.post_type.slice(1);let o=e.meta[post.ID]._cdp_origin,c=e.meta[post.ID]._cdp_counter,d=e.meta[post.ID]._cdp_origin_title,s=r(post.post_content),a={id:post.ID,url:post.guid,slug:post.post_name,type:post.post_type,date:post.post_date,title:post.post_title,status:post.post_status,edit:post.post_modified,excerpt:post.post_excerpt,words:u(s),origin:"object"==typeof o&&n(e,o),counter:"object"==typeof c&&c[c.length-1],origin_title:"object"==typeof d&&d[0]};if(l&&t.cdp.isPremium()&&(a.content=t.cdp.premium.prepareAdvanced(s),a.author=t.cdp.premium.prepareAdvanced(post.post_author)),"object"==typeof o){let t=parseInt(o[o.length-1]);void 0===p[t]?p[t]=1:p[t]++}i[post_type].push(a)}i=function(t){let e=JSON.parse(JSON.stringify(t));return e.posts.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e.pages.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e.custom.sort((t,e)=>!1===t.origin?-1:!1===e.origin?1:0),e}(i),null==c&&(c=i);let _=[],S=[],C=!1,T=0,j=0,J=[],I=[],N=[];if("2"==k){T=1;let t=[],e=[],o=[];1==m&&(t=i.posts),1==h&&(e=i.pages),1==f&&(o=i.custom),_=(_=[].concat(t,e,o)).sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),S=P(_)}else{let t=[],e=[],o=[];1==m&&(T+=1),1==h&&(T+=1),1==f&&(T+=1),i.posts=i.posts.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==m&&(t=P(i.posts)),i.pages=i.pages.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==h&&(e=P(i.pages)),i.custom=i.custom.sort((t,e)=>t.id<e.id?-1:t.id>e.id?1:0),1==f&&(o=P(i.custom)),S=[].concat(t,e,o)}function Q(e){1==++j&&(J=e),2==j&&(I=e),3==j&&(N=e),j==T&&function(e){for(post in $tbody=t("#cdp-d-table-tbody"),$tbody.html(""),e)$tbody.append((i=e[post],t(`<tr data-id="${i.id}">\n <td><input type="checkbox" id="cdp_in_${i.id}" class="cdp-input-d-id" name="${i.id}"/></td>\n <td><label for="cdp_in_${i.id}">${i.title}</label></td>\n <td><a href="${i.url}" target="_blank">${""!=i.slug?i.slug:i.url}</a></td>\n <td>${i.type}</td>\n <td>${i.date.slice(0,-8)}</td>\n <td>${i.words}</td>\n </tr>`)));var i;if("1"==x)for(parent in d)for(child in d[parent])t(`.cdp-input-d-id[name="${d[parent][child]}"]`).prop("checked",!0);else if("2"==x)for(parent in d){t(`.cdp-input-d-id[name="${parent}"]`).prop("checked",!0);let e=Math.max(...d[parent]);for(child in d[parent])d[parent][child]!=e&&t(`.cdp-input-d-id[name="${d[parent][child]}"]`).prop("checked",!0)}else"3"==x&&t(".cdp-input-d-id").prop("checked",!0);s=d,a=x;let c=!(g||v||y||b),n=t('.cdp-d-option[name="cdp-d-a-posts"]').is(":checked")+0,p=t('.cdp-d-option[name="cdp-d-a-pages"]').is(":checked")+0,l=t('.cdp-d-option[name="cdp-d-a-customs"]').is(":checked")+0;c&&n+p+l>0&&e.length>0?(t("#cdp-d-table-tbody").find("tr").attr("data-ignore",!0),o.refresh(),t(".cdp-delete-info").hide(300),t('[data-empty-info="true"]').find("div").html(cdpJS.strFilterNotSelected),t('[data-empty-info="true"]').addClass("cdp-customized")):o.refresh();t(".cdp-d-searchbox-c").val(""),$(),0==e.length?(t.cdpNotification("warning",cdpJS.strNoDataForFilter),t(".cdp-delete-info").hide(300)):t(".cdp-not-yet-search").is(":visible")||(t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-not-yet-search").show(300),t('[data-empty-info="true"]').hasClass("cdp-customized")||t(".cdp-delete-info").show(300),setTimeout(()=>{t(".cdp-d-section").css({"max-height":"",height:""}),t(".cdp-d-section").css({"max-height":`${t(".cdp-d-section").height()}px`})},320))}(S=[].concat(J,I,N))}function P(e){let i=[],o=[],c=!(g||v||y||b);if(!e)return i;function n(t,e){if(t.id==e.origin&&0!=e.origin_title){let t=e.origin_title.replace(/\[Counter\]/g,e.counter);if(e.title==t)return!0}return!1}function p(t){for(let e=0;e<t.length;e++){let i=t[e];if(!o.includes(i.id))for(let d=c?0:e;d<t.length;d++){if(!t[d])continue;if(o.includes(t[d].id))continue;if(d==e)continue;let p=1==g&&(i.title==t[d].title||1==w&&n(i,t[d])),a=1==v&&D(i.slug,t[d].slug)>=.85,l=!1;l=1==p||1==a?1==y&&(""==i.excerpt||i.excerpt==t[d].excerpt):1==y&&""!=i.excerpt&&i.excerpt==t[d].excerpt;let r=1==b&&i.words==t[d].words,u=1==c&&i.id==t[d].origin&&t.findIndex(e=>e.origin==t[d].id)<=-1;!p&&g||!a&&v||!l&&y||!r&&b||!u&&c||(s(i,!0,!1),s(t[d],!1,i.id))}}Q(i)}function s(t,e=!1,c=!1){o.includes(t.id)||(1==e?d[t.id]=[]:0!=c&&d[c].push(t.id),o.push(t.id),i.push(t))}l&&t.cdp.isPremium()?t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"get_authors"}).done(i=>{if(t.isJsonString(i)&&(i=t.cdpParse(i)),"success"===i.status){let o=i.users;p(e=t.cdp.premium.advancedfilter(e,o))}else!1===C&&(t.cdpNotification("info",cdpJS.strServerConnectIssue),C=!0),p(e)}).fail(()=>{!1===C&&(t.cdpNotification("info",cdpJS.strServerConnectIssue),C=!0),p(e)}):p(e)}}function r(t){return(t=(t=(t=t.replace(/\<\!\-\-(.*?)\-\-\>/gim,"")).replace(/<[^>]*>/gim," ")).replace(/\s+/gim," ")).trim()}function u(t){return(t=t.split(" ")).length}}),t("body").on("change",".cdp-input-d-id",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),i=parseInt(t(".cdp-t-d-ct").text());t(this).is(":checked")?(i++,t(this).parents("tr").addClass("cdp-del")):(i--,t(this).parents("tr").removeClass("cdp-del"));if(t(".cdp-t-d-ct").text(i),i==e)t(".cdp-d-select-all").text("Deselect all"),t(".cdp-d-checkbox-all").prop("checked",!0);else{t(".cdp-d-select-all").text("Select all");let e=t(".cdp-input-d-id:visible");for(let i=0;i<e.length;++i){if(!t(e[i]).is(":checked")){t(".cdp-d-checkbox-all").prop("checked",!1);break}i==e.length-1&&t(".cdp-d-checkbox-all").prop("checked",!0)}}}),t("body").on("change",".cdp-d-checkbox-all",function(e){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return e.preventDefault(),void t(this).prop("checked",!1);let i=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),o=t(".cdp-d-checkbox-all").is(":checked"),c=t(".cdp-input-d-id:visible"),d=0;for(let e=0;e<c.length;++e)t(c[e]).is(":checked")&&!o?d--:!t(c[e]).is(":checked")&&o&&d++,t(c[e]).prop("checked",o);let n=parseInt(t(".cdp-t-d-ct").text())+d;t(".cdp-t-d-ct").text(n),n==i?t(".cdp-d-select-all").text("Deselect all"):t(".cdp-d-select-all").text("Select all");let p=t(".cdp-input-d-id:visible").parents("tr"),s=t(".cdp-input-d-id:visible:checked").parents("tr");p.removeClass("cdp-del"),s.addClass("cdp-del")}),t("body").on("click",".cdp-d-select-all",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;let e=parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text()),i=parseInt(t(".cdp-t-d-ct").text()),o=!0;e==i&&(o=!1);$chbs=t(".cdp-input-d-id");for(let e=0;e<$chbs.length;++e)t($chbs[e]).prop("checked",o);t(".cdp-t-d-ct").text(1==o?e:"0"),0==o?(t(".cdp-d-select-all").text("Select all"),t(".cdp-d-checkbox-all").prop("checked",!1),t(".cdp-input-d-id").parents("tr").removeClass("cdp-del")):(t(".cdp-d-checkbox-all").prop("checked",!0),t(".cdp-d-select-all").text("Deselect all"),t(".cdp-input-d-id").parents("tr").addClass("cdp-del"))}),t("body").on("click",".prev_page, .next_page, .page_link",function(){if("0"==t("#cdp-d-table-pagi-ilosc-wynikow").text())return;t(".cdp-input-d-id:visible:checked").length==t(".cdp-input-d-id:visible").length?t(".cdp-d-checkbox-all").prop("checked",!0):t(".cdp-d-checkbox-all").prop("checked",!1)}),t("body").on("click",".cdp-d-real-delete",function e(i=!1,d=null,n=0){if(!t(".cdp-d-just-check-it").is(":checked"))return void t.cdpNotification("warning",cdpJS.strCheckSteps);let p=[];if(null===d){let e=t(".cdp-input-d-id:checked");for(let i=0;i<e.length;++i)p.push(parseInt(t(e[i]).attr("name")));if(0==p.length)return void t.cdpNotification("warning",cdpJS.strSelectPostToDel)}else p=d;let u=t(".cdp-d-throttling").val(),m=t(".cdp-d-throttling-count").val(),h=t(".cdp-p-redirections").val(),f=!!t(".cdp-p-just-trash-them").is(":checked"),g=null,v="1"==t('.cdp-dis-en-opt[name="cdp-redirections"]').val();if("1"==u&&(!m||0==m||""==m))return void t.cdpNotification("warning",cdpJS.strFieldWrongCount);l&&t.cdp.isPremium()&&(g=t.cdp.premium.auitd(a,s));if(p.length>801&&!0!==i){let t=Math.ceil(p.length/800);for(let i=0,o=!0;i<t;++i)i==t-1&&(o=!1),e(o,p.slice(800*i,800*i+800),i);return}t.post(ajaxurl,{action:"cdp_action_handling",token:"cdp",f:"delete_them",ids:p,throttling:u,thc:m,redi:h,thrs:f,auit:v,auitd:g}).done(e=>{if(t.isJsonString(e)&&(e=t.cdpParse(e)),"success"==e.status){t("#cdp-d-table-tbody").find(".cdp-del").remove();let e=c.posts.filter(t=>!p.includes(t.id)),d=c.pages.filter(t=>!p.includes(t.id)),s=c.custom.filter(t=>!p.includes(t.id));c={posts:e,pages:d,custom:s},!0!==i&&o.refresh(),$(),0==n&&t.cdpNotification("success",cdpJS.strDeletionProcessStarted),_(S),!0!==i&&($parent=t(".cdp-d-section").parents(".cdp-collapsible"),$col=t(t($parent[0]).find(".cdp-collapsible-title")[0]),r("true",$col))}else!0!==i&&t.cdpNotification("error",`${cdpJS.strDeletionTaskStart} ${"1"==u?cdpJS.strDeletionTaskEnd:""}`)}).fail(e=>{!0!==i&&t.cdpNotification("error",cdpJS.strDeletionTaskConsInfo),console.log(e)})}),t("body").on("change",".cdp-d-throttling",function(){t(".cdp-d-section").css({"max-height":"",height:""}),"1"==t(this).val()?t(".cdp-d-throttling-count-p, .cdp-even-more-th-info").show(300):t(".cdp-d-throttling-count-p, .cdp-even-more-th-info").hide(300);setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-d-throttling-count",function(){let e=parseInt(t(this).val());isNaN(e)?t(this).val(1):e>=1&&e<=10240?e>=1&&e<=1&&t(this).val(1):e<1?t(this).val(1):t(this).val(10240)}),t("body").on("change",".cdp-custom-date-picking",u),t("body").on("mouseover",".cdp-tooltip-copy",function(){t(this).hasClass("tooltipstered")||(t(this).tooltipster({delay:100,timer:400,debug:!1,delayTouch:[100,200],interactive:!0,distance:4,side:"bottom",contentAsHTML:!0,content:t(".cdp-tooltip-content").html(),repositionOnScroll:!0,selfDestruction:!1,trigger:"custom",triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},functionBefore:Q,functionReady:P,functionAfter:M,functionFormat:A}),t(this).tooltipster("open"),t("#cdp-hideTT").length>0&&t(".tooltipster-base").hide())}),t("body").on("keyup",".cdp-d-searchbox-c",function(){if(t('[data-empty-info="true"].cdp-customized').length>0)return;let e=t(this).val();e.length>100&&(e=e.substr(0,100));if(e=(e=e.trim().replace(/\s+/gim," ").toLowerCase()).split(" "),$trs=t("#cdp-d-table-tbody").find("tr"),$trs.length<=0)return;$trs.removeAttr("data-ignore");for(let i=0;i<$trs.length;++i){$tr=t($trs[i]),$title=t($tr.find("td")[1]).text().toLowerCase(),$url=t($tr.find("td")[2]).text().toLowerCase();let o=!1;for(let t=0;t<e.length;++t)if($title.includes(e[t]))o=!0;else{if(!$url.includes(e[t])){o=!1;break}o=!0}0==o&&$tr.attr("data-ignore","true")}clearTimeout(p),p=setTimeout(()=>{o.refresh()},20)}),t("body").on("change",".cdp-data-set",C),t("#wpbody").on("scroll",T),t(window).on("scroll",T),t("body").on("click",".nice-select",T),t("body").on("click",".cdp-show-the-copies",function(e){e.preventDefault(),t(".cdp-d-section").css({"max-height":"",height:""}),t("#cdp-d-table-tbody").find("tr").not('[data-empty-info="true"]').removeAttr("data-ignore"),t(".cdp-d-searchbox-c").val(""),t('[data-empty-info="true"]').addClass("cdp-customized"),o.refresh(),$(),t(".cdp-d-section").css({"max-height":"",height:""}),parseInt(t("#cdp-d-table-pagi-ilosc-wynikow").text())>0&&t(".cdp-delete-info").show(300);t(".cdp-not-yet-search").is(":visible")||(t(".cdp-not-yet-search").show(300),t('[data-empty-info="true"]').hasClass("cdp-customized")||t(".cdp-delete-info").show(300));setTimeout(()=>{t(".cdp-d-section").css({"max-height":t(".cdp-d-section").height()})},310)}),t("body").on("change",".cdp-per-page-select-show",function(){let e=t(this).val();o.changePageSize(e)}),t("body").on("change",'.cdp-d-option[name="cdp-d-b-title"]',j),t("body").on("change",'.cdp-d-option[name="cdp-d-b-slug"]',j),t("body").on("click",".cdp-tab-element",function(){if(t(this).hasClass("cdp-tab-active"))return;if("true"==t(this).attr("data-disabled"))return;let e=t(t(`#${t(this).attr("data-box")}`)[0]),i=t(t(`#${t(".cdp-tab-active").attr("data-box")}`)[0]);if(!e||e.length<=0)return;t(".cdp-tab-active").removeClass("cdp-tab-active"),t(this).addClass("cdp-tab-active"),e.show(),e.css({"max-height":"",height:""});let o=e.height();e.css({"max-height":"0px",opacity:0}),e.animate({"max-height":o+"px",opacity:1},500,function(){let e=t(".cdp-d-section").height();t(".cdp-d-section").css({height:e+"px","max-height":e+"px"})}),t(".cdp-d-section").css({height:"","max-height":""}),i.css({"max-height":i.height()+"px",opacity:1}),i.animate({"max-height":"0px",opacity:0},500,function(){i.hide()}),setTimeout(()=>{i.css({"max-height":"",height:""}),e.css({"max-height":"",height:""})},510);let c=parseInt(t(window).height()/8);t("#wpbody").animate({scrollTop:jQuery(".cdp-d-section")[0].offsetTop-c},500)}),t("body").on("click",".cdp-premium-element",function(t){t.preventDefault()}),t("body").on("click",".cdp-go-to-names-chapter",function(e){e.preventDefault(),O(),r("cdp-name-section-cnx"),setTimeout(()=>{let e=parseInt(t(window).height()/4);t("#wpbody").animate({scrollTop:t(".cdp-name-section-cnx")[0].offsetTop-e},500)},400)}),t("body").on("click",".cdp-close-chapter",J),t("body").on("click",".cdp-save-options",J),t("body").on("click",".cdp-togglable-name-b",function(){"(Name of original)"==t(".cdp-togglable-name-b").text()?(t(".cdp-togglable-name-b").text("(blank)"),t(".cdp-togglable-name-b").tooltipster("content",cdpJS.strTogglableNameChange)):(t(".cdp-togglable-name-b").text(cdpJS.strTogglableName),t(".cdp-togglable-name-b").tooltipster("content",cdpJS.strTogglableNameChangeBlank));u()}),t("#cdp_jvlabelWrap-fake").on("click",function(){if(0===t("#support-cdp").length){t(t(".cdp-container")[0]).append('<script id="support-cdp" src="//code.jivosite.com/widget/MoP3Jphzts" async><\/script>'),setTimeout(function(){t("#cdp_jvlabelWrap-fake").hide()},100);var e=!1;let i=setInterval(function(){1==e&&clearInterval(i),void 0!==window.jivo_api&&(window.jivo_api.open(),e=!0)},30)}}),t(".cdp-select").niceSelect(),t(".cdp-tooltip").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:4,side:"top",contentAsHTML:!0,maxWidth:600,triggerOpen:{mouseenter:!0,touchstart:!0},triggerClose:{mouseleave:!0,click:!0,tap:!0},theme:["tooltipster-noir","tooltipster-noir-customized"],repositionOnScroll:!0,functionReady:H}),t("#cdp-d-table").length>0&&(o=new IcPagination(t("#cdp-d-table"),"#cdp-d-table-pagi",{itemsOnPage:25,useParams:!1,emptylist:'<div class="cdp-center">'+cdpJS.strNoItems+"</div>"})),t(".cdp-copy-button").on("mouseup",function(){f(!0)});let I=(e,i,o,c)=>t(`<a class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-ud${0==e?" cdp-bnew-notis":""}" data-token="${i}">\n <div style="display: block; width: calc(100% - 3px);">\n <div class="cdp-dropdown-left${1==o?" cdp-red":""}">${"delete"==c?cdpJS.strDeletingPosts:cdpJS.strAutoCleanPosts}</div>\n <div class="cdp-dropdown-right cdp-noti-kill-btn">`+cdpJS.strKill+"</div>\n </div>\n </a>"),N=(e,i,o,c)=>{let d="",n="";return void 0!==e&&(void 0!==e["formated-date"]&&(d=e["formated-date"]),void 0!==e.text&&(n=e.text),""!=n&&(n='data-ftext="'+n+'" '),""!=d&&(d='data-fdate="Completed at '+d+'" ')),t(`<a ${d}${n}class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-d${0==i?" cdp-bnew-notis":""}" data-token="${o}">\n <div style="display: block; width: calc(100% - 3px);">\n <div class="cdp-dropdown-left">${"delete"==c?cdpJS.strDeletedPosts:cdpJS.strAutoCleanedPosts}</div>\n <div class="cdp-dropdown-right cdp-noti-hide-btn">`+cdpJS.strHide+"</div>\n </div>\n </a>")};function D(t,e){let i=t,o=e;t.length<e.length&&(i=e,o=t);let c=i.length;return 0==c?1:(c-function(t,e){t=t.toLowerCase(),e=e.toLowerCase();let i=new Array;for(let o=0;o<=t.length;o++){let c=o;for(let d=0;d<=e.length;d++)if(0==o)i[d]=d;else if(d>0){let n=i[d-1];t.charAt(o-1)!=e.charAt(d-1)&&(n=Math.min(Math.min(n,c),i[d])+1),i[d-1]=c,c=n}o>0&&(i[e.length]=c)}return i[e.length]}(i,o))/parseFloat(c)}function Q(i,o){O(!0),t(".cdp-tooltip-before-options").show(),t(".cdp-tooltip-full-options").hide(),$inputs=t(t(".cdp-tooltip-content").find("input, select"));for(let e=0;e<$inputs.length;++e){let i=t($inputs[e]);if("checkbox"==i.attr("type"))i.is(":checked")?i.attr("checked","checked"):i.removeAttr("checked");else if(t(i).is("select"))if("tooltip-which-profile-first"==t(i).attr("name")){let e=t(t('[name="tooltip-which-profile-first"]')[0]).val();"custom"==e||null==e?setTimeout(()=>{t('[name="tooltip-which-profile-first"]').val("custom")},50):setTimeout(()=>{t('[name="tooltip-which-profile-first"]').val(e)},50)}else{let e=t('[name="tooltip-which-profile-second"] option:selected').map(function(t,e){return this.value}).get()[0];"custom"==e||null==e?setTimeout(()=>{t('[name="tooltip-which-profile-second"]').val("custom")},50):setTimeout(()=>{t('[name="tooltip-which-profile-second"]').val(e)},50)}else i.attr("value",i.val())}return cdp_tooltips_update_content(),e=t(o.origin).attr("data-cdp-id"),!0}function P(e,i){$parent=t(i.origin).parents(".row-actions"),$parent.css({left:0});let o=t(t("a.menu-top.toplevel_page_copy-delete-posts")[0]).attr("href");t(".cdp-tooltip-info-intt").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:6,side:"top",contentAsHTML:!0,content:`${cdpJS.strDefCopySettingsStart} <a href="${o}">${cdpJS.strDefCopySettingsLink}</a>.`,maxWidth:400,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-center"],repositionOnScroll:!0}),l&&jQuery.cdp.isPremium()?t(".cdp-tooltip-premium-spc-3").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strMultisiteCanCopy,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}):(t(".cdp-tooltip-premium-spc-2").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strCopyToOtherSiteHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t(".cdp-tooltip-premium-spc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strPremFeatureHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").addClass("cdp-premium-element"),t(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").find("input, select").prop("disabled",!0),t(".cdp-tooltip-premium-spc-4").tooltipster("content",cdpJS.strPreOrderHtml),H(),cdp_tooltips_update_content())}function M(e,i){return $parent=t(i.origin).parents(".row-actions"),$parent.css({left:""}),!1}function A(){return t(t(".cdp-tooltip-content").html())}function H(){setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].reposition()},10)}function O(e=!1){if(e){let e=t.tooltipster.instances();for(instance in e)e[instance].close()}else setTimeout(()=>{let e=t.tooltipster.instances();for(instance in e)e[instance].close()},10)}if(t(".cdp-admin-bar-noti").length>0&&setInterval(()=>{_(t=>{S(t)})},7e3),t(".cdp-drag-name").draggable({containment:".cdp-drags-cont",scroll:!1,helper:"clone",revert:"invalid"}),t(".cdp-names-real-input").droppable({drop:function(e,i){$picks=['<div class="cdp-name-box-small cdp-drag" data-cdp-val="0" contenteditable="false"><i class="cdp-novis">[</i>Counter<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="1" contenteditable="false"><i class="cdp-novis">[</i>CurrentTime<i class="cdp-novis">]</i></div>','<div class="cdp-name-box-small cdp-drag" data-cdp-val="2" contenteditable="false"><i class="cdp-novis">[</i>CurrentDate<i class="cdp-novis">]</i></div>'],t(this).html(`${t(this).html()}${$picks[t(i.helper).attr("data-cdp-val")]}`),u()}}),"undefined"!=typeof pagenow&&["edit-page","edit-post"].includes(pagenow)&&t(".column-cb, .check-column").find("input").prop("checked",!1),t("#titlediv").find(".inside").length>0&&t("#cdp-original-post").length>0){let e=t("#cdp-original-post").attr("data-cdp-parent"),i=t("#cdp-original-post").attr("data-cdp-parent-url");t("#titlediv").find(".inside").append(t(`<div style="padding-left: 10px">${cdpJS.strPostDuplicateOf} <a href="${i}" target="_blank">${e}</a></div>`))}t(".cdp-preloader-c").length>0&&(u(),h(),w(),setTimeout(()=>{m(".cdp-names-prefix"),m(".cdp-names-suffix")},1e3),function(){let e=t(".cdp-tab-active");for(let i=0;i<e.length;i++){let o=t(`#${t(e[i]).attr("data-box")}`);o.show(),o.css({"max-height":"",height:""});let c=o.height();t(c).css({"max-height":c+"px",height:c+"px"})}}()),setTimeout(()=>{t(".cdp-container").is(":hidden")&&t(".cdp-container").length>0&&setTimeout(()=>{jQuery(".cdp-preloader-c").hide(),jQuery(".cdp-container").css({opacity:0}),jQuery(".cdp-container").show(),jQuery("#wpfooter").show(300),jQuery(".cdp-container").animate({opacity:1},300)},400)},5e3)}),jQuery(window).on("load",function(){setTimeout(()=>{jQuery(".cdp-container").length>0&&(jQuery(".cdp-preloader-c").hide(),jQuery(".cdp-container").css({opacity:0}),jQuery(".cdp-container").show(),jQuery("#wpfooter").show(300),jQuery(".cdp-container").animate({opacity:1},300));const t=void 0!==jQuery.cdp&&void 0!==jQuery.cdp.isPremium;jQuery(".cdp-tooltip-premium-dc").tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strPremFeatureHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),t&&jQuery.cdp.isPremium()?(jQuery(".cdp-tooltip-premium-spc-3").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strMultisiteCanCopy,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),jQuery(".cdp-tooltip-premium-spc-3").addClass("cdp-premium-element"),jQuery(".cdp-tooltip-premium-spc-3").find("input, select").prop("disabled",!0)):(jQuery('.cdp-option-premium [value="3"]').prop("disabled",!0),setTimeout(()=>{jQuery(".cdp-premium-in-select").find('.option[data-value="premium"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-option-premium").find('.option[data-value="3"]').addClass("cdp-tooltip-premium disabled"),jQuery(".cdp-tooltip-premium-spc-2").tooltipster({delay:800,debug:!1,delayTouch:[100,200],interactive:!0,distance:3,side:"top",content:cdpJS.strCopyToOtherSiteHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),jQuery(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").addClass("cdp-premium-element"),jQuery(".cdp-tooltip-premium-spc, .cdp-tooltip-premium-spc-2").find("input, select").prop("disabled",!0),jQuery(".cdp-tooltip-premium-spc-4").tooltipster("content",cdpJS.strPreOrderHtml),function(t){let e=void 0!==t?t:".cdp-tooltip-premium",i=-15;isNaN(parseInt(jQuery(e).attr("data-top")))||(i=parseInt(jQuery(e).attr("data-top")));jQuery(e).tooltipster({delay:10,debug:!1,delayTouch:[100,200],interactive:!0,distance:i,side:"top",content:cdpJS.strPremFeatureHtml,contentAsHTML:!0,maxWidth:290,theme:["tooltipster-noir","tooltipster-noir-customized","cdp-tooltip-premium-css"],repositionOnScroll:!0}),o=e,jQuery(o).addClass("cdp-premium-element"),jQuery(o).find("input, select").prop("disabled",!0);var o}(),cdp_tooltips_update_content()},1e3))},400)}),function(t){function e(t,e){if(!(t.originalEvent.touches.length>1)){t.preventDefault();let i=t.originalEvent.changedTouches[0],o=document.createEvent("MouseEvents");o.initMouseEvent(e,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(o)}}if(t.support.touch="ontouchend"in document,t.support.touch){let i,o=t.ui.mouse.prototype,c=o._mouseInit,d=o._mouseDestroy;o._touchStart=function(t){!i&&this._mouseCapture(t.originalEvent.changedTouches[0])&&(i=!0,this._touchMoved=!1,e(t,"mouseover"),e(t,"mousemove"),e(t,"mousedown"))},o._touchMove=function(t){i&&(this._touchMoved=!0,e(t,"mousemove"))},o._touchEnd=function(t){i&&(e(t,"mouseup"),e(t,"mouseout"),this._touchMoved||e(t,"click"),i=!1)},o._mouseInit=function(){let e=this;e.element.bind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),c.call(e)},o._mouseDestroy=function(){let e=this;e.element.unbind({touchstart:t.proxy(e,"_touchStart"),touchmove:t.proxy(e,"_touchMove"),touchend:t.proxy(e,"_touchEnd")}),d.call(e)}}}(jQuery);
copy-delete-posts.php CHANGED
@@ -1,126 +1,122 @@
1
  <?php
 
2
  /**
3
  * Plugin Name: Copy & Delete Posts
4
  * Plugin URI: https://copy-delete-posts.com
5
  * Description: The best solution to easily make duplicates of your posts & pages, and delete them in one go.
6
- * Version: 1.1.7
7
  * Author: Copy Delete Posts
8
  * Author URI: https://copy-delete-posts.com/
9
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
-
11
  // Exit if accessed directly.
12
- if (!defined('ABSPATH')) exit;
 
13
 
14
  /** –– **\
15
  * Opt-in.
16
  * @since 1.1.2
17
  */
18
-
19
- require_once 'analyst/main.php';
20
- analyst_init(array(
21
- 'client-id' => 'ovgxe3xq075ladbp',
22
- 'client-secret' => 'b4de5ed2ba7be687e233d152ec1e8fd116052ab0',
23
- 'base-dir' => __FILE__
24
- ));
25
-
26
- /** –– **/
27
-
28
  /** –– **\
29
  * Global variables and constants.
30
  * @since 1.0.0
31
  */
32
-
33
- // Plugin constants
34
- define('CDP_VERSION', '1.1.7');
35
- define('CDP_WP_VERSION', get_bloginfo('version'));
36
- define('CDP_SCRIPT_DEBUG', false);
37
- define('CDP_ROOT_DIR', __DIR__);
38
- define('CDP_ROOT_FILE', __FILE__);
39
- $cdp_plug_url = plugins_url('', __FILE__);
40
-
41
- // Other only admin stuff
42
- if (is_admin()) {
43
-
44
- // Set constant variables for this file
45
- $cdp_dir = dirname(__FILE__);
46
- $cdp_globals = get_option('_cdp_globals');
47
- $cdp_premium = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
48
-
49
- // Try to show error while debugging
50
- if (CDP_SCRIPT_DEBUG === true) {
51
- error_reporting(E_ALL);
52
- ini_set('display_errors', 1);
53
- }
54
-
55
- }
56
-
57
- /** –– **/
58
-
59
  /** –– **\
60
  * Fired on plugin activation.
61
  * @since 1.0.0
62
  */
63
- register_activation_hook(__FILE__, function () {
64
- if (function_exists('activate_plugin')) {
65
- add_option('_cdp_redirect', true);
66
- $cdp_premium_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium';
67
- $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
68
- if (!is_plugin_active($plugin) && is_dir($cdp_premium_path)) activate_plugin($plugin);
69
- }
70
-
71
- if (get_option('_cdp_review', false) == false) {
72
- $review = array(
73
- 'installed' => time(),
74
- 'users' => array()
75
- );
76
-
77
- update_option('_cdp_review', $review);
78
- }
79
-
80
- do_action('cdp_plugin_setup');
81
- });
82
- /** –– **/
83
-
84
  /** –– **\
85
  * Fired on plugin deactivation.
86
  * @since 1.0.0
87
  */
88
- register_deactivation_hook(__FILE__, function () {
89
- if (function_exists('deactivate_plugins')) {
90
- $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
91
- if (is_plugin_active($plugin)) add_action('update_option_active_plugins', function () {
92
- $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
93
- deactivate_plugins($plugin);
94
- });
95
- }
96
- });
97
- /** –– **/
98
-
99
  /** –– **\
100
  * Fired on plugin load and check permissions.
101
  * @since 1.0.0
102
  */
103
- add_action('plugins_loaded', function () {
104
- do_action('cdp_loaded');
105
- });
106
- /** –– **/
107
-
108
  /** –– **\
109
  * Fired on any plugin upgrade (in case if it's ours)
110
  * @since 1.0.6
111
  */
112
- add_action('upgrader_process_complete', function () {
113
- if (get_option('_cdp_review', false) == false) {
114
- $review = array(
115
- 'installed' => time(),
116
- 'users' => array()
117
- );
118
-
119
- update_option('_cdp_review', $review);
120
- }
121
- });
122
- /** –– **/
123
-
124
  /** –– **\
125
  * Include all menus.
126
  * @since 1.0.0
@@ -152,156 +148,255 @@ if (!defined('ABSPATH')) exit;
152
  * Admin Init
153
  * @since 1.0.0
154
  */
155
- add_action('admin_init', function () {
156
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
157
-
158
- if (get_option('_cdp_redirect', false)) {
159
- delete_option('_cdp_redirect', false);
160
- wp_redirect(admin_url('admin.php?page=copy-delete-posts'));
161
- }
162
-
163
- global $cdp_premium;
164
- $cdp_premium_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium';
165
- $cdp_premium_ver_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium/version.txt';
166
- if (defined('CDP_PREMIUM_VERSION') && version_compare(CDP_PREMIUM_VERSION, CDP_VERSION, '!=')) {
167
- update_option('_cdp_mishmash', true);
168
- } else {
169
- if (is_dir($cdp_premium_path) && file_exists($cdp_premium_ver_path)) {
170
- $cdp_prem_ver_file = fopen($cdp_premium_ver_path, 'r') or false;
171
- $cdp_prem_ver = fgets($cdp_prem_ver_file);
172
- fclose($cdp_prem_ver_file);
173
-
174
- if ((trim($cdp_prem_ver) == CDP_VERSION) && !is_plugin_active($cdp_premium)) {
175
- activate_plugin($cdp_premium, '', false, true);
176
- // add_option('_cdp_redirect', false);
177
- }
178
- if (trim($cdp_prem_ver) == CDP_VERSION) update_option('_cdp_mishmash', false);
179
- }
180
- }
181
- if (is_plugin_active($cdp_premium) && !file_exists($cdp_premium_ver_path)) {
182
- if (is_plugin_active($cdp_premium)) deactivate_plugins($cdp_premium, true);
183
- }
184
- });
185
- /** –– **/
186
-
 
 
187
  /** –– **\
188
  * Setup assets.
189
  * @since 1.0.0
190
  */
191
- add_action('admin_enqueue_scripts', function () {
192
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
193
- if (function_exists('wp_doing_ajax') && wp_doing_ajax()) return; global $cdp_plug_url;
194
-
195
- global $pagenow, $post;
196
- $screen = get_current_screen();
197
- $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
198
- $allowed = ['post', 'edit-post', 'toplevel_page_copy-delete-posts', 'edit-page', 'page'];
199
- $at = ($screen->id != 'attachment');
200
-
201
- $g = get_option('_cdp_globals', array());
202
- if (array_key_exists('others', $g)) $g = $g['others'];
203
- else $g = cdp_default_global_options();
204
-
205
- if (is_object($post)) $type = $post->post_type;
206
- else $type = false;
207
-
208
- if (isset($g['cdp-menu-in-settings']) && $g['cdp-menu-in-settings'] == 'true') {
209
- ?>
210
- <style media="screen">
211
- #toplevel_page_copy-delete-posts { display: none; visibility: hidden; }
212
- </style>
213
- <?php
214
- }
215
-
216
- $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
217
- wp_enqueue_style('cdp-css-global', "{$cdp_plug_url}/assets/css/cdp-global{$min}.css", '', $ver);
218
- wp_enqueue_script('cdp-js-global', "{$cdp_plug_url}/assets/js/cdp-global{$min}.js", ['jquery'], $ver, true);
219
- wp_enqueue_style('cdp-css-select', "{$cdp_plug_url}/assets/css/cdp-select{$min}.css", '', $ver);
220
- wp_enqueue_script('cdp-js-select', "{$cdp_plug_url}/assets/js/cdp-select{$min}.js", '', $ver, true);
221
- wp_enqueue_style('cdp-tooltips-css', "{$cdp_plug_url}/assets/css/cdp.tooltip{$min}.css", '', $ver);
222
- wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
223
- if (method_exists($screen, 'is_block_editor')) {
224
- if (!$screen->is_block_editor() && $pagenow == 'post.php' && $at) {
225
- if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'true') {
226
- $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
227
- $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
228
- $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
229
- if (($a || $b || $c) && $pagenow != 'post-new.php') wp_enqueue_style('cdp-editor', "{$cdp_plug_url}/assets/css/cdp-editor{$min}.css", '', $ver);
230
- }
231
- }
232
- }
233
-
234
- $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
235
- if ((!$screen || !in_array($screen->id, $allowed)) && !($pagenow == 'edit.php' || $pagenow == 'post.php')) return;
236
- wp_enqueue_style('cdp-css', "{$cdp_plug_url}/assets/css/cdp{$min}.css", '', $ver);
237
- wp_enqueue_style('cdp-css-user', "{$cdp_plug_url}/assets/css/cdp-user{$min}.css", '', $ver);
238
- wp_enqueue_script('cdp-icPagination', "{$cdp_plug_url}/assets/js/cdp-icPagination{$min}.js", '', $ver);
239
- wp_enqueue_script('cdp', "{$cdp_plug_url}/assets/js/cdp{$min}.js", '', $ver, true);
240
- wp_enqueue_script('cdp-modal', "{$cdp_plug_url}/assets/js/cdp-modal{$min}.js", '', $ver, true);
241
- wp_enqueue_script('cdp-bulk', "{$cdp_plug_url}/assets/js/cdp-bulk{$min}.js", '', $ver, true);
242
- });
243
- /** –– **/
244
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  /** –– **\
246
  * Setup assets (not admin).
247
  * @since 1.0.0
248
  */
249
- add_action('wp_enqueue_scripts', function () {
250
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
251
- if ((function_exists('wp_doing_ajax') && wp_doing_ajax()) || (!(is_single() || is_page()))) return; global $cdp_plug_url;
252
-
253
- $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
254
- $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
255
- wp_enqueue_script('jquery-ui-draggable');
256
- wp_enqueue_script('jquery-ui-droppable');
257
- wp_enqueue_script('jquery-ui-sortable');
258
- wp_enqueue_style('cdp-css-global', "{$cdp_plug_url}/assets/css/cdp-global{$min}.css", '', $ver);
259
- wp_enqueue_script('cdp-js-global', "{$cdp_plug_url}/assets/js/cdp-global{$min}.js", ['jquery'], $ver, true);
260
- wp_enqueue_style('cdp-css', "{$cdp_plug_url}/assets/css/cdp{$min}.css", '', $ver);
261
- wp_enqueue_style('cdp-css-user', "{$cdp_plug_url}/assets/css/cdp-user{$min}.css", '', $ver);
262
- wp_enqueue_script('cdp', "{$cdp_plug_url}/assets/js/cdp{$min}.js", ['jquery'], $ver, true);
263
- wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
264
- wp_enqueue_style('cdp-tooltips-css', "{$cdp_plug_url}/assets/css/cdp.tooltip{$min}.css", '', $ver);
265
- wp_enqueue_script('cdp-modal', "{$cdp_plug_url}/assets/js/cdp-modal{$min}.js", ['jquery'], $ver, true);
266
- wp_enqueue_script('cdp-js-user', "{$cdp_plug_url}/assets/js/cdp-user{$min}.js", '', $ver, true);
267
- wp_enqueue_style('cdp-css-select', "{$cdp_plug_url}/assets/css/cdp-select{$min}.css", '', $ver);
268
- wp_enqueue_script('cdp-js-select', "{$cdp_plug_url}/assets/js/cdp-select{$min}.js", '', $ver, true);
269
- });
270
- /** –– **/
271
-
 
 
 
272
  /** –– **\
273
  * Setup assets (for gutenberg).
274
  * @since 1.0.0
275
  */
276
- add_action('enqueue_block_editor_assets', function () {
277
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
278
-
279
- global $post;
280
- global $cdp_plug_url;
281
- $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
282
-
283
- $g = get_option('_cdp_globals', array());
284
- if (array_key_exists('others', $g)) $g = $g['others'];
285
- else $g = cdp_default_global_options();
286
-
287
- $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
288
- if (is_object($post)) $type = $post->post_type; else $type = false;
289
- $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
290
- $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
291
- $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
292
- if ((isset($g['cdp-display-gutenberg']) && $g['cdp-display-gutenberg'] == 'true') && ($a || $b || $c)) {
293
- wp_enqueue_style('cdp-gutenberg', "{$cdp_plug_url}/assets/css/cdp-gutenberg{$min}.css", '', $ver);
294
- wp_enqueue_script('cdp-js-gutenberg', "{$cdp_plug_url}/assets/js/cdp-gutenberg{$min}.js", ['jquery'], $ver, true);
295
- }
296
- });
297
- /** –– **/
298
-
 
 
 
 
 
 
 
299
  /** –– **\
300
  * Settings and menu initializer.
301
  * @since 1.0.0
302
  */
303
- add_action('admin_menu', function () {
304
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
 
305
 
306
  // Menu icon
307
  $icon_url = plugin_dir_url(__FILE__) . 'assets/imgs/icon.png';
@@ -309,331 +404,372 @@ if (!defined('ABSPATH')) exit;
309
  // Main menu slug
310
  $parentSlug = 'copy-delete-posts';
311
 
312
- // Globals
313
- $g = get_option('_cdp_globals', array());
314
- if (array_key_exists('others', $g)) $g = $g['others'];
315
- else $g = cdp_default_global_options();
 
 
316
 
317
  // Main menu hook
318
- add_menu_page('Copy & Delete Posts', '<span id="cdp-menu">Copy & Delete Posts</span>', 'read', $parentSlug, 'cdp_configuration', $icon_url, $position = 98);
319
- if (isset($g['cdp-menu-in-settings']) && $g['cdp-menu-in-settings'] == 'true') {
320
- add_submenu_page('tools.php', 'Copy & Delete Posts Menu', '<span id="cdp-menu">Copy & Delete Posts</span>', 'read', 'copy-delete-posts', 'cdp_configuration', 3);
321
- }
322
 
323
  // Remove default submenu by menu
324
  remove_submenu_page($parentSlug, $parentSlug);
325
- });
326
- /** –– **/
327
-
328
  /** –– **\
329
  * Add copy option to Quick Actions of Posts.
330
  * @since 1.0.0
331
  */
332
- add_filter('post_row_actions', function ($actions, $post) {
333
- if (cdp_check_permissions(wp_get_current_user()) == false) return $actions;
334
-
335
- // Get global options and post type
336
- $g = get_option('_cdp_globals', array());
337
- if (array_key_exists('others', $g)) $g = $g['others'];
338
- else $g = cdp_default_global_options();
339
- $type = $post->post_type;
340
-
341
- // If user want to see the copy buton here pass
342
- if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
343
- if (($type == 'post' && $g['cdp-content-posts'] == 'true') || ($type != 'post' && $g['cdp-content-custom'] == 'true'))
344
- $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' x='".$type."' title='test' data-cdp-id='{$post->ID}'>Copy</span></a>";
345
-
346
- return $actions;
347
- }, 10, 2);
348
- /** –– **/
349
-
 
 
350
  /** –– **\
351
  * Add copy option to Quick Actions of Pages.
352
  * @since 1.0.0
353
  */
354
- add_filter('page_row_actions', function ($actions, $page) {
355
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
356
-
357
- // Get global options and post type
358
- $g = get_option('_cdp_globals', array());
359
- if (array_key_exists('others', $g)) $g = $g['others'];
360
- else $g = cdp_default_global_options();
361
- $type = $page->post_type;
362
-
363
- // If user want to see the copy buton here pass
364
- if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
365
- if (($type == 'page' && $g['cdp-content-pages'] == 'true') || ($type != 'page' && $g['cdp-content-custom'] == 'true'))
366
- $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' title='test' data-cdp-id='{$page->ID}'>Copy</span></a>";
367
-
368
- return $actions;
369
- }, 10, 2);
370
- /** –– **/
371
-
 
 
372
  /** –– **\
373
  * Add copy option to Bulk Actions of Posts.
374
  * @since 1.0.0
375
  */
376
- add_filter('bulk_actions-edit-post', function ($bulk_actions) {
377
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
378
-
379
- $g = get_option('_cdp_globals', array());
380
- if (array_key_exists('others', $g)) $g = $g['others'];
381
- else $g = cdp_default_global_options();
382
-
383
- if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
384
-
385
- return $bulk_actions;
386
- });
387
- /** –– **/
388
-
 
 
 
389
  /** –– **\
390
  * Add copy option to Bulk Actions of Pages.
391
  * @since 1.0.0
392
  */
393
- add_filter('bulk_actions-edit-page', function ($bulk_actions) {
394
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
395
-
396
- $g = get_option('_cdp_globals', array());
397
- if (array_key_exists('others', $g)) $g = $g['others'];
398
- else $g = cdp_default_global_options();
399
-
400
- if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true') $bulk_actions['cdp_bulk_copy'] = 'Copy';
401
-
402
- return $bulk_actions;
403
- });
404
- /** –– **/
405
-
 
 
 
406
  /** –– **\
407
  * Add copy option to admin bar inside preview.
408
  * @since 1.0.0
409
  */
410
- add_action('admin_bar_menu', function ($admin_bar) {
411
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
412
- $screen = ((function_exists('get_current_screen')?get_current_screen():false));
413
- $screens = ['post', 'page'];
414
-
415
- if (!(is_single() || is_page() || (isset($screen) && ($screen != false && in_array($screen->id, $screens))))) return;
416
-
417
- $g = get_option('_cdp_globals', array());
418
- if (array_key_exists('others', $g)) $g = $g['others'];
419
- else $g = cdp_default_global_options();
420
-
421
- global $post;
422
- if (is_object($post)) $type = $post->post_type; else $type = false;
423
- $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
424
- $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
425
- $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
426
-
427
- if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false') return;
428
- global $cdp_plug_url;
429
-
430
- if ($a || $b || $c) {
431
- $icon = '<span class="cdp-admin-bar-icon" data-plug-path="' . $cdp_plug_url . '" data-this-id="' . get_the_ID() . '"></span>';
432
- $admin_bar->add_menu(array(
433
- 'id' => '#cdp-copy-bar-x',
434
- 'parent' => null,
435
- 'group' => null,
436
- 'title' => $icon . 'Copy this',
437
- 'href' => '#',
438
- 'meta' => array('class' => 'cdp-admin-bar-copy', 'target' => '_self')
439
- ));
440
- }
441
- }, 80);
442
- /** –– **/
443
-
 
 
 
 
 
 
 
444
  /** –– **\
445
  * Add notification to admin bar.
446
  * @since 1.0.0
447
  */
448
- add_action('admin_bar_menu', function ($admin_bar) {
449
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
450
- if (!is_admin()) return;
451
-
452
- if (!function_exists('cdp_notifications_menu'))
453
- require_once plugin_dir_path(__FILE__) . 'menu/notifications.php';
454
-
455
- if (function_exists('cdp_notifications_menu')) {
456
- $data = cdp_notifications_menu();
457
- $admin_bar->add_menu(array(
458
- 'id' => 'wp-admin-copy-and-delete-posts',
459
- 'parent' => null,
460
- 'group' => null,
461
- 'title' => $data['html'],
462
- 'href' => '#',
463
- 'meta' => array(
464
- 'class' => 'cdp-admin-bar-noti menupop' . (($data['in_list'] == 0)?' cdp-noti-hide':''),
465
- 'target' => '_self'
466
- )
467
- ));
468
- }
469
- }, 80);
470
- /** –– **/
471
-
 
472
  /** –– **\
473
  * This function adds version info.
474
  * @since 1.0.0
475
  */
476
- add_action('wp_head', function () {
477
- echo '<meta name="cdp-version" content="' . CDP_VERSION . '" />';
478
- });
479
- /** –– **/
480
-
481
  /** –– **\
482
  * This function adds thickbox modal to preview and view pages.
483
  * @since 1.0.0
484
  */
485
- add_action('wp_footer', function () {
486
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
487
-
488
- $g = get_option('_cdp_globals', array());
489
- if (array_key_exists('others', $g)) $g = $g['others'];
490
- else $g = cdp_default_global_options();
491
-
492
- if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false') return;
493
-
494
- global $cdp_plug_url, $post;
495
-
496
- $post_id = false;
497
- if (isset($post->ID)) $post_id = $post->ID;
498
-
499
-
500
- $screen = ((function_exists('get_current_screen'))?get_current_screen():false);
501
- $profiles = get_option('_cdp_profiles');
502
-
503
- if (is_single() || is_page()) {
504
- $hx = false;
505
- if ($g['cdp-premium-hide-tooltip'] == 'true') $hx = true;
506
- cdp_vars($hx, $cdp_plug_url, $post_id);
507
- cdp_modal($screen, $profiles);
508
- }
509
- });
510
- /** –– **/
511
-
 
 
 
 
 
512
  /** –– **\
513
  * Add prepared HTML for tooltips and other info.
514
  * @since 1.0.0
515
  */
516
- add_action('admin_notices', function () {
517
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
518
-
519
- global $post, $cdp_plug_url, $cdp_globals, $pagenow;
520
- $post_id = false; $hasParent = false;
521
- $screen = get_current_screen();
522
- $profiles = get_option('_cdp_profiles');
523
- $deny = ['edit-page', 'edit-post'];
524
- $hx = false;
525
-
526
- if (!in_array($screen->id, $deny)) {
527
- if (isset($post->ID)) {
528
- $post_id = $post->ID;
529
- $meta = get_post_meta($post->ID, '_cdp_origin');
530
- $site = get_post_meta($post->ID, '_cdp_origin_site');
531
- if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-references-post', $cdp_globals['others'])) {
532
- if ($cdp_globals['others']['cdp-references-edit'] == 'true') {
533
- if (function_exists('switch_to_blog') && $site) switch_to_blog($site);
534
- if (array_key_exists(0, $meta) && get_post_status($meta[0])) {
535
- $parentTitle = get_the_title($meta[0]);
536
- $link = get_post_permalink($meta[0]);
537
- $hasParent = array(
538
- 'title' => $parentTitle,
539
- 'link' => $link
540
- );
541
- }
542
- if (function_exists('restore_current_blog') && $site) restore_current_blog();
543
- }
544
- }
545
- }
546
- }
547
- if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-premium-hide-tooltip', $cdp_globals['others']) && $cdp_globals['others']['cdp-premium-hide-tooltip'] == 'true') {
548
- $hx = true;
549
- }
550
-
551
- if (get_option('_cdp_show_copy', false)) {
552
- echo '<span style="display: none; visibility: hidden;" id="cdp-show-copy-banner" data-value="true"></span>';
553
- delete_option('_cdp_show_copy');
554
- }
555
-
556
- if ($pagenow == 'edit.php') $post_id = false;
557
- cdp_vars($hx, $cdp_plug_url, $post_id, $hasParent, true);
558
- cdp_tooltip_content($profiles);
559
- cdp_modal($screen, $profiles);
560
-
561
- });
562
- /** –– **/
563
-
 
 
 
564
  /** –– **\
565
  * Add button in standard editor.
566
  * @since 1.0.0
567
  */
568
- add_action('post_submitbox_start', function () {
569
- if (cdp_check_permissions(wp_get_current_user()) == false) return;
570
- $g = get_option('_cdp_globals', array());
571
- if (array_key_exists('others', $g)) $g = $g['others'];
572
- else $g = cdp_default_global_options();
573
- if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'false') return;
574
-
575
- global $post, $pagenow;
576
- if (is_object($post)) $type = $post->post_type; else $type = false;
577
- $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
578
- $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
579
- $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
580
-
581
- if (($a || $b || $c) && $pagenow != 'post-new.php')
582
- echo '<div id="cdp-copy-btn"><a class="cdp-copy-btn-editor" href="#">Copy this post</a></div>';
583
-
584
- });
585
- /** –– **/
586
-
 
 
 
 
 
587
  /** –– **\
588
  * Add hook for cron (deletion).
589
  * @since 1.0.0
590
  */
591
- add_action('cdp_cron_delete', function ($args = false) {
592
-
593
- $ids = $args['ids'];
594
- $trash = $args['trash'];
595
- $site = (array_key_exists('site', $args)) ? $args['site'] : '-1';
596
- $tok = $args['token']['token'];
597
- $tsk = $args['token']['tsk'];
598
-
599
- if ($args == false) return;
600
-
601
- $cdp_cron = get_option('_cdp_crons');
602
-
603
- if (!isset($cdp_cron[$tok]) || !$cdp_cron[$tok]) return;
604
-
605
- $auit = $cdp_cron[$tok]['auit'];
606
- $auitd = $cdp_cron[$tok]['auitd'];
607
-
608
- $areWePro = areWePro(true, '/handler/crons.php', true);
609
-
610
- if ($auit == true && $areWePro && function_exists('cdpp_make_redirect')) cdpp_make_redirect($ids, $auitd);
611
- if ($trash == true && $areWePro && function_exists('cdpp_crons_trash_post')) cdpp_crons_trash_post($ids);
612
- else foreach ($ids as $i => $id) wp_delete_post($id, true);
613
-
614
- $cdp_cron[$tok]['tasks'][$tsk] = current_time('timestamp');
615
-
616
- $falsed = false; $last = false;
617
- $i = 0; $size = sizeof($cdp_cron[$tok]['tasks']);
618
- foreach ($cdp_cron[$tok]['tasks'] as $otsk => $val) {
619
- if ($val == false) $falsed = true; $i++;
620
- if ($i == ($size - 1)) $last = $otsk;
621
- }
622
-
623
- if ($tsk == '-0' || $last == $tsk || $falsed == false || $cdp_cron[$tok]['tasks'][$last] != false) {
624
- $cdp_cron[$tok]['done'] = current_time('timestamp');
625
- $cdp_cron[$tok]['data'] = array('formated-date' => date('d M Y, H:i:s'));
626
- if (array_key_exists('del_size', $cdp_cron[$tok])) {
627
- $cdp_cron[$tok]['data']['amount'] = $cdp_cron[$tok]['del_size'];
628
- $cdp_cron[$tok]['data']['text'] = 'Manual Cleanup removed ' . $cdp_cron[$tok]['del_size'] . ' post(s).';
629
- }
630
- $cdp_cron[$tok]['shown'] = false;
631
- }
632
-
633
- update_option('_cdp_crons', $cdp_cron);
634
-
635
- });
636
- /** –– **/
 
 
 
 
 
 
 
 
 
 
637
 
638
  /** –– **\
639
  * Check if user is permmited to use this plugin.
@@ -642,219 +778,275 @@ if (!defined('ABSPATH')) exit;
642
  *
643
  * @return boolean
644
  */
645
- function cdp_check_permissions($user = array()) {
646
- if (!isset($user) || empty($user)) return false;
647
-
648
- $access = false;
649
- $access_roles = get_option('_cdp_globals');
650
- if (!isset($access_roles['roles'])) $access_roles = array();
651
-
652
- foreach ($user->roles as $role => $name) {
653
- if ($name == 'administrator' || (isset($access_roles['roles'][$name]) && $access_roles['roles'][$name] == 'true')) {
654
- $access = true;
655
- break;
656
- }
657
- }
658
-
659
- return $access;
660
- }
661
- /** –– **/
662
-
 
 
663
  /** –– **\
664
  * First run of the plugin setup default options for Default profile
665
  * @since 1.0.0
666
  */
667
- add_action('cdp_plugin_setup', 'cdp_setup_default_profile');
668
- function cdp_setup_default_profile() {
669
- $current = get_option('_cdp_globals');
670
- $isSetup = get_option('_cdp_default_setup');
671
- if (($current != false && array_key_exists('default', $current)) || $isSetup) return;
 
 
672
 
673
- $already = array(); $globals = array();
674
- $already['default'] = cdp_default_options();
675
- $globals['others'] = cdp_default_global_options();
 
676
 
677
- $s1 = update_option('_cdp_globals', $globals);
678
  $s2 = update_option('_cdp_profiles', $already);
679
 
680
- if ($s1 || $s2) update_option('_cdp_default_setup', true);
681
- }
682
- /** –– **/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
683
 
684
  /** –– **\
685
  * Default settings for unset profiles
686
  * @since 1.0.0
687
  */
688
- function cdp_default_options() {
689
- return array(
690
- 'title' => 'true',
691
- 'date' => 'false',
692
- 'status' => 'false',
693
- 'slug' => 'true',
694
- 'excerpt' => 'true',
695
- 'content' => 'true',
696
- 'f_image' => 'true',
697
- 'template' => 'true',
698
- 'format' => 'true',
699
- 'author' => 'true',
700
- 'password' => 'true',
701
- 'attachments' => 'false',
702
- 'children' => 'false',
703
- 'comments' => 'false',
704
- 'menu_order' => 'true',
705
- 'category' => 'true',
706
- 'post_tag' => 'true',
707
- 'taxonomy' => 'true',
708
- 'nav_menu' => 'true',
709
- 'link_category' => 'true',
710
- 'names' => array(
711
- 'prefix' => '',
712
- 'suffix' => '#[Counter]',
713
- 'format' => '1',
714
- 'custom' => 'm/d/Y',
715
- 'display' => 'Default'
716
- ),
717
- 'usmplugin' => 'false',
718
- 'yoast' => 'false',
719
- 'woo' => 'false'
720
- );
721
- }
722
- function cdp_default_global_options() {
723
- return array(
724
- 'cdp-content-pages' => 'true',
725
- 'cdp-content-posts' => 'true',
726
- 'cdp-content-custom' => 'true',
727
- 'cdp-display-posts' => 'true',
728
- 'cdp-display-edit' => 'true',
729
- 'cdp-display-admin' => 'true',
730
- 'cdp-display-bulk' => 'true',
731
- 'cdp-display-gutenberg' => 'true',
732
- 'cdp-references-post' => 'false',
733
- 'cdp-references-edit' => 'false',
734
- 'cdp-premium-import' => 'false',
735
- 'cdp-premium-hide-tooltip' => 'false',
736
- 'cdp-menu-in-settings' => 'false',
737
- );
738
- }
739
- /** –– **/
740
-
 
 
741
  /** –– **\
742
  * Add state info if user want it (the reference to original)
743
  * @since 1.0.0
744
  */
745
- if (is_admin()) {
746
- if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-references-post', $cdp_globals['others'])) {
747
- if ($cdp_globals['others']['cdp-references-post'] == 'true') add_filter('display_post_states', 'cdp_state_post_add', 1, 10 );
748
- }
749
- }
750
-
751
- function cdp_state_post_add($post_states, $post) {
752
- if (cdp_check_permissions(wp_get_current_user()) == false) return $post_states;
753
-
754
- $meta = get_post_meta($post->ID, '_cdp_origin');
755
- $site = get_post_meta($post->ID, '_cdp_origin_site');
756
-
757
- if (function_exists('switch_to_blog') && $site) switch_to_blog($site);
758
- for ($i = sizeof($meta); $i >= 0; --$i) {
759
- if (array_key_exists(($i-1), $meta) && get_post_status($meta[$i-1])) {
760
- $link = get_post_permalink($meta[$i-1]);
761
- $title = get_the_title($meta[$i-1]) . " " . "ID: " . $meta[$i-1];
762
- $post_states['_cdp'] = "Copy of <a class='cdp-tooltip-top' title='$title' href='$link' target='_blank'>this</a> post";
763
- break;
764
- }
765
- }
766
- if (function_exists('restore_current_blog') && $site) restore_current_blog();
767
-
768
- return $post_states;
769
- }
770
- /** –– **/
 
 
 
 
 
771
 
772
  /** –– **\
773
  * Check the premium status and correction
774
  * @since 1.0.0
775
  */
776
- function areWePro($include = true, $file = '/content/premium.php', $ignore_perms = false) {
777
- if (!$ignore_perms && cdp_check_permissions(wp_get_current_user()) == false) return false;
778
-
779
- // Get WP-Plugin path
780
- $premium_plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
781
- $premium_dir = WP_PLUGIN_DIR . '/' . 'copy-delete-posts-premium';
782
- $pplugin_path = $premium_dir . $file;
783
- $squirrel = 'cdpp_squirrelicense';
784
- $core = '/includes/core.php';
785
- $areWePro = false;
786
-
787
- // Load premium content if the plugin is here
788
- if (is_dir($premium_dir) && ((function_exists('is_plugin_active') && is_plugin_active($premium_plugin)) || (!function_exists('is_plugin_active')))) {
789
-
790
- // Include cool features
791
- if ($include && file_exists($pplugin_path)) require_once($pplugin_path);
792
-
793
- // Is premium function
794
- if (file_exists($pplugin_path)) $areWePro = true;
795
-
796
- // Has special functions
797
- if (file_exists($pplugin_path) && file_exists($premium_dir . $core)) {
798
- require_once($premium_dir . $core);
799
- if (function_exists($squirrel)) $areWePro = $squirrel()['p'];
800
- else $areWePro = false;
801
- } else $areWePro = false;
802
-
803
- }
804
-
805
- // Return answer
806
- return $areWePro;
807
- }
808
- /** –– **/
809
-
 
 
 
 
 
810
  /** –– **\
811
  * It adds button on plugin list below plugin
812
  * @since 1.0.0
813
  */
814
- add_filter('plugin_action_links_' . plugin_basename(__FILE__), function ($links) {
815
- $links['cdp-settings-link'] = '<a href="' . admin_url('/admin.php?page=copy-delete-posts') . '">Settings</a>';
816
- return $links;
817
- });
818
- /** –– **/
819
 
820
  /** –– **\
821
  * This function fixes Wordpress wp_upload_dir function
822
  * @since 1.0.0
823
  */
824
- function cdp_fix_upload_paths($data) {
825
- // Check if the base URL matches the format
826
- $needs_fixing = preg_match("/wp-content\/blogs\.dir\/(\d+)\/files/", $data['baseurl'], $uri_part);
827
 
828
- if ($needs_fixing) {
829
- $data['url'] = str_replace($uri_part[0], 'files', $data['url']);
830
- $data['baseurl'] = str_replace($uri_part[0], 'files', $data['baseurl']);
831
- }
832
 
833
- return $data;
834
- }
835
- /** –– **/
 
836
 
837
  /** –– **\
838
  * This function will sanitize whole array with sanitize_text_field – by RECURSION
839
  * @since 1.0.0
840
  */
841
- function cdp_sanitize_array($data = null) {
842
- $array = array();
843
- if (is_array($data) || is_object($data))
844
- foreach ($data as $key => $value) {
845
- $key = ((is_numeric($key))?intval($key):sanitize_text_field($key));
846
- if (is_array($value) || is_object($value)) $array[$key] = cdp_sanitize_array($value);
847
- else $array[$key] = sanitize_text_field($value);
848
- }
849
- else if (is_string($data)) return sanitize_text_field($data);
850
- else if (is_bool($data)) return $data;
851
- else if (is_null($data)) return 'false';
852
- else {
853
- error_log('Copy & Delete Posts[copy-delete-posts.php:707]: Unknown AJaX datatype – ' . gettype($data));
854
- echo 'error – invalid data';
855
- wp_die();
856
- }
 
 
 
 
 
 
 
 
857
 
858
- return $array;
859
- }
860
  /** –– **/
1
  <?php
2
+
3
  /**
4
  * Plugin Name: Copy & Delete Posts
5
  * Plugin URI: https://copy-delete-posts.com
6
  * Description: The best solution to easily make duplicates of your posts & pages, and delete them in one go.
7
+ * Version: 1.1.8
8
  * Author: Copy Delete Posts
9
  * Author URI: https://copy-delete-posts.com/
10
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
11
  // Exit if accessed directly.
12
+ if (!defined('ABSPATH'))
13
+ exit;
14
 
15
  /** –– **\
16
  * Opt-in.
17
  * @since 1.1.2
18
  */
19
+ require_once 'analyst/main.php';
20
+ analyst_init(array(
21
+ 'client-id' => 'ovgxe3xq075ladbp',
22
+ 'client-secret' => 'b4de5ed2ba7be687e233d152ec1e8fd116052ab0',
23
+ 'base-dir' => __FILE__
24
+ ));
25
+
26
+ /** –– * */
 
 
27
  /** –– **\
28
  * Global variables and constants.
29
  * @since 1.0.0
30
  */
31
+ // Plugin constants
32
+ define('CDP_VERSION', '1.1.8');
33
+ define('CDP_WP_VERSION', get_bloginfo('version'));
34
+ define('CDP_SCRIPT_DEBUG', false);
35
+ define('CDP_ROOT_DIR', __DIR__);
36
+ define('CDP_ROOT_FILE', __FILE__);
37
+ $cdp_plug_url = plugins_url('', __FILE__);
38
+
39
+ load_plugin_textdomain('copy-delete-posts', null, dirname(plugin_basename(__FILE__)) . '/languages');
40
+
41
+ // Other only admin stuff
42
+ if (is_admin()) {
43
+
44
+ // Set constant variables for this file
45
+ $cdp_dir = dirname(__FILE__);
46
+ $cdp_globals = get_option('_cdp_globals');
47
+ $cdp_premium = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
48
+
49
+ // Try to show error while debugging
50
+ if (CDP_SCRIPT_DEBUG === true) {
51
+ error_reporting(E_ALL);
52
+ ini_set('display_errors', 1);
53
+ }
54
+ }
55
+
56
+ /** –– * */
 
57
  /** –– **\
58
  * Fired on plugin activation.
59
  * @since 1.0.0
60
  */
61
+ register_activation_hook(__FILE__, function () {
62
+ if (function_exists('activate_plugin')) {
63
+ add_option('_cdp_redirect', true);
64
+ $cdp_premium_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium';
65
+ $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
66
+ if (!is_plugin_active($plugin) && is_dir($cdp_premium_path))
67
+ activate_plugin($plugin);
68
+ }
69
+
70
+ if (get_option('_cdp_review', false) == false) {
71
+ $review = array(
72
+ 'installed' => time(),
73
+ 'users' => array()
74
+ );
75
+
76
+ update_option('_cdp_review', $review);
77
+ }
78
+
79
+ do_action('cdp_plugin_setup');
80
+ });
81
+ /** –– * */
82
  /** –– **\
83
  * Fired on plugin deactivation.
84
  * @since 1.0.0
85
  */
86
+ register_deactivation_hook(__FILE__, function () {
87
+ if (function_exists('deactivate_plugins')) {
88
+ $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
89
+ if (is_plugin_active($plugin))
90
+ add_action('update_option_active_plugins', function () {
91
+ $plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
92
+ deactivate_plugins($plugin);
93
+ });
94
+ }
95
+ });
96
+ /** –– * */
97
  /** –– **\
98
  * Fired on plugin load and check permissions.
99
  * @since 1.0.0
100
  */
101
+ add_action('plugins_loaded', function () {
102
+ do_action('cdp_loaded');
103
+ });
104
+ /** –– * */
 
105
  /** –– **\
106
  * Fired on any plugin upgrade (in case if it's ours)
107
  * @since 1.0.6
108
  */
109
+ add_action('upgrader_process_complete', function () {
110
+ if (get_option('_cdp_review', false) == false) {
111
+ $review = array(
112
+ 'installed' => time(),
113
+ 'users' => array()
114
+ );
115
+
116
+ update_option('_cdp_review', $review);
117
+ }
118
+ });
119
+ /** –– * */
 
120
  /** –– **\
121
  * Include all menus.
122
  * @since 1.0.0
148
  * Admin Init
149
  * @since 1.0.0
150
  */
151
+ add_action('admin_init', function () {
152
+ if (cdp_check_permissions(wp_get_current_user()) == false)
153
+ return;
154
+
155
+ if (get_option('_cdp_redirect', false)) {
156
+ delete_option('_cdp_redirect', false);
157
+ wp_redirect(admin_url('admin.php?page=copy-delete-posts'));
158
+ }
159
+
160
+ global $cdp_premium;
161
+ $cdp_premium_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium';
162
+ $cdp_premium_ver_path = WP_PLUGIN_DIR . '/copy-delete-posts-premium/version.txt';
163
+ if (defined('CDP_PREMIUM_VERSION') && version_compare(CDP_PREMIUM_VERSION, CDP_VERSION, '!=')) {
164
+ update_option('_cdp_mishmash', true);
165
+ } else {
166
+ if (is_dir($cdp_premium_path) && file_exists($cdp_premium_ver_path)) {
167
+ $cdp_prem_ver_file = fopen($cdp_premium_ver_path, 'r') or false;
168
+ $cdp_prem_ver = fgets($cdp_prem_ver_file);
169
+ fclose($cdp_prem_ver_file);
170
+
171
+ if ((trim($cdp_prem_ver) == CDP_VERSION) && !is_plugin_active($cdp_premium)) {
172
+ activate_plugin($cdp_premium, '', false, true);
173
+ // add_option('_cdp_redirect', false);
174
+ }
175
+ if (trim($cdp_prem_ver) == CDP_VERSION)
176
+ update_option('_cdp_mishmash', false);
177
+ }
178
+ }
179
+ if (is_plugin_active($cdp_premium) && !file_exists($cdp_premium_ver_path)) {
180
+ if (is_plugin_active($cdp_premium))
181
+ deactivate_plugins($cdp_premium, true);
182
+ }
183
+ });
184
+ /** –– * */
185
  /** –– **\
186
  * Setup assets.
187
  * @since 1.0.0
188
  */
189
+ add_action('admin_enqueue_scripts', function () {
190
+ if (cdp_check_permissions(wp_get_current_user()) == false)
191
+ return;
192
+ if (function_exists('wp_doing_ajax') && wp_doing_ajax())
193
+ return;
194
+ global $cdp_plug_url;
195
+
196
+ global $pagenow, $post;
197
+ $screen = get_current_screen();
198
+ $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
199
+ $allowed = ['post', 'edit-post', 'toplevel_page_copy-delete-posts', 'edit-page', 'page'];
200
+ $at = ($screen->id != 'attachment');
201
+
202
+ $g = get_option('_cdp_globals', array());
203
+ if (array_key_exists('others', $g))
204
+ $g = $g['others'];
205
+ else
206
+ $g = cdp_default_global_options();
207
+
208
+ if (is_object($post))
209
+ $type = $post->post_type;
210
+ else
211
+ $type = false;
212
+
213
+ if (isset($g['cdp-menu-in-settings']) && $g['cdp-menu-in-settings'] == 'true') {
214
+ ?>
215
+ <style media="screen">
216
+ #toplevel_page_copy-delete-posts { display: none; visibility: hidden; }
217
+ </style>
218
+ <?php
219
+
220
+ }
221
+
222
+ $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
223
+ wp_enqueue_style('cdp-css-global', "{$cdp_plug_url}/assets/css/cdp-global{$min}.css", '', $ver);
224
+ wp_enqueue_script('cdp-js-global', "{$cdp_plug_url}/assets/js/cdp-global{$min}.js", ['jquery'], $ver, true);
225
+ cdp_load_localize_global_js();
226
+ wp_enqueue_style('cdp-css-select', "{$cdp_plug_url}/assets/css/cdp-select{$min}.css", '', $ver);
227
+ wp_enqueue_script('cdp-js-select', "{$cdp_plug_url}/assets/js/cdp-select{$min}.js", '', $ver, true);
228
+ wp_enqueue_style('cdp-tooltips-css', "{$cdp_plug_url}/assets/css/cdp.tooltip{$min}.css", '', $ver);
229
+ wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
230
+ if (method_exists($screen, 'is_block_editor')) {
231
+ if (!$screen->is_block_editor() && $pagenow == 'post.php' && $at) {
232
+ if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'true') {
233
+ $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
234
+ $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
235
+ $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
236
+ if (($a || $b || $c) && $pagenow != 'post-new.php')
237
+ wp_enqueue_style('cdp-editor', "{$cdp_plug_url}/assets/css/cdp-editor{$min}.css", '', $ver);
238
+ }
239
+ }
240
+ }
241
+
242
+ $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
243
+ if ((!$screen || !in_array($screen->id, $allowed)) && !($pagenow == 'edit.php' || $pagenow == 'post.php'))
244
+ return;
245
+ wp_enqueue_style('cdp-css', "{$cdp_plug_url}/assets/css/cdp{$min}.css", '', $ver);
246
+ wp_enqueue_style('cdp-css-user', "{$cdp_plug_url}/assets/css/cdp-user{$min}.css", '', $ver);
247
+ wp_enqueue_script('cdp-icPagination', "{$cdp_plug_url}/assets/js/cdp-icPagination{$min}.js", '', $ver);
248
+ wp_enqueue_script('cdp', "{$cdp_plug_url}/assets/js/cdp{$min}.js", '', $ver, true);
249
+ $cdpJSArgs = [
250
+ 'strNoItems' => __('No items to show, try with other filters!', 'copy-delete-posts'),
251
+ 'strIntroSaveIssue' => __('Something went wrong and we couldn\'t save intro settings!', 'copy-delete-posts'),
252
+ 'strIntroSaveIssue2' => __('Something went wrong and we couldn\'t save intro settings.', 'copy-delete-posts'),
253
+ 'strIntroUpdateIssue' => __('Something went wrong and we couldn\'t update intro settings – try again!', 'copy-delete-posts'),
254
+ 'strIntroUpdateIssue2' => __('Something went wrong and we couldn\'t update intro settings. – Please check console for more info.', 'copy-delete-posts'),
255
+ 'strSettingsSaved' => __('All your settings were saved!', 'copy-delete-posts'),
256
+ 'strSettingsSaveIssue' => __('Something went wrong and we couldn\'t save your settings.', 'copy-delete-posts'),
257
+ 'strSettingsSaveIssue2' => __('Something went wrong and we couldn\'t save your settings. – Please check console for more info.', 'copy-delete-posts'),
258
+ 'strTogglableName' => __('(Name of original)', 'copy-delete-posts'),
259
+ 'strCopyNumIssue' => __('You need to insert positive number for copies.', 'copy-delete-posts'),
260
+ 'strCopyPostIssue' => __('Something went wrong and we couldn\'t copy this post – please try again!', 'copy-delete-posts'),
261
+ 'strCopyPostIssueConsInfo' => __('Something went wrong and we couldn\'t copy this post. – See dev console for more info.', 'copy-delete-posts'),
262
+ 'strTooltipBtnIssue' => __('Couldn\'t recognize that button, please try again.', 'copy-delete-posts'),
263
+ 'strSelectedProfIssue' => __('Unable to recognize selected profile, please try again.', 'copy-delete-posts'),
264
+ 'strSelectedProfGetIssue' => __('Something went wrong and we couldn\'t get profile settings. – Check console for more details', 'copy-delete-posts'),
265
+ 'strConsLogErr' => __('Copy & Delete Post – Error', 'copy-delete-posts'),
266
+ 'strSelectedProfGetIssue2' => __('Something went wrong and we couldn\'t get profile settings – please try again!', 'copy-delete-posts'),
267
+ 'strCopyInProgress' => __('Copy in progress...', 'copy-delete-posts'),
268
+ 'strServerDataIssue' => __('There was an error while getting data from server, please try again.', 'copy-delete-posts'),
269
+ 'strPostListIssue' => __('Something went wrong and we couldn\'t get post list. – Please check console for more info.', 'copy-delete-posts'),
270
+ 'strCheckDuplicatesSearch' => __('Please, check for: which duplicates you are looking for', 'copy-delete-posts'),
271
+ 'strServerConnectIssue' => __('Cannot connect to the server, premium filters will not be applied.', 'copy-delete-posts'),
272
+ 'strFilterNotSelected' => __('You did not select any filter.<br>Click <a href="#" class="cdp-show-the-copies">here</a> to show all copies (of the selected post type) made by this plugin.', 'copy-delete-posts'),
273
+ 'strNoDataForFilter' => __('No posts/pages meeting the current filter conditions.', 'copy-delete-posts'),
274
+ 'strCheckSteps' => __('Please check that you completed all steps, before this task!', 'copy-delete-posts'),
275
+ 'strSelectPostToDel' => __('Nothing to do here, please select at least one post to delete.', 'copy-delete-posts'),
276
+ 'strFieldWrongCount' => __('You have wrong count in throttling field, please fix.', 'copy-delete-posts'),
277
+ 'strDeletionProcessStarted' => __('Deletion process started, you can close this page now and wait till the process ends!', 'copy-delete-posts'),
278
+ 'strDeletionTaskStart' => __('Something went wrong and we couldn\'t setup the deletion task.', 'copy-delete-posts'),
279
+ 'strDeletionTaskEnd' => __('– Please try without throttling.', 'copy-delete-posts'),
280
+ 'strDeletionTaskConsInfo' => __('Something went wrong and we couldn\'t setup the deletion task. – Please check console for more info.', 'copy-delete-posts'),
281
+ 'strLicenseKeyEmpty' => __('Please enter license key, currently it is empty.', 'copy-delete-posts'),
282
+ 'strLicenseActiveReloading' => __('License is already active, let us reload the page!', 'copy-delete-posts'),
283
+ 'strLicenseValidPressBtn' => __('License is valid, press the button again to activate!', 'copy-delete-posts'),
284
+ 'strUnknownRespRefreshPage' => __('Unknown response, please try refresh the page!', 'copy-delete-posts'),
285
+ 'strSendRequestIssue' => __('Something went wrong and we couldn\'t send request, please try refresh page and try again.', 'copy-delete-posts'),
286
+ 'strSendRequestIssue2' => __('Something went wrong and we couldn\'t send request, are you connected to the internet?', 'copy-delete-posts'),
287
+ 'strIncludingHtml' => __('<b>including</b> empty', 'copy-delete-posts'),
288
+ 'strIncludingHtml2' => __('only if <u><b>not</b></u> empty', 'copy-delete-posts'),
289
+ 'strTogglableNameChange' => __('Change it to (Name of original)', 'copy-delete-posts'),
290
+ 'strTogglableNameChangeBlank' => __('Change it to blank', 'copy-delete-posts'),
291
+ 'strDeletingPosts' => __('Deleting Posts', 'copy-delete-posts'),
292
+ 'strAutoCleanPosts' => __('Auto Cleaning-up', 'copy-delete-posts'),
293
+ 'strKill' => __('Kill', 'copy-delete-posts'),
294
+ 'strDeletedPosts' => __('Deleted Posts', 'copy-delete-posts'),
295
+ 'strAutoCleanedPosts' => __('Auto Cleaned-up', 'copy-delete-posts'),
296
+ 'strHide' => __('Hide', 'copy-delete-posts'),
297
+ 'strDefCopySettingsStart' => __('Define your copy settings', 'copy-delete-posts'),
298
+ 'strDefCopySettingsLink' => __('here', 'copy-delete-posts'),
299
+ 'strCopyToOtherSiteHtml' => __('If you’re on a multisite you can copy it to other sites with the Premium Plugin. <a href="https://sellcodes.com/CylMIdJD" target="_blank">Order it now!</a>', 'copy-delete-posts'),
300
+ 'strPremFeatureHtml' => __('This is a Premium Feature.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Check it out and upgrade today</a>,<br>we made it <b>really affordable!</b>', 'copy-delete-posts'),
301
+ 'strPreOrderHtml' => __('You can copy it to other sites with the Premium Plugin.<br><a href="https://sellcodes.com/CylMIdJD" target="_blank">Pre-order it now</a>', 'copy-delete-posts'),
302
+ 'strMultisiteCanCopy' => __('If you’re on a multisite you can copy it to other sites.', 'copy-delete-posts'),
303
+ 'strChangeTypeOfCopy' => __('Change the type of this copy <span class="cdp-premium-icon cdp-big-icon"></span>', 'copy-delete-posts'),
304
+ 'strPostDuplicateOf' => __('This post is a duplicate of', 'copy-delete-posts'),
305
+ 'strAreYouSure' => __('Are you REALLY sure?', 'copy-delete-posts'),
306
+ 'strYouAreCrazy' => __('You\'re crazy! – Here is the output:', 'copy-delete-posts'),
307
+ 'strDebugOutputEnd' => __('–––––––––––––- END OF THE DEBUG OUTPUT –––––––––––––- ', 'copy-delete-posts'),
308
+
309
+ ];
310
+ wp_localize_script('cdp', 'cdpJS', $cdpJSArgs);
311
+
312
+ wp_enqueue_script('cdp-modal', "{$cdp_plug_url}/assets/js/cdp-modal{$min}.js", '', $ver, true);
313
+ $cdpModalJSArgs = [
314
+ 'strRowCopyIssue' => __('Please select at least one row to copy.', 'copy-delete-posts'),
315
+ 'strRowCopyTryAgain' => __('Please select at least one row to copy and try again.', 'copy-delete-posts'),
316
+ 'strSettCopyIssue' => __('Please select basic settings for this copy.', 'copy-delete-posts'),
317
+ 'strPostCopyIssue' => __('Something went wrong and we couldn\'t copy this post – please try again!', 'copy-delete-posts'),
318
+ 'strPostCopyIssueConsoleInfo' => __('Something went wrong and we couldn\'t copy this post. – See dev console for more info.', 'copy-delete-posts'),
319
+ 'strRecogBtnIssue' => __('Couldn\'t recognize that button, please try again.', 'copy-delete-posts'),
320
+ 'strCopyInProgress' => __('Copy in progress...', 'copy-delete-posts'),
321
+ ];
322
+ wp_localize_script('cdp-modal', 'cdpModalJS', $cdpModalJSArgs);
323
+
324
+ wp_enqueue_script('cdp-bulk', "{$cdp_plug_url}/assets/js/cdp-bulk{$min}.js", '', $ver, true);
325
+ $cdpBulkJSArgs = ['strOptCopy' => __('Copy', 'copy-delete-posts')];
326
+ wp_localize_script('cdp-bulk', 'cdpBulkJS', $cdpBulkJSArgs);
327
+ });
328
+ /** –– * */
329
  /** –– **\
330
  * Setup assets (not admin).
331
  * @since 1.0.0
332
  */
333
+ add_action('wp_enqueue_scripts', function () {
334
+ if (cdp_check_permissions(wp_get_current_user()) == false)
335
+ return;
336
+ if ((function_exists('wp_doing_ajax') && wp_doing_ajax()) || (!(is_single() || is_page())))
337
+ return;
338
+ global $cdp_plug_url;
339
+
340
+ $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
341
+ $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
342
+ wp_enqueue_script('jquery-ui-draggable');
343
+ wp_enqueue_script('jquery-ui-droppable');
344
+ wp_enqueue_script('jquery-ui-sortable');
345
+ wp_enqueue_style('cdp-css-global', "{$cdp_plug_url}/assets/css/cdp-global{$min}.css", '', $ver);
346
+ wp_enqueue_script('cdp-js-global', "{$cdp_plug_url}/assets/js/cdp-global{$min}.js", ['jquery'], $ver, true);
347
+ cdp_load_localize_global_js();
348
+ wp_enqueue_style('cdp-css', "{$cdp_plug_url}/assets/css/cdp{$min}.css", '', $ver);
349
+ wp_enqueue_style('cdp-css-user', "{$cdp_plug_url}/assets/css/cdp-user{$min}.css", '', $ver);
350
+ wp_enqueue_script('cdp', "{$cdp_plug_url}/assets/js/cdp{$min}.js", ['jquery'], $ver, true);
351
+ wp_enqueue_script('cdp-tooltips', "{$cdp_plug_url}/assets/js/cdp.tooltip{$min}.js", '', $ver, true);
352
+ wp_enqueue_style('cdp-tooltips-css', "{$cdp_plug_url}/assets/css/cdp.tooltip{$min}.css", '', $ver);
353
+ wp_enqueue_script('cdp-modal', "{$cdp_plug_url}/assets/js/cdp-modal{$min}.js", ['jquery'], $ver, true);
354
+ wp_enqueue_script('cdp-js-user', "{$cdp_plug_url}/assets/js/cdp-user{$min}.js", '', $ver, true);
355
+ wp_enqueue_style('cdp-css-select', "{$cdp_plug_url}/assets/css/cdp-select{$min}.css", '', $ver);
356
+ wp_enqueue_script('cdp-js-select', "{$cdp_plug_url}/assets/js/cdp-select{$min}.js", '', $ver, true);
357
+ });
358
+ /** –– * */
359
  /** –– **\
360
  * Setup assets (for gutenberg).
361
  * @since 1.0.0
362
  */
363
+ add_action('enqueue_block_editor_assets', function () {
364
+ if (cdp_check_permissions(wp_get_current_user()) == false)
365
+ return;
366
+
367
+ global $post;
368
+ global $cdp_plug_url;
369
+ $min = defined('CDP_SCRIPT_DEBUG') && CDP_SCRIPT_DEBUG ? '' : '.min';
370
+
371
+ $g = get_option('_cdp_globals', array());
372
+ if (array_key_exists('others', $g))
373
+ $g = $g['others'];
374
+ else
375
+ $g = cdp_default_global_options();
376
+
377
+ $ver = preg_replace('#[^\pL\pN/-]+#', '', CDP_VERSION);
378
+ if (is_object($post))
379
+ $type = $post->post_type;
380
+ else
381
+ $type = false;
382
+ $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
383
+ $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
384
+ $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
385
+ if ((isset($g['cdp-display-gutenberg']) && $g['cdp-display-gutenberg'] == 'true') && ($a || $b || $c)) {
386
+ wp_enqueue_style('cdp-gutenberg', "{$cdp_plug_url}/assets/css/cdp-gutenberg{$min}.css", '', $ver);
387
+ wp_enqueue_script('cdp-js-gutenberg', "{$cdp_plug_url}/assets/js/cdp-gutenberg{$min}.js", ['jquery'], $ver, true);
388
+ $cdpGutenbergJSArgs = ['cdpCopy' => __('Copy this', 'copy-delete-posts')];
389
+ wp_localize_script('cdp-js-gutenberg', 'cdpGutenbergJS', $cdpGutenbergJSArgs);
390
+ }
391
+ });
392
+ /** –– * */
393
  /** –– **\
394
  * Settings and menu initializer.
395
  * @since 1.0.0
396
  */
397
+ add_action('admin_menu', function () {
398
+ if (cdp_check_permissions(wp_get_current_user()) == false)
399
+ return;
400
 
401
  // Menu icon
402
  $icon_url = plugin_dir_url(__FILE__) . 'assets/imgs/icon.png';
404
  // Main menu slug
405
  $parentSlug = 'copy-delete-posts';
406
 
407
+ // Globals
408
+ $g = get_option('_cdp_globals', array());
409
+ if (array_key_exists('others', $g))
410
+ $g = $g['others'];
411
+ else
412
+ $g = cdp_default_global_options();
413
 
414
  // Main menu hook
415
+ add_menu_page(__('Copy & Delete Posts', 'copy-delete-posts'), __('<span id="cdp-menu">Copy & Delete Posts</span>', 'copy-delete-posts'), 'read', $parentSlug, 'cdp_configuration', $icon_url, $position = 98);
416
+ if (isset($g['cdp-menu-in-settings']) && $g['cdp-menu-in-settings'] == 'true') {
417
+ add_submenu_page('tools.php', __('Copy & Delete Posts Menu', 'copy-delete-posts'), __('<span id="cdp-menu">Copy & Delete Posts</span>', 'copy-delete-posts'), 'read', 'copy-delete-posts', 'cdp_configuration', 3);
418
+ }
419
 
420
  // Remove default submenu by menu
421
  remove_submenu_page($parentSlug, $parentSlug);
422
+ });
423
+ /** –– * */
 
424
  /** –– **\
425
  * Add copy option to Quick Actions of Posts.
426
  * @since 1.0.0
427
  */
428
+ add_filter('post_row_actions', function ($actions, $post) {
429
+ if (cdp_check_permissions(wp_get_current_user()) == false)
430
+ return $actions;
431
+
432
+ // Get global options and post type
433
+ $g = get_option('_cdp_globals', array());
434
+ if (array_key_exists('others', $g))
435
+ $g = $g['others'];
436
+ else
437
+ $g = cdp_default_global_options();
438
+ $type = $post->post_type;
439
+
440
+ // If user want to see the copy buton here pass
441
+ if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
442
+ if (($type == 'post' && $g['cdp-content-posts'] == 'true') || ($type != 'post' && $g['cdp-content-custom'] == 'true'))
443
+ $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' x='" . $type . "' title='" . __('test', 'copy-delete-posts') . "' data-cdp-id='{$post->ID}'>" . __('Copy', 'copy-delete-posts') . "</span></a>";
444
+
445
+ return $actions;
446
+ }, 10, 2);
447
+ /** –– * */
448
  /** –– **\
449
  * Add copy option to Quick Actions of Pages.
450
  * @since 1.0.0
451
  */
452
+ add_filter('page_row_actions', function ($actions, $page) {
453
+ if (cdp_check_permissions(wp_get_current_user()) == false)
454
+ return;
455
+
456
+ // Get global options and post type
457
+ $g = get_option('_cdp_globals', array());
458
+ if (array_key_exists('others', $g))
459
+ $g = $g['others'];
460
+ else
461
+ $g = cdp_default_global_options();
462
+ $type = $page->post_type;
463
+
464
+ // If user want to see the copy buton here pass
465
+ if (isset($g['cdp-display-posts']) && $g['cdp-display-posts'] == 'true')
466
+ if (($type == 'page' && $g['cdp-content-pages'] == 'true') || ($type != 'page' && $g['cdp-content-custom'] == 'true'))
467
+ $actions['cdp_copy'] = "<a href='#'><span class='cdp-copy-button cdp-tooltip-copy' title='" . __('test', 'copy-delete-posts') . "' data-cdp-id='{$page->ID}'>" . __('Copy', 'copy-delete-posts') . "</span></a>";
468
+
469
+ return $actions;
470
+ }, 10, 2);
471
+ /** –– * */
472
  /** –– **\
473
  * Add copy option to Bulk Actions of Posts.
474
  * @since 1.0.0
475
  */
476
+ add_filter('bulk_actions-edit-post', function ($bulk_actions) {
477
+ if (cdp_check_permissions(wp_get_current_user()) == false)
478
+ return;
479
+
480
+ $g = get_option('_cdp_globals', array());
481
+ if (array_key_exists('others', $g))
482
+ $g = $g['others'];
483
+ else
484
+ $g = cdp_default_global_options();
485
+
486
+ if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true')
487
+ $bulk_actions['cdp_bulk_copy'] = __('Copy', 'copy-delete-posts');
488
+
489
+ return $bulk_actions;
490
+ });
491
+ /** –– * */
492
  /** –– **\
493
  * Add copy option to Bulk Actions of Pages.
494
  * @since 1.0.0
495
  */
496
+ add_filter('bulk_actions-edit-page', function ($bulk_actions) {
497
+ if (cdp_check_permissions(wp_get_current_user()) == false)
498
+ return;
499
+
500
+ $g = get_option('_cdp_globals', array());
501
+ if (array_key_exists('others', $g))
502
+ $g = $g['others'];
503
+ else
504
+ $g = cdp_default_global_options();
505
+
506
+ if (isset($g['cdp-display-bulk']) && $g['cdp-display-bulk'] == 'true')
507
+ $bulk_actions['cdp_bulk_copy'] = __('Copy', 'copy-delete-posts');
508
+
509
+ return $bulk_actions;
510
+ });
511
+ /** –– * */
512
  /** –– **\
513
  * Add copy option to admin bar inside preview.
514
  * @since 1.0.0
515
  */
516
+ add_action('admin_bar_menu', function ($admin_bar) {
517
+ if (cdp_check_permissions(wp_get_current_user()) == false)
518
+ return;
519
+ $screen = ((function_exists('get_current_screen') ? get_current_screen() : false));
520
+ $screens = ['post', 'page'];
521
+
522
+ if (!(is_single() || is_page() || (isset($screen) && ($screen != false && in_array($screen->id, $screens)))))
523
+ return;
524
+
525
+ $g = get_option('_cdp_globals', array());
526
+ if (array_key_exists('others', $g))
527
+ $g = $g['others'];
528
+ else
529
+ $g = cdp_default_global_options();
530
+
531
+ global $post;
532
+ if (is_object($post))
533
+ $type = $post->post_type;
534
+ else
535
+ $type = false;
536
+ $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
537
+ $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
538
+ $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
539
+
540
+ if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false')
541
+ return;
542
+ global $cdp_plug_url;
543
+
544
+ if ($a || $b || $c) {
545
+ $icon = '<span class="cdp-admin-bar-icon" data-plug-path="' . $cdp_plug_url . '" data-this-id="' . get_the_ID() . '"></span>';
546
+ $admin_bar->add_menu(array(
547
+ 'id' => '#cdp-copy-bar-x',
548
+ 'parent' => null,
549
+ 'group' => null,
550
+ 'title' => $icon . __('Copy this', 'copy-delete-posts'),
551
+ 'href' => '#',
552
+ 'meta' => array('class' => 'cdp-admin-bar-copy', 'target' => '_self')
553
+ ));
554
+ }
555
+ }, 80);
556
+ /** –– * */
557
  /** –– **\
558
  * Add notification to admin bar.
559
  * @since 1.0.0
560
  */
561
+ add_action('admin_bar_menu', function ($admin_bar) {
562
+ if (cdp_check_permissions(wp_get_current_user()) == false)
563
+ return;
564
+ if (!is_admin())
565
+ return;
566
+
567
+ if (!function_exists('cdp_notifications_menu'))
568
+ require_once plugin_dir_path(__FILE__) . 'menu/notifications.php';
569
+
570
+ if (function_exists('cdp_notifications_menu')) {
571
+ $data = cdp_notifications_menu();
572
+ $admin_bar->add_menu(array(
573
+ 'id' => 'wp-admin-copy-and-delete-posts',
574
+ 'parent' => null,
575
+ 'group' => null,
576
+ 'title' => $data['html'],
577
+ 'href' => '#',
578
+ 'meta' => array(
579
+ 'class' => 'cdp-admin-bar-noti menupop' . (($data['in_list'] == 0) ? ' cdp-noti-hide' : ''),
580
+ 'target' => '_self'
581
+ )
582
+ ));
583
+ }
584
+ }, 80);
585
+ /** –– * */
586
  /** –– **\
587
  * This function adds version info.
588
  * @since 1.0.0
589
  */
590
+ add_action('wp_head', function () {
591
+ echo '<meta name="cdp-version" content="' . CDP_VERSION . '" />';
592
+ });
593
+ /** –– * */
 
594
  /** –– **\
595
  * This function adds thickbox modal to preview and view pages.
596
  * @since 1.0.0
597
  */
598
+ add_action('wp_footer', function () {
599
+ if (cdp_check_permissions(wp_get_current_user()) == false)
600
+ return;
601
+
602
+ $g = get_option('_cdp_globals', array());
603
+ if (array_key_exists('others', $g))
604
+ $g = $g['others'];
605
+ else
606
+ $g = cdp_default_global_options();
607
+
608
+ if (isset($g['cdp-display-admin']) && $g['cdp-display-admin'] == 'false')
609
+ return;
610
+
611
+ global $cdp_plug_url, $post;
612
+
613
+ $post_id = false;
614
+ if (isset($post->ID))
615
+ $post_id = $post->ID;
616
+
617
+
618
+ $screen = ((function_exists('get_current_screen')) ? get_current_screen() : false);
619
+ $profiles = get_option('_cdp_profiles');
620
+
621
+ if (is_single() || is_page()) {
622
+ $hx = false;
623
+ if ($g['cdp-premium-hide-tooltip'] == 'true')
624
+ $hx = true;
625
+ cdp_vars($hx, $cdp_plug_url, $post_id);
626
+ cdp_modal($screen, $profiles);
627
+ }
628
+ });
629
+ /** –– * */
630
  /** –– **\
631
  * Add prepared HTML for tooltips and other info.
632
  * @since 1.0.0
633
  */
634
+ add_action('admin_notices', function () {
635
+ if (cdp_check_permissions(wp_get_current_user()) == false)
636
+ return;
637
+
638
+ global $post, $cdp_plug_url, $cdp_globals, $pagenow;
639
+ $post_id = false;
640
+ $hasParent = false;
641
+ $screen = get_current_screen();
642
+ $profiles = get_option('_cdp_profiles');
643
+ $deny = ['edit-page', 'edit-post'];
644
+ $hx = false;
645
+
646
+ if (!in_array($screen->id, $deny)) {
647
+ if (isset($post->ID)) {
648
+ $post_id = $post->ID;
649
+ $meta = get_post_meta($post->ID, '_cdp_origin');
650
+ $site = get_post_meta($post->ID, '_cdp_origin_site');
651
+ if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-references-post', $cdp_globals['others'])) {
652
+ if ($cdp_globals['others']['cdp-references-edit'] == 'true') {
653
+ if (function_exists('switch_to_blog') && $site)
654
+ switch_to_blog($site);
655
+ if (array_key_exists(0, $meta) && get_post_status($meta[0])) {
656
+ $parentTitle = get_the_title($meta[0]);
657
+ $link = get_post_permalink($meta[0]);
658
+ $hasParent = array(
659
+ 'title' => $parentTitle,
660
+ 'link' => $link
661
+ );
662
+ }
663
+ if (function_exists('restore_current_blog') && $site)
664
+ restore_current_blog();
665
+ }
666
+ }
667
+ }
668
+ }
669
+ if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-premium-hide-tooltip', $cdp_globals['others']) && $cdp_globals['others']['cdp-premium-hide-tooltip'] == 'true') {
670
+ $hx = true;
671
+ }
672
+
673
+ if (get_option('_cdp_show_copy', false)) {
674
+ echo '<span style="display: none; visibility: hidden;" id="cdp-show-copy-banner" data-value="true"></span>';
675
+ delete_option('_cdp_show_copy');
676
+ }
677
+
678
+ if ($pagenow == 'edit.php')
679
+ $post_id = false;
680
+ cdp_vars($hx, $cdp_plug_url, $post_id, $hasParent, true);
681
+ cdp_tooltip_content($profiles);
682
+ cdp_modal($screen, $profiles);
683
+ });
684
+ /** –– * */
685
  /** –– **\
686
  * Add button in standard editor.
687
  * @since 1.0.0
688
  */
689
+ add_action('post_submitbox_start', function () {
690
+ if (cdp_check_permissions(wp_get_current_user()) == false)
691
+ return;
692
+ $g = get_option('_cdp_globals', array());
693
+ if (array_key_exists('others', $g))
694
+ $g = $g['others'];
695
+ else
696
+ $g = cdp_default_global_options();
697
+ if (isset($g['cdp-display-edit']) && $g['cdp-display-edit'] == 'false')
698
+ return;
699
+
700
+ global $post, $pagenow;
701
+ if (is_object($post))
702
+ $type = $post->post_type;
703
+ else
704
+ $type = false;
705
+ $a = ($type == 'post' && $g['cdp-content-posts'] == 'true');
706
+ $b = ($type == 'page' && $g['cdp-content-pages'] == 'true');
707
+ $c = ($type != 'post' && $type != 'page' && $g['cdp-content-custom'] == 'true');
708
+
709
+ if (($a || $b || $c) && $pagenow != 'post-new.php')
710
+ echo '<div id="cdp-copy-btn"><a class="cdp-copy-btn-editor" href="#">' . __('Copy this post', 'copy-delete-posts') . '</a></div>';
711
+ });
712
+ /** –– * */
713
  /** –– **\
714
  * Add hook for cron (deletion).
715
  * @since 1.0.0
716
  */
717
+ add_action('cdp_cron_delete', function ($args = false) {
718
+
719
+ $ids = $args['ids'];
720
+ $trash = $args['trash'];
721
+ $site = (array_key_exists('site', $args)) ? $args['site'] : '-1';
722
+ $tok = $args['token']['token'];
723
+ $tsk = $args['token']['tsk'];
724
+
725
+ if ($args == false)
726
+ return;
727
+
728
+ $cdp_cron = get_option('_cdp_crons');
729
+
730
+ if (!isset($cdp_cron[$tok]) || !$cdp_cron[$tok])
731
+ return;
732
+
733
+ $auit = $cdp_cron[$tok]['auit'];
734
+ $auitd = $cdp_cron[$tok]['auitd'];
735
+
736
+ $areWePro = areWePro(true, '/handler/crons.php', true);
737
+
738
+ if ($auit == true && $areWePro && function_exists('cdpp_make_redirect'))
739
+ cdpp_make_redirect($ids, $auitd);
740
+ if ($trash == true && $areWePro && function_exists('cdpp_crons_trash_post'))
741
+ cdpp_crons_trash_post($ids);
742
+ else
743
+ foreach ($ids as $i => $id)
744
+ wp_delete_post($id, true);
745
+
746
+ $cdp_cron[$tok]['tasks'][$tsk] = current_time('timestamp');
747
+
748
+ $falsed = false;
749
+ $last = false;
750
+ $i = 0;
751
+ $size = sizeof($cdp_cron[$tok]['tasks']);
752
+ foreach ($cdp_cron[$tok]['tasks'] as $otsk => $val) {
753
+ if ($val == false)
754
+ $falsed = true;
755
+ $i++;
756
+ if ($i == ($size - 1))
757
+ $last = $otsk;
758
+ }
759
+
760
+ if ($tsk == '-0' || $last == $tsk || $falsed == false || $cdp_cron[$tok]['tasks'][$last] != false) {
761
+ $cdp_cron[$tok]['done'] = current_time('timestamp');
762
+ $cdp_cron[$tok]['data'] = array('formated-date' => date('d M Y, H:i:s'));
763
+ if (array_key_exists('del_size', $cdp_cron[$tok])) {
764
+ $cdp_cron[$tok]['data']['amount'] = $cdp_cron[$tok]['del_size'];
765
+ $cdp_cron[$tok]['data']['text'] = __('Manual Cleanup removed ', 'copy-delete-posts') . $cdp_cron[$tok]['del_size'] . ' post(s).';
766
+ }
767
+ $cdp_cron[$tok]['shown'] = false;
768
+ }
769
+
770
+ update_option('_cdp_crons', $cdp_cron);
771
+ });
772
+ /** –– * */
773
 
774
  /** –– **\
775
  * Check if user is permmited to use this plugin.
778
  *
779
  * @return boolean
780
  */
781
+ function cdp_check_permissions($user = array()) {
782
+ if (!isset($user) || empty($user))
783
+ return false;
784
+
785
+ $access = false;
786
+ $access_roles = get_option('_cdp_globals');
787
+ if (!isset($access_roles['roles']))
788
+ $access_roles = array();
789
+
790
+ foreach ($user->roles as $role => $name) {
791
+ if ($name == 'administrator' || (isset($access_roles['roles'][$name]) && $access_roles['roles'][$name] == 'true')) {
792
+ $access = true;
793
+ break;
794
+ }
795
+ }
796
+
797
+ return $access;
798
+ }
799
+
800
+ /** –– * */
801
  /** –– **\
802
  * First run of the plugin setup default options for Default profile
803
  * @since 1.0.0
804
  */
805
+ add_action('cdp_plugin_setup', 'cdp_setup_default_profile');
806
+
807
+ function cdp_setup_default_profile() {
808
+ $current = get_option('_cdp_globals');
809
+ $isSetup = get_option('_cdp_default_setup');
810
+ if (($current != false && array_key_exists('default', $current)) || $isSetup)
811
+ return;
812
 
813
+ $already = array();
814
+ $globals = array();
815
+ $already['default'] = cdp_default_options();
816
+ $globals['others'] = cdp_default_global_options();
817
 
818
+ $s1 = update_option('_cdp_globals', $globals);
819
  $s2 = update_option('_cdp_profiles', $already);
820
 
821
+ if ($s1 || $s2)
822
+ update_option('_cdp_default_setup', true);
823
+ }
824
+
825
+ /** –– * */
826
+
827
+ function cdp_load_localize_global_js() {
828
+
829
+ $cdpGlobalJSArgs = [
830
+ 'strDissmisIssue' => __('There was an issue while dismissing banner, please do it next time again.', 'copy-delete-posts'),
831
+ 'strDissmisRequestIssue' => __('Cannot send dismiss request. Are you connected to the internet?', 'copy-delete-posts'),
832
+ 'strReviewReview' => __('Thank you very much for the review, this banner will not appear again!', 'copy-delete-posts'),
833
+ 'strReviewAlready' => __('Thank you very much for the review, this banner will not appear again!', 'copy-delete-posts'),
834
+ 'strReviewLater' => __('Alright! We will ask you again in 14 days!', 'copy-delete-posts'),
835
+ 'strReviewDefault' => __('This banner will not appear again, if any feature is missing you can ask for it on our support forum!', 'copy-delete-posts'),
836
+ 'strTasksCleared' => __('Tasks cleared!', 'copy-delete-posts'),
837
+ 'strTasksUpdateIssue' => __('We couldn\'t update task list, please try again later or kill tasks individualy.', 'copy-delete-posts'),
838
+ 'strTasksUpdateIssue2' => __('We couldn\'t update task list, please try again later or kill tasks individualy.', 'copy-delete-posts'),
839
+ 'strTaskHide' => __('The task has been hidden', 'copy-delete-posts'),
840
+ 'strTaskHideIssue' => __('There was an error and we couldn\'t hide the task.', 'copy-delete-posts'),
841
+ 'strTaskHideIssue2' => __('There was an error and we couldn\'t hide the task.', 'copy-delete-posts'),
842
+ 'strTaskKill' => __('The task has been killed', 'copy-delete-posts'),
843
+ 'strTaskKillIssue' => __('There was an error and we couldn\'t kill the task.', 'copy-delete-posts'),
844
+ 'strTaskKillIssue2' => __('There was an error and we couldn\'t kill the task.', 'copy-delete-posts'),
845
+ 'strCDPInstallSuccess' => __('Plugin has been installed successfully, feel free to check those awesome features!', 'copy-delete-posts'),
846
+ 'strCDPInfo' => __('Copy & Delete Posts', 'copy-delete-posts'),
847
+ 'strCDPInfoPremium' => __('Premium', 'copy-delete-posts'),
848
+ 'strHideBannerNow' => __('It will hide this banner just for now.', 'copy-delete-posts'),
849
+ 'strErrWithNotif' => __('There was an error with this notification.', 'copy-delete-posts'),
850
+ 'strCDPInfo2' => __('Copy & Delete Posts', 'copy-delete-posts'),
851
+ ];
852
+
853
+ wp_localize_script('cdp-js-global', 'cdpGlobalJS', $cdpGlobalJSArgs);
854
+
855
+ }
856
 
857
  /** –– **\
858
  * Default settings for unset profiles
859
  * @since 1.0.0
860
  */
861
+ function cdp_default_options() {
862
+ return array(
863
+ 'title' => 'true',
864
+ 'date' => 'false',
865
+ 'status' => 'false',
866
+ 'slug' => 'true',
867
+ 'excerpt' => 'true',
868
+ 'content' => 'true',
869
+ 'f_image' => 'true',
870
+ 'template' => 'true',
871
+ 'format' => 'true',
872
+ 'author' => 'true',
873
+ 'password' => 'true',
874
+ 'attachments' => 'false',
875
+ 'children' => 'false',
876
+ 'comments' => 'false',
877
+ 'menu_order' => 'true',
878
+ 'category' => 'true',
879
+ 'post_tag' => 'true',
880
+ 'taxonomy' => 'true',
881
+ 'nav_menu' => 'true',
882
+ 'link_category' => 'true',
883
+ 'all_metadata' => 'false',
884
+ 'names' => array(
885
+ 'prefix' => '',
886
+ 'suffix' => '#[Counter]',
887
+ 'format' => '1',
888
+ 'custom' => 'm/d/Y',
889
+ 'display' => 'Default'
890
+ ),
891
+ 'usmplugin' => 'false',
892
+ 'yoast' => 'false',
893
+ 'woo' => 'false'
894
+ );
895
+ }
896
+
897
+ function cdp_default_global_options() {
898
+ return array(
899
+ 'cdp-content-pages' => 'true',
900
+ 'cdp-content-posts' => 'true',
901
+ 'cdp-content-custom' => 'true',
902
+ 'cdp-display-posts' => 'true',
903
+ 'cdp-display-edit' => 'true',
904
+ 'cdp-display-admin' => 'true',
905
+ 'cdp-display-bulk' => 'true',
906
+ 'cdp-display-gutenberg' => 'true',
907
+ 'cdp-references-post' => 'false',
908
+ 'cdp-references-edit' => 'false',
909
+ 'cdp-premium-import' => 'false',
910
+ 'cdp-premium-hide-tooltip' => 'false',
911
+ 'cdp-menu-in-settings' => 'false',
912
+ );
913
+ }
914
+
915
+ /** –– * */
916
  /** –– **\
917
  * Add state info if user want it (the reference to original)
918
  * @since 1.0.0
919
  */
920
+ if (is_admin()) {
921
+ if ($cdp_globals && array_key_exists('others', $cdp_globals) && array_key_exists('cdp-references-post', $cdp_globals['others'])) {
922
+ if ($cdp_globals['others']['cdp-references-post'] == 'true')
923
+ add_filter('display_post_states', 'cdp_state_post_add', 1, 10);
924
+ }
925
+ }
926
+
927
+ function cdp_state_post_add($post_states, $post) {
928
+ if (cdp_check_permissions(wp_get_current_user()) == false)
929
+ return $post_states;
930
+
931
+ $meta = get_post_meta($post->ID, '_cdp_origin');
932
+ $site = get_post_meta($post->ID, '_cdp_origin_site');
933
+
934
+ if (function_exists('switch_to_blog') && $site)
935
+ switch_to_blog($site);
936
+ for ($i = sizeof($meta); $i >= 0; --$i) {
937
+ if (array_key_exists(($i - 1), $meta) && get_post_status($meta[$i - 1])) {
938
+ $link = get_post_permalink($meta[$i - 1]);
939
+ $title = get_the_title($meta[$i - 1]) . " – " . "ID: " . $meta[$i - 1];
940
+ $post_states['_cdp'] = __('Copy of', 'copy-delete-posts') . " <a class='cdp-tooltip-top' title='$title' href='$link' target='_blank'>" . __('this', 'copy-delete-posts') . "</a> " . __('post', 'copy-delete-posts');
941
+ break;
942
+ }
943
+ }
944
+ if (function_exists('restore_current_blog') && $site)
945
+ restore_current_blog();
946
+
947
+ return $post_states;
948
+ }
949
+
950
+ /** –– * */
951
 
952
  /** –– **\
953
  * Check the premium status and correction
954
  * @since 1.0.0
955
  */
956
+ function areWePro($include = true, $file = '/content/premium.php', $ignore_perms = false) {
957
+ if (!$ignore_perms && cdp_check_permissions(wp_get_current_user()) == false)
958
+ return false;
959
+
960
+ // Get WP-Plugin path
961
+ $premium_plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
962
+ $premium_dir = WP_PLUGIN_DIR . '/' . 'copy-delete-posts-premium';
963
+ $pplugin_path = $premium_dir . $file;
964
+ $squirrel = 'cdpp_squirrelicense';
965
+ $core = '/includes/core.php';
966
+ $areWePro = false;
967
+
968
+ // Load premium content if the plugin is here
969
+ if (is_dir($premium_dir) && ((function_exists('is_plugin_active') && is_plugin_active($premium_plugin)) || (!function_exists('is_plugin_active')))) {
970
+
971
+ // Include cool features
972
+ if ($include && file_exists($pplugin_path))
973
+ require_once($pplugin_path);
974
+
975
+ // Is premium function
976
+ if (file_exists($pplugin_path))
977
+ $areWePro = true;
978
+
979
+ // Has special functions
980
+ if (file_exists($pplugin_path) && file_exists($premium_dir . $core)) {
981
+ require_once($premium_dir . $core);
982
+ if (function_exists($squirrel))
983
+ $areWePro = $squirrel()['p'];
984
+ else
985
+ $areWePro = false;
986
+ } else
987
+ $areWePro = false;
988
+ }
989
+
990
+ // Return answer
991
+ return $areWePro;
992
+ }
993
+
994
+ /** –– * */
995
  /** –– **\
996
  * It adds button on plugin list below plugin
997
  * @since 1.0.0
998
  */
999
+ add_filter('plugin_action_links_' . plugin_basename(__FILE__), function ($links) {
1000
+ $links['cdp-settings-link'] = '<a href="' . admin_url('/admin.php?page=copy-delete-posts') . '">' . __('Settings', 'copy-delete-posts') . '</a>';
1001
+ return $links;
1002
+ });
1003
+ /** –– * */
1004
 
1005
  /** –– **\
1006
  * This function fixes Wordpress wp_upload_dir function
1007
  * @since 1.0.0
1008
  */
1009
+ function cdp_fix_upload_paths($data) {
1010
+ // Check if the base URL matches the format
1011
+ $needs_fixing = preg_match("/wp-content\/blogs\.dir\/(\d+)\/files/", $data['baseurl'], $uri_part);
1012
 
1013
+ if ($needs_fixing) {
1014
+ $data['url'] = str_replace($uri_part[0], 'files', $data['url']);
1015
+ $data['baseurl'] = str_replace($uri_part[0], 'files', $data['baseurl']);
1016
+ }
1017
 
1018
+ return $data;
1019
+ }
1020
+
1021
+ /** –– * */
1022
 
1023
  /** –– **\
1024
  * This function will sanitize whole array with sanitize_text_field – by RECURSION
1025
  * @since 1.0.0
1026
  */
1027
+ function cdp_sanitize_array($data = null) {
1028
+ $array = array();
1029
+ if (is_array($data) || is_object($data))
1030
+ foreach ($data as $key => $value) {
1031
+ $key = ((is_numeric($key)) ? intval($key) : sanitize_text_field($key));
1032
+ if (is_array($value) || is_object($value))
1033
+ $array[$key] = cdp_sanitize_array($value);
1034
+ else
1035
+ $array[$key] = sanitize_text_field($value);
1036
+ }
1037
+ else if (is_string($data))
1038
+ return sanitize_text_field($data);
1039
+ else if (is_bool($data))
1040
+ return $data;
1041
+ else if (is_null($data))
1042
+ return 'false';
1043
+ else {
1044
+ error_log('Copy & Delete Posts[copy-delete-posts.php:707]: Unknown AJaX datatype – ' . gettype($data));
1045
+ echo 'error – invalid data';
1046
+ wp_die();
1047
+ }
1048
+
1049
+ return $array;
1050
+ }
1051
 
 
 
1052
  /** –– **/
languages/index.html ADDED
File without changes
menu/configuration.php CHANGED
@@ -87,6 +87,9 @@ function cdp_configuration() {
87
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
88
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
89
  if (
 
 
 
90
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
91
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
92
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
@@ -105,7 +108,7 @@ function cdp_configuration() {
105
  <?php if ($areWePro && function_exists('cdpp_profile_manager_html')) cdpp_profile_manager_html(); ?>
106
  <?php if ($areWePro && function_exists('cdpp_delete_redi_modal')) cdpp_delete_redi_modal(); ?>
107
  <div class="cdp-preloader-c<?php echo $isCoolInstalled ?>">
108
- <div class="cdp-center">Loading...</div>
109
  <div class="cdp-preloader"></div>
110
  </div>
111
  <div class="cdp-container cdp-main-menu-cont" style="display: none;">
@@ -113,43 +116,43 @@ function cdp_configuration() {
113
  <div class="cdp-cf">
114
  <div class="cdp-left">
115
  <!-- <h1 class="cdp-f-s-30 cdp-f-w-light cdp-welcome-title-after">Welcome<?php echo ' ' . $current_user->user_login . ','; ?> to Copy & Delete Posts!</h1> -->
116
- <h1 class="cdp-f-s-30 cdp-f-w-medium cdp-welcome-title-after">Welcome to Copy & Delete Posts!</h1>
117
  </div>
118
  <div class="cdp-right">
119
- <div class="cdp-s-i-a cdp-welcome-title-after cdp-text-right cdp-green"<?php echo $content ?>><a class="cdp-pointer" id="cdp-show-into-again"><span class="cdp-green cdp-f-s-16">Show intro</span></a></div>
120
  </div>
121
  </div>
122
 
123
  <div class="cdp-intro"<?php echo $intro ?>>
124
  <div class="cdp-box cdp-white-bg cdp-shadow">
125
- <div class="cdp-font-heading cdp-f-s-21 cdp-f-w-regular">You can now easily copy posts & pages in various areas:</div>
126
  <div class="cdp-cf">
127
  <div class="cdp-showcase-3 cdp-left">
128
- <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center">List of posts/pages</div>
129
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-1" alt="lists">
130
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_1.gif" class="cdp-no-vis cfg-img-sc-3" alt="lists">
131
  </div>
132
  </div>
133
  <div class="cdp-showcase-3 cdp-left">
134
- <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center">Edit screen</div>
135
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-2" alt="edit">
136
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_2.gif" class="cdp-no-vis cfg-img-sc-3" alt="edit">
137
  </div>
138
  </div>
139
  <div class="cdp-showcase-3 cdp-left">
140
- <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center">Admin bar</div>
141
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-3" alt="adminbar">
142
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_3.gif" class="cdp-no-vis cfg-img-sc-3 cfg-img-sc-3-special" alt="adminbar">
143
  </div>
144
  </div>
145
  </div>
146
- <div class="cdp-center cdp-font-footer">…and you can also <b>delete duplicate</b> posts easily, see below :)</div>
147
  <div class="cdp-center cdp-intro-options">
148
- <button class="cdp-intro-button cdp-f-s-21 cdp-f-w-bold">Got it, close intro!</button>
149
  <div class="cdp-ff-b1 cdp-checkboxes cdp-hide" style="margin-top: 5px;">
150
  <label for="cdp-never-intro">
151
  <input type="checkbox" checked id="cdp-never-intro" style="margin-top: -3px !important"/>
152
- Don't show this intro – never again!
153
  </label>
154
  </div>
155
  </div>
@@ -160,7 +163,7 @@ function cdp_configuration() {
160
  <div class="cdp-left cdp-lh-48 cdp-f-s-20">
161
  <div class="cdp-cf">
162
  <div class="cdp-left cdp-f-w-light">
163
- Below are your
164
  </div>
165
  <select class="cdp-left cdp-profile-selected cdp-select-styled cdp-select cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-color-p-i<?php echo ((!$areWePro)?' cdp-premium-in-select':''); ?>">
166
  <?php
@@ -171,19 +174,19 @@ function cdp_configuration() {
171
  ?>
172
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
173
  <?php endforeach; } else { ?>
174
- <option value="default" selected>Default</option>
175
- <option value="premium" disabled>Add new</option>
176
  <?php } ?>
177
  </select>
178
  <div class="cdp-left cdp-f-w-light">
179
- settings
180
  </div>
181
  </div>
182
  </div>
183
  <div class="cdp-right cdp-lh-48 cdp-relative">
184
  <div>
185
  <span class="cdp-tooltip-premium" style="padding: 25px 0">
186
- <span class="cdp-manager-btns cdp-green cdp-hover cdp-pointer cdp-f-w-light cdp-f-s-16" style="padding-right: 33px;">+ Add / manage / import / export settings</span>
187
  <span class="cdp-premium-icon cdp-big-icon" style="right: 3px;"></span>
188
  </span>
189
  </div>
@@ -195,7 +198,7 @@ function cdp_configuration() {
195
  <div class="cdp-collapsible" data-cdp-group="mains">
196
  <div class="cdp-collapsible-title">
197
  <div class="cdp-cf">
198
- <div class="cdp-left cdp-ff-b1">Which <b class="cdp-ff-b4">elements</b> shall be copied?</div>
199
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
200
  </div>
201
  </div>
@@ -205,100 +208,100 @@ function cdp_configuration() {
205
  <thead class="cdp-thead cdp-f-s-18">
206
  <tr>
207
  <th></th>
208
- <th><b>If checked</b> copies will...</th>
209
- <th><b>If <u class="cdp-f-w-bold">un</u>checked</b> copies will...</th>
210
  </tr>
211
  </thead>
212
  <tbody class="cdp-ff-b1 cdp-f-s-18 cdp-tbody-of-settings">
213
  <tr>
214
- <td><label class="cdp-relative"><input <?php echo $defaults['title']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="title" type="checkbox" /><span>Title <span class="cdp-info-icon"></span></span></label></td>
215
- <td>…get the title as defined in the <a href="#" class="cdp-go-to-names-chapter"><span class="cdp-green">next section</span></a>.</td>
216
- <td>…be titled “Untitled”.</td>
217
  </tr>
218
  <tr>
219
- <td><label class="cdp-relative"><input <?php echo $defaults['date']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="date" type="checkbox" /><span>Date <span class="cdp-info-icon"></span></span></label></td>
220
- <td>…get the same creation date & time as the original.</td>
221
- <td>…get the date & time at time of copying. </td>
222
  </tr>
223
  <tr>
224
- <td><label class="cdp-relative"><input <?php echo $defaults['status']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="status" type="checkbox" /><span>Status <span class="cdp-info-icon"></span></span></label></td>
225
- <td>…get status of original article (which can be “published” or “deleted” etc.)</td>
226
- <td>…get the status “Draft”.</td>
227
  </tr>
228
  <tr>
229
- <td><label class="cdp-relative"><input <?php echo $defaults['slug']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="slug" type="checkbox" /><span>Slug <span class="cdp-info-icon"></span></span></label></td>
230
- <td>…get the same <a href="https://kinsta.com/knowledgebase/wordpress-slug/" target="_blank"><span class="cdp-green">slug</span></a> of the original. (However after publishing it will give it automatically a new slug because 2 pages cannot be on the same URL).</td>
231
- <td>…get a blank slug, unless the page is published, then it will generate it automatically.</td>
232
  </tr>
233
  <tr>
234
- <td><label class="cdp-relative"><input <?php echo $defaults['excerpt']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="excerpt" type="checkbox" /><span>Excerpt <span class="cdp-info-icon"></span></span></label></td>
235
- <td>…get the custom <a href="https://wordpress.org/support/article/excerpt/" target="_blank"><span class="cdp-green">excerpt</span></a> (post/page summary) of the original (if the original had any).</td>
236
- <td>…get an empty <i>custom</i> excerpt (and default to taking the first 55 words of the post).</td>
237
  </tr>
238
  <tr>
239
- <td><label class="cdp-relative"><input <?php echo $defaults['content']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="content" type="checkbox" /><span>Content <span class="cdp-info-icon"></span></span></label></td>
240
- <td>…get all the content (text, images, videos and other elements/blocks) from the original.</td>
241
- <td>…get no content (be completely blank).</td>
242
  </tr>
243
  <tr>
244
- <td><label class="cdp-relative"><input <?php echo $defaults['f_image']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="f_image" type="checkbox" /><span>Featured image <span class="cdp-info-icon"></span></span></label></td>
245
- <td>…it will set the same <a href="https://firstsiteguide.com/wordpress-featured-image/" target="_blank"><span class="cdp-green">featured image</span></a> as the original.</td>
246
- <td>…get no featured image.</td>
247
  </tr>
248
  <tr>
249
- <td><label class="cdp-relative"><input <?php echo $defaults['template']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="template" type="checkbox" /><span>Template <span class="cdp-info-icon"></span></span></label></td>
250
- <td>…get the same page <a href="https://wpapprentice.com/blog/wordpress-theme-vs-template/" target="_blank"><span class="cdp-green">template</span></a> as original.</td>
251
- <td>…get the default page template.</td>
252
  </tr>
253
  <tr>
254
- <td><label class="cdp-relative"><input <?php echo $defaults['format']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="format" type="checkbox" /><span>Format <span class="cdp-info-icon"></span></span></label></td>
255
- <td>…get the same <a href="https://wordpress.org/support/article/post-formats/" target="_blank"><span class="cdp-green">post format</span></a> as original.</td>
256
- <td>…get the standard post format.</td>
257
  </tr>
258
  <tr>
259
- <td><label class="cdp-relative"><input <?php echo $defaults['author']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="author" type="checkbox" /><span>Author <span class="cdp-info-icon"></span></span></label></td>
260
- <td>…get the same author as original.</td>
261
- <td>…get the user that is duplicating as an author.</td>
262
  </tr>
263
  <tr>
264
- <td><label class="cdp-relative"><input <?php echo $defaults['password']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="password" type="checkbox" /><span>Password <span class="cdp-info-icon"></span></span></label></td>
265
- <td>…get the same <a href="https://wordpress.org/support/article/using-password-protection/" target="_blank"><span class="cdp-green">password</span></a> as original.</td>
266
- <td>…get no password.</td>
267
  </tr>
268
  <tr>
269
- <td><label class="cdp-relative"><input <?php echo $defaults['attachments']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="attachments" type="checkbox" /><span>Attachments <span class="cdp-info-icon"></span></span></label></td>
270
- <td>…create new <a href="https://wordpress.org/support/article/using-image-and-file-attachments/#attachment-to-a-post" target="_blank"><span class="cdp-green">attachments</span></a> (duplicates in Media Library) as well. <i>Recommended only for Multisites.</i></td>
271
- <td>…get existing attachments from the original.</td>
272
  </tr>
273
  <tr>
274
- <td><label class="cdp-relative"><input <?php echo $defaults['children']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="children" type="checkbox" /><span>Children <span class="cdp-info-icon"></span></span></label></td>
275
- <td>…get their <a href="https://phppot.com/wordpress/how-to-create-a-child-page-in-wordpress/" target="_blank"><span class="cdp-green">child pages</span></a> copied as well, with all current settings applied to child-duplicates (if the page is a parent).</td>
276
- <td>…not get their child pages copied along (if the page is a parent).</td>
277
  </tr>
278
  <tr>
279
- <td><label class="cdp-relative"><input <?php echo $defaults['comments']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="comments" type="checkbox" /><span>Comments <span class="cdp-info-icon"></span></span></label></td>
280
- <td>…get all comments from the original.</td>
281
- <td>…get no comments from the original.</td>
282
  </tr>
283
  <tr>
284
- <td><label class="cdp-relative"><input <?php echo $defaults['menu_order']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="menu_order" type="checkbox" /><span>Menu order <span class="cdp-info-icon"></span></span></label></td>
285
- <td>…get the <a href="https://wordpress.stackexchange.com/questions/25202/how-to-change-order-of-menu-items" target="_blank"><span class="cdp-green">menu order</span></a> from the original.</td>
286
- <td>…get the menu order set to default (0).</td>
287
  </tr>
288
  <tr>
289
- <td><label class="cdp-relative"><input <?php echo $defaults['category']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="category" type="checkbox" /><span>Categories <span class="cdp-info-icon"></span></span></label></td>
290
- <td>…get all categories from the original post.</td>
291
- <td>…be Uncategorized, no categories will be copied.</td>
292
  </tr>
293
  <tr>
294
- <td><label class="cdp-relative"><input <?php echo $defaults['post_tag']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="post_tag" type="checkbox" /><span>Tags <span class="cdp-info-icon"></span></span></label></td>
295
- <td>…get all tags of the original post.</td>
296
- <td>…be without any tags.</td>
297
  </tr>
298
  <tr>
299
- <td><label class="cdp-relative"><input <?php echo $defaults['taxonomy']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="taxonomy" type="checkbox" /><span>Taxonomies <span class="cdp-info-icon"></span></span></label></td>
300
- <td>…get all custom taxonomy from the original.</td>
301
- <td>…be without custom taxonomy.</td>
302
  </tr>
303
  <tr>
304
  <td>
@@ -308,20 +311,38 @@ function cdp_configuration() {
308
  <input <?php echo $defaults['nav_menu']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="nav_menu" type="checkbox" />
309
  </div>
310
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
311
- <span>Navigation Menus <span class="cdp-info-icon" style="top: calc(50% + 4px) !important;"></span> </span>
312
  </div>
313
  </div>
314
  </label>
315
  </td>
316
- <td>…get this private taxonomy from the original.</td>
317
- <td>…be without private taxonomy.</td>
318
  </tr>
319
  <tr>
320
- <td><label class="cdp-relative"><input <?php echo $defaults['link_category']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="link_category" type="checkbox" /><span>Link categories <span class="cdp-info-icon"></span></span></label></td>
321
- <td>…get this private taxonomy from the original.</td>
322
- <td>…be without private taxonomy.</td>
323
  </tr>
324
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
325
  <tr<?php echo (!$isWoo)?' style="display: none;"':'' ?>>
326
  <td class="cdp-tooltip-premium">
327
  <label>
@@ -330,13 +351,13 @@ function cdp_configuration() {
330
  <input <?php echo (array_key_exists('woo', $defaults) && $defaults['woo']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="woo" type="checkbox" />
331
  </div>
332
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
333
- <span>WooCommerce Settings<span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
334
  </div>
335
  </div>
336
  </label>
337
  </td>
338
- <td>…the same settings from the <a href="https://wordpress.org/plugins/woocommerce/" target="_blank"><span class="cdp-green">WooCommerce plugin</span></a> as the original.</td>
339
- <td>…get empty settings.</td>
340
  </tr>
341
 
342
  <tr<?php echo (!$isUSM)?' style="display: none;"':'' ?>>
@@ -347,13 +368,13 @@ function cdp_configuration() {
347
  <input <?php echo ($defaults['usmplugin']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="usmplugin" type="checkbox" />
348
  </div>
349
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
350
- <span>Ultimate Social Media Settings<span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
351
  </div>
352
  </div>
353
  </label>
354
  </td>
355
- <td>…the same settings from the <a href="https://www.ultimatelysocial.com/usm-premium/" target="_blank"><span class="cdp-green">Ultimate Social Media plugin</span></a> as the original.</td>
356
- <td>…get empty settings.</td>
357
  </tr>
358
 
359
  <tr<?php echo (!$isYoast)?' style="display: none;"':'' ?>>
@@ -364,25 +385,25 @@ function cdp_configuration() {
364
  <input <?php echo ($defaults['yoast']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="yoast" type="checkbox" />
365
  </div>
366
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
367
- <span>Yoast SEO Settings <span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
368
  </div>
369
  </div>
370
  </label>
371
  </td>
372
- <td>…the same settings from the <a href="https://wordpress.org/plugins/wordpress-seo/" target="_blank"><span class="cdp-green">Yoast SEO plugin</span></a> as the original.</td>
373
- <td>…get empty settings.</td>
374
  </tr>
375
 
376
  </tbody>
377
  </table>
378
  <div class="cdp-pad-lin cdp-gray cdp-f-s-18 cdp-lh-24 cdp-center" style="padding-top: 40px; padding-bottom: 20px;">
379
- <i>Do you know anything else you want to have copied (e.g. data added by a different plugin)? <br />
380
- Please <a href="mailto:hi@copy-delete-posts.com" target="_blank"><span class="cdp-green">tell us about it</span></a>, we always want to further improve this plugin! :) </i>
381
  </div>
382
  <div class="cdp-center cdp-padding cdp-p-35-b">
383
- <button class="cdp-button cdp-save-options">Save</button>
384
  <div class="cdp-padding cdp-f-s-17">
385
- <a href="#" class="cdp-close-chapter">Close section</a>
386
  </div>
387
  </div>
388
  </div>
@@ -393,19 +414,19 @@ function cdp_configuration() {
393
  <div class="cdp-collapsible" data-cdp-group="mains">
394
  <div class="cdp-collapsible-title cdp-name-section-cnx">
395
  <div class="cdp-cf">
396
- <div class="cdp-left cdp-ff-b1">What <b class="cdp-ff-b4">name(s)</b> should the copies have?</div>
397
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
398
  </div>
399
  </div>
400
  <div class="cdp-collapsible-content cdp-np cdp-drags-cont">
401
  <div class="cdp-pad-lin cdp-f-s-18 cdp-f-w-light">
402
- Build your preferred naming logic for the copies:
403
  </div>
404
  <div class="cdp-green-bg cdp-pad-lin" style="padding-bottom: 20px;">
405
  <div class="cdp-cf cdp-center">
406
- <div class="cdp-left cdp-names-input cdp-f-s-16">Prefix</div>
407
  <div class="cdp-left cdp-names-divider cdp-nlh"></div>
408
- <div class="cdp-left cdp-names-input cdp-f-s-16">Suffix</div>
409
  </div>
410
  <div class="cdp-cf cdp-center">
411
  <div class="cdp-left cdp-names-input">
@@ -414,7 +435,7 @@ function cdp_configuration() {
414
  </div>
415
  </div>
416
  <div class="cdp-left cdp-names-divider cdp-f-s-19 cdp-f-w-light">
417
- <span class="cdp-tooltip-top cdp-togglable-name-b" title="Change to blank">(Name of original)</span>
418
  </div>
419
  <div class="cdp-left cdp-names-input">
420
  <div strip-br="true" class="cdp-magic-input cdp-shadow cdp-sorts cdp-names-real-input cdp-names-suffix" wrap="off" contenteditable="true" style="margin-left: 0">
@@ -423,57 +444,57 @@ function cdp_configuration() {
423
  </div>
424
  </div>
425
  <div class="cdp-curr-cont">
426
- <span class="cdp-f-s-18">Example based on current selections:</span>
427
  <span class="cdp-f-s-16 cdp-padding-10-h">
428
- <span class="cdp-example-name cdp-f-w-bold">(Name of original)</span>
429
  </span>
430
  </div>
431
  </div>
432
  <div class="cdp-pad-lin cdp-f-s-18">
433
- <div class="cdp-padding-23-h">Drag & drop the automatic elements into the Prefix/Suffix fields to add them.</div>
434
  <div class="">
435
  <div class="cdp-cf cdp-padding-10-h">
436
  <div class="cdp-left">
437
- <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="0">Counter</div>
438
  </div>
439
- <div class="cdp-left cdp-names-text-info">Adds an <b class="cdp-f-w-semi-bold">incremental counter</b> (starting with “2”)</div>
440
  </div>
441
  <div class="cdp-cf cdp-padding-10-h">
442
  <div class="cdp-left" style="margin-top: 6px;">
443
- <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="2">CurrentDate</div>
444
  </div>
445
  <div class="cdp-left cdp-names-text-info">
446
  <div class="cdp-cf" style="line-height: 49px !important;">
447
  <div class="cdp-left">
448
- Adds the <b class="cdp-f-w-semi-bold">current date</b> in
449
  </div>
450
  <select class="cdp-left cdp-select-styled cdp-date-picked cdp-select cdp-dd-p-43 cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-select-black cdp-option-premium" name="cdp-date-option">
451
- <option value="1"<?php echo ($names_format == 1 || $names_format == false || (!$areWePro && $names_format == 3))?' selected':''; ?>>mm/dd/yyyy</option>
452
- <option value="2"<?php echo ($names_format == 2)?' selected':''; ?>>dd/mm/yyyy</option>
453
- <option value="3"<?php echo (($areWePro && $names_format == 3)?' selected':''); ?>>Custom</option>
454
  </select>
455
  <?php if ($areWePro && function_exists('cdpp_custom_date')) cdpp_custom_date($names_format, $defaults); ?>
456
- <div class="cdp-left" style="padding-left: 15px;">format.</div>
457
  </div>
458
  <?php if ($areWePro && function_exists('cdpp_custom_date_info')) cdpp_custom_date_info(); ?>
459
  </div>
460
  </div>
461
  <div class="cdp-cf cdp-padding-10-h" style="padding-bottom: 0; margin-top: 6px;">
462
  <div class="cdp-left">
463
- <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="1">CurrentTime</div>
464
  </div>
465
- <div class="cdp-left cdp-names-text-info">Adds the <b class="cdp-f-w-semi-bold">current time</b> in hh:mm:ss format</div>
466
  </div>
467
  </div>
468
  <div class="cdp-padding-23-h">
469
- <p class="cdp-f-s-18">You can also type tailored text into the fields above.</p>
470
- <p class="cdp-f-s-18">If you’re not of the drag & droppy-type, you can also enter shortcodes [Counter], [CurrentDate] and [CurrentTime].</p>
471
- <p class="cdp-f-s-18">If you make multiple copies in one go, use the Counter-option as otherwise some copies will have the same name.</p>
472
  </div>
473
  <div class="cdp-center">
474
- <button class="cdp-button cdp-save-options">Save</button>
475
  <div class="cdp-padding cdp-f-s-17">
476
- <a href="#" class="cdp-close-chapter">Close section</a>
477
  </div>
478
  </div>
479
  </div>
@@ -484,43 +505,43 @@ function cdp_configuration() {
484
  <div class="cdp-collapsible" data-cdp-group="mains">
485
  <div class="cdp-collapsible-title">
486
  <div class="cdp-cf">
487
- <div class="cdp-left cdp-ff-b1"><b class="cdp-ff-b4">Other</b> options</div>
488
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
489
  </div>
490
  </div>
491
  <div class="cdp-collapsible-content cdp-oth-section cdp-np cdp-special-cb-p">
492
  <div class="cdp-pad-lin">
493
- <div><h2 class="cdp-f-s-18"><b class="cdp-f-w-bold">Navigation after copying</b></h2></div>
494
  <div class="cdp-padding-15-h">
495
  <div class="cdp-con-cen">
496
  <select class="cdp-other-options cdp-select cdp-select-centered cdp-sel-separat cdp-select-large cdp-dd-p-40 cdp-c-x-a-v" name="after_copy">
497
- <option value="1"<?php echo ($after_copy == '1' || $after_copy == false)?' selected':''; ?>>Leave me where I was</option>
498
- <option value="2"<?php echo ($after_copy == '2')?' selected':''; ?>>Take me to the edit-page of the created copy</option>
499
- <option value="3"<?php echo ($after_copy == '3')?' selected':''; ?>>Decide on a case-by-case basis (adds new button on copy screen)</option>
500
  </select>
501
  </div>
502
- <div class="cdp-if-edit-page-selected cdp-con-cen cdp-f-s-18 cdp-f-w-light cdp-p-25-40" style="display: none;">If you created multiple copies in one go, you’ll be taken to the first copy. </div>
503
  </div>
504
  <div>
505
  <h2>
506
- <b class="cdp-relative cdp-f-s-18 cdp-f-w-bold cdp-tooltip-premium" data-top="5" style="padding-right: 30px;">Pages vs. Posts converter <span class="cdp-premium-icon cdp-big-icon"></span></b>
507
  </h2>
508
  </div>
509
  <div class="cdp-f-s-18 cdp-f-w-light">
510
- <p class="cdp-f-s-18 cdp-f-w-light">By default, the type of what you copy does not change, i.e. if you copy a post the new version will also be a post, and the same for pages.</p>
511
- <p class="cdp-padding-15-h cdp-f-s-18 cdp-f-w-light">If you want to make a page out of a post, or vice versa, then you can do this on a <b class="cdp-f-w-bold">case by case basis</b> if you select the option “Define it specifically for this case” in the copy-tooltip, and then select this option on the following screen in the tooltip.</p>
512
- <p class="cdp-f-s-18 cdp-f-w-light">However, if you want it as a <b class="cdp-f-w-bold">default setting option</b>, then please select it below: </p>
513
  </div>
514
  <div class="cdp-con-cen">
515
  <div class="cdp-tooltip-premium" style="width: 663px; margin: 0 auto; height: 60px;" data-top="-10">
516
  <select class="cdp-other-options cdp-select cdp-select-centered cdp-sel-separat cdp-select-large cdp-c-x-a-v" name="post_converter">
517
- <option value="1"<?php echo ($post_converter == '1' || $post_converter == false)?' selected':''; ?>>Copies will be the same type as the original</option>
518
- <option value="2"<?php echo ($post_converter == '2')?' selected':''; ?>>ALWAYS change the type when copied (posts will become pages, pages will become posts)</option>
519
  </select>
520
  </div>
521
  </div>
522
- <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold">User level permissions</b></h2></div>
523
- <div class="cdp-f-s-18 cdp-p-15-25 cdp-f-w-light">Which user role(s) should be able to copy & delete? <i style="color: gray">– The role also must have access to the dashboard.</i></div>
524
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
525
  <?php
526
  $isSaved = false;
@@ -540,61 +561,61 @@ function cdp_configuration() {
540
  }
541
  ?>
542
  </div>
543
- <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold">Content types which can be copied</b></h2></div>
544
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
545
- <label for="cdp-o-pages"><input <?php echo ($gos['cdp-content-pages'] == 'true')?'checked ':''; ?>id="cdp-o-pages" type="checkbox" class="cdp-other-inputs" name="cdp-content-pages">Pages</label>
546
- <label for="cdp-o-posts"><input <?php echo ($gos['cdp-content-posts'] == 'true')?'checked ':''; ?>id="cdp-o-posts" type="checkbox" class="cdp-other-inputs" name="cdp-content-posts">Posts</label>
547
- <label for="cdp-o-custom"><input <?php echo ($gos['cdp-content-custom'] == 'true')?'checked ':''; ?>id="cdp-o-custom" type="checkbox" class="cdp-other-inputs" name="cdp-content-custom">Custom posts types</label>
548
  </div>
549
- <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold">Display copy option on...</b></h2></div>
550
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
551
- <label for="cdp-o-postspages"><input <?php echo ($gos['cdp-display-posts'] == 'true')?'checked ':''; ?>id="cdp-o-postspages" type="checkbox" class="cdp-other-inputs" name="cdp-display-posts">Posts/pages lists</label>
552
- <label for="cdp-o-edit"><input <?php echo ($gos['cdp-display-edit'] == 'true')?'checked ':''; ?>id="cdp-o-edit" type="checkbox" class="cdp-other-inputs" name="cdp-display-edit">Edit screens</label>
553
- <label for="cdp-o-admin"><input <?php echo ($gos['cdp-display-admin'] == 'true')?'checked ':''; ?>id="cdp-o-admin" type="checkbox" class="cdp-other-inputs" name="cdp-display-admin">Admin bar</label>
554
- <label for="cdp-o-bulk"><input <?php echo ($gos['cdp-display-bulk'] == 'true')?'checked ':''; ?>id="cdp-o-bulk" type="checkbox" class="cdp-other-inputs" name="cdp-display-bulk">Bulk actions menu</label>
555
- <label for="cdp-o-gutenberg"><input <?php echo ($gos['cdp-display-gutenberg'] == 'true')?'checked ':''; ?>id="cdp-o-gutenberg" type="checkbox" class="cdp-other-inputs" name="cdp-display-gutenberg">Gutenberg editor</label>
556
  </div>
557
- <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold">Show reference to original item?</b></h2></div>
558
- <div class="cdp-f-s-18 cdp-f-w-light cdp-p-15-25">If checked, you will see a reference to the original post/page (on the copied version).</div>
559
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
560
- <label for="cdp-o-posts2"><input <?php echo ($gos['cdp-references-post'] == 'true')?'checked ':''; ?>id="cdp-o-posts2" type="checkbox" class="cdp-other-inputs" name="cdp-references-post">Posts/pages lists</label>
561
- <label for="cdp-o-edits2"><input <?php echo ($gos['cdp-references-edit'] == 'true')?'checked ':''; ?>id="cdp-o-edits2" type="checkbox" class="cdp-other-inputs" name="cdp-references-edit">Edit screens</label>
562
  </div>
563
- <div><h2><b class="cdp-f-s-18 cdp-f-w-bold">Additional features</b></h2></div>
564
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
565
  <label for="cdp-o-premium-hide-tooltip">
566
  <?php if (!isset($gos['cdp-premium-hide-tooltip'])) $gos['cdp-premium-hide-tooltip'] = false; ?>
567
  <input id="cdp-o-premium-hide-tooltip"<?php echo ((!$areWePro)?' disabled="true"':''); ?> <?php echo ($areWePro && $gos['cdp-premium-hide-tooltip'] == 'true')?'checked ':''; ?> type="checkbox" class="cdp-other-inputs" name="cdp-premium-hide-tooltip" />
568
- <span class="cdp-relative cdp-tooltip-premium" data-top="5">Hide copy tooltip on hover and only show the button <span class="cdp-premium-icon cdp-big-icon" style="right: -30px"></span></span>
569
  </label>
570
  <label for="cdp-o-premium-import">
571
  <?php if (!isset($gos['cdp-premium-import'])) $gos['cdp-premium-import'] = false; ?>
572
  <input id="cdp-o-premium-import"<?php echo ((!$areWePro)?' disabled="true"':''); ?> <?php echo ($areWePro && $gos['cdp-premium-import'] == 'true')?'checked ':''; ?> type="checkbox" class="cdp-other-inputs" name="cdp-premium-import" />
573
- <span class="cdp-relative cdp-tooltip-premium" data-top="5">Show post export & import buttons <span class="cdp-premium-icon cdp-big-icon" style="right: -30px"></span></span>
574
  </label>
575
  <label for="cdp-o-menu-in-settings">
576
  <input <?php echo (isset($gos['cdp-menu-in-settings']) && $gos['cdp-menu-in-settings'] == 'true')?'checked ':''; ?>id="cdp-o-menu-in-settings" type="checkbox" class="cdp-other-inputs" name="cdp-menu-in-settings">
577
- Hide Copy & Delete Posts Menu under <b>Tools</b> dropdown
578
  </label>
579
  </div>
580
  <div class="cdp-center cdp-padding-15-h">
581
- <button class="cdp-button cdp-save-options">Save</button>
582
  <div class="cdp-padding cdp-f-s-17">
583
- <a href="#" class="cdp-close-chapter">Close section</a>
584
  </div>
585
  </div>
586
  </div>
587
  </div>
588
  </div>
589
  <div class="cdp-f-s-20 cdp-p-hh">
590
- ...and after your copy frenzy, you may need to…
591
  </div>
592
 
593
  <!-- DELETE SECTION -->
594
  <div class="cdp-collapsible" data-cdp-group="mains">
595
  <div class="cdp-d-xclicked cdp-collapsible-title">
596
  <div class="cdp-cf">
597
- <div class="cdp-left cdp-ff-b1"><b class="cdp-ff-b4">Delete duplicate posts/pages</b></div>
598
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
599
  </div>
600
  </div>
@@ -602,18 +623,18 @@ function cdp_configuration() {
602
 
603
  <div class="cdp-padding">
604
  <div class="cdp-backup-alert cdp-f-s-20 cdp-f-w-light">
605
- Before you delete anything here (which cannot be undone!) we <b class="cdp-f-w-bold">strongly suggest</b><br />
606
- that you create a backup, for example with <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank">this plugin</a>
607
  </div>
608
  <div class="cdp-cf cdp-tab-list">
609
  <div class="cdp-left cdp-tab-element cdp-tab-active" data-box="cdp-tabox-manual">
610
- <span>Manual Cleanup</span>
611
  </div>
612
  <div class="cdp-left cdp-tab-element cdp-tooltip-premium" data-top="-4" data-box="cdp-tabox-automatic"<?php echo ((!$areWePro)?' data-disabled="true"':''); ?>>
613
- <span class="cdp-relative">Automatic Cleanup <span class="cdp-premium-icon cdp-big-icon"></span></span>
614
  </div>
615
  <div class="cdp-left cdp-tab-element" data-box="cdp-tabox-redirects">
616
- <span class="cdp-relative">Redirection <span class="cdp-premium-icon cdp-big-icon"></span></span>
617
  </div>
618
  </div>
619
  <div class="cdp-cont-d-box-tabed" id="cdp-tabox-redirects">
@@ -626,20 +647,20 @@ function cdp_configuration() {
626
  </div>
627
  <div class="cdp-lh-24 cdp-black-all" style="max-width: 82%; margin: 0 auto;">
628
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
629
- As part of the <span class="cdp-green">premium plugin</span> you can enable redirects, so that the URLs of your deleted posts/pages automatically take visitors to the version which you decided to keep.
630
  </div>
631
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
632
- This isn’t just good for your visitors, but also for SEO: the “link juice” from your old (deleted) articles will be forwarded to the versions you keep, helping you to rank higher in search engines.
633
  </div>
634
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
635
- And: you can also use this feature for any other redirections you may need
636
- (not only redirects from deleted posts/pages)!
637
  </div>
638
  </div>
639
  <br />
640
  <div class="cdp-center cdp-padding-15-h" style="padding-bottom: 60px;">
641
  <a href="https://sellcodes.com/CylMIdJD" target="_blank">
642
- <button class="cdp-button cdp-f-s-21 cdp-f-w-medium" style="width: 465px; height: 70px; border-radius: 35px;">Go premium now</button>
643
  </a>
644
  </div>
645
  </div>
@@ -656,61 +677,61 @@ function cdp_configuration() {
656
  <div class="cdp-d-pad-sp" style="padding-top: 20px">
657
  <div class="cdp-special-cb-p">
658
  <div class="cdp-d-header cdp-f-s-19">
659
- Scan for duplicates in...
660
  </div>
661
  <div class="cdp-p-25-40 cdp-f-s-18">
662
- <label><input type="checkbox" name="cdp-d-a-posts" checked class="cdp-d-option cdp-d-first-chapter-cb" />Posts</label>
663
- <label><input type="checkbox" name="cdp-d-a-pages" checked class="cdp-d-option cdp-d-first-chapter-cb" />Pages</label>
664
- <label><input type="checkbox" name="cdp-d-a-customs" checked class="cdp-d-option cdp-d-first-chapter-cb" />Custom posts</label>
665
  </div>
666
  </div>
667
  <div class="cdp-special-cb-p">
668
  <div class="cdp-d-header cdp-f-s-19">
669
- Count them as duplicates if they are identical with respect to <u class="cdp-f-w-bold">all</u> of the below...
670
  </div>
671
  <div>
672
  <div class="cdp-p-25-t cdp-cf">
673
  <div class="cdp-left cdp-f-s-18">
674
- <label style="margin-right: 5px;"><input type="checkbox" checked name="cdp-d-b-title" class="cdp-d-option"/>Title</label>
675
  </div>
676
  <div class="cdp-left" style="margin-top: 1px; margin-left: 5px; font-size: 13px;">
677
- <a href="#" class="cdp-show-more-d-title cdp-f-s-16" style="line-height: 43px;">(show more options)</a>
678
  </div>
679
  <div class="cdp-left cdp-f-s-18" style="margin-left: 50px;">
680
- <label><input type="checkbox" name="cdp-d-b-slug" class="cdp-d-option" />Similar slug <span class="cdp-tooltip-top" title="Slugs are never 100% identical (i.e. Wordpress adds a counter automatically to ensure they are unique). The rule to only have them at least 85% identical does the job fine (you can see after the scan which posts are considered identical).">(x ≥ 85%)</span></label>
681
  </div>
682
  </div>
683
  <div class="cdp-p-20-h cdp-more-d-title" style="display: none; padding-left: 37px;">
684
  <div class="cdp-f-s-17 cdp-p-20-b cdp-lh-24">
685
- Do you want to consider different titles still to be identical if a) the copied posts/pages<br />were created by this plugin and b) they were not modified thereafter?
686
  </div>
687
  <div class="cdp-cf">
688
- <label class="cdp-left cdp-f-s-18"><input type="radio" class="cdp-d-option cdp-radio" value="0" name="cdp-radio-btn-dtitles" checked>No</label>
689
- <label class="cdp-left cdp-f-s-18"><input type="radio" class="cdp-d-option cdp-radio" value="1" name="cdp-radio-btn-dtitles">Yes</label>
690
- <span class="cdp-green cdp-f-s-17 cdp-tooltip-top cdp-left" title="The copies you created may have been given different titles automatically (according to the rules in <a href='#' class='cdp-go-to-names-chapter'>this section</a>) and therefore would not count as duplicates as they have different titles.<br /><br />To remedy this, you can select “Yes” here so that those posts/pages also get considered as duplicates." style="line-height: 44px;">When does “yes” make sense here?</span>
691
  </div>
692
  </div>
693
  <!-- <div class="cdp-padding-15-h cdp-f-s-18">
694
  </div> -->
695
  <div class="cdp-cf cdp-p-40-b">
696
  <label class="cdp-left cdp-f-s-18" style="margin-right: 21px;">
697
- <input type="checkbox" name="cdp-d-c-excerpt" class="cdp-d-option" />Excerpt (<span class="cdp-no-empty-text"><b>including</b> empty</span>)
698
  </label>
699
- <label class="cdp-left cdp-f-s-18" style="margin-right: 90px !important;"><input type="checkbox" name="cdp-d-c-count" class="cdp-d-option"/>Word count</label>
700
  <div class="cdp-left cdp-f-s-17" style="line-height: 43px;">
701
- ...need others? <a href="mailto:hi@copy-delete-posts.com" target="_blank">Suggest them!</a>
702
  </div>
703
  </div>
704
  </div>
705
  <div class="cdp-d-option-select-parent cdp-padding-15-h cdp-center cdp-ntp">
706
  <div class="cdp-inline cdp-cf">
707
  <select class="cdp-left cdp-d-option-select cdp-pad-49-list cdp-select-large cdp-max-600 cdp-select cdp-select-centered cdp-sel-separat" name="cdp-d-sels-diftyp">
708
- <option value="1">Only count pages/posts of the same type as duplicates</option>
709
- <option value="2">Also count pages/posts of different types as duplicates</option>
710
  </select>
711
  <span class="cdp-left cdp-green">
712
  <div style="margin-left: 15px; line-height: 51px;">
713
- <span class="cdp-tooltip-top" title='Select the “same type”-option if the pages/posts have to be of the same type (i.e. post / page / specific custom post category) in order to count as duplicates. If you select “cross-type” then pages/posts of different types will also be considered as duplicates.'>Huh?</span>
714
  </div>
715
  </span>
716
  </div>
@@ -718,32 +739,32 @@ function cdp_configuration() {
718
  </div>
719
  <div class="">
720
  <div class="cdp-d-header cdp-f-s-19">
721
- Which version do you want to keep?
722
  </div>
723
  <div class="cdp-p-30-h cdp-center">
724
  <select class="cdp-d-option-select cdp-pad-49-list cdp-select-large cdp-select cdp-select-centered cdp-sel-separat" name="cdp-d-d-sel-which">
725
- <option value="1">Keep the oldest duplicate (typically the original)</option>
726
- <option value="2">Keep the newest duplicate (typically the last copy you made)</option>
727
- <option value="3">Delete ALL duplicates, don’t keep any (Be careful!)</option>
728
  </select>
729
  </div>
730
  </div>
731
  <div class="cdp-relative cdp-f-s-19">
732
  <span class="cdp-tooltip-premium" data-top="0">
733
- <b>Filter results (optional)</b>: Only list them, if they<span id="cdpp-switch-mf"> […]</span> <span class="cdp-premium-icon cdp-big-icon"></span>
734
  </span>
735
  </div>
736
  <?php if ($areWePro && function_exists('cdpp_more_filters')) cdpp_more_filters(); ?>
737
  <br />
738
  <div class="cdp-center cdp-p-30-h">
739
- <button class="cdp-button cdp-delete-btn cdp-d-search cdp-rl-round cdp-f-w-bold" type="button" name="button">Scan for duplicates now!<br /><small class="cdp-sm-d cdp-f-s-17 cdp-f-w-medium">(at this point nothing gets deleted)</small></button>
740
  </div>
741
  </div>
742
 
743
  <div class="cdp-padding-15-h">
744
  <div class="cdp-cf cdp-d-pad-sp cdp-not-yet-search" style="display: none; padding-bottom: 30px;">
745
  <div class="cdp-left cdp-f-s-19 cdp-f-w-bold" style="line-height: 41px;">
746
- Scan has found [<span id="cdp-d-table-pagi-ilosc-wynikow" class="cdp-f-w-bold"></span>] duplicates
747
  </div>
748
  <div class="cdp-right">
749
  <input type="text" class="cdp-d-searchbox-c" name="cdp-d-searchbox" placeholder="Search...">
@@ -751,7 +772,7 @@ function cdp_configuration() {
751
  <div class="cdp-right cdp-f-s-19" style="padding-right: 45px;">
752
  <div class="cdp-cf" style="line-height: 41px;">
753
  <div class="cdp-left">
754
- Show
755
  </div>
756
  <select class="cdp-left cdp-select cdp-ow-border cdp-per-page-select-show cdp-width-166">
757
  <option value="5">5</option>
@@ -764,7 +785,7 @@ function cdp_configuration() {
764
  <option value="100">100</option>
765
  </select>
766
  <div class="cdp-left">
767
- per page
768
  </div>
769
  </div>
770
  </div>
@@ -776,11 +797,11 @@ function cdp_configuration() {
776
  <thead>
777
  <tr class="cdp-f-s-19 cdp-f-w-medium">
778
  <th><label><input type="checkbox" class="cdp-d-checkbox-all"/></label></th>
779
- <th>Title</th>
780
- <th>Slug/URL</th>
781
- <th>Type</th>
782
- <th>Date created</th>
783
- <th># of words</th>
784
  </tr>
785
  </thead>
786
  <thead>
@@ -797,7 +818,7 @@ function cdp_configuration() {
797
  <div class="cdp-d-pad-sp">
798
  <div class="cdp-cf cdp-not-yet-search" style="display: none;">
799
  <div class="cdp-d-sel-all-con cdp-left cdp-f-w-light cdp-f-s-17">
800
- <u class="cdp-d-select-all cdp-f-w-light">Select all</u> (also from other pages)
801
  </div>
802
  <div class="cdp-center cdp-d-pagi-cent cdp-left">
803
  <div id="cdp-d-table-pagi" class="cdp-pagination"></div>
@@ -805,82 +826,82 @@ function cdp_configuration() {
805
  </div>
806
  <div class="cdp-center cdp-p-10-h cdp-not-yet-search" style="display: none;">
807
  <div class="cdp-delete-info cdp-f-w-light cdp-f-s-19">
808
- You selected <b class="cdp-t-d-ct cdp-f-w-light">0</b> pages/posts to be deleted
809
  </div>
810
  </div>
811
  <div class="cdp-p-10-h cdp-not-yet-search" style="display: none;">
812
  <div class="cdp-d-header-2 cdp-f-s-19 cdp-f-w-light">
813
- Steps to deletion:
814
  </div>
815
  <div class="cdp-margin-left cdp-f-s-19">
816
  <div class="cdp-p-10-h">
817
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
818
  <div class="cdp-left cdp-blue-circle">1</div>
819
- <div class="cdp-left">&nbsp;Make sure you created a backup with, e.g. with <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank">this plugin</a>.</div>
820
  </div>
821
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
822
  <div class="cdp-left cdp-blue-circle">2</div>
823
- <div class="cdp-left">&nbsp;Select all the posts & pages which should be deleted (by ticking the checkboxes in the table above).</div>
824
  </div>
825
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
826
  <div class="cdp-left cdp-blue-circle">3</div>
827
- <div class="cdp-left">&nbsp;Check if you need these features (optional):</div>
828
  </div>
829
  </div>
830
  <div class="cdp-margin-left-25 cdp-p-20-h cdp-nbp" style="padding-top: 0px">
831
  <table>
832
  <tbody>
833
  <tr>
834
- <td class="cdp-vtop-pad">Automatic redirection</td>
835
  <td>
836
  <div class="cdp-relative">
837
  <span class="cdp-tooltip-premium" style="padding: 25px 0;">
838
  <select class="cdp-p-redirections cdp-select cdp-ow-border cdp-dis-en-opt" name="cdp-redirections">
839
- <option value="0">Disabled</option>
840
- <option value="1">Enabled</option>
841
  </select>
842
  </span>
843
  <div class="cdp-premium-icon cdp-big-icon" style="margin-left: 17px;"></div>
844
  </div>
845
- <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24">Enable this if you want to redirect the urls from your deleted posts/pages to the main one you decided to keep.</div>
846
  </td>
847
  </tr>
848
  <tr>
849
- <td class="cdp-vtop-pad">Deletion throttling</td>
850
  <td>
851
  <div class="cdp-cf">
852
  <select class="cdp-left cdp-d-throttling cdp-select cdp-ow-border cdp-dis-en-opt" name="cdp-throttling">
853
- <option value="0">Disabled</option>
854
- <option value="1">Enabled</option>
855
  </select>
856
  <div class="cdp-left cdp-inline cdp-cf cdp-d-throttling-count-p" style="display: none; line-height: 41px;">
857
  <div class="cdp-left">
858
- <span style="padding: 0px 15px;">Delete</span>
859
  </div>
860
  <div class="cdp-left">
861
  <input type="number" class="cdp-d-throttling-count cdp-number-field-styled" name="cdp-throttling-count" min="1" max="10240" placeholder="50">
862
  </div>
863
  <div class="cdp-left">
864
- <span style="padding: 0px 15px;">per minute</span>
865
  </div>
866
  </div>
867
  </div>
868
  <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24">
869
- Enable this if you want to have your posts/pages getting deleted in batches (instead of all at once).<br />This reduces the risk of timeouts if you have a lot to delete.<br />
870
  <span class="cdp-even-more-th-info" style="display: none">
871
- If it’s necessary the process will dynamically slow down - depending on your server’s resource consumption. For example, if you’re using another plugin which is running a background process and it takes a lot of resources (+50%), our plugin will wait/slow down until the other process is complete.
872
  </span>
873
  </div>
874
  </td>
875
  </tr>
876
  <tr>
877
- <td class="cdp-vtop-pad" style="padding-top: 4px">Move post(s) to trash?</td>
878
  <td>
879
  <div class="">
880
  <span class="cdp-tooltip-premium" style="padding: 25px 0">
881
- <label class="cdp-relative" style="padding-right: 25px;"><input type="checkbox" class="cdp-p-just-trash-them" /> Yes, keep deleted posts in trash! <span class="cdp-premium-icon cdp-big-icon"></span></label>
882
  </span>
883
- <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24">Select this option to move deleted posts to trash (instead of deleting them permanently right away).</div>
884
  </div>
885
  </td>
886
  </tr>
@@ -893,17 +914,17 @@ function cdp_configuration() {
893
  <div class="cdp-not-yet-search" style="display: none;">
894
  <hr class="cdp-hr">
895
  <div class="cdp-center cdp-padding-15-h cdp-f-s-19">
896
- <label><input type="checkbox" class="cdp-d-just-check-it"> I completed <u>all</u> steps, it’s ok!</label>
897
  </div>
898
  <div class="cdp-center cdp-p-10-h">
899
- <button type="button" class="cdp-button cdp-red-bg cdp-d-real-delete cdp-f-s-19" name="button">Delete selected pages/posts!</button>
900
  </div>
901
  <div class="cdp-center cdp-padding-15-h cdp-f-s-19">
902
- You will be notified when the deletion process ends via <span class="cdp-green">Admin Bar Menu</span>.
903
  </div>
904
  </div>
905
  <div class="cdp-padding cdp-f-s-17 cdp-center">
906
- <a href="#" class="cdp-close-chapter">Close section</a>
907
  </div>
908
  </div>
909
  </div>
@@ -920,7 +941,7 @@ function cdp_configuration() {
920
  </div>
921
 
922
  <div class="cdp-f-s-20 cdp-p-hh cdp-center cdp-relative">
923
- <b>Questions?</b> We're happy to help in the <a href="https://wordpress.org/support/plugin/copy-delete-posts/" target="_blank" style="text-decoration: none;">Support Forum</a>. <span class="cdp-info-icon cdp-tooltip-top" title="Your account on Wordpress.org (where you open a new support thread) is different to the one you login to your WordPress dashboard (where you are now). If you don't have a WordPress.org account yet, please sign up at the top right on here. It only takes a minute :) Thank you!"></span>
924
  </div>
925
 
926
  <jdiv class="label_e50 _bottom_ea7 notranslate" id="cdp_jvlabelWrap-fake" style="background: linear-gradient(95deg, rgb(47, 50, 74) 20%, rgb(66, 72, 103) 80%);right: 30px;bottom: 0px;width: 310px;">
@@ -944,5 +965,3 @@ function cdp_configuration() {
944
  <?php
945
  }
946
  /** –– **/
947
-
948
- ?>
87
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
88
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
89
  if (
90
+ is_plugin_active('USM-Premium/usm_premium_icons.php') ||
91
+ is_plugin_active('Ultimate-Social-Media-Plus/ultimate_social_media_icons.php') ||
92
+ is_plugin_active('Ultimate-Social-Media-Icons/ultimate_social_media_icons.php') ||
93
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
94
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
95
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
108
  <?php if ($areWePro && function_exists('cdpp_profile_manager_html')) cdpp_profile_manager_html(); ?>
109
  <?php if ($areWePro && function_exists('cdpp_delete_redi_modal')) cdpp_delete_redi_modal(); ?>
110
  <div class="cdp-preloader-c<?php echo $isCoolInstalled ?>">
111
+ <div class="cdp-center"><?php _e('Loading...', 'copy-delete-posts'); ?></div>
112
  <div class="cdp-preloader"></div>
113
  </div>
114
  <div class="cdp-container cdp-main-menu-cont" style="display: none;">
116
  <div class="cdp-cf">
117
  <div class="cdp-left">
118
  <!-- <h1 class="cdp-f-s-30 cdp-f-w-light cdp-welcome-title-after">Welcome<?php echo ' ' . $current_user->user_login . ','; ?> to Copy & Delete Posts!</h1> -->
119
+ <h1 class="cdp-f-s-30 cdp-f-w-medium cdp-welcome-title-after"><?php _e('Welcome to Copy & Delete Posts!', 'copy-delete-posts'); ?></h1>
120
  </div>
121
  <div class="cdp-right">
122
+ <div class="cdp-s-i-a cdp-welcome-title-after cdp-text-right cdp-green"<?php echo $content ?>><a class="cdp-pointer" id="cdp-show-into-again"><span class="cdp-green cdp-f-s-16"><?php _e('Show intro', 'copy-delete-posts'); ?></span></a></div>
123
  </div>
124
  </div>
125
 
126
  <div class="cdp-intro"<?php echo $intro ?>>
127
  <div class="cdp-box cdp-white-bg cdp-shadow">
128
+ <div class="cdp-font-heading cdp-f-s-21 cdp-f-w-regular"><?php _e('You can now easily copy posts & pages in various areas:', 'copy-delete-posts'); ?></div>
129
  <div class="cdp-cf">
130
  <div class="cdp-showcase-3 cdp-left">
131
+ <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center"><?php _e('List of posts/pages', 'copy-delete-posts'); ?></div>
132
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-1" alt="lists">
133
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_1.gif" class="cdp-no-vis cfg-img-sc-3" alt="lists">
134
  </div>
135
  </div>
136
  <div class="cdp-showcase-3 cdp-left">
137
+ <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center"><?php _e('Edit screen', 'copy-delete-posts'); ?></div>
138
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-2" alt="edit">
139
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_2.gif" class="cdp-no-vis cfg-img-sc-3" alt="edit">
140
  </div>
141
  </div>
142
  <div class="cdp-showcase-3 cdp-left">
143
+ <div class="cdp-font-title cdp-f-s-22 cdp-f-w-bold cdp-center"><?php _e('Admin bar', 'copy-delete-posts'); ?></div>
144
  <div class="cfg-img-sc-3 cdp-intro-image cdp-intro-img-3" alt="adminbar">
145
  <img src="<?php echo $cdp_plug_url; ?>/assets/imgs/intro_3.gif" class="cdp-no-vis cfg-img-sc-3 cfg-img-sc-3-special" alt="adminbar">
146
  </div>
147
  </div>
148
  </div>
149
+ <div class="cdp-center cdp-font-footer"><?php _e('…and you can also <b>delete duplicate</b> posts easily, see below :)', 'copy-delete-posts'); ?></div>
150
  <div class="cdp-center cdp-intro-options">
151
+ <button class="cdp-intro-button cdp-f-s-21 cdp-f-w-bold"><?php _e('Got it, close intro!', 'copy-delete-posts'); ?></button>
152
  <div class="cdp-ff-b1 cdp-checkboxes cdp-hide" style="margin-top: 5px;">
153
  <label for="cdp-never-intro">
154
  <input type="checkbox" checked id="cdp-never-intro" style="margin-top: -3px !important"/>
155
+ <?php _e('Don\'t show this intro – never again!', 'copy-delete-posts'); ?>
156
  </label>
157
  </div>
158
  </div>
163
  <div class="cdp-left cdp-lh-48 cdp-f-s-20">
164
  <div class="cdp-cf">
165
  <div class="cdp-left cdp-f-w-light">
166
+ <?php _e('Below are your', 'copy-delete-posts'); ?>
167
  </div>
168
  <select class="cdp-left cdp-profile-selected cdp-select-styled cdp-select cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-color-p-i<?php echo ((!$areWePro)?' cdp-premium-in-select':''); ?>">
169
  <?php
174
  ?>
175
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
176
  <?php endforeach; } else { ?>
177
+ <option value="default" selected><?php _e('Default', 'copy-delete-posts'); ?></option>
178
+ <option value="premium" disabled><?php _e('Add new', 'copy-delete-posts'); ?></option>
179
  <?php } ?>
180
  </select>
181
  <div class="cdp-left cdp-f-w-light">
182
+ <?php _e('settings', 'copy-delete-posts'); ?>
183
  </div>
184
  </div>
185
  </div>
186
  <div class="cdp-right cdp-lh-48 cdp-relative">
187
  <div>
188
  <span class="cdp-tooltip-premium" style="padding: 25px 0">
189
+ <span class="cdp-manager-btns cdp-green cdp-hover cdp-pointer cdp-f-w-light cdp-f-s-16" style="padding-right: 33px;"><?php _e('+ Add / manage / import / export settings', 'copy-delete-posts'); ?></span>
190
  <span class="cdp-premium-icon cdp-big-icon" style="right: 3px;"></span>
191
  </span>
192
  </div>
198
  <div class="cdp-collapsible" data-cdp-group="mains">
199
  <div class="cdp-collapsible-title">
200
  <div class="cdp-cf">
201
+ <div class="cdp-left cdp-ff-b1"><?php _e('Which <b class="cdp-ff-b4">elements</b> shall be copied?', 'copy-delete-posts'); ?></div>
202
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
203
  </div>
204
  </div>
208
  <thead class="cdp-thead cdp-f-s-18">
209
  <tr>
210
  <th></th>
211
+ <th><?php _e('<b>If checked</b> copies will...', 'copy-delete-posts'); ?></th>
212
+ <th><?php _e('<b>If <u class="cdp-f-w-bold">un</u>checked</b> copies will...', 'copy-delete-posts'); ?></th>
213
  </tr>
214
  </thead>
215
  <tbody class="cdp-ff-b1 cdp-f-s-18 cdp-tbody-of-settings">
216
  <tr>
217
+ <td><label class="cdp-relative"><input <?php echo $defaults['title']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="title" type="checkbox" /><span><?php _e('Title', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
218
+ <td><?php _e('…get the title as defined in the <a href="#" class="cdp-go-to-names-chapter"><span class="cdp-green">next section</span></a>.', 'copy-delete-posts'); ?></td>
219
+ <td><?php _e('…be titled “Untitled”.', 'copy-delete-posts'); ?></td>
220
  </tr>
221
  <tr>
222
+ <td><label class="cdp-relative"><input <?php echo $defaults['date']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="date" type="checkbox" /><span><?php _e('Date', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
223
+ <td><?php _e('…get the same creation date & time as the original.', 'copy-delete-posts'); ?></td>
224
+ <td><?php _e('…get the date & time at time of copying. ', 'copy-delete-posts'); ?></td>
225
  </tr>
226
  <tr>
227
+ <td><label class="cdp-relative"><input <?php echo $defaults['status']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="status" type="checkbox" /><span><?php _e('Status', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
228
+ <td><?php _e('…get status of original article (which can be “published” or “deleted” etc.)', 'copy-delete-posts'); ?></td>
229
+ <td><?php _e('…get the status “Draft”.', 'copy-delete-posts'); ?></td>
230
  </tr>
231
  <tr>
232
+ <td><label class="cdp-relative"><input <?php echo $defaults['slug']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="slug" type="checkbox" /><span><?php _e('Slug', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
233
+ <td><?php _e('…get the same <a href="https://kinsta.com/knowledgebase/wordpress-slug/" target="_blank"><span class="cdp-green">slug</span></a> of the original. (However after publishing it will give it automatically a new slug because 2 pages cannot be on the same URL).', 'copy-delete-posts'); ?></td>
234
+ <td><?php _e('…get a blank slug, unless the page is published, then it will generate it automatically.', 'copy-delete-posts'); ?></td>
235
  </tr>
236
  <tr>
237
+ <td><label class="cdp-relative"><input <?php echo $defaults['excerpt']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="excerpt" type="checkbox" /><span><?php _e('Excerpt', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
238
+ <td><?php _e('…get the custom <a href="https://wordpress.org/support/article/excerpt/" target="_blank"><span class="cdp-green">excerpt</span></a> (post/page summary) of the original (if the original had any).', 'copy-delete-posts'); ?></td>
239
+ <td><?php _e('…get an empty <i>custom</i> excerpt (and default to taking the first 55 words of the post).', 'copy-delete-posts'); ?></td>
240
  </tr>
241
  <tr>
242
+ <td><label class="cdp-relative"><input <?php echo $defaults['content']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="content" type="checkbox" /><span><?php _e('Content', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
243
+ <td><?php _e('…get all the content (text, images, videos and other elements/blocks) from the original.', 'copy-delete-posts'); ?></td>
244
+ <td><?php _e('…get no content (be completely blank).', 'copy-delete-posts'); ?></td>
245
  </tr>
246
  <tr>
247
+ <td><label class="cdp-relative"><input <?php echo $defaults['f_image']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="f_image" type="checkbox" /><span><?php _e('Featured image', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
248
+ <td><?php _e('…it will set the same <a href="https://firstsiteguide.com/wordpress-featured-image/" target="_blank"><span class="cdp-green">featured image</span></a> as the original.', 'copy-delete-posts'); ?></td>
249
+ <td><?php _e('…get no featured image.', 'copy-delete-posts'); ?></td>
250
  </tr>
251
  <tr>
252
+ <td><label class="cdp-relative"><input <?php echo $defaults['template']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="template" type="checkbox" /><span><?php _e('Template', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
253
+ <td><?php _e('…get the same page <a href="https://wpapprentice.com/blog/wordpress-theme-vs-template/" target="_blank"><span class="cdp-green">template</span></a> as original.', 'copy-delete-posts'); ?></td>
254
+ <td><?php _e('…get the default page template.', 'copy-delete-posts'); ?></td>
255
  </tr>
256
  <tr>
257
+ <td><label class="cdp-relative"><input <?php echo $defaults['format']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="format" type="checkbox" /><span><?php _e('Format', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
258
+ <td><?php _e('…get the same <a href="https://wordpress.org/support/article/post-formats/" target="_blank"><span class="cdp-green">post format</span></a> as original.', 'copy-delete-posts'); ?></td>
259
+ <td><?php _e('…get the standard post format.', 'copy-delete-posts'); ?></td>
260
  </tr>
261
  <tr>
262
+ <td><label class="cdp-relative"><input <?php echo $defaults['author']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="author" type="checkbox" /><span><?php _e('Author', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
263
+ <td><?php _e('…get the same author as original.', 'copy-delete-posts'); ?></td>
264
+ <td><?php _e('…get the user that is duplicating as an author.', 'copy-delete-posts'); ?></td>
265
  </tr>
266
  <tr>
267
+ <td><label class="cdp-relative"><input <?php echo $defaults['password']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="password" type="checkbox" /><span><?php _e('Password', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
268
+ <td><?php _e('…get the same <a href="https://wordpress.org/support/article/using-password-protection/" target="_blank"><span class="cdp-green">password</span></a> as original.', 'copy-delete-posts'); ?></td>
269
+ <td><?php _e('…get no password.', 'copy-delete-posts'); ?></td>
270
  </tr>
271
  <tr>
272
+ <td><label class="cdp-relative"><input <?php echo $defaults['attachments']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="attachments" type="checkbox" /><span><?php _e('Attachments', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
273
+ <td><?php _e('…create new <a href="https://wordpress.org/support/article/using-image-and-file-attachments/#attachment-to-a-post" target="_blank"><span class="cdp-green">attachments</span></a> (duplicates in Media Library) as well. <i>Recommended only for Multisites.</i>', 'copy-delete-posts'); ?></td>
274
+ <td><?php _e('…get existing attachments from the original.', 'copy-delete-posts'); ?></td>
275
  </tr>
276
  <tr>
277
+ <td><label class="cdp-relative"><input <?php echo $defaults['children']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="children" type="checkbox" /><span><?php _e('Children', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
278
+ <td><?php _e('…get their <a href="https://phppot.com/wordpress/how-to-create-a-child-page-in-wordpress/" target="_blank"><span class="cdp-green">child pages</span></a> copied as well, with all current settings applied to child-duplicates (if the page is a parent).', 'copy-delete-posts'); ?></td>
279
+ <td><?php _e('…not get their child pages copied along (if the page is a parent).', 'copy-delete-posts'); ?></td>
280
  </tr>
281
  <tr>
282
+ <td><label class="cdp-relative"><input <?php echo $defaults['comments']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="comments" type="checkbox" /><span><?php _e('Comments', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
283
+ <td><?php _e('…get all comments from the original.', 'copy-delete-posts'); ?></td>
284
+ <td><?php _e('…get no comments from the original.', 'copy-delete-posts'); ?></td>
285
  </tr>
286
  <tr>
287
+ <td><label class="cdp-relative"><input <?php echo $defaults['menu_order']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="menu_order" type="checkbox" /><span><?php _e('Menu order', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
288
+ <td><?php _e('…get the <a href="https://wordpress.stackexchange.com/questions/25202/how-to-change-order-of-menu-items" target="_blank"><span class="cdp-green">menu order</span></a> from the original.', 'copy-delete-posts'); ?></td>
289
+ <td><?php _e('…get the menu order set to default (0).', 'copy-delete-posts'); ?></td>
290
  </tr>
291
  <tr>
292
+ <td><label class="cdp-relative"><input <?php echo $defaults['category']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="category" type="checkbox" /><span><?php _e('Categories', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
293
+ <td><?php _e('…get all categories from the original post.', 'copy-delete-posts'); ?></td>
294
+ <td><?php _e('…be Uncategorized, no categories will be copied.', 'copy-delete-posts'); ?></td>
295
  </tr>
296
  <tr>
297
+ <td><label class="cdp-relative"><input <?php echo $defaults['post_tag']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="post_tag" type="checkbox" /><span><?php _e('Tags', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
298
+ <td><?php _e('…get all tags of the original post.', 'copy-delete-posts'); ?></td>
299
+ <td><?php _e('…be without any tags.', 'copy-delete-posts'); ?></td>
300
  </tr>
301
  <tr>
302
+ <td><label class="cdp-relative"><input <?php echo $defaults['taxonomy']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="taxonomy" type="checkbox" /><span><?php _e('Taxonomies', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
303
+ <td><?php _e('…get all custom taxonomy from the original.', 'copy-delete-posts'); ?></td>
304
+ <td><?php _e('…be without custom taxonomy.', 'copy-delete-posts'); ?></td>
305
  </tr>
306
  <tr>
307
  <td>
311
  <input <?php echo $defaults['nav_menu']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="nav_menu" type="checkbox" />
312
  </div>
313
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
314
+ <span><?php _e('Navigation Menus', 'copy-delete-posts'); ?> <span class="cdp-info-icon" style="top: calc(50% + 4px) !important;"></span> </span>
315
  </div>
316
  </div>
317
  </label>
318
  </td>
319
+ <td><?php _e('…get this private taxonomy from the original.', 'copy-delete-posts'); ?></td>
320
+ <td><?php _e('…be without private taxonomy.', 'copy-delete-posts'); ?></td>
321
  </tr>
322
  <tr>
323
+ <td><label class="cdp-relative"><input <?php echo $defaults['link_category']=='true'?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="link_category" type="checkbox" /><span><?php _e('Link categories', 'copy-delete-posts'); ?> <span class="cdp-info-icon"></span></span></label></td>
324
+ <td><?php _e('…get this private taxonomy from the original.', 'copy-delete-posts'); ?></td>
325
+ <td><?php _e('…be without private taxonomy.', 'copy-delete-posts'); ?></td>
326
  </tr>
327
 
328
+ <?php if (false): ?>
329
+ <tr>
330
+ <td class="cdp-tooltip-premium">
331
+ <label>
332
+ <div class="cdp-cf">
333
+ <div class="cdp-left">
334
+ <input <?php echo (array_key_exists('all_metadata', $defaults) && $defaults['all_metadata']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="all_metadata" type="checkbox" />
335
+ </div>
336
+ <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
337
+ <span><?php _e('Other Plugin Settings', 'copy-delete-posts'); ?><span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
338
+ </div>
339
+ </div>
340
+ </label>
341
+ </td>
342
+ <td><?php _e('…clone all metadata tags assigned to post/page.', 'copy-delete-posts'); ?></td>
343
+ <td><?php _e('…copy only required post/page metadata.', 'copy-delete-posts'); ?></td>
344
+ </tr>
345
+ <?php endif; ?>
346
  <tr<?php echo (!$isWoo)?' style="display: none;"':'' ?>>
347
  <td class="cdp-tooltip-premium">
348
  <label>
351
  <input <?php echo (array_key_exists('woo', $defaults) && $defaults['woo']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="woo" type="checkbox" />
352
  </div>
353
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
354
+ <span><?php _e('WooCommerce Settings', 'copy-delete-posts'); ?><span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
355
  </div>
356
  </div>
357
  </label>
358
  </td>
359
+ <td><?php _e('…the same settings from the <a href="https://wordpress.org/plugins/woocommerce/" target="_blank"><span class="cdp-green">WooCommerce plugin</span></a> as the original.', 'copy-delete-posts'); ?></td>
360
+ <td><?php _e('…get empty settings.', 'copy-delete-posts'); ?></td>
361
  </tr>
362
 
363
  <tr<?php echo (!$isUSM)?' style="display: none;"':'' ?>>
368
  <input <?php echo ($defaults['usmplugin']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="usmplugin" type="checkbox" />
369
  </div>
370
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
371
+ <span><?php _e('Ultimate Social Media Settings', 'copy-delete-posts'); ?><span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
372
  </div>
373
  </div>
374
  </label>
375
  </td>
376
+ <td><?php _e('…the same settings from the <a href="https://www.ultimatelysocial.com/usm-premium/" target="_blank"><span class="cdp-green">Ultimate Social Media plugin</span></a> as the original.', 'copy-delete-posts'); ?></td>
377
+ <td><?php _e('…get empty settings.', 'copy-delete-posts'); ?></td>
378
  </tr>
379
 
380
  <tr<?php echo (!$isYoast)?' style="display: none;"':'' ?>>
385
  <input <?php echo ($defaults['yoast']=='true' && $areWePro == true)?'checked ':''; ?>class="cdp-data-set" data-cdp-opt="yoast" type="checkbox" />
386
  </div>
387
  <div class="cdp-left cdp-relative" style="width: calc(100% - 45px)">
388
+ <span><?php _e('Yoast SEO Settings', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon" style="top: calc(50% + 2px) !important;"></span> </span>
389
  </div>
390
  </div>
391
  </label>
392
  </td>
393
+ <td><?php _e('…the same settings from the <a href="https://wordpress.org/plugins/wordpress-seo/" target="_blank"><span class="cdp-green">Yoast SEO plugin</span></a> as the original.', 'copy-delete-posts'); ?></td>
394
+ <td><?php _e('…get empty settings.', 'copy-delete-posts'); ?></td>
395
  </tr>
396
 
397
  </tbody>
398
  </table>
399
  <div class="cdp-pad-lin cdp-gray cdp-f-s-18 cdp-lh-24 cdp-center" style="padding-top: 40px; padding-bottom: 20px;">
400
+ <i><?php _e('Do you know anything else you want to have copied (e.g. data added by a different plugin)? <br />
401
+ Please <a href="mailto:hi@copy-delete-posts.com" target="_blank"><span class="cdp-green">tell us about it</span></a>, we always want to further improve this plugin! :) ', 'copy-delete-posts'); ?></i>
402
  </div>
403
  <div class="cdp-center cdp-padding cdp-p-35-b">
404
+ <button class="cdp-button cdp-save-options"><?php _e('Save', 'copy-delete-posts'); ?></button>
405
  <div class="cdp-padding cdp-f-s-17">
406
+ <a href="#" class="cdp-close-chapter"><?php _e('Close section', 'copy-delete-posts'); ?></a>
407
  </div>
408
  </div>
409
  </div>
414
  <div class="cdp-collapsible" data-cdp-group="mains">
415
  <div class="cdp-collapsible-title cdp-name-section-cnx">
416
  <div class="cdp-cf">
417
+ <div class="cdp-left cdp-ff-b1"><?php _e('What <b class="cdp-ff-b4">name(s)</b> should the copies have?', 'copy-delete-posts'); ?></div>
418
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
419
  </div>
420
  </div>
421
  <div class="cdp-collapsible-content cdp-np cdp-drags-cont">
422
  <div class="cdp-pad-lin cdp-f-s-18 cdp-f-w-light">
423
+ <?php _e('Build your preferred naming logic for the copies:', 'copy-delete-posts'); ?>
424
  </div>
425
  <div class="cdp-green-bg cdp-pad-lin" style="padding-bottom: 20px;">
426
  <div class="cdp-cf cdp-center">
427
+ <div class="cdp-left cdp-names-input cdp-f-s-16"><?php _e('Prefix', 'copy-delete-posts'); ?></div>
428
  <div class="cdp-left cdp-names-divider cdp-nlh"></div>
429
+ <div class="cdp-left cdp-names-input cdp-f-s-16"><?php _e('Suffix', 'copy-delete-posts'); ?></div>
430
  </div>
431
  <div class="cdp-cf cdp-center">
432
  <div class="cdp-left cdp-names-input">
435
  </div>
436
  </div>
437
  <div class="cdp-left cdp-names-divider cdp-f-s-19 cdp-f-w-light">
438
+ <span class="cdp-tooltip-top cdp-togglable-name-b" title="<?php _e('Change to blank', 'copy-delete-posts'); ?>"><?php _e('(Name of original)', 'copy-delete-posts'); ?></span>
439
  </div>
440
  <div class="cdp-left cdp-names-input">
441
  <div strip-br="true" class="cdp-magic-input cdp-shadow cdp-sorts cdp-names-real-input cdp-names-suffix" wrap="off" contenteditable="true" style="margin-left: 0">
444
  </div>
445
  </div>
446
  <div class="cdp-curr-cont">
447
+ <span class="cdp-f-s-18"><?php _e('Example based on current selections:', 'copy-delete-posts'); ?></span>
448
  <span class="cdp-f-s-16 cdp-padding-10-h">
449
+ <span class="cdp-example-name cdp-f-w-bold"><?php _e('(Name of original)', 'copy-delete-posts'); ?></span>
450
  </span>
451
  </div>
452
  </div>
453
  <div class="cdp-pad-lin cdp-f-s-18">
454
+ <div class="cdp-padding-23-h"><?php _e('Drag & drop the automatic elements into the Prefix/Suffix fields to add them.', 'copy-delete-posts'); ?></div>
455
  <div class="">
456
  <div class="cdp-cf cdp-padding-10-h">
457
  <div class="cdp-left">
458
+ <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="0"><?php _e('Counter', 'copy-delete-posts'); ?></div>
459
  </div>
460
+ <div class="cdp-left cdp-names-text-info"><?php _e('Adds an <b class="cdp-f-w-semi-bold">incremental counter</b> (starting with “2”)', 'copy-delete-posts'); ?></div>
461
  </div>
462
  <div class="cdp-cf cdp-padding-10-h">
463
  <div class="cdp-left" style="margin-top: 6px;">
464
+ <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="2"><?php _e('CurrentDate', 'copy-delete-posts'); ?></div>
465
  </div>
466
  <div class="cdp-left cdp-names-text-info">
467
  <div class="cdp-cf" style="line-height: 49px !important;">
468
  <div class="cdp-left">
469
+ <?php _e('Adds the <b class="cdp-f-w-semi-bold">current date</b> in', 'copy-delete-posts'); ?>
470
  </div>
471
  <select class="cdp-left cdp-select-styled cdp-date-picked cdp-select cdp-dd-p-43 cdp-select-padding cdp-ow-border cdp-f-s-19 cdp-select-black cdp-option-premium" name="cdp-date-option">
472
+ <option value="1"<?php echo ($names_format == 1 || $names_format == false || (!$areWePro && $names_format == 3))?' selected':''; ?>><?php _e('mm/dd/yyyy', 'copy-delete-posts'); ?></option>
473
+ <option value="2"<?php echo ($names_format == 2)?' selected':''; ?>><?php _e('dd/mm/yyyy', 'copy-delete-posts'); ?></option>
474
+ <option value="3"<?php echo (($areWePro && $names_format == 3)?' selected':''); ?>><?php _e('Custom', 'copy-delete-posts'); ?></option>
475
  </select>
476
  <?php if ($areWePro && function_exists('cdpp_custom_date')) cdpp_custom_date($names_format, $defaults); ?>
477
+ <div class="cdp-left" style="padding-left: 15px;"><?php _e('format.', 'copy-delete-posts'); ?></div>
478
  </div>
479
  <?php if ($areWePro && function_exists('cdpp_custom_date_info')) cdpp_custom_date_info(); ?>
480
  </div>
481
  </div>
482
  <div class="cdp-cf cdp-padding-10-h" style="padding-bottom: 0; margin-top: 6px;">
483
  <div class="cdp-left">
484
+ <div class="cdp-name-box cdp-drag-name cdp-name-clickable" oncontextmenu="return false;" data-cdp-val="1"><?php _e('CurrentTime', 'copy-delete-posts'); ?></div>
485
  </div>
486
+ <div class="cdp-left cdp-names-text-info"><?php _e('Adds the <b class="cdp-f-w-semi-bold">current time</b> in hh:mm:ss format', 'copy-delete-posts'); ?></div>
487
  </div>
488
  </div>
489
  <div class="cdp-padding-23-h">
490
+ <p class="cdp-f-s-18"><?php _e('You can also type tailored text into the fields above.', 'copy-delete-posts'); ?></p>
491
+ <p class="cdp-f-s-18"><?php _e('If you’re not of the drag & droppy-type, you can also enter shortcodes [Counter], [CurrentDate] and [CurrentTime].', 'copy-delete-posts'); ?></p>
492
+ <p class="cdp-f-s-18"><?php _e('If you make multiple copies in one go, use the Counter-option as otherwise some copies will have the same name.', 'copy-delete-posts'); ?></p>
493
  </div>
494
  <div class="cdp-center">
495
+ <button class="cdp-button cdp-save-options"><?php _e('Save', 'copy-delete-posts'); ?></button>
496
  <div class="cdp-padding cdp-f-s-17">
497
+ <a href="#" class="cdp-close-chapter"><?php _e('Close section', 'copy-delete-posts'); ?></a>
498
  </div>
499
  </div>
500
  </div>
505
  <div class="cdp-collapsible" data-cdp-group="mains">
506
  <div class="cdp-collapsible-title">
507
  <div class="cdp-cf">
508
+ <div class="cdp-left cdp-ff-b1"><?php _e('<b class="cdp-ff-b4">Other</b> options', 'copy-delete-posts'); ?></div>
509
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
510
  </div>
511
  </div>
512
  <div class="cdp-collapsible-content cdp-oth-section cdp-np cdp-special-cb-p">
513
  <div class="cdp-pad-lin">
514
+ <div><h2 class="cdp-f-s-18"><b class="cdp-f-w-bold"><?php _e('Navigation after copying', 'copy-delete-posts'); ?></b></h2></div>
515
  <div class="cdp-padding-15-h">
516
  <div class="cdp-con-cen">
517
  <select class="cdp-other-options cdp-select cdp-select-centered cdp-sel-separat cdp-select-large cdp-dd-p-40 cdp-c-x-a-v" name="after_copy">
518
+ <option value="1"<?php echo ($after_copy == '1' || $after_copy == false)?' selected':''; ?>><?php _e('Leave me where I was', 'copy-delete-posts'); ?></option>
519
+ <option value="2"<?php echo ($after_copy == '2')?' selected':''; ?>><?php _e('Take me to the edit-page of the created copy', 'copy-delete-posts'); ?></option>
520
+ <option value="3"<?php echo ($after_copy == '3')?' selected':''; ?>><?php _e('Decide on a case-by-case basis (adds new button on copy screen)', 'copy-delete-posts'); ?></option>
521
  </select>
522
  </div>
523
+ <div class="cdp-if-edit-page-selected cdp-con-cen cdp-f-s-18 cdp-f-w-light cdp-p-25-40" style="display: none;"><?php _e('If you created multiple copies in one go, you’ll be taken to the first copy.', 'copy-delete-posts'); ?> </div>
524
  </div>
525
  <div>
526
  <h2>
527
+ <b class="cdp-relative cdp-f-s-18 cdp-f-w-bold cdp-tooltip-premium" data-top="5" style="padding-right: 30px;"><?php _e('Pages vs. Posts converter', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon"></span></b>
528
  </h2>
529
  </div>
530
  <div class="cdp-f-s-18 cdp-f-w-light">
531
+ <p class="cdp-f-s-18 cdp-f-w-light"><?php _e('By default, the type of what you copy does not change, i.e. if you copy a post the new version will also be a post, and the same for pages.', 'copy-delete-posts'); ?></p>
532
+ <p class="cdp-padding-15-h cdp-f-s-18 cdp-f-w-light"><?php _e('If you want to make a page out of a post, or vice versa, then you can do this on a <b class="cdp-f-w-bold">case by case basis</b> if you select the option “Define it specifically for this case” in the copy-tooltip, and then select this option on the following screen in the tooltip.', 'copy-delete-posts'); ?></p>
533
+ <p class="cdp-f-s-18 cdp-f-w-light"><?php _e('However, if you want it as a <b class="cdp-f-w-bold">default setting option</b>, then please select it below: ', 'copy-delete-posts'); ?></p>
534
  </div>
535
  <div class="cdp-con-cen">
536
  <div class="cdp-tooltip-premium" style="width: 663px; margin: 0 auto; height: 60px;" data-top="-10">
537
  <select class="cdp-other-options cdp-select cdp-select-centered cdp-sel-separat cdp-select-large cdp-c-x-a-v" name="post_converter">
538
+ <option value="1"<?php echo ($post_converter == '1' || $post_converter == false)?' selected':''; ?>><?php _e('Copies will be the same type as the original', 'copy-delete-posts'); ?></option>
539
+ <option value="2"<?php echo ($post_converter == '2')?' selected':''; ?>><?php _e('ALWAYS change the type when copied (posts will become pages, pages will become posts)', 'copy-delete-posts'); ?></option>
540
  </select>
541
  </div>
542
  </div>
543
+ <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold"><?php _e('User level permissions', 'copy-delete-posts'); ?></b></h2></div>
544
+ <div class="cdp-f-s-18 cdp-p-15-25 cdp-f-w-light"><?php _e('Which user role(s) should be able to copy & delete? <i style="color: gray">– The role also must have access to the dashboard.</i>', 'copy-delete-posts'); ?></div>
545
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
546
  <?php
547
  $isSaved = false;
561
  }
562
  ?>
563
  </div>
564
+ <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold"><?php _e('Content types which can be copied', 'copy-delete-posts'); ?></b></h2></div>
565
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
566
+ <label for="cdp-o-pages"><input <?php echo ($gos['cdp-content-pages'] == 'true')?'checked ':''; ?>id="cdp-o-pages" type="checkbox" class="cdp-other-inputs" name="cdp-content-pages"><?php _e('Pages', 'copy-delete-posts'); ?></label>
567
+ <label for="cdp-o-posts"><input <?php echo ($gos['cdp-content-posts'] == 'true')?'checked ':''; ?>id="cdp-o-posts" type="checkbox" class="cdp-other-inputs" name="cdp-content-posts"><?php _e('Posts', 'copy-delete-posts'); ?></label>
568
+ <label for="cdp-o-custom"><input <?php echo ($gos['cdp-content-custom'] == 'true')?'checked ':''; ?>id="cdp-o-custom" type="checkbox" class="cdp-other-inputs" name="cdp-content-custom"><?php _e('Custom posts types', 'copy-delete-posts'); ?></label>
569
  </div>
570
+ <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold"><?php _e('Display copy option on...', 'copy-delete-posts'); ?></b></h2></div>
571
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
572
+ <label for="cdp-o-postspages"><input <?php echo ($gos['cdp-display-posts'] == 'true')?'checked ':''; ?>id="cdp-o-postspages" type="checkbox" class="cdp-other-inputs" name="cdp-display-posts"><?php _e('Posts/pages lists', 'copy-delete-posts'); ?></label>
573
+ <label for="cdp-o-edit"><input <?php echo ($gos['cdp-display-edit'] == 'true')?'checked ':''; ?>id="cdp-o-edit" type="checkbox" class="cdp-other-inputs" name="cdp-display-edit"><?php _e('Edit screens', 'copy-delete-posts'); ?></label>
574
+ <label for="cdp-o-admin"><input <?php echo ($gos['cdp-display-admin'] == 'true')?'checked ':''; ?>id="cdp-o-admin" type="checkbox" class="cdp-other-inputs" name="cdp-display-admin"><?php _e('Admin bar', 'copy-delete-posts'); ?></label>
575
+ <label for="cdp-o-bulk"><input <?php echo ($gos['cdp-display-bulk'] == 'true')?'checked ':''; ?>id="cdp-o-bulk" type="checkbox" class="cdp-other-inputs" name="cdp-display-bulk"><?php _e('Bulk actions menu', 'copy-delete-posts'); ?></label>
576
+ <label for="cdp-o-gutenberg"><input <?php echo ($gos['cdp-display-gutenberg'] == 'true')?'checked ':''; ?>id="cdp-o-gutenberg" type="checkbox" class="cdp-other-inputs" name="cdp-display-gutenberg"><?php _e('Gutenberg editor', 'copy-delete-posts'); ?></label>
577
  </div>
578
+ <div class=""><h2><b class="cdp-f-s-18 cdp-f-w-bold"><?php _e('Show reference to original item?', 'copy-delete-posts'); ?></b></h2></div>
579
+ <div class="cdp-f-s-18 cdp-f-w-light cdp-p-15-25"><?php _e('If checked, you will see a reference to the original post/page (on the copied version).', 'copy-delete-posts'); ?></div>
580
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
581
+ <label for="cdp-o-posts2"><input <?php echo ($gos['cdp-references-post'] == 'true')?'checked ':''; ?>id="cdp-o-posts2" type="checkbox" class="cdp-other-inputs" name="cdp-references-post"><?php _e('Posts/pages lists', 'copy-delete-posts'); ?></label>
582
+ <label for="cdp-o-edits2"><input <?php echo ($gos['cdp-references-edit'] == 'true')?'checked ':''; ?>id="cdp-o-edits2" type="checkbox" class="cdp-other-inputs" name="cdp-references-edit"><?php _e('Edit screens', 'copy-delete-posts'); ?></label>
583
  </div>
584
+ <div><h2><b class="cdp-f-s-18 cdp-f-w-bold"><?php _e('Additional features', 'copy-delete-posts'); ?></b></h2></div>
585
  <div class="cdp-p-25-40 cdp-f-s-18 cdp-f-w-light">
586
  <label for="cdp-o-premium-hide-tooltip">
587
  <?php if (!isset($gos['cdp-premium-hide-tooltip'])) $gos['cdp-premium-hide-tooltip'] = false; ?>
588
  <input id="cdp-o-premium-hide-tooltip"<?php echo ((!$areWePro)?' disabled="true"':''); ?> <?php echo ($areWePro && $gos['cdp-premium-hide-tooltip'] == 'true')?'checked ':''; ?> type="checkbox" class="cdp-other-inputs" name="cdp-premium-hide-tooltip" />
589
+ <span class="cdp-relative cdp-tooltip-premium" data-top="5"><?php _e('Hide copy tooltip on hover and only show the button', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon" style="right: -30px"></span></span>
590
  </label>
591
  <label for="cdp-o-premium-import">
592
  <?php if (!isset($gos['cdp-premium-import'])) $gos['cdp-premium-import'] = false; ?>
593
  <input id="cdp-o-premium-import"<?php echo ((!$areWePro)?' disabled="true"':''); ?> <?php echo ($areWePro && $gos['cdp-premium-import'] == 'true')?'checked ':''; ?> type="checkbox" class="cdp-other-inputs" name="cdp-premium-import" />
594
+ <span class="cdp-relative cdp-tooltip-premium" data-top="5"><?php _e('Show post export & import buttons', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon" style="right: -30px"></span></span>
595
  </label>
596
  <label for="cdp-o-menu-in-settings">
597
  <input <?php echo (isset($gos['cdp-menu-in-settings']) && $gos['cdp-menu-in-settings'] == 'true')?'checked ':''; ?>id="cdp-o-menu-in-settings" type="checkbox" class="cdp-other-inputs" name="cdp-menu-in-settings">
598
+ <?php _e('Hide Copy & Delete Posts Menu under <b>Tools</b> dropdown', 'copy-delete-posts'); ?>
599
  </label>
600
  </div>
601
  <div class="cdp-center cdp-padding-15-h">
602
+ <button class="cdp-button cdp-save-options"><?php _e('Save', 'copy-delete-posts'); ?></button>
603
  <div class="cdp-padding cdp-f-s-17">
604
+ <a href="#" class="cdp-close-chapter"><?php _e('Close section', 'copy-delete-posts'); ?></a>
605
  </div>
606
  </div>
607
  </div>
608
  </div>
609
  </div>
610
  <div class="cdp-f-s-20 cdp-p-hh">
611
+ <?php _e('...and after your copy frenzy, you may need to…', 'copy-delete-posts'); ?>
612
  </div>
613
 
614
  <!-- DELETE SECTION -->
615
  <div class="cdp-collapsible" data-cdp-group="mains">
616
  <div class="cdp-d-xclicked cdp-collapsible-title">
617
  <div class="cdp-cf">
618
+ <div class="cdp-left cdp-ff-b1"><b class="cdp-ff-b4"><?php _e('Delete duplicate posts/pages', 'copy-delete-posts'); ?></b></div>
619
  <div class="cdp-right"><i class="cdp-arrow cdp-arrow-left"></i></div>
620
  </div>
621
  </div>
623
 
624
  <div class="cdp-padding">
625
  <div class="cdp-backup-alert cdp-f-s-20 cdp-f-w-light">
626
+ <?php _e('Before you delete anything here (which cannot be undone!) we <b class="cdp-f-w-bold">strongly suggest</b><br />
627
+ that you create a backup, for example with <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank">this plugin</a>', 'copy-delete-posts'); ?>
628
  </div>
629
  <div class="cdp-cf cdp-tab-list">
630
  <div class="cdp-left cdp-tab-element cdp-tab-active" data-box="cdp-tabox-manual">
631
+ <span><?php _e('Manual Cleanup', 'copy-delete-posts'); ?></span>
632
  </div>
633
  <div class="cdp-left cdp-tab-element cdp-tooltip-premium" data-top="-4" data-box="cdp-tabox-automatic"<?php echo ((!$areWePro)?' data-disabled="true"':''); ?>>
634
+ <span class="cdp-relative"><?php _e('Automatic Cleanup', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon"></span></span>
635
  </div>
636
  <div class="cdp-left cdp-tab-element" data-box="cdp-tabox-redirects">
637
+ <span class="cdp-relative"><?php _e('Redirection', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon"></span></span>
638
  </div>
639
  </div>
640
  <div class="cdp-cont-d-box-tabed" id="cdp-tabox-redirects">
647
  </div>
648
  <div class="cdp-lh-24 cdp-black-all" style="max-width: 82%; margin: 0 auto;">
649
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
650
+ <?php _e('As part of the <span class="cdp-green">premium plugin</span> you can enable redirects, so that the URLs of your deleted posts/pages automatically take visitors to the version which you decided to keep.', 'copy-delete-posts'); ?>
651
  </div>
652
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
653
+ <?php _e('This isn’t just good for your visitors, but also for SEO: the “link juice” from your old (deleted) articles will be forwarded to the versions you keep, helping you to rank higher in search engines.', 'copy-delete-posts'); ?>
654
  </div>
655
  <div class="cdp-f-s-19 cdp-f-w-regular cdp-padding">
656
+ <?php _e('And: you can also use this feature for any other redirections you may need
657
+ (not only redirects from deleted posts/pages)!', 'copy-delete-posts'); ?>
658
  </div>
659
  </div>
660
  <br />
661
  <div class="cdp-center cdp-padding-15-h" style="padding-bottom: 60px;">
662
  <a href="https://sellcodes.com/CylMIdJD" target="_blank">
663
+ <button class="cdp-button cdp-f-s-21 cdp-f-w-medium" style="width: 465px; height: 70px; border-radius: 35px;"><?php _e('Go premium now', 'copy-delete-posts'); ?></button>
664
  </a>
665
  </div>
666
  </div>
677
  <div class="cdp-d-pad-sp" style="padding-top: 20px">
678
  <div class="cdp-special-cb-p">
679
  <div class="cdp-d-header cdp-f-s-19">
680
+ <?php _e('Scan for duplicates in...', 'copy-delete-posts'); ?>
681
  </div>
682
  <div class="cdp-p-25-40 cdp-f-s-18">
683
+ <label><input type="checkbox" name="cdp-d-a-posts" checked class="cdp-d-option cdp-d-first-chapter-cb" /><?php _e('Posts', 'copy-delete-posts'); ?></label>
684
+ <label><input type="checkbox" name="cdp-d-a-pages" checked class="cdp-d-option cdp-d-first-chapter-cb" /><?php _e('Pages', 'copy-delete-posts'); ?></label>
685
+ <label><input type="checkbox" name="cdp-d-a-customs" checked class="cdp-d-option cdp-d-first-chapter-cb" /><?php _e('Custom posts', 'copy-delete-posts'); ?></label>
686
  </div>
687
  </div>
688
  <div class="cdp-special-cb-p">
689
  <div class="cdp-d-header cdp-f-s-19">
690
+ <?php _e('Count them as duplicates if they are identical with respect to <u class="cdp-f-w-bold">all</u> of the below...', 'copy-delete-posts'); ?>
691
  </div>
692
  <div>
693
  <div class="cdp-p-25-t cdp-cf">
694
  <div class="cdp-left cdp-f-s-18">
695
+ <label style="margin-right: 5px;"><input type="checkbox" checked name="cdp-d-b-title" class="cdp-d-option"/><?php _e('Title', 'copy-delete-posts'); ?></label>
696
  </div>
697
  <div class="cdp-left" style="margin-top: 1px; margin-left: 5px; font-size: 13px;">
698
+ <a href="#" class="cdp-show-more-d-title cdp-f-s-16" style="line-height: 43px;"><?php _e('(show more options)', 'copy-delete-posts'); ?></a>
699
  </div>
700
  <div class="cdp-left cdp-f-s-18" style="margin-left: 50px;">
701
+ <label><input type="checkbox" name="cdp-d-b-slug" class="cdp-d-option" /><?php _e('Similar slug', 'copy-delete-posts'); ?> <span class="cdp-tooltip-top" title="<?php _e('Slugs are never 100% identical (i.e. Wordpress adds a counter automatically to ensure they are unique). The rule to only have them at least 85% identical does the job fine (you can see after the scan which posts are considered identical).', 'copy-delete-posts'); ?>">(x ≥ 85%)</span></label>
702
  </div>
703
  </div>
704
  <div class="cdp-p-20-h cdp-more-d-title" style="display: none; padding-left: 37px;">
705
  <div class="cdp-f-s-17 cdp-p-20-b cdp-lh-24">
706
+ <?php _e('Do you want to consider different titles still to be identical if a) the copied posts/pages<br />were created by this plugin and b) they were not modified thereafter?', 'copy-delete-posts'); ?>
707
  </div>
708
  <div class="cdp-cf">
709
+ <label class="cdp-left cdp-f-s-18"><input type="radio" class="cdp-d-option cdp-radio" value="0" name="cdp-radio-btn-dtitles" checked><?php _e('No', 'copy-delete-posts'); ?></label>
710
+ <label class="cdp-left cdp-f-s-18"><input type="radio" class="cdp-d-option cdp-radio" value="1" name="cdp-radio-btn-dtitles"><?php _e('Yes', 'copy-delete-posts'); ?></label>
711
+ <span class="cdp-green cdp-f-s-17 cdp-tooltip-top cdp-left" title="<?php _e('The copies you created may have been given different titles automatically (according to the rules in <a href="#" class="cdp-go-to-names-chapter">this section</a>) and therefore would not count as duplicates as they have different titles.<br /><br />To remedy this, you can select “Yes” here so that those posts/pages also get considered as duplicates.', 'copy-delete-posts'); ?>" style="line-height: 44px;"><?php _e('When does “yes” make sense here?', 'copy-delete-posts'); ?></span>
712
  </div>
713
  </div>
714
  <!-- <div class="cdp-padding-15-h cdp-f-s-18">
715
  </div> -->
716
  <div class="cdp-cf cdp-p-40-b">
717
  <label class="cdp-left cdp-f-s-18" style="margin-right: 21px;">
718
+ <input type="checkbox" name="cdp-d-c-excerpt" class="cdp-d-option" /><?php _e('Excerpt (<span class="cdp-no-empty-text"><b>including</b> empty</span>)', 'copy-delete-posts'); ?>
719
  </label>
720
+ <label class="cdp-left cdp-f-s-18" style="margin-right: 90px !important;"><input type="checkbox" name="cdp-d-c-count" class="cdp-d-option"/><?php _e('Word count', 'copy-delete-posts'); ?></label>
721
  <div class="cdp-left cdp-f-s-17" style="line-height: 43px;">
722
+ <?php _e('...need others? <a href="mailto:hi@copy-delete-posts.com" target="_blank">Suggest them!</a>', 'copy-delete-posts'); ?>
723
  </div>
724
  </div>
725
  </div>
726
  <div class="cdp-d-option-select-parent cdp-padding-15-h cdp-center cdp-ntp">
727
  <div class="cdp-inline cdp-cf">
728
  <select class="cdp-left cdp-d-option-select cdp-pad-49-list cdp-select-large cdp-max-600 cdp-select cdp-select-centered cdp-sel-separat" name="cdp-d-sels-diftyp">
729
+ <option value="1"><?php _e('Only count pages/posts of the same type as duplicates', 'copy-delete-posts'); ?></option>
730
+ <option value="2"><?php _e('Also count pages/posts of different types as duplicates', 'copy-delete-posts'); ?></option>
731
  </select>
732
  <span class="cdp-left cdp-green">
733
  <div style="margin-left: 15px; line-height: 51px;">
734
+ <span class="cdp-tooltip-top" title='Select the “same type”-option if the pages/posts have to be of the same type (i.e. post / page / specific custom post category) in order to count as duplicates. If you select “cross-type” then pages/posts of different types will also be considered as duplicates.'><?php _e('Huh?', 'copy-delete-posts'); ?></span>
735
  </div>
736
  </span>
737
  </div>
739
  </div>
740
  <div class="">
741
  <div class="cdp-d-header cdp-f-s-19">
742
+ <?php _e('Which version do you want to keep?', 'copy-delete-posts'); ?>
743
  </div>
744
  <div class="cdp-p-30-h cdp-center">
745
  <select class="cdp-d-option-select cdp-pad-49-list cdp-select-large cdp-select cdp-select-centered cdp-sel-separat" name="cdp-d-d-sel-which">
746
+ <option value="1"><?php _e('Keep the oldest duplicate (typically the original)', 'copy-delete-posts'); ?></option>
747
+ <option value="2"><?php _e('Keep the newest duplicate (typically the last copy you made)', 'copy-delete-posts'); ?></option>
748
+ <option value="3"><?php _e('Delete ALL duplicates, don’t keep any (Be careful!)', 'copy-delete-posts'); ?></option>
749
  </select>
750
  </div>
751
  </div>
752
  <div class="cdp-relative cdp-f-s-19">
753
  <span class="cdp-tooltip-premium" data-top="0">
754
+ <?php _e('<b>Filter results (optional)</b>: Only list them, if they<span id="cdpp-switch-mf"> […]</span>', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon"></span>
755
  </span>
756
  </div>
757
  <?php if ($areWePro && function_exists('cdpp_more_filters')) cdpp_more_filters(); ?>
758
  <br />
759
  <div class="cdp-center cdp-p-30-h">
760
+ <button class="cdp-button cdp-delete-btn cdp-d-search cdp-rl-round cdp-f-w-bold" type="button" name="button"><?php _e('Scan for duplicates now!<br /><small class="cdp-sm-d cdp-f-s-17 cdp-f-w-medium">(at this point nothing gets deleted)</small>', 'copy-delete-posts'); ?></button>
761
  </div>
762
  </div>
763
 
764
  <div class="cdp-padding-15-h">
765
  <div class="cdp-cf cdp-d-pad-sp cdp-not-yet-search" style="display: none; padding-bottom: 30px;">
766
  <div class="cdp-left cdp-f-s-19 cdp-f-w-bold" style="line-height: 41px;">
767
+ <?php _e('Scan has found [<span id="cdp-d-table-pagi-ilosc-wynikow" class="cdp-f-w-bold"></span>] duplicates', 'copy-delete-posts'); ?>
768
  </div>
769
  <div class="cdp-right">
770
  <input type="text" class="cdp-d-searchbox-c" name="cdp-d-searchbox" placeholder="Search...">
772
  <div class="cdp-right cdp-f-s-19" style="padding-right: 45px;">
773
  <div class="cdp-cf" style="line-height: 41px;">
774
  <div class="cdp-left">
775
+ <?php _e('Show', 'copy-delete-posts'); ?>
776
  </div>
777
  <select class="cdp-left cdp-select cdp-ow-border cdp-per-page-select-show cdp-width-166">
778
  <option value="5">5</option>
785
  <option value="100">100</option>
786
  </select>
787
  <div class="cdp-left">
788
+ <?php _e('per page', 'copy-delete-posts'); ?>
789
  </div>
790
  </div>
791
  </div>
797
  <thead>
798
  <tr class="cdp-f-s-19 cdp-f-w-medium">
799
  <th><label><input type="checkbox" class="cdp-d-checkbox-all"/></label></th>
800
+ <th><?php _e('Title', 'copy-delete-posts'); ?></th>
801
+ <th><?php _e('Slug/URL', 'copy-delete-posts'); ?></th>
802
+ <th><?php _e('Type', 'copy-delete-posts'); ?></th>
803
+ <th><?php _e('Date created', 'copy-delete-posts'); ?></th>
804
+ <th><?php _e('# of words', 'copy-delete-posts'); ?></th>
805
  </tr>
806
  </thead>
807
  <thead>
818
  <div class="cdp-d-pad-sp">
819
  <div class="cdp-cf cdp-not-yet-search" style="display: none;">
820
  <div class="cdp-d-sel-all-con cdp-left cdp-f-w-light cdp-f-s-17">
821
+ <?php _e('<u class="cdp-d-select-all cdp-f-w-light">Select all</u> (also from other pages)', 'copy-delete-posts'); ?>
822
  </div>
823
  <div class="cdp-center cdp-d-pagi-cent cdp-left">
824
  <div id="cdp-d-table-pagi" class="cdp-pagination"></div>
826
  </div>
827
  <div class="cdp-center cdp-p-10-h cdp-not-yet-search" style="display: none;">
828
  <div class="cdp-delete-info cdp-f-w-light cdp-f-s-19">
829
+ <?php _e('You selected <b class="cdp-t-d-ct cdp-f-w-light">0</b> pages/posts to be deleted', 'copy-delete-posts'); ?>
830
  </div>
831
  </div>
832
  <div class="cdp-p-10-h cdp-not-yet-search" style="display: none;">
833
  <div class="cdp-d-header-2 cdp-f-s-19 cdp-f-w-light">
834
+ <?php _e('Steps to deletion:', 'copy-delete-posts'); ?>
835
  </div>
836
  <div class="cdp-margin-left cdp-f-s-19">
837
  <div class="cdp-p-10-h">
838
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
839
  <div class="cdp-left cdp-blue-circle">1</div>
840
+ <div class="cdp-left">&nbsp;<?php _e('Make sure you created a backup with, e.g. with <a href="https://wordpress.org/plugins/wp-clone-by-wp-academy/" target="_blank">this plugin</a>.', 'copy-delete-posts'); ?></div>
841
  </div>
842
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
843
  <div class="cdp-left cdp-blue-circle">2</div>
844
+ <div class="cdp-left">&nbsp;<?php _e('Select all the posts & pages which should be deleted (by ticking the checkboxes in the table above).', 'copy-delete-posts'); ?></div>
845
  </div>
846
  <div class="cdp-cf cdp-low-margin-bot" style="line-height: 28px;">
847
  <div class="cdp-left cdp-blue-circle">3</div>
848
+ <div class="cdp-left">&nbsp;<?php _e('Check if you need these features (optional):', 'copy-delete-posts'); ?></div>
849
  </div>
850
  </div>
851
  <div class="cdp-margin-left-25 cdp-p-20-h cdp-nbp" style="padding-top: 0px">
852
  <table>
853
  <tbody>
854
  <tr>
855
+ <td class="cdp-vtop-pad"><?php _e('Automatic redirection', 'copy-delete-posts'); ?></td>
856
  <td>
857
  <div class="cdp-relative">
858
  <span class="cdp-tooltip-premium" style="padding: 25px 0;">
859
  <select class="cdp-p-redirections cdp-select cdp-ow-border cdp-dis-en-opt" name="cdp-redirections">
860
+ <option value="0"><?php _e('Disabled', 'copy-delete-posts'); ?></option>
861
+ <option value="1"><?php _e('Enabled', 'copy-delete-posts'); ?></option>
862
  </select>
863
  </span>
864
  <div class="cdp-premium-icon cdp-big-icon" style="margin-left: 17px;"></div>
865
  </div>
866
+ <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24"><?php _e('Enable this if you want to redirect the urls from your deleted posts/pages to the main one you decided to keep.', 'copy-delete-posts'); ?></div>
867
  </td>
868
  </tr>
869
  <tr>
870
+ <td class="cdp-vtop-pad"><?php _e('Deletion throttling', 'copy-delete-posts'); ?></td>
871
  <td>
872
  <div class="cdp-cf">
873
  <select class="cdp-left cdp-d-throttling cdp-select cdp-ow-border cdp-dis-en-opt" name="cdp-throttling">
874
+ <option value="0"><?php _e('Disabled', 'copy-delete-posts'); ?></option>
875
+ <option value="1"><?php _e('Enabled', 'copy-delete-posts'); ?></option>
876
  </select>
877
  <div class="cdp-left cdp-inline cdp-cf cdp-d-throttling-count-p" style="display: none; line-height: 41px;">
878
  <div class="cdp-left">
879
+ <span style="padding: 0px 15px;"><?php _e('Delete', 'copy-delete-posts'); ?></span>
880
  </div>
881
  <div class="cdp-left">
882
  <input type="number" class="cdp-d-throttling-count cdp-number-field-styled" name="cdp-throttling-count" min="1" max="10240" placeholder="50">
883
  </div>
884
  <div class="cdp-left">
885
+ <span style="padding: 0px 15px;"><?php _e('per minute', 'copy-delete-posts'); ?></span>
886
  </div>
887
  </div>
888
  </div>
889
  <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24">
890
+ <?php _e('Enable this if you want to have your posts/pages getting deleted in batches (instead of all at once).<br />This reduces the risk of timeouts if you have a lot to delete.<br />', 'copy-delete-posts'); ?>
891
  <span class="cdp-even-more-th-info" style="display: none">
892
+ <?php _e('If it’s necessary the process will dynamically slow down - depending on your server’s resource consumption. For example, if you’re using another plugin which is running a background process and it takes a lot of resources (+50%), our plugin will wait/slow down until the other process is complete.', 'copy-delete-posts'); ?>
893
  </span>
894
  </div>
895
  </td>
896
  </tr>
897
  <tr>
898
+ <td class="cdp-vtop-pad" style="padding-top: 4px"><?php _e('Move post(s) to trash?', 'copy-delete-posts'); ?></td>
899
  <td>
900
  <div class="">
901
  <span class="cdp-tooltip-premium" style="padding: 25px 0">
902
+ <label class="cdp-relative" style="padding-right: 25px;"><input type="checkbox" class="cdp-p-just-trash-them" /> <?php _e('Yes, keep deleted posts in trash!', 'copy-delete-posts'); ?> <span class="cdp-premium-icon cdp-big-icon"></span></label>
903
  </span>
904
+ <div class="cdp-d-tp-pad cdp-f-s-17 cdp-lh-24"><?php _e('Select this option to move deleted posts to trash (instead of deleting them permanently right away).', 'copy-delete-posts'); ?></div>
905
  </div>
906
  </td>
907
  </tr>
914
  <div class="cdp-not-yet-search" style="display: none;">
915
  <hr class="cdp-hr">
916
  <div class="cdp-center cdp-padding-15-h cdp-f-s-19">
917
+ <label><input type="checkbox" class="cdp-d-just-check-it"> <?php _e('I completed <u>all</u> steps, it’s ok!', 'copy-delete-posts'); ?></label>
918
  </div>
919
  <div class="cdp-center cdp-p-10-h">
920
+ <button type="button" class="cdp-button cdp-red-bg cdp-d-real-delete cdp-f-s-19" name="button"><?php _e('Delete selected pages/posts!', 'copy-delete-posts'); ?></button>
921
  </div>
922
  <div class="cdp-center cdp-padding-15-h cdp-f-s-19">
923
+ <?php _e('You will be notified when the deletion process ends via <span class="cdp-green">Admin Bar Menu</span>.', 'copy-delete-posts'); ?>
924
  </div>
925
  </div>
926
  <div class="cdp-padding cdp-f-s-17 cdp-center">
927
+ <a href="#" class="cdp-close-chapter"><?php _e('Close section', 'copy-delete-posts'); ?></a>
928
  </div>
929
  </div>
930
  </div>
941
  </div>
942
 
943
  <div class="cdp-f-s-20 cdp-p-hh cdp-center cdp-relative">
944
+ <?php _e('<b>Questions?</b> We\'re happy to help in the <a href="https://wordpress.org/support/plugin/copy-delete-posts/" target="_blank" style="text-decoration: none;">Support Forum</a>.', 'copy-delete-posts'); ?> <span class="cdp-info-icon cdp-tooltip-top" title="<?php _e('Your account on Wordpress.org (where you open a new support thread) is different to the one you login to your WordPress dashboard (where you are now). If you don\'t have a WordPress.org account yet, please sign up at the top right on here. It only takes a minute :) Thank you!', 'copy-delete-posts'); ?>"></span>
945
  </div>
946
 
947
  <jdiv class="label_e50 _bottom_ea7 notranslate" id="cdp_jvlabelWrap-fake" style="background: linear-gradient(95deg, rgb(47, 50, 74) 20%, rgb(66, 72, 103) 80%);right: 30px;bottom: 0px;width: 310px;">
965
  <?php
966
  }
967
  /** –– **/
 
 
menu/modal.php CHANGED
@@ -22,6 +22,9 @@ function cdp_modal($screen = '', $profiles = array()) {
22
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
23
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
24
  if (
 
 
 
25
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
26
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
27
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
@@ -42,17 +45,17 @@ function cdp_modal($screen = '', $profiles = array()) {
42
 
43
  <div class="cdp-cf cdp-cp-pad" style="margin-top: 50px; padding-top: 0; padding-bottom: 10px;">
44
  <div class="cdp-left">
45
- <h2 class="cdp-f-s-16 cdp-f-w-semi-bold" style="margin: 0; line-height: 40px;">Elements to copy:</h2>
46
  </div>
47
  <div class="cdp-right" style="width: calc(100% - 200px) !important; text-align: right !important;">
48
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
49
- <div class="cdp-left cdp-f-s-16">Use as basis settings</div>
50
  <?php $gepres = get_option('_cdp_preselections', array()); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
51
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
52
- <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled>–– Select ––</option>
53
- <option value="clear">Clean slate</option>
54
- <optgroup label="–– Profiles ––"></optgroup>
55
- <option value="custom_named" disabled>Custom</option>
56
  <?php
57
  if ($profiles != false && $areWePro) {
58
  foreach ($profiles as $profile => $vals):
@@ -60,7 +63,7 @@ function cdp_modal($screen = '', $profiles = array()) {
60
  ?>
61
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
62
  <?php endforeach; } else { ?>
63
- <option value="default">Default</option>
64
  <?php } ?>
65
  </select>
66
  </div>
@@ -71,101 +74,101 @@ function cdp_modal($screen = '', $profiles = array()) {
71
  <div class="cdp-modal-checkboxes cdp-checkboxes">
72
  <label>
73
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="title">
74
- <span>Title</span>
75
  </label>
76
  <label>
77
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="date">
78
- <span>Date</span>
79
  </label>
80
  <label>
81
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="status">
82
- <span>Status</span>
83
  </label>
84
  <label>
85
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="slug">
86
- <span>Slug</span>
87
  </label>
88
  </div>
89
  <div class="cdp-modal-checkboxes cdp-checkboxes">
90
  <label>
91
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="excerpt">
92
- <span>Excerpt</span>
93
  </label>
94
  <label>
95
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="content">
96
- <span>Content</span>
97
  </label>
98
  <label>
99
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="f_image">
100
- <span>Feat. image</span>
101
  </label>
102
  <label>
103
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="template">
104
- <span>Template</span>
105
  </label>
106
  </div>
107
  <div class="cdp-modal-checkboxes cdp-checkboxes">
108
  <label>
109
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="format">
110
- <span>Format</span>
111
  </label>
112
  <label>
113
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="author">
114
- <span>Author</span>
115
  </label>
116
  <label>
117
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="password">
118
- <span>Password</span>
119
  </label>
120
  <label>
121
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="children">
122
- <span>Children</span>
123
  </label>
124
  </div>
125
  <div class="cdp-modal-checkboxes cdp-checkboxes">
126
  <label>
127
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="comments">
128
- <span>Comments</span>
129
  </label>
130
  <label>
131
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="menu_order">
132
- <span>Menu order</span>
133
  </label>
134
  <label>
135
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="attachments">
136
- <span>Attachments</span>
137
  </label>
138
  <label>
139
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="category">
140
- <span>Categories</span>
141
  </label>
142
  </div>
143
  <div class="cdp-modal-checkboxes cdp-checkboxes">
144
  <label>
145
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="post_tag">
146
- <span>Tags</span>
147
  </label>
148
  <label>
149
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="taxonomy">
150
- <span>Taxonomies</span>
151
  </label>
152
  <label>
153
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="nav_menu">
154
- <span>Navigation Menus</span>
155
  </label>
156
  <label>
157
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="link_category">
158
- <span>Link categories</span>
159
  </label>
160
  </div>
161
  <?php if ($isYoast || $isUSM || $isWoo): ?>
162
  <div class="cdp-modal-checkboxes cdp-checkboxes cdp-modal-checkboxes-three">
163
- <label class="cdp-relative"><span class="cdp-premium-icon" style="margin-left: 0"></span><b style="padding-left: 21px;" class="cdp-f-s-15 cdp-f-w-medium">Plugin options:</b></label>
164
  <?php if ($isWoo): ?>
165
  <label class="cdp-woo">
166
  <div class="cdp-inline cdp-tooltip-premium-spc">
167
  <input class="cdp-input-dynamic" type="checkbox" name="woo">
168
- <span>Woo Settings</span>
169
  </div>
170
  </label>
171
  <?php endif; ?>
@@ -173,7 +176,7 @@ function cdp_modal($screen = '', $profiles = array()) {
173
  <label class="cdp-yoast">
174
  <div class="cdp-inline cdp-tooltip-premium-spc">
175
  <input class="cdp-input-dynamic" type="checkbox" name="yoast">
176
- <span>Yoast Settings</span>
177
  </div>
178
  </label>
179
  <?php endif; ?>
@@ -181,7 +184,15 @@ function cdp_modal($screen = '', $profiles = array()) {
181
  <label>
182
  <div class="cdp-inline cdp-tooltip-premium-spc">
183
  <input class="cdp-input-dynamic" type="checkbox" name="usmplugin">
184
- <span>USM Settings</span>
 
 
 
 
 
 
 
 
185
  </div>
186
  </label>
187
  <?php endif; ?>
@@ -193,18 +204,18 @@ function cdp_modal($screen = '', $profiles = array()) {
193
  <div class="cdp-modal-copy-times-content">
194
  <?php if ($areWePro && function_exists('cdpp_change_post_type')) cdpp_change_post_type(); ?>
195
  <div class="cdp-cf cdp-inline">
196
- <div class="cdp-left" style="line-height: 40px;">Copy&nbsp;</div>
197
  <div class="cdp-left" style="line-height: 40px;">
198
  <input class="cdp-modal-input-times cdp-input-border" style="border-width: 1px !important;" placeholder="1" type="number" value="1">
199
  </div>
200
  <div class="cdp-left" style="line-height: 40px;">
201
- &nbsp;time(s)
202
  </div>
203
  <div class="cdp-left" style="line-height: 40px;">&nbsp;to</div>
204
  <div class="cdp-left">
205
  <div class="cdp-inline cdp-tooltip-premium-spc-2 <?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
206
  <select class="cdp-input-dynamic cdp-modal-select cdp-modal-select-2 cdp-ow-border cdp-modal-input-site cdp-select cdp-m-l-9-d" name="tooltip-which-site-second" <?php echo $isMulti; ?>>
207
- <option value="-1">this site</option>
208
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
209
  </select>
210
  </div>
@@ -214,13 +225,13 @@ function cdp_modal($screen = '', $profiles = array()) {
214
  </div>
215
 
216
  <div class="cdp-center">
217
- <span class="cdp-error-span-tooltip">Making more than 50 copies will take some time. – depending on your server.</span>
218
  </div>
219
 
220
  <div class="cdp-center cdp-p-25-h">
221
- <button class="cdp-button cdp-copy-modal-button cdp-f-s-15 cdp-f-w-regular" data-cdp-btn="copy-custom" style="height:44px; width:211px;padding:0 20px;line-height: 44px;">Copy it!</button>
222
  <?php if (isset($globals) && array_key_exists('afterCopy', $globals) && $globals['afterCopy'] == '3'): ?>
223
- <button class="cdp-button cdp-copy-modal-button cdp-p-right-h cdp-f-s-15 cdp-f-w-regular" data-cdp-btn="copy-custom-link" style="height:44px; width:292px;padding:0 20px;line-height: 44px;margin-left: 15px !important;">Copy and jump to editing</button>
224
  <?php endif; ?>
225
  </div>
226
  </div>
22
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
23
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
24
  if (
25
+ is_plugin_active('USM-Premium/usm_premium_icons.php') ||
26
+ is_plugin_active('Ultimate-Social-Media-Plus/ultimate_social_media_icons.php') ||
27
+ is_plugin_active('Ultimate-Social-Media-Icons/ultimate_social_media_icons.php') ||
28
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
29
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
30
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
45
 
46
  <div class="cdp-cf cdp-cp-pad" style="margin-top: 50px; padding-top: 0; padding-bottom: 10px;">
47
  <div class="cdp-left">
48
+ <h2 class="cdp-f-s-16 cdp-f-w-semi-bold" style="margin: 0; line-height: 40px;"><?php _e('Elements to copy:', 'copy-delete-posts'); ?></h2>
49
  </div>
50
  <div class="cdp-right" style="width: calc(100% - 200px) !important; text-align: right !important;">
51
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
52
+ <div class="cdp-left cdp-f-s-16"><?php _e('Use as basis settings', 'copy-delete-posts'); ?></div>
53
  <?php $gepres = get_option('_cdp_preselections', array()); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
54
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
55
+ <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled><?php _e('–– Select ––', 'copy-delete-posts'); ?></option>
56
+ <option value="clear"><?php _e('Clean slate', 'copy-delete-posts'); ?></option>
57
+ <optgroup label="<?php _e('–– Profiles ––', 'copy-delete-posts'); ?>"></optgroup>
58
+ <option value="custom_named" disabled><?php _e('Custom', 'copy-delete-posts'); ?></option>
59
  <?php
60
  if ($profiles != false && $areWePro) {
61
  foreach ($profiles as $profile => $vals):
63
  ?>
64
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
65
  <?php endforeach; } else { ?>
66
+ <option value="default"><?php _e('Default', 'copy-delete-posts'); ?></option>
67
  <?php } ?>
68
  </select>
69
  </div>
74
  <div class="cdp-modal-checkboxes cdp-checkboxes">
75
  <label>
76
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="title">
77
+ <span><?php _e('Title', 'copy-delete-posts'); ?></span>
78
  </label>
79
  <label>
80
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="date">
81
+ <span><?php _e('Date', 'copy-delete-posts'); ?></span>
82
  </label>
83
  <label>
84
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="status">
85
+ <span><?php _e('Status', 'copy-delete-posts'); ?></span>
86
  </label>
87
  <label>
88
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="slug">
89
+ <span><?php _e('Slug', 'copy-delete-posts'); ?></span>
90
  </label>
91
  </div>
92
  <div class="cdp-modal-checkboxes cdp-checkboxes">
93
  <label>
94
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="excerpt">
95
+ <span><?php _e('Excerpt', 'copy-delete-posts'); ?></span>
96
  </label>
97
  <label>
98
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="content">
99
+ <span><?php _e('Content', 'copy-delete-posts'); ?></span>
100
  </label>
101
  <label>
102
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="f_image">
103
+ <span><?php _e('Feat. image', 'copy-delete-posts'); ?></span>
104
  </label>
105
  <label>
106
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="template">
107
+ <span><?php _e('Template', 'copy-delete-posts'); ?></span>
108
  </label>
109
  </div>
110
  <div class="cdp-modal-checkboxes cdp-checkboxes">
111
  <label>
112
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="format">
113
+ <span><?php _e('Format', 'copy-delete-posts'); ?></span>
114
  </label>
115
  <label>
116
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="author">
117
+ <span><?php _e('Author', 'copy-delete-posts'); ?></span>
118
  </label>
119
  <label>
120
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="password">
121
+ <span><?php _e('Password', 'copy-delete-posts'); ?></span>
122
  </label>
123
  <label>
124
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="children">
125
+ <span><?php _e('Children', 'copy-delete-posts'); ?></span>
126
  </label>
127
  </div>
128
  <div class="cdp-modal-checkboxes cdp-checkboxes">
129
  <label>
130
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="comments">
131
+ <span><?php _e('Comments', 'copy-delete-posts'); ?></span>
132
  </label>
133
  <label>
134
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="menu_order">
135
+ <span><?php _e('Menu order', 'copy-delete-posts'); ?></span>
136
  </label>
137
  <label>
138
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="attachments">
139
+ <span><?php _e('Attachments', 'copy-delete-posts'); ?></span>
140
  </label>
141
  <label>
142
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="category">
143
+ <span><?php _e('Categories', 'copy-delete-posts'); ?></span>
144
  </label>
145
  </div>
146
  <div class="cdp-modal-checkboxes cdp-checkboxes">
147
  <label>
148
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="post_tag">
149
+ <span><?php _e('Tags', 'copy-delete-posts'); ?></span>
150
  </label>
151
  <label>
152
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="taxonomy">
153
+ <span><?php _e('Taxonomies', 'copy-delete-posts'); ?></span>
154
  </label>
155
  <label>
156
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="nav_menu">
157
+ <span><?php _e('Navigation Menus', 'copy-delete-posts'); ?></span>
158
  </label>
159
  <label>
160
  <input class="cdp-modal-option-r cdp-input-dynamic" type="checkbox" name="link_category">
161
+ <span><?php _e('Link categories', 'copy-delete-posts'); ?></span>
162
  </label>
163
  </div>
164
  <?php if ($isYoast || $isUSM || $isWoo): ?>
165
  <div class="cdp-modal-checkboxes cdp-checkboxes cdp-modal-checkboxes-three">
166
+ <label class="cdp-relative"><span class="cdp-premium-icon" style="margin-left: 0"></span><b style="padding-left: 21px;" class="cdp-f-s-15 cdp-f-w-medium"><?php _e('Plugin options:', 'copy-delete-posts'); ?></b></label>
167
  <?php if ($isWoo): ?>
168
  <label class="cdp-woo">
169
  <div class="cdp-inline cdp-tooltip-premium-spc">
170
  <input class="cdp-input-dynamic" type="checkbox" name="woo">
171
+ <span><?php _e('Woo Settings', 'copy-delete-posts'); ?></span>
172
  </div>
173
  </label>
174
  <?php endif; ?>
176
  <label class="cdp-yoast">
177
  <div class="cdp-inline cdp-tooltip-premium-spc">
178
  <input class="cdp-input-dynamic" type="checkbox" name="yoast">
179
+ <span><?php _e('Yoast Settings', 'copy-delete-posts'); ?></span>
180
  </div>
181
  </label>
182
  <?php endif; ?>
184
  <label>
185
  <div class="cdp-inline cdp-tooltip-premium-spc">
186
  <input class="cdp-input-dynamic" type="checkbox" name="usmplugin">
187
+ <span><?php _e('USM Settings', 'copy-delete-posts'); ?></span>
188
+ </div>
189
+ </label>
190
+ <?php endif; ?>
191
+ <?php if (false): ?>
192
+ <label>
193
+ <div class="cdp-inline cdp-tooltip-premium-spc">
194
+ <input class="cdp-input-dynamic" type="checkbox" name="all_metadata">
195
+ <span><?php _e('Other Plugin Settings', 'copy-delete-posts'); ?></span>
196
  </div>
197
  </label>
198
  <?php endif; ?>
204
  <div class="cdp-modal-copy-times-content">
205
  <?php if ($areWePro && function_exists('cdpp_change_post_type')) cdpp_change_post_type(); ?>
206
  <div class="cdp-cf cdp-inline">
207
+ <div class="cdp-left" style="line-height: 40px;"><?php _e('Copy', 'copy-delete-posts'); ?>&nbsp;</div>
208
  <div class="cdp-left" style="line-height: 40px;">
209
  <input class="cdp-modal-input-times cdp-input-border" style="border-width: 1px !important;" placeholder="1" type="number" value="1">
210
  </div>
211
  <div class="cdp-left" style="line-height: 40px;">
212
+ &nbsp;<?php _e('time(s)', 'copy-delete-posts'); ?>
213
  </div>
214
  <div class="cdp-left" style="line-height: 40px;">&nbsp;to</div>
215
  <div class="cdp-left">
216
  <div class="cdp-inline cdp-tooltip-premium-spc-2 <?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
217
  <select class="cdp-input-dynamic cdp-modal-select cdp-modal-select-2 cdp-ow-border cdp-modal-input-site cdp-select cdp-m-l-9-d" name="tooltip-which-site-second" <?php echo $isMulti; ?>>
218
+ <option value="-1"><?php _e('this site', 'copy-delete-posts'); ?></option>
219
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
220
  </select>
221
  </div>
225
  </div>
226
 
227
  <div class="cdp-center">
228
+ <span class="cdp-error-span-tooltip"><?php _e('Making more than 50 copies will take some time. – depending on your server.', 'copy-delete-posts'); ?></span>
229
  </div>
230
 
231
  <div class="cdp-center cdp-p-25-h">
232
+ <button class="cdp-button cdp-copy-modal-button cdp-f-s-15 cdp-f-w-regular" data-cdp-btn="copy-custom" style="height:44px; width:211px;padding:0 20px;line-height: 44px;"><?php _e('Copy it!', 'copy-delete-posts'); ?></button>
233
  <?php if (isset($globals) && array_key_exists('afterCopy', $globals) && $globals['afterCopy'] == '3'): ?>
234
+ <button class="cdp-button cdp-copy-modal-button cdp-p-right-h cdp-f-s-15 cdp-f-w-regular" data-cdp-btn="copy-custom-link" style="height:44px; width:292px;padding:0 20px;line-height: 44px;margin-left: 15px !important;"><?php _e('Copy and jump to editing', 'copy-delete-posts'); ?></button>
235
  <?php endif; ?>
236
  </div>
237
  </div>
menu/notifications.php CHANGED
@@ -33,16 +33,16 @@ if (!defined('ABSPATH')) exit;
33
  if ($val['shown'] == false) $to_show++;
34
  }
35
  }
36
-
37
  $html = '<span class="cdp-admin-bar-icon-noti"></span>';
38
- $html .= 'Copy & Delete [<span class="cdp-notis-counter">' . $to_show . '</span>]';
39
  $html .= '<div class="ab-sub-wrapper cdp-ab-sub">
40
  <ul class="ab-submenu cdp-dropdown-submenu">';
41
 
42
  $html .= '<li class="cdp-undone-notis"' . ((sizeof($sorts['undone']) <= 0)?' style="display: none;"':'') . '>
43
  <a class="ab-item cdp-dropdown-menu">
44
  <div style="display: block;">
45
- <div class="cdp-dropdown-left-header">In progress:</div>
46
  </div>
47
  </a>
48
  </li>
@@ -52,8 +52,8 @@ if (!defined('ABSPATH')) exit;
52
  $red = (($current - $val['st']) >= 86400) ? true : false;
53
  $html .= '<a class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-ud' . (($val['s'] == false)?' cdp-bnew-notis':'') . '" data-token="' . $val['t'] . '">
54
  <div style="display: block; width: calc(100% - 3px);">
55
- <div class="cdp-dropdown-left' . (($red)?' cdp-red':'') . '">' . (($val['f'] == 'delete')?'Deleting Posts':'Auto Cleaning-up') . '</div>
56
- <div class="cdp-dropdown-right cdp-noti-kill-btn">Kill</div>
57
  </div>
58
  </a>';
59
  }
@@ -65,7 +65,7 @@ if (!defined('ABSPATH')) exit;
65
  $html .= '<li class="cdp-done-notis"' . ((sizeof($sorts['done']) <= 0)?' style="display: none;"':'') . '>
66
  <a class="ab-item cdp-dropdown-menu">
67
  <div style="display: block;">
68
- <div class="cdp-dropdown-left-header">Done:</div>
69
  </div>
70
  </a>
71
  </li>
@@ -83,8 +83,8 @@ if (!defined('ABSPATH')) exit;
83
 
84
  $html .= '<a ' . $ftext . $format . 'class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-d' . (($val['s'] == false)?' cdp-bnew-notis':'') . '" data-token="' . $val['t'] . '">
85
  <div style="display: block; width: calc(100% - 3px);">
86
- <div class="cdp-dropdown-left">' . (($val['f'] == 'delete')?'Deleted Posts':'Auto Cleaned-up') . '</div>
87
- <div class="cdp-dropdown-right cdp-noti-hide-btn">Hide</div>
88
  </div>
89
  </a>';
90
  }
@@ -92,7 +92,7 @@ if (!defined('ABSPATH')) exit;
92
  $html .= '</li>
93
  <hr class="cdp-dropdown-hr cdp-done-hr"'. ((sizeof($sorts['done']) <= 0)?' style="display: none;"':'') .'>';
94
 
95
- $html .= '<li><a class="ab-item cdp-dropdown-clear-all-notis" href="#">Clear notifiactions</a></li>
96
  </ul>
97
  </div>';
98
 
33
  if ($val['shown'] == false) $to_show++;
34
  }
35
  }
36
+
37
  $html = '<span class="cdp-admin-bar-icon-noti"></span>';
38
+ $html .= __('Copy & Delete', 'copy-delete-posts') . ' [<span class="cdp-notis-counter">' . $to_show . '</span>]';
39
  $html .= '<div class="ab-sub-wrapper cdp-ab-sub">
40
  <ul class="ab-submenu cdp-dropdown-submenu">';
41
 
42
  $html .= '<li class="cdp-undone-notis"' . ((sizeof($sorts['undone']) <= 0)?' style="display: none;"':'') . '>
43
  <a class="ab-item cdp-dropdown-menu">
44
  <div style="display: block;">
45
+ <div class="cdp-dropdown-left-header">'. __('In progress:', 'copy-delete-posts').'</div>
46
  </div>
47
  </a>
48
  </li>
52
  $red = (($current - $val['st']) >= 86400) ? true : false;
53
  $html .= '<a class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-ud' . (($val['s'] == false)?' cdp-bnew-notis':'') . '" data-token="' . $val['t'] . '">
54
  <div style="display: block; width: calc(100% - 3px);">
55
+ <div class="cdp-dropdown-left' . (($red)?' cdp-red':'') . '">' . (($val['f'] == 'delete')? __('Deleting Posts', 'copy-delete-posts'):__('Auto Cleaning-up', 'copy-delete-posts')) . '</div>
56
+ <div class="cdp-dropdown-right cdp-noti-kill-btn">' . __('Kill', 'copy-delete-posts') . '</div>
57
  </div>
58
  </a>';
59
  }
65
  $html .= '<li class="cdp-done-notis"' . ((sizeof($sorts['done']) <= 0)?' style="display: none;"':'') . '>
66
  <a class="ab-item cdp-dropdown-menu">
67
  <div style="display: block;">
68
+ <div class="cdp-dropdown-left-header">' . __('Done:', 'copy-delete-posts') . '</div>
69
  </div>
70
  </a>
71
  </li>
83
 
84
  $html .= '<a ' . $ftext . $format . 'class="ab-item cdp-dropdown-menu cdp-dd-item cdp-dd-d' . (($val['s'] == false)?' cdp-bnew-notis':'') . '" data-token="' . $val['t'] . '">
85
  <div style="display: block; width: calc(100% - 3px);">
86
+ <div class="cdp-dropdown-left">' . (($val['f'] == 'delete')?__('Deleted Posts', 'copy-delete-posts'):__('Auto Cleaned-up', 'copy-delete-posts')) . '</div>
87
+ <div class="cdp-dropdown-right cdp-noti-hide-btn">' . __('Hide', 'copy-delete-posts') . '</div>
88
  </div>
89
  </a>';
90
  }
92
  $html .= '</li>
93
  <hr class="cdp-dropdown-hr cdp-done-hr"'. ((sizeof($sorts['done']) <= 0)?' style="display: none;"':'') .'>';
94
 
95
+ $html .= '<li><a class="ab-item cdp-dropdown-clear-all-notis" href="#">' . __('Clear notifiactions', 'copy-delete-posts'). '</a></li>
96
  </ul>
97
  </div>';
98
 
menu/tooltips.php CHANGED
@@ -21,6 +21,9 @@ function cdp_tooltip_content($profiles = array()) {
21
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
22
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
23
  if (
 
 
 
24
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
25
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
26
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
@@ -40,7 +43,7 @@ function cdp_tooltip_content($profiles = array()) {
40
  <div class="cdp-tooltip-before-options cdp-checkboxes">
41
  <div class="cdp-tooltip-before">
42
 
43
- <div class="cdp-button cdp-tooltip-btn-copy cdp-low-round cdp-copy-now-btn-tooltip cdp-center" data-cdp-btn="copy-quick">Copy now!</div>
44
 
45
  <div class="cdp-modal-copy-times-tooltip">
46
  <div class="cdp-modal-copy-times-content-tooltip">
@@ -51,13 +54,13 @@ function cdp_tooltip_content($profiles = array()) {
51
  <input class="cdp-input-border cdp-input-dynamic cdp-number-field-styled cdp-modal-input-times-tooltip" style="width: 42px !important; padding: 0 1px;" value="1" placeholder="1" min="1" max="10000" type="number" name="tooltip-times-first">
52
  </div>
53
 
54
- <div class="cdp-left">&nbsp;time(s)</div>
55
 
56
  <div class="cdp-left">&nbsp;to&nbsp;</div>
57
  <div class="cdp-left" style="max-height: 32px;">
58
  <div class="cdp-inline cdp-tooltip-premium-spc-2 <?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
59
  <select<?php echo $isMulti; ?> class="cdp-input-dynamic cdp-tooltip-top cdp-premiu cdp-tooltip-select cdp-select cdp-sel-separat cdp-m-l-9-d" style="max-width: 98px !important" name="tooltip-which-site-first">
60
- <option value="-1">this site</option>
61
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
62
  </select>
63
  </div>
@@ -66,12 +69,12 @@ function cdp_tooltip_content($profiles = array()) {
66
  </div>
67
 
68
  <div class="cdp-cf" style="line-height: 32px; margin-top: 3px; margin-bottom: 5px;">
69
- <div class="cdp-left">Settings:&nbsp;&nbsp;</div>
70
 
71
  <div class="cdp-left" style="line-height: 10px;">
72
  <select class="cdp-input-dynamic cdp-select cdp-tooltip-select cdp-sel-separat cdp-m-l-9-d cdp-sizes-profile-tooltip" name="tooltip-which-profile-first">
73
  <?php $gepres = get_option('_cdp_preselections', array()); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
74
- <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled>–– Select ––</option>
75
  <?php
76
  if ($profiles != false && $areWePro) {
77
  foreach ($profiles as $profile => $vals):
@@ -79,7 +82,7 @@ function cdp_tooltip_content($profiles = array()) {
79
  ?>
80
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
81
  <?php endforeach; } else { ?>
82
- <option value="default">Default</option>
83
  <?php } ?>
84
  </select>
85
  </div>
@@ -93,11 +96,11 @@ function cdp_tooltip_content($profiles = array()) {
93
  </div>
94
 
95
  <div class="cdp-center cdp-f-s-12 cdp-padding-5-h">
96
- Or <span class="cdp-green cdp-pointer cdp-clickable cdp-tooltip-before-button">define it for this case</span>
97
  </div>
98
  <div class="cdp-center cdp-below-tooltip-before">
99
  <!-- Define the possible settings <span class="cdp-green">on the plugin page</span>.<br /> -->
100
- <span class="cdp-error-span-tooltip">Making more than 50 copies will take some time. – depending on your server.</span>
101
  </div>
102
  </div>
103
  </div>
@@ -105,16 +108,16 @@ function cdp_tooltip_content($profiles = array()) {
105
  <div class="cdp-tooltip-full-options cdp-checkboxes" style="display: none; min-height: 360px; min-width: 602px; padding: 10px;">
106
  <div class="cdp-cf">
107
  <div class="cdp-left">
108
- <h2 class="cdp-f-s-16 cdp-f-w-semi-bold" style="margin: 0; line-height: 40px;">Elements to copy:</h2>
109
  </div>
110
  <div class="cdp-right" style="width: calc(100% - 200px); text-align: right;">
111
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
112
- <div class="cdp-left cdp-f-s-16">Use as basis settings</div>
113
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
114
- <option value="custom" selected disabled>–– Select ––</option>
115
- <option value="clear">Clean slate</option>
116
- <optgroup label="–– Profiles ––"></optgroup>
117
- <option value="custom_named" disabled>Custom</option>
118
  <?php
119
  if ($profiles != false && $areWePro) {
120
  foreach ($profiles as $profile => $vals):
@@ -122,7 +125,7 @@ function cdp_tooltip_content($profiles = array()) {
122
  ?>
123
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
124
  <?php endforeach; } else { ?>
125
- <option value="default">Default</option>
126
  <?php } ?>
127
  </select>
128
  </div>
@@ -132,101 +135,101 @@ function cdp_tooltip_content($profiles = array()) {
132
  <div class="cdp-modal-checkboxes">
133
  <label>
134
  <input class="cdp-input-dynamic" type="checkbox" name="title">
135
- <span>Title</span>
136
  </label>
137
  <label>
138
  <input class="cdp-input-dynamic" type="checkbox" name="date">
139
- <span>Date</span>
140
  </label>
141
  <label>
142
  <input class="cdp-input-dynamic" type="checkbox" name="status">
143
- <span>Status</span>
144
  </label>
145
  <label>
146
  <input class="cdp-input-dynamic" type="checkbox" name="slug">
147
- <span>Slug</span>
148
  </label>
149
  </div>
150
  <div class="cdp-modal-checkboxes">
151
  <label>
152
  <input class="cdp-input-dynamic" type="checkbox" name="excerpt">
153
- <span>Excerpt</span>
154
  </label>
155
  <label>
156
  <input class="cdp-input-dynamic" type="checkbox" name="content">
157
- <span>Content</span>
158
  </label>
159
  <label>
160
  <input class="cdp-input-dynamic" type="checkbox" name="f_image">
161
- <span>Feat. image</span>
162
  </label>
163
  <label>
164
  <input class="cdp-input-dynamic" type="checkbox" name="template">
165
- <span>Template</span>
166
  </label>
167
  </div>
168
  <div class="cdp-modal-checkboxes">
169
  <label>
170
  <input class="cdp-input-dynamic" type="checkbox" name="format">
171
- <span>Format</span>
172
  </label>
173
  <label>
174
  <input class="cdp-input-dynamic" type="checkbox" name="author">
175
- <span>Author</span>
176
  </label>
177
  <label>
178
  <input class="cdp-input-dynamic" type="checkbox" name="password">
179
- <span>Password</span>
180
  </label>
181
  <label>
182
  <input class="cdp-input-dynamic" type="checkbox" name="children">
183
- <span>Children</span>
184
  </label>
185
  </div>
186
  <div class="cdp-modal-checkboxes">
187
  <label>
188
  <input class="cdp-input-dynamic" type="checkbox" name="comments">
189
- <span>Comments</span>
190
  </label>
191
  <label>
192
  <input class="cdp-input-dynamic" type="checkbox" name="menu_order">
193
- <span>Menu order</span>
194
  </label>
195
  <label>
196
  <input class="cdp-input-dynamic" type="checkbox" name="attachments">
197
- <span>Attachments</span>
198
  </label>
199
  <label>
200
  <input class="cdp-input-dynamic" type="checkbox" name="category">
201
- <span>Categories</span>
202
  </label>
203
  </div>
204
  <div class="cdp-modal-checkboxes">
205
  <label>
206
  <input class="cdp-input-dynamic" type="checkbox" name="post_tag">
207
- <span>Tags</span>
208
  </label>
209
  <label>
210
  <input class="cdp-input-dynamic" type="checkbox" name="taxonomy">
211
- <span>Taxonomies</span>
212
  </label>
213
  <label>
214
  <input class="cdp-input-dynamic" type="checkbox" name="nav_menu">
215
- <span>Nav Menus</span>
216
  </label>
217
  <label>
218
  <input class="cdp-input-dynamic" type="checkbox" name="link_category">
219
- <span>Link cats</span>
220
  </label>
221
  </div>
222
  <?php if ($isYoast || $isUSM || $isWoo): ?>
223
  <div class="cdp-modal-checkboxes cdp-modal-checkboxes-three">
224
- <label class="cdp-relative"><span class="cdp-premium-icon" style="margin-left: 0"></span><b style="padding-left: 21px;" class="cdp-f-s-15 cdp-f-w-medium">Plugin options:</b></label>
225
  <?php if ($isWoo): ?>
226
  <label class="cdp-woo">
227
  <div class="cdp-inline cdp-tooltip-premium-spc">
228
  <input class="cdp-input-dynamic" type="checkbox" name="woo">
229
- <span>Woo Settings</span>
230
  </div>
231
  </label>
232
  <?php endif; ?>
@@ -234,7 +237,7 @@ function cdp_tooltip_content($profiles = array()) {
234
  <label class="cdp-yoast">
235
  <div class="cdp-inline cdp-tooltip-premium-spc">
236
  <input class="cdp-input-dynamic" type="checkbox" name="yoast">
237
- <span>Yoast Settings</span>
238
  </div>
239
  </label>
240
  <?php endif; ?>
@@ -242,7 +245,15 @@ function cdp_tooltip_content($profiles = array()) {
242
  <label>
243
  <div class="cdp-inline cdp-tooltip-premium-spc">
244
  <input class="cdp-input-dynamic" type="checkbox" name="usmplugin">
245
- <span>USM Settings</span>
 
 
 
 
 
 
 
 
246
  </div>
247
  </label>
248
  <?php endif; ?>
@@ -254,18 +265,18 @@ function cdp_tooltip_content($profiles = array()) {
254
  <div class="cdp-modal-copy-times-content">
255
  <?php if ($areWePro && function_exists('cdpp_change_post_type')) cdpp_change_post_type(); ?>
256
  <div class="cdp-cf cdp-inline">
257
- <div class="cdp-left" style="line-height: 40px;">Copy&nbsp;</div>
258
  <div class="cdp-left" style="line-height: 40px;">
259
  <input class="cdp-modal-input-times cdp-input-border" name="tooltip-which-times-second" style="border-width: 1px !important;" placeholder="1" type="number" value="1">
260
  </div>
261
  <div class="cdp-left" style="line-height: 40px;">
262
- &nbsp;time(s)
263
  </div>
264
- <div class="cdp-left" style="line-height: 40px;">&nbsp;to</div>
265
  <div class="cdp-left">
266
  <div class="cdp-tooltip-premium-spc-2 cdp-inline<?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
267
  <select<?php echo $isMulti; ?> class="cdp-input-dynamic cdp-modal-select cdp-modal-select-2 cdp-ow-border cdp-modal-input-site cdp-select cdp-m-l-9-d" name="tooltip-which-site-second">
268
- <option value="-1">this site</option>
269
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
270
  </select>
271
  </div>
@@ -276,13 +287,13 @@ function cdp_tooltip_content($profiles = array()) {
276
  </div>
277
 
278
  <div class="cdp-center">
279
- <span class="cdp-error-span-tooltip">Making more than 50 copies will take some time. – depending on your server.</span>
280
  </div>
281
 
282
  <div class="cdp-center cdp-padding" style="min-width: 420px; padding-bottom: 10px;">
283
- <button class="cdp-button cdp-tooltip-btn-copy cdp-f-s-15 cdp-f-s-regular" data-cdp-btn="copy-custom" style="height:44px; width:211px;padding:0 20px;line-height: 44px;border-radius: 3px;">Copy it!</button>
284
  <?php if (isset($globals) && array_key_exists('afterCopy', $globals) && $globals['afterCopy'] == '3'): ?>
285
- <button class="cdp-button cdp-tooltip-btn-copy cdp-f-s-15 cdp-f-s-regular" data-cdp-btn="copy-custom-link" style="height:44px; width:292px;padding:0 20px;line-height: 44px;border-radius: 3px;margin-left: 15px !important;">Copy and jump to editing</button>
286
  <?php endif; ?>
287
  </div>
288
 
21
  if (is_plugin_active('woocommerce/woocommerce.php')) $isWoo = true;
22
  if (is_plugin_active('wordpress-seo/wp-seo.php') || is_plugin_active('wordpress-seo-premium/wp-seo-premium.php')) $isYoast = true;
23
  if (
24
+ is_plugin_active('USM-Premium/usm_premium_icons.php') ||
25
+ is_plugin_active('Ultimate-Social-Media-Plus/ultimate_social_media_icons.php') ||
26
+ is_plugin_active('Ultimate-Social-Media-Icons/ultimate_social_media_icons.php') ||
27
  is_plugin_active('Ultimate-Premium-Plugin/usm_premium_icons.php') ||
28
  is_plugin_active('ultimate-social-media-icons/ultimate_social_media_icons.php') ||
29
  is_plugin_active('ultimate-social-media-plus/ultimate-social-media-plus.php') ||
43
  <div class="cdp-tooltip-before-options cdp-checkboxes">
44
  <div class="cdp-tooltip-before">
45
 
46
+ <div class="cdp-button cdp-tooltip-btn-copy cdp-low-round cdp-copy-now-btn-tooltip cdp-center" data-cdp-btn="copy-quick"><?php _e('Copy now!', 'copy-delete-posts'); ?></div>
47
 
48
  <div class="cdp-modal-copy-times-tooltip">
49
  <div class="cdp-modal-copy-times-content-tooltip">
54
  <input class="cdp-input-border cdp-input-dynamic cdp-number-field-styled cdp-modal-input-times-tooltip" style="width: 42px !important; padding: 0 1px;" value="1" placeholder="1" min="1" max="10000" type="number" name="tooltip-times-first">
55
  </div>
56
 
57
+ <div class="cdp-left">&nbsp;<?php _e('time(s)', 'copy-delete-posts'); ?></div>
58
 
59
  <div class="cdp-left">&nbsp;to&nbsp;</div>
60
  <div class="cdp-left" style="max-height: 32px;">
61
  <div class="cdp-inline cdp-tooltip-premium-spc-2 <?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
62
  <select<?php echo $isMulti; ?> class="cdp-input-dynamic cdp-tooltip-top cdp-premiu cdp-tooltip-select cdp-select cdp-sel-separat cdp-m-l-9-d" style="max-width: 98px !important" name="tooltip-which-site-first">
63
+ <option value="-1"><?php _e('this site', 'copy-delete-posts'); ?></option>
64
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
65
  </select>
66
  </div>
69
  </div>
70
 
71
  <div class="cdp-cf" style="line-height: 32px; margin-top: 3px; margin-bottom: 5px;">
72
+ <div class="cdp-left"><?php _e('Settings:', 'copy-delete-posts'); ?>&nbsp;&nbsp;</div>
73
 
74
  <div class="cdp-left" style="line-height: 10px;">
75
  <select class="cdp-input-dynamic cdp-select cdp-tooltip-select cdp-sel-separat cdp-m-l-9-d cdp-sizes-profile-tooltip" name="tooltip-which-profile-first">
76
  <?php $gepres = get_option('_cdp_preselections', array()); if (array_key_exists(get_current_user_id(), $gepres)) $preSelProf = $gepres[get_current_user_id()]; else $preSelProf = 0; ?>
77
+ <option value="custom"<?php echo (array_key_exists($preSelProf, $profiles) && !$profiles[$preSelProf])?' selected':''?> disabled><?php _e('–– Select ––', 'copy-delete-posts'); ?></option>
78
  <?php
79
  if ($profiles != false && $areWePro) {
80
  foreach ($profiles as $profile => $vals):
82
  ?>
83
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
84
  <?php endforeach; } else { ?>
85
+ <option value="default"><?php _e('Default', 'copy-delete-posts'); ?></option>
86
  <?php } ?>
87
  </select>
88
  </div>
96
  </div>
97
 
98
  <div class="cdp-center cdp-f-s-12 cdp-padding-5-h">
99
+ Or <span class="cdp-green cdp-pointer cdp-clickable cdp-tooltip-before-button"><?php _e('define it for this case', 'copy-delete-posts'); ?></span>
100
  </div>
101
  <div class="cdp-center cdp-below-tooltip-before">
102
  <!-- Define the possible settings <span class="cdp-green">on the plugin page</span>.<br /> -->
103
+ <span class="cdp-error-span-tooltip"><?php _e('Making more than 50 copies will take some time. – depending on your server.', 'copy-delete-posts'); ?></span>
104
  </div>
105
  </div>
106
  </div>
108
  <div class="cdp-tooltip-full-options cdp-checkboxes" style="display: none; min-height: 360px; min-width: 602px; padding: 10px;">
109
  <div class="cdp-cf">
110
  <div class="cdp-left">
111
+ <h2 class="cdp-f-s-16 cdp-f-w-semi-bold" style="margin: 0; line-height: 40px;"><?php _e('Elements to copy:', 'copy-delete-posts'); ?></h2>
112
  </div>
113
  <div class="cdp-right" style="width: calc(100% - 200px); text-align: right;">
114
  <div class="cdp-cf cdp-inline" style="line-height: 40px">
115
+ <div class="cdp-left cdp-f-s-16"><?php _e('Use as basis settings', 'copy-delete-posts'); ?></div>
116
  <select class="cdp-left cdp-modal-select cdp-ow-border cdp-input-dynamic cdp-modal-input-profiles-r cdp-select cdp-m-l-9-d" name="tooltip-which-profile-second">
117
+ <option value="custom" selected disabled><?php _e('–– Select ––', 'copy-delete-posts'); ?></option>
118
+ <option value="clear"><?php _e('Clean slate', 'copy-delete-posts'); ?></option>
119
+ <optgroup label="<?php _e('–– Profiles ––', 'copy-delete-posts'); ?>"></optgroup>
120
+ <option value="custom_named" disabled><?php _e('Custom', 'copy-delete-posts'); ?></option>
121
  <?php
122
  if ($profiles != false && $areWePro) {
123
  foreach ($profiles as $profile => $vals):
125
  ?>
126
  <option value="<?php echo htmlspecialchars($profile); ?>"<?php echo ($isSel)?' selected':''?>><?php echo ucfirst(htmlspecialchars($vals['names']['display'])); ?></option>
127
  <?php endforeach; } else { ?>
128
+ <option value="default"><?php _e('Default', 'copy-delete-posts'); ?></option>
129
  <?php } ?>
130
  </select>
131
  </div>
135
  <div class="cdp-modal-checkboxes">
136
  <label>
137
  <input class="cdp-input-dynamic" type="checkbox" name="title">
138
+ <span><?php _e('Title', 'copy-delete-posts'); ?></span>
139
  </label>
140
  <label>
141
  <input class="cdp-input-dynamic" type="checkbox" name="date">
142
+ <span><?php _e('Date', 'copy-delete-posts'); ?></span>
143
  </label>
144
  <label>
145
  <input class="cdp-input-dynamic" type="checkbox" name="status">
146
+ <span><?php _e('Status', 'copy-delete-posts'); ?></span>
147
  </label>
148
  <label>
149
  <input class="cdp-input-dynamic" type="checkbox" name="slug">
150
+ <span><?php _e('Slug', 'copy-delete-posts'); ?></span>
151
  </label>
152
  </div>
153
  <div class="cdp-modal-checkboxes">
154
  <label>
155
  <input class="cdp-input-dynamic" type="checkbox" name="excerpt">
156
+ <span><?php _e('Excerpt', 'copy-delete-posts'); ?></span>
157
  </label>
158
  <label>
159
  <input class="cdp-input-dynamic" type="checkbox" name="content">
160
+ <span><?php _e('Content', 'copy-delete-posts'); ?></span>
161
  </label>
162
  <label>
163
  <input class="cdp-input-dynamic" type="checkbox" name="f_image">
164
+ <span><?php _e('Feat. image', 'copy-delete-posts'); ?></span>
165
  </label>
166
  <label>
167
  <input class="cdp-input-dynamic" type="checkbox" name="template">
168
+ <span><?php _e('Template', 'copy-delete-posts'); ?></span>
169
  </label>
170
  </div>
171
  <div class="cdp-modal-checkboxes">
172
  <label>
173
  <input class="cdp-input-dynamic" type="checkbox" name="format">
174
+ <span><?php _e('Format', 'copy-delete-posts'); ?></span>
175
  </label>
176
  <label>
177
  <input class="cdp-input-dynamic" type="checkbox" name="author">
178
+ <span><?php _e('Author', 'copy-delete-posts'); ?></span>
179
  </label>
180
  <label>
181
  <input class="cdp-input-dynamic" type="checkbox" name="password">
182
+ <span><?php _e('Password', 'copy-delete-posts'); ?></span>
183
  </label>
184
  <label>
185
  <input class="cdp-input-dynamic" type="checkbox" name="children">
186
+ <span><?php _e('Children', 'copy-delete-posts'); ?></span>
187
  </label>
188
  </div>
189
  <div class="cdp-modal-checkboxes">
190
  <label>
191
  <input class="cdp-input-dynamic" type="checkbox" name="comments">
192
+ <span><?php _e('Comments', 'copy-delete-posts'); ?></span>
193
  </label>
194
  <label>
195
  <input class="cdp-input-dynamic" type="checkbox" name="menu_order">
196
+ <span><?php _e('Menu order', 'copy-delete-posts'); ?></span>
197
  </label>
198
  <label>
199
  <input class="cdp-input-dynamic" type="checkbox" name="attachments">
200
+ <span><?php _e('Attachments', 'copy-delete-posts'); ?></span>
201
  </label>
202
  <label>
203
  <input class="cdp-input-dynamic" type="checkbox" name="category">
204
+ <span><?php _e('Categories', 'copy-delete-posts'); ?></span>
205
  </label>
206
  </div>
207
  <div class="cdp-modal-checkboxes">
208
  <label>
209
  <input class="cdp-input-dynamic" type="checkbox" name="post_tag">
210
+ <span><?php _e('Tags', 'copy-delete-posts'); ?></span>
211
  </label>
212
  <label>
213
  <input class="cdp-input-dynamic" type="checkbox" name="taxonomy">
214
+ <span><?php _e('Taxonomies', 'copy-delete-posts'); ?></span>
215
  </label>
216
  <label>
217
  <input class="cdp-input-dynamic" type="checkbox" name="nav_menu">
218
+ <span><?php _e('Nav Menus', 'copy-delete-posts'); ?></span>
219
  </label>
220
  <label>
221
  <input class="cdp-input-dynamic" type="checkbox" name="link_category">
222
+ <span><?php _e('Link cats', 'copy-delete-posts'); ?></span>
223
  </label>
224
  </div>
225
  <?php if ($isYoast || $isUSM || $isWoo): ?>
226
  <div class="cdp-modal-checkboxes cdp-modal-checkboxes-three">
227
+ <label class="cdp-relative"><span class="cdp-premium-icon" style="margin-left: 0"></span><b style="padding-left: 21px;" class="cdp-f-s-15 cdp-f-w-medium"><?php _e('Plugin options:', 'copy-delete-posts'); ?></b></label>
228
  <?php if ($isWoo): ?>
229
  <label class="cdp-woo">
230
  <div class="cdp-inline cdp-tooltip-premium-spc">
231
  <input class="cdp-input-dynamic" type="checkbox" name="woo">
232
+ <span><?php _e('Woo Settings', 'copy-delete-posts'); ?></span>
233
  </div>
234
  </label>
235
  <?php endif; ?>
237
  <label class="cdp-yoast">
238
  <div class="cdp-inline cdp-tooltip-premium-spc">
239
  <input class="cdp-input-dynamic" type="checkbox" name="yoast">
240
+ <span><?php _e('Yoast Settings', 'copy-delete-posts'); ?></span>
241
  </div>
242
  </label>
243
  <?php endif; ?>
245
  <label>
246
  <div class="cdp-inline cdp-tooltip-premium-spc">
247
  <input class="cdp-input-dynamic" type="checkbox" name="usmplugin">
248
+ <span><?php _e('USM Settings', 'copy-delete-posts'); ?></span>
249
+ </div>
250
+ </label>
251
+ <?php endif; ?>
252
+ <?php if (false): ?>
253
+ <label>
254
+ <div class="cdp-inline cdp-tooltip-premium-spc">
255
+ <input class="cdp-input-dynamic" type="checkbox" name="all_metadata">
256
+ <span><?php _e('Other Plugin Settings', 'copy-delete-posts'); ?></span>
257
  </div>
258
  </label>
259
  <?php endif; ?>
265
  <div class="cdp-modal-copy-times-content">
266
  <?php if ($areWePro && function_exists('cdpp_change_post_type')) cdpp_change_post_type(); ?>
267
  <div class="cdp-cf cdp-inline">
268
+ <div class="cdp-left" style="line-height: 40px;"><?php _e('Copy', 'copy-delete-posts'); ?>&nbsp;</div>
269
  <div class="cdp-left" style="line-height: 40px;">
270
  <input class="cdp-modal-input-times cdp-input-border" name="tooltip-which-times-second" style="border-width: 1px !important;" placeholder="1" type="number" value="1">
271
  </div>
272
  <div class="cdp-left" style="line-height: 40px;">
273
+ &nbsp;<?php _e('time(s)', 'copy-delete-posts'); ?>
274
  </div>
275
+ <div class="cdp-left" style="line-height: 40px;">&nbsp;<?php _e('to', 'copy-delete-posts'); ?></div>
276
  <div class="cdp-left">
277
  <div class="cdp-tooltip-premium-spc-2 cdp-inline<?php echo (($isMulti != '')?' cdp-tooltip-premium-spc-3':' cdp-tooltip-premium-spc-4'); ?>">
278
  <select<?php echo $isMulti; ?> class="cdp-input-dynamic cdp-modal-select cdp-modal-select-2 cdp-ow-border cdp-modal-input-site cdp-select cdp-m-l-9-d" name="tooltip-which-site-second">
279
+ <option value="-1"><?php _e('this site', 'copy-delete-posts'); ?></option>
280
  <?php if ($areWePro && function_exists('cdpp_get_sites')) echo cdpp_get_sites(true); ?>
281
  </select>
282
  </div>
287
  </div>
288
 
289
  <div class="cdp-center">
290
+ <span class="cdp-error-span-tooltip"><?php _e('Making more than 50 copies will take some time. – depending on your server.', 'copy-delete-posts'); ?></span>
291
  </div>
292
 
293
  <div class="cdp-center cdp-padding" style="min-width: 420px; padding-bottom: 10px;">
294
+ <button class="cdp-button cdp-tooltip-btn-copy cdp-f-s-15 cdp-f-s-regular" data-cdp-btn="copy-custom" style="height:44px; width:211px;padding:0 20px;line-height: 44px;border-radius: 3px;"><?php _e('Copy it!', 'copy-delete-posts'); ?></button>
295
  <?php if (isset($globals) && array_key_exists('afterCopy', $globals) && $globals['afterCopy'] == '3'): ?>
296
+ <button class="cdp-button cdp-tooltip-btn-copy cdp-f-s-15 cdp-f-s-regular" data-cdp-btn="copy-custom-link" style="height:44px; width:292px;padding:0 20px;line-height: 44px;border-radius: 3px;margin-left: 15px !important;"><?php _e('Copy and jump to editing', 'copy-delete-posts'); ?></button>
297
  <?php endif; ?>
298
  </div>
299
 
menu/variables.php CHANGED
@@ -22,16 +22,16 @@ function cdp_vars($hideTT = false, $cdp_plug_url = 'x', $post_id = false, $paren
22
  if (typeof ajaxurl === 'undefined') ajaxurl = '<?php echo esc_url(admin_url('admin-ajax.php')); ?>';
23
  </script>
24
  <div class="cdp-copy-alert-success" style="top: -28px; opacity: 0; display: none;">
25
- <img src="<?php echo $cdp_plug_url ?>/assets/imgs/copy.png" alt="Successfull copy image">
26
  </div>
27
  <div class="cdp-copy-loader-overlay" style="opacity: 0">
28
  <div class="cdp-text-overlay">
29
- <h1 style="color: white; font-size: 25px;">Please wait, copying in progress...</h1>
30
  <p>
31
- If you’re making a lot of copies it can take a while
32
- <br>(up to 5 minutes if you’re on a slow server).
33
  </p>
34
- <span>Average time is 8 copies per second.</span>
35
  </div>
36
  <div class="cdp-spinner"></div>
37
  </div>
22
  if (typeof ajaxurl === 'undefined') ajaxurl = '<?php echo esc_url(admin_url('admin-ajax.php')); ?>';
23
  </script>
24
  <div class="cdp-copy-alert-success" style="top: -28px; opacity: 0; display: none;">
25
+ <img src="<?php echo $cdp_plug_url ?>/assets/imgs/copy.png" alt="<?php _e('Successfull copy image', 'copy-delete-posts'); ?>">
26
  </div>
27
  <div class="cdp-copy-loader-overlay" style="opacity: 0">
28
  <div class="cdp-text-overlay">
29
+ <h1 style="color: white; font-size: 25px;"><?php _e('Please wait, copying in progress...', 'copy-delete-posts'); ?></h1>
30
  <p>
31
+ <?php _e('If you’re making a lot of copies it can take a while
32
+ <br>(up to 5 minutes if you’re on a slow server).', 'copy-delete-posts'); ?>
33
  </p>
34
+ <span><?php _e('Average time is 8 copies per second.', 'copy-delete-posts'); ?></span>
35
  </div>
36
  <div class="cdp-spinner"></div>
37
  </div>
post/handler.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
  /**
3
  * Copy & Delete Posts – Post requests handler file.
4
  *
@@ -7,94 +8,130 @@
7
  * @author CopyDeletePosts
8
  * @since 1.0.0
9
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
10
-
11
  /** –– **\
12
  * Main handler + It will also sanitize and verify that request a little bit.
13
  * @since 1.0.0
14
  */
15
- add_action('wp_ajax_cdp_action_handling', function () {
16
  if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
17
- if (isset($_POST['token']) && $_POST['token'] == 'cdp' && isset($_POST['f']) && is_admin()) {
18
-
19
- // Expand execution time
20
- if (intval(ini_get('max_execution_time')) < 7200) set_time_limit(0);
21
-
22
- // Get WP-Plugin path
23
- $premium_plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
24
- $premium_dir = WP_PLUGIN_DIR . '/' . 'copy-delete-posts-premium';
25
- $pplugin_path = $premium_dir . '/handler/premium.php';
26
-
27
- // Load premium content if the plugin is here
28
- if (is_dir($premium_dir) && is_plugin_active($premium_plugin))
29
- require_once($pplugin_path);
30
-
31
- // Is premium function
32
- $areWePro = is_plugin_active($premium_plugin);
33
-
34
- // Get user roles and check if the role is permmited to use plugin
35
- $access = false;
36
- $current_user = wp_get_current_user();
37
- $access_roles = get_option('_cdp_globals');
38
- if (!isset($access_roles['roles'])) $access_roles = array();
39
- foreach ($current_user->roles as $role => $name)
40
- if ($name == 'administrator' || (isset($access_roles['roles'][$name]) && $access_roles['roles'][$name] == 'true')) {
41
- $access = true;
42
- break;
43
- }
44
-
45
- // Check user permission
46
- if ($access === true) {
47
-
48
- // Pointers
49
- if ($_POST['f'] == 'no_intro') cdp_add_new_no_intro();
50
- else if ($_POST['f'] == 'intro_again') cdp_add_new_intro();
51
- else if ($_POST['f'] == 'save_options') cdp_save_plugin_options($areWePro);
52
- else if ($_POST['f'] == 'copy_post') cdp_insert_new_post($areWePro);
53
- else if ($_POST['f'] == 'get_settings') cdp_get_profile();
54
- else if ($_POST['f'] == 'get_all_settings') cdp_get_all_profiles();
55
- else if ($_POST['f'] == 'save_profiles' && $areWePro) cdp_save_profile_set();
56
- else if ($_POST['f'] == 'get_all_posts') cdp_get_all_posts();
57
- else if ($_POST['f'] == 'delete_them') cdp_delete_posts();
58
- else if ($_POST['f'] == 'get_formatted_time' && $areWePro) cdp_formatted_time();
59
- else if ($_POST['f'] == 'set_default_profile') cdp_set_default_profile();
60
- else if ($_POST['f'] == 'get_default_profile') cdp_get_default_profile();
61
- else if ($_POST['f'] == 'clear_crons') cdp_clear_all_crons();
62
- else if ($_POST['f'] == 'i_saw_this_noti') cdp_set_noti_as_seen();
63
- else if ($_POST['f'] == 'try_to_hide_the_tasks') cdp_just_hide_task();
64
- else if ($_POST['f'] == 'try_to_kill_the_tasks') cdp_just_kill_task();
65
- else if ($_POST['f'] == 'give_me_current_tasks') cdp_just_get_tasks();
66
- else if ($_POST['f'] == 'review_dismiss') cdp_review();
67
- else if ($_POST['f'] == 'debug_function') cdp_debug_function();
68
- else if ($_POST['f'] == 'delete_success_img') delete_option('_cdp_show_copy');
69
- else if ($_POST['f'] == 'save_redi_state' && $areWePro) cdpp_save_redi_state();
70
- else if ($_POST['f'] == 'multi_redi_importer' && $areWePro) cdpp_redis_importer();
71
- else if ($_POST['f'] == 'save_redirections' && $areWePro) cdpp_save_redirections();
72
- else if ($_POST['f'] == 'delete_redirect' && $areWePro) cdpp_delete_redirection();
73
- else if ($_POST['f'] == 'switch_redirects' && $areWePro) cdpp_switch_redirects();
74
- else if ($_POST['f'] == 'get_authors' && $areWePro) cdpp_get_authors();
75
- else if ($_POST['f'] == 'get_curr_time' && $areWePro) cdpp_get_curr_s_time();
76
- else if ($_POST['f'] == 'get_post_export' && $areWePro) cdpp_get_for_export();
77
- else if ($_POST['f'] == 'import_posts' && $areWePro) cdpp_take_for_import();
78
- else if ($_POST['f'] == 'save_aci' && $areWePro) cdpp_save_cleanup_settings();
79
- else if ($_POST['f'] == 'get_aci' && $areWePro) cdpp_get_cleanup_settings();
80
- else if ($_POST['f'] == 'turn_off_aci' && $areWePro) cdpp_turn_the_acii_off();
81
- else if ($_POST['f'] == 'i_love_squirrels' && $areWePro) cdpp_squirrel();
82
- else echo 'error';
83
-
84
- } else echo 'error';
85
-
86
- } else echo 'no_access';
87
- } else echo 'no_access';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
88
 
89
  wp_die();
90
- });
91
- /** –– **/
92
 
93
  /** –– **\
94
  * This function will be fired when user don't want to see intro – never again.
95
  * @since 1.0.6
96
  */
97
- function cdp_review() {
98
 
99
  // Option
100
  $method = sanitize_text_field($_POST['decision']);
@@ -104,26 +141,27 @@
104
  $already = get_option('_cdp_review', false);
105
 
106
  // Create if not exists
107
- if ($already == false) $already = array('installed' => time(), 'users' => array());
 
108
 
109
  // Set dismiss
110
  $already['users'][$user_id] = array();
111
- $already['users'][$user_id]['dismiss'] = (($method == 'remind')?time():true);
112
 
113
  // Add option to datbase if not exit.
114
  $opt = update_option('_cdp_review', $already);
115
 
116
  // Return success
117
  echo json_encode(array('status' => 'success'));
 
118
 
119
- }
120
- /** –– **/
121
 
122
  /** –– **\
123
  * This function will be fired when user don't want to see intro – never again.
124
  * @since 1.0.0
125
  */
126
- function cdp_add_new_no_intro() {
127
 
128
  // Get user id and array from db
129
  $user_id = get_current_user_id();
@@ -131,26 +169,27 @@
131
 
132
  // Check if it's first time that user checked this option.
133
  if (!$already)
134
- $already = array($user_id);
135
 
136
  // If it already exists just add another user.
137
  else if (!in_array($user_id, $already))
138
- array_push($already, $user_id);
139
 
140
  // If the user already exists exit.
141
- else exit;
 
142
 
143
  // Add option to datbase if not exit.
144
  $opt = update_option('_cdp_no_intro', $already);
 
145
 
146
- }
147
- /** –– **/
148
 
149
  /** –– **\
150
  * This function will be fired when user want to see intro – again.
151
  * @since 1.0.0
152
  */
153
- function cdp_add_new_intro() {
154
 
155
  // Get user id and array from db
156
  $user_id = get_current_user_id();
@@ -158,30 +197,31 @@
158
 
159
  // Check if it's first time that user checked this option.
160
  if ($already && in_array($user_id, $already))
161
- unset($already[array_search($user_id, $already, true)]);
162
 
163
  // If the user no exists exit.
164
- else exit;
 
165
 
166
  // Add option to database if not exit.
167
  $opt = update_option('_cdp_no_intro', $already);
 
168
 
169
- }
170
- /** –– **/
171
 
172
  /** –– **\
173
  * This function will be fired when user want to save plugin options – again.
174
  * @since 1.0.0
175
  */
176
- function cdp_save_plugin_options($areWePro) {
177
 
178
  // Get the info about our professionalness
179
  $areWePro = $areWePro;
180
 
181
  // Get new options and current profile.
182
- $options = ((isset($_POST['options']))?cdp_sanitize_array($_POST['options']):false);
183
- $entire = ((isset($_POST['entire']))?cdp_sanitize_array($_POST['entire']):false);
184
- $profile = ((isset($_POST['profile']))?sanitize_text_field($_POST['profile']):false);
185
 
186
  // Get current options and profiles.
187
  $a_or = get_option('_cdp_profiles');
@@ -190,8 +230,10 @@
190
  $globals = get_option('_cdp_globals');
191
 
192
  // Check if it's first time – create array.
193
- if (!is_array($already)) $already = array();
194
- if (!is_array($globals)) $globals = array();
 
 
195
 
196
  // Add display name for this profile
197
  $profile = preg_replace('/\s+/', '_', trim(strtolower($profile)));
@@ -201,18 +243,21 @@
201
  $already[$profile]['usmplugin'] = 'false';
202
  $already[$profile]['yoast'] = 'false';
203
  $already[$profile]['woo'] = 'false';
204
- if ($areWePro) $already[$profile] = cdpp_filter_premium_opts($already, $options, $profile);
 
205
 
206
  if (!isset($already[$profile]['names']['display']) || (strlen(trim($already[$profile]['names']['display'])) <= 0))
207
- $already[$profile]['names']['display'] = $profile;
208
  $globals = $entire;
209
 
210
  // Check if there is default profile
211
  if (!array_key_exists('default', $already) || !array_key_exists('title', $already['default'])) {
212
- $already['default'] = array();
213
 
214
- if (function_exists('cdp_default_options')) $already['default'] = cdp_default_options();
215
- if (function_exists('cdp_default_global_options')) $globals['others'] = cdp_default_global_options();
 
 
216
  }
217
 
218
  // Add new options to database.
@@ -220,540 +265,572 @@
220
  $s2 = update_option('_cdp_profiles', $already);
221
 
222
  // Check if success while uploading
223
- if (($s1 || $s2) || ($globals == $g_or) || ($already == $a_or)) echo 'success';
224
- else echo 'error';
 
 
 
225
 
226
- }
227
- /** –– **/
228
 
229
  /** –– **\
230
  * This function will be fired when user want to save plugin options – again.
231
  * @since 1.0.0
232
  */
233
- function cdp_insert_new_post($areWePro = false) {
234
 
235
  // Create output array which will be returned to requester
236
  $output = array('status' => 'success');
237
 
238
  // Get ID(s) of post(s)
239
- $ids = ((isset($_POST['id']))?cdp_sanitize_array($_POST['id']):false);
240
 
241
  // Get all important pieces of information from requester
242
- $data = ((isset($_POST['data']))?cdp_sanitize_array($_POST['data']):false);
243
- $site = isset($_POST['data']['site']) ? sanitize_text_field($_POST['data']['site']) : false;
244
- $times = isset($_POST['data']['times']) ? sanitize_text_field($_POST['data']['times']) : 1;
245
- $swap = isset($_POST['data']['swap']) ? sanitize_text_field($_POST['data']['swap']) : false;
246
  $profile = isset($_POST['data']['profile']) ? sanitize_text_field($_POST['data']['profile']) : 'default';
247
- $origin = isset($_POST['origin']) ? sanitize_text_field($_POST['origin']) : false;
248
- $custom = isset($_POST['data']['custom']) ? cdp_sanitize_array($_POST['data']['custom']) : false;
249
 
250
  // Load default options for selected profile
251
  $defaults = get_option('_cdp_profiles')[$profile];
252
 
253
  // Settings for this copy
254
- $settings = (($data['type'] != 'copy-quick' && $custom != false)?$custom:$defaults);
255
- if (!isset($settings['names'])) $settings['names'] = $defaults['names'];
 
256
 
257
  // Convert string to boolean – only for much less code later
258
  foreach ($settings as $setting => $val)
259
- if ($setting != 'names')
260
- $settings[$setting] = (($val == 'true')?true:false);
261
 
262
  /**
263
- * This local function filters post data by user settings
264
- * @param $post (array of wordpress post/page data)
265
- * @param $settings (array of preselected settings of profile or by user)
266
- * @return array with insert ready values for wordpress post || false on wrong $post
267
- */
268
  function cdp_filter_post($post, $swap, $opt, $settings, $taxonomies = false, $areWePro) {
269
 
270
- // If $post has wrong format return false
271
- if (!(is_array($post) || is_object($post))) return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
 
273
- // Array for formatted and prepared taxonomy
274
- $ft = array();
275
- $buin = array('link_category', 'nav_menu', 'post_tag', 'category', 'post_format');
 
 
 
 
 
 
 
276
 
277
- // Loop thorugh all taxonomies from post
278
- foreach ($taxonomies as $taxonomy) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
279
 
280
- // Set the name to shorted variable
281
- $tn = $taxonomy->taxonomy;
 
 
 
 
 
282
 
283
- // Check if it's private taxonomy and if it's set in options
284
- if ($tn == 'link_category' && !$settings['link_category']) continue;
285
- if ($tn == 'nav_menu' && !$settings['nav_menu']) continue;
286
- if ($tn == 'post_tag' && !$settings['post_tag']) continue;
287
- if ($tn == 'category' && !$settings['category']) continue;
288
- if ($tn == 'post_format' && !$settings['format']) continue;
 
 
 
 
 
 
289
 
290
- // Don't copy custom taxonomy if it's not checked
291
- if (!in_array($tn, $buin) && !$settings['taxonomy']) continue;
292
 
293
- // Push next term of existing taxonomy
294
- if (isset($ft[$tn])) array_push($ft[$tn], $taxonomy->term_id);
 
 
 
 
 
 
 
 
295
 
296
- // Create new taxonomy and push new term
297
- else {
298
- $ft[$tn] = array();
299
- array_push($ft[$tn], $taxonomy->term_id);
300
- }
301
-
302
- }
303
-
304
- // Create array with required values and contant values
305
- $new = array(
306
- 'post_title' => ($settings['title'] ? cdp_create_title($post['post_title'], $settings['names'], $post['ID'], $areWePro) : 'Untitled Copy'),
307
- 'post_date' => ($settings['date'] ? $post['post_date'] : current_time('mysql')),
308
- 'post_status' => ($settings['status'] ? $post['post_status'] : 'draft'),
309
- 'post_author' => ($settings['author'] ? $post['post_author'] : wp_get_current_user()->ID),
310
- 'post_content' => ($settings['content']) ? $post['post_content'] : ' ',
311
- 'comment_status' => $post['comment_status'], // that's additional element which cannot be edited by user
312
- 'post_parent' => $post['post_parent'] // that's additional element which cannot be edited by user
313
- );
314
-
315
- // Converter
316
- if ((($opt == '2' && $swap == 'true') || $swap == 'true') && $areWePro && function_exists('cdpp_post_converter'))
317
- $new['post_type'] = cdpp_post_converter($post['post_type']);
318
- else $new['post_type'] = $post['post_type'];
319
-
320
- // Add optional values of post – depending on settings
321
- if ($settings['slug']) $new['post_name'] = $post['post_name'];
322
- if ($settings['excerpt']) $new['post_excerpt'] = $post['post_excerpt'];
323
- if ($settings['template']) $new['page_template'] = $post['page_template'];
324
- if ($settings['password']) $new['post_password'] = $post['post_password'];
325
- if ($settings['menu_order']) $new['menu_order'] = $post['menu_order'];
326
- if ($settings['category']) $new['post_category'] = $post['post_category'];
327
- if ($settings['post_tag']) $new['tags_input'] = $post['tags_input'];
328
- if ($taxonomies != false) $new['tax_input'] = $ft;
329
-
330
- // Return filtered data of current post
331
- return $new;
332
 
333
- }
 
 
334
 
335
- /**
336
- * This local function filters post data by user settings
337
- * @param $metas (array of wordpress post/page meta data)
338
- * @param $settings (array of preselected settings of profile or by user)
339
- * @return array with metadata values for post || false on wrong $metas
340
- */
341
- function cdp_filter_meta($metas, $settings, $id, $areWePro, $site, $title) {
342
 
343
- // If $metas has wrong format return false
344
- if (!(is_array($metas) || is_object($metas))) return false;
345
-
346
- // Create empty array for filtered meta data
347
- $prepared = array(
348
- // Add or replace ours copy tracker
349
- array('_cdp_origin' => $id),
350
- array('_cdp_origin_site' => $site),
351
- array('_cdp_origin_title' => $title),
352
- array('_cdp_counter' => '0')
353
- );
354
-
355
- // Iterate through every meta index
356
- foreach ($metas as $meta => $vals) {
357
-
358
- // Conditions
359
- $a = ($areWePro && function_exists('cdpp_check_yoast'))?cdpp_check_yoast($settings, $meta):false;
360
- $b = ($areWePro && function_exists('cdpp_check_usm'))?cdpp_check_usm($settings, $meta):false;
361
- $c = ($areWePro && function_exists('cdpp_check_woo'))?cdpp_check_woo($settings, $meta, $id):false;
362
- $d = ($settings['f_image'] && $meta == '_thumbnail_id')?true:false;
363
- $e = (mb_substr($meta, 0, 4) == '_wp_')?true:false;
364
- $f = ($meta == '_thumbnail_id' && $settings['f_image'])?true:false;
365
- $g = ($meta == '_cdp_origin')?true:false;
366
- $h = (mb_substr($meta, 0, 11) == '_elementor_')?true:false;
367
-
368
- // If any of above condition is true pass the meta tag
369
- if ($a || $b || $c || $d || $e || $f || $g || $h) {
370
-
371
- // Prepare data and insert filtered to results
372
- foreach ($vals as $val)
373
- array_push($prepared, array($meta => $val));
374
 
 
375
  }
376
 
377
- }
378
-
379
- // Return results
380
- return $prepared;
381
-
382
  }
383
 
384
  /**
385
- * This local function format title by user settings
386
- * @param $title (string)
387
- * @param $settings (array of name settings preselected in profile)
388
- * @return string formated title
389
- */
390
  function cdp_create_title($title, $settings, $id, $areWePro) {
391
 
392
- // Date formats
393
- $date_format = intval($settings['format']);
394
 
395
- // Get right format
396
- if ($date_format == 1) $date_format = 'm/d/Y';
397
- else if ($date_format == 2) $date_format = 'd/m/Y';
398
- else {
399
- if ($areWePro && function_exists('cdpp_custom_date'))
400
- $date_format = cdpp_custom_date($settings);
401
- else $date_format = 'd/m/Y';
402
- }
403
-
404
- // Create date and time replacements
405
- $curr = current_time('timestamp', true);
406
- $date = date($date_format, $curr);
407
- $time = date('H:i:s', $curr);
408
 
409
- // Concat whole title with prefix and suffix
410
- $new_title = $settings['prefix'] . ' ' . $title . ' ' . $settings['suffix'];
 
 
411
 
412
- // Make replace of placeholders
413
- $new_title = str_replace('[CurrentDate]', $date, $new_title);
414
- $new_title = str_replace('[CurrentTime]', $time, $new_title);
415
 
416
- // Return formatted title
417
- return $new_title;
 
418
 
 
 
419
  }
420
 
421
  /**
422
- * This local function inserts whole post into database
423
- * @param $data (array prepared by cdp_filter_post function)
424
- * @param $times (int how many times should this function copy post)
425
- * @return array of new inserted post(s) and error status
426
- * Structure of return array: { ids: [$ids], error: (count of errors) }
427
- */
428
  function cdp_insert_post($id, $data, $times, $areWePro, $isChild = false, $p_ids = null, $site) {
429
 
430
- // Get Wordpress database
431
- global $wpdb;
432
-
433
- // Create empty array for new id(s) and error(s)
434
- $results = array('ids' => array(), 'error' => 0, 'counter' => 0);
435
 
436
- // Get Counter value
437
- $prefix = (($site != -1)?$wpdb->get_blog_prefix($site):$wpdb->get_blog_prefix());
438
- $newestId = $wpdb->get_results("SELECT post_id FROM {$prefix}postmeta WHERE meta_key = '_cdp_origin' AND meta_value = {$id} ORDER BY post_id DESC LIMIT 1", ARRAY_A);
439
- $newestId = ((array_key_exists(0, $newestId))?(intval($newestId[0]['post_id'])):false);
440
- if (isset($newestId) && $newestId != false && $newestId > 0)
441
- $counter = $wpdb->get_results("SELECT meta_value AS 'Counter' FROM {$prefix}postmeta WHERE meta_key = '_cdp_counter' AND post_id = {$newestId} ORDER BY post_id DESC", ARRAY_A)[0]['Counter'];
442
- else $counter = 1;
443
 
444
- $base_title = $data['post_title'];
445
- $counter = intval($counter) + 1;
 
 
 
 
 
 
446
 
447
- // Handle multisite for premium
448
- if ($areWePro && function_exists('cdpp_handle_multisite'))
449
- cdpp_handle_multisite($site);
450
 
451
- // Loop for each post iteration
452
- for ($i = 0; $i < $times; ++$i) {
453
-
454
- // Change parent if it's child
455
- if ($isChild) $data['post_parent'] = $p_ids['posts'][$i];
456
 
457
- // Replace title with Counter if multiple copies
458
- $data['post_title'] = str_replace('[Counter]', ($counter + $i), $base_title);
459
 
460
- // Insert post with filtered data
461
- $new = wp_insert_post($data, true);
 
462
 
463
- // Check if the post is inserted successfully and append array
464
- if (is_numeric($new)) array_push($results['ids'], $new);
465
- else $results['error']++;
466
 
467
- }
 
468
 
469
- // Handle multisite for premium fix
470
- if ($areWePro && function_exists('cdpp_handle_multisite_after'))
471
- cdpp_handle_multisite_after($site);
 
 
 
472
 
473
- // Set first counter number for future
474
- $results['counter'] = $counter;
 
475
 
476
- // Return array with results
477
- return $results;
478
 
 
 
479
  }
480
 
481
  /**
482
- * This local function filter and adds missing meta to added post
483
- * @param $ids (array of post ids)
484
- * @param $metas (filtered meta data with cdp_filter_meta function)
485
- * @return array structure below
486
- * { ids: { [id] => [failed times]}, error: { [id] => [failed times]} }
487
- */
488
  function cdp_insert_post_meta($ids, $metas, $areWePro, $counter, $site) {
489
 
490
- // Handle multisite for premium
491
- if ($areWePro && function_exists('cdpp_handle_multisite'))
492
- cdpp_handle_multisite($site);
493
-
494
- // Create empty array for new id(s) and error(s)
495
- $results = array('ids' => array(), 'error' => array());
496
-
497
- // Iterate through every inserted post
498
- foreach ($ids as $id) {
499
-
500
- // Iterate through every meta tag
501
- foreach ($metas as $meta_id => $meta) {
502
-
503
- // Get individual data from metas array
504
- foreach ($meta as $key => $val) {
505
-
506
- // Replace the counter with dynamic value
507
- if ($key == '_cdp_counter') $val = $counter;
508
-
509
- // Insert meta tag
510
- $res = add_post_meta($id, $key, $val);
511
-
512
- // Check if the insert was successfull
513
- if ($res != false) {
514
- if (!isset($results['ids'][$id])) $results['ids'][$id] = [];
515
- array_push($results['ids'][$id], array($key, $val));
516
- } else {
517
- if (!isset($results['error'][$id])) $results['error'][$id] = [];
518
- array_push($results['error'][$id], array($key, $val));
 
 
 
 
 
519
  }
520
 
521
- }
522
-
523
  }
524
 
525
- // Iterate the counter
526
- $counter++;
527
-
528
- }
529
-
530
- // Fix multisite handler
531
- if ($areWePro && function_exists('cdpp_handle_multisite_after'))
532
- cdpp_handle_multisite_after($site);
533
-
534
- // Return the results
535
- return $results;
536
 
 
 
537
  }
538
 
539
  /**
540
- * This local function search for childs and catch their IDs
541
- * @param $id string/int (post id)
542
- * @return array of child(s) ID(s)
543
- */
544
  function cdp_check_childs($id) {
545
- $childs = [];
546
- $childrens = get_children(array('post_parent' => $id));
547
 
548
- foreach ($childrens as $i => $child)
549
- array_push($childs, $child->ID);
550
 
551
- return $childs;
552
  }
553
 
554
  /**
555
- * This local function copies original attachments
556
- * @param $path string (path to original file)
557
- * @return string path to new file
558
- */
559
  function cdp_copy_attachment($path = '', $destination) {
560
- if ($path == '') return false;
561
-
562
- $dirname = $destination;
563
- $name = basename($path);
564
- $actual_name = pathinfo($name, PATHINFO_FILENAME);
565
- $original_name = $actual_name;
566
- $extension = pathinfo($name, PATHINFO_EXTENSION);
567
-
568
- $i = 1;
569
- while (file_exists($dirname.'/'.$actual_name.".".$extension)) {
570
- $actual_name = (string)$original_name.'-'.$i;
571
- $name = $actual_name.'.'.$extension;
572
- $i++;
573
- }
574
-
575
- copy($path, $dirname.'/'.$name);
576
- return $dirname.'/'.$name;
 
577
  }
578
 
579
  /**
580
- * This local function gets copy and insert attachments
581
- * @param $id int/string of post
582
- * @return array of inserted attachments
583
- */
584
  function cdp_insert_attachments($id, $inserted_posts, $areWePro, $site) {
585
- $inserts = array();
586
- $media = get_attached_media('', $id);
587
 
588
- // Handle multisite for premium
589
- if ($areWePro && function_exists('cdpp_handle_multisite'))
590
- cdpp_handle_multisite($site);
591
 
592
- // Fix wordpress multisite path
593
- add_filter('upload_dir', 'cdp_fix_upload_paths');
594
- $wp_upload_dir = wp_upload_dir();
595
- remove_filter('upload_dir', 'cdp_fix_upload_paths');
596
 
597
- // Handle multisite for premium fix
598
- if ($areWePro && function_exists('cdpp_handle_multisite_after'))
599
- cdpp_handle_multisite_after($site);
600
 
601
- foreach ($media as $i => $m) {
602
- if (get_attached_file($m->ID) == '') continue;
603
- $path = cdp_copy_attachment(get_attached_file($m->ID), $wp_upload_dir['path']);
 
604
 
605
- $filename = $path;
606
- $parent_post_id = $inserted_posts['ids'][0];
607
 
608
- $filetype = wp_check_filetype(basename($filename), null);
609
 
610
- // Handle multisite for premium
611
- if ($areWePro && function_exists('cdpp_handle_multisite'))
612
- cdpp_handle_multisite($site);
613
-
614
- $attachment = array(
615
- 'guid' => $wp_upload_dir['url'] . '/' . basename($filename),
616
- 'post_mime_type' => $filetype['type'],
617
- 'post_title' => preg_replace( '/\.[^.]+$/', '', basename($filename)),
618
- 'post_content' => '',
619
- 'post_status' => 'inherit'
620
- );
621
 
622
- $attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
623
- array_push($inserts, array('url' => wp_get_attachment_url($attach_id), 'id' => $attach_id));
 
 
 
 
 
624
 
625
- $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
626
- wp_update_attachment_metadata($attach_id, $attach_data);
627
 
628
- // Handle multisite for premium fix
629
- if ($areWePro && function_exists('cdpp_handle_multisite_after'))
630
- cdpp_handle_multisite_after($site);
631
- }
 
 
 
632
 
633
- return $inserts;
634
  }
635
 
636
  /**
637
- * This local function gets comments and copy them
638
- * @param $id int/string of base post
639
- * @param $dests array of post ids where the comms from $id should be copied
640
- * @return array of inserted comments
641
- */
642
  function cdp_copy_comments($id, $dests) {
643
- $comments = get_comments(array('post_id' => $id));
644
- $curr = current_time('mysql');
645
- $all_inserts = array();
646
- $all_inserts['fix_try'] = array();
647
- $all_inserts['olds'] = '';
648
-
649
- foreach ($dests as $dest) {
650
- $p = 0;
651
- $olds = array();
652
-
653
- $cm1 = $comments;
654
- foreach ($cm1 as $i => $c) {
655
- $c = $c->to_array();
656
- $old_id = $c['comment_ID'];
657
- $parent = $c['comment_parent'];
658
-
659
- $c['comment_date'] = $curr;
660
- $c['comment_date_gmt'] = $curr;
661
- $c['comment_post_ID'] = $dest;
662
- $c['comment_parent'] = 0;
663
- if ($parent != "0") $p++;
664
-
665
- $new_id = @wp_insert_comment($c);
666
-
667
- $olds[$old_id] = array('new' => $new_id, 'old_parent_id' => $parent);
668
- array_push($all_inserts, array('old' => $old_id, 'new' => $new_id, 'parent' => $parent));
669
- }
 
670
 
671
- if ($p != 0) {
672
- $cm2 = $comments;
673
- foreach ($cm2 as $j => $m) {
674
- if ($m->comment_parent != "0" && $olds[$m->comment_ID]['old_parent_id'] == $m->comment_parent) {
675
- $post = get_comment($olds[$m->comment_ID]['new']);
676
- $post = $post->to_array();
677
- $post['comment_parent'] = $olds[$m->comment_parent]['new'];
678
- wp_update_comment($post);
 
 
679
  }
680
- }
681
  }
682
 
683
- }
684
-
685
- return $all_inserts;
686
  }
687
 
688
  // Main code for this duplication – for each id (post) do whole process
689
  function cdp_process_ids($ids, $swap, $settings, $times, $site, $areWePro, $g, $isChild = false, $p_ids = null) {
690
 
691
- // Make it clear
692
- $globals = cdp_default_global_options();
693
- if ($g != false) $globals = $g;
694
- $g = $globals['others'];
695
-
696
- // Return data storage
697
- $output = [];
698
- $new_posts = array('parents' => array(), 'childs' => array(), 'ids' => array());
699
-
700
- // Iterate each id
701
- foreach ($ids as $id) {
702
-
703
- // Get post data and meta data
704
- $post = get_post($id)->to_array();
705
- $meta = get_post_custom($id);
706
- $taxonomies = wp_get_object_terms($id, get_taxonomies());
707
-
708
- // Check if this post type is allowed to copy
709
- $type = $post['post_type'];
710
- if ($g['cdp-content-pages'] == 'false' && $type == 'page') continue;
711
- if ($g['cdp-content-posts'] == 'false' && $type == 'post') continue;
712
- if ($g['cdp-content-custom'] == 'false' && ($type != 'page' && $type != 'post')) continue;
713
-
714
- // Post converting?
715
- $pConv = false;
716
- if (array_key_exists('postConverter', $globals))
717
- $pConv = $globals['postConverter'];
718
-
719
- // Run process and validate response
720
- $childrens = cdp_check_childs($id); // if sizeof($this) == has childs
721
- $post_data = cdp_filter_post($post, $swap, $pConv, $settings, $taxonomies, $areWePro, $swap); // can be false
722
- $meta_data = cdp_filter_meta($meta, $settings, $id, $areWePro, $site, $post_data['post_title']); // can be false
723
- $inserted_posts = cdp_insert_post($id, $post_data, $times, $areWePro, $isChild, $p_ids, $site); // $res['error'] must be == 0
724
- $inserted_metas = cdp_insert_post_meta($inserted_posts['ids'], $meta_data, $areWePro, $inserted_posts['counter'], $site); // sizeof($res['error']) must be == 0
725
-
726
- // Comments copy
727
- if ($settings['comments']) $inserted_comments = cdp_copy_comments($id, $inserted_posts['ids']);
728
- $cms = get_comments(array('post_id' => $id));
729
-
730
- // Post format
731
- if ($settings['format']) foreach ($inserted_posts['ids'] as $i => $tid)
732
- $isReFormat = set_post_format($tid, get_post_format($id));
733
-
734
- // Featured image copy
735
- if ($settings['attachments']) $inserted_attachments = cdp_insert_attachments($id, $inserted_posts, $areWePro, $site);
736
- else $inserted_attachments = false;
737
-
738
- // Copy childrens recursively if exist
739
- if ($settings['children'] && sizeof($childrens) > 0) {
740
- $child_helpers = array('posts' => $inserted_posts['ids']);
741
- $inserted_childs = cdp_process_ids($childrens, $swap, $settings, $times, $site, $areWePro, $globals, true, $child_helpers);
742
- array_push($new_posts['childs'], array($id => $inserted_childs['$new_posts']['ids']));
743
- }
744
-
745
- // Add new inserted IDs
746
- foreach ($inserted_posts['ids'] as $i_id)
747
- array_push($new_posts['parents'], $i_id);
748
-
749
- // Merge for easier read
750
- $new_posts['ids'] = array_merge($new_posts['ids'], $new_posts['parents'], $new_posts['childs']);
751
 
752
- }
 
 
753
 
754
- // Return all data to main request
755
- return array('$output' => $output, '$new_posts' => $new_posts);
 
756
 
 
 
757
  }
758
 
759
  // Run the machine for selected post(s)
@@ -762,73 +839,78 @@
762
 
763
  // Handle multisite for premium
764
  if ($areWePro && function_exists('cdpp_handle_multisite'))
765
- cdpp_handle_multisite($site);
766
 
767
  $pConv = false;
768
  if (array_key_exists('postConverter', $g) && $areWePro)
769
- $pConv = (($g['postConverter'] === '2' || $g['postConverter'] === 2)?true:false);
770
 
771
  // Output link if it's edited post
772
- $aCop = ((array_key_exists('afterCopy', $g))?$g['afterCopy']:'1');
773
  if (($data['type'] == 'copy-custom-link' || $aCop == '2'))
774
- $output['link'] = get_edit_post_link($new_insertions['$new_posts']['parents'][0], 'x');
775
 
776
- if ($pConv == true && !($data['type'] == 'copy-custom-link' || $aCop == '2')) $output['link'] = 'pConv';
777
- else update_option('_cdp_show_copy', true);
 
 
778
 
779
  // Handle multisite for premium fix
780
  if ($areWePro && function_exists('cdpp_handle_multisite_after'))
781
- cdpp_handle_multisite_after($site);
782
 
783
  echo json_encode(cdp_sanitize_array($output));
784
- }
785
- /** –– **/
 
786
 
787
  /** –– **\
788
  * This function will return profile information for presets.
789
  * @return object of settings by requested profile
790
  * @since 1.0.0
791
  */
792
- function cdp_get_profile() {
793
 
794
- if (function_exists('cdpp_get_all_profiles')) cdpp_get_profile();
 
795
  else {
796
 
797
- // Search for the settings of profile
798
- $settings = get_option('_cdp_profiles')['default'];
799
-
800
- // Display those settings
801
- echo json_encode(cdp_sanitize_array($settings));
802
 
 
 
803
  }
 
804
 
805
- }
806
- /** –– **/
807
 
808
  /** –– **\
809
  * This function will return all profile information for manager.
810
  * @return object of settings by requested profile
811
  * @since 1.0.0
812
  */
813
- function cdp_get_all_profiles() {
814
 
815
- if (function_exists('cdpp_get_all_profiles')) cdpp_get_all_profiles();
816
- else cdp_get_profile();
 
 
 
817
 
818
- }
819
- /** –– **/
820
 
821
  /** –– **\
822
  * This function will return all not trashed posts
823
  * @return object of posts and success or fail message
824
  */
825
- function cdp_get_all_posts() {
826
  $output = array();
827
 
828
  $args = array(
829
- 'numberposts' => -1,
830
- 'post_type' => 'post',
831
- 'post_status' => 'publish,private,draft,future,pending,inherit,sticky'
832
  );
833
 
834
  $output['posts'] = get_posts($args);
@@ -839,213 +921,243 @@
839
  $post_types = get_post_types(array('public' => true, '_builtin' => false));
840
 
841
  if (sizeof($post_types) > 0)
842
- $output['custom'] = get_posts(array(
843
- 'post_type' => $post_types,
844
- 'numberposts' => -1,
845
- 'post_status' => 'publish,private,draft,future,pending,inherit,sticky'
846
- ));
847
 
848
  $output['meta'] = array();
849
- foreach ($output['posts'] as $k => $p) $output['meta'][$p->ID] = get_post_meta($p->ID);
850
- foreach ($output['pages'] as $k => $p) $output['meta'][$p->ID] = get_post_meta($p->ID);
851
- foreach ($output['custom'] as $k => $p) $output['meta'][$p->ID] = get_post_meta($p->ID);
 
 
 
852
 
853
  echo json_encode(cdp_sanitize_array($output));
854
- }
855
- /** –– **/
 
856
 
857
  /** –– **\
858
  * This function will delete all posts in array PERMANENTLY!
859
  * @return object of success message or error
860
  */
861
- function cdp_delete_posts() {
862
- $ids = ((isset($_POST['ids']))?cdp_sanitize_array($_POST['ids']):false); // ids to delete
863
  $throttling = sanitize_text_field($_POST['throttling']); // throttling if enabeld
864
- $thc = sanitize_text_field($_POST['thc']); // throttling count if enabeld
865
- $thrs = sanitize_text_field($_POST['thrs']) == 'true' ? true : false; // trash or not?
866
- $redi = sanitize_text_field($_POST['redi']) == 'true' ? true : false; // redirect if enabled
867
- $auit = sanitize_text_field($_POST['auit']) == 'true' ? true : false; // auit if enabled
868
- $auitd = ((isset($_POST['auitd']))?cdp_sanitize_array($_POST['auitd']):false); // auitd if auit enabled
869
-
870
- $prepared_ids = array(); $inGroup = 0;
871
- $curr = current_time('timestamp'); $token = uniqid($curr, true);
 
 
872
  $cdp_cron = get_option('_cdp_crons');
873
  $site = is_multisite() ? get_current_blog_id() : '-1';
874
- if ($cdp_cron == false) $cdp_cron = array();
 
875
  $cdp_cron[$token] = array(
876
- 'start' => $curr,
877
- 'ids' => $ids,
878
- 'done' => false,
879
- 'shown' => false,
880
- 'f' => 'delete',
881
- 'del_size' => sizeof($ids),
882
- 'handler' => 'cdp_cron_delete',
883
- 'auit' => $auit,
884
- 'auitd' => $auitd
885
  );
886
  $cdp_cron[$token]['tasks'] = array();
887
  $cdp_cron[$token]['args'] = array();
888
 
889
  if ($throttling == '1' && $thc && intval($thc) >= 1 && intval($thc) <= 10240) {
890
 
891
- $inGroup = ceil(intval($thc) / 30);
892
 
893
- for ($i=0, $k=2; $i < sizeof($ids); $i = $i + $inGroup, $k++)
894
- $cdp_cron[$token]['tasks']["-$k"] = false;
895
 
896
- update_option('_cdp_crons', $cdp_cron);
897
- for ($i=0, $k=2; $i < sizeof($ids); $i = $i + $inGroup, $k++) {
898
- $tg = array(); $tt = array('tsk' => "-".$k, 'token' => $token);
 
899
 
900
- for ($j=$i; $j < ($i + $inGroup); $j++) if (isset($ids[$j])) array_push($tg, $ids[$j]);
901
-
902
- array_push($prepared_ids, $tg);
903
- $time = $k * 2;
904
- $args = array(array('ids' => $tg, 'site' => $site, 'trash' => $thrs, 'token' => $tt));
905
- wp_schedule_single_event(strtotime("+$time seconds"), 'cdp_cron_delete', $args);
906
- array_push($cdp_cron[$token]['args'], $args);
907
- }
908
 
 
 
 
 
 
 
909
  } else {
910
 
911
- $cdp_cron[$token]['tasks']["-0"] = false;
912
- update_option('_cdp_crons', $cdp_cron);
913
- $tt = array('tsk' => "-0", 'token' => $token);
914
- $args = array(array('ids' => $ids, 'site' => $site, 'trash' => $thrs, 'token' => $tt));
915
- wp_schedule_single_event(strtotime('+2 seconds'), 'cdp_cron_delete', $args);
916
- array_push($cdp_cron[$token]['args'], $args);
917
-
918
  }
919
 
920
  echo json_encode(array('status' => 'success', 'token' => cdp_sanitize_array($token)));
921
- }
922
- /** –– **/
 
923
 
924
  /** –– **\
925
  * This function will delete all posts in array PERMANENTLY!
926
  * @return object of success message or error
927
  */
928
- function cdp_clear_all_crons() {
929
  $cdp_cron = get_option('_cdp_crons');
930
 
931
  foreach ($cdp_cron as $cron => $val) {
932
- if (array_key_exists('done', $val)) {
933
- if ($val['done'] != true) {
934
- echo json_encode(array(
935
- 'status' => 'fail',
936
- 'type' => 'warning',
937
- 'msg' => 'You can\'t clear messages when tasks are in progress, please firstly kill tasks or wait till the end.'
938
- ));
939
- return;
 
940
  }
941
- }
942
  }
943
 
944
  $cdp_cron = delete_option('_cdp_crons');
945
  echo json_encode(array('status' => 'success'));
946
- }
947
- /** –– **/
 
948
 
949
  /** –– **\
950
  * Local function which sets default profile for user
951
  * @return Boolean
952
  */
953
- function cdp_set_default_profile() {
954
  $curr = get_option('_cdp_preselections');
955
  $id = get_current_user_id();
956
  $new = array();
957
- $selection = ((isset($_POST['selection']))?cdp_sanitize_array($_POST['selection']):false);
958
- if ($curr && !is_object($curr) || $curr == false) $new = array($id => $selection);
959
- else { $new = $curr; $new[$id] = $selection; }
 
 
 
 
960
  $stat = update_option('_cdp_preselections', $new);
961
  echo cdp_sanitize_array($stat);
962
- }
963
- /** –– **/
 
964
 
965
  /** –– **\
966
- * Local function which gets default profile for user
967
- * @return String
968
- */
969
- function cdp_get_default_profile() {
970
  echo(esc_html(get_option('_cdp_preselections')[get_current_user_id()]));
971
- }
972
- /** –– **/
 
973
 
974
  /** –– **\
975
  * This function will set as seen notification!
976
  * @return object of success message — WARNING: ALWAYS
977
  */
978
- function cdp_set_noti_as_seen() {
979
- if (wp_doing_cron()) return;
 
980
 
981
- $token = ((isset($_POST['noti_token']))?sanitize_text_field($_POST['noti_token']):false);
982
  $cdp_cron = get_option('_cdp_crons', array());
983
  $cdp_cron[$token]['shown'] = true;
984
  update_option('_cdp_crons', $cdp_cron);
985
 
986
  echo json_encode(array('status' => 'success'));
987
- }
988
- /** –– **/
 
989
 
990
  /** –– **\
991
  * This function will delete task from the history!
992
  * @return object of success message or fail
993
  */
994
- function cdp_just_hide_task() {
995
- $token = ((isset($_POST['task']))?sanitize_text_field($_POST['task']):false);
996
  $cdp_cron = get_option('_cdp_crons', array());
997
  unset($cdp_cron[$token]);
998
  $res = update_option('_cdp_crons', $cdp_cron);
999
 
1000
- if ($res) echo json_encode(array('status' => 'success'));
1001
- else echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => 'We can\'t hide this task now, – maybe it\'t already hidden. Please try again later.'));
1002
- }
1003
- /** –– **/
 
 
 
1004
 
1005
  /** –– **\
1006
  * This function will kill task from the cron!
1007
  * @return object of success message or fail
1008
  */
1009
- function cdp_just_kill_task() {
1010
- $token = ((isset($_POST['task']))?sanitize_text_field($_POST['task']):false);
1011
  $cdp_cron = get_option('_cdp_crons', array());
1012
  $handler = $cdp_cron[$token]['handler'];
1013
- $args = (array_key_exists('args', $cdp_cron[$token])?$cdp_cron[$token]['args']:array());
1014
 
1015
  if ($cdp_cron[$token]['done'] != false) {
1016
- echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => 'This task has already ended this work, please wait for list refresh and try again.'));
1017
- return;
1018
  }
1019
 
1020
- $status = true; $res = false;
 
1021
  foreach ($args as $arg => $val) {
1022
- $sres = wp_clear_scheduled_hook($handler, $val);
1023
- if ($sres == false) $status = false;
 
1024
  }
1025
 
1026
- if ($cdp_cron[$token]['done'] != false) $status = true;
 
1027
 
1028
  if ($status == true) {
1029
- unset($cdp_cron[$token]);
1030
- $res = update_option('_cdp_crons', $cdp_cron);
1031
  }
1032
 
1033
- if ($status || $res) echo json_encode(array('status' => 'success'));
1034
- else echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => 'We can\'t confirm that we killed this task now, please try again later or check if it\'t killed.'));
1035
- }
1036
- /** –– **/
 
 
 
1037
 
1038
  /** –– **\
1039
  * This function will catch current cron tasks!
1040
  * @return object of tasks or fail
1041
  */
1042
- function cdp_just_get_tasks() {
1043
  $cdp_cron = get_option('_cdp_crons', false);
1044
 
1045
- if ($cdp_cron) echo json_encode(array('status' => 'success', 'tasks' => cdp_sanitize_array($cdp_cron)));
1046
- else echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => 'We couldn\'t catch current tasks, please try again later.'));
1047
- }
1048
- /** –– **/
 
 
 
1049
 
1050
  /** –– **\
1051
  * This function is just for debug have fun with it!
@@ -1053,7 +1165,7 @@
1053
  * It won't work in production mode so dont even try it, if you're not me ~ Mikołaj :P
1054
  * @return mixed
1055
  */
1056
- function cdp_debug_function() {
1057
 
1058
  // require_once('C:/Developer/Web/wordpress/wp-content/plugins/copy-delete-posts-premium/classes/methods.php');
1059
  // $settings = get_option('cdpp_aci_settings', false);
@@ -1063,9 +1175,9 @@
1063
 
1064
  $cdp_cron = get_option('_cdp_crons', false);
1065
  $things_to_debug = array(
1066
- '$cdp_cron' => $cdp_cron
1067
  );
1068
  var_export($things_to_debug);
 
1069
 
1070
- }
1071
  /** –– **/
1
  <?php
2
+
3
  /**
4
  * Copy & Delete Posts – Post requests handler file.
5
  *
8
  * @author CopyDeletePosts
9
  * @since 1.0.0
10
  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
 
11
  /** –– **\
12
  * Main handler + It will also sanitize and verify that request a little bit.
13
  * @since 1.0.0
14
  */
15
+ add_action('wp_ajax_cdp_action_handling', function () {
16
  if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
17
+ if (isset($_POST['token']) && $_POST['token'] == 'cdp' && isset($_POST['f']) && is_admin()) {
18
+
19
+ // Expand execution time
20
+ if (intval(ini_get('max_execution_time')) < 7200)
21
+ set_time_limit(0);
22
+
23
+ // Get WP-Plugin path
24
+ $premium_plugin = 'copy-delete-posts-premium/copy-delete-posts-premium.php';
25
+ $premium_dir = WP_PLUGIN_DIR . '/' . 'copy-delete-posts-premium';
26
+ $pplugin_path = $premium_dir . '/handler/premium.php';
27
+
28
+ // Load premium content if the plugin is here
29
+ if (is_dir($premium_dir) && is_plugin_active($premium_plugin))
30
+ require_once($pplugin_path);
31
+
32
+ // Is premium function
33
+ $areWePro = is_plugin_active($premium_plugin);
34
+
35
+ // Get user roles and check if the role is permmited to use plugin
36
+ $access = false;
37
+ $current_user = wp_get_current_user();
38
+ $access_roles = get_option('_cdp_globals');
39
+ if (!isset($access_roles['roles']))
40
+ $access_roles = array();
41
+ foreach ($current_user->roles as $role => $name)
42
+ if ($name == 'administrator' || (isset($access_roles['roles'][$name]) && $access_roles['roles'][$name] == 'true')) {
43
+ $access = true;
44
+ break;
45
+ }
46
+
47
+ // Check user permission
48
+ if ($access === true) {
49
+
50
+ // Pointers
51
+ if ($_POST['f'] == 'no_intro')
52
+ cdp_add_new_no_intro();
53
+ else if ($_POST['f'] == 'intro_again')
54
+ cdp_add_new_intro();
55
+ else if ($_POST['f'] == 'save_options')
56
+ cdp_save_plugin_options($areWePro);
57
+ else if ($_POST['f'] == 'copy_post')
58
+ cdp_insert_new_post($areWePro);
59
+ else if ($_POST['f'] == 'get_settings')
60
+ cdp_get_profile();
61
+ else if ($_POST['f'] == 'get_all_settings')
62
+ cdp_get_all_profiles();
63
+ else if ($_POST['f'] == 'save_profiles' && $areWePro)
64
+ cdp_save_profile_set();
65
+ else if ($_POST['f'] == 'get_all_posts')
66
+ cdp_get_all_posts();
67
+ else if ($_POST['f'] == 'delete_them')
68
+ cdp_delete_posts();
69
+ else if ($_POST['f'] == 'get_formatted_time' && $areWePro)
70
+ cdp_formatted_time();
71
+ else if ($_POST['f'] == 'set_default_profile')
72
+ cdp_set_default_profile();
73
+ else if ($_POST['f'] == 'get_default_profile')
74
+ cdp_get_default_profile();
75
+ else if ($_POST['f'] == 'clear_crons')
76
+ cdp_clear_all_crons();
77
+ else if ($_POST['f'] == 'i_saw_this_noti')
78
+ cdp_set_noti_as_seen();
79
+ else if ($_POST['f'] == 'try_to_hide_the_tasks')
80
+ cdp_just_hide_task();
81
+ else if ($_POST['f'] == 'try_to_kill_the_tasks')
82
+ cdp_just_kill_task();
83
+ else if ($_POST['f'] == 'give_me_current_tasks')
84
+ cdp_just_get_tasks();
85
+ else if ($_POST['f'] == 'review_dismiss')
86
+ cdp_review();
87
+ else if ($_POST['f'] == 'debug_function')
88
+ cdp_debug_function();
89
+ else if ($_POST['f'] == 'delete_success_img')
90
+ delete_option('_cdp_show_copy');
91
+ else if ($_POST['f'] == 'save_redi_state' && $areWePro)
92
+ cdpp_save_redi_state();
93
+ else if ($_POST['f'] == 'multi_redi_importer' && $areWePro)
94
+ cdpp_redis_importer();
95
+ else if ($_POST['f'] == 'save_redirections' && $areWePro)
96
+ cdpp_save_redirections();
97
+ else if ($_POST['f'] == 'delete_redirect' && $areWePro)
98
+ cdpp_delete_redirection();
99
+ else if ($_POST['f'] == 'switch_redirects' && $areWePro)
100
+ cdpp_switch_redirects();
101
+ else if ($_POST['f'] == 'get_authors' && $areWePro)
102
+ cdpp_get_authors();
103
+ else if ($_POST['f'] == 'get_curr_time' && $areWePro)
104
+ cdpp_get_curr_s_time();
105
+ else if ($_POST['f'] == 'get_post_export' && $areWePro)
106
+ cdpp_get_for_export();
107
+ else if ($_POST['f'] == 'import_posts' && $areWePro)
108
+ cdpp_take_for_import();
109
+ else if ($_POST['f'] == 'save_aci' && $areWePro)
110
+ cdpp_save_cleanup_settings();
111
+ else if ($_POST['f'] == 'get_aci' && $areWePro)
112
+ cdpp_get_cleanup_settings();
113
+ else if ($_POST['f'] == 'turn_off_aci' && $areWePro)
114
+ cdpp_turn_the_acii_off();
115
+ else if ($_POST['f'] == 'i_love_squirrels' && $areWePro)
116
+ cdpp_squirrel();
117
+ else
118
+ echo 'error';
119
+ } else
120
+ echo 'error';
121
+ } else
122
+ echo 'no_access';
123
+ } else
124
+ echo 'no_access';
125
 
126
  wp_die();
127
+ });
128
+ /** –– * */
129
 
130
  /** –– **\
131
  * This function will be fired when user don't want to see intro – never again.
132
  * @since 1.0.6
133
  */
134
+ function cdp_review() {
135
 
136
  // Option
137
  $method = sanitize_text_field($_POST['decision']);
141
  $already = get_option('_cdp_review', false);
142
 
143
  // Create if not exists
144
+ if ($already == false)
145
+ $already = array('installed' => time(), 'users' => array());
146
 
147
  // Set dismiss
148
  $already['users'][$user_id] = array();
149
+ $already['users'][$user_id]['dismiss'] = (($method == 'remind') ? time() : true);
150
 
151
  // Add option to datbase if not exit.
152
  $opt = update_option('_cdp_review', $already);
153
 
154
  // Return success
155
  echo json_encode(array('status' => 'success'));
156
+ }
157
 
158
+ /** –– * */
 
159
 
160
  /** –– **\
161
  * This function will be fired when user don't want to see intro – never again.
162
  * @since 1.0.0
163
  */
164
+ function cdp_add_new_no_intro() {
165
 
166
  // Get user id and array from db
167
  $user_id = get_current_user_id();
169
 
170
  // Check if it's first time that user checked this option.
171
  if (!$already)
172
+ $already = array($user_id);
173
 
174
  // If it already exists just add another user.
175
  else if (!in_array($user_id, $already))
176
+ array_push($already, $user_id);
177
 
178
  // If the user already exists exit.
179
+ else
180
+ exit;
181
 
182
  // Add option to datbase if not exit.
183
  $opt = update_option('_cdp_no_intro', $already);
184
+ }
185
 
186
+ /** –– * */
 
187
 
188
  /** –– **\
189
  * This function will be fired when user want to see intro – again.
190
  * @since 1.0.0
191
  */
192
+ function cdp_add_new_intro() {
193
 
194
  // Get user id and array from db
195
  $user_id = get_current_user_id();
197
 
198
  // Check if it's first time that user checked this option.
199
  if ($already && in_array($user_id, $already))
200
+ unset($already[array_search($user_id, $already, true)]);
201
 
202
  // If the user no exists exit.
203
+ else
204
+ exit;
205
 
206
  // Add option to database if not exit.
207
  $opt = update_option('_cdp_no_intro', $already);
208
+ }
209
 
210
+ /** –– * */
 
211
 
212
  /** –– **\
213
  * This function will be fired when user want to save plugin options – again.
214
  * @since 1.0.0
215
  */
216
+ function cdp_save_plugin_options($areWePro) {
217
 
218
  // Get the info about our professionalness
219
  $areWePro = $areWePro;
220
 
221
  // Get new options and current profile.
222
+ $options = ((isset($_POST['options'])) ? cdp_sanitize_array($_POST['options']) : false);
223
+ $entire = ((isset($_POST['entire'])) ? cdp_sanitize_array($_POST['entire']) : false);
224
+ $profile = ((isset($_POST['profile'])) ? sanitize_text_field($_POST['profile']) : false);
225
 
226
  // Get current options and profiles.
227
  $a_or = get_option('_cdp_profiles');
230
  $globals = get_option('_cdp_globals');
231
 
232
  // Check if it's first time – create array.
233
+ if (!is_array($already))
234
+ $already = array();
235
+ if (!is_array($globals))
236
+ $globals = array();
237
 
238
  // Add display name for this profile
239
  $profile = preg_replace('/\s+/', '_', trim(strtolower($profile)));
243
  $already[$profile]['usmplugin'] = 'false';
244
  $already[$profile]['yoast'] = 'false';
245
  $already[$profile]['woo'] = 'false';
246
+ if ($areWePro)
247
+ $already[$profile] = cdpp_filter_premium_opts($already, $options, $profile);
248
 
249
  if (!isset($already[$profile]['names']['display']) || (strlen(trim($already[$profile]['names']['display'])) <= 0))
250
+ $already[$profile]['names']['display'] = $profile;
251
  $globals = $entire;
252
 
253
  // Check if there is default profile
254
  if (!array_key_exists('default', $already) || !array_key_exists('title', $already['default'])) {
255
+ $already['default'] = array();
256
 
257
+ if (function_exists('cdp_default_options'))
258
+ $already['default'] = cdp_default_options();
259
+ if (function_exists('cdp_default_global_options'))
260
+ $globals['others'] = cdp_default_global_options();
261
  }
262
 
263
  // Add new options to database.
265
  $s2 = update_option('_cdp_profiles', $already);
266
 
267
  // Check if success while uploading
268
+ if (($s1 || $s2) || ($globals == $g_or) || ($already == $a_or))
269
+ echo 'success';
270
+ else
271
+ echo 'error';
272
+ }
273
 
274
+ /** –– * */
 
275
 
276
  /** –– **\
277
  * This function will be fired when user want to save plugin options – again.
278
  * @since 1.0.0
279
  */
280
+ function cdp_insert_new_post($areWePro = false) {
281
 
282
  // Create output array which will be returned to requester
283
  $output = array('status' => 'success');
284
 
285
  // Get ID(s) of post(s)
286
+ $ids = ((isset($_POST['id'])) ? cdp_sanitize_array($_POST['id']) : false);
287
 
288
  // Get all important pieces of information from requester
289
+ $data = ((isset($_POST['data'])) ? cdp_sanitize_array($_POST['data']) : false);
290
+ $site = isset($_POST['data']['site']) ? sanitize_text_field($_POST['data']['site']) : false;
291
+ $times = isset($_POST['data']['times']) ? sanitize_text_field($_POST['data']['times']) : 1;
292
+ $swap = isset($_POST['data']['swap']) ? sanitize_text_field($_POST['data']['swap']) : false;
293
  $profile = isset($_POST['data']['profile']) ? sanitize_text_field($_POST['data']['profile']) : 'default';
294
+ $origin = isset($_POST['origin']) ? sanitize_text_field($_POST['origin']) : false;
295
+ $custom = isset($_POST['data']['custom']) ? cdp_sanitize_array($_POST['data']['custom']) : false;
296
 
297
  // Load default options for selected profile
298
  $defaults = get_option('_cdp_profiles')[$profile];
299
 
300
  // Settings for this copy
301
+ $settings = (($data['type'] != 'copy-quick' && $custom != false) ? $custom : $defaults);
302
+ if (!isset($settings['names']))
303
+ $settings['names'] = $defaults['names'];
304
 
305
  // Convert string to boolean – only for much less code later
306
  foreach ($settings as $setting => $val)
307
+ if ($setting != 'names')
308
+ $settings[$setting] = (($val == 'true') ? true : false);
309
 
310
  /**
311
+ * This local function filters post data by user settings
312
+ * @param $post (array of wordpress post/page data)
313
+ * @param $settings (array of preselected settings of profile or by user)
314
+ * @return array with insert ready values for wordpress post || false on wrong $post
315
+ */
316
  function cdp_filter_post($post, $swap, $opt, $settings, $taxonomies = false, $areWePro) {
317
 
318
+ // If $post has wrong format return false
319
+ if (!(is_array($post) || is_object($post)))
320
+ return false;
321
+
322
+ // Array for formatted and prepared taxonomy
323
+ $ft = array();
324
+ $buin = array('link_category', 'nav_menu', 'post_tag', 'category', 'post_format');
325
+
326
+ // Loop thorugh all taxonomies from post
327
+ foreach ($taxonomies as $taxonomy) {
328
+
329
+ // Set the name to shorted variable
330
+ $tn = $taxonomy->taxonomy;
331
+
332
+ // Check if it's private taxonomy and if it's set in options
333
+ if ($tn == 'link_category' && !$settings['link_category'])
334
+ continue;
335
+ if ($tn == 'nav_menu' && !$settings['nav_menu'])
336
+ continue;
337
+ if ($tn == 'post_tag' && !$settings['post_tag'])
338
+ continue;
339
+ if ($tn == 'category' && !$settings['category'])
340
+ continue;
341
+ if ($tn == 'post_format' && !$settings['format'])
342
+ continue;
343
+
344
+ // Don't copy custom taxonomy if it's not checked
345
+ if (!in_array($tn, $buin) && !$settings['taxonomy'])
346
+ continue;
347
+
348
+ // Push next term of existing taxonomy
349
+ if (isset($ft[$tn]))
350
+ array_push($ft[$tn], $taxonomy->term_id);
351
+
352
+ // Create new taxonomy and push new term
353
+ else {
354
+ $ft[$tn] = array();
355
+ array_push($ft[$tn], $taxonomy->term_id);
356
+ }
357
+ }
358
 
359
+ // Create array with required values and contant values
360
+ $new = array(
361
+ 'post_title' => ($settings['title'] ? cdp_create_title($post['post_title'], $settings['names'], $post['ID'], $areWePro) : __('Untitled Copy', 'copy-delete-posts')),
362
+ 'post_date' => ($settings['date'] ? $post['post_date'] : current_time('mysql')),
363
+ 'post_status' => ($settings['status'] ? $post['post_status'] : 'draft'),
364
+ 'post_author' => ($settings['author'] ? $post['post_author'] : wp_get_current_user()->ID),
365
+ 'post_content' => ($settings['content']) ? $post['post_content'] : ' ',
366
+ 'comment_status' => $post['comment_status'], // that's additional element which cannot be edited by user
367
+ 'post_parent' => $post['post_parent'] // that's additional element which cannot be edited by user
368
+ );
369
 
370
+ // Converter
371
+ if ((($opt == '2' && $swap == 'true') || $swap == 'true') && $areWePro && function_exists('cdpp_post_converter'))
372
+ $new['post_type'] = cdpp_post_converter($post['post_type']);
373
+ else
374
+ $new['post_type'] = $post['post_type'];
375
+
376
+ // Add optional values of post – depending on settings
377
+ if ($settings['slug'])
378
+ $new['post_name'] = $post['post_name'];
379
+ if ($settings['excerpt'])
380
+ $new['post_excerpt'] = $post['post_excerpt'];
381
+ if ($settings['template'])
382
+ $new['page_template'] = $post['page_template'];
383
+ if ($settings['password'])
384
+ $new['post_password'] = $post['post_password'];
385
+ if ($settings['menu_order'])
386
+ $new['menu_order'] = $post['menu_order'];
387
+ if ($settings['category'])
388
+ $new['post_category'] = $post['post_category'];
389
+ if ($settings['post_tag'])
390
+ $new['tags_input'] = $post['tags_input'];
391
+ if ($taxonomies != false)
392
+ $new['tax_input'] = $ft;
393
+
394
+ // Return filtered data of current post
395
+ return $new;
396
+ }
397
 
398
+ /**
399
+ * This local function filters post data by user settings
400
+ * @param $metas (array of wordpress post/page meta data)
401
+ * @param $settings (array of preselected settings of profile or by user)
402
+ * @return array with metadata values for post || false on wrong $metas
403
+ */
404
+ function cdp_filter_meta($metas, $settings, $id, $areWePro, $site, $title) {
405
 
406
+ // If $metas has wrong format return false
407
+ if (!(is_array($metas) || is_object($metas)))
408
+ return false;
409
+
410
+ // Create empty array for filtered meta data
411
+ $prepared = array(
412
+ // Add or replace ours copy tracker
413
+ array('_cdp_origin' => $id),
414
+ array('_cdp_origin_site' => $site),
415
+ array('_cdp_origin_title' => $title),
416
+ array('_cdp_counter' => '0')
417
+ );
418
 
419
+ // Iterate through every meta index
420
+ foreach ($metas as $meta => $vals) {
421
 
422
+ // Conditions
423
+ $a = ($areWePro && function_exists('cdpp_check_yoast')) ? cdpp_check_yoast($settings, $meta) : false;
424
+ $b = ($areWePro && function_exists('cdpp_check_usm')) ? cdpp_check_usm($settings, $meta) : false;
425
+ $c = ($areWePro && function_exists('cdpp_check_woo')) ? cdpp_check_woo($settings, $meta, $id) : false;
426
+ $d = ($settings['f_image'] && $meta == '_thumbnail_id') ? true : false;
427
+ $e = (mb_substr($meta, 0, 4) == '_wp_') ? true : false;
428
+ $f = ($meta == '_thumbnail_id' && $settings['f_image']) ? true : false;
429
+ $g = ($meta == '_cdp_origin') ? true : false;
430
+ $h = (mb_substr($meta, 0, 11) == '_elementor_') ? true : false;
431
+ // $i = (isset($settings['all_metadata']) && $settings['all_metadata'] == 'true') ? true : false;
432
 
433
+ // If any of above condition is true pass the meta tag
434
+ if ($a || $b || $c || $d || $e || $f || $g || $h /*|| $i*/) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
 
436
+ // Prepare data and insert filtered to results
437
+ foreach ($vals as $val)
438
+ array_push($prepared, array($meta => $val));
439
 
440
+ } else {
 
 
 
 
 
 
441
 
442
+ // error_log(print_r($vals, true));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
+ }
445
  }
446
 
447
+ // Return results
448
+ return $prepared;
 
 
 
449
  }
450
 
451
  /**
452
+ * This local function format title by user settings
453
+ * @param $title (string)
454
+ * @param $settings (array of name settings preselected in profile)
455
+ * @return string formated title
456
+ */
457
  function cdp_create_title($title, $settings, $id, $areWePro) {
458
 
459
+ // Date formats
460
+ $date_format = intval($settings['format']);
461
 
462
+ // Get right format
463
+ if ($date_format == 1)
464
+ $date_format = 'm/d/Y';
465
+ else if ($date_format == 2)
466
+ $date_format = 'd/m/Y';
467
+ else {
468
+ if ($areWePro && function_exists('cdpp_custom_date'))
469
+ $date_format = cdpp_custom_date($settings);
470
+ else
471
+ $date_format = 'd/m/Y';
472
+ }
 
 
473
 
474
+ // Create date and time replacements
475
+ $curr = current_time('timestamp', true);
476
+ $date = date($date_format, $curr);
477
+ $time = date('H:i:s', $curr);
478
 
479
+ // Concat whole title with prefix and suffix
480
+ $new_title = $settings['prefix'] . ' ' . $title . ' ' . $settings['suffix'];
 
481
 
482
+ // Make replace of placeholders
483
+ $new_title = str_replace('[CurrentDate]', $date, $new_title);
484
+ $new_title = str_replace('[CurrentTime]', $time, $new_title);
485
 
486
+ // Return formatted title
487
+ return $new_title;
488
  }
489
 
490
  /**
491
+ * This local function inserts whole post into database
492
+ * @param $data (array prepared by cdp_filter_post function)
493
+ * @param $times (int how many times should this function copy post)
494
+ * @return array of new inserted post(s) and error status
495
+ * Structure of return array: { ids: [$ids], error: (count of errors) }
496
+ */
497
  function cdp_insert_post($id, $data, $times, $areWePro, $isChild = false, $p_ids = null, $site) {
498
 
499
+ // Get Wordpress database
500
+ global $wpdb;
 
 
 
501
 
502
+ // Create empty array for new id(s) and error(s)
503
+ $results = array('ids' => array(), 'error' => 0, 'counter' => 0);
 
 
 
 
 
504
 
505
+ // Get Counter value
506
+ $prefix = (($site != -1) ? $wpdb->get_blog_prefix($site) : $wpdb->get_blog_prefix());
507
+ $newestId = $wpdb->get_results("SELECT post_id FROM {$prefix}postmeta WHERE meta_key = '_cdp_origin' AND meta_value = {$id} ORDER BY post_id DESC LIMIT 1", ARRAY_A);
508
+ $newestId = ((array_key_exists(0, $newestId)) ? (intval($newestId[0]['post_id'])) : false);
509
+ if (isset($newestId) && $newestId != false && $newestId > 0)
510
+ $counter = $wpdb->get_results("SELECT meta_value AS 'Counter' FROM {$prefix}postmeta WHERE meta_key = '_cdp_counter' AND post_id = {$newestId} ORDER BY post_id DESC", ARRAY_A)[0]['Counter'];
511
+ else
512
+ $counter = 1;
513
 
514
+ $base_title = $data['post_title'];
515
+ $counter = intval($counter) + 1;
 
516
 
517
+ // Handle multisite for premium
518
+ if ($areWePro && function_exists('cdpp_handle_multisite'))
519
+ cdpp_handle_multisite($site);
 
 
520
 
521
+ // Loop for each post iteration
522
+ for ($i = 0; $i < $times; ++$i) {
523
 
524
+ // Change parent if it's child
525
+ if ($isChild)
526
+ $data['post_parent'] = $p_ids['posts'][$i];
527
 
528
+ // Replace title with Counter if multiple copies
529
+ $data['post_title'] = str_replace('[Counter]', ($counter + $i), $base_title);
 
530
 
531
+ // Insert post with filtered data
532
+ $new = wp_insert_post($data, true);
533
 
534
+ // Check if the post is inserted successfully and append array
535
+ if (is_numeric($new))
536
+ array_push($results['ids'], $new);
537
+ else
538
+ $results['error'] ++;
539
+ }
540
 
541
+ // Handle multisite for premium fix
542
+ if ($areWePro && function_exists('cdpp_handle_multisite_after'))
543
+ cdpp_handle_multisite_after($site);
544
 
545
+ // Set first counter number for future
546
+ $results['counter'] = $counter;
547
 
548
+ // Return array with results
549
+ return $results;
550
  }
551
 
552
  /**
553
+ * This local function filter and adds missing meta to added post
554
+ * @param $ids (array of post ids)
555
+ * @param $metas (filtered meta data with cdp_filter_meta function)
556
+ * @return array structure below
557
+ * { ids: { [id] => [failed times]}, error: { [id] => [failed times]} }
558
+ */
559
  function cdp_insert_post_meta($ids, $metas, $areWePro, $counter, $site) {
560
 
561
+ // Handle multisite for premium
562
+ if ($areWePro && function_exists('cdpp_handle_multisite'))
563
+ cdpp_handle_multisite($site);
564
+
565
+ // Create empty array for new id(s) and error(s)
566
+ $results = array('ids' => array(), 'error' => array());
567
+
568
+ // Iterate through every inserted post
569
+ foreach ($ids as $id) {
570
+
571
+ // Iterate through every meta tag
572
+ foreach ($metas as $meta_id => $meta) {
573
+
574
+ // Get individual data from metas array
575
+ foreach ($meta as $key => $val) {
576
+
577
+ // Replace the counter with dynamic value
578
+ if ($key == '_cdp_counter')
579
+ $val = $counter;
580
+
581
+ // Insert meta tag
582
+ $res = add_post_meta($id, $key, $val);
583
+
584
+ // Check if the insert was successfull
585
+ if ($res != false) {
586
+ if (!isset($results['ids'][$id]))
587
+ $results['ids'][$id] = [];
588
+ array_push($results['ids'][$id], array($key, $val));
589
+ } else {
590
+ if (!isset($results['error'][$id]))
591
+ $results['error'][$id] = [];
592
+ array_push($results['error'][$id], array($key, $val));
593
+ }
594
+ }
595
  }
596
 
597
+ // Iterate the counter
598
+ $counter++;
599
  }
600
 
601
+ // Fix multisite handler
602
+ if ($areWePro && function_exists('cdpp_handle_multisite_after'))
603
+ cdpp_handle_multisite_after($site);
 
 
 
 
 
 
 
 
604
 
605
+ // Return the results
606
+ return $results;
607
  }
608
 
609
  /**
610
+ * This local function search for childs and catch their IDs
611
+ * @param $id string/int (post id)
612
+ * @return array of child(s) ID(s)
613
+ */
614
  function cdp_check_childs($id) {
615
+ $childs = [];
616
+ $childrens = get_children(array('post_parent' => $id));
617
 
618
+ foreach ($childrens as $i => $child)
619
+ array_push($childs, $child->ID);
620
 
621
+ return $childs;
622
  }
623
 
624
  /**
625
+ * This local function copies original attachments
626
+ * @param $path string (path to original file)
627
+ * @return string path to new file
628
+ */
629
  function cdp_copy_attachment($path = '', $destination) {
630
+ if ($path == '')
631
+ return false;
632
+
633
+ $dirname = $destination;
634
+ $name = basename($path);
635
+ $actual_name = pathinfo($name, PATHINFO_FILENAME);
636
+ $original_name = $actual_name;
637
+ $extension = pathinfo($name, PATHINFO_EXTENSION);
638
+
639
+ $i = 1;
640
+ while (file_exists($dirname . '/' . $actual_name . "." . $extension)) {
641
+ $actual_name = (string) $original_name . '-' . $i;
642
+ $name = $actual_name . '.' . $extension;
643
+ $i++;
644
+ }
645
+
646
+ copy($path, $dirname . '/' . $name);
647
+ return $dirname . '/' . $name;
648
  }
649
 
650
  /**
651
+ * This local function gets copy and insert attachments
652
+ * @param $id int/string of post
653
+ * @return array of inserted attachments
654
+ */
655
  function cdp_insert_attachments($id, $inserted_posts, $areWePro, $site) {
656
+ $inserts = array();
657
+ $media = get_attached_media('', $id);
658
 
659
+ // Handle multisite for premium
660
+ if ($areWePro && function_exists('cdpp_handle_multisite'))
661
+ cdpp_handle_multisite($site);
662
 
663
+ // Fix wordpress multisite path
664
+ add_filter('upload_dir', 'cdp_fix_upload_paths');
665
+ $wp_upload_dir = wp_upload_dir();
666
+ remove_filter('upload_dir', 'cdp_fix_upload_paths');
667
 
668
+ // Handle multisite for premium fix
669
+ if ($areWePro && function_exists('cdpp_handle_multisite_after'))
670
+ cdpp_handle_multisite_after($site);
671
 
672
+ foreach ($media as $i => $m) {
673
+ if (get_attached_file($m->ID) == '')
674
+ continue;
675
+ $path = cdp_copy_attachment(get_attached_file($m->ID), $wp_upload_dir['path']);
676
 
677
+ $filename = $path;
678
+ $parent_post_id = $inserted_posts['ids'][0];
679
 
680
+ $filetype = wp_check_filetype(basename($filename), null);
681
 
682
+ // Handle multisite for premium
683
+ if ($areWePro && function_exists('cdpp_handle_multisite'))
684
+ cdpp_handle_multisite($site);
 
 
 
 
 
 
 
 
685
 
686
+ $attachment = array(
687
+ 'guid' => $wp_upload_dir['url'] . '/' . basename($filename),
688
+ 'post_mime_type' => $filetype['type'],
689
+ 'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),
690
+ 'post_content' => '',
691
+ 'post_status' => 'inherit'
692
+ );
693
 
694
+ $attach_id = wp_insert_attachment($attachment, $filename, $parent_post_id);
695
+ array_push($inserts, array('url' => wp_get_attachment_url($attach_id), 'id' => $attach_id));
696
 
697
+ $attach_data = wp_generate_attachment_metadata($attach_id, $filename);
698
+ wp_update_attachment_metadata($attach_id, $attach_data);
699
+
700
+ // Handle multisite for premium fix
701
+ if ($areWePro && function_exists('cdpp_handle_multisite_after'))
702
+ cdpp_handle_multisite_after($site);
703
+ }
704
 
705
+ return $inserts;
706
  }
707
 
708
  /**
709
+ * This local function gets comments and copy them
710
+ * @param $id int/string of base post
711
+ * @param $dests array of post ids where the comms from $id should be copied
712
+ * @return array of inserted comments
713
+ */
714
  function cdp_copy_comments($id, $dests) {
715
+ $comments = get_comments(array('post_id' => $id));
716
+ $curr = current_time('mysql');
717
+ $all_inserts = array();
718
+ $all_inserts['fix_try'] = array();
719
+ $all_inserts['olds'] = '';
720
+
721
+ foreach ($dests as $dest) {
722
+ $p = 0;
723
+ $olds = array();
724
+
725
+ $cm1 = $comments;
726
+ foreach ($cm1 as $i => $c) {
727
+ $c = $c->to_array();
728
+ $old_id = $c['comment_ID'];
729
+ $parent = $c['comment_parent'];
730
+
731
+ $c['comment_date'] = $curr;
732
+ $c['comment_date_gmt'] = $curr;
733
+ $c['comment_post_ID'] = $dest;
734
+ $c['comment_parent'] = 0;
735
+ if ($parent != "0")
736
+ $p++;
737
+
738
+ $new_id = @wp_insert_comment($c);
739
+
740
+ $olds[$old_id] = array('new' => $new_id, 'old_parent_id' => $parent);
741
+ array_push($all_inserts, array('old' => $old_id, 'new' => $new_id, 'parent' => $parent));
742
+ }
743
 
744
+ if ($p != 0) {
745
+ $cm2 = $comments;
746
+ foreach ($cm2 as $j => $m) {
747
+ if ($m->comment_parent != "0" && $olds[$m->comment_ID]['old_parent_id'] == $m->comment_parent) {
748
+ $post = get_comment($olds[$m->comment_ID]['new']);
749
+ $post = $post->to_array();
750
+ $post['comment_parent'] = $olds[$m->comment_parent]['new'];
751
+ wp_update_comment($post);
752
+ }
753
+ }
754
  }
 
755
  }
756
 
757
+ return $all_inserts;
 
 
758
  }
759
 
760
  // Main code for this duplication – for each id (post) do whole process
761
  function cdp_process_ids($ids, $swap, $settings, $times, $site, $areWePro, $g, $isChild = false, $p_ids = null) {
762
 
763
+ // Make it clear
764
+ $globals = cdp_default_global_options();
765
+ if ($g != false)
766
+ $globals = $g;
767
+ $g = $globals['others'];
768
+
769
+ // Return data storage
770
+ $output = [];
771
+ $new_posts = array('parents' => array(), 'childs' => array(), 'ids' => array());
772
+
773
+ // Iterate each id
774
+ foreach ($ids as $id) {
775
+
776
+ // Get post data and meta data
777
+ $post = get_post($id)->to_array();
778
+ $meta = get_post_custom($id);
779
+ $taxonomies = wp_get_object_terms($id, get_taxonomies());
780
+
781
+ // Check if this post type is allowed to copy
782
+ $type = $post['post_type'];
783
+ if ($g['cdp-content-pages'] == 'false' && $type == 'page')
784
+ continue;
785
+ if ($g['cdp-content-posts'] == 'false' && $type == 'post')
786
+ continue;
787
+ if ($g['cdp-content-custom'] == 'false' && ($type != 'page' && $type != 'post'))
788
+ continue;
789
+
790
+ // Post converting?
791
+ $pConv = false;
792
+ if (array_key_exists('postConverter', $globals))
793
+ $pConv = $globals['postConverter'];
794
+
795
+ // Run process and validate response
796
+ $childrens = cdp_check_childs($id); // if sizeof($this) == has childs
797
+ $post_data = cdp_filter_post($post, $swap, $pConv, $settings, $taxonomies, $areWePro, $swap); // can be false
798
+ $meta_data = cdp_filter_meta($meta, $settings, $id, $areWePro, $site, $post_data['post_title']); // can be false
799
+ $inserted_posts = cdp_insert_post($id, $post_data, $times, $areWePro, $isChild, $p_ids, $site); // $res['error'] must be == 0
800
+ $inserted_metas = cdp_insert_post_meta($inserted_posts['ids'], $meta_data, $areWePro, $inserted_posts['counter'], $site); // sizeof($res['error']) must be == 0
801
+ // Comments copy
802
+ if ($settings['comments'])
803
+ $inserted_comments = cdp_copy_comments($id, $inserted_posts['ids']);
804
+ $cms = get_comments(array('post_id' => $id));
805
+
806
+ // Post format
807
+ if ($settings['format'])
808
+ foreach ($inserted_posts['ids'] as $i => $tid)
809
+ $isReFormat = set_post_format($tid, get_post_format($id));
810
+
811
+ // Featured image copy
812
+ if ($settings['attachments'])
813
+ $inserted_attachments = cdp_insert_attachments($id, $inserted_posts, $areWePro, $site);
814
+ else
815
+ $inserted_attachments = false;
816
+
817
+ // Copy childrens recursively if exist
818
+ if ($settings['children'] && sizeof($childrens) > 0) {
819
+ $child_helpers = array('posts' => $inserted_posts['ids']);
820
+ $inserted_childs = cdp_process_ids($childrens, $swap, $settings, $times, $site, $areWePro, $globals, true, $child_helpers);
821
+ array_push($new_posts['childs'], array($id => $inserted_childs['$new_posts']['ids']));
822
+ }
823
 
824
+ // Add new inserted IDs
825
+ foreach ($inserted_posts['ids'] as $i_id)
826
+ array_push($new_posts['parents'], $i_id);
827
 
828
+ // Merge for easier read
829
+ $new_posts['ids'] = array_merge($new_posts['ids'], $new_posts['parents'], $new_posts['childs']);
830
+ }
831
 
832
+ // Return all data to main request
833
+ return array('$output' => $output, '$new_posts' => $new_posts);
834
  }
835
 
836
  // Run the machine for selected post(s)
839
 
840
  // Handle multisite for premium
841
  if ($areWePro && function_exists('cdpp_handle_multisite'))
842
+ cdpp_handle_multisite($site);
843
 
844
  $pConv = false;
845
  if (array_key_exists('postConverter', $g) && $areWePro)
846
+ $pConv = (($g['postConverter'] === '2' || $g['postConverter'] === 2) ? true : false);
847
 
848
  // Output link if it's edited post
849
+ $aCop = ((array_key_exists('afterCopy', $g)) ? $g['afterCopy'] : '1');
850
  if (($data['type'] == 'copy-custom-link' || $aCop == '2'))
851
+ $output['link'] = get_edit_post_link($new_insertions['$new_posts']['parents'][0], 'x');
852
 
853
+ if ($pConv == true && !($data['type'] == 'copy-custom-link' || $aCop == '2'))
854
+ $output['link'] = 'pConv';
855
+ else
856
+ update_option('_cdp_show_copy', true);
857
 
858
  // Handle multisite for premium fix
859
  if ($areWePro && function_exists('cdpp_handle_multisite_after'))
860
+ cdpp_handle_multisite_after($site);
861
 
862
  echo json_encode(cdp_sanitize_array($output));
863
+ }
864
+
865
+ /** –– * */
866
 
867
  /** –– **\
868
  * This function will return profile information for presets.
869
  * @return object of settings by requested profile
870
  * @since 1.0.0
871
  */
872
+ function cdp_get_profile() {
873
 
874
+ if (function_exists('cdpp_get_all_profiles'))
875
+ cdpp_get_profile();
876
  else {
877
 
878
+ // Search for the settings of profile
879
+ $settings = get_option('_cdp_profiles')['default'];
 
 
 
880
 
881
+ // Display those settings
882
+ echo json_encode(cdp_sanitize_array($settings));
883
  }
884
+ }
885
 
886
+ /** –– * */
 
887
 
888
  /** –– **\
889
  * This function will return all profile information for manager.
890
  * @return object of settings by requested profile
891
  * @since 1.0.0
892
  */
893
+ function cdp_get_all_profiles() {
894
 
895
+ if (function_exists('cdpp_get_all_profiles'))
896
+ cdpp_get_all_profiles();
897
+ else
898
+ cdp_get_profile();
899
+ }
900
 
901
+ /** –– * */
 
902
 
903
  /** –– **\
904
  * This function will return all not trashed posts
905
  * @return object of posts and success or fail message
906
  */
907
+ function cdp_get_all_posts() {
908
  $output = array();
909
 
910
  $args = array(
911
+ 'numberposts' => -1,
912
+ 'post_type' => 'post',
913
+ 'post_status' => 'publish,private,draft,future,pending,inherit,sticky'
914
  );
915
 
916
  $output['posts'] = get_posts($args);
921
  $post_types = get_post_types(array('public' => true, '_builtin' => false));
922
 
923
  if (sizeof($post_types) > 0)
924
+ $output['custom'] = get_posts(array(
925
+ 'post_type' => $post_types,
926
+ 'numberposts' => -1,
927
+ 'post_status' => 'publish,private,draft,future,pending,inherit,sticky'
928
+ ));
929
 
930
  $output['meta'] = array();
931
+ foreach ($output['posts'] as $k => $p)
932
+ $output['meta'][$p->ID] = get_post_meta($p->ID);
933
+ foreach ($output['pages'] as $k => $p)
934
+ $output['meta'][$p->ID] = get_post_meta($p->ID);
935
+ foreach ($output['custom'] as $k => $p)
936
+ $output['meta'][$p->ID] = get_post_meta($p->ID);
937
 
938
  echo json_encode(cdp_sanitize_array($output));
939
+ }
940
+
941
+ /** –– * */
942
 
943
  /** –– **\
944
  * This function will delete all posts in array PERMANENTLY!
945
  * @return object of success message or error
946
  */
947
+ function cdp_delete_posts() {
948
+ $ids = ((isset($_POST['ids'])) ? cdp_sanitize_array($_POST['ids']) : false); // ids to delete
949
  $throttling = sanitize_text_field($_POST['throttling']); // throttling if enabeld
950
+ $thc = sanitize_text_field($_POST['thc']); // throttling count if enabeld
951
+ $thrs = sanitize_text_field($_POST['thrs']) == 'true' ? true : false; // trash or not?
952
+ $redi = sanitize_text_field($_POST['redi']) == 'true' ? true : false; // redirect if enabled
953
+ $auit = sanitize_text_field($_POST['auit']) == 'true' ? true : false; // auit if enabled
954
+ $auitd = ((isset($_POST['auitd'])) ? cdp_sanitize_array($_POST['auitd']) : false); // auitd if auit enabled
955
+
956
+ $prepared_ids = array();
957
+ $inGroup = 0;
958
+ $curr = current_time('timestamp');
959
+ $token = uniqid($curr, true);
960
  $cdp_cron = get_option('_cdp_crons');
961
  $site = is_multisite() ? get_current_blog_id() : '-1';
962
+ if ($cdp_cron == false)
963
+ $cdp_cron = array();
964
  $cdp_cron[$token] = array(
965
+ 'start' => $curr,
966
+ 'ids' => $ids,
967
+ 'done' => false,
968
+ 'shown' => false,
969
+ 'f' => 'delete',
970
+ 'del_size' => sizeof($ids),
971
+ 'handler' => 'cdp_cron_delete',
972
+ 'auit' => $auit,
973
+ 'auitd' => $auitd
974
  );
975
  $cdp_cron[$token]['tasks'] = array();
976
  $cdp_cron[$token]['args'] = array();
977
 
978
  if ($throttling == '1' && $thc && intval($thc) >= 1 && intval($thc) <= 10240) {
979
 
980
+ $inGroup = ceil(intval($thc) / 30);
981
 
982
+ for ($i = 0, $k = 2; $i < sizeof($ids); $i = $i + $inGroup, $k++)
983
+ $cdp_cron[$token]['tasks']["-$k"] = false;
984
 
985
+ update_option('_cdp_crons', $cdp_cron);
986
+ for ($i = 0, $k = 2; $i < sizeof($ids); $i = $i + $inGroup, $k++) {
987
+ $tg = array();
988
+ $tt = array('tsk' => "-" . $k, 'token' => $token);
989
 
990
+ for ($j = $i; $j < ($i + $inGroup); $j++)
991
+ if (isset($ids[$j]))
992
+ array_push($tg, $ids[$j]);
 
 
 
 
 
993
 
994
+ array_push($prepared_ids, $tg);
995
+ $time = $k * 2;
996
+ $args = array(array('ids' => $tg, 'site' => $site, 'trash' => $thrs, 'token' => $tt));
997
+ wp_schedule_single_event(strtotime("+$time seconds"), 'cdp_cron_delete', $args);
998
+ array_push($cdp_cron[$token]['args'], $args);
999
+ }
1000
  } else {
1001
 
1002
+ $cdp_cron[$token]['tasks']["-0"] = false;
1003
+ update_option('_cdp_crons', $cdp_cron);
1004
+ $tt = array('tsk' => "-0", 'token' => $token);
1005
+ $args = array(array('ids' => $ids, 'site' => $site, 'trash' => $thrs, 'token' => $tt));
1006
+ wp_schedule_single_event(strtotime('+2 seconds'), 'cdp_cron_delete', $args);
1007
+ array_push($cdp_cron[$token]['args'], $args);
 
1008
  }
1009
 
1010
  echo json_encode(array('status' => 'success', 'token' => cdp_sanitize_array($token)));
1011
+ }
1012
+
1013
+ /** –– * */
1014
 
1015
  /** –– **\
1016
  * This function will delete all posts in array PERMANENTLY!
1017
  * @return object of success message or error
1018
  */
1019
+ function cdp_clear_all_crons() {
1020
  $cdp_cron = get_option('_cdp_crons');
1021
 
1022
  foreach ($cdp_cron as $cron => $val) {
1023
+ if (array_key_exists('done', $val)) {
1024
+ if ($val['done'] != true) {
1025
+ echo json_encode(array(
1026
+ 'status' => 'fail',
1027
+ 'type' => 'warning',
1028
+ 'msg' => __('You can\'t clear messages when tasks are in progress, please firstly kill tasks or wait till the end.', 'copy-delete-posts')
1029
+ ));
1030
+ return;
1031
+ }
1032
  }
 
1033
  }
1034
 
1035
  $cdp_cron = delete_option('_cdp_crons');
1036
  echo json_encode(array('status' => 'success'));
1037
+ }
1038
+
1039
+ /** –– * */
1040
 
1041
  /** –– **\
1042
  * Local function which sets default profile for user
1043
  * @return Boolean
1044
  */
1045
+ function cdp_set_default_profile() {
1046
  $curr = get_option('_cdp_preselections');
1047
  $id = get_current_user_id();
1048
  $new = array();
1049
+ $selection = ((isset($_POST['selection'])) ? cdp_sanitize_array($_POST['selection']) : false);
1050
+ if ($curr && !is_object($curr) || $curr == false)
1051
+ $new = array($id => $selection);
1052
+ else {
1053
+ $new = $curr;
1054
+ $new[$id] = $selection;
1055
+ }
1056
  $stat = update_option('_cdp_preselections', $new);
1057
  echo cdp_sanitize_array($stat);
1058
+ }
1059
+
1060
+ /** –– * */
1061
 
1062
  /** –– **\
1063
+ * Local function which gets default profile for user
1064
+ * @return String
1065
+ */
1066
+ function cdp_get_default_profile() {
1067
  echo(esc_html(get_option('_cdp_preselections')[get_current_user_id()]));
1068
+ }
1069
+
1070
+ /** –– * */
1071
 
1072
  /** –– **\
1073
  * This function will set as seen notification!
1074
  * @return object of success message — WARNING: ALWAYS
1075
  */
1076
+ function cdp_set_noti_as_seen() {
1077
+ if (wp_doing_cron())
1078
+ return;
1079
 
1080
+ $token = ((isset($_POST['noti_token'])) ? sanitize_text_field($_POST['noti_token']) : false);
1081
  $cdp_cron = get_option('_cdp_crons', array());
1082
  $cdp_cron[$token]['shown'] = true;
1083
  update_option('_cdp_crons', $cdp_cron);
1084
 
1085
  echo json_encode(array('status' => 'success'));
1086
+ }
1087
+
1088
+ /** –– * */
1089
 
1090
  /** –– **\
1091
  * This function will delete task from the history!
1092
  * @return object of success message or fail
1093
  */
1094
+ function cdp_just_hide_task() {
1095
+ $token = ((isset($_POST['task'])) ? sanitize_text_field($_POST['task']) : false);
1096
  $cdp_cron = get_option('_cdp_crons', array());
1097
  unset($cdp_cron[$token]);
1098
  $res = update_option('_cdp_crons', $cdp_cron);
1099
 
1100
+ if ($res)
1101
+ echo json_encode(array('status' => 'success'));
1102
+ else
1103
+ echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => __('We can\'t hide this task now, – maybe it\'t already hidden. Please try again later.', 'copy-delete-posts')));
1104
+ }
1105
+
1106
+ /** –– * */
1107
 
1108
  /** –– **\
1109
  * This function will kill task from the cron!
1110
  * @return object of success message or fail
1111
  */
1112
+ function cdp_just_kill_task() {
1113
+ $token = ((isset($_POST['task'])) ? sanitize_text_field($_POST['task']) : false);
1114
  $cdp_cron = get_option('_cdp_crons', array());
1115
  $handler = $cdp_cron[$token]['handler'];
1116
+ $args = (array_key_exists('args', $cdp_cron[$token]) ? $cdp_cron[$token]['args'] : array());
1117
 
1118
  if ($cdp_cron[$token]['done'] != false) {
1119
+ echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => __('This task has already ended this work, please wait for list refresh and try again.', 'copy-delete-posts')));
1120
+ return;
1121
  }
1122
 
1123
+ $status = true;
1124
+ $res = false;
1125
  foreach ($args as $arg => $val) {
1126
+ $sres = wp_clear_scheduled_hook($handler, $val);
1127
+ if ($sres == false)
1128
+ $status = false;
1129
  }
1130
 
1131
+ if ($cdp_cron[$token]['done'] != false)
1132
+ $status = true;
1133
 
1134
  if ($status == true) {
1135
+ unset($cdp_cron[$token]);
1136
+ $res = update_option('_cdp_crons', $cdp_cron);
1137
  }
1138
 
1139
+ if ($status || $res)
1140
+ echo json_encode(array('status' => 'success'));
1141
+ else
1142
+ echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => __('We can\'t confirm that we killed this task now, please try again later or check if it\'t killed.', 'copy-delete-posts')));
1143
+ }
1144
+
1145
+ /** –– * */
1146
 
1147
  /** –– **\
1148
  * This function will catch current cron tasks!
1149
  * @return object of tasks or fail
1150
  */
1151
+ function cdp_just_get_tasks() {
1152
  $cdp_cron = get_option('_cdp_crons', false);
1153
 
1154
+ if ($cdp_cron)
1155
+ echo json_encode(array('status' => 'success', 'tasks' => cdp_sanitize_array($cdp_cron)));
1156
+ else
1157
+ echo json_encode(array('status' => 'fail', 'type' => 'error', 'msg' => __('We couldn\'t catch current tasks, please try again later.', 'copy-delete-posts')));
1158
+ }
1159
+
1160
+ /** –– * */
1161
 
1162
  /** –– **\
1163
  * This function is just for debug have fun with it!
1165
  * It won't work in production mode so dont even try it, if you're not me ~ Mikołaj :P
1166
  * @return mixed
1167
  */
1168
+ function cdp_debug_function() {
1169
 
1170
  // require_once('C:/Developer/Web/wordpress/wp-content/plugins/copy-delete-posts-premium/classes/methods.php');
1171
  // $settings = get_option('cdpp_aci_settings', false);
1175
 
1176
  $cdp_cron = get_option('_cdp_crons', false);
1177
  $things_to_debug = array(
1178
+ '$cdp_cron' => $cdp_cron
1179
  );
1180
  var_export($things_to_debug);
1181
+ }
1182
 
 
1183
  /** –– **/
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: CopyDeletePosts, copydelete
3
  Tags: Duplicate post, Copy posts, Copy pages, Duplicate posts, Duplicate pages, Clone posts, Clone pages, Delete posts, Delete pages, Duplicator, copy post, copy page
4
  Requires at least: 4.6
5
  Tested up to: 5.8
6
- Stable tag: 1.1.7
7
  License: GPLv3
8
  Requires PHP: 5.6
9
 
@@ -88,6 +88,7 @@ Just try it out! You'll love it :)
88
 
89
  This plugin is part of the Inisev product family - [check out our other products](https://inisev.com).
90
 
 
91
  == Installation ==
92
 
93
  = Admin Installer via search =
@@ -150,6 +151,12 @@ Copy Delete Posts WordPress plugin doesn’t store any site visitor information
150
 
151
  == Changelog ==
152
 
 
 
 
 
 
 
153
  = 1.1.7 =
154
  * Banner fixes
155
 
@@ -236,5 +243,8 @@ Copy Delete Posts WordPress plugin doesn’t store any site visitor information
236
  * Initial release
237
 
238
  == Upgrade Notice ==
239
- = 1.1.7 =
240
- * Banner fixes
 
 
 
3
  Tags: Duplicate post, Copy posts, Copy pages, Duplicate posts, Duplicate pages, Clone posts, Clone pages, Delete posts, Delete pages, Duplicator, copy post, copy page
4
  Requires at least: 4.6
5
  Tested up to: 5.8
6
+ Stable tag: 1.1.8
7
  License: GPLv3
8
  Requires PHP: 5.6
9
 
88
 
89
  This plugin is part of the Inisev product family - [check out our other products](https://inisev.com).
90
 
91
+
92
  == Installation ==
93
 
94
  = Admin Installer via search =
151
 
152
  == Changelog ==
153
 
154
+ = 1.1.8 =
155
+ * Performance adjustements for PHP 8
156
+ * Plugin prepared for translation
157
+ * Improvements for ACF plugin kind
158
+ * Fixed activation/deactivation issues for Pro
159
+
160
  = 1.1.7 =
161
  * Banner fixes
162
 
243
  * Initial release
244
 
245
  == Upgrade Notice ==
246
+ = 1.1.8 =
247
+ * Performance adjustements for PHP 8
248
+ * Plugin prepared for translation
249
+ * Improvements for ACF plugin kind
250
+ * Fixed activation/deactivation issues for Pro