WC_GZD_Shortcodes

Adds Germanized Shortcodes.

Defined (1)

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

/includes/class-wc-gzd-shortcodes.php  
  1. class WC_GZD_Shortcodes { 
  2.  
  3. /** 
  4. * Initializes Shortcodes 
  5. */ 
  6. public static function init() { 
  7.  
  8. // Define shortcodes 
  9. $shortcodes = array( 
  10. 'revocation_form' => __CLASS__ . '::revocation_form',  
  11. 'payment_methods_info' => __CLASS__ . '::payment_methods_info',  
  12. 'ekomi_badge' => __CLASS__ . '::ekomi_badge',  
  13. 'ekomi_widget' => __CLASS__ . '::ekomi_widget',  
  14. 'gzd_feature' => __CLASS__ . '::gzd_feature',  
  15. 'gzd_vat_info' => __CLASS__ . '::gzd_vat_info',  
  16. 'gzd_sale_info' => __CLASS__ . '::gzd_sale_info',  
  17. 'gzd_complaints' => __CLASS__ . '::gzd_complaints',  
  18. ); 
  19.  
  20. foreach ( $shortcodes as $shortcode => $function ) { 
  21. add_shortcode( apply_filters( "{$shortcode}_shortcode_tag", $shortcode ), $function ); 
  22.  
  23.  
  24. public static function gzd_complaints( $atts ) { 
  25. return wpautop( str_replace( 'http://ec.europa.eu/consumers/odr/', '<a href="http://ec.europa.eu/consumers/odr/" target="_blank">http://ec.europa.eu/consumers/odr/</a>', get_option( 'woocommerce_gzd_complaints_procedure_text' ) ) ); 
  26.  
  27. /** 
  28. * Returns revocation_form template html 
  29. *  
  30. * @param array $atts  
  31. * @return string revocation form html  
  32. */ 
  33. public static function revocation_form( $atts ) { 
  34.  
  35. ob_start(); 
  36. wc_get_template( 'forms/revocation-form.php' ); 
  37. $return = '<div class="woocommerce woocommerce-gzd">' . ob_get_clean() . '</div>'; 
  38. return $return; 
  39.  
  40.  
  41. /** 
  42. * Returns payment methods info html 
  43. *  
  44. * @param array $atts 
  45. * @return string 
  46. */ 
  47. public static function payment_methods_info( $atts ) { 
  48.  
  49. WC_GZD_Payment_Gateways::instance()->manipulate_gateways(); 
  50.  
  51. ob_start(); 
  52. wc_get_template( 'global/payment-methods.php' ); 
  53. $return = '<div class="woocommerce woocommerce-gzd">' . ob_get_clean() . '</div>'; 
  54. return $return; 
  55.  
  56.  
  57. /** 
  58. * Returns eKomi Badge html 
  59. *  
  60. * @param array $atts  
  61. * @return string  
  62. */ 
  63. public static function ekomi_badge( $atts ) { 
  64.  
  65. return WC_germanized()->ekomi->get_badge( $atts ); 
  66.  
  67.  
  68. /** 
  69. * Returns eKomi Widget html 
  70. *  
  71. * @param array $atts  
  72. * @return string  
  73. */ 
  74. public static function ekomi_widget( $atts ) { 
  75.  
  76. return WC_germanized()->ekomi->get_widget( $atts ); 
  77.  
  78.  
  79. /** 
  80. * Returns header feature shortcode 
  81. *  
  82. * @param array $atts  
  83. * @param string $content  
  84. * @return string  
  85. */ 
  86. public static function gzd_feature( $atts, $content = '' ) { 
  87.  
  88. extract( shortcode_atts( array('icon' => ''), $atts ) ); 
  89. return ( !empty( $icon ) ? '<i class="fa fa-' . $icon . '"></i> ' : '' ) . $content; 
  90.  
  91.  
  92. /** 
  93. * Returns VAT info 
  94. *  
  95. * @param array $atts  
  96. * @param string $content  
  97. * @return string  
  98. */ 
  99. public static function gzd_vat_info( $atts, $content = '' ) { 
  100.  
  101. ob_start(); 
  102. wc_get_template( 'footer/vat-info.php' ); 
  103. return ob_get_clean(); 
  104.  
  105.  
  106. /** 
  107. * Returns Sale info 
  108. *  
  109. * @param array $atts  
  110. * @param string $content  
  111. * @return string  
  112. */ 
  113. public static function gzd_sale_info( $atts, $content = '' ) { 
  114.  
  115. ob_start(); 
  116. wc_get_template( 'footer/sale-info.php' ); 
  117. return ob_get_clean(); 
  118.  
  119.