Better Documentation

In accordance with the [WordPress PHP Coding Standards](https://make.wordpress.org/core/handbook/best-practices/coding-standards/php/). This commit adds
- Short descriptions
- Period endings for comments, short descriptions, and long descriptions.
This commit is contained in:
Ahmad Awais 2015-10-29 19:06:28 +05:00
parent 4522b68a47
commit c3fdb948da
1 changed files with 25 additions and 21 deletions

View File

@ -17,13 +17,13 @@
* @author WooThemes
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
exit; // Exit if accessed directly.
}
if ( ! class_exists( 'WooCommerce' ) ) :
/**
* Main WooCommerce Class
* Main WooCommerce Class.
*
* @class WooCommerce
* @version 2.4.0
@ -36,7 +36,7 @@ final class WooCommerce {
public $version = '2.5.0';
/**
* @var WooCommerce The single instance of the class
* @var WooCommerce The single instance of the class.
* @since 2.1
*/
protected static $_instance = null;
@ -82,14 +82,14 @@ final class WooCommerce {
public $order_factory = null;
/**
* Main WooCommerce Instance
* Main WooCommerce Instance.
*
* Ensures only one instance of WooCommerce is loaded or can be loaded.
*
* @since 2.1
* @static
* @see WC()
* @return WooCommerce - Main instance
* @return WooCommerce - Main instance.
*/
public static function instance() {
if ( is_null( self::$_instance ) ) {
@ -137,7 +137,7 @@ final class WooCommerce {
}
/**
* Hook into actions and filters
* Hook into actions and filters.
* @since 2.3
*/
private function init_hooks() {
@ -150,7 +150,7 @@ final class WooCommerce {
}
/**
* Define WC Constants
* Define WC Constants.
*/
private function define_constants() {
$upload_dir = wp_upload_dir();
@ -168,7 +168,8 @@ final class WooCommerce {
}
/**
* Define constant if not already set
* Define constant if not already set.
*
* @param string $name
* @param string|bool $value
*/
@ -180,7 +181,8 @@ final class WooCommerce {
/**
* What type of request is this?
* string $type ajax, frontend or admin
* string $type ajax, frontend or admin.
*
* @return bool
*/
private function is_request( $type ) {
@ -277,25 +279,25 @@ final class WooCommerce {
* Init WooCommerce when WordPress Initialises.
*/
public function init() {
// Before init action
// Before init action.
do_action( 'before_woocommerce_init' );
// Set up localisation
// Set up localisation.
$this->load_plugin_textdomain();
// Load class instances
// Load class instances.
$this->product_factory = new WC_Product_Factory(); // Product Factory to create new product instances
$this->order_factory = new WC_Order_Factory(); // Order Factory to create new order instances
$this->countries = new WC_Countries(); // Countries class
$this->integrations = new WC_Integrations(); // Integrations class
// Session class, handles session data for users - can be overwritten if custom handler is needed
// Session class, handles session data for users - can be overwritten if custom handler is needed.
if ( $this->is_request( 'frontend' ) || $this->is_request( 'cron' ) ) {
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
$this->session = new $session_class();
}
// Classes/actions loaded for the frontend and for ajax requests
// Classes/actions loaded for the frontend and for ajax requests.
if ( $this->is_request( 'frontend' ) ) {
$this->cart = new WC_Cart(); // Cart class, stores the cart contents
$this->customer = new WC_Customer(); // Customer class, handles data such as customer location
@ -303,7 +305,7 @@ final class WooCommerce {
$this->load_webhooks();
// Init action
// Init action.
do_action( 'woocommerce_init' );
}
@ -337,7 +339,7 @@ final class WooCommerce {
}
/**
* Ensure post thumbnail support is turned on
* Ensure post thumbnail support is turned on.
*/
private function add_thumbnail_support() {
if ( ! current_theme_supports( 'post-thumbnails' ) ) {
@ -347,7 +349,7 @@ final class WooCommerce {
}
/**
* Add WC Image sizes to WP
* Add WC Image sizes to WP.
*
* @since 2.3
*/
@ -394,7 +396,7 @@ final class WooCommerce {
}
/**
* Return the WC API URL for a given request
* Return the WC API URL for a given request.
*
* @param string $request
* @param mixed $ssl (default: null)
@ -421,7 +423,7 @@ final class WooCommerce {
}
/**
* Load & enqueue active webhooks
* Load & enqueue active webhooks.
*
* @since 2.2
*/
@ -450,7 +452,7 @@ final class WooCommerce {
}
/**
* Get gateways class
* Get gateways class.
* @return WC_Payment_Gateways
*/
public function payment_gateways() {
@ -458,7 +460,7 @@ final class WooCommerce {
}
/**
* Get shipping class
* Get shipping class.
* @return WC_Shipping
*/
public function shipping() {
@ -477,6 +479,8 @@ final class WooCommerce {
endif;
/**
* Main instance of WooCommerce.
*
* Returns the main instance of WC to prevent the need to use globals.
*
* @since 2.1