@@ -44,22 +44,22 @@ |
||
| 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 | |
| 58 | - ob_start(); |
|
| 58 | + ob_start(); |
|
| 59 | 59 | |
| 60 | - wpinv_print_errors(); |
|
| 60 | + wpinv_print_errors(); |
|
| 61 | 61 | |
| 62 | - return '<div class="wpinv">' . ob_get_clean() . '</div>'; |
|
| 62 | + return '<div class="wpinv">' . ob_get_clean() . '</div>'; |
|
| 63 | 63 | |
| 64 | 64 | } |
| 65 | 65 | |
@@ -46,18 +46,18 @@ |
||
| 46 | 46 | parent::__construct( $options ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * The Super block output function. |
|
| 51 | - * |
|
| 52 | - * @param array $args |
|
| 53 | - * @param array $widget_args |
|
| 54 | - * @param string $content |
|
| 55 | - * |
|
| 56 | - * @return mixed|string|bool |
|
| 57 | - */ |
|
| 49 | + /** |
|
| 50 | + * The Super block output function. |
|
| 51 | + * |
|
| 52 | + * @param array $args |
|
| 53 | + * @param array $widget_args |
|
| 54 | + * @param string $content |
|
| 55 | + * |
|
| 56 | + * @return mixed|string|bool |
|
| 57 | + */ |
|
| 58 | 58 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 59 | 59 | |
| 60 | - return wpinv_checkout_form(); |
|
| 60 | + return wpinv_checkout_form(); |
|
| 61 | 61 | |
| 62 | 62 | } |
| 63 | 63 | |
@@ -46,25 +46,25 @@ |
||
| 46 | 46 | parent::__construct( $options ); |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * The Super block output function. |
|
| 51 | - * |
|
| 52 | - * @param array $args |
|
| 53 | - * @param array $widget_args |
|
| 54 | - * @param string $content |
|
| 55 | - * |
|
| 56 | - * @return mixed|string|bool |
|
| 57 | - */ |
|
| 49 | + /** |
|
| 50 | + * The Super block output function. |
|
| 51 | + * |
|
| 52 | + * @param array $args |
|
| 53 | + * @param array $widget_args |
|
| 54 | + * @param string $content |
|
| 55 | + * |
|
| 56 | + * @return mixed|string|bool |
|
| 57 | + */ |
|
| 58 | 58 | public function output( $args = array(), $widget_args = array(), $content = '' ) { |
| 59 | 59 | |
| 60 | - ob_start(); |
|
| 60 | + ob_start(); |
|
| 61 | 61 | |
| 62 | - do_action( 'wpinv_before_user_subscriptions' ); |
|
| 63 | - wpinv_get_template_part( 'wpinv-subscriptions-history' ); |
|
| 64 | - do_action( 'wpinv_after_user_subscriptions' ); |
|
| 62 | + do_action( 'wpinv_before_user_subscriptions' ); |
|
| 63 | + wpinv_get_template_part( 'wpinv-subscriptions-history' ); |
|
| 64 | + do_action( 'wpinv_after_user_subscriptions' ); |
|
| 65 | 65 | |
| 66 | - $output = ob_get_clean(); |
|
| 67 | - return trim($output); |
|
| 66 | + $output = ob_get_clean(); |
|
| 67 | + return trim($output); |
|
| 68 | 68 | |
| 69 | 69 | } |
| 70 | 70 | |
@@ -44,25 +44,25 @@ |
||
| 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 | |
| 58 | - ob_start(); |
|
| 58 | + ob_start(); |
|
| 59 | 59 | |
| 60 | - do_action( 'wpinv_success_content_before' ); |
|
| 61 | - echo wpinv_payment_receipt( $args ); |
|
| 62 | - do_action( 'wpinv_success_content_after' ); |
|
| 60 | + do_action( 'wpinv_success_content_before' ); |
|
| 61 | + echo wpinv_payment_receipt( $args ); |
|
| 62 | + do_action( 'wpinv_success_content_after' ); |
|
| 63 | 63 | |
| 64 | - $output = ob_get_clean(); |
|
| 65 | - return trim($output); |
|
| 64 | + $output = ob_get_clean(); |
|
| 65 | + return trim($output); |
|
| 66 | 66 | |
| 67 | 67 | } |
| 68 | 68 | |
@@ -139,12 +139,12 @@ discard block |
||
| 139 | 139 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-privacy.php' ); |
| 140 | 140 | require_once( WPINV_PLUGIN_DIR . 'includes/libraries/class-ayecode-addons.php' ); |
| 141 | 141 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-addons.php' ); |
| 142 | - require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 143 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 144 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 145 | - require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 146 | - require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 147 | - require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 142 | + require_once( WPINV_PLUGIN_DIR . 'widgets/checkout.php' ); |
|
| 143 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-history.php' ); |
|
| 144 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-receipt.php' ); |
|
| 145 | + require_once( WPINV_PLUGIN_DIR . 'widgets/invoice-messages.php' ); |
|
| 146 | + require_once( WPINV_PLUGIN_DIR . 'widgets/subscriptions.php' ); |
|
| 147 | + require_once( WPINV_PLUGIN_DIR . 'widgets/buy-item.php' ); |
|
| 148 | 148 | |
| 149 | 149 | if ( !class_exists( 'WPInv_EUVat' ) ) { |
| 150 | 150 | require_once( WPINV_PLUGIN_DIR . 'includes/libraries/wpinv-euvat/class-wpinv-euvat.php' ); |
@@ -420,16 +420,16 @@ discard block |
||
| 420 | 420 | require_once( WPINV_PLUGIN_DIR . 'includes/class-wpinv-bp-core.php' ); |
| 421 | 421 | } |
| 422 | 422 | |
| 423 | - /** |
|
| 424 | - * Register widgets |
|
| 425 | - * |
|
| 426 | - */ |
|
| 427 | - public function register_widgets() { |
|
| 428 | - register_widget( "WPInv_Checkout_Widget" ); |
|
| 429 | - register_widget( "WPInv_History_Widget" ); |
|
| 430 | - register_widget( "WPInv_Receipt_Widget" ); |
|
| 431 | - register_widget( "WPInv_Subscriptions_Widget" ); |
|
| 432 | - register_widget( "WPInv_Buy_Item_Widget" ); |
|
| 433 | - register_widget( "WPInv_Messages_Widget" ); |
|
| 434 | - } |
|
| 423 | + /** |
|
| 424 | + * Register widgets |
|
| 425 | + * |
|
| 426 | + */ |
|
| 427 | + public function register_widgets() { |
|
| 428 | + register_widget( "WPInv_Checkout_Widget" ); |
|
| 429 | + register_widget( "WPInv_History_Widget" ); |
|
| 430 | + register_widget( "WPInv_Receipt_Widget" ); |
|
| 431 | + register_widget( "WPInv_Subscriptions_Widget" ); |
|
| 432 | + register_widget( "WPInv_Buy_Item_Widget" ); |
|
| 433 | + register_widget( "WPInv_Messages_Widget" ); |
|
| 434 | + } |
|
| 435 | 435 | } |
| 436 | 436 | \ No newline at end of file |
@@ -984,326 +984,326 @@ discard block |
||
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | function wpinv_get_pages( $with_slug = false, $default_label = NULL ) { |
| 987 | - $pages_options = array(); |
|
| 987 | + $pages_options = array(); |
|
| 988 | 988 | |
| 989 | - if( $default_label !== NULL && $default_label !== false ) { |
|
| 990 | - $pages_options = array( '' => $default_label ); // Blank option |
|
| 991 | - } |
|
| 989 | + if( $default_label !== NULL && $default_label !== false ) { |
|
| 990 | + $pages_options = array( '' => $default_label ); // Blank option |
|
| 991 | + } |
|
| 992 | 992 | |
| 993 | - $pages = get_pages(); |
|
| 994 | - if ( $pages ) { |
|
| 995 | - foreach ( $pages as $page ) { |
|
| 996 | - $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
| 993 | + $pages = get_pages(); |
|
| 994 | + if ( $pages ) { |
|
| 995 | + foreach ( $pages as $page ) { |
|
| 996 | + $title = $with_slug ? $page->post_title . ' (' . $page->post_name . ')' : $page->post_title; |
|
| 997 | 997 | $pages_options[ $page->ID ] = $title; |
| 998 | - } |
|
| 999 | - } |
|
| 998 | + } |
|
| 999 | + } |
|
| 1000 | 1000 | |
| 1001 | - return $pages_options; |
|
| 1001 | + return $pages_options; |
|
| 1002 | 1002 | } |
| 1003 | 1003 | |
| 1004 | 1004 | function wpinv_header_callback( $args ) { |
| 1005 | - if ( !empty( $args['desc'] ) ) { |
|
| 1005 | + if ( !empty( $args['desc'] ) ) { |
|
| 1006 | 1006 | echo $args['desc']; |
| 1007 | 1007 | } |
| 1008 | 1008 | } |
| 1009 | 1009 | |
| 1010 | 1010 | function wpinv_hidden_callback( $args ) { |
| 1011 | - global $wpinv_options; |
|
| 1012 | - |
|
| 1013 | - if ( isset( $args['set_value'] ) ) { |
|
| 1014 | - $value = $args['set_value']; |
|
| 1015 | - } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1016 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1017 | - } else { |
|
| 1018 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1019 | - } |
|
| 1020 | - |
|
| 1021 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1022 | - $args['readonly'] = true; |
|
| 1023 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1024 | - $name = ''; |
|
| 1025 | - } else { |
|
| 1026 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1027 | - } |
|
| 1028 | - |
|
| 1029 | - $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
| 1011 | + global $wpinv_options; |
|
| 1012 | + |
|
| 1013 | + if ( isset( $args['set_value'] ) ) { |
|
| 1014 | + $value = $args['set_value']; |
|
| 1015 | + } elseif ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1016 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1017 | + } else { |
|
| 1018 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1019 | + } |
|
| 1020 | + |
|
| 1021 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1022 | + $args['readonly'] = true; |
|
| 1023 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1024 | + $name = ''; |
|
| 1025 | + } else { |
|
| 1026 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1027 | + } |
|
| 1028 | + |
|
| 1029 | + $html = '<input type="hidden" id="wpinv_settings[' . wpinv_sanitize_key( $args['id'] ) . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '" />'; |
|
| 1030 | 1030 | |
| 1031 | - echo $html; |
|
| 1031 | + echo $html; |
|
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | function wpinv_checkbox_callback( $args ) { |
| 1035 | - global $wpinv_options; |
|
| 1035 | + global $wpinv_options; |
|
| 1036 | 1036 | |
| 1037 | 1037 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1038 | 1038 | |
| 1039 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1040 | - $name = ''; |
|
| 1041 | - } else { |
|
| 1042 | - $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
| 1043 | - } |
|
| 1039 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1040 | + $name = ''; |
|
| 1041 | + } else { |
|
| 1042 | + $name = 'name="wpinv_settings[' . $sanitize_id . ']"'; |
|
| 1043 | + } |
|
| 1044 | 1044 | |
| 1045 | - $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : ''; |
|
| 1046 | - $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
| 1047 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1045 | + $checked = isset( $wpinv_options[ $args['id'] ] ) ? checked( 1, $wpinv_options[ $args['id'] ], false ) : ''; |
|
| 1046 | + $html = '<input type="checkbox" id="wpinv_settings[' . $sanitize_id . ']"' . $name . ' value="1" ' . $checked . '/>'; |
|
| 1047 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1048 | 1048 | |
| 1049 | - echo $html; |
|
| 1049 | + echo $html; |
|
| 1050 | 1050 | } |
| 1051 | 1051 | |
| 1052 | 1052 | function wpinv_multicheck_callback( $args ) { |
| 1053 | - global $wpinv_options; |
|
| 1053 | + global $wpinv_options; |
|
| 1054 | 1054 | |
| 1055 | - $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
| 1056 | - $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
| 1055 | + $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
|
| 1056 | + $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
|
| 1057 | 1057 | |
| 1058 | - if ( ! empty( $args['options'] ) ) { |
|
| 1059 | - echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
| 1058 | + if ( ! empty( $args['options'] ) ) { |
|
| 1059 | + echo '<div class="wpi-mcheck-rows wpi-mcheck-' . $sanitize_id . $class . '">'; |
|
| 1060 | 1060 | foreach( $args['options'] as $key => $option ): |
| 1061 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1062 | - if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { |
|
| 1063 | - $enabled = $sanitize_key; |
|
| 1064 | - } else { |
|
| 1065 | - $enabled = NULL; |
|
| 1066 | - } |
|
| 1067 | - echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
| 1068 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
| 1069 | - endforeach; |
|
| 1070 | - echo '</div>'; |
|
| 1071 | - echo '<p class="description">' . $args['desc'] . '</p>'; |
|
| 1072 | - } |
|
| 1061 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1062 | + if ( isset( $wpinv_options[$args['id']][$sanitize_key] ) ) { |
|
| 1063 | + $enabled = $sanitize_key; |
|
| 1064 | + } else { |
|
| 1065 | + $enabled = NULL; |
|
| 1066 | + } |
|
| 1067 | + echo '<div class="wpi-mcheck-row"><input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $sanitize_key ) . '" ' . checked( $sanitize_key, $enabled, false ) . '/> '; |
|
| 1068 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . wp_kses_post( $option ) . '</label></div>'; |
|
| 1069 | + endforeach; |
|
| 1070 | + echo '</div>'; |
|
| 1071 | + echo '<p class="description">' . $args['desc'] . '</p>'; |
|
| 1072 | + } |
|
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | function wpinv_payment_icons_callback( $args ) { |
| 1076 | - global $wpinv_options; |
|
| 1076 | + global $wpinv_options; |
|
| 1077 | 1077 | |
| 1078 | 1078 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1079 | 1079 | |
| 1080 | - if ( ! empty( $args['options'] ) ) { |
|
| 1081 | - foreach( $args['options'] as $key => $option ) { |
|
| 1080 | + if ( ! empty( $args['options'] ) ) { |
|
| 1081 | + foreach( $args['options'] as $key => $option ) { |
|
| 1082 | 1082 | $sanitize_key = wpinv_sanitize_key( $key ); |
| 1083 | 1083 | |
| 1084 | - if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
| 1085 | - $enabled = $option; |
|
| 1086 | - } else { |
|
| 1087 | - $enabled = NULL; |
|
| 1088 | - } |
|
| 1089 | - |
|
| 1090 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
| 1091 | - |
|
| 1092 | - echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
| 1093 | - |
|
| 1094 | - if ( wpinv_string_is_image_url( $key ) ) { |
|
| 1095 | - echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 1096 | - } else { |
|
| 1097 | - $card = strtolower( str_replace( ' ', '', $option ) ); |
|
| 1098 | - |
|
| 1099 | - if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
| 1100 | - $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
| 1101 | - } else { |
|
| 1102 | - $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
| 1103 | - $content_dir = WP_CONTENT_DIR; |
|
| 1104 | - |
|
| 1105 | - if ( function_exists( 'wp_normalize_path' ) ) { |
|
| 1106 | - // Replaces backslashes with forward slashes for Windows systems |
|
| 1107 | - $image = wp_normalize_path( $image ); |
|
| 1108 | - $content_dir = wp_normalize_path( $content_dir ); |
|
| 1109 | - } |
|
| 1110 | - |
|
| 1111 | - $image = str_replace( $content_dir, content_url(), $image ); |
|
| 1112 | - } |
|
| 1113 | - |
|
| 1114 | - echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 1115 | - } |
|
| 1116 | - echo $option . '</label>'; |
|
| 1117 | - } |
|
| 1118 | - echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 1119 | - } |
|
| 1084 | + if( isset( $wpinv_options[$args['id']][$key] ) ) { |
|
| 1085 | + $enabled = $option; |
|
| 1086 | + } else { |
|
| 1087 | + $enabled = NULL; |
|
| 1088 | + } |
|
| 1089 | + |
|
| 1090 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" style="margin-right:10px;line-height:16px;height:16px;display:inline-block;">'; |
|
| 1091 | + |
|
| 1092 | + echo '<input name="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="' . esc_attr( $option ) . '" ' . checked( $option, $enabled, false ) . '/> '; |
|
| 1093 | + |
|
| 1094 | + if ( wpinv_string_is_image_url( $key ) ) { |
|
| 1095 | + echo '<img class="payment-icon" src="' . esc_url( $key ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 1096 | + } else { |
|
| 1097 | + $card = strtolower( str_replace( ' ', '', $option ) ); |
|
| 1098 | + |
|
| 1099 | + if ( has_filter( 'wpinv_accepted_payment_' . $card . '_image' ) ) { |
|
| 1100 | + $image = apply_filters( 'wpinv_accepted_payment_' . $card . '_image', '' ); |
|
| 1101 | + } else { |
|
| 1102 | + $image = wpinv_locate_template( 'images' . DIRECTORY_SEPARATOR . 'icons' . DIRECTORY_SEPARATOR . $card . '.gif', false ); |
|
| 1103 | + $content_dir = WP_CONTENT_DIR; |
|
| 1104 | + |
|
| 1105 | + if ( function_exists( 'wp_normalize_path' ) ) { |
|
| 1106 | + // Replaces backslashes with forward slashes for Windows systems |
|
| 1107 | + $image = wp_normalize_path( $image ); |
|
| 1108 | + $content_dir = wp_normalize_path( $content_dir ); |
|
| 1109 | + } |
|
| 1110 | + |
|
| 1111 | + $image = str_replace( $content_dir, content_url(), $image ); |
|
| 1112 | + } |
|
| 1113 | + |
|
| 1114 | + echo '<img class="payment-icon" src="' . esc_url( $image ) . '" style="width:32px;height:24px;position:relative;top:6px;margin-right:5px;"/>'; |
|
| 1115 | + } |
|
| 1116 | + echo $option . '</label>'; |
|
| 1117 | + } |
|
| 1118 | + echo '<p class="description" style="margin-top:16px;">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 1119 | + } |
|
| 1120 | 1120 | } |
| 1121 | 1121 | |
| 1122 | 1122 | function wpinv_radio_callback( $args ) { |
| 1123 | - global $wpinv_options; |
|
| 1123 | + global $wpinv_options; |
|
| 1124 | 1124 | |
| 1125 | 1125 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1126 | 1126 | |
| 1127 | 1127 | foreach ( $args['options'] as $key => $option ) : |
| 1128 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1128 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1129 | 1129 | |
| 1130 | 1130 | $checked = false; |
| 1131 | 1131 | |
| 1132 | - if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
| 1133 | - $checked = true; |
|
| 1134 | - elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
| 1135 | - $checked = true; |
|
| 1132 | + if ( isset( $wpinv_options[ $args['id'] ] ) && $wpinv_options[ $args['id'] ] == $key ) |
|
| 1133 | + $checked = true; |
|
| 1134 | + elseif( isset( $args['std'] ) && $args['std'] == $key && ! isset( $wpinv_options[ $args['id'] ] ) ) |
|
| 1135 | + $checked = true; |
|
| 1136 | 1136 | |
| 1137 | - echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
| 1138 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
| 1139 | - endforeach; |
|
| 1137 | + echo '<input name="wpinv_settings[' . $sanitize_id . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="radio" value="' . $sanitize_key . '" ' . checked(true, $checked, false) . '/> '; |
|
| 1138 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option ) . '</label><br/>'; |
|
| 1139 | + endforeach; |
|
| 1140 | 1140 | |
| 1141 | - echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 1141 | + echo '<p class="description">' . wp_kses_post( $args['desc'] ) . '</p>'; |
|
| 1142 | 1142 | } |
| 1143 | 1143 | |
| 1144 | 1144 | function wpinv_gateways_callback( $args ) { |
| 1145 | - global $wpinv_options; |
|
| 1145 | + global $wpinv_options; |
|
| 1146 | 1146 | |
| 1147 | 1147 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1148 | 1148 | |
| 1149 | - foreach ( $args['options'] as $key => $option ) : |
|
| 1150 | - $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1149 | + foreach ( $args['options'] as $key => $option ) : |
|
| 1150 | + $sanitize_key = wpinv_sanitize_key( $key ); |
|
| 1151 | 1151 | |
| 1152 | 1152 | if ( isset( $wpinv_options['gateways'][ $key ] ) ) |
| 1153 | - $enabled = '1'; |
|
| 1154 | - else |
|
| 1155 | - $enabled = null; |
|
| 1153 | + $enabled = '1'; |
|
| 1154 | + else |
|
| 1155 | + $enabled = null; |
|
| 1156 | 1156 | |
| 1157 | - echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
| 1158 | - echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
| 1159 | - endforeach; |
|
| 1157 | + echo '<input name="wpinv_settings[' . esc_attr( $args['id'] ) . '][' . $sanitize_key . ']" id="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']" type="checkbox" value="1" ' . checked('1', $enabled, false) . '/> '; |
|
| 1158 | + echo '<label for="wpinv_settings[' . $sanitize_id . '][' . $sanitize_key . ']">' . esc_html( $option['admin_label'] ) . '</label><br/>'; |
|
| 1159 | + endforeach; |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | function wpinv_gateway_select_callback($args) { |
| 1163 | - global $wpinv_options; |
|
| 1163 | + global $wpinv_options; |
|
| 1164 | 1164 | |
| 1165 | 1165 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1166 | 1166 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
| 1167 | 1167 | |
| 1168 | - echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
| 1168 | + echo '<select name="wpinv_settings[' . $sanitize_id . ']"" id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" >'; |
|
| 1169 | 1169 | |
| 1170 | - foreach ( $args['options'] as $key => $option ) : |
|
| 1171 | - if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
| 1170 | + foreach ( $args['options'] as $key => $option ) : |
|
| 1171 | + if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
|
| 1172 | 1172 | $selected = selected( $key, $args['selected'], false ); |
| 1173 | 1173 | } else { |
| 1174 | 1174 | $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $key, $wpinv_options[$args['id']], false ) : ''; |
| 1175 | 1175 | } |
| 1176 | - echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
| 1177 | - endforeach; |
|
| 1176 | + echo '<option value="' . wpinv_sanitize_key( $key ) . '"' . $selected . '>' . esc_html( $option['admin_label'] ) . '</option>'; |
|
| 1177 | + endforeach; |
|
| 1178 | 1178 | |
| 1179 | - echo '</select>'; |
|
| 1180 | - echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1179 | + echo '</select>'; |
|
| 1180 | + echo '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1181 | 1181 | } |
| 1182 | 1182 | |
| 1183 | 1183 | function wpinv_text_callback( $args ) { |
| 1184 | - global $wpinv_options; |
|
| 1184 | + global $wpinv_options; |
|
| 1185 | 1185 | |
| 1186 | 1186 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1187 | 1187 | |
| 1188 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1189 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1190 | - } else { |
|
| 1191 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1192 | - } |
|
| 1193 | - |
|
| 1194 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1195 | - $args['readonly'] = true; |
|
| 1196 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1197 | - $name = ''; |
|
| 1198 | - } else { |
|
| 1199 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1200 | - } |
|
| 1201 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
| 1202 | - |
|
| 1203 | - $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
| 1204 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1205 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
| 1206 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1207 | - |
|
| 1208 | - echo $html; |
|
| 1188 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1189 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1190 | + } else { |
|
| 1191 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1192 | + } |
|
| 1193 | + |
|
| 1194 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1195 | + $args['readonly'] = true; |
|
| 1196 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1197 | + $name = ''; |
|
| 1198 | + } else { |
|
| 1199 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1200 | + } |
|
| 1201 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
| 1202 | + |
|
| 1203 | + $readonly = $args['readonly'] === true ? ' readonly="readonly"' : ''; |
|
| 1204 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1205 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"' . $readonly . '/>'; |
|
| 1206 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1207 | + |
|
| 1208 | + echo $html; |
|
| 1209 | 1209 | } |
| 1210 | 1210 | |
| 1211 | 1211 | function wpinv_number_callback( $args ) { |
| 1212 | - global $wpinv_options; |
|
| 1212 | + global $wpinv_options; |
|
| 1213 | 1213 | |
| 1214 | 1214 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1215 | 1215 | |
| 1216 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1217 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1218 | - } else { |
|
| 1219 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1220 | - } |
|
| 1221 | - |
|
| 1222 | - if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1223 | - $args['readonly'] = true; |
|
| 1224 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1225 | - $name = ''; |
|
| 1226 | - } else { |
|
| 1227 | - $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1228 | - } |
|
| 1229 | - |
|
| 1230 | - $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
| 1231 | - $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
| 1232 | - $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
| 1233 | - $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
| 1234 | - |
|
| 1235 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1236 | - $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
| 1237 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1238 | - |
|
| 1239 | - echo $html; |
|
| 1216 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1217 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1218 | + } else { |
|
| 1219 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1220 | + } |
|
| 1221 | + |
|
| 1222 | + if ( isset( $args['faux'] ) && true === $args['faux'] ) { |
|
| 1223 | + $args['readonly'] = true; |
|
| 1224 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1225 | + $name = ''; |
|
| 1226 | + } else { |
|
| 1227 | + $name = 'name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"'; |
|
| 1228 | + } |
|
| 1229 | + |
|
| 1230 | + $max = isset( $args['max'] ) ? $args['max'] : 999999; |
|
| 1231 | + $min = isset( $args['min'] ) ? $args['min'] : 0; |
|
| 1232 | + $step = isset( $args['step'] ) ? $args['step'] : 1; |
|
| 1233 | + $class = !empty( $args['class'] ) ? sanitize_html_class( $args['class'] ) : ''; |
|
| 1234 | + |
|
| 1235 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1236 | + $html = '<input type="number" step="' . esc_attr( $step ) . '" max="' . esc_attr( $max ) . '" min="' . esc_attr( $min ) . '" class="' . sanitize_html_class( $size ) . '-text ' . $class . '" id="wpinv_settings[' . $sanitize_id . ']" ' . $name . ' value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
| 1237 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1238 | + |
|
| 1239 | + echo $html; |
|
| 1240 | 1240 | } |
| 1241 | 1241 | |
| 1242 | 1242 | function wpinv_textarea_callback( $args ) { |
| 1243 | - global $wpinv_options; |
|
| 1243 | + global $wpinv_options; |
|
| 1244 | 1244 | |
| 1245 | 1245 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1246 | 1246 | |
| 1247 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1248 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1249 | - } else { |
|
| 1250 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1251 | - } |
|
| 1247 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1248 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1249 | + } else { |
|
| 1250 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1251 | + } |
|
| 1252 | 1252 | |
| 1253 | 1253 | $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
| 1254 | 1254 | $class = ( isset( $args['class'] ) && ! is_null( $args['class'] ) ) ? $args['class'] : 'large-text'; |
| 1255 | 1255 | |
| 1256 | - $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
| 1257 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1256 | + $html = '<textarea class="' . sanitize_html_class( $class ) . ' txtarea-' . sanitize_html_class( $size ) . ' wpi-' . esc_attr( sanitize_html_class( $sanitize_id ) ) . ' " cols="' . $args['cols'] . '" rows="' . $args['rows'] . '" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
| 1257 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1258 | 1258 | |
| 1259 | - echo $html; |
|
| 1259 | + echo $html; |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | function wpinv_password_callback( $args ) { |
| 1263 | - global $wpinv_options; |
|
| 1263 | + global $wpinv_options; |
|
| 1264 | 1264 | |
| 1265 | 1265 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1266 | 1266 | |
| 1267 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1268 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1269 | - } else { |
|
| 1270 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1271 | - } |
|
| 1267 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1268 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1269 | + } else { |
|
| 1270 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1271 | + } |
|
| 1272 | 1272 | |
| 1273 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1274 | - $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
| 1275 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1273 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1274 | + $html = '<input type="password" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '"/>'; |
|
| 1275 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1276 | 1276 | |
| 1277 | - echo $html; |
|
| 1277 | + echo $html; |
|
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | function wpinv_missing_callback($args) { |
| 1281 | - printf( |
|
| 1282 | - __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
| 1283 | - '<strong>' . $args['id'] . '</strong>' |
|
| 1284 | - ); |
|
| 1281 | + printf( |
|
| 1282 | + __( 'The callback function used for the %s setting is missing.', 'invoicing' ), |
|
| 1283 | + '<strong>' . $args['id'] . '</strong>' |
|
| 1284 | + ); |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | function wpinv_select_callback($args) { |
| 1288 | - global $wpinv_options; |
|
| 1288 | + global $wpinv_options; |
|
| 1289 | 1289 | |
| 1290 | 1290 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1291 | 1291 | |
| 1292 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1293 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1294 | - } else { |
|
| 1295 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1296 | - } |
|
| 1292 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1293 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1294 | + } else { |
|
| 1295 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1296 | + } |
|
| 1297 | 1297 | |
| 1298 | 1298 | if ( isset( $args['selected'] ) && $args['selected'] !== null && $args['selected'] !== false ) { |
| 1299 | 1299 | $value = $args['selected']; |
| 1300 | 1300 | } |
| 1301 | 1301 | |
| 1302 | - if ( isset( $args['placeholder'] ) ) { |
|
| 1303 | - $placeholder = $args['placeholder']; |
|
| 1304 | - } else { |
|
| 1305 | - $placeholder = ''; |
|
| 1306 | - } |
|
| 1302 | + if ( isset( $args['placeholder'] ) ) { |
|
| 1303 | + $placeholder = $args['placeholder']; |
|
| 1304 | + } else { |
|
| 1305 | + $placeholder = ''; |
|
| 1306 | + } |
|
| 1307 | 1307 | |
| 1308 | 1308 | if( !empty( $args['onchange'] ) ) { |
| 1309 | 1309 | $onchange = ' onchange="' . esc_attr( $args['onchange'] ) . '"'; |
@@ -1313,142 +1313,142 @@ discard block |
||
| 1313 | 1313 | |
| 1314 | 1314 | $class = !empty( $args['class'] ) ? ' ' . esc_attr( $args['class'] ) : ''; |
| 1315 | 1315 | |
| 1316 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
| 1316 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" class="'.$class.'" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" data-placeholder="' . esc_html( $placeholder ) . '"' . $onchange . ' />'; |
|
| 1317 | 1317 | |
| 1318 | - foreach ( $args['options'] as $option => $name ) { |
|
| 1319 | - $selected = selected( $option, $value, false ); |
|
| 1320 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 1321 | - } |
|
| 1318 | + foreach ( $args['options'] as $option => $name ) { |
|
| 1319 | + $selected = selected( $option, $value, false ); |
|
| 1320 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 1321 | + } |
|
| 1322 | 1322 | |
| 1323 | - $html .= '</select>'; |
|
| 1324 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1323 | + $html .= '</select>'; |
|
| 1324 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1325 | 1325 | |
| 1326 | - echo $html; |
|
| 1326 | + echo $html; |
|
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | 1329 | function wpinv_color_select_callback( $args ) { |
| 1330 | - global $wpinv_options; |
|
| 1330 | + global $wpinv_options; |
|
| 1331 | 1331 | |
| 1332 | 1332 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1333 | 1333 | |
| 1334 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1335 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1336 | - } else { |
|
| 1337 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1338 | - } |
|
| 1334 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1335 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1336 | + } else { |
|
| 1337 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1338 | + } |
|
| 1339 | 1339 | |
| 1340 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
| 1340 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"/>'; |
|
| 1341 | 1341 | |
| 1342 | - foreach ( $args['options'] as $option => $color ) { |
|
| 1343 | - $selected = selected( $option, $value, false ); |
|
| 1344 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
| 1345 | - } |
|
| 1342 | + foreach ( $args['options'] as $option => $color ) { |
|
| 1343 | + $selected = selected( $option, $value, false ); |
|
| 1344 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $color['label'] ) . '</option>'; |
|
| 1345 | + } |
|
| 1346 | 1346 | |
| 1347 | - $html .= '</select>'; |
|
| 1348 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1347 | + $html .= '</select>'; |
|
| 1348 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1349 | 1349 | |
| 1350 | - echo $html; |
|
| 1350 | + echo $html; |
|
| 1351 | 1351 | } |
| 1352 | 1352 | |
| 1353 | 1353 | function wpinv_rich_editor_callback( $args ) { |
| 1354 | - global $wpinv_options, $wp_version; |
|
| 1354 | + global $wpinv_options, $wp_version; |
|
| 1355 | 1355 | |
| 1356 | 1356 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1357 | 1357 | |
| 1358 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1359 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1358 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1359 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1360 | 1360 | |
| 1361 | - if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
| 1362 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1363 | - } |
|
| 1364 | - } else { |
|
| 1365 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1366 | - } |
|
| 1361 | + if( empty( $args['allow_blank'] ) && empty( $value ) ) { |
|
| 1362 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1363 | + } |
|
| 1364 | + } else { |
|
| 1365 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1366 | + } |
|
| 1367 | 1367 | |
| 1368 | - $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
| 1368 | + $rows = isset( $args['size'] ) ? $args['size'] : 20; |
|
| 1369 | 1369 | |
| 1370 | - if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
| 1371 | - ob_start(); |
|
| 1372 | - wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
| 1373 | - $html = ob_get_clean(); |
|
| 1374 | - } else { |
|
| 1375 | - $html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
| 1376 | - } |
|
| 1370 | + if ( $wp_version >= 3.3 && function_exists( 'wp_editor' ) ) { |
|
| 1371 | + ob_start(); |
|
| 1372 | + wp_editor( stripslashes( $value ), 'wpinv_settings_' . esc_attr( $args['id'] ), array( 'textarea_name' => 'wpinv_settings[' . esc_attr( $args['id'] ) . ']', 'textarea_rows' => absint( $rows ), 'media_buttons' => false ) ); |
|
| 1373 | + $html = ob_get_clean(); |
|
| 1374 | + } else { |
|
| 1375 | + $html = '<textarea class="large-text" rows="10" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" class="wpi-' . esc_attr( sanitize_html_class( $args['id'] ) ) . '">' . esc_textarea( stripslashes( $value ) ) . '</textarea>'; |
|
| 1376 | + } |
|
| 1377 | 1377 | |
| 1378 | - $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1378 | + $html .= '<br/><label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1379 | 1379 | |
| 1380 | - echo $html; |
|
| 1380 | + echo $html; |
|
| 1381 | 1381 | } |
| 1382 | 1382 | |
| 1383 | 1383 | function wpinv_upload_callback( $args ) { |
| 1384 | - global $wpinv_options; |
|
| 1384 | + global $wpinv_options; |
|
| 1385 | 1385 | |
| 1386 | 1386 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1387 | 1387 | |
| 1388 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1389 | - $value = $wpinv_options[$args['id']]; |
|
| 1390 | - } else { |
|
| 1391 | - $value = isset($args['std']) ? $args['std'] : ''; |
|
| 1392 | - } |
|
| 1388 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1389 | + $value = $wpinv_options[$args['id']]; |
|
| 1390 | + } else { |
|
| 1391 | + $value = isset($args['std']) ? $args['std'] : ''; |
|
| 1392 | + } |
|
| 1393 | 1393 | |
| 1394 | - $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1395 | - $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
| 1396 | - $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
| 1397 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1394 | + $size = ( isset( $args['size'] ) && ! is_null( $args['size'] ) ) ? $args['size'] : 'regular'; |
|
| 1395 | + $html = '<input type="text" class="' . sanitize_html_class( $size ) . '-text" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( stripslashes( $value ) ) . '"/>'; |
|
| 1396 | + $html .= '<span> <input type="button" class="wpinv_settings_upload_button button-secondary" value="' . __( 'Upload File', 'invoicing' ) . '"/></span>'; |
|
| 1397 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1398 | 1398 | |
| 1399 | - echo $html; |
|
| 1399 | + echo $html; |
|
| 1400 | 1400 | } |
| 1401 | 1401 | |
| 1402 | 1402 | function wpinv_color_callback( $args ) { |
| 1403 | - global $wpinv_options; |
|
| 1403 | + global $wpinv_options; |
|
| 1404 | 1404 | |
| 1405 | 1405 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1406 | 1406 | |
| 1407 | - if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1408 | - $value = $wpinv_options[ $args['id'] ]; |
|
| 1409 | - } else { |
|
| 1410 | - $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1411 | - } |
|
| 1407 | + if ( isset( $wpinv_options[ $args['id'] ] ) ) { |
|
| 1408 | + $value = $wpinv_options[ $args['id'] ]; |
|
| 1409 | + } else { |
|
| 1410 | + $value = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1411 | + } |
|
| 1412 | 1412 | |
| 1413 | - $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1413 | + $default = isset( $args['std'] ) ? $args['std'] : ''; |
|
| 1414 | 1414 | |
| 1415 | - $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
| 1416 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1415 | + $html = '<input type="text" class="wpinv-color-picker" id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']" value="' . esc_attr( $value ) . '" data-default-color="' . esc_attr( $default ) . '" />'; |
|
| 1416 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1417 | 1417 | |
| 1418 | - echo $html; |
|
| 1418 | + echo $html; |
|
| 1419 | 1419 | } |
| 1420 | 1420 | |
| 1421 | 1421 | function wpinv_country_states_callback($args) { |
| 1422 | - global $wpinv_options; |
|
| 1422 | + global $wpinv_options; |
|
| 1423 | 1423 | |
| 1424 | 1424 | $sanitize_id = wpinv_sanitize_key( $args['id'] ); |
| 1425 | 1425 | |
| 1426 | - if ( isset( $args['placeholder'] ) ) { |
|
| 1427 | - $placeholder = $args['placeholder']; |
|
| 1428 | - } else { |
|
| 1429 | - $placeholder = ''; |
|
| 1430 | - } |
|
| 1426 | + if ( isset( $args['placeholder'] ) ) { |
|
| 1427 | + $placeholder = $args['placeholder']; |
|
| 1428 | + } else { |
|
| 1429 | + $placeholder = ''; |
|
| 1430 | + } |
|
| 1431 | 1431 | |
| 1432 | - $states = wpinv_get_country_states(); |
|
| 1432 | + $states = wpinv_get_country_states(); |
|
| 1433 | 1433 | |
| 1434 | - $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
| 1435 | - $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
| 1434 | + $class = empty( $states ) ? ' class="wpinv-no-states"' : ' class="wpi_select2"'; |
|
| 1435 | + $html = '<select id="wpinv_settings[' . $sanitize_id . ']" name="wpinv_settings[' . esc_attr( $args['id'] ) . ']"' . $class . 'data-placeholder="' . esc_html( $placeholder ) . '"/>'; |
|
| 1436 | 1436 | |
| 1437 | - foreach ( $states as $option => $name ) { |
|
| 1438 | - $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
| 1439 | - $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 1440 | - } |
|
| 1437 | + foreach ( $states as $option => $name ) { |
|
| 1438 | + $selected = isset( $wpinv_options[ $args['id'] ] ) ? selected( $option, $wpinv_options[$args['id']], false ) : ''; |
|
| 1439 | + $html .= '<option value="' . esc_attr( $option ) . '" ' . $selected . '>' . esc_html( $name ) . '</option>'; |
|
| 1440 | + } |
|
| 1441 | 1441 | |
| 1442 | - $html .= '</select>'; |
|
| 1443 | - $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1442 | + $html .= '</select>'; |
|
| 1443 | + $html .= '<label for="wpinv_settings[' . $sanitize_id . ']"> ' . wp_kses_post( $args['desc'] ) . '</label>'; |
|
| 1444 | 1444 | |
| 1445 | - echo $html; |
|
| 1445 | + echo $html; |
|
| 1446 | 1446 | } |
| 1447 | 1447 | |
| 1448 | 1448 | function wpinv_tax_rates_callback($args) { |
| 1449 | - global $wpinv_options; |
|
| 1450 | - $rates = wpinv_get_tax_rates(); |
|
| 1451 | - ob_start(); ?> |
|
| 1449 | + global $wpinv_options; |
|
| 1450 | + $rates = wpinv_get_tax_rates(); |
|
| 1451 | + ob_start(); ?> |
|
| 1452 | 1452 | </td><tr> |
| 1453 | 1453 | <td colspan="2" class="wpinv_tax_tdbox"> |
| 1454 | 1454 | <p><?php echo $args['desc']; ?></p> |
@@ -1472,40 +1472,40 @@ discard block |
||
| 1472 | 1472 | <tr> |
| 1473 | 1473 | <td class="wpinv_tax_country"> |
| 1474 | 1474 | <?php |
| 1475 | - echo wpinv_html_select( array( |
|
| 1476 | - 'options' => wpinv_get_country_list( true ), |
|
| 1477 | - 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
| 1475 | + echo wpinv_html_select( array( |
|
| 1476 | + 'options' => wpinv_get_country_list( true ), |
|
| 1477 | + 'name' => 'tax_rates[' . $sanitized_key . '][country]', |
|
| 1478 | 1478 | 'id' => 'tax_rates[' . $sanitized_key . '][country]', |
| 1479 | - 'selected' => $rate['country'], |
|
| 1480 | - 'show_option_all' => false, |
|
| 1481 | - 'show_option_none' => false, |
|
| 1482 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
| 1483 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
| 1484 | - ) ); |
|
| 1485 | - ?> |
|
| 1479 | + 'selected' => $rate['country'], |
|
| 1480 | + 'show_option_all' => false, |
|
| 1481 | + 'show_option_none' => false, |
|
| 1482 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
| 1483 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
| 1484 | + ) ); |
|
| 1485 | + ?> |
|
| 1486 | 1486 | </td> |
| 1487 | 1487 | <td class="wpinv_tax_state"> |
| 1488 | 1488 | <?php |
| 1489 | - $states = wpinv_get_country_states( $rate['country'] ); |
|
| 1490 | - if( !empty( $states ) ) { |
|
| 1491 | - echo wpinv_html_select( array( |
|
| 1492 | - 'options' => array_merge( array( '' => '' ), $states ), |
|
| 1493 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
| 1489 | + $states = wpinv_get_country_states( $rate['country'] ); |
|
| 1490 | + if( !empty( $states ) ) { |
|
| 1491 | + echo wpinv_html_select( array( |
|
| 1492 | + 'options' => array_merge( array( '' => '' ), $states ), |
|
| 1493 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', |
|
| 1494 | 1494 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
| 1495 | - 'selected' => $rate['state'], |
|
| 1496 | - 'show_option_all' => false, |
|
| 1497 | - 'show_option_none' => false, |
|
| 1495 | + 'selected' => $rate['state'], |
|
| 1496 | + 'show_option_all' => false, |
|
| 1497 | + 'show_option_none' => false, |
|
| 1498 | 1498 | 'class' => 'wpi_select2', |
| 1499 | - 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
| 1500 | - ) ); |
|
| 1501 | - } else { |
|
| 1502 | - echo wpinv_html_text( array( |
|
| 1503 | - 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
| 1504 | - 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
| 1499 | + 'placeholder' => __( 'Choose a state', 'invoicing' ) |
|
| 1500 | + ) ); |
|
| 1501 | + } else { |
|
| 1502 | + echo wpinv_html_text( array( |
|
| 1503 | + 'name' => 'tax_rates[' . $sanitized_key . '][state]', $rate['state'], |
|
| 1504 | + 'value' => ! empty( $rate['state'] ) ? $rate['state'] : '', |
|
| 1505 | 1505 | 'id' => 'tax_rates[' . $sanitized_key . '][state]', |
| 1506 | - ) ); |
|
| 1507 | - } |
|
| 1508 | - ?> |
|
| 1506 | + ) ); |
|
| 1507 | + } |
|
| 1508 | + ?> |
|
| 1509 | 1509 | </td> |
| 1510 | 1510 | <td class="wpinv_tax_global"> |
| 1511 | 1511 | <input type="checkbox" name="tax_rates[<?php echo $sanitized_key; ?>][global]" id="tax_rates[<?php echo $sanitized_key; ?>][global]" value="1"<?php checked( true, ! empty( $rate['global'] ) ); ?>/> |
@@ -1520,19 +1520,19 @@ discard block |
||
| 1520 | 1520 | <tr> |
| 1521 | 1521 | <td class="wpinv_tax_country"> |
| 1522 | 1522 | <?php |
| 1523 | - echo wpinv_html_select( array( |
|
| 1524 | - 'options' => wpinv_get_country_list( true ), |
|
| 1525 | - 'name' => 'tax_rates[0][country]', |
|
| 1526 | - 'show_option_all' => false, |
|
| 1527 | - 'show_option_none' => false, |
|
| 1528 | - 'class' => 'wpinv-tax-country wpi_select2', |
|
| 1529 | - 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
| 1530 | - ) ); ?> |
|
| 1523 | + echo wpinv_html_select( array( |
|
| 1524 | + 'options' => wpinv_get_country_list( true ), |
|
| 1525 | + 'name' => 'tax_rates[0][country]', |
|
| 1526 | + 'show_option_all' => false, |
|
| 1527 | + 'show_option_none' => false, |
|
| 1528 | + 'class' => 'wpinv-tax-country wpi_select2', |
|
| 1529 | + 'placeholder' => __( 'Choose a country', 'invoicing' ) |
|
| 1530 | + ) ); ?> |
|
| 1531 | 1531 | </td> |
| 1532 | 1532 | <td class="wpinv_tax_state"> |
| 1533 | 1533 | <?php echo wpinv_html_text( array( |
| 1534 | - 'name' => 'tax_rates[0][state]' |
|
| 1535 | - ) ); ?> |
|
| 1534 | + 'name' => 'tax_rates[0][state]' |
|
| 1535 | + ) ); ?> |
|
| 1536 | 1536 | </td> |
| 1537 | 1537 | <td class="wpinv_tax_global"> |
| 1538 | 1538 | <input type="checkbox" name="tax_rates[0][global]" id="tax_rates[0][global]" value="1"/> |
@@ -1547,7 +1547,7 @@ discard block |
||
| 1547 | 1547 | <tfoot><tr><td colspan="5"></td><td class="wpinv_tax_action"><span class="button-secondary" id="wpinv_add_tax_rate"><?php _e( 'Add Tax Rate', 'invoicing' ); ?></span></td></tr></tfoot> |
| 1548 | 1548 | </table> |
| 1549 | 1549 | <?php |
| 1550 | - echo ob_get_clean(); |
|
| 1550 | + echo ob_get_clean(); |
|
| 1551 | 1551 | } |
| 1552 | 1552 | |
| 1553 | 1553 | function wpinv_tools_callback($args) { |
@@ -1575,15 +1575,15 @@ discard block |
||
| 1575 | 1575 | } |
| 1576 | 1576 | |
| 1577 | 1577 | function wpinv_descriptive_text_callback( $args ) { |
| 1578 | - echo wp_kses_post( $args['desc'] ); |
|
| 1578 | + echo wp_kses_post( $args['desc'] ); |
|
| 1579 | 1579 | } |
| 1580 | 1580 | |
| 1581 | 1581 | function wpinv_hook_callback( $args ) { |
| 1582 | - do_action( 'wpinv_' . $args['id'], $args ); |
|
| 1582 | + do_action( 'wpinv_' . $args['id'], $args ); |
|
| 1583 | 1583 | } |
| 1584 | 1584 | |
| 1585 | 1585 | function wpinv_set_settings_cap() { |
| 1586 | - return wpinv_get_capability(); |
|
| 1586 | + return wpinv_get_capability(); |
|
| 1587 | 1587 | } |
| 1588 | 1588 | add_filter( 'option_page_capability_wpinv_settings', 'wpinv_set_settings_cap' ); |
| 1589 | 1589 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | case 'status' : |
| 102 | 102 | $value = $wpi_invoice->get_status( true ) . ( $wpi_invoice->is_recurring() && $wpi_invoice->is_parent() ? ' <span class="wpi-suffix">' . __( '(r)', 'invoicing' ) . '</span>' : '' ); |
| 103 | 103 | $is_viewed = wpinv_is_invoice_viewed( $wpi_invoice->ID ); |
| 104 | - $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ); |
|
| 105 | - $offline_gateways = apply_filters('wpinv_offline_payments', array('bank_transfer', 'cheque', 'cod')); |
|
| 106 | - $is_offline_payment = in_array($wpi_invoice->get_gateway(), $offline_gateways) ? true : false; |
|
| 104 | + $gateway_title = wpinv_get_gateway_admin_label( $wpi_invoice->get_gateway() ); |
|
| 105 | + $offline_gateways = apply_filters('wpinv_offline_payments', array('bank_transfer', 'cheque', 'cod')); |
|
| 106 | + $is_offline_payment = in_array($wpi_invoice->get_gateway(), $offline_gateways) ? true : false; |
|
| 107 | 107 | |
| 108 | 108 | if ( 1 == $is_viewed ) { |
| 109 | 109 | $value .= ' <i class="fa fa-eye" title="'.__( 'Viewed by Customer', 'invoicing' ).'"></i>'; |
@@ -174,69 +174,69 @@ discard block |
||
| 174 | 174 | } |
| 175 | 175 | |
| 176 | 176 | function wpinv_admin_messages() { |
| 177 | - global $wpinv_options, $pagenow, $post; |
|
| 177 | + global $wpinv_options, $pagenow, $post; |
|
| 178 | 178 | |
| 179 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 180 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
| 181 | - } |
|
| 179 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 180 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-added', __( 'Discount code added.', 'invoicing' ), 'updated' ); |
|
| 181 | + } |
|
| 182 | 182 | |
| 183 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 184 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 185 | - } |
|
| 183 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_add_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 184 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-add-fail', __( 'There was a problem adding your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 185 | + } |
|
| 186 | 186 | |
| 187 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 188 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
| 189 | - } |
|
| 187 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_exists' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 188 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-exists', __( 'A discount with that code already exists, please use a different code.', 'invoicing' ), 'error' ); |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 192 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
| 193 | - } |
|
| 191 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 192 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated', __( 'Discount code updated.', 'invoicing' ), 'updated' ); |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 196 | - add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 197 | - } |
|
| 195 | + if ( isset( $_GET['wpinv-message'] ) && 'discount_update_failed' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 196 | + add_settings_error( 'wpinv-notices', 'wpinv-discount-updated-fail', __( 'There was a problem updating your discount code, please try again.', 'invoicing' ), 'error' ); |
|
| 197 | + } |
|
| 198 | 198 | |
| 199 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 200 | - add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
| 201 | - } |
|
| 199 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice_deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 200 | + add_settings_error( 'wpinv-notices', 'wpinv-deleted', __( 'The invoice has been deleted.', 'invoicing' ), 'updated' ); |
|
| 201 | + } |
|
| 202 | 202 | |
| 203 | - if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 204 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
| 205 | - } |
|
| 203 | + if ( isset( $_GET['wpinv-message'] ) && 'email_disabled' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 204 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Email notification is disabled. Please check settings.', 'invoicing' ), 'error' ); |
|
| 205 | + } |
|
| 206 | 206 | |
| 207 | - if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 208 | - add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
| 207 | + if ( isset( $_GET['wpinv-message'] ) && 'email_sent' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 208 | + add_settings_error( 'wpinv-notices', 'wpinv-sent', __( 'The email has been sent to customer.', 'invoicing' ), 'updated' ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | if ( isset( $_GET['wpinv-message'] ) && 'email_fail' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
| 212 | - add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
| 212 | + add_settings_error( 'wpinv-notices', 'wpinv-sent-fail', __( 'Fail to send email to the customer.', 'invoicing' ), 'error' ); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | if ( isset( $_GET['wpinv-message'] ) && 'invoice-note-deleted' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
| 216 | 216 | add_settings_error( 'wpinv-notices', 'wpinv-note-deleted', __( 'The invoice note has been deleted.', 'invoicing' ), 'updated' ); |
| 217 | 217 | } |
| 218 | 218 | |
| 219 | - if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 220 | - add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
| 221 | - } |
|
| 219 | + if ( isset( $_GET['wpinv-message'] ) && 'settings-imported' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 220 | + add_settings_error( 'wpinv-notices', 'wpinv-settings-imported', __( 'The settings have been imported.', 'invoicing' ), 'updated' ); |
|
| 221 | + } |
|
| 222 | 222 | |
| 223 | - if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 224 | - add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
| 225 | - } |
|
| 223 | + if ( isset( $_GET['wpinv-message'] ) && 'note-added' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 224 | + add_settings_error( 'wpinv-notices', 'wpinv-note-added', __( 'The invoice note has been added successfully.', 'invoicing' ), 'updated' ); |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 228 | - add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
| 229 | - } |
|
| 227 | + if ( isset( $_GET['wpinv-message'] ) && 'invoice-updated' == $_GET['wpinv-message'] && wpinv_current_user_can_manage_invoicing() ) { |
|
| 228 | + add_settings_error( 'wpinv-notices', 'wpinv-updated', __( 'The invoice has been successfully updated.', 'invoicing' ), 'updated' ); |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
| 232 | - $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
| 231 | + if ( $pagenow == 'post.php' && !empty( $post->post_type ) && $post->post_type == 'wpi_item' && !wpinv_item_is_editable( $post ) ) { |
|
| 232 | + $message = apply_filters( 'wpinv_item_non_editable_message', __( 'This item in not editable.', 'invoicing' ), $post->ID ); |
|
| 233 | 233 | |
| 234 | - if ( !empty( $message ) ) { |
|
| 235 | - add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
| 236 | - } |
|
| 237 | - } |
|
| 234 | + if ( !empty( $message ) ) { |
|
| 235 | + add_settings_error( 'wpinv-notices', 'wpinv-edit-n', $message, 'updated' ); |
|
| 236 | + } |
|
| 237 | + } |
|
| 238 | 238 | |
| 239 | - settings_errors( 'wpinv-notices' ); |
|
| 239 | + settings_errors( 'wpinv-notices' ); |
|
| 240 | 240 | } |
| 241 | 241 | add_action( 'admin_notices', 'wpinv_admin_messages' ); |
| 242 | 242 | |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | break; |
| 327 | 327 | case 'id' : |
| 328 | 328 | echo $post->ID; |
| 329 | - echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '"> |
|
| 329 | + echo '<div class="hidden" id="wpinv_inline-' . $post->ID . '"> |
|
| 330 | 330 | <div class="price">' . wpinv_get_item_price( $post->ID ) . '</div>'; |
| 331 | 331 | if ( $wpinv_euvat->allow_vat_rules() ) { |
| 332 | 332 | echo '<div class="vat_rule">' . $wpinv_euvat->get_item_rule( $post->ID ) . '</div>'; |
@@ -159,11 +159,11 @@ |
||
| 159 | 159 | */ |
| 160 | 160 | function wpinv_get_capability( $capalibilty = 'manage_invoicing' ) { |
| 161 | 161 | |
| 162 | - if ( current_user_can( 'manage_options' ) ) { |
|
| 163 | - return 'manage_options'; |
|
| 164 | - }; |
|
| 162 | + if ( current_user_can( 'manage_options' ) ) { |
|
| 163 | + return 'manage_options'; |
|
| 164 | + }; |
|
| 165 | 165 | |
| 166 | - return $capalibilty; |
|
| 166 | + return $capalibilty; |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | /** |
@@ -52,14 +52,14 @@ |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Registers routes |
|
| 57 | - * |
|
| 55 | + /** |
|
| 56 | + * Registers routes |
|
| 57 | + * |
|
| 58 | 58 | * @since 1.0.13 |
| 59 | - */ |
|
| 60 | - public function register_rest_routes() { |
|
| 59 | + */ |
|
| 60 | + public function register_rest_routes() { |
|
| 61 | 61 | |
| 62 | - // Invoices. |
|
| 62 | + // Invoices. |
|
| 63 | 63 | $this->invoices_controller->register_routes(); |
| 64 | 64 | |
| 65 | 65 | // Items. |