WC_Settings_Emails::email_notification_setting()publicWC 1.0

Output email notification settings.

Метод класса: WC_Settings_Emails{}

Возвращает

null. Ничего (null).

Использование

$WC_Settings_Emails = new WC_Settings_Emails();
$WC_Settings_Emails->email_notification_setting();

Код WC_Settings_Emails::email_notification_setting() WC 9.8.2

<?php
public function email_notification_setting() {
	// Define emails that can be customised here.
	$mailer          = WC()->mailer();
	$email_templates = $mailer->get_emails();

	?>
	<tr valign="top">
	<td class="wc_emails_wrapper" colspan="2">
		<table class="wc_emails widefat" cellspacing="0">
			<thead>
				<tr>
					<?php
					$columns = apply_filters(
						'woocommerce_email_setting_columns',
						array(
							'status'     => '',
							'name'       => __( 'Email', 'woocommerce' ),
							'email_type' => __( 'Content type', 'woocommerce' ),
							'recipient'  => __( 'Recipient(s)', 'woocommerce' ),
							'actions'    => '',
						)
					);
					foreach ( $columns as $key => $column ) {
						echo '<th class="wc-email-settings-table-' . esc_attr( $key ) . '">' . esc_html( $column ) . '</th>';
					}
					?>
					</tr>
				</thead>
				<tbody>
					<?php
					foreach ( $email_templates as $email_key => $email ) {
						echo '<tr>';

						foreach ( $columns as $key => $column ) {

							switch ( $key ) {
								case 'name':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									<a href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) ) . '">' . esc_html( $email->get_title() ) . '</a>
									' . wc_help_tip( $email->get_description() ) . '
									</td>';
									break;
								case 'recipient':
									$to  = $email->is_customer_email() ? __( 'Customer', 'woocommerce' ) : $email->get_recipient();
									$cc  = false;
									$bcc = false;
									if ( FeaturesUtil::feature_is_enabled( 'email_improvements' ) ) {
										$ccs  = $email->get_cc_recipient();
										$bccs = $email->get_bcc_recipient();
										// Translators: %s: comma-separated email addresses to which the email is cc-ed.
										$cc = $ccs ? sprintf( __( '<b>Cc</b>: %s', 'woocommerce' ), $ccs ) : false;
										// Translators: %s: comma-separated email addresses to which the email is bcc-ed.
										$bcc = $bccs ? sprintf( __( '<b>Bcc</b>: %s', 'woocommerce' ), $bccs ) : false;
										if ( $cc || $bcc ) {
											// Translators: %s: comma-separated email addresses to which the email is sent.
											$to = sprintf( __( '<b>To</b>: %s', 'woocommerce' ), $to );
										}
									}
									$allowed_tags = array( 'b' => array() );

									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';
									echo wp_kses( $to, $allowed_tags );
									if ( $cc ) {
										echo '<br>' . wp_kses( $cc, $allowed_tags );
									}
									if ( $bcc ) {
										echo '<br>' . wp_kses( $bcc, $allowed_tags );
									}
									echo '</td>';
									break;
								case 'status':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">';

									if ( $email->is_manual() ) {
										echo '<span class="status-manual tips" data-tip="' . esc_attr__( 'Manually sent', 'woocommerce' ) . '">' . esc_html__( 'Manual', 'woocommerce' ) . '</span>';
									} elseif ( $email->is_enabled() ) {
										echo '<span class="status-enabled tips" data-tip="' . esc_attr__( 'Enabled', 'woocommerce' ) . '">' . esc_html__( 'Yes', 'woocommerce' ) . '</span>';
									} else {
										echo '<span class="status-disabled tips" data-tip="' . esc_attr__( 'Disabled', 'woocommerce' ) . '">-</span>';
									}

									echo '</td>';
									break;
								case 'email_type':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									' . esc_html( $email->get_content_type() ) . '
									</td>';
									break;
								case 'actions':
									echo '<td class="wc-email-settings-table-' . esc_attr( $key ) . '">
									<a class="button alignright" href="' . esc_url( admin_url( 'admin.php?page=wc-settings&tab=email&section=' . strtolower( $email_key ) ) ) . '">' . esc_html__( 'Manage', 'woocommerce' ) . '</a>
									</td>';
									break;
								default:
									do_action( 'woocommerce_email_setting_column_' . $key, $email );
									break;
							}
						}

						echo '</tr>';
					}
					?>
				</tbody>
			</table>
		</td>
	</tr>
	<?php
}