Skip to content

Commit de3983e

Browse files
committed
convert view to html
1 parent eba9422 commit de3983e

1 file changed

Lines changed: 48 additions & 30 deletions

File tree

views/tasks/set-date-format-form-contents.php

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,57 @@
1818
$prpl_date_formats = array_unique( \apply_filters( 'date_formats', [ __( 'F j, Y' ), 'F j, Y', 'Y-m-d', 'm/d/Y', 'd/m/Y', 'd.m.Y' ] ) ); // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound, WordPress.WP.I18n.MissingArgDomain -- WP core filter & we want to add the default date format
1919

2020
$prpl_custom = true;
21+
?>
22+
<div class="radios">
23+
<fieldset>
24+
<?php foreach ( $prpl_date_formats as $prpl_format ) : ?>
25+
<div class="prpl-radio-wrapper">
26+
<label class="prpl-custom-radio"><input type="radio" name="date_format" value="<?php echo \esc_attr( $prpl_format ); ?>"
27+
<?php
28+
if ( \get_option( 'date_format' ) === $prpl_format ) { // checked() uses "==" rather than "===".
29+
echo " checked='checked'";
30+
$prpl_custom = false;
31+
}
32+
?>
33+
/>
34+
<span class="prpl-custom-control"></span>
35+
<span class="date-time-text format-i18n"><?php echo \esc_html( \date_i18n( $prpl_format ) ); ?></span>
36+
<code><?php echo \esc_html( $prpl_format ); ?></code>
37+
</label>
38+
</div>
39+
<?php endforeach; ?>
2140

22-
echo '<div class="radios">';
23-
echo '<fieldset>';
24-
foreach ( $prpl_date_formats as $prpl_format ) {
25-
echo '<div class="prpl-radio-wrapper">';
26-
echo "<label class='prpl-custom-radio'><input type='radio' name='date_format' value='" . \esc_attr( $prpl_format ) . "'";
27-
if ( \get_option( 'date_format' ) === $prpl_format ) { // checked() uses "==" rather than "===".
28-
echo " checked='checked'";
29-
$prpl_custom = false;
30-
}
31-
echo ' /> <span class="prpl-custom-control"></span><span class="date-time-text format-i18n">' . \esc_html( \date_i18n( $prpl_format ) ) . '</span><code>' . \esc_html( $prpl_format ) . '</code></label>';
32-
echo '</div>';
33-
}
41+
<?php /* Custom date format. */ ?>
42+
<div class="prpl-radio-wrapper">
43+
<label class="prpl-custom-radio">
44+
<input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m" <?php checked( $prpl_custom ); ?>/>
45+
<span class="prpl-custom-control"></span> <span class="date-time-text date-time-custom-text">
46+
<?php \esc_html_e( 'Custom:', 'progress-planner' ); ?>
47+
<span class="screen-reader-text">
48+
<?php
49+
/* translators: Hidden accessibility text. */
50+
\esc_html_e( 'enter a custom date format in the following field', 'progress-planner' );
51+
?>
52+
</span>
53+
</span>
54+
</label>
55+
<label for="date_format_custom" class="screen-reader-text">
56+
<?php
57+
/* translators: Hidden accessibility text. */
58+
\esc_html_e( 'Custom date format:', 'progress-planner' );
59+
?>
60+
</label>
61+
<input type="text" name="date_format_custom" id="date_format_custom" value="<?php echo \esc_attr( \get_option( 'date_format' ) ); ?>" class="small-text" />
62+
</div>
3463

35-
echo '<div class="prpl-radio-wrapper">';
36-
echo '<label class="prpl-custom-radio"><input type="radio" name="date_format" id="date_format_custom_radio" value="\c\u\s\t\o\m"';
37-
checked( $prpl_custom );
38-
echo '/> <span class="prpl-custom-control"></span> <span class="date-time-text date-time-custom-text">' . \esc_html( __( 'Custom:', 'progress-planner' ) ) . '<span class="screen-reader-text"> ' .
39-
/* translators: Hidden accessibility text. */
40-
\esc_html( __( 'enter a custom date format in the following field', 'progress-planner' ) ) .
41-
'</span></span></label>' .
42-
'<label for="date_format_custom" class="screen-reader-text">' .
43-
/* translators: Hidden accessibility text. */
44-
\esc_html( __( 'Custom date format:', 'progress-planner' ) ) .
45-
'</label>' .
46-
'<input type="text" name="date_format_custom" id="date_format_custom" value="' . \esc_attr( \get_option( 'date_format' ) ) . '" class="small-text" />' .
47-
'</div>' .
48-
'<p><strong>' . \esc_html( __( 'Preview:', 'progress-planner' ) ) . '</strong> <span class="example">' . \esc_html( \date_i18n( \get_option( 'date_format' ) ) ) . '</span>' .
49-
"<span class='spinner'></span>\n" . '</p>';
50-
?>
51-
</fieldset>
64+
<?php /* Preview. */ ?>
65+
<p>
66+
<strong><?php \esc_html_e( 'Preview:', 'progress-planner' ); ?></strong>
67+
<span class="example"><?php echo \esc_html( \date_i18n( \get_option( 'date_format' ) ) ); ?></span>
68+
<span class="spinner"></span>
69+
</p>
70+
</fieldset>
5271
</div>
5372
<button type="submit" class="prpl-button prpl-button-primary" style="color: #fff;">
5473
<?php \esc_html_e( 'Set date format', 'progress-planner' ); ?>
5574
</button>
56-
<?php

0 commit comments

Comments
 (0)