PluginProbe
Easy Invoice – Invoice Generator, PDF Quotes & Payments / 2.4.1
Easy Invoice – Invoice Generator, PDF Quotes & Payments v2.4.1
2.4.0 2.4.1 2.3.8 2.3.7 2.3.6 2.3.5 2.3.4 2.3.3 2.3.2 2.3.1 2.2.0 2.1.21 2.1.20 2.1.19 2.1.18 2.1.0 2.1.1 2.1.10 2.1.11 2.1.12 2.1.13 2.1.14 2.1.15 2.1.16 2.1.2 All 57 releases
← All changes | templates/payments/view.php +33 -29 2.3.42.4.1 View file →
@@ -6,13 +6,17 @@
6 6 */
7 7
8 8 namespace EasyInvoice\Templates\Payments;
9 9
10 +
11 +if ( ! defined( 'ABSPATH' ) ) {
12 + exit;
13 +}
10 14 use EasyInvoice\Models\Payment;
11 15 use EasyInvoice\Models\Invoice;
12 16
13 17 if (!isset($payment) || !($payment instanceof Payment)) {
14 - wp_die(__('Invalid payment', 'easy-invoice'));
18 + wp_die(esc_html__('Invalid payment', 'easy-invoice'));
15 19 }
16 20
17 21 $invoice_post = get_post($payment->getInvoiceId());
18 22 $invoice = $invoice_post ? new Invoice($invoice_post) : null;
@@ -22,47 +26,47 @@
22 26
23 27 <div class="p-8">
24 28 <div class="flex justify-between items-center mb-6">
25 29 <h1 class="text-2xl font-bold text-gray-900">
26 - <?php printf(__('Payment #%s', 'easy-invoice'), $payment->getId()); ?>
30 + <?php /* translators: %s: payment id. */ printf(esc_html__('Payment #%s', 'easy-invoice'), (int) $payment->getId()); ?>
27 31 </h1>
28 - <a href="<?php echo admin_url('admin.php?page=easy-invoice-payments'); ?>"
32 + <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments')); ?>"
29 33 class="inline-flex items-center px-4 py-2 border border-transparent text-sm font-medium rounded-md shadow-sm text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500">
30 - <?php _e('Back to Payments', 'easy-invoice'); ?>
34 + <?php esc_html_e('Back to Payments', 'easy-invoice'); ?>
31 35 </a>
32 36 </div>
33 37
34 38 <div class="bg-white shadow overflow-hidden sm:rounded-lg">
35 39 <div class="px-4 py-5 sm:px-6 border-b border-gray-200">
36 - <h2 class="text-lg font-medium text-gray-900"><?php _e('Payment Information', 'easy-invoice'); ?></h2>
40 + <h2 class="text-lg font-medium text-gray-900"><?php esc_html_e('Payment Information', 'easy-invoice'); ?></h2>
37 41 </div>
38 42 <div class="border-t border-gray-200">
39 43 <dl>
40 44 <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
41 - <dt class="text-sm font-medium text-gray-500"><?php _e('Payment ID', 'easy-invoice'); ?></dt>
42 - <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">#<?php echo $payment->getId(); ?></dd>
45 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Payment ID', 'easy-invoice'); ?></dt>
46 + <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">#<?php echo (int) $payment->getId(); ?></dd>
43 47 </div>
44 48 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
45 - <dt class="text-sm font-medium text-gray-500"><?php _e('Invoice', 'easy-invoice'); ?></dt>
49 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Invoice', 'easy-invoice'); ?></dt>
46 50 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
47 51 <?php if ($invoice): ?>
48 - <a href="<?php echo admin_url('admin.php?page=easy-invoice&action=edit&id=' . $invoice->getId()); ?>"
52 + <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice&action=edit&id=' . $invoice->getId())); ?>"
49 53 class="text-indigo-600 hover:text-indigo-900">
50 - <?php echo $invoice->getNumber(); ?>
54 + <?php echo esc_html($invoice->getNumber()); ?>
51 55 </a>
52 56 <?php else: ?>
53 - <span class="text-gray-400"><?php _e('Invoice not found', 'easy-invoice'); ?></span>
57 + <span class="text-gray-400"><?php esc_html_e('Invoice not found', 'easy-invoice'); ?></span>
54 58 <?php endif; ?>
55 59 </dd>
56 60 </div>
57 61 <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
58 - <dt class="text-sm font-medium text-gray-500"><?php _e('Amount', 'easy-invoice'); ?></dt>
62 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Amount', 'easy-invoice'); ?></dt>
59 63 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
60 - <?php echo $payment->getCurrencySymbol() . number_format($payment->getAmount(), 2); ?>
64 + <?php echo esc_html($payment->getCurrencySymbol() . number_format((float) $payment->getAmount(), 2)); ?>
61 65 </dd>
62 66 </div>
63 67 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
64 - <dt class="text-sm font-medium text-gray-500"><?php _e('Payment Method', 'easy-invoice'); ?></dt>
68 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Payment Method', 'easy-invoice'); ?></dt>
65 69 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
66 70 <?php
67 71 $payment_method = $payment->getPaymentMethod();
68 72 if (empty($payment_method)) {
@@ -75,14 +79,14 @@
75 79 }
76 80
77 81
78 82
79 - echo ucfirst($payment_method ?: __('Not specified', 'easy-invoice'));
83 + echo esc_html(ucfirst($payment_method ?: __('Not specified', 'easy-invoice')));
80 84 ?>
81 85 </dd>
82 86 </div>
83 87 <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
84 - <dt class="text-sm font-medium text-gray-500"><?php _e('Status', 'easy-invoice'); ?></dt>
88 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Status', 'easy-invoice'); ?></dt>
85 89 <dd class="mt-1 text-sm sm:mt-0 sm:col-span-2">
86 90 <span class="px-2 inline-flex text-xs leading-5 font-semibold rounded-full
87 91 <?php
88 92 switch ($payment->getStatus()) {
@@ -98,39 +102,39 @@
98 102 default:
99 103 echo 'bg-gray-100 text-gray-800';
100 104 }
101 105 ?>">
102 - <?php echo ucfirst($payment->getStatus()); ?>
106 + <?php echo esc_html(ucfirst($payment->getStatus())); ?>
103 107 </span>
104 108 </dd>
105 109 </div>
106 110 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
107 - <dt class="text-sm font-medium text-gray-500"><?php _e('Date', 'easy-invoice'); ?></dt>
111 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Date', 'easy-invoice'); ?></dt>
108 112 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
109 - <?php echo date_i18n(get_option('date_format'), strtotime($payment->getPaymentDate())); ?>
113 + <?php echo esc_html(date_i18n(get_option('date_format'), strtotime($payment->getPaymentDate()))); ?>
110 114 </dd>
111 115 </div>
112 116 <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
113 - <dt class="text-sm font-medium text-gray-500"><?php _e('Type', 'easy-invoice'); ?></dt>
117 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Type', 'easy-invoice'); ?></dt>
114 118 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
115 - <?php echo ucfirst($payment->getPaymentType()); ?>
119 + <?php echo esc_html(ucfirst($payment->getPaymentType())); ?>
116 120 </dd>
117 121 </div>
118 122 <?php if ($payment->getRecurringId()) : ?>
119 123 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
120 - <dt class="text-sm font-medium text-gray-500"><?php _e('Recurring ID', 'easy-invoice'); ?></dt>
124 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Recurring ID', 'easy-invoice'); ?></dt>
121 125 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
122 - <?php echo $payment->getRecurringId(); ?>
126 + <?php echo esc_html($payment->getRecurringId()); ?>
123 127 </dd>
124 128 </div>
125 129 <?php endif; ?>
126 130 <?php if ($payment->getParentPaymentId()) : ?>
127 131 <div class="bg-gray-50 px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
128 - <dt class="text-sm font-medium text-gray-500"><?php _e('Parent Payment', 'easy-invoice'); ?></dt>
132 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Parent Payment', 'easy-invoice'); ?></dt>
129 133 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
130 - <a href="<?php echo admin_url('admin.php?page=easy-invoice-payments&action=view&id=' . $payment->getParentPaymentId()); ?>"
134 + <a href="<?php echo esc_url(admin_url('admin.php?page=easy-invoice-payments&action=view&id=' . $payment->getParentPaymentId())); ?>"
131 135 class="text-indigo-600 hover:text-indigo-900">
132 - #<?php echo $payment->getParentPaymentId(); ?>
136 + #<?php echo (int) $payment->getParentPaymentId(); ?>
133 137 </a>
134 138 </dd>
135 139 </div>
136 140 <?php endif; ?>
@@ -135,9 +139,9 @@
135 139 </div>
136 140 <?php endif; ?>
137 141 <?php if ($payment->getNotes()) : ?>
138 142 <div class="bg-white px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
139 - <dt class="text-sm font-medium text-gray-500"><?php _e('Notes', 'easy-invoice'); ?></dt>
143 + <dt class="text-sm font-medium text-gray-500"><?php esc_html_e('Notes', 'easy-invoice'); ?></dt>
140 144 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
141 145 <?php echo nl2br(esc_html($payment->getNotes())); ?>
142 146 </dd>
143 147 </div>
@@ -160,9 +164,9 @@
160 164
161 165 if ($gateway_response && is_array($gateway_response)) :
162 166 ?>
163 167 <div class="px-4 py-5 sm:px-6 border-t border-gray-200">
164 - <h2 class="text-lg font-medium text-gray-900"><?php _e('Gateway Response', 'easy-invoice'); ?></h2>
168 + <h2 class="text-lg font-medium text-gray-900"><?php esc_html_e('Gateway Response', 'easy-invoice'); ?></h2>
165 169 </div>
166 170 <div class="border-t border-gray-200">
167 171 <dl>
168 172 <?php
@@ -170,9 +174,9 @@
170 174 foreach ($gateway_response as $key => $value) :
171 175 $loop++;
172 176 ?>
173 177 <div class="<?php echo $loop % 2 === 0 ? 'bg-white' : 'bg-gray-50'; ?> px-4 py-5 sm:grid sm:grid-cols-3 sm:gap-4 sm:px-6">
174 - <dt class="text-sm font-medium text-gray-500"><?php echo ucwords(str_replace('_', ' ', $key)); ?></dt>
178 + <dt class="text-sm font-medium text-gray-500"><?php echo esc_html(ucwords(str_replace('_', ' ', $key))); ?></dt>
175 179 <dd class="mt-1 text-sm text-gray-900 sm:mt-0 sm:col-span-2">
176 180 <?php
177 181 if (is_array($value)) {
178 182 echo '<pre class="text-xs bg-gray-100 p-2 rounded overflow-x-auto">' . esc_html(json_encode($value, JSON_PRETTY_PRINT)) . '</pre>';