Helper: Various Improvements (#15519)
* Helper: Improve messaging and CTAs * Helper: Update copy on connect flow * Helper: Improve messaging around plugins without a subscription * removes toggle from extensions that cannot be activated * Helper: Add new `WC_Helper_Compat` class for legacy helper compat This new class removes some of the actions from the legacy helper (updater) plugin, attempts to migrate an existing legacy connection to a new one, attempts to deactivate the old helper plugin. * Helper: Improve messaging around maxed out subscriptions * Helper: Enable `WC_Tracker` when connected to WooCommerce.com * Helper: adds styles for manual licence form row and other visual improvements * Helper: removes disabled toggles * Helper: adds styles for connection component * Helper: redesigned connection module * Helper: rotates the connection module chevron on mouse hover * Helper: adds some fixes to the key form on mobile and other updates to meet coding standards * Helper: Only mark action as primary if there's a CTA button. * Helper: Better handling for woothemes_updater_notice Remove the updater notice built into extensions and themes, even if the legacy Helper plugin is deactivated. * Helper: Navigate existing Helper users to the new place. Adds a Dashboard menu item and direct users of the old helper plugin to the new Extensions screen. * Helper: Do not show the back-compat menu item for new users * Helper: Avoid notice in API authentication if credentials are missing * Helper: Hide the back-compat menu item when users see the new screen Also sets the user_id for the connection if one was not previously set.
This commit is contained in:
parent
9fb8fa4761
commit
247e13e2ca
File diff suppressed because one or more lines are too long
|
@ -35,12 +35,12 @@ $color_button_secondary: $woo_pink2;
|
|||
Tab navigation
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.wc-helper{
|
||||
.nav-tab-wrapper{
|
||||
.wc-helper {
|
||||
.nav-tab-wrapper {
|
||||
margin-bottom: 22px;
|
||||
}
|
||||
@media only screen and (max-width : 784px) {
|
||||
.nav-tab{
|
||||
.nav-tab {
|
||||
max-width: 40%;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
|
@ -53,8 +53,8 @@ $color_button_secondary: $woo_pink2;
|
|||
Buttons
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.wc-helper{
|
||||
.button, .button:hover{
|
||||
.wc-helper {
|
||||
.button, .button:hover {
|
||||
background-color: $color_button_primary;
|
||||
border-width: 0;
|
||||
box-shadow: none;
|
||||
|
@ -69,51 +69,51 @@ $color_button_secondary: $woo_pink2;
|
|||
line-height: 2;
|
||||
}
|
||||
}
|
||||
.button:hover{
|
||||
.button:hover {
|
||||
opacity: 0.8;
|
||||
}
|
||||
|
||||
.button.button-secondary{
|
||||
.button.button-secondary {
|
||||
background-color: #e6e6e6;
|
||||
color: #3c3c3c;
|
||||
text-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
.wc-helper .subscription-filter{
|
||||
.wc-helper .subscription-filter {
|
||||
color: #2E4453;
|
||||
font-size: 13px;
|
||||
line-height: 13px;
|
||||
margin: 22px 0;
|
||||
|
||||
label{
|
||||
label {
|
||||
display: none;
|
||||
position: relative;
|
||||
|
||||
.chevron{
|
||||
.chevron {
|
||||
color: #E1E1E1;
|
||||
border-bottom-width: 0;
|
||||
line-height: 1;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
top: 12px;
|
||||
right: 12px;
|
||||
border-bottom-width: 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
span{
|
||||
span {
|
||||
font-weight: bold;
|
||||
padding-right: 4px;
|
||||
}
|
||||
|
||||
a{
|
||||
position: relative;
|
||||
a {
|
||||
color: #0073AA;
|
||||
display: inline-block;
|
||||
padding: 0 4px 0 8px;
|
||||
position: relative;
|
||||
text-decoration: none;
|
||||
|
||||
&:before{
|
||||
&:before {
|
||||
background-color: #979797;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
|
@ -130,39 +130,45 @@ $color_button_secondary: $woo_pink2;
|
|||
border-radius: 2px;
|
||||
font-size: 14px;
|
||||
|
||||
label, span, a{
|
||||
label,
|
||||
span,
|
||||
a {
|
||||
border-bottom: 1px solid #E1E1E1;
|
||||
line-height: 2;
|
||||
padding: 8px 16px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
label, span.chevron{
|
||||
label,
|
||||
span.chevron {
|
||||
display: block;
|
||||
}
|
||||
|
||||
span, a{
|
||||
span,
|
||||
a {
|
||||
display: none;
|
||||
}
|
||||
|
||||
a{
|
||||
a {
|
||||
cursor: pointer;
|
||||
|
||||
&::before{
|
||||
&::before {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
|
||||
span.chevron{
|
||||
span.chevron {
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
|
||||
&:focus,&:hover{
|
||||
span, a{
|
||||
&:focus,
|
||||
&:hover {
|
||||
span,
|
||||
a {
|
||||
display: block;
|
||||
}
|
||||
|
||||
span.chevron{
|
||||
span.chevron {
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
}
|
||||
|
@ -170,6 +176,157 @@ $color_button_secondary: $woo_pink2;
|
|||
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Subscriptons Header
|
||||
------------------------------------------------------------------------------*/
|
||||
|
||||
.wc-helper {
|
||||
.subscriptions-header {
|
||||
margin: 3em 0 0;
|
||||
position: relative;
|
||||
z-index: 10;
|
||||
|
||||
h2 {
|
||||
display: inline-block;
|
||||
line-height: 25px;
|
||||
margin: 0 0 1.5em 0;
|
||||
}
|
||||
|
||||
}
|
||||
.button-update, .button-update:hover {
|
||||
background-color: #E6E6E6;
|
||||
border-radius: 4px;
|
||||
color: #333;
|
||||
font-weight: 800;
|
||||
font-size: 10px;
|
||||
line-height: 20px;
|
||||
margin-left: 6px;
|
||||
opacity: 0.75;
|
||||
padding: 3px 7px;
|
||||
text-transform: uppercase;
|
||||
|
||||
.dashicons {
|
||||
font-size: 12px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
vertical-align: text-bottom;
|
||||
}
|
||||
}
|
||||
|
||||
.button-update:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
.user-info {
|
||||
background-color: #fff;
|
||||
border: 1px solid #E1E1E1;
|
||||
border-radius: 4px;
|
||||
font-size: 12px;
|
||||
line-height: 26px;
|
||||
position: absolute;
|
||||
top: -10px;
|
||||
right: 0;
|
||||
transition: all .1s ease-in;
|
||||
|
||||
@media only screen and (max-width : 600px) {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
p {
|
||||
line-height: 26px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
box-shadow: 0 3px 5px rgba(0,0,0,.2);
|
||||
}
|
||||
|
||||
header {
|
||||
color: #555555;
|
||||
font-weight: 600;
|
||||
padding: 6px 14px;
|
||||
position: relative;
|
||||
|
||||
p {
|
||||
padding-right: 26px;
|
||||
}
|
||||
|
||||
.dashicons {
|
||||
opacity: 0.5;
|
||||
position: absolute;
|
||||
top: 9px;
|
||||
right: 14px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
section {
|
||||
display: none;
|
||||
|
||||
p {
|
||||
border-top: 1px solid #E1E1E1;
|
||||
padding: 6px 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.actions {
|
||||
border-top: 1px solid #E1E1E1;
|
||||
display: flex;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #A26897;
|
||||
cursor: pointer;
|
||||
font-weight: 600;
|
||||
line-height: 38px;
|
||||
padding: 0 14px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
white-space: nowrap;
|
||||
width: 50%;
|
||||
|
||||
.dashicons {
|
||||
margin-top: -3px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
&:first-child {
|
||||
border-right: 1px solid #E1E1E1;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: #A26897;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.avatar {
|
||||
border: 1px solid #ECE1EA;
|
||||
border-radius: 50%;
|
||||
height: auto;
|
||||
margin-right: 6px;
|
||||
width: 24px;
|
||||
vertical-align: bottom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.user-info:hover,
|
||||
.user-info:focus,
|
||||
.user-info:active {
|
||||
header .dashicons {
|
||||
transform: rotateX(180deg);
|
||||
}
|
||||
section {
|
||||
display: block
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Subscripton table
|
||||
------------------------------------------------------------------------------*/
|
||||
|
@ -198,31 +355,33 @@ $color_button_secondary: $woo_pink2;
|
|||
.widefat tfoot tr th,
|
||||
.widefat tfoot tr td {
|
||||
color: #32373c;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 15px;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
.widefat td {
|
||||
//border-bottom: 1px solid #e5e5e5;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.wp-list-table{
|
||||
padding-top: 0 !important;
|
||||
.wp-list-table {
|
||||
border: 0;
|
||||
box-shadow: none;
|
||||
padding-top: 0 !important;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.button{
|
||||
.button {
|
||||
@media only screen and (max-width : 782px) {
|
||||
font-size: 11px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__row{
|
||||
.wp-list-table__row {
|
||||
background-color: rgba(0,0,0,0);
|
||||
|
||||
td{
|
||||
td {
|
||||
align-items: center;
|
||||
background-color: #fff;
|
||||
border: 0px;
|
||||
//border-top: 1px solid #e5e5e5;
|
||||
|
@ -234,13 +393,13 @@ $color_button_secondary: $woo_pink2;
|
|||
}
|
||||
}
|
||||
|
||||
td.color-bar{
|
||||
td.color-bar {
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
&.is-ext-header{
|
||||
&.is-ext-header {
|
||||
|
||||
td{
|
||||
td {
|
||||
border-top: 1px solid #E1E1E1;
|
||||
}
|
||||
|
||||
|
@ -249,11 +408,11 @@ $color_button_secondary: $woo_pink2;
|
|||
flex-flow: row wrap;
|
||||
width: 100%;
|
||||
|
||||
.wp-list-table__ext-details{
|
||||
flex: 2;
|
||||
.wp-list-table__ext-details {
|
||||
display: block;
|
||||
flex: 2;
|
||||
}
|
||||
.wp-list-table__ext-actions{
|
||||
.wp-list-table__ext-actions {
|
||||
display: block;
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
@ -261,20 +420,31 @@ $color_button_secondary: $woo_pink2;
|
|||
}
|
||||
}
|
||||
|
||||
&:last-child td{
|
||||
border-bottom: 6px solid #F1F1F1;
|
||||
&:last-child td {
|
||||
border-bottom: 24px solid #F1F1F1;
|
||||
box-shadow: inset 0 -1px 0 #E1E1E1;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-details,
|
||||
.wp-list-table__ext-status{
|
||||
border-left: 1px solid #E1E1E1 !important;
|
||||
.wp-list-table__ext-status,
|
||||
.wp-list-table__licence-container {
|
||||
padding-right: 22px;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
|
||||
&::before {
|
||||
background-color: #E1E1E1;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0 !important;
|
||||
width: 1px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-details{
|
||||
.wp-list-table__ext-details {
|
||||
display: flex;
|
||||
|
||||
@media only screen and (max-width : 782px) {
|
||||
|
@ -282,7 +452,7 @@ $color_button_secondary: $woo_pink2;
|
|||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-title{
|
||||
.wp-list-table__ext-title {
|
||||
color: $color_text_blue;
|
||||
font-size: 18px;
|
||||
font-weight: 784;
|
||||
|
@ -292,6 +462,10 @@ $color_button_secondary: $woo_pink2;
|
|||
margin-bottom: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 320px) {
|
||||
max-width: 120px;
|
||||
}
|
||||
}
|
||||
.wp-list-table__ext-description {
|
||||
color: #333;
|
||||
|
@ -306,69 +480,83 @@ $color_button_secondary: $woo_pink2;
|
|||
.wp-list-table__ext-status {
|
||||
position: relative;
|
||||
|
||||
&.update-available:after{
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 5px;
|
||||
&.update-available:after {
|
||||
background-color: #FFC322;
|
||||
}
|
||||
|
||||
&.expired:after{
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 5px;
|
||||
background-color: #B81C23;
|
||||
}
|
||||
|
||||
.dashicons-update{
|
||||
&.expired:after {
|
||||
background-color: #B81C23;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
bottom: 0;
|
||||
width: 5px;
|
||||
}
|
||||
|
||||
.dashicons-update {
|
||||
color: #FFC322;
|
||||
}
|
||||
|
||||
.dashicons-info{
|
||||
.dashicons-info {
|
||||
color: #B81C23;
|
||||
}
|
||||
|
||||
p{
|
||||
p {
|
||||
color: #333333;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.dashicons{
|
||||
.dashicons {
|
||||
margin-right: 5px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-actions{
|
||||
border-right: 1px solid #E1E1E1 !important;
|
||||
.wp-list-table__ext-actions {
|
||||
min-width: 150px;
|
||||
position: relative;
|
||||
width: 25%;
|
||||
text-align: right;
|
||||
|
||||
&::after {
|
||||
background-color: #E1E1E1;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-updates {
|
||||
|
||||
td{
|
||||
.wp-list-table__ext-updates,
|
||||
.wp-list-table__ext-licence {
|
||||
td {
|
||||
position: relative;
|
||||
|
||||
&:before {
|
||||
background-color: #E1E1E1;
|
||||
content: " ";
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background-color: #E1E1E1;
|
||||
}
|
||||
}
|
||||
|
||||
td.wp-list-table__ext-status:before {
|
||||
left: 22px;
|
||||
td.wp-list-table__ext-status,
|
||||
td.wp-list-table__licence-container {
|
||||
&:before {
|
||||
left: 22px !important;
|
||||
width: auto !important;
|
||||
}
|
||||
}
|
||||
|
||||
td.wp-list-table__ext-actions:before {
|
||||
|
@ -378,29 +566,118 @@ $color_button_secondary: $woo_pink2;
|
|||
@media only screen and (max-width : 782px) {
|
||||
display: flex;
|
||||
|
||||
.wp-list-table__ext-status{
|
||||
.wp-list-table__ext-status {
|
||||
flex: 2;
|
||||
|
||||
&::before{
|
||||
&::before {
|
||||
left: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__ext-actions{
|
||||
.wp-list-table__ext-actions {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
|
||||
&::before{
|
||||
right: 0 !important;
|
||||
&::before {
|
||||
left: 0 !important;
|
||||
right: 0 !important;
|
||||
width: 100% !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__licence-container {
|
||||
padding: 0 !important;
|
||||
|
||||
&::after {
|
||||
background-color: #E1E1E1;
|
||||
content: " ";
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
right: 0;
|
||||
width: 1px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__licence-form {
|
||||
display: flex;
|
||||
padding: 16px 22px;
|
||||
|
||||
@media only screen and (max-width : 782px) {
|
||||
display: block;
|
||||
}
|
||||
|
||||
&::before {
|
||||
background-color: #E1E1E1;
|
||||
content: " ";
|
||||
height: 1px;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 22px;
|
||||
left: 22px;
|
||||
|
||||
@media only screen and (max-width : 782px) {
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
div {
|
||||
padding-right: 16px;
|
||||
vertical-align: middle;
|
||||
|
||||
@media only screen and (max-width : 782px) {
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0 !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__licence-label {
|
||||
label {
|
||||
color: #23282d;
|
||||
font-weight: 600;
|
||||
line-height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__licence-field {
|
||||
input {
|
||||
height: 32px;
|
||||
|
||||
@media only screen and (max-width : 480px) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 782px) {
|
||||
padding: 8px 0 16px !important;
|
||||
}
|
||||
}
|
||||
|
||||
.wp-list-table__licence-actions {
|
||||
flex-grow: 2;
|
||||
padding-right: 0 !important;
|
||||
|
||||
.button {
|
||||
margin-right: 8px;
|
||||
}
|
||||
.button-secondary {
|
||||
float: right;
|
||||
margin: 0 0 0 8px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 480px) {
|
||||
text-align: right;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*------------------------------------------------------------------------------
|
||||
Expired notification bar
|
||||
|
@ -435,15 +712,15 @@ $color_button_secondary: $woo_pink2;
|
|||
.wc-helper {
|
||||
.connect-wrapper {
|
||||
background-color: #fff;
|
||||
margin-bottom: 25px;
|
||||
border: 1px solid #e5e5e5;
|
||||
margin-bottom: 25px;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.connected {
|
||||
display: flex;
|
||||
|
||||
.user-info{
|
||||
.user-info {
|
||||
display: flex;
|
||||
padding: 20px;
|
||||
width: 100%;
|
||||
|
@ -456,7 +733,7 @@ $color_button_secondary: $woo_pink2;
|
|||
width: 34px;
|
||||
}
|
||||
|
||||
.buttons{
|
||||
.buttons {
|
||||
padding: 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
@ -466,55 +743,53 @@ $color_button_secondary: $woo_pink2;
|
|||
margin: 10px 0 0 20px;
|
||||
}
|
||||
|
||||
.chevron{
|
||||
.chevron {
|
||||
display: none;
|
||||
|
||||
&:hover{
|
||||
cursor: pointer;
|
||||
&:hover {
|
||||
color: $woo_pink1;
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width : 784px) {
|
||||
|
||||
display: block;
|
||||
|
||||
strong{
|
||||
strong {
|
||||
display: block;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
p{
|
||||
p {
|
||||
margin: 0;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.user-info{
|
||||
.user-info {
|
||||
padding-right: 0;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.avatar{
|
||||
.avatar {
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.chevron{
|
||||
display: block;
|
||||
.chevron {
|
||||
color: #E1E1E1;
|
||||
display: block;
|
||||
margin: 10px;
|
||||
transform: rotateX(0deg);
|
||||
}
|
||||
|
||||
.buttons{
|
||||
.buttons {
|
||||
display: none;
|
||||
border-top: 1px solid #E1E1E1;
|
||||
padding: 10px 20px;
|
||||
|
||||
display: none;
|
||||
|
||||
&.active{
|
||||
&.active {
|
||||
display: block;
|
||||
}
|
||||
|
||||
|
@ -530,24 +805,24 @@ $color_button_secondary: $woo_pink2;
|
|||
.wc-helper {
|
||||
.start-container {
|
||||
background-color: #ffffff;
|
||||
border-left: 4px solid #cc99c2;
|
||||
padding: 45px 20px 20px 30px;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
border-left: 4px solid #cc99c2;
|
||||
}
|
||||
|
||||
.start-container::before {
|
||||
content: "\e01C";
|
||||
font-family: WooCommerce;
|
||||
text-align: center;
|
||||
line-height: 1;
|
||||
color: #eee2ec;
|
||||
content: "\e01C";
|
||||
display: block;
|
||||
width: 1em;
|
||||
font-family: WooCommerce;
|
||||
font-size: 192px;
|
||||
top: 65%;
|
||||
right: -3%;
|
||||
line-height: 1;
|
||||
position: absolute;
|
||||
top: 65%;
|
||||
right: -3%;
|
||||
text-align: center;
|
||||
width: 1em;
|
||||
}
|
||||
|
||||
.start-container h2 {
|
||||
|
@ -598,15 +873,15 @@ $color_button_secondary: $woo_pink2;
|
|||
// FormToggle
|
||||
// ==========================================================================
|
||||
|
||||
.form-toggle__wrapper{
|
||||
.form-toggle__wrapper {
|
||||
position: relative;
|
||||
|
||||
label{
|
||||
label {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.form-toggle{
|
||||
.form-toggle {
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
position: absolute;
|
||||
|
@ -618,48 +893,50 @@ $color_button_secondary: $woo_pink2;
|
|||
text-indent: -100000px;
|
||||
z-index: 2;
|
||||
|
||||
&:focus{
|
||||
&:focus {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
&.disabled{
|
||||
&.disabled {
|
||||
cursor: default;
|
||||
}
|
||||
}
|
||||
|
||||
.form-toggle__switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
align-self: flex-start;
|
||||
background: lighten( $gray, 20% );
|
||||
border-radius: 12px;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
padding: 2px;
|
||||
outline: 0;
|
||||
position: relative;
|
||||
width: 40px;
|
||||
height: 24px;
|
||||
vertical-align: middle;
|
||||
align-self: flex-start;
|
||||
outline: 0;
|
||||
transition: all .4s ease, box-shadow 0s;
|
||||
|
||||
background: lighten( $gray, 20% );
|
||||
vertical-align: middle;
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
position: relative;
|
||||
display: block;
|
||||
content: "";
|
||||
display: block;
|
||||
position: relative;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
&:after {
|
||||
left: 0;
|
||||
border-radius: 50%;
|
||||
background: $white;
|
||||
left: 0;
|
||||
transition: all .2s ease;
|
||||
}
|
||||
|
||||
&:before {
|
||||
display: none;
|
||||
}
|
||||
.accessible-focus &:focus{
|
||||
|
||||
.accessible-focus &:focus {
|
||||
box-shadow: 0 0 0 2px $woo_pink1;
|
||||
}
|
||||
|
||||
|
@ -671,12 +948,11 @@ $color_button_secondary: $woo_pink2;
|
|||
z-index: 1;
|
||||
|
||||
.form-toggle__label-content {
|
||||
flex: 0 1 100%;
|
||||
margin-left: 12px;
|
||||
|
||||
color: #87a6bc;
|
||||
flex: 0 1 100%;
|
||||
font-size: 13px;
|
||||
line-height: 16px;
|
||||
margin-left: 12px;
|
||||
margin-right: 8px;
|
||||
vertical-align: top;
|
||||
text-transform: uppercase;
|
||||
|
@ -707,7 +983,7 @@ $color_button_secondary: $woo_pink2;
|
|||
}
|
||||
}
|
||||
|
||||
&.active{
|
||||
&.active {
|
||||
+ .form-toggle__label .form-toggle__switch {
|
||||
background: $woo_pink1;
|
||||
|
||||
|
@ -748,13 +1024,13 @@ $color_button_secondary: $woo_pink2;
|
|||
|
||||
&:before,
|
||||
&:after {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
width: 12px;
|
||||
}
|
||||
}
|
||||
&:checked {
|
||||
+ .form-toggle__label .form-toggle__switch {
|
||||
&:after{
|
||||
&:after {
|
||||
left: 8px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,6 +81,7 @@ class WC_Admin {
|
|||
include_once( dirname( __FILE__ ) . '/helper/class-wc-helper-api.php' );
|
||||
include_once( dirname( __FILE__ ) . '/helper/class-wc-helper-updater.php' );
|
||||
include_once( dirname( __FILE__ ) . '/helper/class-wc-helper-plugin-info.php' );
|
||||
include_once( dirname( __FILE__ ) . '/helper/class-wc-helper-compat.php' );
|
||||
include_once( dirname( __FILE__ ) . '/helper/class-wc-helper.php' );
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,10 @@ class WC_Helper_API {
|
|||
*/
|
||||
private static function _authenticate( $url, &$args ) {
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
if ( empty( $auth['access_token'] ) || empty( $auth['access_token_secret'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$request_uri = parse_url( $url, PHP_URL_PATH );
|
||||
$query_string = parse_url( $url, PHP_URL_QUERY );
|
||||
if ( $query_string ) {
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
<?php
|
||||
if ( ! defined( 'ABSPATH' ) ) {
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* WC_Helper_Compat Class
|
||||
*
|
||||
* Some level of compatibility with the legacy WooCommerce Helper plugin.
|
||||
*/
|
||||
class WC_Helper_Compat {
|
||||
|
||||
/**
|
||||
* Loads the class, runs on init.
|
||||
*/
|
||||
public static function load() {
|
||||
add_action( 'woocommerce_helper_loaded', array( __CLASS__, 'helper_loaded' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs during woocommerce_helper_loaded
|
||||
*/
|
||||
public static function helper_loaded() {
|
||||
// Stop the nagging about WooThemes Updater
|
||||
remove_action( 'admin_notices', 'woothemes_updater_notice' );
|
||||
|
||||
// A placeholder dashboard menu for legacy helper users.
|
||||
add_action( 'admin_menu', array( __CLASS__, 'admin_menu' ) );
|
||||
|
||||
if ( empty( $GLOBALS['woothemes_updater'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
self::remove_actions();
|
||||
self::migrate_connection();
|
||||
self::deactivate_plugin();
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove legacy helper actions (notices, menus, etc.)
|
||||
*/
|
||||
public static function remove_actions() {
|
||||
// Remove WooThemes Updater notices
|
||||
remove_action( 'network_admin_notices', array( $GLOBALS['woothemes_updater']->admin, 'maybe_display_activation_notice' ) );
|
||||
remove_action( 'admin_notices', array( $GLOBALS['woothemes_updater']->admin, 'maybe_display_activation_notice' ) );
|
||||
remove_action( 'network_admin_menu', array( $GLOBALS['woothemes_updater']->admin, 'register_settings_screen' ) );
|
||||
remove_action( 'admin_menu', array( $GLOBALS['woothemes_updater']->admin, 'register_settings_screen' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to migrate a legacy connection to a new one.
|
||||
*/
|
||||
public static function migrate_connection() {
|
||||
// Don't attempt to migrate if attempted before.
|
||||
if ( WC_Helper_Options::get( 'did-migrate' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
if ( ! empty( $auth ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
WC_Helper::log( 'Attempting oauth/migrate' );
|
||||
WC_Helper_Options::update( 'did-migrate', true );
|
||||
|
||||
$master_key = get_option( 'woothemes_helper_master_key' );
|
||||
if ( empty( $master_key ) ) {
|
||||
WC_Helper::log( 'Master key not found, aborting' );
|
||||
return;
|
||||
}
|
||||
|
||||
$request = WC_Helper_API::post( 'oauth/migrate', array(
|
||||
'body' => array(
|
||||
'home_url' => home_url(),
|
||||
'master_key' => $master_key,
|
||||
),
|
||||
) );
|
||||
|
||||
if ( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) !== 200 ) {
|
||||
WC_Helper::log( 'Call to oauth/migrate returned a non-200 response code' );
|
||||
return;
|
||||
}
|
||||
|
||||
$request_token = json_decode( wp_remote_retrieve_body( $request ) );
|
||||
if ( empty( $request_token ) ) {
|
||||
WC_Helper::log( 'Call to oauth/migrate returned an empty token' );
|
||||
return;
|
||||
}
|
||||
|
||||
// Obtain an access token.
|
||||
$request = WC_Helper_API::post( 'oauth/access_token', array(
|
||||
'body' => array(
|
||||
'request_token' => $request_token,
|
||||
'home_url' => home_url(),
|
||||
),
|
||||
) );
|
||||
|
||||
if ( is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) !== 200 ) {
|
||||
WC_Helper::log( 'Call to oauth/access_token returned a non-200 response code' );
|
||||
return;
|
||||
}
|
||||
|
||||
$access_token = json_decode( wp_remote_retrieve_body( $request ), true );
|
||||
if ( empty( $access_token ) ) {
|
||||
WC_Helper::log( 'Call to oauth/access_token returned an invalid token' );
|
||||
return;
|
||||
}
|
||||
|
||||
WC_Helper_Options::update( 'auth', array(
|
||||
'access_token' => $access_token['access_token'],
|
||||
'access_token_secret' => $access_token['access_token_secret'],
|
||||
'site_id' => $access_token['site_id'],
|
||||
'user_id' => null, // Set this later
|
||||
'updated' => time(),
|
||||
) );
|
||||
|
||||
// Obtain the connected user info.
|
||||
if ( ! WC_Helper::_flush_authentication_cache() ) {
|
||||
WC_Helper::log( 'Could not obtain connected user info in migrate_connection' );
|
||||
WC_Helper_Options::update( 'auth', array() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempt to deactivate the legacy helper plugin.
|
||||
*/
|
||||
public static function deactivate_plugin() {
|
||||
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
||||
if ( ! function_exists( 'deactivate_plugins' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( is_plugin_active( 'woothemes-updater/woothemes-updater.php' ) ) {
|
||||
deactivate_plugins( 'woothemes-updater/woothemes-updater.php' );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register menu item.
|
||||
*/
|
||||
public static function admin_menu() {
|
||||
// No additional menu items for users who did not have a connected helper before.
|
||||
$master_key = get_option( 'woothemes_helper_master_key' );
|
||||
if ( empty( $master_key ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Do not show the menu item if user has already seen the new screen.
|
||||
$auth = WC_Helper_Options::get( 'auth' );
|
||||
if ( ! empty( $auth['user_id'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
add_dashboard_page( __( 'WooCommerce Helper', 'woocommerce' ), __( 'WooCommerce Helper', 'woocommerce' ), 'manage_options', 'woothemes-helper-compat', array( __CLASS__, 'render_compat_menu' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the legacy helper compat view.
|
||||
*/
|
||||
public static function render_compat_menu() {
|
||||
$helper_url = add_query_arg( array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
), admin_url( 'admin.php' ) );
|
||||
include( WC_Helper::get_view_filename( 'html-helper-compat.php' ) );
|
||||
}
|
||||
}
|
||||
|
||||
WC_Helper_Compat::load();
|
|
@ -39,22 +39,11 @@ class WC_Helper {
|
|||
add_action( 'activated_plugin', array( __CLASS__, 'activated_plugin' ) );
|
||||
add_action( 'deactivated_plugin', array( __CLASS__, 'deactivated_plugin' ) );
|
||||
|
||||
// Stop the nagging about WooThemes Updater
|
||||
remove_action( 'admin_notices', 'woothemes_updater_notice' );
|
||||
|
||||
// Remove WooThemes Updater notices
|
||||
if ( ! empty( $GLOBALS['woothemes_updater'] ) ) {
|
||||
remove_action( 'network_admin_notices', array( $GLOBALS['woothemes_updater']->admin, 'maybe_display_activation_notice' ) );
|
||||
remove_action( 'admin_notices', array( $GLOBALS['woothemes_updater']->admin, 'maybe_display_activation_notice' ) );
|
||||
remove_action( 'network_admin_menu', array( $GLOBALS['woothemes_updater']->admin, 'register_settings_screen' ) );
|
||||
remove_action( 'admin_menu', array( $GLOBALS['woothemes_updater']->admin, 'register_settings_screen' ) );
|
||||
|
||||
// TODO: In a later version, when things are stable, attempt to deactivate the legacy helper.
|
||||
}
|
||||
|
||||
// Add some nags about extension updates
|
||||
add_action( 'admin_notices', array( __CLASS__, 'admin_notices' ) );
|
||||
add_filter( 'woocommerce_in_plugin_update_message', array( __CLASS__, 'in_plugin_update_message' ) );
|
||||
|
||||
do_action( 'woocommerce_helper_loaded' );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,6 +146,93 @@ class WC_Helper {
|
|||
$subscription['update_url'] = wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' . $local['_stylesheet'] ), 'upgrade-theme_' . $local['_stylesheet'] );
|
||||
}
|
||||
}
|
||||
|
||||
$subscription['has_update'] = false;
|
||||
if ( $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['has_update'] = version_compare( $updates[ $subscription['product_id'] ]['version'], $subscription['local']['version'], '>' );
|
||||
}
|
||||
|
||||
$subscription['download_url'] = $subscription['product_url'];
|
||||
if ( ! $subscription['local']['installed'] && ! empty( $updates[ $subscription['product_id'] ] ) ) {
|
||||
$subscription['download_url'] = $updates[ $subscription['product_id'] ]['package'];
|
||||
}
|
||||
|
||||
$subscription['actions'] = array();
|
||||
|
||||
if ( $subscription['has_update'] && ! $subscription['expired'] ) {
|
||||
$action = array(
|
||||
/* translators: %s: version number */
|
||||
'message' => sprintf( __( 'Version %s is <strong>available</strong>.', 'woocommerce' ), esc_html( $updates[ $subscription['product_id'] ]['version'] ) ),
|
||||
'button_label' => __( 'Update', 'woocommerce' ),
|
||||
'button_url' => $subscription['update_url'],
|
||||
'status' => 'update-available',
|
||||
'icon' => 'dashicons-update',
|
||||
);
|
||||
|
||||
// Subscription is not active on this site.
|
||||
if ( ! $subscription['active'] ) {
|
||||
$action['message'] .= ' ' . __( 'To enable this update you need to <strong>activate</strong> this subscription.', 'woocommerce' );
|
||||
$action['button_label'] = null;
|
||||
$action['button_url'] = null;
|
||||
}
|
||||
|
||||
$subscription['actions'][] = $action;
|
||||
}
|
||||
|
||||
if ( $subscription['has_update'] && $subscription['expired'] ) {
|
||||
$action = array(
|
||||
/* translators: %s: version number */
|
||||
'message' => sprintf( __( 'Version %s is <strong>available</strong>.', 'woocommerce' ), esc_html( $updates[ $subscription['product_id'] ]['version'] ) ),
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$action['message'] .= ' ' . __( 'To enable this update you need to <strong>purchase</strong> a new subscription.', 'woocommerce' );
|
||||
$action['button_label'] = __( 'Purchase', 'woocommerce' );
|
||||
$action['button_url'] = $subscription['product_url'];
|
||||
|
||||
$subscription['actions'][] = $action;
|
||||
} elseif ( $subscription['expired'] ) {
|
||||
$action = array(
|
||||
'message' => sprintf( __( 'This subscription has expired. Please <strong>renew</strong> to receive updates and support.', 'woocommerce' ) ),
|
||||
'button_label' => __( 'Renew', 'woocommerce' ),
|
||||
'button_url' => 'https://woocommerce.com/my-account/my-subscriptions/',
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$subscription['actions'][] = $action;
|
||||
}
|
||||
|
||||
if ( $subscription['expiring'] && ! $subscription['autorenew'] ) {
|
||||
$action = array(
|
||||
'message' => __( 'Subscription is <strong>expiring</strong> soon.', 'woocommerce' ),
|
||||
'button_label' => __( 'Enable auto-renew', 'woocommerce' ),
|
||||
'button_url' => 'https://woocommerce.com/my-account/my-subscriptions/',
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$subscription['actions'][] = $action;
|
||||
} elseif ( $subscription['expiring'] ) {
|
||||
$action = array(
|
||||
'message' => sprintf( __( 'This subscription is expiring soon. Please <strong>renew</strong> to continue receiving updates and support.', 'woocommerce' ) ),
|
||||
'button_label' => __( 'Renew', 'woocommerce' ),
|
||||
'button_url' => 'https://woocommerce.com/my-account/my-subscriptions/',
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$subscription['actions'][] = $action;
|
||||
}
|
||||
|
||||
// Mark the first action primary.
|
||||
foreach ( $subscription['actions'] as $key => $action ) {
|
||||
if ( ! empty( $action['button_label'] ) ) {
|
||||
$subscription['actions'][ $key ]['primary'] = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Break the by-ref.
|
||||
|
@ -169,9 +245,52 @@ class WC_Helper {
|
|||
continue;
|
||||
}
|
||||
|
||||
$data['_product_url'] = '#';
|
||||
$data['_has_update'] = false;
|
||||
|
||||
if ( ! empty( $updates[ $data['_product_id'] ] ) ) {
|
||||
$data['_has_update'] = version_compare( $updates[ $data['_product_id'] ]['version'], $data['Version'], '>' );
|
||||
|
||||
if ( ! empty( $updates[ $data['_product_id'] ]['url'] ) ) {
|
||||
$data['_product_url'] = $updates[ $data['_product_id'] ]['url'];
|
||||
} elseif ( ! empty( $data['PluginURI'] ) ) {
|
||||
$data['_product_url'] = $data['PluginURI'];
|
||||
}
|
||||
}
|
||||
|
||||
$data['_actions'] = array();
|
||||
|
||||
if ( $data['_has_update'] ) {
|
||||
$action = array(
|
||||
'message' => sprintf( __( 'Version %s is <strong>available</strong>. To enable this update you need to <strong>purchase</strong> a new subscription.', 'woocommerce' ), esc_html( $updates[ $data['_product_id'] ]['version'] ) ),
|
||||
'button_label' => __( 'Purchase', 'woocommerce' ),
|
||||
'button_url' => $data['_product_url'],
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$data['_actions'][] = $action;
|
||||
} else {
|
||||
$action = array(
|
||||
'message' => __( 'To receive updates and support for this extension, you need to <strong>purchase</strong> a new subscription.', 'woocommerce' ),
|
||||
'button_label' => __( 'Purchase', 'woocommerce' ),
|
||||
'button_url' => $data['_product_url'],
|
||||
'status' => 'expired',
|
||||
'icon' => 'dashicons-info',
|
||||
);
|
||||
|
||||
$data['_actions'][] = $action;
|
||||
}
|
||||
|
||||
$no_subscriptions[ $filename ] = $data;
|
||||
}
|
||||
|
||||
// Update the user id if it came from a migrated connection.
|
||||
if ( empty( $auth['user_id'] ) ) {
|
||||
$auth['user_id'] = get_current_user_id();
|
||||
WC_Helper_Options::update( 'auth', $auth );
|
||||
}
|
||||
|
||||
// We have an active connection.
|
||||
include( self::get_view_filename( 'html-main.php' ) );
|
||||
return;
|
||||
|
@ -449,6 +568,12 @@ class WC_Helper {
|
|||
|
||||
self::_flush_subscriptions_cache();
|
||||
|
||||
// Enable tracking when connected.
|
||||
if ( class_exists( 'WC_Tracker' ) ) {
|
||||
update_option( 'woocommerce_allow_tracking', 'yes' );
|
||||
WC_Tracker::send_tracking_data( true );
|
||||
}
|
||||
|
||||
wp_safe_redirect( add_query_arg( array(
|
||||
'page' => 'wc-addons',
|
||||
'section' => 'helper',
|
||||
|
@ -482,6 +607,9 @@ class WC_Helper {
|
|||
self::_flush_subscriptions_cache();
|
||||
self::_flush_updates_cache();
|
||||
|
||||
// Disable tracking when disconnected.
|
||||
update_option( 'woocommerce_allow_tracking', 'no' );
|
||||
|
||||
wp_safe_redirect( $redirect_uri );
|
||||
die();
|
||||
}
|
||||
|
@ -1033,8 +1161,10 @@ class WC_Helper {
|
|||
|
||||
/**
|
||||
* Flush auth cache.
|
||||
*
|
||||
* @access private
|
||||
*/
|
||||
private static function _flush_authentication_cache() {
|
||||
public static function _flush_authentication_cache() {
|
||||
$request = WC_Helper_API::get( 'oauth/me', array(
|
||||
'authenticated' => true,
|
||||
) );
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?php defined( 'ABSPATH' ) or exit(); ?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1><?php _e( 'Looking for the WooCommerce Helper?', 'woocommerce' ); ?></h1>
|
||||
<p><?php printf( __( 'We\'ve made things simpler and easier to manage moving forward. From now on you can manage all your WooCommerce purchases directly from the Extensions menu within the WooCommerce plugin itself. <a href="%s">View and manage</a> your extensions now.', 'woocommerce' ), esc_url( $helper_url ) ); ?></p>
|
||||
</div>
|
|
@ -5,47 +5,19 @@
|
|||
<h1 class="screen-reader-text"><?php _e( 'WooCommerce Extensions', 'woocommerce' ); ?></h1>
|
||||
|
||||
<?php include( WC_Helper::get_view_filename( 'html-section-notices.php' ) ); ?>
|
||||
<?php include( WC_Helper::get_view_filename( 'html-section-account.php' ) ); ?>
|
||||
|
||||
<h2><?php _e( 'Subscriptions', 'woocommerce' ); ?></h2>
|
||||
<p><?php _e( 'Below is a list of products available on your WooCommerce.com account. To receive plugin updates please make sure the product is installed, activated and connected to your WooCommerce.com account.', 'woocommerce' ); ?></p>
|
||||
<div class="subscriptions-header">
|
||||
<h2><?php _e( 'Subscriptions', 'woocommerce' ); ?></h2>
|
||||
<?php include( WC_Helper::get_view_filename( 'html-section-account.php' ) ); ?>
|
||||
<p><?php _e( 'Below is a list of products available on your WooCommerce.com account. To receive plugin updates please make sure the product is installed, activated and connected to your WooCommerce.com account.', 'woocommerce' ); ?></p>
|
||||
</div>
|
||||
|
||||
<table class="wp-list-table widefat fixed striped">
|
||||
<?php if ( ! empty( $subscriptions ) ) : ?>
|
||||
<?php foreach ( $subscriptions as $subscription ) : ?>
|
||||
<?php
|
||||
$installed = ! empty( $subscription['local']['installed'] );
|
||||
$connected = $subscription['active'];
|
||||
$product_id = $subscription['product_id'];
|
||||
$update_available = false;
|
||||
|
||||
if ( $installed && ! empty( $updates[ $product_id ] ) &&
|
||||
version_compare( $updates[ $product_id ]['version'], $subscription['local']['version'], '>' ) ) {
|
||||
$update_available = true;
|
||||
}
|
||||
|
||||
$download_url = $subscription['product_url'];
|
||||
if ( ! $installed && ! empty( $updates[ $product_id ]['package'] ) ) {
|
||||
$download_url = $updates[ $product_id ]['package'];
|
||||
}
|
||||
|
||||
$classes = array(
|
||||
'color-bar' => true,
|
||||
'expired' => $subscription['expired'],
|
||||
'expiring' => $subscription['expiring'],
|
||||
'update-available' => $update_available,
|
||||
'autorenews' => $subscription['autorenew'],
|
||||
);
|
||||
|
||||
$classes = array_filter( $classes, function( $i ) {
|
||||
return (bool) $i;
|
||||
} );
|
||||
|
||||
$classes = array_keys( $classes );
|
||||
?>
|
||||
<tbody>
|
||||
<tr class="wp-list-table__row is-ext-header">
|
||||
<td class="wp-list-table__ext-details <?php echo implode( ' ', $classes ); ?>">
|
||||
<td class="wp-list-table__ext-details">
|
||||
<div class="wp-list-table__ext-title">
|
||||
<a href="<?php echo esc_url( $subscription['product_url'] ); ?>" target="_blank"><?php
|
||||
echo esc_html( $subscription['product_name'] ); ?></a>
|
||||
|
@ -88,9 +60,11 @@
|
|||
</div>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<?php if ( ! $installed && ! $subscription['expired'] ) : ?>
|
||||
<a class="button" href="<?php echo esc_url( $download_url ); ?>" target="_blank"><?php _e( 'Download', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( $connected ) : ?>
|
||||
<?php if ( ! $subscription['active'] && $subscription['maxed'] ) : ?>
|
||||
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php _e( 'Upgrade', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( ! $subscription['local']['installed'] && ! $subscription['expired'] ) : ?>
|
||||
<a class="button" href="<?php echo esc_url( $subscription['download_url'] ); ?>" target="_blank"><?php _e( 'Download', 'woocommerce' ); ?></a>
|
||||
<?php elseif ( $subscription['active'] ) : ?>
|
||||
<span class="form-toggle__wrapper">
|
||||
<a href="<?php echo esc_url( $subscription['deactivate_url'] ); ?>" class="form-toggle active is-compact" role="link" aria-checked="true"><?php _e( 'Active', 'woocommerce' ); ?></a>
|
||||
<label class="form-toggle__label" for="activate-extension">
|
||||
|
@ -117,73 +91,26 @@
|
|||
<span class="form-toggle__label-content">
|
||||
<label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
|
||||
</span>
|
||||
<span class="form-toggle__switch"></span>
|
||||
</label>
|
||||
</span>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( $update_available && ! $subscription['expired'] ) : ?>
|
||||
<?php foreach ( $subscription['actions'] as $action ) : ?>
|
||||
<tr class="wp-list-table__row wp-list-table__ext-updates">
|
||||
<td class="wp-list-table__ext-status update-available">
|
||||
<p><span class="dashicons dashicons-update"></span>
|
||||
<?php /* translators: %s: version number */ ?>
|
||||
<?php printf( __( 'Version %s is <strong>available</strong>.', 'woocommerce' ), esc_html( $updates[ $product_id ]['version'] ) ); ?>
|
||||
<?php if ( ! $connected ) : ?>
|
||||
<?php _e( 'To enable this update you need to <strong>activate</strong> this subscription.', 'woocommerce' ); ?>
|
||||
<?php endif; ?>
|
||||
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
|
||||
<p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
|
||||
<?php echo $action['message']; ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<?php if ( $connected ) : ?>
|
||||
<a class="button" href="<?php echo esc_url( $subscription['update_url'] ); ?>"><?php _e( 'Update', 'woocommerce' ); ?></a>
|
||||
<!-- TODO: Activate & Update -->
|
||||
<?php if ( $action['button_label'] && $action['button_url'] ) : ?>
|
||||
<a class="button <?php if ( empty( $action['primary'] ) ) : ?>button-secondary<?php endif; ?>" href="<?php echo esc_url( $action['button_url'] ); ?>"><?php echo esc_html( $action['button_label'] ); ?></a>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $update_available && $subscription['expired'] ) : ?>
|
||||
<tr class="wp-list-table__row wp-list-table__ext-updates">
|
||||
<td class="wp-list-table__ext-status expired">
|
||||
<p><span class="dashicons dashicons-info"></span>
|
||||
<?php /* translators: %s: version number */ ?>
|
||||
<?php printf( __( 'Version %s is <strong>available</strong>.', 'woocommerce' ), esc_html( $updates[ $product_id ]['version'] ) ); ?>
|
||||
<?php _e( 'To enable this update you need to <strong>purchase</strong> a new subscription.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<a class="button" href="<?php echo esc_url( $subscription['product_url'] ); ?>" target="_blank"><?php _e( 'Purchase', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( $subscription['expiring'] && ! $subscription['autorenew'] ) : ?>
|
||||
<tr class="wp-list-table__row wp-list-table__ext-updates">
|
||||
<td class="wp-list-table__ext-status expired">
|
||||
<p><span class="dashicons dashicons-info"></span>
|
||||
<?php _e( 'Subscription is <strong>expiring</strong> soon.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php _e( 'Enable auto-renew', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! $connected && $subscription['sites_max'] > 0 && $subscription['sites_active'] >= $subscription['sites_max'] ) : ?>
|
||||
<tr class="wp-list-table__row wp-list-table__ext-updates">
|
||||
<td class="wp-list-table__ext-status expired">
|
||||
<p><span class="dashicons dashicons-info"></span>
|
||||
<?php _e( 'You are already using the <strong>maximum number of sites available</strong> with your current subscription.', 'woocommerce' ); ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<a class="button" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><?php _e( 'Upgrade', 'woocommerce' ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
<?php endforeach; ?>
|
||||
|
@ -202,27 +129,11 @@
|
|||
<table class="wp-list-table widefat fixed striped">
|
||||
<?php /* Extensions without a subscription. */ ?>
|
||||
<?php foreach ( $no_subscriptions as $filename => $data ) : ?>
|
||||
<?php
|
||||
$product_id = $data['_product_id'];
|
||||
$update_available = false;
|
||||
|
||||
if ( ! empty( $updates[ $product_id ] ) &&
|
||||
version_compare( $updates[ $product_id ]['version'], $data['Version'], '>' ) ) {
|
||||
$update_available = true;
|
||||
}
|
||||
|
||||
$product_url = '#';
|
||||
if ( ! empty( $updates[ $product_id ]['url'] ) ) {
|
||||
$product_url = $updates[ $product_id ]['url'];
|
||||
} elseif ( ! empty( $data['PluginURI'] ) ) {
|
||||
$product_url = $data['PluginURI'];
|
||||
}
|
||||
?>
|
||||
<tbody>
|
||||
<tr class="wp-list-table__row is-ext-header">
|
||||
<td class="wp-list-table__ext-details color-bar autorenews">
|
||||
<div class="wp-list-table__ext-title">
|
||||
<a href="<?php echo esc_url( $product_url ); ?>" target="_blank"><?php echo esc_html( $data['Name'] ); ?></a>
|
||||
<a href="<?php echo esc_url( $data['_product_url'] ); ?>" target="_blank"><?php echo esc_html( $data['Name'] ); ?></a>
|
||||
</div>
|
||||
<div class="wp-list-table__ext-description">
|
||||
</div>
|
||||
|
@ -234,24 +145,23 @@
|
|||
<span class="form-toggle__label-content">
|
||||
<label for="activate-extension"><?php _e( 'Inactive', 'woocommerce' ); ?></label>
|
||||
</span>
|
||||
<span class="form-toggle__switch"></span>
|
||||
</label>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<?php if ( $update_available ) : ?>
|
||||
<?php foreach ( $data['_actions'] as $action ) : ?>
|
||||
<tr class="wp-list-table__row wp-list-table__ext-updates">
|
||||
<td class="wp-list-table__ext-status update-available">
|
||||
<p><span class="dashicons dashicons-update"></span>
|
||||
<?php printf( __( 'Version %s is available. To enable this update you need to <strong>purchase</strong> a new subscription.', 'woocommerce' ), esc_html( $updates[ $product_id ]['version'] ) ); ?>
|
||||
<td class="wp-list-table__ext-status <?php echo sanitize_html_class( $action['status'] ); ?>">
|
||||
<p><span class="dashicons <?php echo sanitize_html_class( $action['icon'] ); ?>"></span>
|
||||
<?php echo $action['message']; ?>
|
||||
</p>
|
||||
</td>
|
||||
<td class="wp-list-table__ext-actions">
|
||||
<a class="button" href="<?php echo esc_url( $product_url ); ?>" target="_blank"><?php _e( 'Purchase', 'woocommerce' ); ?></a>
|
||||
<a class="button" href="<?php echo esc_url( $action['button_url'] ); ?>" target="_blank"><?php echo esc_html( $action['button_label'] ); ?></a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</tbody>
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
<p><?php _e( '<strong>Sorry to see you go</strong>. Feel free to reconnect again using the button below.', 'woocommerce' ); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<h2><?php _e( 'Connect your store to your WooCommerce.com account, and manage your purchases directly from your personal site', 'woocommerce' ); ?></h2>
|
||||
<p><?php _e( 'When you connect your account, your purchases will automatically be listed on your site. You can disconnect the account at anytime. Once your connected, you will receive the updates & support that come with your subscription. ', 'woocommerce' ); ?></p>
|
||||
<h2><?php _e( 'Connect a WooCommerce.com account to manage subscriptions and updates from the convenience of your WooCommerce dashboard', 'woocommerce' ); ?></h2>
|
||||
<p><?php _e( 'Once connected, WooCommerce.com purchases will be listed automatically within your WooCommerce dashboard. Manage subscriptions and get important notifications, updates, and support more easily – and disconnect at any time.', 'woocommerce' ); ?></p>
|
||||
<p><a class="button-primary" href="<?php echo esc_url( $connect_url ); ?>"><?php _e( 'Connect your store', 'woocommerce' ); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<?php defined( 'ABSPATH' ) or exit(); ?>
|
||||
|
||||
<div class="connect-wrapper">
|
||||
<div class="connected active">
|
||||
<div class="user-info">
|
||||
<?php echo get_avatar( $auth_user_data['email'], 100 ); ?>
|
||||
<p><?php printf( __( 'Connected to: <strong>%s</strong>', 'woocommerce' ), esc_html( $auth_user_data['email'] ) ); ?></p>
|
||||
<span class="chevron dashicons dashicons-arrow-up-alt2"></span>
|
||||
<a class="button button-update" href="<?php echo esc_url( $refresh_url ); ?>"><span class="dashicons dashicons-image-rotate"></span> <?php _e( 'Update', 'woocommerce' ); ?></a>
|
||||
<div class="user-info">
|
||||
<header>
|
||||
<p><?php printf( __( 'Connected to WooCommerce.com', 'woocommerce' ) ); ?> <span class="chevron dashicons dashicons-arrow-down-alt2"></span></p>
|
||||
</header>
|
||||
<section>
|
||||
<p><?php echo get_avatar( $auth_user_data['email'], 48 ); ?> <?php echo esc_html( $auth_user_data['email'] ); ?></p>
|
||||
<div class="actions">
|
||||
<a class="" href="https://woocommerce.com/my-account/my-subscriptions/" target="_blank"><span class="dashicons dashicons-admin-generic"></span> <?php _e( 'My Subscriptions', 'woocommerce' ); ?></a>
|
||||
<a class="" href="<?php echo esc_url( $disconnect_url ); ?>"><span class="dashicons dashicons-no"></span> <?php _e( 'Disconnect', 'woocommerce' ); ?></a>
|
||||
</div>
|
||||
<div class="buttons active">
|
||||
<a class="button button-secondary" href="<?php echo esc_url( $disconnect_url ); ?>">Disconnect</a>
|
||||
<a class="button" href="<?php echo esc_url( $refresh_url ); ?>">Refresh</a>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue