PluginProbe
Cool Timeline (Horizontal & Vertical Timeline) / trunk
Cool Timeline (Horizontal & Vertical Timeline) vtrunk
3.4.0 3.3.6 3.3.5 3.3.4 3.3.3 3.3.2 2.2.3 2.3.3 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.6.1 2.7.1 2.8.3 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 2.9.9 3.0.0 All 79 releases
cool-timeline / admin / ctl-admin-settings.php

ctl-admin-settings.php in Cool Timeline (Horizontal & Vertical Timeline) trunk, at admin/ctl-admin-settings.php

384 lines 11.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 // Exit if accessed directly.
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 // Add admin notice for timeline express migration
8 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedFunctionFound
9 function ctl_admin_notice_for_migration() {
10
11 // Check if we're on the Cool Timeline settings page (read-only screen detection).
12 // phpcs:ignore WordPress.Security.NonceVerification.Recommended
13 if ( ! isset( $_GET['page'] ) || 'cool_timeline_settings' !== sanitize_key( wp_unslash( $_GET['page'] ) ) ) {
14 return;
15 }
16 // Check if timeline express is installed and migration is not completed
17 if (file_exists(WP_PLUGIN_DIR . '/timeline-express/timeline-express.php')) {
18 $migration_completed = get_option('timeline_express_migrated');
19
20 // Only show notice if migration is not completed
21 if (!$migration_completed) {
22 ?>
23 <div class="notice ctl_migration notice-info is-dismissible">
24 <div class="migration_message_container">
25 <p>
26 <?php echo esc_html__('Timeline Express plugin is installed on your site. To move your announcements into Cool Timeline, you can now start the migration process.', 'cool-timeline'); ?>
27 <a href="admin.php?page=cool_timeline_settings#tab=migration-settings" class="button button-small ctl_migration_btn"><?php echo esc_html__('Start Migration', 'cool-timeline'); ?></a>
28 </p>
29 </div>
30 </div>
31 <?php
32 }
33 }
34 }
35 add_action('admin_notices', 'ctl_admin_notice_for_migration');
36
37 // Control core classes for avoid errors
38 if ( class_exists( 'CSF' ) ) {
39
40 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
41 $prefix = 'cool_timeline_settings';
42 include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
43
44 // Create options
45 CSF::createOptions(
46 $prefix,
47 array(
48 'framework_title' => 'Timeline Settings',
49 'menu_title' => 'Timeline Settings',
50 'menu_slug' => 'cool_timeline_settings',
51 'menu_type' => 'submenu',
52 'menu_parent' => 'cool-plugins-timeline-addon',
53 'menu_capability' => 'manage_options', // The capability needed to view the page
54 'menu_icon' => CTL_PLUGIN_URL . 'assets/images/cool-timeline-icon.svg',
55 'menu_position' => 6,
56 'nav' => 'inline',
57 'show_reset_section' => false,
58 'show_reset_all' => false,
59 'show_bar_menu' => false,
60
61 'footer_text' => '',
62 )
63 );
64
65 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
66 $fields=array(
67
68
69
70 // Create a Fieldset
71 array(
72 'id' => 'timeline_header',
73 'type' => 'fieldset',
74 'title' => 'Content Before Timeline',
75 'fields' => array(
76 array(
77 'id' => 'title_text',
78 'type' => 'text',
79 'title' => __( 'Timeline Title', 'cool-timeline' ),
80 ),
81 ),
82 ), // End Fieldset
83
84
85 // Create a Fieldset
86 array(
87 'id' => 'story_content_settings',
88 'type' => 'fieldset',
89 'title' => 'Story Content',
90 'fields' => array(
91 array(
92 'id' => 'content_length',
93 'type' => 'text',
94 'title' => __( 'Content Length', 'cool-timeline' ),
95 'default' => '50',
96 'desc' => __( 'Please enter no of words', 'cool-timeline' ),
97 ),
98 array(
99 'id' => 'display_readmore',
100 'type' => 'radio',
101 'title' => __( 'Display read more?', 'cool-timeline' ),
102 'options' => array(
103 'yes' => __( 'Yes', 'cool-timeline' ),
104 'no' => __( 'No', 'cool-timeline' ),
105 ),
106 'desc' => __( 'It will also disable link from story title.', 'cool-timeline' ),
107 'inline' => true,
108 'default' => 'yes',
109 ),
110 array(
111 'id' => 'story_link_target',
112 'type' => 'radio',
113 'title' => __( 'Open read more link in?', 'cool-timeline' ),
114 'options' => array(
115 '_self' => __( 'Same Tab', 'cool-timeline' ),
116 '_blank' => __( 'New Tab', 'cool-timeline' ),
117 ),
118 'inline' => true,
119 'default' => '_self',
120 'dependency' => array( 'display_readmore', '==', 'yes' ),
121 ),
122
123 ),
124 ), // End Fieldset
125
126
127 array(
128 'id' => 'story_date_settings',
129 'type' => 'fieldset',
130 'title' => 'Story Date',
131 'fields' => array(
132
133 array(
134 'id' => 'year_label_visibility',
135 'type' => 'switcher',
136 'title' => __( 'Year Label', 'cool-timeline' ),
137 'text_on' => __( 'Show', 'cool-timeline' ),
138 'text_off' => __( 'Hide', 'cool-timeline' ),
139 'text_width' => 100,
140 'default' => true,
141 'desc' => __( 'Only for Vertical and One sided layout', 'cool-timeline' ),
142 ),
143
144 ),
145 ), // End Fieldset
146
147 array(
148 'id' => 'first_story_position',
149 'type' => 'button_set',
150 'title' => 'Vertical Timeline Stories Starts From',
151 'desc' => 'Not for Compact and Horizontal layout',
152 'options' => array(
153 'left' => 'Left',
154 'right' => 'Right',
155 ),
156 'default' => 'right',
157 )
158
159 );
160
161 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
162 $review_option = get_option( 'cpfm_opt_in_choice_cool-timeline' );
163
164 if($review_option){
165
166 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
167 $fields[]= array(
168 'id' => 'ctl_cpfm_feedback_data',
169 'type' => 'checkbox',
170 // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
171 'title' => __('Usage Data Sharing', 'ccpw1'),
172 'default' => $review_option === 'yes' ? true : false,
173 'desc' => 'Help us make this plugin more compatible with your site by sharing non-sensitive site data.
174 <a href="#" class="cpfm-see-terms">[See terms]</a>
175 <div id="termsBox" style="display: none; margin-top: 10px; ">
176 ' . sprintf(
177 // translators: %s: minimum number of characters
178 __('Opt in to receive email updates about security improvements, new features, helpful tutorials, and occasional special offers. We\'ll collect: <a href="%s" target="_blank" rel="noopener noreferrer">click here</a>', 'ccpw'), // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
179 esc_url('https://my.coolplugins.net/terms/usage-tracking/')
180 ) . '
181 <ul class="ctl_data_share" >
182 ' .
183 // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
184 '<li>' . esc_html__('1. Your website home URL and WordPress admin email.', 'ccpw') . '</li>
185 ' .
186 // phpcs:ignore WordPress.WP.I18n.TextDomainMismatch
187 '<li>' . esc_html__('2. To check plugin compatibility, we will collect the following: list of active plugins and themes, server type, MySQL version, WordPress version, memory limit, site language and database prefix.', 'ccpw') . '</li>
188 </ul>
189 </div>',
190 );
191 }
192
193
194 // Create a section
195 CSF::createSection(
196 $prefix,
197 array(
198 'title' => 'General Settings',
199 'fields'=>$fields
200 ));
201
202
203
204
205
206 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
207 $timeline_express_installed = file_exists(WP_PLUGIN_DIR . '/timeline-express/timeline-express.php');
208
209
210
211 if ($timeline_express_installed && ! get_option( 'timeline_express_migrated')) {
212 CSF::createSection(
213 $prefix,
214 array(
215 'title' => 'Migration Settings',
216 'fields' => array(
217 array(
218 'id' => 'migration_fieldset',
219 'type' => 'fieldset',
220 'title' => 'Timeline Express Migration',
221 'fields' => array(
222 array(
223 'id' => 'migrate_stories',
224 'type' => 'content',
225 'content' => '
226 <div class="ctl-buttons-migrate">
227 <button class="button button-primary ctl-migrate">Migrate Content</button>
228 <div class="ctl-progress-bar">
229 <div class="ctl-progress-bar-inner">
230 </div>
231 </div>
232 </div>',
233
234 'desc' => is_plugin_active('timeline-express/timeline-express.php')
235 ? 'Timeline Express is active. You can migrate stories now.'
236 : 'Timeline Express is installed but not active. Please activate it to migrate stories.',
237
238
239 )
240 )
241 )
242 )
243 )
244 );
245 }
246
247 // Create a section
248 CSF::createSection(
249 $prefix,
250 array(
251 'title' => 'Style Settings',
252 'fields' => array(
253
254 array(
255 'id' => 'content_bg_color',
256 'type' => 'color',
257 'title' => 'Story Background Color',
258 'default' => '#ffffff',
259 ),
260
261 array(
262 'id' => 'circle_border_color',
263 'type' => 'color',
264 'title' => 'Circle Color',
265 'default' => '#38aab7',
266 ),
267
268 array(
269 'id' => 'line_color',
270 'type' => 'color',
271 'title' => 'Line Color',
272 'default' => '#025149',
273 ),
274
275 array(
276 'id' => 'first_post',
277 'type' => 'color',
278 'title' => 'First Color',
279 'default' => '#29b246',
280 ),
281
282 array(
283 'id' => 'second_post',
284 'type' => 'color',
285 'title' => 'Second Color',
286 'default' => '#ce792f',
287 ),
288
289 array(
290 'id' => 'custom_styles',
291 'type' => 'code_editor',
292 'title' => 'Custom Styles',
293 'settings' => array(
294 'theme' => 'mbo',
295 'mode' => 'css',
296 ),
297
298 ),
299
300 ),
301 )
302 );
303
304 // Create a section
305 CSF::createSection(
306 $prefix,
307 array(
308 'title' => 'Typography Setings',
309 'fields' => array(
310
311 array(
312 'id' => 'ctl_date_typo',
313 'type' => 'typography',
314 'title' => 'Story Date',
315 'default' => array(
316 'font-family' => 'Maven Pro',
317 'font-size' => '21',
318 'line-height' => '',
319 'unit' => 'px',
320 'type' => 'google',
321 'font-weight' => '700',
322 ),
323 'text_align' => false,
324 'color' => false,
325 ),
326
327 array(
328 'id' => 'post_title_typo',
329 'type' => 'typography',
330 'title' => 'Story Title',
331 'default' => array(
332 'font-family' => 'Maven Pro',
333 'font-size' => '20',
334 'line-height' => '',
335 'unit' => 'px',
336 'type' => 'google',
337 'font-weight' => '700',
338 ),
339 'color' => false,
340 ),
341
342 array(
343 'id' => 'post_content_typo',
344 'type' => 'typography',
345 'title' => 'Post Content',
346 'default' => array(
347 'font-family' => 'Maven Pro',
348 'font-size' => '16',
349 'line-height' => '',
350 'unit' => 'px',
351 'type' => 'google',
352 ),
353 'color' => false,
354 ),
355
356
357 ),
358
359
360 )
361 );
362
363 // Create a section
364 CSF::createSection(
365 $prefix,
366 array(
367 'title' => 'Advance Settings',
368 'fields' => array(
369
370 array(
371 'id' => 'advanced-features',
372 'type' => 'content',
373 'content' => '<div class="advance_options" style="text-align:center"><a target="_blank" href="' . esc_url( CTL_BUY_PRO . '?utm_source=ctl_plugin&utm_medium=inside&utm_campaign=get_pro&utm_content=settings' ) . '">
374 <img src="' . esc_url( CTL_PLUGIN_URL . 'assets/images/pro-features-list.png' ) . '" alt=""></a></div>',
375
376 ),
377
378 ),
379 )
380 );
381
382
383 }
384