@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | 12 | ?> |
13 | 13 |
@@ -13,128 +13,128 @@ |
||
13 | 13 | class GetPaid_Payment_Forms { |
14 | 14 | |
15 | 15 | /** |
16 | - * Class constructor |
|
17 | - * |
|
18 | - */ |
|
19 | - public function __construct() { |
|
20 | - |
|
21 | - // Update a payment form's revenue whenever an invoice is paid for or refunded. |
|
22 | - add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) ); |
|
23 | - add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) ); |
|
24 | - |
|
25 | - // Sync form amount whenever invoice statuses change. |
|
26 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 ); |
|
27 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 ); |
|
28 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 ); |
|
29 | - |
|
30 | - } |
|
31 | - |
|
32 | - /** |
|
33 | - * Increments a form's revenue whenever there is a payment. |
|
34 | - * |
|
35 | - * @param WPInv_Invoice $invoice |
|
36 | - */ |
|
37 | - public function increment_form_revenue( $invoice ) { |
|
38 | - |
|
39 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
40 | - if ( $form->get_id() ) { |
|
41 | - $form->set_earned( $form->get_earned() + $invoice->get_total() ); |
|
42 | - $form->save(); |
|
43 | - } |
|
44 | - |
|
45 | - } |
|
46 | - |
|
47 | - /** |
|
48 | - * Decreases form revenue whenever invoice payment changes. |
|
49 | - * |
|
50 | - * @param WPInv_Invoice $invoice |
|
51 | - */ |
|
52 | - public function decrease_form_revenue( $invoice ) { |
|
53 | - |
|
54 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
55 | - if ( $form->get_id() ) { |
|
56 | - $form->set_earned( $form->get_earned() - $invoice->get_total() ); |
|
57 | - $form->save(); |
|
58 | - } |
|
59 | - |
|
60 | - } |
|
61 | - |
|
62 | - /** |
|
63 | - * Updates a form's failed amount. |
|
64 | - * |
|
65 | - * @param WPInv_Invoice $invoice |
|
66 | - * @param string $from |
|
67 | - * @param string $to |
|
68 | - */ |
|
69 | - public function update_form_failed_amount( $invoice, $from, $to ) { |
|
70 | - |
|
71 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
72 | - if ( $form->get_id() ) { |
|
73 | - return; |
|
74 | - } |
|
75 | - |
|
76 | - if ( 'wpi-failed' == $from ) { |
|
77 | - $form->set_failed( $form->get_failed() - $invoice->get_total() ); |
|
78 | - $form->save(); |
|
79 | - } |
|
80 | - |
|
81 | - if ( 'wpi-failed' == $to ) { |
|
82 | - $form->set_failed( $form->get_failed() + $invoice->get_total() ); |
|
83 | - $form->save(); |
|
84 | - } |
|
85 | - |
|
86 | - } |
|
87 | - |
|
88 | - /** |
|
89 | - * Updates a form's refunded amount. |
|
90 | - * |
|
91 | - * @param WPInv_Invoice $invoice |
|
92 | - * @param string $from |
|
93 | - * @param string $to |
|
94 | - */ |
|
95 | - public function update_form_refunded_amount( $invoice, $from, $to ) { |
|
96 | - |
|
97 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
98 | - if ( $form->get_id() ) { |
|
99 | - return; |
|
100 | - } |
|
101 | - |
|
102 | - if ( 'wpi-refunded' == $from ) { |
|
103 | - $form->set_refunded( $form->get_refunded() - $invoice->get_total() ); |
|
104 | - $form->save(); |
|
105 | - } |
|
106 | - |
|
107 | - if ( 'wpi-refunded' == $to ) { |
|
108 | - $form->set_refunded( $form->get_refunded() + $invoice->get_total() ); |
|
109 | - $form->save(); |
|
110 | - } |
|
111 | - |
|
112 | - } |
|
113 | - |
|
114 | - /** |
|
115 | - * Updates a form's cancelled amount. |
|
116 | - * |
|
117 | - * @param WPInv_Invoice $invoice |
|
118 | - * @param string $from |
|
119 | - * @param string $to |
|
120 | - */ |
|
121 | - public function update_form_cancelled_amount( $invoice, $from, $to ) { |
|
122 | - |
|
123 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
124 | - if ( $form->get_id() ) { |
|
125 | - return; |
|
126 | - } |
|
127 | - |
|
128 | - if ( 'wpi-cancelled' == $from ) { |
|
129 | - $form->set_cancelled( $form->get_cancelled() - $invoice->get_total() ); |
|
130 | - $form->save(); |
|
131 | - } |
|
132 | - |
|
133 | - if ( 'wpi-cancelled' == $to ) { |
|
134 | - $form->set_cancelled( $form->get_cancelled() + $invoice->get_total() ); |
|
135 | - $form->save(); |
|
136 | - } |
|
137 | - |
|
138 | - } |
|
16 | + * Class constructor |
|
17 | + * |
|
18 | + */ |
|
19 | + public function __construct() { |
|
20 | + |
|
21 | + // Update a payment form's revenue whenever an invoice is paid for or refunded. |
|
22 | + add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) ); |
|
23 | + add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) ); |
|
24 | + |
|
25 | + // Sync form amount whenever invoice statuses change. |
|
26 | + add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 ); |
|
27 | + add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 ); |
|
28 | + add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 ); |
|
29 | + |
|
30 | + } |
|
31 | + |
|
32 | + /** |
|
33 | + * Increments a form's revenue whenever there is a payment. |
|
34 | + * |
|
35 | + * @param WPInv_Invoice $invoice |
|
36 | + */ |
|
37 | + public function increment_form_revenue( $invoice ) { |
|
38 | + |
|
39 | + $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
40 | + if ( $form->get_id() ) { |
|
41 | + $form->set_earned( $form->get_earned() + $invoice->get_total() ); |
|
42 | + $form->save(); |
|
43 | + } |
|
44 | + |
|
45 | + } |
|
46 | + |
|
47 | + /** |
|
48 | + * Decreases form revenue whenever invoice payment changes. |
|
49 | + * |
|
50 | + * @param WPInv_Invoice $invoice |
|
51 | + */ |
|
52 | + public function decrease_form_revenue( $invoice ) { |
|
53 | + |
|
54 | + $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
55 | + if ( $form->get_id() ) { |
|
56 | + $form->set_earned( $form->get_earned() - $invoice->get_total() ); |
|
57 | + $form->save(); |
|
58 | + } |
|
59 | + |
|
60 | + } |
|
61 | + |
|
62 | + /** |
|
63 | + * Updates a form's failed amount. |
|
64 | + * |
|
65 | + * @param WPInv_Invoice $invoice |
|
66 | + * @param string $from |
|
67 | + * @param string $to |
|
68 | + */ |
|
69 | + public function update_form_failed_amount( $invoice, $from, $to ) { |
|
70 | + |
|
71 | + $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
72 | + if ( $form->get_id() ) { |
|
73 | + return; |
|
74 | + } |
|
75 | + |
|
76 | + if ( 'wpi-failed' == $from ) { |
|
77 | + $form->set_failed( $form->get_failed() - $invoice->get_total() ); |
|
78 | + $form->save(); |
|
79 | + } |
|
80 | + |
|
81 | + if ( 'wpi-failed' == $to ) { |
|
82 | + $form->set_failed( $form->get_failed() + $invoice->get_total() ); |
|
83 | + $form->save(); |
|
84 | + } |
|
85 | + |
|
86 | + } |
|
87 | + |
|
88 | + /** |
|
89 | + * Updates a form's refunded amount. |
|
90 | + * |
|
91 | + * @param WPInv_Invoice $invoice |
|
92 | + * @param string $from |
|
93 | + * @param string $to |
|
94 | + */ |
|
95 | + public function update_form_refunded_amount( $invoice, $from, $to ) { |
|
96 | + |
|
97 | + $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
98 | + if ( $form->get_id() ) { |
|
99 | + return; |
|
100 | + } |
|
101 | + |
|
102 | + if ( 'wpi-refunded' == $from ) { |
|
103 | + $form->set_refunded( $form->get_refunded() - $invoice->get_total() ); |
|
104 | + $form->save(); |
|
105 | + } |
|
106 | + |
|
107 | + if ( 'wpi-refunded' == $to ) { |
|
108 | + $form->set_refunded( $form->get_refunded() + $invoice->get_total() ); |
|
109 | + $form->save(); |
|
110 | + } |
|
111 | + |
|
112 | + } |
|
113 | + |
|
114 | + /** |
|
115 | + * Updates a form's cancelled amount. |
|
116 | + * |
|
117 | + * @param WPInv_Invoice $invoice |
|
118 | + * @param string $from |
|
119 | + * @param string $to |
|
120 | + */ |
|
121 | + public function update_form_cancelled_amount( $invoice, $from, $to ) { |
|
122 | + |
|
123 | + $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
124 | + if ( $form->get_id() ) { |
|
125 | + return; |
|
126 | + } |
|
127 | + |
|
128 | + if ( 'wpi-cancelled' == $from ) { |
|
129 | + $form->set_cancelled( $form->get_cancelled() - $invoice->get_total() ); |
|
130 | + $form->save(); |
|
131 | + } |
|
132 | + |
|
133 | + if ( 'wpi-cancelled' == $to ) { |
|
134 | + $form->set_cancelled( $form->get_cancelled() + $invoice->get_total() ); |
|
135 | + $form->save(); |
|
136 | + } |
|
137 | + |
|
138 | + } |
|
139 | 139 | |
140 | 140 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Payment forms controller class |
@@ -19,13 +19,13 @@ discard block |
||
19 | 19 | public function __construct() { |
20 | 20 | |
21 | 21 | // Update a payment form's revenue whenever an invoice is paid for or refunded. |
22 | - add_action( 'getpaid_invoice_payment_status_changed', array( $this, 'increment_form_revenue' ) ); |
|
23 | - add_action( 'getpaid_invoice_payment_status_reversed', array( $this, 'decrease_form_revenue' ) ); |
|
22 | + add_action('getpaid_invoice_payment_status_changed', array($this, 'increment_form_revenue')); |
|
23 | + add_action('getpaid_invoice_payment_status_reversed', array($this, 'decrease_form_revenue')); |
|
24 | 24 | |
25 | 25 | // Sync form amount whenever invoice statuses change. |
26 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_failed_amount' ), 10, 3 ); |
|
27 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_refunded_amount' ), 10, 3 ); |
|
28 | - add_action( 'getpaid_invoice_status_changed', array( $this, 'update_form_cancelled_amount' ), 10, 3 ); |
|
26 | + add_action('getpaid_invoice_status_changed', array($this, 'update_form_failed_amount'), 10, 3); |
|
27 | + add_action('getpaid_invoice_status_changed', array($this, 'update_form_refunded_amount'), 10, 3); |
|
28 | + add_action('getpaid_invoice_status_changed', array($this, 'update_form_cancelled_amount'), 10, 3); |
|
29 | 29 | |
30 | 30 | } |
31 | 31 | |
@@ -34,11 +34,11 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param WPInv_Invoice $invoice |
36 | 36 | */ |
37 | - public function increment_form_revenue( $invoice ) { |
|
37 | + public function increment_form_revenue($invoice) { |
|
38 | 38 | |
39 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
40 | - if ( $form->get_id() ) { |
|
41 | - $form->set_earned( $form->get_earned() + $invoice->get_total() ); |
|
39 | + $form = new GetPaid_Payment_Form($invoice->get_payment_form()); |
|
40 | + if ($form->get_id()) { |
|
41 | + $form->set_earned($form->get_earned() + $invoice->get_total()); |
|
42 | 42 | $form->save(); |
43 | 43 | } |
44 | 44 | |
@@ -49,11 +49,11 @@ discard block |
||
49 | 49 | * |
50 | 50 | * @param WPInv_Invoice $invoice |
51 | 51 | */ |
52 | - public function decrease_form_revenue( $invoice ) { |
|
52 | + public function decrease_form_revenue($invoice) { |
|
53 | 53 | |
54 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
55 | - if ( $form->get_id() ) { |
|
56 | - $form->set_earned( $form->get_earned() - $invoice->get_total() ); |
|
54 | + $form = new GetPaid_Payment_Form($invoice->get_payment_form()); |
|
55 | + if ($form->get_id()) { |
|
56 | + $form->set_earned($form->get_earned() - $invoice->get_total()); |
|
57 | 57 | $form->save(); |
58 | 58 | } |
59 | 59 | |
@@ -66,20 +66,20 @@ discard block |
||
66 | 66 | * @param string $from |
67 | 67 | * @param string $to |
68 | 68 | */ |
69 | - public function update_form_failed_amount( $invoice, $from, $to ) { |
|
69 | + public function update_form_failed_amount($invoice, $from, $to) { |
|
70 | 70 | |
71 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
72 | - if ( $form->get_id() ) { |
|
71 | + $form = new GetPaid_Payment_Form($invoice->get_payment_form()); |
|
72 | + if ($form->get_id()) { |
|
73 | 73 | return; |
74 | 74 | } |
75 | 75 | |
76 | - if ( 'wpi-failed' == $from ) { |
|
77 | - $form->set_failed( $form->get_failed() - $invoice->get_total() ); |
|
76 | + if ('wpi-failed' == $from) { |
|
77 | + $form->set_failed($form->get_failed() - $invoice->get_total()); |
|
78 | 78 | $form->save(); |
79 | 79 | } |
80 | 80 | |
81 | - if ( 'wpi-failed' == $to ) { |
|
82 | - $form->set_failed( $form->get_failed() + $invoice->get_total() ); |
|
81 | + if ('wpi-failed' == $to) { |
|
82 | + $form->set_failed($form->get_failed() + $invoice->get_total()); |
|
83 | 83 | $form->save(); |
84 | 84 | } |
85 | 85 | |
@@ -92,20 +92,20 @@ discard block |
||
92 | 92 | * @param string $from |
93 | 93 | * @param string $to |
94 | 94 | */ |
95 | - public function update_form_refunded_amount( $invoice, $from, $to ) { |
|
95 | + public function update_form_refunded_amount($invoice, $from, $to) { |
|
96 | 96 | |
97 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
98 | - if ( $form->get_id() ) { |
|
97 | + $form = new GetPaid_Payment_Form($invoice->get_payment_form()); |
|
98 | + if ($form->get_id()) { |
|
99 | 99 | return; |
100 | 100 | } |
101 | 101 | |
102 | - if ( 'wpi-refunded' == $from ) { |
|
103 | - $form->set_refunded( $form->get_refunded() - $invoice->get_total() ); |
|
102 | + if ('wpi-refunded' == $from) { |
|
103 | + $form->set_refunded($form->get_refunded() - $invoice->get_total()); |
|
104 | 104 | $form->save(); |
105 | 105 | } |
106 | 106 | |
107 | - if ( 'wpi-refunded' == $to ) { |
|
108 | - $form->set_refunded( $form->get_refunded() + $invoice->get_total() ); |
|
107 | + if ('wpi-refunded' == $to) { |
|
108 | + $form->set_refunded($form->get_refunded() + $invoice->get_total()); |
|
109 | 109 | $form->save(); |
110 | 110 | } |
111 | 111 | |
@@ -118,20 +118,20 @@ discard block |
||
118 | 118 | * @param string $from |
119 | 119 | * @param string $to |
120 | 120 | */ |
121 | - public function update_form_cancelled_amount( $invoice, $from, $to ) { |
|
121 | + public function update_form_cancelled_amount($invoice, $from, $to) { |
|
122 | 122 | |
123 | - $form = new GetPaid_Payment_Form( $invoice->get_payment_form() ); |
|
124 | - if ( $form->get_id() ) { |
|
123 | + $form = new GetPaid_Payment_Form($invoice->get_payment_form()); |
|
124 | + if ($form->get_id()) { |
|
125 | 125 | return; |
126 | 126 | } |
127 | 127 | |
128 | - if ( 'wpi-cancelled' == $from ) { |
|
129 | - $form->set_cancelled( $form->get_cancelled() - $invoice->get_total() ); |
|
128 | + if ('wpi-cancelled' == $from) { |
|
129 | + $form->set_cancelled($form->get_cancelled() - $invoice->get_total()); |
|
130 | 130 | $form->save(); |
131 | 131 | } |
132 | 132 | |
133 | - if ( 'wpi-cancelled' == $to ) { |
|
134 | - $form->set_cancelled( $form->get_cancelled() + $invoice->get_total() ); |
|
133 | + if ('wpi-cancelled' == $to) { |
|
134 | + $form->set_cancelled($form->get_cancelled() + $invoice->get_total()); |
|
135 | 135 | $form->save(); |
136 | 136 | } |
137 | 137 |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
4 | - exit; // Exit if accessed directly |
|
4 | + exit; // Exit if accessed directly |
|
5 | 5 | } |
6 | 6 | |
7 | 7 | /** |
@@ -11,77 +11,77 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class AUI_Component_Pagination { |
13 | 13 | |
14 | - /** |
|
15 | - * Build the component. |
|
16 | - * |
|
17 | - * @param array $args |
|
18 | - * |
|
19 | - * @return string The rendered component. |
|
20 | - */ |
|
21 | - public static function get( $args = array() ) { |
|
22 | - global $wp_query; |
|
23 | - |
|
24 | - $defaults = array( |
|
25 | - 'class' => '', |
|
26 | - 'mid_size' => 2, |
|
27 | - 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
|
28 | - 'next_text' => '<i class="fas fa-chevron-right"></i>', |
|
29 | - 'screen_reader_text' => __( 'Posts navigation','aui' ), |
|
30 | - 'before_paging' => '', |
|
31 | - 'after_paging' => '', |
|
32 | - 'type' => 'array', |
|
33 | - 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
34 | - 'links' => array() // an array of links if using custom links, this includes the a tag. |
|
35 | - ); |
|
36 | - |
|
37 | - /** |
|
38 | - * Parse incoming $args into an array and merge it with $defaults |
|
39 | - */ |
|
40 | - $args = wp_parse_args( $args, $defaults ); |
|
41 | - |
|
42 | - $output = ''; |
|
43 | - |
|
44 | - // Don't print empty markup if there's only one page. |
|
45 | - if ( $args['total'] > 1 ) { |
|
46 | - |
|
47 | - // Set up paginated links. |
|
48 | - $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
49 | - |
|
50 | - $class = !empty($args['class']) ? $args['class'] : ''; |
|
51 | - |
|
52 | - // make the output bootstrap ready |
|
53 | - $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
|
54 | - if ( ! empty( $links ) ) { |
|
55 | - foreach ( $links as $link ) { |
|
56 | - $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
57 | - $links_html .= "<li class='page-item $active'>"; |
|
58 | - $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
59 | - $links_html .= "</li>"; |
|
60 | - } |
|
61 | - } |
|
62 | - $links_html .= "</ul>"; |
|
63 | - |
|
64 | - if ( $links ) { |
|
65 | - $output .= '<section class="px-0 py-2 w-100">'; |
|
66 | - $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
67 | - $output .= '</section>'; |
|
68 | - } |
|
69 | - |
|
70 | - $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
71 | - $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
72 | - } |
|
73 | - |
|
74 | - if ( $output ) { |
|
75 | - if ( ! empty( $args['before_paging'] ) ) { |
|
76 | - $output = $args['before_paging'] . $output; |
|
77 | - } |
|
78 | - |
|
79 | - if ( ! empty( $args['after_paging'] ) ) { |
|
80 | - $output = $output . $args['after_paging']; |
|
81 | - } |
|
82 | - } |
|
83 | - |
|
84 | - return $output; |
|
85 | - } |
|
14 | + /** |
|
15 | + * Build the component. |
|
16 | + * |
|
17 | + * @param array $args |
|
18 | + * |
|
19 | + * @return string The rendered component. |
|
20 | + */ |
|
21 | + public static function get( $args = array() ) { |
|
22 | + global $wp_query; |
|
23 | + |
|
24 | + $defaults = array( |
|
25 | + 'class' => '', |
|
26 | + 'mid_size' => 2, |
|
27 | + 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
|
28 | + 'next_text' => '<i class="fas fa-chevron-right"></i>', |
|
29 | + 'screen_reader_text' => __( 'Posts navigation','aui' ), |
|
30 | + 'before_paging' => '', |
|
31 | + 'after_paging' => '', |
|
32 | + 'type' => 'array', |
|
33 | + 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
34 | + 'links' => array() // an array of links if using custom links, this includes the a tag. |
|
35 | + ); |
|
36 | + |
|
37 | + /** |
|
38 | + * Parse incoming $args into an array and merge it with $defaults |
|
39 | + */ |
|
40 | + $args = wp_parse_args( $args, $defaults ); |
|
41 | + |
|
42 | + $output = ''; |
|
43 | + |
|
44 | + // Don't print empty markup if there's only one page. |
|
45 | + if ( $args['total'] > 1 ) { |
|
46 | + |
|
47 | + // Set up paginated links. |
|
48 | + $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
49 | + |
|
50 | + $class = !empty($args['class']) ? $args['class'] : ''; |
|
51 | + |
|
52 | + // make the output bootstrap ready |
|
53 | + $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
|
54 | + if ( ! empty( $links ) ) { |
|
55 | + foreach ( $links as $link ) { |
|
56 | + $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
57 | + $links_html .= "<li class='page-item $active'>"; |
|
58 | + $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
59 | + $links_html .= "</li>"; |
|
60 | + } |
|
61 | + } |
|
62 | + $links_html .= "</ul>"; |
|
63 | + |
|
64 | + if ( $links ) { |
|
65 | + $output .= '<section class="px-0 py-2 w-100">'; |
|
66 | + $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
67 | + $output .= '</section>'; |
|
68 | + } |
|
69 | + |
|
70 | + $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
71 | + $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
72 | + } |
|
73 | + |
|
74 | + if ( $output ) { |
|
75 | + if ( ! empty( $args['before_paging'] ) ) { |
|
76 | + $output = $args['before_paging'] . $output; |
|
77 | + } |
|
78 | + |
|
79 | + if ( ! empty( $args['after_paging'] ) ) { |
|
80 | + $output = $output . $args['after_paging']; |
|
81 | + } |
|
82 | + } |
|
83 | + |
|
84 | + return $output; |
|
85 | + } |
|
86 | 86 | |
87 | 87 | } |
88 | 88 | \ No newline at end of file |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if ( ! defined( 'ABSPATH' ) ) { |
|
3 | +if (!defined('ABSPATH')) { |
|
4 | 4 | exit; // Exit if accessed directly |
5 | 5 | } |
6 | 6 | |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * |
19 | 19 | * @return string The rendered component. |
20 | 20 | */ |
21 | - public static function get( $args = array() ) { |
|
21 | + public static function get($args = array()) { |
|
22 | 22 | global $wp_query; |
23 | 23 | |
24 | 24 | $defaults = array( |
@@ -26,57 +26,57 @@ discard block |
||
26 | 26 | 'mid_size' => 2, |
27 | 27 | 'prev_text' => '<i class="fas fa-chevron-left"></i>', |
28 | 28 | 'next_text' => '<i class="fas fa-chevron-right"></i>', |
29 | - 'screen_reader_text' => __( 'Posts navigation','aui' ), |
|
29 | + 'screen_reader_text' => __('Posts navigation', 'aui'), |
|
30 | 30 | 'before_paging' => '', |
31 | 31 | 'after_paging' => '', |
32 | 32 | 'type' => 'array', |
33 | - 'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1, |
|
33 | + 'total' => isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1, |
|
34 | 34 | 'links' => array() // an array of links if using custom links, this includes the a tag. |
35 | 35 | ); |
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Parse incoming $args into an array and merge it with $defaults |
39 | 39 | */ |
40 | - $args = wp_parse_args( $args, $defaults ); |
|
40 | + $args = wp_parse_args($args, $defaults); |
|
41 | 41 | |
42 | 42 | $output = ''; |
43 | 43 | |
44 | 44 | // Don't print empty markup if there's only one page. |
45 | - if ( $args['total'] > 1 ) { |
|
45 | + if ($args['total'] > 1) { |
|
46 | 46 | |
47 | 47 | // Set up paginated links. |
48 | - $links = !empty( $args['links'] ) ? $args['links'] : paginate_links( $args ); |
|
48 | + $links = !empty($args['links']) ? $args['links'] : paginate_links($args); |
|
49 | 49 | |
50 | 50 | $class = !empty($args['class']) ? $args['class'] : ''; |
51 | 51 | |
52 | 52 | // make the output bootstrap ready |
53 | 53 | $links_html = "<ul class='pagination m-0 p-0 $class'>"; |
54 | - if ( ! empty( $links ) ) { |
|
55 | - foreach ( $links as $link ) { |
|
56 | - $active = strpos( $link, 'current' ) !== false ? 'active' : ''; |
|
54 | + if (!empty($links)) { |
|
55 | + foreach ($links as $link) { |
|
56 | + $active = strpos($link, 'current') !== false ? 'active' : ''; |
|
57 | 57 | $links_html .= "<li class='page-item $active'>"; |
58 | - $links_html .= str_replace( "page-numbers", "page-link", $link ); |
|
58 | + $links_html .= str_replace("page-numbers", "page-link", $link); |
|
59 | 59 | $links_html .= "</li>"; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | $links_html .= "</ul>"; |
63 | 63 | |
64 | - if ( $links ) { |
|
64 | + if ($links) { |
|
65 | 65 | $output .= '<section class="px-0 py-2 w-100">'; |
66 | - $output .= _navigation_markup( $links_html, 'aui-pagination', $args['screen_reader_text'] ); |
|
66 | + $output .= _navigation_markup($links_html, 'aui-pagination', $args['screen_reader_text']); |
|
67 | 67 | $output .= '</section>'; |
68 | 68 | } |
69 | 69 | |
70 | - $output = str_replace( "screen-reader-text", "screen-reader-text sr-only", $output ); |
|
71 | - $output = str_replace( "nav-links", "aui-nav-links", $output ); |
|
70 | + $output = str_replace("screen-reader-text", "screen-reader-text sr-only", $output); |
|
71 | + $output = str_replace("nav-links", "aui-nav-links", $output); |
|
72 | 72 | } |
73 | 73 | |
74 | - if ( $output ) { |
|
75 | - if ( ! empty( $args['before_paging'] ) ) { |
|
74 | + if ($output) { |
|
75 | + if (!empty($args['before_paging'])) { |
|
76 | 76 | $output = $args['before_paging'] . $output; |
77 | 77 | } |
78 | 78 | |
79 | - if ( ! empty( $args['after_paging'] ) ) { |
|
79 | + if (!empty($args['after_paging'])) { |
|
80 | 80 | $output = $output . $args['after_paging']; |
81 | 81 | } |
82 | 82 | } |
@@ -7,24 +7,24 @@ discard block |
||
7 | 7 | * @version 1.0.19 |
8 | 8 | */ |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -$bg = wpinv_get_option( 'email_background_color', '#f5f5f5' ); |
|
13 | -$body = wpinv_get_option( 'email_body_background_color', '#fdfdfd' ); |
|
14 | -$base = wpinv_get_option( 'email_base_color', '#557da2' ); |
|
15 | -$base_text = wpinv_light_or_dark( $base, '#202020', '#ffffff' ); |
|
16 | -$text = wpinv_get_option( 'email_text_color', '#505050' ); |
|
12 | +$bg = wpinv_get_option('email_background_color', '#f5f5f5'); |
|
13 | +$body = wpinv_get_option('email_body_background_color', '#fdfdfd'); |
|
14 | +$base = wpinv_get_option('email_base_color', '#557da2'); |
|
15 | +$base_text = wpinv_light_or_dark($base, '#202020', '#ffffff'); |
|
16 | +$text = wpinv_get_option('email_text_color', '#505050'); |
|
17 | 17 | |
18 | -$bg_darker_10 = wpinv_hex_darker( $bg, 10 ); |
|
19 | -$body_darker_10 = wpinv_hex_darker( $body, 10 ); |
|
20 | -$base_lighter_20 = wpinv_hex_lighter( $base, 20 ); |
|
21 | -$base_lighter_40 = wpinv_hex_lighter( $base, 40 ); |
|
22 | -$text_lighter_20 = wpinv_hex_lighter( $text, 20 ); |
|
18 | +$bg_darker_10 = wpinv_hex_darker($bg, 10); |
|
19 | +$body_darker_10 = wpinv_hex_darker($body, 10); |
|
20 | +$base_lighter_20 = wpinv_hex_lighter($base, 20); |
|
21 | +$base_lighter_40 = wpinv_hex_lighter($base, 40); |
|
22 | +$text_lighter_20 = wpinv_hex_lighter($text, 20); |
|
23 | 23 | |
24 | 24 | // !important; is a gmail hack to prevent styles being stripped if it doesn't like something. |
25 | 25 | ?> |
26 | 26 | #wrapper { |
27 | - background-color: <?php echo esc_attr( $bg ); ?>; |
|
27 | + background-color: <?php echo esc_attr($bg); ?>; |
|
28 | 28 | margin: 0; |
29 | 29 | -webkit-text-size-adjust: none !important; |
30 | 30 | padding: 3%; |
@@ -45,15 +45,15 @@ discard block |
||
45 | 45 | |
46 | 46 | #template_container { |
47 | 47 | box-shadow: 0 1px 4px rgba(0,0,0,0.1) !important; |
48 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
49 | - border: 1px solid <?php echo esc_attr( $bg_darker_10 ); ?>; |
|
48 | + background-color: <?php echo esc_attr($body); ?>; |
|
49 | + border: 1px solid <?php echo esc_attr($bg_darker_10); ?>; |
|
50 | 50 | border-radius: 3px !important; |
51 | 51 | } |
52 | 52 | |
53 | 53 | #template_header { |
54 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
54 | + background-color: <?php echo esc_attr($base); ?>; |
|
55 | 55 | border-radius: 3px 3px 0 0 !important; |
56 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
56 | + color: <?php echo esc_attr($base_text); ?>; |
|
57 | 57 | border-bottom: 0; |
58 | 58 | font-weight: bold; |
59 | 59 | line-height: 100%; |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | |
68 | 68 | #template_header h1 { |
69 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
69 | + color: <?php echo esc_attr($base_text); ?>; |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | #template_footer td { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | #template_footer #credit { |
79 | 79 | border:0; |
80 | - color: <?php echo esc_attr( $base_lighter_40 ); ?>; |
|
80 | + color: <?php echo esc_attr($base_lighter_40); ?>; |
|
81 | 81 | font-family: Arial; |
82 | 82 | font-size:12px; |
83 | 83 | line-height:125%; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | } |
87 | 87 | |
88 | 88 | #body_content { |
89 | - background-color: <?php echo esc_attr( $body ); ?>; |
|
89 | + background-color: <?php echo esc_attr($body); ?>; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | #body_content table td { |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | } |
107 | 107 | |
108 | 108 | #body_content_inner { |
109 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
109 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
110 | 110 | font-family: Arial,Helvetica,sans-serif; |
111 | 111 | font-size: 14px; |
112 | 112 | line-height: 150%; |
@@ -114,17 +114,17 @@ discard block |
||
114 | 114 | } |
115 | 115 | |
116 | 116 | .td { |
117 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
118 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
117 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
118 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | .text { |
122 | - color: <?php echo esc_attr( $text ); ?>; |
|
122 | + color: <?php echo esc_attr($text); ?>; |
|
123 | 123 | font-family: Arial,Helvetica,sans-serif; |
124 | 124 | } |
125 | 125 | |
126 | 126 | .link { |
127 | - color: <?php echo esc_attr( $base ); ?>; |
|
127 | + color: <?php echo esc_attr($base); ?>; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | #header_wrapper { |
@@ -133,19 +133,19 @@ discard block |
||
133 | 133 | } |
134 | 134 | |
135 | 135 | h1 { |
136 | - color: <?php echo esc_attr( $base ); ?>; |
|
136 | + color: <?php echo esc_attr($base); ?>; |
|
137 | 137 | font-family: Arial,Helvetica,sans-serif; |
138 | 138 | font-size: 30px; |
139 | 139 | font-weight: 300; |
140 | 140 | line-height: 150%; |
141 | 141 | margin: 0; |
142 | 142 | text-align: <?php echo is_rtl() ? 'right' : 'left'; ?>; |
143 | - text-shadow: 0 1px 0 <?php echo esc_attr( $base_lighter_20 ); ?>; |
|
143 | + text-shadow: 0 1px 0 <?php echo esc_attr($base_lighter_20); ?>; |
|
144 | 144 | -webkit-font-smoothing: antialiased; |
145 | 145 | } |
146 | 146 | |
147 | 147 | h2 { |
148 | - color: <?php echo esc_attr( $base ); ?>; |
|
148 | + color: <?php echo esc_attr($base); ?>; |
|
149 | 149 | display: block; |
150 | 150 | font-family: Arial,Helvetica,sans-serif; |
151 | 151 | font-size: 18px; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | } |
157 | 157 | |
158 | 158 | h3 { |
159 | - color: <?php echo esc_attr( $base ); ?>; |
|
159 | + color: <?php echo esc_attr($base); ?>; |
|
160 | 160 | display: block; |
161 | 161 | font-family: Arial,Helvetica,sans-serif; |
162 | 162 | font-size: 16px; |
@@ -167,7 +167,7 @@ discard block |
||
167 | 167 | } |
168 | 168 | |
169 | 169 | a { |
170 | - color: <?php echo esc_attr( $base ); ?>; |
|
170 | + color: <?php echo esc_attr($base); ?>; |
|
171 | 171 | font-weight: normal; |
172 | 172 | text-decoration: underline; |
173 | 173 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | .table-bordered { |
188 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
188 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
189 | 189 | border-collapse: collapse; |
190 | 190 | border-spacing: 0; |
191 | 191 | width: 100%; |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | |
194 | 194 | .table-bordered th, |
195 | 195 | .table-bordered td { |
196 | - border: 1px solid <?php echo esc_attr( $body_darker_10 ); ?>; |
|
197 | - color: <?php echo esc_attr( $text_lighter_20 ); ?>; |
|
196 | + border: 1px solid <?php echo esc_attr($body_darker_10); ?>; |
|
197 | + color: <?php echo esc_attr($text_lighter_20); ?>; |
|
198 | 198 | font-size: 14px; |
199 | 199 | } |
200 | 200 | .small { |
@@ -294,9 +294,9 @@ discard block |
||
294 | 294 | text-decoration: none; |
295 | 295 | } |
296 | 296 | .btn-default { |
297 | - color: <?php echo esc_attr( $base_text ); ?>; |
|
298 | - background-color: <?php echo esc_attr( $base ); ?>; |
|
299 | - border-color: <?php echo esc_attr( $base ); ?>; |
|
297 | + color: <?php echo esc_attr($base_text); ?>; |
|
298 | + background-color: <?php echo esc_attr($base); ?>; |
|
299 | + border-color: <?php echo esc_attr($base); ?>; |
|
300 | 300 | } |
301 | 301 | .btn-primary { |
302 | 302 | color: #fff; |