| 1 |
<?php |
| 2 |
|
| 3 |
namespace AgeGate\Admin\Settings; |
| 4 |
|
| 5 |
trait Advanced |
| 6 |
{ |
| 7 |
protected function getAdvancedFields() |
| 8 |
{ |
| 9 |
return [ |
| 10 |
[ |
| 11 |
'title' => __('Caching / Performance', 'age-gate'), |
| 12 |
'model' => ['method'], |
| 13 |
'subtitle' => __('If you have a caching solution, it is best to use a JavaScript triggered version of the age gate as this won\'t be adversely affected by the cache. If you don\'t have caching, the standard method is recommended.', 'age-gate'), |
| 14 |
'fields' => [ |
| 15 |
'method' => [ |
| 16 |
'label' => __('Method', 'age-gate'), |
| 17 |
'type' => 'select', |
| 18 |
'options' => [ |
| 19 |
'standard' => __('Standard (PHP)', 'age-gate'), |
| 20 |
'js' => __('No caching (JavaScript)', 'age-gate'), |
| 21 |
], |
| 22 |
'default' => 'js', |
| 23 |
'attributes' => [ |
| 24 |
'x-model' => 'method', |
| 25 |
] |
| 26 |
|
| 27 |
], |
| 28 |
'raw_assets' => [ |
| 29 |
'label' => __('Unoptimised Assets', 'age-gate'), |
| 30 |
'type' => 'checkbox', |
| 31 |
'subtext' => __('By default, age gate loads production ready assets. You can disable this if you have an alternative optimisation tool.', 'age-gate'), |
| 32 |
], |
| 33 |
'renderer' => [ |
| 34 |
'label' => __('Template render element', 'age-gate'), |
| 35 |
'type' => 'select', |
| 36 |
'default' => 'template', |
| 37 |
'subtext' => __('Templates may be crawled by Google giving unexpected SEO results, but may improve compatibility with some performance plugins', 'age-gate'), |
| 38 |
'options' => [ |
| 39 |
'template' => __('Template element', 'age-gate'), |
| 40 |
'script' => __('Script element', 'age-gate'), |
| 41 |
], |
| 42 |
'condition' => [ |
| 43 |
'x-show' => "method == 'js'" |
| 44 |
], |
| 45 |
], |
| 46 |
'disable_ajax_fallback' => [ |
| 47 |
'label' => __('Disable AJAX fallback', 'age-gate'), |
| 48 |
'type' => 'checkbox', |
| 49 |
'default' => false, |
| 50 |
'subtext' => __('By default, if Age Gate fails to get a response from the REST API it will then attempt an admin_ajax request', 'age-gate'), |
| 51 |
'condition' => [ |
| 52 |
'x-show' => "method == 'js'" |
| 53 |
], |
| 54 |
], |
| 55 |
'use_local_storage' => [ |
| 56 |
'label' => __('Local storage', 'age-gate'), |
| 57 |
'sublabel' => __('BETA', 'age-gate'), |
| 58 |
'type' => 'checkbox', |
| 59 |
'default' => false, |
| 60 |
'subtext' => __('Some cookie banners may disable or unset cookies, use local storage as an alternative to cookies', 'age-gate'), |
| 61 |
'condition' => [ |
| 62 |
'x-show' => "method == 'js'" |
| 63 |
], |
| 64 |
], |
| 65 |
'munge' => [ |
| 66 |
'label' => __('Munge options', 'age-gate'), |
| 67 |
'type' => 'checkbox', |
| 68 |
'default' => false, |
| 69 |
'subtext' => __('Settings in JavaScript mode are not outputted as a script tag, useful for some performance plugins like Lightspeed', 'age-gate'), |
| 70 |
'condition' => [ |
| 71 |
'x-show' => "method == 'js'" |
| 72 |
], |
| 73 |
], |
| 74 |
'in_header' => [ |
| 75 |
'label' => __('In header', 'age-gate'), |
| 76 |
'type' => 'checkbox', |
| 77 |
'default' => false, |
| 78 |
'subtext' => __('Add Age Gate early in the load process. This may give a visual speed improvement but harm pagespeed scores (blocking)', 'age-gate'), |
| 79 |
'condition' => [ |
| 80 |
'x-show' => "method == 'js'" |
| 81 |
], |
| 82 |
], |
| 83 |
'js_hooks' => [ |
| 84 |
'label' => __('Hooks', 'age-gate'), |
| 85 |
'type' => 'checkbox', |
| 86 |
'default' => false, |
| 87 |
'subtext' => __('Enable certain hooks in JavaScript', 'age-gate'), |
| 88 |
'condition' => [ |
| 89 |
'x-show' => "method == 'js'" |
| 90 |
], |
| 91 |
], |
| 92 |
'loader_img' => [ |
| 93 |
'label' => __('Loading image', 'age-gate'), |
| 94 |
'type' => 'checkbox', |
| 95 |
'default' => false, |
| 96 |
'subtext' => __('Include loader as image tag (default inline SVG)', 'age-gate'), |
| 97 |
'condition' => [ |
| 98 |
'x-show' => "method == 'js'" |
| 99 |
], |
| 100 |
], |
| 101 |
'preload' => [ |
| 102 |
'label' => __('Preload images', 'age-gate'), |
| 103 |
'type' => 'checkbox', |
| 104 |
'default' => true, |
| 105 |
'subtext' => __('Logo and/or background images are preloaded', 'age-gate'), |
| 106 |
], |
| 107 |
], |
| 108 |
], |
| 109 |
[ |
| 110 |
'title' => __('Interactions', 'age-gate'), |
| 111 |
'subtitle' => __('Block certain actions from a user.', 'age-gate'), |
| 112 |
'fields' => [ |
| 113 |
'focus' => [ |
| 114 |
'label' => __('Trap focus', 'age-gate'), |
| 115 |
'type' => 'checkbox', |
| 116 |
'default' => false, |
| 117 |
'subtext' => __('Focus trapping can help accessibility, however may conflict with other popups like cookie banners.', 'age-gate'), |
| 118 |
], |
| 119 |
'dev_tools' => [ |
| 120 |
'label' => __('Disable right click and F12', 'age-gate'), |
| 121 |
'type' => 'checkbox', |
| 122 |
'default' => false, |
| 123 |
'subtext' => __('Removes users ability to open context menu or dev tools with F12. Other routes may stil be available for developers', 'age-gate'), |
| 124 |
], |
| 125 |
], |
| 126 |
], |
| 127 |
[ |
| 128 |
'title' => __('Additional tags', 'age-gate'), |
| 129 |
'fields' => [ |
| 130 |
'rta' => [ |
| 131 |
'label' => __('Enable RTA tag', 'age-gate'), |
| 132 |
'type' => 'checkbox', |
| 133 |
'default' => false, |
| 134 |
], |
| 135 |
], |
| 136 |
], |
| 137 |
[ |
| 138 |
'title' => __('Toolbar', 'age-gate'), |
| 139 |
'fields' => [ |
| 140 |
'toolbar' => [ |
| 141 |
'label' => __('Show in front end toolbar', 'age-gate'), |
| 142 |
'type' => 'checkbox', |
| 143 |
'default' => true, |
| 144 |
], |
| 145 |
], |
| 146 |
], |
| 147 |
[ |
| 148 |
'title' => __('Custom bots', 'age-gate'), |
| 149 |
// TODO: can be a part or full user agent string |
| 150 |
'subtitle' => __('You can add the user agent string of any bots that are not automatically picked up. Add 1 per line.', 'age-gate'), |
| 151 |
'fields' => [ |
| 152 |
'user_agents' => [ |
| 153 |
'type' => 'textarea', |
| 154 |
'label' => __('UA Strings', 'age-gate'), |
| 155 |
'default' => '', |
| 156 |
'attributes' => [ |
| 157 |
'class' => 'mono' |
| 158 |
] |
| 159 |
] |
| 160 |
], |
| 161 |
], |
| 162 |
[ |
| 163 |
'fields' => [ |
| 164 |
'anonymous' => [ |
| 165 |
'label' => __('Anonymous Age Gate', 'age-gate'), |
| 166 |
'type' => 'checkbox', |
| 167 |
'default' => false, |
| 168 |
], |
| 169 |
'cookie_name' => [ |
| 170 |
'label' => __('Cookie name', 'age-gate'), |
| 171 |
'type' => 'text', |
| 172 |
'default' => 'age_gate', |
| 173 |
], |
| 174 |
|
| 175 |
], |
| 176 |
], |
| 177 |
[ |
| 178 |
'title' => __('Styling', 'age-gate'), |
| 179 |
'subtitle' => __('You can add custom CSS for the Age Gate in customizer.', 'age-gate'), |
| 180 |
'fields' => [ |
| 181 |
'css' => [ |
| 182 |
'label' => __('Custom CSS', 'age-gate'), |
| 183 |
'type' => 'message', |
| 184 |
'message' => __('Custom CSS can now be found/added in the customiser', 'age-gate'), |
| 185 |
'suboption' => get_option('age_gate_legacy_css', ''), |
| 186 |
'default' => false, |
| 187 |
'attributes' => [ |
| 188 |
'class' => 'ag-css', |
| 189 |
], |
| 190 |
'docs' => [ |
| 191 |
'link' => 'https://agegate.io/docs/v3/styling/css-reference', |
| 192 |
'label' => 'CSS Reference', |
| 193 |
'class' => 'button', |
| 194 |
] |
| 195 |
], |
| 196 |
'css_type' => [ |
| 197 |
'label' => __('CSS style', 'age-gate'), |
| 198 |
'type' => 'select', |
| 199 |
'options' => [ |
| 200 |
'v3' => 'BEM style', |
| 201 |
'v2' => 'V2 style' |
| 202 |
], |
| 203 |
'default' => 'v3', |
| 204 |
|
| 205 |
], |
| 206 |
], |
| 207 |
], |
| 208 |
|
| 209 |
]; |
| 210 |
} |
| 211 |
} |
| 212 |
|