pojo-a11y-settings.php
20.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
<?php
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class Pojo_A11y_Settings {
public $menu_slug = null;
const PAGE_ID = 'pojo-a11y';
const SETTINGS_PAGE = 'toplevel_page_accessibility-settings';
const TOOLBAR_PAGE = 'accessibility_page_accessibility-toolbar';
const FIELD_TEXT = 'text';
const FIELD_SELECT = 'select';
const FIELD_CHECKBOX_LIST = 'checkbox_list';
protected $_fields = array();
protected $_sections = array();
protected $_defaults = array();
protected $_pages = array();
/**
* Setup Toolbar fields
*
* @param array $sections
*
* @return array
*/
public function section_a11y_toolbar( $sections = array() ) {
$fields = array();
$fields[] = array(
'id' => 'pojo_a11y_toolbar',
'title' => __( 'Display Toolbar', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'options' => array(
'enable' => __( 'Show on all devices', 'pojo-accessibility' ),
'visible-desktop' => __( 'Visible Desktop', 'pojo-accessibility' ),
'visible-tablet' => __( 'Visible Tablet', 'pojo-accessibility' ),
'visible-phone' => __( 'Visible Phone', 'pojo-accessibility' ),
'hidden-desktop' => __( 'Hidden Desktop', 'pojo-accessibility' ),
'hidden-tablet' => __( 'Hidden Tablet', 'pojo-accessibility' ),
'hidden-phone' => __( 'Hidden Phone', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$toolbar_options_classes = 'pojo-a11y-toolbar-button';
$fields[] = array(
'id' => 'pojo_a11y_toolbar_title',
'title' => __( 'Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'desc' => __( 'Title top of the toolbar (recommended).', 'pojo-accessibility' ),
'class' => $toolbar_options_classes,
'std' => __( 'Accessibility Tools', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_resize_font',
'title' => __( 'Resize Font', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_resize_font_add_title',
'title' => __( 'Increase Text', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row no-border',
'std' => __( 'Increase Text', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_resize_font_less_title',
'title' => __( 'Decrease Text', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Decrease Text', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_grayscale',
'title' => __( 'Grayscale', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_grayscale_title',
'title' => __( 'Grayscale Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Grayscale', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_high_contrast',
'title' => __( 'High Contrast', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_high_contrast_title',
'title' => __( 'High Contrast Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'High Contrast', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_negative_contrast',
'title' => __( 'Negative Contrast', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_negative_contrast_title',
'title' => __( 'Negative Contrast Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Negative Contrast', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_light_bg',
'title' => __( 'Light Background', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_light_bg_title',
'title' => __( 'Light Background Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Light Background', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_links_underline',
'title' => __( 'Links Underline', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_links_underline_title',
'title' => __( 'Links Underline Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Links Underline', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_readable_font',
'title' => __( 'Readable Font', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'class' => $toolbar_options_classes,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_readable_font_title',
'title' => __( 'Readable Font Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => __( 'Readable Font', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_sitemap_title',
'title' => __( 'Sitemap Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes,
'std' => __( 'Sitemap', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_sitemap_link',
'title' => __( 'Sitemap Link', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'placeholder' => 'http://your-domain.com/sitemap',
'desc' => __( 'Link for sitemap page in your website. Leave blank to disable.', 'pojo-accessibility' ),
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => '',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_help_title',
'title' => __( 'Help Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes,
'std' => __( 'Help', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_help_link',
'title' => __( 'Help Link', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'placeholder' => 'http://your-domain.com/help',
'desc' => __( 'Link for help page in your website. Leave blank to disable.', 'pojo-accessibility' ),
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => '',
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_feedback_title',
'title' => __( 'Feedback Title', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'class' => $toolbar_options_classes,
'std' => __( 'Feedback', 'pojo-accessibility' ),
);
$fields[] = array(
'id' => 'pojo_a11y_toolbar_button_feedback_link',
'title' => __( 'Feedback Link', 'pojo-accessibility' ),
'type' => self::FIELD_TEXT,
'placeholder' => 'http://your-domain.com/feedback',
'desc' => __( 'Link for feedback page in your website. Leave blank to disable.', 'pojo-accessibility' ),
'class' => $toolbar_options_classes . ' pojo-settings-child-row',
'std' => '',
);
$sections[] = array(
'id' => 'section-a11y-toolbar',
'page' => self::TOOLBAR_PAGE,
'title' => __( 'Toolbar Settings', 'pojo-accessibility' ),
'intro' => '',
'fields' => $fields,
);
$sections[] = array(
'id' => 'section-a11y-styles',
'page' => self::TOOLBAR_PAGE,
'title' => __( 'Style Settings', 'pojo-accessibility' ),
'intro' => sprintf( __( 'For style settings of accessibility tools go to > Customize > <a href="%s">Accessibility</a>.', 'pojo-accessibility' ), $this->get_admin_url( 'customizer' ) ),
'fields' => array(),
);
return $sections;
}
public function section_a11y_settings( $sections ) {
$fields = array();
$fields[] = array(
'id' => 'pojo_a11y_focusable',
'title' => __( 'Add Outline Focus', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'desc' => __( 'Add outline to elements on keyboard focus.', 'pojo-accessibility' ),
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'disable',
);
$fields[] = array(
'id' => 'pojo_a11y_skip_to_content_link',
'title' => __( 'Skip to Content link', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'desc' => __( 'Add skip to content link when using keyboard.', 'pojo-accessibility' ),
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_skip_to_content_link_element_id',
'title' => __( 'Skip to Content Element ID', 'pojo-accessibility' ),
'placeholder' => 'content',
'type' => self::FIELD_TEXT,
'std' => 'content',
);
$fields[] = array(
'id' => 'pojo_a11y_remove_link_target',
'title' => __( 'Remove target attribute from links', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'desc' => __( 'This option will reset all your target links to open in the same window or tab.', 'pojo-accessibility' ),
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'disable',
);
$fields[] = array(
'id' => 'pojo_a11y_add_role_links',
'title' => __( 'Add landmark roles to all links', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'desc' => __( 'This option will add <code>role="link"</code> to all links on the page.', 'pojo-accessibility' ),
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_save',
'title' => __( 'Sitewide Accessibility', 'pojo-accessibility' ),
'desc' => __( 'Consistent accessibility throughout your site visit. Site remembers you and stays accessible.', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'options' => array(
'enable' => __( 'Enable', 'pojo-accessibility' ),
'disable' => __( 'Disable', 'pojo-accessibility' ),
),
'std' => 'enable',
);
$fields[] = array(
'id' => 'pojo_a11y_save_expiration',
'title' => __( 'Remember user for', 'pojo-accessibility' ),
'type' => self::FIELD_SELECT,
'desc' => __( 'Define how long your toolbar settings will be remembered', 'pojo-accessibility' ),
'options' => array(
'1' => __( '1 Hour', 'pojo-accessibility' ),
'6' => __( '6 Hours', 'pojo-accessibility' ),
'12' => __( '12 Hours', 'pojo-accessibility' ),
'24' => __( '1 Day', 'pojo-accessibility' ),
'48' => __( '2 Days', 'pojo-accessibility' ),
'72' => __( '3 Days', 'pojo-accessibility' ),
'168' => __( '1 Week', 'pojo-accessibility' ),
'720' => __( '1 Month', 'pojo-accessibility' ),
),
'std' => '12',
);
$sections[] = array(
'id' => 'section-a11y-settings',
'page' => self::SETTINGS_PAGE,
'title' => __( 'General Settings', 'pojo-accessibility' ),
'intro' => '',
'fields' => $fields,
);
return $sections;
}
public function print_js() {
// TODO: Maybe need to move to other file
?>
<script>
jQuery( document ).ready( function( $ ) {
var $a11yToolbarOption = $( 'table.form-table #pojo_a11y_toolbar' ),
$a11yToolbarButtons = $( 'tr.pojo-a11y-toolbar-button' );
$a11yToolbarOption.on( 'change', function() {
if ( 'disable' !== $( this ).val() ) {
$a11yToolbarButtons.fadeIn( 'fast' );
} else {
$a11yToolbarButtons.hide();
}
} );
$a11yToolbarOption.trigger( 'change' );
} );
</script>
<?php
}
public function get_settings_sections() {
$sections = array();
$sections = $this->section_a11y_toolbar( $sections );
$sections = $this->section_a11y_settings( $sections );
$this->_sections = $sections;
return $this->_sections;
}
public function add_settings_section( $args = array() ) {
$args = wp_parse_args( $args, array(
'id' => '',
'title' => '',
) );
foreach ( $this->_sections as $section ) {
if ( $args['id'] !== $section['id'] ) {
continue;
}
if ( empty( $section['intro'] ) ) {
return;
}
printf( '<p>%s</p>', $section['intro'] );
break;
}
}
public function add_settings_field( $args = array() ) {
if ( empty( $args ) ) {
return;
}
$args = wp_parse_args( $args, array(
'id' => '',
'std' => '',
'type' => self::FIELD_TEXT,
) );
if ( empty( $args['id'] ) || empty( $args['type'] ) ) {
return;
}
$field_callback = 'render_' . $args['type'] . '_field';
if ( method_exists( $this, $field_callback ) ) {
call_user_func( array( $this, $field_callback ), $args );
}
}
public function render_select_field( $field ) {
$options = array();
foreach ( $field['options'] as $option_key => $option_value ) {
$options[] = sprintf(
'<option value="%1$s"%2$s>%3$s</option>',
esc_attr( $option_key ),
selected( get_option( $field['id'], $field['std'] ), $option_key, false ),
$option_value
);
}
?>
<select id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>">
<?php echo implode( '', $options ); ?>
</select>
<?php if ( ! empty( $field['sub_desc'] ) ) echo $field['sub_desc']; ?>
<?php if ( ! empty( $field['desc'] ) ) : ?>
<p class="description"><?php echo $field['desc']; ?></p>
<?php endif; ?>
<?php
}
public function render_text_field( $field ) {
if ( empty( $field['classes'] ) )
$field['classes'] = array( 'regular-text' );
?>
<input type="text" class="<?php echo implode( ' ', $field['classes'] ); ?>" id="<?php echo $field['id']; ?>" name="<?php echo $field['id']; ?>" value="<?php echo esc_attr( get_option( $field['id'], $field['std'] ) ); ?>"<?php echo ! empty( $field['placeholder'] ) ? ' placeholder="' . $field['placeholder'] . '"' : ''; ?> />
<?php if ( ! empty( $field['sub_desc'] ) ) echo $field['sub_desc']; ?>
<?php if ( ! empty( $field['desc'] ) ) : ?>
<p class="description"><?php echo $field['desc']; ?></p>
<?php endif; ?>
<?php
}
public function admin_init() {
foreach ( $this->get_settings_sections() as $section_key => $section ) {
add_settings_section(
$section['id'],
$section['title'],
array( &$this, 'add_settings_section' ),
$section['page']
);
if ( empty( $section['fields'] ) ) {
continue;
}
foreach ( $section['fields'] as $field ) {
add_settings_field(
$field['id'],
$field['title'],
array( &$this, 'add_settings_field' ),
$section['page'],
$section['id'],
$field
);
$sanitize_callback = array( $this, 'field_html' );
if ( ! empty( $field['type'] ) && self::FIELD_CHECKBOX_LIST === $field['type'] ) {
$sanitize_callback = array( $this, 'field_checkbox_list' );
}
if ( ! empty( $field['sanitize_callback'] ) ) {
$sanitize_callback = $field['sanitize_callback'];
}
register_setting( $section['page'], $field['id'], $sanitize_callback );
}
}
}
public static function field_html( $input ) {
return stripslashes( wp_filter_post_kses( addslashes( $input ) ) );
}
public static function field_checkbox_list( $input ) {
if ( empty( $input ) ) {
$input = array();
}
return $input;
}
public function display_settings_page() {
$screen = get_current_screen();
$screen_id = $screen->id;
if ( false !== strpos( $screen_id, 'toolbar' ) ) {
$screen_id = self::TOOLBAR_PAGE;
}
?>
<div class="wrap">
<h2><?php echo $this->_page_title; ?></h2>
<?php settings_errors( $screen_id ); ?>
<form method="post" action="options.php">
<?php
settings_fields( $screen_id );
do_settings_sections( $screen_id );
submit_button();
?>
</form>
</div><!-- /.wrap -->
<?php
}
public function admin_menu() {
$this->menu_slug = add_menu_page(
__( 'Accessibility', 'pojo-accessibility' ),
__( 'Accessibility', 'pojo-accessibility' ),
'manage_options',
'accessibility-settings',
array( &$this, 'display_settings_page' ),
'dashicons-universal-access-alt'
);
add_submenu_page(
'accessibility-settings',
__( 'Accessibility Settings', 'pojo-accessibility' ),
__( 'Settings', 'pojo-accessibility' ),
'manage_options',
'accessibility-settings',
array( &$this, 'display_settings_page' )
);
add_submenu_page(
'accessibility-settings',
__( 'Accessibility Toolbar', 'pojo-accessibility' ),
__( 'Toolbar', 'pojo-accessibility' ),
'manage_options',
'accessibility-toolbar',
array( &$this, 'display_settings_page' )
);
add_submenu_page(
'accessibility-settings',
__( 'Customize', 'pojo-accessibility' ),
__( 'Customize', 'pojo-accessibility' ),
'manage_options',
'/customize.php?autofocus[section]=accessibility'
);
}
public function plugin_action_links( $links, $plugin_file ) {
if ( POJO_A11Y_BASE === $plugin_file ) {
$settings = '<a href="' . $this->get_admin_url( 'general' ) . '" aria-label="' . esc_attr__( 'Set Accessibility settings', 'pojo-accessibility' ) . '">' . __( 'Settings', 'pojo-accessibility' ) . '</a>';
$toolbar = '<a href="' . $this->get_admin_url( 'toolbar' ) . '" aria-label="' . esc_attr__( 'Set Accessibility Toolbar Settings', 'pojo-accessibility' ) . '">' . __( 'Toolbar', 'pojo-accessibility' ) . '</a>';
$customizer = '<a href="' . $this->get_admin_url( 'customizer' ) . '" aria-label="' . esc_attr__( 'Customize Toolbar', 'pojo-accessibility' ) . '" target="_blank">' . __( 'Customize', 'pojo-accessibility' ) . '</a>';
array_unshift( $links, $customizer );
array_unshift( $links, $toolbar );
array_unshift( $links, $settings );
}
return $links;
}
private function get_admin_url( $type ) {
switch ( $type ) {
case 'customizer':
return admin_url( 'customize.php?autofocus[section]=accessibility' );
break;
case 'general':
return admin_url( 'admin.php?page=accessibility-settings' );
break;
case 'toolbar':
return admin_url( 'admin.php?page=accessibility-toolbar' );
break;
}
}
private function get_default_values() {
if ( empty( $this->_defaults ) ) {
if ( empty( $this->_sections ) ) {
$this->get_settings_sections();
}
$defaults = array();
foreach ( $this->_sections as $section ) {
foreach ( $section['fields'] as $field ) {
$defaults[ $field['id'] ] = isset( $field['std'] ) ? $field['std'] : '';
}
}
$this->_defaults = $defaults;
}
}
public function get_default_title_text( $option ) {
$this->get_default_values();
$default = isset( $this->_defaults[ $option ] ) ? $this->_defaults[ $option ] : '';
return get_option( $option, $default );
}
public function __construct() {
$this->_page_title = __( 'One Click Accessibility', 'pojo-accessibility' );
$this->_page_menu_title = __( 'One Click Accessibility', 'pojo-accessibility' );
$this->_menu_parent = 'themes.php';
add_action( 'admin_menu', array( &$this, 'admin_menu' ), 20 );
add_action( 'admin_init', array( &$this, 'admin_init' ), 20 );
add_action( 'admin_footer', array( &$this, 'print_js' ) );
add_filter( 'plugin_action_links_' . POJO_A11Y_BASE, [ $this, 'plugin_action_links' ], 10, 2 );
}
}