$nr_actions_required,
'ajaxurl' => admin_url( 'admin-ajax.php' ),
'template_directory' => get_template_directory_uri(),
'no_required_actions_text' => __( 'Hooray! There are no required actions for you right now.','awada' )
) );
}
}
/**
* Load scripts for customizer page
* @since 1.8.2.4
*/
public function Awada_lite_welcome_scripts_for_customizer() {
wp_enqueue_style( 'awada-lite-welcome-screen-customizer-css', get_template_directory_uri() . '/inc/welcome-screen/css/welcome_customizer.css' );
wp_enqueue_script( 'awada-lite-welcome-screen-customizer-js', get_template_directory_uri() . '/inc/welcome-screen/js/welcome_customizer.js', array('jquery'), '20120206', true );
global $Awada_required_actions;
$nr_actions_required = 0;
wp_localize_script( 'awada-lite-welcome-screen-customizer-js', 'awadaLiteWelcomeScreenCustomizerObject', array(
'nr_actions_required' => $nr_actions_required,
'aboutpage' => esc_url( admin_url( 'themes.php?page=awada-welcome#actions_required' ) ),
'customizerpage' => esc_url( admin_url( 'customize.php#actions_required' ) ),
'themeinfo' => __('View Theme Info','awada'),
) );
}
/**
* Dismiss required actions
* @since 1.8.2.4
*/
public function Awada_lite_dismiss_required_action_callback() {
global $Awada_required_actions;
$Awada_dismiss_id = (isset($_GET['dismiss_id'])) ? $_GET['dismiss_id'] : 0;
echo $Awada_dismiss_id; /* this is needed and it's the id of the dismissable required action */
if( !empty($Awada_dismiss_id) ):
/* if the option exists, update the record for the specified id */
if( get_option('Awada_show_required_actions') ):
$Awada_show_required_actions = get_option('Awada_show_required_actions');
$Awada_show_required_actions[$Awada_dismiss_id] = false;
update_option( 'Awada_show_required_actions',$Awada_show_required_actions );
/* create the new option,with false for the specified id */
else:
$Awada_show_required_actions_new = array();
if( !empty($Awada_required_actions) ):
foreach( $Awada_required_actions as $Awada_required_action ):
if( $Awada_required_action['id'] == $Awada_dismiss_id ):
$Awada_show_required_actions_new[$Awada_required_action['id']] = false;
else:
$Awada_show_required_actions_new[$Awada_required_action['id']] = true;
endif;
endforeach;
update_option( 'Awada_show_required_actions', $Awada_show_required_actions_new );
endif;
endif;
endif;
die(); // this is required to return a proper result
}
/**
* Welcome screen content
* @since 1.8.2.4
*/
public function Awada_lite_welcome_screen() {
require_once( ABSPATH . 'wp-load.php' );
require_once( ABSPATH . 'wp-admin/admin.php' );
require_once( ABSPATH . 'wp-admin/admin-header.php' );
?>
admin_notices;
// Check for an active admin notice array
if (!empty($notices)) {
// Enum admin notices
foreach ($notices as $notice) {
$add_style = '';
if (strpos($notice['type'], 'webhunt-message') != false) {
$add_style = 'style="border-left: 4px solid ' . $notice['color'] . '!important;"';
}
if (true == $notice['dismiss']) {
// Get user ID
$userid = $current_user->ID;
if (!get_user_meta($userid, 'ignore_' . $notice['id'])) {
// Check if we are on admin.php. If we are, we have
// to get the current page slug and tab, so we can
// feed it back to Wordpress. Why> admin.php cannot
// be accessed without the page parameter. We add the
// tab to return the user to the last panel they were
// on.
$pageName = '';
$curTab = '';
if ($pagenow == 'admin.php' || $pagenow == 'themes.php') {
// Get the current page. To avoid errors, we'll set
$pageName = empty($_GET['page']) ? '&page=awada-welcome' : '&page=' . $_GET['page'];
// Ditto for the current tab.
$curTab = empty($_GET['tab']) ? '&tab=0' : '&tab=' . $_GET['tab'];
}
// Print the notice with the dismiss link
echo '';
}
} else {
// Standard notice
echo '';
}
}
// Clear the admin notice array
$this->admin_notices = array();
}
}
/**
* dismissAdminNotice - Updates user meta to store dismiss notice preference
* @access public
* @return void
*/
public function dismissAdminNotice()
{
global $current_user;
// Verify the dismiss and id parameters are present.
if (isset($_GET['dismiss']) && isset($_GET['id'])) {
if ('true' == $_GET['dismiss'] || 'false' == $_GET['dismiss']) {
// Get the user id
$userid = $current_user->ID;
// Get the notice id
$id = $_GET['id'];
$val = $_GET['dismiss'];
// Add the dismiss request to the user meta.
update_user_meta($userid, 'ignore_' . $id, $val);
}
}
}
/**
* Getting started
* @since 1.8.2.4
*/
public function Awada_lite_welcome_getting_started() {
require_once( get_template_directory() . '/inc/welcome-screen/sections/getting-started.php' );
}
/**
* Changelog
* @since 1.8.2.4
*/
public function Awada_lite_welcome_changelog() {
require_once( get_template_directory() . '/inc/welcome-screen/sections/changelog.php' );
}
}
$GLOBALS['Awada_Welcome'] = new Awada_Welcome();
}
?>