WC_Size_Calculator

The WooCommerce Naguro Connect WC Size Calculator class.

Defined (1)

The class is defined in the following location(s).

/includes/woocommerce/core/class-wc-calculator.php  
  1. class WC_Size_Calculator { 
  2. private $dpi; 
  3. private $cm_to_in_conversion = 0.393700787; // 1cm = 0.393700787 inches 
  4. private $yard_to_in_conversion = 36; // 1 yard = 36 inches 
  5.  
  6. public function __construct( $dpi = 300 ) { 
  7. $this->dpi = intval( $dpi ); 
  8.  
  9. public function cm_to_px( $cm ) { 
  10. $inch = $this->cm_to_in( $cm ); 
  11. return round( $inch * $this->dpi ); 
  12.  
  13. public function cm_to_in( $cm ) { 
  14. return $cm * $this->cm_to_in_conversion; 
  15.  
  16. public function in_to_px( $inch ) { 
  17. return $inch * $this->dpi; 
  18.  
  19. public function mm_to_cm( $cm ) { 
  20. return $cm / 10; 
  21.  
  22. public function mm_to_px( $mm ) { 
  23. return $this->cm_to_px( $this->mm_to_cm( $mm ) ); 
  24.  
  25. public function yard_to_in( $yard ) { 
  26. return $yard * $this->yard_to_in_conversion; 
  27.  
  28. public function yard_to_px( $yard ) { 
  29. return $this->yard_to_in( $yard ) * $this->dpi;