| 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/Control |
| 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 Control |
| 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( |
| 29 |
$prefix, |
| 30 |
array( |
| 31 |
'title' => esc_html__('CONTROLS', 'darkify'), |
| 32 |
'icon' => 'icofont-ui-settings', |
| 33 |
'fields' => array( |
| 34 |
array( |
| 35 |
'type' => 'section_tab', |
| 36 |
'tabs' => array( |
| 37 |
|
| 38 |
array( |
| 39 |
'title' => esc_html__('Frontend', 'darkify'), |
| 40 |
'icon' => 'icofont-computer', |
| 41 |
'fields' => array( |
| 42 |
array( |
| 43 |
'type' => 'heading', |
| 44 |
'content' => esc_html__('Basic Control', 'darkify'), |
| 45 |
), |
| 46 |
array( |
| 47 |
'id' => 'enable_dark_mode_switch', |
| 48 |
'type' => 'switcher', |
| 49 |
'title' => esc_html__('Frontend Dark Mode', 'darkify'), |
| 50 |
'title_help' => '<div class="darkify-info-label">' . __('Show the dark mode floating switch in your Website\'s frontend.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls/" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/control/" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 51 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 52 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 53 |
'text_width' => 100, |
| 54 |
'default' => true, |
| 55 |
), |
| 56 |
array( |
| 57 |
'id' => 'enable_default_dark_mode', |
| 58 |
'type' => 'switcher', |
| 59 |
'title' => esc_html__('Default Dark Mode', 'darkify'), |
| 60 |
'title_help' => '<div class="darkify-info-label">' . __('Automatically turn your website dark by default.', 'darkify') . '</div>', |
| 61 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 62 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 63 |
'text_width' => 100, |
| 64 |
// 'title_video' => '<div class="darkify-img-tag"> |
| 65 |
// <video autoplay loop muted playsinline> |
| 66 |
// <source src="https://plugins.svn.wordpress.org/darkify/assets/video/os-aware-darkmode.webm" type="video/webm"> |
| 67 |
// </video> |
| 68 |
// </div><div class="darkify-info-label">Auto Convert Dropdowns to Button</div>', |
| 69 |
), |
| 70 |
array( |
| 71 |
'id' => 'enable_os_aware', |
| 72 |
'type' => 'switcher', |
| 73 |
'title' => esc_html__('OS Aware Dark Mode', 'darkify'), |
| 74 |
'title_video' => '<div class="darkify-img-tag"> |
| 75 |
<video autoplay loop muted playsinline> |
| 76 |
<source src="https://plugins.svn.wordpress.org/darkify/assets/videos/os-aware-darkmode.webm" type="video/webm"> |
| 77 |
</video> |
| 78 |
</div><div class="darkify-info-label">Dark Mode toggling based on OS setting</div>', |
| 79 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 80 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 81 |
'text_width' => 100, |
| 82 |
'default' => true, |
| 83 |
), |
| 84 |
array( |
| 85 |
'id' => 'enable_keyboard_shortcut', |
| 86 |
'type' => 'switcher', |
| 87 |
'title' => esc_html__('Keyboard Shortcut', 'darkify'), |
| 88 |
'title_help' => '<div class="darkify-info-label">' . __('Enable to dark mode by pressing Ctrl+Alt+D on windows keyboard & Ctrl+Opt|Start+D on mac.', 'darkify') . '</div>', |
| 89 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 90 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 91 |
'text_width' => 100, |
| 92 |
'default' => true, |
| 93 |
), |
| 94 |
array( |
| 95 |
'type' => 'heading', |
| 96 |
'title' => esc_html__('Advanced Control', 'darkify'), |
| 97 |
), |
| 98 |
// Enable Time Based Auto Dark Mode |
| 99 |
array( |
| 100 |
'id' => 'enable_time', |
| 101 |
'type' => 'fieldset', |
| 102 |
'fields' => array( |
| 103 |
array( |
| 104 |
'id' => 'enable_time_based_dark', |
| 105 |
'type' => 'switcher', |
| 106 |
'title' => esc_html__('Time Based Auto Dark Mode', 'darkify'), |
| 107 |
'title_help' => '<div class="darkify-info-label">' . __('Automatically turn dark mode ON based on users’ localtime.', 'darkify') . '</div>', |
| 108 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 109 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 110 |
'text_width' => 100, |
| 111 |
), |
| 112 |
array( |
| 113 |
'id' => 'time_based_dark_start', |
| 114 |
'type' => 'datetime', |
| 115 |
'title' => esc_html__('Pick a Time', 'darkify'), |
| 116 |
'title_help' => '<div class="darkify-info-label">' . __('Set the exact start and end times when dark mode should automatically be enabled or disabled.', 'darkify') . '</div>', |
| 117 |
'from_to' => true, |
| 118 |
'text_from' => esc_html__('Form', 'darkify'), |
| 119 |
'text_to' => esc_html__('To', 'darkify'), |
| 120 |
'settings' => array( |
| 121 |
'noCalendar' => true, |
| 122 |
'enableTime' => true, |
| 123 |
'dateFormat' => 'H:i', |
| 124 |
'time_24hr' => false, |
| 125 |
), |
| 126 |
'dependency' => array('enable_time_based_dark', '==', 'true'), |
| 127 |
), |
| 128 |
), |
| 129 |
), |
| 130 |
array( |
| 131 |
'id' => 'hide_on_desktop', |
| 132 |
'type' => 'switcher', |
| 133 |
'title' => esc_html__('Hide Dark Mode Switch On Desktop', 'darkify'), |
| 134 |
'title_help' => '<div class="darkify-info-label">' . __('Hide the Dark Mode Floating Switch if users’ are using desktop or laptop.', 'darkify') . '</div>', |
| 135 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 136 |
'text_off' => esc_html__('No', 'darkify'), |
| 137 |
), |
| 138 |
array( |
| 139 |
'id' => 'hide_on_mobile', |
| 140 |
'type' => 'fieldset', |
| 141 |
'fields' => array( |
| 142 |
array( |
| 143 |
'id' => 'hide_dark_mode_on_mobile', |
| 144 |
'type' => 'switcher', |
| 145 |
'title' => esc_html__('Hide Dark Mode On Mobile', 'darkify'), |
| 146 |
'title_help' => '<div class="darkify-info-label">' . __('Hide the Dark Mode Floating Switch if user(s) are using mobile.', 'darkify') . '</div>', |
| 147 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 148 |
'text_off' => esc_html__('No', 'darkify'), |
| 149 |
), |
| 150 |
array( |
| 151 |
'id' => 'type_of_hide_by', |
| 152 |
'type' => 'button_set', |
| 153 |
'title' => esc_html__('Hide By', 'darkify'), |
| 154 |
'title_help' => '<div class="darkify-info-label">' . __('Choose the method to detect mobile devices: by User Agent, by Screen Size, or use Both for maximum accuracy.', 'darkify') . '</div>', |
| 155 |
'options' => array( |
| 156 |
'user_agent' => esc_html__('User Agent', 'darkify'), |
| 157 |
'screen_size' => esc_html__('Screen Size', 'darkify'), |
| 158 |
'both' => esc_html__('Both', 'darkify'), |
| 159 |
), |
| 160 |
'default' => 'both', |
| 161 |
'dependency' => array('hide_dark_mode_on_mobile', '==', 'true'), |
| 162 |
), |
| 163 |
), |
| 164 |
), |
| 165 |
array( |
| 166 |
'id' => 'show_in_menu', |
| 167 |
'type' => 'fieldset', |
| 168 |
'fields' => array( |
| 169 |
array( |
| 170 |
'id' => 'enable_switch_in_menu', |
| 171 |
'type' => 'switcher', |
| 172 |
'title' => esc_html__('Show Switch In Menu', 'darkify'), |
| 173 |
'title_help' => '<div class="darkify-info-label">' . __('Show the dark mode toggle switch in specific menu.', 'darkify') . '</div>', |
| 174 |
'text_on' => esc_html__('Yes', 'darkify'), |
| 175 |
'text_off' => esc_html__('No', 'darkify'), |
| 176 |
), |
| 177 |
array( |
| 178 |
'id' => 'select_menus', |
| 179 |
'type' => 'group', |
| 180 |
'title' => esc_html__('Menu Switch Settings', 'darkify'), |
| 181 |
'title_help' => '<div class="darkify-info-label">' . __('Configure menu switch options and placement for your site.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls#menu-switcher" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/controls/" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 182 |
'accordion_title_number' => true, |
| 183 |
'accordion_title_auto' => true, |
| 184 |
'class' => 'select_menus', |
| 185 |
'max' => '1', |
| 186 |
'add_more_text' => __('Want to use switch in unlimited number of menus? <a target="_blank" href="https://darkifywp.com/pricing/?ref=1"><b>Upgrade To Pro!</b></a>', 'darkify'), |
| 187 |
'fields' => array( |
| 188 |
array( |
| 189 |
'id' => 'switch_in_menu_location', |
| 190 |
'type' => 'select', |
| 191 |
'class' => 'select_menu_location', |
| 192 |
'title' => esc_html__('Select Menu', 'darkify'), |
| 193 |
'title_help' => '<div class="darkify-info-label">' . esc_html__('Choose an option from the dropdown menu', 'darkify') . '</div>', |
| 194 |
'options' => 'menus', |
| 195 |
'empty_message' => esc_html__('You haven\'t created a menu yet. If you\'re using an FSE theme, copy the shortcode below and paste it where you want the switch to appear.', 'darkify'), |
| 196 |
), |
| 197 |
array( |
| 198 |
'id' => 'darkify_menu_shortcode_helper', |
| 199 |
'type' => 'textarea', |
| 200 |
'title' => esc_html__('Shortcode To Add On Menu', 'darkify'), |
| 201 |
'title_help' => '<div class="darkify-info-label">' . __('You can change shortcode options value based on your pereference.', 'darkify') . '</div>', |
| 202 |
'default' => '[darkify switch="1" width="60px" height="60px" icon_size="40px" light_mode_bg="#121116" dark_mode_bg="#ffffff" light_mode_color="#ffffff" dark_mode_color="#121116" border="0px" border_light_color="#121119" border_dark_color="#ffffff" border_radius="7px"]' |
| 203 |
), |
| 204 |
array( |
| 205 |
'id' => 'select_menu_position', |
| 206 |
'type' => 'button_set', |
| 207 |
'title' => esc_html__('Select Menu Position', 'darkify'), |
| 208 |
'title_help' => '<div class="darkify-info-label">' . esc_html__('Choose the position for the select menu', 'darkify') . '</div>', |
| 209 |
'options' => array( |
| 210 |
'after' => esc_html__('After', 'darkify'), |
| 211 |
'before' => esc_html__('Before', 'darkify'), |
| 212 |
), |
| 213 |
'default' => 'after', |
| 214 |
), |
| 215 |
), |
| 216 |
'dependency' => array('enable_switch_in_menu', '==', 'true'), |
| 217 |
), |
| 218 |
), |
| 219 |
), |
| 220 |
), |
| 221 |
), |
| 222 |
array( |
| 223 |
'title' => esc_html__('Admin', 'darkify'), |
| 224 |
'icon' => 'icofont-dashboard-web', |
| 225 |
'fields' => array( |
| 226 |
|
| 227 |
array( |
| 228 |
'id' => 'enable_admin_panel_dark_mode', |
| 229 |
'type' => 'switcher', |
| 230 |
'title' => esc_html__('Admin Panel Dark Mode', 'darkify'), |
| 231 |
'title_help' => '<div class="darkify-info-label">' . __('Switch to enable Dark Mode in WordPress Admin Panel.', 'darkify') . '</div><a class="tooltip_btn_primary" href="https://darkifywp.com/controls/" target="_blank">' . __('Live Demo', 'darkify') . '</a><a class="tooltip_btn_secondary" href="https://docs.themeatelier.net/docs/darkify-pro/darkify-settings/controls/#admin_controls" target="_blank">' . __('Open Docs', 'darkify') . '</a>', |
| 232 |
'default' => false, |
| 233 |
'text_on' => esc_html__('Enabled', 'darkify'), |
| 234 |
'text_off' => esc_html__('Disabled', 'darkify'), |
| 235 |
'text_width' => 100, |
| 236 |
), |
| 237 |
|
| 238 |
array( |
| 239 |
'id' => 'disallowed_admin_pages', |
| 240 |
'type' => 'textarea', |
| 241 |
'title' => esc_html__('Disallowed Pages', 'darkify'), |
| 242 |
'title_help' => '<div class="darkify-info-label">' . __('If the admin page URL is like http://example.com/wp-admin/admin.php?page=darkify then darkify is it\'s page slug.', 'darkify') . '</div>', |
| 243 |
'placeholder' => esc_html__('Enter comma separated page slugs. Example: darkify-dashboard, elementor', 'darkify'), |
| 244 |
'dependency' => array('enable_admin_panel_dark_mode', '==', 'true'), |
| 245 |
'class' => 'only_pro' |
| 246 |
), |
| 247 |
|
| 248 |
), |
| 249 |
), |
| 250 |
), |
| 251 |
), |
| 252 |
), |
| 253 |
), |
| 254 |
); |
| 255 |
} |
| 256 |
} |
| 257 |
|