Warning! The settings below are meant for debugging/development only. Do not use them on a live website!' , 'woocommerce-pdf-invoices-packing-slips' ) );
}
/**
* Custom fields section callback.
*
* @return void.
*/
public function custom_fields_section() {
echo wp_kses_post( __( 'These are used for the (optional) footer columns in the Modern (Premium) template, but can also be used for other elements in your custom template' , 'woocommerce-pdf-invoices-packing-slips' ) );
}
/**
* HTML section callback.
*
* @return void.
*/
public function html_section( $args ) {
extract( $this->normalize_settings_args( $args ) );
// output HTML
echo wp_kses_post( $html );
}
/**
* Checkbox callback.
*
* args:
* option_name - name of the main option
* id - key of the setting
* value - value if not 1 (optional)
* default - default setting (optional)
* description - description (optional)
*
* @return void.
*/
public function checkbox( $args ) {
extract( $this->normalize_settings_args( $args ) );
// output checkbox
printf( '', esc_attr( $id ), esc_attr( $setting_name ), esc_attr( $value ), checked( $value, $current, false ), ! empty( $disabled ) ? 'disabled="disabled"' : '' );
// print store empty input if true
if( $store_unchecked ) {
printf( '', $option_name, esc_attr( $id ) );
}
// output description.
if ( ! empty( $description ) ) {
printf( '
%s
', wp_kses_post( $description ) );
}
}
/**
* Text input callback.
*
* args:
* option_name - name of the main option
* id - key of the setting
* size - size of the text input (em)
* default - default setting (optional)
* description - description (optional)
* type - type (optional)
*
* @return void.
*/
public function text_input( $args ) {
extract( $this->normalize_settings_args( $args ) );
if ( empty( $type ) ) {
$type = 'text';
}
$size = ! empty( $size ) ? sprintf( 'size="%s"', esc_attr( $size ) ) : '';
printf( '', esc_attr( $type ), esc_attr( $id ), esc_attr( $setting_name ), esc_attr( $current ), $size, esc_attr( $placeholder ), ! empty( $disabled ) ? 'disabled="disabled"' : '' );
// output description.
if ( ! empty( $description ) ) {
printf( '
%s
', wp_kses_post( $description ) );
}
}
/**
* URL input callback.
*
* args:
* option_name - name of the main option
* id - key of the setting
* size - size of the text input (em)
* default - default setting (optional)
* description - description (optional)
* type - type (optional)
*
* @return void.
*/
public function url_input( $args ) {
extract( $this->normalize_settings_args( $args ) );
if ( empty( $type ) ) {
$type = 'url';
}
$size = ! empty( $size ) ? sprintf( 'size="%s"', esc_attr( $size ) ) : '';
printf( '', esc_attr( $type ), esc_attr( $id ), esc_attr( $setting_name ), sanitize_url( $current ), $size, esc_attr( $placeholder ), ! empty( $disabled ) ? 'disabled="disabled"' : '' );
// output description.
if ( ! empty( $description ) ) {
printf( '
%s
', wp_kses_post( $description ) );
}
}
/**
* Email input callback.
*
* args:
* option_name - name of the main option
* id - key of the setting
* size - size of the text input (em)
* default - default setting (optional)
* description - description (optional)
* type - type (optional)
*
* @return void.
*/
public function email_input( $args ) {
extract( $this->normalize_settings_args( $args ) );
if ( empty( $type ) ) {
$type = 'email';
}
$size = ! empty( $size ) ? sprintf( 'size="%s"', esc_attr( $size ) ) : '';
printf( '', esc_attr( $type ), esc_attr( $id ), esc_attr( $setting_name ), sanitize_email( $current ), $size, esc_attr( $placeholder ), ! empty( $disabled ) ? 'disabled="disabled"' : '' );
// output description.
if ( ! empty( $description ) ) {
printf( '
%s
', wp_kses_post( $description ) );
}
}
/**
* Combined checkbox & text input callback.
*
* args:
* option_name - name of the main option
* id - key of the setting
* value - value if not 1 (optional)
* default - default setting (optional)
* description - description (optional)
*
* @return void.
*/
public function checkbox_text_input( $args ) {
$args = $this->normalize_settings_args( $args );
extract( $args );
unset( $args['description'] ); // already extracted, should only be used here
// get checkbox
ob_start();
$this->checkbox( $args );
$checkbox = ob_get_clean();
// get text input for insertion in wrapper
$input_args = array(
'id' => $args['text_input_id'],
'default' => isset( $args['text_input_default'] ) ? (string) $args['text_input_default'] : NULL,
'size' => isset( $args['text_input_size'] ) ? $args['text_input_size'] : NULL,
) + $args;
unset( $input_args['current'] );
unset( $input_args['setting_name'] );
ob_start();
$this->text_input( $input_args );
$text_input = ob_get_clean();
if (! empty( $text_input_wrap ) ) {
printf( "{$checkbox} {$text_input_wrap}", $text_input);
} else {
echo "{$checkbox} {$text_input}";
}
// output description.
if ( ! empty( $description ) ) {
printf( '