-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
40a9a72
commit b3eaac5
Showing
2 changed files
with
53 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,58 @@ | ||
<?php | ||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
exit; | ||
} | ||
|
||
if ( ! class_exists( 'Kekspay_Order_Admin' ) ) { | ||
/** | ||
* Kekspay_Order_Admin class | ||
* | ||
* @since 0.1 | ||
*/ | ||
class Kekspay_Order_Admin { | ||
|
||
/** | ||
* Class constructor. | ||
*/ | ||
public function __construct() { | ||
add_action( 'admin_notices', array( $this, 'display_test_order_notice' ), 100 ); | ||
} | ||
|
||
/** | ||
* Display WordPress warning notice if current order (admin view) is processed in sandbox/test mode. | ||
* | ||
* @return void | ||
*/ | ||
public function display_test_order_notice() { | ||
if ( ! is_admin() ) { | ||
return; | ||
} | ||
|
||
$screen = get_current_screen(); | ||
if ( 'post' === $screen->base && 'shop_order' === $screen->id ) { | ||
$order = wc_get_order( get_the_ID() ); | ||
if ( ! is_a( $order, 'WC_Order' ) ) { | ||
return; | ||
} | ||
|
||
if ( Kekspay_Data::order_test_mode( $order ) ) { | ||
$class = 'notice notice-warning'; | ||
$message = __( 'Narudžba kreirana koristeći KEKS Pay u testnom načinu rada.', 'kekspay' ); | ||
|
||
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); | ||
} | ||
|
||
if ( 'HRK' === $order->get_currency() ) { | ||
$class = 'notice notice-warning'; | ||
$message = __( 'KEKS Pay - Narudžba naplaćena u valuti HRK koja više nije podržana od strane KEKS Pay sustava. Ako želite napraviti povrat novca kroz KEKS Pay sustav, iznos za povrat prije povrata preračunati će se u EUR prema tečaju 7.5345 te biti vraćen u valuti EUR.', 'kekspay' ); | ||
|
||
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
/** | ||
* Kekspay_Order_Admin class | ||
* | ||
* @since 0.1 | ||
*/ | ||
class Kekspay_Order_Admin { | ||
|
||
/** | ||
* Class constructor. | ||
*/ | ||
public function __construct() { | ||
add_action( 'admin_notices', [ $this, 'display_test_order_notice' ], 100 ); | ||
} | ||
|
||
/** | ||
* Display WordPress warning notice if current order (admin view) is processed in sandbox/test mode. | ||
* | ||
* @return void | ||
*/ | ||
public function display_test_order_notice() { | ||
if ( ! is_admin() ) { | ||
return; | ||
} | ||
|
||
$screen = get_current_screen(); | ||
if ( 'post' === $screen->base && 'shop_order' === $screen->id ) { | ||
$order = wc_get_order( get_the_ID() ); | ||
if ( ! is_a( $order, 'WC_Order' ) ) { | ||
return; | ||
} | ||
|
||
if ( Kekspay_Data::order_test_mode( $order ) ) { | ||
$class = 'notice notice-warning'; | ||
$message = __( 'Narudžba kreirana koristeći KEKS Pay u testnom načinu rada.', 'kekspay' ); | ||
|
||
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); | ||
} | ||
|
||
if ( 'HRK' === $order->get_currency() ) { | ||
$class = 'notice notice-warning'; | ||
$message = __( 'KEKS Pay - Narudžba naplaćena u valuti HRK koja više nije podržana od strane KEKS Pay sustava. Ako želite napraviti povrat novca kroz KEKS Pay sustav, iznos za povrat prije povrata preračunati će se u EUR prema tečaju 7.5345 te biti vraćen u valuti EUR.', 'kekspay' ); | ||
|
||
printf( '<div class="%1$s"><p>%2$s</p></div>', esc_attr( $class ), esc_html( $message ) ); | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} | ||
|
||
new Kekspay_Order_Admin(); |