Easy Digital Downloads
  • Package
  • Class
  • Tree

Packages

  • EDD
    • Admin
      • Actions
      • Add-ons
      • Dashboard
      • Discounts
      • Downloads
      • Export
      • Notices
      • Pages
      • Payments
      • Reports
      • Settings
      • System
      • Upgrades
      • Upload
      • Welcome
    • Cart
    • Checkout
    • Classes
      • API
      • Fees
      • HTML
      • Roles
      • Session
    • Emails
    • Functions
      • AJAX
      • Compatibility
      • Errors
      • Formatting
      • Install
      • Login
      • Taxes
      • Templates
    • Gateways
    • Logging
    • Payments
    • Shortcodes
    • Widgets

Classes

  • EDD_Welcome
  1 <?php
  2 /**
  3  * Weclome Page Class
  4  *
  5  * @package     EDD
  6  * @subpackage  Admin/Welcome
  7  * @copyright   Copyright (c) 2013, Pippin Williamson
  8  * @license     http://opensource.org/licenses/gpl-2.0.php GNU Public License
  9  * @since       1.4
 10  */
 11 
 12 // Exit if accessed directly
 13 if ( ! defined( 'ABSPATH' ) ) exit;
 14 
 15 /**
 16  * EDD_Welcome Class
 17  *
 18  * A general class for About and Credits page.
 19  *
 20  * @since 1.4
 21  */
 22 class EDD_Welcome {
 23     /**
 24      * @var string The capability users should have to view the page
 25      */
 26     public $minimum_capability = 'manage_options';
 27 
 28     /**
 29      * Get things started
 30      *
 31      * @access  public
 32      * @since 1.4
 33      * @return void
 34      */
 35     public function __construct() {
 36         add_action( 'admin_menu', array( $this, 'admin_menus') );
 37         add_action( 'admin_head', array( $this, 'admin_head' ) );
 38         add_action( 'admin_init', array( $this, 'welcome'    ) );
 39     }
 40 
 41     /**
 42      * Register the Dashboard Pages which are later hidden but these pages
 43      * are used to render the Welcome and Credits pages.
 44      *
 45      * @access public
 46      * @since 1.4
 47      * @return void
 48      */
 49     public function admin_menus() {
 50         // About Page
 51         add_dashboard_page(
 52             __( 'Welcome to Easy Digital Downloads', 'edd' ),
 53             __( 'Welcome to Easy Digital Downloads', 'edd' ),
 54             $this->minimum_capability,
 55             'edd-about',
 56             array( $this, 'about_screen' )
 57         );
 58 
 59         // Credits Page
 60         add_dashboard_page(
 61             __( 'Welcome to Easy Digital Downloads', 'edd' ),
 62             __( 'Welcome to Easy Digital Downloads', 'edd' ),
 63             $this->minimum_capability,
 64             'edd-credits',
 65             array( $this, 'credits_screen' )
 66         );
 67     }
 68 
 69     /**
 70      * Hide Individual Dashboard Pages
 71      *
 72      * @access public
 73      * @since 1.4
 74      * @return void
 75      */
 76     public function admin_head() {
 77         remove_submenu_page( 'index.php', 'edd-about' );
 78         remove_submenu_page( 'index.php', 'edd-credits' );
 79 
 80         // Badge for welcome page
 81         $badge_url = EDD_PLUGIN_URL . 'assets/images/edd-badge.png';
 82         ?>
 83         <style type="text/css" media="screen">
 84         /*<![CDATA[*/
 85         .edd-badge {
 86             padding-top: 150px;
 87             height: 52px;
 88             width: 185px;
 89             color: #666;
 90             font-weight: bold;
 91             font-size: 14px;
 92             text-align: center;
 93             text-shadow: 0 1px 0 rgba(255, 255, 255, 0.8);
 94             margin: 0 -5px;
 95             background: url('<?php echo $badge_url; ?>') no-repeat;
 96         }
 97 
 98         .about-wrap .edd-badge {
 99             position: absolute;
100             top: 0;
101             right: 0;
102         }
103         /*]]>*/
104         </style>
105         <?php
106     }
107 
108     /**
109      * Render About Screen
110      *
111      * @access public
112      * @since 1.4
113      * @return void
114      */
115     public function about_screen() {
116         list( $display_version ) = explode( '-', EDD_VERSION );
117         ?>
118         <div class="wrap about-wrap">
119             <h1><?php printf( __( 'Welcome to Easy Digital Downloads %s', 'edd' ), $display_version ); ?></h1>
120             <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Easy Digital Downloads %s is ready to make your online store faster, safer and better!', 'edd' ), $display_version ); ?></div>
121             <div class="edd-badge"><?php printf( __( 'Version %s', 'edd' ), $display_version ); ?></div>
122 
123             <h2 class="nav-tab-wrapper">
124                 <a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'edd-about' ), 'index.php' ) ) ); ?>">
125                     <?php _e( "What's New", 'edd' ); ?>
126                 </a><a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'edd-credits' ), 'index.php' ) ) ); ?>">
127                     <?php _e( 'Credits', 'edd' ); ?>
128                 </a>
129             </h2>
130 
131             <div class="changelog">
132                 <h3><?php _e( 'Improved Checkout User Experience', 'edd' ); ?></h3>
133 
134                 <div class="feature-section">
135 
136                     <h4><?php _e( 'Preload Default Payment Method', 'edd' ); ?></h4>
137                     <p><?php _e( 'You can now define the default payment method for customers that will be loaded immediately when accessing the checkout page. This saves the customer a click and results in more conversions for you.', 'edd' ); ?></p>
138 
139                     <h4><?php _e( 'Better Payment Method Select', 'edd' ); ?></h4>
140                     <p><?php _e( 'Payment methods are now displayed as radio buttons, making the options more accessible and easier to see / understand for customers.', 'edd' ); ?></p>
141 
142                     <h4><?php _e( 'Field Descriptions', 'edd' ); ?></h4>
143                     <p><?php _e( 'It has been proven by countless studies that descriptive text by every field helps customers complete the purchase process, so we have added description text for each field.', 'edd' ); ?></p>
144 
145                     <h4><?php _e( 'Reworked Field Order', 'edd' ); ?></h4>
146                     <p><?php _e( 'The order that the fields are displayed on the checkout has been updated to reflect the findings of many UX studies to help ensure customers have a simple, enjoyable experiencing purchasing through your store.', 'edd' ); ?></p>
147 
148                 </div>
149             </div>
150 
151             <div class="changelog">
152                 <h3><?php _e( 'Greatly Improved Discount Codes', 'edd' ); ?></h3>
153 
154                 <div class="feature-section">
155 
156                     <h4><?php _e( 'Per-Product Discounts', 'edd' ); ?></h4>
157                     <p><?php _e( 'Discount codes can now be restricted to individual (or several) products, giving you greater control over your marketing.', 'edd' ); ?></p>
158 
159                     <h4><?php _e( 'Once-Per-Customer Discounts', 'edd' ); ?></h4>
160                     <p><?php _e( 'You can now specify on a per-discount basis whether customers should be able to use a discount more than once.', 'edd' ); ?></p>
161 
162 
163                 </div>
164             </div>
165 
166             <div class="changelog">
167                 <h3><?php _e( 'Improved Tax Options', 'edd' ); ?></h3>
168 
169                 <div class="feature-section">
170 
171                     <h4><?php _e( 'Checkout Display Options', 'edd' ); ?></h4>
172                     <p><?php _e( 'New options to better control how taxes are displayed on checkout have been added.', 'edd' );  ?></p>
173 
174                     <h4><?php _e( 'Better Tax Calculation', 'edd' ); ?></h4>
175                     <p><?php _e( 'Taxes are now more accurately calculated and there is an option to set product prices as inclusive or exclusive of tax.', 'edd' );  ?></p>
176 
177                 </div>
178             </div>
179 
180             <div class="changelog">
181                 <h3><?php _e( 'Improved Reports and Data Export', 'edd' ); ?></h3>
182 
183                 <div class="feature-section">
184 
185                     <h4><?php _e( 'Per-Product Customer Export', 'edd' ); ?></h4>
186                     <p><?php printf( __( 'You can now export all customers that have purchased a particular product from the %sExport%s screen.', 'edd' ), '<a href="' . admin_url( 'edit.php?post_type=download&page=edd-reports&tab=export' ) . '">', '</a>' );  ?></p>
187 
188                     <h4><?php _e( 'Export Payment History By Status', 'edd' ); ?></h4>
189                     <p><?php _e( 'The Payment History export now includes an option to only export payments of a particular status. Want to export all of your failed payments? Now you can.', 'edd' );  ?></p>
190 
191                     <h4><?php _e( 'Estimated Monthly Stats', 'edd' ); ?></h4>
192                     <p><?php _e( 'Monthly estimates for sales and earnings are now displayed below the graphs in the Reports page.', 'edd' );  ?></p>
193 
194                 </div>
195             </div>
196 
197             <div class="changelog">
198                 <h3><?php _e( 'RESTful API', 'edd' ); ?></h3>
199 
200                 <div class="feature-section">
201                     <h4><?php _e( 'Creation of Third Party Stat Tracking Apps Now Possible', 'edd' ); ?></h4>
202                     <p><?php _e( 'The new RESTful API available in Easy Digital Downloads makes it possible to create 3rd party apps (iOS, Android, etc) for tracking your store sales and earnings.', 'edd' );  ?></p>
203 
204                     <p><?php printf( __( 'The API is %sfully documented%s and ready for developers to have fun with.', 'edd' ), '<a href="https://easydigitaldownloads.com/docs/edd-api-reference/" target="_blank">', '</a>' ); ?></p>
205                 </div>
206             </div>
207 
208             <div class="changelog">
209                 <h3><?php _e( 'Under the Hood', 'edd' ); ?></h3>
210 
211                 <div class="feature-section col three-col">
212                     <div>
213                         <h4><?php _e( 'EDD_Fees Class', 'edd' ); ?></h4>
214                         <p><?php printf( __( 'The new %sEDD_Fees class%s makes it possible to create arbitrary fees (or discounts) that are applied to the shopping cart contents.', 'edd' ), '<a href="https://github.com/pippinsplugins/Easy-Digital-Downloads/issues/418" target="_blank">', '</a>' ); ?></p>
215 
216                         <h4><?php _e( 'Better Session Management', 'edd' ); ?></h4>
217                         <p><?php printf( __( 'We have replaced usage of the standard PHP $_SESSION with the phenomenal %sWP_Session%s system developed by Eric Mann. This will provide a more stable experience and greater support for more hosts.', 'edd' ), '<a href="http://eamann.com/tech/introducing-wp_session/" target="_blank">', '</a>' ); ?></p>
218                     </div>
219 
220                     <div>
221                         <h4><?php _e( 'More Template Files', 'edd' ); ?></h4>
222                         <p><?php printf( __( 'Additional %stemplate files%s that can be modified via your theme have been added for the cart widget and shopping cart short code.', 'edd' ), '<a href="https://easydigitaldownloads.com/videos/template-files/" target="_blank">', '</a>' ); ?></p>
223 
224                         <h4><?php _e( 'Better AJAX Functionality', 'edd' ); ?></h4>
225                         <p><?php _e( 'The ajaxed functions, such as payment gateway loading, have been significantly improved to make them faster.', 'edd' ); ?></p>
226                     </div>
227 
228                     <div class="last-feature">
229                         <h4><?php _e( 'New Product Microdata', 'edd' ); ?></h4>
230                         <p><?php _e( 'Microdata defined by Schema.org/Product has been added to all download products to improve product appearance in search engines.', 'edd' ); ?></p>
231 
232                         <h4><?php _e( 'Improved Performance', 'edd' ); ?></h4>
233                         <p><?php _e( 'Memory usage and general performance of the plugin was investigated and dramatically improved in several key areas of the admin interfaces.', 'edd' ); ?></p>
234                     </div>
235                 </div>
236             </div>
237 
238             <div class="return-to-dashboard">
239                 <a href="<?php echo esc_url( admin_url( add_query_arg( array( 'post_type' => 'download', 'page' => 'edd-settings' ), 'edit.php' ) ) ); ?>"><?php _e( 'Go to Easy Digital Downloads Settings', 'edd' ); ?></a>
240             </div>
241         </div>
242         <?php
243     }
244 
245     /**
246      * Render Credits Screen
247      *
248      * @access public
249      * @since 1.4
250      * @return void
251      */
252     public function credits_screen() {
253         list( $display_version ) = explode( '-', EDD_VERSION );
254         ?>
255         <div class="wrap about-wrap">
256             <h1><?php printf( __( 'Welcome to Easy Digital Downloads %s', 'edd' ), $display_version ); ?></h1>
257             <div class="about-text"><?php printf( __( 'Thank you for updating to the latest version! Easy Digital Downloads %s is ready to make your online store faster, safer and better!', 'edd' ), $display_version ); ?></div>
258             <div class="edd-badge"><?php printf( __( 'Version %s', 'edd' ), $display_version ); ?></div>
259 
260             <h2 class="nav-tab-wrapper">
261                 <a class="nav-tab" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'edd-about' ), 'index.php' ) ) ); ?>">
262                     <?php _e( "What's New", 'edd' ); ?>
263                 </a><a class="nav-tab nav-tab-active" href="<?php echo esc_url( admin_url( add_query_arg( array( 'page' => 'edd-credits' ), 'index.php' ) ) ); ?>">
264                     <?php _e( 'Credits', 'edd' ); ?>
265                 </a>
266             </h2>
267 
268             <p class="about-description"><?php _e( 'Easy Digital Downloads is created by a worldwide team of developers who aim to provide the #1 eCommerce platform for selling digital goods through WordPress.', 'edd' ); ?></p>
269 
270             <?php echo $this->contributors(); ?>
271         </div>
272         <?php
273     }
274 
275 
276     /**
277      * Render Contributors List
278      *
279      * @since 1.4
280      * @uses EDD_Welcome::get_contributors()
281      * @return string $contributor_list HTML formatted list of all the contributors for EDD
282      */
283     public function contributors() {
284         $contributors = $this->get_contributors();
285 
286         if ( empty( $contributors ) )
287             return '';
288 
289         $contributor_list = '<ul class="wp-people-group">';
290 
291         foreach ( $contributors as $contributor ) {
292             $contributor_list .= '<li class="wp-person">';
293             $contributor_list .= sprintf( '<a href="%s" title="%s">',
294                 esc_url( 'https://github.com/' . $contributor->login ),
295                 esc_html( sprintf( __( 'View %s', 'edd' ), $contributor->login ) )
296             );
297             $contributor_list .= sprintf( '<img src="%s" width="64" height="64" class="gravatar" alt="%s" />', esc_url( $contributor->avatar_url ), esc_html( $contributor->login ) );
298             $contributor_list .= '</a>';
299             $contributor_list .= sprintf( '<a class="web" href="%s">%s</a>', esc_url( 'https://github.com/' . $contributor->login ), esc_html( $contributor->login ) );
300             $contributor_list .= '</a>';
301             $contributor_list .= '</li>';
302         }
303 
304         $contributor_list .= '</ul>';
305 
306         return $contributor_list;
307     }
308 
309     /**
310      * Retreive list of contributors from GitHub.
311      *
312      * @access public
313      * @since 1.4
314      * @return array $contributors List of contributors
315      */
316     public function get_contributors() {
317         $contributors = get_transient( 'edd_contributors' );
318 
319         if ( false !== $contributors )
320             return $contributors;
321 
322         $response = wp_remote_get( 'https://api.github.com/repos/pippinsplugins/Easy-Digital-Downloads/contributors', array( 'sslverify' => false ) );
323 
324         if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
325             return array();
326 
327         $contributors = json_decode( wp_remote_retrieve_body( $response ) );
328 
329         if ( ! is_array( $contributors ) )
330             return array();
331 
332         set_transient( 'edd_contributors', $contributors, 3600 );
333 
334         return $contributors;
335     }
336 
337     /**
338      * Sends user to the Welcome page on first activation of EDD as well as each
339      * time EDD is upgraded to a new version
340      *
341      * @access public
342      * @since 1.4
343      * @global $edd_options Array of all the EDD Options
344      * @return void
345      */
346     public function welcome() {
347         global $edd_options;
348 
349         // Bail if no activation redirect
350         if ( ! get_transient( '_edd_activation_redirect' ) )
351             return;
352 
353         // Delete the redirect transient
354         delete_transient( '_edd_activation_redirect' );
355 
356         // Bail if activating from network, or bulk
357         if ( is_network_admin() || isset( $_GET['activate-multi'] ) )
358             return;
359 
360         wp_safe_redirect( admin_url( 'index.php?page=edd-about' ) ); exit;
361     }
362 }
363 new EDD_Welcome();
Easy Digital Downloads API documentation generated by ApiGen 2.8.0