filesystem = new webhunt_Filesystem ($this); //set webhunt upload folder $this->set_webhunt_content(); // Display admin notices add_action('admin_notices', array($this, 'adminNotices'), 99); // Check for dismissed admin notices. add_action('admin_init', array($this, 'dismissAdminNotice'), 9); /* create dashbord page */ add_action( 'admin_menu', array( $this, 'Fortune_lite_welcome_register_menu' ) ); /* activation notice */ add_action( 'load-themes.php', array( $this, 'Fortune_lite_activation_admin_notice' ) ); /* enqueue script and style for welcome screen */ add_action( 'admin_enqueue_scripts', array( $this, 'Fortune_lite_welcome_style_and_scripts' ) ); /* enqueue script for customizer */ add_action( 'customize_controls_enqueue_scripts', array( $this, 'Fortune_lite_welcome_scripts_for_customizer' ) ); /* load welcome screen */ add_action( 'Fortune_lite_welcome', array( $this, 'Fortune_lite_welcome_getting_started' ), 10 ); add_action( 'Fortune_lite_welcome', array( $this, 'Fortune_lite_welcome_changelog' ), 50 ); /* ajax callback for dismissable required actions */ add_action( 'wp_ajax_Fortune_lite_dismiss_required_action', array( $this, 'Fortune_lite_dismiss_required_action_callback') ); add_action( 'wp_ajax_nopriv_Fortune_lite_dismiss_required_action', array($this, 'Fortune_lite_dismiss_required_action_callback') ); if (!isset ($GLOBALS['webhunt_notice_check'])) { include_once 'sections/newsflash.php'; $params = array( 'dir_name' => 'notice', 'server_file' => 'http://www.webhuntinfotech.com/wp-content/uploads/webhunt/fortune_notice.json', 'interval' => 3, 'cookie_id' => 'fortune_rocks', ); new WebHuntNewsflash($this, $params); $GLOBALS['webhunt_notice_check'] = 1; } } private function set_webhunt_content() { $upload_dir = wp_upload_dir(); self::$_upload_dir = $upload_dir['basedir'] . '/webhunt/'; if (!is_dir(self::$_upload_dir)) { $this->filesystem->execute('mkdir', self::$_upload_dir); } } /** * Creates the dashboard page * @see add_theme_page() * @since 1.8.2.4 */ public function Fortune_lite_welcome_register_menu() { add_theme_page( 'About fortune', 'About Fortune', 'activate_plugins', 'fortune-welcome', array( $this, 'Fortune_lite_welcome_screen' ) ); } /** * Adds an admin notice upon successful activation. * @since 1.8.2.4 */ public function Fortune_lite_activation_admin_notice() { global $pagenow; if ( is_admin() && ('themes.php' == $pagenow) && isset( $_GET['activated'] ) ) { add_action( 'admin_notices', array( $this, 'Fortune_lite_welcome_admin_notice' ), 99 ); } } /** * Display an admin notice linking to the welcome screen * @since 1.8.2.4 */ public function Fortune_lite_welcome_admin_notice() { ?>
$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.','fortune' ) ) ); } } /** * Load scripts for customizer page * @since 1.8.2.4 */ public function Fortune_lite_welcome_scripts_for_customizer() { wp_enqueue_style( 'fortune-lite-welcome-screen-customizer-css', get_template_directory_uri() . '/inc/welcome-screen/css/welcome_customizer.css' ); wp_enqueue_script( 'fortune-lite-welcome-screen-customizer-js', get_template_directory_uri() . '/inc/welcome-screen/js/welcome_customizer.js', array('jquery'), '20120206', true ); global $Fortune_required_actions; $nr_actions_required = 0; wp_localize_script( 'fortune-lite-welcome-screen-customizer-js', 'fortuneLiteWelcomeScreenCustomizerObject', array( 'nr_actions_required' => $nr_actions_required, 'aboutpage' => esc_url( admin_url( 'themes.php?page=fortune-welcome#actions_required' ) ), 'customizerpage' => esc_url( admin_url( 'customize.php#actions_required' ) ), 'themeinfo' => __('View Theme Info','fortune'), ) ); } /** * Dismiss required actions * @since 1.8.2.4 */ public function Fortune_lite_dismiss_required_action_callback() { global $Fortune_required_actions; $Fortune_dismiss_id = (isset($_GET['dismiss_id'])) ? $_GET['dismiss_id'] : 0; echo $Fortune_dismiss_id; /* this is needed and it's the id of the dismissable required action */ if( !empty($Fortune_dismiss_id) ): /* if the option exists, update the record for the specified id */ if( get_option('Fortune_show_required_actions') ): $Fortune_show_required_actions = get_option('Fortune_show_required_actions'); $Fortune_show_required_actions[$Fortune_dismiss_id] = false; update_option( 'Fortune_show_required_actions',$Fortune_show_required_actions ); /* create the new option,with false for the specified id */ else: $Fortune_show_required_actions_new = array(); if( !empty($Fortune_required_actions) ): foreach( $Fortune_required_actions as $Fortune_required_action ): if( $Fortune_required_action['id'] == $Fortune_dismiss_id ): $Fortune_show_required_actions_new[$Fortune_required_action['id']] = false; else: $Fortune_show_required_actions_new[$Fortune_required_action['id']] = true; endif; endforeach; update_option( 'Fortune_show_required_actions', $Fortune_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 Fortune_lite_welcome_screen() { require_once( ABSPATH . 'wp-load.php' ); require_once( ABSPATH . 'wp-admin/admin.php' ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>' . $notice['msg'] . ' ' . __('Dismiss', 'fortune') . '.
' . $notice['msg'] . '.