@@ -56,69 +56,69 @@ |
||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | function wpinv_admin_messages() { |
| 59 | - global $wpinv_options, $pagenow, $post; |
|
| 59 | + global $wpinv_options, $pagenow, $post; |
|
| 60 | 60 | |
| 61 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 62 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
| 63 | - } |
|
| 61 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 62 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
| 63 | + } |
|
| 64 | 64 | |
| 65 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 66 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 67 | - } |
|
| 65 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 66 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 70 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
| 71 | - } |
|
| 69 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 70 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 74 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
| 75 | - } |
|
| 73 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 74 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 78 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 79 | - } |
|
| 77 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 78 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 82 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
| 83 | - } |
|
| 81 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 82 | + add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 86 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
| 87 | - } |
|
| 85 | + if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 86 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
| 87 | + } |
|
| 88 | 88 | |
| 89 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 90 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
| 89 | + if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 90 | + add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
| 94 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
| 94 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
| 98 | 98 | add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 102 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
| 103 | - } |
|
| 101 | + if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 102 | + add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 106 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
| 107 | - } |
|
| 105 | + if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 106 | + add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 110 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
| 111 | - } |
|
| 109 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 110 | + add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
| 111 | + } |
|
| 112 | 112 | |
| 113 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
| 114 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
| 113 | + if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
| 114 | + $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
| 115 | 115 | |
| 116 | - if ( !empty( $message ) ) { |
|
| 117 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
| 118 | - } |
|
| 119 | - } |
|
| 116 | + if ( !empty( $message ) ) { |
|
| 117 | + add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
| 118 | + } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - settings_errors( 'wpinv-notices' ); |
|
| 121 | + settings_errors( 'wpinv-notices' ); |
|
| 122 | 122 | } |
| 123 | 123 | add_action( 'admin_notices', 'wpinv_admin_messages' ); |
| 124 | 124 | |
@@ -45,17 +45,17 @@ |
||
| 45 | 45 | parent::__construct( $options ); |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * The Super block output function. |
|
| 50 | - * |
|
| 51 | - * @param array $args |
|
| 52 | - * @param array $widget_args |
|
| 53 | - * @param string $content |
|
| 54 | - * |
|
| 55 | - * @return mixed|string|bool |
|
| 56 | - */ |
|
| 48 | + /** |
|
| 49 | + * The Super block output function. |
|
| 50 | + * |
|
| 51 | + * @param array $args |
|
| 52 | + * @param array $widget_args |
|
| 53 | + * @param string $content |
|
| 54 | + * |
|
| 55 | + * @return mixed|string|bool |
|
| 56 | + */ |
|
| 57 | 57 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 58 | - return wpinv_checkout_form(); |
|
| 58 | + return wpinv_checkout_form(); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | - exit; // Exit if accessed directly |
|
| 4 | + exit; // Exit if accessed directly |
|
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | /** |
@@ -11,143 +11,143 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | class AUI_Component_Button { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Build the component. |
|
| 16 | - * |
|
| 17 | - * @param array $args |
|
| 18 | - * |
|
| 19 | - * @return string The rendered component. |
|
| 20 | - */ |
|
| 21 | - public static function get($args = array()){ |
|
| 22 | - $defaults = array( |
|
| 23 | - 'type' => 'a', // a, button, badge |
|
| 24 | - 'href' => '#', |
|
| 25 | - 'new_window' => false, |
|
| 26 | - 'class' => 'btn btn-primary', |
|
| 27 | - 'id' => '', |
|
| 28 | - 'title' => '', |
|
| 29 | - 'value' => '', |
|
| 30 | - 'content' => '', |
|
| 31 | - 'icon' => '', |
|
| 32 | - 'hover_content' => '', |
|
| 33 | - 'hover_icon' => '', |
|
| 34 | - 'new_line_after' => true, |
|
| 35 | - 'no_wrap' => true, |
|
| 36 | - 'onclick' => '', |
|
| 37 | - 'style' => '', |
|
| 38 | - 'extra_attributes' => array(), // an array of extra attributes |
|
| 39 | - 'icon_extra_attributes' => array() // an array of icon extra attributes |
|
| 40 | - ); |
|
| 41 | - |
|
| 42 | - /** |
|
| 43 | - * Parse incoming $args into an array and merge it with $defaults |
|
| 44 | - */ |
|
| 45 | - $args = wp_parse_args( $args, $defaults ); |
|
| 46 | - $output = ''; |
|
| 47 | - if ( ! empty( $args['type'] ) ) { |
|
| 48 | - $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; |
|
| 49 | - |
|
| 50 | - // open/type |
|
| 51 | - if($type=='a'){ |
|
| 52 | - $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; |
|
| 53 | - $output .= '<a href="' . $args['href'] . '"'.$new_window; |
|
| 54 | - }elseif($type=='badge'){ |
|
| 55 | - $output .= '<span '; |
|
| 56 | - }else{ |
|
| 57 | - $output .= '<button type="' . $type . '" '; |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - // name |
|
| 61 | - if(!empty($args['name'])){ |
|
| 62 | - $output .= AUI_Component_Helper::name($args['name']); |
|
| 63 | - } |
|
| 64 | - |
|
| 65 | - // id |
|
| 66 | - if(!empty($args['id'])){ |
|
| 67 | - $output .= AUI_Component_Helper::id($args['id']); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - // title |
|
| 71 | - if(!empty($args['title'])){ |
|
| 72 | - $output .= AUI_Component_Helper::title($args['title']); |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - // value |
|
| 76 | - if(!empty($args['value'])){ |
|
| 77 | - $output .= AUI_Component_Helper::value($args['value']); |
|
| 78 | - } |
|
| 79 | - |
|
| 80 | - // class |
|
| 81 | - $class = !empty($args['class']) ? $args['class'] : ''; |
|
| 82 | - $output .= AUI_Component_Helper::class_attr($class); |
|
| 14 | + /** |
|
| 15 | + * Build the component. |
|
| 16 | + * |
|
| 17 | + * @param array $args |
|
| 18 | + * |
|
| 19 | + * @return string The rendered component. |
|
| 20 | + */ |
|
| 21 | + public static function get($args = array()){ |
|
| 22 | + $defaults = array( |
|
| 23 | + 'type' => 'a', // a, button, badge |
|
| 24 | + 'href' => '#', |
|
| 25 | + 'new_window' => false, |
|
| 26 | + 'class' => 'btn btn-primary', |
|
| 27 | + 'id' => '', |
|
| 28 | + 'title' => '', |
|
| 29 | + 'value' => '', |
|
| 30 | + 'content' => '', |
|
| 31 | + 'icon' => '', |
|
| 32 | + 'hover_content' => '', |
|
| 33 | + 'hover_icon' => '', |
|
| 34 | + 'new_line_after' => true, |
|
| 35 | + 'no_wrap' => true, |
|
| 36 | + 'onclick' => '', |
|
| 37 | + 'style' => '', |
|
| 38 | + 'extra_attributes' => array(), // an array of extra attributes |
|
| 39 | + 'icon_extra_attributes' => array() // an array of icon extra attributes |
|
| 40 | + ); |
|
| 41 | + |
|
| 42 | + /** |
|
| 43 | + * Parse incoming $args into an array and merge it with $defaults |
|
| 44 | + */ |
|
| 45 | + $args = wp_parse_args( $args, $defaults ); |
|
| 46 | + $output = ''; |
|
| 47 | + if ( ! empty( $args['type'] ) ) { |
|
| 48 | + $type = $args['type'] != 'a' ? esc_attr($args['type']) : 'a'; |
|
| 49 | + |
|
| 50 | + // open/type |
|
| 51 | + if($type=='a'){ |
|
| 52 | + $new_window = !empty($args['new_window']) ? ' target="_blank" ' : ''; |
|
| 53 | + $output .= '<a href="' . $args['href'] . '"'.$new_window; |
|
| 54 | + }elseif($type=='badge'){ |
|
| 55 | + $output .= '<span '; |
|
| 56 | + }else{ |
|
| 57 | + $output .= '<button type="' . $type . '" '; |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + // name |
|
| 61 | + if(!empty($args['name'])){ |
|
| 62 | + $output .= AUI_Component_Helper::name($args['name']); |
|
| 63 | + } |
|
| 64 | + |
|
| 65 | + // id |
|
| 66 | + if(!empty($args['id'])){ |
|
| 67 | + $output .= AUI_Component_Helper::id($args['id']); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + // title |
|
| 71 | + if(!empty($args['title'])){ |
|
| 72 | + $output .= AUI_Component_Helper::title($args['title']); |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + // value |
|
| 76 | + if(!empty($args['value'])){ |
|
| 77 | + $output .= AUI_Component_Helper::value($args['value']); |
|
| 78 | + } |
|
| 79 | + |
|
| 80 | + // class |
|
| 81 | + $class = !empty($args['class']) ? $args['class'] : ''; |
|
| 82 | + $output .= AUI_Component_Helper::class_attr($class); |
|
| 83 | 83 | |
| 84 | - // data-attributes |
|
| 85 | - $output .= AUI_Component_Helper::data_attributes($args); |
|
| 84 | + // data-attributes |
|
| 85 | + $output .= AUI_Component_Helper::data_attributes($args); |
|
| 86 | 86 | |
| 87 | - // aria-attributes |
|
| 88 | - $output .= AUI_Component_Helper::aria_attributes($args); |
|
| 87 | + // aria-attributes |
|
| 88 | + $output .= AUI_Component_Helper::aria_attributes($args); |
|
| 89 | 89 | |
| 90 | - // extra attributes |
|
| 91 | - if(!empty($args['extra_attributes'])){ |
|
| 92 | - $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
| 93 | - } |
|
| 90 | + // extra attributes |
|
| 91 | + if(!empty($args['extra_attributes'])){ |
|
| 92 | + $output .= AUI_Component_Helper::extra_attributes($args['extra_attributes']); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - // onclick, we don't escape this |
|
| 96 | - if(!empty($args['onclick'])){ |
|
| 97 | - $output .= ' onclick="'.$args['onclick'].'" '; |
|
| 98 | - } |
|
| 95 | + // onclick, we don't escape this |
|
| 96 | + if(!empty($args['onclick'])){ |
|
| 97 | + $output .= ' onclick="'.$args['onclick'].'" '; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - // style, we don't escape this |
|
| 101 | - if(!empty($args['style'])){ |
|
| 102 | - $output .= ' style="'.$args['style'].'" '; |
|
| 103 | - } |
|
| 100 | + // style, we don't escape this |
|
| 101 | + if(!empty($args['style'])){ |
|
| 102 | + $output .= ' style="'.$args['style'].'" '; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - // close opening tag |
|
| 106 | - $output .= ' >'; |
|
| 105 | + // close opening tag |
|
| 106 | + $output .= ' >'; |
|
| 107 | 107 | |
| 108 | 108 | |
| 109 | - // hover content |
|
| 110 | - $hover_content = false; |
|
| 111 | - if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ |
|
| 112 | - $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; |
|
| 113 | - $hover_content = true; |
|
| 114 | - } |
|
| 109 | + // hover content |
|
| 110 | + $hover_content = false; |
|
| 111 | + if(!empty($args['hover_content']) || !empty($args['hover_icon'])){ |
|
| 112 | + $output .= "<span class='hover-content'>".AUI_Component_Helper::icon($args['hover_icon'],$args['hover_content']).$args['hover_content']."</span>"; |
|
| 113 | + $hover_content = true; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - // content |
|
| 117 | - if($hover_content){$output .= "<span class='hover-content-original'>";} |
|
| 118 | - if(!empty($args['content']) || !empty($args['icon'])){ |
|
| 119 | - $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; |
|
| 120 | - } |
|
| 121 | - if($hover_content){$output .= "</span>";} |
|
| 116 | + // content |
|
| 117 | + if($hover_content){$output .= "<span class='hover-content-original'>";} |
|
| 118 | + if(!empty($args['content']) || !empty($args['icon'])){ |
|
| 119 | + $output .= AUI_Component_Helper::icon($args['icon'],$args['content'],$args['icon_extra_attributes']).$args['content']; |
|
| 120 | + } |
|
| 121 | + if($hover_content){$output .= "</span>";} |
|
| 122 | 122 | |
| 123 | 123 | |
| 124 | 124 | |
| 125 | - // close |
|
| 126 | - if($type=='a'){ |
|
| 127 | - $output .= '</a>'; |
|
| 128 | - }elseif($type=='badge'){ |
|
| 129 | - $output .= '</span>'; |
|
| 130 | - }else{ |
|
| 131 | - $output .= '</button>'; |
|
| 132 | - } |
|
| 125 | + // close |
|
| 126 | + if($type=='a'){ |
|
| 127 | + $output .= '</a>'; |
|
| 128 | + }elseif($type=='badge'){ |
|
| 129 | + $output .= '</span>'; |
|
| 130 | + }else{ |
|
| 131 | + $output .= '</button>'; |
|
| 132 | + } |
|
| 133 | 133 | |
| 134 | - // maybe new line after? This adds better spacing between buttons. |
|
| 135 | - if(!empty($args['new_line_after'])){ |
|
| 136 | - $output .= PHP_EOL; |
|
| 137 | - } |
|
| 134 | + // maybe new line after? This adds better spacing between buttons. |
|
| 135 | + if(!empty($args['new_line_after'])){ |
|
| 136 | + $output .= PHP_EOL; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | |
| 140 | - // wrap |
|
| 141 | - if(!$args['no_wrap']){ |
|
| 142 | - $output = AUI_Component_Input::wrap(array( |
|
| 143 | - 'content' => $output, |
|
| 144 | - )); |
|
| 145 | - } |
|
| 140 | + // wrap |
|
| 141 | + if(!$args['no_wrap']){ |
|
| 142 | + $output = AUI_Component_Input::wrap(array( |
|
| 143 | + 'content' => $output, |
|
| 144 | + )); |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | 147 | |
| 148 | - } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - return $output; |
|
| 151 | - } |
|
| 150 | + return $output; |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | 153 | } |
| 154 | 154 | \ No newline at end of file |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | * @deprecated |
| 247 | 247 | */ |
| 248 | 248 | function wpinv_get_payment_key( $invoice = 0 ) { |
| 249 | - $invoice = new WPInv_Invoice( $invoice ); |
|
| 249 | + $invoice = new WPInv_Invoice( $invoice ); |
|
| 250 | 250 | return $invoice->get_key(); |
| 251 | 251 | } |
| 252 | 252 | |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | * @deprecated |
| 425 | 425 | */ |
| 426 | 426 | function wpinv_get_checkout_session() { |
| 427 | - return false; |
|
| 427 | + return false; |
|
| 428 | 428 | } |
| 429 | 429 | |
| 430 | 430 | /** |
@@ -67,7 +67,7 @@ |
||
| 67 | 67 | * Checks if the current user cna view an invoice receipt. |
| 68 | 68 | */ |
| 69 | 69 | function wpinv_can_view_receipt( $invoice ) { |
| 70 | - return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice ); |
|
| 70 | + return (bool) apply_filters( 'wpinv_can_view_receipt', wpinv_user_can_view_invoice( $invoice ), $invoice ); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | /** |
@@ -44,15 +44,15 @@ |
||
| 44 | 44 | parent::__construct( $options ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The Super block output function. |
|
| 49 | - * |
|
| 50 | - * @param array $args |
|
| 51 | - * @param array $widget_args |
|
| 52 | - * @param string $content |
|
| 53 | - * |
|
| 54 | - * @return mixed|string|bool |
|
| 55 | - */ |
|
| 47 | + /** |
|
| 48 | + * The Super block output function. |
|
| 49 | + * |
|
| 50 | + * @param array $args |
|
| 51 | + * @param array $widget_args |
|
| 52 | + * @param string $content |
|
| 53 | + * |
|
| 54 | + * @return mixed|string|bool |
|
| 55 | + */ |
|
| 56 | 56 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 57 | 57 | return getpaid_invoice_history(); |
| 58 | 58 | } |
@@ -44,15 +44,15 @@ |
||
| 44 | 44 | parent::__construct( $options ); |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The Super block output function. |
|
| 49 | - * |
|
| 50 | - * @param array $args |
|
| 51 | - * @param array $widget_args |
|
| 52 | - * @param string $content |
|
| 53 | - * |
|
| 54 | - * @return mixed|string|bool |
|
| 55 | - */ |
|
| 47 | + /** |
|
| 48 | + * The Super block output function. |
|
| 49 | + * |
|
| 50 | + * @param array $args |
|
| 51 | + * @param array $widget_args |
|
| 52 | + * @param string $content |
|
| 53 | + * |
|
| 54 | + * @return mixed|string|bool |
|
| 55 | + */ |
|
| 56 | 56 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 57 | 57 | return wpinv_payment_receipt(); |
| 58 | 58 | } |
@@ -394,15 +394,15 @@ discard block |
||
| 394 | 394 | } |
| 395 | 395 | |
| 396 | 396 | /** |
| 397 | - * Fetches the database from the MaxMind service. |
|
| 398 | - * |
|
| 399 | - * @param string $license_key The license key to be used when downloading the database. |
|
| 400 | - */ |
|
| 397 | + * Fetches the database from the MaxMind service. |
|
| 398 | + * |
|
| 399 | + * @param string $license_key The license key to be used when downloading the database. |
|
| 400 | + */ |
|
| 401 | 401 | public static function geoip2_download_database() { |
| 402 | 402 | |
| 403 | 403 | // Allow us to easily interact with the filesystem. |
| 404 | 404 | require_once ABSPATH . 'wp-admin/includes/file.php'; |
| 405 | - WP_Filesystem(); |
|
| 405 | + WP_Filesystem(); |
|
| 406 | 406 | global $wp_filesystem; |
| 407 | 407 | |
| 408 | 408 | $license_key = wpinv_get_option( 'maxmind_license_key' ); |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | // Move the new database into position. |
| 436 | - $wp_filesystem->move( $database_path, $target_path, true ); |
|
| 436 | + $wp_filesystem->move( $database_path, $target_path, true ); |
|
| 437 | 437 | $wp_filesystem->delete( dirname( $database_path ) ); |
| 438 | 438 | |
| 439 | 439 | wpinv_update_option( 'wpinv_geoip2_date_updated', current_time( 'timestamp' ) ); |
@@ -452,16 +452,16 @@ discard block |
||
| 452 | 452 | |
| 453 | 453 | // The download URI of the database. |
| 454 | 454 | $source_url = add_query_arg( |
| 455 | - array( |
|
| 455 | + array( |
|
| 456 | 456 | 'license_key' => urlencode( sanitize_text_field( $license_key ) ), |
| 457 | 457 | 'edition_id' => $database, |
| 458 | - 'suffix' => 'tar.gz', |
|
| 459 | - ), |
|
| 460 | - 'https://download.maxmind.com/app/geoip_download' |
|
| 458 | + 'suffix' => 'tar.gz', |
|
| 459 | + ), |
|
| 460 | + 'https://download.maxmind.com/app/geoip_download' |
|
| 461 | 461 | ); |
| 462 | 462 | |
| 463 | 463 | // Needed for the download_url call right below. |
| 464 | - require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
| 464 | + require_once ABSPATH . 'wp-admin/includes/file.php'; |
|
| 465 | 465 | |
| 466 | 466 | // Download the file. |
| 467 | 467 | $tmp_archive_path = download_url( esc_url_raw( $source_url ) ); |
@@ -470,16 +470,16 @@ discard block |
||
| 470 | 470 | if ( is_wp_error( $tmp_archive_path ) ) { |
| 471 | 471 | |
| 472 | 472 | // Transform the error into something more informative. |
| 473 | - $error_data = $tmp_archive_path->get_error_data(); |
|
| 474 | - if ( isset( $error_data['code'] ) ) { |
|
| 475 | - switch ( $error_data['code'] ) { |
|
| 476 | - case 401: |
|
| 477 | - return new WP_Error( |
|
| 478 | - 'invoicing_maxmind_geolocation_database_license_key', |
|
| 479 | - __( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' ) |
|
| 480 | - ); |
|
| 481 | - } |
|
| 482 | - } |
|
| 473 | + $error_data = $tmp_archive_path->get_error_data(); |
|
| 474 | + if ( isset( $error_data['code'] ) ) { |
|
| 475 | + switch ( $error_data['code'] ) { |
|
| 476 | + case 401: |
|
| 477 | + return new WP_Error( |
|
| 478 | + 'invoicing_maxmind_geolocation_database_license_key', |
|
| 479 | + __( 'The MaxMind license key is invalid. If you have recently created this key, you may need to wait for it to become active.', 'invoicing' ) |
|
| 480 | + ); |
|
| 481 | + } |
|
| 482 | + } |
|
| 483 | 483 | |
| 484 | 484 | return new WP_Error( 'invoicing_maxmind_geolocation_database_download', __( 'Failed to download the MaxMind database.', 'invoicing' ) ); |
| 485 | 485 | |
@@ -487,19 +487,19 @@ discard block |
||
| 487 | 487 | |
| 488 | 488 | // Extract the database from the archive. |
| 489 | 489 | try { |
| 490 | - $file = new PharData( $tmp_archive_path ); |
|
| 490 | + $file = new PharData( $tmp_archive_path ); |
|
| 491 | 491 | $file_path = trailingslashit( dirname( $tmp_archive_path ) ) . trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb'; |
| 492 | 492 | |
| 493 | - $file->extractTo( |
|
| 494 | - dirname( $tmp_archive_path ), |
|
| 495 | - trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb', |
|
| 496 | - true |
|
| 493 | + $file->extractTo( |
|
| 494 | + dirname( $tmp_archive_path ), |
|
| 495 | + trailingslashit( $file->current()->getFilename() ) . $database . '.mmdb', |
|
| 496 | + true |
|
| 497 | 497 | ); |
| 498 | 498 | |
| 499 | - } catch ( Exception $exception ) { |
|
| 500 | - return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() ); |
|
| 501 | - } finally { |
|
| 502 | - // Remove the archive since we only care about a single file in it. |
|
| 499 | + } catch ( Exception $exception ) { |
|
| 500 | + return new WP_Error( 'invoicing_maxmind_geolocation_database_archive', $exception->getMessage() ); |
|
| 501 | + } finally { |
|
| 502 | + // Remove the archive since we only care about a single file in it. |
|
| 503 | 503 | unlink( $tmp_archive_path ); |
| 504 | 504 | } |
| 505 | 505 | |
@@ -1862,7 +1862,7 @@ discard block |
||
| 1862 | 1862 | $valid_company = $vies_company && $company && ( $vies_company == '---' || strcasecmp( trim( $vies_company ), trim( $company ) ) == 0 ) ? true : false; |
| 1863 | 1863 | |
| 1864 | 1864 | if ( ! $valid_company && ! empty( $wpinv_options['vat_disable_company_name_check'] ) ) { |
| 1865 | - return wp_sprintf( |
|
| 1865 | + return wp_sprintf( |
|
| 1866 | 1866 | __( 'The company name associated with the %s number provided is not the same as the company name provided.', 'invoicing' ), |
| 1867 | 1867 | getpaid_vat_name() |
| 1868 | 1868 | ); |
@@ -618,10 +618,10 @@ |
||
| 618 | 618 | |
| 619 | 619 | } |
| 620 | 620 | |
| 621 | - if ( empty( $iso ) ) { |
|
| 622 | - return false; |
|
| 623 | - } |
|
| 621 | + if ( empty( $iso ) ) { |
|
| 622 | + return false; |
|
| 623 | + } |
|
| 624 | 624 | |
| 625 | - return compact( 'iso', 'country', 'region', 'city', 'longitude', 'latitude', 'credit' ); |
|
| 625 | + return compact( 'iso', 'country', 'region', 'city', 'longitude', 'latitude', 'credit' ); |
|
| 626 | 626 | |
| 627 | 627 | } |