This file contains 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', 'sliced_invoice_line_items_output_custom' ); | |
function sliced_invoice_line_items_output_custom( $output ) { | |
if ( preg_match_all('#<td class="qty">(.*?)</td>#', $output, $matches) ) { | |
$patterns = array(); | |
$replacements = array(); | |
foreach ( $matches[1] as $match ) { | |
$patterns[] = '#<td class="qty">'.$match.'</td>#'; | |
$replacements[] = '<td class="qty">'.intval($match).'</td>'; | |
} | |
$output = preg_replace($patterns, $replacements, $output); |
This file contains 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 sliced_custom_params_admins_only( $opts ) { | |
$opts['map_meta_cap'] = false; | |
$opts['capabilities'] = array( | |
'edit_post' => 'manage_options', | |
'read_post' => 'manage_options', | |
'delete_post' => 'manage_options', | |
'edit_posts' => 'manage_options', | |
'edit_others_posts' => 'manage_options', | |
'delete_posts' => 'manage_options', | |
'publish_posts' => 'manage_options', |
This file contains 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_invoice_top_bar_left', 'sliced_custom_apple_pay_button', 999 ); | |
add_action( 'sliced_invoice_head', 'sliced_custom_apple_pay_button_scripts' ); | |
function sliced_custom_apple_pay_button() { | |
$payments = get_option( 'sliced_payments' ); | |
if ( ! $payments['stripe_apple_pay'] ) { | |
return; | |
} | |
if( has_term( array( 'paid', 'cancelled' ), 'invoice_status' ) ) { | |
return; | |
} |
This file contains 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', 'sliced_invoice_line_items_output_20171013' ); | |
function sliced_invoice_line_items_output_20171013( $output ) { | |
// remove rate field from showing | |
$regex = array( | |
'#<th class="rate">(.*?)</th>#', | |
'#<td class="rate">(.*?)</td>#' | |
); | |
$output = preg_replace( $regex, '', $output ); | |
return $output; | |
} |
This file contains 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_after_line_items', 'sliced_admin_hide_the_adjust_field', 10, 2 ); | |
function sliced_admin_hide_the_adjust_field( $line_items_group_id, $line_items ) { | |
// for historical reasons the "adjust(%)" field is called "tax" internally, | |
// although it is no longer used for this purpose. | |
return $line_items->remove_field( 'tax', $line_items_group_id ); | |
} |
This file contains 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_email_option_fields', 'sliced_email_option_fields_add_reminder_days' ); | |
function sliced_email_option_fields_add_reminder_days( $array ) { | |
if ( ! isset( $array['fields'] ) ) { return $array; } | |
foreach ( $array['fields'] as $i => $field ) { | |
if ( isset( $field['id'] ) && $field['id'] === 'payment_reminder_days' ) { | |
// add to beginning of options list: | |
$array['fields'][$i]['options'] = array_replace( array( | |
'-60' => '60 days before Due Date', | |
'-30' => '30 days before Due Date', //etc... | |
), $array['fields'][$i]['options'] ); |
This file contains 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_pdf_init', 'sliced_pdf_html_custom_params', 10, 1 ); | |
function sliced_pdf_html_custom_params( $pdf ) { | |
$pdf->showWatermarkText = false; | |
} |
This file contains 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( 'new_to_publish', 'sliced_auto_send_invoice', 10, 1 ); | |
add_action( 'draft_to_publish', 'sliced_auto_send_invoice', 10, 1 ); | |
add_action( 'pending_to_publish', 'sliced_auto_send_invoice', 10, 1 ); | |
add_action( 'sliced_auto_send_invoice_deferred', 'sliced_auto_send_invoice_deferred_function', 10, 1 ); | |
function sliced_auto_send_invoice( $post ) { | |
if ( $post->post_type === 'sliced_invoice' ) { | |
// run in background | |
wp_schedule_single_event( time(), 'sliced_auto_send_invoice_deferred', array( $post ) ); | |
} | |
} |
This file contains 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( 'new_to_publish', 'sliced_auto_send_quote', 10, 1 ); | |
add_action( 'draft_to_publish', 'sliced_auto_send_quote', 10, 1 ); | |
add_action( 'pending_to_publish', 'sliced_auto_send_quote', 10, 1 ); | |
add_action( 'sliced_auto_send_quote_deferred', 'sliced_auto_send_quote_deferred_function', 10, 1 ); | |
function sliced_auto_send_quote( $post ) { | |
if ( $post->post_type === 'sliced_quote' ) { | |
// run in background | |
wp_schedule_single_event( time(), 'sliced_auto_send_quote_deferred', array( $post ) ); | |
} | |
} |
This file contains 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_stripe_gateway_image', 'sliced_stripe_gateway_image_custom' ); | |
function sliced_stripe_gateway_image_custom() { | |
return '<img src="' . plugins_url( '/sliced-invoices-stripe/accept-stripe.png' ) . '" alt="" />'; | |
} |
OlderNewer