ThemeGrill Demo Importer - Version 1.6.4

Version Description

  • 04-06-2020 =
  • Fix - WooCommerce Setup Wizard disabled when the plugin is active.
  • Fix - Live Preview button link on successful demo import message in WordPress multisite install.
  • Tweak - Add admin notice for Plugin Review.
  • Tweak - Add admin notice for Plugin Deactivate if demo is already imported in their site.
  • Tweak - Add refresh demo lists feature.
  • Tweak - Add feature to restrict demo import process for specific demos to fix unwanted issues for unsupported demos.
  • Deprecate - Upgrade to Pro admin notice.
Download this release

Release Info

Developer themegrilldev
Plugin Icon 128x128 ThemeGrill Demo Importer
Version 1.6.4
Comparing to
See all releases

Code changes from version 1.6.3 to 1.6.4

assets/js/admin/demo-importer.min.js CHANGED
@@ -1 +1 @@
1
- window.wp=window.wp||{},function(d){var a,i;(a=wp.demos=wp.demos||{}).data=_demoImporterSettings,i=a.data.l10n,a.isNew=!!a.data.settings.isNew,_.extend(a,{model:{},view:{},routes:{},router:{},template:wp.template}),a.Model=Backbone.Model.extend({initialize:function(){var e;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),a.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:d(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:a.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new a.view.Demos({collection:this.collection,parent:this}),this.search(),this.$el.removeClass("search-loading"),this.view.render(),this.$el.empty().append(this.view.el).addClass("rendered")},searchContainer:d(".search-form"),search:function(){var e;1!==a.data.demos.length&&(e=new this.SearchView({collection:this.collection,parent:this}),(this.SearchView=e).render(),this.searchContainer.append(d.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+i.search+"</label>")).append(e.el).on("submit",function(e){e.preventDefault()}))},scroller:function(){var e,t=this;this.window.scrollTop(),t.window.height(),e=t.$el.offset().top+t.$el.outerHeight(!1)-t.window.height(),e=Math.round(.9*e)}}),a.Collection=Backbone.Collection.extend({model:a.Model,terms:"",doSearch:function(e){this.terms!==e&&(this.terms=e,0<this.terms.length&&this.search(this.terms),""===this.terms&&(this.reset(a.data.demos),d("body").removeClass("no-results")),this.trigger("demos:update"))},search:function(t){var i,e,o,s,r,n;this.reset(a.data.demos,{silent:!0}),t=(t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\amp;")).replace(/ /g,")(?=.*"),i=new RegExp("^(?=.*"+t+").+","i"),0===(e=this.filter(function(e){return s=e.get("name").replace(/(<([^>]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),n=e.get("author").replace(/(<([^>]+)>)/gi,""),o=_.union([s,e.get("id"),r,n,e.get("tags")]),i.test(e.get("author"))&&2<t.length&&e.set("displayAuthor",!0),i.test(o)})).length?this.trigger("query:empty"):d("body").removeClass("no-results"),this.reset(e)},paginate:function(e){return 0,this},count:!1,query:function(t){var e,i,o,s=this.queries,r=this;if(this.currentQuery.request=t,e=_.find(s,function(e){return _.isEqual(e.request,t)}),(i=_.has(t,"page"))||(this.currentQuery.page=1),e||i){if(i)return this.apiCall(t,i).done(function(e){r.add(e.demos),r.trigger("query:success"),r.loadingDemos=!1}).fail(function(){r.trigger("query:fail")});0===e.demos.length?r.trigger("query:empty"):d("body").removeClass("no-results"),_.isNumber(e.total)&&(this.count=e.total),this.reset(e.demos),e.total||(this.count=this.length),this.trigger("demos:update"),this.trigger("query:success",this.count)}else e=this.apiCall(t).done(function(e){e.demos&&(r.reset(e.demos),o=e.info.results,s.push({demos:e.demos,request:t,total:o})),r.trigger("demos:update"),r.trigger("query:success",o),e.demos&&0===e.demos.length&&r.trigger("query:empty")}).fail(function(){r.trigger("query:fail")})},queries:[],currentQuery:{page:1,request:{}},apiCall:function(e,t){return wp.ajax.send("query-demos",{data:{request:_.extend({per_page:100},e)},beforeSend:function(){t||d("body").addClass("loading-content").removeClass("no-results")}})},loadingDemos:!1}),a.view.Demo=wp.Backbone.View.extend({className:"theme",state:"grid",html:a.template("demo"),events:{click:"preview",keydown:"preview",touchend:"preview",keyup:"addFocus",touchmove:"preventExpand","click .demo-import":"importDemo"},touchDrag:!1,initialize:function(){this.model.on("change",this.render,this)},render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name","data-slug":e.id}),this.activeDemo(),this.model.get("displayAuthor")&&this.$el.addClass("display-author")},activeDemo:function(){this.model.get("active")&&this.$el.addClass("active")},addFocus:function(){var e=d(":focus").hasClass("theme")?d(":focus"):d(":focus").parents(".theme");d(".theme.focus").removeClass("focus"),e.addClass("focus")},preventExpand:function(){this.touchDrag=!0},preview:function(e){var t,i,o=this;if(e=e||window.event,!0===this.touchDrag)return this.touchDrag=!1;d(e.target).not(".install-demo-preview").parents(".theme-actions").length||"keydown"===e.type&&13!==e.which&&32!==e.which||"keydown"===e.type&&13!==e.which&&d(":focus").hasClass("button")||(e.preventDefault(),e=e||window.event,a.focusedDemo=this.$el,a.preview=i=new a.view.Preview({model:this.model}),i.render(),this.setNavButtonsState(),1===this.model.collection.length?i.$el.addClass("no-navigation"):i.$el.removeClass("no-navigation"),d("div.wrap").append(i.el),this.listenTo(i,"demo:next",function(){if(t=o.model,_.isUndefined(o.current)||(t=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(t)+1),_.isUndefined(o.current))return o.options.parent.parent.trigger("demo:end"),o.current=t;i.model=o.current,i.render(),this.setNavButtonsState(),d(".next-theme").focus()}).listenTo(i,"demo:previous",function(){t=o.model,0!==o.model.collection.indexOf(o.current)&&(_.isUndefined(o.current)||(t=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(t)-1),_.isUndefined(o.current)||(i.model=o.current,i.render(),this.setNavButtonsState(),d(".previous-theme").focus()))}),this.listenTo(i,"preview:close",function(){o.current=o.model}))},setNavButtonsState:function(){var e=d(".theme-install-overlay"),t=_.isUndefined(this.current)?this.model:this.current,i=e.find(".previous-theme"),o=e.find(".next-theme");0===this.model.collection.indexOf(t)&&(i.addClass("disabled").prop("disabled",!0),o.focus()),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(t)+1))&&(o.addClass("disabled").prop("disabled",!0),i.focus())},importDemo:function(e){var t=this,i=d(e.target),o=d(e.target).data("plugins");e.preventDefault(),i.hasClass("disabled")||i.hasClass("updating-message")||d.confirm({title:"",content:'<div class="demo-import-confirm-message">'+wp.demos.data.settings.confirmImport+"</div>",boxWidth:"50%",useBootstrap:!1,buttons:{confirm:{text:wp.demos.data.l10n.confirmMsg,keys:["enter"],btnClass:"demo-import-confirm-button",action:function(){t.processImport(i,o,t)}},cancel:{btnClass:"demo-import-cancel-button",action:function(){}}}})},processImport:function(i,e,o){wp.updates.maybeRequestFilesystemCredentials(event),d(document).trigger("wp-plugin-bulk-install",e),d.each(e,function(e,t){t.is_active||wp.updates.queue.push({action:"install-plugin",data:{plugin:t.slug,name:t.name,slug:e,demo:i.data("slug")}})}),d(document).on("wp-demo-import-success",function(e,t){o.model.get("id")===t.slug&&(o.render(),o.model.set({imported:!0}))}),wp.updates.queue.push({action:"import-demo",data:{slug:i.data("slug")}}),wp.updates.queueChecker()}}),a.view.Preview=wp.Backbone.View.extend({className:"wp-full-overlay expanded",el:".theme-install-overlay",events:{"click .close-full-overlay":"close","click .collapse-sidebar":"collapse","click .devices button":"previewDevice","click .previous-theme":"previousDemo","click .next-theme":"nextDemo",keyup:"keyEvent","click .demo-import":"importDemo"},html:a.template("demo-preview"),render:function(){var e,t=this,i=this.model.toJSON(),o=d(document.body);o.attr("aria-busy","true"),this.$el.removeClass("iframe-ready").html(this.html(i)),(e=this.$el.data("current-preview-device"))&&t.tooglePreviewDeviceButtons(e),a.router.navigate(a.router.baseUrl(a.router.demoPath+this.model.get("id")),{replace:!1}),this.$el.fadeIn(200,function(){o.addClass("demo-importer-active full-overlay-active")}),this.$el.find("iframe").one("load",function(){t.iframeLoaded()})},iframeLoaded:function(){this.$el.addClass("iframe-ready"),d(document.body).attr("aria-busy","false")},close:function(){return this.$el.fadeOut(200,function(){d("body").removeClass("demo-importer-active full-overlay-active"),a.focusedDemo&&a.focusedDemo.focus()}).removeClass("iframe-ready"),a.router.selectedTab?a.router.navigate(a.router.baseUrl("&browse="+a.router.selectedTab)):a.router.navigate(a.router.baseUrl("")),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),!1},collapse:function(e){var t=d(e.currentTarget);return"true"===t.attr("aria-expanded")?t.attr({"aria-expanded":"false","aria-label":i.expandSidebar}):t.attr({"aria-expanded":"true","aria-label":i.collapseSidebar}),this.$el.toggleClass("collapsed").toggleClass("expanded"),!1},previewDevice:function(e){var t=d(e.currentTarget).data("device");this.$el.removeClass("preview-desktop preview-tablet preview-mobile").addClass("preview-"+t).data("current-preview-device",t),this.tooglePreviewDeviceButtons(t)},tooglePreviewDeviceButtons:function(e){var t=d(".wp-full-overlay-footer .devices");t.find("button").removeClass("active").attr("aria-pressed",!1),t.find("button.preview-"+e).addClass("active").attr("aria-pressed",!0)},keyEvent:function(e){27===e.keyCode&&(this.undelegateEvents(),this.close()),39===e.keyCode&&_.once(this.nextDemo()),37===e.keyCode&&this.previousDemo()},nextDemo:function(){return this.trigger("demo:next",this.model.cid),!1},previousDemo:function(){return this.trigger("demo:previous",this.model.cid),!1},importDemo:function(e){var t=this,i=d(e.target),o=d(".plugins-list-table").find("#the-list tr"),s=[];e.preventDefault(),i.hasClass("disabled")||i.hasClass("updating-message")||d.confirm({title:"",content:'<div class="demo-import-confirm-message">'+wp.demos.data.settings.confirmImport+"</div>",boxWidth:"50%",useBootstrap:!1,buttons:{confirm:{text:wp.demos.data.l10n.confirmMsg,keys:["enter"],btnClass:"demo-import-confirm-button",action:function(){t.processImport(i,o,0,0,s,t)}},cancel:{btnClass:"demo-import-cancel-button",action:function(){}}},onContentReady:function(){d("body").addClass("demo-import-message-popup")},onDestroy:function(){d("body").removeClass("demo-import-message-popup")}})},processImport:function(r,e,n,a,l,c){wp.updates.maybeRequestFilesystemCredentials(event),d(".theme-install-overlay").find(".next-theme, .previous-theme").addClass("disabled"),d(document).trigger("wp-plugin-bulk-install",e),e.each(function(e,t){var i=d(t);i.hasClass("inactive")&&!i.find("notice-error").length&&wp.updates.queue.push({action:"install-plugin",data:{plugin:i.data("plugin"),slug:i.data("slug"),demo:r.data("slug")}})}),d(document).on("wp-plugin-bulk-installing",function(){d(".wp-full-overlay-sidebar-content").animate({scrollTop:d(document).height()})}),d(document).on("wp-plugin-bulk-install-success wp-plugin-bulk-install-error",function(e,t){var i,o,s=d('[data-slug="'+t.slug+'"]');"wp-"+t.install+"-bulk-install-success"===e.type?n++:(o=t.pluginName?t.pluginName:s.find(".plugin-name").text(),a++,l.push(o+": "+t.errorMessage)),wp.updates.adminNotice=wp.template("wp-bulk-installs-admin-notice"),d(".plugins-details .bulk-action-notice").remove(),d(".plugins-details .plugins-info").after(wp.updates.adminNotice({id:"bulk-action-notice",className:"bulk-action-notice notice-alt",successes:n,errors:a,errorMessages:l,type:t.install})),i=d("#bulk-action-notice").on("click","button",function(){d(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!d(this).hasClass("bulk-action-errors-collapsed")),i.find(".bulk-action-errors").toggleClass("hidden")}),wp.updates.queue.length||(0<a?r.removeClass("updating-message").text(r.data("originaltext")):(c.model.set({requiredPlugins:!1}),d(".theme-install-overlay").find(".next-theme, .previous-theme").addClass("disabled")))}),d(document).on("wp-updates-notice-added",function(){wp.updates.adminNotice=wp.template("wp-updates-admin-notice")}),d(document).on("wp-demo-import-success",function(e,t){c.model.get("id")===t.slug&&c.model.set({imported:!0})}),wp.updates.queue.push({action:"import-demo",data:{slug:r.data("slug")}}),wp.updates.queueChecker()}}),a.view.Demos=wp.Backbone.View.extend({className:"themes wp-clearfix",$overlay:d("div.theme-overlay"),index:0,count:d(".wrap .demo-count"),liveDemoCount:0,initialize:function(e){var t=this;this.parent=e.parent,this.setView("grid"),t.importedDemo(),this.listenTo(t.collection,"demos:update",function(){t.parent.page=0,t.importedDemo(),t.render(this)}),this.listenTo(t.collection,"query:success",function(e){_.isNumber(e)?(t.count.text(e),t.announceSearchResults(e)):(t.count.text(t.collection.length),t.announceSearchResults(t.collection.length))}),this.listenTo(t.collection,"query:empty",function(){d("body").addClass("no-results")}),this.listenTo(this.parent,"demo:scroll",function(){t.renderDemos(t.parent.page)})},render:function(){this.$el.empty(),0<this.options.collection.size()&&this.renderDemos(this.parent.page),this.liveDemoCount=this.collection.count?this.collection.count:this.collection.length,this.count.text(this.liveDemoCount)},renderDemos:function(e){var t=this;t.instance=t.collection.paginate(e),0!==t.instance.size()?(a.isNew&&1<=e&&d(".add-new-theme").remove(),t.instance.each(function(e){t.demo=new a.view.Demo({model:e,parent:t}),t.demo.render(),t.$el.append(t.demo.el)}),a.isNew&&a.data.settings.suggestURI&&this.$el.append('<div class="theme add-new-theme"><a href="'+a.data.settings.suggestURI+'" target="blank"><div class="theme-screenshot"><span></span></div><h2 class="theme-name">'+i.suggestNew+"</h2></a></div>"),this.parent.page++):this.parent.trigger("demo:end")},importedDemo:function(){var e;(e=this.collection.findWhere({active:!0}))&&(this.collection.remove(e),this.collection.add(e,{at:0}))},setView:function(e){return e},announceSearchResults:function(e){0===e?wp.a11y.speak(i.noDemosFound):wp.a11y.speak(i.demosFound.replace("%d",e))}}),a.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:i.searchPlaceholder,type:"search","aria-describedby":"live-search-desc"},events:{input:"search",keyup:"search",blur:"pushState"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"demo:close",function(){this.searching=!1})},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e)},doSearch:function(e){var t={};this.collection.doSearch(e.target.value.replace(/\+/g," ")),this.searching&&13!==e.which?t.replace=!0:this.searching=!0,e.target.value?a.router.navigate(a.router.baseUrl(a.router.searchPath+e.target.value),t):a.router.navigate(a.router.baseUrl(""))},pushState:function(e){var t=a.router.baseUrl("");e.target.value&&(t=a.router.baseUrl(a.router.searchPath+encodeURIComponent(e.target.value))),this.searching=!1,a.router.navigate(t)}}),a.Router=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&demo=:slug":"preview","themes.php?page=demo-importer&browse=:sort":"sort","themes.php?page=demo-importer&search=:query":"search","themes.php?page=demo-importer":"sort"},baseUrl:function(e){return"themes.php?page=demo-importer"+e},demoPath:"&demo=",browsePath:"&browse=",searchPath:"&search=",search:function(e){d(".wp-filter-search").val(e.replace(/\+/g," "))},navigate:function o(e,t){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.call(this,e,t)}}),a.view.InstallerSearch=a.view.Search.extend({events:{input:"search",keyup:"search"},terms:"",search:function(e){("keyup"!==e.type||9!==e.which&&16!==e.which)&&(this.collection=this.options.parent.view.collection,"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e.target.value))},doSearch:function(e){this.terms!==e&&(this.terms=e,d(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),this.collection.doSearch(e.replace(/\+/g," ")),a.router.navigate(a.router.baseUrl(a.router.searchPath+encodeURIComponent(e)),{replace:!0}))}}),a.view.Installer=a.view.Appearance.extend({el:"#wpbody-content .wrap",events:{"click .filter-links li > a":"onSort"},render:function(){var e=this;this.search(),this.collection=new a.Collection,this.listenTo(this,"demo:end",function(){e.collection.loadingDemos||(e.collection.loadingDemos=!0,e.collection.currentQuery.page++,_.extend(e.collection.currentQuery.request,{page:e.collection.currentQuery.page}),e.collection.query(e.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){d("body").removeClass("loading-content"),d(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){d("body").removeClass("loading-content"),d(".theme-browser").find("div.error").remove(),d(".theme-browser").find("div.themes").before('<div class="error"><p>'+i.error+'</p><p><button class="button try-again">'+i.tryAgain+"</button></p></div>"),d(".theme-browser .error .try-again").on("click",function(e){e.preventDefault(),d("input.wp-filter-search").trigger("input")})}),this.view&&this.view.remove(),this.view=new a.view.Demos({collection:this.collection,parent:this}),this.page=0,this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},browse:function(e,t){this.collection.query({browse:e,builder:t})},onSort:function(e){var t=d(e.target),i=t.data("sort"),o=t.data("type");e.preventDefault(),i=i||a.router.selectedTab,o=o||a.router.selectedType,t.hasClass(this.activeClass)||(this.sort(i,o),a.router.navigate(a.router.baseUrl(a.router.browsePath+i)))},sort:function(e,t){this.clearSearch(),a.router.selectedTab=e,a.router.selectedType=t,d(".filter-links li > a").removeClass(this.activeClass).removeAttr("aria-current"),d('[data-sort="'+e+'"]').addClass(this.activeClass).attr("aria-current","page"),d('[data-type="'+t+'"]').addClass(this.activeClass).attr("aria-current","page"),this.browse(e,t)},activeClass:"current",clearSearch:function(){d("#wp-filter-search-input").val("")}}),a.RunInstaller={init:function(){this.view=new a.view.Installer({section:"all",SearchView:a.view.InstallerSearch}),this.render(),this.view.SearchView.doSearch=_.debounce(this.view.SearchView.doSearch,500)},render:function(){this.view.render(),this.routes(),Backbone.History.started&&Backbone.history.stop(),Backbone.history.start({root:a.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this,t={};a.router=new a.Router,a.router.on("route:preview",function(e){a.preview&&(a.preview.undelegateEvents(),a.preview.unbind()),i.view.view.demo&&i.view.view.demo.preview?(i.view.view.demo.model=i.view.collection.findWhere({slug:e}),i.view.view.demo.preview()):(t.demo=e,i.view.collection.query(t),i.view.collection.trigger("update"),i.view.collection.once("query:success",function(){d('div[data-slug="'+e+'"]').trigger("click")}))}),a.router.on("route:sort",function(e){var t=a.router.selectedType?a.router.selectedType:d(".filter-links.pagebuilders li").first().find("a").data("type");e&&d('[data-sort="'+e+'"]').length||(e="all",a.router.navigate(a.router.baseUrl("&browse=all"),{replace:!0})),i.view.sort(e,t),a.preview&&a.preview.close()}),a.router.on("route:search",function(){d(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},d(document).ready(function(){a.RunInstaller.init(),d(document.body).on("init_tooltips",function(){d("#tiptip_holder").removeAttr("style"),d("#tiptip_arrow").removeAttr("style"),d(".tips").tipTip({attribute:"data-tip",defaultPosition:"top",fadeIn:50,fadeOut:50,delay:50})}).trigger("init_tooltips"),d(".themegrill-reset-wordpress").on("click",function(){return window.confirm(_demoImporterSettings.settings.confirmReset)}),d(".themegrill-demo-importer-rating-link").on("click",function(){var e=d(this);d.post(a.data.settings.ajaxUrl,{action:"footer-text-rated"}),e.parent().text(e.data("rated"))})})}(jQuery);
1
+ window.wp=window.wp||{},function(d){var a,i;(a=wp.demos=wp.demos||{}).data=_demoImporterSettings,i=a.data.l10n,a.isNew=!!a.data.settings.isNew,_.extend(a,{model:{},view:{},routes:{},router:{},template:wp.template}),a.Model=Backbone.Model.extend({initialize:function(){var e;this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),a.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:d(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:a.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new a.view.Demos({collection:this.collection,parent:this}),this.search(),this.$el.removeClass("search-loading"),this.view.render(),this.$el.empty().append(this.view.el).addClass("rendered")},searchContainer:d(".search-form"),search:function(){var e;1!==a.data.demos.length&&(e=new this.SearchView({collection:this.collection,parent:this}),(this.SearchView=e).render(),this.searchContainer.append(d.parseHTML('<label class="screen-reader-text" for="wp-filter-search-input">'+i.search+"</label>")).append(e.el).on("submit",function(e){e.preventDefault()}))},scroller:function(){var e,t=this;this.window.scrollTop(),t.window.height(),e=t.$el.offset().top+t.$el.outerHeight(!1)-t.window.height(),e=Math.round(.9*e)}}),a.Collection=Backbone.Collection.extend({model:a.Model,terms:"",doSearch:function(e){this.terms!==e&&(this.terms=e,0<this.terms.length&&this.search(this.terms),""===this.terms&&(this.reset(a.data.demos),d("body").removeClass("no-results")),this.trigger("demos:update"))},search:function(t){var i,e,o,s,r,n;this.reset(a.data.demos,{silent:!0}),t=(t=t.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\amp;")).replace(/ /g,")(?=.*"),i=new RegExp("^(?=.*"+t+").+","i"),0===(e=this.filter(function(e){return s=e.get("name").replace(/(<([^>]+)>)/gi,""),r=e.get("description").replace(/(<([^>]+)>)/gi,""),n=e.get("author").replace(/(<([^>]+)>)/gi,""),o=_.union([s,e.get("id"),r,n,e.get("tags")]),i.test(e.get("author"))&&2<t.length&&e.set("displayAuthor",!0),i.test(o)})).length?this.trigger("query:empty"):d("body").removeClass("no-results"),this.reset(e)},paginate:function(e){return e=e||0,this},count:!1,query:function(t){var e,i,o,s=this.queries,r=this;if(this.currentQuery.request=t,e=_.find(s,function(e){return _.isEqual(e.request,t)}),(i=_.has(t,"page"))||(this.currentQuery.page=1),e||i){if(i)return this.apiCall(t,i).done(function(e){r.add(e.demos),r.trigger("query:success"),r.loadingDemos=!1}).fail(function(){r.trigger("query:fail")});0===e.demos.length?r.trigger("query:empty"):d("body").removeClass("no-results"),_.isNumber(e.total)&&(this.count=e.total),this.reset(e.demos),e.total||(this.count=this.length),this.trigger("demos:update"),this.trigger("query:success",this.count)}else e=this.apiCall(t).done(function(e){e.demos&&(r.reset(e.demos),o=e.info.results,s.push({demos:e.demos,request:t,total:o})),r.trigger("demos:update"),r.trigger("query:success",o),e.demos&&0===e.demos.length&&r.trigger("query:empty")}).fail(function(){r.trigger("query:fail")})},queries:[],currentQuery:{page:1,request:{}},apiCall:function(e,t){return wp.ajax.send("query-demos",{data:{request:_.extend({per_page:100},e)},beforeSend:function(){t||d("body").addClass("loading-content").removeClass("no-results")}})},loadingDemos:!1}),a.view.Demo=wp.Backbone.View.extend({className:"theme",state:"grid",html:a.template("demo"),events:{click:"preview",keydown:"preview",touchend:"preview",keyup:"addFocus",touchmove:"preventExpand","click .demo-import":"importDemo"},touchDrag:!1,initialize:function(){this.model.on("change",this.render,this)},render:function(){var e=this.model.toJSON();this.$el.html(this.html(e)).attr({tabindex:0,"aria-describedby":e.id+"-action "+e.id+"-name","data-slug":e.id}),this.activeDemo(),this.model.get("displayAuthor")&&this.$el.addClass("display-author")},activeDemo:function(){this.model.get("active")&&this.$el.addClass("active")},addFocus:function(){var e=d(":focus").hasClass("theme")?d(":focus"):d(":focus").parents(".theme");d(".theme.focus").removeClass("focus"),e.addClass("focus")},preventExpand:function(){this.touchDrag=!0},preview:function(e){var t,i,o=this;if(e=e||window.event,!0===this.touchDrag)return this.touchDrag=!1;d(e.target).not(".install-demo-preview").parents(".theme-actions").length||"keydown"===e.type&&13!==e.which&&32!==e.which||"keydown"===e.type&&13!==e.which&&d(":focus").hasClass("button")||(e.preventDefault(),e=e||window.event,a.focusedDemo=this.$el,a.preview=i=new a.view.Preview({model:this.model}),i.render(),this.setNavButtonsState(),1===this.model.collection.length?i.$el.addClass("no-navigation"):i.$el.removeClass("no-navigation"),d("div.wrap").append(i.el),this.listenTo(i,"demo:next",function(){if(t=o.model,_.isUndefined(o.current)||(t=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(t)+1),_.isUndefined(o.current))return o.options.parent.parent.trigger("demo:end"),o.current=t;i.model=o.current,i.render(),this.setNavButtonsState(),d(".next-theme").focus()}).listenTo(i,"demo:previous",function(){t=o.model,0!==o.model.collection.indexOf(o.current)&&(_.isUndefined(o.current)||(t=o.current),o.current=o.model.collection.at(o.model.collection.indexOf(t)-1),_.isUndefined(o.current)||(i.model=o.current,i.render(),this.setNavButtonsState(),d(".previous-theme").focus()))}),this.listenTo(i,"preview:close",function(){o.current=o.model}))},setNavButtonsState:function(){var e=d(".theme-install-overlay"),t=_.isUndefined(this.current)?this.model:this.current,i=e.find(".previous-theme"),o=e.find(".next-theme");0===this.model.collection.indexOf(t)&&(i.addClass("disabled").prop("disabled",!0),o.focus()),_.isUndefined(this.model.collection.at(this.model.collection.indexOf(t)+1))&&(o.addClass("disabled").prop("disabled",!0),i.focus())},importDemo:function(e){var t=this,i=d(e.target),o=d(e.target).data("plugins");e.preventDefault(),i.hasClass("disabled")||i.hasClass("updating-message")||d.confirm({title:"",content:'<div class="demo-import-confirm-message">'+wp.demos.data.settings.confirmImport+"</div>",boxWidth:"50%",useBootstrap:!1,buttons:{confirm:{text:wp.demos.data.l10n.confirmMsg,keys:["enter"],btnClass:"demo-import-confirm-button",action:function(){t.processImport(i,o,t)}},cancel:{btnClass:"demo-import-cancel-button",action:function(){}}}})},processImport:function(i,e,o){wp.updates.maybeRequestFilesystemCredentials(event),d(document).trigger("wp-plugin-bulk-install",e),d.each(e,function(e,t){t.is_active||wp.updates.queue.push({action:"install-plugin",data:{plugin:t.slug,name:t.name,slug:e,demo:i.data("slug")}})}),d(document).on("wp-demo-import-success",function(e,t){o.model.get("id")===t.slug&&(o.render(),o.model.set({imported:!0}))}),wp.updates.queue.push({action:"import-demo",data:{slug:i.data("slug")}}),wp.updates.queueChecker()}}),a.view.Preview=wp.Backbone.View.extend({className:"wp-full-overlay expanded",el:".theme-install-overlay",events:{"click .close-full-overlay":"close","click .collapse-sidebar":"collapse","click .devices button":"previewDevice","click .previous-theme":"previousDemo","click .next-theme":"nextDemo",keyup:"keyEvent","click .demo-import":"importDemo"},html:a.template("demo-preview"),render:function(){var e,t=this,i=this.model.toJSON(),o=d(document.body);o.attr("aria-busy","true"),this.$el.removeClass("iframe-ready").html(this.html(i)),(e=this.$el.data("current-preview-device"))&&t.tooglePreviewDeviceButtons(e),a.router.navigate(a.router.baseUrl(a.router.demoPath+this.model.get("id")),{replace:!1}),this.$el.fadeIn(200,function(){o.addClass("demo-importer-active full-overlay-active")}),this.$el.find("iframe").one("load",function(){t.iframeLoaded()})},iframeLoaded:function(){this.$el.addClass("iframe-ready"),d(document.body).attr("aria-busy","false")},close:function(){return this.$el.fadeOut(200,function(){d("body").removeClass("demo-importer-active full-overlay-active"),a.focusedDemo&&a.focusedDemo.focus()}).removeClass("iframe-ready"),a.router.selectedTab?a.router.navigate(a.router.baseUrl("&browse="+a.router.selectedTab)):a.router.navigate(a.router.baseUrl("")),this.trigger("preview:close"),this.undelegateEvents(),this.unbind(),!1},collapse:function(e){var t=d(e.currentTarget);return"true"===t.attr("aria-expanded")?t.attr({"aria-expanded":"false","aria-label":i.expandSidebar}):t.attr({"aria-expanded":"true","aria-label":i.collapseSidebar}),this.$el.toggleClass("collapsed").toggleClass("expanded"),!1},previewDevice:function(e){var t=d(e.currentTarget).data("device");this.$el.removeClass("preview-desktop preview-tablet preview-mobile").addClass("preview-"+t).data("current-preview-device",t),this.tooglePreviewDeviceButtons(t)},tooglePreviewDeviceButtons:function(e){var t=d(".wp-full-overlay-footer .devices");t.find("button").removeClass("active").attr("aria-pressed",!1),t.find("button.preview-"+e).addClass("active").attr("aria-pressed",!0)},keyEvent:function(e){27===e.keyCode&&(this.undelegateEvents(),this.close()),39===e.keyCode&&_.once(this.nextDemo()),37===e.keyCode&&this.previousDemo()},nextDemo:function(){return this.trigger("demo:next",this.model.cid),!1},previousDemo:function(){return this.trigger("demo:previous",this.model.cid),!1},importDemo:function(e){var t=this,i=d(e.target),o=d(".plugins-list-table").find("#the-list tr"),s=[];e.preventDefault(),i.hasClass("disabled")||i.hasClass("updating-message")||d.confirm({title:"",content:'<div class="demo-import-confirm-message">'+wp.demos.data.settings.confirmImport+"</div>",boxWidth:"50%",useBootstrap:!1,buttons:{confirm:{text:wp.demos.data.l10n.confirmMsg,keys:["enter"],btnClass:"demo-import-confirm-button",action:function(){t.processImport(i,o,0,0,s,t)}},cancel:{btnClass:"demo-import-cancel-button",action:function(){}}},onContentReady:function(){d("body").addClass("demo-import-message-popup")},onDestroy:function(){d("body").removeClass("demo-import-message-popup")}})},processImport:function(r,e,n,a,l,c){wp.updates.maybeRequestFilesystemCredentials(event),d(".theme-install-overlay").find(".next-theme, .previous-theme").addClass("disabled"),d(document).trigger("wp-plugin-bulk-install",e),e.each(function(e,t){var i=d(t);i.hasClass("inactive")&&!i.find("notice-error").length&&wp.updates.queue.push({action:"install-plugin",data:{plugin:i.data("plugin"),slug:i.data("slug"),demo:r.data("slug")}})}),d(document).on("wp-plugin-bulk-installing",function(){d(".wp-full-overlay-sidebar-content").animate({scrollTop:d(document).height()})}),d(document).on("wp-plugin-bulk-install-success wp-plugin-bulk-install-error",function(e,t){var i,o,s=d('[data-slug="'+t.slug+'"]');"wp-"+t.install+"-bulk-install-success"===e.type?n++:(o=t.pluginName?t.pluginName:s.find(".plugin-name").text(),a++,l.push(o+": "+t.errorMessage)),wp.updates.adminNotice=wp.template("wp-bulk-installs-admin-notice"),d(".plugins-details .bulk-action-notice").remove(),d(".plugins-details .plugins-info").after(wp.updates.adminNotice({id:"bulk-action-notice",className:"bulk-action-notice notice-alt",successes:n,errors:a,errorMessages:l,type:t.install})),i=d("#bulk-action-notice").on("click","button",function(){d(this).toggleClass("bulk-action-errors-collapsed").attr("aria-expanded",!d(this).hasClass("bulk-action-errors-collapsed")),i.find(".bulk-action-errors").toggleClass("hidden")}),wp.updates.queue.length||(0<a?r.removeClass("updating-message").text(r.data("originaltext")):(c.model.set({requiredPlugins:!1}),d(".theme-install-overlay").find(".next-theme, .previous-theme").addClass("disabled")))}),d(document).on("wp-updates-notice-added",function(){wp.updates.adminNotice=wp.template("wp-updates-admin-notice")}),d(document).on("wp-demo-import-success",function(e,t){c.model.get("id")===t.slug&&c.model.set({imported:!0})}),wp.updates.queue.push({action:"import-demo",data:{slug:r.data("slug")}}),wp.updates.queueChecker()}}),a.view.Demos=wp.Backbone.View.extend({className:"themes wp-clearfix",$overlay:d("div.theme-overlay"),index:0,count:d(".wrap .demo-count"),liveDemoCount:0,initialize:function(e){var t=this;this.parent=e.parent,this.setView("grid"),t.importedDemo(),this.listenTo(t.collection,"demos:update",function(){t.parent.page=0,t.importedDemo(),t.render(this)}),this.listenTo(t.collection,"query:success",function(e){_.isNumber(e)?(t.count.text(e),t.announceSearchResults(e)):(t.count.text(t.collection.length),t.announceSearchResults(t.collection.length))}),this.listenTo(t.collection,"query:empty",function(){d("body").addClass("no-results")}),this.listenTo(this.parent,"demo:scroll",function(){t.renderDemos(t.parent.page)})},render:function(){this.$el.empty(),0<this.options.collection.size()&&this.renderDemos(this.parent.page),this.liveDemoCount=this.collection.count?this.collection.count:this.collection.length,this.count.text(this.liveDemoCount)},renderDemos:function(e){var t=this;t.instance=t.collection.paginate(e),0!==t.instance.size()?(a.isNew&&1<=e&&d(".add-new-theme").remove(),t.instance.each(function(e){t.demo=new a.view.Demo({model:e,parent:t}),t.demo.render(),t.$el.append(t.demo.el)}),a.isNew&&a.data.settings.suggestURI&&this.$el.append('<div class="theme add-new-theme"><a href="'+a.data.settings.suggestURI+'" target="blank"><div class="theme-screenshot"><span></span></div><h2 class="theme-name">'+i.suggestNew+"</h2></a></div>"),this.parent.page++):this.parent.trigger("demo:end")},importedDemo:function(){var e;(e=this.collection.findWhere({active:!0}))&&(this.collection.remove(e),this.collection.add(e,{at:0}))},setView:function(e){return e},announceSearchResults:function(e){0===e?wp.a11y.speak(i.noDemosFound):wp.a11y.speak(i.demosFound.replace("%d",e))}}),a.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:i.searchPlaceholder,type:"search","aria-describedby":"live-search-desc"},events:{input:"search",keyup:"search",blur:"pushState"},initialize:function(e){this.parent=e.parent,this.listenTo(this.parent,"demo:close",function(){this.searching=!1})},search:function(e){"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e)},doSearch:function(e){var t={};this.collection.doSearch(e.target.value.replace(/\+/g," ")),this.searching&&13!==e.which?t.replace=!0:this.searching=!0,e.target.value?a.router.navigate(a.router.baseUrl(a.router.searchPath+e.target.value),t):a.router.navigate(a.router.baseUrl(""))},pushState:function(e){var t=a.router.baseUrl("");e.target.value&&(t=a.router.baseUrl(a.router.searchPath+encodeURIComponent(e.target.value))),this.searching=!1,a.router.navigate(t)}}),a.Router=Backbone.Router.extend({routes:{"themes.php?page=demo-importer&demo=:slug":"preview","themes.php?page=demo-importer&browse=:sort":"sort","themes.php?page=demo-importer&search=:query":"search","themes.php?page=demo-importer":"sort"},baseUrl:function(e){return"themes.php?page=demo-importer"+e},demoPath:"&demo=",browsePath:"&browse=",searchPath:"&search=",search:function(e){d(".wp-filter-search").val(e.replace(/\+/g," "))},navigate:function o(e,t){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.call(this,e,t)}}),a.view.InstallerSearch=a.view.Search.extend({events:{input:"search",keyup:"search"},terms:"",search:function(e){("keyup"!==e.type||9!==e.which&&16!==e.which)&&(this.collection=this.options.parent.view.collection,"keyup"===e.type&&27===e.which&&(e.target.value=""),this.doSearch(e.target.value))},doSearch:function(e){this.terms!==e&&(this.terms=e,d(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),this.collection.doSearch(e.replace(/\+/g," ")),a.router.navigate(a.router.baseUrl(a.router.searchPath+encodeURIComponent(e)),{replace:!0}))}}),a.view.Installer=a.view.Appearance.extend({el:"#wpbody-content .wrap",events:{"click .filter-links li > a":"onSort"},render:function(){var e=this;this.search(),this.collection=new a.Collection,this.listenTo(this,"demo:end",function(){e.collection.loadingDemos||(e.collection.loadingDemos=!0,e.collection.currentQuery.page++,_.extend(e.collection.currentQuery.request,{page:e.collection.currentQuery.page}),e.collection.query(e.collection.currentQuery.request))}),this.listenTo(this.collection,"query:success",function(){d("body").removeClass("loading-content"),d(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){d("body").removeClass("loading-content"),d(".theme-browser").find("div.error").remove(),d(".theme-browser").find("div.themes").before('<div class="error"><p>'+i.error+'</p><p><button class="button try-again">'+i.tryAgain+"</button></p></div>"),d(".theme-browser .error .try-again").on("click",function(e){e.preventDefault(),d("input.wp-filter-search").trigger("input")})}),this.view&&this.view.remove(),this.view=new a.view.Demos({collection:this.collection,parent:this}),this.page=0,this.$el.find(".themes").remove(),this.view.render(),this.$el.find(".theme-browser").append(this.view.el).addClass("rendered")},browse:function(e,t){this.collection.query({browse:e,builder:t})},onSort:function(e){var t=d(e.target),i=t.data("sort"),o=t.data("type");e.preventDefault(),i=i||a.router.selectedTab,o=o||a.router.selectedType,t.hasClass(this.activeClass)||(this.sort(i,o),a.router.navigate(a.router.baseUrl(a.router.browsePath+i)))},sort:function(e,t){this.clearSearch(),a.router.selectedTab=e,a.router.selectedType=t,d(".filter-links li > a").removeClass(this.activeClass).removeAttr("aria-current"),d('[data-sort="'+e+'"]').addClass(this.activeClass).attr("aria-current","page"),d('[data-type="'+t+'"]').addClass(this.activeClass).attr("aria-current","page"),this.browse(e,t)},activeClass:"current",clearSearch:function(){d("#wp-filter-search-input").val("")}}),a.RunInstaller={init:function(){this.view=new a.view.Installer({section:"all",SearchView:a.view.InstallerSearch}),this.render(),this.view.SearchView.doSearch=_.debounce(this.view.SearchView.doSearch,500)},render:function(){this.view.render(),this.routes(),Backbone.History.started&&Backbone.history.stop(),Backbone.history.start({root:a.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var i=this,t={};a.router=new a.Router,a.router.on("route:preview",function(e){a.preview&&(a.preview.undelegateEvents(),a.preview.unbind()),i.view.view.demo&&i.view.view.demo.preview?(i.view.view.demo.model=i.view.collection.findWhere({slug:e}),i.view.view.demo.preview()):(t.demo=e,i.view.collection.query(t),i.view.collection.trigger("update"),i.view.collection.once("query:success",function(){d('div[data-slug="'+e+'"]').trigger("click")}))}),a.router.on("route:sort",function(e){var t=a.router.selectedType?a.router.selectedType:d(".filter-links.pagebuilders li").first().find("a").data("type");e&&d('[data-sort="'+e+'"]').length||(e="all",a.router.navigate(a.router.baseUrl("&browse=all"),{replace:!0})),i.view.sort(e,t),a.preview&&a.preview.close()}),a.router.on("route:search",function(){d(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},d(document).ready(function(){a.RunInstaller.init(),d(document.body).on("init_tooltips",function(){d("#tiptip_holder").removeAttr("style"),d("#tiptip_arrow").removeAttr("style"),d(".tips").tipTip({attribute:"data-tip",defaultPosition:"top",fadeIn:50,fadeOut:50,delay:50})}).trigger("init_tooltips"),d(".themegrill-reset-wordpress").on("click",function(){return window.confirm(_demoImporterSettings.settings.confirmReset)}),d(".themegrill-demo-importer-rating-link").on("click",function(){var e=d(this);d.post(a.data.settings.ajaxUrl,{action:"footer-text-rated"}),e.parent().text(e.data("rated"))})})}(jQuery);
includes/admin/assets/css/notice.css CHANGED
@@ -1,34 +1,20 @@
1
- .pro-theme-notice {
2
position: relative;
3
}
4
5
- .pro-theme-notice p {
6
- font-size: 16px;
7
}
8
9
- .pro-theme-notice code {
10
- display: inline-block;
11
}
12
13
- .pro-theme-notice .links {
14
- margin: 12px 0;
15
}
16
17
- .pro-theme-notice .links a {
18
- height: auto;
19
- padding: 3px 15px;
20
- margin-left: 12px;
21
- text-transform: uppercase;
22
- }
23
-
24
- .pro-theme-notice .links a .dashicons {
25
- line-height: 1.2;
26
- }
27
-
28
- .pro-theme-notice .links a.button-primary {
29
- margin-left: 0;
30
- }
31
-
32
- .pro-theme-notice .notice-dismiss {
33
text-decoration: none;
34
}
1
+ .tg-demo-importer-notice {
2
position: relative;
3
+ padding: 6px 40px 6px 12px;
4
}
5
6
+ .tg-demo-importer-notice .links {
7
+ margin: 0.5em 0;
8
}
9
10
+ .tg-demo-importer-notice .links a {
11
+ margin: 2px;
12
}
13
14
+ .tg-demo-importer-notice .links a > span {
15
+ vertical-align: middle;
16
}
17
18
+ .tg-demo-importer-notice .notice-dismiss {
19
text-decoration: none;
20
}
includes/admin/class-plugin-deactivate-notice.php ADDED
@@ -0,0 +1,104 @@
1
+ <?php
2
+ /**
3
+ * Class to display the plugin deactivation notice.
4
+ *
5
+ * @package ThemeGrill_Demo_Importer
6
+ * @since 1.6.4
7
+ */
8
+
9
+ defined( 'ABSPATH' ) || exit;
10
+
11
+ /**
12
+ * Class to display the plugin deactivation notice.
13
+ *
14
+ * Class TG_Demo_Importer_Plugin_Deactivate_Notice
15
+ */
16
+ class TG_Demo_Importer_Plugin_Deactivate_Notice {
17
+
18
+ /**
19
+ * Constructor function to include the required functionality for the class.
20
+ *
21
+ * TG_Demo_Importer_Plugin_Deactivate_Notice constructor.
22
+ */
23
+ public function __construct() {
24
+ add_action( 'admin_notices', array( $this, 'deactivate_notice_markup' ), 0 );
25
+ add_action( 'admin_init', array( $this, 'deactivate_plugin' ), 0 );
26
+ add_action( 'admin_init', array( $this, 'ignore_plugin_deactivate_notice' ), 0 );
27
+ }
28
+
29
+ /**
30
+ * Show HTML markup if conditions meet.
31
+ */
32
+ public function deactivate_notice_markup() {
33
+ $demo_imported = get_option( 'themegrill_demo_importer_activated_id' );
34
+ $ignore_deactivate_notice = get_option( 'tg_demo_importer_plugin_deactivate_notice' );
35
+
36
+ /**
37
+ * Return from notice display if:
38
+ *
39
+ * 1. Demo is not installed.
40
+ * 2. User does not have the access to deactivate the plugin.
41
+ * 3. User does have no intention to deactivate the plugin.
42
+ */
43
+ if ( ! $demo_imported || ! current_user_can( 'deactivate_plugin' ) || ( $ignore_deactivate_notice && current_user_can( 'deactivate_plugin' ) ) ) {
44
+ return;
45
+ }
46
+ ?>
47
+ <div class="notice notice-success tg-demo-importer-notice plugin-deactivate-notice" style="position:relative;">
48
+ <p>
49
+ <?php
50
+ esc_html_e(
51
+ 'It seems you\'ve imported the theme demo successfully. Now, the purpose of this plugin is fulfilled and it has no more use. So, if you\'re satisfied with this import, you can safely deactivate it by clicking the button.',
52
+ 'themegrill-demo-importer'
53
+ );
54
+ ?>
55
+ </p>
56
+
57
+ <div class="links">
58
+ <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'deactivate-themegrill-demo-importer-plugin', 'true' ), 'deactivate_themegrill_demo_importer_plugin', '_deactivate_themegrill_demo_importer_plugin_nonce' ) ); ?>"
59
+ class="btn button-primary"
60
+ >
61
+ <span class="dashicons dashicons-thumbs-up"></span>
62
+ <span><?php esc_html_e( 'Deactivate', 'themegrill-demo-importer' ); ?></span>
63
+ </a>
64
+ </div> <!-- /.links -->
65
+
66
+ <a class="notice-dismiss" href="?nag_tg_demo_importer_plugin_deactivate_notice=0"></a>
67
+ </div> <!-- /.plugin-deactivate-notice -->
68
+ <?php
69
+ }
70
+
71
+ /**
72
+ * Deactivates the ThemeGrill Demo Importer plugin.
73
+ */
74
+ public function deactivate_plugin() {
75
+ // Deactivate the plugin.
76
+ if ( isset( $_GET['deactivate-themegrill-demo-importer-plugin'] ) && isset( $_GET['_deactivate_themegrill_demo_importer_plugin_nonce'] ) ) {
77
+ if ( ! wp_verify_nonce( $_GET['_deactivate_themegrill_demo_importer_plugin_nonce'], 'deactivate_themegrill_demo_importer_plugin' ) ) {
78
+ wp_die( __( 'Action failed. Please refresh the page and retry.', 'themegrill-demo-importer' ) );
79
+ }
80
+
81
+ // Get the plugin.
82
+ $plugin = 'themegrill-demo-importer/themegrill-demo-importer.php';
83
+ if ( is_plugin_active( $plugin ) ) {
84
+ deactivate_plugins( $plugin );
85
+ }
86
+
87
+ // Redirect to main dashboard page.
88
+ wp_safe_redirect( admin_url( 'plugins.php' ) );
89
+ }
90
+ }
91
+
92
+ /**
93
+ * Remove the plugin deactivate notice permanently.
94
+ */
95
+ public function ignore_plugin_deactivate_notice() {
96
+ /* If user clicks to ignore the notice, add that to the options table. */
97
+ if ( isset( $_GET['nag_tg_demo_importer_plugin_deactivate_notice'] ) && '0' == $_GET['nag_tg_demo_importer_plugin_deactivate_notice'] ) {
98
+ update_option( 'tg_demo_importer_plugin_deactivate_notice', 'true' );
99
+ }
100
+ }
101
+
102
+ }
103
+
104
+ new TG_Demo_Importer_Plugin_Deactivate_Notice();
includes/admin/class-plugin-review-notice.php ADDED
@@ -0,0 +1,117 @@
1
+ <?php
2
+ /**
3
+ * Class to display the plugin review notice.
4
+ *
5
+ * @package ThemeGrill_Demo_Importer
6
+ * @since 1.6.4
7
+ */
8
+
9
+ defined( 'ABSPATH' ) || exit;
10
+
11
+ /**
12
+ * Class to display the plugin review notice.
13
+ *
14
+ * Class TG_Demo_Importer_Review_Notice
15
+ */
16
+ class TG_Demo_Importer_Review_Notice {
17
+
18
+ /**
19
+ * Constructor function to include the required functionality for the class.
20
+ *
21
+ * TG_Demo_Importer_Review_Notice constructor.
22
+ */
23
+ public function __construct() {
24
+ add_action( 'admin_notices', array( $this, 'review_notice_markup' ), 0 );
25
+ add_action( 'admin_init', array( $this, 'ignore_plugin_review_notice' ), 0 );
26
+ add_action( 'admin_init', array( $this, 'ignore_plugin_review_notice_partially' ), 0 );
27
+ }
28
+
29
+ /**
30
+ * Show HTML markup if conditions meet.
31
+ */
32
+ public function review_notice_markup() {
33
+ $user_id = get_current_user_id();
34
+ $current_user = wp_get_current_user();
35
+ $ignored_notice = get_user_meta( $user_id, 'tg_demo_importer_plugin_review_notice', true );
36
+ $ignored_notice_partially = get_user_meta( $user_id, 'nag_tg_demo_importer_plugin_review_notice_partially', true );
37
+
38
+ // Check for if demo is already imported.
39
+ $demo_imported = get_option( 'themegrill_demo_importer_activated_id' );
40
+
41
+ /**
42
+ * Return from notice display if:
43
+ *
44
+ * 1. The demo is not imported.
45
+ * 2. If the user has ignored the message partially for 15 days.
46
+ * 3. Dismiss always if clicked on 'I Already Did' and `Dismiss` button.
47
+ */
48
+ if ( ! $demo_imported || ( $ignored_notice_partially > strtotime( '-15 day' ) ) || $ignored_notice ) {
49
+ return;
50
+ }
51
+ ?>
52
+ <div class="notice notice-success tg-demo-importer-notice plugin-review-notice" style="position:relative;">
53
+ <p>
54
+ <?php
55
+ printf(
56
+ /* Translators: %1$s current user display name. */
57
+ esc_html__(
58
+ 'Howdy, %1$s! It seems that you have imported the theme demo in your site. We hope that you are happy with it and if you can spare a minute, please help us by leaving a 5-star review on WordPress.org.',
59
+ 'themegrill-demo-importer'
60
+ ),
61
+ '<strong>' . esc_html( $current_user->display_name ) . '</strong>'
62
+ );
63
+ ?>
64
+ </p>
65
+
66
+ <div class="links">
67
+ <a href="https://wordpress.org/support/plugin/themegrill-demo-importer/reviews/?filter=5#new-post"
68
+ class="btn button-primary" target="_blank">
69
+ <span class="dashicons dashicons-thumbs-up"></span>
70
+ <span><?php esc_html_e( 'Sure', 'themegrill-demo-importer' ); ?></span>
71
+ </a>
72
+
73
+ <a href="?nag_tg_demo_importer_plugin_review_notice_partially=0" class="btn button-secondary">
74
+ <span class="dashicons dashicons-calendar"></span>
75
+ <span><?php esc_html_e( 'Maybe later', 'themegrill-demo-importer' ); ?></span>
76
+ </a>
77
+
78
+ <a href="?nag_tg_demo_importer_plugin_review_notice=0" class="btn button-secondary">
79
+ <span class="dashicons dashicons-smiley"></span>
80
+ <span><?php esc_html_e( 'I already did', 'themegrill-demo-importer' ); ?></span>
81
+ </a>
82
+
83
+ <a href="<?php echo esc_url( 'https://wordpress.org/support/plugin/themegrill-demo-importer/' ); ?>"
84
+ class="btn button-secondary" target="_blank">
85
+ <span class="dashicons dashicons-edit"></span>
86
+ <span><?php esc_html_e( 'Got plugin support question?', 'themegrill-demo-importer' ); ?></span>
87
+ </a>
88
+ </div> <!-- /.links -->
89
+
90
+ <a class="notice-dismiss" href="?nag_tg_demo_importer_plugin_review_notice=0"></a>
91
+ </div> <!-- /.plugin-review-notice -->
92
+ <?php
93
+ }
94
+
95
+ /**
96
+ * `I already did` button or `dismiss` button: remove the review notice permanently.
97
+ */
98
+ public function ignore_plugin_review_notice() {
99
+ /* If user clicks to ignore the notice, add that to their user meta */
100
+ if ( isset( $_GET['nag_tg_demo_importer_plugin_review_notice'] ) && '0' == $_GET['nag_tg_demo_importer_plugin_review_notice'] ) {
101
+ add_user_meta( get_current_user_id(), 'tg_demo_importer_plugin_review_notice', 'true', true );
102
+ }
103
+ }
104
+
105
+ /**
106
+ * `Maybe later` button: remove the review notice partially.
107
+ */
108
+ public function ignore_plugin_review_notice_partially() {
109
+ /* If user clicks to ignore the notice, add that to their user meta */
110
+ if ( isset( $_GET['nag_tg_demo_importer_plugin_review_notice_partially'] ) && '0' == $_GET['nag_tg_demo_importer_plugin_review_notice_partially'] ) {
111
+ update_user_meta( get_current_user_id(), 'nag_tg_demo_importer_plugin_review_notice_partially', time() );
112
+ }
113
+ }
114
+
115
+ }
116
+
117
+ new TG_Demo_Importer_Review_Notice();
includes/admin/class-pro-theme-notice.php DELETED
@@ -1,228 +0,0 @@
1
- <?php
2
- /**
3
- * Class to display the `Upgrade To Pro` admin notice.
4
- *
5
- * @package ThemeGrill_Demo_Importer
6
- * @since 1.6.1
7
- */
8
-
9
- defined( 'ABSPATH' ) || exit;
10
-
11
- /**
12
- * Class to display the `Upgrade to Pro` admin notice.
13
- *
14
- * Class TG_Pro_Theme_Notice
15
- */
16
- class TG_Pro_Theme_Notice {
17
-
18
- /**
19
- * Currently active theme in the site.
20
- *
21
- * @var \WP_Theme
22
- */
23
- protected $active_theme;
24
-
25
- /**
26
- * Current user id.
27
- *
28
- * @var int Current user id.
29
- */
30
- protected $current_user_data;
31
-
32
- /**
33
- * Constructor function for `Upgrade To Pro` admin notice.
34
- *
35
- * TG_Pro_Theme_Notice constructor.
36
- */
37
- public function __construct() {
38
-
39
- add_action( 'after_setup_theme', array( $this, 'pro_theme_notice' ) );
40
- add_action( 'switch_theme', array( $this, 'delete_pro_notice_datas' ) );
41
- add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
42
-
43
- }
44
-
45
- /**
46
- * Function to hold the available themes, which have pro version available.
47
- *
48
- * @return array Theme lists.
49
- */
50
- public static function get_theme_lists() {
51
-
52
- $theme_lists = array(
53
- 'spacious' => 'https://themegrill.com/pricing/?pid=958&vid=1221792&utm_source=spacious-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
54
- 'colormag' => 'https://themegrill.com/pricing/?pid=1183000&vid=1219398&utm_source=colormag-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
55
- 'estore' => 'https://themegrill.com/pricing/?pid=1242738&vid=1242847&utm_source=estore-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
56
- 'ample' => 'https://themegrill.com/pricing/?pid=774550&vid=1219401&utm_source=ample-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
57
- 'accelerate' => 'https://themegrill.com/pricing/?pid=7394&vid=1221785&utm_source=accelerate-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
58
- 'colornews' => 'https://themegrill.com/pricing/?pid=1198835&vid=1219395&utm_source=colornews-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
59
- 'foodhunt' => 'https://themegrill.com/pricing/?pid=1246665&vid=1246668&utm_source=foodhunt-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
60
- 'fitclub' => 'https://themegrill.com/pricing/?pid=1242755&vid=1242761&utm_source=fitclub-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
61
- 'radiate' => 'https://themegrill.com/pricing/?pid=179&vid=1221773&utm_source=radiate-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
62
- 'freedom' => 'https://themegrill.com/pricing/?pid=12287&vid=1221795&utm_source=freedom-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
63
- 'himalayas' => 'https://themegrill.com/pricing/?pid=1199493&vid=1219392&utm_source=himalayas-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
64
- 'esteem' => 'https://themegrill.com/pricing/?pid=14083&vid=1221789&utm_source=esteem-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
65
- 'envince' => 'https://themegrill.com/pricing/?pid=1256403&vid=1256406&utm_source=envince-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
66
- 'suffice' => 'https://themegrill.com/pricing/?pid=1307844&vid=1307847&utm_source=suffice-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
67
- 'cenote' => 'https://themegrill.com/pricing/?pid=1383257&vid=1383267&utm_source=cenote-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
68
- 'zakra' => 'https://zakratheme.com/pricing/?utm_source=zakra-dashboard-message&utm_medium=view-pricing-link&utm_campaign=upgrade',
69
- );
70
-
71
- return $theme_lists;
72
-
73
- }
74
-
75
- /**
76
- * Set upgrade time and display the admin notice as required.
77
- */
78
- public function pro_theme_notice() {
79
-
80
- global $current_user;
81
- $this->current_user_data = $current_user;
82
- $this->active_theme = wp_get_theme();
83
-
84
- // In case user is using child theme, we need to show `Upgrade To Pro` notice too.
85
- if ( is_child_theme() ) {
86
- $this->active_theme = wp_get_theme()->parent()->get( 'Name' );
87
- }
88
-
89
- $option = get_option( 'tg_pro_theme_notice_start_time' );
90
-
91
- if ( ! $option ) {
92
- update_option( 'tg_pro_theme_notice_start_time', time() );
93
- }
94
-
95
- add_action( 'admin_notices', array( $this, 'pro_theme_notice_markup' ), 0 );
96
- add_action( 'admin_init', array( $this, 'pro_theme_notice_partial_ignore' ), 0 );
97
- add_action( 'admin_init', array( $this, 'pro_theme_notice_ignore' ), 0 );
98
-
99
- }
100
-
101
- /**
102
- * Enqueue the required scripts.
103
- */
104
- public function enqueue_scripts() {
105
-
106
- $assets_path = tgdm()->plugin_url() . '/includes/admin/assets/';
107
-
108
- wp_register_style( 'tg-demo-importer-notice', $assets_path . 'css/notice.css', array(), TGDM_VERSION );
109
- wp_enqueue_style( 'tg-demo-importer-notice' );
110
- }
111
-
112
- /**
113
- * Display the `Upgrade To Pro` admin notice.
114
- */
115
- public function pro_theme_notice_markup() {
116
-
117
- $theme_lists = self::get_theme_lists();
118
- $current_theme = strtolower( $this->active_theme );
119
- $theme_notice_start_time = get_option( 'tg_pro_theme_notice_start_time' );
120
- $pre_sales_query_link = ( 'zakra' !== $current_theme ) ? "https://themegrill.com/contact/?utm_source={$current_theme}-dashboard-message&utm_medium=button-link&utm_campaign=pre-sales" : "https://zakratheme.com/support/?utm_source={$current_theme}-dashboard-message&utm_medium=button-link&utm_campaign=pre-sales";
121
- $ignore_notice_permanent = get_user_meta( $this->current_user_data->ID, 'tg_nag_pro_theme_notice_ignore', true );
122
- $ignore_notice_partially = get_user_meta( $this->current_user_data->ID, 'tg_nag_pro_theme_notice_partial_ignore', true );
123
-
124
- // Return if the theme is not available in theme lists.
125
- if ( ! array_key_exists( $current_theme, $theme_lists ) ) {
126
- return;
127
- }
128
-
129
- // Return if `Zakra Pro` plugin is installed.
130
- if ( is_plugin_active( 'zakra-pro/zakra-pro.php' ) && 'zakra' === $current_theme ) {
131
- return;
132
- }
133
-
134
- /**
135
- * Return from notice display if:
136
- *
137
- * 1. The theme installed is less than 10 days ago.
138
- * 2. If the user has ignored the message partially for 2 days.
139
- * 3. Dismiss always if clicked on 'Dismiss' button.
140
- */
141
- if ( ( $theme_notice_start_time > strtotime( '-10 day' ) ) || ( $ignore_notice_partially > strtotime( '-2 day' ) ) || ( $ignore_notice_permanent ) ) {
142
- return;
143
- }
144
- ?>
145
-
146
- <div class="notice updated pro-theme-notice">
147
- <p>
148
- <?php
149
- $pro_link = '<a target="_blank" href=" ' . esc_url( $theme_lists[ $current_theme ] ) . ' ">' . esc_html__( 'upgrade to pro', 'themegrill-demo-importer' ) . '</a>';
150
-
151
- printf(
152
- esc_html__(
153
- /* Translators: %1$s current user display name., %2$s Currently activated theme., %3$s Pro theme link., %4$s Coupon code. */
154
- 'Howdy, %1$s! You\'ve been using %2$s theme for a while now, and we hope you\'re happy with it. If you need more options and access to the premium features, you can %3$s. Also, you can use the coupon code %4$s to get 15 percent discount while making the purchase. Enjoy!', 'themegrill-demo-importer'
155
- ),
156
- '<strong>' . esc_html( $this->current_user_data->display_name ) . '</strong>',
157
- $this->active_theme,
158
- $pro_link,
159
- '<code>upgrade15</code>'
160
- );
161
- ?>
162
- </p>
163
-
164
- <div class="links">
165
- <a href="<?php echo esc_url( $theme_lists[ $current_theme ] ); ?>" class="btn button-primary"
166
- target="_blank">
167
- <span class="dashicons dashicons-thumbs-up"></span>
168
- <span><?php esc_html_e( 'Upgrade To Pro', 'themegrill-demo-importer' ); ?></span>
169
- </a>
170
-
171
- <a href="?tg_nag_pro_theme_notice_partial_ignore=1" class="btn button-secondary">
172
- <span class="dashicons dashicons-calendar"></span>
173
- <span><?php esc_html_e( 'Maybe later', 'themegrill-demo-importer' ); ?></span>
174
- </a>
175
-
176
- <a href="<?php echo esc_url( $pre_sales_query_link ); ?>"
177
- class="btn button-secondary" target="_blank">
178
- <span class="dashicons dashicons-edit"></span>
179
- <span><?php esc_html_e( 'Got pre sales queries?', 'themegrill-demo-importer' ); ?></span>
180
- </a>
181
- </div>
182
-
183
- <a class="notice-dismiss" href="?tg_nag_pro_theme_notice_ignore=1"></a>
184
- </div>
185
-
186
- <?php
187
- }
188
-
189
- /**
190
- * Set the nag for partially ignored users.
191
- */
192
- public function pro_theme_notice_partial_ignore() {
193
-
194
- $user_id = $this->current_user_data->ID;
195
-
196
- if ( isset( $_GET['tg_nag_pro_theme_notice_partial_ignore'] ) && '1' == $_GET['tg_nag_pro_theme_notice_partial_ignore'] ) {
197
- update_user_meta( $user_id, 'tg_nag_pro_theme_notice_partial_ignore', time() );
198
- }
199
-
200
- }
201
-
202
- /**
203
- * Set the nag for permanently ignored users.
204
- */
205
- public function pro_theme_notice_ignore() {
206
-
207
- $user_id = $this->current_user_data->ID;
208
-
209
- if ( isset( $_GET['tg_nag_pro_theme_notice_ignore'] ) && '1' == $_GET['tg_nag_pro_theme_notice_ignore'] ) {
210
- update_user_meta( $user_id, 'tg_nag_pro_theme_notice_ignore', time() );
211
- }
212
-
213
- }
214
-
215
- /**
216
- * Delete the pro notice datas if theme is switched.
217
- */
218
- public function delete_pro_notice_datas() {
219
-
220
- include_once TGDM_ABSPATH . 'includes/class-demo-importer-deactivator.php';
221
-
222
- TG_Demo_Importer_Deactivator::pro_upgrade_notice();
223
-
224
- }
225
-
226
- }
227
-
228
- new TG_Pro_Theme_Notice();
includes/admin/views/html-admin-page-importer.php CHANGED
@@ -11,6 +11,13 @@ defined( 'ABSPATH' ) || exit;
11
<div class="wrap demo-importer">
12
<h1 class="wp-heading-inline"><?php esc_html_e( 'Demo Importer', 'themegrill-demo-importer' ); ?></h1>
13
14
<?php if ( apply_filters( 'themegrill_demo_importer_upcoming_demos', false ) ) : ?>
15
<a href="<?php echo esc_url( 'https://themegrill.com/upcoming-demos' ); ?>" class="page-title-action" target="_blank"><?php esc_html_e( 'Upcoming Demos', 'themegrill-demo-importer' ); ?></a>
16
<?php endif; ?>
@@ -99,12 +106,14 @@ defined( 'ABSPATH' ) || exit;
99
100
<div class="theme-actions">
101
<# if ( data.active ) { #>
102
- <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url_raw( home_url( '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
103
<# } else { #>
104
<# if ( data.isPremium ) { #>
105
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
106
<# } else if ( data.isPro ) { #>
107
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
108
<# } else { #>
109
<?php
110
/* translators: %s: Demo name */
@@ -134,9 +143,11 @@ defined( 'ABSPATH' ) || exit;
134
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
135
<# } else if ( data.requiredTheme ) { #>
136
<button class="button button-primary hide-if-no-js disabled"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></button>
137
<# } else { #>
138
<# if ( data.active ) { #>
139
- <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url_raw( home_url( '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
140
<# } else { #>
141
<a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></a>
142
<# } #>
@@ -236,9 +247,11 @@ defined( 'ABSPATH' ) || exit;
236
<a class="button button-hero button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
237
<# } else if ( data.requiredTheme ) { #>
238
<button class="button button-hero button-primary hide-if-no-js disabled"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></button>
239
<# } else { #>
240
<# if ( data.active ) { #>
241
- <a class="button button-primary live-preview button-hero hide-if-no-js" target="_blank" href="<?php echo esc_url_raw( home_url( '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
242
<# } else { #>
243
<a class="button button-hero button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></a>
244
<# } #>
11
<div class="wrap demo-importer">
12
<h1 class="wp-heading-inline"><?php esc_html_e( 'Demo Importer', 'themegrill-demo-importer' ); ?></h1>
13
14
+ <a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'refresh-demo-packages', 'true' ), 'refresh_demo_packages', '_refresh_demo_packages_nonce' ) ); ?>"
15
+ class="page-title-action"
16
+ title="<?php esc_html_e( 'If you do not see the new demos on the list, please click this button to fetch all the available demos.', 'themegrill-demo-importer' ); ?>"
17
+ >
18
+ <?php esc_html_e( 'Refresh Demos', 'themegrill-demo-importer' ); ?>
19
+ </a>
20
+
21
<?php if ( apply_filters( 'themegrill_demo_importer_upcoming_demos', false ) ) : ?>
22
<a href="<?php echo esc_url( 'https://themegrill.com/upcoming-demos' ); ?>" class="page-title-action" target="_blank"><?php esc_html_e( 'Upcoming Demos', 'themegrill-demo-importer' ); ?></a>
23
<?php endif; ?>
106
107
<div class="theme-actions">
108
<# if ( data.active ) { #>
109
+ <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( get_site_url( null, '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
110
<# } else { #>
111
<# if ( data.isPremium ) { #>
112
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
113
<# } else if ( data.isPro ) { #>
114
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
115
+ <# } else if ( data.requiredVersion ) { #>
116
+ <a class="button button-primary" href="<?php echo current_user_can( 'update_themes' ) ? esc_url( admin_url( '/update-core.php' ) ) : '#'; ?>" title="{{ data.updateThemeNotice }}" target="_blank"><?php esc_html_e( 'Update', 'themegrill-demo-importer' ); ?></a>
117
<# } else { #>
118
<?php
119
/* translators: %s: Demo name */
143
<a class="button button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
144
<# } else if ( data.requiredTheme ) { #>
145
<button class="button button-primary hide-if-no-js disabled"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></button>
146
+ <# } else if ( data.requiredVersion ) { #>
147
+ <a class="button button-primary" href="<?php echo current_user_can( 'update_themes' ) ? esc_url( admin_url( '/update-core.php' ) ) : '#'; ?>" title="{{ data.updateThemeNotice }}" target="_blank"><?php esc_html_e( 'Update', 'themegrill-demo-importer' ); ?></a>
148
<# } else { #>
149
<# if ( data.active ) { #>
150
+ <a class="button button-primary live-preview" target="_blank" href="<?php echo esc_url( get_site_url( null, '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
151
<# } else { #>
152
<a class="button button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></a>
153
<# } #>
247
<a class="button button-hero button-primary purchase-now" href="{{ data.homepage }}" target="_blank"><?php esc_html_e( 'Buy Now', 'themegrill-demo-importer' ); ?></a>
248
<# } else if ( data.requiredTheme ) { #>
249
<button class="button button-hero button-primary hide-if-no-js disabled"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></button>
250
+ <# } else if ( data.requiredVersion ) { #>
251
+ <a class="button button-hero button-primary" href="<?php echo current_user_can( 'update_themes' ) ? esc_url( admin_url( '/update-core.php' ) ) : '#'; ?>" title="{{ data.updateThemeNotice }}" target="_blank"><?php esc_html_e( 'Update', 'themegrill-demo-importer' ); ?></a>
252
<# } else { #>
253
<# if ( data.active ) { #>
254
+ <a class="button button-primary live-preview button-hero hide-if-no-js" target="_blank" href="<?php echo esc_url( get_site_url( null, '/' ) ); ?>"><?php esc_html_e( 'Live Preview', 'themegrill-demo-importer' ); ?></a>
255
<# } else { #>
256
<a class="button button-hero button-primary hide-if-no-js demo-import" href="#" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php esc_html_e( 'Import Demo', 'themegrill-demo-importer' ); ?></a>
257
<# } #>
includes/class-demo-importer-deactivator.php CHANGED
@@ -19,40 +19,51 @@ class TG_Demo_Importer_Deactivator {
19
*/
20
public static function deactivate() {
21
22
- // Delete the `Upgrade To Pro` data sets.
23
- self::pro_upgrade_notice();
24
25
}
26
27
/**
28
- * Delete the options set for `Upgrade To Pro` admin notice.
29
*/
30
- public static function pro_upgrade_notice() {
31
-
32
- $get_all_users = get_users();
33
- $theme_notice_start_time = get_option( 'tg_pro_theme_notice_start_time' );
34
35
- // Delete the time set on `wp_options`.
36
- if ( $theme_notice_start_time ) {
37
- delete_option( 'tg_pro_theme_notice_start_time' );
38
- }
39
40
// Delete user meta data for theme review notice.
41
foreach ( $get_all_users as $user ) {
42
- $ignored_notice_permanent = get_user_meta( $user->ID, 'tg_nag_pro_theme_notice_ignore', true );
43
- $ignored_notice_partially = get_user_meta( $user->ID, 'tg_nag_pro_theme_notice_partial_ignore', true );
44
45
// Delete permanent notice remove data.
46
- if ( $ignored_notice_permanent ) {
47
- delete_user_meta( $user->ID, 'tg_nag_pro_theme_notice_ignore' );
48
}
49
50
// Delete partial notice remove data.
51
if ( $ignored_notice_partially ) {
52
- delete_user_meta( $user->ID, 'tg_nag_pro_theme_notice_partial_ignore' );
53
}
54
}
55
56
}
57
58
}
19
*/
20
public static function deactivate() {
21
22
+ // Delete the `Plugin Review` data sets.
23
+ self::plugin_review_notice();
24
+
25
+ // Delete the `Plugin Deactivate` data sets.
26
+ self::plugin_deactivate_notice();
27
28
}
29
30
/**
31
+ * Delete the options set for `Plugin Review` admin notice.
32
*/
33
+ public static function plugin_review_notice() {
34
35
+ $get_all_users = get_users();
36
37
// Delete user meta data for theme review notice.
38
foreach ( $get_all_users as $user ) {
39
+ $ignored_notice = get_user_meta( $user->ID, 'tg_demo_importer_plugin_review_notice', true );
40
+ $ignored_notice_partially = get_user_meta( $user->ID, 'nag_tg_demo_importer_plugin_review_notice_partially', true );
41
42
// Delete permanent notice remove data.
43
+ if ( $ignored_notice ) {
44
+ delete_user_meta( $user->ID, 'tg_demo_importer_plugin_review_notice' );
45
}
46
47
// Delete partial notice remove data.
48
if ( $ignored_notice_partially ) {
49
+ delete_user_meta( $user->ID, 'nag_tg_demo_importer_plugin_review_notice_partially' );
50
}
51
}
52
53
}
54
55
+ /**
56
+ * Delete the options set for `Plugin Deactivate` admin notice.
57
+ */
58
+ public static function plugin_deactivate_notice() {
59
+
60
+ $ignore_deactivate_notice = get_option( 'tg_demo_importer_plugin_deactivate_notice' );
61
+
62
+ // Delete the options table row.
63
+ if ( $ignore_deactivate_notice ) {
64
+ delete_option( 'tg_demo_importer_plugin_deactivate_notice' );
65
+ }
66
+
67
+ }
68
+
69
}
includes/class-demo-importer.php CHANGED
@@ -48,7 +48,7 @@ class TG_Demo_Importer {
48
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
49
50
// Disable WooCommerce setup wizard.
51
- add_filter( 'woocommerce_enable_setup_wizard', '__return_false', 1 );
52
53
// AJAX Events to query demo, import demo and update rating footer.
54
add_action( 'wp_ajax_query-demos', array( $this, 'ajax_query_demos' ) );
@@ -63,6 +63,9 @@ class TG_Demo_Importer {
63
// Update widget and customizer demo import settings data.
64
add_filter( 'themegrill_widget_demo_import_settings', array( $this, 'update_widget_data' ), 10, 4 );
65
add_filter( 'themegrill_customizer_demo_import_settings', array( $this, 'update_customizer_data' ), 10, 2 );
66
}
67
68
/**
@@ -155,6 +158,10 @@ class TG_Demo_Importer {
155
wp_register_style( 'jquery-confirm', $assets_path . 'css/jquery-confirm/jquery-confirm.css', array(), TGDM_VERSION );
156
wp_register_style( 'tg-demo-importer', $assets_path . 'css/demo-importer.css', array( 'jquery-confirm' ), TGDM_VERSION );
157
158
// Add RTL support for admin styles.
159
wp_style_add_data( 'tg-demo-importer', 'rtl', 'replace' );
160
@@ -385,7 +392,7 @@ class TG_Demo_Importer {
385
386
if ( isset( $_GET['themegrill_demo_importer_reset_nonce'], $_GET['do_reset_wordpress'] ) ) {
387
if ( ! wp_verify_nonce( wp_unslash( $_GET['themegrill_demo_importer_reset_nonce'] ), 'themegrill_demo_importer_reset' ) ) { // WPCS: input var ok, sanitization ok.
388
- wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'everest-forms' ) );
389
}
390
391
if ( ! current_user_can( 'manage_options' ) ) {
@@ -463,6 +470,19 @@ class TG_Demo_Importer {
463
}
464
}
465
466
/**
467
* Demo Importer page output.
468
*/
@@ -489,11 +509,23 @@ class TG_Demo_Importer {
489
* Ajax handler for getting demos from github.
490
*/
491
public function ajax_query_demos( $return = true ) {
492
- $prepared_demos = array();
493
- $current_template = get_option( 'template' );
494
- $is_pro_theme_demo = strpos( $current_template, '-pro' ) !== false;
495
- $demo_activated_id = get_option( 'themegrill_demo_importer_activated_id' );
496
- $available_packages = $this->demo_packages;
497
498
/**
499
* Filters demo data before it is prepared for JavaScript.
@@ -549,24 +581,138 @@ class TG_Demo_Importer {
549
}
550
}
551
552
// Prepare all demos.
553
$prepared_demos[ $package_slug ] = array(
554
- 'slug' => $package_slug,
555
- 'name' => $package_data->title,
556
- 'theme' => $is_pro_theme_demo ? sprintf( esc_html__( '%s Pro', 'themegrill-demo-importer' ), $available_packages->name ) : $available_packages->name,
557
- 'isPro' => $is_pro_theme_demo ? false : isset( $package_data->isPro ),
558
- 'isPremium' => $this->zakra_is_premium_theme_plan() ? false : isset( $package_data->isPremium ),
559
- 'active' => $package_slug === $demo_activated_id,
560
- 'author' => isset( $package_data->author ) ? $package_data->author : __( 'ThemeGrill', 'themegrill-demo-importer' ),
561
- 'version' => isset( $package_data->version ) ? $package_data->version : $available_packages->version,
562
- 'description' => isset( $package_data->description ) ? $package_data->description : '',
563
- 'homepage' => $available_packages->homepage,
564
- 'preview_url' => set_url_scheme( $package_data->preview ),
565
- 'screenshot_url' => $screenshot_url,
566
- 'plugins' => $plugins_list,
567
- 'requiredTheme' => isset( $package_data->template ) && ! in_array( $current_template, $package_data->template, true ),
568
- 'requiredPlugins' => wp_list_filter( json_decode( wp_json_encode( $plugins_list ), true ), array( 'is_active' => false ) ) ? true : false,
569
);
570
}
571
}
572
@@ -671,7 +817,7 @@ class TG_Demo_Importer {
671
672
$demo_data = $packages[ $slug ];
673
$status['demoName'] = $demo_data['title'];
674
- $status['previewUrl'] = get_home_url( '/' );
675
676
do_action( 'themegrill_ajax_before_demo_import' );
677
@@ -1272,6 +1418,27 @@ class TG_Demo_Importer {
1272
}
1273
}
1274
}
1275
}
1276
1277
new TG_Demo_Importer();
48
add_filter( 'admin_footer_text', array( $this, 'admin_footer_text' ), 1 );
49
50
// Disable WooCommerce setup wizard.
51
+ add_action( 'current_screen', array( $this, 'woocommerce_disable_setup_wizard' ) );
52
53
// AJAX Events to query demo, import demo and update rating footer.
54
add_action( 'wp_ajax_query-demos', array( $this, 'ajax_query_demos' ) );
63
// Update widget and customizer demo import settings data.
64
add_filter( 'themegrill_widget_demo_import_settings', array( $this, 'update_widget_data' ), 10, 4 );
65
add_filter( 'themegrill_customizer_demo_import_settings', array( $this, 'update_customizer_data' ), 10, 2 );
66
+
67
+ // Refresh demos.
68
+ add_action( 'admin_init', array( $this, 'refresh_demo_lists' ) );
69
}
70
71
/**
158
wp_register_style( 'jquery-confirm', $assets_path . 'css/jquery-confirm/jquery-confirm.css', array(), TGDM_VERSION );
159
wp_register_style( 'tg-demo-importer', $assets_path . 'css/demo-importer.css', array( 'jquery-confirm' ), TGDM_VERSION );
160
161
+ // Register and enqueue admin notice files.
162
+ wp_register_style( 'tg-demo-importer-notice', tgdm()->plugin_url() . '/includes/admin/assets/css/notice.css', array(), TGDM_VERSION );
163
+ wp_enqueue_style( 'tg-demo-importer-notice' );
164
+
165
// Add RTL support for admin styles.
166
wp_style_add_data( 'tg-demo-importer', 'rtl', 'replace' );
167
392
393
if ( isset( $_GET['themegrill_demo_importer_reset_nonce'], $_GET['do_reset_wordpress'] ) ) {
394
if ( ! wp_verify_nonce( wp_unslash( $_GET['themegrill_demo_importer_reset_nonce'] ), 'themegrill_demo_importer_reset' ) ) { // WPCS: input var ok, sanitization ok.
395
+ wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'themegrill-demo-importer' ) );
396
}
397
398
if ( ! current_user_can( 'manage_options' ) ) {
470
}
471
}
472
473
+ /**
474
+ * Disable the WooCommerce Setup Wizard on `ThemeGrill Demo Importer` page only.
475
+ */
476
+ public function woocommerce_disable_setup_wizard() {
477
+
478
+ $screen = get_current_screen();
479
+
480
+ if ( 'appearance_page_demo-importer' === $screen->id ) {
481
+ add_filter( 'woocommerce_enable_setup_wizard', '__return_false', 1 );
482
+ }
483
+
484
+ }
485
+
486
/**
487
* Demo Importer page output.
488
*/
509
* Ajax handler for getting demos from github.
510
*/
511
public function ajax_query_demos( $return = true ) {
512
+ $prepared_demos = array();
513
+ $current_template = get_option( 'template' );
514
+ $current_theme_name = wp_get_theme()->get( 'Name' );
515
+ $current_theme_version = wp_get_theme()->get( 'Version' );
516
+ $is_pro_theme_demo = strpos( $current_template, '-pro' ) !== false;
517
+ $demo_activated_id = get_option( 'themegrill_demo_importer_activated_id' );
518
+ $available_packages = $this->demo_packages;
519
+
520
+ // Condition for Zakra Pro.
521
+ $zakra_pro_plugin_version = is_plugin_active( 'zakra-pro/zakra-pro.php' ) ? ZAKRA_PRO_VERSION : false;
522
+ $companion_elementor_plugin_name = is_plugin_active( 'companion-elementor/companion-elementor.php' ) ? COMPANION_ELEMENTOR_VERSION : false;
523
+
524
+ // Condition if child theme is being used.
525
+ if ( is_child_theme() ) {
526
+ $current_theme_name = wp_get_theme()->parent()->get( 'Name' );
527
+ $current_theme_version = wp_get_theme()->parent()->get( 'Version' );
528
+ }
529
530
/**
531
* Filters demo data before it is prepared for JavaScript.
581
}
582
}
583
584
+ // Get the required theme versions.
585
+ $required_version_installed = false;
586
+ $required_version = false;
587
+ $zakra_pro_required_version = false;
588
+ $companion_elementor_required_version = false;
589
+ if ( isset( $package_data->minimum_version ) && is_object( $package_data->minimum_version ) ) {
590
+ foreach ( $package_data->minimum_version as $theme => $minimum_version ) {
591
+ if ( 'zakra' === $current_template ) {
592
+ if (
593
+ version_compare( $minimum_version, $current_theme_version, '>' ) ||
594
+ ( 'zakra-pro' === $theme && version_compare( $minimum_version, $zakra_pro_plugin_version, '>' ) ) ||
595
+ ( 'companion-elementor' === $theme && version_compare( $minimum_version, $companion_elementor_plugin_name, '>' ) )
596
+ ) {
597
+ $required_version_installed = true;
598
+
599
+ if ( 'zakra' === $theme ) {
600
+ $required_version = $minimum_version;
601
+ }
602
+
603
+ if ( 'zakra-pro' === $theme ) {
604
+ $zakra_pro_required_version = $minimum_version;
605
+ }
606
+
607
+ if ( 'companion-elementor' === $theme ) {
608
+ $companion_elementor_required_version = $minimum_version;
609
+ }
610
+ }
611
+ } else {
612
+ if ( $current_template === $theme && version_compare( $minimum_version, $current_theme_version, '>' ) ) {
613
+ $required_version = $minimum_version;
614
+ $required_version_installed = true;
615
+ }
616
+ }
617
+ }
618
+ }
619
+
620
+ // For required message.
621
+ $required_message = false;
622
+ if ( 'zakra' === $current_template ) {
623
+ if ( $required_version ) {
624
+ $required_message = sprintf( esc_html__( 'This demo requires %1$s version of %2$s theme to get imported', 'themegrill-demo-importer' ), $required_version, $current_theme_name );
625
+ }
626
+
627
+ if ( $zakra_pro_required_version ) {
628
+ if ( $required_version && $companion_elementor_required_version ) {
629
+ $required_message = sprintf(
630
+ esc_html__( 'This demo requires %1$s version of %2$s theme and %3$s version of %4$s as well as %5$s version of %6$s plugins to get imported', 'themegrill-demo-importer' ),
631
+ $required_version,
632
+ $current_theme_name,
633
+ $zakra_pro_required_version,
634
+ esc_html__( 'Zakra Pro', 'themegrill-demo-importer' ),
635
+ $companion_elementor_required_version,
636
+ esc_html__( 'Companion Elementor', 'themegrill-demo-importer' )
637
+ );
638
+ } elseif ( $required_version ) {
639
+ $required_message = sprintf(
640
+ esc_html__( 'This demo requires %1$s version of %2$s theme and %3$s version of %4$s plugin to get imported', 'themegrill-demo-importer' ),
641
+ $required_version,
642
+ $current_theme_name,
643
+ $zakra_pro_required_version,
644
+ esc_html__( 'Zakra Pro', 'themegrill-demo-importer' )
645
+ );
646
+ } else {
647
+ $required_message = sprintf(
648
+ esc_html__( 'This demo requires %1$s version of %2$s plugin to get imported', 'themegrill-demo-importer' ),
649
+ $zakra_pro_required_version,
650
+ esc_html__( 'Zakra Pro', 'themegrill-demo-importer' )
651
+ );
652
+ }
653
+ }
654
+
655
+ if ( $companion_elementor_required_version ) {
656
+ if ( $required_version && $zakra_pro_required_version ) {
657
+ $required_message = sprintf(
658
+ esc_html__( 'This demo requires %1$s version of %2$s theme and %3$s version of %4$s as well as %5$s version of %6$s plugins to get imported', 'themegrill-demo-importer' ),
659
+ $required_version,
660
+ $current_theme_name,
661
+ $zakra_pro_required_version,
662
+ esc_html__( 'Zakra Pro', 'themegrill-demo-importer' ),
663
+ $companion_elementor_required_version,
664
+ esc_html__( 'Companion Elementor', 'themegrill-demo-importer' )
665
+ );
666
+ } elseif ( $required_version ) {
667
+ $required_message = sprintf(
668
+ esc_html__( 'This demo requires %1$s version of %2$s theme and %3$s version of %4$s plugin to get imported', 'themegrill-demo-importer' ),
669
+ $required_version,
670
+ $current_theme_name,
671
+ $companion_elementor_required_version,
672
+ esc_html__( 'Companion Elementor', 'themegrill-demo-importer' )
673
+ );
674
+ } else {
675
+ $required_message = sprintf(
676
+ esc_html__( 'This demo requires %1$s version of %2$s plugin to get imported', 'themegrill-demo-importer' ),
677
+ $companion_elementor_required_version,
678
+ esc_html__( 'Companion Elementor', 'themegrill-demo-importer' )
679
+ );
680
+ }
681
+ }
682
+ } else {
683
+ if ( $required_version ) {
684
+ $required_message = sprintf(
685
+ esc_html__( 'This demo requires %1$s version of %2$s theme to get imported', 'themegrill-demo-importer' ),
686
+ $required_version,
687
+ $current_theme_name
688
+ );
689
+ }
690
+ }
691
+
692
// Prepare all demos.
693
$prepared_demos[ $package_slug ] = array(
694
+ 'slug' => $package_slug,
695
+ 'name' => $package_data->title,
696
+ 'theme' => $is_pro_theme_demo ? sprintf( esc_html__( '%s Pro', 'themegrill-demo-importer' ), $available_packages->name ) : $available_packages->name,
697
+ 'isPro' => $is_pro_theme_demo ? false : isset( $package_data->isPro ),
698
+ 'isPremium' => $this->zakra_is_premium_theme_plan() ? false : isset( $package_data->isPremium ),
699
+ 'active' => $package_slug === $demo_activated_id,
700
+ 'author' => isset( $package_data->author ) ? $package_data->author : __( 'ThemeGrill', 'themegrill-demo-importer' ),
701
+ 'version' => isset( $package_data->version ) ? $package_data->version : $available_packages->version,
702
+ 'description' => isset( $package_data->description ) ? $package_data->description : '',
703
+ 'homepage' => $available_packages->homepage,
704
+ 'preview_url' => set_url_scheme( $package_data->preview ),
705
+ 'screenshot_url' => $screenshot_url,
706
+ 'plugins' => $plugins_list,
707
+ 'requiredTheme' => isset( $package_data->template ) && ! in_array( $current_template, $package_data->template, true ),
708
+ 'requiredPlugins' => wp_list_filter( json_decode( wp_json_encode( $plugins_list ), true ), array( 'is_active' => false ) ) ? true : false,
709
+ 'requiredVersion' => $required_version_installed,
710
+ 'updateThemeNotice' => $required_message,
711
);
712
+
713
+ unset( $required_version );
714
+ unset( $zakra_pro_required_version );
715
+ unset( $companion_elementor_required_version );
716
}
717
}
718
817
818
$demo_data = $packages[ $slug ];
819
$status['demoName'] = $demo_data['title'];
820
+ $status['previewUrl'] = get_site_url( null, '/' );
821
822
do_action( 'themegrill_ajax_before_demo_import' );
823
1418
}
1419
}
1420
}
1421
+
1422
+ /**
1423
+ * Refreshes the demo lists.
1424
+ */
1425
+ public function refresh_demo_lists() {
1426
+ // Reset the transient if user has clicked on the `Refresh Demos` button.
1427
+ if ( isset( $_GET['refresh-demo-packages'] ) && isset( $_GET['_refresh_demo_packages_nonce'] ) ) {
1428
+ if ( ! wp_verify_nonce( $_GET['_refresh_demo_packages_nonce'], 'refresh_demo_packages' ) ) {
1429
+ wp_die( __( 'Action failed. Please refresh the page and retry.', 'themegrill-demo-importer' ) );
1430
+ }
1431
+
1432
+ $demo_packages = get_transient( 'themegrill_demo_importer_packages' );
1433
+
1434
+ if ( $demo_packages ) {
1435
+ delete_transient( 'themegrill_demo_importer_packages' );
1436
+ }
1437
+
1438
+ // Redirect to demo import page once the transient is clear, since on first click, none of the demo is shown up in lists.
1439
+ wp_safe_redirect( admin_url( 'themes.php?page=demo-importer&browse=all' ) );
1440
+ }
1441
+ }
1442
}
1443
1444
new TG_Demo_Importer();
includes/class-themegrill-demo-importer.php CHANGED
@@ -20,7 +20,7 @@ final class ThemeGrill_Demo_Importer {
20
*
21
* @var string
22
*/
23
- public $version = '1.6.3';
24
25
/**
26
* Theme single instance of this class.
@@ -139,7 +139,8 @@ final class ThemeGrill_Demo_Importer {
139
private function includes() {
140
include_once TGDM_ABSPATH . 'includes/class-demo-importer.php';
141
include_once TGDM_ABSPATH . 'includes/functions-demo-importer.php';
142
- include_once TGDM_ABSPATH . 'includes/admin/class-pro-theme-notice.php';
143
144
// Backward compatibility for demo packages config.
145
if ( file_exists( TGDM_DEMO_DIR . 'tg-demo-config.php' ) ) {
@@ -182,12 +183,10 @@ final class ThemeGrill_Demo_Importer {
182
/**
183
* Deactivation hook.
184
*/
185
- function deactivate() {
186
-
187
include_once dirname( __FILE__ ) . '/class-demo-importer-deactivator.php';
188
189
TG_Demo_Importer_Deactivator::deactivate();
190
-
191
}
192
193
/**
20
*
21
* @var string
22
*/
23
+ public $version = '1.6.4';
24
25
/**
26
* Theme single instance of this class.
139
private function includes() {
140
include_once TGDM_ABSPATH . 'includes/class-demo-importer.php';
141
include_once TGDM_ABSPATH . 'includes/functions-demo-importer.php';
142
+ include_once TGDM_ABSPATH . 'includes/admin/class-plugin-review-notice.php';
143
+ include_once TGDM_ABSPATH . 'includes/admin/class-plugin-deactivate-notice.php';
144
145
// Backward compatibility for demo packages config.
146
if ( file_exists( TGDM_DEMO_DIR . 'tg-demo-config.php' ) ) {
183
/**
184
* Deactivation hook.
185
*/
186
+ public function deactivate() {
187
include_once dirname( __FILE__ ) . '/class-demo-importer-deactivator.php';
188
189
TG_Demo_Importer_Deactivator::deactivate();
190
}
191
192
/**
languages/themegrill-demo-importer.pot CHANGED
@@ -1,15 +1,15 @@
1
- # Copyright (C) 2019 ThemeGrill
2
# This file is distributed under the GPLv3 or later.
3
msgid ""
4
msgstr ""
5
- "Project-Id-Version: ThemeGrill Demo Importer 1.6.1\n"
6
"Report-Msgid-Bugs-To: "
7
"https://github.com/themegrill/themegrill-demo-importer/issues\n"
8
- "POT-Creation-Date: 2019-10-18 07:08:31+00:00\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=utf-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
- "PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
13
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
15
"X-Generator: grunt-wp-i18n 1.0.3\n"
@@ -55,153 +55,192 @@ msgstr ""
55
msgid "No valid demos were found."
56
msgstr ""
57
58
- #: includes/admin/class-pro-theme-notice.php:149
59
- msgid "upgrade to pro"
60
msgstr ""
61
62
- #: includes/admin/class-pro-theme-notice.php:168
63
- #. Translators: %1$s current user display name., %2$s Currently activated
64
- #. theme., %3$s Pro theme link., %4$s Coupon code.
65
- msgid "Upgrade To Pro"
66
msgstr ""
67
68
- #: includes/admin/class-pro-theme-notice.php:173
69
msgid "Maybe later"
70
msgstr ""
71
72
- #: includes/admin/class-pro-theme-notice.php:179
73
- msgid "Got pre sales queries?"
74
msgstr ""
75
76
#: includes/admin/views/html-admin-page-importer.php:12
77
- #: includes/class-demo-importer.php:121
78
- #: includes/class-themegrill-demo-importer.php:237
79
msgid "Demo Importer"
80
msgstr ""
81
82
- #: includes/admin/views/html-admin-page-importer.php:15
83
msgid "Upcoming Demos"
84
msgstr ""
85
86
- #: includes/admin/views/html-admin-page-importer.php:21
87
msgid "The Demo Importer screen requires JavaScript."
88
msgstr ""
89
90
- #: includes/admin/views/html-admin-page-importer.php:24
91
msgid "Filter demos list"
92
msgstr ""
93
94
- #: includes/admin/views/html-admin-page-importer.php:47
95
msgid "Without Page Builder"
96
msgstr ""
97
98
- #: includes/admin/views/html-admin-page-importer.php:56
99
msgid "Themes list"
100
msgstr ""
101
102
- #: includes/admin/views/html-admin-page-importer.php:60
103
- #: includes/class-demo-importer.php:228
104
msgid "No demos found. Try a different search."
105
msgstr ""
106
107
- #: includes/admin/views/html-admin-page-importer.php:74
108
- #: includes/admin/views/html-admin-page-importer.php:150
109
msgid "Premium"
110
msgstr ""
111
112
- #: includes/admin/views/html-admin-page-importer.php:78
113
- #: includes/admin/views/html-admin-page-importer.php:154
114
msgid "Pro"
115
msgstr ""
116
117
- #: includes/admin/views/html-admin-page-importer.php:84
118
- #: includes/admin/views/html-admin-page-importer.php:161
119
#. translators: %s: Demo author name
120
msgid "By %s"
121
msgstr ""
122
123
- #: includes/admin/views/html-admin-page-importer.php:93
124
#. translators: %s: Demo name
125
msgid "<span>Imported:</span> %s"
126
msgstr ""
127
128
- #: includes/admin/views/html-admin-page-importer.php:102
129
- #: includes/admin/views/html-admin-page-importer.php:139
130
- #: includes/admin/views/html-admin-page-importer.php:241
131
- #: includes/class-demo-importer.php:184
132
msgid "Live Preview"
133
msgstr ""
134
135
- #: includes/admin/views/html-admin-page-importer.php:105
136
- #: includes/admin/views/html-admin-page-importer.php:107
137
- #: includes/admin/views/html-admin-page-importer.php:132
138
- #: includes/admin/views/html-admin-page-importer.php:134
139
- #: includes/admin/views/html-admin-page-importer.php:234
140
- #: includes/admin/views/html-admin-page-importer.php:236
141
msgid "Buy Now"
142
msgstr ""
143
144
- #: includes/admin/views/html-admin-page-importer.php:113
145
msgid "Import"
146
msgstr ""
147
148
- #: includes/admin/views/html-admin-page-importer.php:115
149
- #: includes/admin/views/html-admin-page-importer.php:267
150
msgid "Preview"
151
msgstr ""
152
153
- #: includes/admin/views/html-admin-page-importer.php:128
154
msgid "Close"
155
msgstr ""
156
157
- #: includes/admin/views/html-admin-page-importer.php:136
158
- #: includes/admin/views/html-admin-page-importer.php:141
159
- #: includes/admin/views/html-admin-page-importer.php:238
160
- #: includes/admin/views/html-admin-page-importer.php:243
161
msgid "Import Demo"
162
msgstr ""
163
164
- #: includes/admin/views/html-admin-page-importer.php:172
165
- #: includes/admin/views/html-admin-page-importer.php:181
166
#. translators: %s: Theme Name
167
msgid "%s theme is not active."
168
msgstr ""
169
170
- #: includes/admin/views/html-admin-page-importer.php:188
171
#. translators: %s: Demo version
172
msgid "Version: %s"
173
msgstr ""
174
175
- #: includes/admin/views/html-admin-page-importer.php:195
176
msgid "Plugins Information"
177
msgstr ""
178
179
- #: includes/admin/views/html-admin-page-importer.php:200
180
msgid "Required Plugins"
181
msgstr ""
182
183
- #: includes/admin/views/html-admin-page-importer.php:223
184
msgid "No plugins are required for this demo."
185
msgstr ""
186
187
- #: includes/admin/views/html-admin-page-importer.php:247
188
- #: includes/class-demo-importer.php:229
189
msgid "Collapse Sidebar"
190
msgstr ""
191
192
- #: includes/admin/views/html-admin-page-importer.php:249
193
msgid "Collapse"
194
msgstr ""
195
196
- #: includes/admin/views/html-admin-page-importer.php:254
197
msgid "Enter desktop preview mode"
198
msgstr ""
199
200
- #: includes/admin/views/html-admin-page-importer.php:257
201
msgid "Enter tablet preview mode"
202
msgstr ""
203
204
- #: includes/admin/views/html-admin-page-importer.php:260
205
msgid "Enter mobile preview mode"
206
msgstr ""
207
@@ -211,55 +250,55 @@ msgid ""
211
"<strong>\"%1$s\"</strong> was recreated with its previous password."
212
msgstr ""
213
214
- #: includes/admin/views/html-notice-reset-wizard.php:12
215
msgid ""
216
"<strong>Reset Wizard</strong> &#8211; If you need to reset the WordPress "
217
"back to default again :)"
218
msgstr ""
219
220
- #: includes/admin/views/html-notice-reset-wizard.php:13
221
msgid "Run the Reset Wizard"
222
msgstr ""
223
224
- #: includes/admin/views/html-notice-reset-wizard.php:13
225
msgid "Hide this notice"
226
msgstr ""
227
228
- #: includes/class-demo-importer.php:176
229
msgid "Importing..."
230
msgstr ""
231
232
- #: includes/class-demo-importer.php:178
233
msgid "Importing... please wait."
234
msgstr ""
235
236
- #: includes/class-demo-importer.php:179
237
msgid "Import completed successfully."
238
msgstr ""
239
240
- #: includes/class-demo-importer.php:180
241
msgid "Import Failed!"
242
msgstr ""
243
244
- #: includes/class-demo-importer.php:181
245
msgid "Import failed: %s"
246
msgstr ""
247
248
- #: includes/class-demo-importer.php:186
249
msgid "Imported!"
250
msgstr ""
251
252
- #: includes/class-demo-importer.php:187
253
msgid "Try this solution!"
254
msgstr ""
255
256
- #: includes/class-demo-importer.php:201
257
msgid ""
258
"It is strongly recommended that you backup your database before proceeding. "
259
"Are you sure you wish to run the reset wizard now?"
260
msgstr ""
261
262
- #: includes/class-demo-importer.php:204
263
msgid ""
264
"Importing demo data will ensure that your site will look similar as theme "
265
"demo. It makes you easy to modify the content instead of creating them from "
@@ -267,47 +306,47 @@ msgid ""
267
"%6$s"
268
msgstr ""
269
270
- #: includes/class-demo-importer.php:206
271
msgid ""
272
"Importing the demo on the site if you have already added the content is "
273
"highly discouraged."
274
msgstr ""
275
276
- #: includes/class-demo-importer.php:208
277
msgid ""
278
"You need to import demo on fresh WordPress install to exactly replicate the "
279
"theme demo."
280
msgstr ""
281
282
- #: includes/class-demo-importer.php:210
283
msgid ""
284
"It will install the required plugins as well as activate them for "
285
"installing the required theme demo within your site."
286
msgstr ""
287
288
- #: includes/class-demo-importer.php:212
289
msgid "Copyright images will get replaced with other placeholder images."
290
msgstr ""
291
292
- #: includes/class-demo-importer.php:214
293
msgid ""
294
"None of the posts, pages, attachments or any other data already existing in "
295
"your site will be deleted or modified."
296
msgstr ""
297
298
- #: includes/class-demo-importer.php:216
299
msgid "It will take some time to import the theme demo."
300
msgstr ""
301
302
- #: includes/class-demo-importer.php:221
303
msgid "Search Demos"
304
msgstr ""
305
306
- #: includes/class-demo-importer.php:222
307
msgid "Search demos..."
308
msgstr ""
309
310
- #: includes/class-demo-importer.php:224
311
#. translators: %s: support forums URL
312
msgid ""
313
"An unexpected error occurred. Something may be wrong with ThemeGrill demo "
@@ -315,32 +354,32 @@ msgid ""
315
"the <a href=\"%s\">support forums</a>."
316
msgstr ""
317
318
- #: includes/class-demo-importer.php:225
319
msgid "Try Again"
320
msgstr ""
321
322
- #: includes/class-demo-importer.php:226
323
msgid "Please suggest us!"
324
msgstr ""
325
326
- #: includes/class-demo-importer.php:227
327
msgid "Number of Demos found: %d"
328
msgstr ""
329
330
- #: includes/class-demo-importer.php:230
331
msgid "Expand Sidebar"
332
msgstr ""
333
334
- #: includes/class-demo-importer.php:232
335
#. translators: accessibility text
336
msgid "Select one or more Demo features to filter by"
337
msgstr ""
338
339
- #: includes/class-demo-importer.php:233
340
msgid "Confirm!"
341
msgstr ""
342
343
- #: includes/class-demo-importer.php:259
344
#. translators: 1: ThemeGrill Demo Importer 2: five stars
345
msgid "If you like %1$s please leave us a %2$s rating. A huge thanks in advance!"
346
msgstr ""
@@ -349,45 +388,45 @@ msgstr ""
349
msgid "ThemeGrill Demo Importer"
350
msgstr ""
351
352
- #: includes/class-demo-importer.php:261
353
msgid "Thanks :)"
354
msgstr ""
355
356
- #: includes/class-demo-importer.php:264
357
msgid "Thank you for importing with ThemeGrill Demo Importer."
358
msgstr ""
359
360
- #: includes/class-demo-importer.php:284 includes/class-demo-importer.php:286
361
msgid "Help &amp; Support"
362
msgstr ""
363
364
- #: includes/class-demo-importer.php:288
365
msgid ""
366
"Should you need help understanding, using, or extending ThemeGrill Demo "
367
"Importer, <a href=\"%s\">please read our documentation</a>. You will find "
368
"all kinds of resources including snippets, tutorials and much more."
369
msgstr ""
370
371
- #: includes/class-demo-importer.php:292
372
msgid ""
373
"For further assistance with ThemeGrill Demo Importer core you can use the "
374
"<a href=\"%1$s\">community forum</a>. If you need help with premium themes "
375
"sold by ThemeGrill, please <a href=\"%2$s\">use our free support forum</a>."
376
msgstr ""
377
378
- #: includes/class-demo-importer.php:296
379
msgid "Community forum"
380
msgstr ""
381
382
- #: includes/class-demo-importer.php:296
383
msgid "ThemeGrill Support"
384
msgstr ""
385
386
- #: includes/class-demo-importer.php:303 includes/class-demo-importer.php:305
387
msgid "Found a bug?"
388
msgstr ""
389
390
- #: includes/class-demo-importer.php:306
391
msgid ""
392
"If you find a bug within ThemeGrill Demo Importer you can create a ticket "
393
"via <a href=\"%1$s\">Github issues</a>. Ensure you read the <a "
@@ -395,56 +434,86 @@ msgid ""
395
"help us solve your issue, please be as descriptive as possible."
396
msgstr ""
397
398
- #: includes/class-demo-importer.php:307
399
msgid "Report a bug"
400
msgstr ""
401
402
- #: includes/class-demo-importer.php:315 includes/class-demo-importer.php:317
403
- #: includes/class-demo-importer.php:319
404
msgid "Reset wizard"
405
msgstr ""
406
407
- #: includes/class-demo-importer.php:318
408
msgid ""
409
"If you need to reset the WordPress back to default again, please click on "
410
"the button below."
411
msgstr ""
412
413
- #: includes/class-demo-importer.php:324
414
msgid "For more information:"
415
msgstr ""
416
417
- #: includes/class-demo-importer.php:325
418
msgid "About Demo Importer"
419
msgstr ""
420
421
- #: includes/class-demo-importer.php:326
422
msgid "WordPress.org project"
423
msgstr ""
424
425
- #: includes/class-demo-importer.php:327
426
msgid "Github project"
427
msgstr ""
428
429
- #: includes/class-demo-importer.php:328
430
msgid "Official themes"
431
msgstr ""
432
433
- #: includes/class-demo-importer.php:329
434
msgid "Official plugins"
435
msgstr ""
436
437
- #: includes/class-demo-importer.php:359
438
- msgid "Action failed. Please refresh the page and retry."
439
- msgstr ""
440
-
441
- #: includes/class-demo-importer.php:363
442
#: includes/class-themegrill-demo-importer.php:50
443
#: includes/class-themegrill-demo-importer.php:59
444
msgid "Cheatin&#8217; huh?"
445
msgstr ""
446
447
- #: includes/class-demo-importer.php:542
448
msgid "%s Pro"
449
msgstr ""
450
@@ -452,56 +521,56 @@ msgstr ""
452
msgid "ThemeGrill"
453
msgstr ""
454
455
- #: includes/class-demo-importer.php:600
456
msgid "No demo specified."
457
msgstr ""
458
459
- #: includes/class-demo-importer.php:616
460
msgid "Sorry, you are not allowed to import content."
461
msgstr ""
462
463
- #: includes/class-demo-importer.php:648
464
#: includes/functions-demo-importer.php:110
465
msgid "Unable to connect to the filesystem. Please confirm your credentials."
466
msgstr ""
467
468
- #: includes/class-demo-importer.php:731
469
msgid "The XML file dummy content is missing."
470
msgstr ""
471
472
- #: includes/class-demo-importer.php:822
473
msgid "The DAT file customizer data is missing."
474
msgstr ""
475
476
- #: includes/class-demo-importer.php:847
477
msgid "The WIE file widget content is missing."
478
msgstr ""
479
480
- #: includes/class-themegrill-demo-importer.php:237
481
msgid "View Demo Importer"
482
msgstr ""
483
484
- #: includes/class-themegrill-demo-importer.php:253
485
msgid "View Demo Importer Documentation"
486
msgstr ""
487
488
- #: includes/class-themegrill-demo-importer.php:253
489
msgid "Docs"
490
msgstr ""
491
492
- #: includes/class-themegrill-demo-importer.php:254
493
msgid "Visit Free Customer Support Forum"
494
msgstr ""
495
496
- #: includes/class-themegrill-demo-importer.php:254
497
msgid "Free Support"
498
msgstr ""
499
500
- #: includes/class-themegrill-demo-importer.php:270
501
msgid "This plugin requires %s to be activated to work."
502
msgstr ""
503
504
- #: includes/class-themegrill-demo-importer.php:270
505
msgid "Official ThemeGrill Theme"
506
msgstr ""
507
@@ -795,48 +864,48 @@ msgstr ""
795
msgid "https://themegrill.com"
796
msgstr ""
797
798
- #: includes/admin/views/html-admin-page-importer.php:111
799
#. translators: %s: Demo name
800
msgctxt "demo"
801
msgid "Import %s"
802
msgstr ""
803
804
- #: includes/admin/views/html-admin-page-importer.php:121
805
msgctxt "demo"
806
msgid "Imported"
807
msgstr ""
808
809
- #: includes/class-demo-importer.php:177
810
msgctxt "demo"
811
msgid "Importing %s..."
812
msgstr ""
813
814
- #: includes/class-demo-importer.php:182
815
msgctxt "demo"
816
msgid "%s imported!"
817
msgstr ""
818
819
- #: includes/class-demo-importer.php:183
820
msgctxt "demo"
821
msgid "%s import failed"
822
msgstr ""
823
824
- #: includes/class-demo-importer.php:185
825
msgctxt "demo"
826
msgid "Live Preview %s"
827
msgstr ""
828
829
- #: includes/admin/views/html-admin-page-importer.php:129
830
msgctxt "Button label for a demo"
831
msgid "Previous"
832
msgstr ""
833
834
- #: includes/admin/views/html-admin-page-importer.php:130
835
msgctxt "Button label for a demo"
836
msgid "Next"
837
msgstr ""
838
839
- #: includes/class-demo-importer.php:136
840
msgctxt "Admin menu name"
841
msgid "Demo Importer"
842
msgstr ""
1
+ # Copyright (C) 2020 ThemeGrill
2
# This file is distributed under the GPLv3 or later.
3
msgid ""
4
msgstr ""
5
+ "Project-Id-Version: ThemeGrill Demo Importer 1.6.4\n"
6
"Report-Msgid-Bugs-To: "
7
"https://github.com/themegrill/themegrill-demo-importer/issues\n"
8
+ "POT-Creation-Date: 2020-06-04 06:28:04+00:00\n"
9
"MIME-Version: 1.0\n"
10
"Content-Type: text/plain; charset=utf-8\n"
11
"Content-Transfer-Encoding: 8bit\n"
12
+ "PO-Revision-Date: 2020-MO-DA HO:MI+ZONE\n"
13
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
15
"X-Generator: grunt-wp-i18n 1.0.3\n"
55
msgid "No valid demos were found."
56
msgstr ""
57
58
+ #: includes/admin/class-plugin-deactivate-notice.php:50
59
+ msgid ""
60
+ "It seems you've imported the theme demo successfully. Now, the purpose of "
61
+ "this plugin is fulfilled and it has no more use. So, if you're satisfied "
62
+ "with this import, you can safely deactivate it by clicking the button."
63
+ msgstr ""
64
+
65
+ #: includes/admin/class-plugin-deactivate-notice.php:62
66
+ msgid "Deactivate"
67
+ msgstr ""
68
+
69
+ #: includes/admin/class-plugin-deactivate-notice.php:78
70
+ #: includes/class-demo-importer.php:371 includes/class-demo-importer.php:395
71
+ #: includes/class-demo-importer.php:1429
72
+ msgid "Action failed. Please refresh the page and retry."
73
msgstr ""
74
75
+ #: includes/admin/class-plugin-review-notice.php:57
76
+ #. Translators: %1$s current user display name.
77
+ msgid ""
78
+ "Howdy, %1$s! It seems that you have imported the theme demo in your site. "
79
+ "We hope that you are happy with it and if you can spare a minute, please "
80
+ "help us by leaving a 5-star review on WordPress.org."
81
+ msgstr ""
82
+
83
+ #: includes/admin/class-plugin-review-notice.php:70
84
+ msgid "Sure"
85
msgstr ""
86
87
+ #: includes/admin/class-plugin-review-notice.php:75
88
msgid "Maybe later"
89
msgstr ""
90
91
+ #: includes/admin/class-plugin-review-notice.php:80
92
+ msgid "I already did"
93
+ msgstr ""
94
+
95
+ #: includes/admin/class-plugin-review-notice.php:86
96
+ msgid "Got plugin support question?"
97
msgstr ""
98
99
#: includes/admin/views/html-admin-page-importer.php:12
100
+ #: includes/class-demo-importer.php:124
101
+ #: includes/class-themegrill-demo-importer.php:236
102
msgid "Demo Importer"
103
msgstr ""
104
105
+ #: includes/admin/views/html-admin-page-importer.php:16
106
+ msgid ""
107
+ "If you do not see the new demos on the list, please click this button to "
108
+ "fetch all the available demos."
109
+ msgstr ""
110
+
111
+ #: includes/admin/views/html-admin-page-importer.php:18
112
+ msgid "Refresh Demos"
113
+ msgstr ""
114
+
115
+ #: includes/admin/views/html-admin-page-importer.php:22
116
msgid "Upcoming Demos"
117
msgstr ""
118
119
+ #: includes/admin/views/html-admin-page-importer.php:28
120
msgid "The Demo Importer screen requires JavaScript."
121
msgstr ""
122
123
+ #: includes/admin/views/html-admin-page-importer.php:31
124
msgid "Filter demos list"
125
msgstr ""
126
127
+ #: includes/admin/views/html-admin-page-importer.php:54
128
msgid "Without Page Builder"
129
msgstr ""
130
131
+ #: includes/admin/views/html-admin-page-importer.php:63
132
msgid "Themes list"
133
msgstr ""
134
135
+ #: includes/admin/views/html-admin-page-importer.php:67
136
+ #: includes/class-demo-importer.php:235
137
msgid "No demos found. Try a different search."
138
msgstr ""
139
140
+ #: includes/admin/views/html-admin-page-importer.php:81
141
+ #: includes/admin/views/html-admin-page-importer.php:161
142
msgid "Premium"
143
msgstr ""
144
145
+ #: includes/admin/views/html-admin-page-importer.php:85
146
+ #: includes/admin/views/html-admin-page-importer.php:165
147
msgid "Pro"
148
msgstr ""
149
150
+ #: includes/admin/views/html-admin-page-importer.php:91
151
+ #: includes/admin/views/html-admin-page-importer.php:172
152
#. translators: %s: Demo author name
153
msgid "By %s"
154
msgstr ""
155
156
+ #: includes/admin/views/html-admin-page-importer.php:100
157
#. translators: %s: Demo name
158
msgid "<span>Imported:</span> %s"
159
msgstr ""
160
161
+ #: includes/admin/views/html-admin-page-importer.php:109
162
+ #: includes/admin/views/html-admin-page-importer.php:150
163
+ #: includes/admin/views/html-admin-page-importer.php:254
164
+ #: includes/class-demo-importer.php:191
165
msgid "Live Preview"
166
msgstr ""
167
168
+ #: includes/admin/views/html-admin-page-importer.php:112
169
+ #: includes/admin/views/html-admin-page-importer.php:114
170
+ #: includes/admin/views/html-admin-page-importer.php:141
171
+ #: includes/admin/views/html-admin-page-importer.php:143
172
+ #: includes/admin/views/html-admin-page-importer.php:245
173
+ #: includes/admin/views/html-admin-page-importer.php:247
174
msgid "Buy Now"
175
msgstr ""
176
177
+ #: includes/admin/views/html-admin-page-importer.php:116
178
+ #: includes/admin/views/html-admin-page-importer.php:147
179
+ #: includes/admin/views/html-admin-page-importer.php:251
180
+ msgid "Update"
181
+ msgstr ""
182
+
183
+ #: includes/admin/views/html-admin-page-importer.php:122
184
msgid "Import"
185
msgstr ""
186
187
+ #: includes/admin/views/html-admin-page-importer.php:124
188
+ #: includes/admin/views/html-admin-page-importer.php:280
189
msgid "Preview"
190
msgstr ""
191
192
+ #: includes/admin/views/html-admin-page-importer.php:137
193
msgid "Close"
194
msgstr ""
195
196
+ #: includes/admin/views/html-admin-page-importer.php:145
197
+ #: includes/admin/views/html-admin-page-importer.php:152
198
+ #: includes/admin/views/html-admin-page-importer.php:249
199
+ #: includes/admin/views/html-admin-page-importer.php:256
200
msgid "Import Demo"
201
msgstr ""
202
203
+ #: includes/admin/views/html-admin-page-importer.php:183
204
+ #: includes/admin/views/html-admin-page-importer.php:192
205
#. translators: %s: Theme Name
206
msgid "%s theme is not active."
207
msgstr ""
208
209
+ #: includes/admin/views/html-admin-page-importer.php:199
210
#. translators: %s: Demo version
211
msgid "Version: %s"
212
msgstr ""
213
214
+ #: includes/admin/views/html-admin-page-importer.php:206
215
msgid "Plugins Information"
216
msgstr ""
217
218
+ #: includes/admin/views/html-admin-page-importer.php:211
219
msgid "Required Plugins"
220
msgstr ""
221
222
+ #: includes/admin/views/html-admin-page-importer.php:234
223
msgid "No plugins are required for this demo."
224
msgstr ""
225
226
+ #: includes/admin/views/html-admin-page-importer.php:260
227
+ #: includes/class-demo-importer.php:236
228
msgid "Collapse Sidebar"
229
msgstr ""
230
231
+ #: includes/admin/views/html-admin-page-importer.php:262
232
msgid "Collapse"
233
msgstr ""
234
235
+ #: includes/admin/views/html-admin-page-importer.php:267
236
msgid "Enter desktop preview mode"
237
msgstr ""
238
239
+ #: includes/admin/views/html-admin-page-importer.php:270
240
msgid "Enter tablet preview mode"
241
msgstr ""
242
243
+ #: includes/admin/views/html-admin-page-importer.php:273
244
msgid "Enter mobile preview mode"
245
msgstr ""
246
250
"<strong>\"%1$s\"</strong> was recreated with its previous password."
251
msgstr ""
252
253
+ #: includes/admin/views/html-notice-reset-wizard.php:17
254
msgid ""
255
"<strong>Reset Wizard</strong> &#8211; If you need to reset the WordPress "
256
"back to default again :)"
257
msgstr ""
258
259
+ #: includes/admin/views/html-notice-reset-wizard.php:18
260
msgid "Run the Reset Wizard"
261
msgstr ""
262
263
+ #: includes/admin/views/html-notice-reset-wizard.php:18
264
msgid "Hide this notice"
265
msgstr ""
266
267
+ #: includes/class-demo-importer.php:183
268
msgid "Importing..."
269
msgstr ""
270
271
+ #: includes/class-demo-importer.php:185
272
msgid "Importing... please wait."
273
msgstr ""
274
275
+ #: includes/class-demo-importer.php:186
276
msgid "Import completed successfully."
277
msgstr ""
278
279
+ #: includes/class-demo-importer.php:187
280
msgid "Import Failed!"
281
msgstr ""
282
283
+ #: includes/class-demo-importer.php:188
284
msgid "Import failed: %s"
285
msgstr ""
286
287
+ #: includes/class-demo-importer.php:193
288
msgid "Imported!"
289
msgstr ""
290
291
+ #: includes/class-demo-importer.php:194
292
msgid "Try this solution!"
293
msgstr ""
294
295
+ #: includes/class-demo-importer.php:208
296
msgid ""
297
"It is strongly recommended that you backup your database before proceeding. "
298
"Are you sure you wish to run the reset wizard now?"
299
msgstr ""
300
301
+ #: includes/class-demo-importer.php:211
302
msgid ""
303
"Importing demo data will ensure that your site will look similar as theme "
304
"demo. It makes you easy to modify the content instead of creating them from "
306
"%6$s"
307
msgstr ""
308
309
+ #: includes/class-demo-importer.php:213
310
msgid ""
311
"Importing the demo on the site if you have already added the content is "
312
"highly discouraged."
313
msgstr ""
314
315
+ #: includes/class-demo-importer.php:215
316
msgid ""
317
"You need to import demo on fresh WordPress install to exactly replicate the "
318
"theme demo."
319
msgstr ""
320
321
+ #: includes/class-demo-importer.php:217
322
msgid ""
323
"It will install the required plugins as well as activate them for "
324
"installing the required theme demo within your site."
325
msgstr ""
326
327
+ #: includes/class-demo-importer.php:219
328
msgid "Copyright images will get replaced with other placeholder images."
329
msgstr ""
330
331
+ #: includes/class-demo-importer.php:221
332
msgid ""
333
"None of the posts, pages, attachments or any other data already existing in "
334
"your site will be deleted or modified."
335
msgstr ""
336
337
+ #: includes/class-demo-importer.php:223
338
msgid "It will take some time to import the theme demo."
339
msgstr ""
340
341
+ #: includes/class-demo-importer.php:228
342
msgid "Search Demos"
343
msgstr ""
344
345
+ #: includes/class-demo-importer.php:229
346
msgid "Search demos..."
347
msgstr ""
348
349
+ #: includes/class-demo-importer.php:231
350
#. translators: %s: support forums URL
351
msgid ""
352
"An unexpected error occurred. Something may be wrong with ThemeGrill demo "
354
"the <a href=\"%s\">support forums</a>."
355
msgstr ""
356
357
+ #: includes/class-demo-importer.php:232
358
msgid "Try Again"
359
msgstr ""
360
361
+ #: includes/class-demo-importer.php:233
362
msgid "Please suggest us!"
363
msgstr ""
364
365
+ #: includes/class-demo-importer.php:234
366
msgid "Number of Demos found: %d"
367
msgstr ""
368
369
+ #: includes/class-demo-importer.php:237
370
msgid "Expand Sidebar"
371
msgstr ""
372
373
+ #: includes/class-demo-importer.php:239
374
#. translators: accessibility text
375
msgid "Select one or more Demo features to filter by"
376
msgstr ""
377
378
+ #: includes/class-demo-importer.php:240
379
msgid "Confirm!"
380
msgstr ""
381
382
+ #: includes/class-demo-importer.php:266
383
#. translators: 1: ThemeGrill Demo Importer 2: five stars
384
msgid "If you like %1$s please leave us a %2$s rating. A huge thanks in advance!"
385
msgstr ""
388
msgid "ThemeGrill Demo Importer"
389
msgstr ""
390
391
+ #: includes/class-demo-importer.php:268
392
msgid "Thanks :)"
393
msgstr ""
394
395
+ #: includes/class-demo-importer.php:271
396
msgid "Thank you for importing with ThemeGrill Demo Importer."
397
msgstr ""
398
399
+ #: includes/class-demo-importer.php:296 includes/class-demo-importer.php:298
400
msgid "Help &amp; Support"
401
msgstr ""
402
403
+ #: includes/class-demo-importer.php:300
404
msgid ""
405
"Should you need help understanding, using, or extending ThemeGrill Demo "
406
"Importer, <a href=\"%s\">please read our documentation</a>. You will find "
407
"all kinds of resources including snippets, tutorials and much more."
408
msgstr ""
409
410
+ #: includes/class-demo-importer.php:304
411
msgid ""
412
"For further assistance with ThemeGrill Demo Importer core you can use the "
413
"<a href=\"%1$s\">community forum</a>. If you need help with premium themes "
414
"sold by ThemeGrill, please <a href=\"%2$s\">use our free support forum</a>."
415
msgstr ""
416
417
+ #: includes/class-demo-importer.php:308
418
msgid "Community forum"
419
msgstr ""
420
421
+ #: includes/class-demo-importer.php:308
422
msgid "ThemeGrill Support"
423
msgstr ""
424
425
+ #: includes/class-demo-importer.php:315 includes/class-demo-importer.php:317
426
msgid "Found a bug?"
427
msgstr ""
428
429
+ #: includes/class-demo-importer.php:318
430
msgid ""
431
"If you find a bug within ThemeGrill Demo Importer you can create a ticket "
432
"via <a href=\"%1$s\">Github issues</a>. Ensure you read the <a "
434
"help us solve your issue, please be as descriptive as possible."
435
msgstr ""
436
437
+ #: includes/class-demo-importer.php:319
438
msgid "Report a bug"
439
msgstr ""
440
441
+ #: includes/class-demo-importer.php:327 includes/class-demo-importer.php:329
442
+ #: includes/class-demo-importer.php:331
443
msgid "Reset wizard"
444
msgstr ""
445
446
+ #: includes/class-demo-importer.php:330
447
msgid ""
448
"If you need to reset the WordPress back to default again, please click on "
449
"the button below."
450
msgstr ""
451
452
+ #: includes/class-demo-importer.php:336
453
msgid "For more information:"
454
msgstr ""
455
456
+ #: includes/class-demo-importer.php:337
457
msgid "About Demo Importer"
458
msgstr ""
459
460
+ #: includes/class-demo-importer.php:338
461
msgid "WordPress.org project"
462
msgstr ""
463
464
+ #: includes/class-demo-importer.php:339
465
msgid "Github project"
466
msgstr ""
467
468
+ #: includes/class-demo-importer.php:340
469
msgid "Official themes"
470
msgstr ""
471
472
+ #: includes/class-demo-importer.php:341
473
msgid "Official plugins"
474
msgstr ""
475
476
+ #: includes/class-demo-importer.php:375
477
#: includes/class-themegrill-demo-importer.php:50
478
#: includes/class-themegrill-demo-importer.php:59
479
msgid "Cheatin&#8217; huh?"
480
msgstr ""
481
482
+ #: includes/class-demo-importer.php:399
483
+ msgid "You don&#8217;t have permission to do this."
484
+ msgstr ""
485
+
486
+ #: includes/class-demo-importer.php:624 includes/class-demo-importer.php:685
487
+ msgid "This demo requires %1$s version of %2$s theme to get imported"
488
+ msgstr ""
489
+
490
+ #: includes/class-demo-importer.php:630 includes/class-demo-importer.php:658
491
+ msgid ""
492
+ "This demo requires %1$s version of %2$s theme and %3$s version of %4$s as "
493
+ "well as %5$s version of %6$s plugins to get imported"
494
+ msgstr ""
495
+
496
+ #: includes/class-demo-importer.php:634 includes/class-demo-importer.php:644
497
+ #: includes/class-demo-importer.php:650 includes/class-demo-importer.php:662
498
+ msgid "Zakra Pro"
499
+ msgstr ""
500
+
501
+ #: includes/class-demo-importer.php:636 includes/class-demo-importer.php:664
502
+ #: includes/class-demo-importer.php:672 includes/class-demo-importer.php:678
503
+ msgid "Companion Elementor"
504
+ msgstr ""
505
+
506
+ #: includes/class-demo-importer.php:640 includes/class-demo-importer.php:668
507
+ msgid ""
508
+ "This demo requires %1$s version of %2$s theme and %3$s version of %4$s "
509
+ "plugin to get imported"
510
+ msgstr ""
511
+
512
+ #: includes/class-demo-importer.php:648 includes/class-demo-importer.php:676
513
+ msgid "This demo requires %1$s version of %2$s plugin to get imported"
514
+ msgstr ""
515
+
516
+ #: includes/class-demo-importer.php:696
517
msgid "%s Pro"
518
msgstr ""
519
521
msgid "ThemeGrill"
522
msgstr ""
523
524
+ #: includes/class-demo-importer.php:760
525
msgid "No demo specified."
526
msgstr ""
527
528
+ #: includes/class-demo-importer.php:776
529
msgid "Sorry, you are not allowed to import content."
530
msgstr ""
531
532
+ #: includes/class-demo-importer.php:808
533
#: includes/functions-demo-importer.php:110
534
msgid "Unable to connect to the filesystem. Please confirm your credentials."
535
msgstr ""
536
537
+ #: includes/class-demo-importer.php:891
538
msgid "The XML file dummy content is missing."
539
msgstr ""
540
541
+ #: includes/class-demo-importer.php:982
542
msgid "The DAT file customizer data is missing."
543
msgstr ""
544
545
+ #: includes/class-demo-importer.php:1007
546
msgid "The WIE file widget content is missing."
547
msgstr ""
548
549
+ #: includes/class-themegrill-demo-importer.php:236
550
msgid "View Demo Importer"
551
msgstr ""
552
553
+ #: includes/class-themegrill-demo-importer.php:252
554
msgid "View Demo Importer Documentation"
555
msgstr ""
556
557
+ #: includes/class-themegrill-demo-importer.php:252
558
msgid "Docs"
559
msgstr ""
560
561
+ #: includes/class-themegrill-demo-importer.php:253
562
msgid "Visit Free Customer Support Forum"
563
msgstr ""
564
565
+ #: includes/class-themegrill-demo-importer.php:253
566
msgid "Free Support"
567
msgstr ""
568
569
+ #: includes/class-themegrill-demo-importer.php:269
570
msgid "This plugin requires %s to be activated to work."
571
msgstr ""
572
573
+ #: includes/class-themegrill-demo-importer.php:269
574
msgid "Official ThemeGrill Theme"
575
msgstr ""
576
864
msgid "https://themegrill.com"
865
msgstr ""
866
867
+ #: includes/admin/views/html-admin-page-importer.php:120
868
#. translators: %s: Demo name
869
msgctxt "demo"
870
msgid "Import %s"
871
msgstr ""
872
873
+ #: includes/admin/views/html-admin-page-importer.php:130
874
msgctxt "demo"
875
msgid "Imported"
876
msgstr ""
877
878
+ #: includes/class-demo-importer.php:184
879
msgctxt "demo"
880
msgid "Importing %s..."
881
msgstr ""
882
883
+ #: includes/class-demo-importer.php:189
884
msgctxt "demo"
885
msgid "%s imported!"
886
msgstr ""
887
888
+ #: includes/class-demo-importer.php:190
889
msgctxt "demo"
890
msgid "%s import failed"
891
msgstr ""
892
893
+ #: includes/class-demo-importer.php:192
894
msgctxt "demo"
895
msgid "Live Preview %s"
896
msgstr ""
897
898
+ #: includes/admin/views/html-admin-page-importer.php:138
899
msgctxt "Button label for a demo"
900
msgid "Previous"
901
msgstr ""
902
903
+ #: includes/admin/views/html-admin-page-importer.php:139
904
msgctxt "Button label for a demo"
905
msgid "Next"
906
msgstr ""
907
908
+ #: includes/class-demo-importer.php:139
909
msgctxt "Admin menu name"
910
msgid "Demo Importer"
911
msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
Contributors: ThemeGrill, shivapoudel
3
Tags: themegrill, theme demos, demo, importer, one click import
4
Requires at least: 4.7
5
- Tested up to: 5.3
6
- Stable tag: 1.6.3
7
License: GPLv3 or later
8
License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
@@ -72,6 +72,15 @@ Yes you can! Join in on our [GitHub repository](https://github.com/themegrill/th
72
3. Finally, Import the Demo with just one click.
73
74
== Changelog ==
75
= 1.6.3 - 18-02-2020 =
76
* Enhancement - Secure reset button with nonce check.
77
2
Contributors: ThemeGrill, shivapoudel
3
Tags: themegrill, theme demos, demo, importer, one click import
4
Requires at least: 4.7
5
+ Tested up to: 5.4
6
+ Stable tag: 1.6.4
7
License: GPLv3 or later
8
License URI: https://www.gnu.org/licenses/gpl-3.0.html
9
72
3. Finally, Import the Demo with just one click.
73
74
== Changelog ==
75
+ = 1.6.4 - 04-06-2020 =
76
+ * Fix - `WooCommerce Setup Wizard` disabled when the plugin is active.
77
+ * Fix - `Live Preview` button link on successful demo import message in WordPress multisite install.
78
+ * Tweak - Add admin notice for `Plugin Review`.
79
+ * Tweak - Add admin notice for `Plugin Deactivate` if demo is already imported in their site.
80
+ * Tweak - Add refresh demo lists feature.
81
+ * Tweak - Add feature to restrict demo import process for specific demos to fix unwanted issues for unsupported demos.
82
+ * Deprecate - `Upgrade to Pro` admin notice.
83
+
84
= 1.6.3 - 18-02-2020 =
85
* Enhancement - Secure reset button with nonce check.
86
themegrill-demo-importer.php CHANGED
@@ -3,7 +3,7 @@
3
* Plugin Name: ThemeGrill Demo Importer
4
* Plugin URI: https://themegrill.com/demo-importer/
5
* Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
6
- * Version: 1.6.3
7
* Author: ThemeGrill
8
* Author URI: https://themegrill.com
9
* License: GPLv3 or later
3
* Plugin Name: ThemeGrill Demo Importer
4
* Plugin URI: https://themegrill.com/demo-importer/
5
* Description: Import ThemeGrill official themes demo content, widgets and theme settings with just one click.
6
+ * Version: 1.6.4
7
* Author: ThemeGrill
8
* Author URI: https://themegrill.com
9
* License: GPLv3 or later