first commit without licensingg

This commit is contained in:
kbe
2025-08-21 14:40:43 +02:00
commit fa8d4e58a4
130 changed files with 82163 additions and 0 deletions

View File

@@ -0,0 +1,365 @@
/* Theme Dashboard */
.cs-theme-dashboard .button {
transition: 0.25s;
box-shadow: none !important;
outline: none !important;
}
.cs-theme-dashboard .cs-button {
padding: 6px 22px;
}
.cs-theme-dashboard .cs-button:not(:hover) {
background: transparent;
}
.cs-theme-dashboard .cs-button-primary {
padding: 6px 22px;
}
.cs-theme-dashboard .cs-separator {
background: #F0F0F0;
height: 1px;
margin-bottom: 2rem;
}
.cs-theme-dashboard .cs-title {
font-weight: 600;
font-size: 0.8125rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-heading {
font-weight: 600;
font-size: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-description {
font-size: 0.8125rem;
color: #697B96;
}
.cs-theme-dashboard .cs-description:not(:first-child) {
margin-top: 1rem;
}
.cs-theme-dashboard .cs-badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0px 6px;
border-radius: 9px;
text-transform: uppercase;
}
.cs-theme-dashboard .cs-badge-success {
background: #DEF3ED;
color: #3FB28F;
}
.cs-theme-dashboard .cs-badge-info {
background: #007CBA;
color: #FFFFFF;
}
.cs-theme-dashboard .cs-badge-warning {
background: #F8E4E4;
color: #F58787;
}
.cs-theme-dashboard .cs-header {
display: flex;
align-items: center;
justify-content: space-between;
background: #FFFFFF;
margin: 0 -20px 0 0;
margin-bottom: 20px;
padding: 0 24px;
}
.cs-theme-dashboard .cs-header .cs-header-left {
display: flex;
align-items: center;
height: 100%;
}
.cs-theme-dashboard .cs-header .cs-header-right {
display: flex;
align-items: center;
height: 100%;
}
.cs-theme-dashboard .cs-header .cs-header-col {
display: flex;
align-items: center;
border-left: 1px solid #f0f0f0;
padding: 0 24px;
height: 100%;
min-height: 60px;
}
.cs-theme-dashboard .cs-header .cs-header-col:first-child {
padding-right: 0;
}
.cs-theme-dashboard .cs-header .cs-header-col-logo {
border-left: none;
}
.cs-theme-dashboard .cs-header .cs-logo a {
display: inline-block;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1.25rem;
color: #000000;
text-decoration: none;
}
.cs-theme-dashboard .cs-header .cs-logo a:focus {
box-shadow: none;
}
.cs-theme-dashboard .cs-header .cs-link-documentation {
display: flex;
align-items: center;
text-decoration: none;
}
.cs-theme-dashboard .cs-header .cs-link-documentation:hover span {
text-decoration: underline;
}
.cs-theme-dashboard .cs-header .cs-link-documentation i {
display: flex;
align-items: center;
font-size: 1rem;
margin-right: 0.5rem;
}
.cs-theme-dashboard .cs-hero {
background: #FFFFFF;
display: flex;
border-radius: 2px;
margin-top: 20px;
}
.cs-theme-dashboard .cs-hero .cs-hero-hello {
margin-top: 1rem;
font-weight: 600;
font-size: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-hero-title {
margin-top: 1rem;
font-weight: 600;
font-size: 2rem;
line-height: 1.2;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-badge {
transform: translateY(-10px);
font-weight: normal;
font-size: 0.8125rem;
}
.cs-theme-dashboard .cs-hero .cs-hero-desc {
margin-top: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-hero-go {
margin-top: 1.5rem;
padding: 6px 22px;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
.cs-theme-dashboard .cs-hero .cs-hero-notion {
font-size: 0.75rem;
margin-top: 0.5rem;
color: #697B96;
}
.cs-theme-dashboard .cs-hero .cs-hero-warning {
margin-top: 0.5rem;
color: #dc3232;
}
.cs-theme-dashboard .cs-hero .cs-hero-content {
padding: 24px;
}
.cs-theme-dashboard .cs-hero .cs-hero-image {
display: none;
}
.cs-theme-dashboard .cs-hero .cs-hero-image span {
position: relative;
display: inline-block;
}
.cs-theme-dashboard .cs-hero .cs-hero-image img {
display: block;
zoom: 0.5;
}
@media (min-width: 1360px) {
.cs-theme-dashboard .cs-hero .cs-hero-image {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
}
.cs-theme-dashboard .cs-main {
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.cs-theme-dashboard .cs-main-content {
display: flex;
flex-direction: column;
flex: 1 0 100%;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-main-content .cs-hero {
margin-top: 0;
margin-bottom: 20px;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-main-content .form-table {
margin-top: 0;
}
.cs-theme-dashboard .cs-main-content .form-table th {
padding: 12px 0 12px 10px;
}
.cs-theme-dashboard .cs-main-content .form-table td {
padding: 12px 10px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-main-content {
flex: 1 0 calc(100% - 296px);
max-width: calc(100% - 296px);
width: 100%;
margin-left: 20px;
}
}
.cs-theme-dashboard .cs-main-sidebar {
flex: 1 0 100%;
max-width: 100%;
width: 100%;
margin-top: 20px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-main-sidebar {
flex: 1 0 276px;
max-width: 276px;
width: 100%;
margin-top: 0;
}
}
.cs-theme-dashboard .cs-panel {
display: flex;
flex-direction: column;
background: #FFFFFF;
border-radius: 0px 0px 2px 2px;
border-radius: 2px;
}
.cs-theme-dashboard .cs-panel + .cs-panel {
margin-top: 20px;
}
.cs-theme-dashboard .cs-panel .cs-panel-head {
padding: 16px 24px;
border-bottom: 1px solid #f0f0f0;
}
.cs-theme-dashboard .cs-panel .cs-panel-title {
font-size: 0.8125rem;
margin: 0;
}
.cs-theme-dashboard .cs-panel .cs-panel-content {
height: 100%;
padding: 24px;
}
.cs-theme-dashboard .cs-panel-tabs {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs {
flex-direction: row;
}
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab {
margin: -16px 0;
margin-left: 40px;
border-bottom: 4px solid transparent;
}
}
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
display: block;
padding: 14px 16px;
color: inherit;
text-decoration: none;
box-shadow: none;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
display: inline-block;
padding: 16px 0;
}
}
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
background: #f8f9fd;
border-radius: 2px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
background: transparent;
border-color: #007CBA;
border-radius: 0;
}
}
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab {
display: none;
}
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab.cs-panel-tab-active {
display: block;
}
.cs-theme-dashboard .cs-panel-general {
flex: 1;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-panel-support .cs-button-wrap {
margin-top: auto;
padding-top: 1rem;
}
.cs-theme-dashboard .cs-panel-community .cs-button-wrap {
margin-top: auto;
padding-top: 1rem;
}
.cs-theme-dashboard .cs-panel-changelog .cs-panel-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link {
display: inline-block;
margin-top: 1rem;
text-decoration: none;
}
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link:hover {
text-decoration: underline;
}
.notice.cs-theme-dashboard-notice {
margin: 20px 0;
border: none;
box-shadow: none;
padding: 0 !important;
background: transparent;
}
.notice.cs-theme-dashboard-notice + .notice.updated {
display: none;
}
.cs-activation .cs-activation-postbox {
margin-right: -24px;
margin-left: -2px;
padding-right: 24px;
padding-left: 24px;
}
.cs-activation .cs-activation-postbox + .cs-activation-postbox {
border-top: 1px solid #f0f0f0;
margin-top: 2rem;
padding-top: 1rem;
}
.cs-activation .cs-theme-license-msg {
font-size: 14px;
margin-bottom: 0;
}
.cs-activation .cs-theme-license-form {
max-width: 864px;
}
.cs-activation .cs-theme-license-updates {
display: flex;
}
.cs-activation .cs-theme-license-newsletter {
margin: 10px 0 0 15px;
}
.cs-activation .cs-theme-license-supported_until {
color: red;
}
/*# sourceMappingURL=theme-dashboard.css.map */

View File

@@ -0,0 +1,365 @@
/* Theme Dashboard */
.cs-theme-dashboard .button {
transition: 0.25s;
box-shadow: none !important;
outline: none !important;
}
.cs-theme-dashboard .cs-button {
padding: 6px 22px;
}
.cs-theme-dashboard .cs-button:not(:hover) {
background: transparent;
}
.cs-theme-dashboard .cs-button-primary {
padding: 6px 22px;
}
.cs-theme-dashboard .cs-separator {
background: #F0F0F0;
height: 1px;
margin-bottom: 2rem;
}
.cs-theme-dashboard .cs-title {
font-weight: 600;
font-size: 0.8125rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-heading {
font-weight: 600;
font-size: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-description {
font-size: 0.8125rem;
color: #697B96;
}
.cs-theme-dashboard .cs-description:not(:first-child) {
margin-top: 1rem;
}
.cs-theme-dashboard .cs-badge {
display: inline-flex;
align-items: center;
justify-content: center;
padding: 0px 6px;
border-radius: 9px;
text-transform: uppercase;
}
.cs-theme-dashboard .cs-badge-success {
background: #DEF3ED;
color: #3FB28F;
}
.cs-theme-dashboard .cs-badge-info {
background: #007CBA;
color: #FFFFFF;
}
.cs-theme-dashboard .cs-badge-warning {
background: #F8E4E4;
color: #F58787;
}
.cs-theme-dashboard .cs-header {
display: flex;
align-items: center;
justify-content: space-between;
background: #FFFFFF;
margin: 0 0 0 -20px;
margin-bottom: 20px;
padding: 0 24px;
}
.cs-theme-dashboard .cs-header .cs-header-left {
display: flex;
align-items: center;
height: 100%;
}
.cs-theme-dashboard .cs-header .cs-header-right {
display: flex;
align-items: center;
height: 100%;
}
.cs-theme-dashboard .cs-header .cs-header-col {
display: flex;
align-items: center;
border-right: 1px solid #f0f0f0;
padding: 0 24px;
height: 100%;
min-height: 60px;
}
.cs-theme-dashboard .cs-header .cs-header-col:first-child {
padding-left: 0;
}
.cs-theme-dashboard .cs-header .cs-header-col-logo {
border-right: none;
}
.cs-theme-dashboard .cs-header .cs-logo a {
display: inline-block;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
font-size: 1.25rem;
color: #000000;
text-decoration: none;
}
.cs-theme-dashboard .cs-header .cs-logo a:focus {
box-shadow: none;
}
.cs-theme-dashboard .cs-header .cs-link-documentation {
display: flex;
align-items: center;
text-decoration: none;
}
.cs-theme-dashboard .cs-header .cs-link-documentation:hover span {
text-decoration: underline;
}
.cs-theme-dashboard .cs-header .cs-link-documentation i {
display: flex;
align-items: center;
font-size: 1rem;
margin-left: 0.5rem;
}
.cs-theme-dashboard .cs-hero {
background: #FFFFFF;
display: flex;
border-radius: 2px;
margin-top: 20px;
}
.cs-theme-dashboard .cs-hero .cs-hero-hello {
margin-top: 1rem;
font-weight: 600;
font-size: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-hero-title {
margin-top: 1rem;
font-weight: 600;
font-size: 2rem;
line-height: 1.2;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-badge {
transform: translateY(-10px);
font-weight: normal;
font-size: 0.8125rem;
}
.cs-theme-dashboard .cs-hero .cs-hero-desc {
margin-top: 1rem;
color: #1E1E1E;
}
.cs-theme-dashboard .cs-hero .cs-hero-go {
margin-top: 1.5rem;
padding: 6px 22px;
}
@keyframes spin {
100% {
transform: rotate(360deg);
}
}
.cs-theme-dashboard .cs-hero .cs-hero-notion {
font-size: 0.75rem;
margin-top: 0.5rem;
color: #697B96;
}
.cs-theme-dashboard .cs-hero .cs-hero-warning {
margin-top: 0.5rem;
color: #dc3232;
}
.cs-theme-dashboard .cs-hero .cs-hero-content {
padding: 24px;
}
.cs-theme-dashboard .cs-hero .cs-hero-image {
display: none;
}
.cs-theme-dashboard .cs-hero .cs-hero-image span {
position: relative;
display: inline-block;
}
.cs-theme-dashboard .cs-hero .cs-hero-image img {
display: block;
zoom: 0.5;
}
@media (min-width: 1360px) {
.cs-theme-dashboard .cs-hero .cs-hero-image {
display: flex;
flex-direction: column;
justify-content: flex-end;
}
}
.cs-theme-dashboard .cs-main {
display: flex;
flex-wrap: wrap;
margin-top: 20px;
}
.cs-theme-dashboard .cs-main-content {
display: flex;
flex-direction: column;
flex: 1 0 100%;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-main-content .cs-hero {
margin-top: 0;
margin-bottom: 20px;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-main-content .form-table {
margin-top: 0;
}
.cs-theme-dashboard .cs-main-content .form-table th {
padding: 12px 10px 12px 0;
}
.cs-theme-dashboard .cs-main-content .form-table td {
padding: 12px 10px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-main-content {
flex: 1 0 calc(100% - 296px);
max-width: calc(100% - 296px);
width: 100%;
margin-right: 20px;
}
}
.cs-theme-dashboard .cs-main-sidebar {
flex: 1 0 100%;
max-width: 100%;
width: 100%;
margin-top: 20px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-main-sidebar {
flex: 1 0 276px;
max-width: 276px;
width: 100%;
margin-top: 0;
}
}
.cs-theme-dashboard .cs-panel {
display: flex;
flex-direction: column;
background: #FFFFFF;
border-radius: 0px 0px 2px 2px;
border-radius: 2px;
}
.cs-theme-dashboard .cs-panel + .cs-panel {
margin-top: 20px;
}
.cs-theme-dashboard .cs-panel .cs-panel-head {
padding: 16px 24px;
border-bottom: 1px solid #f0f0f0;
}
.cs-theme-dashboard .cs-panel .cs-panel-title {
font-size: 0.8125rem;
margin: 0;
}
.cs-theme-dashboard .cs-panel .cs-panel-content {
height: 100%;
padding: 24px;
}
.cs-theme-dashboard .cs-panel-tabs {
display: flex;
flex-direction: column;
flex-wrap: wrap;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs {
flex-direction: row;
}
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab {
margin: -16px 0;
margin-right: 40px;
border-bottom: 4px solid transparent;
}
}
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
display: block;
padding: 14px 16px;
color: inherit;
text-decoration: none;
box-shadow: none;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab a {
display: inline-block;
padding: 16px 0;
}
}
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
background: #f8f9fd;
border-radius: 2px;
}
@media (min-width: 960px) {
.cs-theme-dashboard .cs-panel-tabs .cs-panel-tab-active {
background: transparent;
border-color: #007CBA;
border-radius: 0;
}
}
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab {
display: none;
}
.cs-theme-dashboard .cs-panel-content-tabs .cs-panel-tab.cs-panel-tab-active {
display: block;
}
.cs-theme-dashboard .cs-panel-general {
flex: 1;
max-width: 100%;
width: 100%;
}
.cs-theme-dashboard .cs-panel-support .cs-button-wrap {
margin-top: auto;
padding-top: 1rem;
}
.cs-theme-dashboard .cs-panel-community .cs-button-wrap {
margin-top: auto;
padding-top: 1rem;
}
.cs-theme-dashboard .cs-panel-changelog .cs-panel-head {
display: flex;
align-items: center;
justify-content: space-between;
}
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link {
display: inline-block;
margin-top: 1rem;
text-decoration: none;
}
.cs-theme-dashboard .cs-panel-changelog .cs-changelog-link:hover {
text-decoration: underline;
}
.notice.cs-theme-dashboard-notice {
margin: 20px 0;
border: none;
box-shadow: none;
padding: 0 !important;
background: transparent;
}
.notice.cs-theme-dashboard-notice + .notice.updated {
display: none;
}
.cs-activation .cs-activation-postbox {
margin-left: -24px;
margin-right: -2px;
padding-left: 24px;
padding-right: 24px;
}
.cs-activation .cs-activation-postbox + .cs-activation-postbox {
border-top: 1px solid #f0f0f0;
margin-top: 2rem;
padding-top: 1rem;
}
.cs-activation .cs-theme-license-msg {
font-size: 14px;
margin-bottom: 0;
}
.cs-activation .cs-theme-license-form {
max-width: 864px;
}
.cs-activation .cs-theme-license-updates {
display: flex;
}
.cs-activation .cs-theme-license-newsletter {
margin: 10px 15px 0 0;
}
.cs-activation .cs-theme-license-supported_until {
color: red;
}
/*# sourceMappingURL=theme-dashboard.css.map */

View File

@@ -0,0 +1,53 @@
( function( $ ) {
"use strict";
/** ----------------------------------------------------------------------------
* Theme Dashboard */
var cscoThemeDashboard = {};
( function() {
var $this;
cscoThemeDashboard = {
/** Initialize */
init: function( e ) {
$this = cscoThemeDashboard;
// Init events.
$this.events( e );
},
/** Events */
events: function( e ) {
$( document ).on( 'click', '.cs-panel-tabs .cs-panel-tab a', function( e ) {
$this.activePanel( e, this );
});
},
/** Active Panel */
activePanel: function( e, object ) {
let $index = $( object ).closest( '.cs-panel-tab' ).index();
// Set location.
window.history.replaceState( '', '', $( object ).attr( 'href' ) );
// Nav Tabs.
$( object ).closest( '.cs-panel-tab' ).addClass( 'cs-panel-tab-active' ).siblings().removeClass( 'cs-panel-tab-active' );
// Content Tabs.
$( '.cs-panel-content-tabs .cs-panel-tab' ).eq( $index ).addClass( 'cs-panel-tab-active' ).siblings().removeClass( 'cs-panel-tab-active' );
e.preventDefault();
},
};
} )();
// Initialize.
cscoThemeDashboard.init();
} )( jQuery );

View File

@@ -0,0 +1,391 @@
<?php
/**
* Theme Dashboard
*
* @package Revision
*/
if ( ! class_exists( 'CSCO_Theme_Dashboard' ) ) {
/**
* Theme Dashboard Class.
*/
class CSCO_Theme_Dashboard {
/**
* The slug name to refer to this menu by.
*
* @var string $menu_slug The menu slug.
*/
public $menu_slug = 'theme-dashboard';
/**
* The settings of page.
*
* @var array $settings The settings.
*/
public $settings = array();
/**
* Constructor.
*/
public function __construct() {
$self = $this;
/** Include files */
if ( ! function_exists( 'get_plugin_data' ) ) {
require_once ABSPATH . 'wp-admin/includes/plugin.php';
}
/** Initialize actions */
add_action( 'init', array( $this, 'set_settings' ) );
add_action( 'init', function () use ( $self ) {
add_action( 'admin_menu', array( $self, 'add_menu_page' ) );
} );
add_action( 'admin_notices', array( $this, 'notice' ) );
add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ), 5 );
add_action( 'admin_enqueue_scripts', array( $this, 'notice_enqueue_scripts' ), 5 );
add_action( 'wp_ajax_csco_dashboard_dismissed_handler', array( $this, 'dismissed_handler' ) );
add_action( 'switch_theme', array( $this, 'reset_notices' ) );
add_action( 'after_switch_theme', array( $this, 'reset_notices' ) );
}
/**
* Add menu page
*/
public function add_menu_page() {
add_submenu_page( 'themes.php', esc_html__( 'Theme Dashboard', 'revision' ), esc_html__( 'Theme Dashboard', 'revision' ), 'manage_options', $this->menu_slug, array( $this, 'render_page' ), 1 );
}
/**
* Settings
*
* @param array $settings The settings.
*/
public function set_settings( $settings ) {
$theme = wp_get_theme( get_template() );
// Hero.
/* translators: Theme Name */
$this->settings['hero_title'] = sprintf( esc_html__( 'Welcome to %1$s', 'revision' ), $theme->get('Name') );
/* translators: Theme Name */
$this->settings['hero_desc'] = sprintf( esc_html__( '%1$s is now installed and activated. To help you with the next step, we\'ve gathered together on this page all the resources you might need. We hope you enjoy using this theme.', 'revision' ), $theme->get('Name') );
$this->settings['hero_image'] = __return_false();
// Documentation.
$this->settings['documentation_link'] = sprintf( 'https://codesupply.co/documentation/%s/', $theme->get('TextDomain') );
// Changelog.
$this->settings['changelog_link'] = sprintf( 'https://codesupply.co/documentation/%s/changelog/', $theme->get('TextDomain') );
// Support.
$this->settings['support_link'] = 'https://codesupply.co/support/';
// Community.
$this->settings['community_link'] = 'https://www.facebook.com/codesupplyco/';
}
/**
* Render Hero
*
* @param string $location The location.
*/
public function render_hero( $location = null ) {
global $pagenow;
$theme = wp_get_theme( get_template() );
$screen = get_current_screen();
?>
<div class="cs-hero">
<div class="cs-hero-content">
<div class="cs-hero-hello">
<?php esc_html_e( 'Hello, ', 'revision' ); ?>
<?php
$current_user = wp_get_current_user();
echo esc_html( $current_user->display_name );
?>
<?php esc_html_e( '👋🏻', 'revision' ); ?>
</div>
<div class="cs-hero-title">
<?php echo wp_kses( $this->settings['hero_title'], 'content' ); ?>
</div>
<?php if ( isset( $this->settings['hero_desc'] ) && $this->settings['hero_desc'] ) { ?>
<div class="cs-hero-desc">
<?php echo wp_kses( $this->settings['hero_desc'], 'content' ); ?>
</div>
<?php } ?>
<a href="<?php echo esc_url( admin_url( '/themes.php?page=theme-demos' ) ); ?>" class="cs-hero-go button button-primary">
<?php esc_html_e( 'Go to Theme Demos', 'revision' ); ?>
</a>
</div>
<?php if ( isset( $this->settings['hero_image'] ) && $this->settings['hero_image'] ) { ?>
<div class="cs-hero-image">
<span>
<img src="<?php echo esc_url( $this->settings['hero_image'] ); ?>">
</span>
</div>
<?php } ?>
</div>
<?php
}
/**
* Render page
*/
public function render_page() {
?>
<div class="cs-wrap cs-theme-dashboard">
<div class="cs-header">
<div class="cs-header-left">
<div class="cs-header-col cs-header-col-logo">
<div class="cs-logo">
<a target="_blank" href="<?php echo esc_url( 'https://codesupply.co/' ); ?>">
Code Supply Co.
</a>
</div>
</div>
</div>
<div class="cs-header-right">
<a href="<?php echo esc_url( $this->settings['documentation_link'] ); ?>" class="cs-link-documentation" target="_blank">
<span><?php esc_html_e( 'Documentation', 'revision' ); ?></span>
<i class="dashicons dashicons-external"></i>
</a>
</div>
</div>
<div class="wrap">
<h1 class="hidden"><?php esc_html_e( 'Theme Dashboard', 'revision' ); ?></h1>
<div class="cs-main">
<div class="cs-main-content">
<?php $this->render_hero(); ?>
<?php
$dashboard_tabs = apply_filters( 'csco_theme_dashboard_tabs', array() );
if ( $dashboard_tabs ) {
// Sort priority.
usort( $dashboard_tabs, function ( $item1, $item2 ) {
if ( $item1['priority'] === $item2['priority'] ) {
return 0;
}
return $item1['priority'] < $item2['priority'] ? -1 : 1;
});
// Set active tab.
$active_tab = isset( $_GET['tab'] ) ? esc_attr( $_GET['tab'] ) : $dashboard_tabs[0]['slug']; // phpcs:ignore.
?>
<div class="cs-panel cs-panel-general">
<div class="cs-panel-head cs-panel-tabs">
<?php
foreach ( $dashboard_tabs as $tab_data ) {
$tab_url = add_query_arg( array(
'page' => $this->menu_slug,
'tab' => $tab_data['slug'],
), admin_url( 'themes.php' ) );
$tab_status = __return_empty_string();
if ( $active_tab === $tab_data['slug'] ) {
$tab_status = 'cs-panel-tab-active';
}
?>
<div class="cs-panel-tab <?php echo esc_attr( $tab_status ); ?>">
<h3 class="cs-panel-title">
<a href="<?php echo esc_url( $tab_url ); ?>">
<?php echo esc_html( $tab_data['label'] ); ?>
</a>
</h3>
</div>
<?php
}
?>
</div>
<div class="cs-panel-content cs-panel-content-tabs">
<?php
foreach ( $dashboard_tabs as $tab_data ) {
$tab_status = __return_empty_string();
if ( $active_tab === $tab_data['slug'] ) {
$tab_status = 'cs-panel-tab-active';
}
?>
<div id="<?php echo esc_url( $tab_data['slug'] ); ?>" class="cs-panel-tab <?php echo esc_attr( $tab_status ); ?>">
<?php call_user_func( 'printf', '%s', $tab_data['content'] ); ?>
</div>
<?php
}
?>
</div>
</div>
<?php } ?>
</div>
<div class="cs-main-sidebar">
<div class="cs-panel cs-panel-changelog">
<div class="cs-panel-head">
<h3 class="cs-panel-title"><?php esc_html_e( 'Changelog', 'revision' ); ?></h3>
</div>
<div class="cs-panel-content">
<div class="cs-description"><?php esc_html_e( 'Keep informed with the latest changes about each theme.', 'revision' ); ?></div>
<a href="<?php echo esc_url( $this->settings['changelog_link'] ); ?>" class="cs-changelog-link" target="_blank">
<?php echo esc_html_e( 'See the Changelog', 'revision' ); ?>
</a>
</div>
</div>
<div class="cs-panel cs-panel-support">
<div class="cs-panel-head">
<h3 class="cs-panel-title"><?php esc_html_e( 'Support', 'revision' ); ?></h3>
</div>
<div class="cs-panel-content">
<div class="cs-content-primary">
<div class="cs-title">
<?php echo esc_html__( 'Need help? We\'re here for you!', 'revision' ); ?>
</div>
<div class="cs-description"><?php esc_html_e( 'Have a question? Hit a bug? Get the help you need, when you need it from our friendly support staff.', 'revision' ); ?></div>
<div class="cs-button-wrap">
<a href="<?php echo esc_url( $this->settings['support_link'] ); ?>" class="cs-button button" target="_blank">
<?php echo esc_html_e( 'Get Support', 'revision' ); ?>
</a>
</div>
</div>
</div>
</div>
<div class="cs-panel cs-panel-community">
<div class="cs-panel-head">
<h3 class="cs-panel-title"><?php esc_html_e( 'Community', 'revision' ); ?></h3>
</div>
<div class="cs-panel-content">
<div class="cs-title">
<?php echo esc_html__( 'Join our Facebook community', 'revision' ); ?>
</div>
<div class="cs-description"><?php esc_html_e( 'Discuss products and ask for community support or help the community.', 'revision' ); ?></div>
<div class="cs-button-wrap">
<a href="<?php echo esc_url( $this->settings['community_link'] ); ?>" class="cs-button button" target="_blank">
<?php echo esc_html_e( 'Join Now', 'revision' ); ?>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php
}
/**
* Notice
*/
public function notice() {
global $pagenow;
$screen = get_current_screen();
if ( 'themes.php' === $pagenow && 'themes' === $screen->base ) {
$transient_name = sprintf( '%s_hero_notice', get_template() );
if ( ! get_transient( $transient_name ) ) {
?>
<div class="cs-dashboard-notice notice notice-success cs-theme-dashboard cs-theme-dashboard-notice is-dismissible" data-notice="<?php echo esc_attr( $transient_name ); ?>">
<?php $this->render_hero( 'themes' ); ?>
</div>
<?php
}
}
}
/**
* Purified from the database information about notification.
*/
public function reset_notices() {
delete_transient( sprintf( '%s_hero_notice', get_template() ) );
}
/**
* Dismissed handler
*/
public function dismissed_handler() {
wp_verify_nonce( null );
if ( isset( $_POST['notice'] ) ) { // Input var ok; sanitization ok.
set_transient( sanitize_text_field( wp_unslash( $_POST['notice'] ) ), true, 90 * DAY_IN_SECONDS ); // Input var ok.
}
}
/**
* Notice Enqunue Scripts
*
* @param string $page Current page.
*/
public function notice_enqueue_scripts( $page ) {
wp_enqueue_script( 'jquery' );
ob_start();
?>
<script>
jQuery(function($) {
$( document ).on( 'click', '.cs-dashboard-notice .notice-dismiss', function () {
jQuery.post( 'ajax_url', {
action: 'csco_dashboard_dismissed_handler',
notice: $( this ).closest( '.cs-dashboard-notice' ).data( 'notice' ),
});
} );
});
</script>
<?php
$script = str_replace( 'ajax_url', admin_url( 'admin-ajax.php' ), ob_get_clean() );
wp_add_inline_script( 'jquery', str_replace( array( '<script>', '</script>' ), '', $script ) );
}
/**
* This function will register scripts and styles for admin dashboard.
*
* @param string $page Current page.
*/
public function admin_enqueue_scripts( $page ) {
wp_enqueue_script( 'csco-theme-dashboard', get_theme_file_uri( '/core/theme-dashboard/assets/theme-dashboard.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/core/theme-dashboard/assets/theme-dashboard.js' ) ), true );
wp_localize_script( 'csco-theme-dashboard', 'cscoThemeDashboardConfig', array(
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( 'nonce' ),
'failed_message' => esc_html__( 'Something went wrong, contact support.', 'revision' ),
) );
// Styles.
wp_enqueue_style( 'csco-theme-dashboard', get_theme_file_uri( '/core/theme-dashboard/assets/theme-dashboard.css' ), array(), filemtime( get_theme_file_path( '/core/theme-dashboard/assets/theme-dashboard.css' ) ) );
// Add RTL support.
wp_style_add_data( 'revision', 'rtl', 'replace' );
}
}
new CSCO_Theme_Dashboard();
}