id = 'currencies'; $this->desc = __( 'Currencies', 'currency-switcher-woocommerce' ); parent::__construct(); add_action( 'woocommerce_admin_field_alg_custom_number', array( $this, 'output_custom_number' ) ); add_action( 'admin_init', array( $this, 'process_buttons' ) ); } /** * output_custom_number. * * @version 2.0.0 * @since 1.0.0 */ function output_custom_number( $value ) { $type = 'number'; $option_value = get_option( $value['id'], $value['default'] ); $tooltip_html = ( isset( $value['desc_tip'] ) && '' != $value['desc_tip'] ) ? '' : ''; $description = ' ' . $value['desc'] . ''; $style = 'background: #ba0000; border-color: #aa0000; text-shadow: 0 -1px 1px #990000,1px 0 1px #990000,0 1px 1px #990000,-1px 0 1px #990000; box-shadow: 0 1px 0 #990000;'; $save_button = ' '; $custom_attributes = array(); if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) { foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; } } ?>
' . sprintf( __( 'As set in WooCommerce > Settings > General.', 'currency-switcher-woocommerce' ), // admin_url( 'admin.php?page=wc-settings&tab=general' ) ) . '
', ), array( 'title' => __( 'Total additional currencies', 'currency-switcher-woocommerce' ), 'desc_tip' => __( 'Save changes after you update this number.', 'currency-switcher-woocommerce' ), 'id' => 'alg_currency_switcher_total_number', 'default' => 2, 'type' => 'alg_custom_number', 'desc' => ( PHP_INT_MAX === apply_filters( 'alg_wc_currency_switcher_plugin_option', 2 ) ) ? '' : sprintf( '' . __( 'To add more than two additional currencies, you will need %s plugin.', 'currency-switcher-woocommerce' ) . '
', '' . __( 'Currency Switcher for WooCommerce Pro', 'currency-switcher-woocommerce' ) . '' ), 'custom_attributes' => ( PHP_INT_MAX === apply_filters( 'alg_wc_currency_switcher_plugin_option', 2 ) ) ? array( 'step' => '1', 'min' => '1' ) : array( 'step' => '1', 'min' => '1', 'max' => '2' ), ), ) ); $total_number = min( get_option( 'alg_currency_switcher_total_number', 2 ), apply_filters( 'alg_wc_currency_switcher_plugin_option', 2 ) ); for ( $i = 1; $i <= $total_number; $i++ ) { $settings = array_merge( $settings, array( array( 'title' => __( 'Additional currency', 'currency-switcher-woocommerce' ) . ' #' . $i, 'desc' => __( 'Enabled', 'currency-switcher-woocommerce' ), 'id' => 'alg_currency_switcher_currency_enabled_' . $i, 'default' => 'yes', 'type' => 'checkbox', ), array( 'id' => 'alg_currency_switcher_currency_' . $i, 'default' => $currency_from, 'type' => 'select', 'class' => 'wc-enhanced-select', 'options' => $all_currencies_modified, 'css' => 'width:250px;', ), ) ); } $settings = array_merge( $settings, array( array( 'type' => 'sectionend', 'id' => 'alg_currency_switcher_currencies_options', ), ) ); return $settings; } } endif; return new Alg_WC_Currency_Switcher_Settings_Currencies();