Initial commit: Atomaste website

This commit is contained in:
2025-12-10 12:17:30 -05:00
commit 0b9e5d1605
19260 changed files with 5206382 additions and 0 deletions

View File

@@ -0,0 +1,266 @@
.astra-sites-welcome .astra-notice-container {
display: flex;
flex-direction: column;
align-items: flex-start;
padding-top: 0;
padding-bottom: 0;
}
.astra-sites-welcome .astra-notice-container .notice-welcome-container {
background-image: url( "../images/st-banner-background.svg" );
justify-content: left;
overflow: hidden;
position: relative;
background-size: contain;
background-repeat: no-repeat;
background-position: left top;
display: flex;
flex-flow: row;
width: 100%;
}
.astra-sites-welcome .astra-notice-container .notice-welcome-container::after {
padding: 2.5%;
content: "";
display: block;
}
.astra-sites-welcome .text-section {
flex: 0 0 51%;
display: flex;
flex-direction: column;
justify-content: center;
padding: 40px 40px 40px 0;
}
.astra-sites-welcome .showcase-section {
flex: 0 0 45%;
display: flex;
align-items: flex-end;
margin-top: 40px;
}
.astra-sites-welcome .showcase-section img {
width: 100%;
}
.astra-sites-welcome h1.text-heading {
font-style: normal;
font-weight: 600;
font-size: 30px;
line-height: 36px;
color: #0f172a;
padding: 24px 0px 12px 0px;
}
.astra-sites-welcome .logo-section {
display: flex;
align-items: center;
gap: 8px;
}
.astra-sites-welcome .logo-section img {
width: 24px;
}
.astra-sites-welcome .logo-section h3 {
padding: 0;
margin: 0;
font-size: 20px;
font-weight: 600;
line-height: 30px;
text-align: right;
color: #030712;
}
.astra-sites-welcome .button-section {
display: flex;
flex-direction: column;
gap: 16px;
}
.astra-sites-welcome a.text-button {
font-weight: 500;
font-size: 16px;
line-height: 24px;
color: #ffffff;
text-decoration: none;
padding: 10px 16px;
max-width: fit-content;
border-radius: 6px;
background: #2271b1;
box-shadow: 0px 1px 2px 0px rgba( 0, 0, 0, 0.05 );
}
.astra-sites-welcome a.scratch-link {
color: #475569;
font-size: 13px;
font-weight: 400;
display: inline-block;
width: fit-content;
line-height: 20px;
}
.astra-sites-welcome .notice-content-container .content-section {
display: flex;
padding: 20px 16px;
flex-direction: column;
align-items: flex-start;
gap: 8px;
flex: 1 0 0;
border-radius: 6px;
}
.astra-sites-welcome .notice-content-container .content-section:hover {
border-radius: 6px;
background: var( --Colors-base-white, #fff );
box-shadow: 0px 8px 22px 0px rgba( 0, 0, 0, 0.08 );
}
.astra-sites-welcome .notice-content-container {
display: flex;
padding: 32px 60px;
align-items: flex-start;
gap: 32px;
align-self: stretch;
}
.astra-sites-welcome .notice-content-container .icon-section {
border-radius: 24px;
display: flex;
align-items: flex-start;
gap: 8px;
}
.astra-sites-welcome .notice-content-container .link-section h4 {
margin: 0;
color: var( --gray-900, #111827 );
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 28px;
}
.astra-sites-welcome .notice-content-container .link-section p {
margin-bottom: 8px;
padding: 0;
color: var( --gray-500, #6b7280 );
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
margin-top: 0px;
}
.astra-sites-welcome .text-section p {
color: var( --Theme-Body, #475569 );
font-size: 16px;
font-weight: 400;
line-height: 28px;
}
.astra-sites-welcome .text-section p {
margin-bottom: 24px;
margin-top: 0;
}
.astra-sites-welcome.notice.is-dismissible {
padding-left: 0;
}
.astra-sites-welcome.notice {
padding: 0;
border-right-width: 0;
border: none;
}
.astra-sites-welcome .notice-dismiss:before {
background-image: url( ../images/cross.svg );
content: "";
position: relative;
background-size: 10px;
background-repeat: no-repeat;
background-position: center top;
}
.astra-sites-welcome .notice-dismiss {
top: 3px;
left: 3px;
margin: 0;
}
.astra-sites-welcome .link-section .link-text {
display: flex;
text-decoration: none;
gap: 8px;
border-radius: 4px;
color: #5d5e61;
font-size: 12px;
font-style: normal;
font-weight: 600;
line-height: 16px;
}
.astra-sites-welcome .content-section {
text-decoration: none;
}
@media only screen and ( min-width: 1024px ) and ( max-width: 1280px ) {
.astra-sites-welcome .notice-content-container .link-section h4 {
font-size: 14px;
}
.astra-sites-welcome .notice-content-container .link-section p {
font-size: 12px;
}
.astra-sites-welcome .link-section .link-text {
font-size: 10px;
}
}
@media only screen and ( min-width: 768px ) and ( max-width: 1024px ) {
.astra-sites-welcome .text-section {
flex: 0 0 75.5%;
padding-right: 28px;
padding-top: 38px;
padding-bottom: 38px;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}
@media only screen and ( max-width: 767px ) {
.astra-sites-welcome .text-section {
flex: 0 0 80.5%;
padding: 32px 32px 32px 0;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}
@media only screen and ( max-width: 420px ) {
.astra-sites-welcome .text-section {
flex: 0 0 86.5%;
text-align: center;
}
.astra-sites-welcome .button-section {
justify-content: center;
align-items: center;
}
.astra-sites-welcome .logo-section {
justify-content: center;
}
.astra-sites-welcome h1.text-heading {
font-size: 20px;
line-height: 24px;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}

View File

@@ -0,0 +1,266 @@
.astra-sites-welcome .astra-notice-container {
display: flex;
flex-direction: column;
align-items: flex-start;
padding-top: 0;
padding-bottom: 0;
}
.astra-sites-welcome .astra-notice-container .notice-welcome-container {
background-image: url( "../images/st-banner-background.svg" );
justify-content: left;
overflow: hidden;
position: relative;
background-size: contain;
background-repeat: no-repeat;
background-position: right top;
display: flex;
flex-flow: row;
width: 100%;
}
.astra-sites-welcome .astra-notice-container .notice-welcome-container::after {
padding: 2.5%;
content: "";
display: block;
}
.astra-sites-welcome .text-section {
flex: 0 0 51%;
display: flex;
flex-direction: column;
justify-content: center;
padding: 40px 0 40px 40px;
}
.astra-sites-welcome .showcase-section {
flex: 0 0 45%;
display: flex;
align-items: flex-end;
margin-top: 40px;
}
.astra-sites-welcome .showcase-section img {
width: 100%;
}
.astra-sites-welcome h1.text-heading {
font-style: normal;
font-weight: 600;
font-size: 30px;
line-height: 36px;
color: #0f172a;
padding: 24px 0px 12px 0px;
}
.astra-sites-welcome .logo-section {
display: flex;
align-items: center;
gap: 8px;
}
.astra-sites-welcome .logo-section img {
width: 24px;
}
.astra-sites-welcome .logo-section h3 {
padding: 0;
margin: 0;
font-size: 20px;
font-weight: 600;
line-height: 30px;
text-align: left;
color: #030712;
}
.astra-sites-welcome .button-section {
display: flex;
flex-direction: column;
gap: 16px;
}
.astra-sites-welcome a.text-button {
font-weight: 500;
font-size: 16px;
line-height: 24px;
color: #ffffff;
text-decoration: none;
padding: 10px 16px;
max-width: fit-content;
border-radius: 6px;
background: #2271b1;
box-shadow: 0px 1px 2px 0px rgba( 0, 0, 0, 0.05 );
}
.astra-sites-welcome a.scratch-link {
color: #475569;
font-size: 13px;
font-weight: 400;
display: inline-block;
width: fit-content;
line-height: 20px;
}
.astra-sites-welcome .notice-content-container .content-section {
display: flex;
padding: 20px 16px;
flex-direction: column;
align-items: flex-start;
gap: 8px;
flex: 1 0 0;
border-radius: 6px;
}
.astra-sites-welcome .notice-content-container .content-section:hover {
border-radius: 6px;
background: var( --Colors-base-white, #fff );
box-shadow: 0px 8px 22px 0px rgba( 0, 0, 0, 0.08 );
}
.astra-sites-welcome .notice-content-container {
display: flex;
padding: 32px 60px;
align-items: flex-start;
gap: 32px;
align-self: stretch;
}
.astra-sites-welcome .notice-content-container .icon-section {
border-radius: 24px;
display: flex;
align-items: flex-start;
gap: 8px;
}
.astra-sites-welcome .notice-content-container .link-section h4 {
margin: 0;
color: var( --gray-900, #111827 );
font-size: 16px;
font-style: normal;
font-weight: 500;
line-height: 28px;
}
.astra-sites-welcome .notice-content-container .link-section p {
margin-bottom: 8px;
padding: 0;
color: var( --gray-500, #6b7280 );
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: 20px;
margin-top: 0px;
}
.astra-sites-welcome .text-section p {
color: var( --Theme-Body, #475569 );
font-size: 16px;
font-weight: 400;
line-height: 28px;
}
.astra-sites-welcome .text-section p {
margin-bottom: 24px;
margin-top: 0;
}
.astra-sites-welcome.notice.is-dismissible {
padding-right: 0;
}
.astra-sites-welcome.notice {
padding: 0;
border-left-width: 0;
border: none;
}
.astra-sites-welcome .notice-dismiss:before {
background-image: url( ../images/cross.svg );
content: "";
position: relative;
background-size: 10px;
background-repeat: no-repeat;
background-position: center top;
}
.astra-sites-welcome .notice-dismiss {
top: 3px;
right: 3px;
margin: 0;
}
.astra-sites-welcome .link-section .link-text {
display: flex;
text-decoration: none;
gap: 8px;
border-radius: 4px;
color: #5d5e61;
font-size: 12px;
font-style: normal;
font-weight: 600;
line-height: 16px;
}
.astra-sites-welcome .content-section {
text-decoration: none;
}
@media only screen and ( min-width: 1024px ) and ( max-width: 1280px ) {
.astra-sites-welcome .notice-content-container .link-section h4 {
font-size: 14px;
}
.astra-sites-welcome .notice-content-container .link-section p {
font-size: 12px;
}
.astra-sites-welcome .link-section .link-text {
font-size: 10px;
}
}
@media only screen and ( min-width: 768px ) and ( max-width: 1024px ) {
.astra-sites-welcome .text-section {
flex: 0 0 75.5%;
padding-left: 28px;
padding-top: 38px;
padding-bottom: 38px;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}
@media only screen and ( max-width: 767px ) {
.astra-sites-welcome .text-section {
flex: 0 0 80.5%;
padding: 32px 0 32px 32px;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}
@media only screen and ( max-width: 420px ) {
.astra-sites-welcome .text-section {
flex: 0 0 86.5%;
text-align: center;
}
.astra-sites-welcome .button-section {
justify-content: center;
align-items: center;
}
.astra-sites-welcome .logo-section {
justify-content: center;
}
.astra-sites-welcome h1.text-heading {
font-size: 20px;
line-height: 24px;
}
.astra-sites-welcome .showcase-section img {
display: none;
}
.astra-sites-welcome .notice-content-container {
display: none;
}
}

View File

@@ -0,0 +1,283 @@
.dialog-widget-content {
background-color: #fff;
position: absolute;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: -2px 8px 23px 3px rgba( 0, 0, 0, 0.2 );
box-shadow: -2px 8px 23px 3px rgba( 0, 0, 0, 0.2 );
overflow: hidden;
}
.dialog-message {
font-size: 12px;
line-height: 1.5;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.dialog-type-lightbox {
position: fixed;
height: 100%;
width: 100%;
top: 0;
right: 0;
background-color: rgba( 0, 0, 0, 0.8 );
z-index: 9999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dialog-type-lightbox .dialog-widget-content {
margin: auto;
}
.dialog-type-lightbox .dialog-header {
font-size: 15px;
color: #495157;
padding: 30px 0 10px;
font-weight: 500;
}
.dialog-type-lightbox .dialog-message {
padding: 0 30px 30px;
min-height: 50px;
}
.dialog-type-lightbox:not( .elementor-popup-modal ) .dialog-header,
.dialog-type-lightbox:not( .elementor-popup-modal ) .dialog-message {
text-align: center;
}
.dialog-type-lightbox .dialog-buttons-wrapper {
border-top: 1px solid #e6e9ec;
text-align: center;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
width: 50%;
border: none;
background: none;
font-size: 15px;
cursor: pointer;
padding: 13px 0;
outline: 0;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:hover {
background-color: #f4f6f7;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-ok {
color: #b01b1b;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-take_over {
color: #39b54a;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:active {
background-color: rgba( 230, 233, 236, 0.5 );
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button::-moz-focus-inner {
border: 0;
}
.ast-sites-modal .dialog-widget-content {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
background-color: #f1f3f5;
width: 100%;
}
@media ( max-width: 1439px ) {
.ast-sites-modal .dialog-widget-content {
max-width: 990px;
}
}
@media ( min-width: 1440px ) {
.ast-sites-modal .dialog-widget-content {
max-width: 1200px;
}
}
.ast-sites-modal .dialog-header {
padding: 0;
background-color: #fff;
-webkit-box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
position: relative;
z-index: 1;
}
.ast-sites-modal .dialog-buttons-wrapper {
background-color: #fff;
border: none;
display: none;
-webkit-box-pack: end;
-webkit-justify-content: flex-end;
-ms-flex-pack: end;
justify-content: flex-end;
padding: 5px;
-webkit-box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
position: relative;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button {
height: 40px;
margin-right: 5px;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
padding: 12px 36px;
color: #fff;
width: initial;
font-size: 15px;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
background-color: #39b54a;
}
.ast-sites-modal .dialog-message {
height: 750px;
max-height: 85vh;
overflow: auto;
padding-top: 25px;
}
.ast-sites-modal .dialog-content {
height: 100%;
}
.ast-sites-modal .dialog-loading {
display: none;
}
.ast-sites-modal__header {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
height: 50px;
}
.ast-sites-modal__header__logo {
line-height: 1;
text-transform: uppercase;
font-weight: bold;
cursor: pointer;
}
.ast-sites-modal__header__logo-area {
text-align: right;
padding-right: 15px;
}
.ast-sites-modal__header__logo-area > * {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.ast-sites-modal__header__logo__icon-wrapper {
padding: 4px 7px 6px;
background-image: -webkit-linear-gradient( -225deg, #f2295b, #434363 );
background-image: -o-linear-gradient( -225deg, #f2295b, #434363 );
background-image: linear-gradient( 135deg, #f2295b, #434363 );
-webkit-border-radius: 2px;
border-radius: 2px;
margin-left: 10px;
}
.ast-sites-modal__header__logo__title {
padding-top: 2px;
}
.ast-sites-modal__header__logo i {
color: #fff;
font-size: 10px;
}
.ast-sites-modal__header__items-area {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-webkit-flex-direction: row-reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.ast-sites-modal__header__item {
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.ast-sites-modal__header__item > i {
font-size: 20px;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
cursor: pointer;
}
.ast-sites-modal__header__item > i:not( :hover ) {
color: #a4afb7;
}
.ast-sites-modal__header__close--normal {
width: 45px;
border-right: 1px solid #e6e9ec;
}
.ast-sites-modal__header__close--normal i {
font-size: 18px;
}
.ast-sites-modal__header__close--skip {
padding: 10px;
padding-right: 20px;
margin-left: 10px;
color: #fff;
background-color: #a4afb7;
font-size: 11px;
font-weight: normal;
line-height: 1;
text-transform: uppercase;
-webkit-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
}
.ast-sites-modal__header__close--skip > i {
font-size: inherit;
padding-right: 10px;
margin-right: 15px;
border-right: 1px solid;
}
.ast-sites-modal__header__close--skip > i:not( :hover ) {
color: #fff;
}
.ast-sites-modal__sidebar {
width: 25%;
background-color: rgba( 255, 255, 255, 0.3 );
}
.ast-sites-modal__content {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-webkit-box-shadow: 0 0 13px inset rgba( 0, 0, 0, 0.05 );
box-shadow: 0 0 13px inset rgba( 0, 0, 0, 0.05 );
}

View File

@@ -0,0 +1,283 @@
.dialog-widget-content {
background-color: #fff;
position: absolute;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 2px 8px 23px 3px rgba( 0, 0, 0, 0.2 );
box-shadow: 2px 8px 23px 3px rgba( 0, 0, 0, 0.2 );
overflow: hidden;
}
.dialog-message {
font-size: 12px;
line-height: 1.5;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.dialog-type-lightbox {
position: fixed;
height: 100%;
width: 100%;
top: 0;
left: 0;
background-color: rgba( 0, 0, 0, 0.8 );
z-index: 9999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.dialog-type-lightbox .dialog-widget-content {
margin: auto;
}
.dialog-type-lightbox .dialog-header {
font-size: 15px;
color: #495157;
padding: 30px 0 10px;
font-weight: 500;
}
.dialog-type-lightbox .dialog-message {
padding: 0 30px 30px;
min-height: 50px;
}
.dialog-type-lightbox:not( .elementor-popup-modal ) .dialog-header,
.dialog-type-lightbox:not( .elementor-popup-modal ) .dialog-message {
text-align: center;
}
.dialog-type-lightbox .dialog-buttons-wrapper {
border-top: 1px solid #e6e9ec;
text-align: center;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
width: 50%;
border: none;
background: none;
font-size: 15px;
cursor: pointer;
padding: 13px 0;
outline: 0;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:hover {
background-color: #f4f6f7;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-ok {
color: #b01b1b;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button.dialog-take_over {
color: #39b54a;
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button:active {
background-color: rgba( 230, 233, 236, 0.5 );
}
.dialog-type-lightbox .dialog-buttons-wrapper > .dialog-button::-moz-focus-inner {
border: 0;
}
.ast-sites-modal .dialog-widget-content {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
background-color: #f1f3f5;
width: 100%;
}
@media ( max-width: 1439px ) {
.ast-sites-modal .dialog-widget-content {
max-width: 990px;
}
}
@media ( min-width: 1440px ) {
.ast-sites-modal .dialog-widget-content {
max-width: 1200px;
}
}
.ast-sites-modal .dialog-header {
padding: 0;
background-color: #fff;
-webkit-box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
position: relative;
z-index: 1;
}
.ast-sites-modal .dialog-buttons-wrapper {
background-color: #fff;
border: none;
display: none;
-webkit-box-pack: end;
-webkit-justify-content: flex-end;
-ms-flex-pack: end;
justify-content: flex-end;
padding: 5px;
-webkit-box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
position: relative;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button {
height: 40px;
margin-left: 5px;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button-success {
padding: 12px 36px;
color: #fff;
width: initial;
font-size: 15px;
}
.ast-sites-modal .dialog-buttons-wrapper .elementor-button-success:hover {
background-color: #39b54a;
}
.ast-sites-modal .dialog-message {
height: 750px;
max-height: 85vh;
overflow: auto;
padding-top: 25px;
}
.ast-sites-modal .dialog-content {
height: 100%;
}
.ast-sites-modal .dialog-loading {
display: none;
}
.ast-sites-modal__header {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
height: 50px;
}
.ast-sites-modal__header__logo {
line-height: 1;
text-transform: uppercase;
font-weight: bold;
cursor: pointer;
}
.ast-sites-modal__header__logo-area {
text-align: left;
padding-left: 15px;
}
.ast-sites-modal__header__logo-area > * {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
}
.ast-sites-modal__header__logo__icon-wrapper {
padding: 4px 7px 6px;
background-image: -webkit-linear-gradient( 225deg, #f2295b, #434363 );
background-image: -o-linear-gradient( 225deg, #f2295b, #434363 );
background-image: linear-gradient( -135deg, #f2295b, #434363 );
-webkit-border-radius: 2px;
border-radius: 2px;
margin-right: 10px;
}
.ast-sites-modal__header__logo__title {
padding-top: 2px;
}
.ast-sites-modal__header__logo i {
color: #fff;
font-size: 10px;
}
.ast-sites-modal__header__items-area {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: reverse;
-webkit-flex-direction: row-reverse;
-ms-flex-direction: row-reverse;
flex-direction: row-reverse;
}
.ast-sites-modal__header__item {
position: relative;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
-webkit-box-sizing: content-box;
box-sizing: content-box;
}
.ast-sites-modal__header__item > i {
font-size: 20px;
-webkit-transition: all 0.3s;
-o-transition: all 0.3s;
transition: all 0.3s;
cursor: pointer;
}
.ast-sites-modal__header__item > i:not( :hover ) {
color: #a4afb7;
}
.ast-sites-modal__header__close--normal {
width: 45px;
border-left: 1px solid #e6e9ec;
}
.ast-sites-modal__header__close--normal i {
font-size: 18px;
}
.ast-sites-modal__header__close--skip {
padding: 10px;
padding-left: 20px;
margin-right: 10px;
color: #fff;
background-color: #a4afb7;
font-size: 11px;
font-weight: normal;
line-height: 1;
text-transform: uppercase;
-webkit-border-radius: 2px;
border-radius: 2px;
cursor: pointer;
}
.ast-sites-modal__header__close--skip > i {
font-size: inherit;
padding-left: 10px;
margin-left: 15px;
border-left: 1px solid;
}
.ast-sites-modal__header__close--skip > i:not( :hover ) {
color: #fff;
}
.ast-sites-modal__sidebar {
width: 25%;
background-color: rgba( 255, 255, 255, 0.3 );
}
.ast-sites-modal__content {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
-ms-flex-positive: 1;
flex-grow: 1;
-webkit-box-shadow: 0 0 13px inset rgba( 0, 0, 0, 0.05 );
box-shadow: 0 0 13px inset rgba( 0, 0, 0, 0.05 );
}

View File

@@ -0,0 +1,130 @@
.ast-sites-dark-mode {
--dark-mode-background-color: #1f2124;
--dark-mode-background-hover-color: #2b2c31;
--dark-mode-border-color: #3f444b;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template-inner,
.ast-sites-dark-mode #ast-sites-modal .inner,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template:not( .elementor-template-library-template-page ) .elementor-template-library-template-footer,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap:hover span,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal:hover i,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout:hover i {
color: #ffffff;
}
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
border-color: var( --dark-mode-border-color );
}
.ast-sites-dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #e0e1e3 transparent transparent transparent;
}
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar {
background-color: #34383c;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
background-color: #7d7e82;
}
.ast-sites-dark-mode .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #e0e1e3 transparent;
}
.ast-sites-dark-mode #ast-sites-modal .ast-sites-floating-notice-wrap {
background: #404349;
}
.ast-sites-dark-mode #ast-sites-modal .notice-dismiss:before {
color: #e0e1e3;
}
.ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-sync-library-button span,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__item > i:not( :hover ),
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input,
.ast-sites-dark-mode.astra-sites__elementor-open #ast-sites-modal .select2-container--default .select2-selection__rendered,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites h3,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
color: #e0e1e3;
}
.ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites .inner {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .dialog-header {
border-block-end: 1px solid #333438;
}
.ast-sites-dark-mode #ast-sites-modal.dialog-type-lightbox .dialog-header {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap::before {
border: 8px solid #7d7e82;
border-bottom-style: solid;
border-right-color: transparent;
border-left-color: transparent;
border-top: none;
}
.ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap {
background: #7d7e82;
}
.ast-sites-dark-mode #ast-sites-modal #wp-filter-search-input {
border-color: #d5dadf;
border-block-end: 1px solid var( --dark-mode-border-color );
}
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__logo,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
border-left: 1px solid #32363a;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
border-right: 1px solid #32363a;
}
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
background-image: none;
border-color: #fff;
color: #fff;
}
#ast-sites-modal .inner {
border: 1px solid var( --dark-mode-border-color );
}
.ast-sites-dark-mode #ast-sites-modal .inner:hover {
background: var( --dark-mode-background-hover-color );
}
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter {
background: none;
}
.ast-sites-dark-mode .astra-blocks-filter option {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode .astra-blocks-filter option:hover {
background: var( --dark-mode-background-hover-color );
color: var( --dark-mode-border-color );
}

View File

@@ -0,0 +1,130 @@
.ast-sites-dark-mode {
--dark-mode-background-color: #1f2124;
--dark-mode-background-hover-color: #2b2c31;
--dark-mode-border-color: #3f444b;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template-inner,
.ast-sites-dark-mode #ast-sites-modal .inner,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-library-template:not( .elementor-template-library-template-page ) .elementor-template-library-template-footer,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap:hover span,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal:hover i,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout:hover i {
color: #ffffff;
}
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input {
border-color: var( --dark-mode-border-color );
}
.ast-sites-dark-mode .select2-container--default .select2-selection--single .select2-selection__arrow b {
border-color: #e0e1e3 transparent transparent transparent;
}
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar,
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar {
background-color: #34383c;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites-content-wrap::-webkit-scrollbar-thumb,
.ast-sites-dark-mode #ast-sites-modal .single-site-pages::-webkit-scrollbar-thumb {
background-color: #7d7e82;
}
.ast-sites-dark-mode .select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
border-color: transparent transparent #e0e1e3 transparent;
}
.ast-sites-dark-mode #ast-sites-modal .ast-sites-floating-notice-wrap {
background: #404349;
}
.ast-sites-dark-mode #ast-sites-modal .notice-dismiss:before {
color: #e0e1e3;
}
.ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-sync-library-button span,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__item > i:not( :hover ),
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter,
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-order-input,
.ast-sites-dark-mode.astra-sites__elementor-open #ast-sites-modal .select2-container--default .select2-selection__rendered,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites h3,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip .dashicons-editor-help {
color: #e0e1e3;
}
.ast-sites-dark-mode #ast-sites-modal .dialog-widget-content,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-no-sites .inner {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .dialog-header {
border-block-end: 1px solid #333438;
}
.ast-sites-dark-mode #ast-sites-modal.dialog-type-lightbox .dialog-header {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap::before {
border: 8px solid #7d7e82;
border-bottom-style: solid;
border-left-color: transparent;
border-right-color: transparent;
border-top: none;
}
.ast-sites-dark-mode #ast-sites-modal .ast-tooltip-wrap {
background: #7d7e82;
}
.ast-sites-dark-mode #ast-sites-modal #wp-filter-search-input {
border-color: #d5dadf;
border-block-end: 1px solid var( --dark-mode-border-color );
}
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__logo,
.ast-sites-dark-mode #ast-sites-modal .back-to-layout,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
border-right: 1px solid #32363a;
}
.ast-sites-dark-mode #ast-sites-modal .astra-sites__sync-wrap,
.ast-sites-dark-mode #ast-sites-modal .ast-sites-modal__header__close--normal,
.ast-sites-dark-mode #ast-sites-modal .astra-sites-tooltip {
border-left: 1px solid #32363a;
}
.ast-sites-dark-mode #ast-sites-modal .elementor-template-library-menu-item.elementor-active {
background-image: none;
border-color: #fff;
color: #fff;
}
#ast-sites-modal .inner {
border: 1px solid var( --dark-mode-border-color );
}
.ast-sites-dark-mode #ast-sites-modal .inner:hover {
background: var( --dark-mode-background-hover-color );
}
.ast-sites-dark-mode #ast-sites-modal .astra-blocks-filter {
background: none;
}
.ast-sites-dark-mode .astra-blocks-filter option {
background-color: var( --dark-mode-background-color );
}
.ast-sites-dark-mode .astra-blocks-filter option:hover {
background: var( --dark-mode-background-hover-color );
color: var( --dark-mode-border-color );
}

View File

@@ -0,0 +1,630 @@
@font-face {
font-family: "icomoon";
src: url( "../fonts/astra-sites.eot?9i8jex" );
src: url( "../fonts/astra-sites.eot?9i8jex#iefix" ) format( "embedded-opentype" ), url( "../fonts/astra-sites.ttf?9i8jex" ) format( "truetype" ), url( "../fonts/astra-sites.woff?9i8jex" ) format( "woff" ), url( "../fonts/astra-sites.svg?9i8jex#icomoon" ) format( "svg" );
font-weight: normal;
font-style: normal;
}
[class^="ast-icon-"],
[class*=" ast-icon-"] {
font-family: "icomoon" !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ast-icon-chevron-left:before {
content: "\e904";
}
.ast-icon-search:before {
content: "\e900";
}
.ast-attachments-browser .ast-image__search.has-input + .search-icon {
display: none;
}
.ast-attachments-browser .search-icon {
position: absolute;
top: 0;
left: 0;
color: #2b2b2b;
opacity: 0.3;
padding: 12px;
}
.ast-attachments-browser .ast-image__skeleton {
column-count: 5;
column-gap: 20px;
}
.ast-attachments-browser .ast-image__search-wrap {
position: relative;
display: inline-block;
margin-left: 1%;
}
.ast-attachments-browser input.ast-image__search {
line-height: 1.8em;
width: 620px;
height: 35px;
background: #fff;
border-color: #d5dadf;
}
.ast-attachments-browser .ast-image__list-wrap.loaded .ast-image__list-img-wrap {
opacity: 1;
}
.ast-attachments-browser .ast-image__list-wrap.loaded .imported.ast-image__list-inner-wrap:before {
display: block;
}
.fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay span,
.fl-builder-edit .media-modal .media-frame-content .ast-image__save {
color: #fff;
}
.fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay .ast-image__download-icon {
color: #767676;
}
.ast-attachments-browser .ast-image__list-img-overlay span {
position: absolute;
bottom: 0;
right: 0;
color: #fff;
padding: 10px;
font-size: 13px;
width: calc( 100% - 20px );
text-align: right;
text-transform: capitalize;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon {
margin: 10px;
padding: 5px 7px;
width: auto;
border-radius: 2px;
left: 0;
text-align: left;
font-size: 16px;
right: auto;
background: #fff;
color: #767676;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon:hover {
color: #111;
box-shadow: rgb( 0 0 0 / 30% ) 0px 4px 14px;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon.installing:before {
content: "\f463";
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
display: inline-block;
-webkit-animation: cssAnimation 2s linear infinite;
-moz-animation: cssAnimation 2s linear infinite;
-o-animation: cssAnimation 2s linear infinite;
-ms-animation: cssAnimation 2s linear infinite;
animation: cssAnimation 2s linear infinite;
}
.ast-attachments-browser .ast-image__list-img-wrap {
display: flex;
opacity: 0;
position: relative;
}
.ast-attachments-browser .ast-image__list-img-wrap:hover {
box-shadow: 0 3px 10px rgba( 0, 0, 0, 0.12 );
}
.ast-attachments-browser .ast-image__list-img-overlay {
position: absolute;
top: 0;
right: 0;
width: 100%;
height: 100%;
background: rgba( 0, 0, 0, 0.4 );
opacity: 0;
transition: opacity 0.5s, visibility 0s 0.5s;
cursor: pointer;
}
.ast-attachments-browser .ast-image__list-inner-wrap:hover .ast-image__list-img-overlay {
opacity: 1;
}
.ast-attachments-browser .ast-image__filter-wrap {
display: inline-block;
vertical-align: top;
}
.ast-powered-by-pixabay-wrap {
margin-left: 25px;
display: flex;
align-items: center;
float: left;
margin-top: 10px;
}
.ast-powered-by-pixabay-wrap > span {
font-size: 12px;
color: #50575e;
margin-left: 5px;
}
.ast-powered-by-pixabay-wrap > img {
height: 1.2em;
}
.ast-attachments-browser .ast-attachments-search-wrap {
padding: 10px 20px;
border-bottom: 1px solid #ddd;
display: block;
height: 36px;
align-items: center;
padding-left: 0px;
}
.ast-attachments-browser .ast-image__filter {
display: flex;
padding: 0;
margin: 0;
list-style-type: none;
align-items: center;
}
.ast-attachments-browser .ast-image__filter li {
padding: 0 8px;
margin: 0;
}
.ast-attachments-browser .ast-image__filter li:first-child {
padding-right: 0;
}
.ast-attachments-browser .ast-image__filter li select {
height: 35px;
width: auto;
}
.fl-builder .ast-attachments-browser .ast-image__filter li select {
padding: 0 10px;
}
.ast-attachments-browser .ast-image__skeleton-inner-wrap {
overflow-y: scroll;
height: inherit;
padding: 10px;
padding-bottom: 0;
height: inherit;
}
.ast-attachments-browser .button.ast-image__validate-btn {
height: 38px;
line-height: 37px;
padding: 0 15px 2px;
}
.ast-attachments-browser.preview-mode .ast-image__skeleton-inner-wrap {
overflow-y: auto;
}
.ast-attachments-browser .ast-image__list-wrap {
padding: 0;
margin: 0;
display: grid;
grid-template-rows: 1fr auto;
margin-bottom: 20px;
break-inside: avoid;
}
.ast-attachments-browser .ast-image__skeleton-wrap {
height: 100%;
}
.ast-attachments-browser .ast-image__list-inner-wrap img {
width: 100%;
height: auto;
}
.ast-attachments-browser .single-site-wrap {
display: flex;
}
.ast-attachments-browser .single-site {
width: 100%;
display: flex;
}
.ast-attachments-browser .single-site-preview {
height: auto;
margin-left: 0;
max-height: calc( 100vh - 280px );
overflow-y: auto;
border-radius: 2px;
box-shadow: none;
}
.ast-attachments-browser .single-site-preview img {
vertical-align: middle;
}
.ast-attachments-browser .ast-image__preview-skeleton {
padding: 10px;
}
.ast-attachments-browser .single-site-preview img,
.ast-attachments-browser .single-site-preview-wrap {
width: 100%;
}
.ast-image__list-inner-wrap.imported {
position: relative;
}
.ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
content: "IMPORTED";
background: rgba( 0, 0, 0, 0.5 );
color: #fff;
top: 10px;
right: 10px;
width: auto;
height: auto;
padding: 5px;
margin: 0;
z-index: 9;
position: absolute;
display: none;
}
.ast-attachments-browser .ast-image__go-back {
font-weight: 600;
font-size: 12px;
cursor: pointer;
display: inline-block;
align-items: center;
margin-top: 7px;
}
.ast-attachments-browser .ast-image__go-back i {
font-size: 14px;
height: 14px;
width: 14px;
vertical-align: text-bottom;
}
.ast-attachments-browser .ast-image__save-wrap {
padding: 0 20px;
display: inline-block;
float: left;
}
.ast-attachments-browser .ast-image__loader-wrap {
display: none;
margin: 0 auto;
min-height: 58px;
line-height: 58px;
width: 160px;
text-align: center;
position: absolute;
right: 50%;
bottom: 0;
transform: translateX( 50% );
}
.ast-attachments-browser .ast-image__loader-wrap > div {
width: 18px;
height: 18px;
background-color: #0085ba;
-webkit-border-radius: 100%;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}
.ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.ast-attachments-browser .ast-image__license-heading {
margin: 0;
text-align: center;
font-size: 1.4em;
font-weight: 600;
margin-top: 0;
color: #23282d;
}
.ast-attachments-browser .ast-image__license-description {
font-size: 13px;
line-height: 1.5;
margin: 2em 4em;
color: #444;
}
.ast-attachments-browser .ast-image__license-get-wrap {
font-size: 1em;
margin-top: 40px;
padding: 18px;
border-top: 1px solid #eae5e5;
}
.ast-attachments-browser .ast-image__license-input-wrap {
margin-bottom: 20px;
}
.ast-attachments-browser .ast-image__license-get-wrap h4 {
color: #444;
margin: 0;
}
.ast-attachments-browser .astra-sites-no-sites {
width: 100%;
padding: 7em 0;
}
.ast-attachments-browser .astra-sites-no-sites h3 {
font-size: 1.3rem;
font-weight: normal;
color: #666;
margin-top: 0;
text-align: center;
margin-bottom: 3em;
}
.ast-attachments-browser .ast-image__license-heading-wrap {
background: #fff;
margin-bottom: 50px;
padding: 16px 35px;
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
border-radius: 2px 2px 0 0;
}
.ast-attachments-browser .ast-image__license-wrap {
position: absolute;
background: #fcfcfc;
top: 50%;
right: 50%;
transform: translateX( 50% ) translateY( -40% );
width: 600px;
box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.15 );
text-align: center;
border-radius: 2px;
}
.ast-attachments-browser .ast-image__license-input-inner-wrap {
display: inline-grid;
position: relative;
}
.ast-attachments-browser .ast-image__license-input-inner-wrap .ast-image__license-msg {
padding: 5px 10px;
border: 1px solid #cc3333;
border-radius: 2px;
text-align: right;
margin-left: 10px;
margin-top: 5px;
margin-left: 10px;
margin-right: 0;
display: none;
color: #cc3333;
background: #ffeeee;
}
.ast-attachments-browser .ast-image__license-msg i {
margin-left: 5px;
}
.ast-attachments-browser .ast-image__license-msg span {
vertical-align: middle;
}
.ast-attachments-browser input.ast-image__license {
margin-left: 10px;
width: 300px;
height: 40px;
padding-right: 13px;
border-color: #d6d6d6;
}
.ast-attachments-browser li.ast-image__license-edit-key {
display: flex;
justify-content: center;
margin-right: 5px;
align-items: center;
border-right: 1px solid #ededed;
padding: 0 15px;
}
.ast-attachments-browser .ast-image__license-edit-key + div {
padding: 0 10px;
}
.ast-attachments-browser li.ast-image__license-edit-key a:focus {
box-shadow: none;
}
.ast-attachments-browser .ast-image-valid-license {
height: 40px;
position: absolute;
left: 20px;
top: 0;
color: green;
display: flex;
align-items: center;
}
.ast-attachments-browser .ast-image__browse-images {
cursor: pointer;
}
.ast-image__save.button-primary {
display: flex;
align-items: center;
}
.ast-image__filter-safesearch > label input {
margin-left: 5px;
}
.ast-attachments-browser .ast-image__save.installing:before {
display: none;
}
.ast-attachments-browser .ast-image__save.installing:after {
content: "\f463";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
-webkit-animation: cssAnimation 0.72s ease infinite;
-moz-animation: cssAnimation 0.72s ease infinite;
-o-animation: cssAnimation 0.72s ease infinite;
-ms-animation: cssAnimation 0.72s ease infinite;
animation: cssAnimation 0.72s ease infinite;
color: #fff;
margin: 0;
padding: 0;
margin-right: 10px;
vertical-align: middle;
}
@-webkit-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( -360deg );
-moz-transform: rotate( -360deg );
-o-transform: rotate( -360deg );
-ms-transform: rotate( -360deg );
transform: rotate( -360deg );
}
}
@-moz-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( -360deg );
-moz-transform: rotate( -360deg );
-o-transform: rotate( -360deg );
-ms-transform: rotate( -360deg );
transform: rotate( -360deg );
}
}
@-o-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( -360deg );
-moz-transform: rotate( -360deg );
-o-transform: rotate( -360deg );
-ms-transform: rotate( -360deg );
transform: rotate( -360deg );
}
}
@-webkit-keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale( 0 );
transform: scale( 0 );
}
40% {
-webkit-transform: scale( 1 );
transform: scale( 1 );
}
}
@keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale( 0 );
transform: scale( 0 );
}
40% {
-webkit-transform: scale( 1 );
transform: scale( 1 );
}
}
@media ( max-width: 767px ) {
.ast-attachments-browser .ast-image__list-wrap {
width: 33.33%;
}
.ast-attachments-browser:not( .preview-mode ) .ast-attachments-search-wrap {
display: inline-block;
height: 76px;
width: 100%;
}
.ast-attachments-browser .search-icon {
right: 265px;
}
.ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
top: 15px;
padding: 4px;
margin: 0 15px 0 5px;
font-size: 11px;
}
}
@media ( min-width: 768px ) and ( max-width: 1024px ) {
.ast-attachments-browser .ast-image__list-wrap {
width: 33.33%;
}
.ast-attachments-browser .ast-image__filter li select {
width: 100px;
}
.ast-attachments-browser input.ast-image__search {
width: 240px;
}
}
@media ( min-width: 1025px ) and ( max-width: 1200px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 220px;
}
}
@media ( min-width: 1201px ) and ( max-width: 1321px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 360px;
}
}
@media ( min-width: 1322px ) and ( max-width: 1430px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 500px;
}
}

View File

@@ -0,0 +1,630 @@
@font-face {
font-family: "icomoon";
src: url( "../fonts/astra-sites.eot?9i8jex" );
src: url( "../fonts/astra-sites.eot?9i8jex#iefix" ) format( "embedded-opentype" ), url( "../fonts/astra-sites.ttf?9i8jex" ) format( "truetype" ), url( "../fonts/astra-sites.woff?9i8jex" ) format( "woff" ), url( "../fonts/astra-sites.svg?9i8jex#icomoon" ) format( "svg" );
font-weight: normal;
font-style: normal;
}
[class^="ast-icon-"],
[class*=" ast-icon-"] {
font-family: "icomoon" !important;
speak: none;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.ast-icon-chevron-left:before {
content: "\e904";
}
.ast-icon-search:before {
content: "\e900";
}
.ast-attachments-browser .ast-image__search.has-input + .search-icon {
display: none;
}
.ast-attachments-browser .search-icon {
position: absolute;
top: 0;
right: 0;
color: #2b2b2b;
opacity: 0.3;
padding: 12px;
}
.ast-attachments-browser .ast-image__skeleton {
column-count: 5;
column-gap: 20px;
}
.ast-attachments-browser .ast-image__search-wrap {
position: relative;
display: inline-block;
margin-right: 1%;
}
.ast-attachments-browser input.ast-image__search {
line-height: 1.8em;
width: 620px;
height: 35px;
background: #fff;
border-color: #d5dadf;
}
.ast-attachments-browser .ast-image__list-wrap.loaded .ast-image__list-img-wrap {
opacity: 1;
}
.ast-attachments-browser .ast-image__list-wrap.loaded .imported.ast-image__list-inner-wrap:before {
display: block;
}
.fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay span,
.fl-builder-edit .media-modal .media-frame-content .ast-image__save {
color: #fff;
}
.fl-builder-edit .media-modal .media-frame-content .ast-image__list-img-overlay .ast-image__download-icon {
color: #767676;
}
.ast-attachments-browser .ast-image__list-img-overlay span {
position: absolute;
bottom: 0;
left: 0;
color: #fff;
padding: 10px;
font-size: 13px;
width: calc( 100% - 20px );
text-align: left;
text-transform: capitalize;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon {
margin: 10px;
padding: 5px 7px;
width: auto;
border-radius: 2px;
right: 0;
text-align: right;
font-size: 16px;
left: auto;
background: #fff;
color: #767676;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon:hover {
color: #111;
box-shadow: rgb( 0 0 0 / 30% ) 0px 4px 14px;
}
.ast-attachments-browser .ast-image__list-img-overlay .ast-image__download-icon.installing:before {
content: "\f463";
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
display: inline-block;
-webkit-animation: cssAnimation 2s linear infinite;
-moz-animation: cssAnimation 2s linear infinite;
-o-animation: cssAnimation 2s linear infinite;
-ms-animation: cssAnimation 2s linear infinite;
animation: cssAnimation 2s linear infinite;
}
.ast-attachments-browser .ast-image__list-img-wrap {
display: flex;
opacity: 0;
position: relative;
}
.ast-attachments-browser .ast-image__list-img-wrap:hover {
box-shadow: 0 3px 10px rgba( 0, 0, 0, 0.12 );
}
.ast-attachments-browser .ast-image__list-img-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba( 0, 0, 0, 0.4 );
opacity: 0;
transition: opacity 0.5s, visibility 0s 0.5s;
cursor: pointer;
}
.ast-attachments-browser .ast-image__list-inner-wrap:hover .ast-image__list-img-overlay {
opacity: 1;
}
.ast-attachments-browser .ast-image__filter-wrap {
display: inline-block;
vertical-align: top;
}
.ast-powered-by-pixabay-wrap {
margin-right: 25px;
display: flex;
align-items: center;
float: right;
margin-top: 10px;
}
.ast-powered-by-pixabay-wrap > span {
font-size: 12px;
color: #50575e;
margin-right: 5px;
}
.ast-powered-by-pixabay-wrap > img {
height: 1.2em;
}
.ast-attachments-browser .ast-attachments-search-wrap {
padding: 10px 20px;
border-bottom: 1px solid #ddd;
display: block;
height: 36px;
align-items: center;
padding-right: 0px;
}
.ast-attachments-browser .ast-image__filter {
display: flex;
padding: 0;
margin: 0;
list-style-type: none;
align-items: center;
}
.ast-attachments-browser .ast-image__filter li {
padding: 0 8px;
margin: 0;
}
.ast-attachments-browser .ast-image__filter li:first-child {
padding-left: 0;
}
.ast-attachments-browser .ast-image__filter li select {
height: 35px;
width: auto;
}
.fl-builder .ast-attachments-browser .ast-image__filter li select {
padding: 0 10px;
}
.ast-attachments-browser .ast-image__skeleton-inner-wrap {
overflow-y: scroll;
height: inherit;
padding: 10px;
padding-bottom: 0;
height: inherit;
}
.ast-attachments-browser .button.ast-image__validate-btn {
height: 38px;
line-height: 37px;
padding: 0 15px 2px;
}
.ast-attachments-browser.preview-mode .ast-image__skeleton-inner-wrap {
overflow-y: auto;
}
.ast-attachments-browser .ast-image__list-wrap {
padding: 0;
margin: 0;
display: grid;
grid-template-rows: 1fr auto;
margin-bottom: 20px;
break-inside: avoid;
}
.ast-attachments-browser .ast-image__skeleton-wrap {
height: 100%;
}
.ast-attachments-browser .ast-image__list-inner-wrap img {
width: 100%;
height: auto;
}
.ast-attachments-browser .single-site-wrap {
display: flex;
}
.ast-attachments-browser .single-site {
width: 100%;
display: flex;
}
.ast-attachments-browser .single-site-preview {
height: auto;
margin-right: 0;
max-height: calc( 100vh - 280px );
overflow-y: auto;
border-radius: 2px;
box-shadow: none;
}
.ast-attachments-browser .single-site-preview img {
vertical-align: middle;
}
.ast-attachments-browser .ast-image__preview-skeleton {
padding: 10px;
}
.ast-attachments-browser .single-site-preview img,
.ast-attachments-browser .single-site-preview-wrap {
width: 100%;
}
.ast-image__list-inner-wrap.imported {
position: relative;
}
.ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
content: "IMPORTED";
background: rgba( 0, 0, 0, 0.5 );
color: #fff;
top: 10px;
left: 10px;
width: auto;
height: auto;
padding: 5px;
margin: 0;
z-index: 9;
position: absolute;
display: none;
}
.ast-attachments-browser .ast-image__go-back {
font-weight: 600;
font-size: 12px;
cursor: pointer;
display: inline-block;
align-items: center;
margin-top: 7px;
}
.ast-attachments-browser .ast-image__go-back i {
font-size: 14px;
height: 14px;
width: 14px;
vertical-align: text-bottom;
}
.ast-attachments-browser .ast-image__save-wrap {
padding: 0 20px;
display: inline-block;
float: right;
}
.ast-attachments-browser .ast-image__loader-wrap {
display: none;
margin: 0 auto;
min-height: 58px;
line-height: 58px;
width: 160px;
text-align: center;
position: absolute;
left: 50%;
bottom: 0;
transform: translateX( -50% );
}
.ast-attachments-browser .ast-image__loader-wrap > div {
width: 18px;
height: 18px;
background-color: #0085ba;
-webkit-border-radius: 100%;
border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}
.ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.ast-attachments-browser .ast-image__loader-wrap .ast-image__loader-2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
.ast-attachments-browser .ast-image__license-heading {
margin: 0;
text-align: center;
font-size: 1.4em;
font-weight: 600;
margin-top: 0;
color: #23282d;
}
.ast-attachments-browser .ast-image__license-description {
font-size: 13px;
line-height: 1.5;
margin: 2em 4em;
color: #444;
}
.ast-attachments-browser .ast-image__license-get-wrap {
font-size: 1em;
margin-top: 40px;
padding: 18px;
border-top: 1px solid #eae5e5;
}
.ast-attachments-browser .ast-image__license-input-wrap {
margin-bottom: 20px;
}
.ast-attachments-browser .ast-image__license-get-wrap h4 {
color: #444;
margin: 0;
}
.ast-attachments-browser .astra-sites-no-sites {
width: 100%;
padding: 7em 0;
}
.ast-attachments-browser .astra-sites-no-sites h3 {
font-size: 1.3rem;
font-weight: normal;
color: #666;
margin-top: 0;
text-align: center;
margin-bottom: 3em;
}
.ast-attachments-browser .ast-image__license-heading-wrap {
background: #fff;
margin-bottom: 50px;
padding: 16px 35px;
box-shadow: 0 0 8px rgba( 0, 0, 0, 0.1 );
border-radius: 2px 2px 0 0;
}
.ast-attachments-browser .ast-image__license-wrap {
position: absolute;
background: #fcfcfc;
top: 50%;
left: 50%;
transform: translateX( -50% ) translateY( -40% );
width: 600px;
box-shadow: 0 2px 10px rgba( 0, 0, 0, 0.15 );
text-align: center;
border-radius: 2px;
}
.ast-attachments-browser .ast-image__license-input-inner-wrap {
display: inline-grid;
position: relative;
}
.ast-attachments-browser .ast-image__license-input-inner-wrap .ast-image__license-msg {
padding: 5px 10px;
border: 1px solid #cc3333;
border-radius: 2px;
text-align: left;
margin-right: 10px;
margin-top: 5px;
margin-right: 10px;
margin-left: 0;
display: none;
color: #cc3333;
background: #ffeeee;
}
.ast-attachments-browser .ast-image__license-msg i {
margin-right: 5px;
}
.ast-attachments-browser .ast-image__license-msg span {
vertical-align: middle;
}
.ast-attachments-browser input.ast-image__license {
margin-right: 10px;
width: 300px;
height: 40px;
padding-left: 13px;
border-color: #d6d6d6;
}
.ast-attachments-browser li.ast-image__license-edit-key {
display: flex;
justify-content: center;
margin-left: 5px;
align-items: center;
border-left: 1px solid #ededed;
padding: 0 15px;
}
.ast-attachments-browser .ast-image__license-edit-key + div {
padding: 0 10px;
}
.ast-attachments-browser li.ast-image__license-edit-key a:focus {
box-shadow: none;
}
.ast-attachments-browser .ast-image-valid-license {
height: 40px;
position: absolute;
right: 20px;
top: 0;
color: green;
display: flex;
align-items: center;
}
.ast-attachments-browser .ast-image__browse-images {
cursor: pointer;
}
.ast-image__save.button-primary {
display: flex;
align-items: center;
}
.ast-image__filter-safesearch > label input {
margin-right: 5px;
}
.ast-attachments-browser .ast-image__save.installing:before {
display: none;
}
.ast-attachments-browser .ast-image__save.installing:after {
content: "\f463";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: middle;
-webkit-animation: cssAnimation 0.72s ease infinite;
-moz-animation: cssAnimation 0.72s ease infinite;
-o-animation: cssAnimation 0.72s ease infinite;
-ms-animation: cssAnimation 0.72s ease infinite;
animation: cssAnimation 0.72s ease infinite;
color: #fff;
margin: 0;
padding: 0;
margin-left: 10px;
vertical-align: middle;
}
@-webkit-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( 360deg );
-moz-transform: rotate( 360deg );
-o-transform: rotate( 360deg );
-ms-transform: rotate( 360deg );
transform: rotate( 360deg );
}
}
@-moz-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( 360deg );
-moz-transform: rotate( 360deg );
-o-transform: rotate( 360deg );
-ms-transform: rotate( 360deg );
transform: rotate( 360deg );
}
}
@-o-keyframes cssAnimation {
from {
-webkit-transform: rotate( 0 );
-moz-transform: rotate( 0 );
-o-transform: rotate( 0 );
-ms-transform: rotate( 0 );
transform: rotate( 0 );
}
to {
-webkit-transform: rotate( 360deg );
-moz-transform: rotate( 360deg );
-o-transform: rotate( 360deg );
-ms-transform: rotate( 360deg );
transform: rotate( 360deg );
}
}
@-webkit-keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale( 0 );
transform: scale( 0 );
}
40% {
-webkit-transform: scale( 1 );
transform: scale( 1 );
}
}
@keyframes sk-bouncedelay {
0%,
80%,
100% {
-webkit-transform: scale( 0 );
transform: scale( 0 );
}
40% {
-webkit-transform: scale( 1 );
transform: scale( 1 );
}
}
@media ( max-width: 767px ) {
.ast-attachments-browser .ast-image__list-wrap {
width: 33.33%;
}
.ast-attachments-browser:not( .preview-mode ) .ast-attachments-search-wrap {
display: inline-block;
height: 76px;
width: 100%;
}
.ast-attachments-browser .search-icon {
left: 265px;
}
.ast-attachments-browser .imported.ast-image__list-inner-wrap:before {
top: 15px;
padding: 4px;
margin: 0 5px 0 15px;
font-size: 11px;
}
}
@media ( min-width: 768px ) and ( max-width: 1024px ) {
.ast-attachments-browser .ast-image__list-wrap {
width: 33.33%;
}
.ast-attachments-browser .ast-image__filter li select {
width: 100px;
}
.ast-attachments-browser input.ast-image__search {
width: 240px;
}
}
@media ( min-width: 1025px ) and ( max-width: 1200px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 220px;
}
}
@media ( min-width: 1201px ) and ( max-width: 1321px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 360px;
}
}
@media ( min-width: 1322px ) and ( max-width: 1430px ) {
.ast-attachments-search-wrap .ast-image__search-wrap input {
width: 500px;
}
}

View File

@@ -0,0 +1,97 @@
#wpadminbar #astra-sites-import-status-admin-bar {
padding-right: 10px;
border-right: 1px solid #3d4349;
color: #fff;
}
.astra-sites-import-screen.failed .import-step:before {
content: "\f335";
color: #f44336;
}
.astra-sites-import-screen .dashicons-external {
font-size: inherit;
vertical-align: middle;
}
#astra-sites-import-status-admin-bar .dashicons {
font-family: "dashicons";
display: inline-block;
line-height: 1;
font-weight: 400;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 20px;
vertical-align: text-top;
text-align: center;
transition: color 0.1s ease-in;
margin-left: 5px;
}
#astra-sites-import-status-admin-bar .loading::before {
color: #9ea3a8;
content: "\f463";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
animation: rotation 2s infinite linear;
margin: 5px -2px 0 5px;
font-weight: revert;
}
.astra-sites-import-screen .import-steps {
padding: 1.5em 1.5em 1em 1em;
}
.astra-sites-import-screen .import-step.processing:before {
content: "\f463";
animation: rotation 2s infinite linear;
}
.astra-sites-import-screen .import-step:before {
color: #9ea3a8;
content: "\f139";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
font-weight: revert;
margin-left: 3px;
}
.astra-sites-import-screen .import-step.success::before {
content: "\f147";
color: #4caf50;
}
.astra-sites-import-screen .import-step.fail::before {
color: #ff5722;
content: "\f335";
}
.astra-sites-import-screen .footer {
text-align: right;
padding: 10px 15px;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.astra-sites-import-screen .content {
text-align: right;
padding: 2em 5em 4em 5em;
}
.astra-sites-import-screen .view-site-button .dashicons {
font-size: initial;
vertical-align: middle;
}

View File

@@ -0,0 +1,97 @@
#wpadminbar #astra-sites-import-status-admin-bar {
padding-left: 10px;
border-left: 1px solid #3d4349;
color: #fff;
}
.astra-sites-import-screen.failed .import-step:before {
content: "\f335";
color: #f44336;
}
.astra-sites-import-screen .dashicons-external {
font-size: inherit;
vertical-align: middle;
}
#astra-sites-import-status-admin-bar .dashicons {
font-family: "dashicons";
display: inline-block;
line-height: 1;
font-weight: 400;
font-style: normal;
speak: none;
text-decoration: inherit;
text-transform: none;
text-rendering: auto;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 20px;
vertical-align: text-top;
text-align: center;
transition: color 0.1s ease-in;
margin-right: 5px;
}
#astra-sites-import-status-admin-bar .loading::before {
color: #9ea3a8;
content: "\f463";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
animation: rotation 2s infinite linear;
margin: 5px 5px 0 -2px;
font-weight: revert;
}
.astra-sites-import-screen .import-steps {
padding: 1.5em 1em 1em 1.5em;
}
.astra-sites-import-screen .import-step.processing:before {
content: "\f463";
animation: rotation 2s infinite linear;
}
.astra-sites-import-screen .import-step:before {
color: #9ea3a8;
content: "\f139";
display: inline-block;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
font-weight: revert;
margin-right: 3px;
}
.astra-sites-import-screen .import-step.success::before {
content: "\f147";
color: #4caf50;
}
.astra-sites-import-screen .import-step.fail::before {
color: #ff5722;
content: "\f335";
}
.astra-sites-import-screen .footer {
text-align: left;
padding: 10px 15px;
display: flex;
align-items: center;
justify-content: space-between;
position: relative;
}
.astra-sites-import-screen .content {
text-align: left;
padding: 2em 5em 4em 5em;
}
.astra-sites-import-screen .view-site-button .dashicons {
font-size: initial;
vertical-align: middle;
}

View File

@@ -0,0 +1,303 @@
.notice:not( .ast-img-notice ) {
display: none;
}
.ast-img-flex {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
}
.form-field p.ast-img-p {
margin: 1em 0;
}
.ast-img-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
}
.form-wrap .ast-img-response-warning {
display: block;
color: #d02222;
}
.form-wrap .ast-img-google-error-response {
margin-top: 5px;
display: block;
}
.form-wrap .ast-img-google-error-response .ast-img-response-warning {
display: inline-block;
}
.form-wrap .ast-img-response-success {
display: block;
color: #2dbe15;
}
.postbox .inside .form-wrap .ast-img-integration-heading {
font-size: 15px;
font-weight: 600;
}
#ast-img-menu-page .ast-img-notice {
max-width: 860px;
margin: 0 auto;
}
.ast-img-menu-page-wrapper a {
text-decoration: none;
}
.ast-img-general-form-wrap {
width: 680px;
}
.ast-img-bulk-actions-wrap {
flex: auto;
text-align: left;
}
.ast-img-general-list .inside {
padding: 0;
margin: 0;
}
.ast-img-list-section .ast-img-widget-list li {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
padding: 10px 12px;
-moz-box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
-webkit-box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
margin-bottom: 0;
}
.ast-img-list-section .ast-img-widget-list li:nth-child( even ) {
background-color: #fbfbfb;
}
.ast-img-list-section .ast-img-widget-list .activate {
border-right: 3px solid #008ec2;
padding-right: 12px;
}
.ast-img-widget-list a {
text-decoration: none;
}
.ast-img-widget-link-wrapper {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
display: -webkit-flex;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
flex: auto;
}
.ast-img-widget-list li a:before {
display: inline-block;
margin-left: 2px;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
}
.ast-img-widget-link-wrapper a:nth-child( even ) {
margin: 0 10px;
}
.ast-img-container .postbox .hndle {
background: #f7f7f7;
border-bottom: 2px solid #e6e6e6;
}
.ast-img-container .postbox ul {
margin: 0;
}
.ast-img-widget-list a {
line-height: 1.6;
}
.ast-img-widget-list a:focus {
box-shadow: none;
}
.ast-img-branding-list {
margin: 0;
}
.ast-img-menu-page-wrapper .ast-img-container .clear {
overflow: auto;
visibility: visible;
width: auto;
height: auto;
}
/* Update icon. */
.ast-img-widget-link-wrapper a.updating-message:before {
color: #f56e28;
content: "\f463";
}
/* Spins the update icon. */
.ast-img-widget-link-wrapper a.updating-message:before {
-webkit-animation: rotation 2s infinite linear;
animation: rotation 2s infinite linear;
}
.settings_page_astra-images #wpcontent {
padding: 0;
}
/* Header */
.ast-img-menu-page-header.general .ast-img-container,
.ast-img-menu-page-header.branding .ast-img-container,
.ast-img-container.ast-img-general,
.ast-img-container.ast-img-branding-wrapper {
max-width: 930px;
}
.ast-img-title {
flex: auto;
align-content: flex-start;
text-align: right;
margin: 0;
}
.ast-img-title a,
.ast-img-title span {
display: block;
outline: none;
box-shadow: none;
font-size: 1.5rem;
color: #333333;
font-weight: 500;
}
.ast-img-header-icon {
width: 50px;
vertical-align: bottom;
}
.ast-img-top-links {
flex: auto;
text-align: left;
font-weight: bold;
}
.ast-img-menu-page-header {
background-color: #fff;
text-align: center;
padding: 10px 0;
margin-bottom: 20px;
box-shadow: 0 2px 0 #efefef, 0 2px 2px #ececec;
}
/* White Label link*/
.ast-img-widget-list .ast-img-white-label {
border-right: 3px solid #008ec2;
padding-right: 12px;
}
.ast-img-hide-branding #poststuff #post-body.columns-2 {
margin: 0 auto;
max-width: 590px;
}
/* Integration */
.ast-img-integration-wrapper #poststuff {
width: 640px;
margin: 0 auto;
min-width: 640px;
}
.ast-img-integration-form-wrap .form-field select {
border-style: solid;
border-width: 1px;
width: 95%;
}
/* Spinner */
.ast-img-button-spinner:before {
font: normal 20px/0.5 dashicons;
speak: none;
display: inline-block;
padding: 0;
top: 8px;
right: -4px;
position: relative;
vertical-align: top;
content: "\f463";
}
.ast-img-button-spinner.loading:before {
-webkit-animation: rotation 1s infinite linear;
animation: rotation 1s infinite linear;
}
.ast-img-title > a {
display: flex;
align-items: center;
}
.ast-img-title .ast-img-plugin-version {
background-color: #e5e5e5;
border-radius: 3px;
font-size: 0.5em;
font-weight: 400;
margin-right: 10px;
padding: 2px 7px;
color: #333;
}
/* New extensions badge */
#Particles .ast-img-widget-title:after {
content: "extension";
color: #fff;
background: #2ecc71;
font-size: 0.7em;
font-weight: 600;
position: relative;
padding: 0.3em 0.6em;
top: -1px;
right: 12px;
letter-spacing: 0.5px;
line-height: 1em;
text-transform: none;
text-transform: uppercase !important;
border-radius: 2px;
}

View File

@@ -0,0 +1,303 @@
.notice:not( .ast-img-notice ) {
display: none;
}
.ast-img-flex {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
}
.form-field p.ast-img-p {
margin: 1em 0;
}
.ast-img-container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
box-sizing: border-box;
}
.form-wrap .ast-img-response-warning {
display: block;
color: #d02222;
}
.form-wrap .ast-img-google-error-response {
margin-top: 5px;
display: block;
}
.form-wrap .ast-img-google-error-response .ast-img-response-warning {
display: inline-block;
}
.form-wrap .ast-img-response-success {
display: block;
color: #2dbe15;
}
.postbox .inside .form-wrap .ast-img-integration-heading {
font-size: 15px;
font-weight: 600;
}
#ast-img-menu-page .ast-img-notice {
max-width: 860px;
margin: 0 auto;
}
.ast-img-menu-page-wrapper a {
text-decoration: none;
}
.ast-img-general-form-wrap {
width: 680px;
}
.ast-img-bulk-actions-wrap {
flex: auto;
text-align: right;
}
.ast-img-general-list .inside {
padding: 0;
margin: 0;
}
.ast-img-list-section .ast-img-widget-list li {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
padding: 10px 12px;
-moz-box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
-webkit-box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
box-shadow: 0px 0px 2px rgba( 0, 0, 0, 0.1 ) inset;
margin-bottom: 0;
}
.ast-img-list-section .ast-img-widget-list li:nth-child( even ) {
background-color: #fbfbfb;
}
.ast-img-list-section .ast-img-widget-list .activate {
border-left: 3px solid #008ec2;
padding-left: 12px;
}
.ast-img-widget-list a {
text-decoration: none;
}
.ast-img-widget-link-wrapper {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
-webkit-box-align: center;
-webkit-align-items: center;
-moz-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
-webkit-align-content: center;
-ms-flex-line-pack: center;
align-content: center;
display: -webkit-flex;
-webkit-flex-direction: row-reverse;
flex-direction: row-reverse;
flex: auto;
}
.ast-img-widget-list li a:before {
display: inline-block;
margin-right: 2px;
font: normal 20px/1 "dashicons";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
vertical-align: top;
}
.ast-img-widget-link-wrapper a:nth-child( even ) {
margin: 0 10px;
}
.ast-img-container .postbox .hndle {
background: #f7f7f7;
border-bottom: 2px solid #e6e6e6;
}
.ast-img-container .postbox ul {
margin: 0;
}
.ast-img-widget-list a {
line-height: 1.6;
}
.ast-img-widget-list a:focus {
box-shadow: none;
}
.ast-img-branding-list {
margin: 0;
}
.ast-img-menu-page-wrapper .ast-img-container .clear {
overflow: auto;
visibility: visible;
width: auto;
height: auto;
}
/* Update icon. */
.ast-img-widget-link-wrapper a.updating-message:before {
color: #f56e28;
content: "\f463";
}
/* Spins the update icon. */
.ast-img-widget-link-wrapper a.updating-message:before {
-webkit-animation: rotation 2s infinite linear;
animation: rotation 2s infinite linear;
}
.settings_page_astra-images #wpcontent {
padding: 0;
}
/* Header */
.ast-img-menu-page-header.general .ast-img-container,
.ast-img-menu-page-header.branding .ast-img-container,
.ast-img-container.ast-img-general,
.ast-img-container.ast-img-branding-wrapper {
max-width: 930px;
}
.ast-img-title {
flex: auto;
align-content: flex-start;
text-align: left;
margin: 0;
}
.ast-img-title a,
.ast-img-title span {
display: block;
outline: none;
box-shadow: none;
font-size: 1.5rem;
color: #333333;
font-weight: 500;
}
.ast-img-header-icon {
width: 50px;
vertical-align: bottom;
}
.ast-img-top-links {
flex: auto;
text-align: right;
font-weight: bold;
}
.ast-img-menu-page-header {
background-color: #fff;
text-align: center;
padding: 10px 0;
margin-bottom: 20px;
box-shadow: 0 2px 0 #efefef, 0 2px 2px #ececec;
}
/* White Label link*/
.ast-img-widget-list .ast-img-white-label {
border-left: 3px solid #008ec2;
padding-left: 12px;
}
.ast-img-hide-branding #poststuff #post-body.columns-2 {
margin: 0 auto;
max-width: 590px;
}
/* Integration */
.ast-img-integration-wrapper #poststuff {
width: 640px;
margin: 0 auto;
min-width: 640px;
}
.ast-img-integration-form-wrap .form-field select {
border-style: solid;
border-width: 1px;
width: 95%;
}
/* Spinner */
.ast-img-button-spinner:before {
font: normal 20px/0.5 dashicons;
speak: none;
display: inline-block;
padding: 0;
top: 8px;
left: -4px;
position: relative;
vertical-align: top;
content: "\f463";
}
.ast-img-button-spinner.loading:before {
-webkit-animation: rotation 1s infinite linear;
animation: rotation 1s infinite linear;
}
.ast-img-title > a {
display: flex;
align-items: center;
}
.ast-img-title .ast-img-plugin-version {
background-color: #e5e5e5;
border-radius: 3px;
font-size: 0.5em;
font-weight: 400;
margin-left: 10px;
padding: 2px 7px;
color: #333;
}
/* New extensions badge */
#Particles .ast-img-widget-title:after {
content: "extension";
color: #fff;
background: #2ecc71;
font-size: 0.7em;
font-weight: 600;
position: relative;
padding: 0.3em 0.6em;
top: -1px;
left: 12px;
letter-spacing: 0.5px;
line-height: 1em;
text-transform: none;
text-transform: uppercase !important;
border-radius: 2px;
}

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>Generated by IcoMoon</metadata>
<defs>
<font id="icomoon" horiz-adv-x="1024">
<font-face units-per-em="1024" ascent="960" descent="-64" />
<missing-glyph horiz-adv-x="1024" />
<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
<glyph unicode="&#xe900;" glyph-name="search3" d="M660.48 239.616c-68.622-53.712-156.164-86.131-251.277-86.131-226.216 0-409.6 183.384-409.6 409.6s183.384 409.6 409.6 409.6c226.216 0 409.6-183.384 409.6-409.6 0-95.113-32.419-182.654-86.809-252.177l0.678 0.9 273.92-272.896-72.704-72.704-272.896 273.408zM409.6 256c169.662 0 307.2 137.538 307.2 307.2s-137.538 307.2-307.2 307.2v0c-169.662 0-307.2-137.538-307.2-307.2s137.538-307.2 307.2-307.2v0z" />
<glyph unicode="&#xe901;" glyph-name="heart" d="M859.008 711.808c37.547-37.589 56.277-86.656 56.277-135.851s-18.773-98.261-56.277-135.765l-347.008-347.008-347.008 347.008c-37.504 37.504-56.235 86.571-56.235 135.808s18.731 98.304 56.235 135.808 86.571 56.235 135.808 56.235 98.304-18.731 135.808-56.235l45.227-45.227c16.683-16.683 43.691-16.683 60.331 0l45.312 45.312c37.504 37.504 86.571 56.235 135.765 56.192s98.261-18.773 135.765-56.277zM919.339 772.139c-54.144 54.144-125.184 81.237-196.096 81.28s-141.952-27.051-196.139-81.195l-15.104-15.147-15.061 15.061c-54.144 54.144-125.227 81.237-196.139 81.237s-141.995-27.093-196.139-81.237-81.237-125.227-81.237-196.139 27.093-141.995 81.237-196.139l377.173-377.173c16.683-16.683 43.691-16.683 60.331 0l377.173 377.173c54.144 54.144 81.237 125.184 81.28 196.096s-27.051 141.952-81.28 196.181z" />
<glyph unicode="&#xe902;" glyph-name="refresh" d="M189.995 540.416c31.445 88.875 95.872 156.544 174.763 194.219s172.032 45.184 260.864 13.739c50.603-17.92 94.123-46.421 127.275-80.213l120.747-113.493h-148.309c-23.552 0-42.667-19.115-42.667-42.667s19.115-42.667 42.667-42.667h255.872c0.213 0 0.384 0 0.597 0 5.845 0.043 11.435 1.323 16.469 3.499 5.077 2.176 9.771 5.376 13.824 9.6 0.512 0.555 1.024 1.109 1.536 1.664 3.2 3.712 5.675 7.808 7.381 12.16s2.731 9.003 2.944 13.909c0.043 0.64 0.043 1.237 0.043 1.835v256c0 23.552-19.115 42.667-42.667 42.667s-42.667-19.115-42.667-42.667v-157.397l-124.843 117.291c-42.325 43.093-96.896 78.635-159.701 100.864-111.061 39.296-227.627 29.824-326.101-17.152s-179.157-131.669-218.453-242.731c-7.893-22.187 3.755-46.549 25.941-54.443s46.592 3.755 54.443 25.984zM85.333 242.688l126.080-118.485c82.304-82.389 191.573-124.075 300.715-124.117s218.411 41.6 301.739 124.885c47.104 47.104 81.109 102.699 100.736 159.787 7.68 22.272-4.181 46.549-26.496 54.229s-46.549-4.181-54.229-26.496c-15.403-44.8-42.368-89.216-80.341-127.189-66.688-66.645-153.984-99.925-241.365-99.925s-174.677 33.365-242.304 100.949l-119.467 112.341h148.267c23.552 0 42.667 19.115 42.667 42.667s-19.115 42.667-42.667 42.667h-255.872c-0.213 0-0.384 0-0.597 0-5.845-0.043-11.435-1.323-16.469-3.499-5.077-2.176-9.771-5.376-13.824-9.6-0.512-0.555-1.024-1.109-1.536-1.664-3.2-3.712-5.675-7.808-7.381-12.16s-2.731-9.003-2.944-13.909c-0.043-0.64-0.043-1.237-0.043-1.835v-256c0-23.552 19.115-42.667 42.667-42.667s42.667 19.115 42.667 42.667z" />
<glyph unicode="&#xe903;" glyph-name="file" d="M554.667 896h-298.667c-35.328 0-67.413-14.379-90.496-37.504s-37.504-55.168-37.504-90.496v-682.667c0-35.328 14.379-67.413 37.504-90.496s55.168-37.504 90.496-37.504h512c35.328 0 67.413 14.379 90.496 37.504s37.504 55.168 37.504 90.496v469.333c0 11.776-4.779 22.443-12.501 30.165l-298.667 298.667c-4.096 4.096-8.789 7.168-13.824 9.259-5.205 2.176-10.795 3.243-16.341 3.243zM750.336 597.334h-153.003v153.003zM512 810.667v-256c0-23.552 19.115-42.667 42.667-42.667h256v-426.667c0-11.776-4.736-22.4-12.501-30.165s-18.389-12.501-30.165-12.501h-512c-11.776 0-22.4 4.736-30.165 12.501s-12.501 18.389-12.501 30.165v682.667c0 11.776 4.736 22.4 12.501 30.165s18.389 12.501 30.165 12.501z" />
<glyph unicode="&#xe904;" glyph-name="chevron-left" d="M670.165 200.832l-225.835 225.835 225.835 225.835c16.683 16.683 16.683 43.691 0 60.331s-43.691 16.683-60.331 0l-256-256c-16.683-16.683-16.683-43.691 0-60.331l256-256c16.683-16.683 43.691-16.683 60.331 0s16.683 43.691 0 60.331z" />
<glyph unicode="&#xe905;" glyph-name="layers" d="M512 805.632l331.264-165.632-331.264-165.632-331.264 165.632zM492.928 891.478l-426.667-213.333c-21.077-10.539-29.611-36.139-19.072-57.216 4.309-8.661 11.136-15.189 19.072-19.072l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259-4.309 8.619-11.179 15.147-19.072 19.072l-426.667 213.333c-12.459 6.229-26.453 5.803-38.144 0zM66.261 175.19l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259s-36.181 29.611-57.259 19.072l-407.552-203.819-407.595 203.776c-21.077 10.539-46.72 2.005-57.259-19.072s-2.005-46.72 19.072-57.259zM66.261 388.523l426.667-213.333c12.459-6.229 26.453-5.803 38.144 0l426.667 213.333c21.077 10.539 29.611 36.181 19.072 57.259s-36.181 29.611-57.259 19.072l-407.552-203.819-407.595 203.776c-21.077 10.539-46.72 2.005-57.259-19.072s-2.005-46.72 19.072-57.259z" />
</font></defs></svg>

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Isolation_Mode" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
y="0px" width="100px" height="56px" viewBox="0 0 100 56" enable-background="new 0 0 100 56" xml:space="preserve">
<path fill="#0073AA" d="M97.286,0c-1.499,0-2.714,1.2-2.714,2.683c0,11.211-4.895,23.281-13.095,32.286
C72.279,45.069,59.701,50.634,46.06,50.634c-8.53,0-17.074-2.393-24.709-6.921c-4.842-2.88-9.193-6.499-12.889-10.726l12.753,0.416
c1.498,0.049,2.752-1.112,2.801-2.594c0.049-1.48-1.125-2.72-2.623-2.769L3.747,27.465c-1.013-0.412-2.179-0.18-2.953,0.585
c-0.775,0.768-1.007,1.919-0.587,2.92l0.581,17.438c0.034,1.483,1.276,2.657,2.775,2.624c1.497-0.033,2.687-1.261,2.653-2.742
c0-0.02,0-0.038-0.002-0.058L5.878,38.171c3.733,3.944,8,7.357,12.679,10.146C27.035,53.344,36.545,56,46.06,56
c15.199,0,29.213-6.192,39.453-17.44C94.584,28.596,100,15.186,100,2.683C100,1.2,98.786,0,97.286,0L97.286,0z M97.286,0"/>
</svg>

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,3 @@
<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M9.95078 1.46005L6.41078 5.00005L9.95078 8.54005L8.54078 9.95005L5.00078 6.42005L1.47078 9.95005L0.0507812 8.53005L3.58078 5.00005L0.0507812 1.47005L1.47078 0.0500488L5.00078 3.58005L8.54078 0.0500488L9.95078 1.46005Z" fill="#4B5563"/>
</svg>

After

Width:  |  Height:  |  Size: 348 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M3.59961 24H20.3996V0H3.59961V24ZM8.39961 3.6H5.99961V1.2H8.39961V3.6ZM13.1996 3.6H10.7996V1.2H13.1996V3.6ZM17.9996 3.6H15.5996V1.2H17.9996V3.6ZM8.39961 7.2H5.99961V4.8H8.39961V7.2ZM13.1996 7.2H10.7996V4.8H13.1996V7.2ZM17.9996 7.2H15.5996V4.8H17.9996V7.2ZM8.39961 10.8H5.99961V8.4H8.39961V10.8ZM13.1996 10.8H10.7996V8.4H13.1996V10.8ZM17.9996 10.8H15.5996V8.4H17.9996V10.8ZM8.39961 14.4H5.99961V12H8.39961V14.4ZM13.1996 14.4H10.7996V12H13.1996V14.4ZM17.9996 14.4H15.5996V12H17.9996V14.4ZM13.1996 22.8H5.99961V15.6H13.1996V22.8ZM17.9996 18H15.5996V15.6H17.9996V18ZM17.9996 21.6H15.5996V19.2H17.9996V21.6Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 731 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.19922 15.5999H17.9992C18.6592 15.5999 19.1992 16.1399 19.1992 16.7999C19.1992 17.4599 18.6592 17.9999 17.9992 17.9999H5.99922C5.33922 17.9999 4.79922 17.4599 4.79922 16.7999V4.7999H2.39922C1.73922 4.7999 1.19922 4.2599 1.19922 3.5999C1.19922 2.9399 1.73922 2.3999 2.39922 2.3999H5.99922C6.65922 2.3999 7.19922 2.9399 7.19922 3.5999V5.9999H22.7992L17.9992 14.3999H7.19922V15.5999ZM6.59922 19.1999C7.59522 19.1999 8.39922 20.0039 8.39922 20.9999C8.39922 21.9959 7.59522 22.7999 6.59922 22.7999C5.60322 22.7999 4.79922 21.9959 4.79922 20.9999C4.79922 20.0039 5.60322 19.1999 6.59922 19.1999ZM17.3992 19.1999C18.3952 19.1999 19.1992 20.0039 19.1992 20.9999C19.1992 21.9959 18.3952 22.7999 17.3992 22.7999C16.4032 22.7999 15.5992 21.9959 15.5992 20.9999C15.5992 20.0039 16.4032 19.1999 17.3992 19.1999Z" fill="#1F2937"/>
</svg>

After

Width:  |  Height:  |  Size: 931 B

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.781 7.12811C22.333 9.07211 22.237 10.9921 21.757 12.5041C21.253 14.0401 20.245 15.1201 18.997 15.4801C18.805 15.5521 18.685 15.5521 18.517 15.5521C18.445 15.5761 18.373 15.5761 18.301 15.5761C18.229 15.6001 18.133 15.6001 18.037 15.6001H9.87697L12.541 22.2001C12.565 22.3681 12.469 22.5121 12.373 22.6081C12.277 22.7281 12.085 22.8001 11.965 22.8001H8.34097C8.22097 22.8001 8.02897 22.7281 7.93297 22.6081C7.83697 22.5121 7.74097 22.3681 7.76497 22.2001L6.56497 15.6001H5.10097L5.07697 15.5761C4.47697 15.6481 3.78097 15.3601 3.22897 14.8321C2.67697 14.3041 2.17297 13.5361 1.95697 12.5761C1.66897 11.6161 1.71697 10.7041 1.93297 9.93611C2.14897 9.19211 2.62897 8.64011 3.20497 8.37611L3.22897 8.35211L14.029 1.87211C14.149 1.80011 14.245 1.75211 14.317 1.68011C14.389 1.63211 14.485 1.58411 14.605 1.53611C14.797 1.44011 14.941 1.39211 15.205 1.32011C16.453 0.960113 17.893 1.44011 19.069 2.49611C20.245 3.55211 21.277 5.18411 21.781 7.12811ZM18.685 14.3041H18.661C19.141 14.1841 19.549 13.8961 19.909 13.4641C20.605 12.6241 20.941 11.3521 20.941 9.81611C20.941 9.04811 20.821 8.25611 20.605 7.44011C20.197 5.80811 19.381 4.44011 18.469 3.55211C17.557 2.66411 16.453 2.23211 15.517 2.49611C14.533 2.76011 13.837 3.64811 13.477 4.89611C13.093 6.14411 13.141 7.72811 13.549 9.36011C14.005 10.9921 14.749 12.3601 15.709 13.2481C16.645 14.1361 17.653 14.5681 18.685 14.3041ZM15.637 5.80811C15.901 5.76011 16.141 5.78411 16.381 5.85611C16.837 6.04811 17.293 6.43211 17.605 7.05611C17.917 7.68011 18.109 8.49611 18.109 9.19211C18.109 9.55211 18.061 9.86411 17.965 10.1521C17.749 10.7281 17.437 11.1601 16.933 11.2801C16.525 11.4001 15.973 11.2081 15.565 10.8001C15.157 10.3921 14.797 9.76811 14.629 9.00011C14.413 8.25611 14.485 7.51211 14.653 6.93611C14.821 6.36011 15.229 5.92811 15.637 5.80811Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

@@ -0,0 +1,3 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M20.2676 1.43999L21.9596 3.13199C22.4276 3.59999 22.4276 4.35599 21.9596 4.82399L16.7996 9.99599V21.6H3.59961V3.59999H16.4036L18.5636 1.43999C19.0436 0.971987 19.7996 0.959987 20.2676 1.43999ZM13.4756 11.616L19.9196 5.18399L18.2156 3.47999L11.7836 9.92399L10.9316 12.468L13.4756 11.616Z" fill="black"/>
</svg>

After

Width:  |  Height:  |  Size: 415 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="200px" height="240px" viewBox="0 0 200 240" enable-background="new 0 0 200 240" xml:space="preserve">
<g>
<g>
<path fill="#FFFFFF" d="M196.201,0H3.8C1.7,0,0,1.7,0,3.8v232.5c0,2.1,1.7,3.799,3.8,3.799h192.401c2.1,0,3.799-1.699,3.799-3.799
V3.8C200,1.7,198.301,0,196.201,0L196.201,0z"/>
</g>
</g>
<g>
<g>
<g>
<path fill="#FF4D4D" d="M170,222.599c-0.199,0-0.5-0.1-0.699-0.299L164,216.999c-0.9-0.799-1.4-1.9-1.4-3.199
c0-2.301,1.9-4.201,4.201-4.201c1.299,0,2.4,0.5,3.199,1.5c0.801-0.898,2-1.5,3.201-1.5c2.299,0,4.199,1.9,4.199,4.201
c0,1.199-0.5,2.4-1.5,3.199L170.6,222.3C170.5,222.499,170.301,222.599,170,222.599z M167.1,210.999c-1.699,0-3.1,1.4-3.1,3
c0,0.9,0.4,1.701,1,2.301l5,4.9l0,0l4.9-4.9c0.699-0.6,1.1-1.4,1.1-2.301c0-1.699-1.4-3-3.1-3c-1.1,0-2,0.5-2.6,1.4l-0.301,0.6
l-0.299-0.6C169.1,211.499,168.1,210.999,167.1,210.999z"/>
</g>
</g>
</g>
<g>
<g>
<g>
<path fill="#DDE3E6" d="M106.712,217.599H14.421c-0.818,0-1.5-0.682-1.5-1.501c0-0.817,0.682-1.499,1.5-1.499h92.358
c0.818,0,1.5,0.682,1.5,1.499C108.211,216.917,107.598,217.599,106.712,217.599z"/>
</g>
</g>
</g>
<g>
<g>
<path fill="#DDE3E6" d="M196.201,0.9c1.6,0,2.799,1.3,2.799,2.8v232.5c0,1.6-1.299,2.799-2.799,2.799H3.8
c-1.6,0-2.8-1.299-2.8-2.799V3.8C1,2.2,2.3,1,3.8,1L196.201,0.9 M196.201,0H3.8C1.7,0,0,1.7,0,3.8v232.5
c0,2.1,1.7,3.799,3.8,3.799h192.401c2.1,0,3.799-1.699,3.799-3.799V3.8C200,1.7,198.301,0,196.201,0L196.201,0z"/>
</g>
</g>
<g>
<rect x="0.899" y="191.399" fill="#DDE3E6" width="198.601" height="1.5"/>
</g>
<g>
<path fill="#DDE3E6" d="M163.801,118.7H36.2c-1.9,0-3.4-1.5-3.4-3.4V38.7c0-1.9,1.5-3.4,3.4-3.4h127.501
c1.898,0,3.398,1.5,3.398,3.4v76.6C167.1,117.2,165.6,118.7,163.801,118.7z M36.2,37.4c-0.801,0-1.4,0.6-1.4,1.4v76.602
c0,0.699,0.6,1.398,1.4,1.398h127.501c0.799,0,1.398-0.6,1.398-1.398V38.7c0-0.7-0.6-1.4-1.398-1.4H36.2V37.4z"/>
</g>
<g>
<rect x="33.899" y="172.999" fill="#DDE3E6" width="37.801" height="2.4"/>
</g>
<g>
<path fill="#DDE3E6" d="M69.3,165.8H36.2c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.1
c1.9,0,3.4,1.5,3.4,3.398v28.301C72.7,164.3,71.2,165.8,69.3,165.8z M36.2,132.8c-0.801,0-1.4,0.6-1.4,1.4v28.299
c0,0.701,0.6,1.4,1.4,1.4h33.1c0.8,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.601-1.4-1.4-1.4H36.2z"/>
</g>
<g>
<rect x="80.4" y="172.999" fill="#DDE3E6" width="37.801" height="2.4"/>
</g>
<g>
<path fill="#DDE3E6" d="M115.801,165.8H82.7c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.101
c1.9,0,3.4,1.5,3.4,3.398v28.301C119.201,164.3,117.6,165.8,115.801,165.8z M82.7,132.8c-0.8,0-1.4,0.6-1.4,1.4v28.299
c0,0.701,0.601,1.4,1.4,1.4h33.101c0.799,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.602-1.4-1.4-1.4H82.7z"/>
</g>
<g>
<rect x="126.701" y="172.999" fill="#DDE3E6" width="37.799" height="2.4"/>
</g>
<g>
<path fill="#DDE3E6" d="M162.1,165.8H129c-1.9,0-3.4-1.5-3.4-3.4v-28.301c0-1.898,1.5-3.398,3.4-3.398h33.1
c1.9,0,3.4,1.5,3.4,3.398v28.301C165.4,164.3,163.9,165.8,162.1,165.8z M129,132.8c-0.799,0-1.4,0.6-1.4,1.4v28.299
c0,0.701,0.602,1.4,1.4,1.4h33.1c0.801,0,1.4-0.6,1.4-1.4V134.2c0-0.701-0.6-1.4-1.4-1.4H129z"/>
</g>
<g>
<path fill="#DDE3E6" d="M107.967,65.958c0,2.469-1.98,4.48-4.414,4.48c-2.432,0-4.411-2.009-4.411-4.48s1.979-4.48,4.411-4.48
C105.986,61.477,107.967,63.489,107.967,65.958L107.967,65.958z M97.314,65.958c0,3.476,2.801,6.308,6.239,6.308
c3.441,0,6.238-2.831,6.238-6.308c0-3.479-2.797-6.308-6.238-6.308C100.111,59.65,97.314,62.481,97.314,65.958L97.314,65.958z"/>
<path fill="#DDE3E6" d="M118.678,74.36l-14.094,13.848L87.908,67.983L65.561,96.492l1.697,1.312L87.95,71.406l21.511,26.089
l1.664-1.357l-5.17-6.271L118.67,77.37c2.984,2.941,13.779,13.59,14.246,14.054l1.523-1.511
c-0.539-0.535-15.012-14.807-15.012-14.807L118.678,74.36L118.678,74.36z"/>
</g>
<g>
<g>
<path fill="#DDE3E6" d="M40.214,17.787H11.842c-0.423,0-0.756-0.197-0.756-0.447V9.686c0-0.25,0.333-0.447,0.756-0.447h28.35
c0.422,0,0.755,0.197,0.755,0.447v7.654C40.946,17.589,40.613,17.787,40.214,17.787z"/>
</g>
<g>
<g>
<g>
<rect x="99.244" y="12.763" fill="#DDE3E6" width="89.67" height="1.5"/>
</g>
</g>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@@ -0,0 +1,14 @@
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M27.6721 9.13115H12.3279C10.5624 9.13115 9.13115 10.5624 9.13115 12.3279V27.6721C9.13115 29.4376 10.5624 30.8689 12.3279 30.8689H27.6721C29.4376 30.8689 30.8689 29.4376 30.8689 27.6721V12.3279C30.8689 10.5624 29.4376 9.13115 27.6721 9.13115ZM12.3279 7C9.38537 7 7 9.38537 7 12.3279V27.6721C7 30.6146 9.38537 33 12.3279 33H27.6721C30.6146 33 33 30.6146 33 27.6721V12.3279C33 9.38537 30.6146 7 27.6721 7H12.3279Z" fill="url(#paint0_linear_425_16)"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M22.7109 15.1798C22.6609 15.1351 22.6082 15.0923 22.5527 15.0515C22.0715 14.6972 21.4184 14.52 20.5935 14.52C20.0329 14.52 19.5597 14.5993 19.1737 14.758C18.7876 14.9113 18.4915 15.1255 18.2853 15.4005C18.0638 15.7036 17.6865 15.9493 17.3603 15.7634C17.1041 15.6175 16.8677 15.4376 16.6576 15.2275C16.2659 14.8358 15.9787 14.3521 15.8222 13.8206C15.7533 13.5865 15.8143 13.3307 15.9986 13.1707C16.4109 12.8129 16.8929 12.5118 17.4445 12.2673C18.3752 11.8549 19.4328 11.6487 20.6173 11.6487C21.8229 11.6487 22.8752 11.8549 23.7742 12.2673C24.6784 12.6798 25.3817 13.2535 25.8841 13.9886C26.0678 14.2575 26.2191 14.5419 26.3377 14.8419C26.6896 15.7316 25.8774 16.5427 24.9207 16.5427C24.1738 16.5427 23.576 15.9841 23.0112 15.4564C22.9102 15.3621 22.8104 15.2687 22.7109 15.1798ZM17.7934 16.9394C17.9352 16.884 18.087 16.9679 18.1663 17.0979C18.3038 17.3147 18.4915 17.5024 18.7295 17.6611C18.9674 17.8144 19.2424 17.9493 19.5544 18.0656C19.8664 18.1766 20.1995 18.2718 20.5538 18.3511L22.0133 18.7002C22.7219 18.8588 23.3723 19.0703 23.9646 19.3347C24.5568 19.5991 25.0697 19.9243 25.5033 20.3103C25.937 20.6964 26.2727 21.1511 26.5107 21.6746C26.754 22.1981 26.8782 22.7983 26.8835 23.4752C26.8782 24.4693 26.6244 25.3313 26.122 26.061C25.625 26.7854 24.9058 27.3486 23.9646 27.7505C23.0286 28.1471 21.8996 28.3454 20.5776 28.3454C19.2662 28.3454 18.124 28.1445 17.151 27.7426C16.1833 27.3407 15.4271 26.7458 14.8825 25.9579C14.6311 25.5882 14.4354 25.1778 14.2955 24.7266C14.0132 23.8165 14.8178 23.0151 15.7707 23.0151H15.8942C16.7178 23.0151 17.3296 23.7217 17.8252 24.3794C18.1055 24.739 18.4783 25.0113 18.9436 25.1964C19.4143 25.3762 19.9457 25.4661 20.5379 25.4661C21.1196 25.4661 21.6246 25.3815 22.053 25.2123C22.4866 25.0431 22.8224 24.8078 23.0603 24.5063C23.2983 24.2049 23.4172 23.8586 23.4172 23.4673C23.4172 23.1024 23.3088 22.7957 23.092 22.5471C22.8805 22.2986 22.5685 22.0871 22.1561 21.9126C21.7489 21.7381 21.2492 21.5794 20.6569 21.4367L18.8881 20.9925C17.7278 20.7102 16.7743 20.2933 16.0277 19.7415C15.8259 19.5924 15.7514 19.3298 15.8222 19.0891C15.9786 18.5577 16.2658 18.074 16.6575 17.6822C16.9815 17.3582 17.3685 17.1056 17.7934 16.9394ZM15.6917 14.6986L15.5362 14.1704C15.5295 14.1475 15.5156 14.1273 15.4965 14.113C15.4773 14.0987 15.4541 14.0909 15.4302 14.0909C15.4063 14.0909 15.3831 14.0987 15.364 14.113C15.3449 14.1273 15.3309 14.1475 15.3242 14.1704L15.169 14.6986C15.0647 15.0528 14.8732 15.3753 14.612 15.6364C14.3509 15.8975 14.0284 16.0889 13.6741 16.1932L13.1459 16.3486C13.0402 16.38 13.0402 16.5297 13.1459 16.5606L13.6741 16.716C14.0284 16.8203 14.3508 17.0118 14.6119 17.2729C14.873 17.534 15.0645 17.8564 15.1688 18.2106L15.3242 18.739C15.3554 18.8446 15.5051 18.8446 15.5362 18.739L15.6917 18.2109C15.7959 17.8566 15.9874 17.5341 16.2485 17.273C16.5096 17.0118 16.832 16.8203 17.1863 16.716L17.7147 16.5606C17.8203 16.5295 17.8203 16.3798 17.7147 16.3488L17.1865 16.1934C16.8322 16.0891 16.5097 15.8977 16.2486 15.6365C15.9874 15.3753 15.7959 15.0529 15.6917 14.6986ZM13.8075 17.8186L13.8541 17.9771C13.8854 18.0834 13.9428 18.1801 14.0212 18.2584C14.0995 18.3368 14.1963 18.3942 14.3026 18.4255L14.461 18.4721C14.4927 18.4814 14.4927 18.5263 14.461 18.5357L14.3025 18.5823C14.1962 18.6136 14.0995 18.671 14.0212 18.7494C13.9428 18.8277 13.8854 18.9245 13.8541 19.0308L13.8075 19.1892C13.7981 19.2209 13.7532 19.2209 13.7439 19.1892L13.6973 19.0307C13.666 18.9244 13.6085 18.8277 13.5302 18.7494C13.4519 18.671 13.3551 18.6136 13.2489 18.5823L13.0904 18.5357C13.0587 18.5264 13.0587 18.4815 13.0904 18.4721L13.2489 18.4254C13.3551 18.3942 13.4519 18.3367 13.5302 18.2584C13.6086 18.1801 13.666 18.0833 13.6973 17.9771L13.7439 17.8186C13.7459 17.8117 13.7501 17.8057 13.7558 17.8014C13.7615 17.7971 13.7685 17.7948 13.7757 17.7948C13.7829 17.7948 13.7898 17.7971 13.7956 17.8014C13.8013 17.8057 13.8055 17.8117 13.8075 17.8186ZM13.5038 13.5075L13.4312 13.261C13.4281 13.2503 13.4216 13.2409 13.4127 13.2342C13.4038 13.2275 13.3929 13.2239 13.3818 13.2239C13.3706 13.2239 13.3598 13.2275 13.3509 13.2342C13.3419 13.2409 13.3354 13.2503 13.3323 13.261L13.2599 13.5075C13.2112 13.6728 13.1218 13.8233 12.9999 13.9451C12.8781 14.067 12.7276 14.1563 12.5622 14.205L12.3158 14.2775C12.2664 14.2922 12.2664 14.362 12.3158 14.3764L12.5622 14.449C12.7276 14.4976 12.878 14.587 12.9999 14.7088C13.1217 14.8307 13.2111 14.9812 13.2598 15.1465L13.3323 15.393C13.3468 15.4423 13.4167 15.4423 13.4312 15.393L13.5038 15.1466C13.5524 14.9812 13.6418 14.8308 13.7636 14.7089C13.8855 14.587 14.036 14.4977 14.2013 14.449L14.4479 14.3764C14.4971 14.3619 14.4971 14.2921 14.4479 14.2776L14.2014 14.2051C14.036 14.1564 13.8855 14.0671 13.7637 13.9452C13.6418 13.8233 13.5524 13.6728 13.5038 13.5075Z" fill="url(#paint1_linear_425_16)"/>
<defs>
<linearGradient id="paint0_linear_425_16" x1="8.69322" y1="32.6948" x2="17.1596" y2="3.23891" gradientUnits="userSpaceOnUse">
<stop stop-color="#C639FF"/>
<stop offset="1" stop-color="#3662FF"/>
</linearGradient>
<linearGradient id="paint1_linear_425_16" x1="13.2299" y1="28.1494" x2="19.3033" y2="9.66634" gradientUnits="userSpaceOnUse">
<stop stop-color="#C639FF"/>
<stop offset="1" stop-color="#3662FF"/>
</linearGradient>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 100 100" style="enable-background:new 0 0 100 100;" xml:space="preserve">
<style type="text/css">
.st0{fill:#FFFFFF;}
</style>
<path class="st0" d="M93,38.4c0,0.3,0,0.5-0.1,0.8l-5.8,23c-0.3,1.2-1.3,2-2.5,2l-34.5,0.2c0,0,0,0,0,0H15.6c-1.2,0-2.2-0.8-2.5-2
L7.3,39.2c-0.1-0.3-0.1-0.5-0.1-0.8c-2.2-0.7-3.8-2.8-3.8-5.2c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5c0,1.7-0.8,3.2-2,4.2l7.2,7.3
c1.8,1.8,4.3,2.9,6.9,2.9c3.1,0,6-1.5,7.8-3.9L46.1,28c-1-1-1.6-2.4-1.6-3.9c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5
c0,1.5-0.6,2.8-1.5,3.8c0,0,0,0,0,0l11.8,15.7c1.8,2.5,4.8,3.9,7.8,3.9c2.6,0,5.1-1,6.9-2.9l7.2-7.2c-1.2-1-2.1-2.5-2.1-4.3
c0-3,2.5-5.5,5.5-5.5s5.5,2.5,5.5,5.5C96.6,35.6,95.1,37.6,93,38.4z M86.6,72.5c0-1.4-1.2-2.6-2.6-2.6H16.3c-1.4,0-2.6,1.2-2.6,2.6
v6.3c0,1.4,1.2,2.6,2.6,2.6H84c1.4,0,2.6-1.2,2.6-2.6V72.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="bold" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve">
<style type="text/css">
.st0{fill:#4224B8;}
</style>
<g>
<path class="st0" d="M21.5,27.8H4.2c-1.5,0-2.8-1.2-2.8-2.8s1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8s-1.2,2.8-2.8,2.8H21.5"/>
<path class="st0" d="M21.5,42.5H4.2c-1.5,0-2.8-1.2-2.8-2.8c0-1.5,1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8
c0,1.5-1.2,2.8-2.8,2.8H21.5"/>
<path class="st0" d="M45.8,13H4.2c-1.5,0-2.8-1.2-2.8-2.8s1.2-2.8,2.8-2.8h41.5c1.5,0,2.8,1.2,2.8,2.8S47.3,13,45.8,13z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 803 B

View File

@@ -0,0 +1,23 @@
<svg width="400" height="400" viewBox="0 0 400 400" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_30641_151024)">
<mask id="mask0_30641_151024" style="mask-type:alpha" maskUnits="userSpaceOnUse" x="0" y="0" width="400" height="400">
<rect width="400" height="400" fill="url(#paint0_linear_30641_151024)"/>
</mask>
<g mask="url(#mask0_30641_151024)">
<path opacity="0.1" fill-rule="evenodd" clip-rule="evenodd" d="M449.654 138.045C447.501 136.132 445.228 134.301 442.836 132.552C422.095 117.386 393.946 109.802 358.389 109.802C334.229 109.802 313.829 113.198 297.191 119.989C280.552 126.553 267.788 135.722 258.9 147.493C249.351 160.47 233.089 170.986 219.027 163.031C207.99 156.785 197.797 149.081 188.744 140.091C171.86 123.322 159.48 102.614 152.738 79.8637C149.767 69.8409 152.396 58.8858 160.342 52.0385C178.112 36.7243 198.884 23.8343 222.659 13.3697C262.774 -4.28653 308.359 -13.1152 359.415 -13.1152C411.383 -13.1152 456.74 -4.28653 495.487 13.3697C534.462 31.0271 564.776 55.5874 586.43 87.053C594.35 98.5622 600.868 110.739 605.983 123.582C621.151 161.666 586.142 196.387 544.904 196.387C512.714 196.387 486.944 172.476 462.6 149.887C458.249 145.849 453.943 141.854 449.654 138.045ZM237.702 213.375C243.813 211.001 250.356 214.593 253.772 220.156C259.697 229.437 267.788 237.473 278.045 244.264C288.302 250.828 300.155 256.601 313.602 261.582C327.05 266.335 341.408 270.409 356.68 273.805L419.587 288.745C450.13 295.536 478.165 304.591 503.693 315.909C529.221 327.228 551.329 341.149 570.019 357.674C588.709 374.198 603.183 393.667 613.439 416.076C623.923 438.487 629.281 464.18 629.508 493.154C629.281 535.712 618.34 572.609 596.686 603.849C575.262 634.86 544.263 658.968 503.693 676.172C463.349 693.15 414.688 701.639 357.706 701.639C301.18 701.639 251.948 693.036 210.009 675.832C168.299 658.628 135.705 633.162 112.229 599.434C101.394 583.609 92.9606 566.04 86.9276 546.725C74.7589 507.767 109.441 473.461 150.512 473.461H155.837C191.336 473.461 217.705 503.708 239.07 531.864C251.15 547.257 267.219 558.914 287.276 566.836C307.562 574.534 330.469 578.382 355.996 578.382C381.069 578.382 402.835 574.76 421.297 567.516C439.987 560.272 454.46 550.199 464.718 537.297C474.974 524.394 480.102 509.566 480.102 492.815C480.102 477.195 475.429 464.067 466.085 453.427C456.967 442.788 443.521 433.734 425.741 426.264C408.191 418.793 386.652 412.002 361.124 405.89L284.883 386.875C234.871 374.793 193.773 356.943 161.593 333.325C152.893 326.941 149.683 315.702 152.738 305.396C159.477 282.648 171.856 261.941 188.739 245.172C202.705 231.299 219.387 220.487 237.702 213.375ZM147.107 117.451L140.406 94.8417C140.118 93.8597 139.516 92.9972 138.693 92.3839C137.869 91.7705 136.868 91.439 135.838 91.439C134.808 91.439 133.807 91.7705 132.983 92.3839C132.159 92.9972 131.557 93.8597 131.269 94.8417L124.579 117.451C120.083 132.616 111.829 146.419 100.572 157.597C89.3161 168.774 75.4162 176.969 60.1446 181.432L37.3786 188.086C32.82 189.429 32.82 195.837 37.3786 197.161L60.1446 203.814C75.4138 208.278 89.3114 216.475 100.567 227.652C111.822 238.829 120.074 252.631 124.569 267.796L131.269 290.414C132.611 294.932 139.065 294.932 140.406 290.414L147.107 267.805C151.6 252.639 159.852 238.835 171.108 227.656C182.362 216.477 196.261 208.279 211.531 203.814L234.307 197.161C238.856 195.827 238.856 189.419 234.307 188.095L211.541 181.442C196.268 176.978 182.368 168.781 171.111 157.601C159.854 146.423 151.601 132.618 147.107 117.451ZM65.8939 250.993L67.9042 257.775C69.2525 262.326 71.7284 266.467 75.1056 269.821C78.4817 273.174 82.6527 275.633 87.2335 276.972L94.0637 278.969C95.4284 279.367 95.4284 281.289 94.0637 281.689L87.2311 283.685C82.6504 285.024 78.4805 287.483 75.1033 290.838C71.7273 294.192 69.2513 298.333 67.9042 302.882L65.8939 309.665C65.4912 311.02 63.5557 311.02 63.153 309.665L61.1427 302.879C59.7944 298.331 57.3184 294.189 53.9412 290.836C50.5652 287.482 46.3954 285.024 41.8146 283.685L34.9855 281.689C33.6173 281.291 33.6173 279.369 34.9855 278.967L41.8146 276.97C46.3965 275.631 50.5664 273.173 53.9436 269.819C57.3208 266.466 59.7968 262.325 61.1451 257.775L63.153 250.993C63.2393 250.699 63.4191 250.44 63.6666 250.256C63.9141 250.071 64.2141 249.972 64.5234 249.972C64.8316 249.972 65.1328 250.071 65.3791 250.256C65.6266 250.44 65.8076 250.699 65.8939 250.993ZM52.8019 66.467L49.6757 55.9167C49.5403 55.4587 49.2601 55.0564 48.876 54.77C48.4908 54.4837 48.0238 54.3283 47.5429 54.3283C47.0631 54.3283 46.595 54.4837 46.2109 54.77C45.8269 55.0564 45.5455 55.4587 45.4113 55.9167L42.2886 66.467C40.1908 73.5451 36.3396 79.9854 31.0865 85.2026C25.8333 90.4187 19.3462 94.2423 12.2195 96.3258L1.59521 99.4306C-0.531737 100.057 -0.531737 103.048 1.59521 103.666L12.2195 106.771C19.3451 108.854 25.831 112.679 31.083 117.895C36.3361 123.111 40.1873 129.552 42.2851 136.628L45.4113 147.184C46.0382 149.292 49.0488 149.292 49.6757 147.184L52.8019 136.633C54.8985 129.556 58.7496 123.113 64.0028 117.896C69.2548 112.68 75.7407 108.854 82.8663 106.771L93.4952 103.666C95.6187 103.043 95.6187 100.053 93.4952 99.4352L82.871 96.3292C75.7442 94.247 69.2571 90.4222 64.004 85.205C58.7508 79.9877 54.8997 73.5451 52.8019 66.467Z" fill="url(#paint1_linear_30641_151024)"/>
</g>
</g>
<defs>
<linearGradient id="paint0_linear_30641_151024" x1="400" y1="200" x2="0" y2="200" gradientUnits="userSpaceOnUse">
<stop stop-color="#D9D9D9"/>
<stop offset="1" stop-color="#737373" stop-opacity="0"/>
</linearGradient>
<linearGradient id="paint1_linear_30641_151024" x1="40.9963" y1="693.25" x2="299.552" y2="-99.0267" gradientUnits="userSpaceOnUse">
<stop stop-color="#C639FF"/>
<stop offset="1" stop-color="#3662FF"/>
</linearGradient>
<clipPath id="clip0_30641_151024">
<rect width="400" height="400" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -0,0 +1,10 @@
<!-- <svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.17766 12.2532L6.5 14.625L5.82234 12.2532C5.4664 11.0074 4.4926 10.0336 3.24682 9.67766L0.875 9L3.24683 8.32234C4.4926 7.9664 5.4664 6.9926 5.82234 5.74682L6.5 3.375L7.17766 5.74683C7.5336 6.9926 8.5074 7.9664 9.75318 8.32234L12.125 9L9.75317 9.67766C8.5074 10.0336 7.5336 11.0074 7.17766 12.2532Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.2157 6.26211L14 7.125L13.7843 6.26212C13.5324 5.25444 12.7456 4.46764 11.7379 4.21572L10.875 4L11.7379 3.78428C12.7456 3.53236 13.5324 2.74556 13.7843 1.73789L14 0.875L14.2157 1.73788C14.4676 2.74556 15.2544 3.53236 16.2621 3.78428L17.125 4L16.2621 4.21572C15.2544 4.46764 14.4676 5.25444 14.2157 6.26211Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.0785 16.1394L12.75 17.125L12.4215 16.1394C12.2348 15.5795 11.7955 15.1402 11.2356 14.9535L10.25 14.625L11.2356 14.2965C11.7955 14.1098 12.2348 13.6705 12.4215 13.1106L12.75 12.125L13.0785 13.1106C13.2652 13.6705 13.7045 14.1098 14.2644 14.2965L15.25 14.625L14.2644 14.9535C13.7045 15.1402 13.2652 15.5795 13.0785 16.1394Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg> -->
<svg width="18" height="18" viewBox="-2 -2 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.17766 12.2532L6.5 14.625L5.82234 12.2532C5.4664 11.0074 4.4926 10.0336 3.24682 9.67766L0.875 9L3.24683 8.32234C4.4926 7.9664 5.4664 6.9926 5.82234 5.74682L6.5 3.375L7.17766 5.74683C7.5336 6.9926 8.5074 7.9664 9.75318 8.32234L12.125 9L9.75317 9.67766C8.5074 10.0336 7.5336 11.0074 7.17766 12.2532Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.2157 6.26211L14 7.125L13.7843 6.26212C13.5324 5.25444 12.7456 4.46764 11.7379 4.21572L10.875 4L11.7379 3.78428C12.7456 3.53236 13.5324 2.74556 13.7843 1.73789L14 0.875L14.2157 1.73788C14.4676 2.74556 15.2544 3.53236 16.2621 3.78428L17.125 4L16.2621 4.21572C15.2544 4.46764 14.4676 5.25444 14.2157 6.26211Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M13.0785 16.1394L12.75 17.125L12.4215 16.1394C12.2348 15.5795 11.7955 15.1402 11.2356 14.9535L10.25 14.625L11.2356 14.2965C11.7955 14.1098 12.2348 13.6705 12.4215 13.1106L12.75 12.125L13.0785 13.1106C13.2652 13.6705 13.7045 14.1098 14.2644 14.2965L15.25 14.625L14.2644 14.9535C13.7045 15.1402 13.2652 15.5795 13.0785 16.1394Z" stroke="#D1DAE5" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</svg>

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 KiB

View File

@@ -0,0 +1,773 @@
/**
* EventSource
* https://github.com/Yaffle/EventSource
*
* Released under the MIT License (MIT)
* https://github.com/Yaffle/EventSource/blob/master/LICENSE.md
*/
/*jslint indent: 2, vars: true, plusplus: true */
/*global setTimeout, clearTimeout */
( function ( global ) {
'use strict';
var setTimeout = global.setTimeout;
var clearTimeout = global.clearTimeout;
var XMLHttpRequest = global.XMLHttpRequest;
var XDomainRequest = global.XDomainRequest;
var NativeEventSource = global.EventSource;
var document = global.document;
if ( Object.create == null ) {
Object.create = function ( C ) {
function F() {}
F.prototype = C;
return new F();
};
}
var k = function () {};
function XHRWrapper( xhr ) {
this.withCredentials = false;
this.responseType = '';
this.readyState = 0;
this.status = 0;
this.statusText = '';
this.responseText = '';
this.onprogress = k;
this.onreadystatechange = k;
this._contentType = '';
this._xhr = xhr;
this._sendTimeout = 0;
this._abort = k;
}
XHRWrapper.prototype.open = function ( method, url ) {
this._abort( true );
var that = this;
var xhr = this._xhr;
var state = 1;
var timeout = 0;
this._abort = function ( silent ) {
if ( that._sendTimeout !== 0 ) {
clearTimeout( that._sendTimeout );
that._sendTimeout = 0;
}
if ( state === 1 || state === 2 || state === 3 ) {
state = 4;
xhr.onload = k;
xhr.onerror = k;
xhr.onabort = k;
xhr.onprogress = k;
xhr.onreadystatechange = k;
// IE 8 - 9: XDomainRequest#abort() does not fire any event
// Opera < 10: XMLHttpRequest#abort() does not fire any event
xhr.abort();
if ( timeout !== 0 ) {
clearTimeout( timeout );
timeout = 0;
}
if ( ! silent ) {
that.readyState = 4;
that.onreadystatechange();
}
}
state = 0;
};
var onStart = function () {
if ( state === 1 ) {
//state = 2;
var status = 0;
var statusText = '';
var contentType = undefined;
if ( ! ( 'contentType' in xhr ) ) {
try {
status = xhr.status;
statusText = xhr.statusText;
contentType = xhr.getResponseHeader( 'Content-Type' );
} catch ( error ) {
// IE < 10 throws exception for `xhr.status` when xhr.readyState === 2 || xhr.readyState === 3
// Opera < 11 throws exception for `xhr.status` when xhr.readyState === 2
// https://bugs.webkit.org/show_bug.cgi?id=29121
status = 0;
statusText = '';
contentType = undefined;
// Firefox < 14, Chrome ?, Safari ?
// https://bugs.webkit.org/show_bug.cgi?id=29658
// https://bugs.webkit.org/show_bug.cgi?id=77854
}
} else {
status = 200;
statusText = 'OK';
contentType = xhr.contentType;
}
if ( status !== 0 ) {
state = 2;
that.readyState = 2;
that.status = status;
that.statusText = statusText;
that._contentType = contentType;
that.onreadystatechange();
}
}
};
var onProgress = function () {
onStart();
if ( state === 2 || state === 3 ) {
state = 3;
var responseText = '';
try {
responseText = xhr.responseText;
} catch ( error ) {
// IE 8 - 9 with XMLHttpRequest
}
that.readyState = 3;
that.responseText = responseText;
that.onprogress();
}
};
var onFinish = function () {
// Firefox 52 fires "readystatechange" (xhr.readyState === 4) without final "readystatechange" (xhr.readyState === 3)
// IE 8 fires "onload" without "onprogress"
onProgress();
if ( state === 1 || state === 2 || state === 3 ) {
state = 4;
if ( timeout !== 0 ) {
clearTimeout( timeout );
timeout = 0;
}
that.readyState = 4;
that.onreadystatechange();
}
};
var onReadyStateChange = function () {
if ( xhr != undefined ) {
// Opera 12
if ( xhr.readyState === 4 ) {
onFinish();
} else if ( xhr.readyState === 3 ) {
onProgress();
} else if ( xhr.readyState === 2 ) {
onStart();
}
}
};
var onTimeout = function () {
timeout = setTimeout( function () {
onTimeout();
}, 500 );
if ( xhr.readyState === 3 ) {
onProgress();
}
};
// XDomainRequest#abort removes onprogress, onerror, onload
xhr.onload = onFinish;
xhr.onerror = onFinish;
// improper fix to match Firefox behaviour, but it is better than just ignore abort
// see https://bugzilla.mozilla.org/show_bug.cgi?id=768596
// https://bugzilla.mozilla.org/show_bug.cgi?id=880200
// https://code.google.com/p/chromium/issues/detail?id=153570
// IE 8 fires "onload" without "onprogress
xhr.onabort = onFinish;
// https://bugzilla.mozilla.org/show_bug.cgi?id=736723
if (
! ( 'sendAsBinary' in XMLHttpRequest.prototype ) &&
! ( 'mozAnon' in XMLHttpRequest.prototype )
) {
xhr.onprogress = onProgress;
}
// IE 8 - 9 (XMLHTTPRequest)
// Opera < 12
// Firefox < 3.5
// Firefox 3.5 - 3.6 - ? < 9.0
// onprogress is not fired sometimes or delayed
// see also #64
xhr.onreadystatechange = onReadyStateChange;
if ( 'contentType' in xhr ) {
url +=
( url.indexOf( '?', 0 ) === -1 ? '?' : '&' ) + 'padding=true';
}
xhr.open( method, url, true );
if ( 'readyState' in xhr ) {
// workaround for Opera 12 issue with "progress" events
// #91
timeout = setTimeout( function () {
onTimeout();
}, 0 );
}
};
XHRWrapper.prototype.abort = function () {
this._abort( false );
};
XHRWrapper.prototype.getResponseHeader = function ( name ) {
return this._contentType;
};
XHRWrapper.prototype.setRequestHeader = function ( name, value ) {
var xhr = this._xhr;
if ( 'setRequestHeader' in xhr ) {
xhr.setRequestHeader( name, value );
}
};
XHRWrapper.prototype.send = function () {
// loading indicator in Safari < ? (6), Chrome < 14, Firefox
if (
! ( 'ontimeout' in XMLHttpRequest.prototype ) &&
document != undefined &&
document.readyState != undefined &&
document.readyState !== 'complete'
) {
var that = this;
that._sendTimeout = setTimeout( function () {
that._sendTimeout = 0;
that.send();
}, 4 );
return;
}
var xhr = this._xhr;
// withCredentials should be set after "open" for Safari and Chrome (< 19 ?)
xhr.withCredentials = this.withCredentials;
xhr.responseType = this.responseType;
try {
// xhr.send(); throws "Not enough arguments" in Firefox 3.0
xhr.send( undefined );
} catch ( error1 ) {
// Safari 5.1.7, Opera 12
throw error1;
}
};
function XHRTransport( xhr ) {
this._xhr = new XHRWrapper( xhr );
}
XHRTransport.prototype.open = function (
onStartCallback,
onProgressCallback,
onFinishCallback,
url,
withCredentials,
headers
) {
var xhr = this._xhr;
xhr.open( 'GET', url );
var offset = 0;
xhr.onprogress = function () {
var responseText = xhr.responseText;
var chunk = responseText.slice( offset );
offset += chunk.length;
onProgressCallback( chunk );
};
xhr.onreadystatechange = function () {
if ( xhr.readyState === 2 ) {
var status = xhr.status;
var statusText = xhr.statusText;
var contentType = xhr.getResponseHeader( 'Content-Type' );
onStartCallback( status, statusText, contentType );
} else if ( xhr.readyState === 4 ) {
onFinishCallback();
}
};
xhr.withCredentials = withCredentials;
xhr.responseType = 'text';
for ( var name in headers ) {
if ( Object.prototype.hasOwnProperty.call( headers, name ) ) {
xhr.setRequestHeader( name, headers[ name ] );
}
}
xhr.send();
};
XHRTransport.prototype.cancel = function () {
var xhr = this._xhr;
xhr.abort();
};
function EventTarget() {
this._listeners = Object.create( null );
}
function throwError( e ) {
setTimeout( function () {
throw e;
}, 0 );
}
EventTarget.prototype.dispatchEvent = function ( event ) {
event.target = this;
var typeListeners = this._listeners[ event.type ];
if ( typeListeners != undefined ) {
var length = typeListeners.length;
for ( var i = 0; i < length; i += 1 ) {
var listener = typeListeners[ i ];
try {
if ( typeof listener.handleEvent === 'function' ) {
listener.handleEvent( event );
} else {
listener.call( this, event );
}
} catch ( e ) {
throwError( e );
}
}
}
};
EventTarget.prototype.addEventListener = function ( type, listener ) {
type = String( type );
var listeners = this._listeners;
var typeListeners = listeners[ type ];
if ( typeListeners == undefined ) {
typeListeners = [];
listeners[ type ] = typeListeners;
}
var found = false;
for ( var i = 0; i < typeListeners.length; i += 1 ) {
if ( typeListeners[ i ] === listener ) {
found = true;
}
}
if ( ! found ) {
typeListeners.push( listener );
}
};
EventTarget.prototype.removeEventListener = function ( type, listener ) {
type = String( type );
var listeners = this._listeners;
var typeListeners = listeners[ type ];
if ( typeListeners != undefined ) {
var filtered = [];
for ( var i = 0; i < typeListeners.length; i += 1 ) {
if ( typeListeners[ i ] !== listener ) {
filtered.push( typeListeners[ i ] );
}
}
if ( filtered.length === 0 ) {
delete listeners[ type ];
} else {
listeners[ type ] = filtered;
}
}
};
function Event( type ) {
this.type = type;
this.target = undefined;
}
function MessageEvent( type, options ) {
Event.call( this, type );
this.data = options.data;
this.lastEventId = options.lastEventId;
}
MessageEvent.prototype = Object.create( Event.prototype );
var WAITING = -1;
var CONNECTING = 0;
var OPEN = 1;
var CLOSED = 2;
var AFTER_CR = -1;
var FIELD_START = 0;
var FIELD = 1;
var VALUE_START = 2;
var VALUE = 3;
var contentTypeRegExp = /^text\/event\-stream;?(\s*charset\=utf\-8)?$/i;
var MINIMUM_DURATION = 1000;
var MAXIMUM_DURATION = 18000000;
var parseDuration = function ( value, def ) {
var n = parseInt( value, 10 );
if ( n !== n ) {
n = def;
}
return clampDuration( n );
};
var clampDuration = function ( n ) {
return Math.min( Math.max( n, MINIMUM_DURATION ), MAXIMUM_DURATION );
};
var fire = function ( that, f, event ) {
try {
if ( typeof f === 'function' ) {
f.call( that, event );
}
} catch ( e ) {
throwError( e );
}
};
function EventSourcePolyfill( url, options ) {
EventTarget.call( this );
this.onopen = undefined;
this.onmessage = undefined;
this.onerror = undefined;
this.url = undefined;
this.readyState = undefined;
this.withCredentials = undefined;
this._close = undefined;
start( this, url, options );
}
function start( es, url, options ) {
url = String( url );
var withCredentials =
options != undefined && Boolean( options.withCredentials );
var initialRetry = clampDuration( 1000 );
var heartbeatTimeout = clampDuration( 45000 );
var lastEventId = '';
var retry = initialRetry;
var wasActivity = false;
var headers =
options != undefined && options.headers != undefined
? JSON.parse( JSON.stringify( options.headers ) )
: undefined;
var CurrentTransport =
options != undefined && options.Transport != undefined
? options.Transport
: XDomainRequest != undefined
? XDomainRequest
: XMLHttpRequest;
var transport = new XHRTransport( new CurrentTransport() );
var timeout = 0;
var currentState = WAITING;
var dataBuffer = '';
var lastEventIdBuffer = '';
var eventTypeBuffer = '';
var textBuffer = '';
var state = FIELD_START;
var fieldStart = 0;
var valueStart = 0;
var onStart = function ( status, statusText, contentType ) {
if ( currentState === CONNECTING ) {
if (
status === 200 &&
contentType != undefined &&
contentTypeRegExp.test( contentType )
) {
currentState = OPEN;
wasActivity = true;
retry = initialRetry;
es.readyState = OPEN;
var event = new Event( 'open' );
es.dispatchEvent( event );
fire( es, es.onopen, event );
} else {
var message = '';
if ( status !== 200 ) {
if ( statusText ) {
statusText = statusText.replace( /\s+/g, ' ' );
}
message =
"EventSource's response has a status " +
status +
' ' +
statusText +
' that is not 200. Aborting the connection.';
} else {
message =
"EventSource's response has a Content-Type specifying an unsupported type: " +
( contentType == undefined
? '-'
: contentType.replace( /\s+/g, ' ' ) ) +
'. Aborting the connection.';
}
throwError( new Error( message ) );
close();
var event = new Event( 'error' );
es.dispatchEvent( event );
fire( es, es.onerror, event );
}
}
};
var onProgress = function ( textChunk ) {
if ( currentState === OPEN ) {
var n = -1;
for ( var i = 0; i < textChunk.length; i += 1 ) {
var c = textChunk.charCodeAt( i );
if (
c === '\n'.charCodeAt( 0 ) ||
c === '\r'.charCodeAt( 0 )
) {
n = i;
}
}
var chunk =
( n !== -1 ? textBuffer : '' ) +
textChunk.slice( 0, n + 1 );
textBuffer =
( n === -1 ? textBuffer : '' ) + textChunk.slice( n + 1 );
if ( chunk !== '' ) {
wasActivity = true;
}
for (
var position = 0;
position < chunk.length;
position += 1
) {
var c = chunk.charCodeAt( position );
if ( state === AFTER_CR && c === '\n'.charCodeAt( 0 ) ) {
state = FIELD_START;
} else {
if ( state === AFTER_CR ) {
state = FIELD_START;
}
if (
c === '\r'.charCodeAt( 0 ) ||
c === '\n'.charCodeAt( 0 )
) {
if ( state !== FIELD_START ) {
if ( state === FIELD ) {
valueStart = position + 1;
}
var field = chunk.slice(
fieldStart,
valueStart - 1
);
var value = chunk.slice(
valueStart +
( valueStart < position &&
chunk.charCodeAt( valueStart ) ===
' '.charCodeAt( 0 )
? 1
: 0 ),
position
);
if ( field === 'data' ) {
dataBuffer += '\n';
dataBuffer += value;
} else if ( field === 'id' ) {
lastEventIdBuffer = value;
} else if ( field === 'event' ) {
eventTypeBuffer = value;
} else if ( field === 'retry' ) {
initialRetry = parseDuration(
value,
initialRetry
);
retry = initialRetry;
} else if ( field === 'heartbeatTimeout' ) {
heartbeatTimeout = parseDuration(
value,
heartbeatTimeout
);
if ( timeout !== 0 ) {
clearTimeout( timeout );
timeout = setTimeout( function () {
onTimeout();
}, heartbeatTimeout );
}
}
}
if ( state === FIELD_START ) {
if ( dataBuffer !== '' ) {
lastEventId = lastEventIdBuffer;
if ( eventTypeBuffer === '' ) {
eventTypeBuffer = 'message';
}
var event = new MessageEvent(
eventTypeBuffer,
{
data: dataBuffer.slice( 1 ),
lastEventId: lastEventIdBuffer,
}
);
es.dispatchEvent( event );
if ( eventTypeBuffer === 'message' ) {
fire( es, es.onmessage, event );
}
if ( currentState === CLOSED ) {
return;
}
}
dataBuffer = '';
eventTypeBuffer = '';
}
state =
c === '\r'.charCodeAt( 0 )
? AFTER_CR
: FIELD_START;
} else {
if ( state === FIELD_START ) {
fieldStart = position;
state = FIELD;
}
if ( state === FIELD ) {
if ( c === ':'.charCodeAt( 0 ) ) {
valueStart = position + 1;
state = VALUE_START;
}
} else if ( state === VALUE_START ) {
state = VALUE;
}
}
}
}
}
};
var onFinish = function () {
if ( currentState === OPEN || currentState === CONNECTING ) {
currentState = WAITING;
if ( timeout !== 0 ) {
clearTimeout( timeout );
timeout = 0;
}
timeout = setTimeout( function () {
onTimeout();
}, retry );
retry = clampDuration(
Math.min( initialRetry * 16, retry * 2 )
);
es.readyState = CONNECTING;
var event = new Event( 'error' );
es.dispatchEvent( event );
fire( es, es.onerror, event );
}
};
var close = function () {
currentState = CLOSED;
transport.cancel();
if ( timeout !== 0 ) {
clearTimeout( timeout );
timeout = 0;
}
es.readyState = CLOSED;
};
var onTimeout = function () {
timeout = 0;
if ( currentState !== WAITING ) {
if ( ! wasActivity ) {
throwError(
new Error(
'No activity within ' +
heartbeatTimeout +
' milliseconds. Reconnecting.'
)
);
transport.cancel();
} else {
wasActivity = false;
timeout = setTimeout( function () {
onTimeout();
}, heartbeatTimeout );
}
return;
}
wasActivity = false;
timeout = setTimeout( function () {
onTimeout();
}, heartbeatTimeout );
currentState = CONNECTING;
dataBuffer = '';
eventTypeBuffer = '';
lastEventIdBuffer = lastEventId;
textBuffer = '';
fieldStart = 0;
valueStart = 0;
state = FIELD_START;
// https://bugzilla.mozilla.org/show_bug.cgi?id=428916
// Request header field Last-Event-ID is not allowed by Access-Control-Allow-Headers.
var requestURL = url;
if (
url.slice( 0, 5 ) !== 'data:' &&
url.slice( 0, 5 ) !== 'blob:'
) {
requestURL =
url +
( url.indexOf( '?', 0 ) === -1 ? '?' : '&' ) +
'lastEventId=' +
encodeURIComponent( lastEventId );
}
var requestHeaders = {};
requestHeaders[ 'Accept' ] = 'text/event-stream';
if ( headers != undefined ) {
for ( var name in headers ) {
if (
Object.prototype.hasOwnProperty.call( headers, name )
) {
requestHeaders[ name ] = headers[ name ];
}
}
}
try {
transport.open(
onStart,
onProgress,
onFinish,
requestURL,
withCredentials,
requestHeaders
);
} catch ( error ) {
close();
throw error;
}
};
es.url = url;
es.readyState = CONNECTING;
es.withCredentials = withCredentials;
es._close = close;
onTimeout();
}
EventSourcePolyfill.prototype = Object.create( EventTarget.prototype );
EventSourcePolyfill.prototype.CONNECTING = CONNECTING;
EventSourcePolyfill.prototype.OPEN = OPEN;
EventSourcePolyfill.prototype.CLOSED = CLOSED;
EventSourcePolyfill.prototype.close = function () {
this._close();
};
EventSourcePolyfill.CONNECTING = CONNECTING;
EventSourcePolyfill.OPEN = OPEN;
EventSourcePolyfill.CLOSED = CLOSED;
EventSourcePolyfill.prototype.withCredentials = undefined;
global.EventSourcePolyfill = EventSourcePolyfill;
global.NativeEventSource = NativeEventSource;
if (
XMLHttpRequest != undefined &&
( NativeEventSource == undefined ||
! ( 'withCredentials' in NativeEventSource.prototype ) )
) {
// Why replace a native EventSource ?
// https://bugzilla.mozilla.org/show_bug.cgi?id=444328
// https://bugzilla.mozilla.org/show_bug.cgi?id=831392
// https://code.google.com/p/chromium/issues/detail?id=260144
// https://code.google.com/p/chromium/issues/detail?id=225654
// ...
global.EventSource = EventSourcePolyfill;
}
} )( typeof window !== 'undefined' ? window : this );

View File

@@ -0,0 +1,499 @@
/**
* EventSource
* https://github.com/Yaffle/EventSource
*
* Released under the MIT License (MIT)
* https://github.com/Yaffle/EventSource/blob/master/LICENSE.md
*/
! ( function ( a ) {
'use strict';
function b( a ) {
( this.withCredentials = ! 1 ),
( this.responseType = '' ),
( this.readyState = 0 ),
( this.status = 0 ),
( this.statusText = '' ),
( this.responseText = '' ),
( this.onprogress = p ),
( this.onreadystatechange = p ),
( this._contentType = '' ),
( this._xhr = a ),
( this._sendTimeout = 0 ),
( this._abort = p );
}
function c( a ) {
this._xhr = new b( a );
}
function d() {
this._listeners = Object.create( null );
}
function e( a ) {
j( function () {
throw a;
}, 0 );
}
function f( a ) {
( this.type = a ), ( this.target = void 0 );
}
function g( a, b ) {
f.call( this, a ),
( this.data = b.data ),
( this.lastEventId = b.lastEventId );
}
function h( a, b ) {
d.call( this ),
( this.onopen = void 0 ),
( this.onmessage = void 0 ),
( this.onerror = void 0 ),
( this.url = void 0 ),
( this.readyState = void 0 ),
( this.withCredentials = void 0 ),
( this._close = void 0 ),
i( this, a, b );
}
function i( a, b, d ) {
b = String( b );
var h = void 0 != d && Boolean( d.withCredentials ),
i = D( 1e3 ),
n = D( 45e3 ),
o = '',
p = i,
A = ! 1,
B =
void 0 != d && void 0 != d.headers
? JSON.parse( JSON.stringify( d.headers ) )
: void 0,
F =
void 0 != d && void 0 != d.Transport
? d.Transport
: void 0 != m
? m
: l,
G = new c( new F() ),
H = 0,
I = q,
J = '',
K = '',
L = '',
M = '',
N = v,
O = 0,
P = 0,
Q = function ( b, c, d ) {
if ( I === r )
if ( 200 === b && void 0 != d && z.test( d ) ) {
( I = s ), ( A = ! 0 ), ( p = i ), ( a.readyState = s );
var g = new f( 'open' );
a.dispatchEvent( g ), E( a, a.onopen, g );
} else {
var h = '';
200 !== b
? ( c && ( c = c.replace( /\s+/g, ' ' ) ),
( h =
"EventSource's response has a status " +
b +
' ' +
c +
' that is not 200. Aborting the connection.' ) )
: ( h =
"EventSource's response has a Content-Type specifying an unsupported type: " +
( void 0 == d
? '-'
: d.replace( /\s+/g, ' ' ) ) +
'. Aborting the connection.' ),
e( new Error( h ) ),
T();
var g = new f( 'error' );
a.dispatchEvent( g ), E( a, a.onerror, g );
}
},
R = function ( b ) {
if ( I === s ) {
for ( var c = -1, d = 0; d < b.length; d += 1 ) {
var e = b.charCodeAt( d );
( e === '\n'.charCodeAt( 0 ) ||
e === '\r'.charCodeAt( 0 ) ) &&
( c = d );
}
var f = ( -1 !== c ? M : '' ) + b.slice( 0, c + 1 );
( M = ( -1 === c ? M : '' ) + b.slice( c + 1 ) ),
'' !== f && ( A = ! 0 );
for ( var h = 0; h < f.length; h += 1 ) {
var e = f.charCodeAt( h );
if ( N === u && e === '\n'.charCodeAt( 0 ) ) N = v;
else if (
( N === u && ( N = v ),
e === '\r'.charCodeAt( 0 ) ||
e === '\n'.charCodeAt( 0 ) )
) {
if ( N !== v ) {
N === w && ( P = h + 1 );
var l = f.slice( O, P - 1 ),
m = f.slice(
P +
( h > P &&
f.charCodeAt( P ) ===
' '.charCodeAt( 0 )
? 1
: 0 ),
h
);
'data' === l
? ( ( J += '\n' ), ( J += m ) )
: 'id' === l
? ( K = m )
: 'event' === l
? ( L = m )
: 'retry' === l
? ( ( i = C( m, i ) ), ( p = i ) )
: 'heartbeatTimeout' === l &&
( ( n = C( m, n ) ),
0 !== H &&
( k( H ),
( H = j( function () {
U();
}, n ) ) ) );
}
if ( N === v ) {
if ( '' !== J ) {
( o = K ), '' === L && ( L = 'message' );
var q = new g( L, {
data: J.slice( 1 ),
lastEventId: K,
} );
if (
( a.dispatchEvent( q ),
'message' === L &&
E( a, a.onmessage, q ),
I === t )
)
return;
}
( J = '' ), ( L = '' );
}
N = e === '\r'.charCodeAt( 0 ) ? u : v;
} else
N === v && ( ( O = h ), ( N = w ) ),
N === w
? e === ':'.charCodeAt( 0 ) &&
( ( P = h + 1 ), ( N = x ) )
: N === x && ( N = y );
}
}
},
S = function () {
if ( I === s || I === r ) {
( I = q ),
0 !== H && ( k( H ), ( H = 0 ) ),
( H = j( function () {
U();
}, p ) ),
( p = D( Math.min( 16 * i, 2 * p ) ) ),
( a.readyState = r );
var b = new f( 'error' );
a.dispatchEvent( b ), E( a, a.onerror, b );
}
},
T = function () {
( I = t ),
G.cancel(),
0 !== H && ( k( H ), ( H = 0 ) ),
( a.readyState = t );
},
U = function () {
if ( ( ( H = 0 ), I !== q ) )
return void ( A
? ( ( A = ! 1 ),
( H = j( function () {
U();
}, n ) ) )
: ( e(
new Error(
'No activity within ' +
n +
' milliseconds. Reconnecting.'
)
),
G.cancel() ) );
( A = ! 1 ),
( H = j( function () {
U();
}, n ) ),
( I = r ),
( J = '' ),
( L = '' ),
( K = o ),
( M = '' ),
( O = 0 ),
( P = 0 ),
( N = v );
var a = b;
'data:' !== b.slice( 0, 5 ) &&
'blob:' !== b.slice( 0, 5 ) &&
( a =
b +
( -1 === b.indexOf( '?', 0 ) ? '?' : '&' ) +
'lastEventId=' +
encodeURIComponent( o ) );
var c = {};
if ( ( ( c.Accept = 'text/event-stream' ), void 0 != B ) )
for ( var d in B )
Object.prototype.hasOwnProperty.call( B, d ) &&
( c[ d ] = B[ d ] );
try {
G.open( Q, R, S, a, h, c );
} catch ( f ) {
throw ( T(), f );
}
};
( a.url = b ),
( a.readyState = r ),
( a.withCredentials = h ),
( a._close = T ),
U();
}
var j = a.setTimeout,
k = a.clearTimeout,
l = a.XMLHttpRequest,
m = a.XDomainRequest,
n = a.EventSource,
o = a.document;
null == Object.create &&
( Object.create = function ( a ) {
function b() {}
return ( b.prototype = a ), new b();
} );
var p = function () {};
( b.prototype.open = function ( a, b ) {
this._abort( ! 0 );
var c = this,
d = this._xhr,
e = 1,
f = 0;
this._abort = function ( a ) {
0 !== c._sendTimeout &&
( k( c._sendTimeout ), ( c._sendTimeout = 0 ) ),
( 1 === e || 2 === e || 3 === e ) &&
( ( e = 4 ),
( d.onload = p ),
( d.onerror = p ),
( d.onabort = p ),
( d.onprogress = p ),
( d.onreadystatechange = p ),
d.abort(),
0 !== f && ( k( f ), ( f = 0 ) ),
a || ( ( c.readyState = 4 ), c.onreadystatechange() ) ),
( e = 0 );
};
var g = function () {
if ( 1 === e ) {
var a = 0,
b = '',
f = void 0;
if ( 'contentType' in d )
( a = 200 ), ( b = 'OK' ), ( f = d.contentType );
else
try {
( a = d.status ),
( b = d.statusText ),
( f = d.getResponseHeader( 'Content-Type' ) );
} catch ( g ) {
( a = 0 ), ( b = '' ), ( f = void 0 );
}
0 !== a &&
( ( e = 2 ),
( c.readyState = 2 ),
( c.status = a ),
( c.statusText = b ),
( c._contentType = f ),
c.onreadystatechange() );
}
},
h = function () {
if ( ( g(), 2 === e || 3 === e ) ) {
e = 3;
var a = '';
try {
a = d.responseText;
} catch ( b ) {}
( c.readyState = 3 ),
( c.responseText = a ),
c.onprogress();
}
},
i = function () {
h(),
( 1 === e || 2 === e || 3 === e ) &&
( ( e = 4 ),
0 !== f && ( k( f ), ( f = 0 ) ),
( c.readyState = 4 ),
c.onreadystatechange() );
},
m = function () {
void 0 != d &&
( 4 === d.readyState
? i()
: 3 === d.readyState
? h()
: 2 === d.readyState && g() );
},
n = function () {
( f = j( function () {
n();
}, 500 ) ),
3 === d.readyState && h();
};
( d.onload = i ),
( d.onerror = i ),
( d.onabort = i ),
'sendAsBinary' in l.prototype ||
'mozAnon' in l.prototype ||
( d.onprogress = h ),
( d.onreadystatechange = m ),
'contentType' in d &&
( b +=
( -1 === b.indexOf( '?', 0 ) ? '?' : '&' ) +
'padding=true' ),
d.open( a, b, ! 0 ),
'readyState' in d &&
( f = j( function () {
n();
}, 0 ) );
} ),
( b.prototype.abort = function () {
this._abort( ! 1 );
} ),
( b.prototype.getResponseHeader = function ( a ) {
return this._contentType;
} ),
( b.prototype.setRequestHeader = function ( a, b ) {
var c = this._xhr;
'setRequestHeader' in c && c.setRequestHeader( a, b );
} ),
( b.prototype.send = function () {
if (
! ( 'ontimeout' in l.prototype ) &&
void 0 != o &&
void 0 != o.readyState &&
'complete' !== o.readyState
) {
var a = this;
return void ( a._sendTimeout = j( function () {
( a._sendTimeout = 0 ), a.send();
}, 4 ) );
}
var b = this._xhr;
( b.withCredentials = this.withCredentials ),
( b.responseType = this.responseType );
try {
b.send( void 0 );
} catch ( c ) {
throw c;
}
} ),
( c.prototype.open = function ( a, b, c, d, e, f ) {
var g = this._xhr;
g.open( 'GET', d );
var h = 0;
( g.onprogress = function () {
var a = g.responseText,
c = a.slice( h );
( h += c.length ), b( c );
} ),
( g.onreadystatechange = function () {
if ( 2 === g.readyState ) {
var b = g.status,
d = g.statusText,
e = g.getResponseHeader( 'Content-Type' );
a( b, d, e );
} else 4 === g.readyState && c();
} ),
( g.withCredentials = e ),
( g.responseType = 'text' );
for ( var i in f )
Object.prototype.hasOwnProperty.call( f, i ) &&
g.setRequestHeader( i, f[ i ] );
g.send();
} ),
( c.prototype.cancel = function () {
var a = this._xhr;
a.abort();
} ),
( d.prototype.dispatchEvent = function ( a ) {
a.target = this;
var b = this._listeners[ a.type ];
if ( void 0 != b )
for ( var c = b.length, d = 0; c > d; d += 1 ) {
var f = b[ d ];
try {
'function' == typeof f.handleEvent
? f.handleEvent( a )
: f.call( this, a );
} catch ( g ) {
e( g );
}
}
} ),
( d.prototype.addEventListener = function ( a, b ) {
a = String( a );
var c = this._listeners,
d = c[ a ];
void 0 == d && ( ( d = [] ), ( c[ a ] = d ) );
for ( var e = ! 1, f = 0; f < d.length; f += 1 )
d[ f ] === b && ( e = ! 0 );
e || d.push( b );
} ),
( d.prototype.removeEventListener = function ( a, b ) {
a = String( a );
var c = this._listeners,
d = c[ a ];
if ( void 0 != d ) {
for ( var e = [], f = 0; f < d.length; f += 1 )
d[ f ] !== b && e.push( d[ f ] );
0 === e.length ? delete c[ a ] : ( c[ a ] = e );
}
} ),
( g.prototype = Object.create( f.prototype ) );
var q = -1,
r = 0,
s = 1,
t = 2,
u = -1,
v = 0,
w = 1,
x = 2,
y = 3,
z = /^text\/event\-stream;?(\s*charset\=utf\-8)?$/i,
A = 1e3,
B = 18e6,
C = function ( a, b ) {
var c = parseInt( a, 10 );
return c !== c && ( c = b ), D( c );
},
D = function ( a ) {
return Math.min( Math.max( a, A ), B );
},
E = function ( a, b, c ) {
try {
'function' == typeof b && b.call( a, c );
} catch ( d ) {
e( d );
}
};
( h.prototype = Object.create( d.prototype ) ),
( h.prototype.CONNECTING = r ),
( h.prototype.OPEN = s ),
( h.prototype.CLOSED = t ),
( h.prototype.close = function () {
this._close();
} ),
( h.CONNECTING = r ),
( h.OPEN = s ),
( h.CLOSED = t ),
( h.prototype.withCredentials = void 0 ),
( a.EventSourcePolyfill = h ),
( a.NativeEventSource = n ),
void 0 == l ||
( void 0 != n && 'withCredentials' in n.prototype ) ||
( a.EventSource = h );
} )( 'undefined' != typeof window ? window : this );

View File

@@ -0,0 +1,590 @@
/**
* Fetch
* https://github.com/github/fetch
*
* Released under the MIT License (MIT)
* https://github.com/github/fetch/blob/master/LICENSE
*/
( function ( global, factory ) {
typeof exports === 'object' && typeof module !== 'undefined'
? factory( exports )
: typeof define === 'function' && define.amd
? define( [ 'exports' ], factory )
: factory( ( global.WHATWGFetch = {} ) );
} )( this, function ( exports ) {
'use strict';
var support = {
searchParams: 'URLSearchParams' in self,
iterable: 'Symbol' in self && 'iterator' in Symbol,
blob:
'FileReader' in self &&
'Blob' in self &&
( function () {
try {
new Blob();
return true;
} catch ( e ) {
return false;
}
} )(),
formData: 'FormData' in self,
arrayBuffer: 'ArrayBuffer' in self,
};
function isDataView( obj ) {
return obj && DataView.prototype.isPrototypeOf( obj );
}
if ( support.arrayBuffer ) {
var viewClasses = [
'[object Int8Array]',
'[object Uint8Array]',
'[object Uint8ClampedArray]',
'[object Int16Array]',
'[object Uint16Array]',
'[object Int32Array]',
'[object Uint32Array]',
'[object Float32Array]',
'[object Float64Array]',
];
var isArrayBufferView =
ArrayBuffer.isView ||
function ( obj ) {
return (
obj &&
viewClasses.indexOf(
Object.prototype.toString.call( obj )
) > -1
);
};
}
function normalizeName( name ) {
if ( typeof name !== 'string' ) {
name = String( name );
}
if ( /[^a-z0-9\-#$%&'*+.^_`|~]/i.test( name ) ) {
throw new TypeError( 'Invalid character in header field name' );
}
return name.toLowerCase();
}
function normalizeValue( value ) {
if ( typeof value !== 'string' ) {
value = String( value );
}
return value;
}
// Build a destructive iterator for the value list
function iteratorFor( items ) {
var iterator = {
next: function () {
var value = items.shift();
return { done: value === undefined, value: value };
},
};
if ( support.iterable ) {
iterator[ Symbol.iterator ] = function () {
return iterator;
};
}
return iterator;
}
function Headers( headers ) {
this.map = {};
if ( headers instanceof Headers ) {
headers.forEach( function ( value, name ) {
this.append( name, value );
}, this );
} else if ( Array.isArray( headers ) ) {
headers.forEach( function ( header ) {
this.append( header[ 0 ], header[ 1 ] );
}, this );
} else if ( headers ) {
Object.getOwnPropertyNames( headers ).forEach( function ( name ) {
this.append( name, headers[ name ] );
}, this );
}
}
Headers.prototype.append = function ( name, value ) {
name = normalizeName( name );
value = normalizeValue( value );
var oldValue = this.map[ name ];
this.map[ name ] = oldValue ? oldValue + ', ' + value : value;
};
Headers.prototype[ 'delete' ] = function ( name ) {
delete this.map[ normalizeName( name ) ];
};
Headers.prototype.get = function ( name ) {
name = normalizeName( name );
return this.has( name ) ? this.map[ name ] : null;
};
Headers.prototype.has = function ( name ) {
return this.map.hasOwnProperty( normalizeName( name ) );
};
Headers.prototype.set = function ( name, value ) {
this.map[ normalizeName( name ) ] = normalizeValue( value );
};
Headers.prototype.forEach = function ( callback, thisArg ) {
for ( var name in this.map ) {
if ( this.map.hasOwnProperty( name ) ) {
callback.call( thisArg, this.map[ name ], name, this );
}
}
};
Headers.prototype.keys = function () {
var items = [];
this.forEach( function ( value, name ) {
items.push( name );
} );
return iteratorFor( items );
};
Headers.prototype.values = function () {
var items = [];
this.forEach( function ( value ) {
items.push( value );
} );
return iteratorFor( items );
};
Headers.prototype.entries = function () {
var items = [];
this.forEach( function ( value, name ) {
items.push( [ name, value ] );
} );
return iteratorFor( items );
};
if ( support.iterable ) {
Headers.prototype[ Symbol.iterator ] = Headers.prototype.entries;
}
function consumed( body ) {
if ( body.bodyUsed ) {
return Promise.reject( new TypeError( 'Already read' ) );
}
body.bodyUsed = true;
}
function fileReaderReady( reader ) {
return new Promise( function ( resolve, reject ) {
reader.onload = function () {
resolve( reader.result );
};
reader.onerror = function () {
reject( reader.error );
};
} );
}
function readBlobAsArrayBuffer( blob ) {
var reader = new FileReader();
var promise = fileReaderReady( reader );
reader.readAsArrayBuffer( blob );
return promise;
}
function readBlobAsText( blob ) {
var reader = new FileReader();
var promise = fileReaderReady( reader );
reader.readAsText( blob );
return promise;
}
function readArrayBufferAsText( buf ) {
var view = new Uint8Array( buf );
var chars = new Array( view.length );
for ( var i = 0; i < view.length; i++ ) {
chars[ i ] = String.fromCharCode( view[ i ] );
}
return chars.join( '' );
}
function bufferClone( buf ) {
if ( buf.slice ) {
return buf.slice( 0 );
} else {
var view = new Uint8Array( buf.byteLength );
view.set( new Uint8Array( buf ) );
return view.buffer;
}
}
function Body() {
this.bodyUsed = false;
this._initBody = function ( body ) {
this._bodyInit = body;
if ( ! body ) {
this._bodyText = '';
} else if ( typeof body === 'string' ) {
this._bodyText = body;
} else if ( support.blob && Blob.prototype.isPrototypeOf( body ) ) {
this._bodyBlob = body;
} else if (
support.formData &&
FormData.prototype.isPrototypeOf( body )
) {
this._bodyFormData = body;
} else if (
support.searchParams &&
URLSearchParams.prototype.isPrototypeOf( body )
) {
this._bodyText = body.toString();
} else if (
support.arrayBuffer &&
support.blob &&
isDataView( body )
) {
this._bodyArrayBuffer = bufferClone( body.buffer );
// IE 10-11 can't handle a DataView body.
this._bodyInit = new Blob( [ this._bodyArrayBuffer ] );
} else if (
support.arrayBuffer &&
( ArrayBuffer.prototype.isPrototypeOf( body ) ||
isArrayBufferView( body ) )
) {
this._bodyArrayBuffer = bufferClone( body );
} else {
this._bodyText = body = Object.prototype.toString.call( body );
}
if ( ! this.headers.get( 'content-type' ) ) {
if ( typeof body === 'string' ) {
this.headers.set(
'content-type',
'text/plain;charset=UTF-8'
);
} else if ( this._bodyBlob && this._bodyBlob.type ) {
this.headers.set( 'content-type', this._bodyBlob.type );
} else if (
support.searchParams &&
URLSearchParams.prototype.isPrototypeOf( body )
) {
this.headers.set(
'content-type',
'application/x-www-form-urlencoded;charset=UTF-8'
);
}
}
};
if ( support.blob ) {
this.blob = function () {
var rejected = consumed( this );
if ( rejected ) {
return rejected;
}
if ( this._bodyBlob ) {
return Promise.resolve( this._bodyBlob );
} else if ( this._bodyArrayBuffer ) {
return Promise.resolve(
new Blob( [ this._bodyArrayBuffer ] )
);
} else if ( this._bodyFormData ) {
throw new Error( 'could not read FormData body as blob' );
} else {
return Promise.resolve( new Blob( [ this._bodyText ] ) );
}
};
this.arrayBuffer = function () {
if ( this._bodyArrayBuffer ) {
return (
consumed( this ) ||
Promise.resolve( this._bodyArrayBuffer )
);
} else {
return this.blob().then( readBlobAsArrayBuffer );
}
};
}
this.text = function () {
var rejected = consumed( this );
if ( rejected ) {
return rejected;
}
if ( this._bodyBlob ) {
return readBlobAsText( this._bodyBlob );
} else if ( this._bodyArrayBuffer ) {
return Promise.resolve(
readArrayBufferAsText( this._bodyArrayBuffer )
);
} else if ( this._bodyFormData ) {
throw new Error( 'could not read FormData body as text' );
} else {
return Promise.resolve( this._bodyText );
}
};
if ( support.formData ) {
this.formData = function () {
return this.text().then( decode );
};
}
this.json = function () {
return this.text().then( JSON.parse );
};
return this;
}
// HTTP methods whose capitalization should be normalized
var methods = [ 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT' ];
function normalizeMethod( method ) {
var upcased = method.toUpperCase();
return methods.indexOf( upcased ) > -1 ? upcased : method;
}
function Request( input, options ) {
options = options || {};
var body = options.body;
if ( input instanceof Request ) {
if ( input.bodyUsed ) {
throw new TypeError( 'Already read' );
}
this.url = input.url;
this.credentials = input.credentials;
if ( ! options.headers ) {
this.headers = new Headers( input.headers );
}
this.method = input.method;
this.mode = input.mode;
this.signal = input.signal;
if ( ! body && input._bodyInit != null ) {
body = input._bodyInit;
input.bodyUsed = true;
}
} else {
this.url = String( input );
}
this.credentials =
options.credentials || this.credentials || 'same-origin';
if ( options.headers || ! this.headers ) {
this.headers = new Headers( options.headers );
}
this.method = normalizeMethod( options.method || this.method || 'GET' );
this.mode = options.mode || this.mode || null;
this.signal = options.signal || this.signal;
this.referrer = null;
if ( ( this.method === 'GET' || this.method === 'HEAD' ) && body ) {
throw new TypeError( 'Body not allowed for GET or HEAD requests' );
}
this._initBody( body );
}
Request.prototype.clone = function () {
return new Request( this, { body: this._bodyInit } );
};
function decode( body ) {
var form = new FormData();
body.trim()
.split( '&' )
.forEach( function ( bytes ) {
if ( bytes ) {
var split = bytes.split( '=' );
var name = split.shift().replace( /\+/g, ' ' );
var value = split.join( '=' ).replace( /\+/g, ' ' );
form.append(
decodeURIComponent( name ),
decodeURIComponent( value )
);
}
} );
return form;
}
function parseHeaders( rawHeaders ) {
var headers = new Headers();
// Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
// https://tools.ietf.org/html/rfc7230#section-3.2
var preProcessedHeaders = rawHeaders.replace( /\r?\n[\t ]+/g, ' ' );
preProcessedHeaders.split( /\r?\n/ ).forEach( function ( line ) {
var parts = line.split( ':' );
var key = parts.shift().trim();
if ( key ) {
var value = parts.join( ':' ).trim();
headers.append( key, value );
}
} );
return headers;
}
Body.call( Request.prototype );
function Response( bodyInit, options ) {
if ( ! options ) {
options = {};
}
this.type = 'default';
this.status = options.status === undefined ? 200 : options.status;
this.ok = this.status >= 200 && this.status < 300;
this.statusText = 'statusText' in options ? options.statusText : 'OK';
this.headers = new Headers( options.headers );
this.url = options.url || '';
this._initBody( bodyInit );
}
Body.call( Response.prototype );
Response.prototype.clone = function () {
return new Response( this._bodyInit, {
status: this.status,
statusText: this.statusText,
headers: new Headers( this.headers ),
url: this.url,
} );
};
Response.error = function () {
var response = new Response( null, { status: 0, statusText: '' } );
response.type = 'error';
return response;
};
var redirectStatuses = [ 301, 302, 303, 307, 308 ];
Response.redirect = function ( url, status ) {
if ( redirectStatuses.indexOf( status ) === -1 ) {
throw new RangeError( 'Invalid status code' );
}
return new Response( null, {
status: status,
headers: { location: url },
} );
};
exports.DOMException = self.DOMException;
try {
new exports.DOMException();
} catch ( err ) {
exports.DOMException = function ( message, name ) {
this.message = message;
this.name = name;
var error = Error( message );
this.stack = error.stack;
};
exports.DOMException.prototype = Object.create( Error.prototype );
exports.DOMException.prototype.constructor = exports.DOMException;
}
function fetch( input, init ) {
return new Promise( function ( resolve, reject ) {
var request = new Request( input, init );
if ( request.signal && request.signal.aborted ) {
return reject(
new exports.DOMException( 'Aborted', 'AbortError' )
);
}
var xhr = new XMLHttpRequest();
function abortXhr() {
xhr.abort();
}
xhr.onload = function () {
var options = {
status: xhr.status,
statusText: xhr.statusText,
headers: parseHeaders( xhr.getAllResponseHeaders() || '' ),
};
options.url =
'responseURL' in xhr
? xhr.responseURL
: options.headers.get( 'X-Request-URL' );
var body = 'response' in xhr ? xhr.response : xhr.responseText;
resolve( new Response( body, options ) );
};
xhr.onerror = function () {
reject( new TypeError( 'Network request failed' ) );
};
xhr.ontimeout = function () {
reject( new TypeError( 'Network request failed' ) );
};
xhr.onabort = function () {
reject( new exports.DOMException( 'Aborted', 'AbortError' ) );
};
xhr.open( request.method, request.url, true );
if ( request.credentials === 'include' ) {
xhr.withCredentials = true;
} else if ( request.credentials === 'omit' ) {
xhr.withCredentials = false;
}
if ( 'responseType' in xhr && support.blob ) {
xhr.responseType = 'blob';
}
request.headers.forEach( function ( value, name ) {
xhr.setRequestHeader( name, value );
} );
if ( request.signal ) {
request.signal.addEventListener( 'abort', abortXhr );
xhr.onreadystatechange = function () {
// DONE (success or failure)
if ( xhr.readyState === 4 ) {
request.signal.removeEventListener( 'abort', abortXhr );
}
};
}
xhr.send(
typeof request._bodyInit === 'undefined'
? null
: request._bodyInit
);
} );
}
fetch.polyfill = true;
if ( ! self.fetch ) {
self.fetch = fetch;
self.Headers = Headers;
self.Request = Request;
self.Response = Response;
}
exports.Headers = Headers;
exports.Request = Request;
exports.Response = Response;
exports.fetch = fetch;
Object.defineProperty( exports, '__esModule', { value: true } );
} );

View File

@@ -0,0 +1,348 @@
'use strict';
function _defineProperty( obj, key, value ) {
if ( key in obj ) {
Object.defineProperty( obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true,
} );
} else {
obj[ key ] = value;
}
return obj;
}
function _slicedToArray( arr, i ) {
return (
_arrayWithHoles( arr ) ||
_iterableToArrayLimit( arr, i ) ||
_nonIterableRest()
);
}
function _nonIterableRest() {
throw new TypeError(
'Invalid attempt to destructure non-iterable instance'
);
}
function _iterableToArrayLimit( arr, i ) {
var _arr = [];
var _n = true;
var _d = false;
var _e = undefined;
try {
for (
var _i = arr[ Symbol.iterator ](), _s;
! ( _n = ( _s = _i.next() ).done );
_n = true
) {
_arr.push( _s.value );
if ( i && _arr.length === i ) break;
}
} catch ( err ) {
_d = true;
_e = err;
} finally {
try {
if ( ! _n && _i[ 'return' ] != null ) _i[ 'return' ]();
} finally {
if ( _d ) throw _e;
}
}
return _arr;
}
function _arrayWithHoles( arr ) {
if ( Array.isArray( arr ) ) return arr;
}
var PHP = {
stdClass: function stdClass() {},
stringify: function stringify( val ) {
var hash = new Map( [
[ Infinity, 'd:INF;' ],
[ -Infinity, 'd:-INF;' ],
[ NaN, 'd:NAN;' ],
[ null, 'N;' ],
[ undefined, 'N;' ],
] );
var utf8length = function utf8length( str ) {
return str ? encodeURI( str ).match( /(%.)?./g ).length : 0;
};
var serializeString = function serializeString( s ) {
var delim =
arguments.length > 1 && arguments[ 1 ] !== undefined
? arguments[ 1 ]
: '"';
return ''
.concat( utf8length( s ), ':' )
.concat( delim[ 0 ] )
.concat( s )
.concat( delim[ delim.length - 1 ] );
};
var ref = 0;
function serialize( val ) {
var canReference =
arguments.length > 1 && arguments[ 1 ] !== undefined
? arguments[ 1 ]
: true;
if ( hash.has( val ) ) return hash.get( val );
ref += canReference;
if ( typeof val === 'string' )
return 's:'.concat( serializeString( val ), ';' );
if ( typeof val === 'number' )
return ''
.concat( Math.round( val ) === val ? 'i' : 'd', ':' )
.concat(
( '' + val )
.toUpperCase()
.replace( /(-?\d)E/, '$1.0E' ),
';'
);
if ( typeof val === 'boolean' ) return 'b:'.concat( +val, ';' );
var a = Array.isArray( val ) || val.constructor === Object;
hash.set( val, ''.concat( 'rR'[ +a ], ':' ).concat( ref, ';' ) );
if ( typeof val.serialize === 'function' ) {
return 'C:'
.concat( serializeString( val.constructor.name ), ':' )
.concat( serializeString( val.serialize(), '{}' ) );
}
var vals = Object.entries( val ).filter( function ( _ref ) {
var _ref2 = _slicedToArray( _ref, 2 ),
k = _ref2[ 0 ],
v = _ref2[ 1 ];
return typeof v !== 'function';
} );
return (
( a
? 'a'
: 'O:'.concat( serializeString( val.constructor.name ) ) ) +
':'.concat( vals.length, ':{' ).concat(
vals
.map( function ( _ref3 ) {
var _ref4 = _slicedToArray( _ref3, 2 ),
k = _ref4[ 0 ],
v = _ref4[ 1 ];
return (
serialize(
a && /^\d{1,16}$/.test( k ) ? +k : k,
false
) + serialize( v )
);
} )
.join( '' ),
'}'
)
);
}
return serialize( val );
},
// Provide in second argument the classes that may be instantiated
// e.g. { MyClass1, MyClass2 }
parse: function parse( str ) {
var allowedClasses =
arguments.length > 1 && arguments[ 1 ] !== undefined
? arguments[ 1 ]
: {};
allowedClasses.stdClass = PHP.stdClass; // Always allowed.
var offset = 0;
var values = [ null ];
var specialNums = {
INF: Infinity,
'-INF': -Infinity,
NAN: NaN,
};
var kick = function kick( msg ) {
var i =
arguments.length > 1 && arguments[ 1 ] !== undefined
? arguments[ 1 ]
: offset;
throw new Error(
'Error at '
.concat( i, ': ' )
.concat( msg, '\n' )
.concat( str, '\n' )
.concat( ' '.repeat( i ), '^' )
);
};
var read = function read( expected, ret ) {
return expected ===
str.slice( offset, ( offset += expected.length ) )
? ret
: kick(
"Expected '".concat( expected, "'" ),
offset - expected.length
);
};
function readMatch( regex, msg ) {
var terminator =
arguments.length > 2 && arguments[ 2 ] !== undefined
? arguments[ 2 ]
: ';';
read( ':' );
var match = regex.exec( str.slice( offset ) );
if ( ! match )
kick(
'Exected '
.concat( msg, ", but got '" )
.concat(
str
.slice( offset )
.match( /^[:;{}]|[^:;{}]*/ )[ 0 ],
"'"
)
);
offset += match[ 0 ].length;
return read( terminator, match[ 0 ] );
}
function readUtf8chars( numUtf8Bytes ) {
var terminator =
arguments.length > 1 && arguments[ 1 ] !== undefined
? arguments[ 1 ]
: '';
var i = offset;
while ( numUtf8Bytes > 0 ) {
var code = str.charCodeAt( offset++ );
numUtf8Bytes -=
code < 0x80
? 1
: code < 0x800 || code >> 11 === 0x1b
? 2
: 3;
}
return numUtf8Bytes
? kick( 'Invalid string length', i - 2 )
: read( terminator, str.slice( i, offset ) );
}
var create = function create( className ) {
return ! className
? {}
: allowedClasses[ className ]
? Object.create( allowedClasses[ className ].prototype )
: new ( _defineProperty( {}, className, function () {} )[
className
] )();
}; // Create a mock class for this name
var readBoolean = function readBoolean() {
return readMatch( /^[01]/, "a '0' or '1'", ';' );
};
var readInt = function readInt() {
return +readMatch( /^-?\d+/, 'an integer', ';' );
};
var readUInt = function readUInt( terminator ) {
return +readMatch( /^\d+/, 'an unsigned integer', terminator );
};
var readString = function readString() {
var terminator =
arguments.length > 0 && arguments[ 0 ] !== undefined
? arguments[ 0 ]
: '';
return readUtf8chars( readUInt( ':"' ), '"' + terminator );
};
function readDecimal() {
var num = readMatch(
/^-?(\d+(\.\d+)?(E[+-]\d+)?|INF)|NAN/,
'a decimal number',
';'
);
return num in specialNums ? specialNums[ num ] : +num;
}
function readKey() {
var typ = str[ offset++ ];
return typ === 's'
? readString( ';' )
: typ === 'i'
? readUInt( ';' )
: kick(
"Expected 's' or 'i' as type for a key, but got ${str[offset-1]}",
offset - 1
);
}
function readObject( obj ) {
for ( var i = 0, length = readUInt( ':{' ); i < length; i++ ) {
obj[ readKey() ] = readValue();
}
return read( '}', obj );
}
function readArray() {
var obj = readObject( {} );
return Object.keys( obj ).some( function ( key, i ) {
return key != i;
} )
? obj
: Object.values( obj );
}
function readCustomObject( obj ) {
if ( typeof obj.unserialize !== 'function' )
kick(
'Instance of '.concat(
obj.constructor.name,
' does not have an "unserialize" method'
)
);
obj.unserialize( readUtf8chars( readUInt( ':{' ) ) );
return read( '}', obj );
}
function readValue() {
var typ = str[ offset++ ].toLowerCase();
var ref = values.push( null ) - 1;
var val =
typ === 'n'
? read( ';', null )
: typ === 's'
? readString( ';' )
: typ === 'b'
? readBoolean()
: typ === 'i'
? readInt()
: typ === 'd'
? readDecimal()
: typ === 'a'
? readArray() // Associative array
: typ === 'o'
? readObject( create( readString() ) ) // Object
: typ === 'c'
? readCustomObject( create( readString() ) ) // Custom serialized object
: typ === 'r'
? values[ readInt() ] // Backreference
: kick( 'Unexpected type '.concat( typ ), offset - 1 );
if ( typ !== 'r' ) values[ ref ] = val;
return val;
}
var val = readValue();
if ( offset !== str.length ) kick( 'Unexpected trailing character' );
return val;
},
};

View File

@@ -0,0 +1,988 @@
/**
* History.js
* https://github.com/browserstate/history.js
*
* Copyright © 2014+ Bevry Pty Ltd us@bevry.me (http://bevry.me)
* Copyright © 2011-2013 Benjamin Lupton b@lupton.cc (http://balupton.com)
* Released under the BSD License
* https://github.com/browserstate/history.js/blob/master/LICENSE.md
*/
( function ( e, t ) {
'use strict';
var n = ( e.History = e.History || {} ),
r = e.jQuery;
if ( typeof n.Adapter != 'undefined' )
throw new Error( 'History.js Adapter has already been loaded...' );
( n.Adapter = {
bind: function ( e, t, n ) {
r( e ).bind( t, n );
},
trigger: function ( e, t, n ) {
r( e ).trigger( t, n );
},
extractEventData: function ( e, n, r ) {
var i =
( n && n.originalEvent && n.originalEvent[ e ] ) ||
( r && r[ e ] ) ||
t;
return i;
},
onDomLoad: function ( e ) {
r( e );
},
} ),
typeof n.init != 'undefined' && n.init();
} )( window ),
( function ( e, t ) {
'use strict';
var n = e.console || t,
r = e.document,
i = e.navigator,
s = ! 1,
o = e.setTimeout,
u = e.clearTimeout,
a = e.setInterval,
f = e.clearInterval,
l = e.JSON,
c = e.alert,
h = ( e.History = e.History || {} ),
p = e.history;
try {
( s = e.sessionStorage ),
s.setItem( 'TEST', '1' ),
s.removeItem( 'TEST' );
} catch ( d ) {
s = ! 1;
}
( l.stringify = l.stringify || l.encode ),
( l.parse = l.parse || l.decode );
if ( typeof h.init != 'undefined' )
throw new Error( 'History.js Core has already been loaded...' );
( h.init = function ( e ) {
return typeof h.Adapter == 'undefined'
? ! 1
: ( typeof h.initCore != 'undefined' && h.initCore(),
typeof h.initHtml4 != 'undefined' && h.initHtml4(),
! 0 );
} ),
( h.initCore = function ( d ) {
if ( typeof h.initCore.initialized != 'undefined' ) return ! 1;
( h.initCore.initialized = ! 0 ),
( h.options = h.options || {} ),
( h.options.hashChangeInterval =
h.options.hashChangeInterval || 100 ),
( h.options.safariPollInterval =
h.options.safariPollInterval || 500 ),
( h.options.doubleCheckInterval =
h.options.doubleCheckInterval || 500 ),
( h.options.disableSuid = h.options.disableSuid || ! 1 ),
( h.options.storeInterval =
h.options.storeInterval || 1e3 ),
( h.options.busyDelay = h.options.busyDelay || 250 ),
( h.options.debug = h.options.debug || ! 1 ),
( h.options.initialTitle =
h.options.initialTitle || r.title ),
( h.options.html4Mode = h.options.html4Mode || ! 1 ),
( h.options.delayInit = h.options.delayInit || ! 1 ),
( h.intervalList = [] ),
( h.clearAllIntervals = function () {
var e,
t = h.intervalList;
if ( typeof t != 'undefined' && t !== null ) {
for ( e = 0; e < t.length; e++ ) f( t[ e ] );
h.intervalList = null;
}
} ),
( h.debug = function () {
( h.options.debug || ! 1 ) &&
h.log.apply( h, arguments );
} ),
( h.log = function () {
var e =
typeof n != 'undefined' &&
typeof n.log != 'undefined' &&
typeof n.log.apply != 'undefined',
t = r.getElementById( 'log' ),
i,
s,
o,
u,
a;
e
? ( ( u = Array.prototype.slice.call( arguments ) ),
( i = u.shift() ),
typeof n.debug != 'undefined'
? n.debug.apply( n, [ i, u ] )
: n.log.apply( n, [ i, u ] ) )
: ( i = '\n' + arguments[ 0 ] + '\n' );
for ( s = 1, o = arguments.length; s < o; ++s ) {
a = arguments[ s ];
if (
typeof a == 'object' &&
typeof l != 'undefined'
)
try {
a = l.stringify( a );
} catch ( f ) {}
i += '\n' + a + '\n';
}
return (
t
? ( ( t.value += i + '\n-----\n' ),
( t.scrollTop =
t.scrollHeight - t.clientHeight ) )
: e || c( i ),
! 0
);
} ),
( h.getInternetExplorerMajorVersion = function () {
var e = ( h.getInternetExplorerMajorVersion.cached =
typeof h.getInternetExplorerMajorVersion.cached !=
'undefined'
? h.getInternetExplorerMajorVersion.cached
: ( function () {
var e = 3,
t = r.createElement( 'div' ),
n = t.getElementsByTagName( 'i' );
while (
( t.innerHTML =
'<!--[if gt IE ' +
++e +
']><i></i><![endif]-->' ) &&
n[ 0 ]
);
return e > 4 ? e : ! 1;
} )() );
return e;
} ),
( h.isInternetExplorer = function () {
var e = ( h.isInternetExplorer.cached =
typeof h.isInternetExplorer.cached != 'undefined'
? h.isInternetExplorer.cached
: Boolean(
h.getInternetExplorerMajorVersion()
) );
return e;
} ),
h.options.html4Mode
? ( h.emulated = { pushState: ! 0, hashChange: ! 0 } )
: ( h.emulated = {
pushState: ! Boolean(
e.history &&
e.history.pushState &&
e.history.replaceState &&
! / Mobile\/([1-7][a-z]|(8([abcde]|f(1[0-8]))))/i.test(
i.userAgent
) &&
! /AppleWebKit\/5([0-2]|3[0-2])/i.test(
i.userAgent
)
),
hashChange: Boolean(
! (
'onhashchange' in e ||
'onhashchange' in r
) ||
( h.isInternetExplorer() &&
h.getInternetExplorerMajorVersion() <
8 )
),
} ),
( h.enabled = ! h.emulated.pushState ),
( h.bugs = {
setHash: Boolean(
! h.emulated.pushState &&
i.vendor === 'Apple Computer, Inc.' &&
/AppleWebKit\/5([0-2]|3[0-3])/.test(
i.userAgent
)
),
safariPoll: Boolean(
! h.emulated.pushState &&
i.vendor === 'Apple Computer, Inc.' &&
/AppleWebKit\/5([0-2]|3[0-3])/.test(
i.userAgent
)
),
ieDoubleCheck: Boolean(
h.isInternetExplorer() &&
h.getInternetExplorerMajorVersion() < 8
),
hashEscape: Boolean(
h.isInternetExplorer() &&
h.getInternetExplorerMajorVersion() < 7
),
} ),
( h.isEmptyObject = function ( e ) {
for ( var t in e )
if ( e.hasOwnProperty( t ) ) return ! 1;
return ! 0;
} ),
( h.cloneObject = function ( e ) {
var t, n;
return (
e
? ( ( t = l.stringify( e ) ),
( n = l.parse( t ) ) )
: ( n = {} ),
n
);
} ),
( h.getRootUrl = function () {
var e =
r.location.protocol +
'//' +
( r.location.hostname || r.location.host );
if ( r.location.port || ! 1 )
e += ':' + r.location.port;
return ( e += '/' ), e;
} ),
( h.getBaseHref = function () {
var e = r.getElementsByTagName( 'base' ),
t = null,
n = '';
return (
e.length === 1 &&
( ( t = e[ 0 ] ),
( n = t.href.replace( /[^\/]+$/, '' ) ) ),
( n = n.replace( /\/+$/, '' ) ),
n && ( n += '/' ),
n
);
} ),
( h.getBaseUrl = function () {
var e =
h.getBaseHref() ||
h.getBasePageUrl() ||
h.getRootUrl();
return e;
} ),
( h.getPageUrl = function () {
var e = h.getState( ! 1, ! 1 ),
t = ( e || {} ).url || h.getLocationHref(),
n;
return (
( n = t
.replace( /\/+$/, '' )
.replace( /[^\/]+$/, function ( e, t, n ) {
return /\./.test( e ) ? e : e + '/';
} ) ),
n
);
} ),
( h.getBasePageUrl = function () {
var e =
h
.getLocationHref()
.replace( /[#\?].*/, '' )
.replace( /[^\/]+$/, function ( e, t, n ) {
return /[^\/]$/.test( e ) ? '' : e;
} )
.replace( /\/+$/, '' ) + '/';
return e;
} ),
( h.getFullUrl = function ( e, t ) {
var n = e,
r = e.substring( 0, 1 );
return (
( t = typeof t == 'undefined' ? ! 0 : t ),
/[a-z]+\:\/\//.test( e ) ||
( r === '/'
? ( n =
h.getRootUrl() +
e.replace( /^\/+/, '' ) )
: r === '#'
? ( n =
h
.getPageUrl()
.replace( /#.*/, '' ) + e )
: r === '?'
? ( n =
h
.getPageUrl()
.replace( /[\?#].*/, '' ) + e )
: t
? ( n =
h.getBaseUrl() +
e.replace( /^(\.\/)+/, '' ) )
: ( n =
h.getBasePageUrl() +
e.replace( /^(\.\/)+/, '' ) ) ),
n.replace( /\#$/, '' )
);
} ),
( h.getShortUrl = function ( e ) {
var t = e,
n = h.getBaseUrl(),
r = h.getRootUrl();
return (
h.emulated.pushState && ( t = t.replace( n, '' ) ),
( t = t.replace( r, '/' ) ),
h.isTraditionalAnchor( t ) && ( t = './' + t ),
( t = t
.replace( /^(\.\/)+/g, './' )
.replace( /\#$/, '' ) ),
t
);
} ),
( h.getLocationHref = function ( e ) {
return (
( e = e || r ),
e.URL === e.location.href
? e.location.href
: e.location.href ===
decodeURIComponent( e.URL )
? e.URL
: e.location.hash &&
decodeURIComponent(
e.location.href.replace( /^[^#]+/, '' )
) === e.location.hash
? e.location.href
: e.URL.indexOf( '#' ) == -1 &&
e.location.href.indexOf( '#' ) != -1
? e.location.href
: e.URL || e.location.href
);
} ),
( h.store = {} ),
( h.idToState = h.idToState || {} ),
( h.stateToId = h.stateToId || {} ),
( h.urlToId = h.urlToId || {} ),
( h.storedStates = h.storedStates || [] ),
( h.savedStates = h.savedStates || [] ),
( h.normalizeStore = function () {
( h.store.idToState = h.store.idToState || {} ),
( h.store.urlToId = h.store.urlToId || {} ),
( h.store.stateToId = h.store.stateToId || {} );
} ),
( h.getState = function ( e, t ) {
typeof e == 'undefined' && ( e = ! 0 ),
typeof t == 'undefined' && ( t = ! 0 );
var n = h.getLastSavedState();
return (
! n && t && ( n = h.createStateObject() ),
e &&
( ( n = h.cloneObject( n ) ),
( n.url = n.cleanUrl || n.url ) ),
n
);
} ),
( h.getIdByState = function ( e ) {
var t = h.extractId( e.url ),
n;
if ( ! t ) {
n = h.getStateString( e );
if ( typeof h.stateToId[ n ] != 'undefined' )
t = h.stateToId[ n ];
else if (
typeof h.store.stateToId[ n ] != 'undefined'
)
t = h.store.stateToId[ n ];
else {
for (;;) {
t =
new Date().getTime() +
String( Math.random() ).replace(
/\D/g,
''
);
if (
typeof h.idToState[ t ] ==
'undefined' &&
typeof h.store.idToState[ t ] ==
'undefined'
)
break;
}
( h.stateToId[ n ] = t ),
( h.idToState[ t ] = e );
}
}
return t;
} ),
( h.normalizeState = function ( e ) {
var t, n;
if ( ! e || typeof e != 'object' ) e = {};
if ( typeof e.normalized != 'undefined' ) return e;
if ( ! e.data || typeof e.data != 'object' )
e.data = {};
return (
( t = {} ),
( t.normalized = ! 0 ),
( t.title = e.title || '' ),
( t.url = h.getFullUrl(
e.url ? e.url : h.getLocationHref()
) ),
( t.hash = h.getShortUrl( t.url ) ),
( t.data = h.cloneObject( e.data ) ),
( t.id = h.getIdByState( t ) ),
( t.cleanUrl = t.url.replace(
/\??\&_suid.*/,
''
) ),
( t.url = t.cleanUrl ),
( n = ! h.isEmptyObject( t.data ) ),
( t.title || n ) &&
h.options.disableSuid !== ! 0 &&
( ( t.hash = h
.getShortUrl( t.url )
.replace( /\??\&_suid.*/, '' ) ),
/\?/.test( t.hash ) || ( t.hash += '?' ),
( t.hash += '&_suid=' + t.id ) ),
( t.hashedUrl = h.getFullUrl( t.hash ) ),
( h.emulated.pushState || h.bugs.safariPoll ) &&
h.hasUrlDuplicate( t ) &&
( t.url = t.hashedUrl ),
t
);
} ),
( h.createStateObject = function ( e, t, n ) {
var r = { data: e, title: t, url: n };
return ( r = h.normalizeState( r ) ), r;
} ),
( h.getStateById = function ( e ) {
e = String( e );
var n = h.idToState[ e ] || h.store.idToState[ e ] || t;
return n;
} ),
( h.getStateString = function ( e ) {
var t, n, r;
return (
( t = h.normalizeState( e ) ),
( n = {
data: t.data,
title: e.title,
url: e.url,
} ),
( r = l.stringify( n ) ),
r
);
} ),
( h.getStateId = function ( e ) {
var t, n;
return ( t = h.normalizeState( e ) ), ( n = t.id ), n;
} ),
( h.getHashByState = function ( e ) {
var t, n;
return ( t = h.normalizeState( e ) ), ( n = t.hash ), n;
} ),
( h.extractId = function ( e ) {
var t, n, r, i;
return (
e.indexOf( '#' ) != -1
? ( i = e.split( '#' )[ 0 ] )
: ( i = e ),
( n = /(.*)\&_suid=([0-9]+)$/.exec( i ) ),
( r = n ? n[ 1 ] || e : e ),
( t = n ? String( n[ 2 ] || '' ) : '' ),
t || ! 1
);
} ),
( h.isTraditionalAnchor = function ( e ) {
var t = ! /[\/\?\.]/.test( e );
return t;
} ),
( h.extractState = function ( e, t ) {
var n = null,
r,
i;
return (
( t = t || ! 1 ),
( r = h.extractId( e ) ),
r && ( n = h.getStateById( r ) ),
n ||
( ( i = h.getFullUrl( e ) ),
( r = h.getIdByUrl( i ) || ! 1 ),
r && ( n = h.getStateById( r ) ),
! n &&
t &&
! h.isTraditionalAnchor( e ) &&
( n = h.createStateObject(
null,
null,
i
) ) ),
n
);
} ),
( h.getIdByUrl = function ( e ) {
var n = h.urlToId[ e ] || h.store.urlToId[ e ] || t;
return n;
} ),
( h.getLastSavedState = function () {
return h.savedStates[ h.savedStates.length - 1 ] || t;
} ),
( h.getLastStoredState = function () {
return h.storedStates[ h.storedStates.length - 1 ] || t;
} ),
( h.hasUrlDuplicate = function ( e ) {
var t = ! 1,
n;
return (
( n = h.extractState( e.url ) ),
( t = n && n.id !== e.id ),
t
);
} ),
( h.storeState = function ( e ) {
return (
( h.urlToId[ e.url ] = e.id ),
h.storedStates.push( h.cloneObject( e ) ),
e
);
} ),
( h.isLastSavedState = function ( e ) {
var t = ! 1,
n,
r,
i;
return (
h.savedStates.length &&
( ( n = e.id ),
( r = h.getLastSavedState() ),
( i = r.id ),
( t = n === i ) ),
t
);
} ),
( h.saveState = function ( e ) {
return h.isLastSavedState( e )
? ! 1
: ( h.savedStates.push( h.cloneObject( e ) ), ! 0 );
} ),
( h.getStateByIndex = function ( e ) {
var t = null;
return (
typeof e == 'undefined'
? ( t =
h.savedStates[
h.savedStates.length - 1
] )
: e < 0
? ( t =
h.savedStates[
h.savedStates.length + e
] )
: ( t = h.savedStates[ e ] ),
t
);
} ),
( h.getCurrentIndex = function () {
var e = null;
return (
h.savedStates.length < 1
? ( e = 0 )
: ( e = h.savedStates.length - 1 ),
e
);
} ),
( h.getHash = function ( e ) {
var t = h.getLocationHref( e ),
n;
return ( n = h.getHashByUrl( t ) ), n;
} ),
( h.unescapeHash = function ( e ) {
var t = h.normalizeHash( e );
return ( t = decodeURIComponent( t ) ), t;
} ),
( h.normalizeHash = function ( e ) {
var t = e.replace( /[^#]*#/, '' ).replace( /#.*/, '' );
return t;
} ),
( h.setHash = function ( e, t ) {
var n, i;
return t !== ! 1 && h.busy()
? ( h.pushQueue( {
scope: h,
callback: h.setHash,
args: arguments,
queue: t,
} ),
! 1 )
: ( h.busy( ! 0 ),
( n = h.extractState( e, ! 0 ) ),
n && ! h.emulated.pushState
? h.pushState( n.data, n.title, n.url, ! 1 )
: h.getHash() !== e &&
( h.bugs.setHash
? ( ( i = h.getPageUrl() ),
h.pushState(
null,
null,
i + '#' + e,
! 1
) )
: ( r.location.hash = e ) ),
h );
} ),
( h.escapeHash = function ( t ) {
var n = h.normalizeHash( t );
return (
( n = e.encodeURIComponent( n ) ),
h.bugs.hashEscape ||
( n = n
.replace( /\%21/g, '!' )
.replace( /\%26/g, '&' )
.replace( /\%3D/g, '=' )
.replace( /\%3F/g, '?' ) ),
n
);
} ),
( h.getHashByUrl = function ( e ) {
var t = String( e ).replace(
/([^#]*)#?([^#]*)#?(.*)/,
'$2'
);
return ( t = h.unescapeHash( t ) ), t;
} ),
( h.setTitle = function ( e ) {
var t = e.title,
n;
t ||
( ( n = h.getStateByIndex( 0 ) ),
n &&
n.url === e.url &&
( t = n.title || h.options.initialTitle ) );
try {
r.getElementsByTagName( 'title' )[ 0 ].innerHTML = t
.replace( '<', '&lt;' )
.replace( '>', '&gt;' )
.replace( ' & ', ' &amp; ' );
} catch ( i ) {}
return ( r.title = t ), h;
} ),
( h.queues = [] ),
( h.busy = function ( e ) {
typeof e != 'undefined'
? ( h.busy.flag = e )
: typeof h.busy.flag == 'undefined' &&
( h.busy.flag = ! 1 );
if ( ! h.busy.flag ) {
u( h.busy.timeout );
var t = function () {
var e, n, r;
if ( h.busy.flag ) return;
for ( e = h.queues.length - 1; e >= 0; --e ) {
n = h.queues[ e ];
if ( n.length === 0 ) continue;
( r = n.shift() ),
h.fireQueueItem( r ),
( h.busy.timeout = o(
t,
h.options.busyDelay
) );
}
};
h.busy.timeout = o( t, h.options.busyDelay );
}
return h.busy.flag;
} ),
( h.busy.flag = ! 1 ),
( h.fireQueueItem = function ( e ) {
return e.callback.apply( e.scope || h, e.args || [] );
} ),
( h.pushQueue = function ( e ) {
return (
( h.queues[ e.queue || 0 ] =
h.queues[ e.queue || 0 ] || [] ),
h.queues[ e.queue || 0 ].push( e ),
h
);
} ),
( h.queue = function ( e, t ) {
return (
typeof e == 'function' && ( e = { callback: e } ),
typeof t != 'undefined' && ( e.queue = t ),
h.busy() ? h.pushQueue( e ) : h.fireQueueItem( e ),
h
);
} ),
( h.clearQueue = function () {
return ( h.busy.flag = ! 1 ), ( h.queues = [] ), h;
} ),
( h.stateChanged = ! 1 ),
( h.doubleChecker = ! 1 ),
( h.doubleCheckComplete = function () {
return (
( h.stateChanged = ! 0 ), h.doubleCheckClear(), h
);
} ),
( h.doubleCheckClear = function () {
return (
h.doubleChecker &&
( u( h.doubleChecker ),
( h.doubleChecker = ! 1 ) ),
h
);
} ),
( h.doubleCheck = function ( e ) {
return (
( h.stateChanged = ! 1 ),
h.doubleCheckClear(),
h.bugs.ieDoubleCheck &&
( h.doubleChecker = o( function () {
return (
h.doubleCheckClear(),
h.stateChanged || e(),
! 0
);
}, h.options.doubleCheckInterval ) ),
h
);
} ),
( h.safariStatePoll = function () {
var t = h.extractState( h.getLocationHref() ),
n;
if ( ! h.isLastSavedState( t ) )
return (
( n = t ),
n || ( n = h.createStateObject() ),
h.Adapter.trigger( e, 'popstate' ),
h
);
return;
} ),
( h.back = function ( e ) {
return e !== ! 1 && h.busy()
? ( h.pushQueue( {
scope: h,
callback: h.back,
args: arguments,
queue: e,
} ),
! 1 )
: ( h.busy( ! 0 ),
h.doubleCheck( function () {
h.back( ! 1 );
} ),
p.go( -1 ),
! 0 );
} ),
( h.forward = function ( e ) {
return e !== ! 1 && h.busy()
? ( h.pushQueue( {
scope: h,
callback: h.forward,
args: arguments,
queue: e,
} ),
! 1 )
: ( h.busy( ! 0 ),
h.doubleCheck( function () {
h.forward( ! 1 );
} ),
p.go( 1 ),
! 0 );
} ),
( h.go = function ( e, t ) {
var n;
if ( e > 0 ) for ( n = 1; n <= e; ++n ) h.forward( t );
else {
if ( ! ( e < 0 ) )
throw new Error(
'History.go: History.go requires a positive or negative integer passed.'
);
for ( n = -1; n >= e; --n ) h.back( t );
}
return h;
} );
if ( h.emulated.pushState ) {
var v = function () {};
( h.pushState = h.pushState || v ),
( h.replaceState = h.replaceState || v );
} else
( h.onPopState = function ( t, n ) {
var r = ! 1,
i = ! 1,
s,
o;
return (
h.doubleCheckComplete(),
( s = h.getHash() ),
s
? ( ( o = h.extractState(
s || h.getLocationHref(),
! 0
) ),
o
? h.replaceState(
o.data,
o.title,
o.url,
! 1
)
: ( h.Adapter.trigger(
e,
'anchorchange'
),
h.busy( ! 1 ) ),
( h.expectedStateId = ! 1 ),
! 1 )
: ( ( r =
h.Adapter.extractEventData(
'state',
t,
n
) || ! 1 ),
r
? ( i = h.getStateById( r ) )
: h.expectedStateId
? ( i = h.getStateById(
h.expectedStateId
) )
: ( i = h.extractState(
h.getLocationHref()
) ),
i ||
( i = h.createStateObject(
null,
null,
h.getLocationHref()
) ),
( h.expectedStateId = ! 1 ),
h.isLastSavedState( i )
? ( h.busy( ! 1 ), ! 1 )
: ( h.storeState( i ),
h.saveState( i ),
h.setTitle( i ),
h.Adapter.trigger( e, 'statechange' ),
h.busy( ! 1 ),
! 0 ) )
);
} ),
h.Adapter.bind( e, 'popstate', h.onPopState ),
( h.pushState = function ( t, n, r, i ) {
if ( h.getHashByUrl( r ) && h.emulated.pushState )
throw new Error(
'History.js does not support states with fragement-identifiers (hashes/anchors).'
);
if ( i !== ! 1 && h.busy() )
return (
h.pushQueue( {
scope: h,
callback: h.pushState,
args: arguments,
queue: i,
} ),
! 1
);
h.busy( ! 0 );
var s = h.createStateObject( t, n, r );
return (
h.isLastSavedState( s )
? h.busy( ! 1 )
: ( h.storeState( s ),
( h.expectedStateId = s.id ),
p.pushState( s.id, s.title, s.url ),
h.Adapter.trigger( e, 'popstate' ) ),
! 0
);
} ),
( h.replaceState = function ( t, n, r, i ) {
if ( h.getHashByUrl( r ) && h.emulated.pushState )
throw new Error(
'History.js does not support states with fragement-identifiers (hashes/anchors).'
);
if ( i !== ! 1 && h.busy() )
return (
h.pushQueue( {
scope: h,
callback: h.replaceState,
args: arguments,
queue: i,
} ),
! 1
);
h.busy( ! 0 );
var s = h.createStateObject( t, n, r );
return (
h.isLastSavedState( s )
? h.busy( ! 1 )
: ( h.storeState( s ),
( h.expectedStateId = s.id ),
p.replaceState( s.id, s.title, s.url ),
h.Adapter.trigger( e, 'popstate' ) ),
! 0
);
} );
if ( s ) {
try {
h.store = l.parse( s.getItem( 'History.store' ) ) || {};
} catch ( m ) {
h.store = {};
}
h.normalizeStore();
} else ( h.store = {} ), h.normalizeStore();
h.Adapter.bind( e, 'unload', h.clearAllIntervals ),
h.saveState(
h.storeState(
h.extractState( h.getLocationHref(), ! 0 )
)
),
s &&
( ( h.onUnload = function () {
var e, t, n;
try {
e =
l.parse( s.getItem( 'History.store' ) ) ||
{};
} catch ( r ) {
e = {};
}
( e.idToState = e.idToState || {} ),
( e.urlToId = e.urlToId || {} ),
( e.stateToId = e.stateToId || {} );
for ( t in h.idToState ) {
if ( ! h.idToState.hasOwnProperty( t ) )
continue;
e.idToState[ t ] = h.idToState[ t ];
}
for ( t in h.urlToId ) {
if ( ! h.urlToId.hasOwnProperty( t ) ) continue;
e.urlToId[ t ] = h.urlToId[ t ];
}
for ( t in h.stateToId ) {
if ( ! h.stateToId.hasOwnProperty( t ) )
continue;
e.stateToId[ t ] = h.stateToId[ t ];
}
( h.store = e ),
h.normalizeStore(),
( n = l.stringify( e ) );
try {
s.setItem( 'History.store', n );
} catch ( i ) {
if (
i.code !== DOMException.QUOTA_EXCEEDED_ERR
)
throw i;
s.length &&
( s.removeItem( 'History.store' ),
s.setItem( 'History.store', n ) );
}
} ),
h.intervalList.push(
a( h.onUnload, h.options.storeInterval )
),
h.Adapter.bind( e, 'beforeunload', h.onUnload ),
h.Adapter.bind( e, 'unload', h.onUnload ) );
if ( ! h.emulated.pushState ) {
h.bugs.safariPoll &&
h.intervalList.push(
a( h.safariStatePoll, h.options.safariPollInterval )
);
if (
i.vendor === 'Apple Computer, Inc.' ||
( i.appCodeName || '' ) === 'Mozilla'
)
h.Adapter.bind( e, 'hashchange', function () {
h.Adapter.trigger( e, 'popstate' );
} ),
h.getHash() &&
h.Adapter.onDomLoad( function () {
h.Adapter.trigger( e, 'hashchange' );
} );
}
} ),
( ! h.options || ! h.options.delayInit ) && h.init();
} )( window );

View File

@@ -0,0 +1,126 @@
( function ( $ ) {
AstraSitesImportStatus = {
timer: null,
ajax_in_process: false,
current_step: null,
interval: $( '.astra-sites-import-screen' ).length ? 1000 : 10000,
/**
* Init
*/
init: function () {
this.start();
},
/**
* Start
*/
start: function () {
AstraSitesImportStatus.timer = setInterval(
AstraSitesImportStatus.check_status,
AstraSitesImportStatus.interval
);
},
/**
* Check Status
*/
check_status: function () {
if ( false === AstraSitesImportStatus.ajax_in_process ) {
AstraSitesImportStatus.ajax_in_process = true;
AstraSitesImportStatus._ajax_request();
}
},
/**
* Ajax Request
*/
_ajax_request: function () {
$.ajax( {
url: AstraSitesImportStatusVars.ajaxurl,
type: 'POST',
data: {
action: 'astra_sites_check_import_status',
_ajax_nonce: AstraSitesImportStatusVars._ajax_nonce,
},
} )
.done( function ( result ) {
AstraSitesImportStatus.ajax_in_process = false;
// Admin Bar UI markup.
if (
'complete' === result.data.response.step ||
'fail' === result.data.response.step
) {
AstraSitesImportStatus.stop();
var response_message =
'<span class="dashicons dashicons-no-alt"></span> Site Import Failed';
if ( 'complete' === result.data.response.step ) {
response_message =
'<span class="dashicons dashicons-yes"></span>' +
response_message;
}
$( '#astra-sites-import-status-admin-bar' ).html(
response_message
);
} else {
$( '#astra-sites-import-status-admin-bar' ).html(
'<span class="loading"></span>' +
result.data.response.message
);
}
// Admin page UI markup.
var currentStep = $(
'.import-step[data-step="' +
result.data.response.step +
'"]'
);
if ( currentStep.length ) {
if (
'complete' === result.data.response.step ||
'fail' === result.data.response.step
) {
$( '.import-step' )
.removeClass( 'processing' )
.addClass( 'success' );
} else if (
AstraSitesImportStatus.current_step !==
result.data.response.step
) {
AstraSitesImportStatus.current_step =
result.data.response.step;
currentStep
.prevAll()
.removeClass( 'processing' )
.addClass( 'success' );
currentStep.addClass( 'processing' );
}
}
} )
.fail( function ( err ) {
AstraSitesImportStatus.ajax_in_process = false;
// Stop.
AstraSitesImportStatus.stop();
} );
},
/**
* Step
*/
stop: function () {
clearInterval( AstraSitesImportStatus.timer );
},
};
/**
* Initialize AstraSitesImportStatus
*/
$( function () {
AstraSitesImportStatus.init();
} );
} )( jQuery );

View File

@@ -0,0 +1,94 @@
<?php
/**
* Astra_Sites_Elementor_Images class
*
* This class is used to manage Pixabay Images.
*
* @package Astra Sites
* @since 2.0.0
*/
use Elementor\Utils;
// If plugin - 'Elementor' not exist then return.
if ( class_exists( 'Astra_Sites_Elementor_Images' ) ) {
return;
}
/**
* Astra_Sites_Elementor_Images
*/
class Astra_Sites_Elementor_Images {
/**
* Instance of Astra_Sites
*
* @since 2.0.0
* @var (Object) Astra_Sites
*/
private static $instance = null;
/**
* Instance of Astra_Sites_Elementor_Images.
*
* @since 2.0.0
*
* @return object Class object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Import Image.
*
* @since 2.0.0
* @param array $image Downloaded Image array.
*/
public function get_attachment_data( $image ) {
if ( ! empty( $image ) ) {
return array(
'content' => array(
array(
'id' => \Elementor\Utils::generate_random_string(),
'elType' => 'section',
'settings' => array(),
'isInner' => false,
'elements' => array(
array(
'id' => \Elementor\Utils::generate_random_string(),
'elType' => 'column',
'elements' => array(
array(
'id' => \Elementor\Utils::generate_random_string(),
'elType' => 'widget',
'settings' => array(
'image' => array(
'url' => wp_get_attachment_url( $image ),
'id' => $image,
),
'image_size' => 'full',
),
'widgetType' => 'image',
),
),
'isInner' => false,
),
),
),
),
);
}
return array();
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Elementor_Images::get_instance();

View File

@@ -0,0 +1,95 @@
<?php
/**
* Elementor Importer
*
* @package Astra Sites
*/
namespace Elementor\TemplateLibrary;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// If plugin - 'Elementor' not exist then return.
if ( ! class_exists( '\Elementor\Plugin' ) ) {
return;
}
use Elementor\Core\Base\Document;
use Elementor\DB;
use Elementor\Core\Settings\Page\Manager as PageSettingsManager;
use Elementor\Core\Settings\Manager as SettingsManager;
use Elementor\Core\Settings\Page\Model;
use Elementor\Editor;
use Elementor\Plugin;
use Elementor\Settings;
use Elementor\Utils;
/**
* Elementor template library local source.
*
* Elementor template library local source handler class is responsible for
* handling local Elementor templates saved by the user locally on his site.
*
* @since 2.0.0 Added compatibility for Elemetnor v2.5.0
*/
class Astra_Sites_Elementor_Pages extends Source_Local {
/**
* Update post meta.
*
* @since 2.0.0
* @param integer $post_id Post ID.
* @param array $data Elementor Data.
* @return array $data Elementor Imported Data.
*/
public function import( $post_id = 0, $data = array() ) {
if ( ! empty( $post_id ) && ! empty( $data ) ) {
$data = wp_json_encode( $data );
// Update WP form IDs.
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
if ( $ids_mapping ) {
foreach ( $ids_mapping as $old_id => $new_id ) {
$data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
$data = str_replace( '"select_form":"' . $old_id, '"select_form":"' . $new_id, $data );
}
}
$data = json_decode( $data, true );
// Import the data.
$data = $this->process_export_import_content( $data, 'on_import' );
// Replace the site urls.
$demo_data = \Astra_Sites_File_System::get_instance()->get_demo_content();
if ( isset( $demo_data['astra-site-url'] ) ) {
$site_url = get_site_url();
$site_url = str_replace( '/', '\/', $site_url );
$demo_site_url = 'https:' . $demo_data['astra-site-url'];
$demo_site_url = str_replace( '/', '\/', $demo_site_url );
if ( ! is_array( $data ) ) {
$data = str_replace( $demo_site_url, $site_url, $data );
} else {
$data = wp_json_encode( $data );
if ( ! empty( $data ) ) {
$data = str_replace( $demo_site_url, $site_url, $data );
$data = json_decode( $data, true );
}
}
}
// Update processed meta.
update_metadata( 'post', $post_id, '_elementor_data', $data );
// !important, Clear the cache after images import.
Plugin::$instance->posts_css_manager->clear_cache();
return $data;
}
return array();
}
}

View File

@@ -0,0 +1,164 @@
<?php
/**
* Astra Sites
*
* @since 3.0.23
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Astra_Sites_Error_Handler
*/
class Astra_Sites_Error_Handler {
/**
* Instance of Astra_Sites_Error_Handler
*
* @since 3.0.23
* @var (Object) Astra_Sites_Error_Handler
*/
private static $instance = null;
/**
* Instance of Astra_Sites_Error_Handler.
*
* @since 3.0.23
*
* @return object Class object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
public function __construct() {
require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer-log.php';
if ( true === astra_sites_has_import_started() ) {
$this->start_error_handler();
}
add_action( 'shutdown', array( $this, 'stop_handler' ) );
}
/**
* Stop the shutdown handlers.
*
* @return void
*/
public function stop_handler() {
if ( true === astra_sites_has_import_started() ) {
$this->stop_error_handler();
}
}
/**
* Start the error handling.
*/
public function start_error_handler() {
if ( ! interface_exists( 'Throwable' ) ) {
// Fatal error handler for PHP < 7.
register_shutdown_function( array( $this, 'shutdown_handler' ) );
}
// Fatal error handler for PHP >= 7, and uncaught exception handler for all PHP versions.
set_exception_handler( array( $this, 'exception_handler' ) );
}
/**
* Stop and restore the error handlers.
*/
public function stop_error_handler() {
// Restore the error handlers.
restore_error_handler();
restore_exception_handler();
}
/**
* Uncaught exception handler.
*
* In PHP >= 7 this will receive a Throwable object.
* In PHP < 7 it will receive an Exception object.
*
* @throws Exception Exception that is catched.
* @param Throwable|Exception $e The error or exception.
*/
public function exception_handler( $e ) {
if ( is_a( $e, 'Exception' ) ) {
$error = 'Uncaught Exception';
} else {
$error = 'Uncaught Error';
}
Astra_Sites_Importer_Log::add( 'There was an error on website: ' . $error );
Astra_Sites_Importer_Log::add( $e );
if ( wp_doing_ajax() ) {
wp_send_json_error(
array(
'message' => __( 'There was an error on your website.', 'astra-sites' ),
'stack' => array(
'error-message' => sprintf(
'%s: %s',
$error,
$e->getMessage()
),
'file' => $e->getFile(),
'line' => $e->getLine(),
'trace' => $e->getTrace(),
),
)
);
}
throw $e;
}
/**
* Displays fatal error output for sites running PHP < 7.
*/
public function shutdown_handler() {
$e = error_get_last();
if ( empty( $e ) || ! ( $e['type'] & ST_ERROR_FATALS ) ) {
return;
}
if ( $e['type'] & E_RECOVERABLE_ERROR ) {
$error = 'Catchable fatal error';
} else {
$error = 'Fatal error';
}
Astra_Sites_Importer_Log::add( 'There was an error on website: ' . $error );
Astra_Sites_Importer_Log::add( $e );
if ( wp_doing_ajax() ) {
wp_send_json_error(
array(
'message' => __( 'There was an error your website.', 'astra-sites' ),
'stack' => array(
'error-message' => $error,
'error' => $e,
),
)
);
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Error_Handler::get_instance();

View File

@@ -0,0 +1,202 @@
<?php
/**
* Astra Sites File System
*
* @since 4.2.0
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Sites_File_System' ) ) {
/**
* Astra_Sites_File_System
*/
class Astra_Sites_File_System {
/**
* Instance of Astra_Sites
*
* @since 4.2.0
* @var (self) Astra_Sites
*/
private static $instance = null;
/**
* Folder name for the json files.
*
* @var string
* @since 4.2.0
*/
public static $folder_name = 'json';
/**
* Instance of Astra_Sites.
*
* @since 4.2.0
* @return self Class object.
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Create files for demo content.
*
* @return void
* @since 4.2.0
*/
public function create_file() {
$upload_dir = wp_upload_dir();
$file = array(
'file_base' => $upload_dir['basedir'] . '/astra-sites/' . self::$folder_name,
'file_name' => 'astra_sites_import_data.json',
'file_content' => array(),
);
$this->create_single_file( $file );
}
/**
* Delete a JSON file from the uploads directory.
*
* @param string $file_name File name to be deleted.
* @return void True on success, false on failure.
*/
public function delete_json_file( $file_name ) {
$upload_dir = wp_upload_dir();
$file_name = $upload_dir['basedir'] . '/astra-sites/' . self::$folder_name . '/' . $file_name;
if ( file_exists( $file_name ) ) {
wp_delete_file( $file_name );
} else {
astra_sites_error_log( 'File not found: ' . $file_name );
}
}
/**
* Getting json file for templates from uploads.
*
* @param string $file_name File data.
* @param bool $array_format Is The file content array.
*
* @return mixed
*/
public function get_json_file_content( $file_name, $array_format = true ) {
$upload_dir = wp_upload_dir();
$file_name = $upload_dir['basedir'] . '/astra-sites/' . self::$folder_name . '/' . $file_name;
if ( file_exists( $file_name ) ) {
// Ignoring the rule as it is not a remote file.
$file_content = file_get_contents( $file_name ); //phpcs:ignore WordPressVIPMinimum.Performance.FetchingRemoteData.FileGetContentsUnknown
if ( $array_format ) {
return json_decode( (string) $file_content, true );
} else {
return $file_content;
}
}
return '';
}
/**
* Getter for get_json_file_content
*
* @since 4.2.0
*
* @return mixed
*/
public function get_demo_content() {
return $this->get_json_file_content( 'astra_sites_import_data.json' );
}
/**
* Delete for get_json_file_content
*
* @since 4.2.0
*
* @return mixed
*/
public function delete_demo_content() {
$this->delete_json_file( 'astra_sites_import_data.json' );
}
/**
* Create single json file.
*
* @since 4.2.2
* @param array<string, mixed> $file file data.
*
* @return void
*/
public function create_single_file( $file ) {
if ( wp_mkdir_p( $file['file_base'] ) ) {
$file_handle = @fopen( trailingslashit( $file['file_base'] ) . $file['file_name'], 'w' ); // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged, WordPress.WP.AlternativeFunctions.file_system_read_fopen
if ( $file_handle ) {
if ( is_string( wp_json_encode( $file['file_content'] ) ) ) {
fwrite( $file_handle, wp_json_encode( $file['file_content'] ) ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fwrite, WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_fwrite
fclose( $file_handle ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_read_fclose
astra_sites_error_log( 'File: ' . $file['file_name'] . ' Created Successfully!' );
}
}
}
}
/**
* Update files/directories.
*
* @param string $file_name The file name.
* @param mixed $file_content The file content.
*
* @return void
*/
public function update_json_file( $file_name, $file_content ) {
$upload_dir = wp_upload_dir();
$dir_info = array(
'path' => $upload_dir['basedir'] . '/astra-sites/' . self::$folder_name . '/',
);
if ( ! file_exists( $dir_info['path'] . $file_name ) ) {
$file = array(
'file_base' => $dir_info['path'],
'file_name' => $file_name,
'file_content' => '',
);
$this->create_single_file( $file );
}
if ( file_exists( $dir_info['path'] . $file_name ) && file_put_contents( $dir_info['path'] . $file_name, wp_json_encode( $file_content ) ) !== false ) { //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_file_put_contents
astra_sites_error_log( 'File: ' . $file_name . ' Updated Successfully!' );
} else {
astra_sites_error_log( 'File: ' . $file_name . ' Not Updated!' );
}
}
/**
* Setter for update_json_file()
*
* @param string|int $file_content The file content.
*
* @return mixed
*/
public function update_demo_data( $file_content ) {
$this->update_json_file( 'astra_sites_import_data.json', $file_content );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_File_System::get_instance();
}

View File

@@ -0,0 +1,537 @@
<?php
/**
* Astra Sites Importer Log
*
* @since 1.1.0
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Sites_Importer_Log' ) ) :
/**
* Astra Sites Importer
*/
class Astra_Sites_Importer_Log {
/**
* Instance
*
* @since 1.1.0
* @var (Object) Class object
*/
private static $instance = null;
/**
* Log File
*
* @since 1.1.0
* @var (Object) Class object
*/
private static $log_file = null;
/**
* Set Instance
*
* @since 1.1.0
*
* @return object Class object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*
* @since 1.1.0
*/
private function __construct() {
// Check file read/write permissions.
if ( current_user_can( 'edit_posts' ) ) {
add_action( 'admin_init', array( $this, 'has_file_read_write' ) );
}
}
/**
* Check file read/write permissions and process.
*
* @since 1.1.0
* @return null
*/
public function has_file_read_write() {
$upload_dir = self::log_dir();
$file_created = Astra_Sites::get_instance()->get_filesystem()->put_contents( $upload_dir['path'] . 'index.html', '' );
if ( ! $file_created ) {
add_action( 'admin_notices', array( $this, 'file_permission_notice' ) );
return;
}
// Set log file.
self::set_log_file();
// Initial AJAX Import Hooks.
add_action( 'astra_sites_import_start', array( $this, 'start' ), 10, 2 );
}
/**
* File Permission Notice
*
* @since 2.0.0
* @return void
*/
public function file_permission_notice() {
$upload_dir = self::log_dir();
$plugin_name = ASTRA_SITES_NAME;
if ( is_callable( 'Astra_Sites_White_Label::get_instance' ) ) {
$is_white_label = Astra_Sites_White_Label::get_instance()->is_white_labeled();
$plugin_name = $is_white_label ? Astra_Sites_White_Label::get_instance()->get_white_label_name() : ASTRA_SITES_NAME;
}
/* translators: %1$s refers to the plugin name */
$notice = sprintf( __( 'Required File Permissions to import the templates from %s are missing.', 'astra-sites' ), $plugin_name );
?>
<div class="notice notice-error astra-sites-must-notices astra-sites-file-permission-issue">
<p><?php echo esc_html( $notice ); ?></p>
<?php if ( defined( 'FS_METHOD' ) ) { ?>
<p><?php esc_html_e( 'This is usually due to inconsistent file permissions.', 'astra-sites' ); ?></p>
<p><code><?php echo esc_html( $upload_dir['path'] ); ?></code></p>
<?php } else { ?>
<p><?php esc_html_e( 'You can easily update permissions by adding the following code into the wp-config.php file.', 'astra-sites' ); ?></p>
<p><code>define( 'FS_METHOD', 'direct' );</code></p>
<?php } ?>
</div>
<?php
}
/**
* Add log file URL in UI response.
*
* @since 1.1.0
*/
public static function add_log_file_url() {
$upload_dir = self::log_dir();
$upload_path = trailingslashit( $upload_dir['url'] );
$file_abs_url = get_option( 'astra_sites_recent_import_log_file', self::$log_file );
$file_url = $upload_path . basename( $file_abs_url );
return array(
'abs_url' => $file_abs_url,
'url' => $file_url,
);
}
/**
* Current Time for log.
*
* @since 1.1.0
* @return string Current time with time zone.
*/
public static function current_time() {
return gmdate( 'H:i:s' ) . ' ' . date_default_timezone_get();
}
/**
* Import Start
*
* @since 1.1.0
* @param array $data Import Data.
* @param string $demo_api_uri Import site API URL.
* @return void
*/
public function start( $data = array(), $demo_api_uri = '' ) {
self::add( 'Started Import Process' );
self::add( '# System Details: ' );
self::add( "Debug Mode \t\t: " . self::get_debug_mode() );
self::add( "Operating System \t: " . self::get_os() );
self::add( "Software \t\t: " . self::get_software() );
self::add( "MySQL version \t\t: " . self::get_mysql_version() );
self::add( "XML Reader \t\t: " . self::get_xmlreader_status() );
self::add( "PHP Version \t\t: " . self::get_php_version() );
self::add( "PHP Max Input Vars \t: " . self::get_php_max_input_vars() );
self::add( "PHP Max Post Size \t: " . self::get_php_max_post_size() );
self::add( "PHP Extension GD \t: " . self::get_php_extension_gd() );
self::add( "PHP Max Execution Time \t: " . self::get_max_execution_time() );
self::add( "Max Upload Size \t: " . size_format( wp_max_upload_size() ) );
self::add( "Memory Limit \t\t: " . self::get_memory_limit() );
self::add( "Timezone \t\t: " . self::get_timezone() );
self::add( PHP_EOL . '-----' . PHP_EOL );
self::add( 'Importing Started! - ' . self::current_time() );
self::add( '---' . PHP_EOL );
self::add( 'WHY IMPORT PROCESS CAN FAIL? READ THIS - ' );
self::add( 'https://wpastra.com/docs/?p=1314&utm_source=demo-import-panel&utm_campaign=import-error&utm_medium=wp-dashboard' . PHP_EOL );
self::add( '---' . PHP_EOL );
}
/**
* Get Log File
*
* @since 1.1.0
* @return string log file URL.
*/
public static function get_log_file() {
return self::$log_file;
}
/**
* Log file directory
*
* @since 1.1.0
* @param string $dir_name Directory Name.
* @return array Uploads directory array.
*/
public static function log_dir( $dir_name = 'astra-sites' ) {
$upload_dir = wp_upload_dir();
// Build the paths.
$dir_info = array(
'path' => $upload_dir['basedir'] . '/' . $dir_name . '/',
'url' => $upload_dir['baseurl'] . '/' . $dir_name . '/',
);
// Create the upload dir if it doesn't exist.
if ( ! file_exists( $dir_info['path'] ) ) {
// Create the directory.
wp_mkdir_p( $dir_info['path'] );
// Add an index file for security.
Astra_Sites::get_instance()->get_filesystem()->put_contents( $dir_info['path'] . 'index.html', '' );
// Add an .htaccess for security.
Astra_Sites::get_instance()->get_filesystem()->put_contents( $dir_info['path'] . '.htaccess', 'deny from all' );
}
return $dir_info;
}
/**
* Set log file
*
* @since 1.1.0
*/
public static function set_log_file() {
$upload_dir = self::log_dir();
$upload_path = trailingslashit( $upload_dir['path'] );
// File format e.g. 'import-31-Oct-2017-06-39-12-hashcode.log'.
self::$log_file = $upload_path . 'import-' . gmdate( 'd-M-Y-h-i-s' ) . '-' . wp_hash( 'starter-templates-log' ) . '.log';
if ( ! get_option( 'astra_sites_recent_import_log_file', false ) ) {
update_option( 'astra_sites_recent_import_log_file', self::$log_file, 'no' );
}
}
/**
* Write content to a file.
*
* @since 1.1.0
* @param string $content content to be saved to the file.
*/
public static function add( $content ) {
if ( get_option( 'astra_sites_recent_import_log_file', false ) ) {
$log_file = get_option( 'astra_sites_recent_import_log_file', self::$log_file );
} else {
$log_file = self::$log_file;
}
if ( apply_filters( 'astra_sites_debug_logs', false ) ) {
error_log( $content ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- This is for the debug logs while importing. This is conditional and will not be logged in the debug.log file for normal users.
}
$existing_data = '';
if ( file_exists( $log_file ) ) {
$existing_data = Astra_Sites::get_instance()->get_filesystem()->get_contents( $log_file );
}
// Style separator.
$separator = PHP_EOL;
Astra_Sites::get_instance()->get_filesystem()->put_contents( $log_file, $existing_data . $separator . $content, FS_CHMOD_FILE );
}
/**
* Debug Mode
*
* @since 1.1.0
* @return string Enabled for Debug mode ON and Disabled for Debug mode Off.
*/
public static function get_debug_mode() {
if ( WP_DEBUG ) {
return __( 'Enabled', 'astra-sites' );
}
return __( 'Disabled', 'astra-sites' );
}
/**
* Memory Limit
*
* @since 1.1.0
* @return string Memory limit.
*/
public static function get_memory_limit() {
$required_memory = '64M';
$memory_limit_in_bytes_current = wp_convert_hr_to_bytes( WP_MEMORY_LIMIT );
$memory_limit_in_bytes_required = wp_convert_hr_to_bytes( $required_memory );
if ( $memory_limit_in_bytes_current < $memory_limit_in_bytes_required ) {
return sprintf(
/* translators: %1$s Memory Limit, %2$s Recommended memory limit. */
_x( 'Current memory limit %1$s. We recommend setting memory to at least %2$s.', 'Recommended Memory Limit', 'astra-sites' ),
WP_MEMORY_LIMIT,
$required_memory
);
}
return WP_MEMORY_LIMIT;
}
/**
* Timezone
*
* @since 1.1.0
* @see https://codex.wordpress.org/Option_Reference/
*
* @return string Current timezone.
*/
public static function get_timezone() {
$timezone = get_option( 'timezone_string' );
if ( ! $timezone ) {
return get_option( 'gmt_offset' );
}
return $timezone;
}
/**
* Operating System
*
* @since 1.1.0
* @return string Current Operating System.
*/
public static function get_os() {
return PHP_OS;
}
/**
* Server Software
*
* @since 1.1.0
* @return string Current Server Software.
*/
public static function get_software() {
return isset( $_SERVER['SERVER_SOFTWARE'] ) ? sanitize_text_field( $_SERVER['SERVER_SOFTWARE'] ) : '';
}
/**
* MySql Version
*
* @since 1.1.0
* @return string Current MySql Version.
*/
public static function get_mysql_version() {
global $wpdb;
return $wpdb->db_version();
}
/**
* XML Reader
*
* @since 1.2.8
* @return string Current XML Reader status.
*/
public static function get_xmlreader_status() {
if ( class_exists( 'XMLReader' ) ) {
return __( 'Yes', 'astra-sites' );
}
return __( 'No', 'astra-sites' );
}
/**
* PHP Version
*
* @since 1.1.0
* @return string Current PHP Version.
*/
public static function get_php_version() {
if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
return _x( 'We recommend to use php 5.4 or higher', 'PHP Version', 'astra-sites' );
}
return PHP_VERSION;
}
/**
* PHP Max Input Vars
*
* @since 1.1.0
* @return string Current PHP Max Input Vars
*/
public static function get_php_max_input_vars() {
return ini_get( 'max_input_vars' ); // phpcs:disable PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
}
/**
* PHP Max Post Size
*
* @since 1.1.0
* @return string Current PHP Max Post Size
*/
public static function get_php_max_post_size() {
return ini_get( 'post_max_size' );
}
/**
* PHP Max Execution Time
*
* @since 1.1.0
* @return string Current Max Execution Time
*/
public static function get_max_execution_time() {
return ini_get( 'max_execution_time' );
}
/**
* PHP GD Extension
*
* @since 1.1.0
* @return string Current PHP GD Extension
*/
public static function get_php_extension_gd() {
if ( extension_loaded( 'gd' ) ) {
return __( 'Yes', 'astra-sites' );
}
return __( 'No', 'astra-sites' );
}
/**
* Display Data
*
* @since 2.0.0
* @return void
*/
public function display_data() {
$crons = _get_cron_array();
$events = array();
if ( empty( $crons ) ) {
esc_html_e( 'You currently have no scheduled cron events.', 'astra-sites' );
}
foreach ( $crons as $time => $cron ) {
$keys = array_keys( $cron );
$key = $keys[0];
$events[ $key ] = $time;
}
$expired = get_site_transient( 'astra-sites-import-check' );
if ( $expired ) {
global $wpdb;
$transient = 'astra-sites-import-check';
$transient_timeout = $wpdb->get_col(
$wpdb->prepare(
"SELECT option_value
FROM $wpdb->options
WHERE option_name
LIKE %s",
'%_transient_timeout_' . $transient . '%'
)
); // WPCS: cache ok. // WPCS: db call ok.
$older_date = $transient_timeout[0];
$transient_status = 'Transient: Not Expired! Recheck in ' . human_time_diff( time(), $older_date );
} else {
$transient_status = 'Transient: Starting.. Process for each 5 minutes.';
}
$temp = get_site_option( 'astra-sites-batch-status-string', '' );
$temp .= isset( $events['wp_astra_site_importer_cron'] ) ? '<br/>Batch: Recheck batch in ' . human_time_diff( time(), $events['wp_astra_site_importer_cron'] ) : '<br/>Batch: Not Started! Until the Transient expire.';
$upload_dir = self::get_instance()->log_dir();
$list_files = list_files( $upload_dir['path'] );
$backup_files = array();
$log_files = array();
foreach ( $list_files as $key => $file ) {
if ( strpos( $file, '.json' ) ) {
$backup_files[] = $file;
}
if ( strpos( $file, '.txt' ) ) {
$log_files[] = $file;
}
}
?>
<table>
<tr>
<td>
<h2>Log Files</h2>
<ul>
<?php
foreach ( $log_files as $key => $file ) {
$file_name = basename( $file );
$file = str_replace( $upload_dir['path'], $upload_dir['url'], $file );
?>
<li>
<a target="_blank" href="<?php echo esc_url( $file ); ?>"><?php echo esc_html( $file_name ); ?></a>
</li>
<?php } ?>
</ul>
</td>
<td>
<h2>Backup Files</h2>
<ul>
<?php
foreach ( $backup_files as $key => $file ) {
$file_name = basename( $file );
$file = str_replace( $upload_dir['path'], $upload_dir['url'], $file );
?>
<li>
<a target="_blank" href="<?php echo esc_url( $file ); ?>"><?php echo esc_html( $file_name ); ?></a>
</li>
<?php } ?>
</ul>
</td>
<td>
<div class="batch-log">
<p><?php echo wp_kses_post( $temp ); ?></p>
<p><?php echo wp_kses_post( $transient_status ); ?></p>
</div>
</td>
</tr>
</table>
<?php
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Importer_Log::get_instance();
endif;

View File

@@ -0,0 +1,678 @@
<?php
/**
* Astra Sites Importer
*
* @since 1.0.0
* @package Astra Sites
*/
use STImporter\Importer\ST_Importer_Helper;
use STImporter\Importer\WXR_Importer\ST_WXR_Importer;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'Astra_Sites_Importer' ) ) {
/**
* Astra Sites Importer
*/
class Astra_Sites_Importer {
/**
* Instance
*
* @since 1.0.0
* @var (Object) Class object
*/
public static $instance = null;
/**
* Set Instance
*
* @since 1.0.0
*
* @return object Class object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*
* @since 1.0.0
*/
public function __construct() {
require_once ASTRA_SITES_DIR . 'inc/classes/class-astra-sites-importer-log.php';
require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-sites-helper.php';
require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-widget-importer.php';
require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-customizer-import.php';
require_once ASTRA_SITES_DIR . 'inc/importers/class-astra-site-options-import.php';
// Hooks in AJAX.
add_action( 'wp_ajax_astra-sites-import-wpforms', array( $this, 'import_wpforms' ) );
add_action( 'wp_ajax_astra-sites-import-cartflows', array( $this, 'import_cartflows' ) );
add_action( 'wp_ajax_astra-sites-import-latepoint', array( $this, 'import_latepoint' ) );
add_action( 'astra_sites_import_complete', array( $this, 'clear_related_cache' ) );
require_once ASTRA_SITES_DIR . 'inc/importers/batch-processing/class-astra-sites-batch-processing.php';
if ( version_compare( get_bloginfo( 'version' ), '5.1.0', '>=' ) ) {
add_filter( 'http_request_timeout', array( $this, 'set_timeout_for_images' ), 10, 2 ); //phpcs:ignore WordPressVIPMinimum.Hooks.RestrictedHooks.http_request_timeout -- We need this to avoid timeout on slow servers while installing theme, plugin etc.
}
add_action( 'init', array( $this, 'disable_default_woo_pages_creation' ), 2 );
add_filter( 'upgrader_package_options', array( $this, 'plugin_install_clear_directory' ) );
}
/**
* Delete imported posts
*
* @since 1.3.0
* @since 1.4.0 The `$post_id` was added.
* Note: This function can be deleted after a few releases since we are performing the delete operation in chunks.
*
* @param integer $post_id Post ID.
* @return void
*/
public function delete_imported_posts( $post_id = 0 ) {
if ( wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : $post_id;
$message = 'Deleted - Post ID ' . $post_id . ' - ' . get_post_type( $post_id ) . ' - ' . get_the_title( $post_id );
$message = '';
if ( $post_id ) {
$post_type = get_post_type( $post_id );
$message = 'Deleted - Post ID ' . $post_id . ' - ' . $post_type . ' - ' . get_the_title( $post_id );
do_action( 'astra_sites_before_delete_imported_posts', $post_id, $post_type );
Astra_Sites_Importer_Log::add( $message );
wp_delete_post( $post_id, true );
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( $message );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $message );
}
}
/**
* Delete imported WP forms
*
* @since 1.3.0
* @since 1.4.0 The `$post_id` was added.
* Note: This function can be deleted after a few releases since we are performing the delete operation in chunks.
*
* @param integer $post_id Post ID.
* @return void
*/
public function delete_imported_wp_forms( $post_id = 0 ) {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$post_id = isset( $_REQUEST['post_id'] ) ? absint( $_REQUEST['post_id'] ) : $post_id;
$message = '';
if ( $post_id ) {
do_action( 'astra_sites_before_delete_imported_wp_forms', $post_id );
$message = 'Deleted - Form ID ' . $post_id . ' - ' . get_post_type( $post_id ) . ' - ' . get_the_title( $post_id );
Astra_Sites_Importer_Log::add( $message );
wp_delete_post( $post_id, true );
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( $message );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $message );
}
}
/**
* Delete imported terms
*
* @since 1.3.0
* @since 1.4.0 The `$post_id` was added.
* Note: This function can be deleted after a few releases since we are performing the delete operation in chunks.
*
* @param integer $term_id Term ID.
* @return void
*/
public function delete_imported_terms( $term_id = 0 ) {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$term_id = isset( $_REQUEST['term_id'] ) ? absint( $_REQUEST['term_id'] ) : $term_id;
$message = '';
if ( $term_id ) {
$term = get_term( $term_id );
if ( ! is_wp_error( $term ) && ! empty( $term ) && is_object( $term ) ) {
do_action( 'astra_sites_before_delete_imported_terms', $term_id, $term );
$message = 'Deleted - Term ' . $term_id . ' - ' . $term->name . ' ' . $term->taxonomy;
Astra_Sites_Importer_Log::add( $message );
wp_delete_term( $term_id, $term->taxonomy );
}
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( $message );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $message );
}
}
/**
* Delete related transients
*
* @since 3.1.3
*/
public function delete_related_transient() {
delete_option( 'astra_sites_batch_process_started' );
Astra_Sites_File_System::get_instance()->delete_demo_content();
delete_option( 'ast_ai_import_current_url' );
delete_option( 'astra_sites_ai_import_started' );
}
/**
* Delete directory when installing plugin.
*
* Set by enabling `clear_destination` option in the upgrader.
*
* @since 3.0.10
* @param array $options Options for the upgrader.
* @return array $options The options.
*/
public function plugin_install_clear_directory( $options ) {
if ( true !== astra_sites_has_import_started() ) {
return $options;
}
$is_ast_request = isset( $_REQUEST['is_ast_request'] ) && 'true' === $_REQUEST['is_ast_request']; //phpcs:ignore
if ( ! $is_ast_request ) {
return $options;
}
// Verify Nonce.
check_ajax_referer( 'astra-sites', 'ajax_nonce' );
if ( isset( $_REQUEST['clear_destination'] ) && 'true' === $_REQUEST['clear_destination'] ) {
$options['clear_destination'] = true;
}
return $options;
}
/**
* Restrict WooCommerce Pages Creation process
*
* Why? WooCommerce creates set of pages on it's activation
* These pages are re created via our XML import step.
* In order to avoid the duplicacy we restrict these page creation process.
*
* @since 3.0.0
*/
public function disable_default_woo_pages_creation() {
if ( astra_sites_has_import_started() ) {
add_filter( 'woocommerce_create_pages', '__return_empty_array' );
}
}
/**
* Set the timeout for the HTTP request by request URL.
*
* E.g. If URL is images (jpg|png|gif|jpeg) are from the domain `https://websitedemos.net` then we have set the timeout by 30 seconds. Default 5 seconds.
*
* @since 1.3.8
*
* @param int $timeout_value Time in seconds until a request times out. Default 5.
* @param string $url The request URL.
*/
public function set_timeout_for_images( $timeout_value, $url ) {
// URL not contain `https://websitedemos.net` then return $timeout_value.
if ( strpos( $url, 'https://websitedemos.net' ) === false ) {
return $timeout_value;
}
// Check is image URL of type jpg|png|gif|jpeg.
if ( astra_sites_is_valid_image( $url ) ) {
$timeout_value = 300;
}
return $timeout_value;
}
/**
* Change flow status
*
* @since 2.0.0
*
* @param array $args Flow query args.
* @return array Flow query args.
*/
public function change_flow_status( $args ) {
$args['post_status'] = 'publish';
return $args;
}
/**
* Track Flow
*
* @since 2.0.0
*
* @param integer $flow_id Flow ID.
* @return void
*/
public function track_flows( $flow_id ) {
Astra_Sites_Importer_Log::add( 'Flow ID ' . $flow_id );
ST_Importer_Helper::track_post( $flow_id );
}
/**
* Import WP Forms
*
* @since 1.2.14
* @since 1.4.0 The `$wpforms_url` was added.
*
* @param string $wpforms_url WP Forms JSON file URL.
* @return void
*/
public function import_wpforms( $wpforms_url = '' ) {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$screen = ( isset( $_REQUEST['screen'] ) ) ? sanitize_text_field( $_REQUEST['screen'] ) : '';
$id = ( isset( $_REQUEST['id'] ) ) ? absint( $_REQUEST['id'] ) : '';
$wpforms_url = ( 'elementor' === $screen ) ? astra_sites_get_wp_forms_url( $id ) : astra_get_site_data( 'astra-site-wpforms-path' );
$ids_mapping = array();
if ( ! astra_sites_is_valid_url( $wpforms_url ) ) {
/* Translators: %s is WP Forms URL. */
wp_send_json_error( sprintf( __( 'Invalid WPform Request URL - %s', 'astra-sites' ), $wpforms_url ) );
}
if ( ! empty( $wpforms_url ) && function_exists( 'wpforms_encode' ) ) {
// Download JSON file.
$file_path = ST_WXR_Importer::download_file( $wpforms_url );
if ( $file_path['success'] ) {
if ( isset( $file_path['data']['file'] ) ) {
$ext = strtolower( pathinfo( $file_path['data']['file'], PATHINFO_EXTENSION ) );
if ( 'json' === $ext ) {
$forms = json_decode( Astra_Sites::get_instance()->get_filesystem()->get_contents( $file_path['data']['file'] ), true );
if ( ! empty( $forms ) ) {
foreach ( $forms as $form ) {
$title = ! empty( $form['settings']['form_title'] ) ? $form['settings']['form_title'] : '';
$desc = ! empty( $form['settings']['form_desc'] ) ? $form['settings']['form_desc'] : '';
$new_id = post_exists( $title );
if ( ! $new_id ) {
$new_id = wp_insert_post(
array(
'post_title' => $title,
'post_status' => 'publish',
'post_type' => 'wpforms',
'post_excerpt' => $desc,
)
);
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Imported Form ' . $title );
}
// Set meta for tracking the post.
update_post_meta( $new_id, '_astra_sites_imported_wp_forms', true );
Astra_Sites_Importer_Log::add( 'Inserted WP Form ' . $new_id );
}
if ( $new_id ) {
// ID mapping.
$ids_mapping[ $form['id'] ] = $new_id;
$form['id'] = $new_id;
wp_update_post(
array(
'ID' => $new_id,
'post_content' => wpforms_encode( $form ),
)
);
}
}
}
} else {
wp_send_json_error( __( 'Invalid JSON file for WP Forms.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the WP Forms file.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the WP Forms file.', 'astra-sites' ) );
}
}
update_option( 'astra_sites_wpforms_ids_mapping', $ids_mapping, 'no' );
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'WP Forms Imported.' );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $ids_mapping );
}
}
/**
* Import CartFlows
*
* @since 2.0.0
*
* @param string $url Cartflows JSON file URL.
* @return void
*/
public function import_cartflows( $url = '' ) {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'edit_posts' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
// Disable CartFlows import logging.
add_filter( 'cartflows_enable_log', '__return_false' );
// Make the flow publish.
add_filter( 'cartflows_flow_importer_args', array( $this, 'change_flow_status' ) );
add_action( 'cartflows_flow_imported', array( $this, 'track_flows' ) );
add_action( 'cartflows_step_imported', array( $this, 'track_flows' ) );
add_filter( 'cartflows_enable_imported_content_processing', '__return_false' );
$url = astra_get_site_data( 'astra-site-cartflows-path' );
if ( ! empty( $url ) && is_callable( 'CartFlows_Importer::get_instance' ) ) {
// Download JSON file.
$file_path = ST_WXR_Importer::download_file( $url );
if ( $file_path['success'] ) {
if ( isset( $file_path['data']['file'] ) ) {
$ext = strtolower( pathinfo( $file_path['data']['file'], PATHINFO_EXTENSION ) );
if ( 'json' === $ext ) {
$flows = json_decode( Astra_Sites::get_instance()->get_filesystem()->get_contents( $file_path['data']['file'] ), true );
if ( ! empty( $flows ) && class_exists( 'CartFlows_Importer' ) ) {
CartFlows_Importer::get_instance()->import_from_json_data( $flows );
}
} else {
wp_send_json_error( __( 'Invalid file for CartFlows flows', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the CartFlows flows file.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the CartFlows flows file.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'Empty file for CartFlows flows', 'astra-sites' ) );
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Imported from ' . $url );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $url );
}
}
/**
* Import LatePoint
*
* @since 2.0.0
*
* @param string $url LatePoint JSON file URL.
* @return void
*/
public function import_latepoint( $url = '' ) {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'edit_posts' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$url = astra_get_site_data( 'astra-site-latepoint-path' );
if ( ! empty( $url ) && class_exists( 'OsSettingsHelper' ) ) {
// Download JSON file.
$file_path = ST_WXR_Importer::download_file( $url );
if ( $file_path['success'] ) {
if ( isset( $file_path['data']['file'] ) ) {
$ext = strtolower( pathinfo( $file_path['data']['file'], PATHINFO_EXTENSION ) );
if ( 'json' === $ext ) {
$content = Astra_Sites::get_instance()->get_filesystem()->get_contents( $file_path['data']['file'] );
if ( ! empty( $content ) && is_callable( 'OsSettingsHelper::import_data' ) ) {
OsSettingsHelper::import_data( $content );
}
} else {
wp_send_json_error( __( 'Invalid file for Latepoint tables', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the Latepoint tables file.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'There was an error downloading the Latepoint tables file.', 'astra-sites' ) );
}
} else {
wp_send_json_error( __( 'Empty file for Latepoint tables', 'astra-sites' ) );
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Imported from ' . $url );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $url );
}
}
/**
* Get single demo.
*
* @since 1.0.0
*
* @param (String) $demo_api_uri API URL of a demo.
*
* @return (Array) $astra_demo_data demo data for the demo.
*/
public static function get_single_demo( $demo_api_uri ) {
if ( is_int( $demo_api_uri ) ) {
$demo_api_uri = Astra_Sites::get_instance()->get_api_url() . 'astra-sites/' . $demo_api_uri;
}
// default values.
$remote_args = array();
$defaults = array(
'id' => '',
'astra-site-widgets-data' => '',
'astra-site-customizer-data' => '',
'astra-site-options-data' => '',
'astra-post-data-mapping' => '',
'astra-site-wxr-path' => '',
'astra-site-wpforms-path' => '',
'astra-enabled-extensions' => '',
'astra-custom-404' => '',
'required-plugins' => '',
'astra-site-taxonomy-mapping' => '',
'license-status' => '',
'site-type' => '',
'astra-site-url' => '',
);
$api_args = apply_filters(
'astra_sites_api_args',
array(
'timeout' => 15,
)
);
// Use this for premium demos.
$request_params = apply_filters(
'astra_sites_api_params',
array(
'purchase_key' => '',
'site_url' => '',
)
);
$demo_api_uri = add_query_arg( $request_params, trailingslashit( $demo_api_uri ) );
// API Call.
$response = wp_safe_remote_get( $demo_api_uri, $api_args );
if ( is_wp_error( $response ) || ( isset( $response->status ) && 0 === $response->status ) ) {
if ( isset( $response->status ) ) {
$data = json_decode( $response, true );
} else {
return new WP_Error( 'api_invalid_response_code', $response->get_error_message() );
}
}
if ( wp_remote_retrieve_response_code( $response ) !== 200 ) {
return new WP_Error( 'api_invalid_response_code', wp_remote_retrieve_body( $response ) );
} else {
$data = json_decode( wp_remote_retrieve_body( $response ), true );
}
$data = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! isset( $data['code'] ) ) {
$remote_args['id'] = $data['id'];
$remote_args['astra-site-widgets-data'] = json_decode( $data['astra-site-widgets-data'] );
$remote_args['astra-site-customizer-data'] = $data['astra-site-customizer-data'];
$remote_args['astra-site-options-data'] = $data['astra-site-options-data'];
$remote_args['astra-post-data-mapping'] = $data['astra-post-data-mapping'];
$remote_args['astra-site-wxr-path'] = $data['astra-site-wxr-path'];
$remote_args['astra-site-wpforms-path'] = $data['astra-site-wpforms-path'];
$remote_args['astra-enabled-extensions'] = $data['astra-enabled-extensions'];
$remote_args['astra-custom-404'] = $data['astra-custom-404'];
$remote_args['required-plugins'] = $data['required-plugins'];
$remote_args['astra-site-taxonomy-mapping'] = $data['astra-site-taxonomy-mapping'];
$remote_args['license-status'] = $data['license-status'];
$remote_args['site-type'] = $data['astra-site-type'];
$remote_args['astra-site-url'] = $data['astra-site-url'];
}
// Merge remote demo and defaults.
return wp_parse_args( $remote_args, $defaults );
}
/**
* Clear Cache.
*
* @since 1.0.9
*/
public function clear_related_cache() {
// Clear 'Builder Builder' cache.
if ( is_callable( 'FLBuilderModel::delete_asset_cache_for_all_posts' ) ) {
FLBuilderModel::delete_asset_cache_for_all_posts();
Astra_Sites_Importer_Log::add( 'Cache for Beaver Builder cleared.' );
}
// Clear 'Astra Addon' cache.
if ( is_callable( 'Astra_Minify::refresh_assets' ) ) {
Astra_Minify::refresh_assets();
Astra_Sites_Importer_Log::add( 'Cache for Astra Addon cleared.' );
}
Astra_Sites_Utils::third_party_cache_plugins_clear_cache();
$this->update_latest_checksums();
// Flush permalinks.
flush_rewrite_rules(); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.flush_rewrite_rules_flush_rewrite_rules -- This function is called only after import is completed
}
/**
* Update Latest Checksums
*
* Store latest checksum after batch complete.
*
* @since 2.0.0
* @return void
*/
public function update_latest_checksums() {
$latest_checksums = get_site_option( 'astra-sites-last-export-checksums-latest', '' );
update_site_option( 'astra-sites-last-export-checksums', $latest_checksums );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Importer::get_instance();
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* Init
*
* @since 1.0.0
* @package NPS Survey
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Sites_Nps_Notice' ) ) :
/**
* Admin
*/
class Astra_Sites_Nps_Notice {
/**
* Instance
*
* @since 1.0.0
* @var (Object) Astra_Sites_Nps_Notice
*/
private static $instance = null;
/**
* Get Instance
*
* @since 1.0.0
*
* @return object Class object.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*
* @since 1.0.0
*/
private function __construct() {
add_action( 'admin_footer', array( $this, 'render_nps_survey' ), 999 );
}
/**
* Render NPS Survey
*
* @return void
*/
public function render_nps_survey() {
if ( ! class_exists( 'Nps_Survey' ) ) {
return;
}
if ( class_exists( 'Astra_Sites_White_Label' ) && is_callable( 'Astra_Sites_White_Label::get_instance' ) && Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
return;
}
$allowed_screens = array( 'appearance_page_starter-templates', 'appearance_page_ai-builder' );
Nps_Survey::show_nps_notice(
'nps-survey-astra-sites',
array(
'show_if' => get_option( 'astra_sites_import_complete', false ),
'dismiss_timespan' => 2 * WEEK_IN_SECONDS,
'display_after' => 0,
'plugin_slug' => 'astra-sites',
'show_on_screens' => $allowed_screens,
'message' => array(
// Step 1 i.e rating input.
'logo' => esc_url( INTELLIGENT_TEMPLATES_URI . 'assets/images/logo.svg' ),
'plugin_name' => __( 'Starter Templates', 'astra-sites' ),
'nps_rating_message' => __( 'How likely are you to recommend #pluginname to your friends or colleagues?', 'astra-sites' ),
// Step 2A i.e. positive.
'feedback_title' => __( 'Thanks a lot for your feedback! 😍', 'astra-sites' ),
'feedback_content' => __( 'Could you please do us a favor and give us a 5-star rating on WordPress? It would help others choose Starter Templates with confidence. Thank you!', 'astra-sites' ),
'plugin_rating_link' => esc_url( 'https://wordpress.org/support/plugin/astra-sites/reviews/#new-post' ),
// Step 2B i.e. negative.
'plugin_rating_title' => __( 'Thank you for your feedback', 'astra-sites' ),
'plugin_rating_content' => __( 'We value your input. How can we improve your experience?', 'astra-sites' ),
),
)
);
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Nps_Notice::get_instance();
endif;

View File

@@ -0,0 +1,613 @@
<?php
/**
* Astra Sites Page
*
* @since 1.0.6
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Sites_Page' ) ) {
/**
* Astra Admin Settings
*/
class Astra_Sites_Page {
/**
* View all actions
*
* @since 1.0.6
* @var array $view_actions
*/
public $view_actions = array();
/**
* Member Variable
*
* @var instance
*/
private static $instance;
/**
* Initiator
*
* @since 1.3.0
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.3.0
*/
public function __construct() {
if ( ! current_user_can( 'edit_posts' ) ) {
return;
}
add_action( 'wp_ajax_astra-sites-change-page-builder', array( $this, 'save_page_builder_on_ajax' ) );
add_action( 'wp_ajax_astra-sites-dismiss-ai-promotion', array( $this, 'dismiss_ai_promotion' ) );
add_action( 'admin_init', array( $this, 'getting_started' ) );
}
/**
* Admin notice
*
* @since 1.3.5
*
* @return void
*/
public function getting_started() {
$current_screen = get_current_screen();
// Bail if not on Astra Sites screen.
if ( ! is_object( $current_screen ) && null === $current_screen ) {
return;
}
if ( 'plugins' === $current_screen->base ) {
$processed = get_option( '_astra_sites_gettings_started', 'no' );
$product_name = Astra_Sites_White_Label::get_instance()->get_white_label_name( 'Astra' );
if ( 'yes' === $processed ) {
return;
}
$arguments = array(
'page' => 'starter-templates',
);
$url = add_query_arg( $arguments, admin_url( 'themes.php' ) );
?>
<div class="notice notice-info is-dismissible astra-sites-notice astra-sites-getting-started-notice">
<?php /* translators: %1$s is the admin page URL, %2$s is product name. */ ?>
<p><?php printf( esc_attr__( 'Thank you for choosing %1$s! Check the library of <a class="astra-sites-getting-started-btn" href="%2$s">ready starter templates here »</a>', 'astra-sites' ), esc_html( $product_name ), esc_url( $url ) ); ?></p>
</div>
<?php
}
}
/**
* Save Page Builder
*
* @since 1.4.0 The `$page_builder_slug` was added.
*
* @param string $page_builder_slug Page Builder Slug.
* @return mixed
*/
public function save_page_builder_on_submit( $page_builder_slug = '' ) {
// Only admins can save settings.
if ( ! defined( 'WP_CLI' ) && ! current_user_can( 'manage_options' ) ) {
return;
}
if ( ! defined( 'WP_CLI' ) && ( ! isset( $_REQUEST['astra-sites-page-builder'] ) || ! wp_verify_nonce( sanitize_text_field( $_REQUEST['astra-sites-page-builder'] ), 'astra-sites-welcome-screen' ) ) ) {
return;
}
// Stored Settings.
$stored_data = $this->get_settings();
$page_builder = isset( $_REQUEST['page_builder'] ) ? sanitize_key( $_REQUEST['page_builder'] ) : sanitize_key( $page_builder_slug );
if ( ! empty( $page_builder ) ) {
// New settings.
$new_data = array(
'page_builder' => $page_builder,
);
// Merge settings.
$data = wp_parse_args( $new_data, $stored_data );
// Update settings.
update_option( 'astra_sites_settings', $data );
}
if ( ! defined( 'WP_CLI' ) ) {
wp_safe_redirect( admin_url( '/themes.php?page=astra-sites' ) );
exit;
}
}
/**
* Save Page Builder
*
* @return void
*/
public function save_page_builder_on_ajax() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
// Only admins can save settings.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error();
}
// Stored Settings.
$stored_data = $this->get_settings();
// New settings.
$new_data = array(
'page_builder' => ( isset( $_REQUEST['page_builder'] ) ) ? sanitize_key( $_REQUEST['page_builder'] ) : '',
);
// Merge settings.
$data = wp_parse_args( $new_data, $stored_data );
// Update settings.
update_option( 'astra_sites_settings', $data, 'no' );
$sites = $this->get_sites_by_page_builder( $new_data['page_builder'] );
wp_send_json_success( $sites );
}
/**
* Dismiss AI Promotion
*
* @return void
*/
public function dismiss_ai_promotion() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
// Only admins can save settings.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
// Stored Settings.
$stored_data = $this->get_settings();
// New settings.
$new_data = array(
'dismiss_ai_promotion' => ( isset( $_REQUEST['dismiss_ai_promotion'] ) ) ? sanitize_key( $_REQUEST['dismiss_ai_promotion'] ) : false,
);
// Merge settings.
$data = wp_parse_args( $new_data, $stored_data );
// Update settings.
update_option( 'astra_sites_settings', $data, 'no' );
wp_send_json_success( __( 'Notice Dismissed!', 'astra-sites' ) );
}
/**
* Get Page Builder Sites
*
* @since 2.0.0
*
* @param string $default_page_builder default page builder slug.
* @return array page builder sites.
*/
public function get_sites_by_page_builder( $default_page_builder = '' ) {
$sites_and_pages = Astra_Sites::get_instance()->get_all_sites();
$current_page_builder_sites = array();
if ( ! empty( $sites_and_pages ) ) {
$page_builder_keys = wp_list_pluck( $sites_and_pages, 'astra-site-page-builder' );
foreach ( $page_builder_keys as $site_id => $page_builder ) {
if ( $default_page_builder === $page_builder ) {
$current_page_builder_sites[ $site_id ] = $sites_and_pages[ $site_id ];
}
}
}
return $current_page_builder_sites;
}
/**
* Get single setting value
*
* @param string $key Setting key.
* @param mixed $defaults Setting value.
* @return mixed Stored setting value.
*/
public function get_setting( $key = '', $defaults = '' ) {
$settings = $this->get_settings();
if ( empty( $settings ) ) {
return $defaults;
}
if ( array_key_exists( $key, $settings ) ) {
return $settings[ $key ];
}
return $defaults;
}
/**
* Get Settings
*
* @return array Stored settings.
*/
public function get_settings() {
$defaults = array(
'page_builder' => 'gutenberg',
);
$stored_data = get_option( 'astra_sites_settings', $defaults );
return wp_parse_args( $stored_data, $defaults );
}
/**
* Update Settings
*
* @param array $args Arguments.
*/
public function update_settings( $args = array() ) {
$stored_data = get_option( 'astra_sites_settings', array() );
$new_data = wp_parse_args( $args, $stored_data );
update_option( 'astra_sites_settings', $new_data, 'no' );
}
/**
* View actions
*
* @since 1.0.11
*/
public function get_view_actions() {
if ( empty( $this->view_actions ) ) {
$this->view_actions = apply_filters(
'astra_sites_menu_item',
array()
);
}
return $this->view_actions;
}
/**
* Site Filters
*
* @since 2.0.0
*
* @return void
*/
public function site_filters() {
?>
<div class="wp-filter hide-if-no-js">
<div class="section-left">
<div class="search-form">
<?php
$categories = Astra_Sites_File_System::get_instance()->get_json_file_content( 'astra-sites-all-site-categories.json' );
if ( ! empty( $categories ) ) {
?>
<div id="astra-sites__category-filter" class="dropdown-check-list" tabindex="100">
<span class="astra-sites__category-filter-anchor" data-slug=""><?php esc_html_e( 'All', 'astra-sites' ); ?></span>
<ul class="astra-sites__category-filter-items">
<li class="ast-sites__filter-wrap category-active" data-slug=""><?php esc_html_e( 'All', 'astra-sites' ); ?> </li>
<?php
foreach ( $categories as $key => $value ) {
if ( 'free' !== $value['slug'] ) {
?>
<li class="ast-sites__filter-wrap" data-slug="<?php echo esc_attr( $value['slug'] ); ?>"><?php echo esc_html( $value['name'] ); ?> </li>
<?php
}
}
?>
<li class="ast-sites__filter-wrap-checkbox first-wrap">
<label>
<input id="radio-all" type="radio" name="ast-sites-radio" class="checkbox active" value="" checked /><?php esc_html_e( 'All', 'astra-sites' ); ?>
</label>
</li>
<li class="ast-sites__filter-wrap-checkbox">
<label>
<input id="radio-free" type="radio" name="ast-sites-radio" class="checkbox" value="free" /><?php esc_html_e( 'Free', 'astra-sites' ); ?>
</label>
</li>
<li class="ast-sites__filter-wrap-checkbox">
<label>
<input id="radio-agency" type="radio" name="ast-sites-radio" class="checkbox" value="agency" /><?php esc_html_e( 'Premium', 'astra-sites' ); ?>
</label>
</li>
</ul>
</div>
<?php
}
?>
<input autocomplete="off" placeholder="<?php esc_attr_e( 'Search...', 'astra-sites' ); ?>" type="search" aria-describedby="live-search-desc" id="wp-filter-search-input" class="wp-filter-search">
<span class="ast-icon-search search-icon"></span>
<div class="astra-sites-autocomplete-result"></div>
</div>
</div>
</div>
<?php
}
/**
* Get Default Page Builder
*
* @since 2.0.0
*
* @return mixed page builders or empty string.
*/
public function get_default_page_builder() {
$default_page_builder = $this->get_setting( 'page_builder' );
$page_builders = Astra_Sites::get_instance()->get_page_builders();
foreach ( $page_builders as $key => $page_builder ) {
if ( $page_builder['slug'] === $default_page_builder ) {
return $page_builder;
}
}
return '';
}
/**
* Get Page Builders
*
* @since 2.0.0
*
* @param string $slug Page Builder Slug.
* @return array page builders.
*/
public function get_page_builder_image( $slug ) {
$image = '';
switch ( $slug ) {
case 'elementor':
$image = ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg';
break;
case 'beaver-builder':
$image = ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg';
break;
case 'gutenberg':
$image = ASTRA_SITES_URI . 'inc/assets/images/block-editor.png';
break;
case 'brizy':
$image = ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg';
break;
}
return $image;
}
/**
* Page Builder List
*
* @since 1.4.0
* @return array
*/
public function get_page_builders() {
return array(
'gutenberg' => array(
'slug' => 'gutenberg',
'name' => esc_html__( 'Gutenberg', 'astra-sites' ),
'image_url' => ASTRA_SITES_URI . 'inc/assets/images/block-editor.jpg',
'title' => esc_html__( 'The default WordPress editor', 'astra-sites' ),
),
'elementor' => array(
'slug' => 'elementor',
'name' => esc_html__( 'Elementor', 'astra-sites' ),
'image_url' => ASTRA_SITES_URI . 'inc/assets/images/elementor.jpg',
),
'beaver-builder' => array(
'slug' => 'beaver-builder',
'name' => esc_html__( 'Beaver Builder', 'astra-sites' ),
'image_url' => ASTRA_SITES_URI . 'inc/assets/images/beaver-builder.jpg',
),
'brizy' => array(
'slug' => 'brizy',
'name' => esc_html__( 'Brizy', 'astra-sites' ),
'image_url' => ASTRA_SITES_URI . 'inc/assets/images/brizy.jpg',
),
);
}
/**
* Get and return page URL
*
* @param string $menu_slug Menu name.
* @since 1.0.6
* @return string page url
*/
public function get_page_url( $menu_slug ) {
$current_slug = isset( $_GET['page'] ) ? sanitize_text_field( $_GET['page'] ) : 'starter-templates'; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Fetching GET parameter, no nonce associated with this action.
$parent_page = 'themes.php';
if ( strpos( $parent_page, '?' ) !== false ) {
$query_var = '&page=' . $current_slug;
} else {
$query_var = '?page=' . $current_slug;
}
$parent_page_url = admin_url( $parent_page . $query_var );
$url = $parent_page_url . '&action=' . $menu_slug;
return esc_url( $url );
}
/**
* Converts a period of time in seconds into a human-readable format representing the interval.
*
* @since 2.0.0
*
* Example:
*
* echo self::interval( 90 );
* // 1 minute 30 seconds
*
* @param int $since A period of time in seconds.
* @return string An interval represented as a string.
*/
public function interval( $since ) {
// Array of time period chunks.
$chunks = array(
/* translators: 1: The number of years in an interval of time. */
array( 60 * 60 * 24 * 365, _n_noop( '%s year', '%s years', 'astra-sites' ) ),
/* translators: 1: The number of months in an interval of time. */
array( 60 * 60 * 24 * 30, _n_noop( '%s month', '%s months', 'astra-sites' ) ),
/* translators: 1: The number of weeks in an interval of time. */
array( 60 * 60 * 24 * 7, _n_noop( '%s week', '%s weeks', 'astra-sites' ) ),
/* translators: 1: The number of days in an interval of time. */
array( 60 * 60 * 24, _n_noop( '%s day', '%s days', 'astra-sites' ) ),
/* translators: 1: The number of hours in an interval of time. */
array( 60 * 60, _n_noop( '%s hour', '%s hours', 'astra-sites' ) ),
/* translators: 1: The number of minutes in an interval of time. */
array( 60, _n_noop( '%s minute', '%s minutes', 'astra-sites' ) ),
/* translators: 1: The number of seconds in an interval of time. */
array( 1, _n_noop( '%s second', '%s seconds', 'astra-sites' ) ),
);
if ( $since <= 0 ) {
return esc_html__( 'now', 'astra-sites' );
}
/**
* We only want to output two chunks of time here, eg:
* x years, xx months
* x days, xx hours
* so there's only two bits of calculation below:
*/
$j = count( $chunks );
// Step one: the first chunk.
for ( $i = 0; $i < $j; $i++ ) {
$seconds = $chunks[ $i ][0];
$name = $chunks[ $i ][1];
// Finding the biggest chunk (if the chunk fits, break).
$count = floor( $since / $seconds );
if ( $count ) {
break;
}
}
// Set output var.
$output = sprintf( translate_nooped_plural( $name, $count, 'astra-sites' ), $count );
// Step two: the second chunk.
if ( $i + 1 < $j ) {
$seconds2 = $chunks[ $i + 1 ][0];
$name2 = $chunks[ $i + 1 ][1];
$count2 = floor( ( $since - ( $seconds * $count ) ) / $seconds2 );
if ( $count2 ) {
// Add to output var.
$output .= ' ' . sprintf( translate_nooped_plural( $name2, $count2, 'astra-sites' ), $count2 );
}
}
return $output;
}
/**
* Check Cron Status
*
* Gets the current cron status by performing a test spawn. Cached for one hour when all is well.
*
* @since 2.0.0
*
* @param bool $cache Whether to use the cached result from previous calls.
* @return true|WP_Error Boolean true if the cron spawner is working as expected, or a WP_Error object if not.
*/
public static function test_cron( $cache = true ) {
global $wp_version;
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
return new WP_Error( 'astra_sites_cron_error', esc_html__( 'ERROR! Cron schedules are disabled by setting constant DISABLE_WP_CRON to true.<br/>To start the import process please enable the cron by setting the constant to false. E.g. define( \'DISABLE_WP_CRON\', false );', 'astra-sites' ) );
}
if ( defined( 'ALTERNATE_WP_CRON' ) && ALTERNATE_WP_CRON ) {
return new WP_Error( 'astra_sites_cron_error', esc_html__( 'ERROR! Cron schedules are disabled by setting constant ALTERNATE_WP_CRON to true.<br/>To start the import process please enable the cron by setting the constant to false. E.g. define( \'ALTERNATE_WP_CRON\', false );', 'astra-sites' ) );
}
$cached_status = get_transient( 'astra-sites-cron-test-ok' );
if ( $cache && $cached_status ) {
return true;
}
$sslverify = version_compare( $wp_version, 4.0, '<' );
$doing_wp_cron = sprintf( '%.22F', microtime( true ) );
$cron_request = apply_filters(
'cron_request',
array(
'url' => site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron ),
'key' => $doing_wp_cron,
'args' => array(
'timeout' => 3,
'blocking' => true,
'sslverify' => apply_filters( 'https_local_ssl_verify', $sslverify ),
),
)
);
$cron_request['args']['blocking'] = true;
$result = wp_safe_remote_post( $cron_request['url'], $cron_request['args'] );
if ( is_wp_error( $result ) ) {
return $result;
} elseif ( wp_remote_retrieve_response_code( $result ) >= 300 ) {
return new WP_Error(
'unexpected_http_response_code',
sprintf(
/* translators: 1: The HTTP response code. */
__( 'Unexpected HTTP response code: %s', 'astra-sites' ),
intval( wp_remote_retrieve_response_code( $result ) )
)
);
} else {
set_transient( 'astra-sites-cron-test-ok', 1, 3600 );
return true;
}
}
}
Astra_Sites_Page::get_instance();
}// End if.

View File

@@ -0,0 +1,149 @@
<?php
/**
* Astra Sites Update
*
* @package Astra Sites
*/
if ( ! class_exists( 'Astra_Sites_Update' ) ) :
/**
* Astra Sites Update
*
* @since 4.2.2
*/
class Astra_Sites_Update {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 4.2.2
*/
private static $instance = null;
/**
* Initiator
*
* @since 4.2.2
* @return object initialized object of class.
*/
public static function set_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 4.2.2
*/
public function __construct() {
add_action( 'astra_update_before', __CLASS__ . '::init' );
}
/**
* Update
*
* @since 4.2.2
* @return void
*/
public static function init() {
do_action( 'astra_sites_update_before' );
// Get auto saved version number.
$saved_version = get_option( 'astra-sites-auto-version', '0' );
// If equals then return.
if ( version_compare( $saved_version, ASTRA_SITES_VER, '=' ) ) {
return;
}
if ( version_compare( $saved_version, '4.2.2 ', '<' ) ) {
// Run batch process to create the json files for existing users.
delete_site_option( 'astra-sites-fresh-site' );
delete_site_option( 'astra-sites-last-export-checksums' );
$site_pages = get_option( 'astra-sites-requests' );
if ( ! empty( $site_pages ) ) {
// Delete all sites.
for ( $site_page = 1; $site_page <= $site_pages; $site_page++ ) {
delete_site_option( 'astra-sites-and-pages-page-' . $site_page );
}
}
$old_options = array(
'astra-blocks-1',
'astra-blocks-2',
'astra-blocks-3',
'astra-blocks-4',
'astra-sites-site-category',
'astra-sites-all-site-categories',
'astra-sites-page-builders',
'astra-blocks-categories',
'astra-sites-requests',
);
foreach ( $old_options as $option ) {
delete_site_option( $option );
}
delete_site_transient( 'astra-sites-import-check' );
}
if ( version_compare( $saved_version, '4.3.1', '<' ) ) {
if ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) {
delete_site_option( 'astra-sites-fresh-site' );
delete_site_option( 'astra-sites-batch-status' );
delete_site_transient( 'astra-sites-import-check' );
}
}
if ( version_compare( $saved_version, '4.4.2', '<' ) ) {
$transient_name = 'nps-survay-form-dismissed';
$expiration_time = get_option( '_transient_timeout_' . $transient_name );
$nps_transient = get_transient( $transient_name );
if ( $nps_transient && $expiration_time ) {
$transient_duration = 2 * WEEK_IN_SECONDS;
$creation_time = $expiration_time - $transient_duration;
$status = get_option( 'nps-survay-form-dismiss-status', array() );
$status['dismiss_time'] = $creation_time;
update_option( 'nps-survay-form-dismiss-status', $status );
}
}
if ( version_compare( $saved_version, '4.4.6', '<' ) ) {
$old_dismiss_varible = get_option( 'nps-survay-form-dismiss-status' );
if ( ! empty( $old_dismiss_varible ) ) {
update_option( 'nps-survey-astra-sites', $old_dismiss_varible );
delete_option( 'nps-survay-form-dismiss-status' );
}
}
// Auto update product latest version.
update_option( 'astra-sites-auto-version', ASTRA_SITES_VER, 'no' );
do_action( 'astra_sites_update_after' );
}
}
/**
* Kicking this off by calling 'set_instance()' method
*/
Astra_Sites_Update::set_instance();
endif;

View File

@@ -0,0 +1,59 @@
<?php
/**
* Astra Sites Utlis
*
* @since 1.0.0
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'Astra_Sites_Utils' ) ) :
/**
* Astra_Sites_Utils
*/
class Astra_Sites_Utils {
/**
* Third party cache plugin clear cache.
*
* @since 4.0.0
* @return void
*/
public static function third_party_cache_plugins_clear_cache() {
// Clear LiteSpeed cache.
if ( class_exists( '\LiteSpeed\Purge' ) ) {
\LiteSpeed\Purge::purge_all();
}
// Clear cloudways cache.
self::clear_cloudways_cache();
}
/**
* This function helps to purge all cache in clodways envirnoment.
* In presence of Breeze plugin (https://wordpress.org/plugins/breeze/)
*
* @since 4.0.0
* @return void
*/
public static function clear_cloudways_cache() {
if ( ! class_exists( 'Breeze_Configuration' ) || ! class_exists( 'Breeze_CloudFlare_Helper' ) || ! class_exists( 'Breeze_Admin' ) ) {
return;
}
// clear varnish cache.
$admin = new Breeze_Admin();
$admin->breeze_clear_varnish();
// clear static cache.
Breeze_Configuration::breeze_clean_cache();
Breeze_CloudFlare_Helper::reset_all_cache();
}
}
endif;

View File

@@ -0,0 +1,328 @@
<?php
/**
* Astra Sites White Label
*
* @package Astra Sites
* @since 1.0.12
*/
if ( ! class_exists( 'Astra_Sites_White_Label' ) ) :
/**
* Astra_Sites_White_Label
*
* @since 1.0.12
*/
class Astra_Sites_White_Label {
/**
* Instance
*
* @since 1.0.12
*
* @var object Class Object.
* @access private
*/
private static $instance;
/**
* Member Variable
*
* @since 1.0.12
*
* @var array branding
* @access private
*/
private static $branding;
/**
* Settings
*
* @since 1.2.11
*
* @var array settings
*
* @access private
*/
private $settings;
/**
* Initiator
*
* @since 1.0.12
*
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.12
*/
public function __construct() {
add_filter( 'all_plugins', array( $this, 'plugins_page' ) );
add_filter( 'astra_addon_branding_options', __CLASS__ . '::settings' );
add_action( 'astra_pro_white_label_add_form', __CLASS__ . '::add_white_label_form' );
add_filter( 'astra_sites_menu_page_title', array( $this, 'get_white_label_name' ) );
add_filter( 'astra_sites_page_title', array( $this, 'get_white_label_name' ) );
// Update Astra's admin top level menu position.
add_filter( 'astra_menu_priority', array( $this, 'update_admin_menu_position' ) );
// Display the link with the plugin meta.
if ( is_admin() ) {
add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 4 );
}
add_filter( 'gutenberg_templates_localize_vars', array( $this, 'add_white_label_name' ) );
add_filter( 'ast_block_templates_white_label', array( $this, 'is_white_labeled' ) );
add_filter( 'ast_block_templates_white_label_name', array( $this, 'get_white_label' ) );
}
/**
* Update Astra's menu priority to show after Dashboard menu.
*
* @param int $menu_priority top level menu priority.
* @since 3.1.22
*/
public function update_admin_menu_position( $menu_priority ) {
return 2.1;
}
/**
* Add White Label data
*
* @param array $args White label.
* @since 2.6.0
*/
public function add_white_label_name( $args = array() ) {
$args['white_label_name'] = $this->get_white_label();
return $args;
}
/**
* White labels the plugins page.
*
* @since 1.0.12
*
* @param array $plugins Plugins Array.
* @return array
*/
public function plugins_page( $plugins ) {
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
return $plugins;
}
if ( ! isset( $plugins[ ASTRA_SITES_BASE ] ) ) {
return $plugins;
}
// Set White Labels.
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
$description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
$author = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author' );
$author_uri = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author_url' );
if ( ! empty( $name ) ) {
$plugins[ ASTRA_SITES_BASE ]['Name'] = $name;
// Remove Plugin URI if Agency White Label name is set.
$plugins[ ASTRA_SITES_BASE ]['PluginURI'] = '';
}
if ( ! empty( $description ) ) {
$plugins[ ASTRA_SITES_BASE ]['Description'] = $description;
}
if ( ! empty( $author ) ) {
$plugins[ ASTRA_SITES_BASE ]['Author'] = $author;
}
if ( ! empty( $author_uri ) ) {
$plugins[ ASTRA_SITES_BASE ]['AuthorURI'] = $author_uri;
}
return $plugins;
}
/**
* Get value of single key from option array.
*
* @since 2.0.0.
* @param string $type Option type.
* @param string $key Option key.
* @param string $default Default value if key not found.
* @return mixed Return stored option value.
*/
public static function get_option( $type = '', $key = '', $default = null ) {
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
return $default;
}
$value = Astra_Ext_White_Label_Markup::get_white_label( $type, $key );
if ( ! empty( $value ) ) {
return $value;
}
return $default;
}
/**
* Remove a "view details" link from the plugin list table
*
* @since 1.0.12
*
* @param array $plugin_meta List of links.
* @param string $plugin_file Relative path to the main plugin file from the plugins directory.
* @param array $plugin_data Data from the plugin headers.
* @return array
*/
public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
return $plugin_meta;
}
// Set White Labels.
if ( ASTRA_SITES_BASE === $plugin_file ) {
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
$description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' );
// Remove Plugin URI if Agency White Label name is set.
if ( ! empty( $name ) ) {
unset( $plugin_meta[2] );
}
}
return $plugin_meta;
}
/**
* Add White Label setting's
*
* @since 1.0.12
*
* @param array $settings White label setting.
* @return array
*/
public static function settings( $settings = array() ) {
$settings['astra-sites'] = array(
'name' => '',
'description' => '',
);
return $settings;
}
/**
* Add White Label form
*
* @since 1.0.12
*
* @param array $settings White label setting.
* @return void
*/
public static function add_white_label_form( $settings = array() ) {
/* translators: %1$s product name */
$plugin_name = sprintf( __( '%1$s Branding', 'astra-sites' ), ASTRA_SITES_NAME );
require_once ASTRA_SITES_DIR . 'inc/includes/white-label.php';
}
/**
* Page Title
*
* @since 1.0.12
*
* @param string $title Page Title.
* @return string Filtered Page Title.
*/
public function get_white_label_name( $title = '' ) {
if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
$astra_sites_name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
if ( ! empty( $astra_sites_name ) ) {
return Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
}
}
return ASTRA_SITES_NAME;
}
/**
* White Label Link
*
* @since 2.0.0
*
* @param string $link Default link.
* @return string Filtered Page Title.
*/
public function get_white_label_link( $link = '' ) {
if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
$white_label_link = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'licence' );
if ( ! empty( $white_label_link ) ) {
return $white_label_link;
}
}
return $link;
}
/**
* Is Astra sites White labeled
*
* @since 1.2.13
*
* @return string
*/
public function is_white_labeled() {
$white_label = $this->get_white_label();
if ( empty( $white_label ) ) {
return false;
}
return true;
}
/**
* Get white label name
*
* @since 2.6.0
*
* @return string
*/
public function get_white_label() {
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
return '';
}
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' );
if ( ! empty( $name ) ) {
return $name;
}
return '';
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_White_Label::get_instance();
endif;

View File

@@ -0,0 +1,812 @@
<?php
/**
* Astra Sites WP CLI
*
* 1. Run `wp astra-sites list` List of all astra sites.
* 2. Run `wp astra-sites import <id>` Import site.
*
* @package Astra Sites
* @since 1.4.0
*/
use STImporter\Importer\WXR_Importer\ST_WXR_Importer;
use STImporter\Importer\Batch\ST_Batch_Processing;
use AiBuilder\Inc\Traits\Helper;
if ( class_exists( 'WP_CLI_Command' ) && ! class_exists( 'Astra_Sites_WP_CLI' ) ) :
/**
* WP-Cli commands to manage Astra Starter Sites.
*
* @since 1.4.0
*/
class Astra_Sites_WP_CLI extends WP_CLI_Command {
/**
* Site Data
*
* @var array
*/
protected $current_site_data;
/**
* Process Batch
*
* ## EXAMPLES
*
* $ wp astra-sites batch
* Processing Site: http://example.com/
* Batch Process Started..
* ..
*
* @since 2.1.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
*/
public function batch( $args, $assoc_args ) {
WP_CLI::line( 'Processing Site: ' . site_url() );
ST_Batch_Processing::get_instance()->start_process();
}
/**
* Generates the list of all Astra Sites.
*
* ## OPTIONS
*
* [--per-page=<number>]
* : No of sites to show in the list. Default its showing 10 sites.
*
* [--search=<text>]
* : Show the sites from particular search term.
*
* [--category=<text>]
* : Show the site from the specific category.
*
* [--page-builder=<text>]
* : List the sites from the particular page builder.
*
* [--type=<text>]
* : List the sites from the particular site type.
*
* ## EXAMPLES
*
* # List all the sites.
* $ wp astra-sites list
* +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
* | id | title | url | type | categories | page-builder |
* +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
* | 34184 | Nutritionist | //websitedemos.net/nutritionist-01 | free | Business, Free | Elementor |
* | 34055 | Law Firm | //websitedemos.net/law-firm-03 | premium | Business | Elementor |
* +-------+-------------------+-----------------------------------------+---------+----------------+--------------+
*
* @since 1.4.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
*
* @alias list
*/
public function list_sites( $args, $assoc_args ) {
$per_page = isset( $assoc_args['per-page'] ) ? $assoc_args['per-page'] : 10;
$search = isset( $assoc_args['search'] ) ? $assoc_args['search'] : '';
$rest_args = array(
'_fields' => 'id,title,slug,astra-sites-site-category,astra-site-page-builder,astra-site-type,astra-site-url',
'per_page' => $per_page,
);
if ( ! empty( $search ) ) {
$rest_args['search'] = $search;
}
$list = (array) $this->get_sites( 'astra-sites', $rest_args, true, $assoc_args );
// Modify the output.
foreach ( $list as $key => $item ) {
$list[ $key ]['categories'] = implode( ', ', $list[ $key ]['categories'] );
$list[ $key ]['page-builder'] = implode( ', ', $list[ $key ]['page_builders'] );
}
if ( ! empty( $list ) ) {
$display_fields = array(
'id',
'title',
'url',
'type',
'categories',
'page-builder',
);
$formatter = $this->get_formatter( $assoc_args, $display_fields );
$formatter->display_items( $list );
} else {
WP_CLI::error( __( 'No sites found! Try another query.', 'astra-sites' ) );
}
}
/**
* Import the site by site ID.
*
* ## OPTIONS
*
* <id>
* : Site id of the import site.
*
* [--reset]
* : Reset the recently imported site data. Including post, pages, customizer settings, widgets etc.
*
* [--yes]
* : Forcefully import the site without asking any prompt message.
*
*
* ## EXAMPLES
*
* # Import demo site.
* $ wp astra-sites import 34184 --reset --yes --license_key={{YOUR_KEY}}
* Activating Plugins..
* Reseting Posts..
* ..
*
* @since 1.4.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
*/
public function import( $args, $assoc_args ) {
// Force import.
$yes = isset( $assoc_args['yes'] ) ? true : false;
if ( ! $yes ) {
WP_CLI::confirm( __( 'Are you sure you want to import the site?', 'astra-sites' ) );
}
// Valid site ID?
$id = isset( $args[0] ) ? absint( $args[0] ) : 0;
if ( ! $id ) {
WP_CLI::error( __( 'Invalid Site ID,', 'astra-sites' ) );
}
$reset = isset( $assoc_args['reset'] ) ? true : false;
$site_url = get_site_url();
$demo_data = $this->get_site_data( $id );
// Invalid Site ID.
if ( is_wp_error( $demo_data ) ) {
/* Translators: %s is the error message. */
WP_CLI::error( sprintf( __( 'Site Import failed due to error: %s', 'astra-sites' ), $demo_data->get_error_message() ) );
}
// License Status.
$license_status = false;
if ( is_callable( 'BSF_License_Manager::bsf_is_active_license' ) ) {
$license_status = BSF_License_Manager::bsf_is_active_license( 'astra-pro-sites' );
}
if ( 'free' !== $demo_data['site-type'] && 'upgrade' === $demo_data['license-status'] && ! $license_status ) {
if ( ! defined( 'ASTRA_PRO_SITES_NAME' ) ) {
WP_CLI::line( __( 'This is Premium site. Please activate the "Starter Templates" license!', 'astra-sites' ) );
WP_CLI::line( __( 'Use `wp plugin deactivate astra-sites` and then `wp plugin activate astra-pro-sites`', 'astra-sites' ) );
}
/* translators: %s is the activate plugin license link. */
WP_CLI::error( __( 'Use CLI command `wp brainstormforce license activate astra-pro-sites {YOUR_LICENSE_KEY}`', 'astra-sites' ) );
}
/**
* Check File System permissions.
*/
Helper::filesystem_permission();
/**
* Install & Activate Required Plugins.
*/
if ( isset( $demo_data['required-plugins'] ) ) {
$plugins = (array) $demo_data['required-plugins'];
if ( ! empty( $plugins ) ) {
$plugin_status = Helper::required_plugins( $plugins, $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
// Install Plugins.
if ( ! empty( $plugin_status['required_plugins']['notinstalled'] ) ) {
WP_CLI::line( __( 'Installing Plugins..', 'astra-sites' ) );
foreach ( $plugin_status['required_plugins']['notinstalled'] as $key => $plugin ) {
if ( isset( $plugin['slug'] ) ) {
// Install plugin.
WP_CLI::runcommand( 'plugin install ' . $plugin['slug'] );
// Activate plugin.
WP_CLI::runcommand( 'plugin activate ' . $plugin['slug'] );
}
}
}
// Activate Plugins.
if ( ! empty( $plugin_status['required_plugins']['inactive'] ) ) {
WP_CLI::line( __( 'Activating Plugins..', 'astra-sites' ) );
foreach ( $plugin_status['required_plugins']['inactive'] as $key => $plugin ) {
if ( isset( $plugin['init'] ) ) {
Helper::required_plugin_activate( $plugin['init'], $demo_data['astra-site-options-data'], $demo_data['astra-enabled-extensions'] );
}
}
}
}
}
/**
* Backup Customizer Settings
*/
Helper::backup_settings();
/**
* Reset Site Data
*/
if ( $reset ) {
WP_CLI::runcommand( 'astra-sites reset --yes' );
}
/**
* Import Flows & Steps for CartFlows.
*/
if ( isset( $demo_data['astra-site-cartflows-path'] ) && ! empty( $demo_data['astra-site-cartflows-path'] ) ) {
Astra_Sites_Importer::get_instance()->import_cartflows( $demo_data['astra-site-cartflows-path'] );
}
/**
* Import WP Forms.
*/
if ( isset( $demo_data['astra-site-wpforms-path'] ) && ! empty( $demo_data['astra-site-wpforms-path'] ) ) {
Astra_Sites_Importer::get_instance()->import_wpforms( $demo_data['astra-site-wpforms-path'] );
}
/**
* Import Customizer Settings.
*/
WP_CLI::runcommand( 'astra-sites import_customizer_settings ' . $id );
/**
* Import Content from XML/WXR.
*/
if ( isset( $demo_data['astra-site-wxr-path'] ) && ! empty( $demo_data['astra-site-wxr-path'] ) ) {
WP_CLI::runcommand( 'astra-sites import_wxr ' . $demo_data['astra-site-wxr-path'] );
}
/**
* Import Site Options.
*/
if ( isset( $demo_data['astra-site-options-data'] ) && ! empty( $demo_data['astra-site-options-data'] ) ) {
WP_CLI::line( __( 'Importing Site Options..', 'astra-sites' ) );
Helper::import_options( $demo_data['astra-site-options-data'] );
}
/**
* Import Widgets.
*/
if ( isset( $demo_data['astra-site-widgets-data'] ) && ! empty( $demo_data['astra-site-widgets-data'] ) ) {
WP_CLI::line( __( 'Importing Widgets..', 'astra-sites' ) );
Helper::import_widgets( $demo_data['astra-site-widgets-data'] );
}
/**
* Import End.
*/
WP_CLI::runcommand( 'astra-sites import_end' );
/* translators: %s is the site URL. */
WP_CLI::line( sprintf( __( "Site Imported Successfully!\nVisit: %s", 'astra-sites' ), $site_url ) );
}
/**
* Import End
*
* @since 1.4.3
* @return void
*/
public function import_end() {
Helper::import_end();
}
/**
* Import form XML.
*
* ## OPTIONS
*
* <url>
* : XML/WXR file URL.
*
* ## EXAMPLES
*
* $ wp astra-sites import_wxr <url>
*
* @since 1.4.3
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
* @return void.
*/
public function import_wxr( $args = array(), $assoc_args = array() ) {
// Valid site ID?
$url = isset( $args[0] ) ? esc_url_raw( $args[0] ) : '';
if ( empty( $url ) ) {
WP_CLI::error( esc_html__( 'Invalid XML URL.', 'astra-sites' ) );
}
// Download XML file.
/* translators: %s is the XML file URL. */
WP_CLI::line( sprintf( esc_html__( 'Downloading %s', 'astra-sites' ), $url ) );
$xml_path = ST_WXR_Importer::download_file( $url );
if ( $xml_path['success'] && isset( $xml_path['data']['file'] ) ) {
WP_CLI::line( esc_html__( 'Importing WXR..', 'astra-sites' ) );
ST_WXR_Importer::get_instance()->sse_import( $xml_path['data']['file'] );
} else {
/* translators: %s is error message. */
WP_CLI::line( printf( esc_html__( 'WXR file Download Failed. Error %s', 'astra-sites' ), esc_html( $xml_path['data'] ) ) );
}
}
/**
* Reset
*
* Delete all pages, post, custom post type, customizer settings and site options.
*
* ## OPTIONS
*
* [--yes]
* : Reset previously imported site data without asking the prompt message.
*
* ## EXAMPLES
*
* $ wp astra-sites reset
*
* @since 1.4.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
* @return void.
*/
public function reset( $args = array(), $assoc_args = array() ) {
$yes = isset( $assoc_args['yes'] ) ? true : false;
if ( ! $yes ) {
WP_CLI::confirm( __( 'Are you sure you want to delete imported site data?', 'astra-sites' ) );
}
// Get tracked data.
$reset_data = Astra_Sites::get_instance()->get_reset_data();
// Delete tracked posts.
if ( isset( $reset_data['reset_posts'] ) && ! empty( $reset_data['reset_posts'] ) ) {
WP_CLI::line( __( 'Reseting Posts..', 'astra-sites' ) );
foreach ( $reset_data['reset_posts'] as $key => $post_id ) {
Astra_Sites_Importer::get_instance()->delete_imported_posts( $post_id );
}
}
// Delete tracked terms.
if ( isset( $reset_data['reset_terms'] ) && ! empty( $reset_data['reset_terms'] ) ) {
WP_CLI::line( __( 'Reseting Terms..', 'astra-sites' ) );
foreach ( $reset_data['reset_terms'] as $key => $post_id ) {
Astra_Sites_Importer::get_instance()->delete_imported_terms( $post_id );
}
}
// Delete tracked WP forms.
if ( isset( $reset_data['reset_wp_forms'] ) && ! empty( $reset_data['reset_wp_forms'] ) ) {
WP_CLI::line( __( 'Resting WP Forms...', 'astra-sites' ) );
foreach ( $reset_data['reset_wp_forms'] as $key => $post_id ) {
Astra_Sites_Importer::get_instance()->delete_imported_terms( $post_id );
}
}
// Delete Customizer Data.
Helper::reset_customizer_data();
// Delete Site Options.
Helper::reset_site_options();
// Delete Widgets Data.
Helper::reset_widgets_data();
}
/**
* Import Customizer Settings
*
* ## OPTIONS
*
* <id>
* : Site ID.
*
* ## EXAMPLES
*
* $ wp astra-sites import_customizer_settings <id>
*
* @since 1.4.0
*
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
* @return void
*/
public function import_customizer_settings( $args, $assoc_args ) {
// Valid site ID?
$id = isset( $args[0] ) ? absint( $args[0] ) : 0;
if ( ! $id ) {
WP_CLI::error( __( 'Invalid Site ID,', 'astra-sites' ) );
}
$demo_data = $this->get_site_data( $id );
WP_CLI::line( __( 'Importing customizer settings..', 'astra-sites' ) );
Helper::import_customizer_settings( $demo_data['astra-site-customizer-data'] );
}
/**
* Page Builders
*
* ### OPTIONS
*
* [<list>]
* : List all page builders.
*
* OR
*
* [<set>]
* : Set the current page builder with given page builder slug.
*
* [<slug>]
* : Page builder slug.
*
* ### EXAMPLES
*
* # List all the page builders.
* λ wp astra-sites page_builder list
* +----------------+----------------+
* | slug | name |
* +----------------+----------------+
* | gutenberg | Gutenberg |
* | elementor | Elementor |
* | beaver-builder | Beaver Builder |
* | brizy | Brizy |
* +----------------+----------------+
*
* # Set `Elementor` as default page builder.
* λ wp astra-sites page_builder set elementor
* "Elementor" is set as default page builder.
*
* # Set `Beaver Builder` as default page builder.
* λ wp astra-sites page_builder set beaver-builder
* "Beaver Builder" is set as default page builder.
*
* @since 1.4.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
*/
public function page_builder( $args, $assoc_args ) {
$action = isset( $args[0] ) ? $args[0] : '';
if ( empty( $action ) ) {
WP_CLI::error( __( 'Please add valid parameter.', 'astra-sites' ) );
}
$page_builders = Astra_Sites_Page::get_instance()->get_page_builders();
if ( 'list' === $action ) {
$display_fields = array(
'slug',
'name',
);
$formatter = $this->get_formatter( $assoc_args, $display_fields );
$formatter->display_items( $page_builders );
$default_page_builder = isset( $page_builders[ Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ) ] ) ? $page_builders[ Astra_Sites_Page::get_instance()->get_setting( 'page_builder' ) ]['name'] : '';
if ( ! empty( $default_page_builder ) ) {
/* translators: %s is the current page builder name. */
WP_CLI::line( sprintf( __( 'Default page builder is "%s".', 'astra-sites' ), $default_page_builder ) );
}
} elseif ( 'set' === $action ) {
$page_builder_slugs = array_keys( $page_builders );
$page_builder_slug = isset( $args[1] ) ? $args[1] : '';
if ( in_array( $page_builder_slug, $page_builder_slugs, true ) ) {
Astra_Sites_Page::get_instance()->save_page_builder_on_submit( $page_builder_slug );
/* translators: %s is the page builder name. */
WP_CLI::line( sprintf( __( '"%s" is set as default page builder.', 'astra-sites' ), $page_builders[ $page_builder_slug ]['name'] ) );
} else {
WP_CLI::error( __( "Invalid page builder slug. \nCheck all page builder slugs with command `wp astra-sites page_builder list`", 'astra-sites' ) );
}
} else {
WP_CLI::error( __( "Invalid parameter! \nPlease use `list` or `set` parameter.", 'astra-sites' ) );
}
}
/**
* Get Formatter
*
* @since 1.4.0
* @param array $assoc_args Associate arguments.
* @param string $fields Fields.
* @param string $prefix Prefix.
* @return object Class object.
*/
protected function get_formatter( &$assoc_args, $fields = '', $prefix = '' ) {
return new \WP_CLI\Formatter( $assoc_args, $fields, $prefix );
}
/**
* Get Site Data by Site ID
*
* @since 1.4.0
*
* @param int $id Site ID.
* @return array
*/
private function get_site_data( $id ) {
if ( empty( $this->current_site_data ) ) {
// @todo Use Astra_Sites::get_instance()->api_request() instead of below function.
$this->current_site_data = Astra_Sites_Importer::get_instance()->get_single_demo( $id );
Astra_Sites_File_System::get_instance()->update_demo_data( $this->current_site_data );
}
return $this->current_site_data;
}
/**
* Get Sites
*
* @since 1.4.0
*
* @param string $post_slug Post slug.
* @param array $args Post query arguments.
* @param boolean $force Force import.
* @param array $assoc_args Associate arguments.
* @return array
*/
private function get_sites( $post_slug = '', $args = array(), $force = false, $assoc_args = array() ) {
// Add page builders.
$page_builder = isset( $assoc_args['page-builder'] ) ? $assoc_args['page-builder'] : Astra_Sites_Page::get_instance()->get_setting( 'page_builder' );
$response = $this->get_term_ids( 'astra-site-page-builder', $page_builder, $args );
$args = $response['args'];
$page_builders = $response['terms'];
if ( empty( $page_builders['data'] ) ) {
WP_CLI::error( __( 'This page builder plugin is not installed. Please try a different page builder.', 'astra-sites' ) );
}
// Add type.
$type = isset( $assoc_args['type'] ) ? $assoc_args['type'] : '';
$response = $this->get_term_ids( 'astra-sites-type', $type, $args );
$args = $response['args'];
$types = $response['terms'];
if ( empty( $types['data'] ) ) {
WP_CLI::error( __( 'This site type does not exist. Please try a different site type.', 'astra-sites' ) );
}
// Add categories.
$category = isset( $assoc_args['category'] ) ? $assoc_args['category'] : '';
$response = $this->get_term_ids( 'astra-sites-site-category', $category, $args );
$args = $response['args'];
$categories = $response['terms'];
if ( empty( $categories['data'] ) ) {
WP_CLI::error( __( 'This site category does not exist. Please try a different site category.', 'astra-sites' ) );
}
// Site list.
$sites = (array) $this->get_posts( 'astra-sites', $args, $force );
$list = array();
if ( $sites['success'] ) {
foreach ( $sites['data'] as $key => $site ) {
$single_site = array(
'id' => $site['id'],
'slug' => $site['slug'],
'title' => $site['title']['rendered'],
'url' => $site['astra-site-url'],
'type' => ( 'premium' === $site['astra-site-type'] ) ? 'Premium' : ucwords( $site['astra-site-type'] ),
'categories' => array(),
'page_builders' => array(),
);
if ( isset( $site['astra-sites-site-category'] ) && ! empty( $categories['data'] ) ) {
foreach ( $site['astra-sites-site-category'] as $category_key => $category_id ) {
if ( isset( $categories['data'][ $category_id ] ) ) {
$single_site['categories'][ $category_id ] = $categories['data'][ $category_id ];
}
}
}
if ( isset( $site['astra-site-page-builder'] ) && ! empty( $page_builders['data'] ) ) {
foreach ( $site['astra-site-page-builder'] as $page_builder_key => $page_builder_id ) {
if ( isset( $page_builders['data'][ $page_builder_id ] ) ) {
$single_site['page_builders'][ $page_builder_id ] = $page_builders['data'][ $page_builder_id ];
}
}
}
$list[] = $single_site;
}
}
return $list;
}
/**
* Get Term IDs
*
* @since 1.4.0
*
* @param string $term_slug Term slug.
* @param string $search_term Search term.
* @param array $args Term query arguments.
* @return array Term response.
*/
private function get_term_ids( $term_slug = '', $search_term = '', $args = array() ) {
$term_args = array();
if ( ! empty( $search_term ) ) {
$term_args = array(
'search' => $search_term,
);
}
$term_response = (array) $this->get_terms( $term_slug, $term_args, true );
if ( ! empty( $search_term ) ) {
if ( ! empty( $term_response ) && is_array( $term_response['data'] ) ) {
$args[ $term_slug ] = implode( ',', array_keys( $term_response['data'] ) );
}
}
return array(
'args' => $args,
'terms' => $term_response,
);
}
/**
* Get Terms
*
* @since 1.0.0
*
* @param array $term_slug Term Slug.
* @param array $args For selecting the demos (Search terms, pagination etc).
* @param string $force Force import.
* @return $array Term response.
*/
private function get_terms( $term_slug = '', $args = array(), $force = false ) {
$defaults = array(
'_fields' => 'id,name,slug,count',
);
$args = wp_parse_args( (array) $args, $defaults );
$success = false;
$terms_data = get_transient( 'astra-sites-term-' . $term_slug );
if ( empty( $terms_data ) || $force ) {
$url = add_query_arg( $args, Astra_Sites::get_instance()->get_api_url() . $term_slug );
$api_args = array(
'timeout' => 60,
);
$response = wp_safe_remote_get( $url, $api_args );
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
$request_term_data = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! isset( $request_term_data['code'] ) ) {
$success = true;
$new_terms_data = array();
foreach ( $request_term_data as $key => $request_term ) {
$new_terms_data[ $request_term['id'] ] = $request_term['name'];
}
if ( set_transient( 'astra-sites-term-' . $term_slug, $new_terms_data, WEEK_IN_SECONDS ) ) {
return array(
'success' => $success,
'data' => $new_terms_data,
);
}
}
}
}
return array(
'success' => $success,
'data' => $terms_data,
);
}
/**
* Get Posts
*
* @since 1.4.0
*
* @param string $post_slug Post slug.
* @param array $args Post query arguments.
* @param boolean $force Force import.
* @return array
*/
private function get_posts( $post_slug = '', $args = array(), $force = false ) {
$args = wp_parse_args( (array) $args, array() );
$all_posts = get_transient( 'astra-sites-post-' . $post_slug );
if ( empty( $all_posts ) || $force ) {
$url = add_query_arg( $args, Astra_Sites::get_instance()->get_api_url() . $post_slug );
$api_args = array(
'timeout' => 60,
);
$success = false;
$response = wp_safe_remote_get( $url, $api_args );
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
$all_posts = json_decode( wp_remote_retrieve_body( $response ), true );
if ( ! isset( $all_posts['code'] ) ) {
$success = true;
set_transient( 'astra-sites-post-' . $post_slug, $all_posts, WEEK_IN_SECONDS );
}
}
} else {
$success = true;
}
return array(
'success' => $success,
'data' => $all_posts,
);
}
/**
* Sync Library.
*
* Sync the library and create the .json files.
*
* Use: `wp astra-sites sync`
*
* @since 2.0.0
* @param array $args Arguments.
* @param array $assoc_args Associated Arguments.
* @return void.
*/
public function sync( $args = array(), $assoc_args = array() ) {
Astra_Sites_Batch_Processing::get_instance()->process_batch();
}
/**
* Init.
*/
public static function init() {
add_filter( 'wp_check_filetype_and_ext', array( 'Astra_Sites_WP_CLI', 'real_mime_types' ), 10, 5 );
}
/**
* Different MIME type of different PHP version
*
* Filters the "real" file type of the given file.
*
* @since 1.2.9
*
* @param array $defaults File data array containing 'ext', 'type', and
* 'proper_filename' keys.
* @param string $file Full path to the file.
* @param string $filename The name of the file (may differ from $file due to
* $file being in a tmp directory).
* @param array<string, string> $mimes Key is the file extension with value as the mime type.
* @param string $real_mime Real MIME type of the uploaded file.
*/
public static function real_mime_types( $defaults, $file, $filename, $mimes, $real_mime ) {
return ST_WXR_Importer::get_instance()->real_mime_types_5_1_0( $defaults, $file, $filename, $mimes, $real_mime );
}
}
/**
* Add Command
*/
WP_CLI::add_command( 'starter-templates', 'Astra_Sites_WP_CLI' );
WP_CLI::add_command( 'astra-sites', 'Astra_Sites_WP_CLI' );
Astra_Sites_WP_CLI::init();
endif;

View File

@@ -0,0 +1,315 @@
<?php
/**
* Astra Sites Compatibility for 'Astra Pro'
*
* @see https://wordpress.org/plugins/astra-pro/
*
* @package Astra Sites
* @since 1.0.0
*/
use STImporter\Importer\Helpers\ST_Image_Importer;
if ( ! class_exists( 'Astra_Sites_Compatibility_Astra_Pro' ) ) :
/**
* Astra_Sites_Compatibility_Astra_Pro
*
* @since 1.0.0
*/
class Astra_Sites_Compatibility_Astra_Pro {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.0.0
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'astra_pro' ), 10, 2 );
add_action( 'astra_sites_import_start', array( $this, 'import_enabled_extension' ), 10, 2 );
add_action( 'astra_sites_import_complete', array( $this, 'clear_cache' ) );
}
/**
* Import
*
* @since 1.1.6
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Astra Pro" Batch Import' );
}
Astra_Sites_Importer_Log::add( '---- Processing Mapping - for Astra Pro ----' );
self::start_post_mapping();
}
/**
* Update Site Origin Active Widgets
*
* @since 1.0.0
*
* @param string $plugin_init Plugin init file.
* @param array $data Data.
* @return void
*/
public function astra_pro( $plugin_init = '', $data = array() ) {
if ( 'astra-addon/astra-addon.php' === $plugin_init && ! empty( $data ) ) {
if ( is_array( $data ) ) {
$data = json_decode( wp_json_encode( $data ), true );
}
if ( isset( $data['enabled_extensions'] ) ) {
$extensions = $data['enabled_extensions'];
if ( ! empty( $extensions ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $extensions );
}
}
}
}
}
/**
* Import custom 404 section.
*
* @since 1.0.0
* @param array $demo_data Site all data render from API call.
* @param array $demo_api_uri Demo URL.
*/
public function import_custom_404( $demo_data = array(), $demo_api_uri = '' ) {
if ( isset( $demo_data['astra-custom-404'] ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
$options_404 = $demo_data['astra-custom-404'];
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_custom_404', $options_404 );
}
}
}
/**
* Import settings enabled Astra extensions from the demo.
*
* @since 1.0.0
* @param array $demo_data Site all data render from API call.
* @param array $demo_api_uri Demo URL.
*/
public function import_enabled_extension( $demo_data = array(), $demo_api_uri = '' ) {
if ( isset( $demo_data['astra-enabled-extensions'] ) ) {
if ( is_callable( 'Astra_Admin_Helper::update_admin_settings_option' ) ) {
Astra_Admin_Helper::update_admin_settings_option( '_astra_ext_enabled_extensions', $demo_data['astra-enabled-extensions'] );
}
}
}
/**
* Start post meta mapping of Astra Addon
*
* @since 1.1.6
*
* @return null If there is no import option data found.
*/
public static function start_post_mapping() {
$demo_data = Astra_Sites_File_System::get_instance()->get_demo_content();
if ( ! isset( $demo_data['astra-post-data-mapping'] ) ) {
return;
}
$post_type = 'astra-advanced-hook';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
$page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['post_title'], $post_type );
if ( is_object( $page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
}
self::update_location_rules( $page->ID, 'ast-advanced-hook-location', $post['mapping']['ast-advanced-hook-location'] );
}
}
}
$post_type = 'astra_adv_header';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $post_type ] ) ) ? $demo_data['astra-post-data-mapping'][ $post_type ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
$page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['post_title'], $post_type );
if ( is_object( $page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting Location Rules for ' . $post['post_title'] );
}
self::update_location_rules( $page->ID, 'ast-advanced-headers-location', $post['mapping']['ast-advanced-headers-location'] );
self::update_location_rules( $page->ID, 'ast-advanced-headers-exclusion', $post['mapping']['ast-advanced-headers-exclusion'] );
self::update_header_mapping( $page->ID, 'ast-advanced-headers-design', $post['mapping']['ast-advanced-headers-design'] );
}
}
}
}
/**
* Update Header Mapping Data
*
* @since 1.1.6
*
* @param int $post_id Post ID.
* @param string $meta_key Post meta key.
* @param array $mapping Mapping array.
* @return void
*/
public static function update_header_mapping( $post_id = '', $meta_key = '', $mapping = array() ) {
Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
$headers_old = get_post_meta( $post_id, $meta_key, true );
$headers_new = self::get_header_mapping( $headers_old, $mapping );
update_post_meta( $post_id, $meta_key, $headers_new );
}
/**
* Update Location Rules
*
* @since 1.1.6
*
* @param int $post_id Post ID.
* @param string $meta_key Post meta key.
* @param array $mapping Mapping array.
* @return void
*/
public static function update_location_rules( $post_id = '', $meta_key = '', $mapping = array() ) {
Astra_Sites_Importer_Log::add( 'Mapping "' . $meta_key . '" for ' . $post_id );
$location_new = self::get_location_mappings( $mapping );
update_post_meta( $post_id, $meta_key, $location_new );
}
/**
* Get mapping locations.
*
* @since 1.1.6
*
* @param array $location Location data.
* @return array Location mapping data.
*/
public static function get_location_mappings( $location = array() ) {
if ( empty( $location ) ) {
return $location;
}
if ( ! isset( $location['specific'] ) || empty( $location['specific'] ) ) {
return $location;
}
$mapping = array();
if ( isset( $location['specific']['post'] ) ) {
foreach ( $location['specific']['post'] as $post_type => $old_post_data ) {
if ( is_array( $old_post_data ) ) {
foreach ( $old_post_data as $post_key => $post ) {
$post_object = get_page_by_path( $post['slug'] );
if ( $post_object ) {
$mapping[] = 'post-' . absint( $post_object->ID );
}
}
}
}
}
if ( isset( $location['specific']['tax'] ) ) {
foreach ( $location['specific']['tax'] as $taxonomy_type => $old_term_data ) {
if ( is_array( $old_term_data ) ) {
foreach ( $old_term_data as $term_key => $term_data ) {
$term = get_term_by( 'slug', $term_data['slug'], $taxonomy_type );
if ( is_object( $term ) ) {
$mapping[] = 'tax-' . absint( $term->term_id );
}
}
}
}
}
$location['specific'] = $mapping;
return $location;
}
/**
* Get advanced header mapping data
*
* @since 1.1.6
*
* @param array $headers_old Header mapping stored data.
* @param array $headers_data Header mapping data.
* @return array Filtered header mapping data.
*/
public static function get_header_mapping( $headers_old = array(), $headers_data = array() ) {
// Set menu location by menu slug.
if ( isset( $headers_data['menus'] ) && ! empty( $headers_data['menus'] ) ) {
foreach ( $headers_data['menus'] as $header_option_name => $menu_data ) {
$term = get_term_by( 'slug', $menu_data['slug'], 'nav_menu' );
if ( is_object( $term ) ) {
$headers_old[ $header_option_name ] = $term->term_id;
}
}
}
// Set image ID & URL after importing these on website.
if ( isset( $headers_data['images'] ) && ! empty( $headers_data['images'] ) ) {
foreach ( $headers_data['images'] as $key => $image_data ) {
if ( isset( $image_data['image'] ) && ! empty( $image_data['image'] ) ) {
$downloaded_image = ST_Image_Importer::get_instance()->import( $image_data['image'] );
$headers_old[ $image_data['key_map']['url'] ] = $downloaded_image['url'];
$headers_old[ $image_data['key_map']['id'] ] = $downloaded_image['id'];
}
}
}
return $headers_old;
}
/**
* Clear Cache
*
* @since 1.2.3
* @return void
*/
public function clear_cache() {
if ( is_callable( 'Astra_Minify::refresh_assets' ) ) {
Astra_Minify::refresh_assets();
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_Astra_Pro::get_instance();
endif;

View File

@@ -0,0 +1,62 @@
<?php
/**
* Astra Sites Compatibility for 'Beaver Builder'
*
* @package Astra Sites
* @since 3.0.21
*/
defined( 'ABSPATH' ) || exit;
/**
* Beaver Builder Compatibility
*
* @since 3.0.21
*/
class Astra_Sites_Compatibility_BB {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.21
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.21
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 3.0.21
*/
public function __construct() {
add_action( 'fl_builder_activated', array( $this, 'bb_activated' ) );
}
/**
* Disable redirection for Beaver Builder plugin when activated via Starter templates import process.
*/
public function bb_activated() {
if ( astra_sites_has_import_started() ) {
delete_transient( '_fl_builder_activation_admin_notice' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_BB::get_instance();

View File

@@ -0,0 +1,60 @@
<?php
/**
* Astra Sites Compatibility for 'Checkout Plugins Stripe for WooCommerce'
*
* @see https://wordpress.org/plugins/checkout-plugins-stripe-woo/
*
* @package Astra Sites
* @since 3.0.23
*/
/**
* Checkout Plugins - Stripe compatibility for Starter Templates.
*/
class Astra_Sites_Checkout_Plugins_Stripe_WOO {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.23
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.23
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'checkout_plugins' ), 10, 2 );
}
/**
* Disable redirec after installing and activating Checkout Plugins - Stripe.
*
* @param string $plugin_init Plugin init file used for activation.
* @return void
*/
public function checkout_plugins( $plugin_init ) {
if ( 'checkout-plugins-stripe-woo/checkout-plugins-stripe-woo.php' === $plugin_init ) {
delete_option( 'cpsw_start_onboarding' );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Checkout_Plugins_Stripe_WOO::get_instance();

View File

@@ -0,0 +1,78 @@
<?php
/**
* Astra Sites Compatibility for 3rd party plugins.
*
* @package Astra Sites
* @since 1.0.11
*/
if ( ! class_exists( 'Astra_Sites_Compatibility' ) ) :
/**
* Astra Sites Compatibility
*
* @since 1.0.11
*/
class Astra_Sites_Compatibility {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.0.11
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.11
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.11
*/
public function __construct() {
// Plugin - Astra Pro.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/astra-pro/class-astra-sites-compatibility-astra-pro.php';
// Plugin - WooCommerce.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/woocommerce/class-astra-sites-compatibility-woocommerce.php';
// Plugin - LearnDash LMS.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/sfwd-lms/class-astra-sites-compatibility-sfwd-lms.php';
// Plugin - Elementor.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/elementor/class-astra-sites-compatibility-elementor.php';
// Plugin - Beaver Builder.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/beaver-builder/class-astra-sites-compatibility-bb.php';
// Plugin - LearnDash.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/learndash/class-astra-sites-compatibility-learndash.php';
// Plugin - UABB.
require_once ASTRA_SITES_DIR . 'inc/classes/compatibility/uabb/class-astra-sites-compatibility-uabb.php';
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility::instance();
endif;

View File

@@ -0,0 +1,187 @@
<?php
/**
* Astra Sites Compatibility for 'Elementor'
*
* @package Astra Sites
* @since 2.0.0
*/
namespace AstraSites\Elementor;
defined( 'ABSPATH' ) || exit;
if ( ! class_exists( '\Elementor\Plugin' ) ) {
return;
}
if ( ! class_exists( 'Astra_Sites_Compatibility_Elementor' ) ) :
/**
* Elementor Compatibility
*
* @since 2.0.0
*/
class Astra_Sites_Compatibility_Elementor {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 2.0.0
*/
private static $instance;
/**
* Initiator
*
* @since 2.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 2.0.0
*/
public function __construct() {
/**
* Add Slashes
*
* @todo Elementor already have below code which works on defining the constant `WP_LOAD_IMPORTERS`.
* After defining the constant `WP_LOAD_IMPORTERS` in WP CLI it was not works.
* Try to remove below duplicate code in future.
*/
if ( ! wp_doing_ajax() || ( defined( 'ELEMENTOR_VERSION' ) && version_compare( ELEMENTOR_VERSION, '3.0.0', '>=' ) ) ) {
remove_filter( 'wp_import_post_meta', array( 'Elementor\Compatibility', 'on_wp_import_post_meta' ) );
remove_filter( 'wxr_importer.pre_process.post_meta', array( 'Elementor\Compatibility', 'on_wxr_importer_pre_process_post_meta' ) );
add_filter( 'wp_import_post_meta', array( $this, 'on_wp_import_post_meta' ) );
add_filter( 'wxr_importer.pre_process.post_meta', array( $this, 'on_wxr_importer_pre_process_post_meta' ) );
}
add_action( 'astra_sites_before_delete_imported_posts', array( $this, 'force_delete_kit' ), 10, 2 );
add_action( 'astra_sites_before_sse_import', array( $this, 'disable_attachment_metadata' ) );
add_action( 'init', array( $this, 'init' ) );
add_action( 'astra_sites_after_plugin_activation', array( $this, 'disable_elementor_redirect' ) );
}
/**
* Disable Elementor redirect.
*
* @return void.
*/
public function disable_elementor_redirect() {
$elementor_redirect = get_transient( 'elementor_activation_redirect' );
if ( ! empty( $elementor_redirect ) && '' !== $elementor_redirect ) {
delete_transient( 'elementor_activation_redirect' );
}
}
/**
* Remove the transient update check for plugins callback from Elementor.
* This reduces the extra code execution for Elementor.
*/
public function init() {
if ( astra_sites_has_import_started() && null !== \Elementor\Plugin::$instance->admin ) {
remove_filter( 'pre_set_site_transient_update_plugins', array( \Elementor\Plugin::$instance->admin->get_component( 'canary-deployment' ), 'check_version' ) );
}
}
/**
* Disable the attachment metadata
*/
public function disable_attachment_metadata() {
remove_filter(
'wp_update_attachment_metadata', array(
\Elementor\Plugin::$instance->uploads_manager->get_file_type_handlers( 'svg' ),
'set_svg_meta_data',
), 10, 2
);
}
/**
* Force Delete Elementor Kit
*
* Delete the previously imported Elementor kit.
*
* @param int $post_id Post name.
* @param string $post_type Post type.
*/
public function force_delete_kit( $post_id = 0, $post_type = '' ) {
if ( ! $post_id ) {
return;
}
if ( 'elementor_library' === $post_type ) {
$_GET['force_delete_kit'] = true;
}
}
/**
* Process post meta before WP importer.
*
* Normalize Elementor post meta on import, We need the `wp_slash` in order
* to avoid the unslashing during the `add_post_meta`.
*
* Fired by `wp_import_post_meta` filter.
*
* @since 1.4.3
* @access public
*
* @param array $post_meta Post meta.
*
* @return array Updated post meta.
*/
public function on_wp_import_post_meta( $post_meta ) {
foreach ( $post_meta as &$meta ) {
if ( '_elementor_data' === $meta['key'] ) {
$meta['value'] = wp_slash( $meta['value'] );
break;
}
}
return $post_meta;
}
/**
* Process post meta before WXR importer.
*
* Normalize Elementor post meta on import with the new WP_importer, We need
* the `wp_slash` in order to avoid the unslashing during the `add_post_meta`.
*
* Fired by `wxr_importer.pre_process.post_meta` filter.
*
* @since 1.4.3
* @access public
*
* @param array $post_meta Post meta.
*
* @return array Updated post meta.
*/
public function on_wxr_importer_pre_process_post_meta( $post_meta ) {
if ( '_elementor_data' === $post_meta['key'] ) {
$post_meta['value'] = wp_slash( $post_meta['value'] );
}
return $post_meta;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_Elementor::get_instance();
endif;

View File

@@ -0,0 +1,71 @@
<?php
/**
* Astra Sites Compatibility for 'LatePoint'
*
* @see https://wordpress.org/plugins/latepoint/
*
* @package Astra Sites
* @since 4.4.14
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_LatePoint' ) ) :
/**
* LatePoint Compatibility
*
* @since 4.4.14
*/
class Astra_Sites_Compatibility_LatePoint {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 4.4.14
*/
private static $instance;
/**
* Initiator
*
* @since 4.4.14
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 4.4.14
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'disable_latepoint_redirection' ) );
}
/**
* Disables LatePoint redirection during plugin activation.
*
* @param string $plugin_init The path to the plugin file that was just activated.
*
* @since 4.4.14
*/
public function disable_latepoint_redirection( $plugin_init ) {
if ( 'latepoint/latepoint.php' === $plugin_init ) {
update_option( 'latepoint_redirect_to_wizard', false );
update_option( 'latepoint_show_version_5_modal', false );
}
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility_LatePoint::instance();
endif;

View File

@@ -0,0 +1,62 @@
<?php
/**
* Compatibility for 'LearnDash'
*
* @see https://wordpress.org/plugins/astra-pro/
*
* @package Astra Sites
* @since 2.3.8
*/
// If LearnDash is not defined then return false.
if ( ! defined( 'LEARNDASH_COURSE_GRID_VERSION' ) ) {
return;
}
if ( ! class_exists( 'Astra_Sites_Compatibility_LearnDash' ) ) :
/**
* Astra Sites Compatibility LearnDash
*
* @since 2.3.8
*/
class Astra_Sites_Compatibility_LearnDash {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 2.3.8
*/
private static $instance;
/**
* Initiator
*
* @since 2.3.8
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 2.3.8
*/
public function __construct() {
add_filter( 'astra_sites_pre_process_post_disable_content', '__return_false' );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_LearnDash::get_instance();
endif;

View File

@@ -0,0 +1,108 @@
<?php
/**
* Astra Sites Compatibility for 'LearnDash LMS'
*
* @see https://www.learndash.com/
*
* @package Astra Sites
* @since 1.3.13
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_SFWD_LMS' ) ) :
/**
* Astra_Sites_Compatibility_SFWD_LMS
*
* @since 1.3.13
*/
class Astra_Sites_Compatibility_SFWD_LMS {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.3.13
*/
private static $instance;
/**
* Initiator
*
* @since 1.3.13
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.3.13
*/
public function __construct() {
add_filter( 'astra_sites_gutenberg_batch_process_post_types', array( $this, 'set_post_types' ) );
add_action( 'astra_sites_import_complete', array( $this, 'process_landing_pages_mapping' ) );
}
/**
* Set LearnDash Landing pages with respect to Cartflows.
*
* @since 2.3.2
*/
public function process_landing_pages_mapping() {
$demo_data = Astra_Sites_File_System::get_instance()->get_demo_content();
if ( ! isset( $demo_data['astra-post-data-mapping'] ) || ! isset( $demo_data['astra-post-data-mapping']['ld_landing_pages'] ) ) {
return;
}
$index = 'ld_landing_pages';
$posts = ( isset( $demo_data['astra-post-data-mapping'][ $index ] ) ) ? $demo_data['astra-post-data-mapping'][ $index ] : array();
if ( ! empty( $posts ) ) {
foreach ( $posts as $key => $post ) {
if ( '' !== $post['landing_page'] ) {
// Get course by Title.
$course = Astra_Site_Options_Import::instance()->get_page_by_title( $post['course'], 'sfwd-courses' );
// Get landing step by Title.
$landing_page = Astra_Site_Options_Import::instance()->get_page_by_title( $post['landing_page'], 'cartflows_step' );
if ( is_object( $course ) && is_object( $landing_page ) ) {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Setting LearnDash - CartFlows Landing page - ' . $course->post_title . ' - ( ' . $course->ID . ' )' );
}
$ld_meta = get_post_meta( $course->ID, '_sfwd-courses', true );
$ld_meta['sfwd-courses_wcf_course_template'] = $landing_page->ID;
// Update the imported landing step to the course.
update_post_meta( $course->ID, '_sfwd-courses', $ld_meta );
}
}
}
}
}
/**
* Set post types
*
* @since 1.3.13
*
* @param array $post_types Post types.
*/
public function set_post_types( $post_types = array() ) {
return array_merge( $post_types, array( 'sfwd-courses', 'sfwd-lessons', 'sfwd-topic', 'sfwd-quiz', 'sfwd-certificates', 'sfwd-assignment' ) );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_SFWD_LMS::get_instance();
endif;

View File

@@ -0,0 +1,57 @@
<?php
/**
* Astra Sites Compatibility for 'UABB - Lite'
*
* @see https://wordpress.org/plugins/ultimate-addons-for-beaver-builder-lite/
*
* @package Astra Sites
* @since 3.0.23
*/
/**
* UABB compatibility for Starter Templates.
*/
class Astra_Sites_Compatibility_UABB {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 3.0.23
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.23
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
add_action( 'astra_sites_after_plugin_activation', array( $this, 'uabb_activation' ), 10, 2 );
}
/**
* Disable redirec after installing and activating UABB.
*
* @return void
*/
public function uabb_activation() {
update_option( 'uabb_lite_redirect', false );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Compatibility_UABB::get_instance();

View File

@@ -0,0 +1,184 @@
<?php
/**
* Astra Sites Compatibility for 'WooCommerce'
*
* @see https://wordpress.org/plugins/woocommerce/
*
* @package Astra Sites
* @since 1.1.4
*/
if ( ! class_exists( 'Astra_Sites_Compatibility_WooCommerce' ) ) :
/**
* WooCommerce Compatibility
*
* @since 1.1.4
*/
class Astra_Sites_Compatibility_WooCommerce {
/**
* Instance
*
* @access private
* @var object Class object.
* @since 1.1.4
*/
private static $instance;
/**
* Initiator
*
* @since 1.1.4
* @return object initialized object of class.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.1.4
*/
public function __construct() {
add_action( 'astra_sites_import_start', array( $this, 'add_attributes' ), 10, 2 );
add_action( 'astra_sites_after_plugin_activation', array( $this, 'install_wc' ), 10, 2 );
// WooCommerce product attributes registration.
if ( class_exists( 'WooCommerce' ) ) {
add_filter( 'wxr_importer.pre_process.term', array( $this, 'woocommerce_product_attributes_registration' ), 10, 1 );
add_action( 'astra_sites_import_complete', array( $this, 'update_wc_lookup_table' ) );
}
add_filter( 'astra_sites_pre_process_post_disable_content', '__return_false' );
add_filter( 'astra_sites_pre_process_post_empty_excerpt', '__return_false' );
}
/**
* Add product attributes.
*
* @since 1.1.4
*
* @param string $demo_data Import data.
* @param array $demo_api_uri Demo site URL.
* @return void
*/
public function add_attributes( $demo_data = array(), $demo_api_uri = '' ) {
$attributes = ( isset( $demo_data['astra-site-options-data']['woocommerce_product_attributes'] ) ) ? $demo_data['astra-site-options-data']['woocommerce_product_attributes'] : array();
if ( ! empty( $attributes ) && function_exists( 'wc_create_attribute' ) ) {
foreach ( $attributes as $key => $attribute ) {
$args = array(
'name' => $attribute['attribute_label'],
'slug' => $attribute['attribute_name'],
'type' => $attribute['attribute_type'],
'order_by' => $attribute['attribute_orderby'],
'has_archives' => $attribute['attribute_public'],
);
$id = wc_create_attribute( $args );
}
}
}
/**
* Create default WooCommerce tables
*
* @param string $plugin_init Plugin file which is activated.
* @return void
*/
public function install_wc( $plugin_init ) {
if ( 'woocommerce/woocommerce.php' !== $plugin_init ) {
return;
}
// Create WooCommerce database tables.
if ( is_callable( '\Automattic\WooCommerce\Admin\Install::create_tables' ) ) {
\Automattic\WooCommerce\Admin\Install::create_tables();
\Automattic\WooCommerce\Admin\Install::create_events();
}
if ( is_callable( 'WC_Install::install' ) ) {
WC_Install::install();
}
}
/**
* Hook into the pre-process term filter of the content import and register the
* custom WooCommerce product attributes, so that the terms can then be imported normally.
*
* This should probably be removed once the WP importer 2.0 support is added in WooCommerce.
*
* Fixes: [WARNING] Failed to import pa_size L warnings in content import.
* Code from: woocommerce/includes/admin/class-wc-admin-importers.php (ver 2.6.9).
*
* Github issue: https://github.com/proteusthemes/one-click-demo-import/issues/71
*
* @since 3.0.0
* @param array $data The term data to import.
* @return array The unchanged term data.
*/
public function woocommerce_product_attributes_registration( $data ) {
global $wpdb;
if ( strstr( $data['taxonomy'], 'pa_' ) ) {
if ( ! taxonomy_exists( $data['taxonomy'] ) ) {
$attribute_name = wc_sanitize_taxonomy_name( str_replace( 'pa_', '', $data['taxonomy'] ) );
// Create the taxonomy.
if ( ! in_array( $attribute_name, wc_get_attribute_taxonomies(), true ) ) {
$attribute = array(
'attribute_label' => $attribute_name,
'attribute_name' => $attribute_name,
'attribute_type' => 'select',
'attribute_orderby' => 'menu_order',
'attribute_public' => 0,
);
$wpdb->insert( $wpdb->prefix . 'woocommerce_attribute_taxonomies', $attribute ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery -- WP Query would be expensive here, we are adding taxonomy attributes for WooCommerce.
delete_transient( 'wc_attribute_taxonomies' );
}
// Register the taxonomy now so that the import works!
register_taxonomy(
$data['taxonomy'],
apply_filters( 'woocommerce_taxonomy_objects_' . $data['taxonomy'], array( 'product' ) ),
apply_filters(
'woocommerce_taxonomy_args_' . $data['taxonomy'], array(
'hierarchical' => true,
'show_ui' => false,
'query_var' => true,
'rewrite' => false,
)
)
);
}
}
return $data;
}
/**
* Update WooCommerce Lookup Table.
*
* @since 3.0.0
*
* @return void
*/
public function update_wc_lookup_table() {
if ( function_exists( 'wc_update_product_lookup_tables' ) ) {
if ( ! wc_update_product_lookup_tables_is_running() ) {
wc_update_product_lookup_tables();
}
}
}
}
/**
* Kicking this off by calling 'instance()' method
*/
Astra_Sites_Compatibility_WooCommerce::instance();
endif;

View File

@@ -0,0 +1,138 @@
<?php
/**
* Functions
*
* @since 2.0.0
* @package Astra Sites
*/
if ( ! function_exists( 'astra_sites_error_log' ) ) :
/**
* Error Log
*
* A wrapper function for the error_log() function.
*
* @since 2.0.0
*
* @param mixed $message Error message.
* @return void
*/
function astra_sites_error_log( $message = '' ) {
if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) {
if ( is_array( $message ) ) {
$message = wp_json_encode( $message );
}
if ( apply_filters( 'astra_sites_debug_logs', false ) ) {
error_log( $message ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_error_log -- This is for the debug logs while importing. This is conditional and will not be logged in the debug.log file for normal users.
}
}
}
endif;
if ( ! function_exists( 'astra_sites_get_suggestion_link' ) ) :
/**
*
* Get suggestion link.
*
* @since 2.6.1
*
* @return suggestion link.
*/
function astra_sites_get_suggestion_link() {
$white_label_link = Astra_Sites_White_Label::get_option( 'astra-agency', 'licence' );
if ( empty( $white_label_link ) ) {
$white_label_link = 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions';
}
return apply_filters( 'astra_sites_suggestion_link', $white_label_link );
}
endif;
if ( ! function_exists( 'astra_sites_is_valid_image' ) ) :
/**
* Check for the valid image
*
* @param string $link The Image link.
*
* @since 2.6.2
* @return boolean
*/
function astra_sites_is_valid_image( $link = '' ) {
return preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-\@]+\.(jpg|png|gif|jpeg|svg)\/?$/i', $link );
}
endif;
if ( ! function_exists( 'astra_get_site_data' ) ) :
/**
* Returns the value of the index for the Site Data
*
* @param string $index The index value of the data.
*
* @since 2.6.14
* @return mixed
*/
function astra_get_site_data( $index = '' ) {
$demo_data = Astra_Sites_File_System::get_instance()->get_demo_content();
if ( ! empty( $demo_data ) && isset( $demo_data[ $index ] ) ) {
return $demo_data[ $index ];
}
return '';
}
endif;
if ( ! function_exists( 'astra_sites_get_reset_form_data' ) ) :
/**
* Get all the forms to be reset.
*
* @since 3.0.3
* @return array
*/
function astra_sites_get_reset_form_data() {
global $wpdb;
$form_ids = $wpdb->get_col( "SELECT post_id FROM {$wpdb->postmeta} WHERE meta_key='_astra_sites_imported_wp_forms'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need this to get all the WP forms. Traditional WP_Query would have been expensive here.
return $form_ids;
}
endif;
if ( ! function_exists( 'astra_sites_get_reset_term_data' ) ) :
/**
* Get all the terms to be reset.
*
* @since 3.0.3
* @return array
*/
function astra_sites_get_reset_term_data() {
global $wpdb;
$term_ids = $wpdb->get_col( "SELECT term_id FROM {$wpdb->termmeta} WHERE meta_key='_astra_sites_imported_term'" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching -- We need this to get all the terms and taxonomy. Traditional WP_Query would have been expensive here.
return $term_ids;
}
endif;
if ( ! function_exists( 'astra_sites_empty_post_excerpt' ) ) :
/**
* Remove the post excerpt
*
* @param int $post_id The post ID.
* @since 3.1.0
*/
function astra_sites_empty_post_excerpt( $post_id = 0 ) {
if ( ! $post_id ) {
return;
}
wp_update_post(
array(
'ID' => $post_id,
'post_excerpt' => '',
)
);
}
endif;

View File

@@ -0,0 +1,312 @@
<?php
/**
* Batch Processing
*
* @package Astra Sites
* @since 1.0.14
*/
use STImporter\Importer\Helpers\ST_Image_Importer;
if ( ! class_exists( 'Astra_Sites_Batch_Processing_Beaver_Builder' ) ) :
/**
* Astra_Sites_Batch_Processing_Beaver_Builder
*
* @since 1.0.14
*/
class Astra_Sites_Batch_Processing_Beaver_Builder {
/**
* Instance
*
* @since 1.0.14
* @access private
* @var object Class object.
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.14
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.14
*/
public function __construct() {
}
/**
* Import
*
* @since 1.0.14
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Beaver Builder" Batch Import' );
}
Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for Beaver Builder ----' );
if ( ! is_callable( 'FLBuilderModel::get_post_types' ) ) {
return;
}
$post_types = FLBuilderModel::get_post_types( 'post-types' );
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
}
if ( empty( $post_types ) && ! is_array( $post_types ) ) {
return;
}
$post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
return;
}
foreach ( $post_ids as $post_id ) {
$this->import_single_post( $post_id );
}
}
/**
* Update post meta.
*
* @param integer $post_id Post ID.
* @return void
*/
public function import_single_post( $post_id = 0 ) {
$is_bb_post = get_post_meta( $post_id, '_fl_builder_enabled', true );
if ( ! $is_bb_post ) {
return;
}
// Is page imported with Starter Sites?
// If not then skip batch process.
$imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
if ( ! $imported_from_demo_site ) {
return;
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Beaver Builder - Processing page: ' . $post_id );
}
Astra_Sites_Importer_Log::add( '---- Processing WordPress Page - for Beaver Builder ---- "' . $post_id . '"' );
if ( ! empty( $post_id ) ) {
// Get page builder data.
$data = get_post_meta( $post_id, '_fl_builder_data', true );
if ( ! empty( $data ) ) {
foreach ( $data as $key => $el ) {
// Update 'row' images.
if ( 'row' === $el->type ) {
$data[ $key ]->settings = self::update_row( $el->settings );
}
// Update 'module' images.
if ( 'module' === $el->type ) {
$data[ $key ]->settings = self::update_module( $el->settings );
}
// Update 'column' images.
if ( 'column' === $el->type ) {
$data[ $key ]->settings = self::update_column( $el->settings );
}
}
// Update page builder data.
update_post_meta( $post_id, '_fl_builder_data', $data );
update_post_meta( $post_id, '_fl_builder_draft', $data );
// Clear all cache.
FLBuilderModel::delete_asset_cache_for_all_posts();
}
// Clean the post excerpt.
astra_sites_empty_post_excerpt( $post_id );
}
}
/**
* Import Module Images.
*
* @param object $settings Module settings object.
* @return object
*/
public static function update_module( $settings ) {
// 1) Set photos.
$settings = self::import_photo( $settings );
/**
* 2) Set `$settings->data` for Only type 'image-icon'
*
* @todo Remove the condition `'image-icon' === $settings->type` if `$settings->data` is used only for the Image Icon.
*/
if (
isset( $settings->data ) &&
isset( $settings->photo ) && ! empty( $settings->photo ) &&
'image-icon' === $settings->type
) {
$settings->data = FLBuilderPhoto::get_attachment_data( $settings->photo );
}
if ( 'uabb-wp-forms-styler' === $settings->type ) {
astra_sites_error_log( '--------WP Form Styler ID replacement start-------' );
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
if ( $ids_mapping ) {
// Update WP form IDs.
foreach ( $ids_mapping as $old_id => $new_id ) {
if ( isset( $settings->wp_form_id ) && $old_id === $settings->wp_form_id ) {
astra_sites_error_log( '--------WP Form Styler ID ' . $old_id . ' replaced to ' . $new_id . '-------' );
$settings->wp_form_id = $new_id;
}
}
}
astra_sites_error_log( '--------WP Form Styler ID replacement done-------' );
}
// 3) Set `list item` module images.
if ( isset( $settings->add_list_item ) ) {
foreach ( $settings->add_list_item as $key => $value ) {
$settings->add_list_item[ $key ] = self::import_photo( $value );
}
}
// 4) Set `list item` module images.
if ( isset( $settings->text ) ) {
$settings->text = self::get_wpforms_mapping( $settings->text );
} elseif ( isset( $settings->html ) ) {
$settings->html = self::get_wpforms_mapping( $settings->html );
}
return $settings;
}
/**
* Replace WP Forms shortcode.
*
* @since 2.0.0
* @param string $content Content.
* @return string Content.
*/
private static function get_wpforms_mapping( $content = '' ) {
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
astra_sites_error_log( wp_json_encode( $ids_mapping ) );
if ( $ids_mapping ) {
// Update WP form IDs.
foreach ( $ids_mapping as $old_id => $new_id ) {
$content = str_replace( '[wpforms id="' . $old_id, '[wpforms id="' . $new_id, $content );
}
}
return $content;
}
/**
* Import Column Images.
*
* @param object $settings Column settings object.
* @return object
*/
public static function update_column( $settings ) {
// 1) Set BG Images.
$settings = self::import_bg_image( $settings );
return $settings;
}
/**
* Import Row Images.
*
* @param object $settings Row settings object.
* @return object
*/
public static function update_row( $settings ) {
// 1) Set BG Images.
$settings = self::import_bg_image( $settings );
return $settings;
}
/**
* Helper: Import BG Images.
*
* @param object $settings Row settings object.
* @return object
*/
public static function import_bg_image( $settings ) {
if (
( ! empty( $settings->bg_image ) && ! empty( $settings->bg_image_src ) )
) {
$image = array(
'url' => $settings->bg_image_src,
'id' => $settings->bg_image,
);
$downloaded_image = ST_Image_Importer::get_instance()->import( $image );
$settings->bg_image_src = $downloaded_image['url'];
$settings->bg_image = $downloaded_image['id'];
}
return $settings;
}
/**
* Helper: Import Photo.
*
* @param object $settings Row settings object.
* @return object
*/
public static function import_photo( $settings ) {
if ( ! empty( $settings->photo ) && ! empty( $settings->photo_src ) ) {
$image = array(
'url' => $settings->photo_src,
'id' => $settings->photo,
);
$downloaded_image = ST_Image_Importer::get_instance()->import( $image );
$settings->photo_src = $downloaded_image['url'];
$settings->photo = $downloaded_image['id'];
}
return $settings;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Batch_Processing_Beaver_Builder::get_instance();
endif;

View File

@@ -0,0 +1,151 @@
<?php
/**
* Batch Processing
*
* @package Astra Sites
* @since 1.2.14
*/
if ( ! class_exists( 'Astra_Sites_Batch_Processing_Brizy' ) ) :
/**
* Astra Sites Batch Processing Brizy
*
* @since 1.2.14
*/
class Astra_Sites_Batch_Processing_Brizy {
/**
* Instance
*
* @since 1.2.14
* @access private
* @var object Class object.
*/
private static $instance;
/**
* Initiator
*
* @since 1.2.14
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.2.14
*/
public function __construct() {}
/**
* Import
*
* @since 1.2.14
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Brizy" Batch Import' );
}
Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for "Brizy" ----' );
if ( ! is_callable( 'Brizy_Editor_Storage_Common::instance' ) ) {
return;
}
$post_types = Brizy_Editor_Storage_Common::instance()->get( 'post-types' );
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
}
if ( empty( $post_types ) && ! is_array( $post_types ) ) {
return;
}
$post_ids = Astra_Sites_Batch_Processing::get_pages( $post_types );
if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
return;
}
foreach ( $post_ids as $post_id ) {
$this->import_single_post( $post_id );
}
}
/**
* Update post meta.
*
* @param integer $post_id Post ID.
* @return void
*/
public function import_single_post( $post_id = 0 ) {
$is_brizy_post = get_post_meta( $post_id, 'brizy_post_uid', true );
if ( ! $is_brizy_post ) {
return;
}
// Is page imported with Starter Sites?
// If not then skip batch process.
$imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
if ( ! $imported_from_demo_site ) {
return;
}
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Brizy - Processing page: ' . $post_id );
}
astra_sites_error_log( '---- Processing WordPress Page - for "Brizy" ---- "' . $post_id . '"' );
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
$json_value = null;
$post = Brizy_Editor_Post::get( (int) $post_id );
$editor_data = $post->get_editor_data();
// Empty mapping? Then return.
if ( ! empty( $ids_mapping ) ) {
// Update WPForm IDs.
astra_sites_error_log( '---- Processing WP Forms Mapping ----' );
astra_sites_error_log( $ids_mapping );
foreach ( $ids_mapping as $old_id => $new_id ) {
$editor_data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $editor_data );
}
}
$post->set_editor_data( $editor_data );
$post->set_needs_compile( $post->get_needs_compile() );
$post->set_editor_version( BRIZY_EDITOR_VERSION );
$post->set_compiler_version( BRIZY_EDITOR_VERSION );
$post->set_plugin_version( BRIZY_VERSION );
$post->saveStorage();
$post->savePost();
// Clean the post excerpt.
astra_sites_empty_post_excerpt( $post_id );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Batch_Processing_Brizy::get_instance();
endif;

View File

@@ -0,0 +1,42 @@
<?php
/**
* Cleanup batch import tasks.
*
* @package Astra Sites
* @since 4.0.11
*/
if ( ! class_exists( 'Astra_Sites_Batch_Processing_Cleanup' ) ) :
/**
* Astra_Sites_Batch_Processing_Cleanup
*
* @since 4.0.11
*/
class Astra_Sites_Batch_Processing_Cleanup {
/**
* Constructor
*
* @since 4.0.11
*/
public function __construct() {}
/**
* Import
*
* @since 4.0.11
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Cleanup" Batch Import' );
}
update_option( 'st_attachments', array(), 'no' );
delete_option( 'st_attachments_offset' );
}
}
endif;

View File

@@ -0,0 +1,93 @@
<?php
/**
* Customizer batch import tasks.
*
* @package Astra Sites
* @since 3.0.22
*/
use STImporter\Importer\Helpers\ST_Image_Importer;
/**
* Astra_Sites_Batch_Processing_Customizer
*
* @since 3.0.22
*/
class Astra_Sites_Batch_Processing_Customizer {
/**
* Instance
*
* @since 3.0.22
* @access private
* @var object Class object.
*/
private static $instance;
/**
* Initiator
*
* @since 3.0.22
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 3.0.22
*/
public function __construct() {}
/**
* Import
*
* @since 3.0.22
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Processing "Customizer" Batch Import' );
}
Astra_Sites_Importer_Log::add( '---- Processing batch process for Customizer start ----' );
self::images_download();
Astra_Sites_Importer_Log::add( '---- Processing batch process for Customizer done ----' );
}
/**
* Downloads images from customizer.
*/
public static function images_download() {
$options = get_option( 'astra-settings', array() );
array_walk_recursive(
$options,
function ( &$value ) {
if ( ! is_array( $value ) && astra_sites_is_valid_image( $value ) ) {
$downloaded_image = ST_Image_Importer::get_instance()->import(
array(
'url' => $value,
'id' => 0,
)
);
$value = $downloaded_image['url'];
}
}
);
// Updated settings.
update_option( 'astra-settings', $options );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Batch_Processing_Customizer::get_instance();

View File

@@ -0,0 +1,159 @@
<?php
/**
* Elementor Importer
*
* @package Astra Sites
*/
namespace Elementor\TemplateLibrary;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
// If plugin - 'Elementor' not exist then return.
if ( ! class_exists( '\Elementor\Plugin' ) ) {
return;
}
use Elementor\Core\Base\Document;
use Elementor\Core\Editor\Editor;
use Elementor\DB;
use Elementor\Core\Settings\Manager as SettingsManager;
use Elementor\Core\Settings\Page\Model;
use Elementor\Modules\Library\Documents\Library_Document;
use Elementor\Plugin;
use Elementor\Utils;
/**
* Elementor template library local source.
*
* Elementor template library local source handler class is responsible for
* handling local Elementor templates saved by the user locally on his site.
*
* @since 1.2.13 Added compatibility for Elemetnor v2.5.0
* @since 1.0.0
*/
class Astra_Sites_Batch_Processing_Elementor extends Source_Local {
/**
* Import
*
* @since 1.0.14
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::line( 'Processing "Elementor" Batch Import' );
}
\Astra_Sites_Importer_Log::add( '---- Processing WordPress Posts / Pages - for Elementor ----' );
$post_types = \Astra_Sites_Batch_Processing::get_post_types_supporting( 'elementor' );
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::line( 'For post types: ' . implode( ', ', $post_types ) );
}
if ( empty( $post_types ) && ! is_array( $post_types ) ) {
return;
}
$post_ids = \Astra_Sites_Batch_Processing::get_pages( $post_types );
if ( empty( $post_ids ) && ! is_array( $post_ids ) ) {
return;
}
foreach ( $post_ids as $post_id ) {
$this->import_single_post( $post_id );
}
}
/**
* Update post meta.
*
* @since 1.0.14
* @param integer $post_id Post ID.
* @return void
*/
public function import_single_post( $post_id = 0 ) {
$is_elementor_post = get_post_meta( $post_id, '_elementor_version', true );
if ( ! $is_elementor_post ) {
return;
}
// Is page imported with Starter Sites?
// If not then skip batch process.
$imported_from_demo_site = get_post_meta( $post_id, '_astra_sites_enable_for_batch', true );
if ( ! $imported_from_demo_site ) {
return;
}
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::line( 'Elementor - Processing page: ' . $post_id );
}
\Astra_Sites_Importer_Log::add( '---- Processing WordPress Page - for Elementor ---- "' . $post_id . '"' );
if ( ! empty( $post_id ) ) {
$data = get_post_meta( $post_id, '_elementor_data', true );
\Astra_Sites_Importer_Log::add( wp_json_encode( $data ) );
if ( ! empty( $data ) ) {
// Update WP form IDs.
$ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
\Astra_Sites_Importer_Log::add( wp_json_encode( $ids_mapping ) );
if ( $ids_mapping ) {
foreach ( $ids_mapping as $old_id => $new_id ) {
$data = str_replace( '[wpforms id=\"' . $old_id, '[wpforms id=\"' . $new_id, $data );
$data = str_replace( '"select_form":"' . $old_id, '"select_form":"' . $new_id, $data );
$data = str_replace( '"form_id":"' . $old_id, '"form_id":"' . $new_id, $data );
}
}
if ( ! is_array( $data ) ) {
$data = json_decode( $data, true );
}
\Astra_Sites_Importer_Log::add( wp_json_encode( $data ) );
$document = Plugin::$instance->documents->get( $post_id );
if ( $document ) {
$data = $document->get_elements_raw_data( $data, true );
}
// Import the data.
$data = $this->process_export_import_content( $data, 'on_import' );
// Replace the site urls.
$demo_data = \Astra_Sites_File_System::get_instance()->get_demo_content();
\Astra_Sites_Importer_Log::add( wp_json_encode( $demo_data ) );
if ( isset( $demo_data['astra-site-url'] ) ) {
$data = wp_json_encode( $data );
if ( ! empty( $data ) ) {
$site_url = get_site_url();
$site_url = str_replace( '/', '\/', $site_url );
$demo_site_url = 'https:' . $demo_data['astra-site-url'];
$demo_site_url = str_replace( '/', '\/', $demo_site_url );
$data = str_replace( $demo_site_url, $site_url, $data );
$data = json_decode( $data, true );
}
}
// Update processed meta.
update_metadata( 'post', $post_id, '_elementor_data', $data );
update_metadata( 'post', $post_id, '_astra_sites_hotlink_imported', true );
// !important, Clear the cache after images import.
Plugin::$instance->files_manager->clear_cache();
}
// Clean the post excerpt.
$clean_post_excerpt = apply_filters( 'astra_sites_pre_process_post_empty_excerpt', true );
if ( $clean_post_excerpt ) {
astra_sites_empty_post_excerpt( $post_id );
}
}
}
}

View File

@@ -0,0 +1,397 @@
<?php
/**
* Batch Processing
*
* @package Astra Sites
* @since 2.0.0
*/
if ( ! class_exists( 'Astra_Sites_Batch_Processing_Importer' ) ) :
/**
* Astra_Sites_Batch_Processing_Importer
*
* @since 1.0.14
*/
class Astra_Sites_Batch_Processing_Importer {
/**
* Instance
*
* @since 1.0.14
* @access private
* @var object Class object.
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.14
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.14
*/
public function __construct() {
}
/**
* Import All Categories and Tags
*
* @since 2.6.22
* @return void
*/
public function import_all_categories_and_tags() {
astra_sites_error_log( 'Requesting Site Categories' );
update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories' );
$api_args = array(
'timeout' => 30,
);
$request = wp_safe_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-content/uploads/all-site-categories.json', $api_args );
if ( ! is_wp_error( $request ) && 200 === (int) wp_remote_retrieve_response_code( $request ) ) {
$cats = json_decode( wp_remote_retrieve_body( $request ), true );
if ( isset( $cats['code'] ) ) {
$message = isset( $cats['message'] ) ? $cats['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-sites-all-site-categories-and-tags.json', $cats );
do_action( 'astra_sites_sync_all_site_categories_and_tags', $cats );
}
}
astra_sites_error_log( 'Site Categories Imported Successfully!' );
update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!' );
}
/**
* Import All Categories and Tags
*
* @since 2.6.22
* @return void
*/
public function import_all_categories() {
astra_sites_error_log( 'Requesting Site Categories' );
update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories' );
$api_args = array(
'timeout' => 30,
);
$request = wp_safe_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-sites-site-category/?hide_empty=true&_fields=id,name,slug&per_page=100', $api_args );
if ( ! is_wp_error( $request ) && 200 === (int) wp_remote_retrieve_response_code( $request ) ) {
$cats = json_decode( wp_remote_retrieve_body( $request ), true );
if ( isset( $cats['code'] ) ) {
$message = isset( $cats['message'] ) ? $cats['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-sites-all-site-categories.json', $cats );
do_action( 'astra_sites_sync_all_site_categories', $cats );
}
}
astra_sites_error_log( 'Site Categories Imported Successfully!' );
update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!' );
}
/**
* Import Categories
*
* @since 2.0.0
* @return void
*/
public function import_site_categories() {
astra_sites_error_log( 'Requesting Site Categories' );
update_site_option( 'astra-sites-batch-status-string', 'Requesting Site Categories' );
$api_args = array(
'timeout' => 30,
);
$categories_request = wp_safe_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-sites-site-category/?hide_empty=true&_fields=id,name,slug&per_page=100', $api_args );
if ( ! is_wp_error( $categories_request ) && 200 === (int) wp_remote_retrieve_response_code( $categories_request ) ) {
$categories = json_decode( wp_remote_retrieve_body( $categories_request ), true );
if ( isset( $categories['code'] ) ) {
$message = isset( $categories['message'] ) ? $categories['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-sites-categories.json', $categories );
do_action( 'astra_sites_sync_categories', $categories );
}
}
astra_sites_error_log( 'Site Categories Imported Successfully!' );
update_site_option( 'astra-sites-batch-status-string', 'Site Categories Imported Successfully!' );
}
/**
* Import Block Categories
*
* @since 2.0.0
* @return void
*/
public function import_block_categories() {
astra_sites_error_log( 'Requesting Block Categories' );
update_site_option( 'astra-sites-batch-status-string', 'Requesting Block Categories' );
$api_args = array(
'timeout' => 30,
);
$tags_request = wp_safe_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/blocks-category/?_fields=id,name,slug&per_page=100&hide_empty=1', $api_args );
if ( ! is_wp_error( $tags_request ) && 200 === (int) wp_remote_retrieve_response_code( $tags_request ) ) {
$tags = json_decode( wp_remote_retrieve_body( $tags_request ), true );
if ( isset( $tags['code'] ) ) {
$message = isset( $tags['message'] ) ? $tags['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
$categories = array();
foreach ( $tags as $key => $value ) {
$categories[ $value['id'] ] = $value;
}
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-blocks-categories.json', $categories );
do_action( 'astra_sites_sync_blocks_categories', $categories );
}
}
astra_sites_error_log( 'Block Categories Imported Successfully!' );
update_site_option( 'astra-sites-batch-status-string', 'Categories Imported Successfully!' );
}
/**
* Import Page Builders
*
* @since 2.0.0
* @return void
*/
public function set_license_page_builder() {
astra_sites_error_log( 'Requesting License Page Builders' );
$url = add_query_arg(
array(
'_fields' => 'id,name,slug',
'site_url' => get_site_url(),
'purchase_key' => Astra_Sites::get_instance()->get_license_key(),
'only_allow_page_builders' => 'true',
),
trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-site-page-builder/'
);
$api_args = array(
'timeout' => 30,
);
$page_builder_request = wp_safe_remote_get( $url, $api_args );
if ( ! is_wp_error( $page_builder_request ) && 200 === (int) wp_remote_retrieve_response_code( $page_builder_request ) ) {
$page_builders = json_decode( wp_remote_retrieve_body( $page_builder_request ), true );
if ( isset( $page_builders['code'] ) ) {
$message = isset( $page_builders['message'] ) ? $page_builders['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
// Set mini agency page builder.
$page_builder_slugs = wp_list_pluck( $page_builders, 'slug' );
if ( in_array( 'elementor', $page_builder_slugs ) && ! in_array( 'beaver-builder', $page_builder_slugs ) ) {
update_option( 'astra-sites-license-page-builder', 'elementor', 'no' );
astra_sites_error_log( 'Set "Elementor" as License Page Builder' );
} elseif ( in_array( 'beaver-builder', $page_builder_slugs ) && ! in_array( 'elementor', $page_builder_slugs ) ) {
update_option( 'astra-sites-license-page-builder', 'beaver-builder', 'no' );
astra_sites_error_log( 'Set "Beaver Builder" as License Page Builder' );
} else {
update_option( 'astra-sites-license-page-builder', '', 'no' );
astra_sites_error_log( 'Not Set Any License Page Builder' );
}
}
}
}
/**
* Import Page Builders
*
* @since 2.0.0
* @return void
*/
public function import_page_builders() {
astra_sites_error_log( 'Requesting Page Builders' );
update_site_option( 'astra-sites-batch-status-string', 'Requesting Page Builders' );
$purchase_key = Astra_Sites::get_instance()->get_license_key();
$site_url = get_site_url();
$api_args = array(
'timeout' => 30,
);
$page_builder_request = wp_safe_remote_get( trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/wp/v2/astra-site-page-builder/?_fields=id,name,slug&site_url=' . $site_url . '&purchase_key=' . $purchase_key, $api_args );
if ( ! is_wp_error( $page_builder_request ) && 200 === (int) wp_remote_retrieve_response_code( $page_builder_request ) ) {
$page_builders = json_decode( wp_remote_retrieve_body( $page_builder_request ), true );
if ( isset( $page_builders['code'] ) ) {
$message = isset( $page_builders['message'] ) ? $page_builders['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-sites-page-builders.json', $page_builders );
do_action( 'astra_sites_sync_page_builders', $page_builders );
}
}
astra_sites_error_log( 'Page Builders Imported Successfully!' );
update_site_option( 'astra-sites-batch-status-string', 'Page Builders Imported Successfully!' );
}
/**
* Import Blocks
*
* @since 2.0.0
* @param integer $page Page number.
* @return void
*/
public function import_blocks( $page = 1 ) {
astra_sites_error_log( 'BLOCK: -------- ACTUAL IMPORT --------' );
$api_args = array(
'timeout' => 30,
);
$all_blocks = array();
astra_sites_error_log( 'BLOCK: Requesting ' . $page );
update_site_option( 'astra-blocks-batch-status-string', 'Requesting for blocks page - ' . $page );
$query_args = apply_filters(
'astra_sites_blocks_query_args',
array(
'page_builder' => 'elementor',
'per_page' => 100,
'page' => $page,
'wireframe' => 'yes',
)
);
$api_url = add_query_arg( $query_args, trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-blocks/v1/blocks/' );
$response = wp_safe_remote_get( $api_url, $api_args );
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
$astra_blocks = json_decode( wp_remote_retrieve_body( $response ), true );
if ( isset( $astra_blocks['code'] ) ) {
$message = isset( $astra_blocks['message'] ) ? $astra_blocks['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
astra_sites_error_log( 'BLOCK: Storing data for page ' . $page . ' in option astra-blocks-' . $page );
update_site_option( 'astra-blocks-batch-status-string', 'Storing data for page ' . $page . ' in option astra-blocks-' . $page );
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-blocks-' . $page . '.json', $astra_blocks );
do_action( 'astra_sites_sync_blocks', $page, $astra_blocks );
}
} else {
astra_sites_error_log( 'BLOCK: API Error: ' . $response->get_error_message() );
}
astra_sites_error_log( 'BLOCK: Complete storing data for blocks ' . $page );
update_site_option( 'astra-blocks-batch-status-string', 'Complete storing data for page ' . $page );
}
/**
* Import
*
* @since 1.0.14
* @since 2.0.0 Added page no.
*
* @param integer $page Page number.
* @return array
*/
public function import_sites( $page = 1 ) {
$api_args = array(
'timeout' => 30,
);
$sites_and_pages = array();
astra_sites_error_log( 'Requesting ' . $page );
update_site_option( 'astra-sites-batch-status-string', 'Requesting ' . $page );
$query_args = apply_filters(
'astra_sites_import_sites_query_args',
array(
'per_page' => 15,
'page' => $page,
)
);
$api_url = add_query_arg( $query_args, trailingslashit( Astra_Sites::get_instance()->get_api_domain() ) . 'wp-json/astra-sites/v1/sites-and-pages/' );
$response = wp_safe_remote_get( $api_url, $api_args );
if ( ! is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) === 200 ) {
$sites_and_pages = json_decode( wp_remote_retrieve_body( $response ), true );
if ( isset( $sites_and_pages['code'] ) ) {
$message = isset( $sites_and_pages['message'] ) ? $sites_and_pages['message'] : '';
if ( ! empty( $message ) ) {
astra_sites_error_log( 'HTTP Request Error: ' . $message );
} else {
astra_sites_error_log( 'HTTP Request Error!' );
}
} else {
astra_sites_error_log( 'Storing data for page ' . $page . ' in option astra-sites-and-pages-page-' . $page );
update_site_option( 'astra-sites-batch-status-string', 'Storing data for page ' . $page . ' in option astra-sites-and-pages-page-' . $page );
Astra_Sites_File_System::get_instance()->update_json_file( 'astra-sites-and-pages-page-' . $page . '.json', $sites_and_pages );
do_action( 'astra_sites_sync_sites_and_pages', $page, $sites_and_pages );
}
} else {
astra_sites_error_log( 'API Error: ' . $response->get_error_message() );
}
astra_sites_error_log( 'Complete storing data for page ' . $page );
update_site_option( 'astra-sites-batch-status-string', 'Complete storing data for page ' . $page );
return $sites_and_pages;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Batch_Processing_Importer::get_instance();
endif;

View File

@@ -0,0 +1,215 @@
<?php
/**
* Batch Processing
*
* @package Astra Sites
* @since 1.0.14
*/
use STImporter\Importer\Helpers\ST_Image_Importer;
if ( ! class_exists( 'Astra_Sites_Batch_Processing_Widgets' ) ) :
/**
* Astra_Sites_Batch_Processing_Widgets
*
* @since 1.0.14
*/
class Astra_Sites_Batch_Processing_Widgets {
/**
* WP Forms.
*
* @since 2.6.22
* @var object Class object.
*/
public $wpforms_ids_mapping;
/**
* Instance
*
* @since 1.0.14
* @access private
* @var object Class object.
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.14
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.14
*/
public function __construct() {
}
/**
* Import
*
* @since 1.0.14
* @return void
*/
public function import() {
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Importing Widgets Data' );
}
// Catch mapping data.
$this->wpforms_ids_mapping = get_option( 'astra_sites_wpforms_ids_mapping', array() );
// Process image widget data.
$this->widget_media_image();
// Process text widget data.
$this->widget_text();
// Process WP Forms widget data.
$this->widget_wpform();
}
/**
* Widget WP Forms
*
* @since 3.1.3
* @return void
*/
public function widget_wpform() {
$data = get_option( 'widget_wpforms-widget', null );
if ( empty( $data ) ) {
return;
}
Astra_Sites_Importer_Log::add( '---- Processing Contact Form Mapping from WP Forms Widgets -----' );
foreach ( $data as $key => $value ) {
if ( isset( $value['form_id'] ) && ! empty( $value['form_id'] ) ) {
$content = $value['form_id'];
// Empty mapping? Then return.
if ( ! empty( $this->wpforms_ids_mapping ) ) {
// Replace ID's.
foreach ( $this->wpforms_ids_mapping as $old_id => $new_id ) {
if ( $old_id === $content ) {
$content = $new_id;
}
}
}
$data[ $key ]['form_id'] = $content;
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Updating Contact Form Mapping from WP Forms Widgets' );
}
}
}
update_option( 'widget_wpforms-widget', $data );
}
/**
* Widget Text
*
* @since 2.6.22
* @return void
*/
public function widget_text() {
$data = get_option( 'widget_text', null );
if ( empty( $data ) ) {
return;
}
Astra_Sites_Importer_Log::add( '---- Processing Contact Form Mapping from Text Widgets -----' );
foreach ( $data as $key => $value ) {
if ( isset( $value['text'] ) && ! empty( $value['text'] ) ) {
$content = $value['text'];
// Empty mapping? Then return.
if ( ! empty( $this->wpforms_ids_mapping ) ) {
// Replace ID's.
foreach ( $this->wpforms_ids_mapping as $old_id => $new_id ) {
$content = str_replace( '[wpforms id="' . $old_id, '[wpforms id="' . $new_id, $content );
$content = str_replace( '{"formId":"' . $old_id . '"}', '{"formId":"' . $new_id . '"}', $content );
}
}
$data[ $key ]['text'] = $content;
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Updating Contact Form Mapping from Text Widgets' );
}
}
}
update_option( 'widget_text', $data );
}
/**
* Widget Media Image
*
* @since 1.0.14
* @return void
*/
public function widget_media_image() {
$data = get_option( 'widget_media_image', null );
if ( empty( $data ) ) {
return;
}
Astra_Sites_Importer_Log::add( '---- Processing Images from Widgets -----' );
foreach ( $data as $key => $value ) {
if (
isset( $value['url'] ) &&
isset( $value['attachment_id'] )
) {
$image = array(
'url' => $value['url'],
'id' => $value['attachment_id'],
);
$downloaded_image = ST_Image_Importer::get_instance()->import( $image );
$data[ $key ]['url'] = $downloaded_image['url'];
$data[ $key ]['attachment_id'] = $downloaded_image['id'];
if ( defined( 'WP_CLI' ) ) {
WP_CLI::line( 'Importing Widgets Image: ' . $value['url'] . ' | New Image ' . $downloaded_image['url'] );
}
}
}
update_option( 'widget_media_image', $data );
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Batch_Processing_Widgets::get_instance();
endif;

View File

@@ -0,0 +1,63 @@
<?php
/**
* Customizer Data importer class.
*
* @since 1.0.0
* @package Astra Addon
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Customizer Data importer class.
*
* @since 1.0.0
*/
class Astra_Customizer_Import {
/**
* Instance of Astra_Customizer_Import
*
* @since 1.0.0
* @var Astra_Customizer_Import
*/
private static $instance = null;
/**
* Instantiate Astra_Customizer_Import
*
* @since 1.0.0
* @return (Object) Astra_Customizer_Import
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Import customizer options.
*
* @since 1.0.0
*
* @param (Array) $options customizer options from the demo.
*/
public function import( $options ) {
// Update Astra Theme customizer settings.
if ( isset( $options['astra-settings'] ) ) {
update_option( 'astra-settings', $options['astra-settings'] );
}
// Add Custom CSS.
if ( isset( $options['custom-css'] ) ) {
wp_update_custom_css_post( $options['custom-css'] );
}
}
}

View File

@@ -0,0 +1,407 @@
<?php
/**
* Customizer Site options importer class.
*
* @since 1.0.0
* @package Astra Addon
*/
use STImporter\Importer\ST_Importer_Helper;
use STImporter\Importer\Helpers\ST_Image_Importer;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Customizer Site options importer class.
*
* @since 1.0.0
*/
class Astra_Site_Options_Import {
/**
* Instance of Astra_Site_Options_Importer
*
* @since 1.0.0
* @var (Object) Astra_Site_Options_Importer
*/
private static $instance = null;
/**
* Instanciate Astra_Site_Options_Importer
*
* @since 1.0.0
* @return (Object) Astra_Site_Options_Importer
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
add_filter( 'st_importer_site_options', array( $this, 'classic_templates_options' ), 10, 1 );
add_action( 'st_importer_import_site_options', array( $this, 'import_classic_templates_options' ), 10, 1 );
}
/**
* Classic templates options.
*
* @since 4.3.0
* @param array<int, string> $default_options List of defined array.
* @return array<int, string> List of defined array.
*/
public function classic_templates_options( $default_options ) {
$classic_templates_options = array(
'custom_logo',
'nav_menu_locations',
'show_on_front',
'page_on_front',
'page_for_posts',
'site_title',
// Plugin: Elementor.
'elementor_container_width',
'elementor_cpt_support',
'elementor_css_print_method',
'elementor_default_generic_fonts',
'elementor_disable_color_schemes',
'elementor_disable_typography_schemes',
'elementor_editor_break_lines',
'elementor_exclude_user_roles',
'elementor_global_image_lightbox',
'elementor_page_title_selector',
'elementor_scheme_color',
'elementor_scheme_color-picker',
'elementor_scheme_typography',
'elementor_space_between_widgets',
'elementor_stretched_section_container',
'elementor_load_fa4_shim',
'elementor_active_kit',
'elementor_experiment-container',
// Plugin: Beaver Builder.
'_fl_builder_enabled_icons',
'_fl_builder_enabled_modules',
'_fl_builder_post_types',
'_fl_builder_color_presets',
'_fl_builder_services',
'_fl_builder_settings',
'_fl_builder_user_access',
'_fl_builder_enabled_templates',
// Plugin: WooCommerce.
// Pages.
'woocommerce_shop_page_title',
'woocommerce_cart_page_title',
'woocommerce_checkout_page_title',
'woocommerce_myaccount_page_title',
'woocommerce_edit_address_page_title',
'woocommerce_view_order_page_title',
'woocommerce_change_password_page_title',
'woocommerce_logout_page_title',
// Account & Privacy.
'woocommerce_enable_guest_checkout',
'woocommerce_enable_checkout_login_reminder',
'woocommerce_enable_signup_and_login_from_checkout',
'woocommerce_enable_myaccount_registration',
'woocommerce_registration_generate_username',
// Plugin: Easy Digital Downloads - EDD.
'edd_settings',
// Plugin: WPForms.
'wpforms_settings',
// Categories.
'woocommerce_product_cat',
// Plugin: LearnDash LMS.
'learndash_settings_theme_ld30',
'learndash_settings_courses_themes',
// Astra Theme Global Color Palette and Typography Preset options.
'astra-color-palettes',
'astra-typography-presets',
);
$options = array_merge( $default_options, $classic_templates_options );
return $options;
}
/**
* Import Classic Templates Options.
*
* @since 4.3.0
*
* @param array<string, mixed> $options List of default options.
*
* @return void
*/
public function import_classic_templates_options( $options ) {
if ( ! isset( $options ) ) {
return;
}
try {
foreach ( $options as $option_name => $option_value ) {
// Is option exist in defined array site_options()?
if ( null !== $option_value ) {
switch ( $option_name ) {
// Set WooCommerce page ID by page Title.
case 'woocommerce_shop_page_title':
case 'woocommerce_cart_page_title':
case 'woocommerce_checkout_page_title':
case 'woocommerce_myaccount_page_title':
case 'woocommerce_edit_address_page_title':
case 'woocommerce_view_order_page_title':
case 'woocommerce_change_password_page_title':
case 'woocommerce_logout_page_title':
$this->update_woocommerce_page_id_by_option_value( $option_name, $option_value );
break;
case 'page_for_posts':
case 'page_on_front':
$this->update_page_id_by_option_value( $option_name, $option_value );
break;
// nav menu locations.
case 'nav_menu_locations':
$this->set_nav_menu_locations( $option_value );
break;
// import WooCommerce category images.
case 'woocommerce_product_cat':
$this->set_woocommerce_product_cat( $option_value );
break;
// insert logo.
case 'custom_logo':
$this->insert_logo( $option_value );
break;
case 'elementor_active_kit':
if ( '' !== $option_value ) {
$this->set_elementor_kit();
}
break;
case 'site_title':
update_option( 'blogname', $option_value );
break;
default:
update_option( $option_name, $option_value );
break;
}
}
}
} catch ( Exception $e ) {
// Do nothing.
astra_sites_error_log( 'Error while importing site options: ' . $e->getMessage() );
}
}
/**
* Update post option
*
* @since 2.2.2
*
* @return void
*/
private function set_elementor_kit() {
// Update Elementor Theme Kit Option.
$args = array(
'post_type' => 'elementor_library',
'post_status' => 'publish',
'numberposts' => 1,
'meta_query' => array( //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Setting elementor kit. WP Query would have been expensive.
array(
'key' => '_astra_sites_imported_post',
'value' => '1',
),
array(
'key' => '_elementor_template_type',
'value' => 'kit',
),
),
);
$query = get_posts( $args );
if ( ! empty( $query ) && isset( $query[0] ) && isset( $query[0]->ID ) ) {
update_option( 'elementor_active_kit', $query[0]->ID );
}
}
/**
* Get post from post title and post type.
*
* @since 4.0.6
*
* @param mixed $post_title post title.
* @param string $post_type post type.
* @return mixed
*/
public function get_page_by_title( $post_title, $post_type ) {
$page = array();
$query = new WP_Query(
array(
'post_type' => $post_type,
'title' => $post_title,
'posts_per_page' => 1,
'no_found_rows' => true,
'ignore_sticky_posts' => true,
'update_post_term_cache' => false,
'update_post_meta_cache' => false,
'orderby' => 'ID',
'order' => 'DESC',
)
);
if ( $query->have_posts() ) {
$page = $query->posts[0];
}
return $page;
}
/**
* Update post option
*
* @since 1.0.2
*
* @param string $option_name Option name.
* @param mixed $option_value Option value.
* @return void
*/
private function update_page_id_by_option_value( $option_name, $option_value ) {
if ( empty( $option_value ) ) {
return;
}
$page = $this->get_page_by_title( $option_value, 'page' );
if ( is_object( $page ) ) {
update_option( $option_name, $page->ID );
}
}
/**
* Update WooCommerce page ids.
*
* @since 1.1.6
*
* @param string $option_name Option name.
* @param mixed $option_value Option value.
* @return void
*/
private function update_woocommerce_page_id_by_option_value( $option_name, $option_value ) {
$option_name = str_replace( '_title', '_id', $option_name );
$this->update_page_id_by_option_value( $option_name, $option_value );
}
/**
* In WP nav menu is stored as ( 'menu_location' => 'menu_id' );
* In export we send 'menu_slug' like ( 'menu_location' => 'menu_slug' );
* In import we set 'menu_id' from menu slug like ( 'menu_location' => 'menu_id' );
*
* @since 1.0.0
* @param array $nav_menu_locations Array of nav menu locations.
*/
private function set_nav_menu_locations( $nav_menu_locations = array() ) {
$menu_locations = array();
// Update menu locations.
if ( isset( $nav_menu_locations ) ) {
foreach ( $nav_menu_locations as $menu => $value ) {
$term = get_term_by( 'slug', $value, 'nav_menu' );
if ( is_object( $term ) ) {
$menu_locations[ $menu ] = $term->term_id;
}
}
set_theme_mod( 'nav_menu_locations', $menu_locations );
}
}
/**
* Set WooCommerce category images.
*
* @since 1.1.4
*
* @param array $cats Array of categories.
*/
private function set_woocommerce_product_cat( $cats = array() ) {
if ( isset( $cats ) ) {
foreach ( $cats as $key => $cat ) {
if ( ! empty( $cat['slug'] ) && ! empty( $cat['thumbnail_src'] ) ) {
$downloaded_image = ST_Image_Importer::get_instance()->import(
array(
'url' => $cat['thumbnail_src'],
'id' => 0,
)
);
if ( $downloaded_image['id'] ) {
$term = get_term_by( 'slug', $cat['slug'], 'product_cat' );
if ( is_object( $term ) ) {
update_term_meta( $term->term_id, 'thumbnail_id', $downloaded_image['id'] );
}
}
}
}
}
}
/**
* Insert Logo By URL
*
* @since 1.0.0
* @param string $image_url Logo URL.
* @return void
*/
private function insert_logo( $image_url = '' ) {
$downloaded_image = ST_Image_Importer::get_instance()->import(
array(
'url' => $image_url,
'id' => 0,
)
);
if ( $downloaded_image['id'] ) {
ST_Importer_Helper::track_post( $downloaded_image['id'] );
set_theme_mod( 'custom_logo', $downloaded_image['id'] );
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Site_Options_Import::instance();

View File

@@ -0,0 +1,299 @@
<?php
/**
* Astra Site Helper
*
* @since 1.0.0
* @package Astra Sites
*/
if ( ! class_exists( 'Astra_Sites_Helper' ) ) :
/**
* Astra_Sites_Helper
*
* @since 1.0.0
*/
class Astra_Sites_Helper {
/**
* Instance
*
* @access private
* @var object Instance
* @since 1.0.0
*/
private static $instance;
/**
* Initiator
*
* @since 1.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
add_filter( 'wie_import_data', array( $this, 'custom_menu_widget' ) );
add_filter( 'wp_prepare_attachment_for_js', array( $this, 'add_svg_image_support' ), 10, 3 );
}
/**
* Add svg image support
*
* @since 1.1.5
*
* @param array $response Attachment response.
* @param object $attachment Attachment object.
* @param array $meta Attachment meta data.
*/
public function add_svg_image_support( $response, $attachment, $meta ) {
if ( ! function_exists( 'simplexml_load_file' ) ) {
return $response;
}
if ( ! empty( $response['sizes'] ) ) {
return $response;
}
if ( 'image/svg+xml' !== $response['mime'] ) {
return $response;
}
$svg_path = get_attached_file( $attachment->ID );
$dimensions = self::get_svg_dimensions( $svg_path );
$response['sizes'] = array(
'full' => array(
'url' => $response['url'],
'width' => $dimensions->width,
'height' => $dimensions->height,
'orientation' => $dimensions->width > $dimensions->height ? 'landscape' : 'portrait',
),
);
return $response;
}
/**
* Get SVG Dimensions
*
* @since 1.1.5
*
* @param string $svg SVG file path.
* @return array Return SVG file height & width for valid SVG file.
*/
public static function get_svg_dimensions( $svg ) {
$svg = simplexml_load_file( $svg );
if ( false === $svg ) {
$width = '0';
$height = '0';
} else {
$attributes = $svg->attributes();
$width = (string) $attributes->width;
$height = (string) $attributes->height;
}
return (object) array(
'width' => $width,
'height' => $height,
);
}
/**
* Custom Menu Widget
*
* In widget export we set the nav menu slug instead of ID.
* So, In import process we check get menu id by slug and set
* it in import widget process.
*
* @since 1.0.7
*
* @param object $all_sidebars Widget data.
* @return object Set custom menu id by slug.
*/
public function custom_menu_widget( $all_sidebars ) {
// Get current menu ID & Slugs.
$menu_locations = array();
$nav_menus = (object) wp_get_nav_menus();
if ( isset( $nav_menus ) ) {
foreach ( $nav_menus as $menu_key => $menu ) {
if ( is_object( $menu ) ) {
$menu_locations[ $menu->term_id ] = $menu->slug;
}
}
}
// Import widget data.
$all_sidebars = (object) $all_sidebars;
foreach ( $all_sidebars as $widgets_key => $widgets ) {
foreach ( $widgets as $widget_key => $widget ) {
// Found slug in current menu list.
if ( isset( $widget->nav_menu ) ) {
$menu_id = array_search( $widget->nav_menu, $menu_locations, true );
if ( ! empty( $menu_id ) ) {
$all_sidebars->$widgets_key->$widget_key->nav_menu = $menu_id;
}
}
}
}
return $all_sidebars;
}
/**
* Downloads an image from the specified URL.
*
* Taken from the core media_sideload_image() function and
* modified to return an array of data instead of html.
*
* @since 1.0.10
*
* @param string $file The image file path.
* @return array An array of image data.
*/
public static function sideload_image( $file ) {
$data = new stdClass();
if ( ! function_exists( 'media_handle_sideload' ) ) {
require_once ABSPATH . 'wp-admin/includes/media.php';
require_once ABSPATH . 'wp-admin/includes/file.php';
require_once ABSPATH . 'wp-admin/includes/image.php';
}
if ( ! empty( $file ) ) {
// Set variables for storage, fix file filename for query strings.
preg_match( '/[^\?]+\.(jpe?g|jpe|svg|gif|png)\b/i', $file, $matches );
$file_array = array();
$file_array['name'] = basename( $matches[0] );
// Download file to temp location.
$file_array['tmp_name'] = download_url( $file );
// If error storing temporarily, return the error.
if ( is_wp_error( $file_array['tmp_name'] ) ) {
return $file_array['tmp_name'];
}
// Do the validation and storage stuff.
$id = media_handle_sideload( $file_array, 0 );
// If error storing permanently, unlink.
if ( is_wp_error( $id ) ) {
unlink( $file_array['tmp_name'] ); //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.file_ops_unlink -- Deleting the file from temp location.
return $id;
}
// Build the object to return.
$meta = wp_get_attachment_metadata( $id );
$data->attachment_id = $id;
$data->url = wp_get_attachment_url( $id );
$data->thumbnail_url = wp_get_attachment_thumb_url( $id );
$data->height = isset( $meta['height'] ) ? $meta['height'] : '';
$data->width = isset( $meta['width'] ) ? $meta['width'] : '';
}
return $data;
}
/**
* Extract image URLs and other URLs from a given HTML content.
*
* @since 2.6.10
*
* @param string $content HTML content string.
* @return array Array of URLS.
*/
public static function extract_segregated_urls( $content ) {
// Extract all links.
preg_match_all( '#\bhttps?://[^,\s()<>]+(?:\([\w\d]+\)|([^,[:punct:]\s]|/))#', $content, $match );
$extracts = array(
'image' => array(),
'other' => array(),
);
$all_links = array_unique( $match[0] );
// Not have any link.
if ( empty( $all_links ) ) {
return array();
}
$image_links = array();
$other_links = array();
// Extract normal and image links.
foreach ( $all_links as $key => $link ) {
if ( preg_match( '/^((https?:\/\/)|(www\.))([a-z0-9-].?)+(:[0-9]+)?\/[\w\-]+\.(jpg|png|gif|jpeg)\/?$/i', $link ) ) {
// Get all image links.
// Avoid *-150x, *-300x and *-1024x images.
if (
false === strpos( $link, '-150x' ) &&
false === strpos( $link, '-300x' ) &&
false === strpos( $link, '-1024x' )
) {
$image_links[] = $link;
}
} else {
// Collect other links.
$other_links[] = $link;
}
}
$extracts['image'] = $image_links;
$extracts['other'] = $other_links;
return $extracts;
}
/**
* Get the client IP address.
*
* @since 2.6.4
*/
public static function get_client_ip() {
$ipaddress = '';
if ( getenv( 'HTTP_CLIENT_IP' ) ) {
$ipaddress = getenv( 'HTTP_CLIENT_IP' );
} elseif ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$ipaddress = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_X_FORWARDED' ) ) {
$ipaddress = getenv( 'HTTP_X_FORWARDED' );
} elseif ( getenv( 'HTTP_FORWARDED_FOR' ) ) {
$ipaddress = getenv( 'HTTP_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_FORWARDED' ) ) {
$ipaddress = getenv( 'HTTP_FORWARDED' );
} elseif ( getenv( 'REMOTE_ADDR' ) ) {
$ipaddress = getenv( 'REMOTE_ADDR' );
} else {
$ipaddress = 'UNKNOWN';
}
return $ipaddress;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Astra_Sites_Helper::get_instance();
endif;

View File

@@ -0,0 +1,289 @@
<?php
/**
* Widget Importer Exporter
* https://github.com/churchthemes/widget-importer-exporter
*
* Released under the GNU General Public License v2.0
* https://github.com/churchthemes/widget-importer-exporter/blob/master/license.txt
*
* Widget Data exporter class.
*
* @since 2.0.0
* @package Astra Sites
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
/**
* Widget Data exporter class.
*/
class Astra_Widget_Importer {
/**
* Instance of Astra_Widget_Importer
*
* @var Astra_Widget_Importer
*/
private static $instance = null;
/**
* Instance
*
* @return object
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Available widgets
*
* Gather site's widgets into array with ID base, name, etc.
* Used by export and import functions.
*
* @since 0.4
* @global array $wp_registered_widget_updates
* @return array Widget information
*/
public function wie_available_widgets() {
global $wp_registered_widget_controls;
$widget_controls = $wp_registered_widget_controls;
$available_widgets = array();
foreach ( $widget_controls as $widget ) {
if ( ! empty( $widget['id_base'] ) && ! isset( $available_widgets[ $widget['id_base'] ] ) ) { // no dupes.
$available_widgets[ $widget['id_base'] ]['id_base'] = $widget['id_base'];
$available_widgets[ $widget['id_base'] ]['name'] = $widget['name'];
}
}
return apply_filters( 'wie_available_widgets', $available_widgets );
}
/**
* Import widget JSON data
*
* @since 0.4
* @global array $wp_registered_sidebars
*
* @param object $data JSON widget data from .wie file.
*
* @return array Results array
*/
public function import_widgets_data( $data ) {
global $wp_registered_sidebars;
// Have valid data?
// If no data or could not decode.
if ( empty( $data ) || ! is_object( $data ) ) {
wp_die(
esc_html__( 'Import data could not be read. Please try a different file.', 'astra-sites' ),
'',
array(
'back_link' => true,
)
);
}
// Hook before import.
do_action( 'wie_before_import' );
$data = apply_filters( 'wie_import_data', $data );
// Get all available widgets site supports.
$available_widgets = $this->wie_available_widgets();
// Get all existing widget instances.
$widget_instances = array();
foreach ( $available_widgets as $widget_data ) {
$widget_instances[ $widget_data['id_base'] ] = get_option( 'widget_' . $widget_data['id_base'] );
}
// Begin results.
$results = array();
// Loop import data's sidebars.
foreach ( $data as $sidebar_id => $widgets ) {
// Skip inactive widgets.
// (should not be in export file).
if ( 'wp_inactive_widgets' === $sidebar_id ) {
continue;
}
// Check if sidebar is available on this site.
// Otherwise add widgets to inactive, and say so.
if ( isset( $wp_registered_sidebars[ $sidebar_id ] ) ) {
$sidebar_available = true;
$use_sidebar_id = $sidebar_id;
$sidebar_message_type = 'success';
$sidebar_message = '';
} else {
$sidebar_available = false;
$use_sidebar_id = 'wp_inactive_widgets'; // add to inactive if sidebar does not exist in theme.
$sidebar_message_type = 'error';
$sidebar_message = esc_html__( 'Widget area does not exist in theme (using Inactive)', 'astra-sites' );
}
// Result for sidebar.
$results[ $sidebar_id ]['name'] = ! empty( $wp_registered_sidebars[ $sidebar_id ]['name'] ) ? $wp_registered_sidebars[ $sidebar_id ]['name'] : $sidebar_id; // sidebar name if theme supports it; otherwise ID.
$results[ $sidebar_id ]['message_type'] = $sidebar_message_type;
$results[ $sidebar_id ]['message'] = $sidebar_message;
$results[ $sidebar_id ]['widgets'] = array();
// Loop widgets.
foreach ( $widgets as $widget_instance_id => $widget ) {
$fail = false;
// Get id_base (remove -# from end) and instance ID number.
$id_base = preg_replace( '/-[0-9]+$/', '', $widget_instance_id );
$instance_id_number = str_replace( $id_base . '-', '', $widget_instance_id );
// Does site support this widget?
if ( ! $fail && ! isset( $available_widgets[ $id_base ] ) ) {
$fail = true;
$widget_message_type = 'error';
$widget_message = esc_html__( 'Site does not support widget', 'astra-sites' ); // explain why widget not imported.
}
// Filter to modify settings object before conversion to array and import.
// Leave this filter here for backwards compatibility with manipulating objects (before conversion to array below).
// Ideally the newer wie_widget_settings_array below will be used instead of this.
$widget = apply_filters( 'wie_widget_settings', $widget ); // object.
// Convert multidimensional objects to multidimensional arrays
// Some plugins like Jetpack Widget Visibility store settings as multidimensional arrays
// Without this, they are imported as objects and cause fatal error on Widgets page
// If this creates problems for plugins that do actually intend settings in objects then may need to consider other approach: https://wordpress.org/support/topic/problem-with-array-of-arrays
// It is probably much more likely that arrays are used than objects, however.
$widget = json_decode( wp_json_encode( $widget ), true );
// Filter to modify settings array
// This is preferred over the older wie_widget_settings filter above.
// Do before identical check because changes may make it identical to end result (such as URL replacements).
$widget = apply_filters( 'wie_widget_settings_array', $widget );
// Does widget with identical settings already exist in same sidebar?
if ( ! $fail && isset( $widget_instances[ $id_base ] ) ) {
// Get existing widgets in this sidebar.
$sidebars_widgets = get_option( 'sidebars_widgets' );
$sidebar_widgets = isset( $sidebars_widgets[ $use_sidebar_id ] ) ? $sidebars_widgets[ $use_sidebar_id ] : array(); // check Inactive if that's where will go.
// Loop widgets with ID base.
$single_widget_instances = ! empty( $widget_instances[ $id_base ] ) ? $widget_instances[ $id_base ] : array();
foreach ( $single_widget_instances as $check_id => $check_widget ) {
// Is widget in same sidebar and has identical settings?
if ( in_array( "$id_base-$check_id", $sidebar_widgets, true ) && (array) $widget === $check_widget ) {
$fail = true;
$widget_message_type = 'warning';
$widget_message = esc_html__( 'Widget already exists', 'astra-sites' ); // explain why widget not imported.
break;
}
}
}
// No failure.
if ( ! $fail ) {
// Add widget instance.
$single_widget_instances = get_option( 'widget_' . $id_base ); // all instances for that widget ID base, get fresh every time.
$single_widget_instances = ! empty( $single_widget_instances ) ? $single_widget_instances : array(
'_multiwidget' => 1,
); // start fresh if have to.
$single_widget_instances[] = $widget; // add it.
// Get the key it was given.
end( $single_widget_instances );
$new_instance_id_number = key( $single_widget_instances );
// If key is 0, make it 1.
// When 0, an issue can occur where adding a widget causes data from other widget to load, and the widget doesn't stick (reload wipes it).
if ( '0' === strval( $new_instance_id_number ) ) {
$new_instance_id_number = 1;
$single_widget_instances[ $new_instance_id_number ] = $single_widget_instances[0];
unset( $single_widget_instances[0] );
}
// Move _multiwidget to end of array for uniformity.
if ( isset( $single_widget_instances['_multiwidget'] ) ) {
$multiwidget = $single_widget_instances['_multiwidget'];
unset( $single_widget_instances['_multiwidget'] );
$single_widget_instances['_multiwidget'] = $multiwidget;
}
// Update option with new widget.
$result = update_option( 'widget_' . $id_base, $single_widget_instances );
// Assign widget instance to sidebar.
$sidebars_widgets = get_option( 'sidebars_widgets' ); // which sidebars have which widgets, get fresh every time.
// Avoid rarely fatal error when the option is an empty string.
// https://github.com/churchthemes/widget-importer-exporter/pull/11.
if ( ! $sidebars_widgets ) {
$sidebars_widgets = array();
}
$new_instance_id = $id_base . '-' . $new_instance_id_number; // use ID number from new widget instance.
$sidebars_widgets[ $use_sidebar_id ][] = $new_instance_id; // add new instance to sidebar.
update_option( 'sidebars_widgets', $sidebars_widgets ); // save the amended data.
// After widget import action.
$after_widget_import = array(
'sidebar' => $use_sidebar_id,
'sidebar_old' => $sidebar_id,
'widget' => $widget,
'widget_type' => $id_base,
'widget_id' => $new_instance_id,
'widget_id_old' => $widget_instance_id,
'widget_id_num' => $new_instance_id_number,
'widget_id_num_old' => $instance_id_number,
);
do_action( 'wie_after_widget_import', $after_widget_import );
// Success message.
if ( $sidebar_available ) {
$widget_message_type = 'success';
$widget_message = esc_html__( 'Imported', 'astra-sites' );
} else {
$widget_message_type = 'warning';
$widget_message = esc_html__( 'Imported to Inactive', 'astra-sites' );
}
}
// Result for widget instance.
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['name'] = isset( $available_widgets[ $id_base ]['name'] ) ? $available_widgets[ $id_base ]['name'] : $id_base; // widget name or ID if name not available (not supported by site).
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['title'] = ! empty( $widget['title'] ) ? $widget['title'] : esc_html__( 'No Title', 'astra-sites' ); // show "No Title" if widget instance is untitled.
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message_type'] = $widget_message_type;
$results[ $sidebar_id ]['widgets'][ $widget_instance_id ]['message'] = $widget_message;
}
}
// Hook after import.
do_action( 'wie_after_import' );
// Return results.
return apply_filters( 'wie_import_results', $results );
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* Shortcode Markup
*
* TMPL - Single Demo Preview
* TMPL - No more demos
* TMPL - Filters
* TMPL - List
*
* @package Astra Sites
* @since 2.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<script type="text/template" id="tmpl-ast-image-skeleton">
<div class="ast-image__skeleton-wrap">
<div class="ast-image__skeleton-inner-wrap">
<div class="ast-image__skeleton">
</div>
<div class="ast-image__preview-skeleton">
</div>
</div>
</div>
<div class="ast-image__loader-wrap">
<div class="ast-image__loader-1"></div>
<div class="ast-image__loader-2"></div>
<div class="ast-image__loader-3"></div>
</div>
</script>
<script type="text/template" id="tmpl-ast-image-list">
<# var count = 0; #>
<# for ( key in data ) { count++; #>
<# var is_imported = _.includes( astraImages.saved_images, data[key]['id'] ); #>
<# var imported_class = ( is_imported ) ? 'imported' : ''; #>
<div class="ast-image__list-wrap loading" data-id="{{data[key]['id']}}" data-url="{{data[key]['pageURL']}}">
<div class="ast-image__list-inner-wrap {{imported_class}}">
<div class="ast-image__list-img-wrap">
<img src="{{data[key]['webformatURL']}}" alt="{{data[key]['tags']}}" />
<div class="ast-image__list-img-overlay" data-img-url={{data[key]['largeImageURL']}} data-img-id={{data[key]['id']}}>
<span>{{data[key]['tags']}}</span>
<# if ( '' === imported_class ) { #>
<span class="ast-image__download-icon dashicons-arrow-down-alt dashicons" data-import-status={{is_imported}}></span>
<# } #>
</div>
</div>
</div>
</div>
<# } #>
<# if ( 0 === count ) { #>
<div class="astra-sites-no-sites">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
</div>
<# } #>
</script>
<script type="text/template" id="tmpl-ast-image-filters">
<div class="ast-image__filter-wrap">
<ul class="ast-image__filter">
<li class="ast-image__filter-category">
<select>
<# for ( key in astraImages.pixabay_category ) { #>
<option value="{{key}}">{{astraImages.pixabay_category[key]}}</option>
<# } #>
</select>
</li>
<li class="ast-image__filter-orientation">
<select>
<# for ( key in astraImages.pixabay_orientation ) { #>
<option value="{{key}}">{{astraImages.pixabay_orientation[key]}}</option>
<# } #>
</select>
</li>
<li class="ast-image__filter-order">
<select>
<# for ( key in astraImages.pixabay_order ) { #>
<option value="{{key}}">{{astraImages.pixabay_order[key]}}</option>
<# } #>
</select>
</li>
<li class="ast-image__filter-safesearch">
<label><input type="checkbox" checked value="1" /><?php esc_html_e( 'SafeSearch', 'astra-sites' ); ?></label>
</li>
</ul>
</div>
<div class="ast-powered-by-pixabay-wrap"><span><?php esc_html_e( 'Powered by', 'astra-sites' ); ?></span><img src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/pixabay-logo.png' ); ?>">
</div>
</script>
<script type="text/template" id="tmpl-ast-image-no-result">
<div class="astra-sites-no-sites">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
<p class="description">
<?php
/* translators: %1$s External Link */
printf( esc_html__( 'Don\'t see a template you would like to import?<br><a target="_blank" href="%1$s">Make a Template Suggestion!</a>', 'astra-sites' ), esc_url( 'https://wpastra.com/sites-suggestions/?utm_source=demo-import-panel&utm_campaign=astra-sites&utm_medium=suggestions' ) );
?>
</p>
</div>
</script>
<script type="text/template" id="tmpl-ast-image-single">
<# var is_imported = _.includes( astraImages.saved_images, data.id.toString() ); #>
<# var disable_class = ( is_imported ) ? 'disabled': ''; #>
<# var image_type = data.largeImageURL.substring( data.largeImageURL.lastIndexOf( "." ) + 1 ); #>
<div class="single-site-wrap">
<div class="single-site">
<div class="single-site-preview-wrap">
<div class="single-site-preview">
<img class="theme-screenshot" src="{{data.largeImageURL}}">
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="tmpl-ast-image-go-back">
<div class="ast-image__go-back">
<i class="ast-icon-chevron-left"></i>
<span class="ast-image__go-back-text"><?php esc_html_e( 'Back to Images', 'astra-sites' ); ?></span>
</div>
</script>
<script type="text/template" id="tmpl-ast-image-save">
<# var is_imported = _.includes( astraImages.saved_images, data.id.toString() ); #>
<# var disable_class = ( is_imported ) ? 'disabled': ''; #>
<div class="ast-image__save-wrap">
<button type="button" class="ast-image__save button media-button button-primary button-large media-button-select {{disable_class}}" data-import-status={{is_imported}}>
<# if ( is_imported ) { #>
<?php esc_html_e( 'Already Saved', 'astra-sites' ); ?>
<# } else { #>
<?php esc_html_e( 'Save & Insert', 'astra-sites' ); ?>
<# } #>
</button>
</div>
</script>
<?php

View File

@@ -0,0 +1,573 @@
<?php
/**
* Shortcode Markup
*
* TMPL - Single Demo Preview
* TMPL - No more demos
* TMPL - Filters
* TMPL - List
*
* @package Astra Sites
* @since 1.0.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
$suggestion_link = astra_sites_get_suggestion_link();
?>
<script type="text/template" id="tmpl-ast-template-base-skeleton">
<div class="dialog-widget dialog-lightbox-widget dialog-type-buttons dialog-type-lightbox" id="ast-sites-modal">
<div class="dialog-widget-content dialog-lightbox-widget-content">
<div class="astra-sites-content-wrap" data-page="1">
<div class="ast-template-library-toolbar">
<div class="elementor-template-library-filter-toolbar">
<div class="elementor-template-library-order">
<select class="elementor-template-library-order-input elementor-template-library-filter-select elementor-select2">
<option value=""><?php esc_html_e( 'All', 'astra-sites' ); ?></option>
<option value="free"><?php esc_html_e( 'Free', 'astra-sites' ); ?></option>
<option value="agency"><?php esc_html_e( 'Premium', 'astra-sites' ); ?></option>
</select>
</div>
<div class="astra-blocks-category-inner-wrap">
<select id="elementor-template-library-filter" class="astra-blocks-category elementor-template-library-filter-select elementor-select2">
<option value=""><?php esc_html_e( 'All', 'astra-sites' ); ?></option>
<# for ( key in astraElementorSites.astra_block_categories ) { #>
<option value="{{astraElementorSites.astra_block_categories[key].id}}">{{astraElementorSites.astra_block_categories[key].name}}</option>
<# } #>
</select>
</div>
<div class="astra-blocks-filter-inner-wrap" id="elementor-template-block-color-filter" style="display: none;"></div>
</div>
<div class="ast-sites-template-library-filter-text-wrapper">
<label for="elementor-template-library-filter-text" class="elementor-screen-only"><?php esc_html_e( 'Search...', 'astra-sites' ); ?></label>
<input id="wp-filter-search-input" placeholder="<?php esc_attr_e( 'SEARCH', 'astra-sites' ); ?>" class="">
<i class="eicon-search"></i>
</div>
</div>
<?php
// Check flexbox container, If inactive then activate it.
$flexbox_container = get_option( 'elementor_experiment-container' );
// Check if the value is 'inactive'.
if ( 'inactive' === $flexbox_container ) {
?>
<div class="ast-sites-container-notice-wrap">
<div class="ast-sites-container-notice-content">
<p><?php esc_html_e( "We've observed that the 'Flexbox Container' setting in your Elementor configuration is currently inactive. To ensure a seamless import, please active this option.", 'astra-sites' ); ?></p>
<div class="ast-sites-container-notice-actions">
<a href="<?php echo esc_url( home_url( '/wp-admin/admin.php?page=elementor#tab-experiments' ) ); ?>" class="ast-sites-container-notice-button" >
<span><?php esc_html_e( 'Activate it!', 'astra-sites' ); ?></span>
</a>
</div>
</div>
</div>
<?php
}
?>
<div id="ast-sites-floating-notice-wrap-id" class="ast-sites-floating-notice-wrap"><div class="ast-sites-floating-notice"></div></div>
<?php
$manual_sync = get_site_option( 'astra-sites-manual-sync-complete', 'no' );
if ( 'yes' === $manual_sync ) {
$batch_status = get_site_option( 'astra-sites-batch-is-complete', 'no' );
if ( 'yes' === $batch_status ) {
?>
<div class="ast-sites-floating-notice-wrap refreshed-notice slide-in">
<div class="ast-sites-floating-notice">
<div class="astra-sites-sync-library-message success astra-sites-notice notice notice-success is-dismissible">
<?php Astra_Sites::get_instance()->get_sync_complete_message( true ); ?> <button type="button" class="notice-dismiss"><span class="screen-reader-text"><?php esc_html_e( 'Dismiss', 'astra-sites' ); ?></span></button>
</div>
</div>
</div>
<?php
}
}
?>
<div class="dialog-message dialog-lightbox-message" data-type="pages">
<div class="dialog-content dialog-lightbox-content theme-browser"></div>
<div class="theme-preview"></div>
</div>
<div class="dialog-message dialog-lightbox-message-block" data-type="blocks">
<div class="dialog-content dialog-lightbox-content-block theme-browser" data-block-page="1"></div>
<div class="theme-preview-block"></div>
</div>
<div class="astra-loading-wrap"><div class="astra-loading-icon"></div></div>
</div>
<div class="dialog-buttons-wrapper dialog-lightbox-buttons-wrapper"></div>
</div>
<div class="dialog-background-lightbox"></div>
</div>
</script>
<script type="text/template" id="tmpl-ast-template-block-color-filters">
<select class="astra-blocks-filter elementor-template-library-filter-select elementor-select2">
<option value=""><?php esc_html_e( 'Filter by Color', 'astra-sites' ); ?></option>
<# for ( key in data ) { #>
<option value="{{data[key]}}">{{data[key]}}</option>
<# } #>
</select>
</script>
<script type="text/template" id="tmpl-ast-template-modal__header-back">
<div class="dialog-lightbox-back"><span class="dialog-lightbox-back-text"><?php esc_html_e( 'Back to Pages', 'astra-sites' ); ?></span></div>
</script>
<script type="text/template" id="tmpl-ast-template-modal__header">
<div class="dialog-header dialog-lightbox-header">
<div class="ast-sites-modal__header">
<div class="ast-sites-modal__header__logo-area">
<?php
if ( ! Astra_Sites_White_Label::get_instance()->is_white_labeled() ) {
?>
<div class="ast-sites-modal__header__logo">
<span class="ast-sites-modal__header__logo__icon-wrapper"></span>
</div>
<?php
} else {
?>
<div class="ast-sites-modal__header__logo">
<span class="ast-sites-modal__header__logo__text-wrapper"><?php echo esc_html( Astra_Sites_White_Label::get_instance()->get_white_label_name() ); ?></span>
</div>
<?php
}
?>
<div class="back-to-layout" title="<?php esc_attr_e( 'Back to Layout', 'astra-sites' ); ?>" data-step="1"><i class="ast-icon-chevron-left"></i></div>
</div>
<div class="elementor-templates-modal__header__menu-area astra-sites-step-1-wrap ast-sites-modal__options">
<div class="elementor-template-library-header-menu">
<div class="elementor-template-library-menu-item elementor-active" data-template-source="remote" data-template-type="pages"><span class="ast-icon-file"></span><?php esc_html_e( 'Pages', 'astra-sites' ); ?></div>
<div class="elementor-template-library-menu-item" data-template-source="remote" data-template-type="blocks"><span class="ast-icon-layers"></span><?php esc_html_e( 'Blocks', 'astra-sites' ); ?></div>
</div>
</div>
<div class="elementor-templates-modal__header__items-area">
<div class="ast-sites-modal__header__close ast-sites-modal__header__close--normal ast-sites-modal__header__item">
<i class="dashicons close dashicons-no-alt" aria-hidden="true" title="<?php esc_attr_e( 'Close', 'astra-sites' ); ?>"></i>
<span class="elementor-screen-only"><?php esc_html_e( 'Close', 'astra-sites' ); ?></span>
</div>
<div class="astra-sites__sync-wrap">
<div class="astra-sites-sync-library-button">
<span class="ast-icon-refresh" aria-hidden="true" title="<?php esc_attr_e( 'Sync Library', 'astra-sites' ); ?>"></span>
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="tmpl-astra-sites-list">
<#
var count = 0;
for ( key in data ) {
var page_data = data[ key ][ 'pages' ];
var site_type = data[ key ][ 'astra-sites-type' ] || '';
if ( 0 == Object.keys( page_data ).length ) {
continue;
}
if ( undefined == site_type ) {
continue;
}
if ( '' !== AstraElementorSitesAdmin.siteType ) {
if ( 'free' == AstraElementorSitesAdmin.siteType && site_type != 'free' ) {
continue;
}
if ( 'free' != AstraElementorSitesAdmin.siteType && site_type == 'free' ) {
continue;
}
}
var type_class = ' site-type-' + data[ key ]['astra-sites-type'];
var site_title = data[ key ]['title'].slice( 0, 25 );
if ( data[ key ]['title'].length > 25 ) {
site_title += '...';
}
count++;
#>
<div class="theme astra-theme site-single publish page-builder-elementor {{type_class}}" data-site-id={{key}} data-template-id="">
<div class="inner">
<span class="site-preview" data-href="" data-title={{site_title}}>
<div class="theme-screenshot one loading" data-step="1" data-src={{data[ key ]['thumbnail-image-url']}} data-featured-src={{data[ key ]['featured-image-url']}}>
<div class="elementor-template-library-template-preview">
<i class="eicon-zoom-in" aria-hidden="true"></i>
</div>
</div>
</span>
<div class="theme-id-container">
<h3 class="theme-name">{{site_title}}</h3>
</div>
<# if ( site_type && 'free' !== site_type ) { #>
<?php /* translators: %1$s are white label strings. */ ?>
<div class="agency-ribbons" title="<?php printf( esc_attr__( 'This premium template is accessible with %1$s "Premium" Package.', 'astra-sites' ), esc_html( Astra_Sites_White_Label::get_instance()->get_white_label_name() ) ); ?>"><img class="premium-crown-icon" src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/premium-crown.svg' ); ?>" alt="premium-crown"><?php esc_html_e( 'Premium', 'astra-sites' ); ?></div>
<# } #>
</div>
</div>
<#
}
#>
</script>
<script type="text/template" id="tmpl-astra-blocks-list">
<#
var count = 0;
let upper_window = ( AstraElementorSitesAdmin.per_page * ( AstraElementorSitesAdmin.page - 1 ) );
let lower_window = ( upper_window + AstraElementorSitesAdmin.per_page );
for ( key in data ) {
var site_title = ( undefined == data[ key ]['category'] || 0 == data[ key ]['category'].length ) ? data[ key ]['title'] : astraElementorSites.astra_block_categories[data[ key ]['category']].name;
if ( '' !== AstraElementorSitesAdmin.blockCategory ) {
if ( AstraElementorSitesAdmin.blockCategory != data[ key ]['category'] ) {
continue;
}
}
if ( '' !== AstraElementorSitesAdmin.blockColor ) {
if ( undefined !== data[ key ]['filter'] && AstraElementorSitesAdmin.blockColor != data[ key ]['filter'] ) {
continue;
}
}
count++;
#>
<div class="astra-sites-library-template astra-theme" data-block-id={{key}}>
<div class="astra-sites-library-template-inner" >
<div class="elementor-template-library-template-body theme-screenshot" data-step="1">
<img src="{{data[ key ]['thumbnail-image-url']}}">
<div class="elementor-template-library-template-preview">
<i class="eicon-zoom-in" aria-hidden="true"></i>
</div>
</div>
<div class="elementor-template-library-template-footer">
<a class="elementor-template-library-template-action elementor-template-library-template-insert ast-block-insert">
<i class="eicon-file-download" aria-hidden="true"></i>
<span class="elementor-button-title"><?php esc_html_e( 'INSERT', 'astra-sites' ); ?></span>
</a>
</div>
</div>
</div>
<#
}
if ( count == 0 ) {
#>
<div class="astra-sites-no-sites">
<div class="inner">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
<div class="content" style="text-align: center">
<div class="description">
<p>
<?php
/* translators: %1$s External Link */
printf( esc_html__( "Don't see a template you would like to import? %s", 'astra-sites' ), nl2br( '<br><a target="_blank" href="' . esc_url( $suggestion_link ) . '">Make a Template Suggestion!</a>' ) );
?>
</p>
<div class="back-to-layout-button"><span class="button astra-sites-back"><?php esc_html_e( 'Back to Templates', 'astra-sites' ); ?></span></div>
</div>
</div>
</div>
</div>
<#
}
#>
</script>
<script type="text/template" id="tmpl-astra-sites-list-search">
<#
var count = 0;
for ( ind in data ) {
var site_type = data[ ind ]['site-pages-type'];
var type_class = ' site-type-' + site_type;
var site_id = ( undefined == data.site_id ) ? data[ind].site_id : data.site_id;
if ( undefined == site_type ) {
continue;
}
if ( 'gutenberg' == data[ind]['site-pages-page-builder'] ) {
continue;
}
var site_title = data[ ind ]['title'].slice( 0, 25 );
if ( data[ ind ]['title'].length > 25 ) {
site_title += '...';
}
count++;
#>
<div class="theme astra-theme site-single publish page-builder-elementor {{type_class}}" data-template-id={{ind}} data-site-id={{site_id}}>
<div class="inner">
<span class="site-preview" data-href="" data-title={{site_title}}>
<div class="theme-screenshot one loading" data-step="2" data-src={{data[ ind ]['thumbnail-image-url']}} data-featured-src={{data[ ind ]['featured-image-url']}}>
<div class="elementor-template-library-template-preview">
<i class="eicon-zoom-in" aria-hidden="true"></i>
</div>
</div>
</span>
<div class="theme-id-container">
<h3 class="theme-name">{{site_title}}</h3>
<#
var is_free = true;
if ( 'pages' == AstraElementorSitesAdmin.type ) {
if( 'free' !== data[ ind ]['site-pages-type'] && ! astraElementorSites.license_status ) {
is_free = false;
}
}
if( is_free ) { #>
<a class="elementor-template-library-template-action elementor-template-library-template-insert ast-block-insert">
<i class="eicon-file-download" aria-hidden="true"></i>
<span class="elementor-button-title"><?php esc_html_e( 'INSERT', 'astra-sites' ); ?></span>
</a>
<# } else { #>
<a class="elementor-template-library-template-action elementor-template-library-template-go-pro" href="{{astraElementorSites.getProURL}}" target="_blank">
<i class="eicon-external-link-square" aria-hidden="true"></i>
<span class="elementor-button-title"><?php esc_html_e( 'Get Access!', 'astra-sites' ); ?></span>
</a>
<# } #>
</div>
<# if ( site_type && 'free' !== site_type ) { #>
<?php /* translators: %1$s are white label strings. */ ?>
<div class="agency-ribbons" title="<?php printf( esc_attr__( 'This premium template is accessible with %1$s "Premium" Package.', 'astra-sites' ), esc_html( Astra_Sites_White_Label::get_instance()->get_white_label_name() ) ); ?>"><?php esc_html_e( 'Premium', 'astra-sites' ); ?></div>
<# } #>
</div>
</div>
<#
}
if ( count == 0 ) {
#>
<div class="astra-sites-no-sites">
<div class="inner">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
<div class="content">
<div class="description">
<p>
<?php
/* translators: %1$s External Link */
printf( esc_attr__( 'Don\'t see a template you would like to import?<br><a target="_blank" href="%1$s">Make a Template Suggestion!</a>', 'astra-sites' ), esc_url( $suggestion_link ) );
?>
</p>
<div class="back-to-layout-button"><span class="button astra-sites-back"><?php esc_html_e( 'Back to Templates', 'astra-sites' ); ?></span></div>
</div>
</div>
</div>
</div>
<#
}
#>
</script>
<script type="text/template" id="tmpl-astra-sites-search">
<#
var count = 0;
for ( ind in data ) {
if ( 'gutenberg' == data[ind]['site-pages-page-builder'] ) {
continue;
}
var site_id = ( undefined == data.site_id ) ? data[ind].site_id : data.site_id;
var site_type = data[ ind ]['site-pages-type'];
if ( 'site' == data[ind]['type'] ) {
site_type = data[ ind ]['astra-sites-type'];
}
if ( undefined == site_type ) {
continue;
}
var parent_name = '';
if ( undefined != data[ind]['parent-site-name'] ) {
var parent_name = jQuery( "<textarea/>") .html( data[ind]['parent-site-name'] ).text();
}
var complete_title = parent_name + ' - ' + data[ ind ]['title'];
var site_title = complete_title.slice( 0, 25 );
if ( complete_title.length > 25 ) {
site_title += '...';
}
var tmp = site_title.split(' - ');
var title1 = site_title;
var title2 = '';
if ( undefined !== tmp && undefined !== tmp[1] ) {
title1 = tmp[0];
title2 = ' - ' + tmp[1];
} else {
title1 = tmp[0];
title2 = '';
}
var type_class = ' site-type-' + site_type;
count++;
#>
<div class="theme astra-theme site-single publish page-builder-elementor {{type_class}}" data-template-id={{ind}} data-site-id={{site_id}}>
<div class="inner">
<span class="site-preview" data-href="" data-title={{title2}}>
<div class="theme-screenshot one loading" data-type={{data[ind]['type']}} data-step={{data[ind]['step']}} data-show="search" data-src={{data[ ind ]['thumbnail-image-url']}} data-featured-src={{data[ ind ]['featured-image-url']}}></div>
</span>
<div class="theme-id-container">
<h3 class="theme-name"><strong>{{title1}}</strong>{{title2}}</h3>
</div>
<# if ( site_type && 'free' !== site_type ) { #>
<div class="agency-ribbons" title="
<?php
/* translators: %1$s are white label strings. */
printf( esc_attr__( 'This premium template is accessible with %1$s "Premium" Package.', 'astra-sites' ), esc_html( Astra_Sites_White_Label::get_instance()->get_white_label_name() ) );
?>
"
>
<?php esc_html_e( 'Premium', 'astra-sites' ); ?>
</div>
<# } #>
</div>
</div>
<#
}
if ( count == 0 ) {
#>
<div class="astra-sites-no-sites">
<div class="inner">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
<div class="content" style="text-align: center">
<div class="description">
<p>
<?php
/* translators: %1$s External Link */
printf( esc_html__( "Don't see a template you would like to import? %s", 'astra-sites' ), nl2br( '<br><a target="_blank" href="' . esc_url( $suggestion_link ) . '">Make a Template Suggestion!</a>' ) );
?>
</p>
<div class="back-to-layout-button"><span class="button astra-sites-back"><?php esc_html_e( 'Back to Templates', 'astra-sites' ); ?></span></div>
</div>
</div>
</div>
</div>
<#
}
#>
</script>
<script type="text/template" id="tmpl-astra-sites-insert-button">
<div id="elementor-template-library-header-preview-insert-wrapper" class="elementor-templates-modal__header__item" data-template-id={{data.template_id}} data-site-id={{data.site_id}}>
<a class="elementor-template-library-template-action elementor-template-library-template-insert elementor-button">
<i class="eicon-file-download" aria-hidden="true"></i>
<span class="elementor-button-title"><?php esc_html_e( 'Insert', 'astra-sites' ); ?></span>
</a>
</div>
</script>
<?php
/**
* TMPL - Third Party Required Plugins
*/
?>
<script type="text/template" id="tmpl-astra-sites-third-party-required-plugins">
<div class="skip-and-import">
<div class="heading">
<h3><?php esc_html_e( 'Required Plugins Missing', 'astra-sites' ); ?></h3>
<span class="dashicons close dashicons-no-alt"></span>
</div>
<div class="astra-sites-import-content">
<p><?php esc_html_e( 'This starter site requires premium plugins. As these are third party premium plugins, you\'ll need to purchase, install and activate them first.', 'astra-sites' ); ?></p>
<ul class="astra-sites-third-party-required-plugins">
<# for ( key in data ) { #>
<li class="plugin-card plugin-card-{{data[ key ].slug}}'" data-slug="{{data[ key ].slug }}" data-init="{{data[ key ].init}}" data-name="{{data[ key ].name}}"><a href="{{data[ key ].link}}" target="_blank">{{data[ key ].name}}</a></li>
<# } #>
</ul>
</div>
<div class="ast-actioms-wrap">
<a href="#" class="button button-hero button-primary astra-sites-skip-and-import-step"><?php esc_html_e( 'Skip & Import', 'astra-sites' ); ?></a>
<div class="button button-hero site-import-cancel"><?php esc_html_e( 'Cancel', 'astra-sites' ); ?></div>
</div>
</div>
</script>
<script type="text/template" id="tmpl-astra-sites-no-sites">
<div class="astra-sites-no-sites">
<div class="inner">
<h3><?php esc_html_e( 'Sorry No Results Found.', 'astra-sites' ); ?></h3>
<div class="content">
<div class="empty-item">
<img class="empty-collection-part" src="<?php echo esc_url( ASTRA_SITES_URI . 'inc/assets/images/empty-collection.svg' ); ?>" alt="empty-collection">
</div>
<div class="description">
<p>
<?php
/* translators: %1$s External Link */
printf( esc_html__( 'Don\'t see a template you would like to import?<br><a target="_blank" href="%1$s">Make a Template Suggestion!</a>', 'astra-sites' ), esc_url( $suggestion_link ) );
?>
</p>
<div class="back-to-layout-button"><span class="button astra-sites-back"><?php esc_html_e( 'Back to Templates', 'astra-sites' ); ?></span></div>
</div>
</div>
</div>
</div>
<#
</script>
<script type="text/template" id="tmpl-astra-sites-elementor-preview">
<#
let wrap_height = $elscope.find( '.astra-sites-content-wrap' ).height();
wrap_height = ( wrap_height - 55 );
wrap_height = wrap_height + 'px';
#>
<div id="astra-blocks" class="themes wp-clearfix" data-site-id="{{data.id}}" style="display: block;">
<div class="single-site-wrap">
<div class="single-site">
<div class="single-site-preview-wrap">
<div class="single-site-preview" style="max-height: {{wrap_height}};">
<img class="theme-screenshot" data-src="" src="{{data['featured-image-url']}}">
</div>
</div>
</div>
</div>
</div>
</script>
<script type="text/template" id="tmpl-astra-sites-elementor-preview-actions">
<#
var demo_link = '';
var action_str = '';
if ( 'blocks' == AstraElementorSitesAdmin.type ) {
demo_link = astraElementorSites.astra_blocks[AstraElementorSitesAdmin.block_id]['url'];
action_str = 'Block';
} else {
demo_link = data['astra-page-url'];
action_str = 'Template';
}
#>
<div class="astra-preview-actions-wrap">
<div class="astra-preview-actions-inner-wrap">
<div class="astra-preview-actions">
<div class="site-action-buttons-wrap">
<div class="astra-sites-import-template-action site-action-buttons-right">
<div class="astra-sites-tooltip"><span class="astra-sites-tooltip-icon" data-tip-id="astra-sites-tooltip-plugins-settings"><span class="dashicons dashicons-editor-help"></span></span></div>
<#
var is_free = true;
if ( 'pages' == AstraElementorSitesAdmin.type ) {
if( 'free' !== data['site-pages-type'] && ! astraElementorSites.license_status ) {
is_free = false;
}
}
if( ! is_free ) { #>
<a class="button button-hero button-primary" href="{{astraElementorSites.getProURL}}" target="_blank">{{astraElementorSites.getProText}}<i class="dashicons dashicons-external"></i></a>
<# } else { #>
<div type="button" class="button button-hero button-primary ast-library-template-insert disabled"><?php esc_html_e( 'Import ', 'astra-sites' ); ?>{{action_str}}</div>
<div type="button" class="button button-hero button-primary ast-import-elementor-template disabled"><?php esc_html_e( 'Save ', 'astra-sites' ); ?>{{action_str}}</div>
<# } #>
</div>
</div>
</div>
<div class="ast-tooltip-wrap">
<div>
<div class="ast-tooltip-inner-wrap" id="astra-sites-tooltip-plugins-settings">
<ul class="required-plugins-list"><span class="spinner is-active"></span></ul>
</div>
</div>
</div>
</div>
</div>
</script>
<?php

View File

@@ -0,0 +1,42 @@
<?php
/**
* White Label Form
*
* @package Astra Sites
*/
?>
<?php
// Bail from displaying settings screen if Astra Pro is older version.
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::branding_key_to_constant' ) ) {
return;
}
?>
<li>
<div class="branding-form postbox">
<button type="button" class="handlediv button-link" aria-expanded="true">
<span class="screen-reader-text"><?php echo esc_html( $plugin_name ); ?></span>
<span class="toggle-indicator" aria-hidden="true"></span>
</button>
<h2 class="hndle ui-sortable-handle">
<span><?php echo esc_html( $plugin_name ); ?></span>
</h2>
<div class="inside">
<div class="form-wrap">
<div class="form-field">
<label><?php esc_html_e( 'Plugin Name:', 'astra-sites' ); ?>
<input type="text" name="ast_white_label[astra-sites][name]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'astra-sites', 'name' ) ), true, true ); ?> value="<?php echo esc_attr( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'name' ) ); ?>">
</label>
</div>
<div class="form-field">
<label><?php esc_html_e( 'Plugin Description:', 'astra-sites' ); ?>
<textarea name="ast_white_label[astra-sites][description]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'astra-sites', 'description' ) ), true, true ); ?> rows="2"><?php echo esc_html( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' ) ); ?></textarea>
</label>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</li>

View File

@@ -0,0 +1,528 @@
<?php
/**
* Plugin Loader.
*
* @package {{package}}
* @since 1.0.0
*/
namespace AiBuilder;
use AiBuilder\Inc\Api\ApiInit;
use AiBuilder\Inc\Ajax\AjaxInit;
use AiBuilder\Inc\Classes\Zipwp\Ai_Builder_ZipWP_Api;
use AiBuilder\Inc\Traits\Helper;
use AiBuilder\Inc\Classes\Zipwp\Ai_Builder_ZipWP_Integration;
use STImporter\Importer\ST_Importer_Helper;
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Ai_Builder_Plugin_Loader
*
* @since 1.0.0
*/
class Ai_Builder_Plugin_Loader {
/**
* Instance
*
* @access private
* @var object Class Instance.
* @since 1.0.0
*/
private static $instance = null;
/**
* List of hosting providers.
*
* @access private
* @var array<int, string>
* @since 1.0.0
*/
private $hosting_providers = array(
'unaux',
'epizy',
'ezyro',
);
/**
* Initiator
*
* @since 1.0.0
* @return object initialized object of class.
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Autoload classes.
*
* @param string $class class name.
*
* @return void
*/
public function autoload( $class ) {
if ( 0 !== strpos( $class, __NAMESPACE__ ) ) {
return;
}
$class_to_load = $class;
$filename = strtolower(
(string) preg_replace(
[ '/^' . __NAMESPACE__ . '\\\/', '/([a-z])([A-Z])/', '/_/', '/\\\/' ],
[ '', '$1-$2', '-', DIRECTORY_SEPARATOR ],
$class_to_load
)
);
$file = AI_BUILDER_DIR . $filename . '.php';
// if the file redable, include it.
if ( is_readable( $file ) ) {
require_once $file;
}
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
spl_autoload_register( [ $this, 'autoload' ] );
add_action( 'plugins_loaded', array( $this, 'load_plugin' ), 99 );
/*
// add_action( 'plugins_loaded', [ $this, 'load_textdomain' ] );
*/
add_action( 'admin_menu', [ $this, 'add_theme_page' ] );
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_scripts' ] );
add_filter( 'admin_body_class', [ $this, 'admin_body_class' ] );
$this->define_constants();
$this->setup_classes();
}
/**
* Load plugin files.
*
* @since 1.0.0
*
* @return void
*/
public function load_plugin() {
require_once AI_BUILDER_DIR . 'inc/classes/ai-builder-loader.php';
require_once AI_BUILDER_DIR . 'inc/compatibility/ai-builder-compatibility.php';
}
/**
* Include required constants.
*
* @return void
*/
public function define_constants() {
if ( ! defined( 'ZIPWP_APP' ) ) {
define( 'ZIPWP_APP', apply_filters( 'ai_builder_zip_app_url', 'https://app.zipwp.com/auth' ) );
}
if ( ! defined( 'ZIPWP_API' ) ) {
define( 'ZIPWP_API', apply_filters( 'ai_builder_templates_zip_api_url', 'https://api.zipwp.com/api' ) );
}
}
/**
* Include required classes.
*
* @return void
*/
public function setup_classes() {
/* Init API */
ApiInit::Instance();
if ( is_admin() ) {
/* Ajax init */
AjaxInit::Instance();
}
}
/**
* Load Plugin Text Domain.
* This will load the translation textdomain depending on the file priorities.
* 1. Global Languages /wp-content/languages/ai-builder/ folder
* 2. Local dorectory /wp-content/plugins/ai-builder/languages/ folder
*
* @since 1.0.0
* @return void
*/
public function load_textdomain() {
// Default languages directory.
$lang_dir = AI_BUILDER_DIR . 'languages/';
/**
* Filters the languages directory path to use for plugin.
*
* @param string $lang_dir The languages directory path.
*/
$lang_dir = apply_filters( 'ai_builder_languages_directory', $lang_dir );
// Traditional WordPress plugin locale filter.
global $wp_version;
$get_locale = get_locale();
if ( $wp_version >= 4.7 ) {
$get_locale = get_user_locale();
}
$locale = apply_filters( 'plugin_locale', $get_locale, 'ai-builder' );
$mofile = sprintf( '%1$s-%2$s.mo', 'ai-builder', $locale );
// Setup paths to current locale file.
$mofile_global = WP_LANG_DIR . '/plugins/' . $mofile;
$mofile_local = $lang_dir . $mofile;
if ( file_exists( $mofile_global ) ) {
// Look in global /wp-content/languages/ai-builder/ folder.
load_textdomain( 'ai-builder', $mofile_global );
} elseif ( file_exists( $mofile_local ) ) {
// Look in local /wp-content/plugins/ai-builder/languages/ folder.
load_textdomain( 'ai-builder', $mofile_local );
} else {
// Load the default language files.
load_plugin_textdomain( 'ai-builder', false, $lang_dir );
}
}
/**
* Add a theme page.
*
* @since 1.0.0
*
* @return void
*/
public function add_theme_page() {
add_theme_page(
__( 'AI Builder', 'astra-sites' ),
__( 'AI Builder', 'astra-sites' ),
'manage_options',
'ai-builder',
[ $this, 'theme_page' ]
);
}
/**
* Theme page.
*
* @since 1.0.0
*
* @return void
*/
public function theme_page() {
?>
<div id="ai-builder-root" class="font-sans"></div>
<?php
}
/**
* Enqueue scripts and styles.
*
* @param string $hook hook.
* @since 1.0.0
*
* @return void
*/
public function enqueue_scripts( $hook = '' ) {
if ( 'appearance_page_ai-builder' !== $hook ) {
return;
}
remove_all_actions( 'admin_notices' );
$assets_file_path = AI_BUILDER_DIR . '/inc/assets/build/main.asset.php';
if ( ! file_exists( $assets_file_path ) ) {
return;
}
$assets = require_once AI_BUILDER_DIR . '/inc/assets/build/main.asset.php';
if ( ! isset( $assets ) ) {
return;
}
$partner_id = get_option( 'zipwp_partner_url_param', '' );
$partner_id = is_string( $partner_id ) ? sanitize_text_field( $partner_id ) : '';
$zipwp_auth = array(
'screen_url' => ZIPWP_APP,
'redirect_url' => admin_url( 'themes.php?page=ai-builder' ),
'source' => 'starter-templates',
);
if ( ! empty( $partner_id ) ) {
$zipwp_auth['partner_id'] = $partner_id;
}
wp_enqueue_media();
wp_enqueue_script(
'ai-builder',
AI_BUILDER_URL . 'inc/assets/build/main.js',
array_merge(
$assets['dependencies'],
array(
'react',
'react-dom',
'updates',
)
),
$assets['version'],
true
);
wp_enqueue_style( 'ai-builder', AI_BUILDER_URL . 'inc/assets/build/style-main.css', [], $assets['version'] );
// Required variables for JS.
wp_localize_script( 'ai-builder', 'aiBuilderVars', $this->get_localize_variable() );
wp_localize_script(
'ai-builder',
'wpApiSettings',
array(
'root' => esc_url_raw( get_rest_url() ),
'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
'zipwp_auth' => $zipwp_auth,
)
);
$text_domain = apply_filters( 'ai_builder_textdomain', 'ai-builder' );
$locale_path = apply_filters( 'ai_builder_languages_directory', '' );
wp_set_script_translations( 'ai-builder', $text_domain, $locale_path );
// Required for install theme.
wp_enqueue_script( 'ai-builder-install-theme', AI_BUILDER_URL . 'inc/assets/js/install-theme.js', array( 'jquery', 'updates' ), AI_BUILDER_VER, true );
// Google fonts.
wp_enqueue_style( 'ai-builder-google-fonts', $this->google_fonts_url(), array( 'ai-builder' ), 'all' );
}
/**
* Admin body class.
*
* @param string $classes classes.
*
* @return string
*
* @since 1.0.0
*/
public function admin_body_class( $classes ) {
$ai_builder_class_name = isset( $_GET['page'] ) && 'ai-builder' === $_GET['page'] ? 'ai-builder' : ''; //phpcs:ignore WordPress.Security.NonceVerification.Recommended
$classes .= ' ' . $ai_builder_class_name;
return $classes;
}
/**
* Generate and return the Google fonts url.
*
* @since 1.0.1
* @return string
*/
public function google_fonts_url() {
$fonts_url = '';
$font_families = array(
'Inter:400,500,600',
'Figtree:400,500,600,700',
);
$query_args = array(
'family' => rawurlencode( implode( '|', $font_families ) ),
'subset' => rawurlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, '//fonts.googleapis.com/css' );
return $fonts_url;
}
/**
* Check if we should report error or not.
* Skipping error reporting for a few hosting providers.
*
* @since 1.0.0
* @return boolean
*/
public function should_report_error() {
/**
* Byassing error reporting for a few hosting providers.
*/
foreach ( $this->hosting_providers as $provider ) {
if ( strpos( ABSPATH, $provider ) !== false ) {
return false;
}
}
return true;
}
/**
* Checks if legacy Beaver Builder support is enabled.
*
* @since 1.2.28
* @return bool Returns `true` if legacy Beaver Builder support is enabled, `false` otherwise.
*/
public static function is_legacy_beaver_builder_enabled() {
/**
* Filter to enable legacy Beaver Builder support.
*
* @param bool $enabled Default value indicating if Beaver Builder support is enabled. Default to `false`.
*
* @since 1.2.28
* @return bool Returns `true` if Beaver Builder support is enabled, `false` otherwise.
*/
return boolval( apply_filters( 'astra_sites_enable_legacy_beaver_builder_support', false ) );
}
/**
* Get localize variable.
*
* @since 1.0.0
* @return array<string, mixed>
*/
public function get_localize_variable() {
$theme_status = class_exists( 'STImporter\Importer\ST_Importer_Helper' ) ? ST_Importer_Helper::get_instance()->get_theme_status() : '';
$plans = Ai_Builder_ZipWP_Api::Instance()->get_zip_plans();
$team_name = is_array( $plans['data'] ) && isset( $plans['data']['team']['name'] ) ? $plans['data']['team']['name'] : '';
$plan_name = is_array( $plans['data'] ) && isset( $plans['data']['active_plan']['slug'] ) ? $plans['data']['active_plan']['slug'] : '';
$support_link = 'https://wpastra.com/starter-templates-support/?ip=' . $this->get_client_ip();
return array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'_ajax_nonce' => wp_create_nonce( 'astra-sites' ),
'zipwp_auth_nonce' => wp_create_nonce( 'zipwp-auth-nonce' ),
'adminUrl' => admin_url(),
'imageDir' => AI_BUILDER_URL . 'inc/assets/images/',
'supportLink' => $support_link,
'logoUrl' => apply_filters( 'ai_builder_logo', AI_BUILDER_URL . 'inc/assets/images/logo.svg' ),
'placeholder_images' => Helper::get_image_placeholders(),
'reportError' => $this->should_report_error(),
'zip_token_exists' => Helper::get_token() !== '' ? true : false,
'themeStatus' => $theme_status,
'firstImportStatus' => get_option( 'astra_sites_import_complete', false ),
'analytics' => get_site_option( 'bsf_analytics_optin', false ),
'siteUrl' => site_url(),
'installed' => __( 'Installed! Activating..', 'astra-sites' ),
'activating' => __( 'Activating...', 'astra-sites' ),
'activated' => __( 'Activated!', 'astra-sites' ),
'installing' => __( 'Installing...', 'astra-sites' ),
'logoUrlDark' => apply_filters( 'st_ai_onboarding_logo_dark', AI_BUILDER_URL . 'inc/assets/images/build-with-ai/st-logo-dark.svg' ),
'logoUrlLight' => apply_filters( 'st_ai_onboarding_logo_light', AI_BUILDER_URL . 'inc/assets/images/logo.svg' ),
'zip_plans' => ( $plans && isset( $plans['data'] ) ) ? $plans['data'] : array(),
'dashboard_url' => admin_url(),
'migrateSvg' => apply_filters( 'ai_builder_migrate_svg', AI_BUILDER_URL . 'inc/assets/images/build-with-ai/migrate.svg' ),
'business_details' => Ai_Builder_ZipWP_Integration::get_business_details(),
'skipFeatures' => 'yes' === apply_filters( 'ai_builder_skip_features', 'no' ),
'show_premium_badge' => 'yes' === apply_filters( 'ai_builder_show_premium_badge', 'yes' ),
'show_premium_templates' => 'yes' === apply_filters( 'ai_builder_show_premium_templates', 'yes' ),
'parent_plugin' => apply_filters( 'ai_builder_parent_plugin', 'wp-astra-sites' ),
'failed_sites' => $this->get_failed_sites(),
'filtered_data' => apply_filters(
'ai_builder_limit_exceeded_popup_strings',
array(
'main_content' => sprintf(
/* translators: %1$s: team name, %2$s: plan name */
__(
'Your current active organization is %1$s, which is on the %2$s plan. You have reached the maximum number of sites allowed to be created on %2$s plan.',
'astra-sites'
),
$team_name,
$plan_name
),
'secondary_content' => sprintf(
/* translators: %1$s: team name */
__(
'Please upgrade the plan for %s in order to create more sites.',
'astra-sites'
),
$team_name,
),
'upgrade_text' => __( 'Unlock Full Power', 'astra-sites' ),
'upgrade_url' => 'https://app.zipwp.com/founders-deal?source=starter-templates',
'contact_url' => $support_link,
'contact_text' => __( 'Contact Support', 'astra-sites' ),
)
),
'default_website_language' => apply_filters( 'ai_builder_default_website_language', 'en' ),
'default_business_type' => apply_filters( 'ai_builder_default_business_type', '' ),
'show_zip_plan' => apply_filters( 'ai_builder_show_zip_plan_details', true ),
'hide_site_features' => apply_filters( 'ai_builder_hidden_site_features', array() ),
'hideDashboardButton' => 'yes' === apply_filters( 'ai_builder_hide_visit_dashboard_button', 'no' ),
'isElementorDisabled' => get_option( 'st-elementor-builder-flag' ),
'isBeaverBuilderDisabled' => get_option( 'st-beaver-builder-flag' ) || ! self::is_legacy_beaver_builder_enabled(),
);
}
/**
* Get failed sites.
*
* @since 1.2.3
*
* @return array<int, array<string, mixed>>
*/
public function get_failed_sites() {
$failed_sites = get_option( 'astra_sites_import_failed_sites', array() );
$active_failed_sites = array();
if ( is_array( $failed_sites ) ) {
foreach ( $failed_sites as $site ) {
if ( ! $site['is_expired'] ) {
$active_failed_sites[] = $site;
}
}
}
return $active_failed_sites;
}
/**
* Get the client IP address.
*
* @since 1.0.9
*
* @return string
*/
public function get_client_ip() {
$ipaddress = '';
if ( getenv( 'HTTP_CLIENT_IP' ) ) {
$ipaddress = getenv( 'HTTP_CLIENT_IP' );
} elseif ( getenv( 'HTTP_X_FORWARDED_FOR' ) ) {
$ipaddress = getenv( 'HTTP_X_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_X_FORWARDED' ) ) {
$ipaddress = getenv( 'HTTP_X_FORWARDED' );
} elseif ( getenv( 'HTTP_FORWARDED_FOR' ) ) {
$ipaddress = getenv( 'HTTP_FORWARDED_FOR' );
} elseif ( getenv( 'HTTP_FORWARDED' ) ) {
$ipaddress = getenv( 'HTTP_FORWARDED' );
} elseif ( getenv( 'REMOTE_ADDR' ) ) {
$ipaddress = getenv( 'REMOTE_ADDR' );
} else {
$ipaddress = 'UNKNOWN';
}
return $ipaddress;
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
Ai_Builder_Plugin_Loader::get_instance();

View File

@@ -0,0 +1,31 @@
<?php
/**
* Plugin Name: AI Builder
* Description: Starter Templates AI Builder
* Author: Brainstorm Force
* Version: 1.2.30
* License: GPL v2
* Text Domain: ai-builder
*
* @package {{package}}
*/
if ( defined( 'AI_BUILDER_DIR' ) ) {
return;
}
if ( ! apply_filters( 'ai_builder_load_library', true ) ) {
return;
}
/**
* Set constants
*/
define( 'AI_BUILDER_FILE', __FILE__ );
define( 'AI_BUILDER_BASE', plugin_basename( AI_BUILDER_FILE ) );
define( 'AI_BUILDER_DIR', plugin_dir_path( AI_BUILDER_FILE ) );
define( 'AI_BUILDER_URL', plugins_url( '/', AI_BUILDER_FILE ) );
define( 'AI_BUILDER_VER', '1.2.30' );
require_once 'ai-builder-plugin-loader.php';
require_once AI_BUILDER_DIR . 'inc/classes/functions.php';

View File

@@ -0,0 +1,303 @@
v1.2.30 - 21-March-2025
- New: Added Latepoint plugin compatibility in AI onboarding
v1.2.29 - 19-March-2025
- New: Introducing a new action hook `astra_sites_after_theme_activation`.
v1.2.28 - 06-March-2025
- New: Deprecated Beaver Builder starter templates, enable with `astra_sites_enable_legacy_beaver_builder_support` filter to continue using them.
v1.2.27 - 27-February-2025
- New: Added a filter to toggle the “Visit Dashboard” button.
v1.2.26 - 24-February-2025
- New: Added SureMail plugin compatibility in AI onboarding
v1.2.25 - 29-January-2025
- Fix: Removed unnecessary API request headers to improve compatibility.
v1.2.24 - 20-January-2025
- New: Added filter to update the default business type.
v1.2.23 - 16-January-2025
- Improvement: Improved Translation support to the Business Category API.
v1.2.22 - 16-January-2025
- Improvement: Improved condition based translation support to the Business Category API.
v1.2.21 - 16-January-2025
- Improvement: Added condition based translation support to the Business Category API.
v1.2.20 - 16-January-2025
- New: Added translation support to the Business Category API.
v1.2.19 - 15-January-2025
- Improvement: Integrated UTM tracking data for import actions to enhance analytics.
v1.2.18 - 02-December-2024
- Improvement: Improved error handling by displaying actual server error messages in toaster
v1.2.17 - 02-December-2024
- Improvement: Handled displaying "Internal server error" in toaster.
v1.2.16 - 28-November-2024
- Fix: Fixed import process stuck issue.
v1.2.15 - 28-November-2024
- Improvement: Added import success action to trigger custom actions after successful site import.
v1.2.14 - 19-November-2024
- Improvement: Enhanced error handling in the import process with clearer error messages.
- Improvement: Upgrade plan popup UI enhancements for a better user experience.
v1.2.13 - 13-November-2024
- Fix: Resolved an issue causing the import process to fail due to unexpected SureForm plugin redirection upon activation.
v1.2.12 - 13-November-2024
- Fix: This update addressed a security bug. Props to Patchstack for privately reporting it.
v1.2.11 - 05-November-2024
- Improvement: Hidding ecommerce templates if ecommerce feature is hidden.
v1.2.10 - 31-October-2024
- New: Added a filter to hide specified features on the selection screen.
v1.2.9 - 24-October-2024
- Improvement: Prompted users for detailed business descriptions to enhance content generation.
- Improvement: Creating a SureCart merchant account when selected from the feature screen.
- Improvement: Added compatibility for SureForms templates.
v1.2.8 - 15-October-2024
- Improvement: Corrected typos and applied minor CSS enhancements.
v1.2.7 - 14-October-2024
- New: Introduced a ZipWP upgrade promotional popup.
- New: Implemented toasters to provide more detailed error information.
- New: Added source parameters to URLs redirecting to ZipWP for better tracking.
v1.2.6 - 20-September-2024
- New: Added a filter to hide premium templates.
- Improvement: Added a validation on Image upload to check if the image URL is valid.
v1.2.5 - 13-September-2024
- Fix: Console error for starter templates onboarding plugin.
v1.2.4 - 13-September-2024
- Improvement: Added sanitization for display site title value.
v1.2.3 - 09-September-2024
- New: Added functionality to save failed site creations and allow reimporting them.
- New: Displaying users ZipWP plan information.
- New: Displaying alert notice when AI site generation count is nearing its limit.
- New: Added an option to choose the type of store when the Ecommerce feature is selected.
- Improvement: Resume Session popup will now restore the step where the user left off.
- Improvement: Improved images upload process for better performance and user experience.
- Improvement: Showing Premium template notice on customizer screen if user has free plan.
- Fix: Customizer 'Show site title' option was not applied correctly during site import.
v1.2.2 - 30-August-2024
- New: Added filter to update the default website language.
v1.2.1 - 23-August-2024
- Fix: Some strings were not translation ready.
v1.2.0 - 07-August-2024
- New: Enhanced AI onboarding UI.
v1.1.22 - 05-August-2024
- Fix: Required plugins for selected features were not installed for classic templates.
v1.1.21 - 01-August-2024
- Fix: Using option variables instead of transient.
v1.1.20 - 31-July-2024
- Fix: Removed All sites generation condition to show the site limit exceed popup.
v1.1.19 - 30-July-2024
- Improvement: Added support for passing a language parameter to the generate business description API, enabling descriptions to be generated in the selected language.
v1.1.18 - 24-July-2024
- Improvement: Implemented detailed error message handling based on API responses.
v1.1.17 - 22-July-2024
- Improvement: Added new icon for ecommerce feature.
v1.1.16 - 19-July-2024
- Fix: Template preview designs showing ternary operation result HTML.
- Fix: Required plugins data was incorrect for the elementor templates screen.
v1.1.15 - 17-July-2024
- Improvement: Using message code instead of response code to check some condition.
v1.1.14 - 17-July-2024
- Fix: Excluded features title and description from translation.
v1.1.13 - 17-July-2024
- Fix: Social icons title was not translation ready.
v1.1.12 - 17-July-2024
- Fix: Some strings were not translation ready.
- Fix: Import Process Not Working on site language Change.
v1.1.11 - 16-July-2024
- Improvement: Added required changes for script strings translation.
v1.1.10 - 12-July-2024
- New: Added script translation with a filter to update the text domain for script translation.
v1.1.9 - 11-July-2024
- Improvement: Updated condition to show site limit exceed popup.
v1.1.8 - 11-July-2024
- Improvement: Displaying different site limit exceed popup for ST Onboarding plugin.
- Fix: Premium badge was not showing for Premium templates.
v1.1.7 - 08-July-2024
- Fix: Business name is not getting reset after clicking on the start-over.
- Fix: Resume Session popup appears after site creation.
v1.1.5 - 05-July-2024
- Fix: Business type was not getting prefilled if site created from ZipWP platform.
v1.1.5 - 04-July-2024
- Fix: Hover color for accent color converted to CSS variable.
- Fix: Incorrect icon appearing for Contact Form feature.
v1.1.4 - 03-July-2024
- Fix: Resolved an issue preventing users from continuing to the next step if the business type input was entered manually.
v1.1.3 - 02-July-2024
- Fix: Reverted customizer data changes.
v1.1.2 - 01-July-2024
- Improvement: Added ZipWP new features icon support.
v1.1.1 - 26-June-2024
- Improvement: Enriching Website Building Onboarding with Advanced Font Presets.
- Improvement: Added a filter to disable the Premium Badge for templates.
- Fix: Compulsory features should enabled by default and should not be clickable.
- Fix: Hover effect/color is missing on the Continue button.
- Fix: Incorrect Input in Email Field.
v1.1.0 - 24-June-2024
- Fix: Resolved PHPStan errors.
- Fix: Site creation limit exceeded popup was not showing.
v1.0.49 - 19-June-2024
- Fix: Showing irrelevant errors in logging for import failures.
v1.0.48 - 18-June-2024
- Improvement: Add tooltip for "sneak peek" message for better UX
v1.0.47 - 17-June-2024
- Improvement: Add tooltip for "sneak peek" message for better UX
- Improvement: Ability to skip Features screen using a filter.
v1.0.46 - 14-June-2024
- Improvement: Updated the sidebar icons and connecting lines color.
v1.0.45 - 14-June-2024
- Chore: Included build files.
v1.0.44 - 14-June-2024
- Improvement: Updated the Sidebar steps text color.
v1.0.43 - 12-June-2024
- Improvement: Added new color variables to the TailwindCSS config.
v1.0.42 - 11-June-2024
- Fix: Resolved PHP 8.2 deprecated notice related to the creation of dynamic properties.
v1.0.41 - 10-June-2024
- Improvement: Error Boundary Screen in case of unexpected errors.
- Improvement: Removed phone validations to match this phone format - Ex: +1 (888) SIXT-CAR (749-8227)
- Fix: Better handling of console errors due to missing URLs in Image object from ZipWP images API.
v1.0.40 - 07-June-2024
- Fix: Fixed a console error in Gutenberg Templates library due to missing URLs for author and engine for placeholder images.
v1.0.39 - 06-June-2024
- Fix: Fixed an error when using the Spectra One theme and Starter Templates to import websites with ZipAI.
v1.0.38 - 03-June-2024
- Improvement: Added logging for import failures with a user alert for log details, warning that retries will exhaust AI site attempts.
v1.0.37 - 04-June-2024
- Improvement : Prefill websites based on the previous site creation.
v1.0.36 - 03-June-2024
- Fix: Resolved blog posts throwing 404 errors.
v1.0.35 - 29-May-2024
- Fix: The title for the `Description` step does not change for exceptional cases.
v1.0.34 - 29-May-2024
- Improvement: Pass `ecommerce` to the features array if ecommerce is enabled for the selected template.
v1.0.33 - 29-May-2024
- New: Premium template feature implemented.
v1.0.32 - 28-May-2024
- Fix: Inconsistent font sizes and line height
v1.0.31 - 27-May-2024
- Improvement: Added compatibility for classic templates sites options.
v1.0.30 - 27-May-2024
- Improvement: Sending template type parameter to set the flag.
v1.0.29 - 23-May-2024
- Improvement: Added a pre-installation confirmation modal.
v1.0.27 - 23-May-2024
- Improvement: Added filter to skip loading AI Builder library.
v1.0.26 - 21-May-2024
- Fix: Fixed fatal error while activating plugin on multisite.
v1.0.25 - 17-May-2024
- Fix: Show the user-entered contact details in the preview.
v1.0.24 - 15-May-2024
- Improvement: Added compatibility for WP-CLI import process.
v1.0.23 - 13-May-2024
- Fix: Fixed the PHP warning for function optional parameter.
v1.0.22 - 10-May-2024
- Improvement: Added filter for migration svg for onboarding plugin.
v1.0.18 - 09-May-2024
- Improvement: Added Light and Dark Color palettes.
v1.0.17 - 09-May-2024
- Improvement: Removed the width of the logo to make it compatible to Starter Templates Onboarding.
v1.0.15 - 08-May-2024
- Improvement: Set the source to 'starter-templates' on activation.
v1.0.14 - 08-May-2024
- Fix: The site import error when there are some required plugins.
v1.0.13 - 07-May-2024
- Fix: The site import process gets stuck.
- Improvement: Updated the site building step slug.
v1.0.10 - 06-May-2024
- Fix: Fixed an incorrect type casting of a string on a popup for AI Builder.
v1.0.9 - 06-May-2024
- Improvement: Merged two steps into one.
v1.0.7 - 02-May-2024
- Fix: The upload logo is not working on the design preview screen.
v1.0.5 - 02-May-2024
- Improvement: Block sidebar Navigation.
- UI Improvement: Font and Color palette selector UI of the Preview screen.
v1.0.1 - 24-April-2024
- Build files released
v1.0.0 - 24-April-2024
- Initial Release

View File

@@ -0,0 +1,68 @@
<?php
/**
* AiBuilder Ajax Base.
*
* @package AiBuilder
*/
namespace AiBuilder\Inc\Ajax;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AiBuilder\Inc\Ajax\AjaxErrors;
/**
* Class Admin_Menu.
*/
abstract class AjaxBase {
/**
* Ajax action prefix.
*
* @var string
*/
private $prefix = 'astra-sites';
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
}
/**
* Register ajax events.
*
* @param array<int, string> $ajax_events Ajax events.
*
* @return void
*/
public function init_ajax_events( $ajax_events ) {
if ( ! empty( $ajax_events ) ) {
foreach ( $ajax_events as $ajax_event ) {
add_action( 'wp_ajax_' . $this->prefix . '-' . $ajax_event, array( $this, $ajax_event ) ); // @phpstan-ignore-line
}
}
}
/**
* Get ajax error message.
*
* @param string $type Message type.
* @return string
*/
public function get_error_msg( $type ) {
if ( class_exists( 'AiBuilder\Inc\Ajax\AjaxErrors' ) && method_exists( AjaxErrors::Instance(), 'get_error_msg' ) ) {
return AjaxErrors::Instance()->get_error_msg( $type );
}
return '';
}
}

View File

@@ -0,0 +1,63 @@
<?php
/**
* Ai Builder Ajax Errors.
*
* @package Ai Builder
*/
namespace AiBuilder\Inc\Ajax;
use AiBuilder\Inc\Traits\Instance;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class AjaxErrors
*/
class AjaxErrors {
use Instance;
/**
* Errors
*
* @access private
* @var array<string, string> Errors strings.
* @since 1.0.0
*/
private static $errors = array();
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
self::$errors = array(
'permission' => __( 'Sorry, you are not allowed to do this operation.', 'astra-sites' ),
'nonce' => __( 'Nonce validation failed', 'astra-sites' ),
'default' => __( 'Sorry, something went wrong.', 'astra-sites' ),
);
}
/**
* Get error message.
*
* @param string $type Message type.
* @return string
*/
public function get_error_msg( $type ) {
if ( ! isset( self::$errors[ $type ] ) ) {
$type = 'default';
}
return self::$errors[ $type ];
}
}
AjaxErrors::Instance();

View File

@@ -0,0 +1,89 @@
<?php
/**
* AiBuilder Ajax Initialize.
*
* @package AiBuilder
*/
namespace AiBuilder\Inc\Ajax;
use AiBuilder\Inc\Traits\Instance;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Class Admin_Init.
*/
class AjaxInit {
use Instance;
/**
* Ajax Instance
*
* @access private
* @var object Class object.
* @since 1.0.42
*/
private static $ajax_instance = null;
/**
* Initiator
*
* @since 1.0.42
* @return object initialized object of class.
*/
public static function get_instance() {
if ( null === self::$ajax_instance ) {
self::$ajax_instance = new self();
}
return self::$ajax_instance;
}
/**
* Constructor
*
* @since 1.0.0
*/
public function __construct() {
$this->initialize_hooks();
}
/**
* Init Hooks.
*
* @since 1.0.0
* @return void
*/
public function initialize_hooks() {
$this->register_all_ajax_events();
}
/**
* Register API routes.
*
* @return void
*/
public function register_all_ajax_events() {
$controllers = array(
'AiBuilder\Inc\Ajax\Importer',
'AiBuilder\Inc\Ajax\Plugin',
);
foreach ( $controllers as $controller ) {
if ( class_exists( $controller ) && method_exists( $controller::get_instance(), 'register_ajax_events' ) ) {
$controller::get_instance()->register_ajax_events(); // @phpstan-ignore-line
}
}
}
}
AjaxInit::Instance();

View File

@@ -0,0 +1,674 @@
<?php
/**
* Import ajax actions.
*
* @package AiBuilder
*/
namespace AiBuilder\Inc\Ajax;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AiBuilder\Inc\Ajax\AjaxBase;
use AiBuilder\Inc\Traits\Instance;
use AiBuilder\Inc\Classes\Ai_Builder_Importer_Log;
use AiBuilder\Inc\Classes\Zipwp\Ai_Builder_ZipWP_Integration;
use AiBuilder\Inc\Classes\Importer\Ai_Builder_Site_Options_Import;
use AiBuilder\Inc\Classes\Importer\Ai_Builder_Utils;
use AiBuilder\Inc\Classes\Importer\Ai_Builder_Fse_Importer;
use STImporter\Importer\ST_Importer_File_System;
use STImporter\Importer\ST_Importer;
use STImporter\Resetter\ST_Resetter;
use STImporter\Importer\ST_Importer_Helper;
use AiBuilder\Inc\Traits\Helper;
use STImporter\Importer\Batch\ST_Batch_Processing_Gutenberg;
use STImporter\Importer\Batch\ST_Batch_Processing_Misc;
/**
* Class Flows.
*/
class Importer extends AjaxBase {
use Instance;
/**
* Ajax Instance
*
* @access private
* @var object Class object.
* @since 1.0.42
*/
private static $ajax_instance = null;
/**
* Initiator
*
* @since 1.0.42
* @return object initialized object of class.
*/
public static function get_instance() {
if ( null === self::$ajax_instance ) {
self::$ajax_instance = new self();
}
return self::$ajax_instance;
}
/**
* Constructor
*/
public function __construct() {
add_action( 'astra_sites_import_complete', array( $this, 'update_required_options' ) );
}
/**
* Update options.
*
* @return void
*/
public function update_required_options() {
update_option( 'astra_sites_import_complete', 'yes', false );
if ( 'ai' === get_option( 'astra_sites_current_import_template_type' ) ) {
update_option( 'astra_sites_batch_process_complete', 'yes' );
delete_option( 'ai_import_logger' );
delete_option( 'astra_sites_import_failed_sites' );
} else {
update_option( 'astra_sites_batch_process_complete', 'no' );
}
delete_option( 'astra_sites_import_started' );
}
/**
* Register_ajax_events.
*
* @return void
*/
public function register_ajax_events() {
$ajax_events = array(
// Import Part 1 Start.
'backup_settings',
'reset_customizer_data',
'reset_site_options',
'reset_widgets_data',
'reset_terms_and_forms',
'get_deleted_post_ids',
'reset_posts',
'download_selected_image',
'import_customizer_settings',
'import_spectra_settings',
'import_surecart_settings',
// Import Part 1 End.
// Import Part 2 Start.
'import_options',
'import_widgets',
'gutenberg_batch',
'image_replacement_batch',
'import_end',
'set_site_data',
'import_success',
// Import Part 2 End.
);
$this->init_ajax_events( $ajax_events );
}
/**
* Backup our existing settings.
*
* @return void
*/
public function backup_settings() {
Helper::backup_settings();
}
/**
* Reset posts in chunks.
*
* @return void
*
* @since 3.0.8
*/
public function reset_posts() {
if ( wp_doing_ajax() ) {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
if ( class_exists( 'STImporter\Resetter\ST_Resetter' ) ) {
ST_Resetter::reset_posts();
}
if ( wp_doing_ajax() ) {
wp_send_json_success();
}
}
/**
* Import Success.
*
* @return void
*
* @since 1.2.15
*/
public function import_success() {
if ( wp_doing_ajax() ) {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
do_action( 'astra_sites_import_success' );
wp_send_json_success();
}
/**
* Reset customizer data
*
* @since 1.3.0
* @return void
*/
public function reset_customizer_data() {
Helper::reset_customizer_data();
}
/**
* Reset site options
*
* @since 1.3.0
* @return void
*/
public function reset_site_options() {
Helper::reset_site_options();
}
/**
* Reset widgets data
*
* @since 1.3.0
* @return void
*/
public function reset_widgets_data() {
Helper::reset_widgets_data();
}
/**
* Reset terms and forms.
*
* @return void
*
* @since 3.0.3
*/
public function reset_terms_and_forms() {
if ( wp_doing_ajax() ) {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
if ( class_exists( 'STImporter\Resetter\ST_Resetter' ) ) {
ST_Resetter::reset_terms_and_forms();
}
if ( wp_doing_ajax() ) {
wp_send_json_success();
}
}
/**
* Get post IDs to be deleted.
*
* @return void
*/
public function get_deleted_post_ids() {
if ( wp_doing_ajax() ) {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
wp_send_json_success( astra_sites_get_reset_post_data() );
}
/**
* Download Images
*
* @since 4.1.0
* @return void
*/
public function download_selected_image() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error(
array(
'data' => 'You do not have permission to do this action.',
'status' => false,
)
);
}
$index = isset( $_POST['index'] ) ? sanitize_text_field( wp_unslash( $_POST['index'] ) ) : '';
$images = Ai_Builder_ZipWP_Integration::get_business_details( 'images' );
if ( empty( $images ) || ! is_array( $images ) ) {
wp_send_json_error(
array(
'data' => 'Image not downloaded!',
'status' => true,
)
);
}
$image = $images[ $index ];
if ( empty( $image ) || ! is_array( $image ) ) {
wp_send_json_error(
array(
'data' => 'Image not downloaded!',
'status' => true,
)
);
}
$prepare_image = array(
'id' => $image['id'],
'url' => $image['url'],
'description' => $image['description'],
);
Ai_Builder_Importer_Log::add( 'Downloading Image ' . $image['url'] );
if ( class_exists( 'STImporter\Importer\ST_Importer_Helper' ) ) {
$id = ST_Importer_Helper::download_image( $prepare_image );
Ai_Builder_Importer_Log::add( 'Downloaded Image attachment id: ' . $id );
wp_send_json_success(
array(
'data' => 'Image downloaded successfully!',
'status' => true,
)
);
}
wp_send_json_error(
array(
'data' => 'Required function not found!',
'status' => false,
)
);
}
/**
* Import Customizer Settings.
*
* @since 1.0.14
* @since 1.4.0 The `$customizer_data` was added.
*
* @return void
*/
public function import_customizer_settings() {
Helper::import_customizer_settings();
}
/**
* Import Spectra Settings
*
* @since 3.1.16
*
* @param string $url Spectra Settings JSON file URL.
* @return void
*/
public function import_spectra_settings( $url = '' ) {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'edit_posts' ) ) {
wp_send_json_error(
array(
'error' => __( 'Permission Denied!', 'astra-sites' ),
)
);
}
$settings = astra_get_site_data( 'astra-site-spectra-options' );
if ( class_exists( 'STImporter\Importer\ST_Importer' ) ) {
$result = ST_Importer::import_spectra_settings( $settings );
if ( false === $result['status'] ) {
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::line( $result['error'] );
} elseif ( wp_doing_ajax() ) {
wp_send_json_error( $result['error'] );
}
}
if ( defined( 'WP_CLI' ) ) {
\WP_CLI::line( 'Imported Spectra settings from ' . $url );
} elseif ( wp_doing_ajax() ) {
wp_send_json_success( $url );
}
}
wp_send_json_error( __( 'There was an error importing the Spectra settings.', 'astra-sites' ) );
}
/**
* Import Surecart Settings
*
* @since 3.3.0
* @return void
*/
public function import_surecart_settings() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
$id = isset( $_POST['source_id'] ) ? base64_decode( sanitize_text_field( $_POST['source_id'] ) ) : ''; //phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode
if ( class_exists( 'STImporter\Importer\ST_Importer' ) ) {
$result = ST_Importer::import_surecart_settings( $id );
if ( ! is_wp_error( $result ) ) {
wp_send_json_success( 'success' );
}
}
wp_send_json_error( __( 'There was an error cloning the surecart store.', 'astra-sites' ) );
}
/**
* Import Options.
*
* @since 1.0.14
* @since 1.4.0 The `$options_data` was added.
*
* @return void
*/
public function import_options() {
Helper::import_options();
}
/**
* Import Widgets.
*
* @since 1.0.14
* @since 1.4.0 The `$widgets_data` was added.
*
* @return void
*/
public function import_widgets() {
Helper::import_widgets();
}
/**
* Processing GT batch.
*
* @since 1.0.14
* @return void
*/
public function gutenberg_batch() {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$status = class_exists( 'STImporter\Importer\Batch\ST_Batch_Processing_Gutenberg' ) ? ST_Batch_Processing_Gutenberg::get_instance()->import() : array(
'status' => false,
'msg' => __( 'Required function not found', 'astra-sites' ),
);
if ( wp_doing_ajax() ) {
if ( $status['success'] ) {
wp_send_json_success( $status['msg'] );
} else {
wp_send_json_error( $status['msg'] );
}
}
}
/**
* Processing GT batch.
*
* @since 1.0.14
* @return void
*/
public function image_replacement_batch() {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$status = class_exists( 'STImporter\Importer\Batch\ST_Batch_Processing_Misc' ) ? ST_Batch_Processing_Misc::get_instance()->import() : array(
'status' => false,
'msg' => __( 'Required function not found', 'astra-sites' ),
);
if ( wp_doing_ajax() ) {
if ( $status['success'] ) {
wp_send_json_success( $status['msg'] );
} else {
wp_send_json_error( $status['msg'] );
}
}
}
/**
* Import End.
*
* @since 1.0.14
* @return void
*/
public function import_end() {
Helper::import_end();
}
/**
* Set site related data.
*
* @since 3.0.0-beta.1
* @return void
*/
public function set_site_data() {
if ( 'spectra-one' === get_option( 'stylesheet', 'astra' ) ) {
Ai_Builder_Fse_Importer::set_fse_site_data();
return;
}
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => __( 'You are not authorized to perform this action.', 'astra-sites' ),
)
);
}
$param = isset( $_POST['param'] ) ? sanitize_text_field( $_POST['param'] ) : '';
if ( empty( $param ) ) {
wp_send_json_error(
array(
'error' => __( 'Received empty parameters.', 'astra-sites' ),
)
);
}
switch ( $param ) {
case 'site-title':
$business_name = isset( $_POST['business-name'] ) ? sanitize_text_field( stripslashes( $_POST['business-name'] ) ) : '';
if ( ! empty( $business_name ) ) {
update_option( 'blogname', $business_name );
}
if ( isset( $_POST['show-site-title'] ) ) {
// Get the value of the POST variable.
$show_site_title = filter_var( $_POST['show-site-title'], FILTER_VALIDATE_BOOLEAN );
// Determine the array based on the value of the POST variable.
$options_array = $show_site_title
? array(
'desktop' => true,
'tablet' => true,
'mobile' => true,
)
: array(
'desktop' => false,
'tablet' => false,
'mobile' => false,
);
// Update the option in the database.
astra_update_option( 'display-site-title-responsive', $options_array );
astra_update_option( 'display-site-title', $show_site_title );
}
break;
case 'site-logo' === $param && function_exists( 'astra_get_option' ):
$logo_id = isset( $_POST['logo'] ) ? intval( $_POST['logo'] ) : 0;
$width_index = 'ast-header-responsive-logo-width';
set_theme_mod( 'custom_logo', $logo_id );
if ( ! empty( $logo_id ) ) {
// Disable site title when logo is set.
astra_update_option( 'display-site-title', false );
}
// Set logo width.
$logo_width = isset( $_POST['logo-width'] ) ? sanitize_text_field( $_POST['logo-width'] ) : '';
$option = astra_get_option( $width_index );
if ( isset( $option['desktop'] ) ) {
$option['desktop'] = $logo_width;
}
astra_update_option( $width_index, $option );
// Check if transparent header is used in the demo.
$transparent_header = astra_get_option( 'transparent-header-logo', false );
$inherit_desk_logo = astra_get_option( 'different-transparent-logo', false );
if ( '' !== $transparent_header && $inherit_desk_logo ) {
astra_update_option( 'transparent-header-logo', wp_get_attachment_url( $logo_id ) );
$width_index = 'transparent-header-logo-width';
$option = astra_get_option( $width_index );
if ( isset( $option['desktop'] ) ) {
$option['desktop'] = $logo_width;
}
astra_update_option( $width_index, $option );
}
$retina_logo = astra_get_option( 'different-retina-logo', false );
if ( '' !== $retina_logo ) {
astra_update_option( 'ast-header-retina-logo', wp_get_attachment_url( $logo_id ) );
}
$transparent_retina_logo = astra_get_option( 'different-transparent-retina-logo', false );
if ( '' !== $transparent_retina_logo ) {
astra_update_option( 'transparent-header-retina-logo', wp_get_attachment_url( $logo_id ) );
}
break;
case 'site-colors' === $param && function_exists( 'astra_get_option' ):
$palette = isset( $_POST['palette'] ) ? (array) json_decode( stripslashes( $_POST['palette'] ) ) : array();
$colors = isset( $palette['colors'] ) ? (array) $palette['colors'] : array();
if ( ! empty( $colors ) ) {
$global_palette = astra_get_option( 'global-color-palette' );
$color_palettes = get_option( 'astra-color-palettes', \Astra_Global_Palette::get_default_color_palette() );
if ( is_array( $color_palettes ) ) {
foreach ( $colors as $key => $color ) {
$global_palette['palette'][ $key ] = $color;
$color_palettes['palettes']['palette_1'][ $key ] = $color;
}
}
update_option( 'astra-color-palettes', $color_palettes );
astra_update_option( 'global-color-palette', $global_palette );
}
break;
case 'site-typography' === $param && function_exists( 'astra_get_option' ):
$typography = isset( $_POST['typography'] ) ? (array) json_decode( stripslashes( $_POST['typography'] ) ) : '';
$font_size_body = isset( $typography['font-size-body'] ) ? (array) $typography['font-size-body'] : '';
if ( ! empty( $font_size_body ) && is_array( $font_size_body ) ) {
astra_update_option( 'font-size-body', $font_size_body );
}
if ( ! empty( $typography['body-font-family'] ) ) {
astra_update_option( 'body-font-family', $typography['body-font-family'] );
}
if ( ! empty( $typography['body-font-variant'] ) ) {
astra_update_option( 'body-font-variant', $typography['body-font-variant'] );
}
if ( ! empty( $typography['body-font-weight'] ) ) {
astra_update_option( 'body-font-weight', $typography['body-font-weight'] );
}
if ( ! empty( $typography['body-line-height'] ) ) {
astra_update_option( 'body-line-height', $typography['body-line-height'] );
}
if ( ! empty( $typography['headings-font-family'] ) ) {
astra_update_option( 'headings-font-family', $typography['headings-font-family'] );
}
if ( ! empty( $typography['headings-font-weight'] ) ) {
astra_update_option( 'headings-font-weight', $typography['headings-font-weight'] );
}
if ( ! empty( $typography['headings-line-height'] ) ) {
astra_update_option( 'headings-line-height', $typography['headings-line-height'] );
}
if ( ! empty( $typography['headings-font-variant'] ) ) {
astra_update_option( 'headings-font-variant', $typography['headings-font-variant'] );
}
break;
}
// Clearing Cache on hostinger, Cloudways.
Ai_Builder_Utils::third_party_cache_plugins_clear_cache();
wp_send_json_success();
}
}

View File

@@ -0,0 +1,413 @@
<?php
/**
* Plugin ajax actions.
*
* @package AiBuilder
*/
namespace AiBuilder\Inc\Ajax;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
use AiBuilder\Inc\Ajax\AjaxBase;
use AiBuilder\Inc\Traits\Instance;
use AiBuilder\Inc\Classes\Importer\Ai_Builder_Error_Handler;
use STImporter\Importer\ST_Importer;
use AiBuilder\Inc\Traits\Helper;
use AiBuilder\Inc\Classes\Zipwp\Ai_Builder_ZipWP_Integration;
use STImporter\Importer\ST_Importer_Helper;
/**
* Class Flows.
*/
class Plugin extends AjaxBase {
use Instance;
/**
* Ajax Instance
*
* @access private
* @var object Class object.
* @since 1.0.42
*/
private static $ajax_instance = null;
/**
* Initiator
*
* @since 1.0.42
* @return object initialized object of class.
*/
public static function get_instance() {
if ( null === self::$ajax_instance ) {
self::$ajax_instance = new self();
}
return self::$ajax_instance;
}
/**
* Register_ajax_events.
*
* @return void
*/
public function register_ajax_events() {
$ajax_events = array(
'required_plugins',
'required_plugin_activate',
'filesystem_permission',
'set_start_flag',
'download_image',
'report_error',
'activate_theme',
'site_language',
);
$this->init_ajax_events( $ajax_events );
}
/**
* Required Plugins
*
* @since 2.0.0
*
* @param array<int, array<string, string>> $required_plugins Required Plugins.
* @param array<string, mixed> $options Site Options.
* @param array<string, mixed> $enabled_extensions Enabled Extensions.
* @return mixed
*/
public function required_plugins( $required_plugins = array(), $options = array(), $enabled_extensions = array() ) {
Helper::required_plugins( $required_plugins, $options, $enabled_extensions );
}
/**
* Required Plugin Activate
*
* @since 2.0.0 Added parameters $init, $options & $enabled_extensions to add the WP CLI support.
* @since 1.0.0
* @param string $init Plugin init file.
* @param array<string, mixed> $options Site options.
* @param array<string, mixed> $enabled_extensions Enabled extensions.
* @return void
*/
public function required_plugin_activate( $init = '', $options = array(), $enabled_extensions = array() ) {
Helper::required_plugin_activate( $init, $options, $enabled_extensions );
}
/**
* Get the status of file system permission of "/wp-content/uploads" directory.
*
* @return void
*/
public function filesystem_permission() {
Helper::filesystem_permission();
}
/**
* Set a flag that indicates the import process has started.
*
* @return void
*/
public function set_start_flag() {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
$uuid = isset( $_POST['uuid'] ) ? sanitize_text_field( $_POST['uuid'] ) : '';
$template_type = isset( $_POST['template_type'] ) ? sanitize_text_field( $_POST['template_type'] ) : '';
if ( class_exists( 'STImporter\Importer\ST_Importer' ) ) {
ST_Importer::set_import_process_start_flag( $template_type, $uuid );
wp_send_json_success();
} else {
wp_send_json_error( __( 'Required function not found', 'astra-sites' ) );
}
}
/**
* Download Images
*
* @since 4.1.0
* @return void
*/
public function download_image() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error(
array(
'data' => 'You do not have permission to do this action.',
'status' => false,
)
);
}
$index = isset( $_POST['index'] ) ? sanitize_text_field( wp_unslash( $_POST['index'] ) ) : '';
$images = Ai_Builder_ZipWP_Integration::get_business_details( 'images' );
if ( empty( $images ) || ! is_array( $images ) ) {
wp_send_json_success(
array(
'data' => 'No images selected to download!',
'status' => true,
)
);
}
$image = $images[ $index ];
if ( empty( $image ) || ! is_array( $image ) ) {
wp_send_json_success(
array(
'data' => 'No image to download!',
'status' => true,
)
);
}
$prepare_image = array(
'id' => $image['id'],
'url' => $image['url'],
'description' => isset( $image['description'] ) ? $image['description'] : '',
);
$id = class_exists( 'STImporter\Importer\ST_Importer_Helper' ) ? ST_Importer_Helper::download_image( $prepare_image ) : 0;
wp_send_json_success(
array(
'data' => 'Image downloaded successfully!',
'status' => true,
)
);
}
/**
* Report Error.
*
* @since 3.0.0
* @return void
*/
public function report_error() {
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error(
array(
'data' => 'You do not have permission to do this action.',
'status' => false,
)
);
}
$api_domain = class_exists( 'STImporter\Importer\ST_Importer_Helper' ) ? ST_Importer_Helper::get_api_domain() : '';
$api_url = add_query_arg( [], trailingslashit( $api_domain ) . 'wp-json/starter-templates/v2/import-error/' );
if ( ! astra_sites_is_valid_url( $api_url ) ) {
wp_send_json_error(
array(
/* Translators: %s is URL. */
'message' => sprintf( __( 'Invalid URL - %s', 'astra-sites' ), $api_url ),
'code' => 'Error',
)
);
}
$id = ( isset( $_POST['id'] ) ) ? intval( $_POST['id'] ) : 0;
$user_agent_string = isset( $_SERVER['HTTP_USER_AGENT'] ) ? sanitize_text_field( $_SERVER['HTTP_USER_AGENT'] ) : '';
$error = ( isset( $_POST['error'] ) ) ? json_decode( stripslashes( $_POST['error'] ), true ) : array();
$local_storage = ( isset( $_POST['local_storage'] ) ) ? json_decode( stripslashes( $_POST['local_storage'] ), true ) : array();
$ai_import_logger = get_option( 'ai_import_logger', array() );
$ai_import_logger = array(
'time' => current_time( 'mysql' ),
'data' => array(
'user_agent' => $user_agent_string,
'id' => $id,
'error' => $error,
),
);
update_option( 'ai_import_logger', $ai_import_logger );
$api_args = array(
'timeout' => 3,
'blocking' => true,
'body' => array(
'url' => esc_url( site_url() ),
'err' => stripslashes( $_POST['error'] ),
'id' => $_POST['id'],
'logfile' => $this->get_log_file_path(),
'version' => AI_BUILDER_VER,
'abspath' => ABSPATH,
'user_agent' => $user_agent_string,
'server' => array(
'php_version' => Helper::get_php_version(),
'php_post_max_size' => ini_get( 'post_max_size' ),
'php_max_execution_time' => ini_get( 'max_execution_time' ),
'max_input_time' => ini_get( 'max_input_time' ),
'php_memory_limit' => ini_get( 'memory_limit' ),
'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
),
),
);
do_action( 'st_before_sending_error_report', $api_args['body'] );
$request = wp_safe_remote_post( $api_url, $api_args );
do_action( 'st_after_sending_error_report', $api_args['body'], $request );
$failed_sites = get_option( 'astra_sites_import_failed_sites', array() );
$last_import_site = get_option( 'zipwp_import_site_details', array() );
if ( ! is_array( $failed_sites ) ) {
$failed_sites = array();
}
$uuids = array_map(
function( $site ) {
return $site['uuid'];
},
$failed_sites
);
if ( is_array( $last_import_site ) && ! in_array( $last_import_site['uuid'], $uuids, true ) ) {
$last_import_site['template_id'] = $id;
$last_import_site['local_storage'] = $local_storage;
$failed_sites[] = $last_import_site;
update_option( 'astra_sites_import_failed_sites', $failed_sites );
}
if ( is_wp_error( $request ) ) {
wp_send_json_error( $request );
}
$code = (int) wp_remote_retrieve_response_code( $request );
$data = json_decode( wp_remote_retrieve_body( $request ), true );
if ( 200 === $code ) {
wp_send_json_success( $data );
}
wp_send_json_error( $data );
}
/**
* Get full path of the created log file.
*
* @return string File Path.
* @since 3.0.25
*/
public function get_log_file_path() {
$log_file = get_option( 'astra_sites_recent_import_log_file', false );
if ( ! empty( $log_file ) && is_string( $log_file ) ) {
return str_replace( ABSPATH, esc_url( site_url() ) . '/', $log_file );
}
return '';
}
/**
* Activate theme
*
* @since 1.3.2
* @return void
*/
public function activate_theme() {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
Ai_Builder_Error_Handler::Instance()->start_error_handler();
switch_theme( 'astra' );
Ai_Builder_Error_Handler::Instance()->stop_error_handler();
/**
* Fires after the theme activation.
*
* @param string $theme_slug The slug of the theme that was activated.
* @since 1.2.29
*/
do_action( 'astra_sites_after_theme_activation', 'astra' );
wp_send_json_success(
array(
'success' => true,
'message' => __( 'Theme Activated', 'astra-sites' ),
)
);
}
/**
* Set site language.
*
* @since 1.0.0
* @return void
*/
public function site_language() {
if ( ! defined( 'WP_CLI' ) && wp_doing_ajax() ) {
// Verify Nonce.
check_ajax_referer( 'astra-sites', '_ajax_nonce' );
if ( ! current_user_can( 'customize' ) ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
}
if ( ! wp_doing_ajax() ) {
wp_send_json_error( __( 'You are not allowed to perform this action', 'astra-sites' ) );
}
$language = isset( $_POST['language'] ) ? sanitize_text_field( $_POST['language'] ) : 'en_US';
$result = $this->set_language( $language );
if ( ! $result ) {
wp_send_json_error( __( 'Failed to set the site language.', 'astra-sites' ) );
}
wp_send_json_success();
}
/**
* Set the site language.
*
* @since 1.0.0
*
* @param string $language The language code.
* @return bool
*/
public function set_language( $language = 'en_US' ) {
require_once ABSPATH . 'wp-admin/includes/translation-install.php';
$locale_code = 'en_US' === $language ? '' : $language;
if ( '' !== $locale_code && wp_can_install_language_pack() ) {
$language = wp_download_language_pack( $locale_code );
}
if ( ( '' === $locale_code ) || ( '' !== $locale_code && $language ) ) {
update_option( 'WPLANG', $locale_code );
load_default_textdomain( $locale_code );
return switch_to_locale( $locale_code );
}
return false;
}
}

Some files were not shown because too many files have changed in this diff Show More