| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | /** |
| 4 | - * AdvancedSettings class for Advanced options. | |
| 4 | + * Views class for Shortcode generator options. | |
| 5 | 5 | * |
| 6 | 6 | * @link https://themeatelier.net |
| 7 | 7 | * @since 1.0.0 |
| 8 | 8 | * |
| @@ -12,9 +12,9 @@ | ||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | namespace ThemeAtelier\Darkify\Admin\Views; |
| 15 | 15 | |
| 16 | -use ThemeAtelier\Darkify\Admin\Schema\SchemaRegistry as Darkify; | |
| 16 | +use ThemeAtelier\Darkify\Admin\Framework\Classes\Darkify; | |
| 17 | 17 | |
| 18 | 18 | class AdvancedSettings |
| 19 | 19 | { |
| 20 | 20 | /** |
| @@ -25,9 +25,9 @@ | ||
| 25 | 25 | */ |
| 26 | 26 | public static function options($prefix) |
| 27 | 27 | { |
| 28 | 28 | Darkify::createSection($prefix, array( |
| 29 | - 'title' => esc_html__('Advanced', 'darkify'), | |
| 29 | + 'title' => esc_html__('ADVANCED', 'darkify'), | |
| 30 | 30 | 'icon' => 'icofont-settings', |
| 31 | 31 | 'fields' => array( |
| 32 | 32 | array( |
| 33 | 33 | 'type' => 'section_tab', |
| @@ -35,46 +35,23 @@ | ||
| 35 | 35 | array( |
| 36 | 36 | 'title' => esc_html__('HTML/CSS Restriction', 'darkify'), |
| 37 | 37 | 'icon' => 'icofont-code-alt', |
| 38 | 38 | 'fields' => array( |
| 39 | - // Intro line, rendered plain above the section card. | |
| 40 | - array( | |
| 41 | - 'type' => 'page_hint', | |
| 42 | - 'content' => esc_html__('Restrict which HTML elements dark mode applies to, by tag, CSS class, or CSS ID.', 'darkify'), | |
| 43 | - ), | |
| 44 | - // ===== HTML/CSS RESTRICTION ===== | |
| 45 | - array( | |
| 46 | - 'type' => 'heading', | |
| 47 | - 'title' => esc_html__('HTML/CSS Restriction', 'darkify'), | |
| 48 | - 'section_start' => true, | |
| 49 | - ), | |
| 50 | 39 | // ALLOWED ELEMENTS |
| 51 | 40 | array( |
| 52 | 41 | 'id' => 'allowed_elements', |
| 53 | 42 | 'type' => 'textarea', |
| 54 | 43 | 'title' => esc_html__('Allow Only Elements', 'darkify'), |
| 55 | - 'title_help' => | |
| 56 | - '<div class="darkify-info-label">' . | |
| 57 | - __('Dark mode will be applied only to these elements.', 'darkify') . | |
| 58 | - '</div>', | |
| 59 | - 'placeholder' => esc_html__( | |
| 60 | - 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer', | |
| 61 | - 'darkify' | |
| 62 | - ), | |
| 63 | - | |
| 64 | - | |
| 44 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will be applied only to these elements.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/advanced/#element_targeting" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/advanced/" target="_blank">' . __('Open Docs', 'darkify') . '</a>', | |
| 65 | 45 | 'class' => 'only_pro', |
| 46 | + 'placeholder' => esc_html__('Enter comma separated HTML tags, CSS class or CSS ids. Example: div, #site-header, .my-footer', 'darkify'), | |
| 66 | 47 | ), |
| 67 | 48 | |
| 68 | 49 | array( |
| 69 | 50 | 'id' => 'allowed_elements_force_to_correct', |
| 70 | 51 | 'type' => 'switcher', |
| 71 | - 'title' => esc_html__('Force Design Correction', 'darkify'), | |
| 72 | - 'title_help' => | |
| 73 | - '<div class="darkify-info-label">' . | |
| 74 | - __('Force Darkify to preserve layout and readability when background or text colors are modified on allowed elements.', 'darkify') . | |
| 75 | - '</div>', | |
| 76 | - | |
| 52 | + 'title' => esc_html__('Force To Correct', 'darkify'), | |
| 53 | + 'title_help' => '<div class="darkify-info-label">' . __('Force to keep designs correct if background color or text color is changed on allowed elements.', 'darkify') . '</div>', | |
| 77 | 54 | 'class' => 'switcher_pro_only', |
| 78 | 55 | 'text_on' => esc_html__('Yes', 'darkify'), |
| 79 | 56 | 'text_off' => esc_html__('No', 'darkify'), |
| 80 | 57 | 'default' => true, |
| @@ -83,20 +60,12 @@ | ||
| 83 | 60 | // DISALLOWED ELEMENTS |
| 84 | 61 | array( |
| 85 | 62 | 'id' => 'disallowed_elements', |
| 86 | 63 | 'type' => 'textarea', |
| 64 | + 'title' => esc_html__('Disallowed Elements', 'darkify'), | |
| 65 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will be applied only to these elements.', 'darkify') . '</div>', | |
| 87 | 66 | 'class' => 'only_pro', |
| 88 | - 'title' => esc_html__('Disallowed Elements', 'darkify'), | |
| 89 | - 'title_help' => | |
| 90 | - '<div class="darkify-info-label">' . | |
| 91 | - esc_html__('Dark mode will NOT be applied to the elements.', 'darkify') . | |
| 92 | - '</div>', | |
| 93 | - | |
| 94 | - 'placeholder' => esc_html__( | |
| 95 | - 'Enter comma-separated HTML tags, CSS classes, or CSS IDs. Example: div, #site-header, .my-footer', | |
| 96 | - 'darkify' | |
| 97 | - ), | |
| 98 | - | |
| 67 | + 'placeholder' => esc_html__('Enter comma separated HTML tags, CSS class or CSS ids. Example: div, #site-header, .my-footer', 'darkify'), | |
| 99 | 68 | ), |
| 100 | 69 | |
| 101 | 70 | array( |
| 102 | 71 | 'id' => 'disallowed_elements_force_to_correct', |
| @@ -101,12 +70,9 @@ | ||
| 101 | 70 | array( |
| 102 | 71 | 'id' => 'disallowed_elements_force_to_correct', |
| 103 | 72 | 'type' => 'switcher', |
| 104 | 73 | 'title' => esc_html__('Force To Correct', 'darkify'), |
| 105 | - 'title_help' => '<div class="darkify-info-label">' . | |
| 106 | - __('Force Darkify to keep the design correct when background or text colors do not work properly for disallowed elements.', 'darkify') . | |
| 107 | - '</div>', | |
| 108 | - | |
| 74 | + 'title_help' => '<div class="darkify-info-label">' . __('Force to keep designs correct if background color or text color is not working properly for disallowed elements.', 'darkify') . '</div>', | |
| 109 | 75 | 'class' => 'switcher_pro_only', |
| 110 | 76 | 'text_on' => esc_html__('Yes', 'darkify'), |
| 111 | 77 | 'text_off' => esc_html__('No', 'darkify'), |
| 112 | 78 | 'default' => true, |
| @@ -117,32 +83,23 @@ | ||
| 117 | 83 | array( |
| 118 | 84 | 'title' => esc_html__('Page/Posts Restriction', 'darkify'), |
| 119 | 85 | 'icon' => 'icofont-eye-blocked', |
| 120 | 86 | 'fields' => array( |
| 121 | - // Intro line, rendered plain above the section cards. | |
| 122 | 87 | array( |
| 123 | - 'type' => 'page_hint', | |
| 124 | - 'content' => esc_html__('Limit where dark mode and the floating switch run, by specific pages or posts.', 'darkify'), | |
| 88 | + 'type' => 'heading', | |
| 89 | + 'title' => esc_html__('Pages Restriction', 'darkify'), | |
| 125 | 90 | ), |
| 126 | 91 | array( |
| 127 | - 'type' => 'heading', | |
| 128 | - 'title' => esc_html__('Pages Restriction', 'darkify'), | |
| 129 | - 'section_start' => true, | |
| 130 | - ), | |
| 131 | - array( | |
| 132 | 92 | 'id' => 'allowed_pages', |
| 133 | 93 | 'type' => 'select', |
| 134 | 94 | 'title' => esc_html__('Allow Only Pages', 'darkify'), |
| 135 | - 'title_help' => | |
| 136 | - '<div class="darkify-info-label">' . | |
| 137 | - __('Dark mode will be applied only to the selected pages.', 'darkify') . | |
| 138 | - '</div><div class="darkify-short-content">' . | |
| 139 | - __('Choose only the pages where dark mode and the floating switch should work. Dark mode will not be applied to any other pages.', 'darkify') . | |
| 140 | - '</div>', | |
| 141 | - 'placeholder' => esc_html__('Select pages', 'darkify'), | |
| 142 | - | |
| 95 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will be applied only to these pages.', 'darkify') . '</div><div class="darkify-short-content">' . __('Choose the pages only where dark mode and floating switch can work. No other pages will be able to process dark mode.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/advanced/#granular_control" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/advanced/#pagerestriction" target="_blank">' . __('Open Docs', 'darkify') . '</a>', | |
| 143 | 96 | 'class' => 'only_pro', |
| 97 | + 'placeholder' => esc_html__('Select some pages', 'darkify'), | |
| 144 | 98 | 'options' => 'pages', |
| 99 | + 'query_args' => array( | |
| 100 | + 'posts_per_page' => -1, | |
| 101 | + ), | |
| 145 | 102 | 'chosen' => true, |
| 146 | 103 | 'multiple' => true, |
| 147 | 104 | ), |
| 148 | 105 | |
| @@ -149,18 +106,15 @@ | ||
| 149 | 106 | array( |
| 150 | 107 | 'id' => 'disallowed_pages', |
| 151 | 108 | 'type' => 'select', |
| 152 | 109 | 'title' => esc_html__('Disallowed Pages', 'darkify'), |
| 153 | - 'title_help' => | |
| 154 | - '<div class="darkify-info-label">' . | |
| 155 | - __('Dark mode will not be applied to these pages.', 'darkify') . | |
| 156 | - '</div><div class="darkify-short-content">' . | |
| 157 | - __('Choose the pages where dark mode and the floating switch should not work. Dark mode will work on all other pages.', 'darkify') . | |
| 158 | - '</div>', | |
| 159 | - | |
| 110 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will not be applied to these pages.', 'darkify') . '</div><div class="darkify-short-content">' . __('Choose the pages where dark mode and floating switch can not work. Other pages will be able to process dark mode.', 'darkify') . '</div>', | |
| 160 | 111 | 'class' => 'only_pro', |
| 161 | - 'placeholder' => esc_html__('Select pages', 'darkify'), | |
| 112 | + 'placeholder' => esc_html__('Select some pages', 'darkify'), | |
| 162 | 113 | 'options' => 'pages', |
| 114 | + 'query_args' => array( | |
| 115 | + 'posts_per_page' => -1, | |
| 116 | + ), | |
| 163 | 117 | 'chosen' => true, |
| 164 | 118 | 'multiple' => true, |
| 165 | 119 | 'dependency' => array('allowed_pages', '==', ''), |
| 166 | 120 | ), |
| @@ -165,26 +119,22 @@ | ||
| 165 | 119 | 'dependency' => array('allowed_pages', '==', ''), |
| 166 | 120 | ), |
| 167 | 121 | |
| 168 | 122 | array( |
| 169 | - 'type' => 'heading', | |
| 170 | - 'title' => esc_html__('Posts Restriction', 'darkify'), | |
| 171 | - 'section_start' => true, | |
| 123 | + 'type' => 'heading', | |
| 124 | + 'title' => esc_html__('Posts Restriction', 'darkify'), | |
| 172 | 125 | ), |
| 173 | 126 | array( |
| 174 | 127 | 'id' => 'allowed_posts', |
| 175 | 128 | 'type' => 'select', |
| 176 | 129 | 'title' => esc_html__('Allow Only Posts', 'darkify'), |
| 177 | - 'title_help' => | |
| 178 | - '<div class="darkify-info-label">' . | |
| 179 | - __('Dark mode will be applied only to these posts.', 'darkify') . | |
| 180 | - '</div><div class="darkify-short-content">' . | |
| 181 | - __('Choose only the posts where dark mode and the floating switch should work. Dark mode will not be applied to any other posts.', 'darkify') . | |
| 182 | - '</div>', | |
| 183 | - | |
| 184 | - 'placeholder' => esc_html__('Select posts', 'darkify'), | |
| 130 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will be applied only to these posts.', 'darkify') . '</div><div class="darkify-short-content">' . __('Choose the posts only where dark mode and floating switch can work. No other pages will be able to process dark mode.', 'darkify') . '</div>', | |
| 185 | 131 | 'class' => 'only_pro', |
| 132 | + 'placeholder' => esc_html__('Select some posts', 'darkify'), | |
| 186 | 133 | 'options' => 'posts', |
| 134 | + 'query_args' => array( | |
| 135 | + 'posts_per_page' => -1, | |
| 136 | + ), | |
| 187 | 137 | 'chosen' => true, |
| 188 | 138 | 'multiple' => true, |
| 189 | 139 | ), |
| 190 | 140 | array( |
| @@ -190,17 +140,15 @@ | ||
| 190 | 140 | array( |
| 191 | 141 | 'id' => 'disallowed_posts', |
| 192 | 142 | 'type' => 'select', |
| 193 | 143 | 'title' => esc_html__('Disallowed Posts', 'darkify'), |
| 194 | - 'title_help' => | |
| 195 | - '<div class="darkify-info-label">' . | |
| 196 | - __('Dark mode will not be applied to these posts.', 'darkify') . | |
| 197 | - '</div><div class="darkify-short-content">' . | |
| 198 | - __('Choose the posts where dark mode and the floating switch cannot work. Other posts will be able to process dark mode.', 'darkify') . | |
| 199 | - '</div>', | |
| 200 | - 'placeholder' => esc_html__('Select posts', 'darkify'), | |
| 144 | + 'title_help' => '<div class="darkify-info-label">' . __('Dark mode will not be applied to these posts.', 'darkify') . '</div><div class="darkify-short-content">' . __('Choose the posts where dark mode and floating switch can not work. Other pages will be able to process dark mode.', 'darkify') . '</div>', | |
| 201 | 145 | 'class' => 'only_pro', |
| 146 | + 'placeholder' => esc_html__('Select some posts', 'darkify'), | |
| 202 | 147 | 'options' => 'posts', |
| 148 | + 'query_args' => array( | |
| 149 | + 'posts_per_page' => -1, | |
| 150 | + ), | |
| 203 | 151 | 'chosen' => true, |
| 204 | 152 | 'multiple' => true, |
| 205 | 153 | 'dependency' => array('allowed_posts', '==', ''), |
| 206 | 154 | ), |
| @@ -205,34 +153,20 @@ | ||
| 205 | 153 | 'dependency' => array('allowed_posts', '==', ''), |
| 206 | 154 | ), |
| 207 | 155 | ) |
| 208 | 156 | ), |
| 157 | + | |
| 209 | 158 | array( |
| 210 | 159 | 'title' => esc_html__('Custom CSS', 'darkify'), |
| 211 | 160 | 'icon' => 'icofont-file-css', |
| 212 | 161 | 'fields' => array( |
| 213 | - // Intro line, rendered plain above the section card. | |
| 214 | 162 | array( |
| 215 | - 'type' => 'page_hint', | |
| 216 | - 'content' => esc_html__('Add your own CSS for dark mode, and CSS that applies in both modes.', 'darkify'), | |
| 217 | - ), | |
| 218 | - // ===== CUSTOM CSS ===== | |
| 219 | - array( | |
| 220 | - 'type' => 'heading', | |
| 221 | - 'title' => esc_html__('Custom CSS', 'darkify'), | |
| 222 | - 'section_start' => true, | |
| 223 | - ), | |
| 224 | - array( | |
| 225 | 163 | 'id' => 'custom_css', |
| 226 | 164 | 'type' => 'code_editor', |
| 227 | - 'title' => esc_html__('Dark Mode CSS', 'darkify'), | |
| 228 | - 'title_help' => | |
| 229 | - '<div class="darkify-info-label">' . | |
| 230 | - __('The CSS code will only be applied when dark mode is active.', 'darkify') . | |
| 231 | - '</div>', | |
| 232 | - | |
| 165 | + 'title' => esc_html__('Dark Mode CSS', 'darkify'), | |
| 166 | + 'title_help' => '<div class="darkify-info-label">' . __('The CSS code will only be applied when dark mode is active.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/advanced/#custom_css" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/advanced/#custom_css" target="_blank">' . __('Open Docs', 'darkify') . '</a>', | |
| 233 | 167 | 'settings' => array( |
| 234 | - 'theme' => 'default', | |
| 168 | + 'theme' => 'mbo', | |
| 235 | 169 | 'mode' => 'css', |
| 236 | 170 | ), |
| 237 | 171 | ), |
| 238 | 172 | array( |
| @@ -238,76 +172,44 @@ | ||
| 238 | 172 | array( |
| 239 | 173 | 'id' => 'custom_css_rules', |
| 240 | 174 | 'type' => 'switcher', |
| 241 | 175 | 'title' => esc_html__('CSS Rules', 'darkify'), |
| 242 | - | |
| 243 | - 'title_help' => | |
| 244 | - '<div class="darkify-info-label">' . | |
| 245 | - __('CSS rules will be applied to all child elements of the specified CSS selectors.', 'darkify') . | |
| 246 | - '</div>' . | |
| 247 | - '<div class="darkify-short-content">' . | |
| 248 | - __('Custom CSS selectors are automatically treated as Disallowed Elements. To override this behavior, use the :not-disallowed pseudo-class. Example: body:not-disallowed { ... }', 'darkify') . | |
| 249 | - '</div>' . | |
| 250 | - '' . | |
| 251 | - '', | |
| 252 | - | |
| 253 | - 'text_on' => esc_html__('Yes', 'darkify'), | |
| 176 | + 'title_help' => '<div class="darkify-info-label">' . __('CSS rules should be applied to all children of the CSS selectors.', 'darkify') . '</div><div class="darkify-short-content">' . __('Custom CSS selectors are automatically identified as Disallowed Elements, to ignore, use :not-disallowed pseudo class. i.e. body:not-disallowed{...}', 'darkify') . '</div>', | |
| 177 | + 'class' => 'switcher_pro_only', | |
| 178 | + 'text_on' => esc_html__('Yes', 'darkify'), | |
| 254 | 179 | 'text_off' => esc_html__('No', 'darkify'), |
| 255 | - | |
| 256 | - 'class' => 'switcher_pro_only', | |
| 257 | 180 | ), |
| 258 | 181 | array( |
| 259 | 182 | 'id' => 'normal_custom_css', |
| 260 | 183 | 'type' => 'code_editor', |
| 261 | - 'title' => esc_html__('Normal Mode CSS', 'darkify'), | |
| 262 | - 'title_help' => | |
| 263 | - '<div class="darkify-info-label">' . | |
| 264 | - __('The CSS code will be applied in both normal mode and dark mode.', 'darkify') . | |
| 265 | - '</div>' . | |
| 266 | - '' . | |
| 267 | - '', | |
| 268 | - | |
| 184 | + 'title' => esc_html__('Normal Mode CSS', 'darkify'), | |
| 185 | + 'title_help' => '<div class="darkify-info-label">' . __('The CSS code will be applied on both normal mode and dark mode.', 'darkify') . '</div>', | |
| 269 | 186 | 'settings' => array( |
| 270 | - 'theme' => 'default', | |
| 187 | + 'theme' => 'mbo', | |
| 271 | 188 | 'mode' => 'css', |
| 272 | 189 | ), |
| 273 | 190 | ), |
| 274 | 191 | ) |
| 275 | 192 | ), |
| 276 | - // "Extras" — the Frontend Iframe Dark Mode toggle lives here, | |
| 277 | - // matching Pro's layout (moved out of Controls → Frontend). The | |
| 278 | - // page's former Extras contents (Clean-up Data on Deletion + | |
| 279 | - // Backup and Restore) now live on their own Tools page — see | |
| 280 | - // Views/Tools.php. | |
| 281 | 193 | array( |
| 282 | 194 | 'title' => esc_html__('Extras', 'darkify'), |
| 283 | 195 | 'icon' => 'icofont-holding-hands', |
| 284 | 196 | 'fields' => array( |
| 285 | - // Intro line, rendered plain above the section card. | |
| 197 | + // Enable Tooltip On Floating Switch | |
| 286 | 198 | array( |
| 287 | - 'type' => 'page_hint', | |
| 288 | - 'content' => esc_html__('Extra behaviors that don’t fit elsewhere.', 'darkify'), | |
| 199 | + 'id' => 'darkify_data_remove', | |
| 200 | + 'type' => 'checkbox', | |
| 201 | + 'title' => esc_html__('Clean-up Data on Deletion', 'darkify'), | |
| 202 | + 'title_help' => '<div class="darkify-info-label">' . esc_html__('Check this box if you would like Darkify plugin to completely remove all of its data when the plugin is deleted.', 'darkify') . '</div>', | |
| 289 | 203 | ), |
| 290 | - // ===== EXTRAS ===== | |
| 291 | 204 | array( |
| 292 | - 'type' => 'heading', | |
| 293 | - 'title' => esc_html__('Extras', 'darkify'), | |
| 294 | - 'section_start' => true, | |
| 205 | + 'type' => 'heading', | |
| 206 | + 'title' => esc_html__('Backup', 'darkify'), | |
| 295 | 207 | ), |
| 296 | 208 | array( |
| 297 | - 'id' => 'enable_frontend_iframe_dark_mode', | |
| 298 | - 'type' => 'switcher', | |
| 299 | - 'title' => esc_html__('Frontend Iframe Dark Mode', 'darkify'), | |
| 300 | - 'title_help' => | |
| 301 | - '<div class="darkify-info-label">' . | |
| 302 | - __('Apply dark mode to iframes when dark mode is active. Same-origin iframes receive full dark mode styling; cross-origin iframes (embedded third-party widgets) are dimmed to 60% brightness. Disable to keep all iframes at their original appearance.', 'darkify') . | |
| 303 | - '</div>' . | |
| 304 | - '' . | |
| 305 | - '', | |
| 306 | - 'text_on' => esc_html__('Enabled', 'darkify'), | |
| 307 | - 'text_off' => esc_html__('Disabled', 'darkify'), | |
| 308 | - 'text_width' => 100, | |
| 309 | - 'default' => true, | |
| 209 | + 'title' => esc_html__('Backup and Restore Settings', 'darkify'), | |
| 210 | + 'title_help' => '<div class="darkify-info-label">' . esc_html__('Use the options to backup your settings for safekeeping or restore them when needed. Simply export your current settings as a .json file, and import it whenever you want to restore your configuration.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/advanced/#backup" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/advanced/#backup" target="_blank">' . __('Open Docs', 'darkify') . '</a>', | |
| 211 | + 'type' => 'backup', | |
| 310 | 212 | ), |
| 311 | 213 | ) |
| 312 | 214 | ), |
| 313 | 215 | ) |