Merge pull request #3830 from tivnet/master

woocommerce.php PHPDoc cleanup: correct @returns and @deprecated markup
This commit is contained in:
Mike Jolley 2013-09-24 23:58:12 -07:00
commit 51cc6b1bd5
1 changed files with 135 additions and 35 deletions

View File

@ -48,7 +48,7 @@ final class WooCommerce {
* @since 2.1 * @since 2.1
* @static * @static
* @see WC() * @see WC()
* @return Main WooCommerce instance * @return WooCommerce - Main instance
*/ */
public static function instance() { public static function instance() {
if ( is_null( self::$_instance ) ) if ( is_null( self::$_instance ) )
@ -76,9 +76,8 @@ final class WooCommerce {
/** /**
* WooCommerce Constructor. * WooCommerce Constructor.
*
* @access public * @access public
* @return void * @return WooCommerce
*/ */
public function __construct() { public function __construct() {
// Auto-load classes on demand // Auto-load classes on demand
@ -485,8 +484,7 @@ final class WooCommerce {
/** /**
* Init the mailer and call the notifications for the current filter. * Init the mailer and call the notifications for the current filter.
* * @internal param array $args (default: array())
* @param array $args (default: array())
* @return void * @return void
*/ */
public function send_transactional_email() { public function send_transactional_email() {
@ -535,173 +533,275 @@ final class WooCommerce {
/** Deprecated methods *********************************************************/ /** Deprecated methods *********************************************************/
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $image_size
* @return array
*/
public function get_image_size( $image_size ) { public function get_image_size( $image_size ) {
_deprecated_function( 'Woocommerce->get_image_size', '2.1', 'wc_get_image_size()' ); _deprecated_function( 'Woocommerce->get_image_size', '2.1', 'wc_get_image_size()' );
return wc_get_image_size( $image_size ); return wc_get_image_size( $image_size );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @return WC_Logger
*/
public function logger() { public function logger() {
_deprecated_function( 'Woocommerce->logger', '2.1', 'new WC_Logger()' ); _deprecated_function( 'Woocommerce->logger', '2.1', 'new WC_Logger()' );
return new WC_Logger(); return new WC_Logger();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @return WC_Validation
*/
public function validation() { public function validation() {
_deprecated_function( 'Woocommerce->validation', '2.1', 'new WC_Validation()' ); _deprecated_function( 'Woocommerce->validation', '2.1', 'new WC_Validation()' );
return new WC_Validation(); return new WC_Validation();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $post
* @return WC_Product
*/
public function setup_product_data( $post ) { public function setup_product_data( $post ) {
_deprecated_function( 'Woocommerce->setup_product_data', '2.1', 'wc_setup_product_data' ); _deprecated_function( 'Woocommerce->setup_product_data', '2.1', 'wc_setup_product_data' );
return wc_setup_product_data( $post ); return wc_setup_product_data( $post );
} }
// Deprecated 2.1.0 Access via the WC_Transient_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Transient_Helper helper
* @param $content
* @return string
*/
public function force_ssl( $content ) { public function force_ssl( $content ) {
_deprecated_function( 'Woocommerce->force_ssl', '2.1', 'WC_HTTPS::force_https_url' ); _deprecated_function( 'Woocommerce->force_ssl', '2.1', 'WC_HTTPS::force_https_url' );
return WC_HTTPS::force_https_url( $content ); return WC_HTTPS::force_https_url( $content );
} }
// Deprecated 2.1.0 Access via the WC_Transient_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Transient_Helper helper
* @param int $post_id
*/
public function clear_product_transients( $post_id = 0 ) { public function clear_product_transients( $post_id = 0 ) {
_deprecated_function( 'Woocommerce->clear_product_transients', '2.1', 'wc_delete_product_transients' ); _deprecated_function( 'Woocommerce->clear_product_transients', '2.1', 'wc_delete_product_transients' );
wc_delete_product_transients( $post_id ); wc_delete_product_transients( $post_id );
} }
// Deprecated 2.1.0 Access via the WC_Inline_Javascript_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Inline_Javascript_Helper helper
* @param $code
*/
public function add_inline_js( $code ) { public function add_inline_js( $code ) {
_deprecated_function( 'Woocommerce->add_inline_js', '2.1', 'wc_enqueue_js' ); _deprecated_function( 'Woocommerce->add_inline_js', '2.1', 'wc_enqueue_js' );
wc_enqueue_js( $code ); wc_enqueue_js( $code );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $action
* @param bool $referer
* @param bool $echo
* @return string
*/
public function nonce_field( $action, $referer = true , $echo = true ) { public function nonce_field( $action, $referer = true , $echo = true ) {
_deprecated_function( 'Woocommerce->nonce_field', '2.1', 'wp_nonce_field' ); _deprecated_function( 'Woocommerce->nonce_field', '2.1', 'wp_nonce_field' );
return wp_nonce_field('woocommerce-' . $action, '_wpnonce', $referer, $echo ); return wp_nonce_field('woocommerce-' . $action, '_wpnonce', $referer, $echo );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $action
* @param string $url
* @return string
*/
public function nonce_url( $action, $url = '' ) { public function nonce_url( $action, $url = '' ) {
_deprecated_function( 'Woocommerce->nonce_url', '2.1', 'wp_nonce_url' ); _deprecated_function( 'Woocommerce->nonce_url', '2.1', 'wp_nonce_url' );
return wp_nonce_url( $url , 'woocommerce-' . $action ); return wp_nonce_url( $url , 'woocommerce-' . $action );
} }
// Deprecated 2.1.0 Access via the WC_Nonce_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Nonce_Helper helper
* @param $action
* @param string $method
* @param bool $error_message
* @return bool
*/
public function verify_nonce( $action, $method = '_POST', $error_message = false ) { public function verify_nonce( $action, $method = '_POST', $error_message = false ) {
_deprecated_function( 'Woocommerce->verify_nonce', '2.1', 'WC_Nonce_Helper->verify_nonce' ); _deprecated_function( 'Woocommerce->verify_nonce', '2.1', 'WC_Nonce_Helper->verify_nonce' );
return wp_verify_nonce( $$_method[ '_wpnonce' ], 'woocommerce-' . $action ); return wp_verify_nonce( $$_method[ '_wpnonce' ], 'woocommerce-' . $action );
} }
// Deprecated 2.1.0 Access via the WC_Shortcode_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Shortcode_Helper helper
* @param $function
* @param array $atts
* @param array $wrapper
* @return string
*/
public function shortcode_wrapper( $function, $atts = array(), $wrapper = array( 'class' => 'woocommerce', 'before' => null, 'after' => null ) ) { public function shortcode_wrapper( $function, $atts = array(), $wrapper = array( 'class' => 'woocommerce', 'before' => null, 'after' => null ) ) {
_deprecated_function( 'Woocommerce->shortcode_wrapper', '2.1', 'WC_Shortcodes::shortcode_wrapper' ); _deprecated_function( 'Woocommerce->shortcode_wrapper', '2.1', 'WC_Shortcodes::shortcode_wrapper' );
return WC_Shortcodes::shortcode_wrapper( $function, $atts, $wrapper ); return WC_Shortcodes::shortcode_wrapper( $function, $atts, $wrapper );
} }
// Deprecated 2.1.0 Access via the WC_Attribute_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Attribute_Helper helper
* @return object
*/
public function get_attribute_taxonomies() { public function get_attribute_taxonomies() {
_deprecated_function( 'Woocommerce->get_attribute_taxonomies', '2.1', 'wc_get_attribute_taxonomies' ); _deprecated_function( 'Woocommerce->get_attribute_taxonomies', '2.1', 'wc_get_attribute_taxonomies' );
return wc_get_attribute_taxonomies(); return wc_get_attribute_taxonomies();
} }
// Deprecated 2.1.0 Access via the WC_Attribute_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Attribute_Helper helper
* @param $name
* @return string
*/
public function attribute_taxonomy_name( $name ) { public function attribute_taxonomy_name( $name ) {
_deprecated_function( 'Woocommerce->attribute_taxonomy_name', '2.1', 'wc_attribute_taxonomy_name' ); _deprecated_function( 'Woocommerce->attribute_taxonomy_name', '2.1', 'wc_attribute_taxonomy_name' );
return wc_attribute_taxonomy_name( $name ); return wc_attribute_taxonomy_name( $name );
} }
// Deprecated 2.1.0 Access via the WC_Attribute_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Attribute_Helper helper
* @param $name
* @return string
*/
public function attribute_label( $name ) { public function attribute_label( $name ) {
_deprecated_function( 'Woocommerce->attribute_label', '2.1', 'wc_attribute_label' ); _deprecated_function( 'Woocommerce->attribute_label', '2.1', 'wc_attribute_label' );
return wc_attribute_label( $name ); return wc_attribute_label( $name );
} }
// Deprecated 2.1.0 Access via the WC_Attribute_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Attribute_Helper helper
* @param $name
* @return string
*/
public function attribute_orderby( $name ) { public function attribute_orderby( $name ) {
_deprecated_function( 'Woocommerce->attribute_orderby', '2.1', 'wc_attribute_orderby' ); _deprecated_function( 'Woocommerce->attribute_orderby', '2.1', 'wc_attribute_orderby' );
return wc_attribute_orderby( $name ); return wc_attribute_orderby( $name );
} }
// Deprecated 2.1.0 Access via the WC_Attribute_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Attribute_Helper helper
* @return array
*/
public function get_attribute_taxonomy_names() { public function get_attribute_taxonomy_names() {
_deprecated_function( 'Woocommerce->get_attribute_taxonomy_names', '2.1', 'wc_get_attribute_taxonomy_names' ); _deprecated_function( 'Woocommerce->get_attribute_taxonomy_names', '2.1', 'wc_get_attribute_taxonomy_names' );
return wc_get_attribute_taxonomy_names(); return wc_get_attribute_taxonomy_names();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @return array
*/
public function get_coupon_discount_types() { public function get_coupon_discount_types() {
_deprecated_function( 'Woocommerce->get_coupon_discount_types', '2.1', 'wc_get_coupon_types' ); _deprecated_function( 'Woocommerce->get_coupon_discount_types', '2.1', 'wc_get_coupon_types' );
return wc_get_coupon_types(); return wc_get_coupon_types();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param string $type
* @return string
*/
public function get_coupon_discount_type( $type = '' ) { public function get_coupon_discount_type( $type = '' ) {
_deprecated_function( 'Woocommerce->get_coupon_discount_type', '2.1', 'wc_get_coupon_type' ); _deprecated_function( 'Woocommerce->get_coupon_discount_type', '2.1', 'wc_get_coupon_type' );
return wc_get_coupon_type( $type ); return wc_get_coupon_type( $type );
} }
// Deprecated 2.1.0 Access via the WC_Body_Class_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Body_Class_Helper helper
* @param $class
*/
public function add_body_class( $class ) { public function add_body_class( $class ) {
_deprecated_function( 'Woocommerce->add_body_class', '2.1' ); _deprecated_function( 'Woocommerce->add_body_class', '2.1' );
} }
// Deprecated 2.1.0 Access via the WC_Body_Class_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Body_Class_Helper helper
* @param $classes
*/
public function output_body_class( $classes ) { public function output_body_class( $classes ) {
_deprecated_function( 'Woocommerce->output_body_class', '2.1' ); _deprecated_function( 'Woocommerce->output_body_class', '2.1' );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $error
*/
public function add_error( $error ) { public function add_error( $error ) {
_deprecated_function( 'Woocommerce->add_error', '2.1', 'wc_add_error' ); _deprecated_function( 'Woocommerce->add_error', '2.1', 'wc_add_error' );
wc_add_error( $error ); wc_add_error( $error );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @param $message
*/
public function add_message( $message ) { public function add_message( $message ) {
_deprecated_function( 'Woocommerce->add_message', '2.1', 'wc_add_message' ); _deprecated_function( 'Woocommerce->add_message', '2.1', 'wc_add_message' );
wc_add_message( $message ); wc_add_message( $message );
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
*/
public function clear_messages() { public function clear_messages() {
_deprecated_function( 'Woocommerce->clear_messages', '2.1', 'wc_clear_messages' ); _deprecated_function( 'Woocommerce->clear_messages', '2.1', 'wc_clear_messages' );
wc_clear_messages(); wc_clear_messages();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @return int
*/
public function error_count() { public function error_count() {
_deprecated_function( 'Woocommerce->error_count', '2.1', 'wc_error_count' ); _deprecated_function( 'Woocommerce->error_count', '2.1', 'wc_error_count' );
return wc_error_count(); return wc_error_count();
} }
// Deprecated 2.1.0 /**
* @deprecated 2.1.0
* @return int
*/
public function message_count() { public function message_count() {
_deprecated_function( 'Woocommerce->message_count', '2.1', 'wc_message_count' ); _deprecated_function( 'Woocommerce->message_count', '2.1', 'wc_message_count' );
return wc_message_count(); return wc_message_count();
} }
// Deprecated 2.1.0 Access via the WC_Messages_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Messages_Helper helper
* @return mixed
*/
public function get_errors() { public function get_errors() {
_deprecated_function( 'Woocommerce->get_errors', '2.1', 'WC_Messages_Helper->get_errors' ); _deprecated_function( 'Woocommerce->get_errors', '2.1', 'WC_Messages_Helper->get_errors' );
return $this->session->get( 'wc_errors', array() ); return $this->session->get( 'wc_errors', array() );
} }
// Deprecated 2.1.0 Access via the WC_Messages_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Messages_Helper helper
* @return mixed
*/
public function get_messages() { public function get_messages() {
_deprecated_function( 'Woocommerce->get_messages', '2.1', 'WC_Messages_Helper->get_messages' ); _deprecated_function( 'Woocommerce->get_messages', '2.1', 'WC_Messages_Helper->get_messages' );
return $this->session->get( 'wc_messages', array() ); return $this->session->get( 'wc_messages', array() );
} }
// Deprecated 2.1.0 Access via the WC_Messages_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Messages_Helper helper
*/
public function show_messages() { public function show_messages() {
_deprecated_function( 'Woocommerce->show_messages', '2.1', 'wc_print_messages()' ); _deprecated_function( 'Woocommerce->show_messages', '2.1', 'wc_print_messages()' );
wc_print_messages(); wc_print_messages();
} }
// Deprecated 2.1.0 Access via the WC_Messages_Helper helper /**
* @deprecated 2.1.0 Access via the WC_Messages_Helper helper
*/
public function set_messages() { public function set_messages() {
_deprecated_function( 'Woocommerce->set_messages', '2.1' ); _deprecated_function( 'Woocommerce->set_messages', '2.1' );
} }
@ -719,5 +819,5 @@ function WC() {
return WooCommerce::instance(); return WooCommerce::instance();
} }
// Global for backwards compatibilty. // Global for backwards compatibility.
$GLOBALS['woocommerce'] = WC(); $GLOBALS['woocommerce'] = WC();