PluginProbe
Filter Everything — WordPress & WooCommerce Filters / 1.2.4
Filter Everything — WordPress & WooCommerce Filters v1.2.4
1.9.7 1.9.6 1.9.5 1.9.4 1.9.3 1.9.2.2 1.9.2.1 trunk 1.2.1 1.2.3 1.2.4 1.2.5 1.3.0 1.3.1 1.3.2 1.4.1 1.4.4 1.4.5 1.4.8 1.4.9 1.5.0 1.5.1 1.6.0 1.6.1 1.6.2 All 52 releases
filter-everything / src / Settings / Tabs / SettingsTab.php

SettingsTab.php in Filter Everything — WordPress & WooCommerce Filters 1.2.4, at src/Settings/Tabs/SettingsTab.php

123 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FilterEverything\Filter;
4
5 if ( ! defined('WPINC') ) {
6 wp_die();
7 }
8
9 class SettingsTab extends BaseSettings
10 {
11 protected $page = 'wpc-filter-admin-settings';
12
13 protected $group = 'wpc_filter';
14
15 protected $optionName = 'wpc_filter_settings';
16
17 public function init()
18 {
19 add_action('admin_init', array($this, 'initSettings'));
20 }
21
22 public function initSettings()
23 {
24 register_setting($this->group, $this->optionName);
25
26 /**
27 * @see https://developer.wordpress.org/reference/functions/add_settings_field/
28 */
29 $defaultPostsContainer = flrt_default_posts_container();
30 $defaultPrimaryColor = flrt_default_theme_color();
31
32 $settings = array(
33 'mobile_devices' => array(
34 'label' => esc_html__('Mobile devices', 'filter-everything'),
35 'fields' => array(
36 'show_open_close_button' => array(
37 'type' => 'checkbox',
38 'title' => esc_html__('Collapse Filters Widget on Mobile devices', 'filter-everything'),
39 'id' => 'show_open_close_button',
40 'label' => esc_html__('Collapse widget and show the Filters opening button', 'filter-everything'),
41 ),
42 'try_move_to_top_sidebar' => array(
43 'type' => 'checkbox',
44 'title' => esc_html__('Sidebar on top', 'filter-everything'),
45 'id' => 'try_move_to_top_sidebar',
46 'label' => esc_html__('Try to move sidebar to top on mobile devices', 'filter-everything'),
47 )
48 )
49 ),
50 'ajax' => array(
51 'label' => esc_html__('AJAX', 'filter-everything'),
52 'fields' => array(
53 'enable_ajax' => array(
54 'type' => 'checkbox',
55 'title' => esc_html__('AJAX for Filters', 'filter-everything'),
56 'id' => 'enable_ajax',
57 'label' => esc_html__('Try to use AJAX', 'filter-everything'),
58 'description' => esc_html__( 'Please enable this option only after you have ensured that the filtering is working correctly', 'filter-everything' ),
59 ),
60 'posts_container' => array(
61 'type' => 'text',
62 'title' => esc_html__('CSS ID or Class of Posts Container', 'filter-everything'),
63 'id' => 'posts_container',
64 'default' => $defaultPostsContainer,
65 'description' => esc_html__( 'e.g. #primary or .main-content', 'filter-everything' ),
66 'label' => '',
67 )
68 )
69 ),
70 'common_settings' => array(
71 'label' => esc_html__('Other', 'filter-everything'),
72 'fields' => array(
73 'primary_color' => array(
74 'type' => 'text',
75 'title' => esc_html__('Widget Primary Color', 'filter-everything'),
76 'id' => 'wpc_primary_color',
77 'default' => $defaultPrimaryColor,
78 'label' => '',
79 ),
80 'container_height' => array(
81 'type' => 'text',
82 'title' => esc_html__('Filter Container max height, px', 'filter-everything'),
83 'id' => 'container_height',
84 'label' => '',
85 ),
86 'show_terms_in_content' => array(
87 'type' => 'checkbox',
88 'title' => esc_html__('Selected Terms above the posts container', 'filter-everything'),
89 'id' => 'show_terms_in_content',
90 'label' => esc_html__('Try to show selected terms above the posts container', 'filter-everything'),
91 ),
92 'widget_debug_messages' => array(
93 'type' => 'checkbox',
94 'title' => esc_html__('Debug mode', 'filter-everything'),
95 'id' => 'widget_debug_messages',
96 'label' => esc_html__('Enable debugging messages to help to configure filters', 'filter-everything'),
97 )
98 )
99 )
100 );
101
102 $settings = apply_filters('wpc_general_filters_settings', $settings);
103
104 $this->registerSettings($settings, $this->page, $this->optionName);
105 }
106
107 public function getLabel()
108 {
109 return esc_html__('General', 'filter-everything');
110 }
111
112 public function getName()
113 {
114 return 'settings';
115 }
116
117 public function valid()
118 {
119 return true;
120 }
121 }
122
123