1+ <?php
2+ $ custom_schedules = array ();
3+ $ has_pro = feedzy_is_pro ();
4+ $ settings = apply_filters ( 'feedzy_get_settings ' , array () );
5+
6+ if ( isset ( $ settings ['custom_schedules ' ] ) && is_array ( $ settings ['custom_schedules ' ] ) ) {
7+ $ custom_schedules = $ settings ['custom_schedules ' ];
8+ }
9+ ?>
10+ <div class="fz-form-wrap">
11+ <div class="form-block">
12+ <div class="fz-form-group">
13+ <h4 class="h4">
14+ <?php esc_html_e ( 'Add Cron Schedule ' , 'feedzy-rss-feeds ' ); ?>
15+ <?php if ( ! $ has_pro ) : ?>
16+ <span class="pro-label">PRO</span>
17+ <?php endif ; ?>
18+ </h4>
19+ <div class="fz-condition-control" style="padding-bottom: 0;">
20+ <div class="fz-form-row" style="margin: 0; gap: 1rem; align-items: flex-end;">
21+ <div class="fz-form-group">
22+ <label class="form-label" for="fz-schedule-interval">
23+ <?php esc_html_e ( 'Interval (seconds) ' , 'feedzy-rss-feeds ' ); ?>
24+ </label>
25+ <input
26+ type="number"
27+ class="form-control"
28+ id="fz-schedule-interval"
29+ placeholder="3600"
30+ min="<?php echo esc_attr ( defined ( 'WP_CRON_LOCK_TIMEOUT ' ) ? WP_CRON_LOCK_TIMEOUT : 60 ); ?> "
31+ <?php disabled ( ! $ has_pro ); ?>
32+ />
33+ </div>
34+
35+ <div class="fz-form-group">
36+ <label class="form-label" for="fz-schedule-display">
37+ <?php esc_html_e ( 'Display Name ' , 'feedzy-rss-feeds ' ); ?>
38+ </label>
39+ <input
40+ type="text"
41+ class="form-control"
42+ id="fz-schedule-display"
43+ placeholder="Once Hourly"
44+ <?php disabled ( ! $ has_pro ); ?>
45+ />
46+ </div>
47+
48+ <div class="fz-form-group">
49+ <label class="form-label" for="fz-schedule-name">
50+ <?php esc_html_e ( 'Internal Name ' , 'feedzy-rss-feeds ' ); ?>
51+ </label>
52+ <input
53+ type="text"
54+ class="form-control"
55+ id="fz-schedule-name"
56+ placeholder="hourly"
57+ <?php disabled ( ! $ has_pro ); ?>
58+ />
59+ </div>
60+ <div class="fz-form-group">
61+ <button
62+ class="btn btn-primary"
63+ id="fz-add-schedule"
64+ <?php disabled ( ! $ has_pro ); ?>
65+ >
66+ <?php esc_html_e ( 'Add Cron Schedule ' , 'feedzy-rss-feeds ' ); ?>
67+ </button>
68+ </div>
69+ </div>
70+ </div>
71+ </div>
72+ </div>
73+
74+ <div
75+ class="form-block"
76+ >
77+ <div
78+ class="fz-schedules-table"
79+ style="<?php echo empty ( $ custom_schedules ) || ! $ has_pro ? 'display: none; ' : '' ; ?> "
80+ >
81+ <div class="fz-schedule-counter">
82+ <?php
83+ $ schedule_count = count ( $ custom_schedules );
84+
85+ // translators: %s is the number of custom schedules.
86+ echo esc_html ( sprintf ( __ ( '%s items ' , 'feedzy-rss-feeds ' ), $ schedule_count ) );
87+ ?>
88+ </div>
89+
90+ <table class="fz-schedules-table widefat striped">
91+ <thead>
92+ <tr>
93+ <th><?php esc_html_e ( 'Internal Name ' , 'feedzy-rss-feeds ' ); ?> </th>
94+ <th><?php esc_html_e ( 'Interval ' , 'feedzy-rss-feeds ' ); ?> </th>
95+ <th><?php esc_html_e ( 'Display Name ' , 'feedzy-rss-feeds ' ); ?> </th>
96+ <th><?php esc_html_e ( 'Actions ' , 'feedzy-rss-feeds ' ); ?> </th>
97+ </tr>
98+ </thead>
99+ <tbody>
100+ <?php
101+ foreach ( $ custom_schedules as $ slug => $ schedule ) :
102+ $ interval_seconds = $ schedule ['interval ' ];
103+ $ interval_display = $ interval_seconds . ' ( ' . human_time_diff ( 0 , $ interval_seconds ) . ') ' ;
104+ ?>
105+ <tr>
106+ <td class="fz-schedule-attributes">
107+ <strong><?php echo esc_html ( $ slug ); ?> </strong>
108+ </td>
109+
110+ <td class="fz-schedule-attributes">
111+ <?php echo esc_html ( $ interval_display ); ?>
112+ </td>
113+
114+ <td class="fz-schedule-attributes">
115+ <?php echo esc_html ( $ schedule ['display ' ] ); ?>
116+ </td>
117+
118+ <td class="fz-schedule-attributes">
119+ <button type="button" class="btn btn-outline-primary fz-delete-schedule fz-is-destructive" data-schedule="<?php echo esc_attr ( $ slug ); ?> ">
120+ <?php esc_html_e ( 'Delete ' , 'feedzy-rss-feeds ' ); ?>
121+ </button>
122+ </td>
123+
124+ <input
125+ type="hidden"
126+ value="<?php echo esc_attr ( $ schedule ['interval ' ] ); ?> "
127+ name="fz-custom-schedule-interval[<?php echo esc_attr ( $ slug ); ?> ][interval]"
128+ >
129+
130+ <input
131+ type="hidden"
132+ value="<?php echo esc_attr ( $ schedule ['display ' ] ); ?> "
133+ name="fz-custom-schedule-interval[<?php echo esc_attr ( $ slug ); ?> ][display]"
134+ >
135+ </tr>
136+ <?php endforeach ; ?>
137+ </tbody>
138+ </table>
139+ </div>
140+ </div>
141+ </div>
0 commit comments