| 1 |
<?php |
| 2 |
|
| 3 |
use FloatingButton\Dashboard\Field; |
| 4 |
use FloatingButton\Dashboard\FieldHelper; |
| 5 |
|
| 6 |
defined( 'ABSPATH' ) || exit; |
| 7 |
|
| 8 |
$default = Field::getDefault(); |
| 9 |
|
| 10 |
$show = [ |
| 11 |
'general_start' => __( 'General', 'floating-button' ), |
| 12 |
'everywhere' => __( 'Everywhere', 'floating-button' ), |
| 13 |
'shortcode' => __( 'Shortcode', 'floating-button' ), |
| 14 |
'general_end' => __( 'General', 'floating-button' ), |
| 15 |
]; |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
$pages_type = [ |
| 20 |
'is_front_page' => __( 'Home Page', 'floating-button' ), |
| 21 |
'is_home' => __( 'Posts Page', 'floating-button' ), |
| 22 |
'is_search' => __( 'Search Pages', 'floating-button' ), |
| 23 |
'is_404' => __( '404 Pages', 'floating-button' ), |
| 24 |
'is_archive' => __( 'Archive Page', 'floating-button' ), |
| 25 |
]; |
| 26 |
|
| 27 |
$operator = [ |
| 28 |
'1' => 'is', |
| 29 |
'0' => 'is not', |
| 30 |
]; |
| 31 |
|
| 32 |
$weekdays = [ |
| 33 |
'none' => __( 'Everyday', 'floating-button' ), |
| 34 |
'1' => __( 'Monday', 'floating-button' ), |
| 35 |
'2' => __( 'Tuesday', 'floating-button' ), |
| 36 |
'3' => __( 'Wednesday', 'floating-button' ), |
| 37 |
'4' => __( 'Thursday', 'floating-button' ), |
| 38 |
'5' => __( 'Friday', 'floating-button' ), |
| 39 |
'6' => __( 'Saturday', 'floating-button' ), |
| 40 |
'7' => __( 'Sunday', 'floating-button' ), |
| 41 |
]; |
| 42 |
|
| 43 |
return [ |
| 44 |
'show' => [ |
| 45 |
'type' => 'select', |
| 46 |
'name' => '[show]', |
| 47 |
'title' => __( 'Display', 'floating-button' ), |
| 48 |
'options' => $show, |
| 49 |
'class' => 'display-option', |
| 50 |
'default' => '', |
| 51 |
], |
| 52 |
|
| 53 |
'operator' => [ |
| 54 |
'type' => 'select', |
| 55 |
'name' => '[operator]', |
| 56 |
'title' => __( 'Is or is not', 'floating-button' ), |
| 57 |
'options' => $operator, |
| 58 |
'class' => 'display-operator', |
| 59 |
'default' => '1', |
| 60 |
], |
| 61 |
|
| 62 |
'ids' => [ |
| 63 |
'type' => 'text', |
| 64 |
'name' => '[ids]', |
| 65 |
'title' => __( 'Enter ID\'s', 'floating-button' ), |
| 66 |
'class' => 'display-ids', |
| 67 |
'info' => __( 'Enter IDs, separated by comma.', 'floating-button' ), |
| 68 |
], |
| 69 |
|
| 70 |
'page_type' => [ |
| 71 |
'type' => 'select', |
| 72 |
'name' => '[page_type]', |
| 73 |
'title' => __( 'Specific page types', 'floating-button' ), |
| 74 |
'options' => $pages_type, |
| 75 |
'class' => 'display-pages', |
| 76 |
], |
| 77 |
|
| 78 |
// Devices Rules |
| 79 |
'is_desktop' => [ |
| 80 |
'type' => 'checkbox', |
| 81 |
'name' => '[include_more_screen]', |
| 82 |
'title' => __( 'Don\'t show on screens more', 'floating-button' ), |
| 83 |
'text' => __( 'Enable', 'floating-button' ), |
| 84 |
], |
| 85 |
|
| 86 |
'desktop_screen' => [ |
| 87 |
'type' => 'number', |
| 88 |
'name' => '[screen_more]', |
| 89 |
'title' => __( 'Screen width', 'floating-button' ), |
| 90 |
'class' => 'has-addon-right has-background', |
| 91 |
'addon' => 'px', |
| 92 |
'default' => 1024 |
| 93 |
], |
| 94 |
|
| 95 |
'is_mobile' => [ |
| 96 |
'type' => 'checkbox', |
| 97 |
'name' => '[include_mobile]', |
| 98 |
'title' => __( 'Don\'t show on screens more', 'floating-button' ), |
| 99 |
'text' => __( 'Enable', 'floating-button' ), |
| 100 |
], |
| 101 |
|
| 102 |
'mobile_screen' => [ |
| 103 |
'type' => 'number', |
| 104 |
'name' => '[screen]', |
| 105 |
'title' => __( 'Screen width', 'floating-button' ), |
| 106 |
'class' => 'has-addon-right has-background', |
| 107 |
'addon' => 'px', |
| 108 |
'default' => 480 |
| 109 |
], |
| 110 |
|
| 111 |
// Users |
| 112 |
|
| 113 |
'users' => [ |
| 114 |
'type' => 'select', |
| 115 |
'name' => '[item_user]', |
| 116 |
'title' => __( 'Users', 'floating-button' ), |
| 117 |
'options' => [ |
| 118 |
1 => __( 'All users', 'floating-button' ), |
| 119 |
2 => __( 'Authorized Users', 'floating-button' ), |
| 120 |
3 => __( 'Unauthorized Users', 'floating-button' ), |
| 121 |
], |
| 122 |
], |
| 123 |
|
| 124 |
// Browsers |
| 125 |
'opera' => [ |
| 126 |
'type' => 'checkbox', |
| 127 |
'name' => '[browsers][opera]', |
| 128 |
'title' => __( 'Opera', 'floating-button' ), |
| 129 |
'text' => __( 'Disable', 'floating-button' ), |
| 130 |
], |
| 131 |
|
| 132 |
'edge' => [ |
| 133 |
'type' => 'checkbox', |
| 134 |
'name' => '[browsers][edge]', |
| 135 |
'title' => __( 'Microsoft Edge', 'floating-button' ), |
| 136 |
'text' => __( 'Disable', 'floating-button' ), |
| 137 |
], |
| 138 |
|
| 139 |
'chrome' => [ |
| 140 |
'type' => 'checkbox', |
| 141 |
'name' => '[browsers][chrome]', |
| 142 |
'title' => __( 'Chrome', 'floating-button' ), |
| 143 |
'text' => __( 'Disable', 'floating-button' ), |
| 144 |
], |
| 145 |
|
| 146 |
'safari' => [ |
| 147 |
'type' => 'checkbox', |
| 148 |
'name' => '[browsers][safari]', |
| 149 |
'title' => __( 'Safari', 'floating-button' ), |
| 150 |
'text' => __( 'Disable', 'floating-button' ), |
| 151 |
], |
| 152 |
|
| 153 |
'firefox' => [ |
| 154 |
'type' => 'checkbox', |
| 155 |
'name' => '[browsers][firefox]', |
| 156 |
'title' => __( 'Firefox', 'floating-button' ), |
| 157 |
'text' => __( 'Disable', 'floating-button' ), |
| 158 |
], |
| 159 |
|
| 160 |
'ie' => [ |
| 161 |
'type' => 'checkbox', |
| 162 |
'name' => '[browsers][ie]', |
| 163 |
'title' => __( 'Internet Explorer', 'floating-button' ), |
| 164 |
'text' => __( 'Disable', 'floating-button' ), |
| 165 |
], |
| 166 |
|
| 167 |
'other' => [ |
| 168 |
'type' => 'checkbox', |
| 169 |
'name' => '[browsers][other]', |
| 170 |
'title' => __( 'Other', 'floating-button' ), |
| 171 |
'text' => __( 'Disable', 'floating-button' ), |
| 172 |
], |
| 173 |
|
| 174 |
// Schedule |
| 175 |
'weekday' => [ |
| 176 |
'type' => 'select', |
| 177 |
'name' => '[weekday]', |
| 178 |
'title' => __( 'Weekday', 'floating-button' ), |
| 179 |
'options' => $weekdays, |
| 180 |
], |
| 181 |
|
| 182 |
'time_start' => [ |
| 183 |
'type' => 'time', |
| 184 |
'name' => '[time_start]', |
| 185 |
'title' => __( 'Start time', 'floating-button' ), |
| 186 |
], |
| 187 |
|
| 188 |
'time_end' => [ |
| 189 |
'type' => 'time', |
| 190 |
'name' => '[time_end]', |
| 191 |
'title' => __( 'End time', 'floating-button' ), |
| 192 |
], |
| 193 |
|
| 194 |
'dates' => [ |
| 195 |
'type' => 'checkbox', |
| 196 |
'name' => '[dates]', |
| 197 |
'title' => __( 'Define Dates', 'floating-button' ), |
| 198 |
'text' => __( 'Enable', 'floating-button' ), |
| 199 |
'class' => 'wowp-dates', |
| 200 |
], |
| 201 |
|
| 202 |
'date_start' => [ |
| 203 |
'type' => 'date', |
| 204 |
'name' => '[date_start]', |
| 205 |
'title' => __( 'Date From', 'floating-button' ), |
| 206 |
'class' => 'wowp-date-input', |
| 207 |
], |
| 208 |
|
| 209 |
'date_end' => [ |
| 210 |
'type' => 'date', |
| 211 |
'name' => '[date_end]', |
| 212 |
'title' => __( 'Date To', 'floating-button' ), |
| 213 |
'class' => 'wowp-date-input', |
| 214 |
], |
| 215 |
|
| 216 |
// Other |
| 217 |
'language_on' => [ |
| 218 |
'type' => 'checkbox', |
| 219 |
'name' => '[depending_language]', |
| 220 |
'title' => __( 'Depending on the language', 'floating-button' ), |
| 221 |
'text' => __( 'Enable', 'floating-button' ), |
| 222 |
], |
| 223 |
|
| 224 |
'language' => [ |
| 225 |
'type' => 'select', |
| 226 |
'name' => '[lang]', |
| 227 |
'title' => __( 'Language', 'floating-button' ), |
| 228 |
'options' => FieldHelper::languages(), |
| 229 |
], |
| 230 |
|
| 231 |
'fontawesome' => [ |
| 232 |
'type' => 'checkbox', |
| 233 |
'name' => '[disable_fontawesome]', |
| 234 |
'title' => __( 'Font Awesome', 'floating-button' ), |
| 235 |
'text' => __( 'Disable', 'floating-button' ), |
| 236 |
], |
| 237 |
|
| 238 |
]; |