This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'wpwham_checkout_files_upload_validate_file_type', 'wpw20250531_restore_normal_file_type_validation', 10, 3 ); | |
| function wpw20250531_restore_normal_file_type_validation( $result, $file_uploader, $file ) { | |
| $result = true; | |
| $files_accepted = get_option( 'alg_checkout_files_upload_file_accept_' . $file_uploader, '.jpg,.jpeg,.png' ); | |
| if ( $files_accepted > '' ) { | |
| $files_accepted = array_map( 'trim', explode( ',', strtolower( $files_accepted ) ) ); | |
| if ( is_array( $files_accepted ) && ! empty( $files_accepted ) ) { | |
| $file_type = strtolower( '.' . pathinfo( $file['name'], PATHINFO_EXTENSION ) ); | |
| if ( ! in_array( $file_type, $files_accepted ) ) { | |
| $result = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_action( 'setted_transient', 'si20250220_change_paypal_params', 10, 3 ); | |
| function si20250220_change_paypal_params( $transient, $value, $expiration ) { | |
| if ( strpos( $transient, 'sliced_paypal_' ) === 0 && strpos( $value, 'NOSHIPPING=1' ) !== false ) { | |
| $value = str_replace( 'NOSHIPPING=1', 'NOSHIPPING=0', $value ); | |
| set_transient( $transient, $value, 60*60*24 ); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // which file uploader... i.e. "File Uploader #1" in the settings: | |
| $file_uploader_id = 1; | |
| // with the WooCommerce $order_id, we can get all the files for $file_uploader_id here: | |
| $order_files = get_post_meta( $order_id, '_alg_checkout_files_upload_' . $file_uploader_id, true ); | |
| // $order_files will be an array. we can grab a specific file by key here: | |
| $order_file = $order_files[ $file_key ]; | |
| // once we've picked a single $order_file, we can access it's 'tmp_name' (name it's stored under on the server): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'sliced_deposit_invoice_message', '__return_false' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'sliced_client_accepted_quote', 'si20220627_custom_quote_acceptance_action', 20, 2 ); | |
| function si20220627_custom_quote_acceptance_action( $id, $new_post_id ) { | |
| $invoice_id = $new_post_id ? $new_post_id : $id; | |
| if ( $invoice_id ) { | |
| if ( wp_redirect( get_permalink( $invoice_id ) ) ) { | |
| exit; | |
| } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'sliced_invoices_non_cloneable_post_metas', 'si20220524_add_non_cloneable_post_metas' ); | |
| function si20220524_add_non_cloneable_post_metas( $non_cloneable_post_metas ) { | |
| $non_cloneable_post_metas[] = '_sliced_invoice_created'; | |
| $non_cloneable_post_metas[] = '_sliced_invoice_due'; | |
| return $non_cloneable_post_metas; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function si20220524_preserve_quote_terms_on_invoice_before( $id ) { | |
| global $si20220524_quote_terms; | |
| $si20220524_quote_terms = get_post_meta( $id, '_sliced_quote_terms', true ); | |
| } | |
| function si20220524_preserve_quote_terms_on_invoice_after( $id, $new_post_id = null ) { | |
| global $si20220524_quote_terms; | |
| if ( $si20220524_quote_terms ) { | |
| if ( $new_post_id ) { | |
| // created new invoice from quote | |
| update_post_meta( $new_post_id, '_sliced_invoice_terms', $si20220524_quote_terms ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'sliced_invoice_line_items_output', 'si20220317_sliced_invoice_line_items_output_custom' ); | |
| function si20220317_sliced_invoice_line_items_output_custom( $output ) { | |
| if ( preg_match_all('#<t[hd] class="qty">(.*?)</t[hd]>#', $output, $matches) ) { | |
| $patterns = array(); | |
| $replacements = array(); | |
| foreach ( $matches[1] as $match ) { | |
| $patterns[] = '#<t[hd] class="qty">'.$match.'</t[hd]>#'; | |
| $replacements[] = ''; | |
| } | |
| $output = preg_replace($patterns, $replacements, $output); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'sliced_get_invoice_terms', 'si20220310_do_shortcodes_in_terms' ); | |
| function si20220310_do_shortcodes_in_terms( $content ) { | |
| return do_shortcode( $content ); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_filter( 'comments_open', 'si20220222_disable_comments_for_all_quotes', 10, 2 ); | |
| function si20220222_disable_comments_for_all_quotes( $open, $post_id = null ) { | |
| $_post = get_post( $post_id ); | |
| if ( $_post && ( $_post->post_type === 'sliced_quote' ) ) { | |
| $open = false; | |
| } | |
| return $open; | |
| } |
NewerOlder