WCML_Currency_Switcher_Options_Dialog

The WooCommerce Multilingual WCML Currency Switcher Options Dialog class.

Defined (1)

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

/inc/template-classes/currency-switcher/class-wcml-currency-switcher-options-dialog.php  
  1. class WCML_Currency_Switcher_Options_Dialog extends WPML_Templates_Factory { 
  2.  
  3. private $woocommerce_wpml; 
  4. private $args; 
  5.  
  6. function __construct( &$args, &$woocommerce_wpml ) { 
  7. parent::__construct( ); 
  8.  
  9. $this->woocommerce_wpml = $woocommerce_wpml; 
  10. $this->args = $args; 
  11.  
  12. add_action( 'wcml_before_currency_switcher_options', array( $this, 'render' ) ); 
  13.  
  14. public function get_model() { 
  15.  
  16. $model = array( 
  17.  
  18. 'args' => $this->args,  
  19. 'color_schemes' => array( 
  20. 'clear_all' => array( 
  21. 'label' => __( 'Clear all colors', 'woocommerce-multilingual' ),  
  22. ),  
  23. 'gray' => array( 
  24. 'label' => __( 'Gray', 'woocommerce-multilingual' ),  
  25. ),  
  26. 'white' => array( 
  27. 'label' => __( 'White', 'woocommerce-multilingual' ),  
  28. ),  
  29. 'blue' => array( 
  30. 'label' => __( 'Blue', 'woocommerce-multilingual' ) 
  31. ),  
  32. 'options' => array( 
  33. 'border' => __( 'Border', 'woocommerce-multilingual' ),  
  34. 'font_current' => __( 'Current currency font color', 'woocommerce-multilingual' ),  
  35. 'font_other' => __( 'Other currency font color', 'woocommerce-multilingual' ),  
  36. 'background_current' => __( 'Current currency background color', 'woocommerce-multilingual' ),  
  37. 'background_other' => __( 'Other currency background color', 'woocommerce-multilingual' ) 
  38. ),  
  39. 'form' => array( 
  40. 'switcher_style' => array( 
  41. 'label' =>__( 'Currency switcher style', 'woocommerce-multilingual' ),  
  42. 'core' =>__( 'Core', 'woocommerce-multilingual' ),  
  43. 'custom' =>__( 'Custom', 'woocommerce-multilingual' ),  
  44. 'allowed_tags' => __( 'Allowed HTML tags: <img> <span> <u> <strong> <em>', 'woocommerce-multilingual') 
  45. ),  
  46. 'template' => array( 
  47. 'label' => __( 'Template for currency switcher', 'woocommerce-multilingual' ),  
  48. 'parameters' => __( 'Available parameters', 'woocommerce-multilingual' ),  
  49. 'template_tip' => __( 'Default: %name% (%symbol%) - %code%', 'woocommerce-multilingual' ),  
  50. 'parameters_list' => '%code%, %symbol%, %name%, %subtotal%' 
  51. ),  
  52. 'colors' => array( 
  53. 'label' => __( 'Currency switcher colors', 'woocommerce-multilingual' ),  
  54. 'theme' => __( 'Color theme', 'woocommerce-multilingual' ),  
  55. 'normal' => __( 'Normal', 'woocommerce-multilingual' ),  
  56. 'hover' => __( 'Hover', 'woocommerce-multilingual' ),  
  57. 'select_option_choose' => __( 'Select a preset', 'woocommerce-multilingual' ) 
  58. ),  
  59. 'widgets' => array( 
  60. 'widget_area' => __( 'Widget area', 'woocommerce-multilingual' ),  
  61. 'widget_title' => __( 'Widget title', 'woocommerce-multilingual' ),  
  62. 'choose_label' => __( '-- Choose a widget area --', 'woocommerce-multilingual' ),  
  63. 'available_sidebars' => $this->woocommerce_wpml->multi_currency->currency_switcher->get_available_sidebars() 
  64. ),  
  65. 'preview' => __( 'Preview', 'woocommerce-multilingual' ),  
  66. 'preview_nonce' => wp_create_nonce( 'wcml_currencies_switcher_preview' ),  
  67. 'save_settings_nonce' => wp_create_nonce( 'wcml_currencies_switcher_save_settings' ),  
  68. 'cancel' => __( 'Cancel', 'woocommerce-multilingual' ),  
  69. 'save' => __( 'Save', 'woocommerce-multilingual' ) 
  70. ); 
  71.  
  72. return $model; 
  73.  
  74. static public function currency_switcher_pre_selected_colors() { 
  75.  
  76. $defaults = array(); 
  77.  
  78. $defaults['clear_all'] = array( 
  79. 'font_current_normal' => '',  
  80. 'font_current_hover' => '',  
  81. 'background_current_normal' => '',  
  82. 'background_current_hover' => '',  
  83. 'font_other_normal' => '',  
  84. 'font_other_hover' => '',  
  85. 'background_other_normal' => '',  
  86. 'background_other_hover' => '',  
  87. 'border_normal' => '' 
  88. ); 
  89.  
  90. $defaults['gray'] = array( 
  91. 'font_current_normal' => '#222222',  
  92. 'font_current_hover' => '#000000',  
  93. 'background_current_normal' => '#eeeeee',  
  94. 'background_current_hover' => '#eeeeee',  
  95. 'font_other_normal' => '#222222',  
  96. 'font_other_hover' => '#000000',  
  97. 'background_other_normal' => '#e5e5e5',  
  98. 'background_other_hover' => '#eeeeee',  
  99. 'border_normal' => '#cdcdcd' 
  100. ); 
  101.  
  102. $defaults['white'] = array( 
  103. 'font_current_normal' => '#444444',  
  104. 'font_current_hover' => '#000000',  
  105. 'background_current_normal' => '#ffffff',  
  106. 'background_current_hover' => '#eeeeee',  
  107. 'font_other_normal' => '#444444',  
  108. 'font_other_hover' => '#000000',  
  109. 'background_other_normal' => '#ffffff',  
  110. 'background_other_hover' => '#eeeeee',  
  111. 'border_normal' => '#cdcdcd' 
  112. ); 
  113.  
  114. $defaults['blue'] = array( 
  115. 'font_current_normal' => '#ffffff',  
  116. 'font_current_hover' => '#000000',  
  117. 'background_current_normal' => '#95bedd',  
  118. 'background_current_hover' => '#95bedd',  
  119. 'font_other_normal' => '#000000',  
  120. 'font_other_hover' => '#ffffff',  
  121. 'background_other_normal' => '#cbddeb',  
  122. 'background_other_hover' => '#95bedd',  
  123. 'border_normal' => '#0099cc' 
  124. ); 
  125.  
  126. return $defaults; 
  127.  
  128. public function render() { 
  129. echo $this->get_view(); 
  130.  
  131. protected function init_template_base_dir() { 
  132. $this->template_paths = array( 
  133. WCML_PLUGIN_PATH . '/templates/multi-currency/',  
  134. ); 
  135.  
  136. public function get_template() { 
  137. return 'currency-switcher-options-dialog.twig';