| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Views class for Shortcode generator options. |
| 5 |
* |
| 6 |
* @link https://themeatelier.net |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package darkify |
| 10 |
* @subpackage darkify/src/Admin/Views/AdvancedSettings |
| 11 |
* @author ThemeAtelier<themeatelierbd@gmail.com> |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace ThemeAtelier\Darkify\Admin\Views; |
| 15 |
|
| 16 |
use ThemeAtelier\Darkify\Admin\Framework\Classes\Darkify; |
| 17 |
|
| 18 |
class AdvancedSettings |
| 19 |
{ |
| 20 |
/** |
| 21 |
* Create Option fields for the setting options. |
| 22 |
* |
| 23 |
* @param string $prefix Option setting key prefix. |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public static function options($prefix) |
| 27 |
{ |
| 28 |
Darkify::createSection($prefix, array( |
| 29 |
'title' => esc_html__('ADVANCED', 'darkify'), |
| 30 |
'icon' => 'icofont-settings', |
| 31 |
'fields' => array( |
| 32 |
array( |
| 33 |
'type' => 'section_tab', |
| 34 |
'tabs' => array( |
| 35 |
array( |
| 36 |
'title' => esc_html__('HTML/CSS Restriction', 'darkify'), |
| 37 |
'icon' => 'icofont-code-alt', |
| 38 |
'fields' => array( |
| 39 |
// ALLOWED ELEMENTS |
| 40 |
array( |
| 41 |
'id' => 'allowed_elements', |
| 42 |
'type' => 'textarea', |
| 43 |
'title' => esc_html__('Allow Only Elements', 'darkify'), |
| 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>', |
| 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'), |
| 47 |
), |
| 48 |
|
| 49 |
array( |
| 50 |
'id' => 'allowed_elements_force_to_correct', |
| 51 |
'type' => 'switcher', |
| 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>', |
| 54 |
'class' => 'switcher_pro_only', |
| 55 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 56 |
'text_off' => esc_html__('No', 'darkify'), |
| 57 |
'default' => true, |
| 58 |
), |
| 59 |
|
| 60 |
// DISALLOWED ELEMENTS |
| 61 |
array( |
| 62 |
'id' => 'disallowed_elements', |
| 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>', |
| 66 |
'class' => 'only_pro', |
| 67 |
'placeholder' => esc_html__('Enter comma separated HTML tags, CSS class or CSS ids. Example: div, #site-header, .my-footer', 'darkify'), |
| 68 |
), |
| 69 |
|
| 70 |
array( |
| 71 |
'id' => 'disallowed_elements_force_to_correct', |
| 72 |
'type' => 'switcher', |
| 73 |
'title' => esc_html__('Force To Correct', 'darkify'), |
| 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>', |
| 75 |
'class' => 'switcher_pro_only', |
| 76 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 77 |
'text_off' => esc_html__('No', 'darkify'), |
| 78 |
'default' => true, |
| 79 |
), |
| 80 |
) |
| 81 |
), |
| 82 |
|
| 83 |
array( |
| 84 |
'title' => esc_html__('Page/Posts Restriction', 'darkify'), |
| 85 |
'icon' => 'icofont-eye-blocked', |
| 86 |
'fields' => array( |
| 87 |
array( |
| 88 |
'type' => 'heading', |
| 89 |
'title' => esc_html__('Pages Restriction', 'darkify'), |
| 90 |
), |
| 91 |
array( |
| 92 |
'id' => 'allowed_pages', |
| 93 |
'type' => 'select', |
| 94 |
'title' => esc_html__('Allow Only Pages', 'darkify'), |
| 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>', |
| 96 |
'class' => 'only_pro', |
| 97 |
'placeholder' => esc_html__('Select some pages', 'darkify'), |
| 98 |
'options' => 'pages', |
| 99 |
'query_args' => array( |
| 100 |
'posts_per_page' => -1, |
| 101 |
), |
| 102 |
'chosen' => true, |
| 103 |
'multiple' => true, |
| 104 |
), |
| 105 |
|
| 106 |
array( |
| 107 |
'id' => 'disallowed_pages', |
| 108 |
'type' => 'select', |
| 109 |
'title' => esc_html__('Disallowed Pages', 'darkify'), |
| 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>', |
| 111 |
'class' => 'only_pro', |
| 112 |
'placeholder' => esc_html__('Select some pages', 'darkify'), |
| 113 |
'options' => 'pages', |
| 114 |
'query_args' => array( |
| 115 |
'posts_per_page' => -1, |
| 116 |
), |
| 117 |
'chosen' => true, |
| 118 |
'multiple' => true, |
| 119 |
'dependency' => array('allowed_pages', '==', ''), |
| 120 |
), |
| 121 |
|
| 122 |
array( |
| 123 |
'type' => 'heading', |
| 124 |
'title' => esc_html__('Posts Restriction', 'darkify'), |
| 125 |
), |
| 126 |
array( |
| 127 |
'id' => 'allowed_posts', |
| 128 |
'type' => 'select', |
| 129 |
'title' => esc_html__('Allow Only 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>', |
| 131 |
'class' => 'only_pro', |
| 132 |
'placeholder' => esc_html__('Select some posts', 'darkify'), |
| 133 |
'options' => 'posts', |
| 134 |
'query_args' => array( |
| 135 |
'posts_per_page' => -1, |
| 136 |
), |
| 137 |
'chosen' => true, |
| 138 |
'multiple' => true, |
| 139 |
), |
| 140 |
array( |
| 141 |
'id' => 'disallowed_posts', |
| 142 |
'type' => 'select', |
| 143 |
'title' => esc_html__('Disallowed 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>', |
| 145 |
'class' => 'only_pro', |
| 146 |
'placeholder' => esc_html__('Select some posts', 'darkify'), |
| 147 |
'options' => 'posts', |
| 148 |
'query_args' => array( |
| 149 |
'posts_per_page' => -1, |
| 150 |
), |
| 151 |
'chosen' => true, |
| 152 |
'multiple' => true, |
| 153 |
'dependency' => array('allowed_posts', '==', ''), |
| 154 |
), |
| 155 |
) |
| 156 |
), |
| 157 |
|
| 158 |
array( |
| 159 |
'title' => esc_html__('Custom CSS', 'darkify'), |
| 160 |
'icon' => 'icofont-file-css', |
| 161 |
'fields' => array( |
| 162 |
array( |
| 163 |
'id' => 'custom_css', |
| 164 |
'type' => 'code_editor', |
| 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>', |
| 167 |
'settings' => array( |
| 168 |
'theme' => 'mbo', |
| 169 |
'mode' => 'css', |
| 170 |
), |
| 171 |
), |
| 172 |
array( |
| 173 |
'id' => 'custom_css_rules', |
| 174 |
'type' => 'switcher', |
| 175 |
'title' => esc_html__('CSS Rules', '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'), |
| 179 |
'text_off' => esc_html__('No', 'darkify'), |
| 180 |
), |
| 181 |
array( |
| 182 |
'id' => 'normal_custom_css', |
| 183 |
'type' => 'code_editor', |
| 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>', |
| 186 |
'settings' => array( |
| 187 |
'theme' => 'mbo', |
| 188 |
'mode' => 'css', |
| 189 |
), |
| 190 |
), |
| 191 |
) |
| 192 |
), |
| 193 |
array( |
| 194 |
'title' => esc_html__('Extras', 'darkify'), |
| 195 |
'icon' => 'icofont-holding-hands', |
| 196 |
'fields' => array( |
| 197 |
// Enable Tooltip On Floating Switch |
| 198 |
array( |
| 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>', |
| 203 |
), |
| 204 |
array( |
| 205 |
'type' => 'heading', |
| 206 |
'title' => esc_html__('Backup', 'darkify'), |
| 207 |
), |
| 208 |
array( |
| 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', |
| 212 |
), |
| 213 |
) |
| 214 |
), |
| 215 |
) |
| 216 |
), |
| 217 |
), |
| 218 |
)); |
| 219 |
} |
| 220 |
} |
| 221 |
|