| @@ -19,8 +19,9 @@ | ||
| 19 | 19 | * |
| 20 | 20 | * 1. User can only set absolute integer value as number of decimals. |
| 21 | 21 | * 2. number_decimals setting will be zero if no decimal separator defined |
| 22 | 22 | * |
| 23 | + * @since 4.9.0 rename function - PHP 8 compatibility | |
| 23 | 24 | * @since 1.8 |
| 24 | 25 | * @used-by Give_Plugin_Settings::give_settings() |
| 25 | 26 | * |
| 26 | 27 | * @param string $value |
| @@ -26,9 +27,9 @@ | ||
| 26 | 27 | * @param string $value |
| 27 | 28 | * |
| 28 | 29 | * @return mixed |
| 29 | 30 | */ |
| 30 | -function __give_sanitize_number_decimals_setting_field( $value ) { | |
| 31 | +function give_sanitize_number_decimals_setting_field( $value ) { | |
| 31 | 32 | $value_changed = false; |
| 32 | 33 | $show_notice = false; |
| 33 | 34 | $old_value = $value; |
| 34 | 35 | |
| @@ -41,19 +42,19 @@ | ||
| 41 | 42 | Give_Admin_Settings::add_error( 'give-number-decimal', __( 'The \'Number of Decimals\' option has been automatically set to zero because the \'Decimal Separator\' is not set.', 'give' ) ); |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | $value = absint( $value ); |
| 45 | - $is_currency_set_to_bitcoin = ( 'BTC' === give_get_option( 'currency' ) && ! isset( $_POST['currency'] ) ) || 'BTC' === $_POST['currency']; | |
| 46 | + $is_currency_set_to_bitcoin = ( 'XBT' === give_get_option( 'currency' ) && ! isset( $_POST['currency'] ) ) || 'XBT' === $_POST['currency']; | |
| 46 | 47 | |
| 47 | - if ( $is_currency_set_to_bitcoin && 8 < $value) { | |
| 48 | - $value = 8; | |
| 48 | + if ( $is_currency_set_to_bitcoin && 8 < $value ) { | |
| 49 | + $value = 8; | |
| 49 | 50 | $show_notice = true; |
| 50 | - }elseif ( ! $is_currency_set_to_bitcoin && 6 <= $value ) { | |
| 51 | - $value = 5; | |
| 51 | + } elseif ( ! $is_currency_set_to_bitcoin && 6 <= $value ) { | |
| 52 | + $value = 5; | |
| 52 | 53 | $show_notice = true; |
| 53 | 54 | } |
| 54 | 55 | |
| 55 | - if( $show_notice ) { | |
| 56 | + if ( $show_notice ) { | |
| 56 | 57 | Give_Admin_Settings::add_error( |
| 57 | 58 | 'give-number-decimal', |
| 58 | 59 | sprintf( |
| 59 | 60 | __( 'The \'Number of Decimals\' option has been automatically set to %s because you entered a number higher than the maximum allowed.', 'give' ), |
| @@ -64,9 +65,9 @@ | ||
| 64 | 65 | |
| 65 | 66 | return absint( $value ); |
| 66 | 67 | } |
| 67 | 68 | |
| 68 | -add_filter( 'give_admin_settings_sanitize_option_number_decimals', '__give_sanitize_number_decimals_setting_field', 10 ); | |
| 69 | +add_filter( 'give_admin_settings_sanitize_option_number_decimals', 'give_sanitize_number_decimals_setting_field', 10 ); | |
| 69 | 70 | |
| 70 | 71 | |
| 71 | 72 | /** |
| 72 | 73 | * Sanitize number of decimals setting field. |
| @@ -73,8 +74,9 @@ | ||
| 73 | 74 | * |
| 74 | 75 | * 1. User can only set absolute integer value as number of decimals. |
| 75 | 76 | * 2. number_decimals setting will be zero if no decimal separator defined |
| 76 | 77 | * |
| 78 | + * @since 4.9.0 rename function - PHP 8 compatibility | |
| 77 | 79 | * @since 1.8 |
| 78 | 80 | * @used-by Give_Plugin_Settings::give_settings() |
| 79 | 81 | * |
| 80 | 82 | * @param string $value |
| @@ -80,9 +82,9 @@ | ||
| 80 | 82 | * @param string $value |
| 81 | 83 | * |
| 82 | 84 | * @return mixed |
| 83 | 85 | */ |
| 84 | -function __give_validate_decimal_separator_setting_field( $value ) { | |
| 86 | +function give_validate_decimal_separator_setting_field( $value ) { | |
| 85 | 87 | $thousand_separator = isset( $_POST['thousands_separator'] ) ? give_clean( $_POST['thousands_separator'] ) : ''; |
| 86 | 88 | $decimal_separator = isset( $_POST['decimal_separator'] ) ? give_clean( $_POST['decimal_separator'] ) : ''; |
| 87 | 89 | |
| 88 | 90 | if ( $decimal_separator === $thousand_separator ) { |
| @@ -93,13 +95,14 @@ | ||
| 93 | 95 | |
| 94 | 96 | return $value; |
| 95 | 97 | } |
| 96 | 98 | |
| 97 | -add_filter( 'give_admin_settings_sanitize_option_decimal_separator', '__give_validate_decimal_separator_setting_field', 10 ); | |
| 99 | +add_filter( 'give_admin_settings_sanitize_option_decimal_separator', 'give_validate_decimal_separator_setting_field', 10 ); | |
| 98 | 100 | |
| 99 | 101 | /** |
| 100 | 102 | * Change $delimiter text to symbol. |
| 101 | 103 | * |
| 104 | + * @since 4.9.0 rename function - PHP 8 compatibility | |
| 102 | 105 | * @since 1.8.14 |
| 103 | 106 | * |
| 104 | 107 | * @param string $delimiter |
| 105 | 108 | * |
| @@ -104,9 +107,9 @@ | ||
| 104 | 107 | * @param string $delimiter |
| 105 | 108 | * |
| 106 | 109 | * @return string $delimiter. |
| 107 | 110 | */ |
| 108 | -function __give_import_delimiter_set_callback( $delimiter ) { | |
| 111 | +function give_import_delimiter_set_callback( $delimiter ) { | |
| 109 | 112 | $delimite_type = array( |
| 110 | 113 | 'csv' => ',', |
| 111 | 114 | 'tab-separated-values' => "\t", |
| 112 | 115 | ); |
| @@ -113,9 +116,9 @@ | ||
| 113 | 116 | |
| 114 | 117 | return ( array_key_exists( $delimiter, $delimite_type ) ? $delimite_type[ $delimiter ] : ',' ); |
| 115 | 118 | } |
| 116 | 119 | |
| 117 | -add_filter( 'give_import_delimiter_set', '__give_import_delimiter_set_callback', 10 ); | |
| 120 | +add_filter( 'give_import_delimiter_set', 'give_import_delimiter_set_callback', 10 ); | |
| 118 | 121 | |
| 119 | 122 | /** |
| 120 | 123 | * Give unset the page id from the core setting data from the json files. |
| 121 | 124 | * |
| @@ -120,9 +123,9 @@ | ||
| 120 | 123 | * Give unset the page id from the core setting data from the json files. |
| 121 | 124 | * |
| 122 | 125 | * @since 1.8.17 |
| 123 | 126 | * |
| 124 | - * @param array $json_to_array Data from json file | |
| 127 | + * @param array $json_to_array Data from json file | |
| 125 | 128 | * @param string $type |
| 126 | 129 | * |
| 127 | 130 | * @return array $json_to_array |
| 128 | 131 | */ |
| @@ -143,9 +146,9 @@ | ||
| 143 | 146 | * |
| 144 | 147 | * @since 1.8.17 |
| 145 | 148 | * |
| 146 | 149 | * @param $json_to_array |
| 147 | - * @param string $type | |
| 150 | + * @param string $type | |
| 148 | 151 | * |
| 149 | 152 | * @return array $json_to_array |
| 150 | 153 | */ |
| 151 | 154 | function give_import_core_settings_merge_image_size( $json_to_array, $type ) { |
| @@ -174,9 +177,9 @@ | ||
| 174 | 177 | * |
| 175 | 178 | * @since 1.8.17 |
| 176 | 179 | * |
| 177 | 180 | * @param $json_to_array |
| 178 | - * @param string $type | |
| 181 | + * @param string $type | |
| 179 | 182 | * |
| 180 | 183 | * @return array $json_to_array |
| 181 | 184 | */ |
| 182 | 185 | function give_import_core_settings_merge_upload_image( $json_to_array, $type ) { |
| @@ -185,11 +188,11 @@ | ||
| 185 | 188 | if ( ! empty( $json_to_array['email_logo'] ) ) { |
| 186 | 189 | |
| 187 | 190 | // Need to require these files. |
| 188 | 191 | if ( ! function_exists( 'media_handle_upload' ) ) { |
| 189 | - require_once( ABSPATH . 'wp-admin/includes/image.php' ); | |
| 190 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); | |
| 191 | - require_once( ABSPATH . 'wp-admin/includes/media.php' ); | |
| 192 | + require_once ABSPATH . 'wp-admin/includes/image.php'; | |
| 193 | + require_once ABSPATH . 'wp-admin/includes/file.php'; | |
| 194 | + require_once ABSPATH . 'wp-admin/includes/media.php'; | |
| 192 | 195 | } |
| 193 | 196 | |
| 194 | 197 | $url = $json_to_array['email_logo']; |
| 195 | 198 | $new_url = media_sideload_image( $url, 0, null, 'src' ); |
| @@ -210,9 +213,9 @@ | ||
| 210 | 213 | * Give unset the license key from the core setting data from the json files. |
| 211 | 214 | * |
| 212 | 215 | * @since 1.8.17 |
| 213 | 216 | * |
| 214 | - * @param array $json_to_array Data from json file | |
| 217 | + * @param array $json_to_array Data from json file | |
| 215 | 218 | * @param string $type |
| 216 | 219 | * |
| 217 | 220 | * @return array $json_to_array |
| 218 | 221 | */ |