first commit

This commit is contained in:
2024-07-15 11:28:08 +02:00
commit f52d538ea5
21891 changed files with 6161164 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?php
/**
* The code is based on simple product template from WooCommerce.
*
* @package Przelewy24
*/
defined( 'ABSPATH' ) || exit;
if ( ! isset( $post_data ) ) {
throw new LogicException( 'The variable $post_data is not set.' );
}
if ( ! isset( $nonce_action ) ) {
throw new LogicException( 'The variable $nonce_action is not set.' );
}
global $product;
global $userdata;
if ( ! $userdata || ! $product->is_purchasable() ) {
return;
}
echo wc_get_stock_html( $product ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
if ( $product->is_in_stock() ) : ?>
<?php do_action( 'woocommerce_before_add_to_cart_form' ); ?>
<form class="cart" action="<?php echo esc_url( apply_filters( 'woocommerce_add_to_cart_form_action', $product->get_permalink() ) ); ?>" method="post" enctype='multipart/form-data'>
<?php do_action( 'woocommerce_before_add_to_cart_button' ); ?>
<?php
do_action( 'woocommerce_before_add_to_cart_quantity' );
wp_nonce_field( $nonce_action );
woocommerce_quantity_input(
array(
'min_value' => apply_filters( 'woocommerce_quantity_input_min', $product->get_min_purchase_quantity(), $product ),
'max_value' => apply_filters( 'woocommerce_quantity_input_max', $product->get_max_purchase_quantity(), $product ),
'input_value' => isset( $post_data['quantity'] ) ? wc_stock_amount( sanitize_text_field( wp_unslash( $post_data['quantity'] ) ) ) : $product->get_min_purchase_quantity(),
)
);
do_action( 'woocommerce_after_add_to_cart_quantity' );
?>
<button type="submit" name="add-to-cart" value="<?php echo esc_attr( $product->get_id() ); ?>" class="single_add_to_cart_button button alt"><?php echo esc_html( $product->single_add_to_cart_text() ); ?></button>
<?php do_action( 'woocommerce_after_add_to_cart_button' ); ?>
</form>
<?php do_action( 'woocommerce_after_add_to_cart_form' ); ?>
<?php endif; ?>

View File

@@ -0,0 +1,42 @@
<?php
/**
* Template for currency selector widget.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $widget_title ) ) {
throw new LogicException( 'The variable $widget_title is not set.' );
}
if ( ! isset( $currency_options ) ) {
throw new LogicException( 'The variable $currency_options is not set.' );
}
if ( ! isset( $active_currency ) ) {
throw new LogicException( 'The variable $active_currency is not set.' );
}
?>
<form method="post">
<h2 class="widget-title"><?php echo esc_html( $widget_title ); ?></h2>
<div id="p24-change-currency-widget">
<label> <?php echo esc_html( __( 'Waluta' ) ); ?>
<select name="p24_currency">
<?php foreach ( $currency_options as $currency_option ) : ?>
<option value="<?php echo esc_attr( $currency_option ); ?>" <?php echo (string) $currency_option === (string) $active_currency ? 'selected="selected"' : ''; ?>>
<?php echo esc_html( $currency_option ); ?>
</option>
<?php endforeach; ?>
</select>
</label>
<input type="hidden" name="p24_action_type_field" value="change_currency" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_attr( __( 'Zmień' ) ); ?>" />
</div>
</form>
<?php

View File

@@ -0,0 +1,31 @@
<?php
/**
* Template for the bottom of the config page.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $url ) ) {
throw new LogicException( 'The variable $url is not set.' );
}
?>
<tr valign="top" id="p24-btn-additional">
<th scope="row" class="titledesc">
<label>Dodatkowe akcje</label>
</th>
<td class="forminp">
<span
class="button button-secondary js-check-config"
data-url="<?php echo esc_attr( $url ); ?>"
>
<?php echo esc_html( __( 'Sprawdź konfigurację' ) ); ?>
</span>
</td>
</tr>

View File

@@ -0,0 +1,34 @@
<?php
/**
* Template for configuring currency selector widget.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $widget_title ) ) {
throw new LogicException( 'The variable $widget_title is not set.' );
}
if ( ! isset( $title_field_id ) ) {
throw new LogicException( 'The variable $title_field_id is not set.' );
}
if ( ! isset( $title_field_name ) ) {
throw new LogicException( 'The variable $title_field_name is not set.' );
}
?>
<p>
<label for="<?php echo esc_attr( $title_field_id ); ?>">
<?php esc_html( __( 'Tytuł:' ) ); ?>
</label>
<input class="widefat"
id="<?php echo esc_attr( $title_field_id ); ?>"
name="<?php echo esc_attr( $title_field_name ); ?>"
type="text"
value="<?php echo esc_attr( $widget_title ); ?>" />
</p>
<?php

View File

@@ -0,0 +1,58 @@
<?php
/**
* Template for the bottom of the config page.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div id="p24-check-config-descriptions">
<dialog data-error-code="<?php echo esc_html( P24_Config_Checker::ERROR_NONE_ID ); ?>">
<p>
<?php echo esc_html( __( 'Sprawdzenie konfiguracji powiodło się' ) ); ?>
</p>
<form method="dialog">
<button>Ok</button>
</form>
</dialog>
<dialog data-error-code="<?php echo esc_html( P24_Config_Checker::ERROR_X_ID ); ?>">
<p>
<?php echo esc_html( __( 'Test rejestracji transakcji zakończył się błędem - Sprawdź czy dane wpisane w konfiguracji wtyczki są prawidłowe. W przypadku dalszych błędów skontaktuj się z Działem Technicznym na adres email support@przelewy24.pl.' ) ); ?>
</p>
<p>
<?php echo esc_html( __( 'Pamiętaj aby na początku korespondencji podać dane takie jak: ID sprzedawcy, zrzut ekranu konfiguracji.' ) ); ?>
</p>
<form method="dialog">
<button>Ok</button>
</form>
</dialog>
<dialog data-error-code="<?php echo esc_html( P24_Config_Checker::ERROR_AUTH_ID ); ?>">
<p>
<?php echo esc_html( __( 'Test rejestracji transakcji zakończył się błędem - Sprawdź czy dane wpisane w konfiguracji wtyczki są prawidłowe. W przypadku dalszych błędów skontaktuj się z Działem Technicznym na adres email support@przelewy24.pl.' ) ); ?>
</p>
<p>
<?php echo esc_html( __( 'Pamiętaj aby na początku korespondencji podać dane takie jak: ID sprzedawcy, zrzut ekranu konfiguracji.' ) ); ?>
</p>
<form method="dialog">
<button>Ok</button>
</form>
</dialog>
<dialog data-error-code="<?php echo esc_html( P24_Config_Checker::ERROR_REGISTRATION_ID ); ?>">
<p>
<?php echo esc_html( __( 'W celu dokończenia aktywacji konta skontaktuj się z naszym' ) ); ?>
<strong><?php echo esc_html( __( 'Biurem Obsługi Biznesu' ) ); ?></strong>
<?php echo esc_html( __( 'na adres email biznes@przelewy24.pl' ) ); ?>
</p>
<p>
<?php echo esc_html( __( 'Pamiętaj aby na początku korespondencji podać ID sprzedawcy.' ) ); ?>
</p>
<form method="dialog">
<button>Ok</button>
</form>
</dialog>
</div>

View File

@@ -0,0 +1,68 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $field_name ) ) {
throw new LogicException( 'The variable $field_name is not set.' );
}
if ( ! isset( $deleted ) ) {
throw new LogicException( 'The variable $deleted is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Kasowanie ustawień Przelewy24' ) ); ?></h1>
<?php if ( $deleted ) : ?>
<div>
<strong><?php echo esc_html( __( 'Ustawienia zostały skasowane.' ) ); ?></strong>
</div>
<?php else : ?>
<?php $field_id = $field_name . wp_rand(); ?>
<form method="post">
<table>
<tr>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Potwierdź skasowanie ustawień Przelewy24' ) ); ?></label>
</th>
<td>
<input type="checkbox" name="<?php echo esc_attr( $field_name ); ?>" id="<?php echo esc_attr( $field_id ); ?>" value="yes">
</td>
</tr>
<tr>
<td colspan="2">
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Wykonaj' ) ); ?>">
</td>
</tr>
</table>
</form>
<script>
jQuery(function () {
let $ = jQuery;
let $confirm = $('#<?php echo esc_attr( $field_id ); ?>');
let $button = $confirm.parents('form').find('input[type=submit]');
$button.prop('disabled', true);
$confirm.on('change', function () {
let canProcess = $confirm.prop('checked');
$button.prop('disabled', !canProcess);
});
});
</script>
<?php endif; ?>
<?php

View File

@@ -0,0 +1,71 @@
<?php
/**
* Template for currency selector widget.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $currency_options ) ) {
throw new LogicException( 'The variable $currency_options is not set.' );
}
?>
<div id="p24-currency-menu" class="posttypediv">
<div class="tabs-panel tabs-panel-active">
<ul class="categorychecklist form-no-clear">
<?php $i = -1; ?>
<?php foreach ( $currency_options as $currency_option ) : ?>
<?php $name_prefix = "menu-item[$i]"; ?>
<?php $label = __( 'Zmiana waluty na', 'przelewy24' ) . ' ' . $currency_option; ?>
<li>
<label class="menu-item-title">
<input
type="checkbox"
class="menu-item-checkbox"
name="<?php echo esc_attr( $name_prefix ); ?>[menu-item-object-id]"
value="-1">
<?php echo esc_html( $label ); ?>
</label>
<input type="hidden"
class="menu-item-type"
name="<?php echo esc_attr( $name_prefix ); ?>[menu-item-type]"
value="custom">
<input type="hidden"
class="menu-item-title"
name="<?php echo esc_attr( $name_prefix ); ?>[menu-item-title]"
value="<?php echo esc_attr( $label ); ?>">
<input type="hidden"
class="menu-item-url"
name="<?php echo esc_attr( $name_prefix ); ?>[menu-item-url]"
value="?p24_change_currency=<?php echo esc_attr( $currency_option ); ?>">
<input type="hidden"
class="menu-item-classes"
name="<?php echo esc_attr( $name_prefix ); ?>[menu-item-classes]"
value="p24-change-currency">
</li>
<?php --$i; ?>
<?php endforeach; ?>
</ul>
</div>
<p class="button-controls">
<span class="list-controls">
<a href="/wordpress/wp-admin/nav-menus.php?page-tab=all&amp;selectall=1#p24-currency-menu"
class="select-all">
<?php echo __( 'Select All' ); ?>
</a>
</span>
<span class="add-to-menu">
<input type="submit"
class="button-secondary submit-add-to-menu right"
value="<?php echo esc_attr( __( 'Add to Menu' ) ); ?>"
id="submit-p24-currency-menu"
name="add-post-type-menu-item">
<span class="spinner"></span>
</span>
</p>
</div>

View File

@@ -0,0 +1,105 @@
<?php
/**
* Template to set currency formats.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $currency_options ) ) {
throw new LogicException( 'The variable $currency_options is not set.' );
}
if ( ! isset( $active_currency ) ) {
throw new LogicException( 'The variable $active_currency is not set.' );
}
if ( ! isset( $format ) ) {
throw new LogicException( 'The variable $format is not set.' );
} elseif ( ! is_array( $format ) ) {
throw new LogicException( 'The variable $format has to be an array.' );
}
?>
<h1><?php echo esc_html( __( 'Formatowanie walut' ) ); ?></h1>
<form method="post">
<table>
<tr>
<?php $field_id = '24_currency_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Aktywna waluta' ) ); ?></label>
</th>
<td>
<select title="<?php echo esc_attr( __( 'Aktywna waluta' ) ); ?>" name="p24_currency" id="<?php echo esc_attr( $field_id ); ?>" class="js_currency_admin_selector">
<?php foreach ( $currency_options as $currency_option ) : ?>
<option value="<?php echo esc_attr( $currency_option ); ?>" <?php echo $currency_option === $active_currency ? 'selected="selected"' : ''; ?>>
<?php echo esc_html( $currency_option ); ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<tr>
<?php $field_id = 'p24_formats_currency_pos_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Pozycja waluty', 'woocommerce' ) ); ?></label>
</th>
<td>
<select name="p24_formats[currency_pos]" id="<?php echo esc_attr( $field_id ); ?>">
<option value="left" <?php echo 'left' === $format['currency_pos'] ? 'selected="selected"' : ''; ?>><?php echo esc_html( __( 'Po lewej' ) ); ?></option>
<option value="right" <?php echo 'right' === $format['currency_pos'] ? 'selected="selected"' : ''; ?>><?php echo esc_html( __( 'Po prawej' ) ); ?></option>
<option value="left_space" <?php echo 'left_space' === $format['currency_pos'] ? 'selected="selected"' : ''; ?>><?php echo esc_html( __( 'Po lewej ze spacją' ) ); ?></option>
<option value="right_space" <?php echo 'right_space' === $format['currency_pos'] ? 'selected="selected"' : ''; ?>><?php echo esc_html( __( 'Po prawej ze spacją' ) ); ?></option>
</select>
</td>
</tr>
<tr>
<?php $field_id = 'p24_formats_thousand_separator_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_attr( __( 'Separator trzycyfrowy', 'woocommerce' ) ); ?></label>
</th>
<td>
<input name="p24_formats[thousand_separator]" id="<?php echo esc_attr( $field_id ); ?>" value="<?php echo esc_attr( $format['thousand_separator'] ); ?>" />
</td>
</tr>
<tr>
<?php $field_id = 'p24_formats_decimal_separator_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Separator dziesiętny', 'woocommerce' ) ); ?></label>
</th>
<td>
<input name="p24_formats[decimal_separator]" id="<?php echo esc_attr( $field_id ); ?>" value="<?php echo esc_attr( $format['decimal_separator'] ); ?>" />
</td>
</tr>
<tr>
<?php $field_id = 'p24_formats_decimals_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Cyfry po przecinku', 'woocommerce' ) ); ?></label>
</th>
<td>
<input type="number" name="p24_formats[decimals]" id="<?php echo esc_attr( $field_id ); ?>" value="<?php echo esc_attr( $format['decimals'] ); ?>" />
</td>
</tr>
<tr>
<td></td>
<td>
<input type="hidden" name="p24_action_type_field" value="change_formats" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php

View File

@@ -0,0 +1,125 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $multi_currency_instance ) ) {
throw new LogicException( 'The variable $multi_currency_instance is not set.' );
}
if ( ! isset( $value ) ) {
throw new LogicException( 'The variable $value is not set.' );
}
if ( $value ) {
if ( ! isset( $currency_options ) ) {
throw new LogicException( 'The variable $currency_options is not set.' );
}
if ( ! isset( $report_currency ) ) {
throw new LogicException( 'The variable $active_currency is not set.' );
}
}
if ( ! isset( $order_created_notification_value ) ) {
throw new LogicException( 'The variable $order_created_notification_value is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Moduł multi currency' ) ); ?></h1>
<p class="p24-info">
Wtyczka płatności Przelewy24 posiada zintegrowany moduł do obsługi wielu walut
w kontekście jednego sklepu. Po jego aktywacji należy przejść do zakładki
z mnożnikami i dodać kolejne waluty.
</p>
<?php if ( $multi_currency_instance->is_multi_currency_active() && ! $multi_currency_instance->is_internal() ) : ?>
<p class="p24-warning">
<?php
echo esc_html(
__(
'
Wykryto zewnętrzny, aktywny moduł obsługi wielu walut.
Aktywacja modułu Przelewy24 może spowodować poważne błędy.
'
)
);
?>
<br>
<?php echo esc_html( __( 'Wykryty moduł:' ) . ' ' . $multi_currency_instance->get_name() . '.' ); ?>
</p>
<?php endif; ?>
<p class="p24-warning">
<?php
echo esc_html( __('
Niektóre wtyczki mogą wchodzić w konflikt z tą opcją.
Dotyczy przede wszystkim tych, które wprowadzają nowy rodzaj produktów,
niedostępnych z poziomu Woocommerce → Products.
') );
?>
</p>
<form method="post">
<table>
<tr>
<?php $field_id = 'p24_multi_currency_active_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Aktywować moduł multi currency' ) ); ?></label>
</th>
<td>
<input type="checkbox" name="p24_multi_currency_active" id="<?php echo esc_attr( $field_id ); ?>" value="yes" <?php echo $value ? 'checked="checked"' : ''; ?> />
</td>
</tr>
<?php if ( $value ) { ?>
<tr>
<?php $reports_field_id = 'p24_reports_currency_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $reports_field_id ); ?>"><?php echo esc_html( __( 'Waluta do analityki (w tym dashboard)' ) ); ?></label>
</th>
<td>
<select title="<?php echo esc_attr( __( 'Waluta do analityki (w tym dashboard)' ) ); ?>" name="p24_reports_currency" id="<?php echo esc_attr( $reports_field_id ); ?>">
<?php foreach ( $currency_options as $currency_option ) : ?>
<option value="<?php echo esc_attr( $currency_option ); ?>" <?php echo $currency_option === $report_currency ? 'selected="selected"' : ''; ?>>
<?php echo esc_html( $currency_option ); ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<td colspan="2">
<h4><?php echo esc_html( __( 'Notyfikacje' ) ); ?></h4>
</td>
</tr>
<?php $field_id = 'p24_notification_order_created_' . wp_rand(); ?>
<tr>
<th align="left">
<label for="<?php echo esc_attr( $field_id ); ?>">
<?php echo esc_html( __( 'E-mail o złożeniu zamówienia.' ) ); ?>
</label>
</th>
<td>
<input type="checkbox" name="p24_notification_order_created" id="<?php echo esc_attr( $field_id ); ?>" value="yes" <?php echo $order_created_notification_value ? 'checked="checked"' : ''; ?> />
</td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="p24_action_type_field" value="activate_multi_currency" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php

View File

@@ -0,0 +1,73 @@
<?php
/**
* Template to set currency multipliers.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $multipliers ) ) {
throw new LogicException( 'The variable $multiplers is not set.' );
}
if ( ! isset( $base_currency ) ) {
throw new LogicException( 'The variable $base_currency is not set.' );
}
if ( ! isset( $available ) ) {
throw new LogicException( 'The variable $available is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Mnożniki walut' ) ); ?></h1>
<form method="post">
<table>
<?php foreach ( $multipliers as $k => $v ) : ?>
<?php $html_id = 'id_' . wp_rand(); ?>
<tr class="js-p24-multiplier-box">
<th>
<label for="<?php echo esc_html( $html_id ); ?>"><?php echo esc_html( $k ); ?></label>
</th>
<td>
<input type="number" title="<?php echo esc_attr( $k ); ?>" step="0.000001" min="0" id="<?php echo esc_attr( $html_id ); ?>" name="p24_multipliers[<?php echo esc_attr( $k ); ?>]" value="<?php echo esc_attr( $v ); ?>" <?php echo $k === $base_currency ? 'disabled' : ''; ?> />
</td>
<td>
<input type="button" value="-" style="<?php echo $k === $base_currency ? 'display: none;' : ''; ?>" />
</td>
</tr>
<?php endforeach; ?>
<tr class="js-currency-adder">
<?php $html_id = 'id_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_html( $html_id ); ?>"><?php echo esc_html( __( 'Dodaj' ) ); ?></label>
</th>
<td>
<select name="p24_new_currency" id="<?php echo esc_attr( $html_id ); ?>" title="<?php echo esc_attr( __( 'Dodaj' ) ); ?>" >
<?php foreach ( $available as $k => $v ) : ?>
<option value="<?php echo esc_attr( $k ); ?>">
<?php echo esc_html( $v ); ?>
</option>
<?php endforeach; ?>
</select>
</td>
<td>
<input type="button" value="+" />
</td>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="hidden" name="p24_action_type_field" value="change_multipliers" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php

View File

@@ -0,0 +1,31 @@
<?php
/**
* Template to set currency multipliers.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $currency_options ) ) {
throw new LogicException( 'The variable $currency_options is not set.' );
}
if ( ! isset( $post ) || ! $post instanceof WP_Post ) {
throw new LogicException( 'The variable $available is not set or is of unsupported class.' );
}
$active_currency = $post->_order_currency;
$order_id = $post->ID;
?>
<label> <?php echo esc_html( __( 'Waluta' ) ); ?>: <br>
<select name="p24_order_currency" class="wc-enhanced-select" style="min-width: 50%;">
<?php foreach ( $currency_options as $currency_option ) : ?>
<option value="<?php echo esc_attr( $currency_option ); ?>" <?php echo (string) $currency_option === (string) $active_currency ? 'selected="selected"' : ''; ?>>
<?php echo esc_html( $currency_option ); ?>
</option>
<?php endforeach; ?>
</select>
</label>
<?php

View File

@@ -0,0 +1,48 @@
<?php
/**
* Template with tabs of multi currency config.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $tab ) ) {
throw new LogicException( 'The variable $tab is not set.' );
}
if ( ! isset( $multicurrency ) ) {
throw new LogicException( 'The variable $multicurrency is not set.' );
}
?>
<nav class="p24-horizontal-tab-menu">
<?php if ( 'main' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></span>
<?php else : ?>
<a href="?page=p24-multi-currency"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></a>
<?php endif; ?>
<?php if ( 'multipliers' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Mnożniki walut' ) ); ?></span>
<?php elseif ( $multicurrency ) : ?>
<a href="?page=p24-multi-currency&tab=multipliers"><?php echo esc_html( __( 'Mnożniki walut' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Mnożniki walut' ) ); ?></span>
<?php endif; ?>
<?php if ( 'formats' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Formaty wyświetlania walut' ) ); ?></span>
<?php elseif ( $multicurrency ) : ?>
<a href="?page=p24-multi-currency&tab=formats"><?php echo esc_html( __( 'Formaty wyświetlania walut' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Formaty wyświetlania walut' ) ); ?></span>
<?php endif; ?>
</nav>
<?php

View File

@@ -0,0 +1,42 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $is_active ) ) {
throw new LogicException( 'The variable $is_active is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Aktywacja statusów P24' ) ); ?></h1>
<form method="post">
<table>
<tr>
<?php $field_id = 'p24_statuses_active_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Aktywuj statusy' ) ); ?></label>
</th>
<td>
<input type="checkbox" name="p24_statuses_active" <?php echo $is_active ? esc_attr( 'checked' ) : ''; ?> id="<?php echo esc_attr( $field_id ); ?>" value="1" />
</td>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="hidden" name="p24_action_type_field" value="activate_statuses" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php

View File

@@ -0,0 +1,39 @@
<?php
/**
* Template with tabs of order statuses config.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $tab ) ) {
throw new LogicException( 'The variable $tab is not set.' );
}
if ( ! isset( $is_active ) ) {
throw new LogicException( 'The variable $is_active is not set.' );
}
?>
<nav class="p24-horizontal-tab-menu">
<?php if ( 'main' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></span>
<?php else : ?>
<a href="?page=p24-order-status"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></a>
<?php endif; ?>
<?php if ( 'list' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Lista' ) ); ?></span>
<?php elseif ( $is_active ) : ?>
<a href="?page=p24-order-status&tab=list"><?php echo esc_html( __( 'Lista' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Lista' ) ); ?></span>
<?php endif; ?>
</nav>
<?php

View File

@@ -0,0 +1,72 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $statuses ) ) {
throw new LogicException( 'The variable $statuses is not set.' );
}
if ( ! isset( $error ) ) {
throw new LogicException( 'The variable $error is not set.' );
}
if ( ! isset( $new_code ) ) {
throw new LogicException( 'The variable $new_code is not set.' );
}
if ( ! isset( $new_label ) ) {
throw new LogicException( 'The variable $new_label is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Statusy' ) ); ?></h1>
<?php if ( $statuses ) : ?>
<h2><?php echo esc_html( __( 'Obecnie wprowadzone statusy:' ) ); ?></h2>
<table class="p24-border">
<tr>
<th><?php echo esc_html( __( 'Kod' ) ); ?></th>
<th><?php echo esc_html( __( 'Nazwa' ) ); ?></th>
</tr>
<?php foreach ( $statuses as $new ) : ?>
<tr>
<td><?php echo esc_html( $new['code'] ); ?></td>
<td><?php echo esc_html( $new['label'] ); ?></td>
</tr>
<?php endforeach ?>
</table>
<?php endif; ?>
<h2><?php echo esc_html( __( 'Wprowadź nowy status:' ) ); ?></h2>
<form method="post" class="p24-label-form">
<?php if ( $error ) : ?>
<p class="p24-error">
<?php echo esc_html( $error ); ?>
</p>
<?php endif; ?>
<div>
<label>
<?php echo esc_html( __( 'Kod:' ) ); ?>
<input name="p24-status-new-code" required value="<?php echo esc_attr( $new_code ); ?>">
</label>
</div>
<div>
<label>
<?php echo esc_html( __( 'Nazwa:' ) ); ?>
<input name="p24-status-new-label" required value="<?php echo esc_attr( $new_label ); ?>">
</label>
</div>
<div>
<input type="hidden" name="p24_action_type_field" value="add_status" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Dodaj' ) ); ?>" />
</div>
</form>
<?php

View File

@@ -0,0 +1,82 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $is_active ) ) {
throw new LogicException( 'The variable $is_active is not set.' );
}
if ( ! isset( $days_to_renew ) ) {
throw new LogicException( 'The variable $days_to_renew is not set.' );
}
if ( ! isset( $page_id ) ) {
/* Force defined null. */
$page_id = null;
}
?>
<h1><?php echo esc_html( __( 'Moduł subskrypcji' ) ); ?></h1>
<form method="post">
<table>
<tr>
<?php $field_id = 'p24_subscriptions_active_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Aktywuj subskrypcje' ) ); ?></label>
</th>
<td>
<input type="checkbox" name="p24_subscriptions_active" <?php echo $is_active ? esc_attr( 'checked' ) : ''; ?> id="<?php echo esc_attr( $field_id ); ?>" value="1" />
</td>
</tr>
<tr>
<?php $field_id = 'p24_subscription_page_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Strona subskrypcji użytkownika' ) ); ?></label>
</th>
<td>
<select name="p24_subscription_page" id="<?php echo esc_attr( $field_id ); ?>">
<option value="nothing"><?php echo esc_html( __( 'Brak akcji' ) ); ?></option>
<?php if ( $page_id ) : ?>
<option value="delete"><?php echo esc_html( __( 'Skasuj' ) ); ?></option>
<option value="force"><?php echo esc_html( __( 'Ponownie wygeneruj' ) ); ?></option>
<?php else : ?>
<option value="generate"><?php echo esc_html( __( 'Wygeneruj' ) ); ?></option>
<?php endif; ?>
</select>
<?php if ( $page_id ) : ?>
<a href="<?php echo esc_attr( get_permalink( $page_id ) ); ?>"><?php echo esc_html( __( 'Link do obecnej strony' ) ); ?></a>
<?php endif; ?>
</td>
</tr>
<tr>
<?php $field_id = 'p24_subscriptions_days_' . wp_rand(); ?>
<th>
<label for="<?php echo esc_attr( $field_id ); ?>"><?php echo esc_html( __( 'Liczba dni na odnowienie subskrypcji' ) ); ?></label>
</th>
<td>
<input type="number" name="p24_subscriptions_days" id="<?php echo esc_attr( $field_id ); ?>" value="<?php echo (int) $days_to_renew; ?>" />
</td>
</tr>
<tr>
<td></td>
<td colspan="2">
<input type="hidden" name="p24_action_type_field" value="update_subscription" />
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php

View File

@@ -0,0 +1,43 @@
<?php
/**
* Template for inactive subscriptions.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $inactive_list ) ) {
throw new LogicException( 'The variable $inactive_list is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Moduł subskrypcji' ) ); ?></h1>
<h2><?php echo esc_html( __( 'Nieaktywne subskrypcje' ) ); ?></h2>
<form method="post">
<table class="p24-border">
<tr>
<tr>
<th><?php echo esc_html( __( 'Użytkownik' ) ); ?></th>
<th><?php echo esc_html( __( 'E-Mail' ) ); ?></th>
<th><?php echo esc_html( __( 'Ważna do' ) ); ?></th>
<th><?php echo esc_html( __( 'Subskrypcje' ) ); ?></th>
</tr>
<?php foreach ( $inactive_list as $one ) : ?>
<tr>
<td><?php echo esc_html( $one->user_nicename ); ?></td>
<td><?php echo esc_html( $one->user_email ); ?></td>
<td><?php echo esc_html( $one->valid_to ); ?></td>
<td><?php echo esc_html( $one->subscription_title ); ?></td>
</tr>
<?php endforeach; ?>
</table>
</form>
<?php

View File

@@ -0,0 +1,54 @@
<?php
/**
* Template for active multi currency.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $list ) ) {
throw new LogicException( 'The variable $list is not set.' );
}
?>
<h1><?php echo esc_html( __( 'Moduł subskrypcji' ) ); ?></h1>
<form method="post">
<table class="p24-border">
<tr>
<tr>
<th><?php echo esc_html( __( 'Użytkownik' ) ); ?></th>
<th><?php echo esc_html( __( 'E-Mail' ) ); ?></th>
<th><?php echo esc_html( __( 'Ważna do' ) ); ?></th>
<th><?php echo esc_html( __( 'Subskrypcje' ) ); ?></th>
<th><?php echo esc_html( __( 'Aktywna' ) ); ?></th>
</tr>
<?php foreach ( $list as $one ) : ?>
<tr>
<td><?php echo esc_html( $one->user_nicename ); ?></td>
<td><?php echo esc_html( $one->user_email ); ?></td>
<td><?php echo esc_html( $one->valid_to ); ?></td>
<td><?php echo esc_html( $one->subscription_title ); ?></td>
<td>
<input type="checkbox" checked name="preserve[]" value="<?php echo esc_attr( $one->record_id ); ?>">
<input type="hidden" name="displayed[]" value="<?php echo esc_attr( $one->record_id ); ?>">
</td>
</tr>
<?php endforeach; ?>
</table>
<p>
<?php wp_nonce_field( 'p24_subscription' ); ?>
<button><?php echo esc_html( __( 'Edytuj' ) ); ?></button>
</p>
</form>
<div>
<a href="?p24&subscription_csv"><?php echo esc_html( __( 'Pobierz CSV' ) ); ?></a>
</div>
<?php

View File

@@ -0,0 +1,28 @@
<?php
/**
* Template with input for files.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $file ) ) {
throw new LogicException( 'The variable $file is not set.' );
}
?>
<tr>
<td class="sort"></td>
<td class="file_name">
<input type="text" class="input_text" placeholder="<?php esc_attr_e( 'File name', 'woocommerce' ); ?>" name="_p24_sub_file_names[]" value="<?php echo esc_attr( $file['name'] ); ?>" />
</td>
<td class="file_url"><input type="text" class="input_text" placeholder="<?php esc_attr_e( 'http://', 'woocommerce' ); ?>" name="_p24_sub_file_urls[]" value="<?php echo esc_attr( $file['url'] ); ?>" /></td>
<td class="file_url_choose" width="1%"><a href="#" class="button upload_file_button" data-choose="<?php esc_attr_e( 'Choose file', 'woocommerce' ); ?>" data-update="<?php esc_attr_e( 'Insert file URL', 'woocommerce' ); ?>"><?php echo esc_html__( 'Choose file', 'woocommerce' ); ?></a></td>
<td width="1%"><a href="#" class="delete"><?php esc_html_e( 'Delete', 'woocommerce' ); ?></a></td>
</tr>
<?php

View File

@@ -0,0 +1,100 @@
<?php
/**
* Template to edit subscription.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $files ) ) {
throw new LogicException( 'The variable $files is not set.' );
}
?>
<div id='p24_subscription_options' class='panel woocommerce_options_panel'>
<div class='options_group'>
<?php
woocommerce_wp_text_input(
array(
'id' => '_subscription_price',
'label' => __( 'Price' ),
'placeholder' => '',
'desc_tip' => 'true',
'description' => __( 'Enter Subscription Price.' ),
)
);
woocommerce_wp_text_input(
array(
'id' => '_days',
'label' => __( 'Days' ),
'placeholder' => '',
'desc_tip' => 'true',
'description' => __( 'Enter Subcription Length in Days.' ),
)
);
?>
</div>
<div class="downloadable downloadable_files">
<table class="widefat">
<thead>
<tr>
<th class="sort">&nbsp;</th>
<th><?php esc_html_e( 'Name', 'woocommerce' ); ?></th>
<th colspan="2"><?php esc_html_e( 'File URL', 'woocommerce' ); ?></th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
<?php if ( $files ) : ?>
<?php foreach ( $files as $file ) : ?>
<?php require __DIR__ . '/subscriptions-product-file.php'; ?>
<?php endforeach; ?>
<?php else : ?>
<?php
$file = array(
'name' => '',
'url' => '',
);
?>
<?php require __DIR__ . '/subscriptions-product-file.php'; ?>
<?php endif; ?>
</tbody>
<tfoot>
<tr>
<th colspan="5">
<?php
$file = array(
'name' => '',
'url' => '',
);
ob_start();
require __DIR__ . '/subscriptions-product-file.php';
$content = ob_get_clean();
?>
<a href="#" class="button insert" data-row="<?php echo esc_attr( $content ); ?>">
<?php echo esc_html( __( 'Add File', 'woocommerce' ) ); ?>
</a>
</th>
</tr>
</tfoot>
</table>
</div>
</div>
<?php

View File

@@ -0,0 +1,49 @@
<?php
/**
* Template with tabs of multi currency config.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $tab ) ) {
throw new LogicException( 'The variable $tab is not set.' );
}
if ( ! isset( $is_active ) ) {
throw new LogicException( 'The variable $is_active is not set.' );
}
?>
<nav class="p24-horizontal-tab-menu">
<?php if ( 'main' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></span>
<?php elseif ( $is_active ) : ?>
<a href="?page=p24-subscription"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Ustawienia główne' ) ); ?></span>
<?php endif; ?>
<?php if ( 'list' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Aktywne' ) ); ?></span>
<?php elseif ( $is_active ) : ?>
<a href="?page=p24-subscription&tab=list"><?php echo esc_html( __( 'Aktywne' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Aktywne' ) ); ?></span>
<?php endif; ?>
<?php if ( 'inactive' === $tab ) : ?>
<span class="active"><?php echo esc_html( __( 'Nieaktywne' ) ); ?></span>
<?php elseif ( $is_active ) : ?>
<a href="?page=p24-subscription&tab=inactive"><?php echo esc_html( __( 'Nieaktywne' ) ); ?></a>
<?php else : ?>
<span class="inactive"><?php echo esc_html( __( 'Nieaktywne' ) ); ?></span>
<?php endif; ?>
</nav>
<?php

View File

@@ -0,0 +1,103 @@
<?php
/**
* Template with tabs of multi currency config.
*
* @package Przelewy24
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
if ( ! isset( $user ) ) {
throw new LogicException( 'The variable $user is not set.' );
}
if ( ! isset( $subscriptions ) ) {
throw new LogicException( 'The variable $subscriptions is not set.' );
}
if ( ! isset( $cards ) ) {
throw new LogicException( 'The variable $cards is not set.' );
}
if ( ! isset( $files ) ) {
throw new LogicException( 'The variable $files is not set.' );
}
if ( ! isset( $inactive ) ) {
throw new LogicException( 'The variable $inactive is not set.' );
}
?>
<?php if ( $subscriptions ) : ?>
<form method="POST">
<table class="p24-border">
<tr>
<th><?php echo esc_html( __( 'Ważna do' ) ); ?></th>
<th><?php echo esc_html( __( 'Subskrypcja' ) ); ?></th>
<th><?php echo esc_html( __( 'Karta' ) ); ?></th>
</tr>
<?php foreach ( $subscriptions as $one ) : ?>
<tr>
<td><?php echo esc_html( $one->valid_to ); ?></td>
<td><?php echo esc_html( $one->subscription_title ); ?></td>
<td>
<select name="card_for_subscription[<?php echo esc_attr( $one->record_id ); ?>]">
<option value="">
<?php echo esc_html( __( 'Brak podpiętej karty' ) ); ?>
</option>
<?php foreach ( $cards as $card ) : ?>
<option value="<?php echo esc_attr( $card->custom_key ); ?>"
<?php
if ( $one->card_ref === $card->custom_key ) :
?>
selected="selected" <?php endif; ?>>
<?php echo esc_html( $card->custom_value['type'] ); ?>
<?php echo esc_html( $card->custom_value['mask'] ); ?>
</option>
<?php endforeach; ?>
</select>
</td>
</tr>
<?php endforeach; ?>
<tr>
<td></td>
<td colspan="2">
<input type="hidden" name="p24_action_type_field" value="user_subscriptions" >
<?php wp_nonce_field( 'p24_action', 'p24_nonce' ); ?>
<input type="submit" value="<?php echo esc_html( __( 'Zapisz' ) ); ?>" />
</td>
</tr>
</table>
</form>
<?php if ( $files ) : ?>
<h3><?php echo esc_html( __( 'Dostępne pliki' ) ); ?></h3>
<ul>
<?php foreach ( $files as $file ) : ?>
<li>
<a href="/?p24&download&subscription_id=<?php echo esc_attr( $file['parent_id'] ); ?>&file_name=<?php echo esc_attr( $file['name_url'] ); ?>"><?php echo esc_html( $file['name'] ); ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php else : ?>
<div><?php echo esc_html( __( 'Nie masz aktywnych subskrypcji.' ) ); ?></div>
<?php endif; ?>
<?php if ( $inactive ) : ?>
<h3><?php echo esc_html( __( 'Nieaktywne subskrypcje' ) ); ?></h3>
<table class="p24-border">
<tr>
<th><?php echo esc_html( __( 'Subskrypcja' ) ); ?></th>
</tr>
<?php foreach ( $inactive as $one ) : ?>
<tr>
<td><?php echo esc_html( $one->subscription_title ); ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php endif; ?>
<?php