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

448 lines
78 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
2013-11-19 16:18:44 +00:00
* @version 2.1.0
2013-03-01 16:03:10 +00:00
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
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
/**
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' ) );
}
/**
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 );
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>
2013-03-01 16:03:10 +00:00
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.woothemes.com/woocommerce/" data-text="A open-source (free) #ecommerce plugin for #WordPress that helps you sell anything. Beautifully." data-via="WooThemes" data-size="large" data-hashtags="WooCommerce">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 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>
</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();