WCPBC_Widget_Country_Selector

Country Selector Widget.

Defined (1)

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

/includes/class-wcpbc-widget-country-selector.php  
  1. class WCPBC_Widget_Country_Selector extends WC_Widget { 
  2.  
  3. /** 
  4. * @var string 
  5. */ 
  6. private static $_other_countries_text = ''; 
  7.  
  8. /** 
  9. * Constructor 
  10. */ 
  11. public function __construct() {  
  12. $this->widget_description = __( 'A country switcher for your store.', 'wc-price-based-country' ); 
  13. $this->widget_id = 'wcpbc_country_selector'; 
  14. $this->widget_name = __( 'WooCommerce Country Switcher', 'wc-price-based-country' ); 
  15. $this->settings = array( 
  16. 'title' => array( 
  17. 'type' => 'text',  
  18. 'std' => __( 'Country', 'wc-price-based-country' ),  
  19. 'label' => __( 'Title', 'wc-price-based-country' ) 
  20. ),  
  21. 'other_countries_text' => array( 
  22. 'type' => 'text',  
  23. 'std' => __( 'Other countries', 'wc-price-based-country' ) ,  
  24. 'label' => __( 'Other countries text', 'wc-price-based-country' ) 
  25. ); 
  26.  
  27. parent::__construct(); 
  28.  
  29. /** 
  30. * widget function. 
  31. * @see WP_Widget 
  32. * @param array $args 
  33. * @param array $instance 
  34. * @return void 
  35. */ 
  36. function widget( $args, $instance ) {  
  37.  
  38. self::$_other_countries_text = isset( $instance['other_countries_text']) ? $instance['other_countries_text'] : $this->settings['other_countries_text']['std'] ; 
  39.  
  40. add_filter('wcpbc_other_countries_text', array( __CLASS__, 'get_other_countries_text') ); 
  41.  
  42. $this->widget_start( $args, $instance );  
  43.  
  44. do_action('wcpbc_manual_country_selector'); 
  45.  
  46. $this->widget_end( $args ); 
  47.  
  48. /** 
  49. * Get other countries text 
  50. * @return string 
  51. */ 
  52. public static function get_other_countries_text( $value ) { 
  53. return self::$_other_countries_text; 
  54.