Cleanup: Remoción masiva de restos de WordPress y consolidación de archivos GKACHELE™
This commit is contained in:
46
gk-assets/themes/chromax/inc/admin/assets/css/admin.css
Normal file
46
gk-assets/themes/chromax/inc/admin/assets/css/admin.css
Normal file
@@ -0,0 +1,46 @@
|
||||
li#accordion-panel-chromax_typography_options {
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.chromax-getting-started-notice {
|
||||
padding: 20px 10px;
|
||||
display: -webkit-flex;
|
||||
display: -moz-flex;
|
||||
display: -ms-flex;
|
||||
display: -o-flex;
|
||||
display: flex;
|
||||
-ms-align-items: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.chromax-theme-screenshot img {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
border: 2px solid #ddd;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.chromax-theme-notice-content {
|
||||
width: 70%;
|
||||
display: block;
|
||||
vertical-align: top;
|
||||
padding: 0 20px;
|
||||
}
|
||||
|
||||
h2.chromax-notice-h2 {
|
||||
margin: 0 0 10px;
|
||||
font-weight: 400;
|
||||
line-height: 1.3;
|
||||
}
|
||||
|
||||
.chromax-push-down {
|
||||
padding-top: 15px;
|
||||
display: inline-block;
|
||||
padding-left: 8px;
|
||||
}
|
||||
|
||||
.chromax-button-padding.updating-message::before {
|
||||
margin-top: 12px;
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
( function( $ ){
|
||||
$( document ).ready( function(){
|
||||
$( '.chromax-btn-get-started' ).on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
$( this ).html( 'Processing.. Please wait' ).addClass( 'updating-message' );
|
||||
$.post( chromax_ajax_object.ajax_url, { 'action' : 'install_act_plugin' }, function( response ){
|
||||
location.href = 'customize.php?chromax_notice=dismiss-get-started';
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
$( document ).on( 'click', '.notice-get-started-class .notice-dismiss', function () {
|
||||
// Read the "data-notice" information to track which notice
|
||||
// is being dismissed and send it via AJAX
|
||||
var type = $( this ).closest( '.notice-get-started-class' ).data( 'notice' );
|
||||
// Make an AJAX call
|
||||
$.ajax( ajaxurl,
|
||||
{
|
||||
type: 'POST',
|
||||
data: {
|
||||
action: 'chromax_dismissed_notice_handler',
|
||||
type: type,
|
||||
}
|
||||
} );
|
||||
} );
|
||||
}( jQuery ) )
|
||||
97
gk-assets/themes/chromax/inc/admin/getting-started.php
Normal file
97
gk-assets/themes/chromax/inc/admin/getting-started.php
Normal file
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Get started notice
|
||||
*/
|
||||
|
||||
add_action( 'wp_ajax_chromax_dismissed_notice_handler', 'chromax_ajax_notice_handler' );
|
||||
|
||||
/**
|
||||
* AJAX handler to store the state of dismissible notices.
|
||||
*/
|
||||
function chromax_ajax_notice_handler() {
|
||||
if ( isset( $_POST['type'] ) ) {
|
||||
// Pick up the notice "type" - passed via jQuery (the "data-notice" attribute on the notice)
|
||||
$type = sanitize_text_field( wp_unslash( $_POST['type'] ) );
|
||||
// Store it in the options table
|
||||
update_option( 'dismissed-' . $type, TRUE );
|
||||
}
|
||||
}
|
||||
|
||||
function chromax_deprecated_hook_admin_notice() {
|
||||
// Check if it's been dismissed...
|
||||
if ( ! get_option('dismissed-get_started', FALSE ) ) {
|
||||
// Added the class "notice-get-started-class" so jQuery pick it up and pass via AJAX,
|
||||
// and added "data-notice" attribute in order to track multiple / different notices
|
||||
// multiple dismissible notice states ?>
|
||||
<div class="updated notice notice-get-started-class is-dismissible" data-notice="get_started">
|
||||
<div class="chromax-getting-started-notice clearfix">
|
||||
<div class="chromax-theme-screenshot">
|
||||
<img src="<?php echo esc_url( get_stylesheet_directory_uri() ); ?>/screenshot.png" class="screenshot" alt="<?php esc_attr_e( 'Theme Screenshot', 'chromax' ); ?>" />
|
||||
</div><!-- /.chromax-theme-screenshot -->
|
||||
<div class="chromax-theme-notice-content">
|
||||
<h2 class="chromax-notice-h2">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: welcome page link starting html tag, 2: welcome page link ending html tag. */
|
||||
esc_html__( 'Welcome! Thank you for choosing %1$s!', 'chromax' ), '<strong>'. wp_get_theme()->get('Name'). '</strong>' );
|
||||
?>
|
||||
</h2>
|
||||
|
||||
<p class="plugin-install-notice"><?php echo sprintf(__('To take full advantage of all the features of this theme, please install and activate the <strong>Desert Companion</strong> plugin, then enjoy this theme.', 'chromax')) ?></p>
|
||||
|
||||
<a class="chromax-btn-get-started button button-primary button-hero chromax-button-padding" href="#" data-name="" data-slug="">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: welcome page link starting html tag, 2: welcome page link ending html tag. */
|
||||
esc_html__( 'Get started with %1$s', 'chromax' ), '<strong>'. wp_get_theme()->get('Name'). '</strong>' );
|
||||
?>
|
||||
|
||||
</a><span class="chromax-push-down">
|
||||
<?php
|
||||
/* translators: %1$s: Anchor link start %2$s: Anchor link end */
|
||||
printf(
|
||||
'or %1$sCustomize theme%2$s</a></span>',
|
||||
'<a target="_blank" href="' . esc_url( admin_url( 'customize.php' ) ) . '">',
|
||||
'</a>'
|
||||
);
|
||||
?>
|
||||
</div><!-- /.chromax-theme-notice-content -->
|
||||
</div>
|
||||
</div>
|
||||
<?php }
|
||||
}
|
||||
|
||||
add_action( 'admin_notices', 'chromax_deprecated_hook_admin_notice' );
|
||||
|
||||
/**
|
||||
* Plugin installer
|
||||
*/
|
||||
|
||||
add_action( 'wp_ajax_install_act_plugin', 'chromax_admin_install_plugin' );
|
||||
|
||||
function chromax_admin_install_plugin() {
|
||||
/**
|
||||
* Install Plugin.
|
||||
*/
|
||||
include_once ABSPATH . '/wp-admin/includes/file.php';
|
||||
include_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
|
||||
include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
|
||||
|
||||
if ( ! file_exists( WP_PLUGIN_DIR . '/desert-companion' ) ) {
|
||||
$api = plugins_api( 'plugin_information', array(
|
||||
'slug' => sanitize_key( wp_unslash( 'desert-companion' ) ),
|
||||
'fields' => array(
|
||||
'sections' => false,
|
||||
),
|
||||
) );
|
||||
|
||||
$skin = new WP_Ajax_Upgrader_Skin();
|
||||
$upgrader = new Plugin_Upgrader( $skin );
|
||||
$result = $upgrader->install( $api->download_link );
|
||||
}
|
||||
|
||||
// Activate plugin.
|
||||
if ( current_user_can( 'activate_plugin' ) ) {
|
||||
$result = activate_plugin( 'desert-companion/desert-companion.php' );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user