| 1 |
<?php |
| 2 |
/** |
| 3 |
* Display options |
| 4 |
* |
| 5 |
* @package Lead_Generation |
| 6 |
* @subpackage Settings |
| 7 |
* @copyright Copyright (c) 2018, Dmytro Lobov |
| 8 |
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 9 |
* @since 1.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
if ( ! defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
// Enable Don’t show on screens more than |
| 17 |
$include_more_screen = array( |
| 18 |
'id' => 'include_more_screen', |
| 19 |
'name' => 'param[include_more_screen]', |
| 20 |
'type' => 'checkbox', |
| 21 |
'val' => isset( $param['include_more_screen'] ) ? $param['include_more_screen'] : 0, |
| 22 |
'func' => 'screen_more(this);', |
| 23 |
); |
| 24 |
|
| 25 |
// Show on screens helper |
| 26 |
$show_screen_help = array( |
| 27 |
'text' => esc_attr__( 'Specify the window breakpoint in px when the button will be shown.', $this->plugin['text'] ), |
| 28 |
); |
| 29 |
|
| 30 |
// Max screen value |
| 31 |
$screen_more = array( |
| 32 |
'id' => 'screenmore', |
| 33 |
'name' => 'param[screen_more]', |
| 34 |
'type' => 'number', |
| 35 |
'val' => isset( $param['screen_more'] ) ? $param['screen_more'] : 1024, |
| 36 |
'option' => array( |
| 37 |
'min' => '0', |
| 38 |
'max' => '3000', |
| 39 |
'step' => '1', |
| 40 |
'placeholder' => '1024', |
| 41 |
), |
| 42 |
); |
| 43 |
|
| 44 |
// Enable Don’t show on screens less than |
| 45 |
$include_mobile = array( |
| 46 |
'id' => 'include_mobile', |
| 47 |
'name' => 'param[include_mobile]', |
| 48 |
'type' => 'checkbox', |
| 49 |
'val' => isset( $param['include_mobile'] ) ? $param['include_mobile'] : 0, |
| 50 |
'func' => 'screen_less(this);', |
| 51 |
); |
| 52 |
|
| 53 |
// Enable Don’t show on screens less than helper |
| 54 |
$include_mobile_help = array( |
| 55 |
'text' => esc_attr__( 'Specify the window breakpoint ( mix width) in px.', $this->plugin['text'] ), |
| 56 |
); |
| 57 |
|
| 58 |
// Min screen value |
| 59 |
$screen = array( |
| 60 |
'id' => 'screen', |
| 61 |
'name' => 'param[screen]', |
| 62 |
'type' => 'number', |
| 63 |
'val' => isset( $param['screen'] ) ? $param['screen'] : 480, |
| 64 |
'option' => array( |
| 65 |
'min' => '0', |
| 66 |
'max' => '3000', |
| 67 |
'step' => '1', |
| 68 |
'placeholder' => '480', |
| 69 |
), |
| 70 |
); |
| 71 |
|
| 72 |
// Show for users |
| 73 |
$item_user = array( |
| 74 |
'id' => 'item_user', |
| 75 |
'name' => 'param[item_user]', |
| 76 |
'type' => 'select', |
| 77 |
'class' => 'item_user', |
| 78 |
'val' => isset( $param['item_user'] ) ? $param['item_user'] : '1', |
| 79 |
'option' => array( |
| 80 |
'1' => esc_attr__( 'All Users', $this->plugin['text'] ), |
| 81 |
'2' => esc_attr__( 'Authorized Users', $this->plugin['text'] ), |
| 82 |
'3' => esc_attr__( 'Unauthorized Users', $this->plugin['text'] ), |
| 83 |
), |
| 84 |
'sep' => 'br', |
| 85 |
'func' => 'usersroles(this);', |
| 86 |
); |
| 87 |
|
| 88 |
|
| 89 |
// Users role |
| 90 |
$add_users = array( 'all' => array( 'name' => esc_attr__( 'All Users', $this->plugin['text'] ) ) ); |
| 91 |
$editable_role = array_reverse( get_editable_roles() ); |
| 92 |
$editable_roles = array_merge( $add_users, $editable_role ); |
| 93 |
$users_arr = array(); |
| 94 |
foreach ( $editable_roles as $role => $details ) { |
| 95 |
$name = translate_user_role( $details['name'] ); |
| 96 |
$users_arr[ esc_attr( $role ) ] = $name; |
| 97 |
} |
| 98 |
|
| 99 |
$user_role = array( |
| 100 |
'id' => 'users_roles', |
| 101 |
'name' => 'param[user_role]', |
| 102 |
'type' => 'select', |
| 103 |
'val' => isset( $param['user_role'] ) ? $param['user_role'] : 'all', |
| 104 |
'option' => $users_arr, |
| 105 |
); |
| 106 |
|
| 107 |
// Enable Depending on the language |
| 108 |
$depending_language = array( |
| 109 |
'id' => 'depending_language', |
| 110 |
'name' => 'param[depending_language]', |
| 111 |
'type' => 'checkbox', |
| 112 |
'val' => isset( $param['depending_language'] ) ? $param['depending_language'] : 0, |
| 113 |
'func' => 'languages(this);', |
| 114 |
); |
| 115 |
|
| 116 |
$languages = array( |
| 117 |
'af' => 'Afrikaans', |
| 118 |
'ar' => 'العربية', |
| 119 |
'ary' => 'العربية ال� |
| 120 |
غربية', |
| 121 |
'as' => '� |
| 122 |
সমীয়া', |
| 123 |
'az' => 'Azərbaycan dili', |
| 124 |
'azb' => 'گؤنئی آذربایجان', |
| 125 |
'bel' => 'Беларуская мова', |
| 126 |
'bg_BG' => 'Български', |
| 127 |
'bn_BD' => 'বাংলা', |
| 128 |
'bo' => 'བོད་ཡིག', |
| 129 |
'bs_BA' => 'Bosanski', |
| 130 |
'ca' => 'Català', |
| 131 |
'ceb' => 'Cebuano', |
| 132 |
'cs_CZ' => 'Čeština', |
| 133 |
'cy' => 'Cymraeg', |
| 134 |
'da_DK' => 'Dansk', |
| 135 |
'de_DE' => 'Deutsch', |
| 136 |
'de_CH_informal' => 'Deutsch (Schweiz, Du)', |
| 137 |
'de_CH' => 'Deutsch (Schweiz)', |
| 138 |
'de_DE_formal' => 'Deutsch (Sie)', |
| 139 |
'de_AT' => 'Deutsch (Österreich)', |
| 140 |
'dzo' => 'རྫོང་ཁ', |
| 141 |
'el' => 'Ελληνικά', |
| 142 |
'en_US' => 'English (United States)', |
| 143 |
'en_GB' => 'English (UK)', |
| 144 |
'en_AU' => 'English (Australia)', |
| 145 |
'en_NZ' => 'English (New Zealand)', |
| 146 |
'en_CA' => 'English (Canada)', |
| 147 |
'en_ZA' => 'English (South Africa)', |
| 148 |
'eo' => 'Esperanto', |
| 149 |
'es_ES' => 'Español', |
| 150 |
'es_VE' => 'Español de Venezuela', |
| 151 |
'es_GT' => 'Español de Guatemala', |
| 152 |
'es_CR' => 'Español de Costa Rica', |
| 153 |
'es_MX' => 'Español de México', |
| 154 |
'es_CO' => 'Español de Colombia', |
| 155 |
'es_PE' => 'Español de Perú', |
| 156 |
'es_CL' => 'Español de Chile', |
| 157 |
'es_AR' => 'Español de Argentina', |
| 158 |
'et' => 'Eesti', |
| 159 |
'eu' => 'Euskara', |
| 160 |
'fa_IR' => 'فارسی', |
| 161 |
'fi' => 'Suomi', |
| 162 |
'fr_FR' => 'Français', |
| 163 |
'fr_CA' => 'Français du Canada', |
| 164 |
'fr_BE' => 'Français de Belgique', |
| 165 |
'fur' => 'Friulian', |
| 166 |
'gd' => 'Gàidhlig', |
| 167 |
'gl_ES' => 'Galego', |
| 168 |
'gu' => 'ગુજરાતી', |
| 169 |
'haz' => 'هزاره گی', |
| 170 |
'he_IL' => 'עִבְרִית', |
| 171 |
'hi_IN' => 'हिन्दी', |
| 172 |
'hr' => 'Hrvatski', |
| 173 |
'hu_HU' => 'Magyar', |
| 174 |
'hy' => 'Հայերեն', |
| 175 |
'id_ID' => 'Bahasa Indonesia', |
| 176 |
'is_IS' => 'Íslenska', |
| 177 |
'it_IT' => 'Italiano', |
| 178 |
'ja' => '日本語', |
| 179 |
'jv_ID' => 'Basa Jawa', |
| 180 |
'ka_GE' => 'ქართული', |
| 181 |
'kab' => 'Taqbaylit', |
| 182 |
'kk' => 'Қазақ тілі', |
| 183 |
'km' => 'ភាសាខ្មែរ', |
| 184 |
'kn' => 'ಕನ್ನಡ', |
| 185 |
'ko_KR' => '한국어', |
| 186 |
'ckb' => 'كوردی', |
| 187 |
'lo' => 'ພາສາລາວ', |
| 188 |
'lt_LT' => 'Lietuvių kalba', |
| 189 |
'lv' => 'Latviešu valoda', |
| 190 |
'mk_MK' => 'Македонски јазик', |
| 191 |
'ml_IN' => 'മലയാളം', |
| 192 |
'mn' => 'Монгол', |
| 193 |
'mr' => 'मराठी', |
| 194 |
'ms_MY' => 'Bahasa Melayu', |
| 195 |
'my_MM' => 'ဗမာ� |
| 196 |
ာ', |
| 197 |
'nb_NO' => 'Norsk bokmål', |
| 198 |
'ne_NP' => 'नेपाली', |
| 199 |
'nl_NL' => 'Nederlands', |
| 200 |
'nl_NL_formal' => 'Nederlands (Formeel)', |
| 201 |
'nl_BE' => 'Nederlands (België)', |
| 202 |
'nn_NO' => 'Norsk nynorsk', |
| 203 |
'oci' => 'Occitan', |
| 204 |
'pa_IN' => 'ਪੰਜਾਬੀ', |
| 205 |
'pl_PL' => 'Polski', |
| 206 |
'ps' => 'پښتو', |
| 207 |
'pt_PT' => 'Português', |
| 208 |
'pt_AO' => 'Português de Angola', |
| 209 |
'pt_PT_ao90' => 'Português (AO90)', |
| 210 |
'pt_BR' => 'Português do Brasil', |
| 211 |
'rhg' => 'Ruáinga', |
| 212 |
'ro_RO' => 'Română', |
| 213 |
'ru_RU' => 'Русский', |
| 214 |
'sah' => 'Са� |
| 215 |
алыы', |
| 216 |
'si_LK' => 'සිංහල', |
| 217 |
'sk_SK' => 'Slovenčina', |
| 218 |
'skr' => 'سرائیکی', |
| 219 |
'sl_SI' => 'Slovenščina', |
| 220 |
'sq' => 'Shqip', |
| 221 |
'sr_RS' => 'Српски језик', |
| 222 |
'sv_SE' => 'Svenska', |
| 223 |
'szl' => 'Ślōnskŏ gŏdka', |
| 224 |
'ta_IN' => 'தமிழ்', |
| 225 |
'te' => 'తెలుగు', |
| 226 |
'th' => 'ไทย', |
| 227 |
'tl' => 'Tagalog', |
| 228 |
'tr_TR' => 'Türkçe', |
| 229 |
'tt_RU' => 'Татар теле', |
| 230 |
'tah' => 'Reo Tahiti', |
| 231 |
'ug_CN' => 'ئۇيغۇرچە', |
| 232 |
'uk' => 'Українська', |
| 233 |
'ur' => 'اردو', |
| 234 |
'uz_UZ' => 'O‘zbekcha', |
| 235 |
'vi' => 'Tiếng Việt', |
| 236 |
'zh_CN' => '简体中文', |
| 237 |
'zh_TW' => '繁體中文', |
| 238 |
'zh_HK' => '香港中文版', |
| 239 |
); |
| 240 |
|
| 241 |
$default_lang = 'en_US'; |
| 242 |
|
| 243 |
if ( isset( $param['lang'] ) && ! isset( $param['language'] ) ) { |
| 244 |
$old_lang = $param['lang']; |
| 245 |
if ( $old_lang !== 'all' ) { |
| 246 |
foreach ( $languages as $key => $val ) { |
| 247 |
$pos = strpos( $key, $old_lang ); |
| 248 |
if ( $pos !== false ) { |
| 249 |
$default_lang = $key; |
| 250 |
break; |
| 251 |
} |
| 252 |
} |
| 253 |
} |
| 254 |
|
| 255 |
} |
| 256 |
|
| 257 |
// Languages |
| 258 |
$language = array( |
| 259 |
'id' => 'language', |
| 260 |
'name' => 'param[language]', |
| 261 |
'type' => 'select', |
| 262 |
'val' => isset( $param['language'] ) ? $param['language'] : $default_lang, |
| 263 |
'option' => $languages, |
| 264 |
); |
| 265 |
|
| 266 |
// Disable FontAwesome on front-end of the site |
| 267 |
$disable_fontawesome = array( |
| 268 |
'id' => 'disable_fontawesome', |
| 269 |
'name' => 'param[disable_fontawesome]', |
| 270 |
'type' => 'checkbox', |
| 271 |
'val' => isset( $param['disable_fontawesome'] ) ? $param['disable_fontawesome'] : 0, |
| 272 |
); |
| 273 |
|
| 274 |
$disable_fontawesome_help = array( |
| 275 |
'title' => esc_attr__( 'Disable Font Awesome 5 style on front-end of the site.', $this->plugin['text'] ), |
| 276 |
'ul' => array( |
| 277 |
__( 'If you already have a Font Awesome 5 installed on the site, you can disable the include the Font Awesome 5 style.', |
| 278 |
$this->plugin['text'] ), |
| 279 |
), |
| 280 |
); |
| 281 |
|
| 282 |
// Mobile rules Enable |
| 283 |
$mobile_rules = array( |
| 284 |
'name' => 'param[mobile_rules]', |
| 285 |
'id' => 'mobile_rules', |
| 286 |
'class' => '', |
| 287 |
'type' => 'checkbox', |
| 288 |
'val' => isset( $param['mobile_rules'] ) ? $param['mobile_rules'] : 0, |
| 289 |
'func' => 'mobileRules(this);', |
| 290 |
'sep' => '', |
| 291 |
); |
| 292 |
|
| 293 |
$mobile_rules_help = array( |
| 294 |
'title' => esc_attr__( 'Enable mobile rules for menu. Defines menu behavior on mobile devices:', $this->plugin['text'] ), |
| 295 |
'ul' => array( |
| 296 |
__( 'First click opens the label', $this->plugin['text'] ), |
| 297 |
__( 'Second click calls the link AND closes the label', $this->plugin['text'] ), |
| 298 |
__( 'Hide label after 3 sec, if it open', $this->plugin['text'] ), |
| 299 |
), |
| 300 |
); |
| 301 |
|
| 302 |
// Screen for mobile rules |
| 303 |
$mobile_screen = array( |
| 304 |
'name' => 'param[mobile_screen]', |
| 305 |
'id' => 'mobile_screen', |
| 306 |
'type' => 'number', |
| 307 |
'val' => isset( $param['mobile_screen'] ) ? $param['mobile_screen'] : '768', |
| 308 |
'option' => array( |
| 309 |
'step' => '1', |
| 310 |
'placeholder' => '768', |
| 311 |
), |
| 312 |
); |
| 313 |
|
| 314 |
$mobile_screen_help = array( |
| 315 |
'text' => esc_attr__( 'Set the screen width for mobile devices when mobile rules are applied.', $this->plugin['text'] ), |
| 316 |
); |
| 317 |
|
| 318 |
//region Schedule |
| 319 |
$weekday = array( |
| 320 |
'name' => 'param[weekday]', |
| 321 |
'id' => 'weekday', |
| 322 |
'type' => 'select', |
| 323 |
'val' => isset( $param['weekday'] ) ? $param['weekday'] : 'none', |
| 324 |
'option' => [ |
| 325 |
'none' => esc_attr__( 'Everyday', $this->plugin['text'] ), |
| 326 |
'1' => esc_attr__( 'Monday', $this->plugin['text'] ), |
| 327 |
'2' => esc_attr__( 'Tuesday', $this->plugin['text'] ), |
| 328 |
'3' => esc_attr__( 'Wednesday', $this->plugin['text'] ), |
| 329 |
'4' => esc_attr__( 'Thursday', $this->plugin['text'] ), |
| 330 |
'5' => esc_attr__( 'Friday', $this->plugin['text'] ), |
| 331 |
'6' => esc_attr__( 'Saturday', $this->plugin['text'] ), |
| 332 |
'7' => esc_attr__( 'Sunday ', $this->plugin['text'] ), |
| 333 |
|
| 334 |
], |
| 335 |
'tooltip' => esc_attr__( 'Select the day of the week when the notification will be displayed.', $this->plugin['text'] ), |
| 336 |
'icon' => '', |
| 337 |
'func' => '', |
| 338 |
); |
| 339 |
|
| 340 |
$weekday_help = array( |
| 341 |
'text' => esc_attr__( 'Select the day of the week when the menu will be displayed.', $this->plugin['text'] ), |
| 342 |
); |
| 343 |
|
| 344 |
$time_start = array( |
| 345 |
'name' => 'param[time_start]', |
| 346 |
'id' => 'time_start', |
| 347 |
'type' => 'time', |
| 348 |
'val' => isset( $param['time_start'] ) ? $param['time_start'] : '00:00', |
| 349 |
); |
| 350 |
|
| 351 |
$time_start_help = array( |
| 352 |
'text' => esc_attr__( 'Specify what from time of the day to show the menu', $this->plugin['text'] ), |
| 353 |
); |
| 354 |
|
| 355 |
$time_end = array( |
| 356 |
'name' => 'param[time_end]', |
| 357 |
'id' => 'time_end', |
| 358 |
'val' => isset( $param['time_end'] ) ? $param['time_end'] : '23:59', |
| 359 |
'type' => 'time', |
| 360 |
); |
| 361 |
|
| 362 |
$time_end_help = array( |
| 363 |
'text' => esc_attr__( 'Specify what to time of the day to show the menu', $this->plugin['text'] ), |
| 364 |
); |
| 365 |
|
| 366 |
$set_dates = array( |
| 367 |
'name' => 'param[set_dates]', |
| 368 |
'id' => 'set_dates', |
| 369 |
'val' => isset( $param['set_dates'] ) ? $param['set_dates'] : '', |
| 370 |
'type' => 'checkbox', |
| 371 |
); |
| 372 |
|
| 373 |
$set_dates_help = array( |
| 374 |
'text' => esc_attr__( 'Check this if you want to set the show menu between dates.', $this->plugin['text'] ), |
| 375 |
); |
| 376 |
|
| 377 |
$date_start = array( |
| 378 |
'name' => 'param[date_start]', |
| 379 |
'id' => 'date_start', |
| 380 |
'val' => isset( $param['date_start'] ) ? $param['date_start'] : '', |
| 381 |
'type' => 'time', |
| 382 |
); |
| 383 |
|
| 384 |
$date_start_help = array( |
| 385 |
'text' => esc_attr__( 'Set the date start.', $this->plugin['text'] ), |
| 386 |
); |
| 387 |
|
| 388 |
$date_end = array( |
| 389 |
'name' => 'param[date_end]', |
| 390 |
'id' => 'date_end', |
| 391 |
'val' => isset( $param['date_end'] ) ? $param['date_end'] : '', |
| 392 |
'type' => 'time', |
| 393 |
); |
| 394 |
|
| 395 |
$date_start_help = array( |
| 396 |
'text' => esc_attr__( 'Set the date end.', $this->plugin['text'] ), |
| 397 |
); |
| 398 |
|
| 399 |
//endregion |
| 400 |
|
| 401 |
//region Browser |
| 402 |
|
| 403 |
$all_browser = array( |
| 404 |
'name' => 'param[all_browser]', |
| 405 |
'id' => 'all_browser', |
| 406 |
'val' => isset( $param['all_browser'] ) ? $param['all_browser'] : '0', |
| 407 |
'type' => 'checkbox' |
| 408 |
); |
| 409 |
|
| 410 |
$br_opera = array( |
| 411 |
'name' => 'param[br_opera]', |
| 412 |
'id' => 'br_opera', |
| 413 |
'val' => isset( $param['br_opera'] ) ? $param['br_opera'] : '0', |
| 414 |
'type' => 'checkbox' |
| 415 |
); |
| 416 |
|
| 417 |
$br_edge = array( |
| 418 |
'name' => 'param[br_edge]', |
| 419 |
'id' => 'br_edge', |
| 420 |
'val' => isset( $param['br_edge'] ) ? $param['br_edge'] : '0', |
| 421 |
'class' => 'browser', |
| 422 |
'type' => 'checkbox' |
| 423 |
); |
| 424 |
|
| 425 |
$br_chrome = array( |
| 426 |
'name' => 'param[br_chrome]', |
| 427 |
'id' => 'br_chrome', |
| 428 |
'val' => isset( $param['br_chrome'] ) ? $param['br_chrome'] : '0', |
| 429 |
'class' => 'browser', |
| 430 |
'type' => 'checkbox' |
| 431 |
); |
| 432 |
|
| 433 |
$br_safari = array( |
| 434 |
'name' => 'param[br_safari]', |
| 435 |
'id' => 'br_safari', |
| 436 |
'val' => isset( $param['br_safari'] ) ? $param['br_safari'] : '0', |
| 437 |
'class' => 'browser', |
| 438 |
'type' => 'checkbox' |
| 439 |
); |
| 440 |
|
| 441 |
$br_firefox = array( |
| 442 |
'name' => 'param[br_firefox]', |
| 443 |
'id' => 'br_firefox', |
| 444 |
'val' => isset( $param['br_firefox'] ) ? $param['br_firefox'] : '0', |
| 445 |
'class' => 'browser', |
| 446 |
'type' => 'checkbox' |
| 447 |
|
| 448 |
); |
| 449 |
|
| 450 |
$br_ie = array( |
| 451 |
'name' => 'param[br_ie]', |
| 452 |
'id' => 'br_ie', |
| 453 |
'val' => isset( $param['br_ie'] ) ? $param['br_ie'] : '0', |
| 454 |
'class' => 'browser', |
| 455 |
'type' => 'checkbox' |
| 456 |
); |
| 457 |
|
| 458 |
$br_other = array( |
| 459 |
'name' => 'param[br_other]', |
| 460 |
'id' => 'br_other', |
| 461 |
'val' => isset( $param['br_other'] ) ? $param['br_other'] : '0', |
| 462 |
'type' => 'checkbox' |
| 463 |
); |
| 464 |
|
| 465 |
//endregion |