Merge pull request #7297 from shivapoudel/docblocks

Docblocks Fixes
This commit is contained in:
Mike Jolley 2015-02-05 11:23:06 +00:00
commit f5ff10711d
5 changed files with 104 additions and 109 deletions

View File

@ -2,14 +2,15 @@
/** /**
* Adds settings to the permalinks admin settings page. * Adds settings to the permalinks admin settings page.
* *
* @class WC_Admin_Permalink_Settings
* @author WooThemes * @author WooThemes
* @category Admin * @category Admin
* @package WooCommerce/Admin * @package WooCommerce/Admin
* @version 2.1.0 * @version 2.3.0
*/ */
if ( ! defined( 'ABSPATH' ) ) { if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly exit;
} }
if ( ! class_exists( 'WC_Admin_Permalink_Settings' ) ) : if ( ! class_exists( 'WC_Admin_Permalink_Settings' ) ) :
@ -28,7 +29,7 @@ class WC_Admin_Permalink_Settings {
} }
/** /**
* Init our settings * Init our settings.
*/ */
public function settings_init() { public function settings_init() {
// Add a section to the permalinks page // Add a section to the permalinks page
@ -89,7 +90,7 @@ class WC_Admin_Permalink_Settings {
} }
/** /**
* Show the settings * Show the settings.
*/ */
public function settings() { public function settings() {
echo wpautop( __( 'These settings control the permalinks used for products. These settings only apply when <strong>not using "default" permalinks above</strong>.', 'woocommerce' ) ); echo wpautop( __( 'These settings control the permalinks used for products. These settings only apply when <strong>not using "default" permalinks above</strong>.', 'woocommerce' ) );
@ -153,7 +154,7 @@ class WC_Admin_Permalink_Settings {
} }
/** /**
* Save the settings * Save the settings.
*/ */
public function settings_save() { public function settings_save() {

View File

@ -1,31 +1,32 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/** /**
* Comments * Comments
* *
* Handle comments (reviews and order notes) * Handle comments (reviews and order notes)
* *
* @class WC_Post_types * @class WC_Comments
* @version 2.3.0 * @version 2.3.0
* @package WooCommerce/Classes/Products * @package WooCommerce/Classes/Products
* @category Class * @category Class
* @author WooThemes * @author WooThemes
*/ */
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
class WC_Comments { class WC_Comments {
/** /**
* Hook in methods * Hook in methods.
*/ */
public static function init() { public static function init() {
// Rating posts // Rating posts
add_filter( 'preprocess_comment', array( __CLASS__, 'check_comment_rating' ), 0 ); add_filter( 'preprocess_comment', array( __CLASS__, 'check_comment_rating' ), 0 );
add_action( 'comment_post', array( __CLASS__, 'add_comment_rating' ), 1 ); add_action( 'comment_post', array( __CLASS__, 'add_comment_rating' ), 1 );
// clear transients // Clear transients
add_action( 'wp_update_comment_count', array( __CLASS__, 'clear_transients' ) ); add_action( 'wp_update_comment_count', array( __CLASS__, 'clear_transients' ) );
// Secure order notes // Secure order notes
@ -41,7 +42,7 @@ class WC_Comments {
// Count comments // Count comments
add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 ); add_filter( 'wp_count_comments', array( __CLASS__, 'wp_count_comments' ), 10, 2 );
// support avatars for `review` comment type // Support avatars for `review` comment type
add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) ); add_filter( 'get_avatar_comment_types', array( __CLASS__, 'add_avatar_for_review_comment_type' ) );
} }
@ -53,8 +54,7 @@ class WC_Comments {
* shop managers can view orders anyway. * shop managers can view orders anyway.
* *
* The frontend view order pages get around this filter by using remove_filter('comments_clauses', array( 'WC_Comments' ,'exclude_order_comments'), 10, 1 ); * The frontend view order pages get around this filter by using remove_filter('comments_clauses', array( 'WC_Comments' ,'exclude_order_comments'), 10, 1 );
* * @param array $clauses
* @param array $clauses
* @return array * @return array
*/ */
public static function exclude_order_comments( $clauses ) { public static function exclude_order_comments( $clauses ) {
@ -83,8 +83,7 @@ class WC_Comments {
/** /**
* Exclude order comments from queries and RSS * Exclude order comments from queries and RSS
* * @param string $join
* @param string $join
* @return string * @return string
*/ */
public static function exclude_order_comments_from_feed_join( $join ) { public static function exclude_order_comments_from_feed_join( $join ) {
@ -99,8 +98,7 @@ class WC_Comments {
/** /**
* Exclude order comments from queries and RSS * Exclude order comments from queries and RSS
* * @param string $where
* @param string $where
* @return string * @return string
*/ */
public static function exclude_order_comments_from_feed_where( $where ) { public static function exclude_order_comments_from_feed_where( $where ) {
@ -117,9 +115,8 @@ class WC_Comments {
/** /**
* Exclude webhook comments from queries and RSS * Exclude webhook comments from queries and RSS
* * @since 2.2
* @since 2.2 * @param array $clauses
* @param array $clauses
* @return array * @return array
*/ */
public static function exclude_webhook_comments( $clauses ) { public static function exclude_webhook_comments( $clauses ) {
@ -144,9 +141,8 @@ class WC_Comments {
/** /**
* Exclude webhook comments from queries and RSS * Exclude webhook comments from queries and RSS
* * @since 2.2
* @since 2.2 * @param string $join
* @param string $join
* @return string * @return string
*/ */
public static function exclude_webhook_comments_from_feed_join( $join ) { public static function exclude_webhook_comments_from_feed_join( $join ) {
@ -161,9 +157,8 @@ class WC_Comments {
/** /**
* Exclude webhook comments from queries and RSS * Exclude webhook comments from queries and RSS
* * @since 2.1
* @since 2.1 * @param string $where
* @param string $where
* @return string * @return string
*/ */
public static function exclude_webhook_comments_from_feed_where( $where ) { public static function exclude_webhook_comments_from_feed_where( $where ) {
@ -180,8 +175,7 @@ class WC_Comments {
/** /**
* Validate the comment ratings. * Validate the comment ratings.
* * @param array $comment_data
* @param array $comment_data
* @return array * @return array
*/ */
public static function check_comment_rating( $comment_data ) { public static function check_comment_rating( $comment_data ) {
@ -196,7 +190,6 @@ class WC_Comments {
/** /**
* Rating field for comments. * Rating field for comments.
*
* @param int $comment_id * @param int $comment_id
*/ */
public static function add_comment_rating( $comment_id ) { public static function add_comment_rating( $comment_id ) {
@ -211,7 +204,6 @@ class WC_Comments {
/** /**
* Clear transients for a review. * Clear transients for a review.
*
* @param int $post_id * @param int $post_id
*/ */
public static function clear_transients( $post_id ) { public static function clear_transients( $post_id ) {
@ -229,10 +221,9 @@ class WC_Comments {
/** /**
* Remove order notes from wp_count_comments() * Remove order notes from wp_count_comments()
* * @since 2.2
* @since 2.2 * @param object $stats
* @param object $stats * @param int $post_id
* @param int $post_id
* @return object * @return object
*/ */
public static function wp_count_comments( $stats, $post_id ) { public static function wp_count_comments( $stats, $post_id ) {
@ -276,9 +267,8 @@ class WC_Comments {
/** /**
* Make sure WP displays avatars for comments with the `review` type * Make sure WP displays avatars for comments with the `review` type
* * @since 2.3
* @since 2.3 * @param array $comment_types
* @param array $comment_types
* @return array * @return array
*/ */
public static function add_avatar_for_review_comment_type( $comment_types ) { public static function add_avatar_for_review_comment_type( $comment_types ) {

View File

@ -1,17 +1,20 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/** /**
* Handle frontend scripts * Handle frontend scripts
* *
* @class WC_Frontend_Scripts * @class WC_Frontend_Scripts
* @version 2.3.0 * @version 2.3.0
* @package WooCommerce/Classes/ * @package WooCommerce/Classes/
* @category Class * @category Class
* @author WooThemes * @author WooThemes
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Frontend_Scripts Class
*/ */
class WC_Frontend_Scripts { class WC_Frontend_Scripts {
@ -28,7 +31,7 @@ class WC_Frontend_Scripts {
private static $wp_localize_scripts = array(); private static $wp_localize_scripts = array();
/** /**
* Hook in methods * Hook in methods.
*/ */
public static function init() { public static function init() {
add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) ); add_action( 'wp_enqueue_scripts', array( __CLASS__, 'load_scripts' ) );
@ -37,7 +40,7 @@ class WC_Frontend_Scripts {
} }
/** /**
* Get styles for the frontend * Get styles for the frontend.
* @access private * @access private
* @return array * @return array
*/ */
@ -65,15 +68,15 @@ class WC_Frontend_Scripts {
} }
/** /**
* Register a script for use * Register a script for use.
* *
* @uses wp_register_script() * @uses wp_register_script()
* @access private * @access private
* @param string $handle [description] * @param string $handle [description]
* @param string $path [description] * @param string $path [description]
* @param string[] $deps [description] * @param string[] $deps [description]
* @param string $version [description] * @param string $version [description]
* @param boolean $in_footer [description] * @param boolean $in_footer [description]
*/ */
private static function register_script( $handle, $path, $deps = array( 'jquery' ), $version = WC_VERSION, $in_footer = true ) { private static function register_script( $handle, $path, $deps = array( 'jquery' ), $version = WC_VERSION, $in_footer = true ) {
self::$scripts[] = $handle; self::$scripts[] = $handle;
@ -81,15 +84,15 @@ class WC_Frontend_Scripts {
} }
/** /**
* Register and enqueue a script for use * Register and enqueue a script for use.
* *
* @uses wp_enqueue_script() * @uses wp_enqueue_script()
* @access private * @access private
* @param string $handle [description] * @param string $handle [description]
* @param string $path [description] * @param string $path [description]
* @param string[] $deps [description] * @param string[] $deps [description]
* @param string $version [description] * @param string $version [description]
* @param boolean $in_footer [description] * @param boolean $in_footer [description]
*/ */
private static function enqueue_script( $handle, $path = '', $deps = array( 'jquery' ), $version = WC_VERSION, $in_footer = true ) { private static function enqueue_script( $handle, $path = '', $deps = array( 'jquery' ), $version = WC_VERSION, $in_footer = true ) {
if ( ! in_array( $handle, self::$scripts ) && $path ) { if ( ! in_array( $handle, self::$scripts ) && $path ) {
@ -100,8 +103,6 @@ class WC_Frontend_Scripts {
/** /**
* Register/queue frontend scripts. * Register/queue frontend scripts.
*
* @access public
*/ */
public static function load_scripts() { public static function load_scripts() {
global $post; global $post;
@ -184,7 +185,7 @@ class WC_Frontend_Scripts {
/** /**
* Localize a WC script once. * Localize a WC script once.
* @access private * @access private
* @since 2.3.0 this needs less wp_script_is() calls due to https://core.trac.wordpress.org/ticket/28404 being added in WP 4.0. * @since 2.3.0 this needs less wp_script_is() calls due to https://core.trac.wordpress.org/ticket/28404 being added in WP 4.0.
* @param string $handle * @param string $handle
*/ */
private static function localize_script( $handle ) { private static function localize_script( $handle ) {
@ -196,7 +197,7 @@ class WC_Frontend_Scripts {
} }
/** /**
* Return data for script handles * Return data for script handles.
* @access private * @access private
* @param string $handle * @param string $handle
* @return array|bool * @return array|bool

View File

@ -1,24 +1,27 @@
<?php <?php
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly
}
/** /**
* Post types * Post Types
* *
* Registers post types and taxonomies * Registers post types and taxonomies
* *
* @class WC_Post_types * @class WC_Post_types
* @version 2.2.0 * @version 2.3.0
* @package WooCommerce/Classes/Products * @package WooCommerce/Classes/Products
* @category Class * @category Class
* @author WooThemes * @author WooThemes
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* WC_Post_types Class
*/ */
class WC_Post_types { class WC_Post_types {
/** /**
* Hook in methods * Hook in methods.
*/ */
public static function init() { public static function init() {
add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 ); add_action( 'init', array( __CLASS__, 'register_taxonomies' ), 5 );
@ -28,7 +31,7 @@ class WC_Post_types {
} }
/** /**
* Register WooCommerce taxonomies. * Register core taxonomies.
*/ */
public static function register_taxonomies() { public static function register_taxonomies() {
if ( taxonomy_exists( 'product_type' ) ) { if ( taxonomy_exists( 'product_type' ) ) {
@ -40,16 +43,16 @@ class WC_Post_types {
$permalinks = get_option( 'woocommerce_permalinks' ); $permalinks = get_option( 'woocommerce_permalinks' );
register_taxonomy( 'product_type', register_taxonomy( 'product_type',
apply_filters( 'woocommerce_taxonomy_objects_product_type', array( 'product' ) ), apply_filters( 'woocommerce_taxonomy_objects_product_type', array( 'product' ) ),
apply_filters( 'woocommerce_taxonomy_args_product_type', array( apply_filters( 'woocommerce_taxonomy_args_product_type', array(
'hierarchical' => false, 'hierarchical' => false,
'show_ui' => false, 'show_ui' => false,
'show_in_nav_menus' => false, 'show_in_nav_menus' => false,
'query_var' => is_admin(), 'query_var' => is_admin(),
'rewrite' => false, 'rewrite' => false,
'public' => false 'public' => false
) ) ) )
); );
register_taxonomy( 'product_cat', register_taxonomy( 'product_cat',
apply_filters( 'woocommerce_taxonomy_objects_product_cat', array( 'product' ) ), apply_filters( 'woocommerce_taxonomy_objects_product_cat', array( 'product' ) ),
@ -210,7 +213,7 @@ class WC_Post_types {
} }
/** /**
* Register core post types * Register core post types.
*/ */
public static function register_post_types() { public static function register_post_types() {
if ( post_type_exists('product') ) { if ( post_type_exists('product') ) {
@ -404,7 +407,7 @@ class WC_Post_types {
} }
/** /**
* Register our custom post statuses, used for order status * Register our custom post statuses, used for order status.
*/ */
public static function register_post_status() { public static function register_post_status() {
register_post_status( 'wc-pending', array( register_post_status( 'wc-pending', array(
@ -466,13 +469,13 @@ class WC_Post_types {
} }
/** /**
* Add Product Support to Jetpack Omnisearch * Add Product Support to Jetpack Omnisearch.
*/ */
public static function support_jetpack_omnisearch() { public static function support_jetpack_omnisearch() {
if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) { if ( class_exists( 'Jetpack_Omnisearch_Posts' ) ) {
new Jetpack_Omnisearch_Posts( 'product' ); new Jetpack_Omnisearch_Posts( 'product' );
} }
} }
} }
WC_Post_types::init(); WC_Post_types::init();

View File

@ -21,15 +21,15 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
parent::setUp(); parent::setUp();
// add custom factories // Add custom factories
$this->factory = new WC_Unit_Test_Factory(); $this->factory = new WC_Unit_Test_Factory();
// setup mock WC session handler // Setup mock WC session handler
add_filter( 'woocommerce_session_handler', array( $this, 'set_mock_session_handler' ) ); add_filter( 'woocommerce_session_handler', array( $this, 'set_mock_session_handler' ) );
$this->setOutputCallback( array( $this, 'filter_output' ) ); $this->setOutputCallback( array( $this, 'filter_output' ) );
// register post types before each test // Register post types before each test
WC_Post_types::register_post_types(); WC_Post_types::register_post_types();
WC_Post_types::register_taxonomies(); WC_Post_types::register_taxonomies();
} }
@ -38,7 +38,7 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
* Mock the WC session using the abstract class as cookies are not available * Mock the WC session using the abstract class as cookies are not available
* during tests * during tests
* *
* @since 2.2 * @since 2.2
* @return string * @return string
*/ */
public function set_mock_session_handler() { public function set_mock_session_handler() {
@ -64,7 +64,7 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
* Asserts thing is not WP_Error * Asserts thing is not WP_Error
* *
* @since 2.2 * @since 2.2
* @param mixed $actual * @param mixed $actual
* @param string $message * @param string $message
*/ */
public function assertNotWPError( $actual, $message = '' ) { public function assertNotWPError( $actual, $message = '' ) {
@ -74,7 +74,7 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
/** /**
* Asserts thing is WP_Error * Asserts thing is WP_Error
* *
* @param $actual * @param mixed $actual
* @param string $message * @param string $message
*/ */
public function assertIsWPError( $actual, $message = '' ) { public function assertIsWPError( $actual, $message = '' ) {
@ -84,9 +84,9 @@ class WC_Unit_Test_Case extends WP_UnitTestCase {
/** /**
* Backport assertNotFalse to PHPUnit 3.6.12 which only runs in PHP 5.2 * Backport assertNotFalse to PHPUnit 3.6.12 which only runs in PHP 5.2
* *
* @since 2.2 * @since 2.2
* @param $condition * @param $condition
* @param string $message * @param string $message
* @return mixed * @return mixed
*/ */
public static function assertNotFalse( $condition, $message = '' ) { public static function assertNotFalse( $condition, $message = '' ) {