@@ -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; |
@@ -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 | * The service class responsible for interacting with MaxMind databases. |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | * |
| 36 | 36 | * @param string|null $database_prefix A prefix for the MaxMind database filename. |
| 37 | 37 | */ |
| 38 | - public function __construct( $database_prefix ) { |
|
| 38 | + public function __construct($database_prefix) { |
|
| 39 | 39 | $this->database_prefix = $database_prefix; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | public function get_database_path() { |
| 48 | 48 | $uploads_dir = wp_upload_dir(); |
| 49 | 49 | |
| 50 | - $database_path = trailingslashit( $uploads_dir['basedir'] ) . 'invoicing/'; |
|
| 51 | - if ( ! empty( $this->database_prefix ) ) { |
|
| 50 | + $database_path = trailingslashit($uploads_dir['basedir']) . 'invoicing/'; |
|
| 51 | + if (!empty($this->database_prefix)) { |
|
| 52 | 52 | $database_path .= $this->database_prefix . '-'; |
| 53 | 53 | } |
| 54 | 54 | $database_path .= self::DATABASE . self::DATABASE_EXTENSION; |
| 55 | 55 | |
| 56 | 56 | // Filter the geolocation database storage path. |
| 57 | - return apply_filters( 'getpaid_maxmind_geolocation_database_path', $database_path ); |
|
| 57 | + return apply_filters('getpaid_maxmind_geolocation_database_path', $database_path); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -63,12 +63,12 @@ discard block |
||
| 63 | 63 | * @param string $license_key The license key to be used when downloading the database. |
| 64 | 64 | * @return string|WP_Error The path to the database file or an error if invalid. |
| 65 | 65 | */ |
| 66 | - public function download_database( $license_key ) { |
|
| 66 | + public function download_database($license_key) { |
|
| 67 | 67 | |
| 68 | 68 | $download_uri = add_query_arg( |
| 69 | 69 | array( |
| 70 | 70 | 'edition_id' => self::DATABASE, |
| 71 | - 'license_key' => urlencode( wpinv_clean( $license_key ) ), |
|
| 71 | + 'license_key' => urlencode(wpinv_clean($license_key)), |
|
| 72 | 72 | 'suffix' => 'tar.gz', |
| 73 | 73 | ), |
| 74 | 74 | 'https://download.maxmind.com/app/geoip_download' |
@@ -77,23 +77,23 @@ discard block |
||
| 77 | 77 | // Needed for the download_url call right below. |
| 78 | 78 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
| 79 | 79 | |
| 80 | - $tmp_archive_path = download_url( esc_url_raw( $download_uri ) ); |
|
| 80 | + $tmp_archive_path = download_url(esc_url_raw($download_uri)); |
|
| 81 | 81 | |
| 82 | - if ( is_wp_error( $tmp_archive_path ) ) { |
|
| 82 | + if (is_wp_error($tmp_archive_path)) { |
|
| 83 | 83 | // Transform the error into something more informative. |
| 84 | 84 | $error_data = $tmp_archive_path->get_error_data(); |
| 85 | - if ( isset( $error_data['code'] ) && $error_data['code'] == 401 ) { |
|
| 85 | + if (isset($error_data['code']) && $error_data['code'] == 401) { |
|
| 86 | 86 | return new WP_Error( |
| 87 | 87 | 'getpaid_maxmind_geolocation_database_license_key', |
| 88 | - __( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' ) |
|
| 88 | + __('The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing') |
|
| 89 | 89 | ); |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - return new WP_Error( 'getpaid_maxmind_geolocation_database_download', __( 'Failed to download the MaxMind database.', 'invoicing' ) ); |
|
| 92 | + return new WP_Error('getpaid_maxmind_geolocation_database_download', __('Failed to download the MaxMind database.', 'invoicing')); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | // Extract the database from the archive. |
| 96 | - return $this->extract_downloaded_database( $tmp_archive_path ); |
|
| 96 | + return $this->extract_downloaded_database($tmp_archive_path); |
|
| 97 | 97 | |
| 98 | 98 | } |
| 99 | 99 | |
@@ -103,27 +103,27 @@ discard block |
||
| 103 | 103 | * @param string $tmp_archive_path The database archive path. |
| 104 | 104 | * @return string|WP_Error The path to the database file or an error if invalid. |
| 105 | 105 | */ |
| 106 | - protected function extract_downloaded_database( $tmp_archive_path ) { |
|
| 106 | + protected function extract_downloaded_database($tmp_archive_path) { |
|
| 107 | 107 | |
| 108 | 108 | // Extract the database from the archive. |
| 109 | 109 | $tmp_database_path = ''; |
| 110 | 110 | |
| 111 | 111 | try { |
| 112 | 112 | |
| 113 | - $file = new PharData( $tmp_archive_path ); |
|
| 114 | - $tmp_database_path = trailingslashit( dirname( $tmp_archive_path ) ) . trailingslashit( $file->current()->getFilename() ) . self::DATABASE . self::DATABASE_EXTENSION; |
|
| 113 | + $file = new PharData($tmp_archive_path); |
|
| 114 | + $tmp_database_path = trailingslashit(dirname($tmp_archive_path)) . trailingslashit($file->current()->getFilename()) . self::DATABASE . self::DATABASE_EXTENSION; |
|
| 115 | 115 | |
| 116 | 116 | $file->extractTo( |
| 117 | - dirname( $tmp_archive_path ), |
|
| 118 | - trailingslashit( $file->current()->getFilename() ) . self::DATABASE . self::DATABASE_EXTENSION, |
|
| 117 | + dirname($tmp_archive_path), |
|
| 118 | + trailingslashit($file->current()->getFilename()) . self::DATABASE . self::DATABASE_EXTENSION, |
|
| 119 | 119 | true |
| 120 | 120 | ); |
| 121 | 121 | |
| 122 | - } catch ( Exception $exception ) { |
|
| 123 | - return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() ); |
|
| 122 | + } catch (Exception $exception) { |
|
| 123 | + return new WP_Error('invoicing_maxmind_geolocation_database_archive', $exception->getMessage()); |
|
| 124 | 124 | } finally { |
| 125 | 125 | // Remove the archive since we only care about a single file in it. |
| 126 | - unlink( $tmp_archive_path ); |
|
| 126 | + unlink($tmp_archive_path); |
|
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | return $tmp_database_path; |
@@ -135,29 +135,29 @@ discard block |
||
| 135 | 135 | * @param string $ip_address The IP address to find the country code for. |
| 136 | 136 | * @return string The country code for the IP address, or empty if not found. |
| 137 | 137 | */ |
| 138 | - public function get_iso_country_code_for_ip( $ip_address ) { |
|
| 138 | + public function get_iso_country_code_for_ip($ip_address) { |
|
| 139 | 139 | $country_code = ''; |
| 140 | 140 | |
| 141 | - if ( ! class_exists( 'MaxMind\Db\Reader' ) ) { |
|
| 141 | + if (!class_exists('MaxMind\Db\Reader')) { |
|
| 142 | 142 | return $country_code; |
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $database_path = $this->get_database_path(); |
| 146 | - if ( ! file_exists( $database_path ) ) { |
|
| 146 | + if (!file_exists($database_path)) { |
|
| 147 | 147 | return $country_code; |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | try { |
| 151 | - $reader = new MaxMind\Db\Reader( $database_path ); |
|
| 152 | - $data = $reader->get( $ip_address ); |
|
| 151 | + $reader = new MaxMind\Db\Reader($database_path); |
|
| 152 | + $data = $reader->get($ip_address); |
|
| 153 | 153 | |
| 154 | - if ( isset( $data['country']['iso_code'] ) ) { |
|
| 154 | + if (isset($data['country']['iso_code'])) { |
|
| 155 | 155 | $country_code = $data['country']['iso_code']; |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | $reader->close(); |
| 159 | - } catch ( Exception $e ) { |
|
| 160 | - wpinv_error_log( $e->getMessage(), 'SOURCE: MaxMind GeoLocation' ); |
|
| 159 | + } catch (Exception $e) { |
|
| 160 | + wpinv_error_log($e->getMessage(), 'SOURCE: MaxMind GeoLocation'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | return $country_code; |
@@ -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 | * @deprecated |
@@ -38,15 +38,15 @@ discard block |
||
| 38 | 38 | /** |
| 39 | 39 | * @deprecated |
| 40 | 40 | */ |
| 41 | - public static function is_eu_state( $country_code ) { |
|
| 42 | - return getpaid_is_eu_state( $country_code ); |
|
| 41 | + public static function is_eu_state($country_code) { |
|
| 42 | + return getpaid_is_eu_state($country_code); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | /** |
| 46 | 46 | * @deprecated |
| 47 | 47 | */ |
| 48 | - public static function is_gst_country( $country_code ) { |
|
| 49 | - return getpaid_is_gst_country( $country_code ); |
|
| 48 | + public static function is_gst_country($country_code) { |
|
| 49 | + return getpaid_is_gst_country($country_code); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | * @version 1.0.19 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | return array( |
| 12 | 12 | 'AT', |
@@ -7,24 +7,24 @@ |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | |
| 14 | - <?php do_action( 'getpaid_before_invoice_details_top', $invoice ); ?> |
|
| 14 | + <?php do_action('getpaid_before_invoice_details_top', $invoice); ?> |
|
| 15 | 15 | |
| 16 | 16 | <div class="getpaid-invoice-details-top mb-5"> |
| 17 | 17 | <div class="row"> |
| 18 | 18 | <div class="col-12 col-sm-6 text-sm-left"> |
| 19 | - <?php do_action( 'getpaid_invoice_details_top_left', $invoice ); ?> |
|
| 19 | + <?php do_action('getpaid_invoice_details_top_left', $invoice); ?> |
|
| 20 | 20 | </div> |
| 21 | 21 | |
| 22 | 22 | <div class="col-12 col-sm-6 text-sm-right"> |
| 23 | - <?php do_action( 'getpaid_invoice_details_top_right', $invoice ); ?> |
|
| 23 | + <?php do_action('getpaid_invoice_details_top_right', $invoice); ?> |
|
| 24 | 24 | </div> |
| 25 | 25 | </div> |
| 26 | 26 | </div> |
| 27 | 27 | |
| 28 | - <?php do_action( 'getpaid_after_invoice_details_top', $invoice ); ?> |
|
| 28 | + <?php do_action('getpaid_after_invoice_details_top', $invoice); ?> |
|
| 29 | 29 | |
| 30 | 30 | <?php |
@@ -7,7 +7,7 @@ discard block |
||
| 7 | 7 | * @version 1.0.19 |
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | -defined( 'ABSPATH' ) || exit; |
|
| 10 | +defined('ABSPATH') || exit; |
|
| 11 | 11 | |
| 12 | 12 | ?> |
| 13 | 13 | |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | <?php |
| 19 | 19 | |
| 20 | 20 | // Fires when printing the header. |
| 21 | - do_action( 'getpaid_invoice_header', $invoice ); |
|
| 21 | + do_action('getpaid_invoice_header', $invoice); |
|
| 22 | 22 | |
| 23 | 23 | // Print the opening wrapper. |
| 24 | 24 | echo '<div class="container bg-white border mt-4 mb-4 p-4 position-relative flex-grow-1">'; |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | wpinv_print_errors(); |
| 28 | 28 | |
| 29 | 29 | // Fires when printing the invoice details. |
| 30 | - do_action( 'getpaid_invoice_details', $invoice ); |
|
| 30 | + do_action('getpaid_invoice_details', $invoice); |
|
| 31 | 31 | |
| 32 | 32 | // Fires when printing the invoice line items. |
| 33 | - do_action( 'getpaid_invoice_line_items', $invoice ); |
|
| 33 | + do_action('getpaid_invoice_line_items', $invoice); |
|
| 34 | 34 | |
| 35 | 35 | // Print the closing wrapper. |
| 36 | 36 | echo '</div>'; |
| 37 | 37 | |
| 38 | 38 | // Fires when printing the invoice footer. |
| 39 | - do_action( 'getpaid_invoice_footer', $invoice ); |
|
| 39 | + do_action('getpaid_invoice_footer', $invoice); |
|
| 40 | 40 | |
| 41 | 41 | ?> |
| 42 | 42 | |
@@ -9,7 +9,7 @@ |
||
| 9 | 9 | * @since 2.0.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * GetPaid REST top earners controller class. |
@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | * @since 1.0.19 |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -defined( 'ABSPATH' ) || exit; |
|
| 9 | +defined('ABSPATH') || exit; |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * The main API class |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | $this->invoice_counts = new GetPaid_REST_Report_Invoice_Counts_Controller(); |
| 97 | 97 | |
| 98 | 98 | // Fires after loading the rest api. |
| 99 | - do_action( 'getpaid_rest_api_loaded', $this ); |
|
| 99 | + do_action('getpaid_rest_api_loaded', $this); |
|
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | * @since 2.0.0 |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | -defined( 'ABSPATH' ) || exit; |
|
| 12 | +defined('ABSPATH') || exit; |
|
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * GetPaid REST invoice counts controller class. |
@@ -32,25 +32,25 @@ discard block |
||
| 32 | 32 | * @param WP_REST_Request $request Request object. |
| 33 | 33 | * @return WP_REST_Response $response Response data. |
| 34 | 34 | */ |
| 35 | - public function prepare_item_for_response( $report, $request ) { |
|
| 35 | + public function prepare_item_for_response($report, $request) { |
|
| 36 | 36 | |
| 37 | 37 | $data = (array) $report; |
| 38 | - $context = ! empty( $request['context'] ) ? $request['context'] : 'view'; |
|
| 39 | - $data = $this->add_additional_fields_to_object( $data, $request ); |
|
| 40 | - $data = $this->filter_response_by_context( $data, $context ); |
|
| 38 | + $context = !empty($request['context']) ? $request['context'] : 'view'; |
|
| 39 | + $data = $this->add_additional_fields_to_object($data, $request); |
|
| 40 | + $data = $this->filter_response_by_context($data, $context); |
|
| 41 | 41 | |
| 42 | 42 | // Wrap the data in a response object. |
| 43 | - $response = rest_ensure_response( $data ); |
|
| 43 | + $response = rest_ensure_response($data); |
|
| 44 | 44 | |
| 45 | 45 | $response->add_links( |
| 46 | 46 | array( |
| 47 | 47 | 'about' => array( |
| 48 | - 'href' => rest_url( sprintf( '%s/reports', $this->namespace ) ), |
|
| 48 | + 'href' => rest_url(sprintf('%s/reports', $this->namespace)), |
|
| 49 | 49 | ), |
| 50 | 50 | ) |
| 51 | 51 | ); |
| 52 | 52 | |
| 53 | - return apply_filters( 'getpaid_rest_prepare_report_invoices_count', $response, $report, $request ); |
|
| 53 | + return apply_filters('getpaid_rest_prepare_report_invoices_count', $response, $report, $request); |
|
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | /** |
@@ -61,12 +61,12 @@ discard block |
||
| 61 | 61 | */ |
| 62 | 62 | protected function get_reports() { |
| 63 | 63 | |
| 64 | - $counts = wp_count_posts( 'wpi_invoice' ); |
|
| 64 | + $counts = wp_count_posts('wpi_invoice'); |
|
| 65 | 65 | $data = array(); |
| 66 | 66 | |
| 67 | - foreach ( wpinv_get_invoice_statuses() as $slug => $name ) { |
|
| 67 | + foreach (wpinv_get_invoice_statuses() as $slug => $name) { |
|
| 68 | 68 | |
| 69 | - if ( ! isset( $counts->$slug ) ) { |
|
| 69 | + if (!isset($counts->$slug)) { |
|
| 70 | 70 | continue; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -94,26 +94,26 @@ discard block |
||
| 94 | 94 | 'type' => 'object', |
| 95 | 95 | 'properties' => array( |
| 96 | 96 | 'slug' => array( |
| 97 | - 'description' => __( 'An alphanumeric identifier for the resource.', 'invoicing' ), |
|
| 97 | + 'description' => __('An alphanumeric identifier for the resource.', 'invoicing'), |
|
| 98 | 98 | 'type' => 'string', |
| 99 | - 'context' => array( 'view' ), |
|
| 99 | + 'context' => array('view'), |
|
| 100 | 100 | 'readonly' => true, |
| 101 | 101 | ), |
| 102 | 102 | 'name' => array( |
| 103 | - 'description' => __( 'Invoice status name.', 'invoicing' ), |
|
| 103 | + 'description' => __('Invoice status name.', 'invoicing'), |
|
| 104 | 104 | 'type' => 'string', |
| 105 | - 'context' => array( 'view' ), |
|
| 105 | + 'context' => array('view'), |
|
| 106 | 106 | 'readonly' => true, |
| 107 | 107 | ), |
| 108 | 108 | 'count' => array( |
| 109 | - 'description' => __( 'Number of invoices.', 'invoicing' ), |
|
| 109 | + 'description' => __('Number of invoices.', 'invoicing'), |
|
| 110 | 110 | 'type' => 'string', |
| 111 | - 'context' => array( 'view' ), |
|
| 111 | + 'context' => array('view'), |
|
| 112 | 112 | 'readonly' => true, |
| 113 | 113 | ), |
| 114 | 114 | ), |
| 115 | 115 | ); |
| 116 | 116 | |
| 117 | - return $this->add_additional_fields_schema( $schema ); |
|
| 117 | + return $this->add_additional_fields_schema($schema); |
|
| 118 | 118 | } |
| 119 | 119 | } |