Passed
Push — dev/6.0.0 ( 3895eb...981341 )
by Sudar
02:46
created

Renderer::render_cron_settings()   B

Complexity

Conditions 5
Paths 16

Size

Total Lines 82
Code Lines 60

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 30

Importance

Changes 0
Metric Value
cc 5
eloc 60
c 0
b 0
f 0
nc 16
nop 0
dl 0
loc 82
ccs 0
cts 0
cp 0
crap 30
rs 8.5616

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
<?php
2
3
namespace BulkWP\BulkDelete\Core\Base\Mixin;
4
5 1
defined( 'ABSPATH' ) || exit; // Exit if accessed directly.
6
7
/**
8
 * Container of all Render methods.
9
 *
10
 * Ideally this should be a Trait. Since Bulk Delete still supports PHP 5.3, this is implemented as a class.
11
 * Once the minimum requirement is increased to PHP 5.3, this will be changed into a Trait.
12
 *
13
 * @since 6.0.0
14
 */
15
abstract class Renderer extends Fetcher {
16
	/**
17
	 * Slug for the form fields.
18
	 *
19
	 * @var string
20
	 */
21
	protected $field_slug;
22
23
	/**
24
	 * Render post status including custom post status.
25
	 *
26
	 * @param string $post_type The post type for which the post status should be displayed.
27
	 */
28
	protected function render_post_status( $post_type = 'post' ) {
29
		$post_statuses = $this->get_post_statuses();
30
		$post_count    = wp_count_posts( $post_type );
31
32
		foreach ( $post_statuses as $post_status ) : ?>
33
			<tr>
34
				<td>
35
					<input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>[]" id="smbd_<?php echo esc_attr( $post_status->name ); ?>"
36
						value="<?php echo esc_attr( $post_status->name ); ?>" type="checkbox">
37
38
					<label for="smbd_<?php echo esc_attr( $post_status->name ); ?>">
39
						<?php echo esc_html( $post_status->label ), ' '; ?>
40
						<?php if ( property_exists( $post_count, $post_status->name ) ) : ?>
41
							(<?php echo absint( $post_count->{ $post_status->name } ) . ' ', __( 'Posts', 'bulk-delete' ); ?>)
42
						<?php endif; ?>
43
					</label>
44
				</td>
45
			</tr>
46
		<?php endforeach;
47
	}
48
49
	/**
50
	 * Render Post Types as radio buttons.
51
	 */
52
	protected function render_post_type_as_radios() {
53
		$post_types = $this->get_post_types();
54
		?>
55
56
		<?php foreach ( $post_types as $post_type ) : ?>
57
58
			<tr>
59
				<td scope="row">
60
					<input type="radio" name="<?php echo esc_attr( $this->field_slug ); ?>_post_type"
61
						value="<?php echo esc_attr( $post_type->name ); ?>"
62
						id="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
63
64
					<label for="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
65
						<?php echo esc_html( $post_type->label ); ?>
66
					</label>
67
				</td>
68
			</tr>
69
70
		<?php endforeach; ?>
71
		<?php
72
	}
73
74
	/**
75
	 * Render Post type with status and post count checkboxes.
76
	 */
77
	protected function render_post_type_with_status() {
78
		$post_types_by_status = $this->get_post_types_by_status();
79
		?>
80
		<tr>
81
			<td scope="row" colspan="2">
82
				<select class="enhanced-post-types-with-status" multiple="multiple" data-placeholder="Select Post Type" name="smbd_<?php echo esc_attr( $this->field_slug ); ?>[]">
83
				<?php foreach ( $post_types_by_status as $post_type => $all_status ) : ?>
84
					<optgroup label="<?php echo esc_html( $post_type ); ?>">
85
					<?php foreach ( $all_status as $status_key => $status_value ) : ?>
86
						<option value="<?php echo esc_attr( $status_key ); ?>"><?php echo esc_html( $status_value ); ?></option>
87
					<?php endforeach; ?>
88
					</optgroup>
89
				<?php endforeach; ?>
90
				</select>
91
			</td>
92
		</tr>
93
		<?php
94
	}
95
96
	/**
97
	 * Split post type and status.
98
	 *
99
	 * @param string $str Post type and status combination.
100
	 *
101
	 * @return array Post type and status as elements of array.
102
	 */
103 9
	protected function split_post_type_and_status( $str ) {
104 9
		$type_status = array();
105
106 9
		$str_arr = explode( '-', $str );
107
108 9
		if ( count( $str_arr ) > 1 ) {
109
			$type_status['status'] = end( $str_arr );
110
			$type_status['type']   = implode( '-', array_slice( $str_arr, 0, - 1 ) );
111
		} else {
112 9
			$type_status['status'] = 'publish';
113 9
			$type_status['type']   = $str;
114
		}
115
116 9
		return $type_status;
117
	}
118
119
	/**
120
	 * Render user role dropdown.
121
	 *
122
	 * @param bool $show_users_with_no_roles Should users with no user roles be shown? Default false.
123
	 */
124
	protected function render_user_role_dropdown( $show_users_with_no_roles = false ) {
125
		global $wp_roles;
126
127
		$users_count = count_users();
128
		?>
129
130
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_roles[]" class="enhanced-role-dropdown"
131
				multiple="multiple" data-placeholder="<?php _e( 'Select User Role', 'bulk-delete' ); ?>">
132
133
			<?php foreach ( $wp_roles->roles as $role => $role_details ) : ?>
134
				<option value="<?php echo esc_attr( $role ); ?>">
135
					<?php echo esc_html( $role_details['name'] ), ' (', absint( $this->get_user_count_by_role( $role, $users_count ) ), ' ', __( 'Users', 'bulk-delete' ), ')'; ?>
136
				</option>
137
			<?php endforeach; ?>
138
139
			<?php if ( $show_users_with_no_roles ) : ?>
140
				<?php if ( isset( $users_count['avail_roles']['none'] ) && $users_count['avail_roles']['none'] > 0 ) : ?>
141
					<option value="none">
142
						<?php echo __( 'No role', 'bulk-delete' ), ' (', absint( $users_count['avail_roles']['none'] ), ' ', __( 'Users', 'bulk-delete' ), ')'; ?>
143
					</option>
144
				<?php endif; ?>
145
			<?php endif; ?>
146
		</select>
147
148
		<?php
149
	}
150
151
	/**
152
	 * Render Post type dropdown.
153
	 */
154
	protected function render_post_type_dropdown() {
155
		bd_render_post_type_dropdown( $this->field_slug );
156
	}
157
158
	/**
159
	 * Render Taxonomy dropdown.
160
	 */
161
	protected function render_taxonomy_dropdown() {
162
		$taxonomies = get_taxonomies( array(), 'objects' );
163
		?>
164
165
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_taxonomy" class="enhanced-taxonomy-list" data-placeholder="<?php _e( 'Select Taxonomy', 'bulk-delete' ); ?>">
166
			<?php foreach ( $taxonomies as $taxonomy ) : ?>
167
				<option value="<?php echo esc_attr( $taxonomy->name ); ?>">
168
					<?php echo esc_html( $taxonomy->label . ' (' . $taxonomy->name . ')' ); ?>
169
				</option>
170
			<?php endforeach; ?>
171
		</select>
172
		<?php
173
	}
174
175
	/**
176
	 * Render Category dropdown.
177
	 */
178
	protected function render_category_dropdown() {
179
		$categories = $this->get_categories();
180
		?>
181
182
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_category[]" data-placeholder="<?php _e( 'Select Categories', 'bulk-delete' ); ?>"
183
				class="<?php echo sanitize_html_class( $this->enable_ajax_if_needed_to_dropdown_class_name( count( $categories ), 'select2-taxonomy' ) ); ?>"
184
				data-taxonomy="category" multiple>
185
186
			<option value="all">
187
				<?php _e( 'All Categories', 'bulk-delete' ); ?>
188
			</option>
189
190
			<?php foreach ( $categories as $category ) : ?>
191
				<option value="<?php echo absint( $category->cat_ID ); ?>">
192
					<?php echo esc_html( $category->cat_name ), ' (', absint( $category->count ), ' ', __( 'Posts', 'bulk-delete' ), ')'; ?>
193
				</option>
194
			<?php endforeach; ?>
195
196
		</select>
197
		<?php
198
	}
199
200
	/**
201
	 * Render String based comparison operators dropdown.
202
	 */
203
	protected function render_string_comparison_operators() {
204
		?>
205
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_operator">
206
			<option value="equal_to"><?php _e( 'equal to', 'bulk-delete' ); ?></option>
207
			<option value="not_equal_to"><?php _e( 'not equal to', 'bulk-delete' ); ?></option>
208
			<option value="starts_with"><?php _e( 'starts with', 'bulk-delete' ); ?></option>
209
			<option value="ends_with"><?php _e( 'ends with', 'bulk-delete' ); ?></option>
210
			<option value="contains"><?php _e( 'contains', 'bulk-delete' ); ?></option>
211
			<option value="not_contains"><?php _e( 'not contains', 'bulk-delete' ); ?></option>
212
		</select>
213
		<?php
214
	}
215
216
	/**
217
	 * Render number based comparison operators dropdown.
218
	 */
219
	protected function render_number_comparison_operators() {
220
		?>
221
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_operator">
222
			<option value="="><?php _e( 'equal to', 'bulk-delete' ); ?></option>
223
			<option value="!="><?php _e( 'not equal to', 'bulk-delete' ); ?></option>
224
			<option value="<"><?php _e( 'less than', 'bulk-delete' ); ?></option>
225
			<option value=">"><?php _e( 'greater than', 'bulk-delete' ); ?></option>
226
		</select>
227
		<?php
228
	}
229
230
	/**
231
	 * Render data types dropdown.
232
	 */
233
	protected function render_data_types_dropdown() {
234
		?>
235
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_type" class="meta-type">
236
			<option value="numeric"><?php _e( 'Number', 'bulk-delete' ); ?></option>
237
			<option value="string"><?php _e( 'Character', 'bulk-delete' ); ?></option>
238
			<option value="date"><?php _e( 'Date', 'bulk-delete' ); ?></option>
239
		</select>
240
		<?php
241
	}
242
	/**
243
	 * Render numeric comparison operators dropdown.
244
	 *
245
	 * @param string $class     Class to be applied.
246
	 * @param array  $operators List of Operators needed.
247
	 */
248
	protected function render_numeric_operators_dropdown( $class = 'numeric', $operators = array( 'all' ) ) {
249
		$all_numeric_operators = array(
250
			'='           => 'equal to',
251
			'!='          => 'not equal to',
252
			'<'           => 'less than',
253
			'<='          => 'less than or equal to',
254
			'>'           => 'greater than',
255
			'>='          => 'greater than or equal to',
256
			'IN'          => 'In',
257
			'NOT IN'      => 'Not In',
258
			'BETWEEN'     => 'Between',
259
			'NOT BETWEEN' => 'Not Between',
260
			'EXISTS'      => 'Exists',
261
			'NOT EXISTS'  => 'Not Exists',
262
		);
263
		if ( in_array( 'all', $operators, true ) ) {
264
			$operators = array_keys( $all_numeric_operators );
265
		}
266
		?>
267
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_operator" class= "<?php echo esc_attr( $class ); ?>">
268
		<?php
269
		foreach ( $operators as $operator ) {
270
			echo '<option value="' . $operator . '">' . __( $all_numeric_operators[ $operator ], 'bulk-delete' ) . '</option>';
271
		}
272
		?>
273
		</select>
274
		<?php
275
	}
276
	/**
277
	 * Render string comparison operators dropdown.
278
	 *
279
	 * @param string $class     Class to be applied.
280
	 * @param array  $operators List of Operators needed.
281
	 */
282
	protected function render_string_operators_dropdown( $class = 'string', $operators = array( 'all' ) ) {
283
		$all_string_operators = array(
284
			'='          => 'equal to',
285
			'!='         => 'not equal to',
286
			'IN'         => 'In',
287
			'NOT IN'     => 'Not In',
288
			'LIKE'       => 'Like',
289
			'NOT LIKE'   => 'Not Like',
290
			'EXISTS'     => 'Exists',
291
			'NOT EXISTS' => 'Not Exists',
292
		);
293
		if ( in_array( 'all', $operators, true ) ) {
294
			$operators = array_keys( $all_string_operators );
295
		}
296
		?>
297
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_operator" class="<?php echo esc_attr( $class ); ?>">
298
		<?php
299
		foreach ( $operators as $operator ) {
300
			echo '<option value="' . $operator . '">' . __( $all_string_operators[ $operator ], 'bulk-delete' ) . '</option>';
301
		}
302
		?>
303
		</select>
304
		<?php
305
	}
306
307
	/**
308
	 * Render Tags dropdown.
309
	 */
310
	protected function render_tags_dropdown() {
311
		$tags = $this->get_tags();
312
		?>
313
314
		<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>[]" data-placeholder="<?php _e( 'Select Tags', 'bulk-delete' ); ?>"
315
				class="<?php echo sanitize_html_class( $this->enable_ajax_if_needed_to_dropdown_class_name( count( $tags ), 'select2-taxonomy' ) ); ?>"
316
				data-taxonomy="post_tag" multiple>
317
318
			<option value="all">
319
				<?php _e( 'All Tags', 'bulk-delete' ); ?>
320
			</option>
321
322
			<?php foreach ( $tags as $tag ) : ?>
323
				<option value="<?php echo absint( $tag->term_id ); ?>">
324
					<?php echo esc_html( $tag->name ), ' (', absint( $tag->count ), ' ', __( 'Posts', 'bulk-delete' ), ')'; ?>
325
				</option>
326
			<?php endforeach; ?>
327
		</select>
328
		<?php
329
	}
330
331
	/**
332
	 * Get the class name for select2 dropdown based on the number of items present.
333
	 *
334
	 * @param int    $count      The number of items present.
335
	 * @param string $class_name Primary class name.
336
	 *
337
	 * @return string Class name.
338
	 */
339
	protected function enable_ajax_if_needed_to_dropdown_class_name( $count, $class_name ) {
340
		if ( $count >= $this->get_enhanced_select_threshold() ) {
341
			$class_name .= '-ajax';
342
		}
343
344
		return $class_name;
345
	}
346
347
	/**
348
	 * Render Sticky Posts dropdown.
349
	 */
350
	protected function render_sticky_posts_dropdown() {
351
		$sticky_posts = $this->get_sticky_posts();
352
		?>
353
354
		<table class="optiontable">
355
			<?php if ( count( $sticky_posts ) > 1 ) : ?>
356
				<tr>
357
					<td scope="row">
358
						<label>
359
							<input type="checkbox" name="smbd_<?php echo esc_attr( $this->field_slug ); ?>[]" value="all">
360
							<?php echo __( 'All sticky posts', 'bulk-delete' ), ' (', count( $sticky_posts ), ' ', __( 'Posts', 'bulk-delete' ), ')'; ?>
361
						</label>
362
					</td>
363
				</tr>
364
			<?php endif; ?>
365
366
			<?php foreach ( $sticky_posts as $post ) : ?>
367
				<?php $author = get_userdata( $post->post_author ); ?>
368
				<tr>
369
					<td scope="row">
370
						<label>
371
							<input type="checkbox" name="smbd_<?php echo esc_attr( $this->field_slug ); ?>[]" value="<?php echo absint( $post->ID ); ?>">
372
							<?php
373
								echo esc_html( $post->post_title ), ' - ',
374
									__( 'Published on', 'bulk-delete' ), ' ', get_the_date( get_option( 'date_format' ), $post->ID ),
0 ignored issues
show
Bug introduced by
It seems like get_option('date_format') can also be of type false; however, parameter $d of get_the_date() does only seem to accept string, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

374
									__( 'Published on', 'bulk-delete' ), ' ', get_the_date( /** @scrutinizer ignore-type */ get_option( 'date_format' ), $post->ID ),
Loading history...
Bug introduced by
Are you sure get_the_date(get_option(...te_format'), $post->ID) of type false|string can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

374
									__( 'Published on', 'bulk-delete' ), ' ', /** @scrutinizer ignore-type */ get_the_date( get_option( 'date_format' ), $post->ID ),
Loading history...
375
									__( ' by ', 'bulk-delete' ), esc_html( $author->display_name );
376
							?>
377
						</label>
378
					</td>
379
				</tr>
380
			<?php endforeach; ?>
381
		</table>
382
		<?php
383
	}
384
385
	/**
386
	 * Renders exclude sticky posts checkbox.
387
	 */
388
	protected function render_exclude_sticky_settings() {
389
		if ( $this->are_sticky_posts_present() ) : // phpcs:ignore?>
390
		<tr>
391
			<td scope="row">
392
				<input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_exclude_sticky" id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_exclude_sticky" value="true" type="checkbox">
393
			</td>
394
			<td>
395
				<label for="smbd_<?php echo esc_attr( $this->field_slug ); ?>_exclude_sticky"><?php _e( 'Exclude sticky posts', 'bulk-delete' ); ?></label>
396
			</td>
397
		</tr>
398
		<?php endif; // phpcs:ignore?>
399
		<?php
400
	}
401
402
	/**
403
	 * Render Post Types as checkboxes.
404
	 *
405
	 * @since 5.6.0
406
	 *
407
	 * @param string $name Name of post type checkboxes.
408
	 */
409
	protected function render_post_type_checkboxes( $name ) {
410
		$post_types = bd_get_post_types();
411
		?>
412
413
		<?php foreach ( $post_types as $post_type ) : ?>
414
415
		<tr>
416
			<td scope="row">
417
				<input type="checkbox" name="<?php echo esc_attr( $name ); ?>[]" value="<?php echo esc_attr( $post_type->name ); ?>"
418
					id="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>" checked>
419
420
				<label for="smbd_post_type_<?php echo esc_html( $post_type->name ); ?>">
421
					<?php echo esc_html( $post_type->label ); ?>
422
				</label>
423
			</td>
424
		</tr>
425
426
		<?php endforeach; ?>
427
		<?php
428
	}
429
430
	/**
431
	 * Render the "private post" setting fields.
432
	 */
433
	protected function render_private_post_settings() {
434
		bd_render_private_post_settings( $this->field_slug );
435
	}
436
437
	/**
438
	 * Get the threshold after which enhanced select should be used.
439
	 *
440
	 * @return int Threshold.
441
	 */
442
	protected function get_enhanced_select_threshold() {
443
		/**
444
		 * Filter the enhanced select threshold.
445
		 *
446
		 * @since 6.0.0
447
		 *
448
		 * @param int Threshold.
449
		 */
450
		return apply_filters( 'bd_enhanced_select_threshold', 1000 );
451
	}
452
453
	/**
454
	 * Render sticky settings.
455
	 */
456
	protected function render_sticky_action_settings() {
457
		?>
458
		<tr>
459
			<td scope="row" colspan="2">
460
				<label>
461
					<input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_sticky_action" value="unsticky" type="radio" checked>
462
					<?php _e( 'Remove Sticky', 'bulk-delete' ); ?>
463
				</label>
464
				<label>
465
					<input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_sticky_action" value="delete" type="radio">
466
					<?php _e( 'Delete Post', 'bulk-delete' ); ?>
467
				</label>
468
			</td>
469
		</tr>
470
		<?php
471
	}
472
473
	/**
474
	 * Render filtering table header.
475
	 */
476
	protected function render_filtering_table_header() {
477
		bd_render_filtering_table_header();
478
	}
479
480
	/**
481
	 * Render restrict settings.
482
	 */
483
	protected function render_restrict_settings() {
484
		bd_render_restrict_settings( $this->field_slug, $this->item_type );
485
	}
486
487
	/**
488
	 * Render delete settings.
489
	 */
490
	protected function render_delete_settings() {
491
		bd_render_delete_settings( $this->field_slug );
492
		/**
493
		 * This action is primarily for adding delete attachment settings.
494
		 *
495
		 * @since 6.0.0
496
		 *
497
		 * @param \BulkWP\BulkDelete\Core\Base\BaseModule The delete module.
498
		 */
499
		do_action( 'bd_render_attachment_settings', $this );
500
	}
501
502
	/**
503
	 * Render limit settings.
504
	 *
505
	 * @param string $item_type Item Type to be displayed in label.
506
	 */
507
	protected function render_limit_settings( $item_type = '' ) {
508
		if ( empty( $item_type ) ) {
509
			$item_type = $this->item_type;
510
		}
511
		bd_render_limit_settings( $this->field_slug, $item_type );
512
	}
513
514
	/**
515
	 * Render cron settings based on whether scheduler is present or not.
516
	 */
517
	protected function render_cron_settings() {
518
		$pro_class = '';
519
520
		$disabled_attr = 'disabled';
521
		if ( empty( $this->scheduler_url ) ) {
522
			$disabled_attr = '';
523
		}
524
		?>
525
526
		<tr>
527
			<td scope="row" colspan="2">
528
				<label><input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" value="false" type="radio"
529
					checked="checked"> <?php _e( 'Delete now', 'bulk-delete' ); ?></label>
530
				<label><input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" value="true" type="radio"
531
					id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron" <?php echo esc_attr( $disabled_attr ); ?>> <?php _e( 'Schedule', 'bulk-delete' ); ?></label>
532
				<input name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_start"
533
					id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_start" value="now"
534
					type="text" <?php echo esc_attr( $disabled_attr ); ?>><?php _e( 'repeat ', 'bulk-delete' ); ?>
535
536
				<select name="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_freq"
537
						id="smbd_<?php echo esc_attr( $this->field_slug ); ?>_cron_freq" <?php echo esc_attr( $disabled_attr ); ?>>
538
539
					<option value="-1"><?php _e( "Don't repeat", 'bulk-delete' ); ?></option>
540
					<?php
541
					/**
542
					 * List of cron schedules.
543
					 *
544
					 * @since 6.0.0
545
					 *
546
					 * @param array                                   $cron_schedules List of cron schedules.
547
					 * @param \BulkWP\BulkDelete\Core\Base\BaseModule $module         Module.
548
					 */
549
					$cron_schedules = apply_filters( 'bd_cron_schedules', wp_get_schedules(), $this );
550
					?>
551
552
					<?php foreach ( $cron_schedules as $key => $value ) : ?>
553
						<option
554
							value="<?php echo esc_attr( $key ); ?>"><?php echo esc_html( $value['display'] ); ?></option>
555
					<?php endforeach; ?>
556
				</select>
557
558
				<?php if ( ! empty( $this->scheduler_url ) ) : ?>
559
					<?php
560
					$pro_class = 'bd-' . str_replace( '_', '-', $this->field_slug ) . '-pro';
561
562
					/**
563
					 * HTML class of the span that displays the 'Pro only feature' message.
564
					 *
565
					 * @since 6.0.0
566
					 *
567
					 * @param string                                  $pro_class  HTML class.
568
					 * @param string                                  $field_slug Field Slug of module.
569
					 * @param \BulkWP\BulkDelete\Core\Base\BaseModule $module     Module.
570
					 */
571
					$pro_class = apply_filters( 'bd_pro_only_feature_class', $pro_class, $this->field_slug, $this )
572
					?>
573
574
					<span class="<?php echo sanitize_html_class( $pro_class ); ?>" style="color:red">
575
						<?php _e( 'Only available in Pro Addon', 'bulk-delete' ); ?> <a
576
							href="<?php echo esc_url( $this->scheduler_url ); ?>">Buy now</a>
577
					</span>
578
				<?php endif; ?>
579
			</td>
580
		</tr>
581
582
		<?php if ( empty( $pro_class ) ) : ?>
583
			<tr>
584
		<?php else : ?>
585
			<tr class="<?php echo sanitize_html_class( $pro_class ); ?>" style="display: none;">
586
		<?php endif; ?>
587
588
			<td scope="row" colspan="2">
589
				<?php
590
				_e( 'Enter time in <strong>Y-m-d H:i:s</strong> format or enter <strong>now</strong> to use current time.', 'bulk-delete' );
591
592
				$markup = __( 'Want to add new a Cron schedule?', 'bulk-delete' ) . '&nbsp' .
593
					'<a href="https://bulkwp.com/docs/add-a-new-cron-schedule/" target="_blank" rel="noopener">' . __( 'Find out how', 'bulk-delete' ) . '</a>';
594
595
				$content = __( 'Learn how to add your desired Cron schedule.', 'bulk-delete' );
596
				echo '&nbsp', bd_generate_help_tooltip( $markup, $content );
597
				?>
598
			</td>
599
		</tr>
600
		<?php
601
	}
602
603
	/**
604
	 * Render submit button.
605
	 */
606
	protected function render_submit_button() {
607
		bd_render_submit_button( $this->action );
608
	}
609
}
610