first commit
This commit is contained in:
@@ -0,0 +1,138 @@
|
||||
html[dir="rtl"] .owp-ready-wrap.owp-wrap,
|
||||
html[dir="rtl"] .owp-welcome-wrap.owp-wrap {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-wizard-setup-actions .continue i {
|
||||
margin-right: 6px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-demo-wrap .owp-navigation {
|
||||
float: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-demo-wrap .owp-navigation li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-demo-wrap .theme-wrap {
|
||||
float: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .demo-import-loader {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .preview-icon i.custom-loader:before {
|
||||
right: 50%;
|
||||
left: auto;
|
||||
margin-right: -15px;
|
||||
margin-left: 0;
|
||||
border-right-color: #000;
|
||||
border-left-color: transparent;
|
||||
}
|
||||
|
||||
html[dir="rtl"] #owp-demo-popup-wrap,
|
||||
html[dir="rtl"] #owp-demo-popup-wrap .owp-demo-popup-overlay {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-demo-popup-content-inner .owp-demo-popup-close {
|
||||
left: 0;
|
||||
right: auto;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-demo-popup-container {
|
||||
right: 0;
|
||||
left: auto;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-wrap,
|
||||
html[dir="rtl"] .owp-demo-popup-content-wrap {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] #owp-demo-popup-content h2.title:after {
|
||||
right: 50%;
|
||||
left: auto;
|
||||
margin-right: -43px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-required-plugins .button {
|
||||
float: left;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-loader .owp-import-status p:before {
|
||||
margin-left: 5px;
|
||||
margin-right: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-last a:after {
|
||||
margin-right: 3px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] ol.owp-setup-steps li{
|
||||
float: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] ol.owp-setup-steps li::before{
|
||||
right: 50%;
|
||||
left: auto;
|
||||
margin-right: -6px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .field_group p {
|
||||
padding-right: 21px;
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] #owp-demo-plugins h2.title:after,
|
||||
html[dir="rtl"] .owp-demo-import-form-types h2.title:after,
|
||||
html[dir="rtl"] .owp-loader h2.title:after{
|
||||
right: 50%;
|
||||
left: auto;
|
||||
margin-right: -43px;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] #owp-demo-import-form ul.owp-popup-text {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .theme-browser .theme .theme-actions,
|
||||
html[dir="rtl"] .theme-browser .theme.active .theme-actions{
|
||||
right: 0;
|
||||
left: auto;
|
||||
-webkit-transform: translateX(-50%);
|
||||
transform: translateX(-50%);
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-required-plugins .owp-plugin {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-customize-wrap .wp-color-picker {
|
||||
float: right;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-customize-wrap .wp-picker-default,
|
||||
html[dir="rtl"] .owp-customize-wrap .wp-picker-clear {
|
||||
margin-right: 10%;
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-customize-wrap .wp-picker-input-wrap .button {
|
||||
margin-right: 0;
|
||||
float: left;
|
||||
}
|
||||
|
||||
html[dir="rtl"] .owp-newsletter .klaviyo_styling .klaviyo_field_group {
|
||||
margin-left: 6px;
|
||||
margin-right: 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
html[dir=rtl] .owp-ready-wrap.owp-wrap,html[dir=rtl] .owp-welcome-wrap.owp-wrap{text-align:center}html[dir=rtl] .owp-wizard-setup-actions .continue i{margin-right:6px;margin-left:0}html[dir=rtl] .owp-demo-wrap .owp-navigation{float:right}html[dir=rtl] .owp-demo-wrap .owp-navigation li{float:right}html[dir=rtl] .owp-demo-wrap .theme-wrap{float:right}html[dir=rtl] .demo-import-loader{right:0;left:auto}html[dir=rtl] .preview-icon i.custom-loader:before{right:50%;left:auto;margin-right:-15px;margin-left:0;border-right-color:#000;border-left-color:transparent}html[dir=rtl] #owp-demo-popup-wrap,html[dir=rtl] #owp-demo-popup-wrap .owp-demo-popup-overlay{right:0;left:auto}html[dir=rtl] .owp-demo-popup-content-inner .owp-demo-popup-close{left:0;right:auto}html[dir=rtl] .owp-demo-popup-container{right:0;left:auto}html[dir=rtl] .owp-demo-popup-content-wrap,html[dir=rtl] .owp-wrap{text-align:right}html[dir=rtl] #owp-demo-popup-content h2.title:after{right:50%;left:auto;margin-right:-43px;margin-left:0}html[dir=rtl] .owp-required-plugins .button{float:left}html[dir=rtl] .owp-loader .owp-import-status p:before{margin-left:5px;margin-right:0}html[dir=rtl] .owp-last a:after{margin-right:3px;margin-left:0}html[dir=rtl] ol.owp-setup-steps li{float:right}html[dir=rtl] ol.owp-setup-steps li::before{right:50%;left:auto;margin-right:-6px;margin-left:0}html[dir=rtl] .field_group p{padding-right:21px;padding-left:0}html[dir=rtl] #owp-demo-plugins h2.title:after,html[dir=rtl] .owp-demo-import-form-types h2.title:after,html[dir=rtl] .owp-loader h2.title:after{right:50%;left:auto;margin-right:-43px;margin-left:0}html[dir=rtl] #owp-demo-import-form ul.owp-popup-text{text-align:right}html[dir=rtl] .theme-browser .theme .theme-actions,html[dir=rtl] .theme-browser .theme.active .theme-actions{right:0;left:auto;-webkit-transform:translateX(-50%);transform:translateX(-50%)}html[dir=rtl] .owp-required-plugins .owp-plugin{text-align:right}html[dir=rtl] .owp-customize-wrap .wp-color-picker{float:right}html[dir=rtl] .owp-customize-wrap .wp-picker-clear,html[dir=rtl] .owp-customize-wrap .wp-picker-default{margin-right:10%;margin-left:0}html[dir=rtl] .owp-customize-wrap .wp-picker-input-wrap .button{margin-right:0;float:left}html[dir=rtl] .owp-newsletter .klaviyo_styling .klaviyo_field_group{margin-left:6px;margin-right:0}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Binary file not shown.
|
After Width: | Height: | Size: 43 KiB |
@@ -0,0 +1,602 @@
|
||||
var sucessRequests = 0;
|
||||
var totalRequests = 0;
|
||||
var name = "";
|
||||
|
||||
(function ($) {
|
||||
|
||||
"use strict";
|
||||
|
||||
$(document).ready(function () {
|
||||
owpDemoImport.init();
|
||||
owpCustomizer.init();
|
||||
});
|
||||
|
||||
var owpDemoImport = {
|
||||
importData: {},
|
||||
allowPopupClosing: true,
|
||||
init: function () {
|
||||
var that = this;
|
||||
|
||||
// Categories filter
|
||||
this.categoriesFilter();
|
||||
|
||||
// Search functionality.
|
||||
$('.owp-search-input').on('keyup', function () {
|
||||
if (0 < $(this).val().length) {
|
||||
// Hide all items.
|
||||
$('.owp-demo-wrap .themes').find('.theme-wrap').hide();
|
||||
|
||||
// Show just the ones that have a match on the import name.
|
||||
$('.owp-demo-wrap .themes').find('.theme-wrap[data-name*="' + $(this).val().toLowerCase() + '"]').show();
|
||||
} else {
|
||||
$('.owp-demo-wrap .themes').find('.theme-wrap').show();
|
||||
}
|
||||
});
|
||||
|
||||
// Prevent the popup from showing when the live preview button
|
||||
$('.owp-demo-wrap .theme-actions a.button').on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
|
||||
$('.owp-open-popup').click(function (e) {
|
||||
if ($(this).hasClass("active")) {
|
||||
$(this).removeClass('active');
|
||||
$(".install-demos-button").addClass('disabled');
|
||||
$(".install-demos-button").attr("disabled", true);
|
||||
} else {
|
||||
$('.owp-open-popup').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
$(".install-demos-button").removeClass('disabled');
|
||||
$(".install-demos-button").attr("disabled", false);
|
||||
}
|
||||
});
|
||||
// Get demo data
|
||||
$('.install-demos-button').click(function (e) {
|
||||
e.preventDefault();
|
||||
if ($('.owp-open-popup.active').length > 0) {
|
||||
// Vars
|
||||
var $selected_demo = $('.owp-open-popup.active:first').data('demo-id'),
|
||||
$loading_icon = $('.preview-' + $selected_demo),
|
||||
$disable_preview = $('.preview-all-' + $selected_demo);
|
||||
|
||||
$(".demo-import-loader").show();
|
||||
|
||||
that.getDemoData($selected_demo);
|
||||
} else {
|
||||
window.location.href = $(this).attr("data-next_step");
|
||||
}
|
||||
});
|
||||
|
||||
$(document).on('click', '.install-now', this.installNow);
|
||||
$(document).on('click', '.activate-now', this.activatePlugins);
|
||||
$(document).on('wp-plugin-install-success', this.installSuccess);
|
||||
$(document).on('wp-plugin-installing', this.pluginInstalling);
|
||||
$(document).on('wp-plugin-install-error', this.installError);
|
||||
|
||||
},
|
||||
// Category filter.
|
||||
categoriesFilter: function () {
|
||||
|
||||
// Cache selector to all items
|
||||
var $items = $('.owp-demo-wrap .themes').find('.theme-wrap'),
|
||||
fadeoutClass = 'owp-is-fadeout',
|
||||
fadeinClass = 'owp-is-fadein',
|
||||
animationDuration = 200;
|
||||
|
||||
// Hide all items.
|
||||
var fadeOut = function () {
|
||||
var dfd = $.Deferred();
|
||||
|
||||
$items.addClass(fadeoutClass);
|
||||
|
||||
setTimeout(function () {
|
||||
$items.removeClass(fadeoutClass).hide();
|
||||
|
||||
dfd.resolve();
|
||||
}, animationDuration);
|
||||
|
||||
return dfd.promise();
|
||||
};
|
||||
|
||||
var fadeIn = function (category, dfd) {
|
||||
var filter = category ? '[data-categories*="' + category + '"]' : 'div';
|
||||
|
||||
if ('all' === category) {
|
||||
filter = 'div';
|
||||
}
|
||||
|
||||
$items.filter(filter).show().addClass('owp-is-fadein');
|
||||
|
||||
setTimeout(function () {
|
||||
$items.removeClass(fadeinClass);
|
||||
|
||||
dfd.resolve();
|
||||
}, animationDuration);
|
||||
};
|
||||
|
||||
var animate = function (category) {
|
||||
var dfd = $.Deferred();
|
||||
|
||||
var promise = fadeOut();
|
||||
|
||||
promise.done(function () {
|
||||
fadeIn(category, dfd);
|
||||
});
|
||||
|
||||
return dfd;
|
||||
};
|
||||
|
||||
$('.owp-navigation-link').on('click', function (event) {
|
||||
event.preventDefault();
|
||||
|
||||
// Remove 'active' class from the previous nav list items.
|
||||
$(this).parent().siblings().removeClass('active');
|
||||
|
||||
// Add the 'active' class to this nav list item.
|
||||
$(this).parent().addClass('active');
|
||||
|
||||
var category = this.hash.slice(1);
|
||||
|
||||
// show/hide the right items, based on category selected
|
||||
var $container = $('.owp-demo-wrap .themes');
|
||||
$container.css('min-width', $container.outerHeight());
|
||||
|
||||
var promise = animate(category);
|
||||
|
||||
promise.done(function () {
|
||||
$container.removeAttr('style');
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
// Get demo data.
|
||||
getDemoData: function (demo_name) {
|
||||
var that = this;
|
||||
|
||||
// Get import data
|
||||
$.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'get',
|
||||
data: {
|
||||
action: 'owp_ajax_get_import_data',
|
||||
demo_name: demo_name,
|
||||
security: owpDemos.owp_import_data_nonce
|
||||
},
|
||||
complete: function (data) {
|
||||
$(".demo-import-loader").hide();
|
||||
that.importData = $.parseJSON(data.responseText);
|
||||
}
|
||||
});
|
||||
|
||||
// Run the import
|
||||
$.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'get',
|
||||
data: {
|
||||
action: 'owp_wizard_ajax_get_demo_data',
|
||||
demo_name: demo_name,
|
||||
demo_data_nonce: owpDemos.demo_data_nonce
|
||||
},
|
||||
complete: function (data) {
|
||||
console.log(data);
|
||||
$(".owp-demo-wrap").html(data.responseText);
|
||||
|
||||
$('html,body').animate({
|
||||
scrollTop: $("#owp-demo-plugins").offset().top
|
||||
}, 500);
|
||||
|
||||
that.runPopup(data);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
},
|
||||
// Run popup.
|
||||
runPopup: function (data) {
|
||||
var that = this
|
||||
|
||||
|
||||
// Close popup
|
||||
$('.owp-demo-popup-close, .owp-demo-popup-overlay').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
if (that.allowPopupClosing === true) {
|
||||
that.closePopup();
|
||||
}
|
||||
});
|
||||
|
||||
// Display the step two
|
||||
$('.owp-plugins-next').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Hide step one
|
||||
$('#owp-demo-plugins').hide();
|
||||
|
||||
// Display step two
|
||||
$('#owp-demo-import-form').show();
|
||||
|
||||
});
|
||||
|
||||
// if clicked on import data button
|
||||
$('#owp-demo-import-form').submit(function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Vars
|
||||
var demo = $(this).find('[name="owp_import_demo"]').val(),
|
||||
nonce = $(this).find('[name="owp_import_demo_data_nonce"]').val(),
|
||||
contentToImport = [];
|
||||
|
||||
// Check what need to be imported
|
||||
$(this).find('input[type="checkbox"]').each(function () {
|
||||
if ($(this).is(':checked') === true) {
|
||||
contentToImport.push($(this).attr('name'));
|
||||
}
|
||||
});
|
||||
|
||||
// Hide the checkboxes and show the loader
|
||||
$(this).hide();
|
||||
$('.owp-loader').show();
|
||||
$('#owp-demo-import-form,#owp-demo-plugins').hide();
|
||||
// Start importing the content
|
||||
totalRequests = contentToImport.length;
|
||||
that.importContent({
|
||||
demo: demo,
|
||||
nonce: nonce,
|
||||
contentToImport: contentToImport,
|
||||
isXML: $('#owp_import_xml').is(':checked')
|
||||
});
|
||||
});
|
||||
|
||||
},
|
||||
// importing the content.
|
||||
importContent: function (importData) {
|
||||
var that = this,
|
||||
currentContent,
|
||||
importingLimit,
|
||||
timerStart = Date.now(),
|
||||
ajaxData = {
|
||||
owp_import_demo: importData.demo,
|
||||
owp_import_demo_data_nonce: importData.nonce
|
||||
};
|
||||
|
||||
this.allowPopupClosing = false;
|
||||
$('.owp-demo-popup-close').fadeOut();
|
||||
|
||||
// When all the selected content has been imported
|
||||
if (importData.contentToImport.length === 0) {
|
||||
if (sucessRequests != totalRequests) {
|
||||
$('.owp-loader').hide();
|
||||
$(".owp-error").show();
|
||||
$(".wizard-install-demos-buttons-wrapper.final-step").show();
|
||||
|
||||
} else {
|
||||
// Show the imported screen after 1 second
|
||||
setTimeout(function () {
|
||||
$('.owp-loader').hide();
|
||||
$('.owp-last').show();
|
||||
window.location.href = $(".wizard-install-demos-buttons-wrapper.final-step .skip-btn").attr("href");
|
||||
}, 1000);
|
||||
|
||||
// Notify the server that the importing process is complete
|
||||
$.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'post',
|
||||
data: {
|
||||
action: 'owp_after_import',
|
||||
owp_import_demo: importData.demo,
|
||||
owp_import_demo_data_nonce: importData.nonce,
|
||||
owp_import_is_xml: importData.isXML
|
||||
},
|
||||
complete: function (data) {
|
||||
}
|
||||
});
|
||||
|
||||
this.allowPopupClosing = true;
|
||||
$('.owp-demo-popup-close').fadeIn();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Check the content that was selected to be imported.
|
||||
for (var key in this.importData) {
|
||||
|
||||
// Check if the current item in the iteration is in the list of importable content
|
||||
var contentIndex = $.inArray(this.importData[ key ][ 'input_name' ], importData.contentToImport);
|
||||
|
||||
// If it is:
|
||||
if (contentIndex !== -1) {
|
||||
|
||||
// Get a reference to the current content
|
||||
currentContent = key;
|
||||
|
||||
// Remove the current content from the list of remaining importable content
|
||||
importData.contentToImport.splice(contentIndex, 1);
|
||||
|
||||
// Get the AJAX action name that corresponds to the current content
|
||||
ajaxData.action = this.importData[ key ]['action'];
|
||||
|
||||
// After an item is found get out of the loop and execute the rest of the function
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Tell the user which content is currently being imported
|
||||
$('.owp-import-status').append('<p class="owp-importing">' + this.importData[ currentContent ]['loader'] + '</p>');
|
||||
|
||||
// Tell the server to import the current content
|
||||
var ajaxRequest = $.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'post',
|
||||
data: ajaxData,
|
||||
complete: function (data) {
|
||||
clearTimeout(importingLimit);
|
||||
|
||||
// Indicates if the importing of the content can continue
|
||||
var continueProcess = true;
|
||||
|
||||
// Check if the importing of the content was successful or if there was any error
|
||||
if (data.status === 500 || data.status === 502 || data.status === 503) {
|
||||
$('.owp-importing')
|
||||
.addClass('owp-importing-failed')
|
||||
.removeClass('owp-importing')
|
||||
.text(owpDemos.content_importing_error + ' ' + data.status);
|
||||
} else if (data.responseText.indexOf('successful import') !== -1) {
|
||||
$('.owp-importing').addClass('owp-imported').removeClass('owp-importing');
|
||||
sucessRequests++;
|
||||
} else {
|
||||
|
||||
var errors = $.parseJSON(data.responseText),
|
||||
errorMessage = '';
|
||||
|
||||
// Iterate through the list of errors
|
||||
for (var error in errors) {
|
||||
errorMessage += errors[ error ];
|
||||
|
||||
// If there was an error with the importing of the XML file, stop the process
|
||||
if (error === 'xml_import_error') {
|
||||
continueProcess = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Display the error message
|
||||
$('.owp-importing')
|
||||
.addClass('owp-importing-failed')
|
||||
.removeClass('owp-importing')
|
||||
.text(errorMessage);
|
||||
|
||||
that.allowPopupClosing = true;
|
||||
$('.owp-demo-popup-close').fadeIn();
|
||||
}
|
||||
|
||||
// Continue with the loading only if an important error was not encountered
|
||||
if (continueProcess === true) {
|
||||
|
||||
// Load the next content in the list
|
||||
that.importContent(importData);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// Set a time limit of 15 minutes for the importing process.
|
||||
importingLimit = setTimeout(function () {
|
||||
|
||||
// Abort the AJAX request
|
||||
ajaxRequest.abort();
|
||||
|
||||
// Allow the popup to be closed
|
||||
that.allowPopupClosing = true;
|
||||
$('.owp-demo-popup-close').fadeIn();
|
||||
|
||||
$('.owp-importing')
|
||||
.addClass('owp-importing-failed')
|
||||
.removeClass('owp-importing')
|
||||
.text(owpDemos.content_importing_error);
|
||||
}, 15 * 60 * 1000);
|
||||
|
||||
},
|
||||
// Close demo popup.
|
||||
closePopup: function () {
|
||||
$('html').css({
|
||||
'overflow': '',
|
||||
'margin-right': ''
|
||||
});
|
||||
|
||||
// Hide loader
|
||||
$('.preview-icon').hide();
|
||||
$('.preview-all').hide();
|
||||
|
||||
// Hide demo popup
|
||||
$('#owp-demo-popup-wrap').fadeOut();
|
||||
|
||||
// Remove content in the popup
|
||||
setTimeout(function () {
|
||||
$('#owp-demo-popup-content').html('');
|
||||
}, 600);
|
||||
},
|
||||
// Install required plugins.
|
||||
installNow: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Vars
|
||||
var $button = $(e.target),
|
||||
$document = $(document);
|
||||
|
||||
if ($button.hasClass('updating-message') || $button.hasClass('button-disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (wp.updates.shouldRequestFilesystemCredentials && !wp.updates.ajaxLocked) {
|
||||
wp.updates.requestFilesystemCredentials(e);
|
||||
|
||||
$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')
|
||||
});
|
||||
},
|
||||
// Activate required plugins.
|
||||
activatePlugins: function (e) {
|
||||
e.preventDefault();
|
||||
|
||||
// Vars
|
||||
var $button = $(e.target),
|
||||
$init = $button.data('init'),
|
||||
$slug = $button.data('slug');
|
||||
|
||||
if ($button.hasClass('updating-message') || $button.hasClass('button-disabled')) {
|
||||
return;
|
||||
}
|
||||
|
||||
$button.addClass('updating-message button-primary').html(owpDemos.button_activating);
|
||||
|
||||
$.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'owp_ajax_required_plugins_activate',
|
||||
init: $init,
|
||||
},
|
||||
}).done(function (result) {
|
||||
|
||||
if (result.success) {
|
||||
|
||||
$button.removeClass('button-primary install-now activate-now updating-message')
|
||||
.attr('disabled', 'disabled')
|
||||
.addClass('disabled')
|
||||
.text(owpDemos.button_active);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
// Install success.
|
||||
installSuccess: function (e, response) {
|
||||
e.preventDefault();
|
||||
|
||||
var $message = $('.owp-plugin-' + response.slug).find('.button');
|
||||
|
||||
// Transform the 'Install' button into an 'Activate' button.
|
||||
var $init = $message.data('init');
|
||||
|
||||
$message.removeClass('install-now installed button-disabled updated-message')
|
||||
.addClass('updating-message')
|
||||
.html(owpDemos.button_activating);
|
||||
|
||||
// WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that.
|
||||
setTimeout(function () {
|
||||
|
||||
$.ajax({
|
||||
url: owpDemos.ajaxurl,
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'owp_ajax_required_plugins_activate',
|
||||
init: $init,
|
||||
},
|
||||
}).done(function (result) {
|
||||
|
||||
if (result.success) {
|
||||
|
||||
$message.removeClass('button-primary install-now activate-now updating-message')
|
||||
.attr('disabled', 'disabled')
|
||||
.addClass('disabled')
|
||||
.text(owpDemos.button_active);
|
||||
|
||||
} else {
|
||||
$message.removeClass('updating-message');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}, 1200);
|
||||
},
|
||||
// Plugin installing.
|
||||
pluginInstalling: function (e, args) {
|
||||
e.preventDefault();
|
||||
|
||||
var $card = $('.owp-plugin-' + args.slug),
|
||||
$button = $card.find('.button');
|
||||
|
||||
$button.addClass('updating-message');
|
||||
},
|
||||
// Plugin install error.
|
||||
installError: function (e, response) {
|
||||
e.preventDefault();
|
||||
|
||||
var $card = $('.owp-plugin-' + response.slug);
|
||||
|
||||
$card.removeClass('button-primary').addClass('disabled').html(wp.updates.l10n.installFailedShort);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
var owpCustomizer = {
|
||||
init: function () {
|
||||
|
||||
var custom_uploader;
|
||||
|
||||
$('.upload_image_button').on("click", function (e) {
|
||||
e.preventDefault();
|
||||
var element = $(this);
|
||||
name = element.attr("data-name");
|
||||
|
||||
//If the uploader object has already been created, reopen the dialog
|
||||
if (custom_uploader) {
|
||||
custom_uploader.open();
|
||||
return;
|
||||
}
|
||||
|
||||
//Extend the wp.media object
|
||||
custom_uploader = wp.media.frames.file_frame = wp.media({
|
||||
title: 'Choose Image',
|
||||
button: {
|
||||
text: 'Choose Image'
|
||||
},
|
||||
multiple: false
|
||||
});
|
||||
|
||||
//When a file is selected, grab the URL and set it as the text field's value
|
||||
custom_uploader.on('select', function () {
|
||||
var attachment = custom_uploader.state().get('selection').first().toJSON();
|
||||
console.log(attachment);
|
||||
$('#' + name).val(attachment.id);
|
||||
$('#' + name + "-img").attr("src", attachment.url).show();
|
||||
$('.remove_image_button[data-name="' + name + '"]').show();
|
||||
});
|
||||
|
||||
//Open the uploader dialog
|
||||
custom_uploader.open();
|
||||
});
|
||||
|
||||
// The "Remove" button (remove the value from input type='hidden')
|
||||
$('.remove_image_button').on('click', function (e) {
|
||||
e.preventDefault();
|
||||
var element = $(this);
|
||||
var name = element.attr("data-name");
|
||||
$('#' + name).val('');
|
||||
$('#' + name + "-img").attr("src", "").hide();
|
||||
element.hide();
|
||||
return false;
|
||||
});
|
||||
|
||||
|
||||
if ($(".color-picker-field").length > 0) {
|
||||
$(".color-picker-field").each(function (){
|
||||
$(this).wpColorPicker();
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
})(jQuery);
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
require_once(ABSPATH . 'wp-admin/includes/class-wp-upgrader.php');
|
||||
/*
|
||||
* Hide the 'Activate Plugin' and other links when not using QuietSkin as these links will
|
||||
* fail when not called from /wp-admin
|
||||
*/
|
||||
|
||||
class QuietSkin extends \WP_Upgrader_Skin {
|
||||
|
||||
public $api;
|
||||
public $type;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param array $args
|
||||
*/
|
||||
public function __construct($args = array()) {
|
||||
$defaults = array('type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '');
|
||||
$args = wp_parse_args($args, $defaults);
|
||||
|
||||
$this->type = $args['type'];
|
||||
$this->api = isset($args['api']) ? $args['api'] : array();
|
||||
|
||||
parent::__construct($args);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function before() {
|
||||
if (!empty($this->api))
|
||||
$this->upgrader->strings['process_success'] = sprintf(__('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public function after() {
|
||||
$plugin_file = $this->upgrader->plugin_info();
|
||||
|
||||
$install_actions = array();
|
||||
|
||||
$from = isset($_GET['from']) ? wp_unslash($_GET['from']) : 'plugins';
|
||||
|
||||
if ('import' == $from) {
|
||||
$install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url('plugins.php?action=activate&from=import&plugin=' . urlencode($plugin_file), 'activate-plugin_' . $plugin_file) . '" target="_parent">' . __('Activate Plugin & Run Importer') . '</a>';
|
||||
} else if ('press-this' == $from) {
|
||||
$install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url('plugins.php?action=activate&from=press-this&plugin=' . urlencode($plugin_file), 'activate-plugin_' . $plugin_file) . '" target="_parent">' . __('Activate Plugin & Return to Press This') . '</a>';
|
||||
} else {
|
||||
$install_actions['activate_plugin'] = '<a class="button button-primary" href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . urlencode($plugin_file), 'activate-plugin_' . $plugin_file) . '" target="_parent">' . __('Activate Plugin') . '</a>';
|
||||
}
|
||||
|
||||
if (is_multisite() && current_user_can('manage_network_plugins')) {
|
||||
$install_actions['network_activate'] = '<a class="button button-primary" href="' . wp_nonce_url('plugins.php?action=activate&networkwide=1&plugin=' . urlencode($plugin_file), 'activate-plugin_' . $plugin_file) . '" target="_parent">' . __('Network Activate') . '</a>';
|
||||
unset($install_actions['activate_plugin']);
|
||||
}
|
||||
|
||||
if ('import' == $from) {
|
||||
$install_actions['importers_page'] = '<a href="' . admin_url('import.php') . '" target="_parent">' . __('Return to Importers') . '</a>';
|
||||
} elseif ($this->type == 'web') {
|
||||
$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '" target="_parent">' . __('Return to Plugin Installer') . '</a>';
|
||||
} elseif ('upload' == $this->type && 'plugins' == $from) {
|
||||
$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugin-install.php') . '">' . __('Return to Plugin Installer') . '</a>';
|
||||
} else {
|
||||
$install_actions['plugins_page'] = '<a href="' . self_admin_url('plugins.php') . '" target="_parent">' . __('Return to Plugins page') . '</a>';
|
||||
}
|
||||
|
||||
if (!$this->result || is_wp_error($this->result)) {
|
||||
unset($install_actions['activate_plugin'], $install_actions['network_activate']);
|
||||
} elseif (!current_user_can('activate_plugin', $plugin_file)) {
|
||||
unset($install_actions['activate_plugin']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the list of action links available following a single plugin installation.
|
||||
*
|
||||
* @since 2.7.0
|
||||
*
|
||||
* @param array $install_actions Array of plugin action links.
|
||||
* @param object $api Object containing WordPress.org API plugin data. Empty
|
||||
* for non-API installs, such as when a plugin is installed
|
||||
* via upload.
|
||||
* @param string $plugin_file Path to the plugin file.
|
||||
*/
|
||||
$install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
|
||||
|
||||
if (!empty($install_actions)) {
|
||||
$this->feedback(implode(' ', (array) $install_actions));
|
||||
}
|
||||
}
|
||||
|
||||
public function feedback($string, ...$args) { /* no output */
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
<?php
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
Class WizardAjax {
|
||||
|
||||
public function __construct() {
|
||||
add_action('wp_ajax_owp_wizard_ajax_get_demo_data', array($this, 'ajax_demo_data'));
|
||||
}
|
||||
|
||||
public function ajax_demo_data() {
|
||||
|
||||
|
||||
if (!wp_verify_nonce($_GET['demo_data_nonce'], 'get-demo-data')) {
|
||||
die('This action was stopped for security purposes.');
|
||||
}
|
||||
|
||||
// Database reset url
|
||||
if (is_plugin_active('wordpress-database-reset/wp-reset.php')) {
|
||||
$plugin_link = admin_url('tools.php?page=database-reset');
|
||||
} else {
|
||||
$plugin_link = admin_url('plugin-install.php?s=Wordpress+Database+Reset&tab=search');
|
||||
}
|
||||
|
||||
// Get all demos
|
||||
$demos = OceanWP_Demos::get_demos_data();
|
||||
|
||||
// Get selected demo
|
||||
$demo = $_GET['demo_name'];
|
||||
|
||||
// Get required plugins
|
||||
$plugins = $demos[$demo]['required_plugins'];
|
||||
|
||||
// Get free plugins
|
||||
$free = $plugins['free'];
|
||||
|
||||
// Get premium plugins
|
||||
$premium = $plugins['premium'];
|
||||
?>
|
||||
|
||||
<div id="owp-demo-plugins">
|
||||
|
||||
<h2 class="title"><?php echo sprintf(esc_html__('Import the %1$s demo', 'ocean-extra'), esc_attr($demo)); ?></h2>
|
||||
|
||||
<div class="owp-popup-text">
|
||||
|
||||
<p><?php
|
||||
echo
|
||||
sprintf(
|
||||
esc_html__('Importing demo data allow you to quickly edit everything instead of creating content from scratch. It is recommended uploading sample data on a fresh WordPress install to prevent conflicts with your current content. You can use this plugin to reset your site if needed: %1$sWordpress Database Reset%2$s.', 'ocean-extra'), '<a href="' . $plugin_link . '" target="_blank">', '</a>'
|
||||
);
|
||||
?></p>
|
||||
|
||||
<div class="owp-required-plugins-wrap">
|
||||
<h3><?php esc_html_e('Required Plugins', 'ocean-extra'); ?></h3>
|
||||
<p><?php esc_html_e('For your site to look exactly like this demo, the plugins below need to be activated.', 'ocean-extra'); ?></p>
|
||||
<div class="owp-required-plugins oe-plugin-installer">
|
||||
<?php
|
||||
OceanWP_Demos::required_plugins($free, 'free');
|
||||
OceanWP_Demos::required_plugins($premium, 'premium');
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<form method="post" id="owp-demo-import-form">
|
||||
|
||||
<input id="owp_import_demo" type="hidden" name="owp_import_demo" value="<?php echo esc_attr($demo); ?>" />
|
||||
|
||||
<div class="owp-demo-import-form-types">
|
||||
|
||||
<h2 class="title"><?php esc_html_e('Select what you want to import:', 'ocean-extra'); ?></h2>
|
||||
|
||||
<ul class="owp-popup-text">
|
||||
<li>
|
||||
<label for="owp_import_xml">
|
||||
<input id="owp_import_xml" type="checkbox" name="owp_import_xml" checked="checked" />
|
||||
<strong><?php esc_html_e('Import XML Data', 'ocean-extra'); ?></strong> (<?php esc_html_e('pages, posts, images, menus, etc...', 'ocean-extra'); ?>)
|
||||
</label>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label for="owp_theme_settings">
|
||||
<input id="owp_theme_settings" type="checkbox" name="owp_theme_settings" checked="checked" />
|
||||
<strong><?php esc_html_e('Import Customizer Settings', 'ocean-extra'); ?></strong>
|
||||
</label>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<label for="owp_import_widgets">
|
||||
<input id="owp_import_widgets" type="checkbox" name="owp_import_widgets" checked="checked" />
|
||||
<strong><?php esc_html_e('Import Widgets', 'ocean-extra'); ?></strong>
|
||||
</label>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
<?php wp_nonce_field('owp_import_demo_data_nonce', 'owp_import_demo_data_nonce'); ?>
|
||||
<input type="submit" name="submit" class="owp-button owp-import" value="<?php esc_html_e('Import', 'ocean-extra'); ?>" />
|
||||
|
||||
</form>
|
||||
|
||||
<div class="owp-loader">
|
||||
<h2 class="title"><?php esc_html_e('The import process could take some time, please be patient', 'ocean-extra'); ?></h2>
|
||||
<div class="owp-import-status owp-popup-text"></div>
|
||||
</div>
|
||||
|
||||
<div class="owp-last">
|
||||
<svg class="checkmark" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 52 52"><circle class="checkmark-circle" cx="26" cy="26" r="25" fill="none"></circle><path class="checkmark-check" fill="none" d="M14.1 27.2l7.1 7.2 16.7-16.8"></path></svg>
|
||||
<h3><?php esc_html_e('Demo Imported!', 'ocean-extra'); ?></h3>
|
||||
</div>
|
||||
<div class="owp-error" style="display: none;">
|
||||
<p ><?php esc_html_e("The import didn't import well please contact the support.", 'ocean-extra'); ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<?php
|
||||
die();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new WizardAjax();
|
||||
@@ -0,0 +1,866 @@
|
||||
<?php
|
||||
/**
|
||||
* Theme Wizard
|
||||
*
|
||||
* @package Ocean_Extra
|
||||
* @category Core
|
||||
* @author OceanWP
|
||||
*/
|
||||
// Exit if accessed directly
|
||||
if (!defined('ABSPATH')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!class_exists('Ocean_Extra_Theme_Wizard')):
|
||||
|
||||
// Start Class
|
||||
class Ocean_Extra_Theme_Wizard {
|
||||
|
||||
/**
|
||||
* Current step
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $step = '';
|
||||
|
||||
/**
|
||||
* Steps for the setup wizard
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $steps = array();
|
||||
|
||||
public function __construct() {
|
||||
$this->includes();
|
||||
add_action('admin_menu', array($this, 'add_ocean_wizard_menu'));
|
||||
add_action('admin_init', array($this, 'ocean_wizard_setup'), 99);
|
||||
add_action('wp_loaded', array($this, 'remove_notice'));
|
||||
add_action('admin_print_styles', array($this, 'add_notice'));
|
||||
add_action("add_second_notice", array($this, "install"));
|
||||
}
|
||||
|
||||
public static function install() {
|
||||
if (!get_option("owp_wizard")) {
|
||||
update_option("owp_wizard", "un-setup");
|
||||
(wp_safe_redirect(admin_url('admin.php?page=owp_setup')));
|
||||
}
|
||||
else{
|
||||
// first run for automatic message after first 24 hour
|
||||
if (!get_option("automatic_2nd_notice")) {
|
||||
update_option("automatic_2nd_notice", "second-time");
|
||||
|
||||
} else {
|
||||
// clear cronjob after second 24 hour
|
||||
wp_clear_scheduled_hook('add_second_notice');
|
||||
delete_option("automatic_2nd_notice");
|
||||
delete_option("2nd_notice");
|
||||
delete_option("owp_wizard");
|
||||
wp_safe_redirect(admin_url());
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// clear cronjob when deactivate plugin
|
||||
public static function uninstall() {
|
||||
wp_clear_scheduled_hook('add_second_notice');
|
||||
delete_option("automatic_2nd_notice");
|
||||
delete_option("2nd_notice");
|
||||
delete_option("owp_wizard");
|
||||
}
|
||||
|
||||
public function remove_notice() {
|
||||
if (isset($_GET['owp_wizard_hide_notice']) && $_GET['owp_wizard_hide_notice'] == "install") { // WPCS: input var ok, CSRF ok.
|
||||
// when finish install
|
||||
delete_option("owp_wizard");
|
||||
//clear cronjob when finish install
|
||||
wp_clear_scheduled_hook('add_second_notice');
|
||||
delete_option("2nd_notice");
|
||||
if (isset($_GET['show'])) {
|
||||
wp_safe_redirect(home_url());
|
||||
exit;
|
||||
}
|
||||
} else if(isset($_GET['owp_wizard_hide_notice']) && $_GET['owp_wizard_hide_notice'] == "2nd_notice") { // WPCS: input var ok, CSRF ok.
|
||||
//when skip install
|
||||
delete_option("owp_wizard");
|
||||
if (!get_option("2nd_notice")) {
|
||||
update_option("2nd_notice", "second-time");
|
||||
$timezone_string = get_option( 'timezone_string' );
|
||||
if ( ! $timezone_string ) {
|
||||
return false;
|
||||
}
|
||||
date_default_timezone_set($timezone_string);
|
||||
|
||||
// set time for next day
|
||||
$new_time_format = time() + (24 * 60 * 60 );
|
||||
//add "add_second_notice" cronjob
|
||||
if (!wp_next_scheduled('add_second_notice')) {
|
||||
wp_schedule_event($new_time_format, 'daily', 'add_second_notice');
|
||||
}
|
||||
} else {
|
||||
//clear cronjob when skip for second time
|
||||
wp_clear_scheduled_hook('add_second_notice');
|
||||
}
|
||||
if(isset($_GET['show'])){
|
||||
wp_safe_redirect(home_url());
|
||||
exit;
|
||||
} else {
|
||||
wp_safe_redirect(admin_url());
|
||||
exit;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function add_notice() {
|
||||
if ((get_option("owp_wizard") == "un-setup") && (empty($_GET['page']) || 'owp_setup' !== $_GET['page'])) {
|
||||
if (!get_option("2nd_notice")&&!get_option("automatic_2nd_notice")) {?>
|
||||
<div class="updated notice-success owp-extra-notice">
|
||||
<div class="notice-inner">
|
||||
<div class="notice-content">
|
||||
<p><?php _e('<strong>Welcome to OceanWP</strong> - Are you ready to create an amazing website?', 'ocean-extra'); ?></p>
|
||||
<p class="submit">
|
||||
<a href="<?php echo esc_url(admin_url('admin.php?page=owp_setup')); ?>" class="btn button-primary"><?php _e('Run the Setup Wizard', 'ocean-extra'); ?></a>
|
||||
<a class="btn button-secondary" href="<?php echo esc_url((add_query_arg('owp_wizard_hide_notice', '2nd_notice'))); ?>"><?php _e('Skip setup', 'ocean-extra'); ?></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<style type="text/css">
|
||||
.owp-extra-notice.updated { border-color: #13aff0; }
|
||||
.owp-extra-notice .button-primary { background: #13aff0; border-color: #1e9bd0; box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 0 #1e9bd0; color: #fff; text-shadow: 0 -1px 1px #1e9bd0, 1px 0 1px #1e9bd0, 0 1px 1px #1e9bd0, -1px 0 1px #1e9bd0; }
|
||||
|
||||
.owp-extra-notice.owp-contest-notice { position: relative; border: none; padding: 0; }
|
||||
.owp-extra-notice.owp-contest-notice:after { content: ''; display: block; visibility: hidden; clear: both; zoom: 1; height: 0; }
|
||||
.owp-extra-notice.owp-contest-notice { position: relative; }
|
||||
.owp-extra-notice.owp-contest-notice span.icon-side { color: #fff; position: absolute; top: 0; left: 0; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-align: center; -webkit-align-items: center; -moz-align-items: center; align-items: center; font-size: 30px; width: 60px; height: 100%; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; }
|
||||
.owp-extra-notice.owp-contest-notice span.dashicons-heart { background-color: #13aff0; }
|
||||
.owp-extra-notice.owp-contest-notice { padding: 10px 40px 15px 74px; }
|
||||
.owp-extra-notice.owp-contest-notice p { font-size: 14px; }
|
||||
.owp-extra-notice.owp-contest-notice p:first-child { margin-top: 0; }
|
||||
.owp-extra-notice.owp-contest-notice p:last-child { margin-bottom: 0; }
|
||||
.owp-extra-notice.owp-contest-notice a { text-decoration: none; -webkit-box-shadow: none !important; box-shadow: none !important; }
|
||||
.owp-extra-notice.owp-contest-notice a.btn { height: auto; font-size: 12px; line-height: 1; background-color: #13aff0; color: #fff; border: 1px solid #13aff0; padding: 10px 18px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; text-shadow: none; transition: all .3s ease; -webkit-transition: all .3s ease; -moz-transition: all .3s ease; -o-transition: all .3s ease; -ms-transition: all .3s ease; }
|
||||
.owp-extra-notice.owp-contest-notice a.btn:hover { background-color: #0b7cac; border-color: #0b7cac; }
|
||||
.owp-extra-notice.owp-contest-notice a.btn.button-secondary { background-color: #f2f2f2; color: #666; border-color: #dadada; margin-left: 10px; }
|
||||
.owp-extra-notice.owp-contest-notice a.btn.button-secondary:hover { background-color: #e6e6e6; border-color: #e6e6e6; }
|
||||
.owp-extra-notice.owp-contest-notice a.dismiss { position: absolute; top: 10px; right: 10px; text-decoration: none; color: #13aff0; -webkit-box-shadow: none !important; box-shadow: none !important; }
|
||||
|
||||
/* Rating notice */
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice span.dashicons-star-filled { background-color: #ffb900; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice p:last-child { margin-top: 20px; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a.btn { background-color: #ffb900; border-color: #ffb900; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a.btn:hover { background-color: #e6a803; border-color: #e6a803; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a.btn.button-secondary { background-color: #f2f2f2; color: #666; border-color: #dadada; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a.btn.button-secondary:hover { background-color: #e6e6e6; border-color: #e6e6e6; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a span { vertical-align: middle; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a span.dashicons { font-size: 1.4em; padding-right: 5px; height: auto; }
|
||||
.owp-extra-notice.oe-rating-notice.owp-contest-notice a.dismiss { color: #ffb900; }
|
||||
|
||||
body.rtl .owp-extra-notice.owp-contest-notice span.dashicons-heart { right: 0; left: auto; }
|
||||
body.rtl .owp-extra-notice.owp-contest-notice { padding-right: 74px; padding-left: 40px; }
|
||||
body.rtl .owp-extra-notice.owp-contest-notice a.btn.button-secondary { margin-right: 10px; margin-left: 0; }
|
||||
body.rtl .owp-extra-notice.owp-contest-notice a.dismiss { left: 10px; right: auto; }
|
||||
|
||||
@media screen and ( max-width: 480px ) {
|
||||
.owp-extra-notice.owp-contest-notice span.dashicons-heart { display: none; }
|
||||
.owp-extra-notice.owp-contest-notice { padding-left: 14px; }
|
||||
body.rtl .owp-extra-notice.owp-contest-notice { padding-right: 14px; }
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
private function includes() {
|
||||
require_once( OE_PATH . '/includes/wizard/classes/QuietSkin.php' );
|
||||
require_once( OE_PATH . '/includes/wizard/classes/WizardAjax.php' );
|
||||
}
|
||||
|
||||
public function add_ocean_wizard_menu() {
|
||||
add_dashboard_page('', '', 'manage_options', 'owp_setup', '');
|
||||
}
|
||||
|
||||
public function ocean_wizard_setup() {
|
||||
if (!current_user_can('manage_options'))
|
||||
return;
|
||||
if (empty($_GET['page']) || 'owp_setup' !== $_GET['page']) { // WPCS: CSRF ok, input var ok.
|
||||
return;
|
||||
}
|
||||
$default_steps = array(
|
||||
'welcome' => array(
|
||||
'name' => __('Welcome', 'ocean-extra'),
|
||||
'view' => array($this, 'ocean_welcome'),
|
||||
),
|
||||
'demo' => array(
|
||||
'name' => __('Choosing Demo', 'ocean-extra'),
|
||||
'view' => array($this, 'ocean_demo_setup'),
|
||||
),
|
||||
'customize' => array(
|
||||
'name' => __('Customize', 'ocean-extra'),
|
||||
'view' => array($this, 'ocean_customize_setup'),
|
||||
),
|
||||
'ready' => array(
|
||||
'name' => __('Ready', 'ocean-extra'),
|
||||
'view' => array($this, 'ocean_ready_setup'),
|
||||
)
|
||||
);
|
||||
$this->steps = apply_filters('owp_setup_wizard_steps', $default_steps);
|
||||
$this->step = isset($_GET['step']) ? sanitize_key($_GET['step']) : current(array_keys($this->steps)); // WPCS: CSRF ok, input var ok.
|
||||
// CSS
|
||||
wp_enqueue_style('owp-wizard-style', plugins_url('/assets/css/style.min.css', __FILE__));
|
||||
|
||||
// RTL
|
||||
if (is_RTL()) {
|
||||
wp_enqueue_style('owp-wizard-rtl', plugins_url('/assets/css/rtl.min.css', __FILE__));
|
||||
}
|
||||
|
||||
// JS
|
||||
wp_enqueue_script('owp-wizard-js', plugins_url('/assets/js/wizard.min.js', __FILE__), array('jquery', 'wp-util', 'updates'));
|
||||
|
||||
wp_localize_script('owp-wizard-js', 'owpDemos', array(
|
||||
'ajaxurl' => admin_url('admin-ajax.php'),
|
||||
'demo_data_nonce' => wp_create_nonce('get-demo-data'),
|
||||
'owp_import_data_nonce' => wp_create_nonce('owp_import_data_nonce'),
|
||||
'content_importing_error' => esc_html__('There was a problem during the importing process resulting in the following error from your server:', 'ocean-extra'),
|
||||
'button_activating' => esc_html__('Activating', 'ocean-extra') . '…',
|
||||
'button_active' => esc_html__('Active', 'ocean-extra'),
|
||||
));
|
||||
|
||||
global $current_screen, $hook_suffix, $wp_locale;
|
||||
if (empty($current_screen))
|
||||
set_current_screen();
|
||||
$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html <?php language_attributes(); ?>>
|
||||
<head>
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php esc_html_e('OceanWP › Setup Wizard', 'ocean-extra'); ?></title>
|
||||
<script type="text/javascript">
|
||||
addLoadEvent = function (func) {
|
||||
if (typeof jQuery != "undefined")
|
||||
jQuery(document).ready(func);
|
||||
else if (typeof wpOnload != 'function') {
|
||||
wpOnload = func;
|
||||
} else {
|
||||
var oldonload = wpOnload;
|
||||
wpOnload = function () {
|
||||
oldonload();
|
||||
func();
|
||||
}
|
||||
}
|
||||
};
|
||||
var ajaxurl = '<?php echo admin_url('admin-ajax.php', 'relative'); ?>',
|
||||
pagenow = '<?php echo $current_screen->id; ?>',
|
||||
typenow = '<?php echo $current_screen->post_type; ?>',
|
||||
adminpage = '<?php echo $admin_body_class; ?>',
|
||||
thousandsSeparator = '<?php echo addslashes($wp_locale->number_format['thousands_sep']); ?>',
|
||||
decimalPoint = '<?php echo addslashes($wp_locale->number_format['decimal_point']); ?>',
|
||||
isRtl = <?php echo (int) is_rtl(); ?>;
|
||||
</script>
|
||||
<?php
|
||||
//include demos script
|
||||
wp_print_scripts('owp-wizard-js');
|
||||
|
||||
//include custom scripts in specifiec steps
|
||||
if ($this->step == 'demo' || $this->step == "welcome" || $this->step == 'customize') {
|
||||
wp_print_styles('themes');
|
||||
wp_print_styles('buttons');
|
||||
wp_print_styles('dashboard');
|
||||
wp_print_styles('common');
|
||||
}
|
||||
|
||||
if ($this->step == 'customize') {
|
||||
wp_print_styles('media');
|
||||
wp_enqueue_media();
|
||||
wp_enqueue_style('wp-color-picker');
|
||||
wp_enqueue_script('wp-color-picker');
|
||||
}
|
||||
|
||||
//add admin styles
|
||||
do_action('admin_print_styles');
|
||||
|
||||
do_action('admin_head');
|
||||
?>
|
||||
</head>
|
||||
<body class="owp-setup wp-core-ui">
|
||||
<?php $logo = apply_filters('oceanwp_setup_wizard_logo', '<a href="https://oceanwp.org/?utm_source=dash&utm_medium=wizard&utm_campaign=logo">OceanWP<span class="circle"></span></a>'); ?>
|
||||
<div id="owp-logo"><?php echo $logo; ?></div>
|
||||
<?php
|
||||
$this->setup_wizard_steps();
|
||||
$this->setup_wizard_content();
|
||||
_wp_footer_scripts();
|
||||
do_action('admin_footer');
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the steps.
|
||||
*/
|
||||
public function setup_wizard_steps() {
|
||||
$output_steps = $this->steps;
|
||||
?>
|
||||
<ol class="owp-setup-steps">
|
||||
<?php
|
||||
foreach ($output_steps as $step_key => $step) {
|
||||
$is_completed = array_search($this->step, array_keys($this->steps), true) > array_search($step_key, array_keys($this->steps), true);
|
||||
|
||||
if ($step_key === $this->step) {
|
||||
?>
|
||||
<li class="active"><?php echo esc_html($step['name']); ?></li>
|
||||
<?php
|
||||
} elseif ($is_completed) {
|
||||
?>
|
||||
<li class="done">
|
||||
<a href="<?php echo esc_url(add_query_arg('step', $step_key, remove_query_arg('activate_error'))); ?>"><?php echo esc_html($step['name']); ?></a>
|
||||
</li>
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
<li><?php echo esc_html($step['name']); ?></li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Output the content for the current step.
|
||||
*/
|
||||
public function setup_wizard_content() {
|
||||
echo '<div class="owp-setup-content">';
|
||||
if (!empty($this->steps[$this->step]['view'])) {
|
||||
call_user_func($this->steps[$this->step]['view'], $this);
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Next Step
|
||||
* @param type $step
|
||||
* @return string
|
||||
*/
|
||||
public function get_next_step_link($step = '') {
|
||||
if (!$step) {
|
||||
$step = $this->step;
|
||||
}
|
||||
|
||||
$keys = array_keys($this->steps);
|
||||
if (end($keys) === $step) {
|
||||
return admin_url();
|
||||
}
|
||||
|
||||
$step_index = array_search($step, $keys, true);
|
||||
if (false === $step_index) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return add_query_arg('step', $keys[$step_index + 1], remove_query_arg('activate_error'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Previous Step
|
||||
* @param type $step
|
||||
* @return string
|
||||
*/
|
||||
public function get_previous_step_link($step = '') {
|
||||
|
||||
if (!$step) {
|
||||
$step = $this->step;
|
||||
}
|
||||
|
||||
$keys = array_keys($this->steps);
|
||||
|
||||
$step_index = array_search($step, $keys, true);
|
||||
|
||||
if (false === $step_index) {
|
||||
return '';
|
||||
}
|
||||
$url = FALSE;
|
||||
|
||||
if (isset($keys[$step_index - 1])) {
|
||||
$url = add_query_arg('step', $keys[$step_index - 1], remove_query_arg('activate_error'));
|
||||
}
|
||||
return $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper method to retrieve the current user's email address.
|
||||
*
|
||||
* @return string Email address
|
||||
*/
|
||||
protected function get_current_user_email() {
|
||||
$current_user = wp_get_current_user();
|
||||
$user_email = $current_user->user_email;
|
||||
|
||||
return $user_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 1 Welcome
|
||||
*/
|
||||
public function ocean_welcome() {
|
||||
// Image
|
||||
$img = plugins_url('/assets/img/jack.png', __FILE__);
|
||||
|
||||
// Button icon
|
||||
if (is_RTL()) {
|
||||
$icon = 'left';
|
||||
} else {
|
||||
$icon = 'right';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="owp-welcome-wrap owp-wrap">
|
||||
<h2><?php esc_attr_e("Setup Wizard", 'ocean-extra'); ?></h2>
|
||||
<h1><?php esc_attr_e("Welcome!", 'ocean-extra'); ?></h1>
|
||||
<div class="owp-thumb">
|
||||
<img src="<?php echo esc_url($img); ?>" width="425" height="290" alt="Jack the Shark" />
|
||||
</div>
|
||||
<p><?php esc_attr_e("Thank you for choosing OceanWP, in this quick setup wizard we'll take you through the 2 essential steps for you to get started building your dream website. Make sure to go through it to the end, where we also included a little bonus as well.", 'ocean-extra'); ?></p>
|
||||
<div class="owp-wizard-setup-actions">
|
||||
<a class="skip-btn continue" href="<?php echo $this->get_next_step_link(); ?>"><?php esc_attr_e("Get started", 'ocean-extra'); ?><i class="dashicons dashicons-arrow-<?php echo esc_attr($icon); ?>-alt"></i></a>
|
||||
</div>
|
||||
<a class="owp-setup-footer-links" href="<?php echo esc_url(( add_query_arg(array('owp_wizard_hide_notice' => '2nd_notice'), admin_url()))); ?>"><?php esc_attr_e("Skip Setup Wizard", 'ocean-extra'); ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 2 list demo
|
||||
*/
|
||||
public function ocean_demo_setup() {
|
||||
$demos = OceanWP_Demos::get_demos_data();
|
||||
|
||||
// Button icon
|
||||
if (is_RTL()) {
|
||||
$icon = 'left';
|
||||
} else {
|
||||
$icon = 'right';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="owp-demos-wrap owp-wrap">
|
||||
<div class="demo-import-loader preview-all"></div>
|
||||
<div class="demo-import-loader preview-icon"><i class="custom-loader"></i></div>
|
||||
|
||||
<div class="owp-demo-wrap">
|
||||
<h1><?php esc_attr_e("Selecting your demo template", 'ocean-extra'); ?></h1>
|
||||
<p><?php
|
||||
echo
|
||||
sprintf(__('Clicking %1$sLive Preview%2$s will open the demo in a new window for you to decide which template to use. Then %1$sSelect%2$s the demo you want and click %1$sInstall Demo%2$s in the bottom.', 'ocean-extra'), '<strong>', '</strong>'
|
||||
);
|
||||
?></p>
|
||||
<div class="theme-browser rendered">
|
||||
|
||||
<?php $categories = OceanWP_Demos::get_demo_all_categories($demos); ?>
|
||||
|
||||
<?php if (!empty($categories)) : ?>
|
||||
<div class="owp-header-bar">
|
||||
<nav class="owp-navigation">
|
||||
<ul>
|
||||
<li class="active"><a href="#all" class="owp-navigation-link"><?php esc_html_e('All', 'ocean-extra'); ?></a></li>
|
||||
<?php foreach ($categories as $key => $name) : ?>
|
||||
<li><a href="#<?php echo esc_attr($key); ?>" class="owp-navigation-link"><?php echo esc_html($name); ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="themes wp-clearfix">
|
||||
|
||||
<?php
|
||||
// Loop through all demos
|
||||
foreach ($demos as $demo => $key) {
|
||||
|
||||
// Vars
|
||||
$item_categories = OceanWP_Demos::get_demo_item_categories($key);
|
||||
?>
|
||||
|
||||
<div class="theme-wrap" data-categories="<?php echo esc_attr($item_categories); ?>" data-name="<?php echo esc_attr(strtolower($demo)); ?>">
|
||||
|
||||
<div class="theme owp-open-popup" data-demo-id="<?php echo esc_attr($demo); ?>">
|
||||
|
||||
<div class="theme-screenshot">
|
||||
<img src="<?php echo OE_URL . 'includes/panel/demos/' . esc_attr($demo); ?>.jpg" />
|
||||
|
||||
</div>
|
||||
|
||||
<div class="theme-id-container">
|
||||
|
||||
<h2 class="theme-name" id="<?php echo esc_attr($demo); ?>"><span><?php echo ucwords($demo); ?></span></h2>
|
||||
<div class="theme-actions">
|
||||
<a class="button button-primary" href="https://<?php echo esc_attr($demo); ?>.oceanwp.org/" target="_blank"><?php _e('Live Preview', 'ocean-extra'); ?></a>
|
||||
<span class="button button-secondary"><?php _e('Select', 'ocean-extra'); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="owp-wizard-setup-actions">
|
||||
<button class="install-demos-button disabled" disabled data-next_step="<?php echo $this->get_next_step_link(); ?>"><?php esc_attr_e("Install Demo", 'ocean-extra'); ?></button>
|
||||
<a class="skip-btn" href="<?php echo $this->get_next_step_link(); ?>"><?php esc_attr_e("Skip Step", 'ocean-extra'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="owp-wizard-setup-actions wizard-install-demos-buttons-wrapper final-step">
|
||||
<a class="skip-btn continue" href="<?php echo $this->get_next_step_link(); ?>"><?php esc_attr_e("Next Step", 'ocean-extra'); ?><i class="dashicons dashicons-arrow-<?php echo esc_attr($icon); ?>-alt"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 3 customize step
|
||||
*/
|
||||
public function ocean_customize_setup() {
|
||||
|
||||
if (isset($_POST['save_step']) && !empty($_POST['save_step'])) {
|
||||
$this->save_ocean_customize();
|
||||
}
|
||||
|
||||
// Button icon
|
||||
if (is_RTL()) {
|
||||
$icon = 'left';
|
||||
} else {
|
||||
$icon = 'right';
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="owp-customize-wrap owp-wrap">
|
||||
<form method="POST" name="owp-customize-form">
|
||||
<?php wp_nonce_field('owp_customize_form'); ?>
|
||||
<div class="field-group">
|
||||
<?php
|
||||
$custom_logo = get_theme_mod("custom_logo");
|
||||
$display = "none";
|
||||
$url = "";
|
||||
|
||||
if ($custom_logo) {
|
||||
$display = "inline-block";
|
||||
if (!($url = wp_get_attachment_image_url($custom_logo))) {
|
||||
$custom_logo = "";
|
||||
$display = "none";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h1><?php esc_attr_e("Logo", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your logo below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<img src="<?php echo $url; ?>" width="115px" height="115px" id="ocean-logo-img" style="display:<?php echo $display; ?>;"/>
|
||||
<div>
|
||||
<input type="hidden" name="ocean-logo" id="ocean-logo" value="<?php echo $custom_logo; ?>" />
|
||||
<button type="submit" data-name="ocean-logo" class="upload_image_button button"><?php esc_attr_e("Upload", 'ocean-extra'); ?></button>
|
||||
<button style="display:<?php echo $display; ?>;" type="submit" data-name="ocean-logo" class="remove_image_button button">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
|
||||
<?php
|
||||
$ocean_retina_logo = get_theme_mod("ocean_retina_logo");
|
||||
$display = "none";
|
||||
$url = "";
|
||||
|
||||
if ($ocean_retina_logo) {
|
||||
$display = "inline-block";
|
||||
$url = wp_get_attachment_image_url($ocean_retina_logo);
|
||||
if (!($url = wp_get_attachment_image_url($ocean_retina_logo))) {
|
||||
$ocean_retina_logo = "";
|
||||
$display = "none";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h1><?php esc_attr_e("Retina Logo", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Retina Logo below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<img src="<?php echo $url; ?>" width="115px" height="115px" id="ocean-retina-logo-img" style="display:<?php echo $display; ?>;"/>
|
||||
<div>
|
||||
<input type="hidden" name="ocean-retina-logo" id="ocean-retina-logo" value="<?php echo $ocean_retina_logo; ?>" />
|
||||
<button type="submit" data-name="ocean-retina-logo" class="upload_image_button button"><?php esc_attr_e("Upload", 'ocean-extra'); ?></button>
|
||||
<button style="display:<?php echo $display; ?>;" type="submit" data-name="ocean-retina-logo" class="remove_image_button button">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Site Title", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Site Title below.", 'ocean-extra'); ?></p>
|
||||
<input type="text" name="ocean-site-title" id="ocean-site-title" class="ocean-input" value="<?php echo get_option("blogname"); ?>">
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Tagline", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Tagline below.", 'ocean-extra'); ?></p>
|
||||
<input type="text" name="ocean-tagline" id="ocean-tagline" class="ocean-input" value="<?php echo get_option("blogdescription"); ?>">
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
|
||||
<?php
|
||||
$favicon = get_option("site_icon");
|
||||
$display = "none";
|
||||
$url = "";
|
||||
|
||||
if ($favicon) {
|
||||
$display = "inline-block";
|
||||
$url = wp_get_attachment_image_url($favicon);
|
||||
if (!($url = wp_get_attachment_image_url($favicon))) {
|
||||
$favicon = "";
|
||||
$display = "none";
|
||||
}
|
||||
}
|
||||
?>
|
||||
<h1><?php esc_attr_e("Site Icon", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Site Icons are what you see in browser tabs, bookmark bars, and within the WordPress mobile apps. Upload one here! Site Icons should be square and at least 512 × 512 pixels.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<img src="<?php echo $url; ?>" width="115px" height="115px" id="ocean-favicon-img" style="display:<?php echo $display; ?>;"/>
|
||||
<div>
|
||||
<input type="hidden" name="ocean-favicon" id="ocean-favicon" value="<?php echo $favicon; ?>" />
|
||||
<button type="submit" data-name="ocean-favicon" class="upload_image_button button"><?php esc_attr_e("Upload", 'ocean-extra'); ?></button>
|
||||
<button style="display:<?php echo $display; ?>;" type="submit" data-name="ocean-favicon" class="remove_image_button button">×</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Primary Color", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Primary Color below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<input name="ocean-primary-color" id="ocean-primary-color" class="color-picker-field" value="<?php echo get_theme_mod("ocean_primary_color"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Hover Primary Color", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Hover Primary Color below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<input name="ocean-hover-primary-color" id="ocean-hover-primary-color" class="color-picker-field" value="<?php echo get_theme_mod("ocean_hover_primary_color"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Main Border Color", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Main Border Color below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<input name="ocean-main-border-color" id="ocean-main-border-color" class="color-picker-field" value="<?php echo get_theme_mod("ocean_main_border_color"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Links Color", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Links Color below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<input name="ocean-links-color" id="ocean-links-color" class="color-picker-field" value="<?php echo get_theme_mod("ocean_links_color"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field-group">
|
||||
<h1><?php esc_attr_e("Links Hover Color", 'ocean-extra'); ?></h1>
|
||||
<p><?php esc_attr_e("Please add your Links Hover Color below.", 'ocean-extra'); ?></p>
|
||||
<div class="upload">
|
||||
<input name="ocean-links-hover-color" id="ocean-links-hover-color" class="color-picker-field" value="<?php echo get_theme_mod("ocean_links_color_hover"); ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="owp-wizard-setup-actions">
|
||||
<input type="hidden" name="save_step" value="save_step"/>
|
||||
<button class="continue" type="submit" ><?php esc_attr_e("Continue", 'ocean-extra'); ?><i class="dashicons dashicons-arrow-<?php echo esc_attr($icon); ?>-alt"></i></button>
|
||||
<a class="skip-btn" href="<?php echo $this->get_next_step_link(); ?>"><?php esc_attr_e("Skip Step", 'ocean-extra'); ?></a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Info In Step3
|
||||
*/
|
||||
public function save_ocean_customize() {
|
||||
|
||||
if ( current_user_can('manage_options') && isset($_REQUEST['_wpnonce']) &&wp_verify_nonce($_REQUEST['_wpnonce'], 'owp_customize_form')){
|
||||
if (isset($_POST['ocean-logo']))
|
||||
set_theme_mod('custom_logo', $_POST['ocean-logo']);
|
||||
|
||||
if (isset($_POST['ocean-retina-logo']))
|
||||
set_theme_mod('ocean_retina_logo', $_POST['ocean-retina-logo']);
|
||||
|
||||
if (isset($_POST['ocean-site-title']))
|
||||
$site_title = sanitize_hex_color( $_POST['ocean-site-title'] );
|
||||
update_option('blogname', esc_html($site_title));
|
||||
|
||||
if (isset($_POST['ocean-tagline']))
|
||||
$site_tagline = sanitize_hex_color( $_POST['ocean-tagline'] );
|
||||
update_option('blogdescription', esc_html($site_tagline));
|
||||
|
||||
if (isset($_POST['ocean-favicon']))
|
||||
update_option('site_icon', $_POST['ocean-favicon']);
|
||||
|
||||
if (isset($_POST['ocean-primary-color']))
|
||||
$primary_color = sanitize_hex_color( $_POST['ocean-primary-color'] );
|
||||
set_theme_mod('ocean_primary_color', esc_html($primary_color));
|
||||
|
||||
if (isset($_POST['ocean-hover-primary-color']))
|
||||
$primary_color_hover = sanitize_hex_color( $_POST['ocean-hover-primary-color'] );
|
||||
set_theme_mod('ocean_hover_primary_color', esc_html($primary_color_hover));
|
||||
|
||||
if (isset($_POST['ocean-main-border-color']))
|
||||
$main_border_color = sanitize_hex_color( $_POST['ocean-main-border-color'] );
|
||||
set_theme_mod('ocean_main_border_color', esc_html($main_border_color));
|
||||
|
||||
if (isset($_POST['ocean-links-color']))
|
||||
$links_color = sanitize_hex_color( $_POST['ocean-links-color'] );
|
||||
set_theme_mod('ocean_links_color', esc_html($links_color));
|
||||
|
||||
if (isset($_POST['ocean-links-hover-color']))
|
||||
$links_color_hover = sanitize_hex_color( $_POST['ocean-links-hover-color'] );
|
||||
set_theme_mod('ocean_links_color_hover', esc_html($links_color_hover));
|
||||
|
||||
wp_safe_redirect($this->get_next_step_link());
|
||||
exit;
|
||||
}else
|
||||
{
|
||||
print 'Your are not authorized to submit this form';
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Step 4 ready step
|
||||
*/
|
||||
public function ocean_ready_setup() {
|
||||
$user_email = $this->get_current_user_email();
|
||||
?>
|
||||
|
||||
<div class="owp-ready-wrap owp-wrap">
|
||||
<h2><?php esc_attr_e("Your website is ready", 'ocean-extra'); ?></h2>
|
||||
<h1 style="font-size: 30px;"><?php esc_attr_e("Get the extension bundle for free!", 'ocean-extra'); ?></h1>
|
||||
<p style="font-size: 14px;"><?php esc_attr_e("Win the Core Extension Bundle by entering our giveaway. Every month we randomly draw 5 people that get the full suite of pro extensions for free. Enter with your email below.", 'ocean-extra'); ?></p>
|
||||
<div class="owp-newsletter">
|
||||
<p><?php esc_attr_e("Input your email below to get the chance to win.", 'ocean-extra'); ?></p>
|
||||
|
||||
<form id="owp_email_signup" class="klaviyo_styling klaviyo_gdpr_embed_J7zjRA" action="//manage.kmail-lists.com/subscriptions/subscribe" data-ajax-submit="//manage.kmail-lists.com/ajax/subscriptions/subscribe" method="GET" target="_blank" novalidate="novalidate">
|
||||
<input type="hidden" name="g" value="J7zjRA">
|
||||
<input type="hidden" name="$fields" value="owp_use">
|
||||
|
||||
<div class="klaviyo_field_group">
|
||||
<input class="" type="email" value="<?php echo esc_attr($user_email); ?>" name="email" id="k_id_email" placeholder="<?php esc_attr_e('Email address', 'ocean-extra'); ?>"/>
|
||||
|
||||
<div class="klaviyo_field_group klaviyo_form_actions klaviyo_form_checkboxes">
|
||||
<div class="klaviyo_helptext"><?php esc_html_e('What’s your intended use of OceanWP?', 'ocean-extra'); ?></div>
|
||||
|
||||
<label for="consent-ecommerce"><input type="checkbox" name="owp_use" id="consent-ecommerce" value="ecommerce"><?php esc_html_e('E-Commerce', 'ocean-extra'); ?></label>
|
||||
<label for="consent-agency"><input type="checkbox" name="owp_use" id="consent-agency" value="agency"><?php esc_html_e('Agency', 'ocean-extra'); ?></label>
|
||||
<label for="consent-blog"><input type="checkbox" name="owp_use" id="consent-blog" value="blog"><?php esc_html_e('Blog', 'ocean-extra'); ?></label>
|
||||
<label for="consent-other"><input type="checkbox" name="owp_use" id="consent-other" value="other"><?php esc_html_e('Other', 'ocean-extra'); ?></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="klaviyo_form_actions">
|
||||
<button type="submit" class="klaviyo_submit_button"><?php esc_html_e('Enter Now', 'ocean-extra'); ?></button>
|
||||
|
||||
<div class="klaviyo_helptext klaviyo_gdpr_text">
|
||||
<?php echo
|
||||
sprintf(
|
||||
esc_html__( 'By entering your email, you agree to our %1$sTerms of Services%2$s and %3$sPrivacy Policy%4$s.', 'ocean-extra' ),
|
||||
'<a href="https://oceanwp.org/terms-and-conditions/" target="_blank">',
|
||||
'</a>',
|
||||
'<a href="https://oceanwp.org/privacy-policy/" target="_blank">',
|
||||
'</a>'
|
||||
); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="klaviyo_messages">
|
||||
<div class="success_message" style="display:none;"><?php esc_html_e('Thank you for participating!', 'ocean-extra'); ?></div>
|
||||
<div class="error_message" style="display:none;"></div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script type="text/javascript" src="//www.klaviyo.com/media/js/public/klaviyo_subscribe.js"></script>
|
||||
<script type="text/javascript">
|
||||
KlaviyoSubscribe.attachToForms('#owp_email_signup', {
|
||||
custom_success_message: true,
|
||||
success: function ($form) {
|
||||
jQuery('.owp-wizard-setup-actions a').attr('href', "<?php echo esc_url(( add_query_arg(array('owp_wizard_hide_notice' => 'install', 'show' => '1',), admin_url()))); ?>")
|
||||
},
|
||||
extra_properties: {
|
||||
$source: '$embed',
|
||||
$method_type: "Klaviyo Form",
|
||||
$method_id: 'embed',
|
||||
$consent_version: 'Embed default text'
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</div>
|
||||
|
||||
<div class="owp-wizard-setup-actions">
|
||||
<a class="button button-next button-large" href="<?php echo esc_url(( add_query_arg(array('owp_wizard_hide_notice' => '2nd_notice', 'show' => '1',), admin_url()))); ?>"><?php esc_html_e('View Your Website', 'ocean-extra'); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Define cronjob
|
||||
*/
|
||||
public static function cronjob_activation() {
|
||||
$timezone_string = get_option( 'timezone_string' );
|
||||
if ( ! $timezone_string ) {
|
||||
return false;
|
||||
}
|
||||
date_default_timezone_set($timezone_string);
|
||||
$new_time_format = time() + (24 * 60 * 60 );
|
||||
if (!wp_next_scheduled('add_second_notice')) {
|
||||
wp_schedule_event($new_time_format, 'daily', 'add_second_notice');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete cronjob
|
||||
*/
|
||||
public static function cronjob_deactivation() {
|
||||
wp_clear_scheduled_hook('add_second_notice');
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
new Ocean_Extra_Theme_Wizard();
|
||||
|
||||
register_activation_hook(OE_FILE_PATH, "Ocean_Extra_Theme_Wizard::install");
|
||||
// when deactivate plugin
|
||||
register_deactivation_hook(OE_FILE_PATH, "Ocean_Extra_Theme_Wizard::uninstall");
|
||||
//when activate plugin for automatic second notice
|
||||
register_activation_hook(OE_FILE_PATH, array("Ocean_Extra_Theme_Wizard", "cronjob_activation"));
|
||||
register_deactivation_hook(OE_FILE_PATH, array("Ocean_Extra_Theme_Wizard", "cronjob_deactivation"));
|
||||
endif;
|
||||
Reference in New Issue
Block a user