init commit

This commit is contained in:
2023-07-04 11:21:47 -07:00
commit ce48e96737
105 changed files with 28651 additions and 0 deletions

View File

@ -0,0 +1,609 @@
/*====================================
About Page Style
====================================*/
pre.changelog {
background-color: #f5f5f5;
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(50%, #f5f5f5), color-stop(50%, #e6e6e6));
background-image: -webkit-linear-gradient(#f5f5f5 50%, #e6e6e6 50%);
background-image: linear-gradient(#f5f5f5 50%, #e6e6e6 50%);
background-size: 50px 54.35px;
border: 1px solid #d4d4d4;
display: block;
line-height: 19px;
margin-bottom: 10px;
overflow: visible;
overflow-y: hidden;
padding: 0 0 0 4px;
font-size: 16px;
line-height: 1.7;
font-weight: 500;
}
pre.changelog span {
font-weight: 700;
}
.return-to-dashboard.sophia-after-dark {
clear: both;
text-align: right;
}
p.sophia-after-dark-actions a.skip {
opacity: .5;
}
table {
width: 100%;
border-collapse: collapse;
}
td {
text-align: center;
}
.about-wrap {
max-width: 100%;
}
.about-wrap table td h3 {
margin: 15px 20px;
padding-left: 20px;
text-align: left;
font-size: 16px;
text-align: center;
}
.mt-nav-content-wrap table th h3 {
margin: 10px 0;
font-weight: 700;
}
table td {
font-weight: 600;
font-size: 16px;
}
.wrap table td .dashicons {
font-size: 44px;
text-align: center;
line-height: 20px;
display: block;
width: 100%;
}
.wrap table {
border: 1px solid #e1e1e1;
border-collapse: collapse;
}
.wrap table th {
width: 33%;
}
.wrap table th:first-child {
background-color: rgba(0, 0, 0, 0.03);
}
.about-wrap table .table-feature-title>h3 {
color: #404040;
}
.mt-nav-content-wrap table th {
background: #f3f3f3;
}
tr:nth-child(2n) {
background-color: #f8f8f8;
}
.wrap table td span {
font-size: 25px;
}
.wrap table td .dashicons.dashicons-no {
color: #CE2D2D;
}
.wrap table td .dashicons.dashicons-yes {
color: #24B37E;
}
table tr .btn-wrapper {
padding: 10px 0;
}
.theme-browser {
margin-top: 15px;
}
.theme-browser .theme .theme-actions,
.theme-browser .theme.active .theme-actions {
position: absolute;
bottom: 0;
top: auto;
-webkit-transform: none;
transform: none;
right: 0;
padding: 9px 15px;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, .1);
}
.author-credit .theme-version {
font-style: italic;
}
.author-credit .author-link a {
text-decoration: none;
}
.author-credit .author-link {
margin: 15px 0 25px;
color: #72777c;
font-size: 16px;
font-weight: 400;
line-height: inherit;
}
/**
* RTL Ready
*/
.rtl .about-wrap .about-text {
float: right;
}
.rtl .theme-browser .theme .theme-name,
.rtl .theme-browser .theme.active .theme-name {
text-align: left;
}
.rtl .theme-browser .theme.active .theme-name {
padding-left: 5%;
}
.rtl .theme-browser .theme.active .theme-actions {
left: 90%;
}
.rtl .theme-browser .theme .theme-actions {
left: 35%;
}
@media (max-width: 1400px) {
.about-wrap h1 {
font-size: 30px;
}
.about-wrap .about-text {
font-size: 16px;
}
}
@media (max-width: 1200px) {
.about-wrap .about-text {
font-size: 14px;
}
.about-wrap table td h3,
.about-wrap table td {
font-size: 14px;
}
}
@media (max-width: 980px) {
.about-wrap h1 {
font-size: 25px;
}
.about-wrap .about-text,
.sophia-after-dark-screenshot {
float: none;
width: 100%;
}
}
/* Welcome new css */
.mt-clearfix:after {
clear: both;
content: "";
display: block;
}
.mt-theme-info {
background: #fff;
padding: 10px 20px;
}
.mt-welcome-screenshot {
width: 42%;
float: right;
border: 1px solid #e1e1e1;
padding: 10px;
margin: 0;
}
.welcome-description-wrap {
margin: 0;
}
.about-wrap .mt-about-title {
display: block;
float: left;
width: auto;
font-size: 24px;
font-weight: 700;
margin: 0;
text-transform: uppercase;
vertical-align: middle;
margin-right: 20px;
}
.about-wrap .author-credit {
display: block;
font-size: 13px;
float: right;
margin-top: 4px;
}
.author-credit .author-link {
font-size: 13px;
}
.about-wrap .about-text {
font-size: 14px;
margin: 10px 0 0;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a {
display: block;
float: none;
}
.mt-nav-tab-content-wrapper {
display: flex;
flex-wrap: wrap;
margin-top: 30px;
}
.nav-tab-wrapper {
width: 18%;
padding: 0;
border-bottom: none;
}
.mt-nav-content-wrap {
width: 82%;
background: #fff;
padding: 0px 40px 30px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
min-height: 500px;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a {
display: block;
float: none;
background: #fff;
border: none;
padding: 20px 20px;
border-top: 1px solid #e1e1e1;
border-left: 5px solid transparent;
margin-left: 0;
font-size: 16px;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a:first-child {
border-top: none;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a.nav-tab.nav-tab-active,
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a:hover {
border-left: 5px solid #0071A1;
color: #0071A1;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a .dashicons {
font-size: 26px;
margin: 0 15px 0px 0;
vertical-align: top;
position: relative;
top: 0;
}
.about-wrap .theme-features-wrap .two-col {
margin-left: -3%;
display: flex;
flex-wrap: wrap;
}
.about-wrap .theme-features-wrap .two-col .col {
border: 1px solid #e1e1e1;
width: 47%;
margin-left: 3%;
padding: 20px;
margin-right: 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
.about-wrap .theme-features-wrap .two-col .col h3 {
margin: 0;
}
.mt-theme-demos .mt-each-demo {
width: 30.33%;
margin-left: 3%;
margin-top: 3%;
margin-right: 0;
box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
box-sizing: border-box;
position: relative;
}
.mt-demo-pro::after {
content: "Premium";
display: inline-block;
position: absolute;
top: 10px;
right: 0px;
background: #B71C1C;
width: 90px;
color: #fff;
text-align: center;
padding: 8px 0;
font-weight: 600;
}
.mt-theme-demos .themes {
display: flex;
flex-wrap: wrap;
margin-left: -3%;
}
.theme-id-container h2 {
font-size: 15px;
font-weight: 600;
height: 18px;
margin: 0;
padding: 15px;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, .1);
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
background: #F6F6F6;
text-align: left;
}
.theme-id-container .theme-actions {
position: absolute;
bottom: 0;
top: auto;
-webkit-transform: none;
transform: none;
right: 0;
padding: 9px 15px;
box-shadow: inset 0 1px 0 rgba(0, 0, 0, .1);
}
.theme-id-container .theme-actions a {
display: inline-block;
margin: 0 5px;
float: none;
}
table tr .btn-wrapper .button {
font-size: 16px;
padding: 5px 50px;
font-weight: 600;
}
.about-wrap .mt-upgrader-title {
margin: 0 0 10px;
font-size: 22px;
font-weight: 700;
}
.mt-upgrader-pro {
background: #fff;
padding: 20px;
margin-top: 30px;
display: flex;
flex-wrap: wrap;
}
.mt-upgrade-title-wrap {
width: 85%;
}
.mt-upgrader-btn {
width: 15%;
}
.wp-core-ui .mt-upgrader-btn a {
font-size: 18px;
width: 100%;
display: block;
text-align: center;
padding: 10px 0;
font-weight: 600;
}
.welcome-panel h4 {
margin-top: 0;
}
.mt-popup-inner-wrap {
padding: 4px 30px;
margin-top: 30px;
}
.mt-dashicons-no::before,
.mt-dashicons-yes::before {
display: inline-block;
width: 30px;
height: 30px;
content: '';
background-image: url(../images/cross.png);
background-size: 30px auto;
position: relative;
top: -6px;
}
.mt-dashicons-yes::before {
background-image: url(../images/tick.png);
}
.theme-features-wrap.welcome-panel {
border: none;
padding: 0;
}
.about-wrap .about-description {
margin-top: 0;
font-weight: 700;
color: #333;
}
.about-wrap .theme-features-wrap .two-col .col li {
display: inline-block;
width: 48%;
vertical-align: top;
margin: 8px 0;
}
.about-wrap .changelog {
background-size: 0;
background: #fafafa;
border: none;
padding: 20px 20px;
}
a.notice-dismiss {
text-decoration: none;
}
.mt-get-started.updating-message::before {
margin-top: 12px !important;
}
.configure-msg {
font-weight: 700;
font-size: 20px;
margin-top: 80px;
text-align: center;
display: block;
text-transform: capitalize;
}
.theme-features-wrap.welcome-panel,
.theme-features-wrap.welcome-panel::before {
background: none;
height: auto;
}
@media (max-width: 1400px) {
.about-wrap .theme-features-wrap .two-col .col {
border: 1px solid #e1e1e1;
width: 47%;
}
.nav-tab-wrapper {
width: 20%;
}
.mt-nav-content-wrap {
width: 80%;
}
.mt-theme-demos .mt-each-demo {
width: 47%;
}
.mt-upgrade-title-wrap {
width: 75%;
}
.mt-upgrader-btn {
width: 25%;
}
.about-wrap .theme-features-wrap .two-col .col li {
width: 100%;
}
}
@media (max-width: 1200px) {
.mt-upgrade-title-wrap {
width: 100%;
text-align: center;
}
.mt-upgrader-btn {
margin: 20px auto 0;
width: auto;
}
.wp-core-ui .mt-upgrader-btn a {
padding: 8px 20px;
}
.theme-id-container {
position: relative;
padding: 10px 0px;
background: #F6F6F6;
}
.theme-id-container h2 {
display: block;
text-align: center;
padding: 10px 0;
box-shadow: none;
}
.theme-id-container .theme-actions {
position: static;
text-align: center;
background: #F6F6F6;
box-shadow: none;
}
}
@media (max-width: 768px) {
.mt-theme-demos .mt-each-demo {
width: 100%;
margin-bottom: 20px;
}
.nav-tab-wrapper {
width: 100%;
}
.mt-nav-content-wrap {
width: 100%;
padding: 0 30px;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a {
display: inline-block;
margin-right: -4px;
font-size: 14px;
padding: 12px 10px;
border-top: none;
border-left: none;
border-bottom: 5px solid transparent;
}
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a.nav-tab.nav-tab-active,
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a:hover {
border-left: none;
border-bottom: 5px solid #0071A1;
}
}
@media (max-width: 600px) {
.about-wrap .mt-nav-tab-content-wrapper .nav-tab-wrapper a {
font: 0/0 a;
}
.mt-each-demo.theme:focus .more-details,
.mt-each-demo.theme:hover .more-details,
.mt-each-demo.theme:not(.active):focus .theme-actions,
.mt-each-demo.theme:not(.active):hover .theme-actions {
display: block;
}
.about-wrap .mt-nav-tab-content-wrapper .theme-features-wrap .two-col .col {
width: 100%;
margin-bottom: 20px;
}
.wp-core-ui .mt-upgrader-btn a {
padding: 0 20px;
font-size: 16px;
}
}

View File

@ -0,0 +1,42 @@
.theme-review-notice {
position: relative;
}
.theme-review-notice .links {
margin: 10px 0;
}
.theme-review-notice .links a {
height: auto;
padding: 3px 15px;
margin-left: 10px;
text-transform: capitalize;
}
.theme-review-notice .links a .dashicons {
line-height: 1.5;
}
.theme-review-notice .links a.button-primary {
margin-left: 0;
}
.theme-review-notice a.notice-dismiss {
text-decoration: none;
}
#mt-theme-message {
position: relative;
}
.sophia-after-dark-message-close .notice-dismiss {
position: absolute;
}
a.notice-dismiss {
text-decoration: none;
}
.mt-get-started.updating-message::before {
margin-top: 12px !important;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,53 @@
/**
* Handles event for theme about page.
*/
jQuery(document).ready(function($) {
var WpAjaxurl = mtaboutObject.ajax_url;
var _wpnonce = mtaboutObject._wpnonce;
var action = mtaboutObject.action;
/**
* Popup on click demo import if mysterythemes demo importer plugin is not activated.
*/
$( '.mtdi-demo-import' ).addClass( 'disabled' );
switch( action ) {
case 'activate' : $( '.mt-activate-demo-import-plugin' ).on( 'click', function() {
var _this = $( this );
sophia_after_dark_do_plugin( 'activate_demo_importer_plugin', _this );
});
break;
case 'install' : $( '.mt-install-demo-import-plugin' ).on( 'click', function() {
var _this = $( this );
sophia_after_dark_do_plugin( 'install_demo_importer_plugin', _this );
});
break;
}
sophia_after_dark_do_plugin = function ( ajax_action, _this ) {
$.ajax({
method : "POST",
url : WpAjaxurl,
data : ({
'action' : ajax_action,
'_wpnonce' : _wpnonce
}),
beforeSend: function() {
var loadingTxt = _this.data( 'process' );
_this.addClass( 'updating-message' ).text( loadingTxt );
},
success: function( response ) {
if( response.success ) {
var loadedTxt = _this.data( 'done' );
_this.removeClass( 'updating-message' ).text( loadedTxt );
console.log( response.data.message );
} else {
console.log( response.data.message );
}
location.reload();
}
});
}
});

View File

@ -0,0 +1,53 @@
jQuery(document).ready(function($) {
"use strict";
var WpAjaxurl = mtaboutObject.ajax_url;
var _wpnonce = mtaboutObject._wpnonce;
var action = mtaboutObject.action;
switch( action ) {
case 'activate' :
$( '#mt-theme-message .mt-get-started' ).on( 'click', function() {
var _this = $( this );
sophia_after_dark_do_plugin( 'activate_demo_importer_plugin', _this );
});
break;
case 'install' :
$( '#mt-theme-message .mt-get-started' ).on( 'click', function() {
var _this = $( this );
sophia_after_dark_do_plugin( 'install_demo_importer_plugin', _this );
});
break;
case 'redirect' :
$( '#mt-theme-message .mt-get-started' ).on( 'click', function() {
var _this = $( this );
location.href = _this.data( 'redirect' );
});
break;
}
function sophia_after_dark_do_plugin( ajax_action, _this ) {
$.ajax({
method : "POST",
url : WpAjaxurl,
data : ({
'action' : ajax_action,
'_wpnonce' : _wpnonce
}),
beforeSend: function() {
var loadingTxt = _this.data( 'process' );
_this.addClass( 'updating-message' ).text( loadingTxt );
},
success: function( response ) {
if( response.success ) {
var loadedTxt = _this.data( 'done' );
_this.removeClass( 'updating-message' ).text( loadedTxt );
console.log( response.data.message );
} else {
console.log( response.data.message );
}
location.href = _this.data( 'redirect' );
}
})
}
})

View File

@ -0,0 +1,880 @@
<?php
/**
* Theme settings page.
*
* @package Sophia After Dark
*
* @since 1.0.7
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! class_exists( 'sophia_after_dark_Settings' ) ) :
class sophia_after_dark_Settings {
/**
* Constructor.
*/
public function __construct() {
add_action( 'admin_menu', array( $this, 'sophia_after_dark_admin_menu' ) );
add_action( 'wp_loaded', array( __CLASS__, 'sophia_after_dark_hide_notices' ) );
add_action( 'wp_loaded', array( $this, 'sophia_after_dark_admin_notice' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'about_theme_styles' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'about_theme_scripts' ) );
add_filter( 'admin_footer_text', array( $this, 'sophia_after_dark_admin_footer_text' ) );
//about theme review notice
add_action( 'after_setup_theme', array( $this, 'sophia_after_dark_theme_rating_notice' ) );
add_action( 'switch_theme', array( $this, 'sophia_after_dark_theme_rating_notice_data_remove' ) );
add_action( 'wp_ajax_activate_demo_importer_plugin', array( $this, 'activate_demo_importer_plugin' ) );
add_action( 'wp_ajax_install_demo_importer_plugin', array( $this, 'install_demo_importer_plugin' ) );
}
/**
* Add admin menu.
*/
public function sophia_after_dark_admin_menu() {
$theme = wp_get_theme( get_template() );
$page = add_theme_page( $theme->display( 'Name' ).' '.esc_html__( 'Settings', 'sophia-after-dark' ), $theme->display( 'Name' ).' '.' '.esc_html__( 'Settings', 'sophia-after-dark' ), 'activate_plugins', 'sophia-after-dark-settings', array( $this, 'get_started_screen' ) );
}
/**
* Enqueue styles.
*/
public function about_theme_styles( $hook ) {
global $sophia_after_dark_theme_version;
wp_enqueue_style( 'mt-theme-review-notice', get_template_directory_uri() . '/inc/theme-settings/assets/css/theme-review-notice.css', array(), esc_attr( $sophia_after_dark_theme_version ) );
if ( 'appearance_page_sophia-after-dark-settings' != $hook && 'themes.php' != $hook ) {
return;
}
wp_enqueue_style( 'mt-theme-settings-style', get_template_directory_uri() . '/inc/theme-settings/assets/css/settings.css', array(), $sophia_after_dark_theme_version );
}
/**
* Enqueue scripts.
*/
public function about_theme_scripts( $hook ) {
global $sophia_after_dark_theme_version;
$theme_notice_option = get_option( 'sophia_after_dark_admin_notice_welcome' );
if ( $theme_notice_option ) {
wp_enqueue_script( 'mt-theme-review-notice', get_template_directory_uri() . '/inc/theme-settings/assets/js/theme-review-notice.js', array( 'jquery' ), esc_attr( $sophia_after_dark_theme_version ) );
$demo_importer_plugin = WP_PLUGIN_DIR . '/mysterythemes-demo-importer/mysterythemes-demo-importer.php';
if ( file_exists( $demo_importer_plugin ) && !is_plugin_active( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php' ) ) {
$action = 'activate';
} elseif ( !file_exists( $demo_importer_plugin ) ) {
$action = 'install';
} else {
$action = 'redirect';
}
wp_localize_script( 'mt-theme-review-notice', 'mtaboutObject', array(
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
'_wpnonce' => wp_create_nonce( 'sophia_after_dark_admin_plugin_install_nonce' ),
'action' => esc_html( $action )
));
}
if ( 'appearance_page_sophia-after-dark-settings' != $hook ) {
return;
}
$activated_plugins = apply_filters( 'sophia_after_dark_active_plugins', get_option('active_plugins') );
$demo_import_plugin = in_array( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php', $activated_plugins );
if ( $demo_import_plugin ) {
return;
}
wp_enqueue_script( 'mt-theme-settings-script', get_template_directory_uri() . '/inc/theme-settings/assets/js/settings.js', array( 'jquery' ), esc_attr( $sophia_after_dark_theme_version ) );
$demo_importer_plugin = WP_PLUGIN_DIR . '/mysterythemes-demo-importer/mysterythemes-demo-importer.php';
if ( file_exists( $demo_importer_plugin ) && !is_plugin_active( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php' ) ) {
$action = 'activate';
} else {
$action = 'install';
}
wp_localize_script( 'mt-theme-settings-script', 'mtaboutObject', array(
'ajax_url' => esc_url( admin_url( 'admin-ajax.php' ) ),
'_wpnonce' => wp_create_nonce( 'sophia_after_dark_admin_plugin_install_nonce' ),
'action' => esc_html( $action )
));
}
/**
* Add admin notice.
*/
public function sophia_after_dark_admin_notice() {
if ( isset( $_GET['activated'] ) ) {
update_option( 'sophia_after_dark_admin_notice_welcome', true );
}
$theme_notice_option = get_option( 'sophia_after_dark_admin_notice_welcome' );
// Let's bail on theme activation.
if ( $theme_notice_option ) {
add_action( 'admin_notices', array( $this, 'welcome_notice' ) );
}
}
/**
* Hide a notice if the GET variable is set.
*/
public static function sophia_after_dark_hide_notices() {
if ( isset( $_GET['sophia-after-dark-hide-notice'] ) && isset( $_GET['_sophia_after_dark_notice_nonce'] ) ) {
if ( ! wp_verify_nonce( $_GET['_sophia_after_dark_notice_nonce'], 'sophia_after_dark_hide_notices_nonce' ) ) {
wp_die( esc_html__( 'Action failed. Please refresh the page and retry.', 'sophia-after-dark' ) );
}
if ( ! current_user_can( 'manage_options' ) ) {
wp_die( esc_html__( 'Cheat in &#8217; huh?', 'sophia-after-dark' ) );
}
$hide_notice = sanitize_text_field( $_GET['sophia-after-dark-hide-notice'] );
update_option( 'sophia_after_dark_admin_notice_' . $hide_notice, false );
}
}
/**
* Show welcome notice.
*/
public function welcome_notice() {
$theme = wp_get_theme( get_template() );
$theme_name = $theme->get( 'Name' );
?>
<div id="mt-theme-message" class="updated notice sophia-after-dark-message">
<a class="sophia-after-dark-message-close notice-dismiss" href="<?php echo esc_url( wp_nonce_url( remove_query_arg( array( 'activated' ), add_query_arg( 'sophia-after-dark-hide-notice', 'welcome' ) ), 'sophia_after_dark_hide_notices_nonce', '_sophia_after_dark_notice_nonce' ) ); ?>">
<span class="screen-reader-text"><?php esc_html_e( 'Dismiss this notice.', 'sophia-after-dark' ); ?>
</a>
<h2 class="welcome-title"><?php printf( esc_html__( 'Welcome to %s', 'sophia-after-dark' ), $theme_name ); ?></h2>
<p>
<?php printf( esc_html__( 'Welcome! Thank you for choosing %1$s ! To fully take advantage of the best our theme can offer please make sure you visit our %2$s theme settings page %3$s.', 'sophia-after-dark' ), '<strong>'. esc_html( $theme_name ).'</strong>', '<a href="' . esc_url( admin_url( 'themes.php?page=sophia-after-dark-settings' ) ) . '">', '</a>' ); ?>
</p>
<p>
<?php printf( esc_html__( 'Clicking get started will process to installation of %1$s Mystery Themes Demo Importer %2$s Plugin in your dashboard. After success it will redirect to the theme settings page.', 'sophia-after-dark' ), '<strong>', '</strong>' ); ?>
</p>
<div class="submit">
<button class="mt-get-started button button-primary button-hero" data-done="<?php esc_attr_e( 'Done!', 'sophia-after-dark' ); ?>" data-process="<?php esc_attr_e( 'Processing', 'sophia-after-dark' ); ?>" data-redirect="<?php echo esc_url( wp_nonce_url( add_query_arg( 'sophia-after-dark-hide-notice', 'welcome', admin_url( 'themes.php' ).'?page=sophia-after-dark-settings&tab=demos' ) , 'sophia_after_dark_hide_notices_nonce', '_sophia_after_dark_notice_nonce' ) ); ?>">
<?php printf( esc_html__( 'Get started with %1$s', 'sophia-after-dark' ), esc_html( $theme_name ) ); ?>
</button>
</div>
</div><!-- #mt-theme-message -->
<?php
}
/**
* Intro text/links shown to all about pages.
*
* @access private
*/
private function intro() {
global $sophia_after_dark_theme_version;
$theme = wp_get_theme( get_template() );
$theme_name = $theme->get( 'Name' );
$author_uri = $theme->get( 'AuthorURI' );
$author_name = $theme->get( 'Author' );
// Drop minor version if 0
?>
<div class="sophia-after-dark-theme-info mt-theme-info mt-clearfix">
<h1 class="mt-about-title"> <?php echo esc_html( $theme_name ); ?> </h1>
<div class="author-credit">
<span class="theme-version"><?php printf( esc_html__( 'Version: %1$s', 'sophia-after-dark' ), $sophia_after_dark_theme_version ); ?></span>
<span class="author-link"><?php printf( wp_kses_post( 'By <a href="%1$s" target="_blank">%2$s</a>', 'sophia-after-dark' ), $author_uri, $author_name ); ?></span>
</div>
</div><!-- .sophia-after-dark-theme-info -->
<div class="mt-upgrader-pro">
<div class="mt-upgrade-title-wrap">
<h3 class="mt-upgrader-title"><?php esc_html_e( 'Upgrade to Premium Version', 'sophia-after-dark' ); ?></h3>
<div class="mt-upgrader-text"><?php esc_html_e( 'Upgrade to pro version for additional features and better supports.', 'sophia-after-dark' ); ?></div>
</div>
<div class="mt-upgrader-btn"> <a href="<?php echo esc_url( 'https://mysterythemes.com/wp-themes/color-blog-pro/' ); ?>" target="_blank" class="button button-primary"><?php esc_html_e( 'Unlock Features With Pro', 'sophia-after-dark' ); ?></a> </div>
</div><!-- .mt-upgrader-pro -->
<div class="mt-nav-tab-content-wrapper">
<div class="nav-tab-wrapper">
<a class="nav-tab <?php if ( empty( $_GET['tab'] ) && $_GET['page'] == 'sophia-after-dark-settings' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sophia-after-dark-settings' ), 'themes.php' ) ) ); ?>">
<span class="dashicons dashicons-admin-appearance"></span> <?php esc_html_e( 'Get Started', 'sophia-after-dark' ); ?>
</a>
<a class="nav-tab <?php if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'demos' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sophia-after-dark-settings', 'tab' => 'demos' ), 'themes.php' ) ) ); ?>">
<span class="dashicons dashicons-download"></span> <?php esc_html_e( 'Demos', 'sophia-after-dark' ); ?>
</a>
<a class="nav-tab <?php if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'free_vs_pro' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sophia-after-dark-settings', 'tab' => 'free_vs_pro' ), 'themes.php' ) ) ); ?>">
<span class="dashicons dashicons-dashboard"></span> <?php esc_html_e( 'Free Vs Pro', 'sophia-after-dark' ); ?>
</a>
<a class="nav-tab <?php if ( isset( $_GET['tab'] ) && $_GET['tab'] == 'changelog' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'sophia-after-dark-settings', 'tab' => 'changelog' ), 'themes.php' ) ) ); ?>">
<span class="dashicons dashicons-flag"></span> <?php esc_html_e( 'Changelog', 'sophia-after-dark' ); ?>
</a>
</div><!-- .nav-tab-wrapper -->
<?php
}
/**
* Get started screen page.
*/
public function get_started_screen() {
$current_tab = empty( $_GET['tab'] ) ? 'about' : sanitize_title( $_GET['tab'] );
// Look for a {$current_tab}_screen method.
if ( is_callable( array( $this, $current_tab . '_screen' ) ) ) {
return $this->{ $current_tab . '_screen' }();
}
// Fallback to about screen.
return $this->about_screen();
}
/**
* Output the about screen.
*/
public function about_screen() {
$theme = wp_get_theme( get_template() );
$theme_name = $theme->template;
$doc_url = 'https://docs.mysterythemes.com/color-blog';
$pro_theme_url = 'https://mysterythemes.com/wp-themes/color-blog-pro';
$support_url = 'https://wordpress.org/support/theme/'. $theme_name;
$review_url = 'https://wordpress.org/support/theme/'. $theme_name .'/reviews/?filter=5#new-post';
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<div class="mt-nav-content-wrap">
<div class="theme-features-wrap welcome-panel">
<h4><?php esc_html_e( 'Here are some useful links for you to get started', 'sophia-after-dark' ); ?></h4>
<div class="under-the-hood two-col">
<div class="col">
<h3><?php esc_html_e( 'Next Steps', 'sophia-after-dark' ); ?></h3>
<ul>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[section]=title_tagline' ); ?>" target="_blank" class="welcome-icon dashicons-visibility"><?php esc_html_e( 'Set site logo', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[section]=sophia_after_dark_section_site' ); ?>" target="_blank" class="welcome-icon dashicons-admin-page"><?php esc_html_e( 'Setup site layout', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[panel]=sophia_after_dark_header_panel' ); ?>" target="_blank" class="welcome-icon dashicons-editor-kitchensink"><?php esc_html_e( 'Manage header section', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[section]=sophia_after_dark_section_post_settings' ); ?>" target="_blank" class="welcome-icon dashicons-text-page"><?php esc_html_e( 'Single page sidebar layouts', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[section]=sophia_after_dark_section_social_icons' ); ?>" target="_blank" class="welcome-icon dashicons-networking"><?php esc_html_e( 'Manage Social Icons', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'customize.php' ).'?autofocus[section]=sophia_after_dark_section_footer_widget_area' ); ?>" target="_blank" class="welcome-icon dashicons-archive"><?php esc_html_e( 'Manage footer widget area', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>" target="_blank" class="welcome-icon welcome-menus"><?php esc_html_e( 'Manage menus', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>" target="_blank" class="welcome-icon welcome-widgets"><?php esc_html_e( 'Manage widgets', 'sophia-after-dark' ); ?></a>
</li>
</ul>
</div>
<div class="col">
<h3><?php esc_html_e( 'More Actions', 'sophia-after-dark' ); ?></h3>
<ul>
<li>
<a href="<?php echo esc_url( $doc_url ); ?>" target="_blank" class="welcome-icon dashicons-media-text"><?php esc_html_e( 'Documentation', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( $pro_theme_url ); ?>" target="_blank" class="welcome-icon dashicons-migrate"><?php esc_html_e( 'Premium version', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( $support_url ); ?>" target="_blank" class="welcome-icon dashicons-businesswoman"><?php esc_html_e( 'Need theme support?', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( $review_url ); ?>" target="_blank" class="welcome-icon dashicons-thumbs-up"><?php esc_html_e( 'Review theme', 'sophia-after-dark' ); ?></a>
</li>
<li>
<a href="<?php echo esc_url( 'https://wpallresources.com/' ); ?>" target="_blank" class="welcome-icon dashicons-admin-users"><?php esc_html_e( 'WP Tutorials', 'sophia-after-dark' ); ?></a>
</li>
</ul>
</div>
</div>
</div><!-- .theme-features-wrap -->
<div class="return-to-dashboard sophia-after-dark">
<?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?>
<a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>">
<?php is_multisite() ? esc_html_e( 'Return to Updates', 'sophia-after-dark' ) : esc_html_e( 'Return to Dashboard &rarr; Updates', 'sophia-after-dark' ); ?>
</a> |
<?php endif; ?>
<a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? esc_html_e( 'Go to Dashboard &rarr; Home', 'sophia-after-dark' ) : esc_html_e( 'Go to Dashboard', 'sophia-after-dark' ); ?></a>
</div><!-- .return-to-dashboard -->
</div><!-- .mt-nav-content-wrap -->
</div><!-- .mt-nav-tab-content-wrapper -->
</div><!-- .about-wrap -->
<?php
}
/**
* Output the more themes screen
*/
public function demos_screen() {
$activated_theme = get_template();
$demodata = get_transient( 'sophia_after_dark_demo_packages' );
if ( empty( $demodata ) || $demodata == false ) {
$demodata = get_transient( 'mtdi_theme_packages' );
if ( $demodata ) {
set_transient( 'sophia_after_dark_demo_packages', $demodata, WEEK_IN_SECONDS );
}
}
$activated_demo_check = get_option( 'mtdi_activated_check' );
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<div class="mt-nav-content-wrap">
<div class="mt-theme-demos rendered">
<?php $this->install_demo_import_plugin_popup(); ?>
<div class="demos wp-clearfix">
<?php
if ( isset( $demodata ) && empty( $demodata ) ) {
?>
<span class="configure-msg"><?php esc_html_e( 'No demos are configured for this theme, please contact the theme author', 'sophia-after-dark' ); ?></span>
<?php
} else {
?>
<div class="mt-demo-wrapper mtdi_gl js-ocdi-gl">
<div class="themes wp-clearfix">
<?php
foreach ( $demodata as $value ) {
$theme_name = $value['name'];
$theme_slug = $value['theme_slug'];
$preview_screenshot = $value['preview_screen'];
$demourl = $value['preview_url'];
if ( ( strpos( $activated_theme, 'pro' ) !== false && strpos( $theme_slug, 'pro' ) !== false ) || ( strpos( $activated_theme, 'pro' ) == false ) ) {
?>
<div class="mt-each-demo<?php if ( strpos( $activated_theme, 'pro' ) == false && strpos( $theme_slug, 'pro' ) !== false ) { echo ' mt-demo-pro'; } ?> theme mtdi_gl-item js-ocdi-gl-item" data-categories="ltrdemo" data-name="<?php echo esc_attr ( $theme_slug ); ?>" style="display: block;">
<div class="mtdi-preview-screenshot mtdi_gl-item-image-container">
<a href="<?php echo esc_url ( $demourl ); ?>" target="_blank">
<img class="mtdi_gl-item-image" src="<?php echo esc_url ( $preview_screenshot ); ?>" />
</a>
</div><!-- .mtdi-preview-screenshot -->
<div class="theme-id-container">
<h2 class="mtdi-theme-name theme-name" id="nokri-name"><?php echo esc_html ( $theme_name ); ?></h2>
<div class="mtdi-theme-actions theme-actions">
<?php
if ( $activated_demo_check != '' && $activated_demo_check == $theme_slug ) {
?>
<a class="button disabled button-primary hide-if-no-js" href="javascript:void(0);" data-name="<?php echo esc_attr ( $theme_name ); ?>" data-slug="<?php echo esc_attr ( $theme_slug ); ?>" aria-label="<?php printf ( esc_html__( 'Imported %1$s', 'sophia-after-dark' ), $theme_name ); ?>">
<?php esc_html_e( 'Imported', 'sophia-after-dark' ); ?>
</a>
<?php
} else {
if ( strpos( $activated_theme, 'pro' ) == false && strpos( $theme_slug, 'pro' ) !== false ) {
$s_slug = explode( "-pro", $theme_slug );
$purchaseurl = 'https://mysterythemes.com/wp-themes/'.$s_slug[0].'-pro';
?>
<a class="button button-primary mtdi-purchasenow" href="<?php echo esc_url( $purchaseurl ); ?>" target="_blank" data-name="<?php echo esc_attr ( $theme_name ); ?>" data-slug="<?php echo esc_attr ( $theme_slug ); ?>" aria-label="<?php printf ( esc_html__( 'Purchase Now', 'sophia-after-dark' ), $theme_name ); ?>">
<?php esc_html_e( 'Buy Now', 'sophia-after-dark' ); ?>
</a>
<?php
} else {
if ( is_plugin_active( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php' ) ) {
$button_tooltip = esc_html__( 'Click to import demo', 'sophia-after-dark' );
} else {
$button_tooltip = esc_html__( 'Demo importer plugin is not installed or activated', 'sophia-after-dark' );
}
?>
<a title="<?php echo esc_attr( $button_tooltip ); ?>" class="button button-primary hide-if-no-js mtdi-demo-import" href="javascript:void(0);" data-name="<?php echo esc_attr ( $theme_name ); ?>" data-slug="<?php echo esc_attr ( $theme_slug ); ?>" aria-label="<?php printf ( esc_attr__( 'Import %1$s', 'sophia-after-dark' ), $theme_name ); ?>">
<?php esc_html_e( 'Import', 'sophia-after-dark' ); ?>
</a>
<?php
}
}
?>
<a class="button preview install-demo-preview" target="_blank" href="<?php echo esc_url ( $demourl ); ?>">
<?php esc_html_e( 'View Demo', 'sophia-after-dark' ); ?>
</a>
</div><!-- .mtdi-theme-actions -->
</div><!-- .theme-id-container -->
</div><!-- .mtdi-each-demo -->
<?php
}
}
?>
</div><!-- .themes -->
</div><!-- .mtdi-demo-wrapper -->
<?php
}
?>
</div>
</div><!-- .theme-browser -->
</div><!-- .mt-nav-content-wrap -->
</div><!-- .mt-nav-tab-content-wrapper -->
</div><!-- .wrap.about-wrap -->
<?php
}
/**
* Output the changelog screen.
*/
public function changelog_screen() {
global $wp_filesystem;
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<div class="mt-nav-content-wrap">
<h4><?php esc_html_e( 'View changelog below:', 'sophia-after-dark' ); ?></h4>
<?php
$changelog_file = apply_filters( 'sophia_after_dark_changelog_file', get_template_directory() . '/readme.txt' );
// Check if the changelog file exists and is readable.
if ( $changelog_file && is_readable( $changelog_file ) ) {
WP_Filesystem();
$changelog = $wp_filesystem->get_contents( $changelog_file );
$changelog_list = $this->parse_changelog( $changelog );
echo wp_kses_post( $changelog_list );
}
?>
</div><!-- .mt-nav-content-wrap -->
</div><!-- .mt-nav-tab-content-wrapper -->
</div>
<?php
}
/**
* Parse changelog from readme file.
* @param string $content
* @return string
*/
private function parse_changelog( $content ) {
$matches = null;
$regexp = '~==\s*Changelog\s*==(.*)($)~Uis';
$changelog = '';
if ( preg_match( $regexp, $content, $matches ) ) {
$changes = explode( '\r\n', trim( $matches[1] ) );
$changelog .= '<pre class="changelog">';
foreach ( $changes as $index => $line ) {
$changelog .= wp_kses_post( preg_replace( '~(=\s*(\d+(?:\.\d+)+)\s*=|$)~Uis', '<span class="title">${1}</span>', $line ) );
}
$changelog .= '</pre>';
}
return wp_kses_post( $changelog );
}
/**
* Output the free vs pro screen.
*/
public function free_vs_pro_screen() {
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<div class="mt-nav-content-wrap">
<h4><?php esc_html_e( 'Upgrade to PRO version for more exciting features.', 'sophia-after-dark' ); ?></h4>
<table>
<thead>
<tr>
<th class="table-feature-title"><h3><?php esc_html_e( 'Features', 'sophia-after-dark' ); ?></h3></th>
<th><h3><?php esc_html_e( 'Sophia After Dark', 'sophia-after-dark' ); ?></h3></th>
<th><h3><?php esc_html_e( 'Color Blog Pro', 'sophia-after-dark' ); ?></h3></th>
</tr>
</thead>
<tbody>
<tr>
<td><h3><?php esc_html_e( 'Price', 'sophia-after-dark' ); ?></h3></td>
<td><?php esc_html_e( 'Free', 'sophia-after-dark' ); ?></td>
<td><?php esc_html_e( '$59.99', 'sophia-after-dark' ); ?></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Import Demo Data', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Pre Loaders Layouts', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Header Layouts', 'sophia-after-dark' ); ?></h3></td>
<td><?php esc_html_e( '1', 'sophia-after-dark' ); ?></td>
<td><?php esc_html_e( '4', 'sophia-after-dark' ); ?></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Multiple Layouts', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Google Fonts', 'sophia-after-dark' ); ?></h3></td>
<td><?php esc_html_e( '2', 'sophia-after-dark' );?></td>
<td><?php esc_html_e( '600+', 'sophia-after-dark' ); ?></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'WordPress Page Builder Compatible', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Custom 404 Page', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Typography Options', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'Footer Layout Options', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'WooCommerce Plugin Compatible', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td><h3><?php esc_html_e( 'GDPR Compatible', 'sophia-after-dark' ); ?></h3></td>
<td><span class="dashicons mt-dashicons-no"></span></td>
<td><span class="dashicons mt-dashicons-yes"></span></td>
</tr>
<tr>
<td></td>
<td></td>
<td class="btn-wrapper">
<a href="<?php echo esc_url( apply_filters( 'sophia-after-dark_theme_url', 'https://mysterythemes.com/wp-themes/color-blog-pro/' ) ); ?>" class="button button-primary" target="_blank"><?php esc_html_e( 'Buy Pro', 'sophia-after-dark' ); ?></a>
</td>
</tr>
</tbody>
</table>
</div><!-- .mt-nav-content-wrap -->
</div><!-- .mt-nav-tab-content-wrapper -->
</div><!-- .about-wrap -->
<?php
}
/**
* Set the required option value as needed for theme review notice.
*/
public function sophia_after_dark_theme_rating_notice() {
// Set the installed time in `sophia_after_dark_theme_installed_time` option table.
$option = get_option( 'sophia_after_dark_theme_installed_time' );
if ( ! $option ) {
update_option( 'sophia_after_dark_theme_installed_time', time() );
}
add_action( 'admin_notices', array( $this, 'sophia_after_dark_theme_review_notice' ), 0 );
add_action( 'admin_init', array( $this, 'sophia_after_dark_ignore_theme_review_notice' ), 0 );
add_action( 'admin_init', array( $this, 'sophia_after_dark_ignore_theme_review_notice_partially' ), 0 );
}
/**
* Display the theme review notice.
*/
public function sophia_after_dark_theme_review_notice() {
global $current_user;
$user_id = $current_user->ID;
$ignored_notice = get_user_meta( $user_id, 'sophia_after_dark_ignore_theme_review_notice', true );
$ignored_notice_partially = get_user_meta( $user_id, 'mt_sophia_after_dark_ignore_theme_review_notice_partially', true );
/**
* Return from notice display if:
*
* 1. The theme installed is less than 15 days ago.
* 2. If the user has ignored the message partially for 15 days.
* 3. Dismiss always if clicked on 'I Already Did' button.
*/
if ( ( get_option( 'sophia_after_dark_theme_installed_time' ) > strtotime( '- 15 days' ) ) || ( $ignored_notice_partially > time() ) || ( $ignored_notice ) ) {
return;
}
?>
<div class="notice updated theme-review-notice">
<p>
<?php
printf( esc_html__(
'Howdy, %1$s! It seems that you have been using this theme for more than 15 days. We hope you are happy with everything that the theme has to offer. If you can spare a minute, please help us by leaving a 5-star review on WordPress.org. By spreading the love, we can continue to develop new amazing features in the future, for free!', 'sophia-after-dark'
),
'<strong>' . esc_html( $current_user->display_name ) . '</strong>'
);
?>
</p>
<div class="links">
<a href="https://wordpress.org/support/theme/sophia-after-dark/reviews/?filter=5#new-post" class="btn button-primary" target="_blank">
<span class="dashicons dashicons-thumbs-up"></span>
<span><?php esc_html_e( 'Sure', 'sophia-after-dark' ); ?></span>
</a>
<a href="?mt_sophia_after_dark_ignore_theme_review_notice_partially=0" class="btn button-secondary">
<span class="dashicons dashicons-calendar"></span>
<span><?php esc_html_e( 'Maybe later', 'sophia-after-dark' ); ?></span>
</a>
<a href="?mt_sophia_after_dark_ignore_theme_review_notice=0" class="btn button-secondary">
<span class="dashicons dashicons-smiley"></span>
<span><?php esc_html_e( 'I already did', 'sophia-after-dark' ); ?></span>
</a>
<a href="<?php echo esc_url( 'https://wordpress.org/support/theme/sophia-after-dark/' ); ?>" class="btn button-secondary" target="_blank">
<span class="dashicons dashicons-edit"></span>
<span><?php esc_html_e( 'Got theme support question?', 'sophia-after-dark' ); ?></span>
</a>
</div>
<a class="notice-dismiss" href="?mt_sophia_after_dark_ignore_theme_review_notice_partially=0"></a>
</div>
<?php
}
/**
* Function to remove the theme review notice permanently as requested by the user.
*/
public function sophia_after_dark_ignore_theme_review_notice() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['mt_sophia_after_dark_ignore_theme_review_notice'] ) && '0' == $_GET['mt_sophia_after_dark_ignore_theme_review_notice'] ) {
add_user_meta( $user_id, 'sophia_after_dark_ignore_theme_review_notice', 'true', true );
}
}
/**
* Function to remove the theme review notice partially as requested by the user.
*/
public function sophia_after_dark_ignore_theme_review_notice_partially() {
global $current_user;
$user_id = $current_user->ID;
/* If user clicks to ignore the notice, add that to their user meta */
if ( isset( $_GET['mt_sophia_after_dark_ignore_theme_review_notice_partially'] ) && '0' == $_GET['mt_sophia_after_dark_ignore_theme_review_notice_partially'] ) {
update_user_meta( $user_id, 'mt_sophia_after_dark_ignore_theme_review_notice_partially', strtotime( '+ 7 days' ) );
}
}
/**
* Remove the data set after the theme has been switched to other theme.
*/
public function sophia_after_dark_theme_rating_notice_data_remove() {
global $current_user;
$user_id = $current_user->ID;
$theme_installed_time = get_option( 'sophia_after_dark_theme_installed_time' );
$ignored_notice = get_user_meta( $user_id, 'sophia_after_dark_ignore_theme_review_notice', true );
$ignored_notice_partially = get_user_meta( $user_id, 'mt_sophia_after_dark_ignore_theme_review_notice_partially', true );
// Delete options data.
if ( $theme_installed_time ) {
delete_option( 'sophia_after_dark_theme_installed_time' );
}
// Delete permanent notice remove data.
if ( $ignored_notice ) {
delete_user_meta( $user_id, 'sophia_after_dark_ignore_theme_review_notice' );
}
// Delete partial notice remove data.
if ( $ignored_notice_partially ) {
delete_user_meta( $user_id, 'mt_sophia_after_dark_ignore_theme_review_notice_partially' );
}
}
/**
* Display custom text on theme settings page
*
* @param string $text
*/
public function sophia_after_dark_admin_footer_text( $text ) {
$screen = get_current_screen();
if ( 'appearance_page_sophia-after-dark-settings' == $screen->id ) {
$theme = wp_get_theme( get_template() );
$theme_name = $theme->get( 'Name' );
$text = sprintf( __( 'If you like <strong>%1$s</strong> please leave us a %2$s rating. A huge thank you from <strong>Mystery Themes</strong> in advance &#128515!', 'sophia-after-dark' ), esc_html( $theme_name ), '<a href="https://wordpress.org/support/theme/sophia-after-dark/reviews/?filter=5#new-post" class="theme-rating" target="_blank">&#9733;&#9733;&#9733;&#9733;&#9733;</a>' );
}
return $text;
}
/**
* Popup alert for mystery themes demo importer plugin install.
*
* @since 1.0.7
*/
public function install_demo_import_plugin_popup() {
$demo_importer_plugin = WP_PLUGIN_DIR . '/mysterythemes-demo-importer/mysterythemes-demo-importer.php';
?>
<div id="mt-demo-import-plugin-popup">
<div class="mt-popup-inner-wrap">
<?php
if ( is_plugin_active( 'mysterythemes-demo-importer/mysterythemes-demo-importer.php' ) ) {
echo '<span class="mt-plugin-message">'.esc_html__( 'You can import available demos now!', 'sophia-after-dark' ).'</span>';
} else {
if ( ! file_exists( $demo_importer_plugin ) ) {
?>
<span class="mt-plugin-message"><?php esc_html_e( 'Mystery Themes Demo Importer Plugin is not installed!', 'sophia-after-dark' ); ?></span>
<a href="javascript:void(0)" class="mt-install-demo-import-plugin" data-process="<?php esc_attr_e( 'Installing & Activating', 'sophia-after-dark' ); ?>" data-done="<?php esc_attr_e( 'Installed & Activated', 'sophia-after-dark' ); ?>">
<?php esc_html_e( 'Install and Activate', 'sophia-after-dark' ); ?>
</a>
<?php
} else {
?>
<span class="mt-plugin-message"><?php esc_html_e( 'Mystery Themes Demo Importer Plugin is installed but not activated!', 'sophia-after-dark' ); ?></span>
<a href="javascript:void(0)" class="mt-activate-demo-import-plugin" data-process="<?php esc_attr_e( 'Activating', 'sophia-after-dark' ); ?>" data-done="<?php esc_attr_e( 'Activated', 'sophia-after-dark' ); ?>">
<?php esc_html_e( 'Activate Now', 'sophia-after-dark' ); ?>
</a>
<?php
}
}
?>
</div><!-- .mt-popup-inner-wrap -->
</div><!-- .mt-demo-import-plugin-popup -->
<?php
}
/**
* Activate Demo Importer Plugins Ajax Method
*
* @since 1.0.7
*/
public function activate_demo_importer_plugin() {
if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'sophia_after_dark_admin_plugin_install_nonce' ) ) {
die( 'This action was stopped for security purposes.' );
}
$result = activate_plugin( '/mysterythemes-demo-importer/mysterythemes-demo-importer.php' );
if ( is_wp_error( $result ) ) {
// Process Error
wp_send_json_error(
array(
'success' => false,
'message' => $result->get_error_message(),
)
);
} else {
wp_send_json_success(
array(
'success' => true,
'message' => __( 'Plugin Successfully Activated.', 'sophia-after-dark' ),
)
);
}
}
/**
* Activate Demo Importer Plugins Ajax Method
*
* @since 1.0.7
*/
function install_demo_importer_plugin() {
if ( ! wp_verify_nonce( $_POST['_wpnonce'], 'sophia_after_dark_admin_plugin_install_nonce' ) ) {
die( 'This action was stopped for security purposes.' );
}
if ( ! current_user_can( 'install_plugins' ) ) {
$status['message'] = __( 'Sorry, you are not allowed to install plugins on this site.', 'sophia-after-dark' );
wp_send_json_error( $status );
}
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$api = plugins_api(
'plugin_information',
array(
'slug' => esc_html( 'mysterythemes-demo-importer' ),
'fields' => array(
'sections' => false,
),
)
);
if ( is_wp_error( $api ) ) {
$status['message'] = $api->get_error_message();
wp_send_json_error( $status );
}
$status['pluginName'] = $api->name;
$skin = new WP_Ajax_Upgrader_Skin();
$upgrader = new Plugin_Upgrader( $skin );
$result = $upgrader->install( $api->download_link );
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
$status['debug'] = $skin->get_upgrade_messages();
}
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['message'] = $result->get_error_message();
wp_send_json_error( $status );
} elseif ( is_wp_error( $skin->result ) ) {
$status['errorCode'] = $skin->result->get_error_code();
$status['message'] = $skin->result->get_error_message();
wp_send_json_error( $status );
} elseif ( $skin->get_errors()->get_error_code() ) {
$status['message'] = $skin->get_error_messages();
wp_send_json_error( $status );
} elseif ( is_null( $result ) ) {
global $wp_filesystem;
$status['errorCode'] = 'unable_to_connect_to_filesystem';
$status['message'] = __( 'Unable to connect to the filesystem. Please confirm your credentials.', 'sophia-after-dark' );
// Pass through the error from WP_Filesystem if one was raised.
if ( $wp_filesystem instanceof WP_Filesystem_Base && is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) {
$status['message'] = esc_html( $wp_filesystem->errors->get_error_message() );
}
wp_send_json_error( $status );
}
if ( current_user_can( 'activate_plugin' ) ) {
$result = activate_plugin( '/mysterythemes-demo-importer/mysterythemes-demo-importer.php' );
if ( is_wp_error( $result ) ) {
$status['errorCode'] = $result->get_error_code();
$status['message'] = $result->get_error_message();
wp_send_json_error( $status );
}
}
$status['message'] = esc_html__( 'Plugin installed successfully', 'sophia-after-dark' );
wp_send_json_success( $status );
}
}
endif;
return new sophia_after_dark_Settings();