Styling and code tidy
This commit is contained in:
parent
ece770490f
commit
0b606c8bbe
|
@ -1 +1 @@
|
|||
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;right:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice.minor{background:#dbd0b0!important;color:#606a74!important}#woocommerce-update .wc_plugin_upgrade_notice.minor::before{display:none}#woocommerce-update .wc_plugin_upgrade_notice.minor a{color:#606a74!important}#woocommerce-update .wc_plugin_upgrade_notice.major{background:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.extensions_warning span{display:list-item;margin-right:1.5em}#woocommerce-update .wc_plugin_upgrade_notice.extensions_warning span:first-of-type{margin-top:.5em}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 -2px 0 8px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}#wc_untested_extensions_modal{display:none}.wc_untested_extensions_modal_container #TB_closeAjaxWindow{display:none}.wc_untested_extensions_modal_container #TB_ajaxContent{height:100%!important}.wc_untested_extensions_modal_container #TB_ajaxContent p:not(.woocommerce-actions){display:none}.wc_untested_extensions_modal--content h1{margin-top:1em;padding-bottom:1.25em;margin-bottom:1.25em;border-bottom:1px solid #eee;color:#555}.wc_untested_extensions_modal--content h4{margin-bottom:2em}.wc_untested_extensions_modal--content .plugin-details{color:red;font-weight:700;display:list-item;margin-right:1.5em}.wc_untested_extensions_modal--content .actions{border-top:1px solid #eee;margin-top:2.5em;padding-top:1em}.wc_untested_extensions_modal--content .actions .woocommerce-actions{display:inline-block}.wc_untested_extensions_modal--content .actions .update-anyways{float:left}.wc_untested_extensions_modal--content .actions .cancel a{display:inline-block;margin-top:.5em;color:#999}
|
||||
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;right:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 -2px 0 8px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}#woocommerce-update .wc_plugin_upgrade_notice.major::before,#woocommerce-update .wc_plugin_upgrade_notice.minor::before{float:right!important}#woocommerce-update .wc_plugin_upgrade_notice.major p,#woocommerce-update .wc_plugin_upgrade_notice.minor p{padding:0 2em 0 0;margin:0}#woocommerce-update .wc_plugin_upgrade_notice.major p::before,#woocommerce-update .wc_plugin_upgrade_notice.minor p::before{content:'';display:none}#woocommerce-update .wc_plugin_upgrade_notice.major ul,#woocommerce-update .wc_plugin_upgrade_notice.minor ul{margin-top:.5em;margin-bottom:0;margin-right:2em;list-style:disc inside}#woocommerce-update .wc_plugin_upgrade_notice.major li,#woocommerce-update .wc_plugin_upgrade_notice.minor li{margin:0}#woocommerce-update .wc_plugin_upgrade_notice.minor{border-right:5px solid #96588a;background:#ecdbd4!important;color:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.minor a,#woocommerce-update .wc_plugin_upgrade_notice.minor li,#woocommerce-update .wc_plugin_upgrade_notice.minor p,#woocommerce-update .wc_plugin_upgrade_notice.minor::before{color:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.major{background:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.major a,#woocommerce-update .wc_plugin_upgrade_notice.major li,#woocommerce-update .wc_plugin_upgrade_notice.major p,#woocommerce-update .wc_plugin_upgrade_notice.major::before{color:#fff!important}#wc_untested_extensions_modal{display:none}.wc_untested_extensions_modal_container #TB_closeAjaxWindow{display:none}.wc_untested_extensions_modal_container #TB_ajaxContent{height:100%!important}.wc_untested_extensions_modal_container #TB_ajaxContent p:not(.woocommerce-actions){display:none}.wc_untested_extensions_modal--content h1{margin-top:1em;padding-bottom:1.25em;margin-bottom:1.25em;border-bottom:1px solid #eee;color:#555}.wc_untested_extensions_modal--content h4{margin-bottom:2em}.wc_untested_extensions_modal--content .plugin-details{color:red;font-weight:700;display:list-item;margin-right:1.5em}.wc_untested_extensions_modal--content .actions{border-top:1px solid #eee;margin-top:2.5em;padding-top:1em}.wc_untested_extensions_modal--content .actions .woocommerce-actions{display:inline-block}.wc_untested_extensions_modal--content .actions .update-anyways{float:left}.wc_untested_extensions_modal--content .actions .cancel a{display:inline-block;margin-top:.5em;color:#999}
|
|
@ -1 +1 @@
|
|||
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice.minor{background:#dbd0b0!important;color:#606a74!important}#woocommerce-update .wc_plugin_upgrade_notice.minor::before{display:none}#woocommerce-update .wc_plugin_upgrade_notice.minor a{color:#606a74!important}#woocommerce-update .wc_plugin_upgrade_notice.major{background:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.extensions_warning span{display:list-item;margin-left:1.5em}#woocommerce-update .wc_plugin_upgrade_notice.extensions_warning span:first-of-type{margin-top:.5em}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 8px 0 -2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}#wc_untested_extensions_modal{display:none}.wc_untested_extensions_modal_container #TB_closeAjaxWindow{display:none}.wc_untested_extensions_modal_container #TB_ajaxContent{height:100%!important}.wc_untested_extensions_modal_container #TB_ajaxContent p:not(.woocommerce-actions){display:none}.wc_untested_extensions_modal--content h1{margin-top:1em;padding-bottom:1.25em;margin-bottom:1.25em;border-bottom:1px solid #eee;color:#555}.wc_untested_extensions_modal--content h4{margin-bottom:2em}.wc_untested_extensions_modal--content .plugin-details{color:red;font-weight:700;display:list-item;margin-left:1.5em}.wc_untested_extensions_modal--content .actions{border-top:1px solid #eee;margin-top:2.5em;padding-top:1em}.wc_untested_extensions_modal--content .actions .woocommerce-actions{display:inline-block}.wc_untested_extensions_modal--content .actions .update-anyways{float:right}.wc_untested_extensions_modal--content .actions .cancel a{display:inline-block;margin-top:.5em;color:#999}
|
||||
@charset "UTF-8";@font-face{font-family:star;src:url(../fonts/star.eot);src:url(../fonts/star.eot?#iefix) format("embedded-opentype"),url(../fonts/star.woff) format("woff"),url(../fonts/star.ttf) format("truetype"),url(../fonts/star.svg#star) format("svg");font-weight:400;font-style:normal}@font-face{font-family:WooCommerce;src:url(../fonts/WooCommerce.eot);src:url(../fonts/WooCommerce.eot?#iefix) format("embedded-opentype"),url(../fonts/WooCommerce.woff) format("woff"),url(../fonts/WooCommerce.ttf) format("truetype"),url(../fonts/WooCommerce.svg#WooCommerce) format("svg");font-weight:400;font-style:normal}#adminmenu #toplevel_page_woocommerce .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e03d'}#adminmenu #menu-posts-product .menu-icon-post div.wp-menu-image::before,#adminmenu #menu-posts-product .menu-icon-product div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e006'}#adminmenu #toplevel_page_wc-reports .menu-icon-generic div.wp-menu-image::before{font-family:WooCommerce!important;content:'\e023';font-size:1.3em!important}span.mce_woocommerce_shortcodes_button{background-image:none!important;display:block;text-indent:-9999px;position:relative;height:1em;width:1em}span.mce_woocommerce_shortcodes_button::before{font-family:WooCommerce;speak:none;font-weight:400;font-variant:normal;text-transform:none;line-height:1;-webkit-font-smoothing:antialiased;margin:0;text-indent:0;position:absolute;top:0;left:0;width:100%;height:100%;text-align:center;content:"";font-size:.9em;line-height:1.2}#woocommerce-update .updating-message .wc_plugin_upgrade_notice{display:none}#woocommerce-update .wc_plugin_upgrade_notice{font-weight:400;color:#fff!important;background:#d54d21!important;padding:1em!important;margin:9px 0!important}#woocommerce-update .wc_plugin_upgrade_notice a{color:#fff;text-decoration:underline}#woocommerce-update .wc_plugin_upgrade_notice::before{color:#fff!important;content:'\f348';display:inline-block;font:400 18px/1 dashicons;speak:none;margin:0 8px 0 -2px;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;vertical-align:top}#woocommerce-update .wc_plugin_upgrade_notice.major::before,#woocommerce-update .wc_plugin_upgrade_notice.minor::before{float:left!important}#woocommerce-update .wc_plugin_upgrade_notice.major p,#woocommerce-update .wc_plugin_upgrade_notice.minor p{padding:0 0 0 2em;margin:0}#woocommerce-update .wc_plugin_upgrade_notice.major p::before,#woocommerce-update .wc_plugin_upgrade_notice.minor p::before{content:'';display:none}#woocommerce-update .wc_plugin_upgrade_notice.major ul,#woocommerce-update .wc_plugin_upgrade_notice.minor ul{margin-top:.5em;margin-bottom:0;margin-left:2em;list-style:disc inside}#woocommerce-update .wc_plugin_upgrade_notice.major li,#woocommerce-update .wc_plugin_upgrade_notice.minor li{margin:0}#woocommerce-update .wc_plugin_upgrade_notice.minor{border-left:5px solid #96588a;background:#ecdbd4!important;color:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.minor a,#woocommerce-update .wc_plugin_upgrade_notice.minor li,#woocommerce-update .wc_plugin_upgrade_notice.minor p,#woocommerce-update .wc_plugin_upgrade_notice.minor::before{color:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.major{background:#96588a!important}#woocommerce-update .wc_plugin_upgrade_notice.major a,#woocommerce-update .wc_plugin_upgrade_notice.major li,#woocommerce-update .wc_plugin_upgrade_notice.major p,#woocommerce-update .wc_plugin_upgrade_notice.major::before{color:#fff!important}#wc_untested_extensions_modal{display:none}.wc_untested_extensions_modal_container #TB_closeAjaxWindow{display:none}.wc_untested_extensions_modal_container #TB_ajaxContent{height:100%!important}.wc_untested_extensions_modal_container #TB_ajaxContent p:not(.woocommerce-actions){display:none}.wc_untested_extensions_modal--content h1{margin-top:1em;padding-bottom:1.25em;margin-bottom:1.25em;border-bottom:1px solid #eee;color:#555}.wc_untested_extensions_modal--content h4{margin-bottom:2em}.wc_untested_extensions_modal--content .plugin-details{color:red;font-weight:700;display:list-item;margin-left:1.5em}.wc_untested_extensions_modal--content .actions{border-top:1px solid #eee;margin-top:2.5em;padding-top:1em}.wc_untested_extensions_modal--content .actions .woocommerce-actions{display:inline-block}.wc_untested_extensions_modal--content .actions .update-anyways{float:right}.wc_untested_extensions_modal--content .actions .cancel a{display:inline-block;margin-top:.5em;color:#999}
|
|
@ -60,34 +60,6 @@ span.mce_woocommerce_shortcodes_button {
|
|||
text-decoration: underline;
|
||||
}
|
||||
|
||||
&.minor {
|
||||
$minor_text_color: #606a74;
|
||||
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
|
||||
background: #dbd0b0 !important;
|
||||
color: $minor_text_color !important;
|
||||
|
||||
a {
|
||||
color: $minor_text_color !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.major {
|
||||
background: #96588a !important;
|
||||
}
|
||||
|
||||
&.extensions_warning span {
|
||||
display: list-item;
|
||||
margin-left: 1.5em;
|
||||
|
||||
&:first-of-type {
|
||||
margin-top: .5em;
|
||||
}
|
||||
}
|
||||
|
||||
&::before {
|
||||
color: #fff !important;
|
||||
content: '\f348';
|
||||
|
@ -99,6 +71,57 @@ span.mce_woocommerce_shortcodes_button {
|
|||
-moz-osx-font-smoothing: grayscale;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
&.minor,
|
||||
&.major {
|
||||
&::before {
|
||||
float: left !important;
|
||||
}
|
||||
p {
|
||||
padding: 0 0 0 2em;
|
||||
margin: 0;
|
||||
|
||||
&::before {
|
||||
content: '';
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
ul {
|
||||
margin-top: .5em;
|
||||
margin-bottom: 0;
|
||||
margin-left: 2em;
|
||||
list-style: disc inside;
|
||||
}
|
||||
li {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.minor {
|
||||
$minor_text_color: #96588a;
|
||||
border-left: 5px solid #96588a;
|
||||
background: #ECDBD4 !important;
|
||||
color: $minor_text_color !important;
|
||||
|
||||
a,
|
||||
p,
|
||||
li,
|
||||
&::before {
|
||||
color: $minor_text_color !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.major {
|
||||
$major_text_color: #fff;
|
||||
background: #96588a !important;
|
||||
|
||||
a,
|
||||
p,
|
||||
li,
|
||||
&::before {
|
||||
color: $major_text_color !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
* @package WooCommerce/Admin
|
||||
* @version 3.2.0
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
@ -17,12 +16,40 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
*/
|
||||
class WC_Admin_Plugin_Updates {
|
||||
|
||||
/**
|
||||
* This is the header used by extensions to show requirements.
|
||||
* @var string
|
||||
*/
|
||||
const VERSION_REQUIRED_HEADER = 'WC requires at least';
|
||||
|
||||
/**
|
||||
* This is the header used by extensions to show testing.
|
||||
* @var string
|
||||
*/
|
||||
const VERSION_TESTED_HEADER = 'WC tested up to';
|
||||
|
||||
/**
|
||||
* The upgrade notice shown inline.
|
||||
* @var string
|
||||
*/
|
||||
protected $upgrade_notice = '';
|
||||
|
||||
/**
|
||||
* The version for the update to WooCommerce.
|
||||
* @var string
|
||||
*/
|
||||
protected $new_version = '';
|
||||
|
||||
/**
|
||||
* Array of plugins lacking testing with the major version.
|
||||
* @var array
|
||||
*/
|
||||
protected $major_untested_plugins = array();
|
||||
|
||||
/**
|
||||
* Array of plugins lacking testing with the minor version.
|
||||
* @var array
|
||||
*/
|
||||
protected $minor_untested_plugins = array();
|
||||
|
||||
/**
|
||||
|
@ -41,7 +68,7 @@ class WC_Admin_Plugin_Updates {
|
|||
*/
|
||||
public function enable_wc_plugin_headers( $headers ) {
|
||||
$headers['WCRequires'] = self::VERSION_REQUIRED_HEADER;
|
||||
$headers['WCTested'] = self::VERSION_TESTED_HEADER;
|
||||
$headers['WCTested'] = self::VERSION_TESTED_HEADER;
|
||||
return $headers;
|
||||
}
|
||||
|
||||
|
@ -51,10 +78,8 @@ class WC_Admin_Plugin_Updates {
|
|||
* @param array $args
|
||||
*/
|
||||
public function in_plugin_update_message( $args, $response ) {
|
||||
|
||||
$this->new_version = $response->new_version;
|
||||
$this->upgrade_notice = $this->get_upgrade_notice( $response->new_version );
|
||||
|
||||
$this->new_version = $response->new_version;
|
||||
$this->upgrade_notice = $this->get_upgrade_notice( $response->new_version );
|
||||
$this->major_untested_plugins = $this->get_untested_plugins( $response->new_version, 'major' );
|
||||
$this->minor_untested_plugins = $this->get_untested_plugins( $response->new_version, 'minor' );
|
||||
|
||||
|
@ -71,9 +96,12 @@ class WC_Admin_Plugin_Updates {
|
|||
add_action( 'admin_print_footer_scripts', array( $this, 'modal_js' ) );
|
||||
}
|
||||
|
||||
echo apply_filters( 'woocommerce_in_plugin_update_message', wp_kses_post( $this->upgrade_notice ) );
|
||||
echo apply_filters( 'woocommerce_in_plugin_update_message', $this->upgrade_notice ? '</p>' . wp_kses_post( $this->upgrade_notice ) : '' );
|
||||
}
|
||||
|
||||
/**
|
||||
* JS for the modal window.
|
||||
*/
|
||||
public function modal_js() {
|
||||
?>
|
||||
<script>
|
||||
|
@ -144,63 +172,88 @@ class WC_Admin_Plugin_Updates {
|
|||
| Methods for getting messages.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Get the inline warning notice for minor version updates.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_extensions_inline_warning_minor() {
|
||||
$upgrade_type = 'minor';
|
||||
$plugins = ! empty( $this->major_untested_plugins ) ? array_diff_key( $this->minor_untested_plugins, $this->major_untested_plugins ) : $this->minor_untested_plugins;
|
||||
|
||||
$upgrade_type = 'minor';
|
||||
$plugins = ! empty( $this->major_untested_plugins ) ? array_diff_key( $this->minor_untested_plugins, $this->major_untested_plugins ) : $this->minor_untested_plugins;
|
||||
$version_parts = explode( '.', $this->new_version );
|
||||
$new_version = $version_parts[0] . '.' . $version_parts[1];
|
||||
$new_version = $version_parts[0] . '.' . $version_parts[1];
|
||||
|
||||
if ( empty( $plugins ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* translators: %s: version number */
|
||||
$message = sprintf( __( 'The following plugin(s) are not listed fully-compatible with WooCommerce %s yet. If possible, upgrade these plugins before upgrading WooCommerce:', 'woocommerce' ), $new_version );
|
||||
$message = sprintf( __( 'The installed versions of the following plugin(s) are not tested with WooCommerce %s. If possible, update these plugins before updating WooCommerce:', 'woocommerce' ), $new_version );
|
||||
|
||||
ob_start();
|
||||
include( 'views/html-notice-untested-extensions-inline.php' );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the inline warning notice for major version updates.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_extensions_inline_warning_major() {
|
||||
$upgrade_type = 'major';
|
||||
$plugins = $this->major_untested_plugins;
|
||||
|
||||
$upgrade_type = 'major';
|
||||
$plugins = $this->major_untested_plugins;
|
||||
$version_parts = explode( '.', $this->new_version );
|
||||
$new_version = $version_parts[0] . '.0';
|
||||
$new_version = $version_parts[0] . '.0';
|
||||
|
||||
if ( empty( $plugins ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* translators: %s: version number */
|
||||
$message = sprintf( __( 'Heads up! The following plugin(s) are not listed compatible with WooCommerce %s yet. If you upgrade without upgrading these extensions first, you may experience issues:', 'woocommerce' ), $new_version );
|
||||
$message = sprintf( __( 'Heads up! The installed versions of the following plugin(s) are not tested with WooCommerce %s and may not be fully-compatible. Please update these extensions or confirm they are compatible first, or you may experience issues:', 'woocommerce' ), $new_version );
|
||||
|
||||
ob_start();
|
||||
include( 'views/html-notice-untested-extensions-inline.php' );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the warning notice for the modal window.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
protected function get_extensions_modal_warning() {
|
||||
$version_parts = explode( '.', $this->new_version );
|
||||
$new_version = $version_parts[0] . '.0';
|
||||
|
||||
$plugins = $this->major_untested_plugins;
|
||||
$new_version = $version_parts[0] . '.0';
|
||||
$plugins = $this->major_untested_plugins;
|
||||
|
||||
ob_start();
|
||||
include( 'views/html-notice-untested-extensions-modal.php' );
|
||||
return ob_get_clean();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the upgrade notice from WordPress.org.
|
||||
*
|
||||
* @param string $version
|
||||
* @return string
|
||||
*/
|
||||
protected function get_upgrade_notice( $version ) {
|
||||
$transient_name = 'wc_upgrade_notice_' . $version;
|
||||
|
||||
//if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) {
|
||||
//if ( false === ( $upgrade_notice = get_transient( $transient_name ) ) ) { @todo remove this for debug
|
||||
//$response = wp_safe_remote_get( 'https://plugins.svn.wordpress.org/woocommerce/trunk/readme.txt' );
|
||||
$response = wp_safe_remote_get( 'http://local.wordpress.dev/wp-content/plugins/woocommerce/readme.txt' );
|
||||
|
||||
if ( ! is_wp_error( $response ) && ! empty( $response['body'] ) ) {
|
||||
$upgrade_notice = $this->parse_update_notice( $response['body'], $version );
|
||||
// set_transient( $transient_name, $upgrade_notice, 1/*DAY_IN_SECONDS*/ );
|
||||
}
|
||||
//}
|
||||
|
||||
return $upgrade_notice;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parse update notice from readme file.
|
||||
*
|
||||
|
@ -209,36 +262,37 @@ class WC_Admin_Plugin_Updates {
|
|||
* @return string
|
||||
*/
|
||||
private function parse_update_notice( $content, $new_version ) {
|
||||
// Output Upgrade Notice.
|
||||
$matches = null;
|
||||
$regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
|
||||
$upgrade_notice = '';
|
||||
$version_parts = explode( '.', $new_version );
|
||||
$check_for_notices = array(
|
||||
$version_parts[0] . '.0', // Major
|
||||
$version_parts[0] . '.0.0', // Major
|
||||
$version_parts[0] . '.' . $version_parts[1], // Minor
|
||||
$version_parts[0] . '.' . $version_parts[1] . '.' . $version_parts[2], // Patch
|
||||
);
|
||||
|
||||
if ( preg_match( $regexp, $content, $matches ) ) {
|
||||
$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
|
||||
|
||||
// Convert the full version strings to minor versions.
|
||||
$notice_version_parts = explode( '.', trim( $matches[1] ) );
|
||||
$current_version_parts = explode( '.', WC_VERSION );
|
||||
|
||||
if ( 3 !== sizeof( $notice_version_parts ) ) {
|
||||
return;
|
||||
foreach ( $check_for_notices as $check_version ) {
|
||||
if ( version_compare( WC_VERSION, $check_version, '>' ) ) {
|
||||
continue;
|
||||
}
|
||||
$matches = null;
|
||||
$regexp = '~==\s*Upgrade Notice\s*==\s*=\s*(.*)\s*=(.*)(=\s*' . preg_quote( $new_version ) . '\s*=|$)~Uis';
|
||||
$upgrade_notice = '';
|
||||
|
||||
$notice_version = $notice_version_parts[0] . '.' . $notice_version_parts[1];
|
||||
$current_version = $current_version_parts[0] . '.' . $current_version_parts[1];
|
||||
if ( preg_match( $regexp, $content, $matches ) ) {
|
||||
$notices = (array) preg_split( '~[\r\n]+~', trim( $matches[2] ) );
|
||||
|
||||
// Check the latest stable version and ignore trunk.
|
||||
if ( version_compare( $current_version, $notice_version, '<' ) ) {
|
||||
if ( version_compare( trim( $matches[1] ), $check_version, '=' ) ) {
|
||||
$upgrade_notice .= '<p class="wc_plugin_upgrade_notice">';
|
||||
|
||||
$upgrade_notice .= '</p><p class="wc_plugin_upgrade_notice">';
|
||||
foreach ( $notices as $index => $line ) {
|
||||
$upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
|
||||
}
|
||||
|
||||
foreach ( $notices as $index => $line ) {
|
||||
$upgrade_notice .= preg_replace( '~\[([^\]]*)\]\(([^\)]*)\)~', '<a href="${2}">${1}</a>', $line );
|
||||
$upgrade_notice .= '</p>';
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return wp_kses_post( $upgrade_notice );
|
||||
}
|
||||
|
||||
|
@ -258,11 +312,10 @@ class WC_Admin_Plugin_Updates {
|
|||
* @return array of plugin info arrays
|
||||
*/
|
||||
protected function get_untested_plugins( $version, $release ) {
|
||||
$extensions = $this->get_plugins_with_header( self::VERSION_TESTED_HEADER );
|
||||
$untested = array();
|
||||
|
||||
$extensions = $this->get_plugins_with_header( self::VERSION_TESTED_HEADER );
|
||||
$untested = array();
|
||||
$version_parts = explode( '.', $version );
|
||||
$version = $version_parts[0];
|
||||
$version = $version_parts[0];
|
||||
|
||||
if ( 'minor' === $release ) {
|
||||
$version .= '.' . $version_parts[1];
|
||||
|
@ -295,7 +348,7 @@ class WC_Admin_Plugin_Updates {
|
|||
$matches = array();
|
||||
|
||||
foreach ( $plugins as $file => $plugin ) {
|
||||
if ( ! empty ( $plugin[ $header ] ) ) {
|
||||
if ( ! empty( $plugin[ $header ] ) ) {
|
||||
$matches[ $file ] = $plugin;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,10 +6,17 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
exit;
|
||||
}
|
||||
?>
|
||||
<p class="wc_plugin_upgrade_notice extensions_warning <?php echo esc_attr( $upgrade_type ) ?>">
|
||||
<strong><?php echo esc_html( $message ) ?></strong><br />
|
||||
<div class="wc_plugin_upgrade_notice extensions_warning <?php echo esc_attr( $upgrade_type ) ?>">
|
||||
<p>
|
||||
<strong><?php echo esc_html( $message ) ?></strong>
|
||||
|
||||
<?php foreach ( $plugins as $plugin ): ?>
|
||||
<span><?php echo esc_html( $plugin['Name'] ); ?></span>
|
||||
<?php endforeach ?>
|
||||
</p>
|
||||
<ul>
|
||||
<?php foreach ( $plugins as $plugin ) : ?>
|
||||
<li><?php
|
||||
/* translators: 1: plugin name 2: tested up to version */
|
||||
echo esc_html( sprintf( __( '%1$s (tested up to %2$s)', 'woocommerce' ), $plugin['Name'], $plugin['WC tested up to'] ) );
|
||||
?></li>
|
||||
<?php endforeach ?>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
|
|
|
@ -15,7 +15,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
|||
<?php
|
||||
/* translators: %s: version number */
|
||||
printf(
|
||||
__( 'These plugins are not listed compatible with WooCommerce %s yet. This is a major update. If you upgrade without upgrading these extensions first, you may experience issues:', 'woocommerce' ),
|
||||
__( 'These plugins are not listed compatible with WooCommerce %s yet. This is a major update. If you upgrade without updating these extensions first, you may experience issues:', 'woocommerce' ),
|
||||
esc_html( $new_version )
|
||||
);
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue