woocommerce/includes/admin/class-wc-admin-welcome.php

726 lines
90 KiB
PHP
Raw Normal View History

2013-03-01 16:03:10 +00:00
<?php
/**
* Welcome Page Class
*
* Shows a feature overview for the new version (major) and credits.
*
* Adapted from code in EDD (Copyright (c) 2012, Pippin Williamson) and WP.
*
2014-11-17 15:56:36 +00:00
* @author WooThemes
* @category Admin
* @package WooCommerce/Admin
* @version 2.4.0
2013-03-01 16:03:10 +00:00
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
2013-03-01 16:03:10 +00:00
/**
2014-11-17 15:56:36 +00:00
* WC_Admin_Welcome class
2013-03-01 16:03:10 +00:00
*/
class WC_Admin_Welcome {
2013-03-01 16:03:10 +00:00
/** @var string Currenct Step */
private $step = '';
/** @var array Steps for the setup wizard */
private $steps = array();
2013-03-01 16:03:10 +00:00
/**
2014-11-17 15:56:36 +00:00
* Hook in tabs.
2013-03-01 16:03:10 +00:00
*/
public function __construct() {
add_action( 'admin_menu', array( $this, 'admin_menus') );
add_action( 'admin_head', array( $this, 'admin_head' ) );
add_action( 'admin_init', array( $this, 'welcome' ) );
add_action( 'admin_init', array( $this, 'setup_wizard' ) );
}
public function setup_wizard() {
if ( empty( $_GET['page'] ) || $_GET['page'] !== 'wc-setup' ) {
return;
}
$this->steps = array(
'introduction' => array(
'name' => __( 'Introduction', 'woocommerce' ),
'view' => array( $this, 'wc_setup_introduction' ),
'handler' => ''
),
'locale' => array(
'name' => __( 'Store Locale', 'woocommerce' ),
'view' => array( $this, 'wc_setup_locale' ),
'handler' => ''
),
'pages' => array(
'name' => __( 'Page Setup', 'woocommerce' ),
'view' => array( $this, 'wc_setup_pages' ),
'handler' => ''
),
'shipping_taxes' => array(
'name' => __( 'Shipping &amp; Tax', 'woocommerce' ),
'view' => array( $this, 'wc_setup_pages' ),
'handler' => ''
),
'next_steps' => array(
'name' => __( 'Ready!', 'woocommerce' ),
'view' => array( $this, 'wc_setup_next_steps' ),
'handler' => ''
)
);
$this->step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : current( array_keys( $this->steps ) );
$suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
wp_register_script( 'select2', WC()->plugin_url() . '/assets/js/select2/select2' . $suffix . '.js', array( 'jquery' ), '3.5.2' );
wp_register_script( 'wc-enhanced-select', WC()->plugin_url() . '/assets/js/admin/wc-enhanced-select' . $suffix . '.js', array( 'jquery', 'select2' ), WC_VERSION );
wp_localize_script( 'wc-enhanced-select', 'wc_enhanced_select_params', array(
'i18n_matches_1' => _x( 'One result is available, press enter to select it.', 'enhanced select', 'woocommerce' ),
'i18n_matches_n' => _x( '%qty% results are available, use up and down arrow keys to navigate.', 'enhanced select', 'woocommerce' ),
'i18n_no_matches' => _x( 'No matches found', 'enhanced select', 'woocommerce' ),
'i18n_ajax_error' => _x( 'Loading failed', 'enhanced select', 'woocommerce' ),
'i18n_input_too_short_1' => _x( 'Please enter 1 or more characters', 'enhanced select', 'woocommerce' ),
'i18n_input_too_short_n' => _x( 'Please enter %qty% or more characters', 'enhanced select', 'woocommerce' ),
'i18n_input_too_long_1' => _x( 'Please delete 1 character', 'enhanced select', 'woocommerce' ),
'i18n_input_too_long_n' => _x( 'Please delete %qty% characters', 'enhanced select', 'woocommerce' ),
'i18n_selection_too_long_1' => _x( 'You can only select 1 item', 'enhanced select', 'woocommerce' ),
'i18n_selection_too_long_n' => _x( 'You can only select %qty% items', 'enhanced select', 'woocommerce' ),
'i18n_load_more' => _x( 'Loading more results&hellip;', 'enhanced select', 'woocommerce' ),
'i18n_searching' => _x( 'Searching&hellip;', 'enhanced select', 'woocommerce' ),
'ajax_url' => admin_url( 'admin-ajax.php' ),
'search_products_nonce' => wp_create_nonce( 'search-products' ),
'search_customers_nonce' => wp_create_nonce( 'search-customers' )
) );
wp_register_style( 'woocommerce_admin_styles', WC()->plugin_url() . '/assets/css/admin.css', array(), WC_VERSION );
wp_register_style( 'wc-setup', WC()->plugin_url() . '/assets/css/wc-setup.css', array(), WC_VERSION );
wp_register_script( 'wc-setup', WC()->plugin_url() . '/assets/js/admin/wc-setup.min.js', array( 'jquery' ), WC_VERSION );
wp_localize_script( 'wc-setup', 'wc_setup_params', array(
'locale_info' => json_encode( include( WC()->plugin_path() . '/i18n/locale-info.php' ) )
) );
$this->setup_wizard_header();
$this->setup_wizard_steps();
$this->setup_wizard_content();
$this->setup_wizard_footer();
exit;
}
public function get_next_step_link() {
$keys = array_keys( $this->steps );
return add_query_arg( 'step', $keys[ array_search( $this->step, array_keys( $this->steps ) ) + 1 ] );
}
/**
* Setup Wizard Header
*/
public function setup_wizard_header() {
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head>
<meta name="viewport" content="width=device-width" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php _e( 'WooCommerce &rsaquo; Setup Wizard', 'woocommerce' ); ?></title>
<?php wp_admin_css( 'install', true ); ?>
<?php wp_admin_css( 'wc-setup', true ); ?>
<?php wp_admin_css( 'woocommerce_admin_styles', true ); ?>
<?php wp_print_scripts( 'wc-enhanced-select' ); ?>
<?php wp_print_scripts( 'wc-setup' ); ?>
</head>
<body class="wc-setup wp-core-ui">
<h1 id="wc-logo"><a href="http://woothemes.com/woocommerce"><img src="<?php echo WC()->plugin_url(); ?>/assets/images/woocommerce_logo.png" alt="WooCommerce" /></a></h1>
<?php
}
/**
* Setup Wizard Footer
*/
public function setup_wizard_footer() {
?>
</body>
</html>
<?php
}
/**
* Output the steps
*/
public function setup_wizard_steps() {
?>
<ol class="wc-install-steps">
<?php foreach ( $this->steps as $step_key => $step ) : ?>
<li class="<?php
if ( $step_key === $this->step ) {
echo 'active';
} elseif ( array_search( $this->step, array_keys( $this->steps ) ) > array_search( $step_key, array_keys( $this->steps ) ) ) {
echo 'done';
}
?>"><?php echo esc_html( $step['name'] ); ?></li>
<?php endforeach; ?>
</ol>
<?php
}
/**
* Output the content for the current step
*/
public function setup_wizard_content() {
echo '<div class="wc-install-content">';
call_user_func( $this->steps[ $this->step ]['view'] );
echo '</div>';
}
public function wc_setup_introduction() {
?>
<h1><?php _e( 'Welcome to WooCommerce', 'woocommerce' ); ?></h1>
<p><?php _e( 'Thanks for choosing WooCommerce to power your online store! To help you get started we\'ve prepared this quick setup wizard - it\'s completely optional and should take no longer than 5 minutes.', 'woocommerce' ); ?></p>
<p><?php _e( 'No time right now? Want to setup your store manually? Just press the skip button to return to the WordPress dashboard. You can come back anytime if you change your mind!', 'woocommerce' ); ?></p>
<p class="wc-install-actions step">
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large"><?php _e( 'Let\'s Go!', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large"><?php _e( 'Not right now', 'woocommerce' ); ?></a>
</p>
<?php
}
public function wc_setup_locale() {
$user_location = WC_Geolocation::geolocate_ip();
$country = ! empty( $user_location['country'] ) ? $user_location['country'] : 'US';
$state = ! empty( $user_location['state'] ) ? $user_location['state'] : '*';
$state = 'US' === $country && '*' === $state ? 'AL' : $state;
?>
<h1><?php _e( 'Store Locale Setup', 'woocommerce' ); ?></h1>
<form id="setup" method="post" action="install.php?step=2" novalidate="novalidate">
<table class="form-table">
<tr>
<th scope="row"><label for="weblog_title"><?php _e( 'Where is your store based?' ); ?></label></th>
<td>
<select name="store_location" style="width:100%;" data-placeholder="<?php _e( 'Choose a country&hellip;', 'woocommerce' ); ?>" class="wc-enhanced-select">
<?php WC()->countries->country_dropdown_options( $country, $state ); ?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="weblog_title"><?php _e( 'Which currency will your store use?' ); ?></label></th>
<td>
<select name="store_currency" style="width:100%;" data-placeholder="<?php _e( 'Choose a currency&hellip;', 'woocommerce' ); ?>" class="wc-enhanced-select">
<?php
foreach ( get_woocommerce_currencies() as $code => $name ) {
echo '<option value="' . esc_attr( $code ) . '">' . esc_html( $name . ' (' . get_woocommerce_currency_symbol( $code ) . ')' ) . '</option>';
}
?>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="currency_pos"><?php _e( 'Currency Position' ); ?></label></th>
<td>
<select id="currency_pos" name="currency_pos" class="wc-enhanced-select">
<option value="left"><?php echo __( 'Left', 'woocommerce' ); ?></option>
<option value="right"><?php echo __( 'Right', 'woocommerce' ); ?></option>
<option value="left_space"><?php echo __( 'Left with space', 'woocommerce' ); ?></option>
<option value="right_space"><?php echo __( 'Right with space', 'woocommerce' ); ?></option>
</select>
</td>
</tr>
<tr>
<th scope="row"><label for="thousand_sep"><?php _e( 'Thousand Separator' ); ?></label></th>
<td>
<input type="text" id="thousand_sep" name="thousand_sep" size="2" value="" />
</td>
</tr>
<tr>
<th scope="row"><label for="decimal_sep"><?php _e( 'Decimal Separator' ); ?></label></th>
<td>
<input type="text" id="decimal_sep" name="decimal_sep" size="2" value="" />
</td>
</tr>
<tr>
<th scope="row"><label for="num_decimals"><?php _e( 'Number of Decimals' ); ?></label></th>
<td>
<input type="text" id="num_decimals" name="num_decimals" size="2" value="" />
</td>
</tr>
</table>
</form>
<p class="wc-install-actions step">
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large"><?php _e( 'Continue', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
</p>
<?php
}
public function wc_setup_pages() {
?>
<h1><?php _e( 'Page Setup', 'woocommerce' ); ?></h1>
<p><?php _e( 'There are a few pages WooCommerce needs to install in order to function correctly. The following pages will be created if they do not already exist:', 'woocommerce' ); ?></p>
<table class="wc-install-pages">
<head>
<tr>
<th class="page-name"><?php _e( 'Page Name', 'woocommerce' ); ?></th>
<th class="page-description"><?php _e( 'Description', 'woocommerce' ); ?></th>
</tr>
</head>
<tbody>
<tr>
<td><?php echo _x( 'Shop', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The shop page will house your product catalog.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'Cart', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The cart page will be where the customer goes to view their cart and begin checkout.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'Checkout', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'The checkout page will be where the customer goes to pay for their items.', 'woocommerce' ); ?></td>
</tr>
<tr>
<td><?php echo _x( 'My Account', 'Page title', 'woocommerce' ); ?></td>
<td><?php _e( 'Registered customers will be able to go to this page to manage their account details and view past orders. Non-registered users will be able to login or register.', 'woocommerce' ); ?></td>
</tr>
</tbody>
</table>
<p class="wc-install-actions step">
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button-primary button button-large"><?php _e( 'Continue', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large"><?php _e( 'Skip this step', 'woocommerce' ); ?></a>
</p>
<?php
}
public function wc_setup_next_steps() {
?>
<h1><?php _e( 'Your Store is Ready', 'woocommerce' ); ?></h1>
<p><?php _e( 'Congratulations - basic setup is complete. Wondering what to do next?', 'woocommerce' ); ?></p>
<ul>
<li>Item 1</li>
</ul>
<?php
2013-03-01 16:03:10 +00:00
}
/**
2014-11-17 15:56:36 +00:00
* Add admin menus/screens.
2013-03-01 16:03:10 +00:00
*/
public function admin_menus() {
if ( empty( $_GET['page'] ) ) {
return;
}
2013-03-18 12:49:13 +00:00
$welcome_page_name = __( 'About WooCommerce', 'woocommerce' );
2013-03-18 12:52:00 +00:00
$welcome_page_title = __( 'Welcome to WooCommerce', 'woocommerce' );
2013-03-18 12:49:13 +00:00
switch ( $_GET['page'] ) {
case 'wc-about' :
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-about', array( $this, 'about_screen' ) );
2014-11-17 16:42:39 +00:00
add_action( 'admin_print_styles-' . $page, array( $this, 'admin_css' ) );
break;
case 'wc-credits' :
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-credits', array( $this, 'credits_screen' ) );
2014-11-17 16:42:39 +00:00
add_action( 'admin_print_styles-' . $page, array( $this, 'admin_css' ) );
break;
case 'wc-translators' :
$page = add_dashboard_page( $welcome_page_title, $welcome_page_name, 'manage_options', 'wc-translators', array( $this, 'translators_screen' ) );
2014-11-17 16:42:39 +00:00
add_action( 'admin_print_styles-' . $page, array( $this, 'admin_css' ) );
break;
}
2013-03-01 16:03:10 +00:00
}
/**
* admin_css function.
*/
public function admin_css() {
2014-11-17 16:18:15 +00:00
wp_enqueue_style( 'woocommerce-activation', WC()->plugin_url() . '/assets/css/activation.css', array(), WC_VERSION );
2013-03-01 16:03:10 +00:00
}
/**
* Add styles just for this page, and remove dashboard page links.
*/
public function admin_head() {
remove_submenu_page( 'index.php', 'wc-about' );
remove_submenu_page( 'index.php', 'wc-credits' );
2014-02-07 13:06:20 +00:00
remove_submenu_page( 'index.php', 'wc-translators' );
2013-03-01 16:03:10 +00:00
?>
<style type="text/css">
/*<![CDATA[*/
2013-11-19 16:18:44 +00:00
.wc-badge:before {
font-family: WooCommerce !important;
content: "\e03d";
color: #fff;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-size: 80px;
font-weight: normal;
width: 165px;
height: 165px;
line-height: 165px;
text-align: center;
position: absolute;
top: 0;
2014-08-27 20:26:45 +00:00
<?php echo is_rtl() ? 'right' : 'left'; ?>: 0;
2013-11-19 16:18:44 +00:00
margin: 0;
vertical-align: middle;
}
2013-03-01 16:03:10 +00:00
.wc-badge {
2014-08-28 00:55:32 +00:00
position: relative;
2013-11-19 16:18:44 +00:00
background: #9c5d90;
text-rendering: optimizeLegibility;
2013-03-01 16:03:10 +00:00
padding-top: 150px;
height: 52px;
2013-11-19 16:18:44 +00:00
width: 165px;
font-weight: 600;
2013-03-01 16:03:10 +00:00
font-size: 14px;
text-align: center;
2013-11-19 16:18:44 +00:00
color: #ddc8d9;
margin: 5px 0 0 0;
-webkit-box-shadow: 0 1px 3px rgba(0,0,0,.2);
box-shadow: 0 1px 3px rgba(0,0,0,.2);
2013-03-01 16:03:10 +00:00
}
.about-wrap .wc-badge {
position: absolute;
top: 0;
2014-08-27 20:26:45 +00:00
<?php echo is_rtl() ? 'left' : 'right'; ?>: 0;
2013-03-01 16:03:10 +00:00
}
2013-11-19 16:18:44 +00:00
.about-wrap .wc-feature {
overflow: visible !important;
*zoom:1;
}
.about-wrap h3 + .wc-feature {
margin-top: 0;
}
2013-11-19 16:18:44 +00:00
.about-wrap .wc-feature:before,
.about-wrap .wc-feature:after {
content: " ";
display: table;
}
.about-wrap .wc-feature:after {
clear: both;
}
.about-wrap .feature-rest div {
width: 50% !important;
2014-08-28 08:55:36 +00:00
padding-<?php echo is_rtl() ? 'left' : 'right'; ?>: 100px;
2013-11-19 16:18:44 +00:00
-moz-box-sizing: border-box;
box-sizing: border-box;
margin: 0 !important;
}
.about-wrap .feature-rest div.last-feature {
2014-08-28 08:55:36 +00:00
padding-<?php echo is_rtl() ? 'right' : 'left'; ?>: 100px;
padding-<?php echo is_rtl() ? 'left' : 'right'; ?>: 0;
2013-11-19 16:18:44 +00:00
}
.about-wrap div.icon {
width: 0 !important;
padding: 0;
2014-12-23 15:04:46 +00:00
margin: 20px 0 !important;
2013-11-19 16:18:44 +00:00
}
2014-05-15 20:42:04 +00:00
.about-wrap .feature-rest div.icon:before {
2013-11-19 16:18:44 +00:00
font-family: WooCommerce !important;
font-weight: normal;
width: 100%;
font-size: 170px;
line-height: 125px;
color: #9c5d90;
display: inline-block;
position: relative;
text-align: center;
speak: none;
2014-08-28 08:55:36 +00:00
margin: <?php echo is_rtl() ? '0 -100px 0 0' : '0 0 0 -100px'; ?>;
2013-11-19 16:18:44 +00:00
content: "\e01d";
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.about-integrations {
background: #fff;
margin: 20px 0;
padding: 1px 20px 10px;
}
2014-09-10 11:18:43 +00:00
.changelog h4 {
line-height: 1.4;
}
2013-03-01 16:03:10 +00:00
/*]]>*/
</style>
<?php
}
/**
2014-11-17 15:56:36 +00:00
* Intro text/links shown on all about pages.
2013-03-01 16:03:10 +00:00
*/
private function intro() {
2013-03-06 13:43:53 +00:00
// Flush after upgrades
if ( ! empty( $_GET['wc-updated'] ) || ! empty( $_GET['wc-installed'] ) ) {
2013-03-06 13:43:53 +00:00
flush_rewrite_rules();
}
2013-03-06 13:43:53 +00:00
2013-03-01 16:03:10 +00:00
// Drop minor version if 0
2013-11-25 14:01:32 +00:00
$major_version = substr( WC()->version, 0, 3 );
2015-02-19 11:16:24 +00:00
// Random tweet - must be kept to 102 chars to "fit"
$tweets = array(
'WooCommerce kickstarts online stores. It\'s free and has been downloaded over 6 million times.',
'Building an online store? WooCommerce is the leading #eCommerce plugin for WordPress (and it\'s free).',
'WooCommerce is a free #eCommerce plugin for #WordPress for selling #allthethings online, beautifully.',
'Ready to ship your idea? WooCommerce is the fastest growing #eCommerce plugin for WordPress on the web'
);
shuffle( $tweets );
2013-03-01 16:03:10 +00:00
?>
<h1><?php printf( __( 'Welcome to WooCommerce %s', 'woocommerce' ), $major_version ); ?></h1>
<div class="about-text woocommerce-about-text">
<?php
2014-11-17 17:14:49 +00:00
if ( ! empty( $_GET['wc-installed'] ) ) {
2013-03-01 16:03:10 +00:00
$message = __( 'Thanks, all done!', 'woocommerce' );
2014-11-17 17:14:49 +00:00
} elseif ( ! empty( $_GET['wc-updated'] ) ) {
2013-03-01 16:03:10 +00:00
$message = __( 'Thank you for updating to the latest version!', 'woocommerce' );
2014-11-17 17:14:49 +00:00
} else {
2013-03-01 16:03:10 +00:00
$message = __( 'Thanks for installing!', 'woocommerce' );
2014-11-17 17:14:49 +00:00
}
2013-03-01 16:03:10 +00:00
2014-09-10 11:18:43 +00:00
printf( __( '%s WooCommerce %s is more powerful, stable and secure than ever before. We hope you enjoy using it.', 'woocommerce' ), $message, $major_version );
2013-03-01 16:03:10 +00:00
?>
</div>
2013-11-25 14:01:32 +00:00
<div class="wc-badge"><?php printf( __( 'Version %s', 'woocommerce' ), WC()->version ); ?></div>
2013-03-01 16:03:10 +00:00
<p class="woocommerce-actions">
2013-10-22 16:26:18 +00:00
<a href="<?php echo admin_url('admin.php?page=wc-settings'); ?>" class="button button-primary"><?php _e( 'Settings', 'woocommerce' ); ?></a>
<a href="<?php echo esc_url( apply_filters( 'woocommerce_docs_url', 'http://docs.woothemes.com/documentation/plugins/woocommerce/', 'woocommerce' ) ); ?>" class="docs button button-primary"><?php _e( 'Docs', 'woocommerce' ); ?></a>
2015-02-19 11:16:24 +00:00
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="<?php echo esc_attr( $tweets[0] ); ?>" data-via="WooThemes" data-size="large">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
2013-03-01 16:03:10 +00:00
</p>
<h2 class="nav-tab-wrapper">
<a class="nav-tab <?php if ( $_GET['page'] == 'wc-about' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-about' ), 'index.php' ) ) ); ?>">
<?php _e( "What's New", 'woocommerce' ); ?>
</a><a class="nav-tab <?php if ( $_GET['page'] == 'wc-credits' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-credits' ), 'index.php' ) ) ); ?>">
<?php _e( 'Credits', 'woocommerce' ); ?>
2014-02-07 13:06:20 +00:00
</a><a class="nav-tab <?php if ( $_GET['page'] == 'wc-translators' ) echo 'nav-tab-active'; ?>" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-translators' ), 'index.php' ) ) ); ?>">
<?php _e( 'Translators', 'woocommerce' ); ?>
2013-03-01 16:03:10 +00:00
</a>
</h2>
<?php
}
/**
* Output the about screen.
*/
public function about_screen() {
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
<!--<div class="changelog point-releases"></div>-->
<div class="changelog">
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'UI Overhaul', 'woocommerce' ); ?></h4>
<p><?php _e( 'We\'ve updated the user interface on both the front and backend of WooCommerce 2.3 "Handsome Hippo".', 'woocommerce' ); ?></p>
<div class="changelog about-integrations">
<div class="wc-feature feature-section col three-col">
<div>
<h4><?php _e( 'Frontend UI Improvements', 'woocommerce' ); ?></h4>
<p><?php _e( 'On the frontend there are several UX enhancements such as the undo-remove-from cart link and responsive table design as well as a fresh, modern look which meshes more fluidly with the current design trends of default WordPress themes.', 'woocommerce' ); ?></p>
</div>
<div>
<h4><?php _e( 'Backend UI Improvements', 'woocommerce' ); ?></h4>
<p><?php _e( 'On the backend, settings have been re-organised and perform better on hand-held devices for an all round improved user experience. ', 'woocommerce' ); ?></p>
</div>
<div class="last-feature">
<h4><?php _e( 'Webhooks UI', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'As part of the API, we\'ve introduced a UI for the Webhook system in WooCommerce 2.3. This makes it easier for 3rd party apps to integrate with WooCommerce. Read more in our %sdocs%s.', 'woocommerce' ), '<a href="http://docs.woothemes.com/document/webhooks/">', '</a>' ); ?></p>
2015-01-13 16:12:51 +00:00
</div>
2013-03-01 16:03:10 +00:00
</div>
</div>
2013-11-19 16:18:44 +00:00
</div>
2015-01-13 16:12:51 +00:00
<div class="changelog">
<div class="feature-section col three-col">
2013-03-01 16:03:10 +00:00
<div>
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Geo-locating Customer Location', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'We have added a new option to geolocate the "Default Customer Location". Coupled with ability to show taxes in your store based on this location, you can show relevant prices store-wide. Enable this in the %ssettings%s.', 'woocommerce' ), '<a href="' . admin_url( 'admin.php?page=wc-settings&tab=tax' ) . '">', '</a>' ); ?></p>
2013-11-19 16:18:44 +00:00
</div>
<div>
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Color Customization', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'If you\'re looking to customise the look and feel of the frontend in 2.3, take a look at the free %sWooCommerce Colors plugin%s. This lets you change the colors with a live preview.', 'woocommerce' ), '<a href="https://wordpress.org/plugins/woocommerce-colors/">', '</a>' ); ?></p>
2013-03-01 16:03:10 +00:00
</div>
<div class="last-feature">
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Improved Reports', 'woocommerce' ); ?></h4>
<p><?php _e( 'Sales reports can now show net and gross amounts, we\'ve added a print stylesheet, and added extra data on refunds to reports.', 'woocommerce' ); ?></p>
2013-03-01 16:03:10 +00:00
</div>
</div>
<div class="feature-section col three-col">
<div>
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Improved Simplify Gateway', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'The built in Simplify Commerce Gateway (available in the US) now supports %sHosted Payments%s - a PCI Compliant hosted payment platform.', 'woocommerce' ), '<a href="https://www.simplify.com/commerce/docs/tools/hosted-payments">', '</a>' ); ?></p>
2013-03-01 16:03:10 +00:00
</div>
<div>
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Email Template Improvements', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'To make email customization simpler, we\'ve included a CSS Inliner in this release, some new template files for styling emails, and some additional hooks for developers. Read more on our %sdeveloper blog%s.', 'woocommerce' ), '<a href="http://develop.woothemes.com/woocommerce/2014/10/2-3-emails/">', '</a>' ); ?></p>
2013-03-01 16:03:10 +00:00
</div>
<div class="last-feature">
2015-01-13 16:12:51 +00:00
<h4><?php _e( 'Simplified Coupon System', 'woocommerce' ); ?></h4>
<p><?php printf( __( 'We have simplified the coupon system to ensure discounts are never applied to taxes, and we\'ve improved support for discounting products inclusive of tax. Read more on our %sdevelop blog%s.', 'woocommerce' ), '<a href="http://develop.woothemes.com/woocommerce/2014/12/upcoming-coupon-changes-in-woocommerce-2-3/">', '</a>' ); ?></p>
2013-03-01 16:03:10 +00:00
</div>
</div>
2014-08-27 20:26:45 +00:00
</div>
2014-11-17 16:42:39 +00:00
<hr />
2013-03-01 16:03:10 +00:00
<div class="return-to-dashboard">
2013-10-22 16:26:18 +00:00
<a href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'wc-settings' ), 'admin.php' ) ) ); ?>"><?php _e( 'Go to WooCommerce Settings', 'woocommerce' ); ?></a>
2013-03-01 16:03:10 +00:00
</div>
</div>
<?php
}
/**
2014-11-17 15:56:36 +00:00
* Output the credits screen.
2013-03-01 16:03:10 +00:00
*/
public function credits_screen() {
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
2014-08-27 20:56:32 +00:00
<p class="about-description"><?php printf( __( 'WooCommerce is developed and maintained by a worldwide team of passionate individuals and backed by an awesome developer community. Want to see your name? <a href="%s">Contribute to WooCommerce</a>.', 'woocommerce' ), 'https://github.com/woothemes/woocommerce/blob/master/CONTRIBUTING.md' ); ?></p>
2013-03-01 16:03:10 +00:00
<?php echo $this->contributors(); ?>
2014-02-07 13:06:20 +00:00
</div>
<?php
}
/**
2014-11-17 15:56:36 +00:00
* Output the translators screen.
2014-02-07 13:06:20 +00:00
*/
public function translators_screen() {
?>
<div class="wrap about-wrap">
<?php $this->intro(); ?>
2014-08-27 20:56:32 +00:00
<p class="about-description"><?php printf( __( 'WooCommerce has been kindly translated into several other languages thanks to our translation team. Want to see your name? <a href="%s">Translate WooCommerce</a>.', 'woocommerce' ), 'https://www.transifex.com/projects/p/woocommerce/' ); ?></p>
2013-03-01 16:03:10 +00:00
<?php
// Have to use this to get the list until the API is open...
/*
$contributor_json = json_decode( 'string from https://www.transifex.com/api/2/project/woocommerce/languages/', true );
$contributors = array();
foreach ( $contributor_json as $group ) {
$contributors = array_merge( $contributors, $group['coordinators'], $group['reviewers'], $group['translators'] );
}
$contributors = array_filter( array_unique( $contributors ) );
natsort( $contributors );
foreach ( $contributors as $contributor ) {
echo htmlspecialchars( '<a href="https://www.transifex.com/accounts/profile/' . $contributor . '">' . $contributor . '</a>, ' );
}
*/
?>
<p class="wp-credits-list">
2015-01-13 16:16:01 +00:00
<a href="https://www.transifex.com/accounts/profile/ABSOLUTE_Web">ABSOLUTE_Web</a>, <a href="https://www.transifex.com/accounts/profile/AIRoman">AIRoman</a>, <a href="https://www.transifex.com/accounts/profile/ANNEMARIEDEHAAN11">ANNEMARIEDEHAAN11</a>, <a href="https://www.transifex.com/accounts/profile/Abdumejid">Abdumejid</a>, <a href="https://www.transifex.com/accounts/profile/Adam_Bajer">Adam_Bajer</a>, <a href="https://www.transifex.com/accounts/profile/AeAdawi">AeAdawi</a>, <a href="https://www.transifex.com/accounts/profile/Aerendir">Aerendir</a>, <a href="https://www.transifex.com/accounts/profile/Ahmed_Na">Ahmed_Na</a>, <a href="https://www.transifex.com/accounts/profile/AlexSunnO">AlexSunnO</a>, <a href="https://www.transifex.com/accounts/profile/Aliom">Aliom</a>, <a href="https://www.transifex.com/accounts/profile/Almaz">Almaz</a>, <a href="https://www.transifex.com/accounts/profile/Ana_Sofia_Figueiredo">Ana_Sofia_Figueiredo</a>, <a href="https://www.transifex.com/accounts/profile/Andriy.Gusak">Andriy.Gusak</a>, <a href="https://www.transifex.com/accounts/profile/AngeloLazzari">AngeloLazzari</a>, <a href="https://www.transifex.com/accounts/profile/Anne19">Anne19</a>, <a href="https://www.transifex.com/accounts/profile/Apelsinova">Apelsinova</a>, <a href="https://www.transifex.com/accounts/profile/ArtGoddess">ArtGoddess</a>, <a href="https://www.transifex.com/accounts/profile/Ashleyking">Ashleyking</a>, <a href="https://www.transifex.com/accounts/profile/AslanDoma">AslanDoma</a>, <a href="https://www.transifex.com/accounts/profile/Axium">Axium</a>, <a href="https://www.transifex.com/accounts/profile/BaronAndrea">BaronAndrea</a>, <a href="https://www.transifex.com/accounts/profile/Bhuvanendran">Bhuvanendran</a>, <a href="https://www.transifex.com/accounts/profile/Bitly">Bitly</a>, <a href="https://www.transifex.com/accounts/profile/BlackJad">BlackJad</a>, <a href="https://www.transifex.com/accounts/profile/Bogusław">Bogusław</a>, <a href="https://www.transifex.com/accounts/profile/CVSz">CVSz</a>, <a href="https://www.transifex.com/accounts/profile/Chaos">Chaos</a>, <a href="https://www.transifex.com/accounts/profile/Chea">Chea</a>, <a href="https://www.transifex.com/accounts/profile/Clausen">Clausen</a>, <a href="https://www.transifex.com/accounts/profile/Closemarketing">Closemarketing</a>, <a href="https://www.transifex.com/accounts/profile/CoachBirgit">CoachBirgit</a>, <a href="https://www.transifex.com/accounts/profile/CodeSupply">CodeSupply</a>, <a href="https://www.transifex.com/accounts/profile/Compute">Compute</a>, <a href="https://www.transifex.com/accounts/profile/CreativeAngels">CreativeAngels</a>, <a href="https://www.transifex.com/accounts/profile/DAJOHH">DAJOHH</a>, <a href="https://www.transifex.com/accounts/profile/DJIO">DJIO</a>, <a href="https://www.transifex.com/accounts/profile/DNCTrung">DNCTrung</a>, <a href="https://www.transifex.com/accounts/profile/Dandebortoli">Dandebortoli</a>, <a href="https://www.transifex.com/accounts/profile/DanielDoinitsin">DanielDoinitsin</a>, <a href="https://www.transifex.com/accounts/profile/Davidinosuper">Davidinosuper</a>, <a href="https://www.transifex.com/accounts/profile/Didierjr">Didierjr</a>, <a href="https://www.transifex.com/accounts/profile/Dimis13">Dimis13</a>, <a href="https://www.transifex.com/accounts/profile/Dmitrijb3">Dmitrijb3</a>, <a href="https://www.transifex.com/accounts/profile/Dorawiniweb">Dorawiniweb</a>, <a href="https://www.transifex.com/accounts/profile/Ekushey">Ekushey</a>, <a href="https://www.transifex.com/accounts/profile/EmilEriksen">EmilEriksen</a>, <a href="https://www.transifex.com/accounts/profile/Ewald">Ewald</a>, <a href="https://www.transifex.com/accounts/profile/Falk">Falk</a>, <a href="https://www.transifex.com/accounts/profile/FaniDesign">FaniDesign</a>, <a href="https://www.transifex.com/accounts/profile/Fdu4">Fdu4</a>, <a href="https://www.transifex.com/accounts/profile/Flobin">Flobin</a>, <a href="https://www.transifex.com/accounts/profile/Flums">Flums</a>, <a href="https://www.transifex.com/accounts/profile/Fra
</p>
2013-03-01 16:03:10 +00:00
</div>
<?php
}
/**
2014-11-17 15:56:36 +00:00
* Render Contributors List.
2013-03-01 16:03:10 +00:00
*
* @return string $contributor_list HTML formatted list of contributors.
*/
public function contributors() {
$contributors = $this->get_contributors();
if ( empty( $contributors ) ) {
2013-03-01 16:03:10 +00:00
return '';
}
2013-03-01 16:03:10 +00:00
$contributor_list = '<ul class="wp-people-group">';
foreach ( $contributors as $contributor ) {
$contributor_list .= '<li class="wp-person">';
$contributor_list .= sprintf( '<a href="%s" title="%s">',
esc_url( 'https://github.com/' . $contributor->login ),
esc_html( sprintf( __( 'View %s', 'woocommerce' ), $contributor->login ) )
);
$contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
$contributor_list .= '</a>';
$contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
$contributor_list .= '</a>';
$contributor_list .= '</li>';
}
$contributor_list .= '</ul>';
return $contributor_list;
}
/**
* Retrieve list of contributors from GitHub.
2013-03-01 16:03:10 +00:00
*
* @return mixed
2013-03-01 16:03:10 +00:00
*/
public function get_contributors() {
$contributors = get_transient( 'woocommerce_contributors' );
if ( false !== $contributors ) {
2013-03-01 16:03:10 +00:00
return $contributors;
}
2013-03-01 16:03:10 +00:00
$response = wp_remote_get( 'https://api.github.com/repos/woothemes/woocommerce/contributors', array( 'sslverify' => false ) );
if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
2013-03-01 16:03:10 +00:00
return array();
}
2013-03-01 16:03:10 +00:00
$contributors = json_decode( wp_remote_retrieve_body( $response ) );
if ( ! is_array( $contributors ) ) {
2013-03-01 16:03:10 +00:00
return array();
}
2013-03-01 16:03:10 +00:00
set_transient( 'woocommerce_contributors', $contributors, HOUR_IN_SECONDS );
2013-03-01 16:03:10 +00:00
return $contributors;
}
/**
2014-11-17 15:56:36 +00:00
* Sends user to the welcome page on first activation.
2013-03-01 16:03:10 +00:00
*/
public function welcome() {
2013-03-05 18:50:44 +00:00
// Bail if no activation redirect transient is set
2014-11-17 15:56:36 +00:00
if ( ! get_transient( '_wc_activation_redirect' ) ) {
2013-03-01 16:03:10 +00:00
return;
2014-11-17 15:56:36 +00:00
}
2013-03-01 16:03:10 +00:00
// Delete the redirect transient
delete_transient( '_wc_activation_redirect' );
2013-03-05 18:50:44 +00:00
// Bail if we are waiting to install or update via the interface update/install links
if ( WC_Admin_Notices::has_notice( 'install' ) || WC_Admin_Notices::has_notice( 'update' ) ) {
2013-03-01 16:03:10 +00:00
return;
}
2013-03-01 16:03:10 +00:00
2013-03-05 18:50:44 +00:00
// Bail if activating from network, or bulk, or within an iFrame
if ( is_network_admin() || isset( $_GET['activate-multi'] ) || defined( 'IFRAME_REQUEST' ) ) {
2013-03-01 16:03:10 +00:00
return;
}
2013-03-01 16:03:10 +00:00
2015-02-17 15:24:12 +00:00
if ( ( isset( $_GET['action'] ) && 'upgrade-plugin' == $_GET['action'] ) || ( ! empty( $_GET['page'] ) && $_GET['page'] === 'wc-about' ) ) {
return;
}
2013-12-04 12:20:18 +00:00
wp_redirect( admin_url( 'index.php?page=wc-about' ) );
2013-03-01 16:03:10 +00:00
exit;
}
}
new WC_Admin_Welcome();