/** * Sets up global variables * * @since Achievements (3.0) */ private function setup_globals() { $this->id = 'default'; $this->name = _x('v3.0 - 3.5.1', 'Version number ranges for this plugin', 'achievements'); $this->version = dpa_get_version(); $this->dir = trailingslashit(achievements()->plugin_dir . 'templates'); $this->url = trailingslashit(achievements()->plugin_url . 'templates'); }
/** * Sets up metaboxes for the achievement post type admin screen. * This is a callback function which is invoked by register_post_type(). * * Also enqueues required JavaScript and CSS. * * @since Achievements (3.0) */ function dpa_admin_setup_metaboxes() { // Load metaboxes and on-save handler add_meta_box('dpa-mb', __('Achievements', 'achievements'), 'dpa_achievement_metabox', dpa_get_achievement_post_type(), 'side', 'high'); remove_meta_box('tagsdiv-dpa_event', dpa_get_achievement_post_type(), 'side'); // Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. wp_enqueue_style('dpa_chosen_css', trailingslashit(achievements()->admin->css_url) . 'chosen.css', array(), dpa_get_version()); wp_enqueue_script('dpa_chosen_js', trailingslashit(achievements()->admin->javascript_url) . 'chosen-jquery-min.js', array('jquery'), dpa_get_version()); // General styles for the post type admin screen. $rtl = is_rtl() ? '-rtl' : ''; wp_enqueue_script('dpa_admin_js', trailingslashit(achievements()->admin->javascript_url) . 'achievements.js', array('jquery', 'dpa_chosen_js'), dpa_get_version()); wp_enqueue_style('dpa_admin_css', trailingslashit(achievements()->admin->css_url) . "achievements{$rtl}.css", array(), dpa_get_version()); }
/** * Output the Achievements version * * @since 3.0 */ function dpa_version() { echo dpa_get_version(); }
/** * Shared content between the About and Get Help screens, this method outputs the screen title and navigation menu. * * @since Achievements (3.6) */ protected function about_screen_header() { list($display_version) = explode('-', dpa_get_version()); $is_new_install = !empty($_GET['is_new_install']); ?> <style type="text/css"> .about-text { min-height: 0; margin-right: 0; } .about-wrap h3 { margin-bottom: 0; padding-top: 0; } </style> <div class="wrap about-wrap"> <h1><?php _e('Welcome to Achievements', 'achievements'); ?> </h1> <div class="about-text"> <?php if ($is_new_install) { /* translators: 1) username, 2) plugin version number */ printf(__('Hi, %s! Thanks very much for downloading Achievements %s. You really are rather nice. This exciting update screen is to confirm a few things that you probably already know:', 'achievements'), esc_html(wp_get_current_user()->display_name), $display_version); ?> <ol> <li><?php _e('You’re super-talented at finding great WordPress plugins.', 'achievements'); ?> </li> <li><?php _e('We think you’ve got a truly beautiful website.', 'achievements'); ?> </li> <li><?php _e('See 1 & 2.', 'achievements'); ?> </li> </ol> <?php _e('Achievements gamifies your WordPress site with challenges, badges, and points, which are the funnest ways to reward and encourage members of your community to participate. We hope you enjoy using the plugin!', 'achievements'); ?> <?php } else { ?> <?php printf(__('Hello there! Version %s is a maintenance release.', 'achievements'), $display_version); ?> <?php } ?> </div><!-- .about-text --> <h2 class="nav-tab-wrapper"> <a class="nav-tab <?php if (get_current_screen()->id === 'dashboard_page_achievements-about') { echo esc_attr('nav-tab-active'); } ?> " href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'achievements-about', 'is_new_install' => (int) $is_new_install), 'index.php'))); ?> "> <?php echo esc_html(_x('What’s New', 'admin about page section title', 'achievements')); ?> </a> <a class="nav-tab <?php if (get_current_screen()->id === 'dashboard_page_achievements-help') { echo esc_attr('nav-tab-active'); } ?> " href="<?php echo esc_url(admin_url(add_query_arg(array('page' => 'achievements-help', 'is_new_install' => (int) $is_new_install), 'index.php'))); ?> "> <?php echo esc_html(_x('Get Help', 'admin about page section title', 'achievements')); ?> </a> </h2><!-- .nav-tab-wrapper --> <?php // Note: this method intentionally omits a closing </div> tag for .about-wrap }
/** * Register bundled theme packages * * Note that since we currently have complete control over the /templates/ * folders, it's fine to hardcode these here. If at a later date we need to * automate this, an API will need to be built. * * @since Achievements (3.0) */ public function register_theme_packages() { // Original theme pack up to 3.6 dpa_register_theme_package(array('id' => '3.0-3.5.1', 'name' => _x('v3.0 - 3.5.1', 'Version number ranges for this plugin', 'achievements'), 'version' => dpa_get_version(), 'dir' => trailingslashit($this->themes_dir . '3.0-3.5.1'), 'url' => trailingslashit($this->themes_url . '3.0-3.5.1'))); // 3.6's theme pack -- gallery layout on directory pages dpa_register_theme_package(array('id' => 'default', 'name' => _x('v3.6+', 'Version number ranges for this plugin', 'achievements'), 'version' => dpa_get_version(), 'dir' => trailingslashit($this->themes_dir . 'default'), 'url' => trailingslashit($this->themes_url . 'default'))); }