Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/admin.zip
Назад
PK ZU,]L�� widget.phpnu ��� <?php /* Class Name: WOOMULTI_CURRENCY_F_Admin_Widget Author: Andy Ha (support@villatheme.com) Author URI: http://villatheme.com Copyright 2015-2017 villatheme.com. All rights reserved. */ if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_Widget { protected $settings; public function __construct() { $this->settings = WOOMULTI_CURRENCY_F_Data::get_ins(); add_action( 'widgets_init', array( $this, 'widgets_init' ) ); } /** * Init widget */ public function widgets_init() { register_widget( 'WMC_Widget' ); register_widget( 'WMC_Widget_Rates' ); } } ?>PK ZU,]��7�. �. product.phpnu ��� <?php /* Class Name: WOOMULTI_CURRENCY_F_Admin_Product Author: Andy Ha (support@villatheme.com) Author URI: http://villatheme.com Copyright 2015-2017 villatheme.com. All rights reserved. */ if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_Product { protected $settings; protected $decimal_separator; public function __construct() { $this->settings = WOOMULTI_CURRENCY_F_Data::get_ins(); if ( $this->settings->check_fixed_price() ) { /*Simple product*/ add_action( 'woocommerce_product_options_pricing', array( $this, 'simple_price_input' ) ); /*Variable product*/ add_action( 'woocommerce_variation_options_pricing', array( $this, 'variation_price_input' ), 10, 3 ); /*Save data*/ $product_types = apply_filters( 'wmc_simple_product_type_register', array( 'simple', 'external', 'bundle', 'course', 'subscription', 'woosb', 'composite', 'appointment', ) ); foreach ( $product_types as $type ) { add_action( 'woocommerce_process_product_meta_' . $type, array( $this, 'save_meta_simple_product' ) ); } add_action( 'woocommerce_save_product_variation', array( $this, 'save_meta_product_variation' ), 10, 2 ); /*Bulk action*/ add_action( 'admin_enqueue_scripts', array( $this, 'init_scripts' ), 12 ); add_action( 'woocommerce_variable_product_bulk_edit_actions', array( $this, 'bulk_edit_actions' ) ); } } /** * Init list currencies for bulk acction */ public function init_scripts() { $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; if ( in_array( $screen_id, array( 'product', 'edit-product' ) ) ) { $currencies = $this->settings->get_currencies(); $currency_default = $this->settings->get_default_currency(); $index = array_search( $currency_default, $currencies ); unset( $currencies[ $index ] ); $params = array( 'currencies' => array_values( $currencies ) ); $src_min = WP_DEBUG ? '' : '.min'; wp_localize_script( 'wc-admin-variation-meta-boxes', 'wmc_params', $params ); wp_enqueue_script( 'woo-multi-currency-bulk-actions', WOOMULTI_CURRENCY_F_JS . 'woo-multi-currency-bulk-actions' . $src_min . '.js', array( 'jquery' ), WOOMULTI_CURRENCY_F_VERSION, false ); } } /** * Show bulk action in product edit page */ public function bulk_edit_actions() { $currencies = $this->settings->get_currencies(); ?> <optgroup label="<?php esc_attr_e( 'Multi Currency', 'woo-multi-currency' ); ?>"> <?php if ( count( $currencies ) ) { foreach ( $currencies as $currency ) { if ( $currency == $this->settings->get_default_currency() ) { continue; } ?> <option value="wbs_regular_price-<?php echo esc_attr( $currency ) ?>"><?php echo esc_html__( 'Set regular prices', 'woo-multi-currency' ) . ' (' . esc_html( $currency ) . ')'; ?></option> <option value="wbs_sale_price-<?php echo esc_attr( $currency ) ?>"><?php echo esc_html__( 'Set sale prices', 'woo-multi-currency' ) . ' (' . esc_html( $currency ) . ')'; ?></option> <?php } } ?> </optgroup> <?php } /** * Add Regular price, Sale price with Simple product * Working with currency by country */ public function simple_price_input() { global $post; $currencies = $this->settings->get_currencies(); $wc_product = wc_get_product( $post->ID ); $regular_price = $this->adjust_fixed_price( self::format_json_price_meta( $wc_product->get_meta('_regular_price_wmcp', true ) ) ); $sale_price = $this->adjust_fixed_price( self::format_json_price_meta( $wc_product->get_meta('_sale_price_wmcp', true ) ) ); foreach ( $currencies as $currency ) { if ( $currency != $this->settings->get_default_currency() ) { ?> <div style="border-left: 5px solid #f78080;"> <p class="form-field "> <label for="_regular_price_wmcp_<?php echo esc_attr( $currency ); ?>"><?php echo esc_html__( 'Regular Price', 'woo-multi-currency' ) . ' (' . esc_html( $currency ) . ')'; ?></label> <input id="_regular_price_wmcp_<?php echo esc_attr( $currency ); ?>" class="short wc_input_price" type="text" value="<?php echo isset( $regular_price[ $currency ] ) ? esc_attr( $regular_price[ $currency ] ) : ''; ?>" name="_regular_price_wmcp[<?php echo esc_attr( $currency ); ?>]"> </p> <p class="form-field "> <label for="_sale_price_wmcp_<?php echo esc_attr( $currency ); ?>"><?php echo esc_html__( 'Sale Price', 'woo-multi-currency' ) . ' (' . esc_html( $currency ) . ')'; ?></label> <input id="_sale_price_wmcp_<?php echo esc_attr( $currency ); ?>" class="short wc_input_price" type="text" value="<?php echo isset( $sale_price[ $currency ] ) ? esc_attr( $sale_price[ $currency ] ) : ''; ?>" name="_sale_price_wmcp[<?php echo esc_attr( $currency ); ?>]"> </p> </div> <?php } } wp_nonce_field( 'wmc_save_simple_product_currency', '_wmc_nonce' ); } /** * Add Regular price, Sale price with Variation product * Working with currency by country * * @param $loop * @param $variation_data * @param $variation */ public function variation_price_input( $loop, $variation_data, $variation ) { $selected_currencies = $this->settings->get_currencies(); $variation_product = wc_get_product( $variation->ID ); $regular_price = $this->adjust_fixed_price( self::format_json_price_meta( $variation_product->get_meta('_regular_price_wmcp', true ) ) ); $sale_price = $this->adjust_fixed_price( self::format_json_price_meta( $variation_product->get_meta('_sale_price_wmcp', true ) ) ); foreach ( $selected_currencies as $code ) { $_regular_price = $_sale_price = ""; if ( isset( $regular_price[ $code ] ) ) { $_regular_price = $regular_price[ $code ]; } if ( isset( $sale_price[ $code ] ) ) { $_sale_price = $sale_price[ $code ]; } if ( $code != $this->settings->get_default_currency() ) { ?> <div> <p class="form-row form-row-first"> <label><?php echo esc_html__( 'Regular Price:', 'woo-multi-currency' ) . ' (' . esc_html( $code ) . ')'; ?></label> <input type="text" size="5" name="variable_regular_price_wmc[<?php echo esc_attr( $loop ) ?>][<?php echo esc_attr( $code ); ?>]" value="<?php echo ( isset( $_regular_price ) ) ? esc_attr( $_regular_price ) : '' ?>" class="wc_input_price wbs-variable-regular-price-<?php echo esc_attr( $code ) ?>"/> </p> <p class="form-row form-row-last"> <label><?php echo esc_html__( 'Sale Price:', 'woo-multi-currency' ) . ' (' . esc_html( $code ) . ')'; ?> </label> <input type="text" size="5" name="variables_sale_price_wmc[<?php echo esc_attr( $loop ) ?>][<?php echo esc_attr( $code ); ?>]" value="<?php echo ( isset( $_sale_price ) ) ? esc_attr( $_sale_price ) : '' ?>" class="wc_input_price wbs-variable-sale-price-<?php echo esc_attr( $code ) ?>"" /> </p> </div> <?php } } wp_nonce_field( 'wmc_save_variable_product_currency', '_wmc_nonce' ); } /** * Save Price by country of Simple Product * * @param $post_id */ public function save_meta_simple_product( $post_id ) { /*Check Permission*/ if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } /*Check send from product edit page*/ if ( ! isset( $_POST['_wmc_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['_wmc_nonce'] ), 'wmc_save_simple_product_currency' ) ) { return; } $simple_product = wc_get_product( $post_id ); $update_meta = false; if ( isset( $_POST['_regular_price_wmcp'] ) ) { $_regular_price_wmcp = wmc_adjust_fixed_price( wc_clean( $_POST['_regular_price_wmcp'] ) ); $simple_product->update_meta_data('_regular_price_wmcp', wp_json_encode( $_regular_price_wmcp ) ); $update_meta = true; } if ( isset( $_POST['_sale_price_wmcp'] ) && ! empty( $_POST['_sale_price'] ) ) { $_sale_price_wmcp = wmc_adjust_fixed_price( wc_clean( $_POST['_sale_price_wmcp'] ) ); $simple_product->update_meta_data('_sale_price_wmcp', wp_json_encode( $_sale_price_wmcp ) ); $update_meta = true; } else { $simple_product->update_meta_data('_sale_price_wmcp', '' ); $update_meta = true; } $date_to = isset( $_POST['_sale_price_dates_to'] ) ? wc_clean( $_POST['_sale_price_dates_to'] ) : ''; if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { $simple_product->update_meta_data('_sale_price_wmcp', '' ); $update_meta = true; } if ( $update_meta ) { $simple_product->save_meta_data(); } } /** * Save Currency by Country of Variation product * * @param $variation_id * @param $i */ public function save_meta_product_variation( $variation_id, $i ) { /*Check Permission*/ if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } /*Check send from product edit page*/ if ( ! isset( $_POST['_wmc_nonce'] ) || ! wp_verify_nonce( sanitize_text_field( $_POST['_wmc_nonce'] ), 'wmc_save_variable_product_currency' ) ) { return; } $variation_product = wc_get_product( $variation_id ); $update_meta = false; if ( isset( $_POST['variable_regular_price_wmc'] ) ) { $_regular_price_wmcp = wmc_adjust_fixed_price( wc_clean( $_POST['variable_regular_price_wmc'] ) ); $variation_product->update_meta_data('_regular_price_wmcp', wp_json_encode( $_regular_price_wmcp[ $i ] ) ); $update_meta = true; } if ( isset( $_POST['variables_sale_price_wmc'] ) && ! empty( $_POST['variable_sale_price'][ $i ] ) ) { $_sale_price_wmcp = wmc_adjust_fixed_price( wc_clean( $_POST['variables_sale_price_wmc'] ) ); $variation_product->update_meta_data('_sale_price_wmcp', wp_json_encode( $_sale_price_wmcp[ $i ] ) ); $update_meta = true; } else { $variation_product->update_meta_data('_sale_price_wmcp', '' ); $update_meta = true; } $variable_sale_price_dates_to = wc_clean( $_POST['variable_sale_price_dates_to'] ); $date_to = ( $variable_sale_price_dates_to[ $i ] ); if ( $date_to && strtotime( $date_to ) < strtotime( 'NOW', current_time( 'timestamp' ) ) ) { $variation_product->update_meta_data('_sale_price_wmcp', '' ); $update_meta = true; } if ( $update_meta ) { $variation_product->save_meta_data(); } } /** * @param $fixed_price * Replace '.' with currently used decimal separator for fixed price input fields * * @return array */ private function adjust_fixed_price( $fixed_price ) { if ( ! $this->decimal_separator ) { $this->decimal_separator = stripslashes( get_option( 'woocommerce_price_decimal_sep', '.' ) ); } if ( $this->decimal_separator !== '.' && is_array( $fixed_price ) && count( $fixed_price ) ) { foreach ( $fixed_price as $key => $value ) { $fixed_price[ $key ] = str_replace( '.', $this->decimal_separator, $value ); } } return $fixed_price; } function format_json_price_meta( $price_meta ) { return is_string( $price_meta ) ? json_decode( $price_meta, true ) : $price_meta; } } ?>PK ZU,]ʘ��# �# order.phpnu ��� <?php /* Class Name: WOOMULTI_CURRENCY_F_Admin_Order Author: Andy Ha (support@villatheme.com) Author URI: http://villatheme.com Copyright 2015-2017 villatheme.com. All rights reserved. */ use Automattic\WooCommerce\Utilities\OrderUtil; if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_Order { public function __construct() { add_action( 'admin_init', array( $this, 'add_metabox' ), 1 ); add_action( 'manage_shop_order_posts_custom_column', array( $this, 'currency_columns' ), 2 ); if ( ! is_plugin_active( 'woocommerce-pdf-invoices-packing-slips/woocommerce-pdf-invoices-packingslips.php' ) ) { add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'get_formatted_order_total' ), 10, 4 ); if ( OrderUtil::custom_orders_table_usage_is_enabled() ) { add_filter( 'woocommerce_get_formatted_order_total', array( $this, 'get_formatted_order_total_custom_column' ), 10, 4 ); } } } /** * Add metabox to order post */ public function add_metabox() { // add_meta_box( 'wmc_order_metabox', esc_html__( 'Currency Information', 'woo-multi-currency' ), array( // $this, // 'order_metabox' // ), 'shop_order', 'side', 'default' ); if ( ! OrderUtil::custom_orders_table_usage_is_enabled() ) { add_meta_box( 'wmc_order_metabox', esc_html__( 'Currency Information', 'woo-multi-currency' ), array( $this, 'order_metabox' ), [ 'shop_order', 'shop_subscription' ], 'side', 'default' ); } else { $screen = class_exists( '\Automattic\WooCommerce\Internal\DataStores\Orders\CustomOrdersTableController' ) ? wc_get_page_screen_id( 'shop-order' ) : 'shop_order'; add_meta_box( 'wmc_order_metabox', esc_html__( 'Currency Information', 'woo-multi-currency' ), array( $this, 'order_metabox' ), $screen, 'side', 'high' ); } } /** * @param $col */ public function currency_columns( $col ) { global $post, $the_order; if ( empty( $the_order ) || $the_order->get_id() !== $post->ID ) { $the_order = wc_get_order( $post->ID ); } if ( $col == 'order_total' ) { ?> <div class="wmc-order-currency"> <?php echo esc_html__( 'Currency: ', 'woo-multi-currency' ) . esc_html( $the_order->get_currency() ); ?> </div> <?php } } /** * @param $post */ public function order_metabox( $post ) { $order_id = $post->ID ?? wc_clean( wp_unslash( $_GET['id'] ?? '' ) ); if ( ! $order_id ) { return; } $order = wc_get_order( $order_id ); $order_currency = $order && is_a( $order, 'WC_Order' ) ? $order->get_currency() : get_woocommerce_currency(); $wmc_order_info = $order && is_object( $order ) ? $order->get_meta('wmc_order_info', true ) : get_post_meta( $order_id, 'wmc_order_info', true ); // $rate = 0; $has_info = 1; if ( ! isset( $wmc_order_info ) || ! is_array( $wmc_order_info ) ) { $has_info = 0; } ?> <div id="wmc_order_metabox"> <?php if ( ! $has_info ) { $wmc_order_base_currency = $order_currency; $rate = 1; } else { foreach ( $wmc_order_info as $code => $currency_info ) { if ( isset( $currency_info['is_main'] ) && $currency_info['is_main'] == 1 ) { $wmc_order_base_currency = $code; break; } } $rate = $wmc_order_info[ $order_currency ]['rate']; } ?> <div id="wmc_order_currency_text"> <p> <?php esc_html_e( 'Currency', 'woo-multi-currency' ); ?> : <span><?php echo esc_html( $order_currency ); ?></span> </p> </div> <div id="wmc_order_base_currency"> <p> <?php esc_html_e( 'Base on Currency', 'woo-multi-currency' ); ?> : <span><?php echo esc_html( $wmc_order_base_currency ); ?></span> </p> </div> <div id="wmc_order_base_currency"> <p> <?php esc_html_e( 'Currency Rate', 'woo-multi-currency' ); ?> : <span><?php echo esc_html( $rate ); ?></span> </p> </div> </div> <?php } public function get_formatted_order_total_custom_column( $formatted_total, $this_order, $tax_display, $display_refunded ) { if ( ! is_admin() || ! function_exists( 'get_current_screen' ) || ( get_current_screen() && 'woocommerce_page_wc-orders' != get_current_screen()->id ) ) { return $formatted_total; } $order_currency = $this_order->get_currency(); ob_start(); ?> <div class="wmc-order-currency"> <?php echo esc_html__( 'Currency: ', 'woo-multi-currency' ) . esc_html( $order_currency ); ?> </div> <?php $order_custom_text = ob_get_clean(); $order_custom_text .= $formatted_total; $wmc_order_info = $this_order->get_meta( 'wmc_order_info', true ); if ( is_array( $wmc_order_info ) && count( $wmc_order_info ) ) { foreach ( $wmc_order_info as $code => $currency_info ) { if ( isset( $currency_info['is_main'] ) && $currency_info['is_main'] == 1 && isset( $wmc_order_info[ $order_currency ] ) ) { if ( $order_currency != $code && floatval( $wmc_order_info[ $order_currency ]['rate'] ) ) { $price_in_base_currency = ( $this_order->get_total() - $this_order->get_total_refunded() ) / $wmc_order_info[ $order_currency ]['rate']; ob_start(); ?> <p class="wmc-order-base-currency" style="color:red"> <?php echo esc_html( $code ) . ': ' ?> <span> <?php echo wc_price( $price_in_base_currency, array(// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped 'currency' => $code, 'decimals' => ! empty( $wmc_order_info[ $code ]['decimals'] ) ? (int) $wmc_order_info[ $code ]['decimals'] : 0 ) ) ?> </span> </p> <?php $order_custom_text .= ob_get_clean(); } break; } } } return $order_custom_text; } /** * @param $formatted_total * @param $order WC_Order * @param $tax_display * @param $display_refunded * * @return string */ public function get_formatted_order_total( $formatted_total, $order, $tax_display, $display_refunded ) { if ( ! $order->get_meta('wmc_order_info', true ) ) { return $formatted_total; } $order_currency = $order->get_currency(); if ( ! isset( $wmc_order_info[ $order_currency ] ) ) { return $formatted_total; } $wmc_order_info = $order->get_meta('wmc_order_info', true ); $total = $order->get_meta('_order_total', true ); $decimal = intval( $wmc_order_info[ $order_currency ]['decimals'] ); $formatted_total = wc_price( $total, array( 'currency' => $order_currency, 'decimals' => $decimal ) ); $order_total = $order->get_total(); $total_refunded = $order->get_total_refunded(); $tax_string = ''; // Tax for inclusive prices. if ( wc_tax_enabled() && 'incl' === $tax_display ) { $tax_string_array = array(); $tax_totals = $order->get_tax_totals(); if ( 'itemized' === get_option( 'woocommerce_tax_total_display' ) ) { foreach ( $tax_totals as $code => $tax ) { $tax_amount = ( $total_refunded && $display_refunded ) ? wc_price( WC_Tax::round( $tax->amount - $order->get_total_tax_refunded_by_rate_id( $tax->rate_id ) ), array( 'currency' => $order->get_currency(), 'decimals' => $decimal ) ) : $tax->formatted_amount; $tax_string_array[] = sprintf( '%s %s', $tax_amount, $tax->label ); } } elseif ( ! empty( $tax_totals ) ) { $tax_amount = ( $total_refunded && $display_refunded ) ? $order->get_total_tax() - $order->get_total_tax_refunded() : $order->get_total_tax(); $tax_string_array[] = sprintf( '%s %s', wc_price( $tax_amount, array( 'currency' => $order->get_currency(), 'decimals' => $decimal ) ), WC()->countries->tax_or_vat() ); } if ( ! empty( $tax_string_array ) ) { /* translators: %s: taxes */ $tax_string = ' <small class="includes_tax">' . sprintf( esc_html__( '(includes %s)', 'woocommerce' ), implode( ', ', $tax_string_array ) ) . '</small>'; } } if ( $total_refunded && $display_refunded ) { $formatted_total = '<del>' . wp_strip_all_tags( $formatted_total ) . '</del> <ins>' . wc_price( $order_total - $total_refunded, array( 'currency' => $order->get_currency(), 'decimals' => $decimal ) ) . $tax_string . '</ins>'; } else { $formatted_total .= $tax_string; } /** * Filter WooCommerce formatted order total. * * @param string $formatted_total Total to display. * @param WC_Order $order Order data. * @param string $tax_display Type of tax display. * @param bool $display_refunded If should include refunded value. */ return $formatted_total; } }PK ZU,]CV�$ $ system.phpnu ��� <?php /* Class Name: WOOMULTI_CURRENCY_F_Admin_System Author: Andy Ha (support@villatheme.com) Author URI: http://villatheme.com Copyright 2015-2017 villatheme.com. All rights reserved. */ if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_System { public function __construct() { add_action( 'admin_menu', array( $this, 'menu_page' ) ); } public function page_callback() { ?> <h2><?php esc_html_e( 'System Status', 'woo-multi-currency' ) ?></h2> <table cellspacing="0" id="status" class="widefat"> <tbody> <tr> <td data-export-label="file_get_contents">file_get_contents</td> <td> <?php if ( function_exists( 'file_get_contents' ) ) { echo '<mark class="yes">✔ <code class="private"></code></mark> '; } else { echo '<mark class="error">✕ </mark>'; } ?> </td> </tr> <tr> <td data-export-label="file_put_contents">file_put_contents</td> <td> <?php if ( function_exists( 'file_put_contents' ) ) { echo '<mark class="yes">✔ <code class="private"></code></mark> '; } else { echo '<mark class="error">✕ </mark>'; } ?> </td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'PHP Time Limit', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'PHP Time Limit', 'woo-multi-currency' ) ?></td> <td><?php echo esc_html( ini_get( 'max_execution_time' ) ); ?></td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'PHP Max Input Vars', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'PHP Max Input Vars', 'woo-multi-currency' ) ?></td> <td><?php echo esc_html( ini_get( 'max_input_vars' ) ); ?></td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'Memory Limit', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'Memory Limit', 'woo-multi-currency' ) ?></td> <td><?php echo esc_html( ini_get( 'memory_limit' ) ); ?></td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'Allow URL Open', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'Allow URL Open', 'woo-multi-currency' ) ?></td> <td> <?php if ( ini_get( 'allow_url_fopen' ) ) { echo '<mark class="yes">✔ <code class="private"></code></mark> '; } else { echo '<mark class="error">✕ </mark>'; } ?> </td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'Session path', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'Session path', 'woo-multi-currency' ) ?></td> <td><?php $check_session = @fopen( session_save_path() . 'test-log.log', 'a' ) ? true : false;// phpcs:ignore WordPress.WP.AlternativeFunctions.file_system_operations_fopen if ( $check_session ) { echo '<mark class="yes"><span class="dashicons dashicons-yes"></span> <code class="private">' . esc_html( session_save_path() ) . '</code></mark> '; } else { /* translators: %1$s: logging file path */ echo '<mark class="error"><span class="dashicons dashicons-warning"></span> ' . sprintf( esc_html__( 'To allow logging, make %1$s writable.', 'woo-multi-currency' ), '<code>' . esc_html( session_save_path() ) . '</code>' ) . '</mark>'; } ?></td> </tr> <tr> <td data-export-label="<?php esc_html_e( 'Your IP', 'woo-multi-currency' ) ?>"><?php esc_html_e( 'Your IP', 'woo-multi-currency' ) ?></td> <td> <ul> <li><strong> <?php $ip = new WC_Geolocation(); esc_html_e( '[WooCommerce] Your IP', 'woo-multi-currency' ) ?> : <?php echo esc_html( $ip->get_ip_address() ) ?> </strong> </li> <li><strong> <?php esc_html_e( '[WooCommerce] Your GEO IP', 'woo-multi-currency' ) ?> : <?php echo esc_html( wp_json_encode( $ip->geolocate_ip() ) ) ?> </strong> </li> <li><h3> <?php esc_html_e( '_SERVER system', 'woo-multi-currency' ) ?></h3> <pre><?php print_r( array_map( 'esc_html', $_SERVER ) ) ?></pre> </li> </ul> </td> </tr> </tbody> </table> <?php } /** * Register a custom menu page. */ public function menu_page() { add_submenu_page( 'woo-multi-currency', esc_html__( 'System Status', 'woo-multi-currency' ), esc_html__( 'System Status', 'woo-multi-currency' ), 'manage_woocommerce', 'woo-multi-currency-system-status', array( $this, 'page_callback' ) ); } }PK ZU,]�r��7� 7� reports.phpnu ��� <?php if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class WOOMULTI_CURRENCY_Admin_Reports */ class WOOMULTI_CURRENCY_F_Admin_Reports { protected $settings; protected $currencies; protected $currency; protected $results; protected $chart_interval; protected $where_meta; protected $total_sales; protected $order_items; protected $current_range; protected $default_currency; protected $is_dashboard; function __construct() { $this->settings = WOOMULTI_CURRENCY_F_Data::get_ins(); $this->is_dashboard = false; add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency' ) ); add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data_for_dashboard' ), 10, 2 ); add_filter( 'woocommerce_currency', array( $this, 'woocommerce_currency' ), 99 ); add_filter( 'wc_get_price_decimals', array( $this, 'wc_get_price_decimals' ), 99 ); $this->default_currency = $this->settings->get_default_currency(); $this->currencies = $this->settings->get_list_currencies(); } /**Get current range to recalculate report data * @return string */ public function get_current_range() { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return '7day'; } if ( $this->current_range === null ) { $this->current_range = ! empty( $_GET['range'] ) ? sanitize_text_field( wp_unslash( $_GET['range'] ) ) : '7day'; if ( ! in_array( $this->current_range, array( 'custom', 'year', 'last_month', 'month', '7day' ), true ) ) { $this->current_range = '7day'; } } return $this->current_range; } public function admin_enqueue_scripts() { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return; } $screen = get_current_screen(); $screen_id = $screen ? $screen->id : ''; if ( 'woocommerce_page_wc-reports' == $screen_id ) { $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'orders'; $report = isset( $_GET['report'] ) ? sanitize_text_field( wp_unslash( $_GET['report'] ) ) : ''; $currency = isset( $_GET['wmc-currency'] ) ? strtoupper( sanitize_text_field( wp_unslash( $_GET['wmc-currency'] ) ) ) : ''; $view_default = isset( $_GET['wmc-view-default-currency'] ) ? sanitize_text_field( wp_unslash( $_GET['wmc-view-default-currency'] ) ) : ''; if ( ( $tab === 'orders' && $report !== 'coupon_usage' ) || ( $tab === 'customers' && $report === 'customers' ) ) { $src_min = WP_DEBUG ? '' : '.min'; wp_enqueue_style( 'woocommerce-multi-currency-admin-reports', WOOMULTI_CURRENCY_F_CSS . 'reports' . $src_min . '.css', '', WOOMULTI_CURRENCY_F_VERSION ); wp_enqueue_script( 'woocommerce-multi-currency-admin-reports', WOOMULTI_CURRENCY_F_JS . 'reports' . $src_min . '.js', array( 'jquery' ), WOOMULTI_CURRENCY_F_VERSION, false ); wp_localize_script( 'woocommerce-multi-currency-admin-reports', 'woocommerce_multi_currency_admin_reports', array( 'currency' => $currency ? $currency : 'all-currencies' ) ); add_action( 'admin_footer', array( $this, 'admin_footer' ) ); } if ( ! $currency ) { if ( $tab === 'orders' ) { if ( ! $report || $report === 'sales_by_date' ) { add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'add_return_order_id' ) ); add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data_1' ), 10, 2 ); } elseif ( $report === 'sales_by_product' && ! empty( $_REQUEST['product_ids'] ) ) { include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-admin-report.php' ); include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-report-sales-by-product.php' ); $current_range = $this->get_current_range(); $results = array(); if ( count( $this->currencies ) ) { foreach ( $this->currencies as $currency_code => $currency_data ) { $this->currency = $currency_code; add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); $report = new WC_Report_Sales_By_Product(); $report->check_current_range_nonce( $current_range ); $report->calculate_current_range( $current_range ); $total_sales = $report->get_order_report_data( array( 'data' => array( '_line_total' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_amount', ), ), 'where_meta' => array( 'relation' => 'OR', array( 'type' => 'order_item_meta', 'meta_key' => array( '_product_id', '_variation_id' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key 'meta_value' => $report->product_ids, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value 'operator' => 'IN', ), ), 'query_type' => 'get_var', 'filter_range' => true, 'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' ), ) ); $results[] = self::convert_to_default_currency( $total_sales, $currency_data['rate'] ); remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); } } add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data' ), 10, 2 ); $this->total_sales = array_sum( $results ); } elseif ( $report === 'sales_by_category' && ! empty( $_GET['show_categories'] ) ) { include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-admin-report.php' ); include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-report-sales-by-category.php' ); $current_range = $this->get_current_range(); $results = array(); if ( count( $this->currencies ) ) { foreach ( $this->currencies as $currency_code => $currency_data ) { $this->currency = $currency_code; add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); $report = new WC_Report_Sales_By_Category(); $report->check_current_range_nonce( $current_range ); $report->calculate_current_range( $current_range ); $order_items = $report->get_order_report_data( array( 'data' => array( '_product_id' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => '', 'name' => 'product_id', ), '_line_total' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_amount', ), 'post_date' => array( 'type' => 'post_data', 'function' => '', 'name' => 'post_date', ), ), 'group_by' => 'ID, product_id, post_date', 'query_type' => 'get_results', 'filter_range' => true, ) ); if ( is_array( $order_items ) && count( $order_items ) ) { foreach ( $order_items as $order_item ) { $order_item->order_item_amount = self::convert_to_default_currency( $order_item->order_item_amount, $currency_data['rate'] ); } } $results = array_merge( $results, $order_items ); remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); } } add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data' ), 10, 2 ); $this->order_items = $results; } } } elseif ( $view_default === 'yes' && $this->default_currency !== $currency ) { if ( ! $report || $report === 'sales_by_date' ) { $this->currency = $currency; if ( isset( $this->currencies[ $this->currency ] ) ) { include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-admin-report.php' ); include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-report-sales-by-date.php' ); $current_range = $this->get_current_range(); $results = array(); add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); $report = new WC_Report_Sales_By_Date(); $report->check_current_range_nonce( $current_range ); $report->calculate_current_range( $current_range ); $result = $report->get_report_data(); $this->chart_interval = $report->chart_interval; if ( isset( $result->orders ) && is_array( $result->orders ) && count( $result->orders ) ) { foreach ( $result->orders as $order ) { $order->total_sales = self::convert_to_default_currency( $order->total_sales, $this->currencies[ $this->currency ]['rate'] ); $order->total_shipping = self::convert_to_default_currency( $order->total_shipping, $this->currencies[ $this->currency ]['rate'] ); $order->total_tax = self::convert_to_default_currency( $order->total_tax, $this->currencies[ $this->currency ]['rate'] ); $order->total_shipping_tax = self::convert_to_default_currency( $order->total_shipping_tax, $this->currencies[ $this->currency ]['rate'] ); } } if ( isset( $result->refunded_orders ) && is_array( $result->refunded_orders ) && count( $result->refunded_orders ) ) { foreach ( $result->refunded_orders as $refunded_orders ) { $refunded_orders->total_refund = self::convert_to_default_currency( $refunded_orders->total_refund, $this->currencies[ $this->currency ]['rate'] ); $refunded_orders->total_shipping = self::convert_to_default_currency( $refunded_orders->total_shipping, $this->currencies[ $this->currency ]['rate'] ); $refunded_orders->total_tax = self::convert_to_default_currency( $refunded_orders->total_tax, $this->currencies[ $this->currency ]['rate'] ); $refunded_orders->total_shipping_tax = self::convert_to_default_currency( $refunded_orders->total_shipping_tax, $this->currencies[ $this->currency ]['rate'] ); $refunded_orders->net_refund = self::convert_to_default_currency( $refunded_orders->net_refund, $this->currencies[ $this->currency ]['rate'] ); } } if ( isset( $result->refund_lines ) && is_array( $result->refund_lines ) && count( $result->refund_lines ) ) { foreach ( $result->refund_lines as $refund_lines ) { $refund_lines->total_refund = self::convert_to_default_currency( $refund_lines->total_refund, $this->currencies[ $this->currency ]['rate'] ); $refund_lines->total_shipping = self::convert_to_default_currency( $refund_lines->total_shipping, $this->currencies[ $this->currency ]['rate'] ); $refund_lines->total_tax = self::convert_to_default_currency( $refund_lines->total_tax, $this->currencies[ $this->currency ]['rate'] ); $refund_lines->total_shipping_tax = self::convert_to_default_currency( $refund_lines->total_shipping_tax, $this->currencies[ $this->currency ]['rate'] ); $refund_lines->total_sales = self::convert_to_default_currency( $refund_lines->total_sales, $this->currencies[ $this->currency ]['rate'] ); } } $result->total_tax = self::convert_to_default_currency( $result->total_tax, $this->currencies[ $this->currency ]['rate'] ); $result->total_shipping = self::convert_to_default_currency( $result->total_shipping, $this->currencies[ $this->currency ]['rate'] ); $result->total_shipping_tax = self::convert_to_default_currency( $result->total_shipping_tax, $this->currencies[ $this->currency ]['rate'] ); $result->total_sales = self::convert_to_default_currency( $result->total_sales, $this->currencies[ $this->currency ]['rate'] ); $result->net_sales = self::convert_to_default_currency( $result->net_sales, $this->currencies[ $this->currency ]['rate'] ); $result->total_tax_refunded = self::convert_to_default_currency( $result->total_tax_refunded, $this->currencies[ $this->currency ]['rate'] ); $result->total_shipping_refunded = self::convert_to_default_currency( $result->total_shipping_refunded, $this->currencies[ $this->currency ]['rate'] ); $result->total_shipping_tax_refunded = self::convert_to_default_currency( $result->total_shipping_tax_refunded, $this->currencies[ $this->currency ]['rate'] ); $result->total_refunds = self::convert_to_default_currency( $result->total_refunds, $this->currencies[ $this->currency ]['rate'] ); $results[] = $result; remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); add_filter( 'woocommerce_admin_report_data', array( $this, 'woocommerce_admin_report_data' ) ); $this->results = $results; } } elseif ( $report === 'sales_by_product' && ! empty( $_REQUEST['product_ids'] ) ) { $this->currency = $currency; if ( isset( $this->currencies[ $this->currency ] ) ) { include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-admin-report.php' ); include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-report-sales-by-product.php' ); $current_range = $this->get_current_range(); add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); $report = new WC_Report_Sales_By_Product(); $report->check_current_range_nonce( $current_range ); $report->calculate_current_range( $current_range ); $total_sales = $report->get_order_report_data( array( 'data' => array( '_line_total' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_amount', ), ), 'where_meta' => array( 'relation' => 'OR', array( 'type' => 'order_item_meta', 'meta_key' => array( '_product_id', '_variation_id' ), // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key 'meta_value' => $report->product_ids, // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value 'operator' => 'IN', ), ), 'query_type' => 'get_var', 'filter_range' => true, 'order_status' => array( 'completed', 'processing', 'on-hold', 'refunded' ), ) ); remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data' ), 10, 2 ); $this->total_sales = self::convert_to_default_currency( $total_sales, $this->currencies[ $this->currency ]['rate'] ); } } elseif ( $report === 'sales_by_category' && ! empty( $_GET['show_categories'] ) ) { $this->currency = $currency; if ( isset( $this->currencies[ $this->currency ] ) ) { include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-admin-report.php' ); include_once( WC()->plugin_path() . '/includes/admin/reports/class-wc-report-sales-by-category.php' ); $current_range = $this->get_current_range(); add_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); $report = new WC_Report_Sales_By_Category(); $report->check_current_range_nonce( $current_range ); $report->calculate_current_range( $current_range ); $order_items = $report->get_order_report_data( array( 'data' => array( '_product_id' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => '', 'name' => 'product_id', ), '_line_total' => array( 'type' => 'order_item_meta', 'order_item_type' => 'line_item', 'function' => 'SUM', 'name' => 'order_item_amount', ), 'post_date' => array( 'type' => 'post_data', 'function' => '', 'name' => 'post_date', ), ), 'group_by' => 'ID, product_id, post_date', 'query_type' => 'get_results', 'filter_range' => true, ) ); if ( is_array( $order_items ) && count( $order_items ) ) { foreach ( $order_items as $order_item ) { $order_item->order_item_amount = self::convert_to_default_currency( $order_item->order_item_amount, $this->currencies[ $this->currency ]['rate'] ); } $this->order_items = $order_items; add_filter( 'woocommerce_reports_get_order_report_data', array( $this, 'woocommerce_reports_get_order_report_data' ), 10, 2 ); } remove_filter( 'woocommerce_reports_get_order_report_data_args', array( $this, 'report_by_currency_for_all' ) ); } } } } } /** * @param $price * @param $rate * * @return float|int */ public static function convert_to_default_currency( $price, $rate ) { return floatval( $price ) / floatval( $rate ); } /** * */ public function admin_footer() { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return; } $currency = isset( $_GET['wmc-currency'] ) ? strtoupper( sanitize_text_field( wp_unslash( $_GET['wmc-currency'] ) ) ) : ''; $view_default = isset( $_GET['wmc-view-default-currency'] ) ? sanitize_text_field( wp_unslash( $_GET['wmc-view-default-currency'] ) ) : ''; $request_uri = isset( $_SERVER['REQUEST_URI'] ) ? esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : ''; $view_default_link = $view_default === 'yes' ? remove_query_arg( 'wmc-view-default-currency', $request_uri ) : add_query_arg( array( 'wmc-view-default-currency' => 'yes' ), $request_uri ); $links = $this->settings->get_links(); $currency_name = get_woocommerce_currencies(); ?> <li class="wmc-reports-currency-selector"> <div class="woocommerce-multi-currency shortcode"> <div class="wmc-currency"> <select class="wmc-nav" onchange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);"> <option value="<?php echo esc_url( remove_query_arg( 'wmc-currency', $request_uri ) ) ?>"><?php esc_html_e( 'All currencies', 'woo-multi-currency' ) ?></option> <?php foreach ( $links as $code => $link ) { ?> <option <?php selected( $currency, $code ) ?> value="<?php echo esc_url( $link ) ?>"><?php echo esc_html( $currency_name[ $code ] ) ?></option> <?php } ?> </select> </div> </div> </li> <?php if ( $currency && $currency !== $this->default_currency ) { ?> <li class="wmc-view-default-currency-container"> <input id="wmc-view-default-currency" type="checkbox" value="yes" <?php checked( $view_default, 'yes' ) ?> data-report_link="<?php echo esc_url( $view_default_link ) ?>"><label for="wmc-view-default-currency"><?php esc_html_e( 'View in default currency', 'woo-multi-currency' ) ?></label> </li> <?php } } /**Filter orders by each currency * * @param $args * * @return mixed */ public function report_by_currency_for_all( $args ) { $args['where_meta'][] = array( 'meta_key' => '_order_currency',// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key 'meta_value' => $this->currency,// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value 'operator' => '=', ); $args['where_meta']['relation'] = 'AND'; $args['nocache'] = true; return $args; } public function add_return_order_id( $args ) { if ( ! isset( $args['data']['ID'] ) ) { if ( ! empty( $args['data']['_order_total'] ) ) { $args['data']['ID'] = array( 'type' => 'post_data', 'function' => '', 'name' => 'order_id', ); $args['group_by'] = 'order_id'; $args['data']['_order_total']['function'] = ''; } elseif ( ! empty( $args['data']['_line_total'] ) ) { $args['data']['ID'] = array( 'type' => 'post_data', 'function' => '', 'name' => 'order_id', ); $args['group_by'] = 'order_id'; $args['data']['_line_total']['function'] = ''; } } $args['nocache'] = true; return $args; } /**Convert to default currency for WooCommerce Status in WP dashboard * * @param $result * @param $data * * @return mixed */ public function woocommerce_reports_get_order_report_data_for_dashboard( $result, $data ) { if ( $this->is_dashboard ) { if ( count( array_keys( $data ) ) === 3 && count( array_intersect( array_keys( $data ), array( '_order_total', 'post_date', 'ID' ) ) ) === 3 ) { if ( is_array( $result ) && count( $result ) ) { foreach ( $result as $key => $value ) { $order_id = $value->order_id; $line_product = wc_get_order( $order_id ); $_order_currency = $line_product->get_meta('_order_currency', true ); $wmc_order_info = $line_product->get_meta('wmc_order_info', true ); $rate = 0; if ( isset( $wmc_order_info[ $this->default_currency ] ) && isset( $wmc_order_info[ $this->default_currency ]['is_main'] ) && $wmc_order_info[ $this->default_currency ]['is_main'] == 1 ) { if ( isset( $wmc_order_info[ $_order_currency ] ) ) { $rate = $wmc_order_info[ $_order_currency ]['rate']; } if ( isset( $this->currencies[ $_order_currency ] ) ) { $rate = $this->currencies[ $_order_currency ]['rate']; } } elseif ( isset( $this->currencies[ $_order_currency ] ) ) { $rate = $this->currencies[ $_order_currency ]['rate']; } if ( $rate > 0 ) { $value->sparkline_value = self::convert_to_default_currency( $value->sparkline_value, $rate ); } } } } else { $result = $this->woocommerce_reports_get_order_report_data_1( $result, $data ); } $this->is_dashboard = false; } return $result; } /** * @param $result * @param $data * * @return mixed */ public function woocommerce_reports_get_order_report_data_1( $result, $data ) { if ( isset( $data['ID'] ) && ( ! empty( $data['_order_total'] ) || ! empty( $data['_line_total'] ) ) ) { foreach ( $result as $data_k => $data_obj ) { $order_id = isset( $data_obj->order_id ) ? $data_obj->order_id : ( isset( $data_obj->refund_id ) ? $data_obj->refund_id : '' ); if ( $order_id ) { $line_order = wc_get_order( $order_id ); $_order_currency = $line_order->get_meta('_order_currency', true ); if ( $this->default_currency !== $_order_currency ) { $wmc_order_info = $line_order->get_meta('wmc_order_info', true ); $rate = 0; if ( isset( $wmc_order_info[ $this->default_currency ] ) && isset( $wmc_order_info[ $this->default_currency ]['is_main'] ) && $wmc_order_info[ $this->default_currency ]['is_main'] == 1 ) { if ( isset( $wmc_order_info[ $_order_currency ] ) ) { $rate = $wmc_order_info[ $_order_currency ]['rate']; } if ( isset( $this->currencies[ $_order_currency ] ) ) { $rate = $this->currencies[ $_order_currency ]['rate']; } } elseif ( isset( $this->currencies[ $_order_currency ] ) ) { $rate = $this->currencies[ $_order_currency ]['rate']; } if ( $rate > 0 ) { foreach ( $data_obj as $data_obj_k => $data_obj_v ) { if ( ! in_array( $data_obj_k, array( 'post_date', 'order_id', 'refund_id' ) ) ) { $data_obj->{$data_obj_k} = self::convert_to_default_currency( $data_obj_v, $rate ); } } } } } } } return $result; } /** * @param $result * @param $data * * @return mixed */ public function woocommerce_reports_get_order_report_data( $result, $data ) { if ( isset( $data['_line_total'] ) ) { if ( $this->total_sales !== null && ! is_array( $result ) ) { $result = $this->total_sales; } elseif ( $this->order_items !== null && is_array( $result ) ) { $result = $this->order_items; } } return $result; } /**Recalculate report data after converting all to default currency * * @param $report_data * * @return mixed */ public function woocommerce_admin_report_data( $report_data ) { if ( is_array( $this->results ) && count( $this->results ) ) { $report_data->orders = array(); $report_data->refund_lines = array(); $report_data->refunded_orders = array(); $report_data->full_refunds = array(); foreach ( $this->results as $result ) { if ( isset( $result->orders ) && is_array( $result->orders ) && count( $result->orders ) ) { $report_data->orders = array_merge( $report_data->orders, $result->orders ); } if ( isset( $result->refund_lines ) && is_array( $result->refund_lines ) && count( $result->refund_lines ) ) { $report_data->refund_lines = array_merge( $report_data->refund_lines, $result->refund_lines ); } if ( isset( $result->refunded_orders ) && is_array( $result->refunded_orders ) && count( $result->refunded_orders ) ) { $report_data->refunded_orders = array_merge( $report_data->refunded_orders, $result->refunded_orders ); } if ( isset( $result->full_refunds ) && is_array( $result->full_refunds ) && count( $result->full_refunds ) ) { $report_data->full_refunds = array_merge( $report_data->full_refunds, $result->full_refunds ); } } $report_data->total_tax_refunded = 0; $report_data->total_shipping_refunded = 0; $report_data->total_shipping_tax_refunded = 0; $report_data->total_refunds = 0; $report_data->refunded_orders = array_merge( $report_data->partial_refunds, $report_data->full_refunds ); foreach ( $report_data->refunded_orders as $key => $value ) { $report_data->total_tax_refunded += floatval( $value->total_tax < 0 ? $value->total_tax * - 1 : $value->total_tax ); $report_data->total_refunds += floatval( $value->total_refund ); $report_data->total_shipping_tax_refunded += floatval( $value->total_shipping_tax < 0 ? $value->total_shipping_tax * - 1 : $value->total_shipping_tax ); $report_data->total_shipping_refunded += floatval( $value->total_shipping < 0 ? $value->total_shipping * - 1 : $value->total_shipping ); // Only applies to parial. if ( isset( $value->order_item_count ) ) { $report_data->refunded_order_items += floatval( $value->order_item_count < 0 ? $value->order_item_count * - 1 : $value->order_item_count ); } } // Totals from all orders - including those refunded. Subtract refunded amounts. $report_data->total_tax = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_tax' ) ) - $report_data->total_tax_refunded, 2 ); $report_data->total_shipping = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_shipping' ) ) - $report_data->total_shipping_refunded, 2 ); $report_data->total_shipping_tax = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_shipping_tax' ) ) - $report_data->total_shipping_tax_refunded, 2 ); // Total the refunds and sales amounts. Sales subract refunds. Note - total_sales also includes shipping costs. $report_data->total_sales = wc_format_decimal( array_sum( wp_list_pluck( $report_data->orders, 'total_sales' ) ) - $report_data->total_refunds, 2 ); $report_data->net_sales = wc_format_decimal( $report_data->total_sales - $report_data->total_shipping - max( 0, $report_data->total_tax ) - max( 0, $report_data->total_shipping_tax ), 2 ); // Calculate average based on net. $report_data->average_sales = wc_format_decimal( $report_data->net_sales / ( $this->chart_interval + 1 ), 2 ); $report_data->average_total_sales = wc_format_decimal( $report_data->total_sales / ( $this->chart_interval + 1 ), 2 ); // Total orders and discounts also includes those which have been refunded at some point. $report_data->total_coupons = number_format( array_sum( wp_list_pluck( $report_data->coupons, 'discount_amount' ) ), 2, '.', '' ); $report_data->total_refunded_orders = absint( count( $report_data->full_refunds ) ); // Total orders in this period, even if refunded. $report_data->total_orders = absint( array_sum( wp_list_pluck( $report_data->order_counts, 'count' ) ) ); // Item items ordered in this period, even if refunded. $report_data->total_items = absint( array_sum( wp_list_pluck( $report_data->order_items, 'order_item_count' ) ) ); $this->results = array(); } return $report_data; } /**Set price decimal for each currency for report * * @param $decimal * * @return int */ public function wc_get_price_decimals( $decimal ) { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return $decimal; } $view_default = isset( $_GET['wmc-view-default-currency'] ) ? sanitize_text_field( wp_unslash( $_GET['wmc-view-default-currency'] ) ) : ''; if ( is_admin() && ! empty( $_GET['wmc-currency'] ) && $view_default !== 'yes' ) { $currency = strtoupper( sanitize_text_field( wp_unslash( $_GET['wmc-currency'] ) ) ); if ( $currency !== $this->default_currency ) { $decimal = isset( $this->currencies[ $currency ]['decimals'] ) ? $this->currencies[ $currency ]['decimals'] : 0; } } return (int) $decimal; } /**Set currency for report * * @param $woocommerce_currency * * @return string */ public function woocommerce_currency( $woocommerce_currency ) { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return $woocommerce_currency; } $view_default = isset( $_GET['wmc-view-default-currency'] ) ? sanitize_text_field( wp_unslash( $_GET['wmc-view-default-currency'] ) ) : ''; $currency = isset( $_GET['wmc-currency'] ) ? strtoupper( sanitize_text_field( wp_unslash( $_GET['wmc-currency'] ) ) ) : ''; if ( is_admin() && ! empty( $_GET['wmc-currency'] ) && $view_default !== 'yes' ) { if ( $currency !== $this->default_currency ) { $woocommerce_currency = $currency; } } return $woocommerce_currency; } /**Filter orders by selected currency * * @param $args * * @return mixed */ public function report_by_currency( $args ) { if ( isset( $_REQUEST['_woo_multi_currency_nonce'] ) && ! wp_verify_nonce( sanitize_text_field( $_REQUEST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_reports' ) ) { return $args; } global $pagenow; if ( $pagenow === 'index.php' ) { /** * For WooCommerce Status in WP dashboard */ if ( ( ! empty( $args['data']['_order_total'] ) || ( ! empty( $args['data']['_product_id'] ) && ! empty( $args['data']['_line_total'] ) ) ) && empty( $args['data']['ID'] ) ) { $args['data']['ID'] = array( 'type' => 'post_data', 'function' => '', 'name' => 'order_id', ); $args['group_by'] = 'order_id'; $args['nocache'] = true; $this->is_dashboard = true; } } else { $report = isset( $_GET['report'] ) ? sanitize_text_field( wp_unslash( $_GET['report'] ) ) : ''; $tab = isset( $_GET['tab'] ) ? sanitize_text_field( wp_unslash( $_GET['tab'] ) ) : 'orders'; $currency = isset( $_GET['wmc-currency'] ) ? strtoupper( sanitize_text_field( wp_unslash( $_GET['wmc-currency'] ) ) ) : ''; if ( $currency ) { if ( $currency !== $this->default_currency ) { $args['nocache'] = true; } if ( ( $tab === 'orders' && $report !== 'coupon_usage' ) || ( $tab === 'customers' && $report === 'customers' ) ) { $args['where_meta'][] = array( 'meta_key' => '_order_currency',// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key 'meta_value' => $currency,// phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_value 'operator' => '=', ); $args['where_meta']['relation'] = 'AND'; } } } return $args; } }PK ZU,]���VK VK admin.phpnu ��� <?php require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/help-tabs.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/tag-generator.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/welcome-panel.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/config-validator.php'; add_action( 'admin_init', static function () { do_action( 'wpcf7_admin_init' ); }, 10, 0 ); add_action( 'admin_menu', 'wpcf7_admin_menu', 9, 0 ); function wpcf7_admin_menu() { do_action( 'wpcf7_admin_menu' ); add_menu_page( __( 'Contact Form 7', 'contact-form-7' ), __( 'Contact', 'contact-form-7' ) . wpcf7_admin_menu_change_notice(), 'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page', 'dashicons-email', 30 ); $edit = add_submenu_page( 'wpcf7', __( 'Edit Contact Form', 'contact-form-7' ), __( 'Contact Forms', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7' ), 'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page' ); add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin', 10, 0 ); $addnew = add_submenu_page( 'wpcf7', __( 'Add Contact Form', 'contact-form-7' ), __( 'Add Contact Form', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7-new' ), 'wpcf7_edit_contact_forms', 'wpcf7-new', 'wpcf7_admin_add_new_page' ); add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin', 10, 0 ); $integration = WPCF7_Integration::get_instance(); if ( $integration->service_exists() ) { $integration = add_submenu_page( 'wpcf7', __( 'Integration with External API', 'contact-form-7' ), __( 'Integration', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7-integration' ), 'wpcf7_manage_integration', 'wpcf7-integration', 'wpcf7_admin_integration_page' ); add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 ); } } function wpcf7_admin_menu_change_notice( $menu_slug = '' ) { $counts = apply_filters( 'wpcf7_admin_menu_change_notice', array( 'wpcf7' => 0, 'wpcf7-new' => 0, 'wpcf7-integration' => 0, ) ); if ( empty( $menu_slug ) ) { $count = absint( array_sum( $counts ) ); } elseif ( isset( $counts[$menu_slug] ) ) { $count = absint( $counts[$menu_slug] ); } else { $count = 0; } if ( $count ) { return sprintf( ' <span class="update-plugins %1$d"><span class="plugin-count">%2$s</span></span>', $count, esc_html( number_format_i18n( $count ) ) ); } return ''; } add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts', 10, 1 ); function wpcf7_admin_enqueue_scripts( $hook_suffix ) { if ( false === strpos( $hook_suffix, 'wpcf7' ) ) { return; } wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/includes/css/styles.css' ), array(), WPCF7_VERSION, 'all' ); if ( wpcf7_is_rtl() ) { wp_enqueue_style( 'contact-form-7-admin-rtl', wpcf7_plugin_url( 'admin/includes/css/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' ); } $assets = include wpcf7_plugin_path( 'admin/includes/js/index.asset.php' ); $assets = wp_parse_args( $assets, array( 'dependencies' => array(), 'version' => WPCF7_VERSION, ) ); wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/includes/js/index.js' ), $assets['dependencies'], $assets['version'], array( 'in_footer' => true ) ); wp_set_script_translations( 'wpcf7-admin', 'contact-form-7' ); $wpcf7_obj = array( 'apiSettings' => array( 'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ), 'namespace' => 'contact-form-7/v1', ), ); $post = wpcf7_get_current_contact_form(); if ( $post ) { $wpcf7_obj = array_merge( $wpcf7_obj, array( 'nonce' => array( 'save' => wp_create_nonce( sprintf( 'wpcf7-save-contact-form_%s', $post->initial() ? -1 : $post->id() ) ), 'copy' => wp_create_nonce( sprintf( 'wpcf7-copy-contact-form_%s', $post->initial() ? -1 : $post->id() ) ), 'delete' => wp_create_nonce( sprintf( 'wpcf7-delete-contact-form_%s', $post->initial() ? -1 : $post->id() ) ), ), 'configValidator' => array( 'errors' => array(), 'docUrl' => WPCF7_ConfigValidator::get_doc_link(), ), ) ); if ( current_user_can( 'wpcf7_edit_contact_form', $post->id() ) and wpcf7_validate_configuration() ) { $config_validator = new WPCF7_ConfigValidator( $post ); $config_validator->restore(); $wpcf7_obj['configValidator'] = array_merge( $wpcf7_obj['configValidator'], array( 'errors' => $config_validator->collect_error_messages( array( 'decodes_html_entities' => true ) ), ) ); } } wp_add_inline_script( 'wpcf7-admin', sprintf( 'var wpcf7 = %s;', wp_json_encode( $wpcf7_obj, JSON_PRETTY_PRINT ) ), 'before' ); } add_filter( 'set_screen_option_wpcf7_contact_forms_per_page', static function ( $result, $option, $value ) { $wpcf7_screens = array( 'wpcf7_contact_forms_per_page', ); if ( in_array( $option, $wpcf7_screens, true ) ) { $result = $value; } return $result; }, 10, 3 ); function wpcf7_load_contact_form_admin() { global $plugin_page; $action = wpcf7_current_action(); do_action( 'wpcf7_admin_load', wpcf7_superglobal_get( 'page' ), $action ); if ( 'save' === $action ) { $id = wpcf7_superglobal_post( 'post_ID', '-1' ); check_admin_referer( 'wpcf7-save-contact-form_' . $id ); if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { wp_die( esc_html( __( 'You are not allowed to edit this item.', 'contact-form-7' ) ) ); } $contact_form = wpcf7_save_contact_form( array_merge( wp_unslash( $_REQUEST ), array( 'id' => $id, 'title' => wpcf7_superglobal_post( 'post_title', null ), 'locale' => wpcf7_superglobal_post( 'wpcf7-locale', null ), 'form' => wpcf7_superglobal_post( 'wpcf7-form', '' ), 'mail' => wpcf7_superglobal_post( 'wpcf7-mail', array() ), 'mail_2' => wpcf7_superglobal_post( 'wpcf7-mail-2', array() ), 'messages' => wpcf7_superglobal_post( 'wpcf7-messages', array() ), 'additional_settings' => wpcf7_superglobal_post( 'wpcf7-additional-settings', '' ), ) ) ); if ( $contact_form and wpcf7_validate_configuration() ) { $config_validator = new WPCF7_ConfigValidator( $contact_form ); $config_validator->validate(); $config_validator->save(); } $query = array( 'post' => $contact_form ? $contact_form->id() : 0, 'active-tab' => wpcf7_canonicalize_name( wpcf7_superglobal_post( 'active-tab' ) ), ); if ( ! $contact_form ) { $query['message'] = 'failed'; } elseif ( -1 === (int) $id ) { $query['message'] = 'created'; } else { $query['message'] = 'saved'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } if ( 'copy' === $action ) { $id = absint( $_POST['post_ID'] ?? $_REQUEST['post'] ?? '' ); check_admin_referer( 'wpcf7-copy-contact-form_' . $id ); if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { wp_die( esc_html( __( 'You are not allowed to edit this item.', 'contact-form-7' ) ) ); } $query = array(); if ( $contact_form = wpcf7_contact_form( $id ) ) { $new_contact_form = $contact_form->copy(); $new_contact_form->save(); $query['post'] = $new_contact_form->id(); $query['message'] = 'created'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } if ( 'delete' === $action ) { $nonce_action = 'bulk-posts'; if ( $post_id = wpcf7_superglobal_post( 'post_ID' ) or ! is_array( $post_id = wpcf7_superglobal_request( 'post', array() ) ) ) { $nonce_action = sprintf( 'wpcf7-delete-contact-form_%s', $post_id ); } check_admin_referer( $nonce_action ); $posts = array_filter( (array) $post_id ); $deleted = 0; foreach ( $posts as $post ) { $post = WPCF7_ContactForm::get_instance( $post ); if ( empty( $post ) ) { continue; } if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) { wp_die( esc_html( __( 'You are not allowed to delete this item.', 'contact-form-7' ) ) ); } if ( ! $post->delete() ) { wp_die( esc_html( __( 'Error in deleting.', 'contact-form-7' ) ) ); } $deleted += 1; } $query = array(); if ( ! empty( $deleted ) ) { $query['message'] = 'deleted'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } $post = null; if ( 'wpcf7-new' === $plugin_page ) { $post = WPCF7_ContactForm::get_template( array( 'locale' => wpcf7_superglobal_get( 'locale', null ), ) ); } elseif ( $post_id = wpcf7_superglobal_get( 'post' ) ) { $post = WPCF7_ContactForm::get_instance( $post_id ); } $current_screen = get_current_screen(); $help_tabs = new WPCF7_Help_Tabs( $current_screen ); if ( $post and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) { $help_tabs->set_help_tabs( 'edit' ); } else { $help_tabs->set_help_tabs( 'list' ); if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) ) { require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php'; } add_filter( 'manage_' . $current_screen->id . '_columns', array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ), 10, 0 ); add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'wpcf7_contact_forms_per_page', ) ); } } function wpcf7_admin_management_page() { if ( $post = wpcf7_get_current_contact_form() ) { $post_id = $post->initial() ? -1 : $post->id(); require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; return; } if ( 'validate' === wpcf7_current_action() and wpcf7_validate_configuration() and current_user_can( 'wpcf7_edit_contact_forms' ) ) { wpcf7_admin_bulk_validate_page(); return; } $list_table = new WPCF7_Contact_Form_List_Table(); $list_table->prepare_items(); $formatter = new WPCF7_HTMLFormatter( array( 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( 'form' => array( 'method' => true, ), ) ), ) ); $formatter->append_start_tag( 'div', array( 'class' => 'wrap', 'id' => 'wpcf7-contact-form-list-table', ) ); $formatter->append_start_tag( 'h1', array( 'class' => 'wp-heading-inline', ) ); $formatter->append_preformatted( esc_html( __( 'Contact Forms', 'contact-form-7' ) ) ); $formatter->end_tag( 'h1' ); if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) { $formatter->append_preformatted( wpcf7_link( menu_page_url( 'wpcf7-new', false ), __( 'Add Contact Form', 'contact-form-7' ), array( 'class' => 'page-title-action' ) ) ); } if ( $search_keyword = wpcf7_superglobal_request( 's' ) ) { $formatter->append_start_tag( 'span', array( 'class' => 'subtitle', ) ); $formatter->append_preformatted( sprintf( /* translators: %s: Search query. */ __( 'Search results for: <strong>%s</strong>', 'contact-form-7' ), esc_html( $search_keyword ) ) ); $formatter->end_tag( 'span' ); } $formatter->append_start_tag( 'hr', array( 'class' => 'wp-header-end', ) ); $formatter->call_user_func( static function () { do_action( 'wpcf7_admin_warnings', 'wpcf7', wpcf7_current_action(), null ); wpcf7_welcome_panel(); do_action( 'wpcf7_admin_notices', 'wpcf7', wpcf7_current_action(), null ); } ); $formatter->append_start_tag( 'form', array( 'method' => 'get', ) ); $formatter->append_start_tag( 'input', array( 'type' => 'hidden', 'name' => 'page', 'value' => wpcf7_superglobal_request( 'page' ), ) ); $formatter->call_user_func( static function () use ( $list_table ) { $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); $list_table->display(); } ); $formatter->print(); } function wpcf7_admin_add_new_page() { $post = wpcf7_get_current_contact_form(); if ( ! $post ) { $post = WPCF7_ContactForm::get_template(); } $post_id = -1; require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; } function wpcf7_load_integration_page() { do_action( 'wpcf7_admin_load', wpcf7_superglobal_get( 'page' ), wpcf7_current_action() ); $integration = WPCF7_Integration::get_instance(); if ( $service_name = wpcf7_superglobal_request( 'service' ) and $integration->service_exists( $service_name ) ) { $service = $integration->get_service( $service_name ); $service->load( wpcf7_current_action() ); } $help_tabs = new WPCF7_Help_Tabs( get_current_screen() ); $help_tabs->set_help_tabs( 'integration' ); } function wpcf7_admin_integration_page() { $integration = WPCF7_Integration::get_instance(); $service_name = wpcf7_superglobal_request( 'service' ); $service = null; if ( $service_name and $integration->service_exists( $service_name ) ) { $service = $integration->get_service( $service_name ); } $formatter = new WPCF7_HTMLFormatter( array( 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( 'form' => array( 'action' => true, 'method' => true, ), ) ), ) ); $formatter->append_start_tag( 'div', array( 'class' => 'wrap', 'id' => 'wpcf7-integration', ) ); $formatter->append_start_tag( 'h1' ); $formatter->append_preformatted( esc_html( __( 'Integration with External API', 'contact-form-7' ) ) ); $formatter->end_tag( 'h1' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( sprintf( /* translators: %s: URL to support page about integration with external APIs */ __( 'You can expand the possibilities of your contact forms by integrating them with external services. For details, see <a href="%s">Integration with external APIs</a>.', 'contact-form-7' ), __( 'https://contactform7.com/integration-with-external-apis/', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); $formatter->call_user_func( static function () use ( $integration, $service, $service_name ) { do_action( 'wpcf7_admin_warnings', 'wpcf7-integration', wpcf7_current_action(), $service ); do_action( 'wpcf7_admin_notices', 'wpcf7-integration', wpcf7_current_action(), $service ); if ( $service ) { $message = wpcf7_superglobal_request( 'message' ); $service->admin_notice( $message ); $integration->list_services( array( 'include' => $service_name, ) ); } else { $integration->list_services(); } } ); $formatter->print(); } add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 ); function wpcf7_admin_updated_message( $page, $action, $object ) { if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ), true ) ) { return; } $message_type = wpcf7_superglobal_request( 'message' ); if ( ! $message_type ) { return; } $notice_type = 'success'; if ( 'created' === $message_type ) { $message = __( 'Contact form created.', 'contact-form-7' ); } elseif ( 'saved' === $message_type ) { $message = __( 'Contact form saved.', 'contact-form-7' ); } elseif ( 'deleted' === $message_type ) { $message = __( 'Contact form deleted.', 'contact-form-7' ); } elseif ( 'failed' === $message_type ) { $notice_type = 'error'; $message = __( 'There was an error saving the contact form.', 'contact-form-7' ); } elseif ( 'validated' === $message_type ) { $bulk_validate = WPCF7::get_option( 'bulk_validate', array() ); $count_invalid = absint( $bulk_validate['count_invalid'] ?? 0 ); if ( $count_invalid ) { $notice_type = 'warning'; $message = sprintf( /* translators: %s: number of contact forms */ _n( 'Configuration validation completed. %s invalid contact form was found.', 'Configuration validation completed. %s invalid contact forms were found.', $count_invalid, 'contact-form-7' ), number_format_i18n( $count_invalid ) ); } else { $message = __( 'Configuration validation completed. No invalid contact form was found.', 'contact-form-7' ); } } if ( ! empty( $message ) ) { wp_admin_notice( $message, array( 'type' => $notice_type ) ); } } add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 ); function wpcf7_plugin_action_links( $links, $file ) { if ( WPCF7_PLUGIN_BASENAME !== $file ) { return $links; } if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) { return $links; } $settings_link = wpcf7_link( menu_page_url( 'wpcf7', false ), __( 'Settings', 'contact-form-7' ) ); array_unshift( $links, $settings_link ); return $links; } add_action( 'wpcf7_admin_warnings', 'wpcf7_old_wp_version_error', 10, 3 ); function wpcf7_old_wp_version_error( $page, $action, $object ) { $wp_version = get_bloginfo( 'version' ); if ( version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) { wp_admin_notice( sprintf( /* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */ __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ), array( 'type' => 'warning' ) ); } } add_action( 'wpcf7_admin_warnings', 'wpcf7_not_allowed_to_edit', 10, 3 ); function wpcf7_not_allowed_to_edit( $page, $action, $object ) { if ( $object instanceof WPCF7_ContactForm ) { $contact_form = $object; } else { return; } if ( ! current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) { wp_admin_notice( __( 'You are not allowed to edit this contact form.', 'contact-form-7' ), array( 'type' => 'warning' ) ); } } add_action( 'wpcf7_admin_warnings', 'wpcf7_ctct_deprecated_warning', 10, 3 ); function wpcf7_ctct_deprecated_warning( $page, $action, $object ) { $service = WPCF7_ConstantContact::get_instance(); if ( $service->is_active() ) { wp_admin_notice( __( 'Contact Form 7 has completed the <a href="https://contactform7.com/2025/01/08/complete-removal-of-constant-contact-integration/">removal of the Constant Contact integration</a>. We recommend <a href="https://contactform7.com/sendinblue-integration/">Brevo</a> as an alternative.', 'contact-form-7' ), array( 'type' => 'warning' ) ); } } add_action( 'wpcf7_admin_warnings', 'wpcf7_captcha_future_warning', 10, 3 ); function wpcf7_captcha_future_warning( $page, $action, $object ) { $service = WPCF7_RECAPTCHA::get_instance(); if ( $service->is_active() ) { wp_admin_notice( __( '<strong>Attention reCAPTCHA users:</strong> Google attempts to make all reCAPTCHA users migrate to reCAPTCHA Enterprise, meaning Google charges you for API calls exceeding the free tier. Contact Form 7 supports <a href="https://contactform7.com/turnstile-integration/">Cloudflare Turnstile</a>, and we recommend it unless you have reasons to use reCAPTCHA.', 'contact-form-7' ), array( 'type' => 'warning' ) ); } } PK ZU,]CeVR�; �; analytics.phpnu ��� <?php if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Class WOOMULTI_CURRENCY_F_Admin_Analytics */ class WOOMULTI_CURRENCY_F_Admin_Analytics { protected $settings; protected $args; protected $default_currency; public function __construct() { $this->settings = WOOMULTI_CURRENCY_F_Data::get_ins(); $this->default_currency = $this->settings->get_default_currency(); /*Orders*/ // add_filter( 'woocommerce_analytics_orders_select_query', array( // $this, // 'woocommerce_analytics_orders_select_query' // ) ); // /*Orders stats*/ // add_filter( 'woocommerce_analytics_orders_stats_query_args', array( // $this, // 'woocommerce_analytics_query_args' // ) ); // add_filter( 'woocommerce_analytics_orders_stats_select_query', array( // $this, // 'convert_orders_stats' // ) ); // /*Revenue*/ // add_filter( 'woocommerce_analytics_revenue_query_args', array( // $this, // 'woocommerce_analytics_query_args' // ) ); // add_filter( 'woocommerce_analytics_revenue_select_query', array( // $this, // 'convert_orders_stats' // ) ); // /*Products*/ // add_filter( 'woocommerce_analytics_products_query_args', array( // $this, // 'woocommerce_analytics_query_args' // ) ); // add_filter( 'woocommerce_analytics_products_select_query', array( // $this, // 'convert_orders_stats' // ) ); // /*Products stats*/ // add_filter( 'woocommerce_analytics_products_stats_query_args', array( // $this, // 'woocommerce_analytics_query_args' // ) ); // add_filter( 'woocommerce_analytics_products_stats_select_query', array( // $this, // 'convert_orders_stats' // ) ); // /*Categories*/ // add_filter( 'woocommerce_analytics_categories_query_args', array( // $this, // 'woocommerce_analytics_query_args' // ) ); // add_filter( 'woocommerce_analytics_categories_select_query', array( // $this, // 'convert_orders_stats' // ) ); add_filter( 'woocommerce_analytics_update_order_stats_data', [ $this, 'import_order_to_order_stats_table' ], 10, 2 ); add_action( 'woocommerce_analytics_update_product', [ $this, 'import_order_product_to_order_product_lookup_table' ], 10, 2 ); add_action( 'woocommerce_analytics_update_coupon', [ $this, 'import_order_coupon_to_order_coupon_lookup_table' ], 10, 2 ); add_action( 'woocommerce_analytics_update_tax', [ $this, 'import_order_tax_to_order_tax_lookup_table' ], 10, 2 ); } /** * @param $order WC_Order * * @return float|int */ public function get_rate( $order ) { $order = $order->get_parent_id() ? wc_get_order( $order->get_parent_id() ) : $order; $rate = 1; $order_id = $order->get_id(); $order_currency = $order->get_currency(); $default_currency = $this->default_currency; $order_info = $order->get_meta('wmc_order_info', true ); if ( isset( $order_info[ $order_currency ], $order_info[ $default_currency ], $order_info[ $default_currency ]['is_main'] ) && $order_info[ $default_currency ]['is_main'] == 1 && $order_info[ $order_currency ]['rate'] > 0 ) { $rate = floatval( $order_info[ $order_currency ]['rate'] ); } return $rate; } public function import_order_to_order_stats_table( $order_data, $order ) { $rate = $this->get_rate( $order ); if ( $rate && $rate != 1 ) { $order_data['total_sales'] = $order_data['total_sales'] / $rate; $order_data['tax_total'] = $order_data['tax_total'] / $rate; $order_data['shipping_total'] = $order_data['shipping_total'] / $rate; $order_data['net_total'] = $order_data['net_total'] / $rate; } return $order_data; } public function import_order_product_to_order_product_lookup_table( $order_item_id, $order_id ) { global $wpdb; $table_name = $wpdb->prefix . 'wc_order_product_lookup'; $order = wc_get_order( $order_id ); $rate = $this->get_rate( $order ); if ( $rate && $rate != 1 ) { $items = $order->get_items(); $order_item = $items[ $order_item_id ]; $decimals = wc_get_price_decimals(); $round_tax = 'no' === get_option( 'woocommerce_tax_round_at_subtotal' ); // Tax amount. $tax_amount = 0; $order_taxes = $order->get_taxes(); $tax_data = $order_item->get_taxes(); foreach ( $order_taxes as $tax_item ) { $tax_item_id = $tax_item->get_rate_id(); $tax_amount += isset( $tax_data['total'][ $tax_item_id ] ) ? (float) $tax_data['total'][ $tax_item_id ] : 0; } $net_revenue = round( $order_item->get_total( 'edit' ) / $rate, $decimals ); if ( $round_tax ) { $tax_amount = round( $tax_amount, $decimals ); } $tax_amount = $tax_amount / $rate; $coupon_amount = $order->get_item_coupon_amount( $order_item ) / $rate; $shipping_amount = $order->get_item_shipping_amount( $order_item ) / $rate; $shipping_tax_amount = $order->get_item_shipping_tax_amount( $order_item ) / $rate; $wpdb->update( $table_name,// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching [ 'product_net_revenue' => $net_revenue, 'coupon_amount' => $coupon_amount, 'tax_amount' => $tax_amount, 'shipping_amount' => $shipping_amount, 'shipping_tax_amount' => $shipping_tax_amount, 'product_gross_revenue' => $net_revenue + $tax_amount + $shipping_amount + $shipping_tax_amount, ], [ 'order_item_id' => $order_item_id ], [ '%f', // product_net_revenue. '%f', // coupon_amount. '%f', // tax_amount. '%f', // shipping_amount. '%f', // shipping_tax_amount. '%f', // product_gross_revenue. ] ); } } public function import_order_coupon_to_order_coupon_lookup_table( $coupon_id, $order_id ) { global $wpdb; $table_name = $wpdb->prefix . 'wc_order_coupon_lookup'; $order = wc_get_order( $order_id ); $rate = $this->get_rate( $order ); if ( $rate && $rate != 1 ) { $coupon_items = $order->get_items( 'coupon' ); $discount_amount = 0; foreach ( $coupon_items as $coupon_item ) { $c_data = $coupon_item->get_meta( 'coupon_data', true ); $c_id = $c_data['id'] ?? wc_get_coupon_id_by_code( $coupon_item->get_code() ); if ( $c_id == $coupon_id ) { $discount_amount = $coupon_item->get_discount(); } } $discount_amount = $discount_amount / $rate; $wpdb->update( $table_name, [ 'discount_amount' => $discount_amount, ], [ 'order_id' => $order_id ], [ '%f', ] );// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching } } public function import_order_tax_to_order_tax_lookup_table( $tax_rate_id, $order_id ) { global $wpdb; $table_name = $wpdb->prefix . 'wc_order_tax_lookup'; $order = wc_get_order( $order_id ); $rate = $this->get_rate( $order ); if ( $rate && $rate != 1 ) { $tax_items = $order->get_items( 'tax' ); $shipping_tax = 0; $order_tax = 0; $total_tax = 0; foreach ( $tax_items as $tax_item ) { if ( $tax_item->get_rate_id() == $tax_rate_id ) { $shipping_tax = $tax_item->get_shipping_tax_total() / $rate; $order_tax = $tax_item->get_tax_total() / $rate; $total_tax = ( (float) $tax_item->get_tax_total() + (float) $tax_item->get_shipping_tax_total() ) / $rate; } } $wpdb->update( $table_name,// phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching [ 'shipping_tax' => $shipping_tax, 'order_tax' => $order_tax, 'total_tax' => $total_tax ], [ 'order_id' => $order_id ], [ '%f', '%f', '%f', ] ); } } /** * Only to save args for later use * * @param $args * * @return mixed */ public function woocommerce_analytics_query_args( $args ) { $this->args = $args; return $args; } /** * Convert order stats based on rate stored in order meta wmc_order_info * * @param $order_data * @param $default_currency * * @return array */ private static function get_converted_order( $order_data, $default_currency ) { $order_id = $order_data['order_id']; $parent_id = $order_data['parent_id'] ?? ''; $order = wc_get_order( $order_id ); if ( $parent_id ) { $order_info = get_post_meta( $parent_id, 'wmc_order_info', true ); } else { $order_info = $order->get_meta('wmc_order_info', true ); } $currency = $order->get_meta( $order_id, '_order_currency', true ); $rate = 1; if ( isset( $order_info[ $currency ], $order_info[ $default_currency ], $order_info[ $default_currency ]['is_main'] ) && $order_info[ $default_currency ]['is_main'] == 1 && $order_info[ $currency ]['rate'] > 0 ) { $rate = floatval( $order_info[ $currency ]['rate'] ); } $converted_order = array( 'date_created' => strtotime( $order_data['date_created'] ), 'gross_sales' => 0, 'refunds' => 0, 'net_revenue' => self::format_price( floatval( $order_data['net_total'] ) / $rate ), 'coupons' => 0, 'taxes' => 0, 'shipping' => 0, 'total_sales' => self::format_price( floatval( $order_data['total_sales'] ) / $rate ), ); if ( $order ) { if ( $order_data['net_total'] < 0 ) { $converted_order['refunds'] = abs( $converted_order['net_revenue'] ); } $converted_order['coupons'] = self::format_price( floatval( $order->get_total_discount() ) / $rate ); $converted_order['taxes'] = self::format_price( floatval( $order->get_total_tax() ) / $rate ); $converted_order['shipping'] = self::format_price( floatval( $order->get_shipping_total() ) / $rate ); } $converted_order['gross_sales'] = $converted_order['total_sales'] + $converted_order['coupons'] - $converted_order['taxes'] - $converted_order['shipping'] + $converted_order['refunds']; return $converted_order; } /** * Convert orders stats * * @param $results * * @return mixed * @throws Exception */ public function convert_orders_stats( $results ) { if ( $this->args !== null ) { $args = $this->args; $args['fields'] = ''; // $args['extended_info'] = 1; $data_store = \WC_Data_Store::load( 'report-orders' ); $results_orders = $data_store->get_data( $args ); $converted = array( 'gross_sales' => 0, 'refunds' => 0, 'net_revenue' => 0, 'coupons' => 0, 'taxes' => 0, 'shipping' => 0, 'total_sales' => 0, ); if ( count( $results_orders->data ) ) { $orders_data = $results_orders->data; if ( $results_orders->pages > 1 ) { for ( $i = 2; $i <= $results_orders->pages; $i ++ ) { $args['page'] = $i; $results_orders = $data_store->get_data( $args ); if ( count( $results_orders->data ) ) { $orders_data = array_merge( $orders_data, $results_orders->data ); } } } $default_currency = $this->settings->get_default_currency(); $converted_orders = array(); foreach ( $orders_data as $order_data ) { if ( ! empty( $order_data['order_id'] ) ) { $converted_order = self::get_converted_order( $order_data, $default_currency ); foreach ( $converted_order as $converted_order_k => $converted_order_v ) { if ( isset( $converted[ $converted_order_k ] ) ) { $converted[ $converted_order_k ] += $converted_order_v; } } $converted_orders[] = $converted_order; } } foreach ( $converted as $key => $value ) { if ( isset( $results->totals->{$key} ) ) { $results->totals->{$key} = $value; } } if ( isset( $results->totals->avg_order_value, $results->totals->orders_count ) && $results->totals->orders_count > 0 ) { $results->totals->avg_order_value = $results->totals->net_revenue / $results->totals->orders_count; } if ( isset( $results->intervals ) && count( $results->intervals ) && count( $converted_orders ) ) { foreach ( $results->intervals as $key => $interval ) { if ( isset( $interval['subtotals'] ) && isset( $interval['subtotals']->gross_sales, $interval['subtotals']->total_sales, $interval['subtotals']->net_revenue ) && ( $interval['subtotals']->gross_sales > 0 || $interval['subtotals']->net_revenue > 0 || $interval['subtotals']->gross_sales > 0 ) ) { $subtotals = array( 'gross_sales' => 0, 'total_sales' => 0, 'coupons' => 0, 'refunds' => 0, 'taxes' => 0, 'shipping' => 0, 'net_revenue' => 0, 'avg_order_value' => 0, ); $found = false; foreach ( $converted_orders as $converted_order ) { if ( $converted_order['date_created'] >= strtotime( $interval['date_start'] ) && $converted_order['date_created'] <= strtotime( $interval['date_end'] ) ) { $found = true; $subtotals['net_revenue'] += $converted_order['net_revenue']; $subtotals['total_sales'] += $converted_order['total_sales']; $subtotals['refunds'] += $converted_order['refunds']; $subtotals['coupons'] += $converted_order['coupons']; $subtotals['taxes'] += $converted_order['taxes']; $subtotals['shipping'] += $converted_order['shipping']; $subtotals['gross_sales'] += $converted_order['gross_sales']; } elseif ( $found ) { break; } } if ( $found ) { if ( isset( $interval['subtotals']->avg_order_value, $interval['subtotals']->orders_count ) && $interval['subtotals']->orders_count > 0 ) { $subtotals['avg_order_value'] = $subtotals['net_revenue'] / $interval['subtotals']->orders_count; } foreach ( $subtotals as $subtotals_k => $subtotals_v ) { if ( isset( $interval['subtotals']->{$subtotals_k} ) ) { $results->intervals[ $key ]['subtotals']->{$subtotals_k} = $subtotals_v; } } } } } } } $this->args = null; } return $results; } /** * Convert net_total and total_sales of every order * * @param $results * * @return mixed */ public function woocommerce_analytics_orders_select_query( $results ) { $default_currency = $this->settings->get_default_currency(); foreach ( $results->data as $key => $order_data ) { if ( ! empty( $order_data['order_id'] ) ) { $converted_order = self::get_converted_order( $order_data, $default_currency ); $results->data[ $key ]['net_total'] = $converted_order['net_revenue']; $results->data[ $key ]['total_sales'] = $converted_order['total_sales']; } } return $results; } /** * Format price after converting * * @param $price * * @return float */ private static function format_price( $price ) { return $price > 0 ? floatval( str_replace( ',', '', number_format( $price, wc_get_price_decimals(), '.', ',' ) ) ) : $price; } }PK ZU,] U8� � cryptocurrency.phpnu ��� <?php /** * Class WOOMULTI_CURRENCY_F_Admin_Cryptocurrency */ if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_Cryptocurrency { protected $settings; public function __construct() { $this->settings = WOOMULTI_CURRENCY_F_Data::get_ins(); add_filter( 'woocommerce_currencies', array( $this, 'woocommerce_currencies' ) ); add_filter( 'woocommerce_currency_symbols', array( $this, 'woocommerce_currency_symbols' ) ); } /** * @param $currency * * @return mixed */ public function woocommerce_currencies( $currency ) { if ( is_admin() || $this->settings->get_enable() ) { $currency['LTC'] = esc_html__( 'Litecoin', 'woo-multi-currency' ); $currency['ETH'] = esc_html__( 'Ethereum', 'woo-multi-currency' ); $currency['ZWL'] = esc_html__( 'Zimbabwe', 'woo-multi-currency' ); } return $currency; } /** * @param $symbols * * @return mixed */ public function woocommerce_currency_symbols( $symbols ) { if ( is_admin() || $this->settings->get_enable() ) { $symbols['LTC'] = "LTC"; $symbols['ETH'] = "ETH"; $symbols['ZWL'] = "ZWL"; } return $symbols; } }PK ZU,]/6 �; �; settings.phpnu ��� <?php /* Class Name: WP_SM_Admin_Settings Author: Andy Ha (support@villatheme.com) Author URI: http://villatheme.com Copyright 2015-2017 villatheme.com. All rights reserved. */ if ( ! defined( 'ABSPATH' ) ) { exit; } class WOOMULTI_CURRENCY_F_Admin_Settings { static $params; public function __construct() { add_action( 'admin_init', array( $this, 'save_meta_boxes' ) ); add_action( 'wp_ajax_woomulticurrency_exchange', array( $this, 'woomulticurrency_exchange' ) ); add_action( 'wp_ajax_nopriv_woomulticurrency_exchange', array( $this, 'woomulticurrency_exchange' ) ); } public function woomulticurrency_exchange() { check_ajax_referer( 'wmc_ajax_nonce', 'nonce' ); if ( ! current_user_can( 'manage_woocommerce' ) || empty( $_POST['original_price'] ) || empty( $_POST['other_currencies'] ) ) { wp_die(); } $original_price = sanitize_text_field( wp_unslash( $_POST['original_price'] ) ); $other_currencies = wc_clean( wp_unslash( $_POST['other_currencies'] ) ); if ( ! is_array( $other_currencies ) ) { $other_currencies = (array) $other_currencies; } if ( ! empty( $other_currencies ) ) { $other_currencies = implode( ',', $other_currencies ); } $data = WOOMULTI_CURRENCY_F_Data::get_ins(); $rates = $data->get_exchange( $original_price, $other_currencies ); wp_send_json( $rates ); } private function stripslashes_deep( $value ) { $value = is_array( $value ) ? array_map( 'stripslashes_deep', $value ) : stripslashes( $value ); return $value; } /** * */ public function save_meta_boxes() { if ( ! isset( $_POST['_woo_multi_currency_nonce'] ) || ! isset( $_POST['woo_multi_currency_params'] ) ) { return; } if ( ! wp_verify_nonce( sanitize_text_field( $_POST['_woo_multi_currency_nonce'] ), 'woo_multi_currency_settings' ) ) { return; } if ( ! current_user_can( 'manage_woocommerce' ) ) { return; } $data = wc_clean( $_POST['woo_multi_currency_params'] ); $data['conditional_tags'] = $this->stripslashes_deep( $data['conditional_tags'] ); $data['custom_css'] = $this->stripslashes_deep( $data['custom_css'] ); /*Override WooCommerce Currency*/ if ( isset( $data['currency_default'] ) && $data['currency_default'] && isset( $data['currency'] ) ) { update_option( 'woocommerce_currency', $data['currency_default'] ); $index = array_search( $data['currency_default'], $data['currency'] ); /*Override WooCommerce Currency*/ if ( isset( $data['currency_pos'][ $index ] ) && $index && $data['currency_pos'][ $index ] ) { update_option( 'woocommerce_currency_pos', $data['currency_pos'][ $index ] ); } if ( isset( $data['currency_decimals'][ $index ] ) ) { update_option( 'woocommerce_price_num_decimals', $data['currency_decimals'][ $index ] ); } if ( count( $data['currency'] ) > 2 ) { array_splice( $data['currency'], 0, 2 ); array_splice( $data['currency_decimals'], 0, 2 ); array_splice( $data['currency_pos'], 0, 2 ); array_splice( $data['currency_rate'], 0, 2 ); array_splice( $data['currency_custom'], 0, 2 ); } } update_option( 'woo_multi_currency_params', $data ); delete_transient( 'wmc_update_exchange_rate' ); } /** * Set field in meta box * * @param $field * @param bool $multi * * @return string */ protected static function set_field( $field, $multi = false ) { if ( $field ) { if ( $multi ) { return esc_attr( 'woo_multi_currency_params[' . $field . '][]' ); } else { return esc_attr( 'woo_multi_currency_params[' . $field . ']' ); } } else { return ''; } } /** * @param $field * @param string $default * * @return string */ public static function get_field( $field, $default = '' ) { global $wmc_settings; $params = $wmc_settings; if ( self::$params ) { $params = self::$params; } else { self::$params = $params; } if ( isset( $params[ $field ] ) && $field ) { return $params[ $field ]; } else { return $default; } } /** * Check element in array * * @param $arg * @param $index * * @return bool */ static protected function data_isset( $arg, $index, $default = false ) { if ( isset( $arg[ $index ] ) ) { return $arg[ $index ]; } else { return $default; } } /** * */ public static function page_callback() { self::$params = get_option( 'woo_multi_currency_params', array() ); ?> <div class="wrap woo-multi-currency"> <h2><?php esc_attr_e( 'Multi Currency for WooCommerce Settings', 'woo-multi-currency' ) ?></h2> <form method="post" action="" class="vi-ui form"> <?php wp_nonce_field( 'woo_multi_currency_settings', '_woo_multi_currency_nonce' ); ?> <div class="vi-ui attached tabular menu"> <div class="item active" data-tab="general"> <a href="#general"><?php esc_html_e( 'General', 'woo-multi-currency' ) ?></a> </div> <div class="item" data-tab="location"> <a href="#location"><?php esc_html_e( 'Location', 'woo-multi-currency' ) ?></a> </div> <div class="item" data-tab="checkout"> <a href="#checkout"><?php esc_html_e( 'Checkout', 'woo-multi-currency' ) ?></a> </div> <div class="item" data-tab="design"> <a href="#design"><?php esc_html_e( 'Design', 'woo-multi-currency' ) ?></a> </div> <div class="item" data-tab="price"> <a href="#price"><?php esc_html_e( 'Price format', 'woo-multi-currency' ) ?></a> </div> <div class="item" data-tab="update"> <a href="#update"><?php esc_html_e( 'Update', 'woo-multi-currency' ) ?></a> </div> </div> <div class="vi-ui bottom attached tab segment active" data-tab="general"> <!-- Tab Content !--> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable' ) ) ?>"> <?php esc_html_e( 'Enable', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable' ) ) ?>"/> <label></label> </div> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_fixed_price' ) ) ?>"> <?php esc_html_e( 'Fixed Price', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable_fixed_price' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable_fixed_price' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable_fixed_price' ) ) ?>"/> <label></label> </div> <p class="description"><?php esc_html_e( 'Set up product price in each currency manually, this price will overwrite the calculated price.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'use_session' ) ) ?>"> <?php esc_html_e( 'Use SESSION', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Use SESSION instead of COOKIE.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_switch_currency_by_js' ) ) ?>"> <?php esc_html_e( 'Switch Currency by JS', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Currency will be changed but It does not use URL. It is good for SEO. Now It is not compatible with Caching plugins.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'cache_compatible' ) ) ?>"> <?php esc_html_e( 'Use cache plugin', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'cache_compatible' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'cache_compatible' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'cache_compatible' ) ) ?>"/> <label></label> </div> <p class="description"> <?php esc_html_e( 'Enable this if you are using a caching plugin(WP Super cache, W3 total cache, WP rocket, ...) and currency does not remain after being switched by customers in the frontend', 'woo-multi-currency' ) ?> </p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'loading_price_mask' ) ) ?>"> <?php esc_html_e( 'Loading price mask', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'loading_price_mask' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'loading_price_mask' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'loading_price_mask' ) ) ?>"/> <label></label> </div> <p class="description"><?php esc_html_e( 'Add loading layer when loading price via AJAX', 'woo-multi-currency' );//Now It is not compatible with Caching plugins.?></p> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Fixed Structure currency', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Fixed currency in schema structure data.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th colspan="2"> <label for="<?php echo esc_attr( self::set_field( 'enable_mobile' ) ) ?>"> <?php esc_html_e( 'Currency Options', 'woo-multi-currency' ) ?> </label> </th> </tr> <tr> <td colspan="2"> <table class="vi-ui table wmc-currency-options"> <thead> <tr> <th class="one wide"><?php esc_html_e( 'Default', 'woo-multi-currency' ) ?></th> <th class="one wide"><?php esc_html_e( 'Hidden', 'woo-multi-currency' ) ?></th> <th class="two wide"><?php esc_html_e( 'Currency', 'woo-multi-currency' ) ?></th> <th class="two wide"><?php esc_html_e( 'Position', 'woo-multi-currency' ) ?></th> <th class="four wide" colspan="2"><?php esc_html_e( 'Rate + Exchange Fee', 'woo-multi-currency' ) ?></th> <th class="two wide"><?php esc_html_e( 'Number of Decimals', 'woo-multi-currency' ) ?></th> <th class="two wide"><?php esc_html_e( 'Custom symbol', 'woo-multi-currency' ) ?></th> <th class="one wide"><?php esc_html_e( 'Action', 'woo-multi-currency' ) ?></th> </tr> </thead> <tbody> <?php $currencies = self::get_field( 'currency', array( get_option( 'woocommerce_currency' ) ) ); $currency_pos = self::get_field( 'currency_pos', array( get_option( 'woocommerce_currency_pos' ) ) ); $currency_rate = self::get_field( 'currency_rate', array( 1 ) ); $currency_rate_fee = self::get_field( 'currency_rate_fee', array( 0.0000 ) ); $currency_decimals = self::get_field( 'currency_decimals', array( get_option( 'woocommerce_price_num_decimals' ) ) ); $currency_custom = self::get_field( 'currency_custom', array() ); $currency_hidden = self::get_field( 'currency_hidden', array() ); if ( is_array( $currencies ) ) { if ( count( array_filter( $currencies ) ) < 1 ) { $currencies = array(); $currency_pos = array(); $currency_rate = array(); $currency_rate_fee = array(); $currency_decimals = array(); $currency_custom = array(); } } else { $currencies = array(); $currency_pos = array(); $currency_rate = array(); $currency_rate_fee = array(); $currency_decimals = array(); $currency_custom = array(); } $wc_currencies = get_woocommerce_currencies(); foreach ( $currencies as $key => $currency ) { if ( $key > 1 ) { break; } if ( self::get_field( 'currency_default', get_option( 'woocommerce_currency' ) ) == $currency ) { $disabled = 'readonly'; } else { $disabled = ''; } ?> <tr class="wmc-currency-data <?php echo esc_attr( $currency . '-currency' ) ?>"> <td class="collapsing"> <div class="vi-ui toggle checkbox"> <input type="radio" <?php checked( self::get_field( 'currency_default', get_option( 'woocommerce_currency' ) ), $currency ) ?> tabindex="0" class="hidden" value="<?php echo esc_attr( $currency ) ?>" name="<?php echo esc_attr( self::set_field( 'currency_default' ) ) ?>"/> <label></label> </div> </td> <td class="collapsing" title="<?php esc_attr_e( 'Hidden currencies on widget, shortcode and sidebar', 'woo-multi-currency' ) ?>" data-tooltip="<?php esc_attr_e( 'Hidden currencies on widget, shortcode and sidebar', 'woo-multi-currency' ) ?>"> <select name="<?php echo esc_attr( self::set_field( 'currency_hidden', 1 ) ) ?>"> <option <?php selected( self::data_isset( $currency_hidden, $key, 0 ), 0 ) ?> value="0"><?php esc_html_e( 'No', 'woo-multi-currency' ) ?></option> <option <?php selected( self::data_isset( $currency_hidden, $key ), 1 ) ?> value="1"><?php esc_html_e( 'Yes', 'woo-multi-currency' ) ?></option> </select> </td> <td> <select name="<?php echo esc_attr( self::set_field( 'currency', 1 ) ) ?>" class="vi-ui select2"> <?php foreach ( $wc_currencies as $k => $wc_currency ) { ?> <option <?php selected( $currency, $k ) ?> value="<?php echo esc_attr( $k ) ?>"><?php echo esc_attr( $k ) . '-' . esc_html( $wc_currency ) . ' (' . esc_html( get_woocommerce_currency_symbol( $k ) ) . ')' ?></option> <?php } ?> </select> <td> <select name="<?php echo esc_attr( self::set_field( 'currency_pos', 1 ) ) ?>"> <option <?php selected( self::data_isset( $currency_pos, $key ), 'left' ) ?> value="left"><?php esc_html_e( 'Left $99', 'woo-multi-currency' ) ?></option> <option <?php selected( self::data_isset( $currency_pos, $key ), 'right' ) ?> value="right"><?php esc_html_e( 'Right 99$', 'woo-multi-currency' ) ?></option> <option <?php selected( self::data_isset( $currency_pos, $key ), 'left_space' ) ?> value="left_space"><?php esc_html_e( 'Left with space $ 99', 'woo-multi-currency' ) ?></option> <option <?php selected( self::data_isset( $currency_pos, $key ), 'right_space' ) ?> value="right_space"><?php esc_html_e( 'Right with space 99 $', 'woo-multi-currency' ) ?></option> </select> </td> <td> <input <?php echo esc_attr( $disabled ) ?> type="text" name="<?php echo esc_attr( self::set_field( 'currency_rate', 1 ) ) ?>" value="<?php echo esc_attr( self::data_isset( $currency_rate, $key, '1' ) ) ?>"/> </td> <td> <div class="vi-ui left icon input" data-tooltip="<?php esc_attr_e( 'It is fixed rate. Eg: (Original rate)1.62 + 0.1(Exchange fee rate) = 1.72(End rate)', 'woo-multi-currency' ) ?>"> <i class="vi-ui icon plus"></i> <input <?php echo esc_attr( $disabled ) ?> type="number" name="<?php echo esc_attr( self::set_field( 'currency_rate_fee', 1 ) ) ?>" value="<?php echo esc_attr( self::data_isset( $currency_rate_fee, $key, '0.0000' ) ) ?>" step="any"/> </div> </td> <td> <input type="text" name="<?php echo esc_attr( self::set_field( 'currency_decimals', 1 ) ) ?>" value="<?php echo esc_attr( self::data_isset( $currency_decimals, $key, '2' ) ) ?>"/> </td> <td> <input type="text" placeholder="eg: CAD $" name="<?php echo esc_attr( self::set_field( 'currency_custom', 1 ) ) ?>" value="<?php echo esc_attr( self::data_isset( $currency_custom, $key ) ) ?>"/> </td> <td> <div class="vi-ui buttons"> <div class="wmc-update-rate-wrap" title="<?php esc_attr_e( 'Update Rate', 'woo-multi-currency' ) ?>" data-tooltip="<?php esc_attr_e( 'Update Rate', 'woo-multi-currency' ) ?>"> <i class="cloud download icon"></i> <div class="vi-ui small icon button wmc-update-rate"> <i class="cloud download icon"></i> </div> </div> <div class="vi-ui small icon red button wmc-remove-currency" title="<?php esc_attr_e( 'Remove', 'woo-multi-currency' ) ?>" data-tooltip="<?php esc_attr_e( 'Remove', 'woo-multi-currency' ) ?>"> <i class="trash icon"></i> </div> </div> </td> </tr> <?php } ?> </tbody> <tfoot class="full-width"> <tr> <th colspan="9"> <div class="vi-ui right floated green labeled icon button wmc-add-currency"> <i class="money icon"></i> <?php esc_html_e( 'Add Currency', 'woo-multi-currency' ) ?> </div> <div class="vi-ui right floated labeled icon button wmc-update-rates"> <i class="in cart icon"></i> <?php esc_html_e( 'Update All Rates', 'woo-multi-currency' ) ?> </div> </th> </tr> </tfoot> </table> <p> <?php esc_html_e( 'You can add only 2 currencies. Please update Pro version to add unlimited currencies.', 'woo-multi-currency' ) ?> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> </p> <p class="vi-ui message yellow"><?php esc_html_e( 'Custom symbol: You can set custom symbol for each currency in your list and how to it will be displayed (used when you have many currency have same symbol). Leave it empty to used default symbol. Example: if you set US$ for US dolar, system will display US$100 instead of $100 like default. Or you can use with pramater #PRICE# to display price in special format, example: if you set US #PRICE# $, system will display: US 100 $.', 'woo-multi-currency' ) ?></p> </td> </tr> </tbody> </table> </div> <!-- Location !--> <div class="vi-ui bottom attached tab segment" data-tab="location"> <!-- Tab Content !--> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'auto_detect' ) ) ?>"> <?php esc_html_e( 'Auto Detect', 'woo-multi-currency' ) ?> </label> </th> <td> <select name="<?php echo esc_attr( self::set_field( 'auto_detect' ) ) ?>"> <option <?php selected( self::get_field( 'auto_detect' ), 0 ) ?> value="0"><?php esc_html_e( 'No', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'auto_detect' ), 1 ) ?> value="1"><?php esc_html_e( 'Auto select currency', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'auto_detect' ), 2 ) ?> value="2"><?php esc_html_e( 'Approximate Price', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'auto_detect' ), 3 ) ?> value="3"><?php esc_html_e( 'Language Polylang', 'woo-multi-currency' ) ?></option> <option disabled><?php esc_html_e( 'TranslatePress Multilingual (Premium)', 'woo-multi-currency' ) ?></option> </select> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Switch when user login', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Switch currency by user address when user login', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'geo_api' ) ) ?>"> <?php esc_html_e( 'Geo API', 'woo-multi-currency' ) ?> </label> </th> <td> <select name="<?php echo esc_attr( self::set_field( 'geo_api' ) ) ?>"> <option <?php selected( self::get_field( 'geo_api' ), 0 ) ?> value="0"><?php esc_html_e( 'WooCommerce', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'geo_api' ), 1 ) ?> value="1"><?php esc_html_e( 'External', 'woo-multi-currency' ) ?></option> <option disabled><?php esc_html_e( 'Inherited from server (Premium)', 'woo-multi-currency' ) ?></option> <option disabled><?php esc_html_e( 'MaxMind Geolocation (Premium)', 'woo-multi-currency' ) ?></option> </select> <p class="description"><?php esc_html_e( 'API will help detect customer country code base on IP address.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_currency_by_country' ) ) ?>"> <?php esc_html_e( 'Currency by Country', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable_currency_by_country' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable_currency_by_country' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable_currency_by_country' ) ) ?>"/> <label></label> </div> <p class="description"><?php esc_html_e( 'Only working with AUTO SELECT CURRENCY feature. Currency will be selected base on country.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <td colspan="2"> <table class="vi-ui table"> <thead> <tr> <th class="two wide"><?php esc_html_e( 'Currency', 'woo-multi-currency' ) ?></th> <th><?php esc_html_e( 'Countries', 'woo-multi-currency' ) ?></th> <th class="four wide"><?php esc_html_e( 'Actions', 'woo-multi-currency' ) ?></th> </tr> </thead> <tbody> <?php foreach ( $currencies as $key => $currency ) { $wc_countries = $countries = WC()->countries->countries; ?> <tr> <td><?php echo esc_html( '(' . get_woocommerce_currency_symbol( $currency ) . ') ' . $currency ) ?></td> <td> <select multiple="multiple" name="<?php echo esc_attr( self::set_field( $currency . '_by_country', 1 ) ) ?>" class="vi-ui select2-multiple" data-placeholder="<?php esc_attr_e( 'Please select countries', 'woo-multi-currency' ) ?>"> <?php $countries_assign = self::get_field( $currency . '_by_country', array() ); foreach ( $wc_countries as $k => $wc_country ) { $selected = ''; if ( is_array( $countries_assign ) && in_array( $k, $countries_assign ) ) { $selected = 'selected="selected"'; } ?> <option <?php echo esc_attr( $selected ) ?> value="<?php echo esc_attr( $k ) ?>"><?php echo esc_html( $wc_country ) ?></option> <?php } ?> </select> </td> <td> <div class="vi-ui small button wmc-select-all-countries"> <?php esc_html_e( 'Select all', 'woo-multi-currency' ) ?> </div> <div class="vi-ui small red button wmc-remove-all-countries"> <?php esc_html_e( 'Remove All', 'woo-multi-currency' ) ?> </div> </td> </tr> <?php } ?> </tbody> </table> </td> </tr> </tbody> </table> <!-- Polylang--> <?php if ( class_exists( 'Polylang' ) ) { ?> <h3> <?php esc_html_e( 'Polylang', 'woo-multi-currency' ) ?> </h3> <table class="optiontable form-table"> <tr> <th> <label> <?php esc_html_e( 'Language switcher', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> </td> </tr> </table> <?php } ?> <!-- WPML.org--> <?php if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) { ?> <h3> <?php esc_html_e( 'WPML.org', 'woo-multi-currency' ) ?> </h3> <table class="optiontable form-table"> <tr> <th> <?php esc_html_e( 'Enable', 'woo-multi-currency' ) ?> </th> <td> <div class="vi-ui toggle checkbox"> <!-- <input id="--> <?php //echo esc_attr( self::set_field( 'enable_wpml' ) ) ?><!--"--> <!-- type="checkbox" --><?php //checked( self::get_field( 'enable_wpml' ), 1 ) ?> <!-- tabindex="0" class="hidden" value="1"--> <!-- name="--> <?php //echo esc_attr( self::set_field( 'enable_wpml' ) ) ?><!--"/>--> <!-- <label></label>--> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> </div> <p class="description"><?php esc_html_e( 'All product fields of Multi Currency for WooCommerce will be copied. When you switch language, Currency will change. ', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Language switcher', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> </td> </tr> </table> <?php } ?> </div> <!-- Design !--> <div class="vi-ui bottom attached tab segment" data-tab="design"> <!-- Tab Content !--> <h3><?php esc_html_e( 'Currencies Bar', 'woo-multi-currency' ) ?></h3> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_design' ) ) ?>"> <?php esc_html_e( 'Enable', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable_design' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable_design' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable_design' ) ) ?>"/> <label></label> </div> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'is_checkout' ) ) ?>"> <?php esc_html_e( 'Checkout page', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'is_checkout' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'is_checkout' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'is_checkout' ) ) ?>"/> <label></label> </div> <p class=""><?php esc_html_e( 'Enable to hide Currencies Bar on Checkout page.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'is_cart' ) ) ?>"> <?php esc_html_e( 'Cart page', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'is_cart' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'is_cart' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'is_cart' ) ) ?>"/> <label></label> </div> <p class=""><?php esc_html_e( 'Enable to hide Currencies Bar on Cart page.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'conditional_tags' ) ) ?>"> <?php esc_html_e( 'Conditional Tags', 'woo-multi-currency' ) ?> </label> </th> <td> <input placeholder="<?php esc_html_e( 'eg: !is_page(array(34,98,73))', 'woo-multi-currency' ) ?>" type="text" value="<?php echo esc_attr( htmlentities( self::get_field( 'conditional_tags' ) ) ) ?>" name="<?php echo esc_attr( self::set_field( 'conditional_tags' ) ) ?>"/> <p class="description"> <?php esc_html_e( 'Adjust which pages will appear using WP\'s conditional tags.', 'woo-multi-currency' ) ?> <br/> Ex: is_home(), is_shop(), is_product(), is_cart(), is_checkout(),... <a href="https://codex.wordpress.org/Conditional_Tags" target="_blank"> <?php esc_html_e( 'more', 'woo-multi-currency' ); ?> </a> </p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Title', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" name="<?php echo esc_attr( self::set_field( 'design_title' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'design_title' ) ) ?>"/> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'position' ) ) ?>"> <?php esc_html_e( 'Position', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui form"> <div class="fields"> <div class="four wide field"> <img src="<?php echo esc_url( WOOMULTI_CURRENCY_F_IMAGES . 'position_1.jpg' ) ?>" class="vi-ui centered medium image middle aligned "/> <div class="vi-ui toggle checkbox center aligned segment"> <input id="<?php echo esc_attr( self::set_field( 'design_position' ) ) ?>" type="radio" <?php checked( self::get_field( 'design_position', 0 ), 0 ) ?> tabindex="0" class="hidden" value="0" name="<?php echo esc_attr( self::set_field( 'design_position' ) ) ?>"/> <label><?php esc_attr_e( 'Left', 'woo-multi-currency' ) ?></label> </div> </div> <div class="two wide field"> </div> <div class="four wide field"> <img src="<?php echo esc_url( WOOMULTI_CURRENCY_F_IMAGES . 'position_2.jpg' ) ?>" class="vi-ui centered medium image middle aligned "/> <div class="vi-ui toggle checkbox center aligned segment"> <input id="<?php echo esc_attr( self::set_field( 'design_position' ) ) ?>" type="radio" <?php checked( self::get_field( 'design_position' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'design_position' ) ) ?>"/> <label><?php esc_attr_e( 'Right', 'woo-multi-currency' ) ?></label> </div> </div> </div> </div> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_collapse' ) ) ?>"> <?php esc_html_e( 'Desktop', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable_collapse' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable_collapse' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable_collapse' ) ) ?>"/> <label><?php esc_html_e( 'Enable Collapse', 'woo-multi-currency' ) ?></label> </div> <p class="description"><?php esc_html_e( 'Sidebar will collapse if you have many currencies.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_click_to_expand_currency_bar' ) ) ?>"> <?php esc_html_e( 'Click to expand currencies bar', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'By default, currencies bar will expand on hovering. Enable this option if you want them to only expand when clicking on.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Top position', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Fixed currency in schema structure data.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Text color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'text_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'text_color', '#fff' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'text_color', '#fff' ) ) ?>"/> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Sidebar layout', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Fixed currency in schema structure data.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Style', 'woo-multi-currency' ) ?></label> </th> <td> <select name="<?php echo esc_attr( self::set_field( 'sidebar_style' ) ) ?>"> <option <?php selected( self::get_field( 'sidebar_style' ), 0 ) ?> value="0"><?php esc_html_e( 'Default', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'sidebar_style' ), 1 ) ?> value="1"><?php esc_html_e( 'Symbol', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'sidebar_style' ), 2 ) ?> value="2"><?php esc_html_e( 'Flag', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'sidebar_style' ), 3 ) ?> value="3"><?php esc_html_e( 'Flag + Currency code', 'woo-multi-currency' ) ?></option> <option <?php selected( self::get_field( 'sidebar_style' ), 4 ) ?> value="4"><?php esc_html_e( 'Flag + Currency symbol', 'woo-multi-currency' ) ?></option> </select> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Main color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'main_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'main_color', '#f78080' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'main_color', '#f78080' ) ) ?>"/> </td> </tr> <tr> <th> <label> <?php esc_html_e( 'Hover color', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Fixed currency in schema structure data.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Background color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'background_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'background_color', '#212121' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'background_color', '#212121' ) ) ?>"/> </td> </tr> </tbody> </table> <h3><?php esc_html_e( 'Product currency selector', 'woo-multi-currency' ) ?></h3> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'price_switcher' ) ) ?>"> <?php esc_html_e( 'Currency Price Switcher', 'woo-multi-currency' ) ?> </label> </th> <td> <?php $price_switcher = self::get_field( 'price_switcher', 0 ) ?> <select name="<?php echo esc_attr( self::set_field( 'price_switcher' ) ) ?>"> <option <?php selected( $price_switcher, 0 ) ?> value="0"><?php esc_html_e( 'Not Show', 'woo-multi-currency' ) ?></option> <option <?php selected( $price_switcher, 1 ) ?> value="1"><?php esc_html_e( 'Flag', 'woo-multi-currency' ) ?></option> <option <?php selected( $price_switcher, 2 ) ?> value="2"><?php esc_html_e( 'Flag + Currency Code', 'woo-multi-currency' ) ?></option> <option <?php selected( $price_switcher, 3 ) ?> value="3"><?php esc_html_e( 'Flag + Price', 'woo-multi-currency' ) ?></option> </select> <p class="description"><?php esc_html_e( 'Display a currency switcher under product price in single product pages.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'price_switcher_position' ) ) ?>"> <?php esc_html_e( 'Switcher Position', 'woo-multi-currency' ) ?> </label> </th> <td> <?php $price_switcher_position = self::get_field( 'price_switcher_position', 20 ) ?> <select name="<?php echo esc_attr( self::set_field( 'price_switcher_position' ) ) ?>" class="vi-ui dropdown fluid"> <option <?php selected( $price_switcher_position, 5 ) ?> value="5"><?php esc_html_e( 'Below title', 'woo-multi-currency' ) ?></option> <option <?php selected( $price_switcher_position, 10 ) ?> value="10"><?php esc_html_e( 'Below price', 'woo-multi-currency' ) ?></option> <option <?php selected( $price_switcher_position, 20 ) ?> value="20"><?php esc_html_e( 'Below excerpt', 'woo-multi-currency' ) ?></option> </select> <p class="description"><?php esc_html_e( 'Position of currency switcher in single product pages, it may be affected by the theme or product template', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_click_to_expand_currency_selector' ) ) ?>"> <?php esc_html_e( 'Click to expand currency selector', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'By default, dropdown currency selector will expand on hovering. Enable this option if you want them to only expand when clicking on.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <h3> <?php esc_html_e( 'Currency price collate', 'woo-multi-currency' ) ?> </h3> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Display product price collated with other currency and display settings (layout, title, position).', 'woo-multi-currency' ) ?></p> </td> </tr> </tbody> </table> <h3><?php esc_html_e( 'Widget', 'woo-multi-currency' ) ?></h3> <table class="optiontable form-table"> <tbody> <tr> <th> <label><?php esc_html_e( 'Flag Custom', 'woo-multi-currency' ) ?></label> </th> <td> <textarea placeholder="Example:
EUR,ES
USD,VN" name="<?php echo esc_attr( self::set_field( 'flag_custom' ) ) ?>"><?php echo esc_attr( self::get_field( 'flag_custom', '' ) ) ?></textarea> <p class="description"><?php esc_html_e( 'Some countries use the same currency. You can choice flag correctly. Each line is the flag. Structure [currency_code,country_code]. Example: EUR,ES', 'woo-multi-currency' ) ?></p> </td> </tr> </tbody> </table> <h3><?php esc_html_e( 'Shortcode', 'woo-multi-currency' ) ?></h3> <table class="optiontable form-table"> <tbody> <tr> <th> <label><?php esc_html_e( 'Text color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'shortcode_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'shortcode_color', '#212121' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'shortcode_color', '#474747' ) ) ?>"/> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Background color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'shortcode_bg_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'shortcode_bg_color', '#fff' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'shortcode_bg_color', '#fff' ) ) ?>"/> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Active currency text color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'shortcode_active_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'shortcode_active_color', '#212121' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'shortcode_active_color', '#212121' ) ) ?>"/> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Active currency background color', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" class="color-picker" name="<?php echo esc_attr( self::set_field( 'shortcode_active_bg_color' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'shortcode_active_bg_color', '#fff' ) ) ?>" style="background-color: <?php echo esc_attr( self::get_field( 'shortcode_active_bg_color', '#fff' ) ) ?>"/> </td> </tr> </tbody> </table> <h3><?php esc_html_e( 'Custom', 'woo-multi-currency' ) ?></h3> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'rel_nofollow' ) ) ?>"> <?php esc_html_e( 'Use rel="nofollow"', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'rel_nofollow' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'rel_nofollow' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'rel_nofollow' ) ) ?>"/> </div> <p class="description"><?php esc_html_e( 'Enable this if you want rel="nofollow" to be added to currency switcher buttons', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'CSS', 'woo-multi-currency' ) ?></label> </th> <td> <textarea placeholder=".woo-multi-currency{}" name="<?php echo esc_attr( self::set_field( 'custom_css' ) ) ?>" ><?php echo esc_attr( self::get_field( 'custom_css', '' ) ) ?></textarea> </td> </tr> </tbody> </table> </div> <!-- Checkout !--> <div class="vi-ui bottom attached tab segment" data-tab="checkout"> <!-- Tab Content !--> <table class="optiontable form-table"> <tbody> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_multi_payment' ) ) ?>"> <?php esc_html_e( 'Enable', 'woo-multi-currency' ) ?> </label> </th> <td> <div class="vi-ui toggle checkbox"> <input id="<?php echo esc_attr( self::set_field( 'enable_multi_payment' ) ) ?>" type="checkbox" <?php checked( self::get_field( 'enable_multi_payment' ), 1 ) ?> tabindex="0" class="hidden" value="1" name="<?php echo esc_attr( self::set_field( 'enable_multi_payment' ) ) ?>"/> </div> <p class="description"><?php esc_html_e( 'Pay in many currencies', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_cart_page' ) ) ?>"> <?php esc_html_e( 'Enable Cart Page', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"> <?php esc_html_e( 'Change the currency in cart page to a check out currency.', 'woo-multi-currency' ) ?> </p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'checkout_currency' ) ) ?>"> <?php esc_html_e( 'Checkout currency', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="vi-ui message yellow"><?php esc_html_e( 'Payment method depend on Payment Gateway. If Payment Gateway is not support currency, customer can not checkout with currency. Example: Paypal is not support IDR, Customer can not checkout IDR by Paypal.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_currency_by_payment_method' ) ) ?>"> <?php esc_html_e( 'Currency by Payment method', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( "Enable this option to change the currency immediately at the checkout order detail when the customer selects a payment gateway, instead of after clicking the 'place order' button.", 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_currency_by_payment_method' ) ) ?>"> <?php esc_html_e( 'Change currency follow', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( "Change currency when customer change billing or shipping address.", 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_currency_by_payment_method' ) ) ?>"> <?php esc_html_e( 'Display multi currencies', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( "Display currencies both in the store pages and checkout page if they are different at the checkout page. This option and Fixed price option don't work together.", 'woo-multi-currency' ) ?></p> </td> </tr> </tbody> </table> </div> <!-- Update !--> <div class="vi-ui bottom attached tab segment" data-tab="price"> <table class="optiontable form-table"> <tbody> <tr> <th> <label><?php esc_html_e( 'Enable', 'woo-multi-currency' ) ?></label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php echo esc_html__( 'This option only works when input price same as output price (both include tax or exclude tax)', 'woo-multi-currency' ) ?></p> </td> </tr> </tbody> </table> </div> <div class="vi-ui bottom attached tab segment" data-tab="update"> <!-- Tab Content !--> <table class="optiontable form-table"> <tbody> <tr> <th> <label><?php esc_html_e( 'Auto Update Exchange Rate', 'woo-multi-currency' ) ?></label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php echo esc_html__( 'Exchange will be updated automatically.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Finance API', 'woo-multi-currency' ) ?></label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php echo esc_html__( 'Exchange rate resources.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Rate Decimals', 'woo-multi-currency' ) ?></label> </th> <td> <input type="text" name="<?php echo esc_attr( self::set_field( 'rate_decimals' ) ) ?>" value="<?php echo esc_attr( self::get_field( 'rate_decimals', 5 ) ) ?>"/> </td> </tr> <tr> <th> <label for="<?php echo esc_attr( self::set_field( 'enable_send_email' ) ) ?>"> <?php esc_html_e( 'Send Email', 'woo-multi-currency' ) ?> </label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php esc_html_e( 'Send email to admin when exchange rate is updated.', 'woo-multi-currency' ) ?></p> </td> </tr> <tr> <th> <label><?php esc_html_e( 'Custom Email', 'woo-multi-currency' ) ?></label> </th> <td> <a class="vi-ui button yellow" href="https://1.envato.market/jABDP" target="_blank"><?php echo esc_html__( 'Unlock This Feature', 'woo-multi-currency' ) ?></a> <p class="description"><?php echo esc_html__( 'If empty, notification will sent to ', 'woo-multi-currency' ) . esc_html( get_option( 'admin_email' ) ) ?></p> </td> </tr> </tbody> </table> </div> <p class="wmc-save-settings-container"> <button class="vi-ui button labeled icon primary wmc-submit"> <i class="send icon"></i> <?php esc_html_e( 'Save', 'woo-multi-currency' ) ?> </button> </p> </form> </div> <?php do_action( 'villatheme_support_woo-multi-currency' ); } }PK hU,]��] ] $ meta-boxes/ovaev-metaboxes-event.phpnu ��� <?php if( !defined( 'ABSPATH' ) ) exit(); if( !class_exists( 'OVAEV_metaboxes_render_event' ) ){ class OVAEV_metaboxes_render_event{ public static function render(){ require_once( OVAEV_PLUGIN_PATH. '/admin/views/ovaev-metabox-event.php' ); } public static function save($post_id, $post_data){ if( empty($post_data) ) exit(); // Checked Special if( array_key_exists('ovaev_special', $post_data) == false ){ $post_data['ovaev_special'] = ''; }else{ $post_data['ovaev_special'] = 'checked'; } // Check gallery exits if ( !isset( $post_data['ovaev_gallery_id'] ) || empty( $post_data['ovaev_gallery_id'] ) ){ $post_data['ovaev_gallery_id'] = ''; } if ( isset( $post_data['ovaev_start_date'] ) && !empty( $post_data['ovaev_start_date'] ) ){ $post_data['ovaev_start_date_time'] = strtotime( $post_data['ovaev_start_date'] . ' ' . $post_data['ovaev_start_time'] ); } else { $post_data['ovaev_start_date_time'] = ''; } if ( isset( $post_data['ovaev_end_date'] ) && !empty( $post_data['ovaev_end_date'] ) ){ $post_data['ovaev_end_date_time'] = strtotime( $post_data['ovaev_end_date'] . ' ' . $post_data['ovaev_end_time'] ); } else { $post_data['ovaev_end_date_time'] = ''; } foreach ($post_data as $key => $value) { update_post_meta( $post_id, $key, $value ); } } } } ?>PK hU,]�"ol� � ovaev-widget.phpnu ��� <?php if ( !defined( 'ABSPATH' ) ) { exit; } require_once( OVAEV_PLUGIN_PATH. '/admin/widget/class-ovaev-category-widget.php' ); require_once( OVAEV_PLUGIN_PATH. '/admin/widget/class-ovaev-tag-widget.php' ); require_once( OVAEV_PLUGIN_PATH. '/admin/widget/class-ovaev-list-event-widget.php' ); require_once( OVAEV_PLUGIN_PATH. '/admin/widget/class-ovaev-event-feature-widget.php' );PK hU,]I�:�# # ! widget/class-ovaev-tag-widget.phpnu ��� <?php // Creating the widget class ova_tag_event_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'widget_tag_cloud', 'description' => esc_html__( 'Get list tag event', 'ovaev' ), 'customize_selective_refresh' => true, ); parent::__construct( 'event_tag', esc_html__( 'Tag Event' ), $widget_ops ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $title = ! empty( $title ) ? $title : esc_html__( 'Tags', 'ovaev' ); echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $args_tag = array( 'taxonomy' => 'event_tag', 'orderby' => 'name', ); $categories = get_categories($args_tag); echo ovaev_get_template( 'widgets/tag_widget.php', array( 'categories' => $categories ) ); echo $args['after_widget']; } public function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'title' => '' ) ); $hierarchical = isset( $instance['hierarchical'] ) ? (bool) $instance['hierarchical'] : false; ?> <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p> <?php } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); return $instance; } } function ovaev_tag_load_widget() { register_widget( 'ova_tag_event_widget' ); } add_action( 'widgets_init', 'ovaev_tag_load_widget' );PK hU,]"�]D� � ( widget/class-ovaev-list-event-widget.phpnu ��� <?php // Creating the widget class ova_list_event_widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' => 'widget_list_event', 'description' => esc_html__( 'Get list upcomming event', 'ovaev' ), 'customize_selective_refresh' => true, ); parent::__construct( 'event_upcomming', esc_html__( 'Upcomming Event' ), $widget_ops ); } public function widget( $args, $instance ) { $title = apply_filters( 'widget_title', $instance['title'] ); $title = ! empty( $title ) ? $title : esc_html__( 'Upcoming Events', 'ovaev' ); $count = isset( $instance['count'] ) ? $instance['count'] : 5; $hierarchical = ! empty( $instance['hierarchical'] ) ? '1' : '0'; echo $args['before_widget']; if ( $title ) { echo $args['before_title'] . $title . $args['after_title']; } $args_event_basic = array( 'post_type' => 'event', 'posts_per_page' => $count, 'orderby' => 'meta_value', 'meta_key' => 'ovaev_start_date_time', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'ovaev_start_date_time', 'value' => current_time( 'timestamp' ), 'compare' => '>' ) ) ); // Query with Category (Type) $args_event_tax = array(); $selected_categories = $instance['wcw_selected_categories'] ? $instance['wcw_selected_categories'] : ''; $wcw_action_on_cat = $instance['wcw_action_on_cat'] ? $instance['wcw_action_on_cat'] : ''; if( $wcw_action_on_cat == 'include' ){ $args_event_tax = array( 'tax_query' => array( array( 'taxonomy' => 'event_category', 'field' => 'term_id', 'terms' => $selected_categories, 'operator' => 'IN', ), ) ); }else if( $wcw_action_on_cat == 'exclude' ){ $args_event_tax = array( 'tax_query' => array( array( 'taxonomy' => 'event_category', 'field' => 'term_id', 'terms' => $selected_categories, 'operator' => 'NOT IN', ), ) ); } $args_event = array_merge( $args_event_basic, $args_event_tax ); $list_events = get_posts( $args_event ); echo ovaev_get_template( 'widgets/list_event.php', array( 'list_events' => $list_events ) ); echo $args['after_widget']; } public function form( $instance ) { // Defaults. $instance = wp_parse_args( (array) $instance, array( 'title' => 'Upcomming Event','count'=>'5' ) ); $wcw_selected_categories = (! empty( $instance['wcw_selected_categories'] ) && ! empty( $instance['wcw_action_on_cat'] ) ) ? $instance['wcw_selected_categories'] : esc_html__( '', 'ovaev' ); $wcw_action_on_cat = ! empty( $instance['wcw_action_on_cat'] ) ? $instance['wcw_action_on_cat'] : esc_html__( '', 'ovaev' ); ?> <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" /></p> <p> <label> <?php esc_html_e( 'Count:', 'ovaev' ); ?> </label> <input class="widefat" id="<?php echo $this->get_field_id( 'count' ); ?>" name="<?php echo $this->get_field_name( 'count' ); ?>" type="text" value="<?php echo esc_attr( $instance['count'] ); ?>" /> </p> <div class="wcwmultiselect"> <select class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'wcw_action_on_cat' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'wcw_action_on_cat' ) ); ?>"> <option value="" <?php selected($wcw_action_on_cat,'' )?> >Show All Category:</option> <option value="include" <?php selected($wcw_action_on_cat,'include' )?> >Include Selected Category:</option> <option value="exclude" <?php selected($wcw_action_on_cat,'exclude' )?> >Exclude Selected Category:</option> </select> <div class="wcwcheckboxes" id="wcwcb-<?php echo esc_attr( $this->get_field_id( 'wcw_action_on_cat' ) ); ?>"> <?php $i=0; $terms = get_terms( array( 'taxonomy' => 'event_category', ) ); if ( $terms ) { foreach ( $terms as $term ) { echo '<label for="'.esc_attr( $this->get_field_id( 'wcw_action_on_cat' ) ).'-'.$i.'"><input type="checkbox" id="'.esc_attr( $this->get_field_id( 'wcw_action_on_cat' ) ).'-'.$i.'" '.checked(true, ($wcw_selected_categories!='' ? in_array($term->term_id,$wcw_selected_categories) : ($wcw_selected_categories=='' ? true : '')), false).' name="'.esc_attr( $this->get_field_name( 'wcw_selected_categories' ) ).'[]" value="'.$term->term_id.'"/>'.$term->name.'</label></br>'; $i++; } } ?> </div> </div> <?php } public function update( $new_instance, $old_instance ) { $instance = $old_instance; $instance['title'] = sanitize_text_field( $new_instance['title'] ); $instance['count'] = sanitize_text_field( $new_instance['count'] ); $instance['wcw_selected_categories'] = ( ! empty( $new_instance['wcw_selected_categories'] ) ) ? $new_instance['wcw_selected_categories'] : ''; $instance['wcw_action_on_cat'] = ( ! empty( $new_instance['wcw_action_on_cat'] ) ) ? $new_instance['wcw_action_on_cat'] : ''; return $instance; } } function ovaev_list_event_load_widget() { register_widget( 'ova_list_event_widget' ); } add_action( 'widgets_init', 'ovaev_list_event_load_widget' );PK hU,]��e= = &