diff --git a/wp-admin/includes/theme.php b/wp-admin/includes/theme.php index 5f063d9102..67d557096c 100644 --- a/wp-admin/includes/theme.php +++ b/wp-admin/includes/theme.php @@ -647,12 +647,16 @@ function wp_prepare_themes_for_js( $themes = null ) { } } - $updates = array(); + $updates = array(); + $no_updates = array(); if ( current_user_can( 'update_themes' ) ) { $updates_transient = get_site_transient( 'update_themes' ); if ( isset( $updates_transient->response ) ) { $updates = $updates_transient->response; } + if ( isset( $updates_transient->no_update ) ) { + $no_updates = $updates_transient->no_update; + } } WP_Theme::sort_by_name( $themes ); @@ -690,6 +694,31 @@ function wp_prepare_themes_for_js( $themes = null ) { $auto_update = in_array( $slug, $auto_updates, true ); $auto_update_action = $auto_update ? 'disable-auto-update' : 'enable-auto-update'; + if ( isset( $updates[ $slug ] ) ) { + $auto_update_supported = true; + $auto_update_filter_payload = (object) $updates[ $slug ]; + } elseif ( isset( $no_updates[ $slug ] ) ) { + $auto_update_supported = true; + $auto_update_filter_payload = (object) $no_updates[ $slug ]; + } else { + $auto_update_supported = false; + /* + * Create the expected payload for the auto_update_theme filter, this is the same data + * as contained within $updates or $no_updates but used when the Theme is not known. + */ + $auto_update_filter_payload = (object) array( + 'theme' => $slug, + 'new_version' => $theme->get( 'Version' ), + 'url' => '', + 'package' => '', + 'requires' => $theme->get( 'RequiresWP' ), + 'requires_php' => $theme->get( 'RequiresPHP' ), + ); + } + + /** This action is documented in wp-admin/includes/class-wp-automatic-updater.php */ + $auto_update_forced = apply_filters( 'auto_update_theme', null, $auto_update_filter_payload ); + $prepared_themes[ $slug ] = array( 'id' => $slug, 'name' => $theme->display( 'Name' ), @@ -710,7 +739,11 @@ function wp_prepare_themes_for_js( $themes = null ) { 'hasUpdate' => isset( $updates[ $slug ] ), 'hasPackage' => isset( $updates[ $slug ] ) && ! empty( $updates[ $slug ]['package'] ), 'update' => get_theme_update_available( $theme ), - 'autoupdate' => $auto_update, + 'autoupdate' => array( + 'enabled' => $auto_update || $auto_update_forced, + 'supported' => $auto_update_supported, + 'forced' => $auto_update_forced, + ), 'actions' => array( 'activate' => current_user_can( 'switch_themes' ) ? wp_nonce_url( admin_url( 'themes.php?action=activate&stylesheet=' . $encoded_slug ), 'switch-theme_' . $slug ) : null, 'customize' => $customize_action, diff --git a/wp-admin/js/theme.js b/wp-admin/js/theme.js index c702e4f169..9a81a893b4 100644 --- a/wp-admin/js/theme.js +++ b/wp-admin/js/theme.js @@ -802,8 +802,11 @@ themes.view.Details = wp.Backbone.View.extend({ // Support concurrent clicks in different Theme Details overlays. callback = function( event, data ) { + var autoupdate; if ( _this.model.get( 'id' ) === data.asset ) { - _this.model.set( { autoupdate: 'enable' === data.state } ); + autoupdate = _this.model.get( 'autoupdate' ); + autoupdate.enabled = 'enable' === data.state; + _this.model.set( { autoupdate: autoupdate } ); $( document ).off( 'wp-auto-update-setting-changed', callback ); } }; diff --git a/wp-admin/js/theme.min.js b/wp-admin/js/theme.min.js index 988c4af7b5..66ac1e0b2a 100644 --- a/wp-admin/js/theme.min.js +++ b/wp-admin/js/theme.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -window.wp=window.wp||{},function(o){var l,a;function e(e,t){Backbone.history._hasPushState&&Backbone.Router.prototype.navigate.call(this,e,t)}(l=wp.themes=wp.themes||{}).data=_wpThemeSettings,a=l.data.l10n,l.isInstall=!!l.data.settings.isInstall,_.extend(l,{model:{},view:{},routes:{},router:{},template:wp.template}),l.Model=Backbone.Model.extend({initialize:function(){var e;this.get("slug")&&(-1!==_.indexOf(l.data.installedThemes,this.get("slug"))&&this.set({installed:!0}),l.data.activeTheme===this.get("slug")&&this.set({active:!0})),this.set({id:this.get("slug")||this.get("id")}),this.has("sections")&&(e=this.get("sections").description,this.set({description:e}))}}),l.view.Appearance=wp.Backbone.View.extend({el:"#wpbody-content .wrap .theme-browser",window:o(window),page:0,initialize:function(e){_.bindAll(this,"scroller"),this.SearchView=e.SearchView?e.SearchView:l.view.Search,this.window.bind("scroll",_.throttle(this.scroller,300))},render:function(){this.view=new l.view.Themes({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:o(".search-form"),search:function(){var e;1!==l.data.themes.length&&(e=new this.SearchView({collection:this.collection,parent:this}),(this.SearchView=e).render(),this.searchContainer.append(o.parseHTML('")).append(e.el).on("submit",function(e){e.preventDefault()}))},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),(t=Math.round(.9*t))]+)>)/gi,""),a=e.get("description").replace(/(<([^>]+)>)/gi,""),n=e.get("author").replace(/(<([^>]+)>)/gi,""),s=_.union([r,e.get("id"),a,n,e.get("tags")]),i.test(e.get("author"))&&2

'+a.addNew+"

"),this.parent.page++):this.parent.trigger("theme:end")},currentTheme:function(){var e;(e=this.collection.findWhere({active:!0}))&&(this.collection.remove(e),this.collection.add(e,{at:0}))},setView:function(e){return e},expand:function(e){var t,i,s=this;this.model=s.collection.get(e),l.router.navigate(l.router.baseUrl(l.router.themePath+this.model.id)),this.setView("detail"),o("body").addClass("modal-open"),this.overlay=new l.view.Details({model:s.model}),this.overlay.render(),this.model.get("hasUpdate")&&(t=o('[data-slug="'+this.model.id+'"]'),i=o(this.overlay.el),t.find(".updating-message").length?(i.find(".notice-warning h3").remove(),i.find(".notice-warning").removeClass("notice-large").addClass("updating-message").find("p").text(wp.updates.l10n.updating)):t.find(".notice-error").length&&i.find(".notice-warning").remove()),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){s.next([s.model.cid])}).listenTo(this.overlay,"theme:previous",function(){s.previous([s.model.cid])})},next:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)+1))&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",i.cid))},previous:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)-1))&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",i.cid))},announceSearchResults:function(e){0===e?wp.a11y.speak(a.noThemesFound):wp.a11y.speak(a.themesFound.replace("%d",e))}}),l.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:a.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,"theme: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?l.router.navigate(l.router.baseUrl(l.router.searchPath+e.target.value),t):l.router.navigate(l.router.baseUrl(""))},pushState:function(e){var t=l.router.baseUrl("");e.target.value&&(t=l.router.baseUrl(l.router.searchPath+encodeURIComponent(e.target.value))),this.searching=!1,l.router.navigate(t)}}),l.Router=Backbone.Router.extend({routes:{"themes.php?theme=:slug":"theme","themes.php?search=:query":"search","themes.php?s=:query":"search","themes.php":"themes","":"themes"},baseUrl:function(e){return"themes.php"+e},themePath:"?theme=",searchPath:"?search=",search:function(e){o(".wp-filter-search").val(e.replace(/\+/g," "))},themes:function(){o(".wp-filter-search").val("")},navigate:e}),l.Run={init:function(){this.themes=new l.Collection(l.data.themes),this.view=new l.view.Appearance({collection:this.themes}),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:l.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this;l.router=new l.Router,l.router.on("route:theme",function(e){t.view.view.expand(e)}),l.router.on("route:themes",function(){t.themes.doSearch(""),t.view.trigger("theme:close")}),l.router.on("route:search",function(){o(".wp-filter-search").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},l.view.InstallerSearch=l.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){var t={};this.terms!==e&&(this.terms=e,"author:"===(t.search=e).substring(0,7)&&(t.search="",t.author=e.slice(7)),"tag:"===e.substring(0,4)&&(t.search="",t.tag=[e.slice(4)]),o(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),o("body").removeClass("show-filters filters-applied show-favorites-form"),o(".drawer-toggle").attr("aria-expanded","false"),this.collection.query(t),l.router.navigate(l.router.baseUrl(l.router.searchPath+encodeURIComponent(e)),{replace:!0}))}}),l.view.Installer=l.view.Appearance.extend({el:"#wpbody-content .wrap",events:{"click .filter-links li > a":"onSort","click .theme-filter":"onFilter","click .drawer-toggle":"moreFilters","click .filter-drawer .apply-filters":"applyFilters",'click .filter-group [type="checkbox"]':"addFilter","click .filter-drawer .clear-filters":"clearFilters","click .edit-filters":"backToFilters","click .favorites-form-submit":"saveUsername","keyup #wporg-username-input":"saveUsername"},render:function(){var e=this;this.search(),this.uploader(),this.collection=new l.Collection,this.listenTo(this,"theme:end",function(){e.collection.loadingThemes||(e.collection.loadingThemes=!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(){o("body").removeClass("loading-content"),o(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){o("body").removeClass("loading-content"),o(".theme-browser").find("div.error").remove(),o(".theme-browser").find("div.themes").before('

'+a.error+'

"),o(".theme-browser .error .try-again").on("click",function(e){e.preventDefault(),o("input.wp-filter-search").trigger("input")})}),this.view&&this.view.remove(),this.view=new l.view.Themes({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){this.collection.query({browse:e})},onSort:function(e){var t=o(e.target),i=t.data("sort");e.preventDefault(),o("body").removeClass("filters-applied show-filters"),o(".drawer-toggle").attr("aria-expanded","false"),t.hasClass(this.activeClass)||(this.sort(i),l.router.navigate(l.router.baseUrl(l.router.browsePath+i)))},sort:function(e){this.clearSearch(),l.router.selectedTab=e,o(".filter-links li > a, .theme-filter").removeClass(this.activeClass).removeAttr("aria-current"),o('[data-sort="'+e+'"]').addClass(this.activeClass).attr("aria-current","page"),"favorites"===e?o("body").addClass("show-favorites-form"):o("body").removeClass("show-favorites-form"),this.browse(e)},onFilter:function(e){var t,i=o(e.target),s=i.data("filter");i.hasClass(this.activeClass)||(o(".filter-links li > a, .theme-section").removeClass(this.activeClass).removeAttr("aria-current"),i.addClass(this.activeClass).attr("aria-current","page"),s&&(t={tag:[s=_.union([s,this.filtersChecked()])]},this.collection.query(t)))},addFilter:function(){this.filtersChecked()},applyFilters:function(e){var t,i=this.filtersChecked(),s={tag:i},r=o(".filtered-by .tags");e&&e.preventDefault(),i?(o("body").addClass("filters-applied"),o(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),r.empty(),_.each(i,function(e){t=o('label[for="filter-id-'+e+'"]').text(),r.append(''+t+"")}),this.collection.query(s)):wp.a11y.speak(a.selectFeatureFilter)},saveUsername:function(e){var t=o("#wporg-username-input").val(),i=o("#wporg-username-nonce").val(),s={browse:"favorites",user:t},r=this;if(e&&e.preventDefault(),"keyup"!==e.type||13===e.which)return wp.ajax.send("save-wporg-username",{data:{_wpnonce:i,username:t},success:function(){r.collection.query(s)}})},filtersChecked:function(){var e=o(".filter-group").find(":checkbox"),t=[];return _.each(e.filter(":checked"),function(e){t.push(o(e).prop("value"))}),0===t.length?(o(".filter-drawer .apply-filters").find("span").text(""),o(".filter-drawer .clear-filters").hide(),o("body").removeClass("filters-applied"),!1):(o(".filter-drawer .apply-filters").find("span").text(t.length),o(".filter-drawer .clear-filters").css("display","inline-block"),t)},activeClass:"current",uploader:function(){var e=o(".upload-view-toggle"),t=o(document.body);e.on("click",function(){t.toggleClass("show-upload-view"),e.attr("aria-expanded",t.hasClass("show-upload-view"))})},moreFilters:function(e){var t=o("body"),i=o(".drawer-toggle");if(e.preventDefault(),t.hasClass("filters-applied"))return this.backToFilters();this.clearSearch(),l.router.navigate(l.router.baseUrl("")),t.toggleClass("show-filters"),i.attr("aria-expanded",t.hasClass("show-filters"))},clearFilters:function(e){var t=o(".filter-group").find(":checkbox"),i=this;e.preventDefault(),_.each(t.filter(":checked"),function(e){return o(e).prop("checked",!1),i.filtersChecked()})},backToFilters:function(e){e&&e.preventDefault(),o("body").removeClass("filters-applied")},clearSearch:function(){o("#wp-filter-search-input").val("")}}),l.InstallerRouter=Backbone.Router.extend({routes:{"theme-install.php?theme=:slug":"preview","theme-install.php?browse=:sort":"sort","theme-install.php?search=:query":"search","theme-install.php":"sort"},baseUrl:function(e){return"theme-install.php"+e},themePath:"?theme=",browsePath:"?browse=",searchPath:"?search=",search:function(e){o(".wp-filter-search").val(e.replace(/\+/g," "))},navigate:e}),l.RunInstaller={init:function(){this.view=new l.view.Installer({section:"featured",SearchView:l.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:l.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this,i={};l.router=new l.InstallerRouter,l.router.on("route:preview",function(e){l.preview&&(l.preview.undelegateEvents(),l.preview.unbind()),t.view.view.theme&&t.view.view.theme.preview?(t.view.view.theme.model=t.view.collection.findWhere({slug:e}),t.view.view.theme.preview()):(i.theme=e,t.view.collection.query(i),t.view.collection.trigger("update"),t.view.collection.once("query:success",function(){o('div[data-slug="'+e+'"]').trigger("click")}))}),l.router.on("route:sort",function(e){e||(e="featured",l.router.navigate(l.router.baseUrl("?browse=featured"),{replace:!0})),t.view.sort(e),l.preview&&l.preview.close()}),l.router.on("route:search",function(){o(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},o(document).ready(function(){l.isInstall?l.RunInstaller.init():l.Run.init(),o(document.body).on("click",".load-customize",function(){var e=o(this),t=document.createElement("a");t.href=e.prop("href"),t.search=o.param(_.extend(wp.customize.utils.parseQueryString(t.search.substr(1)),{return:window.location.href})),e.prop("href",t.href)}),o(".broken-themes .delete-theme").on("click",function(){return confirm(_wpThemeSettings.settings.confirmDelete)})})}(jQuery),jQuery(document).ready(function(a){window.tb_position=function(){var e=a("#TB_window"),t=a(window).width(),i=a(window).height(),s=1040'+a.search+"")).append(e.el).on("submit",function(e){e.preventDefault()}))},scroller:function(){var e,t,i=this;e=this.window.scrollTop()+i.window.height(),t=i.$el.offset().top+i.$el.outerHeight(!1)-i.window.height(),(t=Math.round(.9*t))]+)>)/gi,""),a=e.get("description").replace(/(<([^>]+)>)/gi,""),n=e.get("author").replace(/(<([^>]+)>)/gi,""),s=_.union([r,e.get("id"),a,n,e.get("tags")]),i.test(e.get("author"))&&2

'+a.addNew+"

"),this.parent.page++):this.parent.trigger("theme:end")},currentTheme:function(){var e;(e=this.collection.findWhere({active:!0}))&&(this.collection.remove(e),this.collection.add(e,{at:0}))},setView:function(e){return e},expand:function(e){var t,i,s=this;this.model=s.collection.get(e),l.router.navigate(l.router.baseUrl(l.router.themePath+this.model.id)),this.setView("detail"),o("body").addClass("modal-open"),this.overlay=new l.view.Details({model:s.model}),this.overlay.render(),this.model.get("hasUpdate")&&(t=o('[data-slug="'+this.model.id+'"]'),i=o(this.overlay.el),t.find(".updating-message").length?(i.find(".notice-warning h3").remove(),i.find(".notice-warning").removeClass("notice-large").addClass("updating-message").find("p").text(wp.updates.l10n.updating)):t.find(".notice-error").length&&i.find(".notice-warning").remove()),this.$overlay.html(this.overlay.el),this.listenTo(this.overlay,"theme:next",function(){s.next([s.model.cid])}).listenTo(this.overlay,"theme:previous",function(){s.previous([s.model.cid])})},next:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)+1))&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",i.cid))},previous:function(e){var t,i;t=this.collection.get(e[0]),void 0!==(i=this.collection.at(this.collection.indexOf(t)-1))&&(this.overlay.closeOverlay(),this.theme.trigger("theme:expand",i.cid))},announceSearchResults:function(e){0===e?wp.a11y.speak(a.noThemesFound):wp.a11y.speak(a.themesFound.replace("%d",e))}}),l.view.Search=wp.Backbone.View.extend({tagName:"input",className:"wp-filter-search",id:"wp-filter-search-input",searching:!1,attributes:{placeholder:a.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,"theme: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?l.router.navigate(l.router.baseUrl(l.router.searchPath+e.target.value),t):l.router.navigate(l.router.baseUrl(""))},pushState:function(e){var t=l.router.baseUrl("");e.target.value&&(t=l.router.baseUrl(l.router.searchPath+encodeURIComponent(e.target.value))),this.searching=!1,l.router.navigate(t)}}),l.Router=Backbone.Router.extend({routes:{"themes.php?theme=:slug":"theme","themes.php?search=:query":"search","themes.php?s=:query":"search","themes.php":"themes","":"themes"},baseUrl:function(e){return"themes.php"+e},themePath:"?theme=",searchPath:"?search=",search:function(e){o(".wp-filter-search").val(e.replace(/\+/g," "))},themes:function(){o(".wp-filter-search").val("")},navigate:e}),l.Run={init:function(){this.themes=new l.Collection(l.data.themes),this.view=new l.view.Appearance({collection:this.themes}),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:l.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this;l.router=new l.Router,l.router.on("route:theme",function(e){t.view.view.expand(e)}),l.router.on("route:themes",function(){t.themes.doSearch(""),t.view.trigger("theme:close")}),l.router.on("route:search",function(){o(".wp-filter-search").trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},l.view.InstallerSearch=l.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){var t={};this.terms!==e&&(this.terms=e,"author:"===(t.search=e).substring(0,7)&&(t.search="",t.author=e.slice(7)),"tag:"===e.substring(0,4)&&(t.search="",t.tag=[e.slice(4)]),o(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),o("body").removeClass("show-filters filters-applied show-favorites-form"),o(".drawer-toggle").attr("aria-expanded","false"),this.collection.query(t),l.router.navigate(l.router.baseUrl(l.router.searchPath+encodeURIComponent(e)),{replace:!0}))}}),l.view.Installer=l.view.Appearance.extend({el:"#wpbody-content .wrap",events:{"click .filter-links li > a":"onSort","click .theme-filter":"onFilter","click .drawer-toggle":"moreFilters","click .filter-drawer .apply-filters":"applyFilters",'click .filter-group [type="checkbox"]':"addFilter","click .filter-drawer .clear-filters":"clearFilters","click .edit-filters":"backToFilters","click .favorites-form-submit":"saveUsername","keyup #wporg-username-input":"saveUsername"},render:function(){var e=this;this.search(),this.uploader(),this.collection=new l.Collection,this.listenTo(this,"theme:end",function(){e.collection.loadingThemes||(e.collection.loadingThemes=!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(){o("body").removeClass("loading-content"),o(".theme-browser").find("div.error").remove()}),this.listenTo(this.collection,"query:fail",function(){o("body").removeClass("loading-content"),o(".theme-browser").find("div.error").remove(),o(".theme-browser").find("div.themes").before('

'+a.error+'

"),o(".theme-browser .error .try-again").on("click",function(e){e.preventDefault(),o("input.wp-filter-search").trigger("input")})}),this.view&&this.view.remove(),this.view=new l.view.Themes({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){this.collection.query({browse:e})},onSort:function(e){var t=o(e.target),i=t.data("sort");e.preventDefault(),o("body").removeClass("filters-applied show-filters"),o(".drawer-toggle").attr("aria-expanded","false"),t.hasClass(this.activeClass)||(this.sort(i),l.router.navigate(l.router.baseUrl(l.router.browsePath+i)))},sort:function(e){this.clearSearch(),l.router.selectedTab=e,o(".filter-links li > a, .theme-filter").removeClass(this.activeClass).removeAttr("aria-current"),o('[data-sort="'+e+'"]').addClass(this.activeClass).attr("aria-current","page"),"favorites"===e?o("body").addClass("show-favorites-form"):o("body").removeClass("show-favorites-form"),this.browse(e)},onFilter:function(e){var t,i=o(e.target),s=i.data("filter");i.hasClass(this.activeClass)||(o(".filter-links li > a, .theme-section").removeClass(this.activeClass).removeAttr("aria-current"),i.addClass(this.activeClass).attr("aria-current","page"),s&&(t={tag:[s=_.union([s,this.filtersChecked()])]},this.collection.query(t)))},addFilter:function(){this.filtersChecked()},applyFilters:function(e){var t,i=this.filtersChecked(),s={tag:i},r=o(".filtered-by .tags");e&&e.preventDefault(),i?(o("body").addClass("filters-applied"),o(".filter-links li > a.current").removeClass("current").removeAttr("aria-current"),r.empty(),_.each(i,function(e){t=o('label[for="filter-id-'+e+'"]').text(),r.append(''+t+"")}),this.collection.query(s)):wp.a11y.speak(a.selectFeatureFilter)},saveUsername:function(e){var t=o("#wporg-username-input").val(),i=o("#wporg-username-nonce").val(),s={browse:"favorites",user:t},r=this;if(e&&e.preventDefault(),"keyup"!==e.type||13===e.which)return wp.ajax.send("save-wporg-username",{data:{_wpnonce:i,username:t},success:function(){r.collection.query(s)}})},filtersChecked:function(){var e=o(".filter-group").find(":checkbox"),t=[];return _.each(e.filter(":checked"),function(e){t.push(o(e).prop("value"))}),0===t.length?(o(".filter-drawer .apply-filters").find("span").text(""),o(".filter-drawer .clear-filters").hide(),o("body").removeClass("filters-applied"),!1):(o(".filter-drawer .apply-filters").find("span").text(t.length),o(".filter-drawer .clear-filters").css("display","inline-block"),t)},activeClass:"current",uploader:function(){var e=o(".upload-view-toggle"),t=o(document.body);e.on("click",function(){t.toggleClass("show-upload-view"),e.attr("aria-expanded",t.hasClass("show-upload-view"))})},moreFilters:function(e){var t=o("body"),i=o(".drawer-toggle");if(e.preventDefault(),t.hasClass("filters-applied"))return this.backToFilters();this.clearSearch(),l.router.navigate(l.router.baseUrl("")),t.toggleClass("show-filters"),i.attr("aria-expanded",t.hasClass("show-filters"))},clearFilters:function(e){var t=o(".filter-group").find(":checkbox"),i=this;e.preventDefault(),_.each(t.filter(":checked"),function(e){return o(e).prop("checked",!1),i.filtersChecked()})},backToFilters:function(e){e&&e.preventDefault(),o("body").removeClass("filters-applied")},clearSearch:function(){o("#wp-filter-search-input").val("")}}),l.InstallerRouter=Backbone.Router.extend({routes:{"theme-install.php?theme=:slug":"preview","theme-install.php?browse=:sort":"sort","theme-install.php?search=:query":"search","theme-install.php":"sort"},baseUrl:function(e){return"theme-install.php"+e},themePath:"?theme=",browsePath:"?browse=",searchPath:"?search=",search:function(e){o(".wp-filter-search").val(e.replace(/\+/g," "))},navigate:e}),l.RunInstaller={init:function(){this.view=new l.view.Installer({section:"featured",SearchView:l.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:l.data.settings.adminUrl,pushState:!0,hashChange:!1})},routes:function(){var t=this,i={};l.router=new l.InstallerRouter,l.router.on("route:preview",function(e){l.preview&&(l.preview.undelegateEvents(),l.preview.unbind()),t.view.view.theme&&t.view.view.theme.preview?(t.view.view.theme.model=t.view.collection.findWhere({slug:e}),t.view.view.theme.preview()):(i.theme=e,t.view.collection.query(i),t.view.collection.trigger("update"),t.view.collection.once("query:success",function(){o('div[data-slug="'+e+'"]').trigger("click")}))}),l.router.on("route:sort",function(e){e||(e="featured",l.router.navigate(l.router.baseUrl("?browse=featured"),{replace:!0})),t.view.sort(e),l.preview&&l.preview.close()}),l.router.on("route:search",function(){o(".wp-filter-search").focus().trigger("keyup")}),this.extraRoutes()},extraRoutes:function(){return!1}},o(document).ready(function(){l.isInstall?l.RunInstaller.init():l.Run.init(),o(document.body).on("click",".load-customize",function(){var e=o(this),t=document.createElement("a");t.href=e.prop("href"),t.search=o.param(_.extend(wp.customize.utils.parseQueryString(t.search.substr(1)),{return:window.location.href})),e.prop("href",t.href)}),o(".broken-themes .delete-theme").on("click",function(){return confirm(_wpThemeSettings.settings.confirmDelete)})})}(jQuery),jQuery(document).ready(function(a){window.tb_position=function(){var e=a("#TB_window"),t=a(window).width(),i=a(window).height(),s=1040 - - <# } else { #> - + <# if ( data.autoupdate.supported ) { #> + <# if ( data.autoupdate.forced === false ) { #> + ' . __( 'Auto-updates disabled' ) . ' + <# } else if ( data.autoupdate.forced ) { #> + ' . __( 'Auto-updates enabled' ) . ' + <# } else if ( data.autoupdate.enabled ) { #> + + <# } else { #> + + <# } #> <# } #> <# if ( data.hasUpdate ) { #> - <# if ( data.autoupdate ) { #> + <# if ( data.autoupdate.supported && data.autoupdate.enabled ) { #> <# } else { #>