documents->get_documents( 'all' );
foreach ( $documents as $document ) {
if ( is_callable( array( $document, 'init_settings' ) ) ) {
$document->init_settings();
}
}
}
public function output( $section, $nonce ) {
if ( ! wp_verify_nonce( $nonce, 'wp_wcpdf_settings_page_nonce' ) ) {
return;
}
$section = ! empty( $section ) ? $section : 'invoice';
$documents = WPO_WCPDF()->documents->get_documents( 'all' );
$output_format = 'pdf';
$section_document = null;
if ( ! empty( $_REQUEST['output_format'] ) ) {
$output_format = sanitize_text_field( wp_unslash( $_REQUEST['output_format'] ) );
}
foreach ( $documents as $document ) {
if ( $document->get_type() == $section ) {
$section_document = $document;
break;
}
}
if ( empty( $section_document ) ) {
return;
}
?>
'.esc_html( $section_document->get_title() ).'
▼'; ?>
get_type() != $section ) {
$title = wp_strip_all_tags( $document->get_title() );
if ( empty( trim( $title ) ) ) {
$title = '['.__( 'untitled', 'woocommerce-pdf-invoices-packing-slips' ).']';
}
$active = $document->get_type() == $section ? 'active' : '';
printf( '- %3$s
', esc_url( add_query_arg( 'section', $document->get_type() ) ), esc_attr( $active ), esc_html( $title ) );
}
}
?>
',
''
);
?>
output_formats ) ) {
$output_format_compatible = true;
}
$option_name = ( 'pdf' === $output_format || ! $output_format_compatible ) ? "wpo_wcpdf_documents_settings_{$section}" : "wpo_wcpdf_documents_settings_{$section}_{$output_format}";
settings_fields( $option_name );
do_settings_sections( $option_name );
submit_button();
}
}
endif; // class_exists