Skip to content

Commit 15d99fb

Browse files
committed
move submit wrapper & button to common method where possible
1 parent 1911aa0 commit 15d99fb

20 files changed

Lines changed: 41 additions & 128 deletions

classes/suggested-tasks/providers/class-disable-comment-pagination.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,7 @@ public function print_popover_instructions() {
120120
* @return void
121121
*/
122122
public function print_popover_form_contents() {
123-
?>
124-
<div class="prpl-steps-nav-wrapper">
125-
<button type="submit" class="prpl-button prpl-button-primary">
126-
<?php \esc_html_e( 'Disable comment pagination', 'progress-planner' ); ?>
127-
</button>
128-
</div>
129-
<?php
123+
$this->print_submit_button( \__( 'Disable comment pagination', 'progress-planner' ) );
130124
}
131125

132126
/**

classes/suggested-tasks/providers/class-hello-world.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,7 @@ public function should_add_task() {
139139
* @return void
140140
*/
141141
public function print_popover_form_contents() {
142-
?>
143-
<div class="prpl-steps-nav-wrapper">
144-
<button type="submit" class="prpl-button prpl-button-primary">
145-
<?php \esc_html_e( 'Delete the "Hello World!" post', 'progress-planner' ); ?>
146-
</button>
147-
</div>
148-
<?php
142+
$this->print_submit_button( \__( 'Delete the "Hello World!" post', 'progress-planner' ) );
149143
}
150144

151145
/**

classes/suggested-tasks/providers/class-permalink-structure.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -236,13 +236,8 @@ public function print_popover_form_contents() {
236236
</div>
237237
</fieldset>
238238
</div>
239-
240-
<div class="prpl-steps-nav-wrapper">
241-
<button type="submit" class="prpl-button prpl-button-primary">
242-
<?php \esc_html_e( 'Set permalink structure', 'progress-planner' ); ?>
243-
</button>
244-
</div>
245239
<?php
240+
$this->print_submit_button( \__( 'Set permalink structure', 'progress-planner' ) );
246241
}
247242

248243
/**

classes/suggested-tasks/providers/class-sample-page.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,7 @@ public function should_add_task() {
138138
* @return void
139139
*/
140140
public function print_popover_form_contents() {
141-
?>
142-
<div class="prpl-steps-nav-wrapper">
143-
<button type="submit" class="prpl-button prpl-button-primary">
144-
<?php \esc_html_e( 'Delete the "Sample Page" page', 'progress-planner' ); ?>
145-
</button>
146-
</div>
147-
<?php
141+
$this->print_submit_button( \__( 'Delete the "Sample Page" page', 'progress-planner' ) );
148142
}
149143

150144
/**

classes/suggested-tasks/providers/class-search-engine-visibility.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,7 @@ public function print_popover_instructions() {
112112
* @return void
113113
*/
114114
public function print_popover_form_contents() {
115-
?>
116-
<div class="prpl-steps-nav-wrapper">
117-
<button type="submit" class="prpl-button prpl-button-primary">
118-
<?php \esc_html_e( 'Allow search engines to index your site', 'progress-planner' ); ?>
119-
</button>
120-
</div>
121-
<?php
115+
$this->print_submit_button( \__( 'Allow search engines to index your site', 'progress-planner' ) );
122116
}
123117

124118
/**

classes/suggested-tasks/providers/class-select-locale.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -225,13 +225,8 @@ public function print_popover_form_contents() {
225225
'show_available_translations' => \current_user_can( 'install_languages' ) && \wp_can_install_language_pack(),
226226
]
227227
);
228-
?>
229-
<div class="prpl-steps-nav-wrapper">
230-
<button type="submit" class="prpl-button prpl-button-primary">
231-
<?php \esc_html_e( 'Select locale', 'progress-planner' ); ?>
232-
</button>
233-
</div>
234-
<?php
228+
229+
$this->print_submit_button( \__( 'Select locale', 'progress-planner' ) );
235230
}
236231

237232
/**

classes/suggested-tasks/providers/class-select-timezone.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,8 @@ public function print_popover_form_contents() {
143143
<?php echo \wp_timezone_choice( $tzstring, \get_user_locale() ); ?>
144144
</select>
145145
</label>
146-
<div class="prpl-steps-nav-wrapper">
147-
<button type="submit" class="prpl-button prpl-button-primary">
148-
<?php \esc_html_e( 'Set site timezone', 'progress-planner' ); ?>
149-
</button>
150-
</div>
151146
<?php
147+
$this->print_submit_button( \__( 'Set site timezone', 'progress-planner' ) );
152148
}
153149

154150
/**

classes/suggested-tasks/providers/class-set-date-format.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,8 @@ public function print_popover_form_contents() {
242242
</p>
243243
</fieldset>
244244
</div>
245-
<div class="prpl-steps-nav-wrapper">
246-
<button type="submit" class="prpl-button prpl-button-primary">
247-
<?php \esc_html_e( 'Set date format', 'progress-planner' ); ?>
248-
</button>
249-
</div>
250245
<?php
246+
$this->print_submit_button( \__( 'Set date format', 'progress-planner' ) );
251247
}
252248

253249
/**

classes/suggested-tasks/providers/class-tasks-interactive.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,27 @@ public function print_popover_instructions() {
206206
echo '<p>' . \wp_kses_post( $description ) . '</p>';
207207
}
208208

209+
/**
210+
* Print the submit button.
211+
*
212+
* @param string $button_text The text for the button.
213+
* If empty, the default text "Submit" will be used.
214+
*
215+
* @return void
216+
*/
217+
protected function print_submit_button( $button_text = '' ) {
218+
if ( empty( $button_text ) ) {
219+
$button_text = \__( 'Submit', 'progress-planner' );
220+
}
221+
?>
222+
<div class="prpl-steps-nav-wrapper">
223+
<button type="submit" class="prpl-button prpl-button-primary">
224+
<?php echo \esc_html( $button_text ); ?>
225+
</button>
226+
</div>
227+
<?php
228+
}
229+
209230
/**
210231
* Print the popover form contents.
211232
*

classes/suggested-tasks/providers/integrations/aioseo/class-archive-author.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,7 @@ public function print_popover_instructions() {
135135
* @return void
136136
*/
137137
public function print_popover_form_contents() {
138-
?>
139-
<div class="prpl-steps-nav-wrapper">
140-
<button type="submit" class="prpl-button prpl-button-primary">
141-
<?php \esc_html_e( 'Noindex the author archive', 'progress-planner' ); ?>
142-
</button>
143-
</div>
144-
<?php
138+
$this->print_submit_button( \__( 'Noindex the author archive', 'progress-planner' ) );
145139
}
146140

147141
/**

0 commit comments

Comments
 (0)