Passed
Push — master ( fecf8d...919089 )
by Stiofan
01:09 queued 10s
created
includes/class-wpinv-notes.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! defined( 'ABSPATH' ) ) {
2
+if (!defined('ABSPATH')) {
3 3
     exit; // Exit if accessed directly
4 4
 }
5 5
 
@@ -14,74 +14,74 @@  discard block
 block discarded – undo
14 14
     }
15 15
     
16 16
     public function init() {
17
-        do_action( 'wpinv_class_notes_init', $this );
17
+        do_action('wpinv_class_notes_init', $this);
18 18
     }
19 19
     
20 20
     public function includes() {
21
-        do_action( 'wpinv_class_notes_includes', $this );
21
+        do_action('wpinv_class_notes_includes', $this);
22 22
     }
23 23
     
24 24
     public function actions() {
25 25
         // Secure inovice notes
26
-        add_action( 'pre_get_comments', array( $this, 'set_invoice_note_type' ), 11, 1 );
27
-        add_action( 'comment_feed_where', array( $this, 'wpinv_comment_feed_where' ), 10, 1 );
26
+        add_action('pre_get_comments', array($this, 'set_invoice_note_type'), 11, 1);
27
+        add_action('comment_feed_where', array($this, 'wpinv_comment_feed_where'), 10, 1);
28 28
         
29 29
         // Count comments
30
-        add_filter( 'wp_count_comments', array( $this, 'wp_count_comments' ), 11, 2 );
30
+        add_filter('wp_count_comments', array($this, 'wp_count_comments'), 11, 2);
31 31
         
32 32
         // Delete comments count cache whenever there is a new comment or a comment status changes
33
-        add_action( 'wp_insert_comment', array( $this, 'delete_comments_count_cache' ) );
34
-        add_action( 'wp_set_comment_status', array( $this, 'delete_comments_count_cache' ) );
33
+        add_action('wp_insert_comment', array($this, 'delete_comments_count_cache'));
34
+        add_action('wp_set_comment_status', array($this, 'delete_comments_count_cache'));
35 35
         
36
-        do_action( 'wpinv_class_notes_actions', $this );
36
+        do_action('wpinv_class_notes_actions', $this);
37 37
     }
38 38
         
39
-    public function set_invoice_note_type( $query ) {
40
-        $post_ID        = !empty( $query->query_vars['post_ID'] ) ? $query->query_vars['post_ID'] : $query->query_vars['post_id'];
39
+    public function set_invoice_note_type($query) {
40
+        $post_ID = !empty($query->query_vars['post_ID']) ? $query->query_vars['post_ID'] : $query->query_vars['post_id'];
41 41
         
42
-        if ( $post_ID && in_array(get_post_type( $post_ID ), array($this->invoice_post_type, 'wpi_quote' )) ) {
42
+        if ($post_ID && in_array(get_post_type($post_ID), array($this->invoice_post_type, 'wpi_quote'))) {
43 43
             $query->query_vars['type__in']      = $this->comment_type;
44 44
             $query->query_vars['type__not_in']  = '';
45 45
         } else {        
46
-            if ( isset( $query->query_vars['type__in'] ) && $type_in = $query->query_vars['type__in'] ) {
47
-                if ( is_array( $type_in ) && in_array( $this->comment_type, $type_in ) ) {
48
-                    $key = array_search( $this->comment_type, $type_in );
49
-                    unset( $query->query_vars['type__in'][$key] );
50
-                } else if ( !is_array( $type_in ) && $type_in == $this->comment_type ) {
46
+            if (isset($query->query_vars['type__in']) && $type_in = $query->query_vars['type__in']) {
47
+                if (is_array($type_in) && in_array($this->comment_type, $type_in)) {
48
+                    $key = array_search($this->comment_type, $type_in);
49
+                    unset($query->query_vars['type__in'][$key]);
50
+                } else if (!is_array($type_in) && $type_in == $this->comment_type) {
51 51
                     $query->query_vars['type__in'] = '';
52 52
                 }
53 53
             }
54 54
             
55
-            if ( isset( $query->query_vars['type__not_in'] ) && $type_not_in = $query->query_vars['type__not_in'] ) {
56
-                if ( is_array( $type_not_in ) && !in_array( $this->comment_type, $type_not_in ) ) {
55
+            if (isset($query->query_vars['type__not_in']) && $type_not_in = $query->query_vars['type__not_in']) {
56
+                if (is_array($type_not_in) && !in_array($this->comment_type, $type_not_in)) {
57 57
                     $query->query_vars['type__not_in'][] = $this->comment_type;
58
-                } else if ( !is_array( $type_not_in ) && $type_not_in != $this->comment_type ) {
58
+                } else if (!is_array($type_not_in) && $type_not_in != $this->comment_type) {
59 59
                     $query->query_vars['type__not_in'] = (array)$query->query_vars['type__not_in'];
60 60
                     $query->query_vars['type__not_in'][] = $this->comment_type;
61 61
                 }
62 62
             } else {
63
-                $query->query_vars['type__not_in']  = $this->comment_type;
63
+                $query->query_vars['type__not_in'] = $this->comment_type;
64 64
             }
65 65
         }
66 66
         
67 67
         return $query;
68 68
     }
69 69
     
70
-    public function get_invoice_notes( $invoice_id = 0, $type = '' ) {
70
+    public function get_invoice_notes($invoice_id = 0, $type = '') {
71 71
         $args = array( 
72 72
             'post_id'   => $invoice_id,
73 73
             'orderby'   => 'comment_ID',
74 74
             'order'     => 'ASC',
75 75
         );
76 76
         
77
-        if ( $type == 'customer' ) {
77
+        if ($type == 'customer') {
78 78
             $args['meta_key']   = '_wpi_customer_note';
79 79
             $args['meta_value'] = 1;
80 80
         }
81 81
         
82
-        $args   = apply_filters( 'wpinv_invoice_notes_args', $args, $this, $invoice_id, $type );
82
+        $args = apply_filters('wpinv_invoice_notes_args', $args, $this, $invoice_id, $type);
83 83
         
84
-        return get_comments( $args );
84
+        return get_comments($args);
85 85
     }
86 86
     
87 87
     /**
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
      * @return void
93 93
      */
94 94
     public function delete_comments_count_cache() {
95
-        delete_transient( 'wpinv_count_comments' );
95
+        delete_transient('wpinv_count_comments');
96 96
     }
97 97
     
98 98
     /**
@@ -103,16 +103,16 @@  discard block
 block discarded – undo
103 103
      * @param  int    $post_id Post ID.
104 104
      * @return object
105 105
      */
106
-    public function wp_count_comments( $stats, $post_id ) {
106
+    public function wp_count_comments($stats, $post_id) {
107 107
         global $wpdb;
108 108
 
109
-        if ( 0 === $post_id ) {
110
-            $stats = get_transient( 'wpinv_count_comments' );
109
+        if (0 === $post_id) {
110
+            $stats = get_transient('wpinv_count_comments');
111 111
 
112
-            if ( ! $stats ) {
112
+            if (!$stats) {
113 113
                 $stats = array();
114 114
 
115
-                $count = $wpdb->get_results( "SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A );
115
+                $count = $wpdb->get_results("SELECT comment_approved, COUNT(*) AS num_comments FROM {$wpdb->comments} WHERE comment_type NOT IN ('" . $this->comment_type . "') GROUP BY comment_approved", ARRAY_A);
116 116
 
117 117
                 $total = 0;
118 118
                 $approved = array(
@@ -123,33 +123,33 @@  discard block
 block discarded – undo
123 123
                     'post-trashed' => 'post-trashed',
124 124
                 );
125 125
 
126
-                foreach ( (array) $count as $row ) {
126
+                foreach ((array)$count as $row) {
127 127
                     // Do not count post-trashed toward totals.
128
-                    if ( 'post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved'] ) {
128
+                    if ('post-trashed' !== $row['comment_approved'] && 'trash' !== $row['comment_approved']) {
129 129
                         $total += $row['num_comments'];
130 130
                     }
131
-                    if ( isset( $approved[ $row['comment_approved'] ] ) ) {
132
-                        $stats[ $approved[ $row['comment_approved'] ] ] = $row['num_comments'];
131
+                    if (isset($approved[$row['comment_approved']])) {
132
+                        $stats[$approved[$row['comment_approved']]] = $row['num_comments'];
133 133
                     }
134 134
                 }
135 135
 
136 136
                 $stats['total_comments'] = $total;
137 137
                 $stats['all'] = $total;
138
-                foreach ( $approved as $key ) {
139
-                    if ( empty( $stats[ $key ] ) ) {
140
-                        $stats[ $key ] = 0;
138
+                foreach ($approved as $key) {
139
+                    if (empty($stats[$key])) {
140
+                        $stats[$key] = 0;
141 141
                     }
142 142
                 }
143 143
 
144
-                $stats = (object) $stats;
145
-                set_transient( 'wpinv_count_comments', $stats );
144
+                $stats = (object)$stats;
145
+                set_transient('wpinv_count_comments', $stats);
146 146
             }
147 147
         }
148 148
 
149 149
         return $stats;
150 150
     }
151 151
 
152
-    function wpinv_comment_feed_where($where){
153
-        return $where . ( $where ? ' AND ' : '' ) . " comment_type != 'wpinv_note' ";
152
+    function wpinv_comment_feed_where($where) {
153
+        return $where . ($where ? ' AND ' : '') . " comment_type != 'wpinv_note' ";
154 154
     }
155 155
 }
Please login to merge, or discard this patch.
includes/admin/wpinv-upgrade-functions.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -11,49 +11,49 @@  discard block
 block discarded – undo
11 11
  * @since 1.0.0
12 12
 */
13 13
 function wpinv_automatic_upgrade() {
14
-    $wpi_version = get_option( 'wpinv_version' );
14
+    $wpi_version = get_option('wpinv_version');
15 15
 
16
-    if ( $wpi_version == WPINV_VERSION ) {
16
+    if ($wpi_version == WPINV_VERSION) {
17 17
         return;
18 18
     }
19 19
     
20
-    if ( version_compare( $wpi_version, '0.0.5', '<' ) ) {
20
+    if (version_compare($wpi_version, '0.0.5', '<')) {
21 21
         wpinv_v005_upgrades();
22 22
     }
23 23
     
24
-    if ( version_compare( $wpi_version, '1.0.3', '<' ) ) {
24
+    if (version_compare($wpi_version, '1.0.3', '<')) {
25 25
         wpinv_v110_upgrades();
26 26
     }
27 27
     
28
-    update_option( 'wpinv_version', WPINV_VERSION );
28
+    update_option('wpinv_version', WPINV_VERSION);
29 29
 }
30
-add_action( 'admin_init', 'wpinv_automatic_upgrade' );
30
+add_action('admin_init', 'wpinv_automatic_upgrade');
31 31
 
32 32
 function wpinv_v005_upgrades() {
33 33
     global $wpdb;
34 34
     
35 35
     // Invoices status
36
-    $results = $wpdb->get_results( "SELECT ID FROM " . $wpdb->posts . " WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
37
-    if ( !empty( $results ) ) {
38
-        $wpdb->query( "UPDATE " . $wpdb->posts . " SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )" );
36
+    $results = $wpdb->get_results("SELECT ID FROM " . $wpdb->posts . " WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
37
+    if (!empty($results)) {
38
+        $wpdb->query("UPDATE " . $wpdb->posts . " SET post_status = CONCAT( 'wpi-', post_status ) WHERE post_type = 'wpi_invoice' AND post_status IN( 'pending', 'processing', 'onhold', 'refunded', 'cancelled', 'failed', 'renewal' )");
39 39
         
40 40
         // Clean post cache
41
-        foreach ( $results as $row ) {
42
-            clean_post_cache( $row->ID );
41
+        foreach ($results as $row) {
42
+            clean_post_cache($row->ID);
43 43
         }
44 44
     }
45 45
     
46 46
     // Item meta key changes
47 47
     $query = "SELECT DISTINCT post_id FROM " . $wpdb->postmeta . " WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id', '_wpinv_cpt_name', '_wpinv_cpt_singular_name' )";
48
-    $results = $wpdb->get_results( $query );
48
+    $results = $wpdb->get_results($query);
49 49
     
50
-    if ( !empty( $results ) ) {
51
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )" );
52
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'" );
53
-        $wpdb->query( "UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'" );
50
+    if (!empty($results)) {
51
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_id' WHERE meta_key IN( '_wpinv_item_id', '_wpinv_package_id', '_wpinv_post_id' )");
52
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_name' WHERE meta_key = '_wpinv_cpt_name'");
53
+        $wpdb->query("UPDATE " . $wpdb->postmeta . " SET meta_key = '_wpinv_custom_singular_name' WHERE meta_key = '_wpinv_cpt_singular_name'");
54 54
         
55
-        foreach ( $results as $row ) {
56
-            clean_post_cache( $row->post_id );
55
+        foreach ($results as $row) {
56
+            clean_post_cache($row->post_id);
57 57
         }
58 58
     }
59 59
 
@@ -74,79 +74,79 @@  discard block
 block discarded – undo
74 74
 function wpinv_convert_old_subscriptions() {
75 75
     global $wpdb;
76 76
 
77
-    $query = "SELECT ". $wpdb->posts .".ID FROM ". $wpdb->posts ." INNER JOIN ". $wpdb->postmeta ." ON ( ". $wpdb->posts .".ID = ". $wpdb->postmeta .".post_id ) WHERE 1=1  AND ". $wpdb->postmeta .".meta_key = '_wpinv_subscr_status' AND (". $wpdb->postmeta .".meta_value = 'pending' OR ". $wpdb->postmeta .".meta_value = 'active' OR ". $wpdb->postmeta .".meta_value = 'cancelled' OR ". $wpdb->postmeta .".meta_value = 'completed' OR ". $wpdb->postmeta .".meta_value = 'expired' OR ". $wpdb->postmeta .".meta_value = 'trialling' OR ". $wpdb->postmeta .".meta_value = 'failing') AND ". $wpdb->posts .".post_type = 'wpi_invoice' GROUP BY ". $wpdb->posts .".ID ORDER BY ". $wpdb->posts .".ID ASC";
77
+    $query = "SELECT " . $wpdb->posts . ".ID FROM " . $wpdb->posts . " INNER JOIN " . $wpdb->postmeta . " ON ( " . $wpdb->posts . ".ID = " . $wpdb->postmeta . ".post_id ) WHERE 1=1  AND " . $wpdb->postmeta . ".meta_key = '_wpinv_subscr_status' AND (" . $wpdb->postmeta . ".meta_value = 'pending' OR " . $wpdb->postmeta . ".meta_value = 'active' OR " . $wpdb->postmeta . ".meta_value = 'cancelled' OR " . $wpdb->postmeta . ".meta_value = 'completed' OR " . $wpdb->postmeta . ".meta_value = 'expired' OR " . $wpdb->postmeta . ".meta_value = 'trialling' OR " . $wpdb->postmeta . ".meta_value = 'failing') AND " . $wpdb->posts . ".post_type = 'wpi_invoice' GROUP BY " . $wpdb->posts . ".ID ORDER BY " . $wpdb->posts . ".ID ASC";
78 78
 
79
-    $results = $wpdb->get_results( $query );
79
+    $results = $wpdb->get_results($query);
80 80
 
81
-    if ( empty( $results ) ) {
81
+    if (empty($results)) {
82 82
         return;
83 83
     }
84 84
 
85
-    foreach ( $results as $row ) {
86
-        $invoice = new WPInv_Invoice( $row->ID );
85
+    foreach ($results as $row) {
86
+        $invoice = new WPInv_Invoice($row->ID);
87 87
 
88
-        if ( empty( $invoice->ID ) ) {
88
+        if (empty($invoice->ID)) {
89 89
             continue;
90 90
         }
91 91
 
92
-        if ( $invoice->has_status( 'wpi-renewal' ) ) {
92
+        if ($invoice->has_status('wpi-renewal')) {
93 93
             continue;
94 94
         }
95 95
         
96
-        $item = $invoice->get_recurring( true );
96
+        $item = $invoice->get_recurring(true);
97 97
 
98
-        if ( empty( $item ) ) {
98
+        if (empty($item)) {
99 99
             continue;
100 100
         }
101 101
 
102 102
         $is_free_trial          = $invoice->is_free_trial();
103
-        $profile_id             = get_post_meta( $invoice->ID, '_wpinv_subscr_profile_id', true );
104
-        $subscription_status    = get_post_meta( $invoice->ID, '_wpinv_subscr_status', true );
103
+        $profile_id             = get_post_meta($invoice->ID, '_wpinv_subscr_profile_id', true);
104
+        $subscription_status    = get_post_meta($invoice->ID, '_wpinv_subscr_status', true);
105 105
         $transaction_id         = $invoice->get_transaction_id();
106 106
 
107 107
         // Last invoice
108
-        $query          = "SELECT ID, post_date FROM ". $wpdb->posts ." WHERE post_type = 'wpi_invoice' AND post_parent = '" . $invoice->ID . "' ORDER BY ID DESC LIMIT 1";
109
-        $last_payment   = $wpdb->get_row( $query );
108
+        $query          = "SELECT ID, post_date FROM " . $wpdb->posts . " WHERE post_type = 'wpi_invoice' AND post_parent = '" . $invoice->ID . "' ORDER BY ID DESC LIMIT 1";
109
+        $last_payment   = $wpdb->get_row($query);
110 110
 
111
-        if ( !empty( $last_payment ) ) {
112
-            $invoice_date       = $last_payment->post_date;
111
+        if (!empty($last_payment)) {
112
+            $invoice_date = $last_payment->post_date;
113 113
             
114
-            $meta_profile_id     = get_post_meta( $last_payment->ID, '_wpinv_subscr_profile_id', true );
115
-            $meta_transaction_id = get_post_meta( $last_payment->ID, '_wpinv_transaction_id', true );
114
+            $meta_profile_id     = get_post_meta($last_payment->ID, '_wpinv_subscr_profile_id', true);
115
+            $meta_transaction_id = get_post_meta($last_payment->ID, '_wpinv_transaction_id', true);
116 116
 
117
-            if ( !empty( $meta_profile_id ) ) {
118
-                $profile_id  = $meta_profile_id;
117
+            if (!empty($meta_profile_id)) {
118
+                $profile_id = $meta_profile_id;
119 119
             }
120 120
 
121
-            if ( !empty( $meta_transaction_id ) ) {
122
-                $transaction_id  = $meta_transaction_id;
121
+            if (!empty($meta_transaction_id)) {
122
+                $transaction_id = $meta_transaction_id;
123 123
             }
124 124
         } else {
125
-            $invoice_date       = $invoice->get_invoice_date( false );
125
+            $invoice_date       = $invoice->get_invoice_date(false);
126 126
         }
127 127
         
128
-        $profile_id             = empty( $profile_id ) ? $invoice->ID : $profile_id;
129
-        $status                 = empty( $subscription_status ) ? 'pending' : $subscription_status;
128
+        $profile_id             = empty($profile_id) ? $invoice->ID : $profile_id;
129
+        $status                 = empty($subscription_status) ? 'pending' : $subscription_status;
130 130
         
131
-        $period                 = $item->get_recurring_period( true );
131
+        $period                 = $item->get_recurring_period(true);
132 132
         $interval               = $item->get_recurring_interval();
133 133
         $bill_times             = (int)$item->get_recurring_limit();
134 134
         $add_period             = $interval . ' ' . $period;
135 135
         $trial_period           = '';
136 136
 
137
-        if ( $invoice->is_free_trial() ) {
138
-            $trial_period       = $item->get_trial_period( true );
137
+        if ($invoice->is_free_trial()) {
138
+            $trial_period       = $item->get_trial_period(true);
139 139
             $free_interval      = $item->get_trial_interval();
140 140
             $trial_period       = $free_interval . ' ' . $trial_period;
141 141
 
142
-            if ( empty( $last_payment ) ) {
142
+            if (empty($last_payment)) {
143 143
                 $add_period     = $trial_period;
144 144
             }
145 145
         }
146 146
 
147
-        $expiration             = date_i18n( 'Y-m-d H:i:s', strtotime( '+' . $add_period  . ' 23:59:59', strtotime( $invoice_date ) ) );
148
-        if ( strtotime( $expiration ) <  strtotime( date_i18n( 'Y-m-d' ) ) ) {
149
-            if ( $status == 'active' || $status == 'trialling' || $status == 'pending' ) {
147
+        $expiration = date_i18n('Y-m-d H:i:s', strtotime('+' . $add_period . ' 23:59:59', strtotime($invoice_date)));
148
+        if (strtotime($expiration) < strtotime(date_i18n('Y-m-d'))) {
149
+            if ($status == 'active' || $status == 'trialling' || $status == 'pending') {
150 150
                 $status = 'expired';
151 151
             }
152 152
         }
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
             'frequency'         => $interval,
160 160
             'period'            => $period,
161 161
             'initial_amount'    => $invoice->get_total(),
162
-            'recurring_amount'  => $invoice->get_recurring_details( 'total' ),
162
+            'recurring_amount'  => $invoice->get_recurring_details('total'),
163 163
             'bill_times'        => $bill_times,
164 164
             'created'           => $invoice_date,
165 165
             'expiration'        => $expiration,
@@ -169,14 +169,14 @@  discard block
 block discarded – undo
169 169
         );
170 170
 
171 171
         $subs_db      = new WPInv_Subscriptions_DB;
172
-        $subs         = $subs_db->get_subscriptions( array( 'parent_payment_id' => $invoice->ID, 'number' => 1 ) );
173
-        $subscription = reset( $subs );
172
+        $subs         = $subs_db->get_subscriptions(array('parent_payment_id' => $invoice->ID, 'number' => 1));
173
+        $subscription = reset($subs);
174 174
 
175
-        if ( empty( $subscription ) || $subscription->id <= 0 ) {
175
+        if (empty($subscription) || $subscription->id <= 0) {
176 176
             $subscription = new WPInv_Subscription();
177
-            $new_sub = $subscription->create( $args );
177
+            $new_sub = $subscription->create($args);
178 178
 
179
-            if ( !empty( $bill_times ) && $new_sub->get_times_billed() >= $bill_times && ( 'active' == $new_sub->status || 'trialling' == $new_sub->status ) ) {
179
+            if (!empty($bill_times) && $new_sub->get_times_billed() >= $bill_times && ('active' == $new_sub->status || 'trialling' == $new_sub->status)) {
180 180
                 $new_sub->complete(); // Mark completed if all times billed
181 181
             }
182 182
         }
@@ -186,20 +186,20 @@  discard block
 block discarded – undo
186 186
 function wpinv_update_new_email_settings() {
187 187
     global $wpinv_options;
188 188
 
189
-    $current_options = get_option( 'wpinv_settings', array() );
189
+    $current_options = get_option('wpinv_settings', array());
190 190
     $options = array(
191
-        'email_new_invoice_body' => __( '<p>Hi Admin,</p><p>You have received payment invoice from {name}.</p>', 'invoicing' ),
192
-        'email_cancelled_invoice_body' => __( '<p>Hi Admin,</p><p>The invoice #{invoice_number} from {site_title} has been cancelled.</p>', 'invoicing' ),
193
-        'email_failed_invoice_body' => __( '<p>Hi Admin,</p><p>Payment for invoice #{invoice_number} from {site_title} has been failed.</p>', 'invoicing' ),
194
-        'email_onhold_invoice_body' => __( '<p>Hi {name},</p><p>Your invoice is on-hold until we confirm your payment has been received.</p>', 'invoicing' ),
195
-        'email_processing_invoice_body' => __( '<p>Hi {name},</p><p>Your invoice has been received at {site_title} and is now being processed.</p>', 'invoicing' ),
196
-        'email_refunded_invoice_body' => __( '<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing' ),
197
-        'email_user_invoice_body' => __( '<p>Hi {name},</p><p>An invoice has been created for you on {site_title}. To view / pay for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ),
198
-        'email_user_note_body' => __( '<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing' ),
199
-        'email_overdue_body' => __( '<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing' ),
191
+        'email_new_invoice_body' => __('<p>Hi Admin,</p><p>You have received payment invoice from {name}.</p>', 'invoicing'),
192
+        'email_cancelled_invoice_body' => __('<p>Hi Admin,</p><p>The invoice #{invoice_number} from {site_title} has been cancelled.</p>', 'invoicing'),
193
+        'email_failed_invoice_body' => __('<p>Hi Admin,</p><p>Payment for invoice #{invoice_number} from {site_title} has been failed.</p>', 'invoicing'),
194
+        'email_onhold_invoice_body' => __('<p>Hi {name},</p><p>Your invoice is on-hold until we confirm your payment has been received.</p>', 'invoicing'),
195
+        'email_processing_invoice_body' => __('<p>Hi {name},</p><p>Your invoice has been received at {site_title} and is now being processed.</p>', 'invoicing'),
196
+        'email_refunded_invoice_body' => __('<p>Hi {name},</p><p>Your invoice on {site_title} has been refunded.</p>', 'invoicing'),
197
+        'email_user_invoice_body' => __('<p>Hi {name},</p><p>An invoice has been created for you on {site_title}. To view / pay for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'),
198
+        'email_user_note_body' => __('<p>Hi {name},</p><p>Following note has been added to your {invoice_label}:</p><blockquote class="wpinv-note">{customer_note}</blockquote>', 'invoicing'),
199
+        'email_overdue_body' => __('<p>Hi {full_name},</p><p>This is just a friendly reminder that your invoice <a href="{invoice_link}">#{invoice_number}</a> {is_was} due on {invoice_due_date}.</p><p>The total of this invoice is {invoice_total}</p><p>To view / pay now for this invoice please use the following link: <a class="btn btn-success" href="{invoice_link}">View / Pay</a></p>', 'invoicing'),
200 200
     );
201 201
 
202
-    foreach ($options as $option => $value){
202
+    foreach ($options as $option => $value) {
203 203
         if (!isset($current_options[$option])) {
204 204
             $current_options[$option] = $value;
205 205
         }
@@ -207,5 +207,5 @@  discard block
 block discarded – undo
207 207
 
208 208
     $wpinv_options = $current_options;
209 209
 
210
-    update_option( 'wpinv_settings', $current_options );
210
+    update_option('wpinv_settings', $current_options);
211 211
 }
212 212
\ No newline at end of file
Please login to merge, or discard this patch.
includes/admin/meta-boxes/class-mb-invoice-items.php 1 patch
Spacing   +155 added lines, -155 removed lines patch added patch discarded remove patch
@@ -1,47 +1,47 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // MUST have WordPress.
3
-if ( !defined( 'WPINC' ) ) {
4
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
3
+if (!defined('WPINC')) {
4
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
5 5
 }
6 6
 
7 7
 class WPInv_Meta_Box_Items {
8
-    public static function output( $post ) {
8
+    public static function output($post) {
9 9
         global $wpinv_euvat, $ajax_cart_details;
10 10
 
11
-        $post_id            = !empty( $post->ID ) ? $post->ID : 0;
12
-        $invoice            = new WPInv_Invoice( $post_id );
11
+        $post_id            = !empty($post->ID) ? $post->ID : 0;
12
+        $invoice            = new WPInv_Invoice($post_id);
13 13
         $ajax_cart_details  = $invoice->get_cart_details();
14
-        $subtotal           = $invoice->get_subtotal( true );
14
+        $subtotal           = $invoice->get_subtotal(true);
15 15
         $discount_raw       = $invoice->get_discount();
16
-        $discount           = wpinv_price( $discount_raw, $invoice->get_currency() );
16
+        $discount           = wpinv_price($discount_raw, $invoice->get_currency());
17 17
         $discounts          = $discount_raw > 0 ? $invoice->get_discounts() : '';
18
-        $tax                = $invoice->get_tax( true );
19
-        $total              = $invoice->get_total( true );
18
+        $tax                = $invoice->get_tax(true);
19
+        $total              = $invoice->get_total(true);
20 20
         $item_quantities    = wpinv_item_quantities_enabled();
21 21
         $use_taxes          = wpinv_use_taxes();
22
-        if ( !$use_taxes && (float)$invoice->get_tax() > 0 ) {
22
+        if (!$use_taxes && (float)$invoice->get_tax() > 0) {
23 23
             $use_taxes = true;
24 24
         }
25
-        $item_types         = apply_filters( 'wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post );
25
+        $item_types         = apply_filters('wpinv_item_types_for_quick_add_item', wpinv_get_item_types(), $post);
26 26
         $is_recurring       = $invoice->is_recurring();
27 27
         $post_type_object   = get_post_type_object($invoice->post_type);
28 28
         $type_title         = $post_type_object->labels->singular_name;
29 29
 
30 30
         $cols = 5;
31
-        if ( $item_quantities ) {
31
+        if ($item_quantities) {
32 32
             $cols++;
33 33
         }
34
-        if ( $use_taxes ) {
34
+        if ($use_taxes) {
35 35
             $cols++;
36 36
         }
37 37
         $class = '';
38
-        if ( $invoice->is_paid() ) {
38
+        if ($invoice->is_paid()) {
39 39
             $class .= ' wpinv-paid';
40 40
         }
41
-        if ( $invoice->is_refunded() ) {
41
+        if ($invoice->is_refunded()) {
42 42
             $class .= ' wpinv-refunded';
43 43
         }
44
-        if ( $is_recurring ) {
44
+        if ($is_recurring) {
45 45
             $class .= ' wpi-recurring';
46 46
         }
47 47
         ?>
@@ -49,21 +49,21 @@  discard block
 block discarded – undo
49 49
             <table id="wpinv_items" class="wpinv-items" cellspacing="0" cellpadding="0">
50 50
                 <thead>
51 51
                     <tr>
52
-                        <th class="id"><?php _e( 'ID', 'invoicing' );?></th>
53
-                        <th class="title"><?php _e( 'Item', 'invoicing' );?></th>
54
-                        <th class="price"><?php _e( 'Price', 'invoicing' );?></th>
55
-                        <?php if ( $item_quantities ) { ?>
56
-                        <th class="qty"><?php _e( 'Qty', 'invoicing' );?></th>
52
+                        <th class="id"><?php _e('ID', 'invoicing'); ?></th>
53
+                        <th class="title"><?php _e('Item', 'invoicing'); ?></th>
54
+                        <th class="price"><?php _e('Price', 'invoicing'); ?></th>
55
+                        <?php if ($item_quantities) { ?>
56
+                        <th class="qty"><?php _e('Qty', 'invoicing'); ?></th>
57 57
                         <?php } ?>
58
-                        <th class="total"><?php _e( 'Total', 'invoicing' );?></th>
59
-                        <?php if ( $use_taxes ) { ?>
60
-                        <th class="tax"><?php _e( 'Tax (%)', 'invoicing' );?></th>
58
+                        <th class="total"><?php _e('Total', 'invoicing'); ?></th>
59
+                        <?php if ($use_taxes) { ?>
60
+                        <th class="tax"><?php _e('Tax (%)', 'invoicing'); ?></th>
61 61
                         <?php } ?>
62 62
                         <th class="action"></th>
63 63
                     </tr>
64 64
                 </thead>
65 65
                 <tbody class="wpinv-line-items">
66
-                    <?php echo wpinv_admin_get_line_items( $invoice ); ?>
66
+                    <?php echo wpinv_admin_get_line_items($invoice); ?>
67 67
                 </tbody>
68 68
                 <tfoot class="wpinv-totals">
69 69
                     <tr>
@@ -74,45 +74,45 @@  discard block
 block discarded – undo
74 74
                                         <td class="id">
75 75
                                         </td>
76 76
                                         <td class="title">
77
-                                            <input type="text" class="regular-text" placeholder="<?php _e( 'Item Name', 'invoicing' ); ?>" value="" name="_wpinv_quick[name]">
78
-                                            <?php if ( $wpinv_euvat->allow_vat_rules() ) { ?>
77
+                                            <input type="text" class="regular-text" placeholder="<?php _e('Item Name', 'invoicing'); ?>" value="" name="_wpinv_quick[name]">
78
+                                            <?php if ($wpinv_euvat->allow_vat_rules()) { ?>
79 79
                                             <div class="wp-clearfix">
80 80
                                                 <label class="wpi-vat-rule">
81
-                                                    <span class="title"><?php _e( 'VAT rule type', 'invoicing' );?></span>
81
+                                                    <span class="title"><?php _e('VAT rule type', 'invoicing'); ?></span>
82 82
                                                     <span class="input-text-wrap">
83
-                                                        <?php echo wpinv_html_select( array(
83
+                                                        <?php echo wpinv_html_select(array(
84 84
                                                             'options'          => $wpinv_euvat->get_rules(),
85 85
                                                             'name'             => '_wpinv_quick[vat_rule]',
86 86
                                                             'id'               => '_wpinv_quick_vat_rule',
87 87
                                                             'show_option_all'  => false,
88 88
                                                             'show_option_none' => false,
89 89
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-rule',
90
-                                                        ) ); ?>
90
+                                                        )); ?>
91 91
                                                     </span>
92 92
                                                 </label>
93 93
                                             </div>
94
-                                            <?php } if ( $wpinv_euvat->allow_vat_classes() ) { ?>
94
+                                            <?php } if ($wpinv_euvat->allow_vat_classes()) { ?>
95 95
                                             <div class="wp-clearfix">
96 96
                                                 <label class="wpi-vat-class">
97
-                                                    <span class="title"><?php _e( 'VAT class', 'invoicing' );?></span>
97
+                                                    <span class="title"><?php _e('VAT class', 'invoicing'); ?></span>
98 98
                                                     <span class="input-text-wrap">
99
-                                                        <?php echo wpinv_html_select( array(
99
+                                                        <?php echo wpinv_html_select(array(
100 100
                                                             'options'          => $wpinv_euvat->get_all_classes(),
101 101
                                                             'name'             => '_wpinv_quick[vat_class]',
102 102
                                                             'id'               => '_wpinv_quick_vat_class',
103 103
                                                             'show_option_all'  => false,
104 104
                                                             'show_option_none' => false,
105 105
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-vat-class',
106
-                                                        ) ); ?>
106
+                                                        )); ?>
107 107
                                                     </span>
108 108
                                                 </label>
109 109
                                             </div>
110 110
                                             <?php } ?>
111 111
                                             <div class="wp-clearfix">
112 112
                                                 <label class="wpi-item-type">
113
-                                                    <span class="title"><?php _e( 'Item type', 'invoicing' );?></span>
113
+                                                    <span class="title"><?php _e('Item type', 'invoicing'); ?></span>
114 114
                                                     <span class="input-text-wrap">
115
-                                                        <?php echo wpinv_html_select( array(
115
+                                                        <?php echo wpinv_html_select(array(
116 116
                                                             'options'          => $item_types,
117 117
                                                             'name'             => '_wpinv_quick[type]',
118 118
                                                             'id'               => '_wpinv_quick_type',
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
                                                             'show_option_all'  => false,
121 121
                                                             'show_option_none' => false,
122 122
                                                             'class'            => 'gdmbx2-text-medium wpinv-quick-type',
123
-                                                        ) ); ?>
123
+                                                        )); ?>
124 124
                                                     </span>
125 125
                                                 </label>
126 126
                                             </div>
@@ -133,11 +133,11 @@  discard block
 block discarded – undo
133 133
                                             </div>
134 134
                                         </td>
135 135
                                         <td class="price"><input type="text" placeholder="0.00" class="wpi-field-price wpi-price" name="_wpinv_quick[price]" /></td>
136
-                                        <?php if ( $item_quantities ) { ?>
136
+                                        <?php if ($item_quantities) { ?>
137 137
                                         <td class="qty"><input type="number" class="small-text" step="1" min="1" value="1" name="_wpinv_quick[qty]" /></td>
138 138
                                         <?php } ?>
139 139
                                         <td class="total"></td>
140
-                                        <?php if ( $use_taxes ) { ?>
140
+                                        <?php if ($use_taxes) { ?>
141 141
                                         <td class="tax"></td>
142 142
                                         <?php } ?>
143 143
                                         <td class="action"></td>
@@ -150,29 +150,29 @@  discard block
 block discarded – undo
150 150
                         <td colspan="<?php echo $cols; ?>"></td>
151 151
                     </tr>
152 152
                     <tr class="totals">
153
-                        <td colspan="<?php echo ( $cols - 4 ); ?>"></td>
153
+                        <td colspan="<?php echo ($cols - 4); ?>"></td>
154 154
                         <td colspan="4">
155 155
                             <table cellspacing="0" cellpadding="0">
156 156
                                 <tr class="subtotal">
157
-                                    <td class="name"><?php _e( 'Sub Total:', 'invoicing' );?></td>
158
-                                    <td class="total"><?php echo $subtotal;?></td>
157
+                                    <td class="name"><?php _e('Sub Total:', 'invoicing'); ?></td>
158
+                                    <td class="total"><?php echo $subtotal; ?></td>
159 159
                                     <td class="action"></td>
160 160
                                 </tr>
161 161
                                 <tr class="discount">
162
-                                    <td class="name"><?php wpinv_get_discount_label( wpinv_discount_code( $invoice->ID ) ); ?>:</td>
163
-                                    <td class="total"><?php echo wpinv_discount( $invoice->ID, true, true ); ?></td>
162
+                                    <td class="name"><?php wpinv_get_discount_label(wpinv_discount_code($invoice->ID)); ?>:</td>
163
+                                    <td class="total"><?php echo wpinv_discount($invoice->ID, true, true); ?></td>
164 164
                                     <td class="action"></td>
165 165
                                 </tr>
166
-                                <?php if ( $use_taxes ) { ?>
166
+                                <?php if ($use_taxes) { ?>
167 167
                                 <tr class="tax">
168
-                                    <td class="name"><?php _e( 'Tax:', 'invoicing' );?></td>
169
-                                    <td class="total"><?php echo $tax;?></td>
168
+                                    <td class="name"><?php _e('Tax:', 'invoicing'); ?></td>
169
+                                    <td class="total"><?php echo $tax; ?></td>
170 170
                                     <td class="action"></td>
171 171
                                 </tr>
172 172
                                 <?php } ?>
173 173
                                 <tr class="total">
174
-                                    <td class="name"><?php echo apply_filters( 'wpinv_invoice_items_total_label', __( 'Invoice Total:', 'invoicing' ), $invoice );?></td>
175
-                                    <td class="total"><?php echo $total;?></td>
174
+                                    <td class="name"><?php echo apply_filters('wpinv_invoice_items_total_label', __('Invoice Total:', 'invoicing'), $invoice); ?></td>
175
+                                    <td class="total"><?php echo $total; ?></td>
176 176
                                     <td class="action"></td>
177 177
                                 </tr>
178 178
                             </table>
@@ -183,89 +183,89 @@  discard block
 block discarded – undo
183 183
             <div class="wpinv-actions">
184 184
                 <?php ob_start(); ?>
185 185
                 <?php
186
-                    if ( !$invoice->is_paid() && !$invoice->is_refunded() ) {
187
-                        if ( !$invoice->is_recurring() ) {
188
-                            echo wpinv_item_dropdown( array(
186
+                    if (!$invoice->is_paid() && !$invoice->is_refunded()) {
187
+                        if (!$invoice->is_recurring()) {
188
+                            echo wpinv_item_dropdown(array(
189 189
                                 'name'             => 'wpinv_invoice_item',
190 190
                                 'id'               => 'wpinv_invoice_item',
191 191
                                 'show_recurring'   => true,
192
-                            ) );
192
+                            ));
193 193
                     ?>
194
-                <input type="button" value="<?php echo sprintf(esc_attr__( 'Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e( 'Create new item', 'invoicing' );?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e( 'Recalculate Totals', 'invoicing' );?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">
194
+                <input type="button" value="<?php echo sprintf(esc_attr__('Add item to %s', 'invoicing'), $type_title); ?>" class="button button-primary" id="wpinv-add-item"><input type="button" value="<?php esc_attr_e('Create new item', 'invoicing'); ?>" class="button button-primary" id="wpinv-new-item"><?php } ?><input type="button" value="<?php esc_attr_e('Recalculate Totals', 'invoicing'); ?>" class="button button-primary wpinv-flr" id="wpinv-recalc-totals">
195 195
                     <?php } ?>
196
-                <?php do_action( 'wpinv_invoice_items_actions', $invoice ); ?>
197
-                <?php $item_actions = ob_get_clean(); echo apply_filters( 'wpinv_invoice_items_actions_content', $item_actions, $invoice, $post ); ?>
196
+                <?php do_action('wpinv_invoice_items_actions', $invoice); ?>
197
+                <?php $item_actions = ob_get_clean(); echo apply_filters('wpinv_invoice_items_actions_content', $item_actions, $invoice, $post); ?>
198 198
             </div>
199 199
         </div>
200 200
         <?php
201 201
     }
202 202
 
203
-    public static function prices( $post ) {        
203
+    public static function prices($post) {        
204 204
         $symbol         = wpinv_currency_symbol();
205 205
         $position       = wpinv_currency_position();
206
-        $item           = new WPInv_Item( $post->ID );
206
+        $item           = new WPInv_Item($post->ID);
207 207
 
208 208
         $price          = $item->get_price();
209 209
         $is_recurring   = $item->is_recurring();
210 210
         $period         = $item->get_recurring_period();
211
-        $interval       = absint( $item->get_recurring_interval() );
212
-        $times          = absint( $item->get_recurring_limit() );
211
+        $interval       = absint($item->get_recurring_interval());
212
+        $times          = absint($item->get_recurring_limit());
213 213
         $free_trial     = $item->has_free_trial();
214 214
         $trial_interval = $item->get_trial_interval();
215 215
         $trial_period   = $item->get_trial_period();
216 216
 
217 217
         $intervals      = array();
218
-        for ( $i = 1; $i <= 90; $i++ ) {
218
+        for ($i = 1; $i <= 90; $i++) {
219 219
             $intervals[$i] = $i;
220 220
         }
221 221
 
222
-        $interval       = $interval > 0 ? $interval : 1;
222
+        $interval = $interval > 0 ? $interval : 1;
223 223
 
224 224
         $class = $is_recurring ? 'wpinv-recurring-y' : 'wpinv-recurring-n';
225 225
         ?>
226
-        <p class="wpinv-row-prices"><?php echo ( $position != 'right' ? $symbol . '&nbsp;' : '' );?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount( 0 ); ?>" value="<?php echo $price;?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled( $item->is_editable(), false ); ?> /><?php echo ( $position == 'right' ? '&nbsp;' . $symbol : '' );?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce( 'wpinv_item_meta_box_save' ) ;?>" />
227
-        <?php do_action( 'wpinv_prices_metabox_price', $item ); ?>
226
+        <p class="wpinv-row-prices"><?php echo ($position != 'right' ? $symbol . '&nbsp;' : ''); ?><input type="text" maxlength="12" placeholder="<?php echo wpinv_sanitize_amount(0); ?>" value="<?php echo $price; ?>" id="wpinv_item_price" name="wpinv_item_price" class="medium-text wpi-field-price wpi-price" <?php disabled($item->is_editable(), false); ?> /><?php echo ($position == 'right' ? '&nbsp;' . $symbol : ''); ?><input type="hidden" name="wpinv_vat_meta_box_nonce" value="<?php echo wp_create_nonce('wpinv_item_meta_box_save'); ?>" />
227
+        <?php do_action('wpinv_prices_metabox_price', $item); ?>
228 228
         </p>
229 229
         <p class="wpinv-row-is-recurring">
230 230
             <label for="wpinv_is_recurring">
231
-                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked( 1, $is_recurring ); ?> />
232
-                <?php echo apply_filters( 'wpinv_is_recurring_toggle_text', __( 'Is Recurring Item?', 'invoicing' ) ); ?>
231
+                <input type="checkbox" name="wpinv_is_recurring" id="wpinv_is_recurring" value="1" <?php checked(1, $is_recurring); ?> />
232
+                <?php echo apply_filters('wpinv_is_recurring_toggle_text', __('Is Recurring Item?', 'invoicing')); ?>
233 233
             </label>
234
-            <?php do_action( 'wpinv_prices_metabox_is_recurring_field', $item ); ?>
234
+            <?php do_action('wpinv_prices_metabox_is_recurring_field', $item); ?>
235 235
         </p>
236
-        <p class="wpinv-row-recurring-fields <?php echo $class;?>">
237
-            <label class="wpinv-period" for="wpinv_recurring_period"><?php _e( 'Recurring', 'invoicing' );?> <select class="wpinv-select " id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e( 'day(s)', 'invoicing' ); ?>" <?php selected( 'D', $period );?>><?php _e( 'Daily', 'invoicing' ); ?></option><option value="W" data-text="<?php esc_attr_e( 'week(s)', 'invoicing' ); ?>" <?php selected( 'W', $period );?>><?php _e( 'Weekly', 'invoicing' ); ?></option><option value="M" data-text="<?php esc_attr_e( 'month(s)', 'invoicing' ); ?>" <?php selected( 'M', $period );?>><?php _e( 'Monthly', 'invoicing' ); ?></option><option value="Y" data-text="<?php esc_attr_e( 'year(s)', 'invoicing' ); ?>" <?php selected( 'Y', $period );?>><?php _e( 'Yearly', 'invoicing' ); ?></option></select></label>
238
-            <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e( 'at every', 'invoicing' );?> <?php echo wpinv_html_select( array(
236
+        <p class="wpinv-row-recurring-fields <?php echo $class; ?>">
237
+            <label class="wpinv-period" for="wpinv_recurring_period"><?php _e('Recurring', 'invoicing'); ?> <select class="wpinv-select " id="wpinv_recurring_period" name="wpinv_recurring_period"><option value="D" data-text="<?php esc_attr_e('day(s)', 'invoicing'); ?>" <?php selected('D', $period); ?>><?php _e('Daily', 'invoicing'); ?></option><option value="W" data-text="<?php esc_attr_e('week(s)', 'invoicing'); ?>" <?php selected('W', $period); ?>><?php _e('Weekly', 'invoicing'); ?></option><option value="M" data-text="<?php esc_attr_e('month(s)', 'invoicing'); ?>" <?php selected('M', $period); ?>><?php _e('Monthly', 'invoicing'); ?></option><option value="Y" data-text="<?php esc_attr_e('year(s)', 'invoicing'); ?>" <?php selected('Y', $period); ?>><?php _e('Yearly', 'invoicing'); ?></option></select></label>
238
+            <label class="wpinv-interval" for="wpinv_recurring_interval"> <?php _e('at every', 'invoicing'); ?> <?php echo wpinv_html_select(array(
239 239
                 'options'          => $intervals,
240 240
                 'name'             => 'wpinv_recurring_interval',
241 241
                 'id'               => 'wpinv_recurring_interval',
242 242
                 'selected'         => $interval,
243 243
                 'show_option_all'  => false,
244 244
                 'show_option_none' => false
245
-            ) ); ?> <span id="wpinv_interval_text"><?php _e( 'day(s)', 'invoicing' );?></span></label>
246
-            <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e( 'for', 'invoicing' );?> <input class="small-text" type="number" value="<?php echo $times;?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e( 'time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing' );?></label>
245
+            )); ?> <span id="wpinv_interval_text"><?php _e('day(s)', 'invoicing'); ?></span></label>
246
+            <label class="wpinv-times" for="wpinv_recurring_limit"> <?php _e('for', 'invoicing'); ?> <input class="small-text" type="number" value="<?php echo $times; ?>" size="4" id="wpinv_recurring_limit" name="wpinv_recurring_limit" step="1" min="0"> <?php _e('time(s) <i>(select 0 for recurring forever until cancelled</i>)', 'invoicing'); ?></label>
247 247
             <span class="clear wpi-trial-clr"></span>
248 248
             <label class="wpinv-free-trial" for="wpinv_free_trial">
249
-                <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked( true, (bool)$free_trial ); ?> /> 
250
-                <?php echo __( 'Offer free trial for', 'invoicing' ); ?>
249
+                <input type="checkbox" name="wpinv_free_trial" id="wpinv_free_trial" value="1" <?php checked(true, (bool)$free_trial); ?> /> 
250
+                <?php echo __('Offer free trial for', 'invoicing'); ?>
251 251
             </label>
252 252
             <label class="wpinv-trial-interval" for="wpinv_trial_interval">
253
-                <input class="small-text" type="number" value="<?php echo $trial_interval;?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected( 'D', $trial_period );?>><?php _e( 'day(s)', 'invoicing' ); ?></option><option value="W" <?php selected( 'W', $trial_period );?>><?php _e( 'week(s)', 'invoicing' ); ?></option><option value="M" <?php selected( 'M', $trial_period );?>><?php _e( 'month(s)', 'invoicing' ); ?></option><option value="Y" <?php selected( 'Y', $trial_period );?>><?php _e( 'year(s)', 'invoicing' ); ?></option></select>
253
+                <input class="small-text" type="number" value="<?php echo $trial_interval; ?>" size="4" id="wpinv_trial_interval" name="wpinv_trial_interval" step="1" min="1"> <select class="wpinv-select" id="wpinv_trial_period" name="wpinv_trial_period"><option value="D" <?php selected('D', $trial_period); ?>><?php _e('day(s)', 'invoicing'); ?></option><option value="W" <?php selected('W', $trial_period); ?>><?php _e('week(s)', 'invoicing'); ?></option><option value="M" <?php selected('M', $trial_period); ?>><?php _e('month(s)', 'invoicing'); ?></option><option value="Y" <?php selected('Y', $trial_period); ?>><?php _e('year(s)', 'invoicing'); ?></option></select>
254 254
             </label>
255
-            <?php do_action( 'wpinv_prices_metabox_recurring_fields', $item ); ?>
255
+            <?php do_action('wpinv_prices_metabox_recurring_fields', $item); ?>
256 256
         </p>
257
-        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type( $post->ID ); ?>" />
258
-        <?php do_action( 'wpinv_item_price_field', $post->ID ); ?>
257
+        <input type="hidden" id="_wpi_current_type" value="<?php echo wpinv_get_item_type($post->ID); ?>" />
258
+        <?php do_action('wpinv_item_price_field', $post->ID); ?>
259 259
         <?php
260 260
     }
261 261
 
262
-    public static function vat_rules( $post ) {
262
+    public static function vat_rules($post) {
263 263
         global $wpinv_euvat;
264 264
 
265
-        $rule_type = $wpinv_euvat->get_item_rule( $post->ID );
265
+        $rule_type = $wpinv_euvat->get_item_rule($post->ID);
266 266
         ?>
267
-        <p><label for="wpinv_vat_rules"><strong><?php _e( 'Select how VAT rules will be applied:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
268
-        <?php echo wpinv_html_select( array(
267
+        <p><label for="wpinv_vat_rules"><strong><?php _e('Select how VAT rules will be applied:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
268
+        <?php echo wpinv_html_select(array(
269 269
                     'options'          => $wpinv_euvat->get_rules(),
270 270
                     'name'             => 'wpinv_vat_rules',
271 271
                     'id'               => 'wpinv_vat_rules',
@@ -273,19 +273,19 @@  discard block
 block discarded – undo
273 273
                     'show_option_all'  => false,
274 274
                     'show_option_none' => false,
275 275
                     'class'            => 'gdmbx2-text-medium wpinv-vat-rules',
276
-                ) ); ?>
276
+                )); ?>
277 277
         </p>
278
-        <p class="wpi-m0"><?php _e( 'When you select physical product rules, only consumers and businesses in your country will be charged VAT.  The VAT rate used will be the rate in your country.', 'invoicing' ); ?></p>
279
-        <p class="wpi-m0"><?php _e( 'If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer.  Only businesses in your country will be charged VAT.', 'invoicing' ); ?></p>
278
+        <p class="wpi-m0"><?php _e('When you select physical product rules, only consumers and businesses in your country will be charged VAT.  The VAT rate used will be the rate in your country.', 'invoicing'); ?></p>
279
+        <p class="wpi-m0"><?php _e('If you select Digital product rules, VAT will be charged at the rate that applies in the country of the consumer.  Only businesses in your country will be charged VAT.', 'invoicing'); ?></p>
280 280
         <?php
281 281
     }
282 282
 
283
-    public static function vat_classes( $post ) {
283
+    public static function vat_classes($post) {
284 284
         global $wpinv_euvat;
285 285
         
286
-        $vat_class = $wpinv_euvat->get_item_class( $post->ID );
286
+        $vat_class = $wpinv_euvat->get_item_class($post->ID);
287 287
         ?>
288
-        <p><?php echo wpinv_html_select( array(
288
+        <p><?php echo wpinv_html_select(array(
289 289
                     'options'          => $wpinv_euvat->get_all_classes(),
290 290
                     'name'             => 'wpinv_vat_class',
291 291
                     'id'               => 'wpinv_vat_class',
@@ -293,18 +293,18 @@  discard block
 block discarded – undo
293 293
                     'show_option_all'  => false,
294 294
                     'show_option_none' => false,
295 295
                     'class'            => 'gdmbx2-text-medium wpinv-vat-class',
296
-                ) ); ?>
296
+                )); ?>
297 297
         </p>
298
-        <p class="wpi-m0"><?php _e( 'Select the VAT rate class to use for this invoice item.', 'invoicing' ); ?></p>
298
+        <p class="wpi-m0"><?php _e('Select the VAT rate class to use for this invoice item.', 'invoicing'); ?></p>
299 299
         <?php
300 300
     }
301 301
 
302
-    public static function item_info( $post ) {
303
-        $item_type = wpinv_get_item_type( $post->ID );
304
-        do_action( 'wpinv_item_info_metabox_before', $post );
302
+    public static function item_info($post) {
303
+        $item_type = wpinv_get_item_type($post->ID);
304
+        do_action('wpinv_item_info_metabox_before', $post);
305 305
         ?>
306
-        <p><label for="wpinv_item_type"><strong><?php _e( 'Type:', 'invoicing' );?></strong></label>&nbsp;&nbsp;&nbsp;
307
-        <?php echo wpinv_html_select( array(
306
+        <p><label for="wpinv_item_type"><strong><?php _e('Type:', 'invoicing'); ?></strong></label>&nbsp;&nbsp;&nbsp;
307
+        <?php echo wpinv_html_select(array(
308 308
                     'options'          => wpinv_get_item_types(),
309 309
                     'name'             => 'wpinv_item_type',
310 310
                     'id'               => 'wpinv_item_type',
@@ -312,114 +312,114 @@  discard block
 block discarded – undo
312 312
                     'show_option_all'  => false,
313 313
                     'show_option_none' => false,
314 314
                     'class'            => 'gdmbx2-text-medium wpinv-item-type',
315
-                ) ); ?>
315
+                )); ?>
316 316
         </p>
317
-        <p class="wpi-m0"><?php _e( 'Select item type.', 'invoicing' );?><br><?php _e( '<b>Standard:</b> Standard item type', 'invoicing' );?><br><?php _e( '<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing' );?></p>
317
+        <p class="wpi-m0"><?php _e('Select item type.', 'invoicing'); ?><br><?php _e('<b>Standard:</b> Standard item type', 'invoicing'); ?><br><?php _e('<b>Fee:</b> Like Registration Fee, Sign up Fee etc.', 'invoicing'); ?></p>
318 318
         <?php
319
-        do_action( 'wpinv_item_info_metabox_after', $post );
319
+        do_action('wpinv_item_info_metabox_after', $post);
320 320
     }
321 321
 
322
-    public static function meta_values( $post ) {
323
-        $meta_keys = apply_filters( 'wpinv_show_meta_values_for_keys', array(
322
+    public static function meta_values($post) {
323
+        $meta_keys = apply_filters('wpinv_show_meta_values_for_keys', array(
324 324
             'type',
325 325
             'custom_id'
326
-        ) );
326
+        ));
327 327
 
328
-        if ( empty( $meta_keys ) ) {
328
+        if (empty($meta_keys)) {
329 329
             return;
330 330
         }
331 331
 
332
-        do_action( 'wpinv_meta_values_metabox_before', $post );
332
+        do_action('wpinv_meta_values_metabox_before', $post);
333 333
 
334
-        foreach ( $meta_keys as $meta_key ) {
334
+        foreach ($meta_keys as $meta_key) {
335 335
             ?>
336
-            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta( $post->ID, '_wpinv_' . $meta_key, true ); ?></label></p>
336
+            <p class="wpi-mtb05"><label><strong><?php echo $meta_key; ?></strong>: <?php echo get_post_meta($post->ID, '_wpinv_' . $meta_key, true); ?></label></p>
337 337
             <?php 
338 338
         }
339 339
 
340
-        do_action( 'wpinv_meta_values_metabox_after', $post );
340
+        do_action('wpinv_meta_values_metabox_after', $post);
341 341
     }
342 342
 
343
-    public static function save( $post_id, $data, $post ) {
344
-        $invoice        = new WPInv_Invoice( $post_id );
343
+    public static function save($post_id, $data, $post) {
344
+        $invoice        = new WPInv_Invoice($post_id);
345 345
 
346 346
         // Billing
347
-        $first_name     = sanitize_text_field( $data['wpinv_first_name'] );
348
-        $last_name      = sanitize_text_field( $data['wpinv_last_name'] );
349
-        $company        = sanitize_text_field( $data['wpinv_company'] );
350
-        $vat_number     = sanitize_text_field( $data['wpinv_vat_number'] );
351
-        $phone          = sanitize_text_field( $data['wpinv_phone'] );
352
-        $address        = sanitize_text_field( $data['wpinv_address'] );
353
-        $city           = sanitize_text_field( $data['wpinv_city'] );
354
-        $zip            = sanitize_text_field( $data['wpinv_zip'] );
355
-        $country        = sanitize_text_field( $data['wpinv_country'] );
356
-        $state          = sanitize_text_field( $data['wpinv_state'] );
347
+        $first_name     = sanitize_text_field($data['wpinv_first_name']);
348
+        $last_name      = sanitize_text_field($data['wpinv_last_name']);
349
+        $company        = sanitize_text_field($data['wpinv_company']);
350
+        $vat_number     = sanitize_text_field($data['wpinv_vat_number']);
351
+        $phone          = sanitize_text_field($data['wpinv_phone']);
352
+        $address        = sanitize_text_field($data['wpinv_address']);
353
+        $city           = sanitize_text_field($data['wpinv_city']);
354
+        $zip            = sanitize_text_field($data['wpinv_zip']);
355
+        $country        = sanitize_text_field($data['wpinv_country']);
356
+        $state          = sanitize_text_field($data['wpinv_state']);
357 357
 
358 358
         // Details
359
-        $status         = sanitize_text_field( $data['wpinv_status'] );
360
-        $old_status     = !empty( $data['original_post_status'] ) ? sanitize_text_field( $data['original_post_status'] ) : $status;
361
-        $number         = sanitize_text_field( $data['wpinv_number'] );
362
-        $due_date       = isset( $data['wpinv_due_date'] ) ? sanitize_text_field( $data['wpinv_due_date'] ) : '';
359
+        $status         = sanitize_text_field($data['wpinv_status']);
360
+        $old_status     = !empty($data['original_post_status']) ? sanitize_text_field($data['original_post_status']) : $status;
361
+        $number         = sanitize_text_field($data['wpinv_number']);
362
+        $due_date       = isset($data['wpinv_due_date']) ? sanitize_text_field($data['wpinv_due_date']) : '';
363 363
         //$discounts      = sanitize_text_field( $data['wpinv_discounts'] );
364 364
         //$discount       = sanitize_text_field( $data['wpinv_discount'] );
365 365
 
366
-        $ip             = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
366
+        $ip = $invoice->get_ip() ? $invoice->get_ip() : wpinv_get_ip();
367 367
 
368
-        $invoice->set( 'due_date', $due_date );
369
-        $invoice->set( 'first_name', $first_name );
370
-        $invoice->set( 'last_name', $last_name );
371
-        $invoice->set( 'company', $company );
372
-        $invoice->set( 'vat_number', $vat_number );
373
-        $invoice->set( 'phone', $phone );
374
-        $invoice->set( 'address', $address );
375
-        $invoice->set( 'city', $city );
376
-        $invoice->set( 'zip', $zip );
377
-        $invoice->set( 'country', $country );
378
-        $invoice->set( 'state', $state );
379
-        $invoice->set( 'status', $status );
368
+        $invoice->set('due_date', $due_date);
369
+        $invoice->set('first_name', $first_name);
370
+        $invoice->set('last_name', $last_name);
371
+        $invoice->set('company', $company);
372
+        $invoice->set('vat_number', $vat_number);
373
+        $invoice->set('phone', $phone);
374
+        $invoice->set('address', $address);
375
+        $invoice->set('city', $city);
376
+        $invoice->set('zip', $zip);
377
+        $invoice->set('country', $country);
378
+        $invoice->set('state', $state);
379
+        $invoice->set('status', $status);
380 380
         //$invoice->set( 'number', $number );
381 381
         //$invoice->set( 'discounts', $discounts );
382 382
         //$invoice->set( 'discount', $discount );
383
-        $invoice->set( 'ip', $ip );
383
+        $invoice->set('ip', $ip);
384 384
         $invoice->old_status = $_POST['original_post_status'];
385 385
         $invoice->currency = wpinv_get_currency();
386
-        if ( !empty( $data['wpinv_gateway'] ) ) {
387
-            $invoice->set( 'gateway', sanitize_text_field( $data['wpinv_gateway'] ) );
386
+        if (!empty($data['wpinv_gateway'])) {
387
+            $invoice->set('gateway', sanitize_text_field($data['wpinv_gateway']));
388 388
         }
389 389
         $saved = $invoice->save();
390 390
 
391 391
         // Check for payment notes
392
-        if ( !empty( $data['invoice_note'] ) ) {
393
-            $note               = wp_kses( $data['invoice_note'], array() );
394
-            $note_type          = sanitize_text_field( $data['invoice_note_type'] );
392
+        if (!empty($data['invoice_note'])) {
393
+            $note               = wp_kses($data['invoice_note'], array());
394
+            $note_type          = sanitize_text_field($data['invoice_note_type']);
395 395
             $is_customer_note   = $note_type == 'customer' ? 1 : 0;
396 396
 
397
-            wpinv_insert_payment_note( $invoice->ID, $note, $is_customer_note );
397
+            wpinv_insert_payment_note($invoice->ID, $note, $is_customer_note);
398 398
         }
399 399
 
400 400
         // Update user address if empty.
401
-        if ( $saved && !empty( $invoice ) ) {
402
-            if ( $user_id = $invoice->get_user_id() ) {
403
-                $user_address = wpinv_get_user_address( $user_id, false );
401
+        if ($saved && !empty($invoice)) {
402
+            if ($user_id = $invoice->get_user_id()) {
403
+                $user_address = wpinv_get_user_address($user_id, false);
404 404
 
405 405
                 if (empty($user_address['first_name'])) {
406
-                    update_user_meta( $user_id, '_wpinv_first_name', $first_name );
407
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
406
+                    update_user_meta($user_id, '_wpinv_first_name', $first_name);
407
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
408 408
                 } else if (empty($user_address['last_name']) && $user_address['first_name'] == $first_name) {
409
-                    update_user_meta( $user_id, '_wpinv_last_name', $last_name );
409
+                    update_user_meta($user_id, '_wpinv_last_name', $last_name);
410 410
                 }
411 411
 
412 412
                 if (empty($user_address['address']) || empty($user_address['city']) || empty($user_address['state']) || empty($user_address['country'])) {
413
-                    update_user_meta( $user_id, '_wpinv_address', $address );
414
-                    update_user_meta( $user_id, '_wpinv_city', $city );
415
-                    update_user_meta( $user_id, '_wpinv_state', $state );
416
-                    update_user_meta( $user_id, '_wpinv_country', $country );
417
-                    update_user_meta( $user_id, '_wpinv_zip', $zip );
418
-                    update_user_meta( $user_id, '_wpinv_phone', $phone );
413
+                    update_user_meta($user_id, '_wpinv_address', $address);
414
+                    update_user_meta($user_id, '_wpinv_city', $city);
415
+                    update_user_meta($user_id, '_wpinv_state', $state);
416
+                    update_user_meta($user_id, '_wpinv_country', $country);
417
+                    update_user_meta($user_id, '_wpinv_zip', $zip);
418
+                    update_user_meta($user_id, '_wpinv_phone', $phone);
419 419
                 }
420 420
             }
421 421
 
422
-            do_action( 'wpinv_invoice_metabox_saved', $invoice );
422
+            do_action('wpinv_invoice_metabox_saved', $invoice);
423 423
         }
424 424
 
425 425
         return $saved;
Please login to merge, or discard this patch.
includes/admin/class-wpinv-users.php 2 patches
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  */
8 8
  
9 9
 // MUST have WordPress.
10
-if ( !defined( 'WPINC' ) ) {
11
-    exit( 'Do NOT access this file directly: ' . basename( __FILE__ ) );
10
+if (!defined('WPINC')) {
11
+    exit('Do NOT access this file directly: ' . basename(__FILE__));
12 12
 }
13 13
 
14 14
 class WPInv_Admin_Users {
15 15
     private static $instance;
16 16
     
17 17
     public static function run() {
18
-        if ( !isset( self::$instance ) && !( self::$instance instanceof WPInv_Admin_Users ) ) {
18
+        if (!isset(self::$instance) && !(self::$instance instanceof WPInv_Admin_Users)) {
19 19
             self::$instance = new WPInv_Admin_Users;
20 20
         }
21 21
 
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     }
24 24
     
25 25
     public function __construct() {
26
-        add_filter( 'manage_users_columns', array( $this, 'wpinv_add_user_column') );
27
-        add_filter( 'manage_users_custom_column', array( $this, 'wpinv_user_column_content') , 10, 3 );
26
+        add_filter('manage_users_columns', array($this, 'wpinv_add_user_column'));
27
+        add_filter('manage_users_custom_column', array($this, 'wpinv_user_column_content'), 10, 3);
28 28
     }
29 29
 
30 30
     /**
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @return mixed
36 36
      */
37
-    public function wpinv_add_user_column( $column ) {
38
-        $column['wpinvoicing'] = __('Invoicing','invoicing');
37
+    public function wpinv_add_user_column($column) {
38
+        $column['wpinvoicing'] = __('Invoicing', 'invoicing');
39 39
         return $column;
40 40
     }
41 41
 
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
      *
49 49
      * @return string
50 50
      */
51
-    function wpinv_user_column_content( $val, $column_name, $user_id ) {
51
+    function wpinv_user_column_content($val, $column_name, $user_id) {
52 52
         switch ($column_name) {
53 53
             case 'wpinvoicing' :
54
-                return $this->get_user_invoices( $user_id );
54
+                return $this->get_user_invoices($user_id);
55 55
                 break;
56 56
             default:
57 57
         }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      *
66 66
      * @return string
67 67
      */
68
-    public function get_user_invoices($user_id){
68
+    public function get_user_invoices($user_id) {
69 69
         $output = '';
70 70
         $wp_query_args = array(
71 71
             'post_type'      => 'wpi_invoice',
@@ -74,14 +74,14 @@  discard block
 block discarded – undo
74 74
             'fields'         => 'ids',
75 75
             'author'         => $user_id,
76 76
         );
77
-        $invoices = new WP_Query( $wp_query_args );
78
-        $count = absint( $invoices->found_posts );
77
+        $invoices = new WP_Query($wp_query_args);
78
+        $count = absint($invoices->found_posts);
79 79
 
80
-        if(empty($count)){
81
-            $output .= __('No Invoice(s)','invoicing');
82
-        }else{
83
-            $link_url = admin_url( "edit.php?post_type=wpi_invoice&author=".absint($user_id) );
84
-            $link_text = sprintf( __('Invoices ( %d )', 'invoicing'), $count );
80
+        if (empty($count)) {
81
+            $output .= __('No Invoice(s)', 'invoicing');
82
+        } else {
83
+            $link_url = admin_url("edit.php?post_type=wpi_invoice&author=" . absint($user_id));
84
+            $link_text = sprintf(__('Invoices ( %d )', 'invoicing'), $count);
85 85
             $output .= "<a href='$link_url' >$link_text</a>";
86 86
         }
87 87
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
         if(empty($count)){
81 81
             $output .= __('No Invoice(s)','invoicing');
82
-        }else{
82
+        } else{
83 83
             $link_url = admin_url( "edit.php?post_type=wpi_invoice&author=".absint($user_id) );
84 84
             $link_text = sprintf( __('Invoices ( %d )', 'invoicing'), $count );
85 85
             $output .= "<a href='$link_url' >$link_text</a>";
Please login to merge, or discard this patch.
vendor/composer/autoload_static.php 2 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -28,6 +28,9 @@
 block discarded – undo
28 28
         'WP_Super_Duper' => __DIR__ . '/..' . '/ayecode/wp-super-duper/wp-super-duper.php',
29 29
     );
30 30
 
31
+    /**
32
+     * @return callable
33
+     */
31 34
     public static function getInitializer(ClassLoader $loader)
32 35
     {
33 36
         return \Closure::bind(function () use ($loader) {
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,31 +6,31 @@
 block discarded – undo
6 6
 
7 7
 class ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5
8 8
 {
9
-    public static $files = array (
9
+    public static $files = array(
10 10
         '24583d3588ebda5228dd453cfaa070da' => __DIR__ . '/..' . '/ayecode/wp-font-awesome-settings/wp-font-awesome-settings.php',
11 11
     );
12 12
 
13
-    public static $prefixLengthsPsr4 = array (
13
+    public static $prefixLengthsPsr4 = array(
14 14
         'C' => 
15
-        array (
15
+        array(
16 16
             'Composer\\Installers\\' => 20,
17 17
         ),
18 18
     );
19 19
 
20
-    public static $prefixDirsPsr4 = array (
20
+    public static $prefixDirsPsr4 = array(
21 21
         'Composer\\Installers\\' => 
22
-        array (
22
+        array(
23 23
             0 => __DIR__ . '/..' . '/composer/installers/src/Composer/Installers',
24 24
         ),
25 25
     );
26 26
 
27
-    public static $classMap = array (
27
+    public static $classMap = array(
28 28
         'WP_Super_Duper' => __DIR__ . '/..' . '/ayecode/wp-super-duper/wp-super-duper.php',
29 29
     );
30 30
 
31 31
     public static function getInitializer(ClassLoader $loader)
32 32
     {
33
-        return \Closure::bind(function () use ($loader) {
33
+        return \Closure::bind(function() use ($loader) {
34 34
             $loader->prefixLengthsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixLengthsPsr4;
35 35
             $loader->prefixDirsPsr4 = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$prefixDirsPsr4;
36 36
             $loader->classMap = ComposerStaticInit8b6d4385c391849a80038f0b0e87c8b5::$classMap;
Please login to merge, or discard this patch.
vendor/composer/ClassLoader.php 2 patches
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -367,6 +367,10 @@
 block discarded – undo
367 367
         return $file;
368 368
     }
369 369
 
370
+    /**
371
+     * @param string $class
372
+     * @param string $ext
373
+     */
370 374
     private function findFileWithExtension($class, $ext)
371 375
     {
372 376
         // PSR-4 lookup
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
         if (!$prefix) {
112 112
             if ($prepend) {
113 113
                 $this->fallbackDirsPsr0 = array_merge(
114
-                    (array) $paths,
114
+                    (array)$paths,
115 115
                     $this->fallbackDirsPsr0
116 116
                 );
117 117
             } else {
118 118
                 $this->fallbackDirsPsr0 = array_merge(
119 119
                     $this->fallbackDirsPsr0,
120
-                    (array) $paths
120
+                    (array)$paths
121 121
                 );
122 122
             }
123 123
 
@@ -126,19 +126,19 @@  discard block
 block discarded – undo
126 126
 
127 127
         $first = $prefix[0];
128 128
         if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
-            $this->prefixesPsr0[$first][$prefix] = (array) $paths;
129
+            $this->prefixesPsr0[$first][$prefix] = (array)$paths;
130 130
 
131 131
             return;
132 132
         }
133 133
         if ($prepend) {
134 134
             $this->prefixesPsr0[$first][$prefix] = array_merge(
135
-                (array) $paths,
135
+                (array)$paths,
136 136
                 $this->prefixesPsr0[$first][$prefix]
137 137
             );
138 138
         } else {
139 139
             $this->prefixesPsr0[$first][$prefix] = array_merge(
140 140
                 $this->prefixesPsr0[$first][$prefix],
141
-                (array) $paths
141
+                (array)$paths
142 142
             );
143 143
         }
144 144
     }
@@ -159,13 +159,13 @@  discard block
 block discarded – undo
159 159
             // Register directories for the root namespace.
160 160
             if ($prepend) {
161 161
                 $this->fallbackDirsPsr4 = array_merge(
162
-                    (array) $paths,
162
+                    (array)$paths,
163 163
                     $this->fallbackDirsPsr4
164 164
                 );
165 165
             } else {
166 166
                 $this->fallbackDirsPsr4 = array_merge(
167 167
                     $this->fallbackDirsPsr4,
168
-                    (array) $paths
168
+                    (array)$paths
169 169
                 );
170 170
             }
171 171
         } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
@@ -175,18 +175,18 @@  discard block
 block discarded – undo
175 175
                 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176 176
             }
177 177
             $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
178
+            $this->prefixDirsPsr4[$prefix] = (array)$paths;
179 179
         } elseif ($prepend) {
180 180
             // Prepend directories for an already registered namespace.
181 181
             $this->prefixDirsPsr4[$prefix] = array_merge(
182
-                (array) $paths,
182
+                (array)$paths,
183 183
                 $this->prefixDirsPsr4[$prefix]
184 184
             );
185 185
         } else {
186 186
             // Append directories for an already registered namespace.
187 187
             $this->prefixDirsPsr4[$prefix] = array_merge(
188 188
                 $this->prefixDirsPsr4[$prefix],
189
-                (array) $paths
189
+                (array)$paths
190 190
             );
191 191
         }
192 192
     }
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
     public function set($prefix, $paths)
202 202
     {
203 203
         if (!$prefix) {
204
-            $this->fallbackDirsPsr0 = (array) $paths;
204
+            $this->fallbackDirsPsr0 = (array)$paths;
205 205
         } else {
206
-            $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
206
+            $this->prefixesPsr0[$prefix[0]][$prefix] = (array)$paths;
207 207
         }
208 208
     }
209 209
 
@@ -219,14 +219,14 @@  discard block
 block discarded – undo
219 219
     public function setPsr4($prefix, $paths)
220 220
     {
221 221
         if (!$prefix) {
222
-            $this->fallbackDirsPsr4 = (array) $paths;
222
+            $this->fallbackDirsPsr4 = (array)$paths;
223 223
         } else {
224 224
             $length = strlen($prefix);
225 225
             if ('\\' !== $prefix[$length - 1]) {
226 226
                 throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227 227
             }
228 228
             $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
-            $this->prefixDirsPsr4[$prefix] = (array) $paths;
229
+            $this->prefixDirsPsr4[$prefix] = (array)$paths;
230 230
         }
231 231
     }
232 232
 
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
             return false;
343 343
         }
344 344
         if (null !== $this->apcuPrefix) {
345
-            $file = apcu_fetch($this->apcuPrefix.$class, $hit);
345
+            $file = apcu_fetch($this->apcuPrefix . $class, $hit);
346 346
             if ($hit) {
347 347
                 return $file;
348 348
             }
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
         }
357 357
 
358 358
         if (null !== $this->apcuPrefix) {
359
-            apcu_add($this->apcuPrefix.$class, $file);
359
+            apcu_add($this->apcuPrefix . $class, $file);
360 360
         }
361 361
 
362 362
         if (false === $file) {
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/CakePHPInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@
 block discarded – undo
35 35
     public function getLocations()
36 36
     {
37 37
         if ($this->matchesCakeVersion('>=', '3.0.0')) {
38
-            $this->locations['plugin'] =  $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
38
+            $this->locations['plugin'] = $this->composer->getConfig()->get('vendor-dir') . '/{$vendor}/{$name}/';
39 39
         }
40 40
         return $this->locations;
41 41
     }
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/OxidInstaller.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
 
6 6
 class OxidInstaller extends BaseInstaller
7 7
 {
8
-	const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
8
+    const VENDOR_PATTERN = '/^modules\/(?P<vendor>.+)\/.+/';
9 9
 
10 10
     protected $locations = array(
11 11
         'module'    => 'modules/{$name}/',
@@ -13,47 +13,47 @@  discard block
 block discarded – undo
13 13
         'out'    => 'out/{$name}/',
14 14
     );
15 15
 
16
-	/**
17
-	 * getInstallPath
18
-	 *
19
-	 * @param PackageInterface $package
20
-	 * @param string $frameworkType
21
-	 * @return void
22
-	 */
23
-	public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
-	{
25
-		$installPath = parent::getInstallPath($package, $frameworkType);
26
-		$type = $this->package->getType();
27
-		if ($type === 'oxid-module') {
28
-			$this->prepareVendorDirectory($installPath);
29
-		}
30
-		return $installPath;
31
-	}
16
+    /**
17
+     * getInstallPath
18
+     *
19
+     * @param PackageInterface $package
20
+     * @param string $frameworkType
21
+     * @return void
22
+     */
23
+    public function getInstallPath(PackageInterface $package, $frameworkType = '')
24
+    {
25
+        $installPath = parent::getInstallPath($package, $frameworkType);
26
+        $type = $this->package->getType();
27
+        if ($type === 'oxid-module') {
28
+            $this->prepareVendorDirectory($installPath);
29
+        }
30
+        return $installPath;
31
+    }
32 32
 
33
-	/**
34
-	 * prepareVendorDirectory
35
-	 *
36
-	 * Makes sure there is a vendormetadata.php file inside
37
-	 * the vendor folder if there is a vendor folder.
38
-	 *
39
-	 * @param string $installPath
40
-	 * @return void
41
-	 */
42
-	protected function prepareVendorDirectory($installPath)
43
-	{
44
-		$matches = '';
45
-		$hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
-		if (!$hasVendorDirectory) {
47
-			return;
48
-		}
33
+    /**
34
+     * prepareVendorDirectory
35
+     *
36
+     * Makes sure there is a vendormetadata.php file inside
37
+     * the vendor folder if there is a vendor folder.
38
+     *
39
+     * @param string $installPath
40
+     * @return void
41
+     */
42
+    protected function prepareVendorDirectory($installPath)
43
+    {
44
+        $matches = '';
45
+        $hasVendorDirectory = preg_match(self::VENDOR_PATTERN, $installPath, $matches);
46
+        if (!$hasVendorDirectory) {
47
+            return;
48
+        }
49 49
 
50
-		$vendorDirectory = $matches['vendor'];
51
-		$vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
-		if (!file_exists($vendorPath)) {
53
-			mkdir($vendorPath, 0755, true);
54
-		}
50
+        $vendorDirectory = $matches['vendor'];
51
+        $vendorPath = getcwd() . '/modules/' . $vendorDirectory;
52
+        if (!file_exists($vendorPath)) {
53
+            mkdir($vendorPath, 0755, true);
54
+        }
55 55
 
56
-		$vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
-		touch($vendorMetaDataPath);
58
-	}
56
+        $vendorMetaDataPath = $vendorPath . '/vendormetadata.php';
57
+        touch($vendorMetaDataPath);
58
+    }
59 59
 }
Please login to merge, or discard this patch.
vendor/composer/installers/src/Composer/Installers/GravInstaller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@
 block discarded – undo
20 20
         $restrictedWords = implode('|', array_keys($this->locations));
21 21
 
22 22
         $vars['name'] = strtolower($vars['name']);
23
-        $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:'.$restrictedWords.')-)?(.*?)(?:-(?:'.$restrictedWords.'))?$/ui',
23
+        $vars['name'] = preg_replace('/^(?:grav-)?(?:(?:' . $restrictedWords . ')-)?(.*?)(?:-(?:' . $restrictedWords . '))?$/ui',
24 24
             '$1',
25 25
             $vars['name']
26 26
         );
Please login to merge, or discard this patch.