lightspeeddevelopment /
lsx
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * LSX functions and definitions - Welcome page. |
||
| 4 | * |
||
| 5 | * @package lsx |
||
| 6 | * @subpackage welcome-page |
||
| 7 | */ |
||
| 8 | |||
| 9 | if ( ! defined( 'ABSPATH' ) ) { |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 10 | exit; |
||
| 11 | } |
||
| 12 | |||
| 13 | if ( ! function_exists( 'lsx_activation_admin_notice_dismiss' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | /** |
||
| 16 | * Dismiss the admin notice (successful activation). |
||
| 17 | * |
||
| 18 | * @package lsx |
||
| 19 | * @subpackage welcome-page |
||
| 20 | */ |
||
| 21 | function lsx_activation_admin_notice_dismiss() { |
||
|
0 ignored issues
–
show
|
|||
| 22 | update_option( 'lsx-notice-dismissed', '1' ); |
||
| 23 | wp_die(); |
||
| 24 | } |
||
|
0 ignored issues
–
show
|
|||
| 25 | |||
| 26 | endif; |
||
| 27 | |||
| 28 | add_action( 'wp_ajax_lsx_dismiss_theme_notice', 'lsx_activation_admin_notice_dismiss' ); |
||
| 29 | |||
| 30 | if ( ! function_exists( 'lsx_activation_admin_notice' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 31 | |||
| 32 | /** |
||
| 33 | * Adds an admin notice upon successful activation. |
||
| 34 | * |
||
| 35 | * @package lsx |
||
| 36 | * @subpackage welcome-page |
||
| 37 | */ |
||
| 38 | function lsx_activation_admin_notice() { |
||
|
0 ignored issues
–
show
|
|||
| 39 | if ( empty( get_option( 'lsx-notice-dismissed' ) ) ) { |
||
|
0 ignored issues
–
show
|
|||
| 40 | add_action( 'admin_notices', 'lsx_welcome_admin_notice', 99 ); |
||
| 41 | } |
||
| 42 | } |
||
|
0 ignored issues
–
show
|
|||
| 43 | |||
| 44 | endif; |
||
| 45 | |||
| 46 | add_action( 'admin_notices', 'lsx_activation_admin_notice' ); |
||
| 47 | |||
| 48 | if ( ! function_exists( 'lsx_welcome_admin_notice' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 49 | |||
| 50 | /** |
||
| 51 | * Display an admin notice linking to the welcome screen. |
||
| 52 | * |
||
| 53 | * @package lsx |
||
| 54 | * @subpackage welcome-page |
||
| 55 | */ |
||
| 56 | function lsx_welcome_admin_notice() { |
||
|
0 ignored issues
–
show
|
|||
| 57 | ?> |
||
| 58 | <div class="lsx-theme-notice notice notice-success is-dismissible"> |
||
| 59 | <p> |
||
| 60 | <?php |
||
| 61 | printf( |
||
| 62 | /* Translators: 1: HTML open tag link, 2: HTML close tag link */ |
||
| 63 | esc_html_e( 'Thanks for choosing LSX! You can read hints and tips on how get the most out of your new theme on the %1$swelcome screen%2$s.', 'lsx' ), |
||
| 64 | '<a href="' . esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ) . '">', |
||
| 65 | '</a>' |
||
| 66 | ); |
||
| 67 | ?> |
||
| 68 | </p> |
||
| 69 | <p><a href="<?php echo esc_url( admin_url( 'themes.php?page=lsx-welcome' ) ); ?>" class="button" style="text-decoration: none;"><?php esc_html_e( 'Get started with LSX', 'lsx' ); ?></a></p> |
||
| 70 | </div> |
||
| 71 | <?php |
||
| 72 | } |
||
|
0 ignored issues
–
show
|
|||
| 73 | |||
| 74 | endif; |
||
| 75 | |||
| 76 | if ( ! function_exists( 'lsx_welcome_style' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 77 | |||
| 78 | /** |
||
| 79 | * Load welcome screen css. |
||
| 80 | * |
||
| 81 | * @package lsx |
||
| 82 | * @subpackage welcome-page |
||
| 83 | * |
||
| 84 | * @param string $hook_suffix the current page hook suffix. |
||
| 85 | */ |
||
| 86 | function lsx_welcome_style( $hook_suffix ) { |
||
|
0 ignored issues
–
show
|
|||
| 87 | if ( 'appearance_page_lsx-welcome' === $hook_suffix ) { |
||
|
0 ignored issues
–
show
|
|||
| 88 | wp_enqueue_style( 'lsx-welcome-screen-mailchimp', '//cdn-images.mailchimp.com/embedcode/classic-10_7.css', array(), LSX_VERSION ); |
||
| 89 | wp_enqueue_style( 'lsx-welcome-screen', get_template_directory_uri() . '/assets/css/admin/welcome.css', array( 'lsx-welcome-screen-mailchimp' ), LSX_VERSION ); |
||
| 90 | wp_style_add_data( 'lsx-welcome-screen', 'rtl', 'replace' ); |
||
| 91 | } |
||
| 92 | } |
||
|
0 ignored issues
–
show
|
|||
| 93 | |||
| 94 | endif; |
||
| 95 | |||
| 96 | add_action( 'admin_enqueue_scripts', 'lsx_welcome_style' ); |
||
| 97 | |||
| 98 | if ( ! function_exists( 'lsx_welcome_register_menu' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 99 | |||
| 100 | /** |
||
| 101 | * Creates the dashboard page. |
||
| 102 | * |
||
| 103 | * @package lsx |
||
| 104 | * @subpackage welcome-page |
||
| 105 | */ |
||
| 106 | function lsx_welcome_register_menu() { |
||
|
0 ignored issues
–
show
|
|||
| 107 | add_theme_page( 'LSX', 'LSX', 'activate_plugins', 'lsx-welcome', 'lsx_welcome_screen' ); |
||
| 108 | } |
||
|
0 ignored issues
–
show
|
|||
| 109 | |||
| 110 | endif; |
||
| 111 | |||
| 112 | add_action( 'admin_menu', 'lsx_welcome_register_menu' ); |
||
| 113 | |||
| 114 | if ( ! function_exists( 'lsx_welcome_screen' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 115 | |||
| 116 | /** |
||
| 117 | * The welcome screen. |
||
| 118 | * |
||
| 119 | * @package lsx |
||
| 120 | * @subpackage welcome-page |
||
| 121 | */ |
||
| 122 | function lsx_welcome_screen() { |
||
|
0 ignored issues
–
show
|
|||
| 123 | require_once ABSPATH . 'wp-load.php'; |
||
| 124 | require_once ABSPATH . 'wp-admin/admin.php'; |
||
| 125 | require_once ABSPATH . 'wp-admin/admin-header.php'; |
||
| 126 | ?> |
||
| 127 | <div class="wrap about-wrap"> |
||
| 128 | <?php |
||
| 129 | /** |
||
| 130 | * Functions hooked into lsx_welcome action |
||
| 131 | * |
||
| 132 | * @hooked lsx_welcome_header - 10 |
||
| 133 | * @hooked lsx_welcome_enhance - 20 |
||
| 134 | * @hooked lsx_welcome_footer - 30 |
||
| 135 | */ |
||
| 136 | do_action( 'lsx_welcome' ); |
||
| 137 | ?> |
||
| 138 | </div> |
||
| 139 | <?php |
||
| 140 | } |
||
|
0 ignored issues
–
show
|
|||
| 141 | |||
| 142 | endif; |
||
| 143 | |||
| 144 | if ( ! function_exists( 'lsx_welcome_header' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 145 | |||
| 146 | /** |
||
| 147 | * Welcome screen intro. |
||
| 148 | * |
||
| 149 | * @package lsx |
||
| 150 | * @subpackage welcome-page |
||
| 151 | */ |
||
| 152 | function lsx_welcome_header() { |
||
|
0 ignored issues
–
show
|
|||
| 153 | require_once get_template_directory() . '/includes/admin/welcome-screen/component-header.php'; |
||
| 154 | } |
||
|
0 ignored issues
–
show
|
|||
| 155 | |||
| 156 | endif; |
||
| 157 | |||
| 158 | add_action( 'lsx_welcome', 'lsx_welcome_header', 10 ); |
||
| 159 | |||
| 160 | if ( ! function_exists( 'lsx_welcome_enhance' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 161 | |||
| 162 | /** |
||
| 163 | * Welcome screen enhance section. |
||
| 164 | * |
||
| 165 | * @package lsx |
||
| 166 | * @subpackage welcome-page |
||
| 167 | */ |
||
| 168 | function lsx_welcome_enhance() { |
||
|
0 ignored issues
–
show
|
|||
| 169 | require_once get_template_directory() . '/includes/admin/welcome-screen/component-enhance.php'; |
||
| 170 | } |
||
|
0 ignored issues
–
show
|
|||
| 171 | |||
| 172 | endif; |
||
| 173 | |||
| 174 | add_action( 'lsx_welcome', 'lsx_welcome_enhance', 20 ); |
||
| 175 | |||
| 176 | if ( ! function_exists( 'lsx_welcome_footer' ) ) : |
||
|
0 ignored issues
–
show
|
|||
| 177 | |||
| 178 | /** |
||
| 179 | * Welcome screen contribute section. |
||
| 180 | * |
||
| 181 | * @package lsx |
||
| 182 | * @subpackage welcome-page |
||
| 183 | */ |
||
| 184 | function lsx_welcome_footer() { |
||
|
0 ignored issues
–
show
|
|||
| 185 | require_once get_template_directory() . '/includes/admin/welcome-screen/component-footer.php'; |
||
| 186 | } |
||
|
0 ignored issues
–
show
|
|||
| 187 | |||
| 188 | endif; |
||
| 189 | |||
| 190 | add_action( 'lsx_welcome', 'lsx_welcome_footer', 30 ); |
||
| 191 |