| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | * All functions that have been deprecated. |
| 6 | 6 | * |
| 7 | 7 | * @package Give |
| 8 | 8 | * @subpackage Deprecated |
| 9 | - * @copyright Copyright (c) 2016, WordImpress | |
| 9 | + * @copyright Copyright (c) 2016, GiveWP | |
| 10 | 10 | * @license https://opensource.org/licenses/gpl-license GNU Public License |
| 11 | 11 | * @since 1.4.1 |
| 12 | 12 | */ |
| 13 | 13 | |
| @@ -63,13 +63,13 @@ | ||
| 63 | 63 | $backtrace = debug_backtrace(); |
| 64 | 64 | |
| 65 | 65 | _give_deprecated_function( __FUNCTION__, '1.8', null, $backtrace ); |
| 66 | 66 | |
| 67 | - $views = array( | |
| 67 | + $views = [ | |
| 68 | 68 | 'sales' => __( 'Donations', 'give' ), |
| 69 | 69 | 'gateway_errors' => __( 'Payment Errors', 'give' ), |
| 70 | 70 | 'api_requests' => __( 'API Requests', 'give' ), |
| 71 | - ); | |
| 71 | + ]; | |
| 72 | 72 | |
| 73 | 73 | $views = apply_filters( 'give_log_views', $views ); |
| 74 | 74 | |
| 75 | 75 | return $views; |
| @@ -257,9 +257,9 @@ | ||
| 257 | 257 | * @deprecated 1.8.8 |
| 258 | 258 | * |
| 259 | 259 | * @param array $valid_data |
| 260 | 260 | */ |
| 261 | -function give_get_purchase_form_user( $valid_data = array() ) { | |
| 261 | +function give_get_purchase_form_user( $valid_data = [] ) { | |
| 262 | 262 | |
| 263 | 263 | $backtrace = debug_backtrace(); |
| 264 | 264 | |
| 265 | 265 | _give_deprecated_function( __FUNCTION__, '1.8.8', 'give_get_donation_form_user', $backtrace ); |
| @@ -484,9 +484,9 @@ | ||
| 484 | 484 | * @param int $payment_id Payment ID. |
| 485 | 485 | * |
| 486 | 486 | * @return void |
| 487 | 487 | */ |
| 488 | -function give_undo_purchase( $form_id = false, $payment_id ) { | |
| 488 | +function give_undo_purchase( $form_id, $payment_id ) { | |
| 489 | 489 | |
| 490 | 490 | $backtrace = debug_backtrace(); |
| 491 | 491 | |
| 492 | 492 | _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_undo_donation', $backtrace ); |
| @@ -545,9 +545,9 @@ | ||
| 545 | 545 | * @param string|null $sale_date The date of the sale. |
| 546 | 546 | * |
| 547 | 547 | * @return void |
| 548 | 548 | */ |
| 549 | -function give_record_sale_in_log( $give_form_id = 0, $payment_id, $price_id = false, $sale_date = null ) { | |
| 549 | +function give_record_sale_in_log( $give_form_id, $payment_id, $price_id = false, $sale_date = null ) { | |
| 550 | 550 | $backtrace = debug_backtrace(); |
| 551 | 551 | |
| 552 | 552 | _give_deprecated_function( __FUNCTION__, '1.8.9', 'give_record_donation_in_log', $backtrace ); |
| 553 | 553 | |
| @@ -593,9 +593,9 @@ | ||
| 593 | 593 | $backtrace = debug_backtrace(); |
| 594 | 594 | |
| 595 | 595 | _give_deprecated_function( __FUNCTION__, '1.8.9', 'Give_Notice::print_frontend_notice', $backtrace ); |
| 596 | 596 | |
| 597 | - Give()->notices->print_frontend_notice( $message, $echo, $error_id ); | |
| 597 | + Give_Notices::print_frontend_notice( $message, $echo, $error_id ); | |
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | |
| 601 | 601 | /** |
| @@ -697,10 +697,10 @@ | ||
| 697 | 697 | $currency = give_get_currency(); |
| 698 | 698 | |
| 699 | 699 | switch ( $currency ) { |
| 700 | 700 | // case 'RIAL' : |
| 701 | - case 'JPY' : | |
| 702 | - case 'KRW' : | |
| 701 | + case 'JPY': | |
| 702 | + case 'KRW': | |
| 703 | 703 | // case 'TWD' : |
| 704 | 704 | // case 'HUF' : |
| 705 | 705 | |
| 706 | 706 | $decimals = 0; |
| @@ -771,14 +771,14 @@ | ||
| 771 | 771 | * Decrease form earnings. |
| 772 | 772 | * |
| 773 | 773 | * @deprecated 1.8.17 |
| 774 | 774 | * |
| 775 | - * @param int $form_id | |
| 775 | + * @param int $form_id | |
| 776 | 776 | * @param $amount |
| 777 | 777 | * |
| 778 | 778 | * @return bool|int |
| 779 | 779 | */ |
| 780 | -function give_decrease_earnings( $form_id = 0, $amount ) { | |
| 780 | +function give_decrease_earnings( $form_id, $amount ) { | |
| 781 | 781 | return give_decrease_form_earnings( $form_id, $amount ); |
| 782 | 782 | } |
| 783 | 783 | |
| 784 | 784 | /** |
| @@ -818,12 +818,12 @@ | ||
| 818 | 818 | if ( is_array( $meta ) && ! empty( $meta['key'] ) ) { |
| 819 | 819 | $donation = give_get_payment_by( 'key', $meta['key'] ); |
| 820 | 820 | } |
| 821 | 821 | |
| 822 | - $args = array( | |
| 822 | + $args = [ | |
| 823 | 823 | 'only_level' => $only_level, |
| 824 | 824 | 'separator' => $separator, |
| 825 | - ); | |
| 825 | + ]; | |
| 826 | 826 | |
| 827 | 827 | return give_get_donation_form_title( $donation, $args ); |
| 828 | 828 | } |
| 829 | 829 | |
| @@ -859,9 +859,9 @@ | ||
| 859 | 859 | * @deprecated 2.3.0 |
| 860 | 860 | * |
| 861 | 861 | * @return array |
| 862 | 862 | */ |
| 863 | -function give_get_donor_donation_comments( $donor_id, $comment_args = array(), $search = '' ) { | |
| 863 | +function give_get_donor_donation_comments( $donor_id, $comment_args = [], $search = '' ) { | |
| 864 | 864 | _give_deprecated_function( |
| 865 | 865 | __FUNCTION__, |
| 866 | 866 | '2.3.0', |
| 867 | 867 | 'Give()->comment->db' |
| @@ -873,9 +873,9 @@ | ||
| 873 | 873 | $comment_args, |
| 874 | 874 | $search |
| 875 | 875 | ); |
| 876 | 876 | |
| 877 | - return ( ! empty( $comments ) ? $comments : array() ); | |
| 877 | + return ( ! empty( $comments ) ? $comments : [] ); | |
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | /** |
| 881 | 881 | * Converts a PHP date format for use in JavaScript. |
| @@ -961,25 +961,25 @@ | ||
| 961 | 961 | |
| 962 | 962 | // Backward compatibility. |
| 963 | 963 | if ( ! give_has_upgrade_completed( 'v230_move_donor_note' ) ) { |
| 964 | 964 | |
| 965 | - $comment_args = array( | |
| 965 | + $comment_args = [ | |
| 966 | 966 | 'post_id' => 0, |
| 967 | 967 | 'orderby' => 'comment_ID', |
| 968 | 968 | 'order' => 'DESC', |
| 969 | 969 | 'number' => 1, |
| 970 | - 'meta_query' => array( | |
| 970 | + 'meta_query' => [ | |
| 971 | 971 | 'related' => 'AND', |
| 972 | - array( | |
| 972 | + [ | |
| 973 | 973 | 'key' => '_give_donor_id', |
| 974 | - 'value' => $donor_id | |
| 975 | - ), | |
| 976 | - array( | |
| 974 | + 'value' => $donor_id, | |
| 975 | + ], | |
| 976 | + [ | |
| 977 | 977 | 'key' => '_give_anonymous_donation', |
| 978 | - 'value' => 0 | |
| 979 | - ) | |
| 980 | - ) | |
| 981 | - ); | |
| 978 | + 'value' => 0, | |
| 979 | + ], | |
| 980 | + ], | |
| 981 | + ]; | |
| 982 | 982 | |
| 983 | 983 | // Get donor donation comment for specific form. |
| 984 | 984 | if ( $form_id ) { |
| 985 | 985 | $comment_args['parent'] = $form_id; |
| @@ -989,31 +989,31 @@ | ||
| 989 | 989 | |
| 990 | 990 | return $comment; |
| 991 | 991 | } |
| 992 | 992 | |
| 993 | - $comment_args = array( | |
| 993 | + $comment_args = [ | |
| 994 | 994 | 'orderby' => 'comment_ID', |
| 995 | 995 | 'order' => 'DESC', |
| 996 | 996 | 'number' => 1, |
| 997 | - 'meta_query' => array( | |
| 997 | + 'meta_query' => [ | |
| 998 | 998 | 'relation' => 'AND', |
| 999 | - array( | |
| 999 | + [ | |
| 1000 | 1000 | 'key' => '_give_anonymous_donation', |
| 1001 | 1001 | 'value' => 0, |
| 1002 | - ), | |
| 1003 | - array( | |
| 1002 | + ], | |
| 1003 | + [ | |
| 1004 | 1004 | 'key' => '_give_donor_id', |
| 1005 | 1005 | 'value' => $donor_id, |
| 1006 | - ), | |
| 1007 | - ), | |
| 1008 | - ); | |
| 1006 | + ], | |
| 1007 | + ], | |
| 1008 | + ]; | |
| 1009 | 1009 | |
| 1010 | 1010 | // Get donor donation comment for specific form. |
| 1011 | 1011 | if ( $form_id ) { |
| 1012 | - $comment_args['meta_query'][] = array( | |
| 1012 | + $comment_args['meta_query'][] = [ | |
| 1013 | 1013 | 'key' => '_give_form_id', |
| 1014 | 1014 | 'value' => $form_id, |
| 1015 | - ); | |
| 1015 | + ]; | |
| 1016 | 1016 | } |
| 1017 | 1017 | |
| 1018 | 1018 | $sql = Give()->comment->db->get_sql( $comment_args ); |
| 1019 | 1019 | |
| @@ -1019,5 +1019,237 @@ | ||
| 1019 | 1019 | |
| 1020 | 1020 | $comment = current( $wpdb->get_results( $sql ) ); |
| 1021 | 1021 | |
| 1022 | 1022 | return $comment; |
| 1023 | +} | |
| 1024 | + | |
| 1025 | +/** | |
| 1026 | + * Email template tag: {receipt_id} | |
| 1027 | + * | |
| 1028 | + * @since 1.0 | |
| 1029 | + * @deprecated 2.4.0 | |
| 1030 | + * | |
| 1031 | + * @param array $tag_args | |
| 1032 | + * | |
| 1033 | + * @return string receipt_id | |
| 1034 | + */ | |
| 1035 | +function give_email_tag_receipt_id( $tag_args ) { | |
| 1036 | + $receipt_id = ''; | |
| 1037 | + // Backward compatibility. | |
| 1038 | + $tag_args = give_20_bc_str_type_email_tag_param( $tag_args ); | |
| 1039 | + switch ( true ) { | |
| 1040 | + case give_check_variable( $tag_args, 'isset', 0, 'payment_id' ): | |
| 1041 | + $receipt_id = give_get_payment_key( $tag_args['payment_id'] ); | |
| 1042 | + break; | |
| 1043 | + } | |
| 1044 | + | |
| 1045 | + /** | |
| 1046 | + * Filter the {receipt_id} email template tag output. | |
| 1047 | + * | |
| 1048 | + * @since 2.0 | |
| 1049 | + * | |
| 1050 | + * @param string $receipt_id | |
| 1051 | + * @param array $tag_args | |
| 1052 | + */ | |
| 1053 | + return apply_filters( 'give_email_tag_receipt_id', $receipt_id, $tag_args ); | |
| 1054 | +} | |
| 1055 | + | |
| 1056 | + | |
| 1057 | +/** | |
| 1058 | + * Check site host | |
| 1059 | + * | |
| 1060 | + * @since 1.0 | |
| 1061 | + * | |
| 1062 | + * @param bool /string $host The host to check | |
| 1063 | + * | |
| 1064 | + * @return bool true if host matches, false if not | |
| 1065 | + */ | |
| 1066 | +function give_is_host( $host = false ) { | |
| 1067 | + | |
| 1068 | + _give_deprecated_function( | |
| 1069 | + __FUNCTION__, | |
| 1070 | + '2.4.2', | |
| 1071 | + 'give_get_host' | |
| 1072 | + ); | |
| 1073 | + | |
| 1074 | + $return = false; | |
| 1075 | + | |
| 1076 | + if ( $host ) { | |
| 1077 | + $host = str_replace( ' ', '', strtolower( $host ) ); | |
| 1078 | + | |
| 1079 | + switch ( $host ) { | |
| 1080 | + case 'wpengine': | |
| 1081 | + if ( defined( 'WPE_APIKEY' ) ) { | |
| 1082 | + $return = true; | |
| 1083 | + } | |
| 1084 | + break; | |
| 1085 | + case 'pagely': | |
| 1086 | + if ( defined( 'PAGELYBIN' ) ) { | |
| 1087 | + $return = true; | |
| 1088 | + } | |
| 1089 | + break; | |
| 1090 | + case 'icdsoft': | |
| 1091 | + if ( DB_HOST == 'localhost:/tmp/mysql5.sock' ) { | |
| 1092 | + $return = true; | |
| 1093 | + } | |
| 1094 | + break; | |
| 1095 | + case 'networksolutions': | |
| 1096 | + if ( DB_HOST == 'mysqlv5' ) { | |
| 1097 | + $return = true; | |
| 1098 | + } | |
| 1099 | + break; | |
| 1100 | + case 'ipage': | |
| 1101 | + if ( strpos( DB_HOST, 'ipagemysql.com' ) !== false ) { | |
| 1102 | + $return = true; | |
| 1103 | + } | |
| 1104 | + break; | |
| 1105 | + case 'ipower': | |
| 1106 | + if ( strpos( DB_HOST, 'ipowermysql.com' ) !== false ) { | |
| 1107 | + $return = true; | |
| 1108 | + } | |
| 1109 | + break; | |
| 1110 | + case 'mediatemplegrid': | |
| 1111 | + if ( strpos( DB_HOST, '.gridserver.com' ) !== false ) { | |
| 1112 | + $return = true; | |
| 1113 | + } | |
| 1114 | + break; | |
| 1115 | + case 'pairnetworks': | |
| 1116 | + if ( strpos( DB_HOST, '.pair.com' ) !== false ) { | |
| 1117 | + $return = true; | |
| 1118 | + } | |
| 1119 | + break; | |
| 1120 | + case 'rackspacecloud': | |
| 1121 | + if ( strpos( DB_HOST, '.stabletransit.com' ) !== false ) { | |
| 1122 | + $return = true; | |
| 1123 | + } | |
| 1124 | + break; | |
| 1125 | + case 'sysfix.eu': | |
| 1126 | + case 'sysfix.eupowerhosting': | |
| 1127 | + if ( strpos( DB_HOST, '.sysfix.eu' ) !== false ) { | |
| 1128 | + $return = true; | |
| 1129 | + } | |
| 1130 | + break; | |
| 1131 | + case 'flywheel': | |
| 1132 | + if ( strpos( $_SERVER['SERVER_NAME'], 'Flywheel' ) !== false ) { | |
| 1133 | + $return = true; | |
| 1134 | + } | |
| 1135 | + break; | |
| 1136 | + default: | |
| 1137 | + $return = false; | |
| 1138 | + }// End switch(). | |
| 1139 | + }// End if(). | |
| 1140 | + | |
| 1141 | + return $return; | |
| 1142 | +} | |
| 1143 | + | |
| 1144 | +/** | |
| 1145 | + * Get list of premium add-ons | |
| 1146 | + * | |
| 1147 | + * @since 2.5.0 | |
| 1148 | + * @deprecated 2.9.2 | |
| 1149 | + * | |
| 1150 | + * @return array | |
| 1151 | + * | |
| 1152 | + */ | |
| 1153 | +function give_get_premium_add_ons() { | |
| 1154 | + $list = wp_extract_urls( give_add_ons_feed( 'addons-directory', false ) ); | |
| 1155 | + $list = array_values( | |
| 1156 | + array_filter( | |
| 1157 | + $list, | |
| 1158 | + static function ( $url ) { | |
| 1159 | + return false !== strpos( $url, 'givewp.com/addons' ); | |
| 1160 | + } | |
| 1161 | + ) | |
| 1162 | + ); | |
| 1163 | + | |
| 1164 | + return array_map( | |
| 1165 | + static function ( $url ) { | |
| 1166 | + $path = wp_parse_url( untrailingslashit( $url ) )['path']; | |
| 1167 | + | |
| 1168 | + return str_replace( '/addons/', '', $path ); | |
| 1169 | + }, | |
| 1170 | + $list | |
| 1171 | + ); | |
| 1172 | +} | |
| 1173 | + | |
| 1174 | +/** | |
| 1175 | + * Displays Stripe Connect Button. | |
| 1176 | + * | |
| 1177 | + * @since 2.5.0 | |
| 1178 | + * @deprecated 2.20.2 | |
| 1179 | + * | |
| 1180 | + * @return string | |
| 1181 | + */ | |
| 1182 | +function give_stripe_connect_button() { | |
| 1183 | + _give_deprecated_function( | |
| 1184 | + __FUNCTION__, | |
| 1185 | + '2.13.0' | |
| 1186 | + ); | |
| 1187 | + | |
| 1188 | + // Prepare Stripe Connect URL. | |
| 1189 | + $link = add_query_arg( | |
| 1190 | + [ | |
| 1191 | + 'stripe_action' => 'connect', | |
| 1192 | + 'mode' => give_is_test_mode() ? 'test' : 'live', | |
| 1193 | + 'return_url' => rawurlencode( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=stripe-settings' ) ), | |
| 1194 | + 'website_url' => get_bloginfo( 'url' ), | |
| 1195 | + 'give_stripe_connected' => '0', | |
| 1196 | + ], | |
| 1197 | + 'https://connect.givewp.com/stripe/connect.php' | |
| 1198 | + ); | |
| 1199 | + | |
| 1200 | + return sprintf( | |
| 1201 | + '<a href="%1$s" class="give-stripe-connect"><span>%2$s</span></a>', | |
| 1202 | + esc_url( $link ), | |
| 1203 | + esc_html__( 'Connect with Stripe', 'give' ) | |
| 1204 | + ); | |
| 1205 | +} | |
| 1206 | + | |
| 1207 | +/** | |
| 1208 | + * Stripe Disconnect URL. | |
| 1209 | + * | |
| 1210 | + * @param string $account_id Stripe Account ID. | |
| 1211 | + * @param string $account_name Stripe Account Name. | |
| 1212 | + * | |
| 1213 | + * @since 2.5.0 | |
| 1214 | + * @deprecated 2.13.0 | |
| 1215 | + * | |
| 1216 | + * @return string | |
| 1217 | + */ | |
| 1218 | +function give_stripe_disconnect_url( $account_id = '', $account_name = '' ) { | |
| 1219 | + _give_deprecated_function( | |
| 1220 | + __FUNCTION__, | |
| 1221 | + '2.13.0' | |
| 1222 | + ); | |
| 1223 | + | |
| 1224 | + $args = [ | |
| 1225 | + 'stripe_action' => 'disconnect', | |
| 1226 | + 'mode' => give_is_test_mode() ? 'test' : 'live', | |
| 1227 | + 'stripe_user_id' => $account_id, | |
| 1228 | + 'return_url' => rawurlencode( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=stripe-settings' ) ), | |
| 1229 | + ]; | |
| 1230 | + | |
| 1231 | + // Send Account Name. | |
| 1232 | + if ( ! empty( $account_name ) ) { | |
| 1233 | + $args['account_name'] = $account_name; | |
| 1234 | + } | |
| 1235 | + | |
| 1236 | + // Prepare Stripe Disconnect URL. | |
| 1237 | + return esc_url_raw( add_query_arg( | |
| 1238 | + $args, | |
| 1239 | + 'https://connect.givewp.com/stripe/connect.php' | |
| 1240 | + ) ); | |
| 1241 | +} | |
| 1242 | + | |
| 1243 | +/** | |
| 1244 | + * Admin notices for invalid or expired add-on licenses. | |
| 1245 | + * | |
| 1246 | + * Replaced by the Harbor unified licensing experience. | |
| 1247 | + * | |
| 1248 | + * @since 2.5.0 | |
| 1249 | + * @deprecated 4.15.0 | |
| 1250 | + * | |
| 1251 | + * @return void | |
| 1252 | + */ | |
| 1253 | +function give_license_notices() { | |
| 1254 | + _give_deprecated_function( __FUNCTION__, '4.15.0' ); | |
| 1023 | 1255 | } |