plugin updates

This commit is contained in:
Tony Volpe
2024-02-21 16:19:46 +00:00
parent c72f206574
commit 21d4c85c00
1214 changed files with 102269 additions and 179257 deletions
File diff suppressed because it is too large Load Diff
@@ -1,21 +1,21 @@
.aiosrs-rating-wrap .aiosrs-star-rating-wrap {
display: inline-block;
vertical-align: middle;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap ~ .aiosrs-star-rating-wrap {
float: right;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap .aiosrs-star-rating {
color: #ffd700;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap:not(.disabled) .aiosrs-star-rating {
cursor: pointer;
}
.aiosrs-rating-wrap .success-msg {
color: #0f0;
margin-left: 5px;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap {
display: inline-block;
vertical-align: middle;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap ~ .aiosrs-star-rating-wrap {
float: right;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap .aiosrs-star-rating {
color: #ffd700;
}
.aiosrs-rating-wrap .aiosrs-star-rating-wrap:not(.disabled) .aiosrs-star-rating {
cursor: pointer;
}
.aiosrs-rating-wrap .success-msg {
color: #0f0;
margin-left: 5px;
}
@@ -1,98 +1,98 @@
body.aiosrs-pro-license-form-open {
overflow: hidden;
}
#aiosrs-pro-license-form p {
padding: 5px 0 5px 0;
}
#aiosrs-pro-license-form .aiosrs-pro-license-form-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
#aiosrs-pro-license-form .aiosrs-pro-license-form-inner {
background: #fcfcfc;
position: fixed;
background-color: #fff;
z-index: 999999999;
padding: 2px 20px 20px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
#aiosrs-pro-license-form-close-btn {
position: absolute;
left: auto;
right: 0;
top: 0;
width: 29px;
height: 29px;
border: 0;
padding: 0;
background: none;
cursor: pointer;
outline: none;
-webkit-transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
-webkit-transform: translateX(100%);
transform: translateX(100%);
transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
color: #eee;
}
#aiosrs-pro-license-form-close-btn:hover {
color: #00a0d2;
}
#aiosrs-pro-license-form-close-btn .dashicons {
display: block;
text-align: center;
line-height: 29px;
width: 29px;
height: 29px;
font-size: 29px;
position: absolute;
top: 0;
right: 0;
}
#aiosrs-pro-license-form .license-form-field input.regular-text {
margin-right: 10px;
}
/** Validation Messages */
.bsf-current-license-error-wp-schema-pro,
.bsf-current-license-success-wp-schema-pro {
display: block;
margin-bottom: 0.5em;
}
.bsf-current-license-error-wp-schema-pro {
color: #f44336;
}
.bsf-current-license-success-wp-schema-pro {
color: #008000;
}
/** License link */
#aiosrs-pro-license-form-btn.active {
color: #3db634;
}
#aiosrs-pro-license-form-btn.inactive {
color: #f44336;
}
body.aiosrs-pro-license-form-open {
overflow: hidden;
}
#aiosrs-pro-license-form p {
padding: 5px 0 5px 0;
}
#aiosrs-pro-license-form .aiosrs-pro-license-form-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
#aiosrs-pro-license-form .aiosrs-pro-license-form-inner {
background: #fcfcfc;
position: fixed;
background-color: #fff;
z-index: 999999999;
padding: 2px 20px 20px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}
#aiosrs-pro-license-form-close-btn {
position: absolute;
left: auto;
right: 0;
top: 0;
width: 29px;
height: 29px;
border: 0;
padding: 0;
background: none;
cursor: pointer;
outline: none;
-webkit-transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
-webkit-transform: translateX(100%);
transform: translateX(100%);
transition: color 0.1s ease-in-out, background 0.1s ease-in-out;
color: #eee;
}
#aiosrs-pro-license-form-close-btn:hover {
color: #00a0d2;
}
#aiosrs-pro-license-form-close-btn .dashicons {
display: block;
text-align: center;
line-height: 29px;
width: 29px;
height: 29px;
font-size: 29px;
position: absolute;
top: 0;
right: 0;
}
#aiosrs-pro-license-form .license-form-field input.regular-text {
margin-right: 10px;
}
/** Validation Messages */
.bsf-current-license-error-wp-schema-pro,
.bsf-current-license-success-wp-schema-pro {
display: block;
margin-bottom: 0.5em;
}
.bsf-current-license-error-wp-schema-pro {
color: #f44336;
}
.bsf-current-license-success-wp-schema-pro {
color: #008000;
}
/** License link */
#aiosrs-pro-license-form-btn.active {
color: #3db634;
}
#aiosrs-pro-license-form-btn.inactive {
color: #f44336;
}
@@ -1,460 +1,460 @@
.bsf-aiosrs-pro {
max-width: 1200px;
}
.bsf-aiosrs-pro .aiosrs-help-link {
font-size: 1.2em;
}
.bsf-aiosrs-pro .aiosrs-help-link:focus {
box-shadow: none;
}
.bsf-aiosrs-pro .form-table th {
width: 280px;
}
.bsf-aiosrs-pro .form-table td.schema-contact-type-option {
display: block;
}
.bsf-aiosrs-pro .form-table td.schema-contact-type-option-change {
margin-bottom: unset;
padding-bottom: 0;
}
.sp-required {
color: #dc3232;
font-size: 14px;
margin-left: 2px;
}
.bsf-aiosrs-pro .select2-selection__choice {
line-height: 1.7;
}
.bsf-aiosrs-pro .select2-container * {
vertical-align: middle;
}
.bsf-aiosrs-pro .select2-container .select2-selection__choice__remove {
vertical-align: initial;
}
.wp-schema-pro-global-schemas .form-table select,
.wp-schema-pro-general-settings .form-table input[type="text"],
.wp-schema-pro-general-settings .form-table select,
.wp-schema-pro-breadcrumb-setting .form-table select,
.wp-schema-pro-advanced-settings .form-table select,
.wp-schema-pro-social-profiles .form-table input[type="url"] {
min-width: 50%;
}
.wp-schema-pro-corporate-contact .form-table input[type="url"],
.wp-schema-pro-corporate-contact .form-table input[type="text"],
.wp-schema-pro-corporate-contact .form-table input[type="email"],
.wp-schema-pro-corporate-contact .form-table select {
min-width: 64%;
}
#wp-schema-pro-setting-links {
margin-top: 10px;
margin-left: 5px;
}
#wp-schema-pro-setting-links a {
text-decoration: none;
box-shadow: none;
}
#wp-schema-pro-setting-links a.active {
color: inherit;
pointer-events: none;
font-weight: 600;
}
.wp-schema-pro-general-settings .custom-field-wrapper {
display: inline-block;
width: 48%;
vertical-align: middle;
}
.wp-schema-pro-general-settings .site-logo-custom-wrap {
vertical-align: top;
}
/**
* Custom Image Select
*/
.wp-schema-pro-general-settings .image-field-wrap,
.wp-schema-pro-advanced-settings .image-field-wrap {
position: relative;
display: inline-block;
}
.wp-schema-pro-general-settings .aiosrs-image-select .dashicons,
.wp-schema-pro-advanced-settings .aiosrs-image-select .dashicons {
font-size: 1.2em;
width: 1em;
height: 1em;
line-height: 16px;
margin-right: 5px;
vertical-align: middle;
}
.wp-schema-pro-general-settings .aiosrs-image-remove,
.wp-schema-pro-advanced-settings .aiosrs-image-remove {
display: none;
position: absolute;
background: rgba(255, 255, 255, 0.7);
right: 0;
font-size: 15px;
width: 1em;
height: 1em;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select {
display: none;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-remove,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-remove {
display: inline-block;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img {
max-width: 100%;
display: inline-block;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img img {
max-height: 75px;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img img,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img img {
vertical-align: middle;
max-width: 300px;
}
/**
* Default Image
*/
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img img,
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.default-image.img img {
max-height: 150px;
}
/**
* Repeater Style
*/
.aiosrs-pro-repeater-table-wrap {
position: relative;
margin-bottom: 1em;
border: 1px solid #f1f1f1;
padding: 10px;
}
.aiosrs-pro-repeater-table-wrap .bsf-repeater-close {
position: absolute;
top: 0;
right: 0;
padding: 2px;
border: 1px solid #f1f1f1;
}
.bsf-repeater-add-new-btn {
float: right;
width: 100px;
}
.aiosrs-pro-repeater-table-wrap .form-table th,
.aiosrs-pro-repeater-table-wrap .form-table td {
border: 0;
padding: 0;
width: 100%;
display: inline-block;
}
.aiosrs-pro-repeater-table-wrap .form-table td input,
.aiosrs-pro-repeater-table-wrap .form-table td select {
min-width: 70%;
}
.bsf-aiosrs-schema-type-wrap .aiosrs-pro-repeater-table-wrap:first-of-type:last-of-type .bsf-repeater-close {
opacity: 0.3;
filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
pointer-events: none;
}
/**
* Tooltip
*/
.wp-schema-pro-tooltip-wrapper {
position: relative;
display: inline-block;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
opacity: 0;
visibility: hidden;
transition: 0.3s;
position: absolute;
background: #333;
color: #dedede;
left: calc(100% - 2.4em);
bottom: calc(100% - 0.75em);
border-radius: 3px;
box-shadow: 0 0 1px 0 #333;
font-weight: 400;
min-width: 300px;
z-index: 9999;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
cursor: pointer;
font-size: 18px;
}
.wp-schema-pro-tooltip-wrapper.activate .wp-schema-pro-tooltip-icon {
pointer-events: none;
}
.wp-schema-pro-tooltip-wrapper .dashicons.dashicons-arrow-down {
position: absolute;
font-size: 3em;
top: calc(100% - 0.5em);
left: 0;
color: #333;
line-height: initial;
z-index: -1;
}
.wp-schema-pro-tooltip-wrapper.activate .wp-schema-pro-tooltip-description {
opacity: 1;
visibility: visible;
bottom: calc(100% + 0.75em);
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content {
padding: 8px 12px;
}
.wp-schema-pro-tooltip-wrapper h2.wp-schema-pro-tooltip-heading ~ .wp-schema-pro-tooltip-content {
min-height: 50px;
}
.wp-schema-pro-tooltip-wrapper h2.wp-schema-pro-tooltip-heading {
color: #dedede;
font-weight: 600;
border-bottom: 1px solid #eee;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content a {
text-decoration: none;
box-shadow: none;
font-size: inherit;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content img {
max-width: 100%;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content .tooltip-image {
margin-top: 10px;
}
.tooltip-with-image-wrapper .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
min-width: 400px;
}
.rtl .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
right: calc(100% - 2.4em);
left: 0;
}
.rtl .wp-schema-pro-tooltip-wrapper .dashicons.dashicons-arrow-down {
right: 0;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
color: #f00;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon::before {
content: "\f534";
}
.wp-schema-pro-yoast-compatibilty-wrap th {
display: flex;
}
.wp-schema-pro-yoast-compatibilty-wrap td {
vertical-align: top;
padding-top: 20px;
}
.wp-schema-pro-tooltip-content ol {
margin-top: 0.5em;
}
.schema-branding input::placeholder,
.contact-form input::placeholder {
font-style: italic;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-logo {
vertical-align: middle;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-title {
display: inline-block;
font-size: 20px;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-logo img {
max-width: 12%;
margin: 20px 3px 20px 0;
}
#aiosrs-menu-page .schema-version {
font-size: 13px;
background-color: #fff;
padding: 2px;
}
.form-table td.breadcrumb-title {
padding: 0;
}
.wpsp-required-error-field {
color: #f00 !important;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr {
width: 50%;
display: inline-block;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr td input {
width: 135%;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr th {
width: 34%;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr:last-child {
width: auto;
display: block;
}
.wpsp-text-strong {
font-weight: 700;
}
.bsf-aiosrs-pro .postbox.wp-schema-pro-general-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-breadcrumb-setting .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-advanced-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-branding-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-social-profiles .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-corporate-contact .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-global-schemas .hndle,
.bsf-aiosrs-pro .postbox-container .postbox .hndle {
border-bottom: 1px solid #ccd0d4;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single {
box-shadow: 0 0 0 transparent;
border-radius: 4px;
padding: 0.5em;
font-size: 14px;
height: 33px;
border: 1px solid #7e8993;
background-color: #fff;
color: #32373c;
}
.wp-schema-pro-general-settings .select2.select2-container.select2-container--default {
width: 50% !important;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single .select2-selection__rendered {
color: unset;
line-height: unset;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single .select2-selection__arrow {
top: 4px;
}
.select2-container--default .select2-selection.select2-selection--single:focus {
border-color: #007cba;
box-shadow: 0 0 0 1px #007cba;
outline: 2px solid transparent;
}
/**
* dynamic social profile repeater.
*/
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr th.wpsp-other-th {
width: 33% !important;
}
a#add-row {
float: right;
margin-right: 30px;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr td input.wpsp-other {
width: 132% !important;
}
span.wpsp-field-close.dashicons.dashicons-dismiss {
color: #999;
cursor: pointer;
display: inline-flex;
font-size: 18px;
justify-content: center;
position: relative;
top: -22px;
left: 140%;
width: 5px;
}
@media screen and ( min-width: 783px) {
.wp-schema-pro-tooltip-wrapper {
float: right;
}
.rtl .wp-schema-pro-tooltip-wrapper {
float: left;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
min-width: 400px;
}
.hndle .wp-schema-pro-tooltip-wrapper {
float: none;
}
}
@-moz-document url-prefix() {
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr {
width: 50%;
float: left;
}
}
.bsf-aiosrs-pro {
max-width: 1200px;
}
.bsf-aiosrs-pro .aiosrs-help-link {
font-size: 1.2em;
}
.bsf-aiosrs-pro .aiosrs-help-link:focus {
box-shadow: none;
}
.bsf-aiosrs-pro .form-table th {
width: 280px;
}
.bsf-aiosrs-pro .form-table td.schema-contact-type-option {
display: block;
}
.bsf-aiosrs-pro .form-table td.schema-contact-type-option-change {
margin-bottom: unset;
padding-bottom: 0;
}
.sp-required {
color: #dc3232;
font-size: 14px;
margin-left: 2px;
}
.bsf-aiosrs-pro .select2-selection__choice {
line-height: 1.7;
}
.bsf-aiosrs-pro .select2-container * {
vertical-align: middle;
}
.bsf-aiosrs-pro .select2-container .select2-selection__choice__remove {
vertical-align: initial;
}
.wp-schema-pro-global-schemas .form-table select,
.wp-schema-pro-general-settings .form-table input[type="text"],
.wp-schema-pro-general-settings .form-table select,
.wp-schema-pro-breadcrumb-setting .form-table select,
.wp-schema-pro-advanced-settings .form-table select,
.wp-schema-pro-social-profiles .form-table input[type="url"] {
min-width: 50%;
}
.wp-schema-pro-corporate-contact .form-table input[type="url"],
.wp-schema-pro-corporate-contact .form-table input[type="text"],
.wp-schema-pro-corporate-contact .form-table input[type="email"],
.wp-schema-pro-corporate-contact .form-table select {
min-width: 64%;
}
#wp-schema-pro-setting-links {
margin-top: 10px;
margin-left: 5px;
}
#wp-schema-pro-setting-links a {
text-decoration: none;
box-shadow: none;
}
#wp-schema-pro-setting-links a.active {
color: inherit;
pointer-events: none;
font-weight: 600;
}
.wp-schema-pro-general-settings .custom-field-wrapper {
display: inline-block;
width: 48%;
vertical-align: middle;
}
.wp-schema-pro-general-settings .site-logo-custom-wrap {
vertical-align: top;
}
/**
* Custom Image Select
*/
.wp-schema-pro-general-settings .image-field-wrap,
.wp-schema-pro-advanced-settings .image-field-wrap {
position: relative;
display: inline-block;
}
.wp-schema-pro-general-settings .aiosrs-image-select .dashicons,
.wp-schema-pro-advanced-settings .aiosrs-image-select .dashicons {
font-size: 1.2em;
width: 1em;
height: 1em;
line-height: 16px;
margin-right: 5px;
vertical-align: middle;
}
.wp-schema-pro-general-settings .aiosrs-image-remove,
.wp-schema-pro-advanced-settings .aiosrs-image-remove {
display: none;
position: absolute;
background: rgba(255, 255, 255, 0.7);
right: 0;
font-size: 15px;
width: 1em;
height: 1em;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select {
display: none;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-remove,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-remove {
display: inline-block;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img {
max-width: 100%;
display: inline-block;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img img {
max-height: 75px;
}
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.img img,
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img img {
vertical-align: middle;
max-width: 300px;
}
/**
* Default Image
*/
.wp-schema-pro-advanced-settings .bsf-custom-image-selected .aiosrs-image-select.img img,
.wp-schema-pro-general-settings .bsf-custom-image-selected .aiosrs-image-select.default-image.img img {
max-height: 150px;
}
/**
* Repeater Style
*/
.aiosrs-pro-repeater-table-wrap {
position: relative;
margin-bottom: 1em;
border: 1px solid #f1f1f1;
padding: 10px;
}
.aiosrs-pro-repeater-table-wrap .bsf-repeater-close {
position: absolute;
top: 0;
right: 0;
padding: 2px;
border: 1px solid #f1f1f1;
}
.bsf-repeater-add-new-btn {
float: right;
width: 100px;
}
.aiosrs-pro-repeater-table-wrap .form-table th,
.aiosrs-pro-repeater-table-wrap .form-table td {
border: 0;
padding: 0;
width: 100%;
display: inline-block;
}
.aiosrs-pro-repeater-table-wrap .form-table td input,
.aiosrs-pro-repeater-table-wrap .form-table td select {
min-width: 70%;
}
.bsf-aiosrs-schema-type-wrap .aiosrs-pro-repeater-table-wrap:first-of-type:last-of-type .bsf-repeater-close {
opacity: 0.3;
filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
pointer-events: none;
}
/**
* Tooltip
*/
.wp-schema-pro-tooltip-wrapper {
position: relative;
display: inline-block;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
opacity: 0;
visibility: hidden;
transition: 0.3s;
position: absolute;
background: #333;
color: #dedede;
left: calc(100% - 2.4em);
bottom: calc(100% - 0.75em);
border-radius: 3px;
box-shadow: 0 0 1px 0 #333;
font-weight: 400;
min-width: 300px;
z-index: 9999;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
cursor: pointer;
font-size: 18px;
}
.wp-schema-pro-tooltip-wrapper.activate .wp-schema-pro-tooltip-icon {
pointer-events: none;
}
.wp-schema-pro-tooltip-wrapper .dashicons.dashicons-arrow-down {
position: absolute;
font-size: 3em;
top: calc(100% - 0.5em);
left: 0;
color: #333;
line-height: initial;
z-index: -1;
}
.wp-schema-pro-tooltip-wrapper.activate .wp-schema-pro-tooltip-description {
opacity: 1;
visibility: visible;
bottom: calc(100% + 0.75em);
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content {
padding: 8px 12px;
}
.wp-schema-pro-tooltip-wrapper h2.wp-schema-pro-tooltip-heading ~ .wp-schema-pro-tooltip-content {
min-height: 50px;
}
.wp-schema-pro-tooltip-wrapper h2.wp-schema-pro-tooltip-heading {
color: #dedede;
font-weight: 600;
border-bottom: 1px solid #eee;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content a {
text-decoration: none;
box-shadow: none;
font-size: inherit;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content img {
max-width: 100%;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-content .tooltip-image {
margin-top: 10px;
}
.tooltip-with-image-wrapper .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
min-width: 400px;
}
.rtl .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
right: calc(100% - 2.4em);
left: 0;
}
.rtl .wp-schema-pro-tooltip-wrapper .dashicons.dashicons-arrow-down {
right: 0;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
color: #f00;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon::before {
content: "\f534";
}
.wp-schema-pro-yoast-compatibilty-wrap th {
display: flex;
}
.wp-schema-pro-yoast-compatibilty-wrap td {
vertical-align: top;
padding-top: 20px;
}
.wp-schema-pro-tooltip-content ol {
margin-top: 0.5em;
}
.schema-branding input::placeholder,
.contact-form input::placeholder {
font-style: italic;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-logo {
vertical-align: middle;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-title {
display: inline-block;
font-size: 20px;
}
.aiosrs-menu-page-wrapper #aiosrs-menu-page .wrap .wpsp-pro-logo img {
max-width: 12%;
margin: 20px 3px 20px 0;
}
#aiosrs-menu-page .schema-version {
font-size: 13px;
background-color: #fff;
padding: 2px;
}
.form-table td.breadcrumb-title {
padding: 0;
}
.wpsp-required-error-field {
color: #f00 !important;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr {
width: 50%;
display: inline-block;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr td input {
width: 135%;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr th {
width: 34%;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr:last-child {
width: auto;
display: block;
}
.wpsp-text-strong {
font-weight: 700;
}
.bsf-aiosrs-pro .postbox.wp-schema-pro-general-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-breadcrumb-setting .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-advanced-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-branding-settings .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-social-profiles .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-corporate-contact .hndle,
.bsf-aiosrs-pro .postbox.wp-schema-pro-global-schemas .hndle,
.bsf-aiosrs-pro .postbox-container .postbox .hndle {
border-bottom: 1px solid #ccd0d4;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single {
box-shadow: 0 0 0 transparent;
border-radius: 4px;
padding: 0.5em;
font-size: 14px;
height: 33px;
border: 1px solid #7e8993;
background-color: #fff;
color: #32373c;
}
.wp-schema-pro-general-settings .select2.select2-container.select2-container--default {
width: 50% !important;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single .select2-selection__rendered {
color: unset;
line-height: unset;
}
.wp-schema-pro-general-settings .select2-container--default .select2-selection--single .select2-selection__arrow {
top: 4px;
}
.select2-container--default .select2-selection.select2-selection--single:focus {
border-color: #007cba;
box-shadow: 0 0 0 1px #007cba;
outline: 2px solid transparent;
}
/**
* dynamic social profile repeater.
*/
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr th.wpsp-other-th {
width: 33% !important;
}
a#add-row {
float: right;
margin-right: 30px;
}
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr td input.wpsp-other {
width: 132% !important;
}
span.wpsp-field-close.dashicons.dashicons-dismiss {
color: #999;
cursor: pointer;
display: inline-flex;
font-size: 18px;
justify-content: center;
position: relative;
top: -22px;
left: 140%;
width: 5px;
}
@media screen and ( min-width: 783px) {
.wp-schema-pro-tooltip-wrapper {
float: right;
}
.rtl .wp-schema-pro-tooltip-wrapper {
float: left;
}
.hndle .wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-description {
min-width: 400px;
}
.hndle .wp-schema-pro-tooltip-wrapper {
float: none;
}
}
@-moz-document url-prefix() {
.bsf-aiosrs-pro .wp-schema-pro-social-profiles table.form-table tr {
width: 50%;
float: left;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,388 +1,388 @@
/* Meta Box Heading
------------------------------------------------------*/
#aiosrs-schema-settings .inside {
margin: 0;
padding: 0;
}
#aiosrs-schema-settings .nav-tab-wrapper {
border-bottom: 0;
}
#aiosrs-schema-settings .nav-tab-wrapper ul {
margin: 0;
}
/* Tooltips */
.bsf-aiosrs-schema-heading-help {
color: #0073aa;
float: unset;
font-size: 18px;
cursor: help;
}
.ui-widget-content.bsf-aiosrs-schema-ui-tooltip {
background: #333;
border-width: 1px;
border-color: #333;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 1px 0 2px 0 rgba(214, 214, 214, 0.5);
box-shadow: 1px 0 2px 0 rgba(214, 214, 214, 0.5);
color: #dedede;
max-width: 250px;
text-align: center;
padding: 7px;
text-rendering: optimizeLegibility;
text-shadow: none;
z-index: 9999;
}
/* Table */
.bsf-aiosrs-schema-table {
border: none;
border-bottom: 5px solid #f0f0f0;
}
.bsf-aiosrs-schema-table:last-of-type {
border-bottom-width: 0;
}
.bsf-aiosrs-schema-table.widefat {
border-width: 0;
border-bottom-width: 2px;
}
.bsf-aiosrs-schema-table.widefat:last-child {
border-bottom-width: 1px;
}
/* Rows */
.bsf-aiosrs-schema-row td::before,
.bsf-aiosrs-schema-row td::after {
display: table;
content: " ";
}
.bsf-aiosrs-schema-row td::after {
clear: both;
}
.bsf-aiosrs-schema-row td {
zoom: 1;
vertical-align: middle;
}
.bsf-aiosrs-schema-row td * {
vertical-align: middle;
}
.bsf-aiosrs-schema-row:last-child td {
border-bottom: none;
}
/* Row Heading */
.bsf-aiosrs-schema-row-heading {
border-right: 1px solid #e1e1e1;
padding: 15px;
width: 25%;
vertical-align: middle;
}
.bsf-aiosrs-schema-row td.bsf-aiosrs-schema-row-heading.title {
padding-bottom: 0;
border-bottom: 0;
}
.bsf-aiosrs-schema-row-heading label {
display: inline-block;
font-size: 13px;
line-height: 22px;
font-weight: 700;
padding: 0;
margin: 0 0 3px;
color: #333;
}
/* Row Content */
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-row-content {
padding: 15px 10px;
position: relative;
width: 75%;
}
.bsf-aiosrs-schema-row-content p:last-child {
margin-bottom: 0;
}
.bsf-aiosrs-schema-padding {
width: 110px;
}
.bsf-aiosrs-schema-padding-bottom-wrap {
margin-top: 5px;
}
/* Row Inputs */
.bsf-aiosrs-schema-row-content select {
width: 100%;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-action-desc.ast-no-desc {
margin-top: 0;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-action-desc {
margin-top: 10px;
}
/*Title CSS for the Enable on*/
.bsf-aiosrs-schema-row-select-target h2.bsf-aiosrs-schema-row-heading-select-target {
border-bottom: 1px solid #ccd0d4;
font-weight: 600 !important;
padding: 10px 12px !important;
}
.bsf-aiosrs-schema-row-select-target h2.bsf-aiosrs-schema-row-heading-select-target label {
vertical-align: initial;
}
/* Settings Meta Box
------------------------------------------------------*/
#bsf-aiosrs-schema-settings .inside {
margin: 0;
padding: 0;
}
/* Builder Buttons Meta Box
------------------------------------------------------*/
#bsf-aiosrs-schema-buttons .inside {
margin: 0;
padding: 15px;
}
#bsf-aiosrs-schema-buttons .button {
margin-right: 5px;
}
/* Rule Settings
------------------------------------------------------*/
/* Rule Forms */
.bsf-aiosrs-schema-saved-rule {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
padding: 0 0 8px 0;
}
.bsf-aiosrs-schema-saved-rule-select {
width: 100%;
}
.bsf-aiosrs-schema-rule-objects {
display: none;
}
.bsf-aiosrs-schema-rule-objects-visible {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-rule-objects-visible select {
width: 50%;
}
.bsf-aiosrs-schema-rule-objects-visible .bsf-aiosrs-schema-rule-objects {
display: inline;
margin-left: 7px;
}
.bsf-aiosrs-schema-remove-rule-button {
display: none;
margin-top: 5px;
text-align: right;
width: 33px;
}
.bsf-aiosrs-schema-remove-rule {
color: #000;
cursor: pointer;
opacity: 0.2;
}
.bsf-aiosrs-schema-remove-rule:hover {
color: #d54e21;
opacity: 1;
}
.bsf-aiosrs-schema-add-rule {
float: left;
margin-right: 8px;
min-width: 150px;
}
.bsf-aiosrs-schema-add-rule .button {
text-align: center;
width: 100%;
}
/* Location Rules */
.bsf-aiosrs-schema-locations-form {
display: none;
}
/* Exclusion Rules */
.bsf-aiosrs-schema-exclusion-rules {
display: none;
}
/* Color Picker */
.bsf-aiosrs-schema-row .wp-picker-holder {
position: absolute;
z-index: 1;
}
.bsf-aiosrs-schema-row .iris-border .iris-picker-inner {
right: 0;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-type {
width: auto;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-fixed-text-wrap,
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-custom-text-wrap {
width: calc(55% - 5px);
display: inline-block;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-meta-field {
width: calc(45% - 5px);
display: inline-block;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-custom-text-wrap input {
width: 100%;
}
.bsf-aiosrs-schema-table .bsf-custom-remove-image,
.bsf-aiosrs-schema-table .update-custom-image,
.bsf-aiosrs-schema-table .bsf-hidden-field,
.bsf-custom-image-selected button.bsf-custom-select-image {
display: none;
}
.bsf-custom-image-selected .bsf-custom-remove-image {
display: inline-block;
}
.select-custom-image,
.bsf-custom-image-selected .update-custom-image {
display: block;
}
.bsf-custom-remove-image .dashicons {
padding: 0;
}
.bsf-custom-image-label {
margin-left: 5px;
display: inline-block;
}
.bsf-aiosrs-schema-specific-field-wrap {
display: inline-block;
width: 50%;
}
.bsf-aiosrs-guideline-link i {
font-size: 1rem;
width: auto;
}
/**
* Repeater Style
*/
.aiosrs-pro-repeater-table {
width: 100%;
border: 1px solid #f1f1f1;
padding: 10px;
}
.aiosrs-pro-repeater-table-wrap {
position: relative;
margin-bottom: 1em;
}
.bsf-aiosrs-schema-row:first-child {
line-height: 0;
height: 0;
}
.bsf-repeater-close {
position: absolute;
top: 0;
right: 0;
padding: 2px;
border: 1px solid #f1f1f1;
}
.bsf-repeater-add-new-btn {
float: right;
width: 100px;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-heading,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-content {
border: 0;
padding: 0;
width: 100%;
display: inline-block;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-heading label,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-content {
line-height: 1;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row td::before,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row td::after {
display: none;
}
.bsf-aiosrs-schema-type-wrap .aiosrs-pro-repeater-table-wrap:first-of-type:last-of-type .bsf-repeater-close {
opacity: 0.3;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
pointer-events: none;
}
.bsf-aiosrs-schema-row-repeater-type > .bsf-aiosrs-schema-row-heading {
vertical-align: top;
padding-top: 25px;
}
.wp-schema-pro-tooltip-wrapper {
font-size: 14px;
line-height: 18px;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
line-height: 1.5;
vertical-align: middle;
}
.aiosrs-pro-setup-wizard-content.advanced-settings-content-wrap .label-wrapper {
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
/* Meta Box Heading
------------------------------------------------------*/
#aiosrs-schema-settings .inside {
margin: 0;
padding: 0;
}
#aiosrs-schema-settings .nav-tab-wrapper {
border-bottom: 0;
}
#aiosrs-schema-settings .nav-tab-wrapper ul {
margin: 0;
}
/* Tooltips */
.bsf-aiosrs-schema-heading-help {
color: #0073aa;
float: right;
font-size: 18px;
cursor: help;
}
.ui-widget-content.bsf-aiosrs-schema-ui-tooltip {
background: #333;
border-width: 1px;
border-color: #333;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-shadow: 1px 0 2px 0 rgba(214, 214, 214, 0.5);
box-shadow: 1px 0 2px 0 rgba(214, 214, 214, 0.5);
color: #dedede;
max-width: 250px;
text-align: center;
padding: 7px;
text-rendering: optimizeLegibility;
text-shadow: none;
z-index: 9999;
}
/* Table */
.bsf-aiosrs-schema-table {
border: none;
border-bottom: 5px solid #f0f0f0;
}
.bsf-aiosrs-schema-table:last-of-type {
border-bottom-width: 0;
}
.bsf-aiosrs-schema-table.widefat {
border-width: 0;
border-bottom-width: 2px;
}
.bsf-aiosrs-schema-table.widefat:last-child {
border-bottom-width: 1px;
}
/* Rows */
.bsf-aiosrs-schema-row td::before,
.bsf-aiosrs-schema-row td::after {
display: table;
content: " ";
}
.bsf-aiosrs-schema-row td::after {
clear: both;
}
.bsf-aiosrs-schema-row td {
zoom: 1;
vertical-align: middle;
}
.bsf-aiosrs-schema-row td * {
vertical-align: middle;
}
.bsf-aiosrs-schema-row:last-child td {
border-bottom: none;
}
/* Row Heading */
.bsf-aiosrs-schema-row-heading {
border-right: 1px solid #e1e1e1;
padding: 15px;
width: 25%;
vertical-align: middle;
}
.bsf-aiosrs-schema-row td.bsf-aiosrs-schema-row-heading.title {
padding-bottom: 0;
border-bottom: 0;
}
.bsf-aiosrs-schema-row-heading label {
display: inline-block;
font-size: 13px;
line-height: 22px;
font-weight: 700;
padding: 0;
margin: 0 0 3px;
color: #333;
}
/* Row Content */
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-row-content {
padding: 15px 10px;
position: relative;
width: 75%;
}
.bsf-aiosrs-schema-row-content p:last-child {
margin-bottom: 0;
}
.bsf-aiosrs-schema-padding {
width: 110px;
}
.bsf-aiosrs-schema-padding-bottom-wrap {
margin-top: 5px;
}
/* Row Inputs */
.bsf-aiosrs-schema-row-content select {
width: 100%;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-action-desc.ast-no-desc {
margin-top: 0;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-action-desc {
margin-top: 10px;
}
/*Title CSS for the Enable on*/
.bsf-aiosrs-schema-row-select-target h2.bsf-aiosrs-schema-row-heading-select-target {
border-bottom: 1px solid #ccd0d4;
font-weight: 600 !important;
padding: 10px 12px !important;
}
.bsf-aiosrs-schema-row-select-target h2.bsf-aiosrs-schema-row-heading-select-target label {
vertical-align: initial;
}
/* Settings Meta Box
------------------------------------------------------*/
#bsf-aiosrs-schema-settings .inside {
margin: 0;
padding: 0;
}
/* Builder Buttons Meta Box
------------------------------------------------------*/
#bsf-aiosrs-schema-buttons .inside {
margin: 0;
padding: 15px;
}
#bsf-aiosrs-schema-buttons .button {
margin-right: 5px;
}
/* Rule Settings
------------------------------------------------------*/
/* Rule Forms */
.bsf-aiosrs-schema-saved-rule {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
padding: 0 0 8px 0;
}
.bsf-aiosrs-schema-saved-rule-select {
width: 100%;
}
.bsf-aiosrs-schema-rule-objects {
display: none;
}
.bsf-aiosrs-schema-rule-objects-visible {
-js-display: flex;
display: -webkit-box;
display: -webkit-flex;
display: -moz-box;
display: -ms-flexbox;
display: flex;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-rule-objects-visible select {
width: 50%;
}
.bsf-aiosrs-schema-rule-objects-visible .bsf-aiosrs-schema-rule-objects {
display: inline;
margin-left: 7px;
}
.bsf-aiosrs-schema-remove-rule-button {
display: none;
margin-top: 5px;
text-align: right;
width: 33px;
}
.bsf-aiosrs-schema-remove-rule {
color: #000;
cursor: pointer;
opacity: 0.2;
}
.bsf-aiosrs-schema-remove-rule:hover {
color: #d54e21;
opacity: 1;
}
.bsf-aiosrs-schema-add-rule {
float: left;
margin-right: 8px;
min-width: 150px;
}
.bsf-aiosrs-schema-add-rule .button {
text-align: center;
width: 100%;
}
/* Location Rules */
.bsf-aiosrs-schema-locations-form {
display: none;
}
/* Exclusion Rules */
.bsf-aiosrs-schema-exclusion-rules {
display: none;
}
/* Color Picker */
.bsf-aiosrs-schema-row .wp-picker-holder {
position: absolute;
z-index: 1;
}
.bsf-aiosrs-schema-row .iris-border .iris-picker-inner {
right: 0;
}
.bsf-aiosrs-schema-row-content .bsf-aiosrs-schema-type {
width: auto;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-fixed-text-wrap,
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-custom-text-wrap {
width: calc(55% - 5px);
display: inline-block;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-meta-field {
width: calc(45% - 5px);
display: inline-block;
}
.bsf-aiosrs-schema-table .bsf-aiosrs-schema-custom-text-wrap input {
width: 100%;
}
.bsf-aiosrs-schema-table .bsf-custom-remove-image,
.bsf-aiosrs-schema-table .update-custom-image,
.bsf-aiosrs-schema-table .bsf-hidden-field,
.bsf-custom-image-selected button.bsf-custom-select-image {
display: none;
}
.bsf-custom-image-selected .bsf-custom-remove-image {
display: inline-block;
}
.select-custom-image,
.bsf-custom-image-selected .update-custom-image {
display: block;
}
.bsf-custom-remove-image .dashicons {
padding: 0;
}
.bsf-custom-image-label {
margin-left: 5px;
display: inline-block;
}
.bsf-aiosrs-schema-specific-field-wrap {
display: inline-block;
width: 50%;
}
.bsf-aiosrs-guideline-link i {
font-size: 1rem;
width: auto;
}
/**
* Repeater Style
*/
.aiosrs-pro-repeater-table {
width: 100%;
border: 1px solid #f1f1f1;
padding: 10px;
}
.aiosrs-pro-repeater-table-wrap {
position: relative;
margin-bottom: 1em;
}
.bsf-aiosrs-schema-row:first-child {
line-height: 0;
height: 0;
}
.bsf-repeater-close {
position: absolute;
top: 0;
right: 0;
padding: 2px;
border: 1px solid #f1f1f1;
}
.bsf-repeater-add-new-btn {
float: right;
width: 100px;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-heading,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-content {
border: 0;
padding: 0;
width: 100%;
display: inline-block;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-heading label,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row-content {
line-height: 1;
}
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row td::before,
.aiosrs-pro-repeater-table .bsf-aiosrs-schema-row td::after {
display: none;
}
.bsf-aiosrs-schema-type-wrap .aiosrs-pro-repeater-table-wrap:first-of-type:last-of-type .bsf-repeater-close {
opacity: 0.3;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=30)";
pointer-events: none;
}
.bsf-aiosrs-schema-row-repeater-type > .bsf-aiosrs-schema-row-heading {
vertical-align: top;
padding-top: 25px;
}
.wp-schema-pro-tooltip-wrapper {
font-size: 14px;
line-height: 18px;
}
.wp-schema-pro-tooltip-wrapper .wp-schema-pro-tooltip-icon {
line-height: 1.5;
vertical-align: middle;
}
.aiosrs-pro-setup-wizard-content.advanced-settings-content-wrap .label-wrapper {
display: flex;
-webkit-box-pack: justify;
-ms-flex-pack: justify;
justify-content: space-between;
}
File diff suppressed because it is too large Load Diff
@@ -1,147 +1,147 @@
/* eslint-env jquery */
(function ($) {
/**
* AIOSRS Frontend
*
* @class WPSchemaProFrontend
* @since 1.0
*/
const WPSchemaProFrontend = {
/**
* Initializes a AIOSRS Frontend.
*
* @since 1.0
* @function init
*/
container: '',
init() {
const self = this;
jQuery(document).on(
'click',
'.aiosrs-rating-wrap .aiosrs-star-rating',
function (e) {
e.preventDefault();
self.star_rating(this);
}
);
jQuery(document).on(
'mouseover',
'.aiosrs-rating-wrap .aiosrs-star-rating',
function (e) {
e.preventDefault();
self.hover_star_rating(this);
}
);
jQuery(document).on(
'mouseout',
'.aiosrs-rating-wrap .aiosrs-star-rating-wrap',
function (e) {
e.preventDefault();
if (!$(this).hasClass('disabled')) {
const index = $(this)
.parent()
.find('.aiosrs-rating')
.text();
self.update_stars($(this), index);
}
}
);
},
hover_star_rating(field) {
const self = this,
parent = $(field).closest('.aiosrs-star-rating-wrap'),
index = $(field).data('index');
if (!parent.hasClass('disabled')) {
self.update_stars(parent, index);
}
},
update_stars(wrap, rating) {
let filled = rating > 5 ? 5 : parseInt(rating);
if (rating > 5) {
filled = 5;
} else if (rating < 0) {
filled = 0;
} else {
filled = parseInt(rating);
}
const half = rating === filled || rating > 5 || rating < 0 ? 0 : 1;
wrap.find('span').each(function (index) {
$(this).removeClass(
'dashicons-star-filled dashicons-star-half dashicons-star-empty'
);
if (index < filled) {
$(this).addClass('dashicons-star-filled');
} else if (index === filled && half === 1) {
$(this).addClass('dashicons-star-empty');
} else {
$(this).addClass('dashicons-star-empty');
}
});
},
star_rating(field) {
const self = this,
schemaId = $(field)
.closest('.aiosrs-rating-wrap')
.data('schema-id'),
parent = $(field).closest('.aiosrs-star-rating-wrap'),
index = $(field).data('index');
if (!parent.hasClass('disabled')) {
self.update_stars(parent, index);
parent.addClass('disabled');
$.ajax({
url: AIOSRS_Frontend.ajaxurl,
type: 'POST',
data: {
action: 'aiosrs_user_rating',
rating: index,
schemaId,
post_id: AIOSRS_Frontend.post_id,
nonce: AIOSRS_Frontend.user_rating_nonce,
},
}).success(function (response) {
if (response.success === true) {
const summaryWrap = parent.next(
'.aiosrs-rating-summary-wrap'
),
rating = response.rating,
avgRating = response['rating-avg'],
reviewCount = response['review-count'];
summaryWrap.find('.aiosrs-rating').text(avgRating);
summaryWrap
.find('.aiosrs-rating-count')
.text(reviewCount);
if (parent.next('.success-msg').length === 0) {
parent.after(
'<span class="success-msg">' +
AIOSRS_Frontend.success_msg +
'</span>'
);
}
setTimeout(function () {
parent.parent().find('.success-msg').remove();
parent.removeClass('disabled');
}, 5000);
self.update_stars(parent, rating);
}
});
}
},
};
/* Initializes the AIOSRS Frontend. */
$(function () {
WPSchemaProFrontend.init();
});
})(jQuery);
/* eslint-env jquery */
(function ($) {
/**
* AIOSRS Frontend
*
* @class WPSchemaProFrontend
* @since 1.0
*/
const WPSchemaProFrontend = {
/**
* Initializes a AIOSRS Frontend.
*
* @since 1.0
* @function init
*/
container: '',
init() {
const self = this;
jQuery(document).on(
'click',
'.aiosrs-rating-wrap .aiosrs-star-rating',
function (e) {
e.preventDefault();
self.star_rating(this);
}
);
jQuery(document).on(
'mouseover',
'.aiosrs-rating-wrap .aiosrs-star-rating',
function (e) {
e.preventDefault();
self.hover_star_rating(this);
}
);
jQuery(document).on(
'mouseout',
'.aiosrs-rating-wrap .aiosrs-star-rating-wrap',
function (e) {
e.preventDefault();
if (!$(this).hasClass('disabled')) {
const index = $(this)
.parent()
.find('.aiosrs-rating')
.text();
self.update_stars($(this), index);
}
}
);
},
hover_star_rating(field) {
const self = this,
parent = $(field).closest('.aiosrs-star-rating-wrap'),
index = $(field).data('index');
if (!parent.hasClass('disabled')) {
self.update_stars(parent, index);
}
},
update_stars(wrap, rating) {
let filled = rating > 5 ? 5 : parseInt(rating);
if (rating > 5) {
filled = 5;
} else if (rating < 0) {
filled = 0;
} else {
filled = parseInt(rating);
}
const half = rating === filled || rating > 5 || rating < 0 ? 0 : 1;
wrap.find('span').each(function (index) {
$(this).removeClass(
'dashicons-star-filled dashicons-star-half dashicons-star-empty'
);
if (index < filled) {
$(this).addClass('dashicons-star-filled');
} else if (index === filled && half === 1) {
$(this).addClass('dashicons-star-empty');
} else {
$(this).addClass('dashicons-star-empty');
}
});
},
star_rating(field) {
const self = this,
schemaId = $(field)
.closest('.aiosrs-rating-wrap')
.data('schema-id'),
parent = $(field).closest('.aiosrs-star-rating-wrap'),
index = $(field).data('index');
if (!parent.hasClass('disabled')) {
self.update_stars(parent, index);
parent.addClass('disabled');
$.ajax({
url: AIOSRS_Frontend.ajaxurl,
type: 'POST',
data: {
action: 'aiosrs_user_rating',
rating: index,
schemaId,
post_id: AIOSRS_Frontend.post_id,
nonce: AIOSRS_Frontend.user_rating_nonce,
},
}).success(function (response) {
if (response.success === true) {
const summaryWrap = parent.next(
'.aiosrs-rating-summary-wrap'
),
rating = response.rating,
avgRating = response['rating-avg'],
reviewCount = response['review-count'];
summaryWrap.find('.aiosrs-rating').text(avgRating);
summaryWrap
.find('.aiosrs-rating-count')
.text(reviewCount);
if (parent.next('.success-msg').length === 0) {
parent.after(
'<span class="success-msg">' +
AIOSRS_Frontend.success_msg +
'</span>'
);
}
setTimeout(function () {
parent.parent().find('.success-msg').remove();
parent.removeClass('disabled');
}, 5000);
self.update_stars(parent, rating);
}
});
}
},
};
/* Initializes the AIOSRS Frontend. */
$(function () {
WPSchemaProFrontend.init();
});
})(jQuery);
@@ -1,26 +1,26 @@
/* eslint-env jquery */
jQuery( document ).ready( function () {
jQuery( '#aiosrs-pro-license-form-btn' ).on( 'click', function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).show();
jQuery( 'body' ).addClass( 'aiosrs-pro-license-form-open' );
} );
jQuery( '#aiosrs-pro-license-form-close-btn' ).on( 'click', function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).hide();
jQuery( 'body' ).removeClass( 'aiosrs-pro-license-form-open' );
} );
jQuery( '#aiosrs-pro-license-form .aiosrs-pro-license-form-overlay' ).on(
'click',
function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).hide();
jQuery( 'body' ).removeClass( 'aiosrs-pro-license-form-open' );
}
);
} );
/* eslint-env jquery */
jQuery( document ).ready( function () {
jQuery( '#aiosrs-pro-license-form-btn' ).on( 'click', function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).show();
jQuery( 'body' ).addClass( 'aiosrs-pro-license-form-open' );
} );
jQuery( '#aiosrs-pro-license-form-close-btn' ).on( 'click', function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).hide();
jQuery( 'body' ).removeClass( 'aiosrs-pro-license-form-open' );
} );
jQuery( '#aiosrs-pro-license-form .aiosrs-pro-license-form-overlay' ).on(
'click',
function ( e ) {
e.preventDefault();
jQuery( '#aiosrs-pro-license-form' ).hide();
jQuery( 'body' ).removeClass( 'aiosrs-pro-license-form-open' );
}
);
} );
File diff suppressed because it is too large Load Diff
@@ -1,415 +1,415 @@
/* eslint-env jquery */
(function ($) {
const { __ } = wp.i18n;
const temp = {
person: __('Website Owner Name'),
organization: __('Organization Name', 'wp-schema-pro'),
Webshop: __('Webshop Name', 'wp-schema-pro'),
personblog: __('Website Owner Name', 'wp-schema-pro'),
Smallbusiness: __('Blog Website Name', 'wp-schema-pro'),
Otherbusiness: __('Business Name', 'wp-schema-pro'),
};
/**
* AIOSRS Frontend
*
* @class WPSchemaProSettings
* @since 1.0
*/
const WPSchemaProSettings = {
init() {
const self = this;
this.customFieldDependecy();
this.customImageSelect();
this.initRepeater();
this.toolTips();
this.regenerateSchema();
$('select.wp-select2').each(function (index, el) {
self.init_target_rule_select2(el);
});
},
regenerateSchema() {
$('#wpsp-regenerate-schema').click(function () {
$(this).next('span.spinner').addClass('is-active');
jQuery
.ajax({
url: ajaxurl,
type: 'post',
dataType: 'json',
data: {
action: 'regenerate_schema',
nonce: $(this).data('nonce'),
},
})
.success(function () {
$('#wpsp-regenerate-schema')
.next('span.spinner')
.removeClass('is-active');
$('#wpsp-regenerate-notice')
.show()
.delay(2000)
.fadeOut();
});
});
},
toolTips() {
$(document).on(
'click',
'.wp-schema-pro-tooltip-icon',
function (e) {
e.preventDefault();
$('.wp-schema-pro-tooltip-wrapper').removeClass('activate');
$(this).parent().addClass('activate');
}
);
$(document).on('click', function (e) {
if (
!$(e.target).hasClass(
'wp-schema-pro-tooltip-description'
) &&
!$(e.target).hasClass('wp-schema-pro-tooltip-icon') &&
$(e.target).closest('.wp-schema-pro-tooltip-description')
.length === 0
) {
$('.wp-schema-pro-tooltip-wrapper').removeClass('activate');
}
});
},
customImageSelect() {
let fileFrame;
window.inputWrapper = '';
$(document.body).on(
'click',
'.image-field-wrap .aiosrs-image-select',
function (e) {
e.preventDefault();
window.inputWrapper = $(this).closest('td');
// Create the media frame.
fileFrame = wp.media({
button: {
text: 'Select Image',
close: false,
},
states: [
new wp.media.controller.Library({
title: 'Select Custom Image',
library: wp.media.query({ type: 'image' }),
multiple: false,
}),
],
});
// When an image is selected, run a callback.
fileFrame.on('select', function () {
const attachment = fileFrame
.state()
.get('selection')
.first()
.toJSON();
const image = window.inputWrapper.find(
'.image-field-wrap img'
);
if (image.length === 0) {
window.inputWrapper
.find('.image-field-wrap')
.append(
'<a href="#" class="aiosrs-image-select img"><img src="' +
attachment.url +
'" /></a>'
);
} else {
image.attr('src', attachment.url);
}
window.inputWrapper
.find('.image-field-wrap')
.addClass('bsf-custom-image-selected');
window.inputWrapper
.find('.single-image-field')
.val(attachment.id);
fileFrame.close();
});
fileFrame.open();
}
);
$(document).on('click', '.aiosrs-image-remove', function (e) {
e.preventDefault();
const parent = $(this).closest('td');
parent
.find('.image-field-wrap')
.removeClass('bsf-custom-image-selected');
parent.find('.single-image-field').val('');
parent.find('.image-field-wrap img').removeAttr('src');
});
window.inputWrapper = '';
},
customFieldDependecy() {
jQuery(document).on(
'change',
'#post-body-content .wp-schema-pro-custom-option-select, .aiosrs-pro-setup-wizard-content.general-setting-content-wrap .wp-schema-pro-custom-option-select',
function () {
const customWrap = jQuery(this).next(
'.custom-field-wrapper'
);
customWrap.css('display', 'none');
if ('custom' === jQuery(this).val()) {
customWrap.css('display', '');
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-general-settings[site-represent]"]',
function () {
const wrapper = jQuery(this).closest('table'),
logoWrap = wrapper.find(
'.wp-schema-pro-site-logo-wrap'
),
companyNameWrap = wrapper.find(
'.wp-schema-pro-site-name-wrap'
),
personNameWrap = wrapper.find(
'.wp-schema-pro-person-name-wrap'
);
companyNameWrap.css('display', 'none');
personNameWrap.css('display', 'none');
if ('' !== jQuery(this).val()) {
if (
'organization' === jQuery(this).val() ||
'Webshop' === jQuery(this).val() ||
'Smallbusiness' === jQuery(this).val() ||
'Otherbusiness' === jQuery(this).val()
) {
logoWrap.css('display', '');
companyNameWrap.css('display', '');
} else {
personNameWrap.css('display', '');
logoWrap.css('display', '');
}
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-general-settings[site-represent]"]',
function () {
const organizationType = jQuery(this).val();
if ('' !== jQuery(this).val()) {
if (organizationType in temp) {
$('.wpsp-organization-label').text(
temp[organizationType]
);
}
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-corporate-contact[contact-type]"]',
function () {
const wrapper = jQuery(this).closest('table'),
contactPointWrap = wrapper.find(
'.wp-schema-pro-other-wrap'
);
contactPointWrap.css('display', 'none');
if ('' !== jQuery(this).val()) {
if ('other' === jQuery(this).val()) {
contactPointWrap.css('display', '');
}
}
}
);
$('#add-row').on('click', function () {
const row = $('.empty-row.screen-reader-text').clone(true);
row.removeClass('empty-row screen-reader-text');
row.insertBefore('#repeatable-fieldset-one >tr:last');
return false;
});
$('.remove-row').on('click', function () {
$(this).parents('tr').remove();
return false;
});
},
initRepeater() {
$(document).on(
'click',
'.bsf-repeater-add-new-btn',
function (event) {
event.preventDefault();
const selector = $(this),
parentWrap = selector.closest(
'.bsf-aiosrs-schema-type-wrap'
),
totalCount = parentWrap.find(
'.aiosrs-pro-repeater-table-wrap'
).length,
template = parentWrap
.find('.aiosrs-pro-repeater-table-wrap')
.first()
.clone();
template.find('input, textarea, select').each(function () {
$(this).val('');
const fieldName =
'undefined' !== typeof $(this).attr('name')
? $(this)
.attr('name')
.replace(
'[0]',
'[' + totalCount + ']'
)
: '',
fieldClass =
'undefined' !== typeof $(this).attr('class')
? $(this)
.attr('class')
.replace(
'-0-',
'-' + totalCount + '-'
)
: '',
fieldId =
'undefined' !== typeof $(this).attr('id')
? $(this)
.attr('id')
.replace(
'-0-',
'-' + totalCount + '-'
)
: '';
$(this).attr('name', fieldName);
$(this).attr('class', fieldClass);
$(this).attr('id', fieldId);
});
template.insertBefore(selector);
}
);
$(document).on('click', '.bsf-repeater-close', function (event) {
event.preventDefault();
const selector = $(this),
parentWrap = selector.closest(
'.bsf-aiosrs-schema-type-wrap'
),
repeaterCount = parentWrap.find(
'> .aiosrs-pro-repeater-table-wrap'
).length;
if (repeaterCount > 1) {
selector
.closest('.aiosrs-pro-repeater-table-wrap')
.remove();
}
});
},
init_target_rule_select2(selector) {
$(selector).select2({
placeholder: 'Search Fields...',
ajax: {
url: ajaxurl,
dataType: 'json',
method: 'post',
delay: 250,
data(params) {
return {
nonce_ajax: AIOSRS_search.search_field,
q: params.term, // search term
page: params.page,
action: 'bsf_get_specific_pages',
};
},
processResults(data) {
return {
results: data,
};
},
cache: true,
},
minimumInputLength: 2,
});
},
};
const loadDefaultValues = function () {
const field = jQuery(
'select[name="wp-schema-pro-general-settings[site-represent]"]'
),
wrapper = field.closest('table'),
logoWrap = wrapper.find('.wp-schema-pro-site-logo-wrap'),
companyNameWrap = wrapper.find('.wp-schema-pro-site-name-wrap'),
personNameWrap = wrapper.find('.wp-schema-pro-person-name-wrap');
companyNameWrap.css('display', 'none');
personNameWrap.css('display', 'none');
if ('' !== field.val()) {
if (
'organization' === field.val() ||
'Webshop' === field.val() ||
'Smallbusiness' === field.val() ||
'Otherbusiness' === field.val()
) {
logoWrap.css('display', '');
companyNameWrap.css('display', '');
} else {
personNameWrap.css('display', '');
logoWrap.css('display', '');
}
}
};
const loadDefaultOrganizationLabel = function () {
const field = jQuery(
'select[name="wp-schema-pro-general-settings[site-represent]"]'
),
organizationType = field.val();
if ('' !== field) {
if (organizationType in temp) {
$('.wpsp-organization-label').text(temp[organizationType]);
}
}
};
$(document).ready(function () {
$('.wp-select2').select2();
$('.wpsp-setup-configuration-settings').select2();
loadDefaultValues();
loadDefaultOrganizationLabel();
$('#add-row').on('click', function () {
const row = $('.empty-row.screen-reader-text').clone(true);
row.removeClass('empty-row screen-reader-text');
row.insertBefore('#repeatable-fieldset-one tbody>tr:last');
return false;
});
$('.remove-row').on('click', function () {
$(this).parents('tr').remove();
return false;
});
});
/* Initializes the AIOSRS Frontend. */
$(function () {
WPSchemaProSettings.init();
});
})(jQuery);
/* eslint-env jquery */
(function ($) {
const { __ } = wp.i18n;
const temp = {
person: __('Website Owner Name'),
organization: __('Organization Name', 'wp-schema-pro'),
Webshop: __('Webshop Name', 'wp-schema-pro'),
personblog: __('Website Owner Name', 'wp-schema-pro'),
Smallbusiness: __('Blog Website Name', 'wp-schema-pro'),
Otherbusiness: __('Business Name', 'wp-schema-pro'),
};
/**
* AIOSRS Frontend
*
* @class WPSchemaProSettings
* @since 1.0
*/
const WPSchemaProSettings = {
init() {
const self = this;
this.customFieldDependecy();
this.customImageSelect();
this.initRepeater();
this.toolTips();
this.regenerateSchema();
$('select.wp-select2').each(function (index, el) {
self.init_target_rule_select2(el);
});
},
regenerateSchema() {
$('#wpsp-regenerate-schema').click(function () {
$(this).next('span.spinner').addClass('is-active');
jQuery
.ajax({
url: ajaxurl,
type: 'post',
dataType: 'json',
data: {
action: 'regenerate_schema',
nonce: $(this).data('nonce'),
},
})
.success(function () {
$('#wpsp-regenerate-schema')
.next('span.spinner')
.removeClass('is-active');
$('#wpsp-regenerate-notice')
.show()
.delay(2000)
.fadeOut();
});
});
},
toolTips() {
$(document).on(
'click',
'.wp-schema-pro-tooltip-icon',
function (e) {
e.preventDefault();
$('.wp-schema-pro-tooltip-wrapper').removeClass('activate');
$(this).parent().addClass('activate');
}
);
$(document).on('click', function (e) {
if (
!$(e.target).hasClass(
'wp-schema-pro-tooltip-description'
) &&
!$(e.target).hasClass('wp-schema-pro-tooltip-icon') &&
$(e.target).closest('.wp-schema-pro-tooltip-description')
.length === 0
) {
$('.wp-schema-pro-tooltip-wrapper').removeClass('activate');
}
});
},
customImageSelect() {
let fileFrame;
window.inputWrapper = '';
$(document.body).on(
'click',
'.image-field-wrap .aiosrs-image-select',
function (e) {
e.preventDefault();
window.inputWrapper = $(this).closest('td');
// Create the media frame.
fileFrame = wp.media({
button: {
text: 'Select Image',
close: false,
},
states: [
new wp.media.controller.Library({
title: 'Select Custom Image',
library: wp.media.query({ type: 'image' }),
multiple: false,
}),
],
});
// When an image is selected, run a callback.
fileFrame.on('select', function () {
const attachment = fileFrame
.state()
.get('selection')
.first()
.toJSON();
const image = window.inputWrapper.find(
'.image-field-wrap img'
);
if (image.length === 0) {
window.inputWrapper
.find('.image-field-wrap')
.append(
'<a href="#" class="aiosrs-image-select img"><img src="' +
attachment.url +
'" /></a>'
);
} else {
image.attr('src', attachment.url);
}
window.inputWrapper
.find('.image-field-wrap')
.addClass('bsf-custom-image-selected');
window.inputWrapper
.find('.single-image-field')
.val(attachment.id);
fileFrame.close();
});
fileFrame.open();
}
);
$(document).on('click', '.aiosrs-image-remove', function (e) {
e.preventDefault();
const parent = $(this).closest('td');
parent
.find('.image-field-wrap')
.removeClass('bsf-custom-image-selected');
parent.find('.single-image-field').val('');
parent.find('.image-field-wrap img').removeAttr('src');
});
window.inputWrapper = '';
},
customFieldDependecy() {
jQuery(document).on(
'change',
'#post-body-content .wp-schema-pro-custom-option-select, .aiosrs-pro-setup-wizard-content.general-setting-content-wrap .wp-schema-pro-custom-option-select',
function () {
const customWrap = jQuery(this).next(
'.custom-field-wrapper'
);
customWrap.css('display', 'none');
if ('custom' === jQuery(this).val()) {
customWrap.css('display', '');
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-general-settings[site-represent]"]',
function () {
const wrapper = jQuery(this).closest('table'),
logoWrap = wrapper.find(
'.wp-schema-pro-site-logo-wrap'
),
companyNameWrap = wrapper.find(
'.wp-schema-pro-site-name-wrap'
),
personNameWrap = wrapper.find(
'.wp-schema-pro-person-name-wrap'
);
companyNameWrap.css('display', 'none');
personNameWrap.css('display', 'none');
if ('' !== jQuery(this).val()) {
if (
'organization' === jQuery(this).val() ||
'Webshop' === jQuery(this).val() ||
'Smallbusiness' === jQuery(this).val() ||
'Otherbusiness' === jQuery(this).val()
) {
logoWrap.css('display', '');
companyNameWrap.css('display', '');
} else {
personNameWrap.css('display', '');
logoWrap.css('display', '');
}
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-general-settings[site-represent]"]',
function () {
const organizationType = jQuery(this).val();
if ('' !== jQuery(this).val()) {
if (organizationType in temp) {
$('.wpsp-organization-label').text(
temp[organizationType]
);
}
}
}
);
jQuery(document).on(
'change',
'select[name="wp-schema-pro-corporate-contact[contact-type]"]',
function () {
const wrapper = jQuery(this).closest('table'),
contactPointWrap = wrapper.find(
'.wp-schema-pro-other-wrap'
);
contactPointWrap.css('display', 'none');
if ('' !== jQuery(this).val()) {
if ('other' === jQuery(this).val()) {
contactPointWrap.css('display', '');
}
}
}
);
$('#add-row').on('click', function () {
const row = $('.empty-row.screen-reader-text').clone(true);
row.removeClass('empty-row screen-reader-text');
row.insertBefore('#repeatable-fieldset-one >tr:last');
return false;
});
$('.remove-row').on('click', function () {
$(this).parents('tr').remove();
return false;
});
},
initRepeater() {
$(document).on(
'click',
'.bsf-repeater-add-new-btn',
function (event) {
event.preventDefault();
const selector = $(this),
parentWrap = selector.closest(
'.bsf-aiosrs-schema-type-wrap'
),
totalCount = parentWrap.find(
'.aiosrs-pro-repeater-table-wrap'
).length,
template = parentWrap
.find('.aiosrs-pro-repeater-table-wrap')
.first()
.clone();
template.find('input, textarea, select').each(function () {
$(this).val('');
const fieldName =
'undefined' !== typeof $(this).attr('name')
? $(this)
.attr('name')
.replace(
'[0]',
'[' + totalCount + ']'
)
: '',
fieldClass =
'undefined' !== typeof $(this).attr('class')
? $(this)
.attr('class')
.replace(
'-0-',
'-' + totalCount + '-'
)
: '',
fieldId =
'undefined' !== typeof $(this).attr('id')
? $(this)
.attr('id')
.replace(
'-0-',
'-' + totalCount + '-'
)
: '';
$(this).attr('name', fieldName);
$(this).attr('class', fieldClass);
$(this).attr('id', fieldId);
});
template.insertBefore(selector);
}
);
$(document).on('click', '.bsf-repeater-close', function (event) {
event.preventDefault();
const selector = $(this),
parentWrap = selector.closest(
'.bsf-aiosrs-schema-type-wrap'
),
repeaterCount = parentWrap.find(
'> .aiosrs-pro-repeater-table-wrap'
).length;
if (repeaterCount > 1) {
selector
.closest('.aiosrs-pro-repeater-table-wrap')
.remove();
}
});
},
init_target_rule_select2(selector) {
$(selector).select2({
placeholder: 'Search Fields...',
ajax: {
url: ajaxurl,
dataType: 'json',
method: 'post',
delay: 250,
data(params) {
return {
nonce_ajax: AIOSRS_search.search_field,
q: params.term, // search term
page: params.page,
action: 'bsf_get_specific_pages',
};
},
processResults(data) {
return {
results: data,
};
},
cache: true,
},
minimumInputLength: 2,
});
},
};
const loadDefaultValues = function () {
const field = jQuery(
'select[name="wp-schema-pro-general-settings[site-represent]"]'
),
wrapper = field.closest('table'),
logoWrap = wrapper.find('.wp-schema-pro-site-logo-wrap'),
companyNameWrap = wrapper.find('.wp-schema-pro-site-name-wrap'),
personNameWrap = wrapper.find('.wp-schema-pro-person-name-wrap');
companyNameWrap.css('display', 'none');
personNameWrap.css('display', 'none');
if ('' !== field.val()) {
if (
'organization' === field.val() ||
'Webshop' === field.val() ||
'Smallbusiness' === field.val() ||
'Otherbusiness' === field.val()
) {
logoWrap.css('display', '');
companyNameWrap.css('display', '');
} else {
personNameWrap.css('display', '');
logoWrap.css('display', '');
}
}
};
const loadDefaultOrganizationLabel = function () {
const field = jQuery(
'select[name="wp-schema-pro-general-settings[site-represent]"]'
),
organizationType = field.val();
if ('' !== field) {
if (organizationType in temp) {
$('.wpsp-organization-label').text(temp[organizationType]);
}
}
};
$(document).ready(function () {
$('.wp-select2').select2();
$('.wpsp-setup-configuration-settings').select2();
loadDefaultValues();
loadDefaultOrganizationLabel();
$('#add-row').on('click', function () {
const row = $('.empty-row.screen-reader-text').clone(true);
row.removeClass('empty-row screen-reader-text');
row.insertBefore('#repeatable-fieldset-one tbody>tr:last');
return false;
});
$('.remove-row').on('click', function () {
$(this).parents('tr').remove();
return false;
});
});
/* Initializes the AIOSRS Frontend. */
$(function () {
WPSchemaProSettings.init();
});
})(jQuery);
@@ -1,32 +1,32 @@
/* eslint-env jquery */
/**
* File setup-wizard.js
*
* Handles Color Picker
*
* @package
*/
( function ( $ ) {
jQuery( document ).ready( function () {
$( document ).on(
'click',
'.aiosrs-pro-schema-temp-wrap',
function ( e ) {
e.preventDefault();
$( '.aiosrs-pro-schema-temp-wrap' ).removeClass( 'selected' );
$( '.aiosrs-pro-setup-actions' )
.find( '.button-next' )
.removeAttr( 'disabled' );
$( this ).addClass( 'selected' );
const type = $( this ).data( 'schema-type' ),
title = $( this ).data( 'schema-title' );
$( document ).find( '.bsf-aiosrs-schema-type' ).val( type );
$( document ).find( '.bsf-aiosrs-schema-title' ).val( title );
}
);
} );
} )( jQuery );
/* eslint-env jquery */
/**
* File setup-wizard.js
*
* Handles Color Picker
*
* @package
*/
( function ( $ ) {
jQuery( document ).ready( function () {
$( document ).on(
'click',
'.aiosrs-pro-schema-temp-wrap',
function ( e ) {
e.preventDefault();
$( '.aiosrs-pro-schema-temp-wrap' ).removeClass( 'selected' );
$( '.aiosrs-pro-setup-actions' )
.find( '.button-next' )
.removeAttr( 'disabled' );
$( this ).addClass( 'selected' );
const type = $( this ).data( 'schema-type' ),
title = $( this ).data( 'schema-title' );
$( document ).find( '.bsf-aiosrs-schema-type' ).val( type );
$( document ).find( '.bsf-aiosrs-schema-title' ).val( title );
}
);
} );
} )( jQuery );
File diff suppressed because one or more lines are too long
@@ -1,21 +1,21 @@
[ID*="-optin-notice"] {
padding: 1px 12px;
border-right-color: #007cba;
}
[ID*="-optin-notice"] .notice-container {
padding-top: 10px;
padding-bottom: 12px;
}
[ID*="-optin-notice"] .notice-content {
margin: 0;
}
[ID*="-optin-notice"] .notice-heading {
padding: 0 0 12px 20px;
}
[ID*="-optin-notice"] .button-primary {
margin-left: 5px;
[ID*="-optin-notice"] {
padding: 1px 12px;
border-right-color: #007cba;
}
[ID*="-optin-notice"] .notice-container {
padding-top: 10px;
padding-bottom: 12px;
}
[ID*="-optin-notice"] .notice-content {
margin: 0;
}
[ID*="-optin-notice"] .notice-heading {
padding: 0 0 12px 20px;
}
[ID*="-optin-notice"] .button-primary {
margin-left: 5px;
}
@@ -1,21 +1,21 @@
[ID*="-optin-notice"] {
padding: 1px 12px;
border-left-color: #007cba;
}
[ID*="-optin-notice"] .notice-container {
padding-top: 10px;
padding-bottom: 12px;
}
[ID*="-optin-notice"] .notice-content {
margin: 0;
}
[ID*="-optin-notice"] .notice-heading {
padding: 0 20px 12px 0;
}
[ID*="-optin-notice"] .button-primary {
margin-right: 5px;
[ID*="-optin-notice"] {
padding: 1px 12px;
border-left-color: #007cba;
}
[ID*="-optin-notice"] .notice-container {
padding-top: 10px;
padding-bottom: 12px;
}
[ID*="-optin-notice"] .notice-content {
margin: 0;
}
[ID*="-optin-notice"] .notice-heading {
padding: 0 20px 12px 0;
}
[ID*="-optin-notice"] .button-primary {
margin-right: 5px;
}
@@ -1,118 +1,118 @@
<?php
/**
* BSF analytics loader file.
*
* @version 1.0.0
*
* @package bsf-analytics
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
/**
* Class BSF_Analytics_Loader.
*/
class BSF_Analytics_Loader {
/**
* Analytics Entities.
*
* @access private
* @var array Entities array.
*/
private $entities = array();
/**
* Analytics Version.
*
* @access private
* @var float analytics version.
*/
private $analytics_version = '';
/**
* Analytics path.
*
* @access private
* @var string path array.
*/
private $analytics_path = '';
/**
* Instance
*
* @access private
* @var object Class object.
*/
private static $instance = null;
/**
* Get instace of class.
*
* @return object
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
public function __construct() {
add_action( 'init', array( $this, 'load_analytics' ) );
}
/**
* Set entity for analytics.
*
* @param string $data Entity attributes data.
* @return void
*/
public function set_entity( $data ) {
array_push( $this->entities, $data );
}
/**
* Load Analytics library.
*
* @return void
*/
public function load_analytics() {
$unique_entities = array();
if ( ! empty( $this->entities ) ) {
foreach ( $this->entities as $entity ) {
foreach ( $entity as $key => $data ) {
if ( isset( $data['path'] ) ) {
if ( file_exists( $data['path'] . '/version.json' ) ) {
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$analytics_version = json_decode( $file_contents, 1 );
$analytics_version = $analytics_version['bsf-analytics-ver'];
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
$this->analytics_version = $analytics_version;
$this->analytics_path = $data['path'];
}
}
}
if ( ! isset( $unique_entities[ $key ] ) ) {
$unique_entities[ $key ] = $data;
}
}
}
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
require_once $this->analytics_path . '/class-bsf-analytics.php';
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
}
}
}
}
<?php
/**
* BSF analytics loader file.
*
* @version 1.0.0
*
* @package bsf-analytics
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
/**
* Class BSF_Analytics_Loader.
*/
class BSF_Analytics_Loader {
/**
* Analytics Entities.
*
* @access private
* @var array Entities array.
*/
private $entities = array();
/**
* Analytics Version.
*
* @access private
* @var float analytics version.
*/
private $analytics_version = '';
/**
* Analytics path.
*
* @access private
* @var string path array.
*/
private $analytics_path = '';
/**
* Instance
*
* @access private
* @var object Class object.
*/
private static $instance = null;
/**
* Get instace of class.
*
* @return object
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
public function __construct() {
add_action( 'init', array( $this, 'load_analytics' ) );
}
/**
* Set entity for analytics.
*
* @param string $data Entity attributes data.
* @return void
*/
public function set_entity( $data ) {
array_push( $this->entities, $data );
}
/**
* Load Analytics library.
*
* @return void
*/
public function load_analytics() {
$unique_entities = array();
if ( ! empty( $this->entities ) ) {
foreach ( $this->entities as $entity ) {
foreach ( $entity as $key => $data ) {
if ( isset( $data['path'] ) ) {
if ( file_exists( $data['path'] . '/version.json' ) ) {
$file_contents = file_get_contents( $data['path'] . '/version.json' ); // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents
$analytics_version = json_decode( $file_contents, 1 );
$analytics_version = $analytics_version['bsf-analytics-ver'];
if ( version_compare( $analytics_version, $this->analytics_version, '>' ) ) {
$this->analytics_version = $analytics_version;
$this->analytics_path = $data['path'];
}
}
}
if ( ! isset( $unique_entities[ $key ] ) ) {
$unique_entities[ $key ] = $data;
}
}
}
if ( file_exists( $this->analytics_path ) && ! class_exists( 'BSF_Analytics' ) ) {
require_once $this->analytics_path . '/class-bsf-analytics.php';
new BSF_Analytics( $unique_entities, $this->analytics_path, $this->analytics_version );
}
}
}
}
@@ -1,258 +1,258 @@
<?php
/**
* BSF analytics stat class file.
*
* @package bsf-analytics
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'BSF_Analytics_Stats' ) ) {
/**
* BSF analytics stat class.
*/
class BSF_Analytics_Stats {
/**
* Active plugins.
*
* Holds the sites active plugins list.
*
* @var array
*/
private $plugins;
/**
* Instance of BSF_Analytics_Stats.
*
* Holds only the first object of class.
*
* @var object
*/
private static $instance = null;
/**
* Create only once instance of a class.
*
* @return object
* @since 1.0.0
*/
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Get stats.
*
* @return array stats data.
* @since 1.0.0
*/
public function get_stats() {
return apply_filters( 'bsf_core_stats', $this->get_default_stats() );
}
/**
* Retrieve stats for site.
*
* @return array stats data.
* @since 1.0.0
*/
private function get_default_stats() {
return array(
'graupi_version' => defined( 'BSF_UPDATER_VERSION' ) ? BSF_UPDATER_VERSION : false,
'domain_name' => get_site_url(),
'php_os' => PHP_OS,
'server_software' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? filter_var( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ), FILTER_SANITIZE_STRING ) : '',
'mysql_version' => $this->get_mysql_version(),
'php_version' => $this->get_php_version(),
'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
'php_post_max_size' => ini_get( 'post_max_size' ),
'php_max_execution_time' => ini_get( 'max_execution_time' ),
'php_memory_limit' => ini_get( 'memory_limit' ),
'zip_installed' => extension_loaded( 'zip' ),
'imagick_availabile' => extension_loaded( 'imagick' ),
'xmlreader_exists' => class_exists( 'XMLReader' ),
'gd_available' => extension_loaded( 'gd' ),
'curl_version' => $this->get_curl_version(),
'curl_ssl_version' => $this->get_curl_ssl_version(),
'is_writable' => $this->is_content_writable(),
'wp_version' => get_bloginfo( 'version' ),
'user_count' => $this->get_user_count(),
'posts_count' => wp_count_posts()->publish,
'page_count' => wp_count_posts( 'page' )->publish,
'site_language' => get_locale(),
'timezone' => wp_timezone_string(),
'is_ssl' => is_ssl(),
'is_multisite' => is_multisite(),
'network_url' => network_site_url(),
'external_object_cache' => (bool) wp_using_ext_object_cache(),
'wp_debug' => WP_DEBUG,
'wp_debug_display' => WP_DEBUG_DISPLAY,
'script_debug' => SCRIPT_DEBUG,
'active_plugins' => $this->get_active_plugins(),
'active_theme' => get_template(),
'active_stylesheet' => get_stylesheet(),
);
}
/**
* Get installed PHP version.
*
* @return float PHP version.
* @since 1.0.0
*/
private function get_php_version() {
if ( defined( 'PHP_MAJOR_VERSION' ) && defined( 'PHP_MINOR_VERSION' ) && defined( 'PHP_RELEASE_VERSION' ) ) { // phpcs:ignore
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
return phpversion();
}
/**
* User count on site.
*
* @return int User count.
* @since 1.0.0
*/
private function get_user_count() {
if ( is_multisite() ) {
$user_count = get_user_count();
} else {
$count = count_users();
$user_count = $count['total_users'];
}
return $user_count;
}
/**
* Get active plugin's data.
*
* @return array active plugin's list.
* @since 1.0.0
*/
private function get_active_plugins() {
if ( ! $this->plugins ) {
// Ensure get_plugin_data function is loaded.
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = wp_get_active_and_valid_plugins();
$plugins = array_map( 'get_plugin_data', $plugins );
$this->plugins = array_map( array( $this, 'format_plugin' ), $plugins );
}
return $this->plugins;
}
/**
* Format plugin data.
*
* @param string $plugin plugin.
* @return array formatted plugin data.
* @since 1.0.0
*/
public function format_plugin( $plugin ) {
return array(
'name' => html_entity_decode( $plugin['Name'], ENT_COMPAT, 'UTF-8' ),
'url' => $plugin['PluginURI'],
'version' => $plugin['Version'],
'slug' => $plugin['TextDomain'],
'author_name' => html_entity_decode( wp_strip_all_tags( $plugin['Author'] ), ENT_COMPAT, 'UTF-8' ),
'author_url' => $plugin['AuthorURI'],
);
}
/**
* Curl SSL version.
*
* @return float SSL version.
* @since 1.0.0
*/
private function get_curl_ssl_version() {
$curl = array();
if ( function_exists( 'curl_version' ) ) {
$curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
}
return isset( $curl['ssl_version'] ) ? $curl['ssl_version'] : false;
}
/**
* Get cURL version.
*
* @return float cURL version.
* @since 1.0.0
*/
private function get_curl_version() {
if ( function_exists( 'curl_version' ) ) {
$curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
}
return isset( $curl['version'] ) ? $curl['version'] : false;
}
/**
* Get MySQL version.
*
* @return float MySQL version.
* @since 1.0.0
*/
private function get_mysql_version() {
global $wpdb;
return $wpdb->db_version();
}
/**
* Check if content directory is writable.
*
* @return bool
* @since 1.0.0
*/
private function is_content_writable() {
$upload_dir = wp_upload_dir();
return wp_is_writable( $upload_dir['basedir'] );
}
}
}
/**
* Polyfill for sites using WP version less than 5.3
*/
if ( ! function_exists( 'wp_timezone_string' ) ) {
/**
* Get timezone string.
*
* @return string timezone string.
* @since 1.0.0
*/
function wp_timezone_string() {
$timezone_string = get_option( 'timezone_string' );
if ( $timezone_string ) {
return $timezone_string;
}
$offset = (float) get_option( 'gmt_offset' );
$hours = (int) $offset;
$minutes = ( $offset - $hours );
$sign = ( $offset < 0 ) ? '-' : '+';
$abs_hour = abs( $hours );
$abs_mins = abs( $minutes * 60 );
$tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
return $tz_offset;
}
}
<?php
/**
* BSF analytics stat class file.
*
* @package bsf-analytics
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'BSF_Analytics_Stats' ) ) {
/**
* BSF analytics stat class.
*/
class BSF_Analytics_Stats {
/**
* Active plugins.
*
* Holds the sites active plugins list.
*
* @var array
*/
private $plugins;
/**
* Instance of BSF_Analytics_Stats.
*
* Holds only the first object of class.
*
* @var object
*/
private static $instance = null;
/**
* Create only once instance of a class.
*
* @return object
* @since 1.0.0
*/
public static function instance() {
if ( null === self::$instance ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Get stats.
*
* @return array stats data.
* @since 1.0.0
*/
public function get_stats() {
return apply_filters( 'bsf_core_stats', $this->get_default_stats() );
}
/**
* Retrieve stats for site.
*
* @return array stats data.
* @since 1.0.0
*/
private function get_default_stats() {
return array(
'graupi_version' => defined( 'BSF_UPDATER_VERSION' ) ? BSF_UPDATER_VERSION : false,
'domain_name' => get_site_url(),
'php_os' => PHP_OS,
'server_software' => isset( $_SERVER['SERVER_SOFTWARE'] ) ? filter_var( wp_unslash( $_SERVER['SERVER_SOFTWARE'] ), FILTER_SANITIZE_STRING ) : '',
'mysql_version' => $this->get_mysql_version(),
'php_version' => $this->get_php_version(),
'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
'php_post_max_size' => ini_get( 'post_max_size' ),
'php_max_execution_time' => ini_get( 'max_execution_time' ),
'php_memory_limit' => ini_get( 'memory_limit' ),
'zip_installed' => extension_loaded( 'zip' ),
'imagick_availabile' => extension_loaded( 'imagick' ),
'xmlreader_exists' => class_exists( 'XMLReader' ),
'gd_available' => extension_loaded( 'gd' ),
'curl_version' => $this->get_curl_version(),
'curl_ssl_version' => $this->get_curl_ssl_version(),
'is_writable' => $this->is_content_writable(),
'wp_version' => get_bloginfo( 'version' ),
'user_count' => $this->get_user_count(),
'posts_count' => wp_count_posts()->publish,
'page_count' => wp_count_posts( 'page' )->publish,
'site_language' => get_locale(),
'timezone' => wp_timezone_string(),
'is_ssl' => is_ssl(),
'is_multisite' => is_multisite(),
'network_url' => network_site_url(),
'external_object_cache' => (bool) wp_using_ext_object_cache(),
'wp_debug' => WP_DEBUG,
'wp_debug_display' => WP_DEBUG_DISPLAY,
'script_debug' => SCRIPT_DEBUG,
'active_plugins' => $this->get_active_plugins(),
'active_theme' => get_template(),
'active_stylesheet' => get_stylesheet(),
);
}
/**
* Get installed PHP version.
*
* @return float PHP version.
* @since 1.0.0
*/
private function get_php_version() {
if ( defined( 'PHP_MAJOR_VERSION' ) && defined( 'PHP_MINOR_VERSION' ) && defined( 'PHP_RELEASE_VERSION' ) ) { // phpcs:ignore
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
return phpversion();
}
/**
* User count on site.
*
* @return int User count.
* @since 1.0.0
*/
private function get_user_count() {
if ( is_multisite() ) {
$user_count = get_user_count();
} else {
$count = count_users();
$user_count = $count['total_users'];
}
return $user_count;
}
/**
* Get active plugin's data.
*
* @return array active plugin's list.
* @since 1.0.0
*/
private function get_active_plugins() {
if ( ! $this->plugins ) {
// Ensure get_plugin_data function is loaded.
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
$plugins = wp_get_active_and_valid_plugins();
$plugins = array_map( 'get_plugin_data', $plugins );
$this->plugins = array_map( array( $this, 'format_plugin' ), $plugins );
}
return $this->plugins;
}
/**
* Format plugin data.
*
* @param string $plugin plugin.
* @return array formatted plugin data.
* @since 1.0.0
*/
public function format_plugin( $plugin ) {
return array(
'name' => html_entity_decode( $plugin['Name'], ENT_COMPAT, 'UTF-8' ),
'url' => $plugin['PluginURI'],
'version' => $plugin['Version'],
'slug' => $plugin['TextDomain'],
'author_name' => html_entity_decode( wp_strip_all_tags( $plugin['Author'] ), ENT_COMPAT, 'UTF-8' ),
'author_url' => $plugin['AuthorURI'],
);
}
/**
* Curl SSL version.
*
* @return float SSL version.
* @since 1.0.0
*/
private function get_curl_ssl_version() {
$curl = array();
if ( function_exists( 'curl_version' ) ) {
$curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
}
return isset( $curl['ssl_version'] ) ? $curl['ssl_version'] : false;
}
/**
* Get cURL version.
*
* @return float cURL version.
* @since 1.0.0
*/
private function get_curl_version() {
if ( function_exists( 'curl_version' ) ) {
$curl = curl_version(); // phpcs:ignore WordPress.WP.AlternativeFunctions.curl_curl_version
}
return isset( $curl['version'] ) ? $curl['version'] : false;
}
/**
* Get MySQL version.
*
* @return float MySQL version.
* @since 1.0.0
*/
private function get_mysql_version() {
global $wpdb;
return $wpdb->db_version();
}
/**
* Check if content directory is writable.
*
* @return bool
* @since 1.0.0
*/
private function is_content_writable() {
$upload_dir = wp_upload_dir();
return wp_is_writable( $upload_dir['basedir'] );
}
}
}
/**
* Polyfill for sites using WP version less than 5.3
*/
if ( ! function_exists( 'wp_timezone_string' ) ) {
/**
* Get timezone string.
*
* @return string timezone string.
* @since 1.0.0
*/
function wp_timezone_string() {
$timezone_string = get_option( 'timezone_string' );
if ( $timezone_string ) {
return $timezone_string;
}
$offset = (float) get_option( 'gmt_offset' );
$hours = (int) $offset;
$minutes = ( $offset - $hours );
$sign = ( $offset < 0 ) ? '-' : '+';
$abs_hour = abs( $hours );
$abs_mins = abs( $minutes * 60 );
$tz_offset = sprintf( '%s%02d:%02d', $sign, $abs_hour, $abs_mins );
return $tz_offset;
}
}
File diff suppressed because it is too large Load Diff
@@ -1,4 +1,4 @@
{
"bsf-analytics-ver": "1.1.3"
}
{
"bsf-analytics-ver": "1.1.3"
}
@@ -1,172 +1,172 @@
/* ========================================================================
* Frosty.js
* https://owensbla.github.com/frosty
* by Blake Owens (http://blakeowens.com/)
* ======================================================================== */
.bsf-has-tip,
.has-tip {
cursor: help;
}
.tip {
background-color: black;
background-color: rgba(0, 0, 0, 0.8);
color: #eeeeee;
font-size: 11px;
line-height: 1.5em;
max-width: 200px;
padding: 4px 8px;
}
.tip.success {
background-color: #47fe42;
background-color: rgba(71, 254, 66, 0.8);
color: #025600;
}
.tip.error {
background-color: #ff7f86;
background-color: rgba(255, 127, 134, 0.8);
color: #7f0006;
}
.tip.light {
background-color: #ebebeb;
background-color: rgba(235, 235, 235, 0.8);
color: #222222;
}
.tip[class*="arrow"]:before {
content: ' ';
position: absolute;
border: solid transparent;
width: 0px;
height: 0px;
border-width: 5px;
border-color: black;
border-color: rgba(0, 0, 0, 0.8);
}
.success[class*="arrow"]:before {
border-color: #47fe42;
border-color: rgba(71, 254, 66, 0.8);
}
.error[class*="arrow"]:before {
border-color: #ff7f86;
border-color: rgba(255, 127, 134, 0.8);
}
.light[class*="arrow"]:before {
border-color: #ebebeb;
border-color: rgba(235, 235, 235, 0.8);
}
.tip.arrow-right:before {
border-right-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
left: 100%;
}
.tip.arrow-left:before {
border-left-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
right: 100%;
}
.tip.arrow-top:before {
border-top-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
bottom: 100%;
left: 50%;
}
.tip.arrow-bottom:before {
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
top: 100%;
left: 50%;
}
/* Customizer Tooltip */
.customize-support .tip {
background-color: rgba(0, 148, 221, 0.95);
color: #FFF;
font-size: 13px;
line-height: 1.5em;
max-width: 200px;
padding: 5px 11px;
border: 1px solid #0094DD;
border-radius: 1px;
}
.customize-support .tip[class*="arrow"]:before {
border-width: 5px;
border-color: #0094DD;
border-color: rgba(0, 148, 221, 0.95);
}
.customize-support .tip.arrow-right:before {
border-right-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
left: 100%;
}
.customize-support .tip.arrow-left:before {
border-left-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
right: 100%;
}
.customize-support .tip.arrow-top:before {
border-top-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
bottom: 100%;
left: 50%;
}
.customize-support .tip.arrow-bottom:before {
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
top: 100%;
left: 50%;
}
/*---close button tooltip--------*/
.tip[class*="close-tip-content"]{
border-radius:7px;
max-width:300px;
padding: 15px 30px;
}
.tip[class*="close-tip-content"]:before{
border-width: 8px!important;
margin-top: -8px!important;
}
.tip[class*="close-tip-content"][class*="arrow-bottom"]{
/* margin-top:-10px; */
}
.tip[class*="close-tip-content"][class*="arrow-bottom"]:before{
margin-top: -1px!important;
}
.tip[class*="close-tip-content"][class*="arrow-right"]:before {
left: 100%;
left: calc(100% - 1px);
}
.cp-innertip.tip[class*="close-tip-content"][class*="arrow"]{
margin-top: 30px!important;
}
@media (max-width:768px) {
.tip[class*="close-tip-content"]{
border-radius:7px;
max-width:200px;
padding: 5px 20px;
}
}
@media (max-width:610px) {
.tip[class*="close-tip-content"]{
max-width:170px;
}
/* ========================================================================
* Frosty.js
* https://owensbla.github.com/frosty
* by Blake Owens (http://blakeowens.com/)
* ======================================================================== */
.bsf-has-tip,
.has-tip {
cursor: help;
}
.tip {
background-color: black;
background-color: rgba(0, 0, 0, 0.8);
color: #eeeeee;
font-size: 11px;
line-height: 1.5em;
max-width: 200px;
padding: 4px 8px;
}
.tip.success {
background-color: #47fe42;
background-color: rgba(71, 254, 66, 0.8);
color: #025600;
}
.tip.error {
background-color: #ff7f86;
background-color: rgba(255, 127, 134, 0.8);
color: #7f0006;
}
.tip.light {
background-color: #ebebeb;
background-color: rgba(235, 235, 235, 0.8);
color: #222222;
}
.tip[class*="arrow"]:before {
content: ' ';
position: absolute;
border: solid transparent;
width: 0px;
height: 0px;
border-width: 5px;
border-color: black;
border-color: rgba(0, 0, 0, 0.8);
}
.success[class*="arrow"]:before {
border-color: #47fe42;
border-color: rgba(71, 254, 66, 0.8);
}
.error[class*="arrow"]:before {
border-color: #ff7f86;
border-color: rgba(255, 127, 134, 0.8);
}
.light[class*="arrow"]:before {
border-color: #ebebeb;
border-color: rgba(235, 235, 235, 0.8);
}
.tip.arrow-right:before {
border-right-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
left: 100%;
}
.tip.arrow-left:before {
border-left-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
right: 100%;
}
.tip.arrow-top:before {
border-top-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
bottom: 100%;
left: 50%;
}
.tip.arrow-bottom:before {
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
top: 100%;
left: 50%;
}
/* Customizer Tooltip */
.customize-support .tip {
background-color: rgba(0, 148, 221, 0.95);
color: #FFF;
font-size: 13px;
line-height: 1.5em;
max-width: 200px;
padding: 5px 11px;
border: 1px solid #0094DD;
border-radius: 1px;
}
.customize-support .tip[class*="arrow"]:before {
border-width: 5px;
border-color: #0094DD;
border-color: rgba(0, 148, 221, 0.95);
}
.customize-support .tip.arrow-right:before {
border-right-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
left: 100%;
}
.customize-support .tip.arrow-left:before {
border-left-color: transparent;
border-top-color: transparent;
border-bottom-color: transparent;
margin-top: -5px;
top: 50%;
right: 100%;
}
.customize-support .tip.arrow-top:before {
border-top-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
bottom: 100%;
left: 50%;
}
.customize-support .tip.arrow-bottom:before {
border-bottom-color: transparent;
border-left-color: transparent;
border-right-color: transparent;
margin-left: -5px;
top: 100%;
left: 50%;
}
/*---close button tooltip--------*/
.tip[class*="close-tip-content"]{
border-radius:7px;
max-width:300px;
padding: 15px 30px;
}
.tip[class*="close-tip-content"]:before{
border-width: 8px!important;
margin-top: -8px!important;
}
.tip[class*="close-tip-content"][class*="arrow-bottom"]{
/* margin-top:-10px; */
}
.tip[class*="close-tip-content"][class*="arrow-bottom"]:before{
margin-top: -1px!important;
}
.tip[class*="close-tip-content"][class*="arrow-right"]:before {
left: 100%;
left: calc(100% - 1px);
}
.cp-innertip.tip[class*="close-tip-content"][class*="arrow"]{
margin-top: 30px!important;
}
@media (max-width:768px) {
.tip[class*="close-tip-content"]{
border-radius:7px;
max-width:200px;
padding: 5px 20px;
}
}
@media (max-width:610px) {
.tip[class*="close-tip-content"]{
max-width:170px;
}
}
@@ -1,138 +1,138 @@
.bsf-core-license-form p {
padding: 5px 0px 5px 0px;
font-style: normal;
}
.license-form-allow-email .submit-button-wrap > input,
.license-form-allow-email .submit-button-wrap > p {
display: inline-block;
vertical-align: bottom;
}
.bsf-core-license-form .license-form-allow-email .purchase-license a {
text-decoration: none;
}
.license-form-allow-email {
margin-bottom: 15px;
}
.license-form-allow-email .license-form-external-links {
font-style: italic;
}
.license-form-field input {
width: 100%;
}
.bsf-core-license-form .license-form-allow-email h3 {
font-size: 2em;
margin-bottom: 0.5em;
}
.bsf-core-license-form .license-form-allow-email .purchase-license {
margin-left: 10px;
}
.bsf-core-license-form .license-form-allow-email .submit-button-wrap {
padding: 20px 0px 10px 0px;
}
.license-form-allow-email .bsf-core-license-form-inner, {
padding: 10px 30px 30px;
}
.bsf-core-license-form .bsf-core-license-form-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
.bsf-core-license-form .bsf-core-license-form-inner {
background: #fcfcfc;
position: fixed;
background-color: #fff;
z-index: 999999999;
padding: 2px 20px 20px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
}
.bsf-core-license-form-close-btn {
position: absolute;
left: auto;
right: 0;
top: 0;
width: 29px;
height: 29px;
border: 0;
padding: 0;
background: none;
cursor: pointer;
outline: none;
-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
-webkit-transform: translateX(100%) translateY(-100%);
transform: translateX(100%) translateY(-100%);
transition: color .1s ease-in-out, background .1s ease-in-out;
color: #eee;
}
.bsf-core-license-form-close-btn:hover {
color: #00a0d2;
}
.bsf-core-license-form-close-btn .dashicons {
display: block;
text-align: center;
line-height: 29px;
width: 29px;
height: 29px;
font-size: 29px;
position: absolute;
top: 0;
right: 0;
}
.bsf-core-license-form .license-form-field input.regular-text {
margin-right: 10px;
}
/** License link */
.bsf-core-license-form-btn.inactive {
color: #3db634;
font-weight: 500;
}
.bsf-core-license-form-btn {
cursor: pointer;
}
.bsf-license-message.license-success {
display: none;
}
.bsf-system-info-wrapper {
overflow: scroll;
max-height: 60vh;
}
.bsf-license-heading {
margin: 1em 0;
}
.bsf-license-not-active-astra-portfolio.bsf-license-heading {
margin: 1em 0 0 0;
}
.envato-license-registration form {
margin-bottom: 1em;
.bsf-core-license-form p {
padding: 5px 0px 5px 0px;
font-style: normal;
}
.license-form-allow-email .submit-button-wrap > input,
.license-form-allow-email .submit-button-wrap > p {
display: inline-block;
vertical-align: bottom;
}
.bsf-core-license-form .license-form-allow-email .purchase-license a {
text-decoration: none;
}
.license-form-allow-email {
margin-bottom: 15px;
}
.license-form-allow-email .license-form-external-links {
font-style: italic;
}
.license-form-field input {
width: 100%;
}
.bsf-core-license-form .license-form-allow-email h3 {
font-size: 2em;
margin-bottom: 0.5em;
}
.bsf-core-license-form .license-form-allow-email .purchase-license {
margin-left: 10px;
}
.bsf-core-license-form .license-form-allow-email .submit-button-wrap {
padding: 20px 0px 10px 0px;
}
.license-form-allow-email .bsf-core-license-form-inner, {
padding: 10px 30px 30px;
}
.bsf-core-license-form .bsf-core-license-form-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
.bsf-core-license-form .bsf-core-license-form-inner {
background: #fcfcfc;
position: fixed;
background-color: #fff;
z-index: 999999999;
padding: 2px 20px 20px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
}
.bsf-core-license-form-close-btn {
position: absolute;
left: auto;
right: 0;
top: 0;
width: 29px;
height: 29px;
border: 0;
padding: 0;
background: none;
cursor: pointer;
outline: none;
-webkit-transition: color .1s ease-in-out, background .1s ease-in-out;
-webkit-transform: translateX(100%) translateY(-100%);
transform: translateX(100%) translateY(-100%);
transition: color .1s ease-in-out, background .1s ease-in-out;
color: #eee;
}
.bsf-core-license-form-close-btn:hover {
color: #00a0d2;
}
.bsf-core-license-form-close-btn .dashicons {
display: block;
text-align: center;
line-height: 29px;
width: 29px;
height: 29px;
font-size: 29px;
position: absolute;
top: 0;
right: 0;
}
.bsf-core-license-form .license-form-field input.regular-text {
margin-right: 10px;
}
/** License link */
.bsf-core-license-form-btn.inactive {
color: #3db634;
font-weight: 500;
}
.bsf-core-license-form-btn {
cursor: pointer;
}
.bsf-license-message.license-success {
display: none;
}
.bsf-system-info-wrapper {
overflow: scroll;
max-height: 60vh;
}
.bsf-license-heading {
margin: 1em 0;
}
.bsf-license-not-active-astra-portfolio.bsf-license-heading {
margin: 1em 0 0 0;
}
.envato-license-registration form {
margin-bottom: 1em;
}
@@ -1,84 +1,84 @@
.bsf-core-rollback-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
.bsf-confirm-rollback-popup-content {
background: #fcfcfc;
position: fixed;
/* background-color: #fff; */
z-index: 999999999;
padding: 2px 20px 0px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
border-radius: 2px;
}
.bsf-confirm-rollback-popup-buttons-wrapper .bsf-confirm-cancel{
padding: 0px 16px;
margin-right: 149px;
}
.bsf-confirm-text{
margin-bottom: 25px;
}
.bsf-confirm-rollback-popup-buttons-wrapper .bsf-confirm-ok{
margin-right: 0px;
padding: 0px 16px;
float: right;
}
.bsf-rollback-heading{
text-align: center;
}
.bsf-confirm-rollback-popup-header {
font-size: 15px;
color: #495157;
padding: 30px 0 10px;
font-weight: 500;
text-align: center;
}
.bsf-confirm-rollback-popup-message {
-webkit-box-sizing: border-box;
box-sizing: border-box;
min-height: 50px;
text-align: center;
}
.bsf-confirm-rollback-popup-buttons-wrapper {
border-top: 1px solid #e4e4e4;
width: 100%;
padding: 9px 0px 9px 0px
}
.bsf-confirm-rollback-popup-button {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
width: 50%;
border: none;
background: none;
color: #6d7882;
font-size: 15px;
cursor: pointer;
padding: 13px 0;
outline: 0;
}
.bsf-confirm-rollback-popup-button:hover {
background:#e6e9ec6b
}
.bsf-confirm-rollback-popup-button.confirm-cancel {
border-right: 1px solid #e6e9ec;
}
.bsf-confirm-rollback-popup-button.confirm-ok {
color: rgb(74, 0, 224);
}
.bsf-confirm-rollback-popup.show {
display: block;
.bsf-core-rollback-overlay {
background: #000;
opacity: 0.7;
filter: alpha(opacity=70);
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=70)";
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 100050;
}
.bsf-confirm-rollback-popup-content {
background: #fcfcfc;
position: fixed;
/* background-color: #fff; */
z-index: 999999999;
padding: 2px 20px 0px;
text-align: left;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
-webkit-box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
box-shadow: 0 3px 6px rgba( 0, 0, 0, 0.3 );
border-radius: 2px;
}
.bsf-confirm-rollback-popup-buttons-wrapper .bsf-confirm-cancel{
padding: 0px 16px;
margin-right: 149px;
}
.bsf-confirm-text{
margin-bottom: 25px;
}
.bsf-confirm-rollback-popup-buttons-wrapper .bsf-confirm-ok{
margin-right: 0px;
padding: 0px 16px;
float: right;
}
.bsf-rollback-heading{
text-align: center;
}
.bsf-confirm-rollback-popup-header {
font-size: 15px;
color: #495157;
padding: 30px 0 10px;
font-weight: 500;
text-align: center;
}
.bsf-confirm-rollback-popup-message {
-webkit-box-sizing: border-box;
box-sizing: border-box;
min-height: 50px;
text-align: center;
}
.bsf-confirm-rollback-popup-buttons-wrapper {
border-top: 1px solid #e4e4e4;
width: 100%;
padding: 9px 0px 9px 0px
}
.bsf-confirm-rollback-popup-button {
font-family: Roboto, Arial, Helvetica, Verdana, sans-serif;
width: 50%;
border: none;
background: none;
color: #6d7882;
font-size: 15px;
cursor: pointer;
padding: 13px 0;
outline: 0;
}
.bsf-confirm-rollback-popup-button:hover {
background:#e6e9ec6b
}
.bsf-confirm-rollback-popup-button.confirm-cancel {
border-right: 1px solid #e6e9ec;
}
.bsf-confirm-rollback-popup-button.confirm-ok {
color: rgb(74, 0, 224);
}
.bsf-confirm-rollback-popup.show {
display: block;
}
File diff suppressed because it is too large Load Diff
@@ -1,146 +1,146 @@
input.form-control.smile-switch.switch + label.bsf-switch-btn:before {
display: none;
}
input.form-control.smile-input.bsf-switch-input {
display: none;
}
.switch-wrapper {
width: 95px;
}
.shadow_type .onoffswitch-switch {
width: 45px;
}
.shadow_type .onoffswitch-inactive .onoffswitch-switch:before {
right: 45px;
}
.shadow_type .onoffswitch-active .onoffswitch-switch:before {
left: 45px;
}
.ios-toggle, .ios-toggle:active {
position:absolute;
top:-5000px;
height:0;
width:0;
opacity:0;
border:none;
outline:none;
}
.checkbox-label {
display:block;
position:relative;
padding:0px;
margin: 0px;
margin-bottom:20px;
font-size:12px;
line-height:16px;
width:40px;
height:20px;
-webkit-border-radius:18px;
-moz-border-radius:18px;
border-radius:18px;
background:#f8f8f8;
cursor:pointer;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.checkbox-label:before {
content:'';
display:block;
position:absolute;
z-index:1;
line-height:34px;
text-indent:40px;
height:20px;
width:20px;
-webkit-border-radius:100%;
-moz-border-radius:100%;
border-radius:100%;
top:0px;
left:0px;
right:auto;
background:white;
-webkit-box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
-moz-box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.checkbox-label:after {
content: attr(data-off);
font-size: 13px;
display: block;
position: absolute;
z-index: 0;
top: 0;
left: 50px;
padding: 0;
height: 20px;
line-height: 20px;
width: 36px;
text-align: left;
color: #BFBFBF;
white-space: nowrap;
-webkit-transition: .25s ease-in-out;
-moz-transition: .25s ease-in-out;
-o-transition: .25s ease-in-out;
transition: .25s ease-in-out;
}
/* Switch CHECKBOX */
.switch-checkbox + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
-moz-box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
background: #dddddd;
}
.switch-checkbox:checked + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
-moz-box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
background: #0094DD;
}
.switch-checkbox:checked + .checkbox-label:after {
color:#0094DD;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
/* Toggle Checkbox */
.ios-toggle:checked + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
-moz-box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
}
.ios-toggle:checked + .checkbox-label:before {
left:calc(100% - 21px);
-webkit-box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
-moz-box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.ios-toggle:checked + .checkbox-label:after {
content:attr(data-on);
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.ios-toggle[type=checkbox] {
display: none;
}
.brainstorm-updater-switch {
display: inline-block;
position: absolute;
right: 0;
top: 0;
}
input.form-control.smile-switch.switch + label.bsf-switch-btn:before {
display: none;
}
input.form-control.smile-input.bsf-switch-input {
display: none;
}
.switch-wrapper {
width: 95px;
}
.shadow_type .onoffswitch-switch {
width: 45px;
}
.shadow_type .onoffswitch-inactive .onoffswitch-switch:before {
right: 45px;
}
.shadow_type .onoffswitch-active .onoffswitch-switch:before {
left: 45px;
}
.ios-toggle, .ios-toggle:active {
position:absolute;
top:-5000px;
height:0;
width:0;
opacity:0;
border:none;
outline:none;
}
.checkbox-label {
display:block;
position:relative;
padding:0px;
margin: 0px;
margin-bottom:20px;
font-size:12px;
line-height:16px;
width:40px;
height:20px;
-webkit-border-radius:18px;
-moz-border-radius:18px;
border-radius:18px;
background:#f8f8f8;
cursor:pointer;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.checkbox-label:before {
content:'';
display:block;
position:absolute;
z-index:1;
line-height:34px;
text-indent:40px;
height:20px;
width:20px;
-webkit-border-radius:100%;
-moz-border-radius:100%;
border-radius:100%;
top:0px;
left:0px;
right:auto;
background:white;
-webkit-box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
-moz-box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
box-shadow:0 3px 3px rgba(0, 0, 0, .2), 0 0 0 2px #dddddd;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.checkbox-label:after {
content: attr(data-off);
font-size: 13px;
display: block;
position: absolute;
z-index: 0;
top: 0;
left: 50px;
padding: 0;
height: 20px;
line-height: 20px;
width: 36px;
text-align: left;
color: #BFBFBF;
white-space: nowrap;
-webkit-transition: .25s ease-in-out;
-moz-transition: .25s ease-in-out;
-o-transition: .25s ease-in-out;
transition: .25s ease-in-out;
}
/* Switch CHECKBOX */
.switch-checkbox + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
-moz-box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
box-shadow:inset 0 0 0 18px #dddddd, 0 0 0 2px #dddddd;
background: #dddddd;
}
.switch-checkbox:checked + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
-moz-box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
box-shadow:inset 0 0 0 18px #0094DD, 0 0 0 2px #0094DD;
background: #0094DD;
}
.switch-checkbox:checked + .checkbox-label:after {
color:#0094DD;
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
/* Toggle Checkbox */
.ios-toggle:checked + .checkbox-label {
-webkit-box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
-moz-box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
box-shadow:inset 0 0 0 20px #0094DD, 0 0 0 2px #0094DD;
}
.ios-toggle:checked + .checkbox-label:before {
left:calc(100% - 21px);
-webkit-box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
-moz-box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
box-shadow:0 0 0 1px transparent, 0 2px 2px rgba(0, 0, 0, .3);
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.ios-toggle:checked + .checkbox-label:after {
content:attr(data-on);
-webkit-transition:.25s ease-in-out;
-moz-transition:.25s ease-in-out;
-o-transition:.25s ease-in-out;
transition:.25s ease-in-out;
}
.ios-toggle[type=checkbox] {
display: none;
}
.brainstorm-updater-switch {
display: inline-block;
position: absolute;
right: 0;
top: 0;
}
@@ -1,11 +1,11 @@
<?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;" d="" horiz-adv-x="512" />
<glyph unicode="&#xe603;" d="M467.577-21.5c-2.284 7.369-0.104 15.762 7.18 20.556 10.155 6.679 25.5 20.586 84.534 27.952 35.525 4.396-8.694-54.877-3.142-34.181 1.955 7.287-25.91 1.952-25.91 1.952s-46.553-8.773-58.643-24.894c0 0-1.733 2.227-4.019 8.615zM138.271 557.027c0 0 15.887 237.492 368.384 222.11 0 0 146.319-12.099 215.165-56.96 0 0-293.96 10.546-583.551-165.149zM181.807 507.887c0 0 203.521 128.399 558.772 144.239 0 0 48.21-0.329 72.158-35.208 0 0 14.367-31.64 14.086-88.5 0 0-48.229-1.442-85.408-2.723 0 0-355.977-11.586-537.674-199.511 12.648 44.529-121.089 119.532-21.934 181.703zM255.72 238.57c0 0-14.079 43.451 43.498 69.493 54.329 24.572 127.831 96.191 426.625 133.305 0 0 124.558 25.427 48.884-54.439-84.28-88.948-100.337-111.947-100.337-111.947s-22.41-25.55-14.155 5.204c8.255 30.756-120.967 22.15-120.967 22.15s-201.788-45.676-252.733-113.604c0 0-21.178 22.924-30.816 49.839zM369.409 146.887c0 0 106.32 73.825 227.492 55.88 0 0 29.174-1.921-1.115-22.419-30.29-20.503-226.376-33.461-226.376-33.461zM418.719 53.659c0 0-11.482 30.506 7.413 36.941s36.903 30.834 136.907 41.988c40.619-4.038 1.169-110.607-7.296-79.135 2.763 10.295-10.126 9.762-10.126 9.762s-93.985-18.303-111.035-41.039c0 0-12.635 22.476-15.862 31.483zM899.013 687.749c92.851-208.867-26.868-487.037-271.661-536.994 233.968 65.7 273.711 363.944 218.284 497.451-81.853 197.157-343.286 268.698-505.34 206.428-162.056-62.269-203.018-122.175-238.522-224.811 32.087 89.126 91.171 209.056 273.127 278.972 181.958 69.917 431.262-12.179 524.112-221.047z" />
<?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;" d="" horiz-adv-x="512" />
<glyph unicode="&#xe603;" d="M467.577-21.5c-2.284 7.369-0.104 15.762 7.18 20.556 10.155 6.679 25.5 20.586 84.534 27.952 35.525 4.396-8.694-54.877-3.142-34.181 1.955 7.287-25.91 1.952-25.91 1.952s-46.553-8.773-58.643-24.894c0 0-1.733 2.227-4.019 8.615zM138.271 557.027c0 0 15.887 237.492 368.384 222.11 0 0 146.319-12.099 215.165-56.96 0 0-293.96 10.546-583.551-165.149zM181.807 507.887c0 0 203.521 128.399 558.772 144.239 0 0 48.21-0.329 72.158-35.208 0 0 14.367-31.64 14.086-88.5 0 0-48.229-1.442-85.408-2.723 0 0-355.977-11.586-537.674-199.511 12.648 44.529-121.089 119.532-21.934 181.703zM255.72 238.57c0 0-14.079 43.451 43.498 69.493 54.329 24.572 127.831 96.191 426.625 133.305 0 0 124.558 25.427 48.884-54.439-84.28-88.948-100.337-111.947-100.337-111.947s-22.41-25.55-14.155 5.204c8.255 30.756-120.967 22.15-120.967 22.15s-201.788-45.676-252.733-113.604c0 0-21.178 22.924-30.816 49.839zM369.409 146.887c0 0 106.32 73.825 227.492 55.88 0 0 29.174-1.921-1.115-22.419-30.29-20.503-226.376-33.461-226.376-33.461zM418.719 53.659c0 0-11.482 30.506 7.413 36.941s36.903 30.834 136.907 41.988c40.619-4.038 1.169-110.607-7.296-79.135 2.763 10.295-10.126 9.762-10.126 9.762s-93.985-18.303-111.035-41.039c0 0-12.635 22.476-15.862 31.483zM899.013 687.749c92.851-208.867-26.868-487.037-271.661-536.994 233.968 65.7 273.711 363.944 218.284 497.451-81.853 197.157-343.286 268.698-505.34 206.428-162.056-62.269-203.018-122.175-238.522-224.811 32.087 89.126 91.171 209.056 273.127 278.972 181.958 69.917 431.262-12.179 524.112-221.047z" />
</font></defs></svg>

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

@@ -1,32 +1,32 @@
jQuery( document ).on('click', '.bsf-envato-form-activation', function(event) {
submitButton = jQuery( this ).parent('.submit-button-wrap');
console.log(submitButton);
product_id = submitButton.siblings( 'form input[name="product_id"]' ).val();
url = submitButton.siblings( 'form input[name="url"]' ).val();
redirect = submitButton.siblings( 'form input[name="redirect"]' ).val();
privacyConsent = submitButton.siblings( 'input#bsf-license-privacy-consent').val();
termsConditionConsent = submitButton.siblings( 'input#bsf-license-terms-conditions-consent').val();
envato_activation_nonce = bsf_core.envato_activation_nonce;
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
action: 'bsf_envato_redirect_url',
product_id: product_id,
url: url,
redirect: redirect,
privacy_consent: privacyConsent,
terms_conditions_consent: termsConditionConsent,
envato_activation_nonce: envato_activation_nonce,
}
})
.done(function( response ) {
window.location = response.data.url;
return true;
})
.fail(function(e) {
return false;
});
return false;
jQuery( document ).on('click', '.bsf-envato-form-activation', function(event) {
submitButton = jQuery( this ).parent('.submit-button-wrap');
console.log(submitButton);
product_id = submitButton.siblings( 'form input[name="product_id"]' ).val();
url = submitButton.siblings( 'form input[name="url"]' ).val();
redirect = submitButton.siblings( 'form input[name="redirect"]' ).val();
privacyConsent = submitButton.siblings( 'input#bsf-license-privacy-consent').val();
termsConditionConsent = submitButton.siblings( 'input#bsf-license-terms-conditions-consent').val();
envato_activation_nonce = bsf_core.envato_activation_nonce;
jQuery.ajax({
url: ajaxurl,
dataType: 'json',
data: {
action: 'bsf_envato_redirect_url',
product_id: product_id,
url: url,
redirect: redirect,
privacy_consent: privacyConsent,
terms_conditions_consent: termsConditionConsent,
envato_activation_nonce: envato_activation_nonce,
}
})
.done(function( response ) {
window.location = response.data.url;
return true;
})
.fail(function(e) {
return false;
});
return false;
});
@@ -1,105 +1,105 @@
(function ($) {
var BSFExtensionInstaller = {
init: function () {
$(document).on('click', '.bsf-install-button', BSFExtensionInstaller._installNow);
$( document ).on('wp-plugin-installing' , BSFExtensionInstaller._pluginInstalling);
$( document ).on('wp-plugin-install-error' , BSFExtensionInstaller._installError);
$( document ).on('wp-plugin-install-success' , BSFExtensionInstaller._installSuccess);
},
/**
* Install Now
*/
_installNow: function (event) {
event.preventDefault();
var $button = jQuery(event.target),
$document = jQuery(document);
if ( $button.hasClass('updating-message') || $button.hasClass('button-disabled') ) {
return;
}
if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
wp.updates.requestFilesystemCredentials(event);
$document.on('credential-modal-cancel', function () {
var $message = $('.install-now.updating-message');
$message
.removeClass('updating-message')
.text(wp.updates.l10n.installNow);
wp.a11y.speak(wp.updates.l10n.updateCancel, 'polite');
});
}
wp.updates.installPlugin({
slug: $button.data('slug')
});
},
/**
* Install Success
*/
_installSuccess: function( event, response ) {
event.preventDefault();
// Transform the 'Install' button into an 'Activate' button.
var $init = $( '.bsf-extension-' + response.slug ).data('init');
var nonce = $( '#bsf_activate_extension_nonce' ).val();
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
setTimeout( function() {
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
'action' : 'bsf-extention-activate',
'init' : $init,
'security' : nonce
},
})
.done(function (result) {
if( result.success ) {
$ext = $('.bsf-extension-' + response.slug );
$ext.addClass('bsf-plugin-installed');
$ext.find('.bsf-install-button').addClass('bsf-plugin-installed-button').html('Installed <i class="dashicons dashicons-yes"></i>');
$ext.find('.bsf-extension-start-install').removeClass('show-install');
}
});
}, 1200 );
},
/**
* Plugin Installation Error.
*/
_installError: function( event, response ) {
var $card = $( '.bsf-extension-' + response.slug + ' .bsf-extension-start-install-content')
$card.html( '<h2>' + response.errorMessage + '</h2>' );
},
/**
* Installing Plugin
*/
_pluginInstalling: function(event, args) {
event.preventDefault();
$('.bsf-extension-' + args.slug + ' .bsf-extension-start-install').addClass('show-install');
},
}
/**
* Initialize BSFExtensionInstaller
*/
$(function () {
BSFExtensionInstaller.init();
});
(function ($) {
var BSFExtensionInstaller = {
init: function () {
$(document).on('click', '.bsf-install-button', BSFExtensionInstaller._installNow);
$( document ).on('wp-plugin-installing' , BSFExtensionInstaller._pluginInstalling);
$( document ).on('wp-plugin-install-error' , BSFExtensionInstaller._installError);
$( document ).on('wp-plugin-install-success' , BSFExtensionInstaller._installSuccess);
},
/**
* Install Now
*/
_installNow: function (event) {
event.preventDefault();
var $button = jQuery(event.target),
$document = jQuery(document);
if ( $button.hasClass('updating-message') || $button.hasClass('button-disabled') ) {
return;
}
if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
wp.updates.requestFilesystemCredentials(event);
$document.on('credential-modal-cancel', function () {
var $message = $('.install-now.updating-message');
$message
.removeClass('updating-message')
.text(wp.updates.l10n.installNow);
wp.a11y.speak(wp.updates.l10n.updateCancel, 'polite');
});
}
wp.updates.installPlugin({
slug: $button.data('slug')
});
},
/**
* Install Success
*/
_installSuccess: function( event, response ) {
event.preventDefault();
// Transform the 'Install' button into an 'Activate' button.
var $init = $( '.bsf-extension-' + response.slug ).data('init');
var nonce = $( '#bsf_activate_extension_nonce' ).val();
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
setTimeout( function() {
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
'action' : 'bsf-extention-activate',
'init' : $init,
'security' : nonce
},
})
.done(function (result) {
if( result.success ) {
$ext = $('.bsf-extension-' + response.slug );
$ext.addClass('bsf-plugin-installed');
$ext.find('.bsf-install-button').addClass('bsf-plugin-installed-button').html('Installed <i class="dashicons dashicons-yes"></i>');
$ext.find('.bsf-extension-start-install').removeClass('show-install');
}
});
}, 1200 );
},
/**
* Plugin Installation Error.
*/
_installError: function( event, response ) {
var $card = $( '.bsf-extension-' + response.slug + ' .bsf-extension-start-install-content')
$card.html( '<h2>' + response.errorMessage + '</h2>' );
},
/**
* Installing Plugin
*/
_pluginInstalling: function(event, args) {
event.preventDefault();
$('.bsf-extension-' + args.slug + ' .bsf-extension-start-install').addClass('show-install');
},
}
/**
* Initialize BSFExtensionInstaller
*/
$(function () {
BSFExtensionInstaller.init();
});
})(jQuery);
@@ -1,263 +1,263 @@
/* ========================================================================
* Frosty.js v1.0
* https://github.com/owensbla/frosty
* http://labs.blakeowens.com/frosty
*
* Plugin boilerplate provied by: http://jqueryboilerplate.com/
* ========================================================================
* Copyright 2013 Blake Owens
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ======================================================================== */
;(function ($, window, document, undefined) {
var pluginName = "frosty";
var defaults = {
attribute: 'title',
className: 'tip',
content: '',
delay: 0,
hasArrow: true,
html: false,
offset: 30,
position: 'left',
removeTitle: true,
selector: false,
trigger: 'hover,focus',
onHidden: function() {},
onShown: function() {},
};
function Frosty(anchor, options) {
this.anchor = anchor;
this.$anchor = $(anchor);
this.options = $.extend({}, defaults, options, this.$anchor.data());
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Frosty.prototype = {
init: function () {
this._createTip();
this._bindEvents();
},
show: function() {
var _this = this,
delay = typeof this.options.delay === 'object' ? parseInt(this.options.delay.show) : parseInt(this.options.delay);
clearTimeout(this.timeout);
this.timeout = delay === 0 ?
this._setState('visible') :
setTimeout(function() { _this._setState('visible'); }, delay);
},
hide: function() {
var _this = this
delay = typeof this.options.delay === 'object' ? parseInt(this.options.delay.hide) : parseInt(this.options.delay);
clearTimeout(this.timeout);
this.timeout = delay === 0 ?
this._setState('hidden') :
setTimeout(function() { _this._setState('hidden'); }, delay);
},
toggle: function() {
this.state === 'visible' ? this.hide() : this.show();
},
addClass: function(klass) {
console.log("in");
if (typeof klass === 'string') { this.$el.addClass(klass); }
},
removeClass: function(klass) {
if (typeof klass === 'string') { this.$el.removeClass(klass); }
},
_setState: function(state) {
this.state = state;
switch (state) {
case 'visible':
this.$el.appendTo('body');
this._checkContent();
this._setPosition();
this.options.onShown.call(this);
this.$anchor.trigger('shown');
break;
case 'hidden':
this.$el.detach();
this.options.onHidden.call(this);
this.$anchor.trigger('hidden');
break;
}
},
_checkContent: function() {
if (this.options.selector) {
this.tipContent = $(this.options.selector).html();
this.$el.html(this.tipContent);
}
},
_createTip: function() {
if (this.options.html) {
this.tipContent = this.options.content;
} else if (this.options.selector) {
this.tipContent = $(this.options.selector).html();
} else {
this.tipContent = this.$anchor.attr(this.options.attribute);
if (this.options.attribute === 'title' && this.options.removeTitle) {
this.$anchor.attr('data-original-title', this.tipContent);
this.$anchor.removeAttr('title');
}
}
this.$el = $('<div />', {
'class': this.options.className,
html: '<span class="cp_tooltip_text">'+this.tipContent+'</span>'
}).css({
'z-index': '9999999999',
'left': '-9999px',
'position': 'absolute',
});
this.$el.appendTo('body');
var coords = this.getPosition();
this.$el.detach().css(coords);
if (this.options.hasArrow) { this._addArrowClass(); }
},
_addArrowClass: function() {
switch (this.options.position) {
case 'left':
this.$el.addClass('arrow-right');
break;
case 'right':
this.$el.addClass('arrow-left');
break;
case 'bottom':
this.$el.addClass('arrow-top');
break;
default:
this.$el.addClass('arrow-bottom');
}
},
_bindEvents: function() {
switch (this.options.trigger) {
case 'click':
this.$anchor.click($.proxy(this.toggle, this));
break
case 'manual':
break;
case 'focus':
this.$anchor.focus($.proxy(this.show, this));
this.$anchor.blur($.proxy(this.hide, this));
break;
default:
this.$anchor.hover($.proxy(this.show, this), $.proxy(this.hide, this));
}
//$(window).resize($.proxy(this._setPosition, this));
},
getPosition: function () {
var coords = this.$anchor.offset();
switch (this.options.position) {
case 'left':
coords.left = coords.left - this.$el.outerWidth() - this.options.offset;
coords.top = coords.top + (this.$anchor.outerHeight() / 2) - (this.$el.outerHeight() / 2);
break;
case 'right':
coords.left = coords.left + this.$anchor.outerWidth() + this.options.offset;
coords.top = coords.top + (this.$anchor.outerHeight() / 2) - (this.$el.outerHeight() / 2);
break;
case 'bottom':
coords.top = coords.top + this.$anchor.outerHeight() + this.options.offset;
coords.left = coords.left + (this.$anchor.outerWidth() / 2) - (this.$el.outerWidth() / 2);
break;
default:
coords.top = coords.top - this.$el.outerHeight() - this.options.offset;
var left = coords.left + (this.$anchor.outerWidth() / 2) - (this.$el.outerWidth() / 2);
if( left < 0 )
left = 0;
coords.left = left;
}
//console.log(coords);
return coords;
},
_setPosition: function() {
this.$el.css(this.getPosition());
}
};
$.fn[pluginName] = function (options, args) {
//console.log($.data(this, "plugin_" + pluginName));
if (typeof options === 'string') {
//console.log(options);
switch (options) {
case 'show':
this.each(function() { $.data(this, "plugin_" + pluginName)['show'](); });
break;
case 'hide':
this.each(function() { $.data(this, "plugin_" + pluginName)['hide'](); });
break;
case 'toggle':
this.each(function() { $.data(this, "plugin_" + pluginName)['toggle'](); });
break;
case 'addClass':
this.each(function() { $.data(this, "plugin_" + pluginName)['addClass'](args); });
break;
case 'removeClass':
this.each(function() { $.data(this, "plugin_" + pluginName)['removeClass'](args); });
break;
}
}
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Frosty(this, options));
}
});
};
})(jQuery, window, document);
(function($){
$(document).ready(function(){
$('.bsf-has-tip, .has-tip').each(function(i,tip){
$tip = $(tip);
var attribute = (typeof $tip.attr('data-attribute') != 'undefined') ? $tip.attr('data-attribute') : 'title';
var offset = (typeof $tip.attr('data-offset') != 'undefined') ? $tip.attr('data-offset') : 10;
var position = (typeof $tip.attr('data-position') != 'undefined') ? $tip.attr('data-position') : 'top';
var trigger = (typeof $tip.attr('data-trigger')) ? $tip.attr('data-trigger') : 'hover,focus';
var className = (typeof $tip.attr('data-classes') != 'undefined') ? 'tip '+$tip.attr('data-classes') : 'tip';
$tip.frosty({
className : className,
attribute: attribute,
offset: offset,
position: position,
trigger: trigger
});
});
});
})(jQuery);
/* ========================================================================
* Frosty.js v1.0
* https://github.com/owensbla/frosty
* http://labs.blakeowens.com/frosty
*
* Plugin boilerplate provied by: http://jqueryboilerplate.com/
* ========================================================================
* Copyright 2013 Blake Owens
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
* LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
* ======================================================================== */
;(function ($, window, document, undefined) {
var pluginName = "frosty";
var defaults = {
attribute: 'title',
className: 'tip',
content: '',
delay: 0,
hasArrow: true,
html: false,
offset: 30,
position: 'left',
removeTitle: true,
selector: false,
trigger: 'hover,focus',
onHidden: function() {},
onShown: function() {},
};
function Frosty(anchor, options) {
this.anchor = anchor;
this.$anchor = $(anchor);
this.options = $.extend({}, defaults, options, this.$anchor.data());
this._defaults = defaults;
this._name = pluginName;
this.init();
}
Frosty.prototype = {
init: function () {
this._createTip();
this._bindEvents();
},
show: function() {
var _this = this,
delay = typeof this.options.delay === 'object' ? parseInt(this.options.delay.show) : parseInt(this.options.delay);
clearTimeout(this.timeout);
this.timeout = delay === 0 ?
this._setState('visible') :
setTimeout(function() { _this._setState('visible'); }, delay);
},
hide: function() {
var _this = this
delay = typeof this.options.delay === 'object' ? parseInt(this.options.delay.hide) : parseInt(this.options.delay);
clearTimeout(this.timeout);
this.timeout = delay === 0 ?
this._setState('hidden') :
setTimeout(function() { _this._setState('hidden'); }, delay);
},
toggle: function() {
this.state === 'visible' ? this.hide() : this.show();
},
addClass: function(klass) {
console.log("in");
if (typeof klass === 'string') { this.$el.addClass(klass); }
},
removeClass: function(klass) {
if (typeof klass === 'string') { this.$el.removeClass(klass); }
},
_setState: function(state) {
this.state = state;
switch (state) {
case 'visible':
this.$el.appendTo('body');
this._checkContent();
this._setPosition();
this.options.onShown.call(this);
this.$anchor.trigger('shown');
break;
case 'hidden':
this.$el.detach();
this.options.onHidden.call(this);
this.$anchor.trigger('hidden');
break;
}
},
_checkContent: function() {
if (this.options.selector) {
this.tipContent = $(this.options.selector).html();
this.$el.html(this.tipContent);
}
},
_createTip: function() {
if (this.options.html) {
this.tipContent = this.options.content;
} else if (this.options.selector) {
this.tipContent = $(this.options.selector).html();
} else {
this.tipContent = this.$anchor.attr(this.options.attribute);
if (this.options.attribute === 'title' && this.options.removeTitle) {
this.$anchor.attr('data-original-title', this.tipContent);
this.$anchor.removeAttr('title');
}
}
this.$el = $('<div />', {
'class': this.options.className,
html: '<span class="cp_tooltip_text">'+this.tipContent+'</span>'
}).css({
'z-index': '9999999999',
'left': '-9999px',
'position': 'absolute',
});
this.$el.appendTo('body');
var coords = this.getPosition();
this.$el.detach().css(coords);
if (this.options.hasArrow) { this._addArrowClass(); }
},
_addArrowClass: function() {
switch (this.options.position) {
case 'left':
this.$el.addClass('arrow-right');
break;
case 'right':
this.$el.addClass('arrow-left');
break;
case 'bottom':
this.$el.addClass('arrow-top');
break;
default:
this.$el.addClass('arrow-bottom');
}
},
_bindEvents: function() {
switch (this.options.trigger) {
case 'click':
this.$anchor.click($.proxy(this.toggle, this));
break
case 'manual':
break;
case 'focus':
this.$anchor.focus($.proxy(this.show, this));
this.$anchor.blur($.proxy(this.hide, this));
break;
default:
this.$anchor.hover($.proxy(this.show, this), $.proxy(this.hide, this));
}
//$(window).resize($.proxy(this._setPosition, this));
},
getPosition: function () {
var coords = this.$anchor.offset();
switch (this.options.position) {
case 'left':
coords.left = coords.left - this.$el.outerWidth() - this.options.offset;
coords.top = coords.top + (this.$anchor.outerHeight() / 2) - (this.$el.outerHeight() / 2);
break;
case 'right':
coords.left = coords.left + this.$anchor.outerWidth() + this.options.offset;
coords.top = coords.top + (this.$anchor.outerHeight() / 2) - (this.$el.outerHeight() / 2);
break;
case 'bottom':
coords.top = coords.top + this.$anchor.outerHeight() + this.options.offset;
coords.left = coords.left + (this.$anchor.outerWidth() / 2) - (this.$el.outerWidth() / 2);
break;
default:
coords.top = coords.top - this.$el.outerHeight() - this.options.offset;
var left = coords.left + (this.$anchor.outerWidth() / 2) - (this.$el.outerWidth() / 2);
if( left < 0 )
left = 0;
coords.left = left;
}
//console.log(coords);
return coords;
},
_setPosition: function() {
this.$el.css(this.getPosition());
}
};
$.fn[pluginName] = function (options, args) {
//console.log($.data(this, "plugin_" + pluginName));
if (typeof options === 'string') {
//console.log(options);
switch (options) {
case 'show':
this.each(function() { $.data(this, "plugin_" + pluginName)['show'](); });
break;
case 'hide':
this.each(function() { $.data(this, "plugin_" + pluginName)['hide'](); });
break;
case 'toggle':
this.each(function() { $.data(this, "plugin_" + pluginName)['toggle'](); });
break;
case 'addClass':
this.each(function() { $.data(this, "plugin_" + pluginName)['addClass'](args); });
break;
case 'removeClass':
this.each(function() { $.data(this, "plugin_" + pluginName)['removeClass'](args); });
break;
}
}
return this.each(function () {
if (!$.data(this, "plugin_" + pluginName)) {
$.data(this, "plugin_" + pluginName, new Frosty(this, options));
}
});
};
})(jQuery, window, document);
(function($){
$(document).ready(function(){
$('.bsf-has-tip, .has-tip').each(function(i,tip){
$tip = $(tip);
var attribute = (typeof $tip.attr('data-attribute') != 'undefined') ? $tip.attr('data-attribute') : 'title';
var offset = (typeof $tip.attr('data-offset') != 'undefined') ? $tip.attr('data-offset') : 10;
var position = (typeof $tip.attr('data-position') != 'undefined') ? $tip.attr('data-position') : 'top';
var trigger = (typeof $tip.attr('data-trigger')) ? $tip.attr('data-trigger') : 'hover,focus';
var className = (typeof $tip.attr('data-classes') != 'undefined') ? 'tip '+$tip.attr('data-classes') : 'tip';
$tip.frosty({
className : className,
attribute: attribute,
offset: offset,
position: position,
trigger: trigger
});
});
});
})(jQuery);
@@ -1,151 +1,151 @@
(function($){
BSFCoreLicenseForm = {
/**
* Init
*/
init: function()
{
this._showFormOnLoad();
this._bind();
},
/**
* Binds events
*/
_bind: function()
{
$( document ).on('click', '.bsf-core-license-form-btn', BSFCoreLicenseForm._showFormOnClick);
$( document ).on('click', '.bsf-core-license-form-close-btn', BSFCoreLicenseForm._closeForm);
$( document ).on('click', '.bsf-core-license-form .bsf-core-license-form-overlay', BSFCoreLicenseForm._closeForm);
},
_changeURL: function( url )
{
History.pushState(null, null, url);
},
/**
* Show form on Load
*/
_showFormOnLoad: function( e )
{
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var slug = BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form');
BSFCoreLicenseForm._showForm( slug );
}
},
/**
* Show form on Click
*/
_showFormOnClick: function( e )
{
// don't override click action if the link is not from the popup form.
var licenseFormURl = $( this ).attr('href') || '';
if ( null !== BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form', licenseFormURl) ||
true === $( this ).hasClass('bsf-core-plugin-link') ) {
e.preventDefault();
var slug = $( this ).attr('plugin-slug') || '';
var url_params = {'bsf-inline-license-form':slug};
BSFCoreLicenseForm._showForm( slug );
// Change URL.
if( ! BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var current_url = window.location.href;
var current_url_separator = ( window.location.href.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = current_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
BSFCoreLicenseForm._changeURL( new_url );
}
}
},
/**
* Show form by slug
*/
_showForm: function( slug )
{
if( $(".bsf-core-license-form[plugin-slug='"+slug+"']").length ) {
$(".bsf-core-license-form[plugin-slug='"+slug+"']").show();
$('body').addClass('bsf-core-license-form-open');
}
},
/**
* Close form.
*/
_closeForm: function( e )
{
e.preventDefault();
$('.bsf-core-license-form').hide();
$('body').removeClass('bsf-core-license-form-open');
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var url_params = BSFCoreLicenseForm._getQueryStrings();
delete url_params['bsf-inline-license-form'];
delete url_params['bsf-inline-license-form'];
delete url_params['license_action'];
delete url_params['token'];
delete url_params['product_id'];
delete url_params['purchase_key'];
delete url_params['success'];
delete url_params['status'];
delete url_params['message'];
delete url_params['debug'];
delete url_params['activation_method'];
var current_url = window.location.href;
var root_url = current_url.substr(0, current_url.indexOf('?'));
if( jQuery.isEmptyObject( url_params ) ) {
var new_url = root_url + decodeURIComponent( $.param( url_params ) );
} else {
var current_url_separator = ( root_url.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = root_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
}
// Change URL.
BSFCoreLicenseForm._changeURL( new_url );
}
},
/**
* Get URL param.
*/
_getParamFromURL: function(name, url)
{
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
},
/**
* Get query strings.
*/
_getQueryStrings( str )
{
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
};
/**
* Initialization
*/
$(function(){
BSFCoreLicenseForm.init();
});
(function($){
BSFCoreLicenseForm = {
/**
* Init
*/
init: function()
{
this._showFormOnLoad();
this._bind();
},
/**
* Binds events
*/
_bind: function()
{
$( document ).on('click', '.bsf-core-license-form-btn', BSFCoreLicenseForm._showFormOnClick);
$( document ).on('click', '.bsf-core-license-form-close-btn', BSFCoreLicenseForm._closeForm);
$( document ).on('click', '.bsf-core-license-form .bsf-core-license-form-overlay', BSFCoreLicenseForm._closeForm);
},
_changeURL: function( url )
{
History.pushState(null, null, url);
},
/**
* Show form on Load
*/
_showFormOnLoad: function( e )
{
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var slug = BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form');
BSFCoreLicenseForm._showForm( slug );
}
},
/**
* Show form on Click
*/
_showFormOnClick: function( e )
{
// don't override click action if the link is not from the popup form.
var licenseFormURl = $( this ).attr('href') || '';
if ( null !== BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form', licenseFormURl) ||
true === $( this ).hasClass('bsf-core-plugin-link') ) {
e.preventDefault();
var slug = $( this ).attr('plugin-slug') || '';
var url_params = {'bsf-inline-license-form':slug};
BSFCoreLicenseForm._showForm( slug );
// Change URL.
if( ! BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var current_url = window.location.href;
var current_url_separator = ( window.location.href.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = current_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
BSFCoreLicenseForm._changeURL( new_url );
}
}
},
/**
* Show form by slug
*/
_showForm: function( slug )
{
if( $(".bsf-core-license-form[plugin-slug='"+slug+"']").length ) {
$(".bsf-core-license-form[plugin-slug='"+slug+"']").show();
$('body').addClass('bsf-core-license-form-open');
}
},
/**
* Close form.
*/
_closeForm: function( e )
{
e.preventDefault();
$('.bsf-core-license-form').hide();
$('body').removeClass('bsf-core-license-form-open');
if( BSFCoreLicenseForm._getParamFromURL('bsf-inline-license-form') ) {
var url_params = BSFCoreLicenseForm._getQueryStrings();
delete url_params['bsf-inline-license-form'];
delete url_params['bsf-inline-license-form'];
delete url_params['license_action'];
delete url_params['token'];
delete url_params['product_id'];
delete url_params['purchase_key'];
delete url_params['success'];
delete url_params['status'];
delete url_params['message'];
delete url_params['debug'];
delete url_params['activation_method'];
var current_url = window.location.href;
var root_url = current_url.substr(0, current_url.indexOf('?'));
if( jQuery.isEmptyObject( url_params ) ) {
var new_url = root_url + decodeURIComponent( $.param( url_params ) );
} else {
var current_url_separator = ( root_url.indexOf( "?" ) === -1 ) ? "?" : "&";
var new_url = root_url + current_url_separator + decodeURIComponent( $.param( url_params ) );
}
// Change URL.
BSFCoreLicenseForm._changeURL( new_url );
}
},
/**
* Get URL param.
*/
_getParamFromURL: function(name, url)
{
if (!url) url = window.location.href;
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
},
/**
* Get query strings.
*/
_getQueryStrings( str )
{
return (str || document.location.search).replace(/(^\?)/,'').split("&").map(function(n){return n = n.split("="),this[n[0]] = n[1],this}.bind({}))[0];
}
};
/**
* Initialization
*/
$(function(){
BSFCoreLicenseForm.init();
});
})(jQuery);
@@ -1,16 +1,16 @@
jQuery(document).ready(function(){
var switch_btn = jQuery(".bsf-switch-btn");
jQuery(document).on('click', '.bsf-switch-btn', function(e){
var id = jQuery(this).data('id');
var value = jQuery(this).parents(".switch-wrapper").find("#"+id).val();
if( value == 1 || value == '1' ) {
jQuery(this).parents(".switch-wrapper").find("#"+id).attr('value','0');
} else {
jQuery(this).parents(".switch-wrapper").find("#"+id).attr('value','1');
}
jQuery(this).parents(".switch-wrapper").find(".bsf-switch-input").trigger('change');
});
jQuery(document).ready(function(){
var switch_btn = jQuery(".bsf-switch-btn");
jQuery(document).on('click', '.bsf-switch-btn', function(e){
var id = jQuery(this).data('id');
var value = jQuery(this).parents(".switch-wrapper").find("#"+id).val();
if( value == 1 || value == '1' ) {
jQuery(this).parents(".switch-wrapper").find("#"+id).attr('value','0');
} else {
jQuery(this).parents(".switch-wrapper").find("#"+id).attr('value','1');
}
jQuery(this).parents(".switch-wrapper").find(".bsf-switch-input").trigger('change');
});
});
@@ -1,61 +1,61 @@
(function($){
var currentRollbackButton;
rollbackVersion = {
init: function() {
$( document ).on('change', '.bsf-rollback-version-select' , rollbackVersion.onSelectVersion );
$( document ).on('click', '.bsf-rollback-button' , rollbackVersion.onRollbackClick );
$( document ).on('click', '.bsf-confirm-cancel' , rollbackVersion.closeRollbackPopup );
$( document ).on('click', '.bsf-confirm-ok' , rollbackVersion.onRollbackOk );
},
onSelectVersion:function() {
var selectRollback = jQuery( this );
rollbackButton = selectRollback.next( '.bsf-rollback-button' )
placeholderText = rollbackButton.data( 'placeholder-text' );
placeholderUrl = rollbackButton.data( 'placeholder-url' );
rollbackButton.attr( 'href', placeholderUrl.replace( 'VERSION', selectRollback.val() ) );
},
onRollbackClick: function ( e ) {
e.preventDefault();
var rollbackButton = jQuery( this );
// This will update the current rollback button object.
currentRollbackButton = rollbackButton;
rollbackHeading = $('.bsf-confirm-heading');
rollbackConfirmText = $('.bsf-rollback-text');
closestDiv = rollbackButton.closest('.bsf-rollback-version');
versionNumber = closestDiv.find('.bsf-rollback-version-select').val();
selectProductName = closestDiv.find('#bsf-product-name').val();
// Rollback Heading text.
rollbackHeadingdata = rollbackHeading.data('text').replace( '#PRODUCT_NAME#', selectProductName );
rollbackHeading.html( rollbackHeadingdata );
// Rollback Confirmation text.
rollbackConfirmdata = rollbackConfirmText.data('text').replace( '#PRODUCT_NAME#', selectProductName );
rollbackConfirmdata = rollbackConfirmdata.replace( '#VERSION#', versionNumber )
rollbackConfirmText.html( rollbackConfirmdata );
document.querySelector('.bsf-confirm-rollback-popup').style.display = 'block';
},
closeRollbackPopup: function ( e ) {
document.querySelector('.bsf-confirm-rollback-popup').style.display = 'none';
},
onRollbackOk:function ( e ) {
e.preventDefault();
if( currentRollbackButton ){
var redirectUrl = currentRollbackButton.closest('.bsf-rollback-version').find('.bsf-rollback-button').attr('href');
location.href = redirectUrl;
}
rollbackVersion.closeRollbackPopup( e );
}
}
$( document ).ready(function() {
rollbackVersion.init();
});
})( jQuery );
(function($){
var currentRollbackButton;
rollbackVersion = {
init: function() {
$( document ).on('change', '.bsf-rollback-version-select' , rollbackVersion.onSelectVersion );
$( document ).on('click', '.bsf-rollback-button' , rollbackVersion.onRollbackClick );
$( document ).on('click', '.bsf-confirm-cancel' , rollbackVersion.closeRollbackPopup );
$( document ).on('click', '.bsf-confirm-ok' , rollbackVersion.onRollbackOk );
},
onSelectVersion:function() {
var selectRollback = jQuery( this );
rollbackButton = selectRollback.next( '.bsf-rollback-button' )
placeholderText = rollbackButton.data( 'placeholder-text' );
placeholderUrl = rollbackButton.data( 'placeholder-url' );
rollbackButton.attr( 'href', placeholderUrl.replace( 'VERSION', selectRollback.val() ) );
},
onRollbackClick: function ( e ) {
e.preventDefault();
var rollbackButton = jQuery( this );
// This will update the current rollback button object.
currentRollbackButton = rollbackButton;
rollbackHeading = $('.bsf-confirm-heading');
rollbackConfirmText = $('.bsf-rollback-text');
closestDiv = rollbackButton.closest('.bsf-rollback-version');
versionNumber = closestDiv.find('.bsf-rollback-version-select').val();
selectProductName = closestDiv.find('#bsf-product-name').val();
// Rollback Heading text.
rollbackHeadingdata = rollbackHeading.data('text').replace( '#PRODUCT_NAME#', selectProductName );
rollbackHeading.html( rollbackHeadingdata );
// Rollback Confirmation text.
rollbackConfirmdata = rollbackConfirmText.data('text').replace( '#PRODUCT_NAME#', selectProductName );
rollbackConfirmdata = rollbackConfirmdata.replace( '#VERSION#', versionNumber )
rollbackConfirmText.html( rollbackConfirmdata );
document.querySelector('.bsf-confirm-rollback-popup').style.display = 'block';
},
closeRollbackPopup: function ( e ) {
document.querySelector('.bsf-confirm-rollback-popup').style.display = 'none';
},
onRollbackOk:function ( e ) {
e.preventDefault();
if( currentRollbackButton ){
var redirectUrl = currentRollbackButton.closest('.bsf-rollback-version').find('.bsf-rollback-button').attr('href');
location.href = redirectUrl;
}
rollbackVersion.closeRollbackPopup( e );
}
}
$( document ).ready(function() {
rollbackVersion.init();
});
})( jQuery );
@@ -1,413 +1,413 @@
<?php
/**
* Admin functions.
*
* @package BSF core
*/
if ( ! function_exists( 'bsf_generate_rand_token' ) ) {
/**
* Generate 32 characters random token.
*
* @return string
*/
function bsf_generate_rand_token() {
$valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
$token = '';
$length = 32;
for ( $n = 1; $n < $length; $n++ ) {
$which_character = wp_rand( 0, strlen( $valid_characters ) - 1 );
$token .= $valid_characters[ $which_character ];
}
return $token;
}
}
/**
* Update version numbers of all the brainstorm products in options `brainstorm_products` and `brainstrom_bundled_products`
*
* @todo Current version numbers can be fetched from WordPress at runtime whenever ruquired,
* Remote version can only be required when transient for update data is deleted (i hope)
*/
if ( ! function_exists( 'bsf_update_all_product_version' ) ) {
/**
* Updates all product versions.
*
* @return void
*/
function bsf_update_all_product_version() {
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
$bsf_product_themes = array();
if ( ! empty( $brainstrom_products ) ) :
$bsf_product_plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array();
$bsf_product_themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
endif;
$bundled_product_updated = false;
if ( ! empty( $bsf_product_plugins ) ) {
foreach ( $bsf_product_plugins as $key => $plugin ) {
if ( ! isset( $plugin['id'] ) || empty( $plugin['id'] ) ) {
continue;
}
if ( ! isset( $plugin['template'] ) || empty( $plugin['template'] ) ) {
continue;
}
if ( ! isset( $plugin['type'] ) || empty( $plugin['type'] ) ) {
continue;
}
$version = ( isset( $plugin['version'] ) ) ? $plugin['version'] : '';
$current_version = bsf_get_current_version( $plugin['template'], $plugin['type'] );
$name = bsf_get_current_name( $plugin['template'], $plugin['type'] );
if ( '' !== $name ) {
$brainstrom_products['plugins'][ $key ]['product_name'] = $name;
}
if ( '' !== $current_version ) {
if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_products['plugins'][ $key ]['version'] = $current_version;
}
}
}
}
if ( ! empty( $bsf_product_themes ) ) {
foreach ( $bsf_product_themes as $key => $theme ) {
if ( ! isset( $theme['id'] ) || empty( $theme['id'] ) ) {
continue;
}
if ( ! isset( $theme['template'] ) || empty( $theme['template'] ) ) {
continue;
}
if ( ! isset( $theme['type'] ) || empty( $theme['type'] ) ) {
continue;
}
$version = ( isset( $theme['version'] ) ) ? $theme['version'] : '';
$current_version = bsf_get_current_version( $theme['template'], $theme['type'] );
$name = bsf_get_current_name( $theme['template'], $theme['type'] );
if ( '' !== $name ) {
$brainstrom_products['themes'][ $key ]['product_name'] = $name;
}
if ( '' !== $current_version || false !== $current_version ) {
if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_products['themes'][ $key ]['version'] = $current_version;
}
}
}
}
if ( ! empty( $brainstrom_bundled_products ) ) {
foreach ( $brainstrom_bundled_products as $keys => $bps ) {
$version = '';
if ( strlen( $keys ) > 1 ) {
foreach ( $bps as $key => $bp ) {
if ( ! isset( $bp->id ) || '' === $bp->id ) {
continue;
}
$version = $bp->version;
$current_version = bsf_get_current_version( $bp->init, $bp->type );
if ( '' !== $current_version && false !== $current_version ) {
if ( 1 === - version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) {
if ( is_object( $brainstrom_bundled_products ) ) {
$brainstrom_bundled_products = array( $brainstrom_bundled_products );
}
$single_bp = $brainstrom_bundled_products[ $keys ];
$single_bp[ $key ]->version = $current_version;
$bundled_product_updated = true;
$brainstrom_bundled_products[ $keys ] = $single_bp;
}
}
}
} else {
if ( ! isset( $bps->id ) || '' === $bps->id ) {
continue;
}
$version = $bps->version;
$current_version = bsf_get_current_version( $bps->init, $bps->type );
if ( '' !== $current_version || false !== $current_version ) {
if ( - 1 === version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_bundled_products[ $keys ]->version = $current_version;
$bundled_product_updated = true;
}
}
}
}
}
update_option( 'brainstrom_products', $brainstrom_products );
if ( $bundled_product_updated ) {
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
}
}
}
add_action( 'admin_init', 'bsf_update_all_product_version', 1000 );
if ( ! function_exists( 'bsf_get_current_version' ) ) {
/**
* Get current version of plugin / theme.
*
* @param string $template plugin template/slug.
* @param string $type type of product.
*
* @return float
*/
function bsf_get_current_version( $template, $type ) {
if ( '' === $template ) {
return false;
}
if ( 'theme' === $type || 'themes' === $type ) {
$theme = wp_get_theme( $template );
$version = $theme->get( 'Version' );
} elseif ( 'plugin' === $type || 'plugins' === $type ) {
$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
if ( ! is_file( $plugin_file ) ) {
return false;
}
$plugin = get_plugin_data( $plugin_file );
$version = $plugin['Version'];
}
return $version;
}
}
if ( ! function_exists( 'bsf_get_current_name' ) ) {
/**
* Get name of plugin / theme.
*
* @param string $template plugin template/slug.
* @param string $type type of product.
* @return string
*/
function bsf_get_current_name( $template, $type ) {
if ( '' === $template ) {
return false;
}
if ( 'theme' === $type || 'themes' === $type ) {
$theme = wp_get_theme( $template );
$name = $theme->get( 'Name' );
} elseif ( 'plugin' === $type || 'plugins' === $type ) {
$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
if ( ! is_file( $plugin_file ) ) {
return false;
}
$plugin = get_plugin_data( $plugin_file );
$name = $plugin['Name'];
}
return $name;
}
}
add_action( 'admin_notices', 'bsf_notices', 1000 );
add_action( 'network_admin_notices', 'bsf_notices', 1000 );
if ( ! function_exists( 'bsf_notices' ) ) {
/**
* Display admin notices.
*
* @return bool
*/
function bsf_notices() {
global $pagenow;
if ( 'update-core.php' === $pagenow || 'plugins.php' === $pagenow || 'post-new.php' === $pagenow || 'edit.php' === $pagenow || 'post.php' === $pagenow ) {
$brainstrom_products = get_option( 'brainstrom_products' );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( empty( $brainstrom_products ) ) {
return false;
}
$brainstrom_bundled_products_keys = array();
if ( ! empty( $brainstrom_bundled_products ) ) :
foreach ( $brainstrom_bundled_products as $bps ) {
foreach ( $bps as $key => $bp ) {
array_push( $brainstrom_bundled_products_keys, $bp->id );
}
}
endif;
$mix = array();
$plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array();
$themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
$mix = array_merge( $plugins, $themes );
if ( empty( $mix ) ) {
return false;
}
if ( ( defined( 'BSF_PRODUCTS_NOTICES' ) && ( 'false' === BSF_PRODUCTS_NOTICES || false === BSF_PRODUCTS_NOTICES ) ) ) {
return false;
}
$is_multisite = is_multisite();
$is_network_admin = is_network_admin();
foreach ( $mix as $product ) :
if ( ! isset( $product['id'] ) ) {
continue;
}
if ( false === apply_filters( "bsf_display_product_activation_notice_{$product['id']}", true ) ) {
continue;
}
if ( isset( $product['is_product_free'] ) && ( 'true' === $product['is_product_free'] || true === $product['is_product_free'] ) ) {
continue;
}
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant_nag = 'BSF_' . $constant . '_NAG';
$constant_notice = 'BSF_' . $constant . '_NOTICES';
if ( defined( $constant_nag ) && ( 'false' === constant( $constant_nag ) || false === constant( $constant_nag ) ) ) {
continue;
}
if ( defined( $constant_notice ) && ( 'false' === constant( $constant_notice ) || false === constant( $constant_notice ) ) ) {
continue;
}
$status = ( isset( $product['status'] ) ) ? $product['status'] : false;
$type = ( isset( $product['type'] ) ) ? $product['type'] : false;
if ( ! $type ) {
continue;
}
if ( 'plugin' === $type ) {
if ( ! is_plugin_active( $product['template'] ) ) {
continue;
}
} elseif ( 'theme' === $type ) {
$theme = wp_get_theme();
if ( $product['template'] !== $theme->template ) {
continue;
}
} else {
continue;
}
if ( BSF_Update_Manager::bsf_is_product_bundled( $product['id'] ) ) {
continue;
}
if ( 'registered' !== $status ) :
$url = bsf_registration_page_url( '', $product['id'] );
$message = __( 'Please', 'bsf' ) . ' <a href="' . esc_url( $url ) . '" class="bsf-core-license-form-btn" plugin-slug="' . esc_html( $product['id'] ) . '">' . __( 'activate', 'bsf' ) . '</a> ' . __( 'your copy of the', 'bsf' ) . ' <i>' . esc_html( $product['product_name'] ) . '</i> ' . __( 'to get update notifications, access to support features & other resources!', 'bsf' );
$message = apply_filters( "bsf_product_activation_notice_{$product['id']}", $message, $url, $product['product_name'] );
$allowed_html = array(
'a' => array(
'href' => array(),
'class' => array(),
'title' => array(),
'plugin-slug' => array(),
),
'br' => array(),
'em' => array(),
'strong' => array(),
'i' => array(),
);
if ( ( $is_multisite && $is_network_admin ) || ! $is_multisite ) {
echo '<div class="notice notice-warning"><p>' . wp_kses( $message, $allowed_html ) . '</p></div>';
}
endif;
endforeach;
}
}
}
// delete bundled products after switch theme.
if ( ! function_exists( 'bsf_theme_deactivation' ) ) {
/**
* Delete transients while switching theme.
*
* @return void
*/
function bsf_theme_deactivation() {
update_option( 'bsf_force_check_extensions', false );
}
}
add_action( 'switch_theme', 'bsf_theme_deactivation' );
add_action( 'deactivated_plugin', 'bsf_theme_deactivation' );
if ( ! function_exists( 'bsf_get_free_menu_position' ) ) {
/**
* Get free theme position.
*
* @param int $start menu position priority index.
* @param float $increment increment number for menu position.
* @return int
*/
function bsf_get_free_menu_position( $start, $increment = 0.3 ) {
foreach ( $GLOBALS['menu'] as $key => $menu ) {
$menus_positions[] = $key;
}
if ( ! in_array( $start, $menus_positions, true ) ) {
return $start;
}
/* the position is already reserved find the closet one */
while ( in_array( $start, $menus_positions, true ) ) {
$start += $increment;
}
return $start;
}
}
if ( ! function_exists( 'bsf_get_option' ) ) {
/**
* Get free theme position.
*
* @param bool $request return complete option data OR a single variable.
* @return array
*/
function bsf_get_option( $request = false ) {
$bsf_options = get_option( 'bsf_options' );
if ( ! $request ) {
return $bsf_options;
} else {
return ( isset( $bsf_options[ $request ] ) ) ? $bsf_options[ $request ] : false;
}
}
}
if ( ! function_exists( 'bsf_update_option' ) ) {
/**
* Update bsf option with key and value.
*
* @param string $request variable key.
* @param string $value variable value.
* @return bool
*/
function bsf_update_option( $request, $value ) {
$bsf_options = get_option( 'bsf_options' );
$bsf_options[ $request ] = $value;
return update_option( 'bsf_options', $bsf_options );
}
}
if ( ! function_exists( 'bsf_sort' ) ) {
/**
* Sort array of objects.
*
* @param string $a The first string.
* @param string $b The second string.
* @return int
*/
function bsf_sort( $a, $b ) {
return strcmp( strtolower( $a->short_name ), strtolower( $b->short_name ) );
}
}
<?php
/**
* Admin functions.
*
* @package BSF core
*/
if ( ! function_exists( 'bsf_generate_rand_token' ) ) {
/**
* Generate 32 characters random token.
*
* @return string
*/
function bsf_generate_rand_token() {
$valid_characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
$token = '';
$length = 32;
for ( $n = 1; $n < $length; $n++ ) {
$which_character = wp_rand( 0, strlen( $valid_characters ) - 1 );
$token .= $valid_characters[ $which_character ];
}
return $token;
}
}
/**
* Update version numbers of all the brainstorm products in options `brainstorm_products` and `brainstrom_bundled_products`
*
* @todo Current version numbers can be fetched from WordPress at runtime whenever ruquired,
* Remote version can only be required when transient for update data is deleted (i hope)
*/
if ( ! function_exists( 'bsf_update_all_product_version' ) ) {
/**
* Updates all product versions.
*
* @return void
*/
function bsf_update_all_product_version() {
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
$bsf_product_themes = array();
if ( ! empty( $brainstrom_products ) ) :
$bsf_product_plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array();
$bsf_product_themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
endif;
$bundled_product_updated = false;
if ( ! empty( $bsf_product_plugins ) ) {
foreach ( $bsf_product_plugins as $key => $plugin ) {
if ( ! isset( $plugin['id'] ) || empty( $plugin['id'] ) ) {
continue;
}
if ( ! isset( $plugin['template'] ) || empty( $plugin['template'] ) ) {
continue;
}
if ( ! isset( $plugin['type'] ) || empty( $plugin['type'] ) ) {
continue;
}
$version = ( isset( $plugin['version'] ) ) ? $plugin['version'] : '';
$current_version = bsf_get_current_version( $plugin['template'], $plugin['type'] );
$name = bsf_get_current_name( $plugin['template'], $plugin['type'] );
if ( '' !== $name ) {
$brainstrom_products['plugins'][ $key ]['product_name'] = $name;
}
if ( '' !== $current_version ) {
if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_products['plugins'][ $key ]['version'] = $current_version;
}
}
}
}
if ( ! empty( $bsf_product_themes ) ) {
foreach ( $bsf_product_themes as $key => $theme ) {
if ( ! isset( $theme['id'] ) || empty( $theme['id'] ) ) {
continue;
}
if ( ! isset( $theme['template'] ) || empty( $theme['template'] ) ) {
continue;
}
if ( ! isset( $theme['type'] ) || empty( $theme['type'] ) ) {
continue;
}
$version = ( isset( $theme['version'] ) ) ? $theme['version'] : '';
$current_version = bsf_get_current_version( $theme['template'], $theme['type'] );
$name = bsf_get_current_name( $theme['template'], $theme['type'] );
if ( '' !== $name ) {
$brainstrom_products['themes'][ $key ]['product_name'] = $name;
}
if ( '' !== $current_version || false !== $current_version ) {
if ( version_compare( $version, $current_version ) === - 1 || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_products['themes'][ $key ]['version'] = $current_version;
}
}
}
}
if ( ! empty( $brainstrom_bundled_products ) ) {
foreach ( $brainstrom_bundled_products as $keys => $bps ) {
$version = '';
if ( strlen( $keys ) > 1 ) {
foreach ( $bps as $key => $bp ) {
if ( ! isset( $bp->id ) || '' === $bp->id ) {
continue;
}
$version = $bp->version;
$current_version = bsf_get_current_version( $bp->init, $bp->type );
if ( '' !== $current_version && false !== $current_version ) {
if ( 1 === - version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) {
if ( is_object( $brainstrom_bundled_products ) ) {
$brainstrom_bundled_products = array( $brainstrom_bundled_products );
}
$single_bp = $brainstrom_bundled_products[ $keys ];
$single_bp[ $key ]->version = $current_version;
$bundled_product_updated = true;
$brainstrom_bundled_products[ $keys ] = $single_bp;
}
}
}
} else {
if ( ! isset( $bps->id ) || '' === $bps->id ) {
continue;
}
$version = $bps->version;
$current_version = bsf_get_current_version( $bps->init, $bps->type );
if ( '' !== $current_version || false !== $current_version ) {
if ( - 1 === version_compare( $version, $current_version ) || 1 === version_compare( $version, $current_version ) ) {
$brainstrom_bundled_products[ $keys ]->version = $current_version;
$bundled_product_updated = true;
}
}
}
}
}
update_option( 'brainstrom_products', $brainstrom_products );
if ( $bundled_product_updated ) {
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
}
}
}
add_action( 'admin_init', 'bsf_update_all_product_version', 1000 );
if ( ! function_exists( 'bsf_get_current_version' ) ) {
/**
* Get current version of plugin / theme.
*
* @param string $template plugin template/slug.
* @param string $type type of product.
*
* @return float
*/
function bsf_get_current_version( $template, $type ) {
if ( '' === $template ) {
return false;
}
if ( 'theme' === $type || 'themes' === $type ) {
$theme = wp_get_theme( $template );
$version = $theme->get( 'Version' );
} elseif ( 'plugin' === $type || 'plugins' === $type ) {
$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
if ( ! is_file( $plugin_file ) ) {
return false;
}
$plugin = get_plugin_data( $plugin_file );
$version = $plugin['Version'];
}
return $version;
}
}
if ( ! function_exists( 'bsf_get_current_name' ) ) {
/**
* Get name of plugin / theme.
*
* @param string $template plugin template/slug.
* @param string $type type of product.
* @return string
*/
function bsf_get_current_name( $template, $type ) {
if ( '' === $template ) {
return false;
}
if ( 'theme' === $type || 'themes' === $type ) {
$theme = wp_get_theme( $template );
$name = $theme->get( 'Name' );
} elseif ( 'plugin' === $type || 'plugins' === $type ) {
$plugin_file = rtrim( WP_PLUGIN_DIR, '/' ) . '/' . $template;
if ( ! is_file( $plugin_file ) ) {
return false;
}
$plugin = get_plugin_data( $plugin_file );
$name = $plugin['Name'];
}
return $name;
}
}
add_action( 'admin_notices', 'bsf_notices', 1000 );
add_action( 'network_admin_notices', 'bsf_notices', 1000 );
if ( ! function_exists( 'bsf_notices' ) ) {
/**
* Display admin notices.
*
* @return bool
*/
function bsf_notices() {
global $pagenow;
if ( 'update-core.php' === $pagenow || 'plugins.php' === $pagenow || 'post-new.php' === $pagenow || 'edit.php' === $pagenow || 'post.php' === $pagenow ) {
$brainstrom_products = get_option( 'brainstrom_products' );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( empty( $brainstrom_products ) ) {
return false;
}
$brainstrom_bundled_products_keys = array();
if ( ! empty( $brainstrom_bundled_products ) ) :
foreach ( $brainstrom_bundled_products as $bps ) {
foreach ( $bps as $key => $bp ) {
array_push( $brainstrom_bundled_products_keys, $bp->id );
}
}
endif;
$mix = array();
$plugins = ( isset( $brainstrom_products['plugins'] ) ) ? $brainstrom_products['plugins'] : array();
$themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
$mix = array_merge( $plugins, $themes );
if ( empty( $mix ) ) {
return false;
}
if ( ( defined( 'BSF_PRODUCTS_NOTICES' ) && ( 'false' === BSF_PRODUCTS_NOTICES || false === BSF_PRODUCTS_NOTICES ) ) ) {
return false;
}
$is_multisite = is_multisite();
$is_network_admin = is_network_admin();
foreach ( $mix as $product ) :
if ( ! isset( $product['id'] ) ) {
continue;
}
if ( false === apply_filters( "bsf_display_product_activation_notice_{$product['id']}", true ) ) {
continue;
}
if ( isset( $product['is_product_free'] ) && ( 'true' === $product['is_product_free'] || true === $product['is_product_free'] ) ) {
continue;
}
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant_nag = 'BSF_' . $constant . '_NAG';
$constant_notice = 'BSF_' . $constant . '_NOTICES';
if ( defined( $constant_nag ) && ( 'false' === constant( $constant_nag ) || false === constant( $constant_nag ) ) ) {
continue;
}
if ( defined( $constant_notice ) && ( 'false' === constant( $constant_notice ) || false === constant( $constant_notice ) ) ) {
continue;
}
$status = ( isset( $product['status'] ) ) ? $product['status'] : false;
$type = ( isset( $product['type'] ) ) ? $product['type'] : false;
if ( ! $type ) {
continue;
}
if ( 'plugin' === $type ) {
if ( ! is_plugin_active( $product['template'] ) ) {
continue;
}
} elseif ( 'theme' === $type ) {
$theme = wp_get_theme();
if ( $product['template'] !== $theme->template ) {
continue;
}
} else {
continue;
}
if ( BSF_Update_Manager::bsf_is_product_bundled( $product['id'] ) ) {
continue;
}
if ( 'registered' !== $status ) :
$url = bsf_registration_page_url( '', $product['id'] );
$message = __( 'Please', 'bsf' ) . ' <a href="' . esc_url( $url ) . '" class="bsf-core-license-form-btn" plugin-slug="' . esc_html( $product['id'] ) . '">' . __( 'activate', 'bsf' ) . '</a> ' . __( 'your copy of the', 'bsf' ) . ' <i>' . esc_html( $product['product_name'] ) . '</i> ' . __( 'to get update notifications, access to support features & other resources!', 'bsf' );
$message = apply_filters( "bsf_product_activation_notice_{$product['id']}", $message, $url, $product['product_name'] );
$allowed_html = array(
'a' => array(
'href' => array(),
'class' => array(),
'title' => array(),
'plugin-slug' => array(),
),
'br' => array(),
'em' => array(),
'strong' => array(),
'i' => array(),
);
if ( ( $is_multisite && $is_network_admin ) || ! $is_multisite ) {
echo '<div class="notice notice-warning"><p>' . wp_kses( $message, $allowed_html ) . '</p></div>';
}
endif;
endforeach;
}
}
}
// delete bundled products after switch theme.
if ( ! function_exists( 'bsf_theme_deactivation' ) ) {
/**
* Delete transients while switching theme.
*
* @return void
*/
function bsf_theme_deactivation() {
update_option( 'bsf_force_check_extensions', false );
}
}
add_action( 'switch_theme', 'bsf_theme_deactivation' );
add_action( 'deactivated_plugin', 'bsf_theme_deactivation' );
if ( ! function_exists( 'bsf_get_free_menu_position' ) ) {
/**
* Get free theme position.
*
* @param int $start menu position priority index.
* @param float $increment increment number for menu position.
* @return int
*/
function bsf_get_free_menu_position( $start, $increment = 0.3 ) {
foreach ( $GLOBALS['menu'] as $key => $menu ) {
$menus_positions[] = $key;
}
if ( ! in_array( $start, $menus_positions, true ) ) {
return $start;
}
/* the position is already reserved find the closet one */
while ( in_array( $start, $menus_positions, true ) ) {
$start += $increment;
}
return $start;
}
}
if ( ! function_exists( 'bsf_get_option' ) ) {
/**
* Get free theme position.
*
* @param bool $request return complete option data OR a single variable.
* @return array
*/
function bsf_get_option( $request = false ) {
$bsf_options = get_option( 'bsf_options' );
if ( ! $request ) {
return $bsf_options;
} else {
return ( isset( $bsf_options[ $request ] ) ) ? $bsf_options[ $request ] : false;
}
}
}
if ( ! function_exists( 'bsf_update_option' ) ) {
/**
* Update bsf option with key and value.
*
* @param string $request variable key.
* @param string $value variable value.
* @return bool
*/
function bsf_update_option( $request, $value ) {
$bsf_options = get_option( 'bsf_options' );
$bsf_options[ $request ] = $value;
return update_option( 'bsf_options', $bsf_options );
}
}
if ( ! function_exists( 'bsf_sort' ) ) {
/**
* Sort array of objects.
*
* @param string $a The first string.
* @param string $b The second string.
* @return int
*/
function bsf_sort( $a, $b ) {
return strcmp( strtolower( $a->short_name ), strtolower( $b->short_name ) );
}
}
@@ -1,239 +1,239 @@
<?php
/**
* Product update functions.
*
* @package BSF core
*/
// Alternative function for wp_remote_get.
if ( ! function_exists( 'bsf_get_remote_version' ) ) {
/**
* Get remote version for product
*
* @param array $product_list products data.
* @param array $products products data (deprecated).
* @return array
*/
function bsf_get_remote_version( $product_list, $products ) {
global $ultimate_referer;
$path = bsf_get_api_url() . '?referer=' . $ultimate_referer;
$data = array(
'action' => 'bsf_get_product_versions',
'ids' => $products,
'products' => $product_list,
'site_url' => get_site_url(),
'php_version' => bsf_get_php_version(),
'wp_version' => get_bloginfo( 'version' ),
'locale' => get_locale(),
'bsf_core_version' => BSF_UPDATER_VERSION,
'active_theme' => get_template(),
'active_stylesheet' => get_stylesheet(),
'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
'php_post_max_size' => ini_get( 'post_max_size' ),
'php_max_execution_time' => ini_get( 'max_execution_time' ),
'php_memory_limit' => ini_get( 'memory_limit' ),
);
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '10',
)
);
// Request http URL if the https version fails.
if ( is_wp_error( $request ) && 200 !== wp_remote_retrieve_response_code( $request ) ) {
$path = bsf_get_api_url( true ) . '?referer=' . $ultimate_referer;
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '8',
)
);
}
if ( ! is_wp_error( $request ) || 200 === wp_remote_retrieve_response_code( $request ) ) {
$result = json_decode( wp_remote_retrieve_body( $request ) );
if ( ! empty( $result ) ) {
if ( empty( $result->error ) ) {
return $result->updated_versions;
} else {
return $result->error;
}
}
}
}
}
if ( ! function_exists( 'bsf_check_product_update' ) ) {
/**
* Check product updates.
*
* @return void
*/
function bsf_check_product_update() {
$is_update = true;
$registered = array(); // This list will be deprecated in favor of $product_list.
$product_list = array();
$all_products = brainstorm_get_all_products( false, false, true );
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
foreach ( $all_products as $key => $product ) {
if ( ! isset( $product['id'] ) ) {
continue;
}
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant = 'BSF_' . $constant . '_CHECK_UPDATES';
if ( defined( $constant ) && ( 'false' === constant( $constant ) || false === constant( $constant ) ) ) {
continue;
}
$registered[] = $product['id'];
$product_list[ $product['id'] ] = array(
'id' => $product['id'],
'installed_version' => $product['version'],
);
// Add bundled products to the list.
if ( isset( $brainstrom_bundled_products[ $product['id'] ] ) ) {
$bundled_products = $brainstrom_bundled_products[ $product['id'] ];
$bundled_product_data = array();
foreach ( $bundled_products as $bundled_product ) {
$bundled_product_data[ $bundled_product->id ] = array(
'id' => $bundled_product->id,
'installed_version' => $bundled_product->version,
);
}
$product_list[ $product['id'] ]['bundled_products'] = $bundled_product_data;
}
}
$remote_versions = bsf_get_remote_version( $product_list, $registered );
$bsf_product_plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
$bsf_product_themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();
if ( false !== $remote_versions ) {
if ( ! empty( $remote_versions ) ) {
$is_bundled_update = false;
foreach ( $remote_versions as $rkey => $remote_data ) {
$rid = ( isset( $remote_data->id ) ) ? (string) $remote_data->id : '';
$remote_version = ( isset( $remote_data->remote_version ) ) ? $remote_data->remote_version : '';
$in_house = ( isset( $remote_data->in_house ) ) ? $remote_data->in_house : '';
$on_market = ( isset( $remote_data->on_market ) ) ? $remote_data->on_market : '';
$is_product_free = ( isset( $remote_data->is_product_free ) ) ? $remote_data->is_product_free : '';
$short_name = ( isset( $remote_data->short_name ) ) ? $remote_data->short_name : '';
$changelog_url = ( isset( $remote_data->changelog_url ) ) ? $remote_data->changelog_url : '';
$purchase_url = ( isset( $remote_data->purchase_url ) ) ? $remote_data->purchase_url : '';
$version_beta = ( isset( $remote_data->version_beta ) ) ? $remote_data->version_beta : '';
$download_url = ( isset( $remote_data->download_url ) ) ? $remote_data->download_url : '';
$download_url_beta = ( isset( $remote_data->download_url_beta ) ) ? $remote_data->download_url_beta : '';
$tested_upto = ( isset( $remote_data->tested ) ) ? $remote_data->tested : '';
foreach ( $bsf_product_plugins as $key => $plugin ) {
if ( ! isset( $plugin['id'] ) ) {
continue;
}
$pid = (string) $plugin['id'];
if ( $pid === $rid ) {
$brainstrom_products['plugins'][ $key ]['remote'] = $remote_version;
$brainstrom_products['plugins'][ $key ]['in_house'] = $in_house;
$brainstrom_products['plugins'][ $key ]['on_market'] = $on_market;
$brainstrom_products['plugins'][ $key ]['is_product_free'] = $is_product_free;
$brainstrom_products['plugins'][ $key ]['short_name'] = $short_name;
$brainstrom_products['plugins'][ $key ]['changelog_url'] = $changelog_url;
$brainstrom_products['plugins'][ $key ]['purchase_url'] = $purchase_url;
$brainstrom_products['plugins'][ $key ]['version_beta'] = $version_beta;
$brainstrom_products['plugins'][ $key ]['download_url_beta'] = $download_url_beta;
$brainstrom_products['plugins'][ $key ]['download_url'] = $download_url;
$brainstrom_products['plugins'][ $key ]['tested'] = $tested_upto;
// Deregister status for plugin.
if ( isset( $remote_data->status ) && 0 === $remote_data->status ) {
$brainstrom_products['plugins'][ $key ]['status'] = 'not-registered';
} else {
$brainstrom_products['plugins'][ $key ]['status'] = 'registered';
}
$is_update = true;
}
}
foreach ( $bsf_product_themes as $key => $theme ) {
if ( ! isset( $theme['id'] ) ) {
continue;
}
$pid = $theme['id'];
if ( $pid === $rid ) {
$brainstrom_products['themes'][ $key ]['remote'] = $remote_version;
$brainstrom_products['themes'][ $key ]['in_house'] = $in_house;
$brainstrom_products['themes'][ $key ]['on_market'] = $on_market;
$brainstrom_products['themes'][ $key ]['is_product_free'] = $is_product_free;
$brainstrom_products['themes'][ $key ]['short_name'] = $short_name;
$brainstrom_products['themes'][ $key ]['changelog_url'] = $changelog_url;
$brainstrom_products['themes'][ $key ]['purchase_url'] = $purchase_url;
$brainstrom_products['themes'][ $key ]['version_beta'] = $version_beta;
$brainstrom_products['themes'][ $key ]['download_url'] = $download_url;
$brainstrom_products['themes'][ $key ]['download_url_beta'] = $download_url_beta;
$is_update = true;
// Deregister status for theme.
if ( isset( $remote_data->status ) && 0 === $remote_data->status ) {
$brainstrom_products['themes'][ $key ]['status'] = 'not-registered';
} else {
$brainstrom_products['themes'][ $key ]['status'] = 'registered';
}
}
}
if ( isset( $remote_data->bundled_products ) && ! empty( $remote_data->bundled_products ) ) {
if ( ! empty( $brainstrom_bundled_products ) && is_array( $brainstrom_bundled_products ) ) {
foreach ( $brainstrom_bundled_products as $bkeys => $bps ) {
foreach ( $bps as $bkey => $bp ) {
if ( ! isset( $bp->id ) ) {
continue;
}
foreach ( $remote_data->bundled_products as $rbp ) {
if ( ! isset( $rbp->id ) ) {
continue;
}
if ( $rbp->id === $bp->id ) {
$bprd = $brainstrom_bundled_products[ $bkeys ];
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->remote = $rbp->remote_version;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->parent = $rbp->parent;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->short_name = $rbp->short_name;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->changelog_url = $rbp->changelog_url;
if ( isset( $rbp->download_url ) ) {
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->download_url = $rbp->download_url;
}
if ( isset( $rbp->download_url_beta ) ) {
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->download_url_beta = $rbp->download_url_beta;
}
$is_bundled_update = true;
}
}
}
}
}
}
}
if ( $is_bundled_update ) {
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
}
}
}
if ( $is_update ) {
update_option( 'brainstrom_products', $brainstrom_products );
}
}
}
<?php
/**
* Product update functions.
*
* @package BSF core
*/
// Alternative function for wp_remote_get.
if ( ! function_exists( 'bsf_get_remote_version' ) ) {
/**
* Get remote version for product
*
* @param array $product_list products data.
* @param array $products products data (deprecated).
* @return array
*/
function bsf_get_remote_version( $product_list, $products ) {
global $ultimate_referer;
$path = bsf_get_api_url() . '?referer=' . $ultimate_referer;
$data = array(
'action' => 'bsf_get_product_versions',
'ids' => $products,
'products' => $product_list,
'site_url' => get_site_url(),
'php_version' => bsf_get_php_version(),
'wp_version' => get_bloginfo( 'version' ),
'locale' => get_locale(),
'bsf_core_version' => BSF_UPDATER_VERSION,
'active_theme' => get_template(),
'active_stylesheet' => get_stylesheet(),
'php_max_input_vars' => ini_get( 'max_input_vars' ), // phpcs:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound
'php_post_max_size' => ini_get( 'post_max_size' ),
'php_max_execution_time' => ini_get( 'max_execution_time' ),
'php_memory_limit' => ini_get( 'memory_limit' ),
);
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '10',
)
);
// Request http URL if the https version fails.
if ( is_wp_error( $request ) && 200 !== wp_remote_retrieve_response_code( $request ) ) {
$path = bsf_get_api_url( true ) . '?referer=' . $ultimate_referer;
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '8',
)
);
}
if ( ! is_wp_error( $request ) || 200 === wp_remote_retrieve_response_code( $request ) ) {
$result = json_decode( wp_remote_retrieve_body( $request ) );
if ( ! empty( $result ) ) {
if ( empty( $result->error ) ) {
return $result->updated_versions;
} else {
return $result->error;
}
}
}
}
}
if ( ! function_exists( 'bsf_check_product_update' ) ) {
/**
* Check product updates.
*
* @return void
*/
function bsf_check_product_update() {
$is_update = true;
$registered = array(); // This list will be deprecated in favor of $product_list.
$product_list = array();
$all_products = brainstorm_get_all_products( false, false, true );
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
foreach ( $all_products as $key => $product ) {
if ( ! isset( $product['id'] ) ) {
continue;
}
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant = 'BSF_' . $constant . '_CHECK_UPDATES';
if ( defined( $constant ) && ( 'false' === constant( $constant ) || false === constant( $constant ) ) ) {
continue;
}
$registered[] = $product['id'];
$product_list[ $product['id'] ] = array(
'id' => $product['id'],
'installed_version' => $product['version'],
);
// Add bundled products to the list.
if ( isset( $brainstrom_bundled_products[ $product['id'] ] ) ) {
$bundled_products = $brainstrom_bundled_products[ $product['id'] ];
$bundled_product_data = array();
foreach ( $bundled_products as $bundled_product ) {
$bundled_product_data[ $bundled_product->id ] = array(
'id' => $bundled_product->id,
'installed_version' => $bundled_product->version,
);
}
$product_list[ $product['id'] ]['bundled_products'] = $bundled_product_data;
}
}
$remote_versions = bsf_get_remote_version( $product_list, $registered );
$bsf_product_plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
$bsf_product_themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();
if ( false !== $remote_versions ) {
if ( ! empty( $remote_versions ) ) {
$is_bundled_update = false;
foreach ( $remote_versions as $rkey => $remote_data ) {
$rid = ( isset( $remote_data->id ) ) ? (string) $remote_data->id : '';
$remote_version = ( isset( $remote_data->remote_version ) ) ? $remote_data->remote_version : '';
$in_house = ( isset( $remote_data->in_house ) ) ? $remote_data->in_house : '';
$on_market = ( isset( $remote_data->on_market ) ) ? $remote_data->on_market : '';
$is_product_free = ( isset( $remote_data->is_product_free ) ) ? $remote_data->is_product_free : '';
$short_name = ( isset( $remote_data->short_name ) ) ? $remote_data->short_name : '';
$changelog_url = ( isset( $remote_data->changelog_url ) ) ? $remote_data->changelog_url : '';
$purchase_url = ( isset( $remote_data->purchase_url ) ) ? $remote_data->purchase_url : '';
$version_beta = ( isset( $remote_data->version_beta ) ) ? $remote_data->version_beta : '';
$download_url = ( isset( $remote_data->download_url ) ) ? $remote_data->download_url : '';
$download_url_beta = ( isset( $remote_data->download_url_beta ) ) ? $remote_data->download_url_beta : '';
$tested_upto = ( isset( $remote_data->tested ) ) ? $remote_data->tested : '';
foreach ( $bsf_product_plugins as $key => $plugin ) {
if ( ! isset( $plugin['id'] ) ) {
continue;
}
$pid = (string) $plugin['id'];
if ( $pid === $rid ) {
$brainstrom_products['plugins'][ $key ]['remote'] = $remote_version;
$brainstrom_products['plugins'][ $key ]['in_house'] = $in_house;
$brainstrom_products['plugins'][ $key ]['on_market'] = $on_market;
$brainstrom_products['plugins'][ $key ]['is_product_free'] = $is_product_free;
$brainstrom_products['plugins'][ $key ]['short_name'] = $short_name;
$brainstrom_products['plugins'][ $key ]['changelog_url'] = $changelog_url;
$brainstrom_products['plugins'][ $key ]['purchase_url'] = $purchase_url;
$brainstrom_products['plugins'][ $key ]['version_beta'] = $version_beta;
$brainstrom_products['plugins'][ $key ]['download_url_beta'] = $download_url_beta;
$brainstrom_products['plugins'][ $key ]['download_url'] = $download_url;
$brainstrom_products['plugins'][ $key ]['tested'] = $tested_upto;
// Deregister status for plugin.
if ( isset( $remote_data->status ) && 0 === $remote_data->status ) {
$brainstrom_products['plugins'][ $key ]['status'] = 'not-registered';
} else {
$brainstrom_products['plugins'][ $key ]['status'] = 'registered';
}
$is_update = true;
}
}
foreach ( $bsf_product_themes as $key => $theme ) {
if ( ! isset( $theme['id'] ) ) {
continue;
}
$pid = $theme['id'];
if ( $pid === $rid ) {
$brainstrom_products['themes'][ $key ]['remote'] = $remote_version;
$brainstrom_products['themes'][ $key ]['in_house'] = $in_house;
$brainstrom_products['themes'][ $key ]['on_market'] = $on_market;
$brainstrom_products['themes'][ $key ]['is_product_free'] = $is_product_free;
$brainstrom_products['themes'][ $key ]['short_name'] = $short_name;
$brainstrom_products['themes'][ $key ]['changelog_url'] = $changelog_url;
$brainstrom_products['themes'][ $key ]['purchase_url'] = $purchase_url;
$brainstrom_products['themes'][ $key ]['version_beta'] = $version_beta;
$brainstrom_products['themes'][ $key ]['download_url'] = $download_url;
$brainstrom_products['themes'][ $key ]['download_url_beta'] = $download_url_beta;
$is_update = true;
// Deregister status for theme.
if ( isset( $remote_data->status ) && 0 === $remote_data->status ) {
$brainstrom_products['themes'][ $key ]['status'] = 'not-registered';
} else {
$brainstrom_products['themes'][ $key ]['status'] = 'registered';
}
}
}
if ( isset( $remote_data->bundled_products ) && ! empty( $remote_data->bundled_products ) ) {
if ( ! empty( $brainstrom_bundled_products ) && is_array( $brainstrom_bundled_products ) ) {
foreach ( $brainstrom_bundled_products as $bkeys => $bps ) {
foreach ( $bps as $bkey => $bp ) {
if ( ! isset( $bp->id ) ) {
continue;
}
foreach ( $remote_data->bundled_products as $rbp ) {
if ( ! isset( $rbp->id ) ) {
continue;
}
if ( $rbp->id === $bp->id ) {
$bprd = $brainstrom_bundled_products[ $bkeys ];
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->remote = $rbp->remote_version;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->parent = $rbp->parent;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->short_name = $rbp->short_name;
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->changelog_url = $rbp->changelog_url;
if ( isset( $rbp->download_url ) ) {
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->download_url = $rbp->download_url;
}
if ( isset( $rbp->download_url_beta ) ) {
$brainstrom_bundled_products[ $bkeys ][ $bkey ]->download_url_beta = $rbp->download_url_beta;
}
$is_bundled_update = true;
}
}
}
}
}
}
}
if ( $is_bundled_update ) {
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
}
}
}
if ( $is_update ) {
update_option( 'brainstrom_products', $brainstrom_products );
}
}
}
@@ -1,2 +1,2 @@
/* Do not change otherwise you won't get updates */
/* Do not change otherwise you won't get updates */
ID:[bsf-core]
@@ -1,18 +1,18 @@
### Version - 1.21
# Support for beta updates of the products.
### Version - 1.19
- License Manager v2.0 - Allow plugins to individually set the license form.
- Update themes and plugins with WordPress's transients. so support for WP-CLI and any other website management tools.
- New License manager API.
- Improvement: Force check product update now works when WordPress updates are force checked.
- Slight redesign of help and debug settings screens.
- Support for white label with filters.
- Option to move Brainstorm registration menu in settings.
- Hide purchase key when it is validated.
- Remove use of deprecated 'mysql_' functions.
- Allow users to skip brainstorm account registration.
- Allow plugins/themes to completely hide the screen for Brainstorm Registration.
- Allow using staging API server for development.
### Version - 1.21
# Support for beta updates of the products.
### Version - 1.19
- License Manager v2.0 - Allow plugins to individually set the license form.
- Update themes and plugins with WordPress's transients. so support for WP-CLI and any other website management tools.
- New License manager API.
- Improvement: Force check product update now works when WordPress updates are force checked.
- Slight redesign of help and debug settings screens.
- Support for white label with filters.
- Option to move Brainstorm registration menu in settings.
- Hide purchase key when it is validated.
- Remove use of deprecated 'mysql_' functions.
- Allow users to skip brainstorm account registration.
- Allow plugins/themes to completely hide the screen for Brainstorm Registration.
- Allow using staging API server for development.
- Fix: Occasional PHP fatal errors when using the child theme.
@@ -1,449 +1,449 @@
<?php
/**
* BSf Evato Activation Class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF_Envato_Activate setup
*
* @since 1.0
*/
class BSF_Envato_Activate {
/**
* Instance
*
* @var BSF_Envato_Activate
*/
private static $instance;
/**
* Reference to the License manager class.
*
* @var BSF_License_Manager
*/
private $license_manager;
/**
* Stores temporary response messsages from the API validations.
*
* @var array()
*/
private $message_box;
/**
* Initiator.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new BSF_Envato_Activate();
}
return self::$instance;
}
/**
* Constructor function that initializes required actions and hooks
*
* @since 1.0
*/
public function __construct() {
$this->license_manager = new BSF_License_Manager();
$action = isset( $_GET['license_action'] ) ? esc_attr( $_GET['license_action'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'activate_license' === $action ) {
$this->process_envato_activation();
}
add_filter( 'update_footer', array( $this, 'alternate_method_link' ), 20 );
add_action( 'bsf_inlne_license_envato_after_form', array( $this, 'inline_alternate_method_link' ), 20, 2 );
}
/**
* Envato Register.
*
* @param array $args Arguments.
*/
public function envato_register( $args ) {
// Check if alternate method is to be used.
$method = ( isset( $_GET['activation_method'] ) && isset( $_GET['bsf_activation_nonce'] ) && wp_verify_nonce( $_GET['bsf_activation_nonce'], 'bsf_activation_nonce' ) ) ? esc_attr( $_GET['activation_method'] ) : 'oauth';
$html = '';
$product_id = isset( $args['product_id'] ) ? $args['product_id'] : '';
$is_active = $this->license_manager->bsf_is_active_license( $product_id );
$product_name = $this->license_manager->bsf_get_product_info( $product_id, 'name' );
$purchase_url = $this->license_manager->bsf_get_product_info( $product_id, 'purchase_url' );
$bundled = BSF_Update_Manager::bsf_is_product_bundled( $product_id );
if ( ! empty( $bundled ) ) {
$parent_id = $bundled[0];
$is_active = $this->license_manager->bsf_is_active_license( $parent_id );
$parent_name = brainstrom_product_name( $parent_id );
$registration_page = bsf_registration_page_url( '', $parent_id );
$html .= '<div class="bundled-product-license-registration">';
$html .= '<span>';
if ( $is_active ) {
$html .= '<h3>License Active!</h3>';
$html .= '<p>' . sprintf(
'Your license is activated, you will receive updates for <i>%s</i> when they are available.',
$product_name
) . '</p>';
} else {
$html .= '<h3>Updates Unavailable!</h3>';
$html .= '<p>' . sprintf(
'This plugin is came bundled with the <i>%1$s</i>. For receiving updates, you need to activate license of <i>%2$s</i> <a href="%3$s">here</a>.',
$parent_name,
$parent_name,
$registration_page
) . '</p>';
}
$html .= '</span>';
$html .= '</div>';
return $html;
}
if ( 'license-key' === $method ) {
$html .= bsf_license_activation_form( $args );
return $html;
}
// Licence activation button.
$form_action = ( isset( $args['form_action'] ) && ! is_null( $args['form_action'] ) ) ? $args['form_action'] : '';
$form_class = ( isset( $args['form_class'] ) && ! is_null( $args['form_class'] ) ) ? $args['form_class'] : "bsf-license-form-{$product_id}";
$submit_button_class = ( isset( $args['submit_button_class'] ) && ! is_null( $args['submit_button_class'] ) ) ? $args['submit_button_class'] : '';
$license_form_heading_class = ( isset( $args['bsf_license_form_heading_class'] ) && ! is_null( $args['bsf_license_form_heading_class'] ) ) ? $args['bsf_license_form_heading_class'] : '';
$license_active_class = ( isset( $args['bsf_license_active_class'] ) && ! is_null( $args['bsf_license_active_class'] ) ) ? $args['bsf_license_active_class'] : '';
$license_not_activate_message = ( isset( $args['bsf_license_not_activate_message'] ) && ! is_null( $args['bsf_license_not_activate_message'] ) ) ? $args['bsf_license_not_activate_message'] : '';
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$button_text_activate = ( isset( $args['button_text_activate'] ) && ! is_null( $args['button_text_activate'] ) ) ? __( 'Sign Up & Activate', 'bsf' ) : __( 'Sign Up & Activate', 'bsf' );
$button_text_deactivate = ( isset( $args['button_text_deactivate'] ) && ! is_null( $args['button_text_deactivate'] ) ) ? $args['button_text_deactivate'] : __( 'Deactivate License', 'bsf' );
$placeholder = ( isset( $args['placeholder'] ) && ! is_null( $args['placeholder'] ) ) ? $args['placeholder'] : 'Enter your license key..';
$popup_license_form = ( isset( $args['popup_license_form'] ) ) ? $args['popup_license_form'] : false;
$bsf_license_allow_email = ( isset( $args['bsf_license_allow_email'] ) && ! is_null( $args['bsf_license_allow_email'] ) ) ? $args['bsf_license_allow_email'] : true;
if ( true === $bsf_license_allow_email ) {
$form_class .= ' license-form-allow-email ';
if ( ! $is_active ) {
$submit_button_class .= ' button-primary button-hero bsf-envato-form-activation ';
}
}
if ( true !== $is_active ) {
$form_action = bsf_get_api_site() . 'envato-validation-callback/?wp-envato-validate';
} else {
$form_action = bsf_registration_page_url( '', $product_id );
}
$html .= '<div class="envato-license-registration">';
$html .= '<form method="post" class="' . $form_class . '" action="' . $form_action . '">';
$html .= wp_nonce_field( 'bsf_license_activation_deactivation_nonce', 'bsf_graupi_nonce', true, false );
if ( $this->get_message( 'message' ) !== '' ) {
$html .= '<span class="bsf-license-message license-' . $this->get_message( 'status' ) . '">';
$html .= $this->get_message( 'message' );
$html .= '</span>';
}
if ( $is_active ) {
$envato_active_oauth_title = apply_filters( "envato_active_oauth_title_{$product_id}", 'Updates & Support Registration - <span class="active">Active!</span>' );
$envato_active_oauth_subtitle = '<span class="active">' . sprintf(
'Your license is active.',
$product_name
) . '</span>';
$envato_active_oauth_subtitle = apply_filters( "envato_active_oauth_subtitle_{$product_id}", $envato_active_oauth_subtitle );
if ( $popup_license_form ) {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $product_name . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_active_oauth_subtitle . '</p>';
$html .= '</div>';
} else {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $envato_active_oauth_title . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_active_oauth_subtitle . '</p>';
$html .= '</div>';
}
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="bsf_license_manager[license_key]" value="License Validated"/>';
$html .= '<input type="hidden" class="' . $size . '-text" id="bsf_license_manager[product_id]" name="bsf_license_manager[product_id]" value="' . esc_attr( stripslashes( $product_id ) ) . '"/>';
$html .= '<input type="submit" class="button ' . $submit_button_class . '" name="bsf_deactivate_license" value="' . esc_attr( $button_text_deactivate ) . '"/>';
} else {
$envato_not_active_oauth_title = apply_filters( "envato_not_active_oauth_title_{$product_id}", __( 'Updates & Support Registration - <span class="not-active">Not Active!</span>', 'bsf' ) );
$envato_not_active_oauth_subtitle = apply_filters( "envato_not_active_oauth_subtitle_{$product_id}", __( 'Click on the button below to activate your license and subscribe to our newsletter.', 'bsf' ) );
if ( $popup_license_form ) {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $product_name . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_not_active_oauth_subtitle . '</p>';
$html .= '</div>';
} else {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $envato_not_active_oauth_title . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_not_active_oauth_subtitle . '</p>';
$html .= '</div>';
}
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="url" value="' . get_site_url() . '"/>';
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="redirect" value="' . $this->get_redirect_url( $product_id ) . '"/>';
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="product_id" value="' . $product_id . '"/>';
$html .= '<input id="bsf-license-privacy-consent" name="bsf_license_manager[privacy_consent]" type="hidden" value="true" />';
$html .= '<input id="bsf-license-terms-conditions-consent" name="bsf_license_manager[terms_conditions_consent]" type="hidden" value="true" />';
$html .= '<div class="submit-button-wrap">';
$html .= '<input type="button" class="button ' . $submit_button_class . '" name="bsf_activate_license" value="' . esc_attr( $button_text_activate ) . '"/>';
$html .= "<p class='purchase-license'><a target='_blank' href='$purchase_url'>Purchase License »</a></p>";
$html .= '</div>';
}
$html .= '</form>';
$html = apply_filters( 'bsf_inlne_license_envato_after_form', $html, $product_id );
$html .= '</div> <!-- envato-license-registration -->';
if ( isset( $_GET['debug'] ) ) {
$html .= get_bsf_systeminfo();
}
return $html;
}
/**
* Envato activation URL.
*
* @param array $form_data Form data.
* @return $envato_activation_url.
*/
public function envato_activation_url( $form_data ) {
$product_id = isset( $form_data['product_id'] ) ? esc_attr( $form_data['product_id'] ) : '';
$form_data['token'] = sha1( $this->create_token( $product_id ) );
$url = bsf_get_api_site() . 'envato-validation-callback/?wp-envato-validate';
$envato_activation_url = add_query_arg(
$form_data,
$url
);
return $envato_activation_url;
}
/**
* Get redirect URL.
*
* @param int $product_id Product ID.
* @return $current_url.
*/
protected function get_redirect_url( $product_id = '' ) {
if ( is_ssl() ) {
$current_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} else {
$current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
$current_url = esc_url( remove_query_arg( array( 'license_action', 'token', 'product_id', 'purchase_key', 'success', 'status', 'message' ), $current_url ) );
if ( '' !== $product_id ) {
$current_url = add_query_arg(
array(
'bsf-inline-license-form' => $product_id,
),
$current_url
);
}
return $current_url;
}
/**
* Create Token.
*
* @param int $product_id Product ID.
* @return $token.
*/
protected function create_token( $product_id ) {
$token = $product_id . '|' . current_time( 'timestamp' ) . '|' . bsf_generate_rand_token();
update_site_option( "bsf_envato_token_$product_id", $token );
return $token;
}
/**
* Validate Token.
*
* @param string $token Token.
* @param int $product_id Product ID.
* @return bool.
*/
protected function validate_token( $token, $product_id ) {
$stored_token = get_site_option( "bsf_envato_token_$product_id", '' );
if ( sha1( $stored_token ) === $token ) {
$token_atts = explode( '|', $stored_token );
$stored_id = $token_atts[0];
if ( $stored_id !== $product_id ) {
// Token is invalid.
return false;
}
$timestamp = (int) $token_atts[1];
$valid_ultil = $timestamp + 900;
if ( current_time( 'timestamp' ) > $valid_ultil ) {
// Timestamp has expired.
return false;
}
// If above conditions did not meet, the token is valid.
return true;
}
return false;
}
/**
* Process envato activation.
*/
protected function process_envato_activation() {
$token = isset( $_GET['token'] ) ? esc_attr( $_GET['token'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$product_id = isset( $_GET['product_id'] ) ? esc_attr( $_GET['product_id'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( $this->validate_token( $token, $product_id ) ) {
$args = array();
$args['purchase_key'] = isset( $_GET['purchase_key'] ) ? esc_attr( $_GET['purchase_key'] ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$args['status'] = isset( $_GET['status'] ) ? esc_attr( $_GET['status'] ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$this->license_manager->bsf_update_product_info( $product_id, $args );
$this->set_message(
array(
'status' => 'success',
'message' => 'License successfully activated!',
)
);
} else {
$this->set_message(
array(
'status' => 'error',
'message' => 'The token is invalid or is expired, please try again.',
)
);
}
}
/**
* Set message.
*
* @param array $message Message.
*/
protected function set_message( $message = array() ) {
$this->message_box = $message;
}
/**
* Get message.
*
* @param string $key key.
* @return $mesage
*/
protected function get_message( $key ) {
$message = $this->message_box;
return isset( $message[ $key ] ) ? $message[ $key ] : '';
}
/**
* Inline alternate method link.
*
* @param string $html HTML.
* @param int $bsf_product_id Product ID.
* @return $html.
*/
public function inline_alternate_method_link( $html, $bsf_product_id ) {
$privacy_policy_link = $this->license_manager->bsf_get_product_info( $bsf_product_id, 'privacy_policy' );
$terms_conditions_link = $this->license_manager->bsf_get_product_info( $bsf_product_id, 'terms_conditions' );
if ( isset( $privacy_policy_link ) ) {
$html .= sprintf(
'<a class="license-form-external-links" target="_blank" href="%s">Privacy Policy</a> | ',
$privacy_policy_link
);
}
if ( isset( $terms_conditions_link ) ) {
$html .= sprintf(
'<a class="license-form-external-links" target="_blank" href="%s">Terms & Conditions</a>',
$terms_conditions_link
);
}
return $html;
}
/**
* ALternate method link.
*
* @param string $content Content.
* @return $content.
*/
public function alternate_method_link( $content ) {
$bsf_activation_nonce = wp_create_nonce( 'bsf_activation_nonce' );
$content = sprintf(
'<a href="%s">Activate license using purchase key</a>',
add_query_arg(
array(
'activation_method' => 'license-key',
'bsf_activation_nonce' => $bsf_activation_nonce,
)
)
);
return $content;
}
}
/**
* BSF envato register.
*
* @param string $args Arguments..
* @return envato_register().
*/
function bsf_envato_register( $args ) {
$bsf_envato_activate = BSF_Envato_Activate::instance();
return $bsf_envato_activate->envato_register( $args );
}
<?php
/**
* BSf Evato Activation Class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF_Envato_Activate setup
*
* @since 1.0
*/
class BSF_Envato_Activate {
/**
* Instance
*
* @var BSF_Envato_Activate
*/
private static $instance;
/**
* Reference to the License manager class.
*
* @var BSF_License_Manager
*/
private $license_manager;
/**
* Stores temporary response messsages from the API validations.
*
* @var array()
*/
private $message_box;
/**
* Initiator.
*/
public static function instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new BSF_Envato_Activate();
}
return self::$instance;
}
/**
* Constructor function that initializes required actions and hooks
*
* @since 1.0
*/
public function __construct() {
$this->license_manager = new BSF_License_Manager();
$action = isset( $_GET['license_action'] ) ? esc_attr( $_GET['license_action'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( 'activate_license' === $action ) {
$this->process_envato_activation();
}
add_filter( 'update_footer', array( $this, 'alternate_method_link' ), 20 );
add_action( 'bsf_inlne_license_envato_after_form', array( $this, 'inline_alternate_method_link' ), 20, 2 );
}
/**
* Envato Register.
*
* @param array $args Arguments.
*/
public function envato_register( $args ) {
// Check if alternate method is to be used.
$method = ( isset( $_GET['activation_method'] ) && isset( $_GET['bsf_activation_nonce'] ) && wp_verify_nonce( $_GET['bsf_activation_nonce'], 'bsf_activation_nonce' ) ) ? esc_attr( $_GET['activation_method'] ) : 'oauth';
$html = '';
$product_id = isset( $args['product_id'] ) ? $args['product_id'] : '';
$is_active = $this->license_manager->bsf_is_active_license( $product_id );
$product_name = $this->license_manager->bsf_get_product_info( $product_id, 'name' );
$purchase_url = $this->license_manager->bsf_get_product_info( $product_id, 'purchase_url' );
$bundled = BSF_Update_Manager::bsf_is_product_bundled( $product_id );
if ( ! empty( $bundled ) ) {
$parent_id = $bundled[0];
$is_active = $this->license_manager->bsf_is_active_license( $parent_id );
$parent_name = brainstrom_product_name( $parent_id );
$registration_page = bsf_registration_page_url( '', $parent_id );
$html .= '<div class="bundled-product-license-registration">';
$html .= '<span>';
if ( $is_active ) {
$html .= '<h3>License Active!</h3>';
$html .= '<p>' . sprintf(
'Your license is activated, you will receive updates for <i>%s</i> when they are available.',
$product_name
) . '</p>';
} else {
$html .= '<h3>Updates Unavailable!</h3>';
$html .= '<p>' . sprintf(
'This plugin is came bundled with the <i>%1$s</i>. For receiving updates, you need to activate license of <i>%2$s</i> <a href="%3$s">here</a>.',
$parent_name,
$parent_name,
$registration_page
) . '</p>';
}
$html .= '</span>';
$html .= '</div>';
return $html;
}
if ( 'license-key' === $method ) {
$html .= bsf_license_activation_form( $args );
return $html;
}
// Licence activation button.
$form_action = ( isset( $args['form_action'] ) && ! is_null( $args['form_action'] ) ) ? $args['form_action'] : '';
$form_class = ( isset( $args['form_class'] ) && ! is_null( $args['form_class'] ) ) ? $args['form_class'] : "bsf-license-form-{$product_id}";
$submit_button_class = ( isset( $args['submit_button_class'] ) && ! is_null( $args['submit_button_class'] ) ) ? $args['submit_button_class'] : '';
$license_form_heading_class = ( isset( $args['bsf_license_form_heading_class'] ) && ! is_null( $args['bsf_license_form_heading_class'] ) ) ? $args['bsf_license_form_heading_class'] : '';
$license_active_class = ( isset( $args['bsf_license_active_class'] ) && ! is_null( $args['bsf_license_active_class'] ) ) ? $args['bsf_license_active_class'] : '';
$license_not_activate_message = ( isset( $args['bsf_license_not_activate_message'] ) && ! is_null( $args['bsf_license_not_activate_message'] ) ) ? $args['bsf_license_not_activate_message'] : '';
$size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular';
$button_text_activate = ( isset( $args['button_text_activate'] ) && ! is_null( $args['button_text_activate'] ) ) ? __( 'Sign Up & Activate', 'bsf' ) : __( 'Sign Up & Activate', 'bsf' );
$button_text_deactivate = ( isset( $args['button_text_deactivate'] ) && ! is_null( $args['button_text_deactivate'] ) ) ? $args['button_text_deactivate'] : __( 'Deactivate License', 'bsf' );
$placeholder = ( isset( $args['placeholder'] ) && ! is_null( $args['placeholder'] ) ) ? $args['placeholder'] : 'Enter your license key..';
$popup_license_form = ( isset( $args['popup_license_form'] ) ) ? $args['popup_license_form'] : false;
$bsf_license_allow_email = ( isset( $args['bsf_license_allow_email'] ) && ! is_null( $args['bsf_license_allow_email'] ) ) ? $args['bsf_license_allow_email'] : true;
if ( true === $bsf_license_allow_email ) {
$form_class .= ' license-form-allow-email ';
if ( ! $is_active ) {
$submit_button_class .= ' button-primary button-hero bsf-envato-form-activation ';
}
}
if ( true !== $is_active ) {
$form_action = bsf_get_api_site() . 'envato-validation-callback/?wp-envato-validate';
} else {
$form_action = bsf_registration_page_url( '', $product_id );
}
$html .= '<div class="envato-license-registration">';
$html .= '<form method="post" class="' . $form_class . '" action="' . $form_action . '">';
$html .= wp_nonce_field( 'bsf_license_activation_deactivation_nonce', 'bsf_graupi_nonce', true, false );
if ( $this->get_message( 'message' ) !== '' ) {
$html .= '<span class="bsf-license-message license-' . $this->get_message( 'status' ) . '">';
$html .= $this->get_message( 'message' );
$html .= '</span>';
}
if ( $is_active ) {
$envato_active_oauth_title = apply_filters( "envato_active_oauth_title_{$product_id}", 'Updates & Support Registration - <span class="active">Active!</span>' );
$envato_active_oauth_subtitle = '<span class="active">' . sprintf(
'Your license is active.',
$product_name
) . '</span>';
$envato_active_oauth_subtitle = apply_filters( "envato_active_oauth_subtitle_{$product_id}", $envato_active_oauth_subtitle );
if ( $popup_license_form ) {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $product_name . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_active_oauth_subtitle . '</p>';
$html .= '</div>';
} else {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $envato_active_oauth_title . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_active_oauth_subtitle . '</p>';
$html .= '</div>';
}
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="bsf_license_manager[license_key]" value="License Validated"/>';
$html .= '<input type="hidden" class="' . $size . '-text" id="bsf_license_manager[product_id]" name="bsf_license_manager[product_id]" value="' . esc_attr( stripslashes( $product_id ) ) . '"/>';
$html .= '<input type="submit" class="button ' . $submit_button_class . '" name="bsf_deactivate_license" value="' . esc_attr( $button_text_deactivate ) . '"/>';
} else {
$envato_not_active_oauth_title = apply_filters( "envato_not_active_oauth_title_{$product_id}", __( 'Updates & Support Registration - <span class="not-active">Not Active!</span>', 'bsf' ) );
$envato_not_active_oauth_subtitle = apply_filters( "envato_not_active_oauth_subtitle_{$product_id}", __( 'Click on the button below to activate your license and subscribe to our newsletter.', 'bsf' ) );
if ( $popup_license_form ) {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $product_name . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_not_active_oauth_subtitle . '</p>';
$html .= '</div>';
} else {
$html .= '<div class="bsf-wrap-title">';
$html .= '<h3 class="envato-oauth-heading">' . $envato_not_active_oauth_title . '</h2>';
$html .= '<p class="envato-oauth-subheading">' . $envato_not_active_oauth_subtitle . '</p>';
$html .= '</div>';
}
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="url" value="' . get_site_url() . '"/>';
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="redirect" value="' . $this->get_redirect_url( $product_id ) . '"/>';
$html .= '<input type="hidden" readonly class="' . $license_active_class . ' ' . $size . '-text" id="bsf_license_manager[license_key]" name="product_id" value="' . $product_id . '"/>';
$html .= '<input id="bsf-license-privacy-consent" name="bsf_license_manager[privacy_consent]" type="hidden" value="true" />';
$html .= '<input id="bsf-license-terms-conditions-consent" name="bsf_license_manager[terms_conditions_consent]" type="hidden" value="true" />';
$html .= '<div class="submit-button-wrap">';
$html .= '<input type="button" class="button ' . $submit_button_class . '" name="bsf_activate_license" value="' . esc_attr( $button_text_activate ) . '"/>';
$html .= "<p class='purchase-license'><a target='_blank' href='$purchase_url'>Purchase License »</a></p>";
$html .= '</div>';
}
$html .= '</form>';
$html = apply_filters( 'bsf_inlne_license_envato_after_form', $html, $product_id );
$html .= '</div> <!-- envato-license-registration -->';
if ( isset( $_GET['debug'] ) ) {
$html .= get_bsf_systeminfo();
}
return $html;
}
/**
* Envato activation URL.
*
* @param array $form_data Form data.
* @return $envato_activation_url.
*/
public function envato_activation_url( $form_data ) {
$product_id = isset( $form_data['product_id'] ) ? esc_attr( $form_data['product_id'] ) : '';
$form_data['token'] = sha1( $this->create_token( $product_id ) );
$url = bsf_get_api_site() . 'envato-validation-callback/?wp-envato-validate';
$envato_activation_url = add_query_arg(
$form_data,
$url
);
return $envato_activation_url;
}
/**
* Get redirect URL.
*
* @param int $product_id Product ID.
* @return $current_url.
*/
protected function get_redirect_url( $product_id = '' ) {
if ( is_ssl() ) {
$current_url = 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
} else {
$current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
}
$current_url = esc_url( remove_query_arg( array( 'license_action', 'token', 'product_id', 'purchase_key', 'success', 'status', 'message' ), $current_url ) );
if ( '' !== $product_id ) {
$current_url = add_query_arg(
array(
'bsf-inline-license-form' => $product_id,
),
$current_url
);
}
return $current_url;
}
/**
* Create Token.
*
* @param int $product_id Product ID.
* @return $token.
*/
protected function create_token( $product_id ) {
$token = $product_id . '|' . current_time( 'timestamp' ) . '|' . bsf_generate_rand_token();
update_site_option( "bsf_envato_token_$product_id", $token );
return $token;
}
/**
* Validate Token.
*
* @param string $token Token.
* @param int $product_id Product ID.
* @return bool.
*/
protected function validate_token( $token, $product_id ) {
$stored_token = get_site_option( "bsf_envato_token_$product_id", '' );
if ( sha1( $stored_token ) === $token ) {
$token_atts = explode( '|', $stored_token );
$stored_id = $token_atts[0];
if ( $stored_id !== $product_id ) {
// Token is invalid.
return false;
}
$timestamp = (int) $token_atts[1];
$valid_ultil = $timestamp + 900;
if ( current_time( 'timestamp' ) > $valid_ultil ) {
// Timestamp has expired.
return false;
}
// If above conditions did not meet, the token is valid.
return true;
}
return false;
}
/**
* Process envato activation.
*/
protected function process_envato_activation() {
$token = isset( $_GET['token'] ) ? esc_attr( $_GET['token'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$product_id = isset( $_GET['product_id'] ) ? esc_attr( $_GET['product_id'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
if ( $this->validate_token( $token, $product_id ) ) {
$args = array();
$args['purchase_key'] = isset( $_GET['purchase_key'] ) ? esc_attr( $_GET['purchase_key'] ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$args['status'] = isset( $_GET['status'] ) ? esc_attr( $_GET['status'] ) : '';// phpcs:ignore WordPress.Security.NonceVerification.Recommended
$this->license_manager->bsf_update_product_info( $product_id, $args );
$this->set_message(
array(
'status' => 'success',
'message' => 'License successfully activated!',
)
);
} else {
$this->set_message(
array(
'status' => 'error',
'message' => 'The token is invalid or is expired, please try again.',
)
);
}
}
/**
* Set message.
*
* @param array $message Message.
*/
protected function set_message( $message = array() ) {
$this->message_box = $message;
}
/**
* Get message.
*
* @param string $key key.
* @return $mesage
*/
protected function get_message( $key ) {
$message = $this->message_box;
return isset( $message[ $key ] ) ? $message[ $key ] : '';
}
/**
* Inline alternate method link.
*
* @param string $html HTML.
* @param int $bsf_product_id Product ID.
* @return $html.
*/
public function inline_alternate_method_link( $html, $bsf_product_id ) {
$privacy_policy_link = $this->license_manager->bsf_get_product_info( $bsf_product_id, 'privacy_policy' );
$terms_conditions_link = $this->license_manager->bsf_get_product_info( $bsf_product_id, 'terms_conditions' );
if ( isset( $privacy_policy_link ) ) {
$html .= sprintf(
'<a class="license-form-external-links" target="_blank" href="%s">Privacy Policy</a> | ',
$privacy_policy_link
);
}
if ( isset( $terms_conditions_link ) ) {
$html .= sprintf(
'<a class="license-form-external-links" target="_blank" href="%s">Terms & Conditions</a>',
$terms_conditions_link
);
}
return $html;
}
/**
* ALternate method link.
*
* @param string $content Content.
* @return $content.
*/
public function alternate_method_link( $content ) {
$bsf_activation_nonce = wp_create_nonce( 'bsf_activation_nonce' );
$content = sprintf(
'<a href="%s">Activate license using purchase key</a>',
add_query_arg(
array(
'activation_method' => 'license-key',
'bsf_activation_nonce' => $bsf_activation_nonce,
)
)
);
return $content;
}
}
/**
* BSF envato register.
*
* @param string $args Arguments..
* @return envato_register().
*/
function bsf_envato_register( $args ) {
$bsf_envato_activate = BSF_Envato_Activate::instance();
return $bsf_envato_activate->envato_register( $args );
}
File diff suppressed because it is too large Load Diff
@@ -1,180 +1,180 @@
<?php
/**
* BSF Rollback Version manager class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF Rollback Version manager.
*/
class BSF_Rollback_Version_Manager {
/**
* This is set for page reload cache.
*
* @var $reload_page_cache
*/
public static $reload_page_cache = 1;
/**
* Constructor function that initializes required sections.
*/
public function __construct() {
add_action( 'admin_notices', array( $this, 'bsf_download_rollback_version' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
}
/**
* Display Rollback to privious versions form.
*
* @param string $product_id Product ID.
* @since 1.0.0
*/
public function render_rollback_version_form( $product_id ) {
add_action( 'admin_footer', array( $this, 'rollback_version_popup' ) );
// Enqueue scripts only when this function is called.
wp_enqueue_script( 'bsf-core-version-rollback' );
wp_enqueue_style( 'bsf-core-version-rollback-css' );
$product_details = get_brainstorm_product( $product_id );
$installed_version = isset( $product_details['version'] ) ? $product_details['version'] : '';
$product_versions = BSF_Rollback_Version::bsf_get_product_versions( $product_id ); // Get Remote versions
// Show versions above than latest install version of the product.
$sorted_versions = BSF_Rollback_Version::sort_product_versions( $product_versions, $installed_version );
if ( empty( $sorted_versions ) ) {
echo esc_html__( 'No Versions Found! ', 'bsf-core' );
return;
}
$product_name = isset( $product_details['name'] ) ? $product_details['name'] : '';
$white_label_name = bsf_get_white_lable_product_name( $product_id, $product_name );
?>
<div class="bsf-rollback-version">
<input type="hidden" name="product-name" id="bsf-product-name" value="<?php echo esc_attr( $white_label_name ); ?>">
<select class="bsf-rollback-version-select">
<?php
foreach ( $sorted_versions as $version ) {
?>
<option value="<?php echo esc_attr( $version ); ?>"><?php echo esc_html( $version ); ?> </option>
<?php
}
?>
</select>
<a data-placeholder-text=" <?php echo esc_html__( 'Rollback', 'bsf-core' ); ?>" href="<?php echo esc_url( add_query_arg( 'version_no', $sorted_versions[0], wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&product_id=' . $product_id ), 'bsf_rollback' ) ) ); ?>"
data-placeholder-url="<?php echo esc_url( wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&version_no=VERSION&product_id=' . $product_id ), 'bsf_rollback' ) ); ?>" class="button bsf-rollback-button"><?php echo esc_html__( 'Rollback', 'bsf-core' ); ?> </a>
</div>
<?php
}
/**
* Download Product Version.
*/
public function bsf_download_rollback_version() {
if ( ! current_user_can( 'update_plugins' ) ) {
return false;
}
if ( empty( $_GET['version_no'] ) || empty( $_GET['product_id'] ) || ! isset( $_GET['action'] ) ) {
return false;
}
check_admin_referer( 'bsf_rollback' );
$bsf_update_manager = new BSF_Update_Manager();
$version_no = sanitize_text_field( $_GET['version_no'] );
$product_id = sanitize_text_field( $_GET['product_id'] );
$product_details = get_brainstorm_product( $product_id );
$plugin_slug = ! empty( $product_details['slug'] ) ? $product_details['slug'] : '';
$plugin_name = ! empty( $product_details['template'] ) ? $product_details['template'] : '';
$bundled_plugin_name = ! empty( $product_details['init'] ) ? $product_details['init'] : '';
$purchase_key = $bsf_update_manager->get_purchse_key( $product_id );
$product_title = ! empty( $product_details['name'] ) ? $product_details['name'] : '';
$plugin_name = ! empty( $plugin_name ) ? $plugin_name : $bundled_plugin_name;
$download_params = array(
'version_no' => $version_no,
'purchase_key' => $purchase_key,
'site_url' => get_site_url(),
);
$download_url = bsf_get_api_site( false, true ) . 'download/' . $product_id . '?' . http_build_query( $download_params );
$rollback = new BSF_Rollback_Version(
array(
'version' => $version_no,
'plugin_name' => $plugin_name,
'plugin_slug' => $plugin_slug,
'package_url' => $download_url,
'product_title' => $product_title,
'product_id' => $product_id,
)
);
$rollback->run();
// Delete product versions transient data after update.
bsf_clear_versions_cache( $product_id );
wp_die();
}
/**
* Load Scripts
*
* @since 1.0.0
*
* @param string $hook Current Hook.
* @return void
*/
public function load_scripts( $hook = '' ) {
wp_register_script( 'bsf-core-version-rollback', bsf_core_url( '/assets/js/version-rollback.js' ), array( 'jquery' ), BSF_UPDATER_VERSION, true );
wp_register_style( 'bsf-core-version-rollback-css', bsf_core_url( '/assets/css/rollback-version.css' ), array(), BSF_UPDATER_VERSION );
}
/**
* Version rollback Confirmation popup.
*
* @since 1.0.0
*/
public function rollback_version_popup() {
// This is set to fix the duplicate markup on page load.
if ( 1 !== self::$reload_page_cache ) {
return;
}
self::$reload_page_cache = 0;
?>
<div class="bsf-confirm-rollback-popup" style="display:none;">
<div class="bsf-core-rollback-overlay"></div>
<div class="bsf-confirm-rollback-popup-content">
<h3 class="bsf-rollback-heading bsf-confirm-heading" data-text="<?php esc_html_e( 'Rollback #PRODUCT_NAME# Version', 'bsf-core' ); ?>"></h3>
<p class="bsf-confirm-text bsf-rollback-text" data-text="<?php esc_html_e( 'Are you sure you want to rollback #PRODUCT_NAME# to version #VERSION#?', 'bsf-core' ); ?>" ></p>
<div class="bsf-confirm-rollback-popup-buttons-wrapper">
<button class="button bsf-product-license button-default bsf-confirm-cancel"><?php esc_html_e( 'Cancel', 'bsf-core' ); ?></button>
<button class="button button-primary bsf-confirm-ok"><?php esc_html_e( 'Continue', 'bsf-core' ); ?></button>
</div>
</div>
</div>
<?php
}
}
new BSF_Rollback_Version_Manager();
/**
* Render Rollback versoin form.
*
* @param string $product_id Product ID.
*/
function bsf_get_version_rollback_form( $product_id ) {
if ( ! bsf_display_rollback_version_form( $product_id ) ) {
return false;
}
$instance = new BSF_Rollback_Version_Manager();
$instance->render_rollback_version_form( $product_id );
}
<?php
/**
* BSF Rollback Version manager class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF Rollback Version manager.
*/
class BSF_Rollback_Version_Manager {
/**
* This is set for page reload cache.
*
* @var $reload_page_cache
*/
public static $reload_page_cache = 1;
/**
* Constructor function that initializes required sections.
*/
public function __construct() {
add_action( 'admin_notices', array( $this, 'bsf_download_rollback_version' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
}
/**
* Display Rollback to privious versions form.
*
* @param string $product_id Product ID.
* @since 1.0.0
*/
public function render_rollback_version_form( $product_id ) {
add_action( 'admin_footer', array( $this, 'rollback_version_popup' ) );
// Enqueue scripts only when this function is called.
wp_enqueue_script( 'bsf-core-version-rollback' );
wp_enqueue_style( 'bsf-core-version-rollback-css' );
$product_details = get_brainstorm_product( $product_id );
$installed_version = isset( $product_details['version'] ) ? $product_details['version'] : '';
$product_versions = BSF_Rollback_Version::bsf_get_product_versions( $product_id ); // Get Remote versions
// Show versions above than latest install version of the product.
$sorted_versions = BSF_Rollback_Version::sort_product_versions( $product_versions, $installed_version );
if ( empty( $sorted_versions ) ) {
echo esc_html__( 'No Versions Found! ', 'bsf-core' );
return;
}
$product_name = isset( $product_details['name'] ) ? $product_details['name'] : '';
$white_label_name = bsf_get_white_lable_product_name( $product_id, $product_name );
?>
<div class="bsf-rollback-version">
<input type="hidden" name="product-name" id="bsf-product-name" value="<?php echo esc_attr( $white_label_name ); ?>">
<select class="bsf-rollback-version-select">
<?php
foreach ( $sorted_versions as $version ) {
?>
<option value="<?php echo esc_attr( $version ); ?>"><?php echo esc_html( $version ); ?> </option>
<?php
}
?>
</select>
<a data-placeholder-text=" <?php echo esc_html__( 'Rollback', 'bsf-core' ); ?>" href="<?php echo esc_url( add_query_arg( 'version_no', $sorted_versions[0], wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&product_id=' . $product_id ), 'bsf_rollback' ) ) ); ?>"
data-placeholder-url="<?php echo esc_url( wp_nonce_url( admin_url( 'index.php?action=bsf_rollback&version_no=VERSION&product_id=' . $product_id ), 'bsf_rollback' ) ); ?>" class="button bsf-rollback-button"><?php echo esc_html__( 'Rollback', 'bsf-core' ); ?> </a>
</div>
<?php
}
/**
* Download Product Version.
*/
public function bsf_download_rollback_version() {
if ( ! current_user_can( 'update_plugins' ) ) {
return false;
}
if ( empty( $_GET['version_no'] ) || empty( $_GET['product_id'] ) || ! isset( $_GET['action'] ) ) {
return false;
}
check_admin_referer( 'bsf_rollback' );
$bsf_update_manager = new BSF_Update_Manager();
$version_no = sanitize_text_field( $_GET['version_no'] );
$product_id = sanitize_text_field( $_GET['product_id'] );
$product_details = get_brainstorm_product( $product_id );
$plugin_slug = ! empty( $product_details['slug'] ) ? $product_details['slug'] : '';
$plugin_name = ! empty( $product_details['template'] ) ? $product_details['template'] : '';
$bundled_plugin_name = ! empty( $product_details['init'] ) ? $product_details['init'] : '';
$purchase_key = $bsf_update_manager->get_purchse_key( $product_id );
$product_title = ! empty( $product_details['name'] ) ? $product_details['name'] : '';
$plugin_name = ! empty( $plugin_name ) ? $plugin_name : $bundled_plugin_name;
$download_params = array(
'version_no' => $version_no,
'purchase_key' => $purchase_key,
'site_url' => get_site_url(),
);
$download_url = bsf_get_api_site( false, true ) . 'download/' . $product_id . '?' . http_build_query( $download_params );
$rollback = new BSF_Rollback_Version(
array(
'version' => $version_no,
'plugin_name' => $plugin_name,
'plugin_slug' => $plugin_slug,
'package_url' => $download_url,
'product_title' => $product_title,
'product_id' => $product_id,
)
);
$rollback->run();
// Delete product versions transient data after update.
bsf_clear_versions_cache( $product_id );
wp_die();
}
/**
* Load Scripts
*
* @since 1.0.0
*
* @param string $hook Current Hook.
* @return void
*/
public function load_scripts( $hook = '' ) {
wp_register_script( 'bsf-core-version-rollback', bsf_core_url( '/assets/js/version-rollback.js' ), array( 'jquery' ), BSF_UPDATER_VERSION, true );
wp_register_style( 'bsf-core-version-rollback-css', bsf_core_url( '/assets/css/rollback-version.css' ), array(), BSF_UPDATER_VERSION );
}
/**
* Version rollback Confirmation popup.
*
* @since 1.0.0
*/
public function rollback_version_popup() {
// This is set to fix the duplicate markup on page load.
if ( 1 !== self::$reload_page_cache ) {
return;
}
self::$reload_page_cache = 0;
?>
<div class="bsf-confirm-rollback-popup" style="display:none;">
<div class="bsf-core-rollback-overlay"></div>
<div class="bsf-confirm-rollback-popup-content">
<h3 class="bsf-rollback-heading bsf-confirm-heading" data-text="<?php esc_html_e( 'Rollback #PRODUCT_NAME# Version', 'bsf-core' ); ?>"></h3>
<p class="bsf-confirm-text bsf-rollback-text" data-text="<?php esc_html_e( 'Are you sure you want to rollback #PRODUCT_NAME# to version #VERSION#?', 'bsf-core' ); ?>" ></p>
<div class="bsf-confirm-rollback-popup-buttons-wrapper">
<button class="button bsf-product-license button-default bsf-confirm-cancel"><?php esc_html_e( 'Cancel', 'bsf-core' ); ?></button>
<button class="button button-primary bsf-confirm-ok"><?php esc_html_e( 'Continue', 'bsf-core' ); ?></button>
</div>
</div>
</div>
<?php
}
}
new BSF_Rollback_Version_Manager();
/**
* Render Rollback versoin form.
*
* @param string $product_id Product ID.
*/
function bsf_get_version_rollback_form( $product_id ) {
if ( ! bsf_display_rollback_version_form( $product_id ) ) {
return false;
}
$instance = new BSF_Rollback_Version_Manager();
$instance->render_rollback_version_form( $product_id );
}
File diff suppressed because it is too large Load Diff
@@ -1,113 +1,113 @@
<?php
/**
* WP CLI Commands to manage Brainstorm Force products.
*
* @package bsf-core
*/
/**
* Class BSF_WP_CLI_Command
*/
class BSF_WP_CLI_Command extends WP_CLI_Command {
/**
* BSF_License Manager instance.
*
* @var $license_manager
*/
private $license_manager = '';
/**
* Initiator.
*/
public function __construct() {
$this->license_manager = new BSF_License_Manager();
}
/**
* WP CLI Command to activate and deactivate licenses for brainstormforce products.
*
* ## OPTIONS
*
* <action>
* activate or deactivate
*
* <priduct-id>
* Product id is unique for each brainstorm product, it can be found in the file <product-root-directory>/admin/.bsf.yml
*
* <license-key>
* Your purchase key.
*
* ## EXAMPLES
*
* 1. wp brainstormforce license activate uabb <purchase-key>
* - This will activate the license for plugin Ultimate Addons for beaver builder with purchase key <purchase-key>
* 2. wp brainstormforce license deactivate uabb <purchase-key>
* - This will deactivate the license for plugin Ultimate Addons for beaver builder with purchase key <purchase-key>
*
* @param array $args Arguments.
* @param array $assoc_args Associative Arguments.
*/
public function license( $args, $assoc_args ) {
if ( isset( $args[0] ) && 'activate' === $args[0] || 'deactivate' === $args[0] ) {
$action = $args[0];
} else {
WP_CLI::error( 'Please enter the correct action.' );
}
if ( isset( $args[1] ) ) {
$poduct_id = $args[1];
} else {
WP_CLI::error( 'Please enter a product id.' );
}
if ( isset( $args[2] ) ) {
$purchase_key = $args[2];
} else {
WP_CLI::error( 'Please enter the purchase key.' );
}
// Setup brainstorm_products data.
init_bsf_core();
$_POST = array(
'bsf_license_manager' => array(
'license_key' => $purchase_key,
'product_id' => $poduct_id,
),
);
$bsf_action = '';
if ( 'activate' === $action ) {
$bsf_action = 'bsf_license_activation';
$_POST['bsf_activate_license'] = true;
$_POST['bsf_graupi_nonce'] = wp_create_nonce( 'bsf_license_activation_deactivation_nonce' );
$this->license_manager->bsf_activate_license();
} else {
$bsf_action = 'bsf_license_deactivation';
$_POST['bsf_deactivate_license'] = true;
$_POST['bsf_graupi_nonce'] = wp_create_nonce( 'bsf_license_activation_deactivation_nonce' );
$this->license_manager->bsf_deactivate_license();
}
if ( '' !== $bsf_action ) {
if ( isset( $_POST[ $bsf_action ]['success'] ) && ( true === $_POST[ $bsf_action ]['success'] || 'true' === $_POST[ $bsf_action ]['success'] ) && isset( $_POST['bsf_graupi_nonce'] ) && wp_verify_nonce( $_POST['bsf_graupi_nonce'], 'bsf_license_activation_deactivation_nonce' ) ) {
$success_message = esc_attr( $_POST[ $bsf_action ]['message'] );
WP_CLI::success( $success_message );
} else {
$error_message = esc_attr( $_POST[ $bsf_action ]['message'] );
WP_CLI::error( $error_message );
}
}
}
}
if ( class_exists( 'WP_CLI' ) ) {
WP_CLI::add_command( 'brainstormforce', 'BSF_WP_CLI_Command' );
}
<?php
/**
* WP CLI Commands to manage Brainstorm Force products.
*
* @package bsf-core
*/
/**
* Class BSF_WP_CLI_Command
*/
class BSF_WP_CLI_Command extends WP_CLI_Command {
/**
* BSF_License Manager instance.
*
* @var $license_manager
*/
private $license_manager = '';
/**
* Initiator.
*/
public function __construct() {
$this->license_manager = new BSF_License_Manager();
}
/**
* WP CLI Command to activate and deactivate licenses for brainstormforce products.
*
* ## OPTIONS
*
* <action>
* activate or deactivate
*
* <priduct-id>
* Product id is unique for each brainstorm product, it can be found in the file <product-root-directory>/admin/.bsf.yml
*
* <license-key>
* Your purchase key.
*
* ## EXAMPLES
*
* 1. wp brainstormforce license activate uabb <purchase-key>
* - This will activate the license for plugin Ultimate Addons for beaver builder with purchase key <purchase-key>
* 2. wp brainstormforce license deactivate uabb <purchase-key>
* - This will deactivate the license for plugin Ultimate Addons for beaver builder with purchase key <purchase-key>
*
* @param array $args Arguments.
* @param array $assoc_args Associative Arguments.
*/
public function license( $args, $assoc_args ) {
if ( isset( $args[0] ) && 'activate' === $args[0] || 'deactivate' === $args[0] ) {
$action = $args[0];
} else {
WP_CLI::error( 'Please enter the correct action.' );
}
if ( isset( $args[1] ) ) {
$poduct_id = $args[1];
} else {
WP_CLI::error( 'Please enter a product id.' );
}
if ( isset( $args[2] ) ) {
$purchase_key = $args[2];
} else {
WP_CLI::error( 'Please enter the purchase key.' );
}
// Setup brainstorm_products data.
init_bsf_core();
$_POST = array(
'bsf_license_manager' => array(
'license_key' => $purchase_key,
'product_id' => $poduct_id,
),
);
$bsf_action = '';
if ( 'activate' === $action ) {
$bsf_action = 'bsf_license_activation';
$_POST['bsf_activate_license'] = true;
$_POST['bsf_graupi_nonce'] = wp_create_nonce( 'bsf_license_activation_deactivation_nonce' );
$this->license_manager->bsf_activate_license();
} else {
$bsf_action = 'bsf_license_deactivation';
$_POST['bsf_deactivate_license'] = true;
$_POST['bsf_graupi_nonce'] = wp_create_nonce( 'bsf_license_activation_deactivation_nonce' );
$this->license_manager->bsf_deactivate_license();
}
if ( '' !== $bsf_action ) {
if ( isset( $_POST[ $bsf_action ]['success'] ) && ( true === $_POST[ $bsf_action ]['success'] || 'true' === $_POST[ $bsf_action ]['success'] ) && isset( $_POST['bsf_graupi_nonce'] ) && wp_verify_nonce( $_POST['bsf_graupi_nonce'], 'bsf_license_activation_deactivation_nonce' ) ) {
$success_message = esc_attr( $_POST[ $bsf_action ]['message'] );
WP_CLI::success( $success_message );
} else {
$error_message = esc_attr( $_POST[ $bsf_action ]['message'] );
WP_CLI::error( $error_message );
}
}
}
}
if ( class_exists( 'WP_CLI' ) ) {
WP_CLI::add_command( 'brainstormforce', 'BSF_WP_CLI_Command' );
}
@@ -1,117 +1,117 @@
<?php
/**
* BSF Core REST API
*
* @package bsf-core
*/
/**
* License Activation/Deactivation REST API.
*/
class Bsf_Core_Rest {
/**
* Member Variable
*
* @var instance
*/
private static $instance;
/**
* The namespace of this controller's route.
*
* @var string
*/
public $namespace;
/**
* The base of this controller's route.
*
* @var string
*/
public $rest_base;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
$this->namespace = 'bsf-core/v1';
$this->rest_base = '/license';
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
}
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
register_rest_route(
$this->namespace,
$this->rest_base . '/activate',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( $this, 'activate_license' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => array(
'product-id' => array(
'type' => 'string',
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
),
'license-key' => array(
'type' => 'string',
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
),
),
)
);
}
/**
* Check if a given request has access to activate license.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( current_user_can( 'manage_options' ) ) {
return true;
}
return false;
}
/**
* Activate License Key.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response Rest Response with access key.
*/
public function activate_license( $request ) {
$product_id = $request->get_param( 'product-id' );
$license_key = $request->get_param( 'license-key' );
$data = array(
'privacy_consent' => true,
'terms_conditions_consent' => true,
'product_id' => $product_id,
'license_key' => $license_key,
);
return rest_ensure_response( BSF_License_Manager::instance()->bsf_process_license_activation( $data ) );
}
}
Bsf_Core_Rest::get_instance();
<?php
/**
* BSF Core REST API
*
* @package bsf-core
*/
/**
* License Activation/Deactivation REST API.
*/
class Bsf_Core_Rest {
/**
* Member Variable
*
* @var instance
*/
private static $instance;
/**
* The namespace of this controller's route.
*
* @var string
*/
public $namespace;
/**
* The base of this controller's route.
*
* @var string
*/
public $rest_base;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor.
*/
public function __construct() {
$this->namespace = 'bsf-core/v1';
$this->rest_base = '/license';
add_action( 'rest_api_init', array( $this, 'register_routes' ) );
}
/**
* Register the routes for the objects of the controller.
*/
public function register_routes() {
register_rest_route(
$this->namespace,
$this->rest_base . '/activate',
array(
'methods' => WP_REST_Server::CREATABLE,
'callback' => array( $this, 'activate_license' ),
'permission_callback' => array( $this, 'get_items_permissions_check' ),
'args' => array(
'product-id' => array(
'type' => 'string',
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
),
'license-key' => array(
'type' => 'string',
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
),
),
)
);
}
/**
* Check if a given request has access to activate license.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( current_user_can( 'manage_options' ) ) {
return true;
}
return false;
}
/**
* Activate License Key.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_REST_Response Rest Response with access key.
*/
public function activate_license( $request ) {
$product_id = $request->get_param( 'product-id' );
$license_key = $request->get_param( 'license-key' );
$data = array(
'privacy_consent' => true,
'terms_conditions_consent' => true,
'product_id' => $product_id,
'license_key' => $license_key,
);
return rest_ensure_response( BSF_License_Manager::instance()->bsf_process_license_activation( $data ) );
}
}
Bsf_Core_Rest::get_instance();
@@ -1,98 +1,98 @@
<?php
/**
* BSF Core Update
*
* @package Astra
* @author Astra
* @copyright Copyright (c) 2020, Astra
* @link http://wpastra.com/
* @since Astra 1.0.0
*/
if ( ! class_exists( 'BSF_Core_Update' ) ) {
/**
* BSF_Core_Update initial setup
*
* @since 1.0.0
*/
class BSF_Core_Update {
/**
* Class instance.
*
* @access private
* @var $instance Class instance.
*/
private static $instance;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
public function __construct() {
// Theme Updates.
add_action( 'admin_init', __CLASS__ . '::init', 0 );
add_filter( 'all_plugins', array( $this, 'update_products_slug' ), 10, 1 );
}
/**
* Implement theme update logic.
*
* @since 1.0.0
*/
public static function init() {
do_action( 'astra_update_before' );
// Get auto saved version number.
$saved_version = get_option( 'bsf-updater-version', false );
// If equals then return.
if ( version_compare( $saved_version, BSF_UPDATER_VERSION, '=' ) ) {
return;
}
// // Update auto saved version number.
update_option( 'bsf-updater-version', BSF_UPDATER_VERSION );
do_action( 'astra_update_after' );
}
/**
* Update bsf product slug in WP installed plugins data which will be used in enable/disablestaged updates products.
*
* @param array $plugins All installed plugins.
*
* @return array
*/
public function update_products_slug( $plugins ) {
$bsf_products = bsf_get_brainstorm_products( true );
foreach ( $bsf_products as $product => $data ) {
$plugin_file = isset( $data['template'] ) ? sanitize_text_field( $data['template'] ) : '';
if ( isset( $plugins[ $plugin_file ] ) && ! empty( $data['slug'] ) ) {
$plugins[ $plugin_file ]['slug'] = $data['slug'];
}
}
return $plugins;
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
BSF_Core_Update::get_instance();
<?php
/**
* BSF Core Update
*
* @package Astra
* @author Astra
* @copyright Copyright (c) 2020, Astra
* @link http://wpastra.com/
* @since Astra 1.0.0
*/
if ( ! class_exists( 'BSF_Core_Update' ) ) {
/**
* BSF_Core_Update initial setup
*
* @since 1.0.0
*/
class BSF_Core_Update {
/**
* Class instance.
*
* @access private
* @var $instance Class instance.
*/
private static $instance;
/**
* Initiator
*/
public static function get_instance() {
if ( ! isset( self::$instance ) ) {
self::$instance = new self();
}
return self::$instance;
}
/**
* Constructor
*/
public function __construct() {
// Theme Updates.
add_action( 'admin_init', __CLASS__ . '::init', 0 );
add_filter( 'all_plugins', array( $this, 'update_products_slug' ), 10, 1 );
}
/**
* Implement theme update logic.
*
* @since 1.0.0
*/
public static function init() {
do_action( 'astra_update_before' );
// Get auto saved version number.
$saved_version = get_option( 'bsf-updater-version', false );
// If equals then return.
if ( version_compare( $saved_version, BSF_UPDATER_VERSION, '=' ) ) {
return;
}
// // Update auto saved version number.
update_option( 'bsf-updater-version', BSF_UPDATER_VERSION );
do_action( 'astra_update_after' );
}
/**
* Update bsf product slug in WP installed plugins data which will be used in enable/disablestaged updates products.
*
* @param array $plugins All installed plugins.
*
* @return array
*/
public function update_products_slug( $plugins ) {
$bsf_products = bsf_get_brainstorm_products( true );
foreach ( $bsf_products as $product => $data ) {
$plugin_file = isset( $data['template'] ) ? sanitize_text_field( $data['template'] ) : '';
if ( isset( $plugins[ $plugin_file ] ) && ! empty( $data['slug'] ) ) {
$plugins[ $plugin_file ]['slug'] = $data['slug'];
}
}
return $plugins;
}
}
}
/**
* Kicking this off by calling 'get_instance()' method
*/
BSF_Core_Update::get_instance();
@@ -1,89 +1,89 @@
<?php
/**
* BSF extension installer class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF_Extension_Installer Extension installer.
*/
class BSF_Extension_Installer {
/**
* Constructor
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
add_action( 'wp_ajax_bsf-extention-activate', array( $this, 'activate_plugin' ) );
}
/**
* Load scripts needed for extension installer.
*
* @param hook $hook current page hook.
* @return void
*/
public function load_scripts( $hook ) {
$bsf_ext_inst = apply_filters( 'bsf_extension_installer_screens', array( 'bsf-extensions' ), $hook );
foreach ( $bsf_ext_inst as $key => $value ) {
if ( false !== strpos( $hook, $value ) ) {
wp_register_script( 'bsf-extension-installer', bsf_core_url( '/assets/js/extension-installer.js' ), array( 'jquery', 'wp-util', 'updates' ), BSF_UPDATER_VERSION, true );
wp_enqueue_script( 'bsf-extension-installer' );
}
}
}
/**
* Activates plugin.
*
* @return void
*/
public function activate_plugin() {
if ( ! wp_verify_nonce( $_POST['security'], 'bsf_activate_extension_nonce' ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => __( 'You are not authorized to perform this action.', 'bsf' ),
)
);
}
if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
wp_send_json_error(
array(
'success' => false,
'message' => __( 'No plugin specified', 'bsf' ),
)
);
}
$plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
$activate = activate_plugin( $plugin_init, '', false, true );
if ( is_wp_error( $activate ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $activate->get_error_message(),
)
);
}
wp_send_json_success(
array(
'success' => true,
'message' => __( 'Plugin Activated', 'bsf' ),
)
);
}
}
new BSF_Extension_Installer();
<?php
/**
* BSF extension installer class file.
*
* @package bsf-core
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* BSF_Extension_Installer Extension installer.
*/
class BSF_Extension_Installer {
/**
* Constructor
*/
public function __construct() {
add_action( 'admin_enqueue_scripts', array( $this, 'load_scripts' ) );
add_action( 'wp_ajax_bsf-extention-activate', array( $this, 'activate_plugin' ) );
}
/**
* Load scripts needed for extension installer.
*
* @param hook $hook current page hook.
* @return void
*/
public function load_scripts( $hook ) {
$bsf_ext_inst = apply_filters( 'bsf_extension_installer_screens', array( 'bsf-extensions' ), $hook );
foreach ( $bsf_ext_inst as $key => $value ) {
if ( false !== strpos( $hook, $value ) ) {
wp_register_script( 'bsf-extension-installer', bsf_core_url( '/assets/js/extension-installer.js' ), array( 'jquery', 'wp-util', 'updates' ), BSF_UPDATER_VERSION, true );
wp_enqueue_script( 'bsf-extension-installer' );
}
}
}
/**
* Activates plugin.
*
* @return void
*/
public function activate_plugin() {
if ( ! wp_verify_nonce( $_POST['security'], 'bsf_activate_extension_nonce' ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => __( 'You are not authorized to perform this action.', 'bsf' ),
)
);
}
if ( ! current_user_can( 'install_plugins' ) || ! isset( $_POST['init'] ) || ! $_POST['init'] ) {
wp_send_json_error(
array(
'success' => false,
'message' => __( 'No plugin specified', 'bsf' ),
)
);
}
$plugin_init = ( isset( $_POST['init'] ) ) ? esc_attr( $_POST['init'] ) : '';
$activate = activate_plugin( $plugin_init, '', false, true );
if ( is_wp_error( $activate ) ) {
wp_send_json_error(
array(
'success' => false,
'message' => $activate->get_error_message(),
)
);
}
wp_send_json_success(
array(
'success' => true,
'message' => __( 'Plugin Activated', 'bsf' ),
)
);
}
}
new BSF_Extension_Installer();
@@ -1,242 +1,242 @@
<?php
/**
* BSF Rollback Version
*
* @package bsf-core
* @author Brainstorm Force
* @link http://wpastra.com/
*/
/**
* BSF_Core_Update initial setup
*/
class BSF_Rollback_Version {
/**
* Package URL.
*
* Holds the package URL.
* This will be the actual download URL od zip file.
*
* @access protected
*
* @var string Package URL.
*/
protected $package_url;
/**
* Product URL.
*
* @access protected
* @var string Product URL.
*/
protected $product_url;
/**
* Version.
*
* Holds the version.
*
* @access protected
*
* @var string Package URL.
*/
protected $version;
/**
* Plugin name.
*
* Holds the plugin name.
*
* @access protected
*
* @var string Plugin name.
*/
protected $plugin_name;
/**
* Plugin slug.
*
* Holds the plugin slug.
*
* @access protected
*
* @var string Plugin slug.
*/
protected $plugin_slug;
/**
* Product Title.
*
* Holds the Product Title.
*
* @access protected
*
* @var string Plugin Title.
*/
protected $product_title;
/**
* HOlds the Product ID.
*
* @access protected
* @var string Product ID.
*/
protected $product_id;
/**
*
* Initializing Rollback.
*
* @access public
*
* @param array $args Optional.Rollback arguments. Default is an empty array.
*/
public function __construct( $args = array() ) {
foreach ( $args as $key => $value ) {
$this->{$key} = $value;
}
}
/**
* Apply package.
*
* @since 1.0.0
* @access protected
*/
protected function apply_package() {
$update_products = get_site_transient( 'update_plugins' );
if ( ! is_object( $update_products ) ) {
$update_products = new stdClass();
}
$product_info = new stdClass();
$product_info->new_version = $this->version;
$product_info->slug = $this->plugin_slug;
$product_info->package = $this->package_url; // This will be the actual download URL of zip file..
$product_info->url = $this->product_url;
$update_products->response[ $this->plugin_name ] = $product_info;
set_site_transient( 'update_plugins', $update_products );
}
/**
* Upgrade.
*
* Run WordPress upgrade to Rollback to previous version.
*
* @since 1.0.0
* @access protected
*/
protected function upgrade() {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader_args = array(
'url' => 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $this->plugin_name ),
'plugin' => $this->plugin_name,
'nonce' => 'upgrade-plugin_' . $this->plugin_name,
'title' => apply_filters( 'bsf_rollback_' . $this->product_id . '_title', '<h1>Rollback ' . bsf_get_white_lable_product_name( $this->product_id, $this->product_title ) . ' to version ' . $this->version . ' </h1>' ),
);
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( $upgrader_args ) );
$upgrader->upgrade( $this->plugin_name );
}
/**
*
* Rollback to previous versions.
*
* @since 1.0.0
* @access public
*/
public function run() {
$this->apply_package();
$this->upgrade();
}
/**
* Get All versions of product.
*
* @param string $product_id Product ID.
*/
public static function bsf_get_product_versions( $product_id ) {
if ( empty( $product_id ) ) {
return array();
}
// Check is transient is expire or User has Enalbed/Disabled the beta version.
$versions_transient = get_site_transient( 'bsf-product-versions-' . $product_id );
if ( false !== $versions_transient && false === self::is_beta_enabled_rollback( $product_id ) ) {
return $versions_transient;
}
$per_page = apply_filters( 'bsf_show_versions_to_rollback_' . $product_id, 10 );
$path = bsf_get_api_site( false, true ) . 'versions/' . $product_id . '?per_page=' . $per_page;
if ( BSF_Update_Manager::bsf_allow_beta_updates( $product_id ) ) {
$path = add_query_arg( 'include_beta', 'true', $path );
}
$response = wp_remote_get(
$path,
array(
'timeout' => '10',
)
);
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
return array();
}
$response_versions = json_decode( wp_remote_retrieve_body( $response ), true );
// Cache product version for 24 hrs.
set_site_transient( 'bsf-product-versions-' . $product_id, $response_versions, 24 * HOUR_IN_SECONDS );
return $response_versions;
}
/**
* This will filter the versions and return the versions less than current installed version.
*
* @param array $version_arr array of versions.
* @param string $current_version Current install version.
*
* @return array
*/
public static function sort_product_versions( $version_arr, $current_version ) {
$rollback_versions = array();
foreach ( $version_arr as $version ) {
if ( version_compare( $version, $current_version, '>=' ) ) {
continue;
}
$rollback_versions[] = $version;
}
return $rollback_versions;
}
/**
* This function is added to update the trasient data of product version on beta update enabled/disabled action.
* This will set the flag in db options that should beta versions include/removed in the rollback versions list based on enabled/disabled beta updates for the product.
*
* @param string $product_id Product ID.
*
* @return bool
*/
public static function is_beta_enabled_rollback( $product_id ) {
$allow_beta_update = BSF_Update_Manager::bsf_allow_beta_updates( $product_id );
$is_beta_enable = ( false === $allow_beta_update ) ? '0' : '1';
// Set the initial flag for is beta enelbled/ disabled.
if ( false === get_option( 'is_beta_enable_rollback_' . $product_id ) ) {
update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable );
return false;
}
// If user has enalbed/ disabled beta update then upadate the rollback version transient data.
if ( get_option( 'is_beta_enable_rollback_' . $product_id ) !== $is_beta_enable ) {
update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable );
return true;
}
return false;
}
}
<?php
/**
* BSF Rollback Version
*
* @package bsf-core
* @author Brainstorm Force
* @link http://wpastra.com/
*/
/**
* BSF_Core_Update initial setup
*/
class BSF_Rollback_Version {
/**
* Package URL.
*
* Holds the package URL.
* This will be the actual download URL od zip file.
*
* @access protected
*
* @var string Package URL.
*/
protected $package_url;
/**
* Product URL.
*
* @access protected
* @var string Product URL.
*/
protected $product_url;
/**
* Version.
*
* Holds the version.
*
* @access protected
*
* @var string Package URL.
*/
protected $version;
/**
* Plugin name.
*
* Holds the plugin name.
*
* @access protected
*
* @var string Plugin name.
*/
protected $plugin_name;
/**
* Plugin slug.
*
* Holds the plugin slug.
*
* @access protected
*
* @var string Plugin slug.
*/
protected $plugin_slug;
/**
* Product Title.
*
* Holds the Product Title.
*
* @access protected
*
* @var string Plugin Title.
*/
protected $product_title;
/**
* HOlds the Product ID.
*
* @access protected
* @var string Product ID.
*/
protected $product_id;
/**
*
* Initializing Rollback.
*
* @access public
*
* @param array $args Optional.Rollback arguments. Default is an empty array.
*/
public function __construct( $args = array() ) {
foreach ( $args as $key => $value ) {
$this->{$key} = $value;
}
}
/**
* Apply package.
*
* @since 1.0.0
* @access protected
*/
protected function apply_package() {
$update_products = get_site_transient( 'update_plugins' );
if ( ! is_object( $update_products ) ) {
$update_products = new stdClass();
}
$product_info = new stdClass();
$product_info->new_version = $this->version;
$product_info->slug = $this->plugin_slug;
$product_info->package = $this->package_url; // This will be the actual download URL of zip file..
$product_info->url = $this->product_url;
$update_products->response[ $this->plugin_name ] = $product_info;
set_site_transient( 'update_plugins', $update_products );
}
/**
* Upgrade.
*
* Run WordPress upgrade to Rollback to previous version.
*
* @since 1.0.0
* @access protected
*/
protected function upgrade() {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$upgrader_args = array(
'url' => 'update.php?action=upgrade-plugin&plugin=' . rawurlencode( $this->plugin_name ),
'plugin' => $this->plugin_name,
'nonce' => 'upgrade-plugin_' . $this->plugin_name,
'title' => apply_filters( 'bsf_rollback_' . $this->product_id . '_title', '<h1>Rollback ' . bsf_get_white_lable_product_name( $this->product_id, $this->product_title ) . ' to version ' . $this->version . ' </h1>' ),
);
$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( $upgrader_args ) );
$upgrader->upgrade( $this->plugin_name );
}
/**
*
* Rollback to previous versions.
*
* @since 1.0.0
* @access public
*/
public function run() {
$this->apply_package();
$this->upgrade();
}
/**
* Get All versions of product.
*
* @param string $product_id Product ID.
*/
public static function bsf_get_product_versions( $product_id ) {
if ( empty( $product_id ) ) {
return array();
}
// Check is transient is expire or User has Enalbed/Disabled the beta version.
$versions_transient = get_site_transient( 'bsf-product-versions-' . $product_id );
if ( false !== $versions_transient && false === self::is_beta_enabled_rollback( $product_id ) ) {
return $versions_transient;
}
$per_page = apply_filters( 'bsf_show_versions_to_rollback_' . $product_id, 10 );
$path = bsf_get_api_site( false, true ) . 'versions/' . $product_id . '?per_page=' . $per_page;
if ( BSF_Update_Manager::bsf_allow_beta_updates( $product_id ) ) {
$path = add_query_arg( 'include_beta', 'true', $path );
}
$response = wp_remote_get(
$path,
array(
'timeout' => '10',
)
);
if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
return array();
}
$response_versions = json_decode( wp_remote_retrieve_body( $response ), true );
// Cache product version for 24 hrs.
set_site_transient( 'bsf-product-versions-' . $product_id, $response_versions, 24 * HOUR_IN_SECONDS );
return $response_versions;
}
/**
* This will filter the versions and return the versions less than current installed version.
*
* @param array $version_arr array of versions.
* @param string $current_version Current install version.
*
* @return array
*/
public static function sort_product_versions( $version_arr, $current_version ) {
$rollback_versions = array();
foreach ( $version_arr as $version ) {
if ( version_compare( $version, $current_version, '>=' ) ) {
continue;
}
$rollback_versions[] = $version;
}
return $rollback_versions;
}
/**
* This function is added to update the trasient data of product version on beta update enabled/disabled action.
* This will set the flag in db options that should beta versions include/removed in the rollback versions list based on enabled/disabled beta updates for the product.
*
* @param string $product_id Product ID.
*
* @return bool
*/
public static function is_beta_enabled_rollback( $product_id ) {
$allow_beta_update = BSF_Update_Manager::bsf_allow_beta_updates( $product_id );
$is_beta_enable = ( false === $allow_beta_update ) ? '0' : '1';
// Set the initial flag for is beta enelbled/ disabled.
if ( false === get_option( 'is_beta_enable_rollback_' . $product_id ) ) {
update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable );
return false;
}
// If user has enalbed/ disabled beta update then upadate the rollback version transient data.
if ( get_option( 'is_beta_enable_rollback_' . $product_id ) !== $is_beta_enable ) {
update_option( 'is_beta_enable_rollback_' . $product_id, $is_beta_enable );
return true;
}
return false;
}
}
@@ -1,26 +1,26 @@
{
"name": "brainstormforce/bsf-core",
"type": "wordpress-plugin",
"description": "WordPress updater for Premium Products from Brainstorm Force",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Brainstorm Force",
"email": "hello@bsf.io"
}
],
"require": {
"composer/installers": "^2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/phpcompatibility-wp": "*",
"wp-cli/dist-archive-command": "^2.0",
"wp-coding-standards/wpcs": "dev-master"
},
"minimum-stability": "stable",
"scripts": {
"format": "vendor/bin/phpcbf --standard=phpcs.xml.dist",
"lint": "vendor/bin/phpcs --standard=phpcs.xml.dist"
}
}
{
"name": "brainstormforce/bsf-core",
"type": "wordpress-plugin",
"description": "WordPress updater for Premium Products from Brainstorm Force",
"license": "GPL-3.0-or-later",
"authors": [
{
"name": "Brainstorm Force",
"email": "hello@bsf.io"
}
],
"require": {
"composer/installers": "^2.0"
},
"require-dev": {
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/phpcompatibility-wp": "*",
"wp-cli/dist-archive-command": "^2.0",
"wp-coding-standards/wpcs": "dev-master"
},
"minimum-stability": "stable",
"scripts": {
"format": "vendor/bin/phpcbf --standard=phpcs.xml.dist",
"lint": "vendor/bin/phpcs --standard=phpcs.xml.dist"
}
}
@@ -1,403 +1,403 @@
<?php
/**
* Helper functions for BSF Core.
*
* @author Brainstorm Force
* @package bsf-core
*/
/**
* BSF get API site.
*
* @param bool $prefer_unsecure Prefer unsecure.
* @param bool $is_rest_api use rest api base URL.
* @return $bsf_api_site.
*/
function bsf_get_api_site( $prefer_unsecure = false, $is_rest_api = false ) {
$rest_api_endoint = ( true === $is_rest_api ) ? 'wp-json/bsf-products/v1/' : '';
if ( defined( 'BSF_API_URL' ) ) {
$bsf_api_site = BSF_API_URL . $rest_api_endoint;
} else {
$bsf_api_site = 'http://support.brainstormforce.com/' . $rest_api_endoint;
if ( false === $prefer_unsecure && wp_http_supports( array( 'ssl' ) ) ) {
$bsf_api_site = set_url_scheme( $bsf_api_site, 'https' );
}
}
return $bsf_api_site;
}
/**
* BSF get API URL.
*
* @param bool $prefer_unsecure Prefer unsecure.
* @return $url.
*/
function bsf_get_api_url( $prefer_unsecure = false ) {
$url = bsf_get_api_site( $prefer_unsecure ) . 'wp-admin/admin-ajax.php';
return $url;
}
/**
* BSF time since last version check.
*
* @param int $hours_completed Hours completed.
* @param string $option Option.
* @return $url.
*/
function bsf_time_since_last_versioncheck( $hours_completed, $option ) {
$seconds = $hours_completed * HOUR_IN_SECONDS;
$status = false;
$last_update_timestamp = (int) get_option( $option, false );
if ( false !== $last_update_timestamp ) {
// Find seconds passed since the last timestamp update (i.e. last request made).
$elapsed_seconds = (int) current_time( 'timestamp' ) - $last_update_timestamp;
// IF time is more than the required seconds allow a new HTTP request.
if ( $elapsed_seconds > $seconds ) {
$status = true;
}
} else {
// If timestamp is not yet set - allow the HTTP request.
$status = true;
}
return $status;
}
if ( ! function_exists( 'bsf_convert_core_path_to_relative' ) ) {
/**
* Depracate bsf_convert_core_path_to_relative() to in favour of bsf_core_url()
*
* @param $path $path deprecated.
* @return String URL of bsf-core directory.
*/
function bsf_convert_core_path_to_relative( $path ) {
_deprecated_function( __FUNCTION__, '1.22.46', 'bsf_core_url' );
return bsf_core_url( '' );
}
}
if ( ! function_exists( 'bsf_core_url' ) ) {
/**
* BSF Core URL
*
* @param string $append Append.
* @return String URL of bsf-core directory.
*/
function bsf_core_url( $append = '' ) {
$path = wp_normalize_path( BSF_UPDATER_PATH );
$theme_dir = wp_normalize_path( get_template_directory() );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
if ( strpos( $path, $theme_dir ) !== false ) {
return rtrim( get_template_directory_uri() . '/admin/bsf-core/', '/' ) . $append;
} elseif ( strpos( $path, $plugin_dir ) !== false ) {
return rtrim( plugin_dir_url( BSF_UPDATER_FILE ), '/' ) . $append;
} elseif ( strpos( $path, dirname( plugin_basename( BSF_UPDATER_FILE ) ) ) !== false ) {
return rtrim( plugin_dir_url( BSF_UPDATER_FILE ), '/' ) . $append;
}
return false;
}
}
if ( ! function_exists( 'get_brainstorm_product' ) ) {
/**
* Get BSF product.
*
* @param string $product_id Product ID.
* @return array Product.
*/
function get_brainstorm_product( $product_id = '' ) {
$all_products = brainstorm_get_all_products();
foreach ( $all_products as $key => $product ) {
$product_id_bsf = isset( $product['id'] ) ? ( is_numeric( $product['id'] ) ? (int) $product['id'] : $product['id'] ) : '';
if ( $product_id === $product_id_bsf ) {
return $product;
}
}
return array();
}
}
if ( ! function_exists( 'brainstorm_get_all_products' ) ) {
/**
* Get BSF all products.
*
* @param bool $skip_plugins Skip plugins.
* @param bool $skip_themes Skip themes.
* @param bool $skip_bundled Skip bundled.
*
* @return array All Products.
*/
function brainstorm_get_all_products( $skip_plugins = false, $skip_themes = false, $skip_bundled = false ) {
$all_products = array();
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
$brainstorm_plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
$brainstorm_themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();
if ( true === $skip_plugins ) {
$all_products = $brainstorm_themes;
} elseif ( true === $skip_themes ) {
$all_products = $brainstorm_plugins;
} else {
$all_products = $brainstorm_plugins + $brainstorm_themes;
}
if ( false === $skip_bundled ) {
foreach ( $brainstrom_bundled_products as $parent_id => $parent ) {
foreach ( $parent as $key => $product ) {
if ( isset( $all_products[ $product->id ] ) ) {
$all_products[ $product->id ] = array_merge( $all_products[ $product->id ], (array) $product );
} else {
$all_products[ $product->id ] = (array) $product;
}
}
}
}
return $all_products;
}
}
if ( ! function_exists( 'bsf_extension_nag' ) ) {
/**
* Generate's markup to generate notice to ask users to install required extensions.
*
* @since Graupi 1.9
*
* @param string $product_id (string) Product ID of the brainstorm product.
* @param bool $mu_updater (bool) If True - give nag to separately install brainstorm updater multisite plugin.
*/
function bsf_extension_nag( $product_id = '', $mu_updater = false ) {
$display_nag = get_user_meta( get_current_user_id(), $product_id . '-bsf_nag_dismiss', true );
if ( true === $mu_updater ) {
bsf_nag_brainstorm_updater_multisite();
}
if ( '1' === $display_nag ||
! user_can( get_current_user_id(), 'activate_plugins' ) ||
! user_can( get_current_user_id(), 'install_plugins' ) ) {
return;
}
$bsf_installed_plugins = '';
$bsf_not_installed_plugins = '';
$bsf_not_activated_plugins = '';
$installer = '';
$bsf_install = false;
$bsf_activate = false;
$bsf_bundled_products = bsf_bundled_plugins( $product_id );
$bsf_product_name = brainstrom_product_name( $product_id );
foreach ( $bsf_bundled_products as $key => $plugin ) {
if ( ! isset( $plugin->id ) || '' === $plugin->id || ! isset( $plugin->must_have_extension ) || 'false' === $plugin->must_have_extension ) {
continue;
}
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $plugin->init;
if ( is_file( $plugin_abs_path ) ) {
if ( ! is_plugin_active( $plugin->init ) ) {
$bsf_not_activated_plugins .= $bsf_bundled_products[ $key ]->name . ', ';
}
} else {
$bsf_not_installed_plugins .= $bsf_bundled_products[ $key ]->name . ', ';
}
}
$bsf_not_activated_plugins = rtrim( $bsf_not_activated_plugins, ', ' );
$bsf_not_installed_plugins = rtrim( $bsf_not_installed_plugins, ', ' );
if ( '' !== $bsf_not_activated_plugins || '' !== $bsf_not_installed_plugins ) {
echo '<div class="updated notice is-dismissible"><p></p>';
if ( '' !== $bsf_not_activated_plugins ) {
echo '<p>';
echo esc_html( $bsf_product_name ) . esc_html__( ' requires following plugins to be active : ', 'bsf' );
echo '<strong><em>';
echo esc_html( $bsf_not_activated_plugins );
echo '</strong></em>';
echo '</p>';
$bsf_activate = true;
}
if ( '' !== $bsf_not_installed_plugins ) {
echo '<p>';
echo esc_html( $bsf_product_name ) . esc_html__( ' requires following plugins to be installed and activated : ', 'bsf' );
echo '<strong><em>';
echo esc_html( $bsf_not_installed_plugins );
echo '</strong></em>';
echo '</p>';
$bsf_install = true;
}
if ( true === $bsf_activate ) {
$installer .= '<a href="' . get_admin_url() . 'plugins.php?plugin_status=inactive">' . __( 'Begin activating plugins', 'bsf' ) . '</a> | ';
}
if ( true === $bsf_install ) {
$installer .= '<a href="' . bsf_exension_installer_url( $product_id ) . '">' . __( 'Begin installing plugins', 'bsf' ) . '</a> | ';
}
$installer .= '<a href="' . esc_url( add_query_arg( 'bsf-dismiss-notice', $product_id ) ) . '">' . __( 'Dismiss This Notice', 'bsf' ) . '</a>';
$installer = ltrim( $installer, '| ' );
wp_nonce_field( 'bsf-extension-nag', 'bsf-extension-nag-nonce', true, 1 );
echo '<p><strong>';
echo esc_html( rtrim( $installer, ' |' ) );
echo '</p></strong>';
echo '<p></p></div>';
}
}
}
if ( ! function_exists( 'bsf_nag_brainstorm_updater_multisite' ) ) {
/**
* BSF Updater multisite.
*/
function bsf_nag_brainstorm_updater_multisite() {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if ( ! is_multisite() || is_plugin_active_for_network( 'brainstorm-updater/index.php' ) ) {
return;
}
echo '<div class="notice notice-error uct-notice is-dismissible"><p>';
/* translators: %1$s: strong tag %2%s: strong tag %3%s: anchor tag %4%s: closing anchor tag */
sprintf( __( 'Looks like you are on a WordPress Multisite, you will need to install and network activate %1$s Brainstorm Updater for Multisite %2$s plugin. Download it from %3$s here %4$s', 'bsf' ), '<strong><em>', '<strong><em>', '<a href="http://bsf.io/bsf-updater-mu" target="_blank">', '</a>' );
echo '</p>';
echo '</div>';
}
}
/**
* Get product name from BSF core is loaded.
*/
function bsf_get_loaded_bsf_core_name() {
$path = wp_normalize_path( BSF_UPDATER_PATH );
$theme_dir = wp_normalize_path( WP_CONTENT_DIR . '/themes/' );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
$product_name = '';
if ( false !== strpos( $path, $theme_dir ) ) {
// This is a theme path.
$product_slug = str_replace( array( $theme_dir, '/admin/bsf-core' ), '', $path );
} elseif ( false !== strpos( $path, $plugin_dir ) ) {
// This is plugin path.
$product_slug = str_replace( array( $plugin_dir . '/', '/admin/bsf-core' ), '', $path );
}
$brainstrom_products = get_option( 'brainstrom_products', array() );
foreach ( $brainstrom_products as $type => $products ) {
foreach ( $products as $product ) {
if ( $product['slug'] === $product_slug ) {
$product_name = $product['name'];
}
}
}
return $product_name;
}
/**
* Clear versions form trasinent.
*
* @param string $product_id Product ID.
*/
function bsf_clear_versions_cache( $product_id ) {
if ( false !== get_transient( 'bsf-product-versions-' . $product_id ) ) {
delete_transient( 'bsf-product-versions-' . $product_id );
}
}
/**
* Get white labled for product name.
*
* @param string $product_id Product ID.
* @param string $product_name Product Name.
*
* @return string Product name.
*/
function bsf_get_white_lable_product_name( $product_id, $product_name ) {
$white_label_name = apply_filters( "bsf_product_name_{$product_id}", $product_name );
return ! empty( $white_label_name ) ? $white_label_name : $product_name;
}
/**
* Get installed version of the product.
*
* @param string $type plugins/themes.
* @param string $product_id Product ID.
*/
function bsf_get_product_current_version( $type, $product_id ) {
$brainstrom_products = get_option( 'brainstrom_products' );
return isset( $brainstrom_products[ $type ][ $product_id ]['version'] ) ? $brainstrom_products[ $type ][ $product_id ]['version'] : '';
}
/**
* Check is user has permisson to view the product rollback version form.
*
* @param string $product_id Product ID.
*
* @return bool
*/
function bsf_display_rollback_version_form( $product_id ) {
if ( ! BSF_License_Manager::bsf_is_active_license( $product_id ) ) {
return false;
}
if ( is_multisite() && ! current_user_can( 'manage_network_plugins' ) ) {
return false;
}
if ( ! current_user_can( 'update_plugins' ) ) {
return false;
}
return true;
}
/**
* Get installed PHP version.
*
* @return float|false PHP version.
* @since 1.0.0
*/
function bsf_get_php_version() {
if ( defined( 'PHP_MAJOR_VERSION' ) && defined( 'PHP_MINOR_VERSION' ) && defined( 'PHP_RELEASE_VERSION' ) ) { // phpcs:ignore
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
return phpversion();
}
<?php
/**
* Helper functions for BSF Core.
*
* @author Brainstorm Force
* @package bsf-core
*/
/**
* BSF get API site.
*
* @param bool $prefer_unsecure Prefer unsecure.
* @param bool $is_rest_api use rest api base URL.
* @return $bsf_api_site.
*/
function bsf_get_api_site( $prefer_unsecure = false, $is_rest_api = false ) {
$rest_api_endoint = ( true === $is_rest_api ) ? 'wp-json/bsf-products/v1/' : '';
if ( defined( 'BSF_API_URL' ) ) {
$bsf_api_site = BSF_API_URL . $rest_api_endoint;
} else {
$bsf_api_site = 'http://support.brainstormforce.com/' . $rest_api_endoint;
if ( false === $prefer_unsecure && wp_http_supports( array( 'ssl' ) ) ) {
$bsf_api_site = set_url_scheme( $bsf_api_site, 'https' );
}
}
return $bsf_api_site;
}
/**
* BSF get API URL.
*
* @param bool $prefer_unsecure Prefer unsecure.
* @return $url.
*/
function bsf_get_api_url( $prefer_unsecure = false ) {
$url = bsf_get_api_site( $prefer_unsecure ) . 'wp-admin/admin-ajax.php';
return $url;
}
/**
* BSF time since last version check.
*
* @param int $hours_completed Hours completed.
* @param string $option Option.
* @return $url.
*/
function bsf_time_since_last_versioncheck( $hours_completed, $option ) {
$seconds = $hours_completed * HOUR_IN_SECONDS;
$status = false;
$last_update_timestamp = (int) get_option( $option, false );
if ( false !== $last_update_timestamp ) {
// Find seconds passed since the last timestamp update (i.e. last request made).
$elapsed_seconds = (int) current_time( 'timestamp' ) - $last_update_timestamp;
// IF time is more than the required seconds allow a new HTTP request.
if ( $elapsed_seconds > $seconds ) {
$status = true;
}
} else {
// If timestamp is not yet set - allow the HTTP request.
$status = true;
}
return $status;
}
if ( ! function_exists( 'bsf_convert_core_path_to_relative' ) ) {
/**
* Depracate bsf_convert_core_path_to_relative() to in favour of bsf_core_url()
*
* @param $path $path deprecated.
* @return String URL of bsf-core directory.
*/
function bsf_convert_core_path_to_relative( $path ) {
_deprecated_function( __FUNCTION__, '1.22.46', 'bsf_core_url' );
return bsf_core_url( '' );
}
}
if ( ! function_exists( 'bsf_core_url' ) ) {
/**
* BSF Core URL
*
* @param string $append Append.
* @return String URL of bsf-core directory.
*/
function bsf_core_url( $append = '' ) {
$path = wp_normalize_path( BSF_UPDATER_PATH );
$theme_dir = wp_normalize_path( get_template_directory() );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
if ( strpos( $path, $theme_dir ) !== false ) {
return rtrim( get_template_directory_uri() . '/admin/bsf-core/', '/' ) . $append;
} elseif ( strpos( $path, $plugin_dir ) !== false ) {
return rtrim( plugin_dir_url( BSF_UPDATER_FILE ), '/' ) . $append;
} elseif ( strpos( $path, dirname( plugin_basename( BSF_UPDATER_FILE ) ) ) !== false ) {
return rtrim( plugin_dir_url( BSF_UPDATER_FILE ), '/' ) . $append;
}
return false;
}
}
if ( ! function_exists( 'get_brainstorm_product' ) ) {
/**
* Get BSF product.
*
* @param string $product_id Product ID.
* @return array Product.
*/
function get_brainstorm_product( $product_id = '' ) {
$all_products = brainstorm_get_all_products();
foreach ( $all_products as $key => $product ) {
$product_id_bsf = isset( $product['id'] ) ? ( is_numeric( $product['id'] ) ? (int) $product['id'] : $product['id'] ) : '';
if ( $product_id === $product_id_bsf ) {
return $product;
}
}
return array();
}
}
if ( ! function_exists( 'brainstorm_get_all_products' ) ) {
/**
* Get BSF all products.
*
* @param bool $skip_plugins Skip plugins.
* @param bool $skip_themes Skip themes.
* @param bool $skip_bundled Skip bundled.
*
* @return array All Products.
*/
function brainstorm_get_all_products( $skip_plugins = false, $skip_themes = false, $skip_bundled = false ) {
$all_products = array();
$brainstrom_products = get_option( 'brainstrom_products', array() );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
$brainstorm_plugins = isset( $brainstrom_products['plugins'] ) ? $brainstrom_products['plugins'] : array();
$brainstorm_themes = isset( $brainstrom_products['themes'] ) ? $brainstrom_products['themes'] : array();
if ( true === $skip_plugins ) {
$all_products = $brainstorm_themes;
} elseif ( true === $skip_themes ) {
$all_products = $brainstorm_plugins;
} else {
$all_products = $brainstorm_plugins + $brainstorm_themes;
}
if ( false === $skip_bundled ) {
foreach ( $brainstrom_bundled_products as $parent_id => $parent ) {
foreach ( $parent as $key => $product ) {
if ( isset( $all_products[ $product->id ] ) ) {
$all_products[ $product->id ] = array_merge( $all_products[ $product->id ], (array) $product );
} else {
$all_products[ $product->id ] = (array) $product;
}
}
}
}
return $all_products;
}
}
if ( ! function_exists( 'bsf_extension_nag' ) ) {
/**
* Generate's markup to generate notice to ask users to install required extensions.
*
* @since Graupi 1.9
*
* @param string $product_id (string) Product ID of the brainstorm product.
* @param bool $mu_updater (bool) If True - give nag to separately install brainstorm updater multisite plugin.
*/
function bsf_extension_nag( $product_id = '', $mu_updater = false ) {
$display_nag = get_user_meta( get_current_user_id(), $product_id . '-bsf_nag_dismiss', true );
if ( true === $mu_updater ) {
bsf_nag_brainstorm_updater_multisite();
}
if ( '1' === $display_nag ||
! user_can( get_current_user_id(), 'activate_plugins' ) ||
! user_can( get_current_user_id(), 'install_plugins' ) ) {
return;
}
$bsf_installed_plugins = '';
$bsf_not_installed_plugins = '';
$bsf_not_activated_plugins = '';
$installer = '';
$bsf_install = false;
$bsf_activate = false;
$bsf_bundled_products = bsf_bundled_plugins( $product_id );
$bsf_product_name = brainstrom_product_name( $product_id );
foreach ( $bsf_bundled_products as $key => $plugin ) {
if ( ! isset( $plugin->id ) || '' === $plugin->id || ! isset( $plugin->must_have_extension ) || 'false' === $plugin->must_have_extension ) {
continue;
}
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $plugin->init;
if ( is_file( $plugin_abs_path ) ) {
if ( ! is_plugin_active( $plugin->init ) ) {
$bsf_not_activated_plugins .= $bsf_bundled_products[ $key ]->name . ', ';
}
} else {
$bsf_not_installed_plugins .= $bsf_bundled_products[ $key ]->name . ', ';
}
}
$bsf_not_activated_plugins = rtrim( $bsf_not_activated_plugins, ', ' );
$bsf_not_installed_plugins = rtrim( $bsf_not_installed_plugins, ', ' );
if ( '' !== $bsf_not_activated_plugins || '' !== $bsf_not_installed_plugins ) {
echo '<div class="updated notice is-dismissible"><p></p>';
if ( '' !== $bsf_not_activated_plugins ) {
echo '<p>';
echo esc_html( $bsf_product_name ) . esc_html__( ' requires following plugins to be active : ', 'bsf' );
echo '<strong><em>';
echo esc_html( $bsf_not_activated_plugins );
echo '</strong></em>';
echo '</p>';
$bsf_activate = true;
}
if ( '' !== $bsf_not_installed_plugins ) {
echo '<p>';
echo esc_html( $bsf_product_name ) . esc_html__( ' requires following plugins to be installed and activated : ', 'bsf' );
echo '<strong><em>';
echo esc_html( $bsf_not_installed_plugins );
echo '</strong></em>';
echo '</p>';
$bsf_install = true;
}
if ( true === $bsf_activate ) {
$installer .= '<a href="' . get_admin_url() . 'plugins.php?plugin_status=inactive">' . __( 'Begin activating plugins', 'bsf' ) . '</a> | ';
}
if ( true === $bsf_install ) {
$installer .= '<a href="' . bsf_exension_installer_url( $product_id ) . '">' . __( 'Begin installing plugins', 'bsf' ) . '</a> | ';
}
$installer .= '<a href="' . esc_url( add_query_arg( 'bsf-dismiss-notice', $product_id ) ) . '">' . __( 'Dismiss This Notice', 'bsf' ) . '</a>';
$installer = ltrim( $installer, '| ' );
wp_nonce_field( 'bsf-extension-nag', 'bsf-extension-nag-nonce', true, 1 );
echo '<p><strong>';
echo esc_html( rtrim( $installer, ' |' ) );
echo '</p></strong>';
echo '<p></p></div>';
}
}
}
if ( ! function_exists( 'bsf_nag_brainstorm_updater_multisite' ) ) {
/**
* BSF Updater multisite.
*/
function bsf_nag_brainstorm_updater_multisite() {
if ( ! function_exists( 'is_plugin_active_for_network' ) ) {
require_once ABSPATH . '/wp-admin/includes/plugin.php';
}
if ( ! is_multisite() || is_plugin_active_for_network( 'brainstorm-updater/index.php' ) ) {
return;
}
echo '<div class="notice notice-error uct-notice is-dismissible"><p>';
/* translators: %1$s: strong tag %2%s: strong tag %3%s: anchor tag %4%s: closing anchor tag */
sprintf( __( 'Looks like you are on a WordPress Multisite, you will need to install and network activate %1$s Brainstorm Updater for Multisite %2$s plugin. Download it from %3$s here %4$s', 'bsf' ), '<strong><em>', '<strong><em>', '<a href="http://bsf.io/bsf-updater-mu" target="_blank">', '</a>' );
echo '</p>';
echo '</div>';
}
}
/**
* Get product name from BSF core is loaded.
*/
function bsf_get_loaded_bsf_core_name() {
$path = wp_normalize_path( BSF_UPDATER_PATH );
$theme_dir = wp_normalize_path( WP_CONTENT_DIR . '/themes/' );
$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
$product_name = '';
if ( false !== strpos( $path, $theme_dir ) ) {
// This is a theme path.
$product_slug = str_replace( array( $theme_dir, '/admin/bsf-core' ), '', $path );
} elseif ( false !== strpos( $path, $plugin_dir ) ) {
// This is plugin path.
$product_slug = str_replace( array( $plugin_dir . '/', '/admin/bsf-core' ), '', $path );
}
$brainstrom_products = get_option( 'brainstrom_products', array() );
foreach ( $brainstrom_products as $type => $products ) {
foreach ( $products as $product ) {
if ( $product['slug'] === $product_slug ) {
$product_name = $product['name'];
}
}
}
return $product_name;
}
/**
* Clear versions form trasinent.
*
* @param string $product_id Product ID.
*/
function bsf_clear_versions_cache( $product_id ) {
if ( false !== get_transient( 'bsf-product-versions-' . $product_id ) ) {
delete_transient( 'bsf-product-versions-' . $product_id );
}
}
/**
* Get white labled for product name.
*
* @param string $product_id Product ID.
* @param string $product_name Product Name.
*
* @return string Product name.
*/
function bsf_get_white_lable_product_name( $product_id, $product_name ) {
$white_label_name = apply_filters( "bsf_product_name_{$product_id}", $product_name );
return ! empty( $white_label_name ) ? $white_label_name : $product_name;
}
/**
* Get installed version of the product.
*
* @param string $type plugins/themes.
* @param string $product_id Product ID.
*/
function bsf_get_product_current_version( $type, $product_id ) {
$brainstrom_products = get_option( 'brainstrom_products' );
return isset( $brainstrom_products[ $type ][ $product_id ]['version'] ) ? $brainstrom_products[ $type ][ $product_id ]['version'] : '';
}
/**
* Check is user has permisson to view the product rollback version form.
*
* @param string $product_id Product ID.
*
* @return bool
*/
function bsf_display_rollback_version_form( $product_id ) {
if ( ! BSF_License_Manager::bsf_is_active_license( $product_id ) ) {
return false;
}
if ( is_multisite() && ! current_user_can( 'manage_network_plugins' ) ) {
return false;
}
if ( ! current_user_can( 'update_plugins' ) ) {
return false;
}
return true;
}
/**
* Get installed PHP version.
*
* @return float|false PHP version.
* @since 1.0.0
*/
function bsf_get_php_version() {
if ( defined( 'PHP_MAJOR_VERSION' ) && defined( 'PHP_MINOR_VERSION' ) && defined( 'PHP_RELEASE_VERSION' ) ) { // phpcs:ignore
return PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
}
return phpversion();
}
@@ -1,292 +1,292 @@
<?php
/**
* System Info File.
*
* @author Brainstorm Force
* @package bsf-core
*/
/**
* Display system info.
*/
function bsf_systeminfo() {
?>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'WordPress Environment', 'bsf' ); ?></th>
</tr>
<tr>
<td>Home URL</td>
<td><?php echo esc_url( site_url() ); ?></td>
</tr>
<tr>
<td>Site URL</td>
<td><?php echo esc_url( site_url() ); ?></td>
</tr>
<tr>
<?php global $wp_version; ?>
<td>WP Version</td>
<td><?php echo floatval( $wp_version ); ?></td>
</tr>
<tr>
<td>Multisite</td>
<td><?php echo ( is_multisite() ) ? 'Yes' : 'No'; ?></td>
</tr>
<?php
$limit = (int) ini_get( 'memory_limit' );
$usage = function_exists( 'memory_get_usage' ) ? round( memory_get_usage() / 1024 / 1024, 2 ) : 0;
?>
<tr>
<td>Memory Usage</td>
<td>
<?php echo floatval( $usage ); ?>
MB of
<?php echo intval( $limit ); ?>
MB
</td>
</tr>
<tr>
<td>WP Memory Limit</td>
<td>
<?php echo intval( WP_MEMORY_LIMIT ); ?>
</td>
</tr>
<tr>
<td>WP Debug</td>
<td><?php echo ( WP_DEBUG ) ? 'Enabled' : 'Disabled'; ?></td>
</tr>
<tr>
<td>WP Lang</td>
<?php $currentlang = get_bloginfo( 'language' ); ?>
<td><?php echo esc_html( $currentlang ); ?></td>
</tr>
<tr>
<td>WP Uploads Directory</td>
<td>
<?php
$wp_up = wp_upload_dir();
echo ( is_writable( $wp_up['basedir'] ) ) ? 'Writable' : 'Readable';
?>
</td>
</tr>
<tr>
<td>BSF Updater Path</td>
<td>
<?php echo '(v' . esc_attr( BSF_UPDATER_VERSION ) . ') ' . esc_attr( BSF_UPDATER_PATH ); ?>
</td>
</tr>
<?php if ( defined( 'WPB_VC_VERSION' ) ) : ?>
<tr>
<td>vc_shortcode_output Filter</td>
<td>
<?php echo ( has_filter( 'vc_shortcode_output' ) ) ? 'Available' : 'Not Available'; ?>
</td>
</tr>
<?php endif; ?>
<?php
$mix = bsf_get_brainstorm_products( true );
$temp_constant = '';
if ( ! empty( $mix ) ) :
foreach ( $mix as $key => $product ) :
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant = 'BSF_' . $constant . '_CHECK_UPDATES';
if ( defined( $constant ) && ( constant( $constant ) === 'false' || constant( $constant ) === false ) ) {
$temp_constant .= $constant . '<br/>';
continue;
}
endforeach;
endif;
if ( defined( 'BSF_CHECK_PRODUCT_UPDATES' ) && false === BSF_CHECK_PRODUCT_UPDATES ) {
$temp_constant .= 'BSF_CHECK_PRODUCT_UPDATES';
}
if ( '' !== $temp_constant ) {
if ( ! defined( 'BSF_RESTRICTED_UPDATES' ) ) {
define( 'BSF_RESTRICTED_UPDATES', $temp_constant );
}
}
?>
<?php if ( defined( 'BSF_RESTRICTED_UPDATES' ) ) : ?>
<tr>
<td>Restrited Updates Filter</td>
<td>
<?php echo esc_html( BSF_RESTRICTED_UPDATES ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'Server Environment', 'bsf' ); ?></th>
</tr>
<tr>
<td>Server Info</td>
<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
</tr>
<tr>
<td>PHP Version</td>
<td><?php echo ( function_exists( 'phpversion' ) ) ? floatval( phpversion() ) : 'Not sure'; ?></td>
</tr>
<tr>
<td>MYSQL Version</td>
<td>
<?php
global $wpdb;
echo floatval( $wpdb->db_version() );
?>
</td>
</tr>
<tr>
<td>PHP Post Max Size</td>
<td><?php echo esc_attr( ini_get( 'post_max_size' ) ); ?></td>
</tr>
<tr>
<td>PHP Max Execution Time</td>
<td><?php echo esc_attr( ini_get( 'max_execution_time' ) ); ?> Seconds</td>
</tr>
<tr>
<td>PHP Max Input Vars</td>
<td><?php echo intval( ini_get( 'max_input_vars' ) ); // PHPCS:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound ?></td>
</tr>
<tr>
<td>Max Upload Size</td>
<td><?php echo intval( ini_get( 'upload_max_filesize' ) ); ?></td>
</tr>
<tr>
<td>Default Time Zone</td>
<td>
<?php
if ( date_default_timezone_get() ) {
echo esc_html( date_default_timezone_get() );
}
if ( ini_get( 'date.timezone' ) ) {
echo ' ' . esc_html( ini_get( 'date.timezone' ) );
}
?>
</td>
</tr>
<tr class="<?php echo ( ! function_exists( 'curl_version' ) ) ? 'bsf-alert' : ''; ?>">
<td>SimpleXML</td>
<td>
<?php
if ( extension_loaded( 'simplexml' ) ) {
echo 'SimpleXML extension is installed';
} else {
echo 'SimpleXML extension is not enabled.';
}
?>
</td>
</tr>
<tr class="<?php echo ( ! function_exists( 'curl_version' ) ) ? 'bsf-alert' : ''; ?>">
<td>cURL</td>
<td>
<?php
if ( function_exists( 'curl_version' ) ) {
$curl_info = curl_version();
?>
<div>Version : <strong><?php echo floatval( $curl_info['version'] ); ?></strong></div>
<div>SSL Version : <strong><?php echo floatval( $curl_info['ssl_version'] ); ?></strong></div>
<div>Host : <strong><?php echo esc_html( $curl_info['host'] ); ?></strong></div>
<?php
} else {
echo 'Not Enabled';
}
?>
</td>
</tr>
<?php
$connection = wp_remote_get( bsf_get_api_site() );
$support_class = ( is_wp_error( $connection ) || 200 !== wp_remote_retrieve_response_code( $connection ) ) ? 'bsf-alert' : '';
?>
<tr class="<?php echo esc_attr( $support_class ); ?>">
<td>Connection to Support API</td>
<td>
<?php
if ( is_wp_error( $connection ) || 200 !== wp_remote_retrieve_response_code( $connection ) ) {
echo 'Connection to Support API has error';
echo '<p class="description">Status Code: ' . esc_attr( wp_remote_retrieve_response_code( $connection ) ) . '</p>';
echo '<p class="description">Error Message: ' . esc_attr( $connection->get_error_message() ) . '</p>';
} else {
echo 'Connecion to Support API was successful';
echo '<p class="description">Status Code: ' . esc_attr( wp_remote_retrieve_response_code( $connection ) ) . '</p>';
}
?>
</td>
</tr>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'Theme Information', 'bsf' ); ?></th>
</tr>
<?php $theme_data = wp_get_theme(); ?>
<tr>
<td>Name</td>
<td><?php echo esc_html( $theme_data->Name ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?></td>
</tr>
<tr>
<td>Version</td>
<td><?php echo floatval( $theme_data->Version ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?></td>
</tr>
<tr>
<td>Author</td>
<td>
<?php echo wp_kses_post( $theme_data->Author ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?>
</td>
</tr>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info bsf-table-active-plugin">
<tbody>
<tr class="alternate">
<th colspan="4"><?php esc_html_e( 'Installed Plugins', 'bsf' ); ?></th>
</tr>
<?php
$plugins = get_plugins();
asort( $plugins );
foreach ( $plugins as $plugin_file => $plugin_data ) {
?>
<tr>
<td><?php echo esc_html( str_pad( $plugin_data['Title'], 30 ) ); ?></td>
<td>
<?php
if ( is_plugin_active( $plugin_file ) ) {
echo esc_html( str_pad( 'Active', 10 ) );
} else {
echo esc_html( str_pad( 'Inactive', 10 ) );
}
?>
</td>
<td><?php echo esc_html( str_pad( $plugin_data['Version'], 10 ) ); ?></td>
<td><?php echo esc_html( $plugin_data['Author'] ); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
/**
* Get BSF systeminfo.
*/
function get_bsf_systeminfo() {
$table = '<div class="bsf-system-info-wrapper">';
ob_start();
bsf_systeminfo();
$table .= ob_get_clean();
$table .= '</div>';
return $table;
}
<?php
/**
* System Info File.
*
* @author Brainstorm Force
* @package bsf-core
*/
/**
* Display system info.
*/
function bsf_systeminfo() {
?>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'WordPress Environment', 'bsf' ); ?></th>
</tr>
<tr>
<td>Home URL</td>
<td><?php echo esc_url( site_url() ); ?></td>
</tr>
<tr>
<td>Site URL</td>
<td><?php echo esc_url( site_url() ); ?></td>
</tr>
<tr>
<?php global $wp_version; ?>
<td>WP Version</td>
<td><?php echo floatval( $wp_version ); ?></td>
</tr>
<tr>
<td>Multisite</td>
<td><?php echo ( is_multisite() ) ? 'Yes' : 'No'; ?></td>
</tr>
<?php
$limit = (int) ini_get( 'memory_limit' );
$usage = function_exists( 'memory_get_usage' ) ? round( memory_get_usage() / 1024 / 1024, 2 ) : 0;
?>
<tr>
<td>Memory Usage</td>
<td>
<?php echo floatval( $usage ); ?>
MB of
<?php echo intval( $limit ); ?>
MB
</td>
</tr>
<tr>
<td>WP Memory Limit</td>
<td>
<?php echo intval( WP_MEMORY_LIMIT ); ?>
</td>
</tr>
<tr>
<td>WP Debug</td>
<td><?php echo ( WP_DEBUG ) ? 'Enabled' : 'Disabled'; ?></td>
</tr>
<tr>
<td>WP Lang</td>
<?php $currentlang = get_bloginfo( 'language' ); ?>
<td><?php echo esc_html( $currentlang ); ?></td>
</tr>
<tr>
<td>WP Uploads Directory</td>
<td>
<?php
$wp_up = wp_upload_dir();
echo ( is_writable( $wp_up['basedir'] ) ) ? 'Writable' : 'Readable';
?>
</td>
</tr>
<tr>
<td>BSF Updater Path</td>
<td>
<?php echo '(v' . esc_attr( BSF_UPDATER_VERSION ) . ') ' . esc_attr( BSF_UPDATER_PATH ); ?>
</td>
</tr>
<?php if ( defined( 'WPB_VC_VERSION' ) ) : ?>
<tr>
<td>vc_shortcode_output Filter</td>
<td>
<?php echo ( has_filter( 'vc_shortcode_output' ) ) ? 'Available' : 'Not Available'; ?>
</td>
</tr>
<?php endif; ?>
<?php
$mix = bsf_get_brainstorm_products( true );
$temp_constant = '';
if ( ! empty( $mix ) ) :
foreach ( $mix as $key => $product ) :
$constant = strtoupper( str_replace( '-', '_', $product['id'] ) );
$constant = 'BSF_' . $constant . '_CHECK_UPDATES';
if ( defined( $constant ) && ( constant( $constant ) === 'false' || constant( $constant ) === false ) ) {
$temp_constant .= $constant . '<br/>';
continue;
}
endforeach;
endif;
if ( defined( 'BSF_CHECK_PRODUCT_UPDATES' ) && false === BSF_CHECK_PRODUCT_UPDATES ) {
$temp_constant .= 'BSF_CHECK_PRODUCT_UPDATES';
}
if ( '' !== $temp_constant ) {
if ( ! defined( 'BSF_RESTRICTED_UPDATES' ) ) {
define( 'BSF_RESTRICTED_UPDATES', $temp_constant );
}
}
?>
<?php if ( defined( 'BSF_RESTRICTED_UPDATES' ) ) : ?>
<tr>
<td>Restrited Updates Filter</td>
<td>
<?php echo esc_html( BSF_RESTRICTED_UPDATES ); ?>
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'Server Environment', 'bsf' ); ?></th>
</tr>
<tr>
<td>Server Info</td>
<td><?php echo esc_html( $_SERVER['SERVER_SOFTWARE'] ); ?></td>
</tr>
<tr>
<td>PHP Version</td>
<td><?php echo ( function_exists( 'phpversion' ) ) ? floatval( phpversion() ) : 'Not sure'; ?></td>
</tr>
<tr>
<td>MYSQL Version</td>
<td>
<?php
global $wpdb;
echo floatval( $wpdb->db_version() );
?>
</td>
</tr>
<tr>
<td>PHP Post Max Size</td>
<td><?php echo esc_attr( ini_get( 'post_max_size' ) ); ?></td>
</tr>
<tr>
<td>PHP Max Execution Time</td>
<td><?php echo esc_attr( ini_get( 'max_execution_time' ) ); ?> Seconds</td>
</tr>
<tr>
<td>PHP Max Input Vars</td>
<td><?php echo intval( ini_get( 'max_input_vars' ) ); // PHPCS:ignore:PHPCompatibility.IniDirectives.NewIniDirectives.max_input_varsFound ?></td>
</tr>
<tr>
<td>Max Upload Size</td>
<td><?php echo intval( ini_get( 'upload_max_filesize' ) ); ?></td>
</tr>
<tr>
<td>Default Time Zone</td>
<td>
<?php
if ( date_default_timezone_get() ) {
echo esc_html( date_default_timezone_get() );
}
if ( ini_get( 'date.timezone' ) ) {
echo ' ' . esc_html( ini_get( 'date.timezone' ) );
}
?>
</td>
</tr>
<tr class="<?php echo ( ! function_exists( 'curl_version' ) ) ? 'bsf-alert' : ''; ?>">
<td>SimpleXML</td>
<td>
<?php
if ( extension_loaded( 'simplexml' ) ) {
echo 'SimpleXML extension is installed';
} else {
echo 'SimpleXML extension is not enabled.';
}
?>
</td>
</tr>
<tr class="<?php echo ( ! function_exists( 'curl_version' ) ) ? 'bsf-alert' : ''; ?>">
<td>cURL</td>
<td>
<?php
if ( function_exists( 'curl_version' ) ) {
$curl_info = curl_version();
?>
<div>Version : <strong><?php echo floatval( $curl_info['version'] ); ?></strong></div>
<div>SSL Version : <strong><?php echo floatval( $curl_info['ssl_version'] ); ?></strong></div>
<div>Host : <strong><?php echo esc_html( $curl_info['host'] ); ?></strong></div>
<?php
} else {
echo 'Not Enabled';
}
?>
</td>
</tr>
<?php
$connection = wp_remote_get( bsf_get_api_site() );
$support_class = ( is_wp_error( $connection ) || 200 !== wp_remote_retrieve_response_code( $connection ) ) ? 'bsf-alert' : '';
?>
<tr class="<?php echo esc_attr( $support_class ); ?>">
<td>Connection to Support API</td>
<td>
<?php
if ( is_wp_error( $connection ) || 200 !== wp_remote_retrieve_response_code( $connection ) ) {
echo 'Connection to Support API has error';
echo '<p class="description">Status Code: ' . esc_attr( wp_remote_retrieve_response_code( $connection ) ) . '</p>';
echo '<p class="description">Error Message: ' . esc_attr( $connection->get_error_message() ) . '</p>';
} else {
echo 'Connecion to Support API was successful';
echo '<p class="description">Status Code: ' . esc_attr( wp_remote_retrieve_response_code( $connection ) ) . '</p>';
}
?>
</td>
</tr>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info">
<tbody>
<tr class="alternate">
<th colspan="2"><?php esc_html_e( 'Theme Information', 'bsf' ); ?></th>
</tr>
<?php $theme_data = wp_get_theme(); ?>
<tr>
<td>Name</td>
<td><?php echo esc_html( $theme_data->Name ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?></td>
</tr>
<tr>
<td>Version</td>
<td><?php echo floatval( $theme_data->Version ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?></td>
</tr>
<tr>
<td>Author</td>
<td>
<?php echo wp_kses_post( $theme_data->Author ); // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase ?>
</td>
</tr>
</tbody>
</table>
<table class="wp-list-table widefat fixed bsf-sys-info bsf-table-active-plugin">
<tbody>
<tr class="alternate">
<th colspan="4"><?php esc_html_e( 'Installed Plugins', 'bsf' ); ?></th>
</tr>
<?php
$plugins = get_plugins();
asort( $plugins );
foreach ( $plugins as $plugin_file => $plugin_data ) {
?>
<tr>
<td><?php echo esc_html( str_pad( $plugin_data['Title'], 30 ) ); ?></td>
<td>
<?php
if ( is_plugin_active( $plugin_file ) ) {
echo esc_html( str_pad( 'Active', 10 ) );
} else {
echo esc_html( str_pad( 'Inactive', 10 ) );
}
?>
</td>
<td><?php echo esc_html( str_pad( $plugin_data['Version'], 10 ) ); ?></td>
<td><?php echo esc_html( $plugin_data['Author'] ); ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
<?php
}
/**
* Get BSF systeminfo.
*/
function get_bsf_systeminfo() {
$table = '<div class="bsf-system-info-wrapper">';
ob_start();
bsf_systeminfo();
$table .= ob_get_clean();
$table .= '</div>';
return $table;
}
@@ -1,84 +1,84 @@
<?php
/**
* Plugin installer.
*
* @package bsf-core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
$current_page = '';
if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current_page = sanitize_text_field( $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$arr = explode( 'bsf-extensions-', $current_page );
$product_id = $arr[1];
}
$redirect_url = network_admin_url( 'admin.php?page=' . $current_page );
$extensions_installer_heading = apply_filters( "bsf_extinstaller_heading_{$product_id}", 'iMedica Extensions' );
$extensions_installer_subheading = apply_filters( "bsf_extinstaller_subheading_{$product_id}", 'iMedica is already very flexible & feature rich theme. It further aims to be all-in-one solution for your WordPress needs. Install any necessary extensions you like from below and take it on the steroids.' );
$reset_bundled_url = bsf_exension_installer_url( $product_id . '&remove-bundled-products&redirect=' . $redirect_url );
?>
<div class="clear"></div>
<div class="wrap about-wrap bsf-sp-screen bend <?php echo 'extension-installer-' . sanitize_html_class( $product_id ); ?>">
<div class="bend-heading-section extension-about-header">
<h1><?php echo esc_html( $extensions_installer_heading ); ?></h1>
<h3><?php echo esc_html( $extensions_installer_subheading ); ?></h3>
<div class="bend-head-logo">
<div class="bend-product-ver"><?php esc_html_e( 'Extensions ', 'bsf' ); ?></div>
</div>
</div> <!--heading section-->
<div class="bend-content-wrap">
<hr class="bsf-extensions-lists-separator">
<h3 class="bf-ext-sub-title"><?php esc_html_e( 'Available Extensions', 'bsf' ); ?></h3>
<?php $nonce = wp_create_nonce( 'bsf_activate_extension_nonce' ); ?>
<input type="hidden" id="bsf_activate_extension_nonce" value="<?php echo esc_attr( $nonce ); ?>" >
<?php
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( isset( $brainstrom_bundled_products[ $product_id ] ) ) {
$brainstrom_bundled_products = $brainstrom_bundled_products[ $product_id ];
}
usort( $brainstrom_bundled_products, 'bsf_sort' );
if ( empty( $brainstrom_bundled_products ) ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-download"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'No extensions available yet!', 'bsf' ); ?></em></p>
<div class="bsf-cp-rem-bundle" style="margin-top: 30px;">
<a class="button-primary" href="<?php echo( htmlentities( $reset_bundled_url, ENT_QUOTES, 'utf-8' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php esc_html_e( 'Refresh Bundled Products', 'bsf' ); ?></a>
</div>
</div>
<?php
} else {
?>
<ul class="bsf-extensions-list">
<?php echo wp_kses_post( bsf_render_bundled_products( $product_id, false ) ); ?>
</ul>
<hr class="bsf-extensions-lists-separator">
<h3 class="bf-ext-sub-title"><?php esc_html_e( 'Installed Extensions', 'bsf' ); ?></h3>
<ul class="bsf-extensions-list">
<?php echo wp_kses_post( bsf_render_bundled_products( $product_id, true ) ); ?>
</ul>
<?php
}
?>
</div>
</div>
<?php
/**
* Plugin installer.
*
* @package bsf-core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
$current_page = '';
if ( isset( $_GET['page'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$current_page = sanitize_text_field( $_GET['page'] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
$arr = explode( 'bsf-extensions-', $current_page );
$product_id = $arr[1];
}
$redirect_url = network_admin_url( 'admin.php?page=' . $current_page );
$extensions_installer_heading = apply_filters( "bsf_extinstaller_heading_{$product_id}", 'iMedica Extensions' );
$extensions_installer_subheading = apply_filters( "bsf_extinstaller_subheading_{$product_id}", 'iMedica is already very flexible & feature rich theme. It further aims to be all-in-one solution for your WordPress needs. Install any necessary extensions you like from below and take it on the steroids.' );
$reset_bundled_url = bsf_exension_installer_url( $product_id . '&remove-bundled-products&redirect=' . $redirect_url );
?>
<div class="clear"></div>
<div class="wrap about-wrap bsf-sp-screen bend <?php echo 'extension-installer-' . sanitize_html_class( $product_id ); ?>">
<div class="bend-heading-section extension-about-header">
<h1><?php echo esc_html( $extensions_installer_heading ); ?></h1>
<h3><?php echo esc_html( $extensions_installer_subheading ); ?></h3>
<div class="bend-head-logo">
<div class="bend-product-ver"><?php esc_html_e( 'Extensions ', 'bsf' ); ?></div>
</div>
</div> <!--heading section-->
<div class="bend-content-wrap">
<hr class="bsf-extensions-lists-separator">
<h3 class="bf-ext-sub-title"><?php esc_html_e( 'Available Extensions', 'bsf' ); ?></h3>
<?php $nonce = wp_create_nonce( 'bsf_activate_extension_nonce' ); ?>
<input type="hidden" id="bsf_activate_extension_nonce" value="<?php echo esc_attr( $nonce ); ?>" >
<?php
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( isset( $brainstrom_bundled_products[ $product_id ] ) ) {
$brainstrom_bundled_products = $brainstrom_bundled_products[ $product_id ];
}
usort( $brainstrom_bundled_products, 'bsf_sort' );
if ( empty( $brainstrom_bundled_products ) ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-download"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'No extensions available yet!', 'bsf' ); ?></em></p>
<div class="bsf-cp-rem-bundle" style="margin-top: 30px;">
<a class="button-primary" href="<?php echo( htmlentities( $reset_bundled_url, ENT_QUOTES, 'utf-8' ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"><?php esc_html_e( 'Refresh Bundled Products', 'bsf' ); ?></a>
</div>
</div>
<?php
} else {
?>
<ul class="bsf-extensions-list">
<?php echo wp_kses_post( bsf_render_bundled_products( $product_id, false ) ); ?>
</ul>
<hr class="bsf-extensions-lists-separator">
<h3 class="bf-ext-sub-title"><?php esc_html_e( 'Installed Extensions', 'bsf' ); ?></h3>
<ul class="bsf-extensions-list">
<?php echo wp_kses_post( bsf_render_bundled_products( $product_id, true ) ); ?>
</ul>
<?php
}
?>
</div>
</div>
File diff suppressed because it is too large Load Diff
@@ -1,300 +1,300 @@
<?php
/**
* Admin functions for bsf core.
*
* @package BSF core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
if ( ! function_exists( 'check_bsf_product_status' ) ) {
/**
* Get status of product.
*
* @param int $id product id.
* @return bool
*/
function check_bsf_product_status( $id ) {
$brainstrom_products = ( get_option( 'brainstrom_products' ) ) ? get_option( 'brainstrom_products' ) : array();
$bsf_product_themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
if ( empty( $brainstrom_products ) ) {
return false;
}
$status = false;
foreach ( $brainstrom_products as $products ) {
foreach ( $products as $key => $product ) {
if ( $product['id'] === $id ) {
$status = ( isset( $product['status'] ) ) ? $product['status'] : '';
break;
}
}
}
return $status;
}
}
if ( ! function_exists( 'get_bundled_plugins' ) ) {
/**
* Retrieves bundled plugin data.
*
* @param string $template product template.
* @return void
*/
function get_bundled_plugins( $template = '' ) {
global $ultimate_referer;
$brainstrom_products = get_option( 'brainstrom_products', array() );
$prd_ids = array();
// If brainstrom_products is not yet set, call bsf core init.
if ( is_array( $brainstrom_products ) ) {
init_bsf_core();
$brainstrom_products = get_option( 'brainstrom_products', array() );
}
foreach ( $brainstrom_products as $key => $value ) {
foreach ( $value as $key => $value2 ) {
array_push( $prd_ids, $key );
}
}
$path = bsf_get_api_url() . '?referer=' . $ultimate_referer;
$data = array(
'action' => 'bsf_fetch_brainstorm_products',
'id' => $prd_ids,
);
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '10',
)
);
// Request http URL if the https version fails.
if ( is_wp_error( $request ) && wp_remote_retrieve_response_code( $request ) !== 200 ) {
$path = bsf_get_api_url( true ) . '?referer=' . $ultimate_referer;
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '8',
)
);
}
if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
$result = json_decode( $request['body'] );
$bundled = array();
$simple = array();
if ( ! empty( $result ) ) {
if ( ! empty( $result->bundled ) ) {
$bundled = $result->bundled;
}
if ( ! empty( $result->simple ) ) {
$simple = $result->simple;
}
}
foreach ( $bundled as $key => $value ) {
if ( empty( $value ) ) {
unset( $bundled->$key );
}
}
$brainstrom_bundled_products = (array) $bundled;
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
// update 'brainstorm_products'.
$simple = json_decode( wp_json_encode( $simple ), 1 );
foreach ( $brainstrom_products as $type => $products ) {
foreach ( $products as $key => $product ) {
$old_id = isset( $product['id'] ) ? $product['id'] : '';
$simple[ $type ][ $old_id ]['template'] = isset( $brainstrom_products[ $type ][ $old_id ]['template'] ) ? $brainstrom_products[ $type ][ $old_id ]['template'] : '';
$simple[ $type ][ $old_id ]['remote'] = isset( $simple[ $type ][ $old_id ]['version'] ) ? $simple[ $type ][ $old_id ]['version'] : '';
$simple[ $type ][ $old_id ]['version'] = isset( $brainstrom_products[ $type ][ $old_id ]['version'] ) ? $brainstrom_products[ $type ][ $old_id ]['version'] : '';
$simple[ $type ][ $old_id ]['purchase_key'] = isset( $brainstrom_products[ $type ][ $old_id ]['purchase_key'] ) ? $brainstrom_products[ $type ][ $old_id ]['purchase_key'] : '';
$simple[ $type ][ $old_id ]['status'] = isset( $brainstrom_products[ $type ][ $old_id ]['status'] ) ? $brainstrom_products[ $type ][ $old_id ]['status'] : '';
$simple[ $type ][ $old_id ]['message'] = isset( $brainstrom_products[ $type ][ $old_id ]['message'] ) ? $brainstrom_products[ $type ][ $old_id ]['message'] : '';
}
}
update_option( 'brainstrom_products', $simple );
}
}
}
/**
* Displays bundled product list for product.
*
* @param string $product_id Product ID.
* @param bool $installed Show installed products?.
* @return string
*/
function bsf_render_bundled_products( $product_id, $installed ) {
$product_status = check_bsf_product_status( $product_id );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( isset( $brainstrom_bundled_products[ $product_id ] ) ) {
$brainstrom_bundled_products = $brainstrom_bundled_products[ $product_id ];
}
usort( $brainstrom_bundled_products, 'bsf_sort' );
$global_plugin_installed = 0;
$global_plugin_activated = 0;
$total_bundled_plugins = count( $brainstrom_bundled_products );
foreach ( $brainstrom_bundled_products as $key => $product ) {
if ( ! isset( $product->id ) || empty( $product->id ) ) {
continue;
}
if ( isset( $request_product_id ) && $request_product_id !== $product->id ) {
continue;
}
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $product->init;
if ( is_file( $plugin_abs_path ) ) {
$global_plugin_installed++;
if ( is_plugin_active( $product->init ) ) {
$global_plugin_activated++;
}
}
}
ob_start();
if ( $total_bundled_plugins === $global_plugin_installed ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-smiley"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'All available extensions have been installed!', 'bsf' ); ?></em></p>
</div>
<?php
return ob_get_clean();
}
if ( empty( $brainstrom_bundled_products ) ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-download"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'No extensions available yet!', 'bsf' ); ?></em></p>
<div class="bsf-cp-rem-bundle" style="margin-top: 30px;">
<a class="button-primary" href="<?php echo esc_url( $reset_bundled_url ); ?>"><?php esc_html_e( 'Refresh Bundled Products', 'bsf' ); ?></a>
</div>
</div>
<?php
return ob_get_clean();
}
foreach ( $brainstrom_bundled_products as $key => $product ) {
if ( ! isset( $product->id ) || empty( $product->id ) ) {
continue;
}
if ( isset( $request_product_id ) && $request_product_id !== $product->id ) {
continue;
}
$is_plugin_installed = false;
$is_plugin_activated = false;
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $product->init;
if ( is_file( $plugin_abs_path ) ) {
$is_plugin_installed = true;
if ( is_plugin_active( $product->init ) ) {
$is_plugin_activated = true;
}
}
if ( ( $is_plugin_installed && ! $installed ) || ( ! $is_plugin_installed && $installed ) ) {
continue;
}
if ( $is_plugin_installed && $is_plugin_activated ) {
$class = 'active-plugin';
} elseif ( $is_plugin_installed && ! $is_plugin_activated ) {
$class = 'inactive-plugin';
} else {
$class = 'plugin-not-installed';
}
?>
<li id="ext-<?php echo esc_attr( $key ); ?>" class="bsf-extension <?php echo esc_attr( $class ); ?> bsf-extension-<?php echo esc_attr( $product->slug ); ?>" data-init="<?php echo esc_attr( $product->init ); ?>">
<?php if ( ! $is_plugin_installed ) { ?>
<div class="bsf-extension-start-install">
<div class="bsf-extension-start-install-content">
<h2><?php esc_html_e( 'Downloading', 'bsf' ); ?><div class="bsf-css-loader"></div></h2>
</div>
</div>
<?php } ?>
<div class="top-section">
<?php if ( ! empty( $product->product_image ) ) { ?>
<div class="bsf-extension-product-image">
<div class="bsf-extension-product-image-stick">
<img src="<?php echo esc_url( $product->product_image ); ?>" class="img" alt="image"/>
</div>
</div>
<?php } ?>
<div class="bsf-extension-info">
<?php $name = ( isset( $product->short_name ) ) ? $product->short_name : $product->name; ?>
<h4 class="title"><?php echo esc_html( $name ); ?></h4>
<p class="desc"><?php echo esc_html( $product->description ); ?><span class="author"><cite>By <?php echo esc_html( $product->author ); ?></cite></span></p>
</div>
</div>
<div class="bottom-section">
<?php
$button_class = '';
if ( ! $is_plugin_installed ) {
if ( ( ! $product->licence_require || 'false' === $product->licence_require ) || 'registered' === $product_status ) {
$installer_url = bsf_exension_installer_url( $product_id );
$button = __( 'Install', 'bsf' );
$button_class = 'bsf-install-button install-now';
} elseif ( ( $product->licence_require || 'true' === $product->licence_require ) && 'registered' !== $product_status ) {
$installer_url = bsf_registration_page_url( '&id=' . $product_id, $product_id );
$button = __( 'Validate Purchase', 'bsf' );
$button_class = 'bsf-validate-licence-button';
}
} else {
$current_name = strtolower( bsf_get_current_name( $product->init, $product->type ) );
$current_name = preg_replace( '![^a-z0-9]+!i', '-', $current_name );
if ( is_multisite() ) {
$installer_url = network_admin_url( 'plugins.php#' . $current_name );
} else {
$installer_url = admin_url( 'plugins.php#' . $current_name );
}
$button = __( 'Installed', 'bsf' );
}
?>
<a class="button button-primary extension-button <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_url( $installer_url ); ?>" data-slug="<?php echo esc_html( $product->slug ); ?>" data-ext="<?php echo esc_attr( $key ); ?>" data-pid="<?php echo esc_attr( $product->id ); ?>" data-bundled="true" data-action="install"><?php echo esc_html( $button ); ?></a>
</div>
</li>
<?php
}
return ob_get_clean();
}
<?php
/**
* Admin functions for bsf core.
*
* @package BSF core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
if ( ! function_exists( 'check_bsf_product_status' ) ) {
/**
* Get status of product.
*
* @param int $id product id.
* @return bool
*/
function check_bsf_product_status( $id ) {
$brainstrom_products = ( get_option( 'brainstrom_products' ) ) ? get_option( 'brainstrom_products' ) : array();
$bsf_product_themes = ( isset( $brainstrom_products['themes'] ) ) ? $brainstrom_products['themes'] : array();
if ( empty( $brainstrom_products ) ) {
return false;
}
$status = false;
foreach ( $brainstrom_products as $products ) {
foreach ( $products as $key => $product ) {
if ( $product['id'] === $id ) {
$status = ( isset( $product['status'] ) ) ? $product['status'] : '';
break;
}
}
}
return $status;
}
}
if ( ! function_exists( 'get_bundled_plugins' ) ) {
/**
* Retrieves bundled plugin data.
*
* @param string $template product template.
* @return void
*/
function get_bundled_plugins( $template = '' ) {
global $ultimate_referer;
$brainstrom_products = get_option( 'brainstrom_products', array() );
$prd_ids = array();
// If brainstrom_products is not yet set, call bsf core init.
if ( is_array( $brainstrom_products ) ) {
init_bsf_core();
$brainstrom_products = get_option( 'brainstrom_products', array() );
}
foreach ( $brainstrom_products as $key => $value ) {
foreach ( $value as $key => $value2 ) {
array_push( $prd_ids, $key );
}
}
$path = bsf_get_api_url() . '?referer=' . $ultimate_referer;
$data = array(
'action' => 'bsf_fetch_brainstorm_products',
'id' => $prd_ids,
);
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '10',
)
);
// Request http URL if the https version fails.
if ( is_wp_error( $request ) && wp_remote_retrieve_response_code( $request ) !== 200 ) {
$path = bsf_get_api_url( true ) . '?referer=' . $ultimate_referer;
$request = wp_remote_post(
$path,
array(
'body' => $data,
'timeout' => '8',
)
);
}
if ( ! is_wp_error( $request ) || wp_remote_retrieve_response_code( $request ) === 200 ) {
$result = json_decode( $request['body'] );
$bundled = array();
$simple = array();
if ( ! empty( $result ) ) {
if ( ! empty( $result->bundled ) ) {
$bundled = $result->bundled;
}
if ( ! empty( $result->simple ) ) {
$simple = $result->simple;
}
}
foreach ( $bundled as $key => $value ) {
if ( empty( $value ) ) {
unset( $bundled->$key );
}
}
$brainstrom_bundled_products = (array) $bundled;
update_option( 'brainstrom_bundled_products', $brainstrom_bundled_products );
// update 'brainstorm_products'.
$simple = json_decode( wp_json_encode( $simple ), 1 );
foreach ( $brainstrom_products as $type => $products ) {
foreach ( $products as $key => $product ) {
$old_id = isset( $product['id'] ) ? $product['id'] : '';
$simple[ $type ][ $old_id ]['template'] = isset( $brainstrom_products[ $type ][ $old_id ]['template'] ) ? $brainstrom_products[ $type ][ $old_id ]['template'] : '';
$simple[ $type ][ $old_id ]['remote'] = isset( $simple[ $type ][ $old_id ]['version'] ) ? $simple[ $type ][ $old_id ]['version'] : '';
$simple[ $type ][ $old_id ]['version'] = isset( $brainstrom_products[ $type ][ $old_id ]['version'] ) ? $brainstrom_products[ $type ][ $old_id ]['version'] : '';
$simple[ $type ][ $old_id ]['purchase_key'] = isset( $brainstrom_products[ $type ][ $old_id ]['purchase_key'] ) ? $brainstrom_products[ $type ][ $old_id ]['purchase_key'] : '';
$simple[ $type ][ $old_id ]['status'] = isset( $brainstrom_products[ $type ][ $old_id ]['status'] ) ? $brainstrom_products[ $type ][ $old_id ]['status'] : '';
$simple[ $type ][ $old_id ]['message'] = isset( $brainstrom_products[ $type ][ $old_id ]['message'] ) ? $brainstrom_products[ $type ][ $old_id ]['message'] : '';
}
}
update_option( 'brainstrom_products', $simple );
}
}
}
/**
* Displays bundled product list for product.
*
* @param string $product_id Product ID.
* @param bool $installed Show installed products?.
* @return string
*/
function bsf_render_bundled_products( $product_id, $installed ) {
$product_status = check_bsf_product_status( $product_id );
$brainstrom_bundled_products = get_option( 'brainstrom_bundled_products', array() );
if ( isset( $brainstrom_bundled_products[ $product_id ] ) ) {
$brainstrom_bundled_products = $brainstrom_bundled_products[ $product_id ];
}
usort( $brainstrom_bundled_products, 'bsf_sort' );
$global_plugin_installed = 0;
$global_plugin_activated = 0;
$total_bundled_plugins = count( $brainstrom_bundled_products );
foreach ( $brainstrom_bundled_products as $key => $product ) {
if ( ! isset( $product->id ) || empty( $product->id ) ) {
continue;
}
if ( isset( $request_product_id ) && $request_product_id !== $product->id ) {
continue;
}
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $product->init;
if ( is_file( $plugin_abs_path ) ) {
$global_plugin_installed++;
if ( is_plugin_active( $product->init ) ) {
$global_plugin_activated++;
}
}
}
ob_start();
if ( $total_bundled_plugins === $global_plugin_installed ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-smiley"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'All available extensions have been installed!', 'bsf' ); ?></em></p>
</div>
<?php
return ob_get_clean();
}
if ( empty( $brainstrom_bundled_products ) ) {
?>
<div class="bsf-extensions-no-active">
<div class="bsf-extensions-title-icon"><span class="dashicons dashicons-download"></span></div>
<p class="bsf-text-light"><em><?php esc_html_e( 'No extensions available yet!', 'bsf' ); ?></em></p>
<div class="bsf-cp-rem-bundle" style="margin-top: 30px;">
<a class="button-primary" href="<?php echo esc_url( $reset_bundled_url ); ?>"><?php esc_html_e( 'Refresh Bundled Products', 'bsf' ); ?></a>
</div>
</div>
<?php
return ob_get_clean();
}
foreach ( $brainstrom_bundled_products as $key => $product ) {
if ( ! isset( $product->id ) || empty( $product->id ) ) {
continue;
}
if ( isset( $request_product_id ) && $request_product_id !== $product->id ) {
continue;
}
$is_plugin_installed = false;
$is_plugin_activated = false;
$plugin_abs_path = WP_PLUGIN_DIR . '/' . $product->init;
if ( is_file( $plugin_abs_path ) ) {
$is_plugin_installed = true;
if ( is_plugin_active( $product->init ) ) {
$is_plugin_activated = true;
}
}
if ( ( $is_plugin_installed && ! $installed ) || ( ! $is_plugin_installed && $installed ) ) {
continue;
}
if ( $is_plugin_installed && $is_plugin_activated ) {
$class = 'active-plugin';
} elseif ( $is_plugin_installed && ! $is_plugin_activated ) {
$class = 'inactive-plugin';
} else {
$class = 'plugin-not-installed';
}
?>
<li id="ext-<?php echo esc_attr( $key ); ?>" class="bsf-extension <?php echo esc_attr( $class ); ?> bsf-extension-<?php echo esc_attr( $product->slug ); ?>" data-init="<?php echo esc_attr( $product->init ); ?>">
<?php if ( ! $is_plugin_installed ) { ?>
<div class="bsf-extension-start-install">
<div class="bsf-extension-start-install-content">
<h2><?php esc_html_e( 'Downloading', 'bsf' ); ?><div class="bsf-css-loader"></div></h2>
</div>
</div>
<?php } ?>
<div class="top-section">
<?php if ( ! empty( $product->product_image ) ) { ?>
<div class="bsf-extension-product-image">
<div class="bsf-extension-product-image-stick">
<img src="<?php echo esc_url( $product->product_image ); ?>" class="img" alt="image"/>
</div>
</div>
<?php } ?>
<div class="bsf-extension-info">
<?php $name = ( isset( $product->short_name ) ) ? $product->short_name : $product->name; ?>
<h4 class="title"><?php echo esc_html( $name ); ?></h4>
<p class="desc"><?php echo esc_html( $product->description ); ?><span class="author"><cite>By <?php echo esc_html( $product->author ); ?></cite></span></p>
</div>
</div>
<div class="bottom-section">
<?php
$button_class = '';
if ( ! $is_plugin_installed ) {
if ( ( ! $product->licence_require || 'false' === $product->licence_require ) || 'registered' === $product_status ) {
$installer_url = bsf_exension_installer_url( $product_id );
$button = __( 'Install', 'bsf' );
$button_class = 'bsf-install-button install-now';
} elseif ( ( $product->licence_require || 'true' === $product->licence_require ) && 'registered' !== $product_status ) {
$installer_url = bsf_registration_page_url( '&id=' . $product_id, $product_id );
$button = __( 'Validate Purchase', 'bsf' );
$button_class = 'bsf-validate-licence-button';
}
} else {
$current_name = strtolower( bsf_get_current_name( $product->init, $product->type ) );
$current_name = preg_replace( '![^a-z0-9]+!i', '-', $current_name );
if ( is_multisite() ) {
$installer_url = network_admin_url( 'plugins.php#' . $current_name );
} else {
$installer_url = admin_url( 'plugins.php#' . $current_name );
}
$button = __( 'Installed', 'bsf' );
}
?>
<a class="button button-primary extension-button <?php echo esc_attr( $button_class ); ?>" href="<?php echo esc_url( $installer_url ); ?>" data-slug="<?php echo esc_html( $product->slug ); ?>" data-ext="<?php echo esc_attr( $key ); ?>" data-pid="<?php echo esc_attr( $product->id ); ?>" data-bundled="true" data-action="install"><?php echo esc_html( $button ); ?></a>
</div>
</li>
<?php
}
return ob_get_clean();
}
@@ -1,15 +1,15 @@
<?php
/**
* Plugin installer.
*
* @package bsf-core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
require_once BSF_UPDATER_PATH . '/includes/views/list-bundled-products.php';
<?php
/**
* Plugin installer.
*
* @package bsf-core
*/
/**
* Prevent direct access.
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
require_once BSF_UPDATER_PATH . '/includes/views/list-bundled-products.php';
@@ -1 +1 @@
1.29.9
1.29.9
@@ -1,2 +1,2 @@
/* Do not change otherwise you won't get updates */
/* Do not change otherwise you won't get updates */
ID:[wp-schema-pro]