| 1 |
<?php |
| 2 |
|
| 3 |
use WPCoder\Dashboard\FieldHelper; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || exit; |
| 6 |
|
| 7 |
$show = [ |
| 8 |
'general_start' => __( 'General', 'wpcoder' ), |
| 9 |
'shortcode' => __( 'Shortcode', 'wpcoder' ), |
| 10 |
'everywhere' => __( 'Everywhere', 'wpcoder' ), |
| 11 |
'general_end' => __( 'General', 'wpcoder' ), |
| 12 |
'post_start' => __( 'Posts', 'wpcoder' ), |
| 13 |
'post_all' => __( 'All posts', 'wpcoder' ), |
| 14 |
'post_selected' => __( 'Selected posts', 'wpcoder' ), |
| 15 |
'post_category' => __( 'Post category', 'wpcoder' ), |
| 16 |
'post_end' => __( 'Posts End', 'wpcoder' ), |
| 17 |
'page_start' => __( 'Pages', 'wpcoder' ), |
| 18 |
'page_all' => __( 'All pages', 'wpcoder' ), |
| 19 |
'page_selected' => __( 'Selected pages', 'wpcoder' ), |
| 20 |
'page_type' => __( 'Page type', 'wpcoder' ), |
| 21 |
'page_end' => __( 'Pages End', 'wpcoder' ), |
| 22 |
]; |
| 23 |
|
| 24 |
$post_types = get_post_types( [ 'public' => true, '_builtin' => false, ], 'objects' ); |
| 25 |
|
| 26 |
foreach ( $post_types as $key => $post_type ) { |
| 27 |
$show[ $key . '_start' ] = __( 'Custom Post:', 'wpcoder' ) . ' ' . $post_type->labels->singular_name; |
| 28 |
$show[ 'custom_post_all_' . $key ] = __( 'All', 'wpcoder' ) . ' ' . $post_type->labels->name; |
| 29 |
$show[ 'custom_post_selected_' . $key ] = __( 'Selected', 'wpcoder' ) . ' ' . $post_type->labels->name; |
| 30 |
$show[ 'custom_post_tax_' . $key ] = $post_type->labels->name . ' ' . __( 'taxonomy', 'wpcoder' ); |
| 31 |
$show[ $key . '_end' ] = __( 'Custom Post:', 'wpcoder' ) . ' ' . $post_type->labels->singular_name; |
| 32 |
|
| 33 |
} |
| 34 |
|
| 35 |
$pages_type = [ |
| 36 |
'is_front_page' => __( 'Home Page', 'wpcoder' ), |
| 37 |
'is_home' => __( 'Posts Page', 'wpcoder' ), |
| 38 |
'is_search' => __( 'Search Pages', 'wpcoder' ), |
| 39 |
'is_404' => __( '404 Pages', 'wpcoder' ), |
| 40 |
'is_archive' => __( 'Archive Page', 'wpcoder' ), |
| 41 |
]; |
| 42 |
|
| 43 |
$operator = [ |
| 44 |
'1' => 'is', |
| 45 |
'0' => 'is not', |
| 46 |
]; |
| 47 |
|
| 48 |
return [ |
| 49 |
'show' => [ |
| 50 |
'type' => 'select', |
| 51 |
'name' => '[show]', |
| 52 |
'title' => __( 'Display', 'wpcoder' ), |
| 53 |
'options' => $show, |
| 54 |
'class' => 'display-option', |
| 55 |
'default' => '', |
| 56 |
], |
| 57 |
|
| 58 |
'operator' => [ |
| 59 |
'type' => 'select', |
| 60 |
'name' => '[operator]', |
| 61 |
'title' => __( 'Is or is not', 'wpcoder' ), |
| 62 |
'options' => $operator, |
| 63 |
'class' => 'display-operator', |
| 64 |
'default' => '1', |
| 65 |
], |
| 66 |
|
| 67 |
'ids' => [ |
| 68 |
'type' => 'text', |
| 69 |
'name' => '[ids]', |
| 70 |
'title' => __( 'Enter ID\'s', 'wpcoder' ), |
| 71 |
'class' => 'display-ids', |
| 72 |
'info' => __( 'Enter IDs, separated by comma.', 'wpcoder' ), |
| 73 |
], |
| 74 |
|
| 75 |
'page_type' => [ |
| 76 |
'type' => 'select', |
| 77 |
'name' => '[page_type]', |
| 78 |
'title' => __( 'Specific page types', 'wpcoder' ), |
| 79 |
'options' => $pages_type, |
| 80 |
'class' => 'display-pages', |
| 81 |
], |
| 82 |
|
| 83 |
|
| 84 |
'is_mobile' => [ |
| 85 |
'type' => 'checkbox', |
| 86 |
'name' => '[is_mobile]', |
| 87 |
'title' => __( 'Mobile Devices', 'wpcoder' ), |
| 88 |
'text' => __( 'Disable', 'wpcoder' ), |
| 89 |
], |
| 90 |
|
| 91 |
'is_desktop' => [ |
| 92 |
'type' => 'checkbox', |
| 93 |
'name' => '[is_desktop]', |
| 94 |
'title' => __( 'Desktop Devices', 'wpcoder' ), |
| 95 |
'text' => __( 'Disable', 'wpcoder' ), |
| 96 |
], |
| 97 |
|
| 98 |
'users' => [ |
| 99 |
'type' => 'select', |
| 100 |
'name' => '[item_user]', |
| 101 |
'title' => __( 'Users', 'wpcoder' ), |
| 102 |
'options' => [ |
| 103 |
1 => __( 'All users', 'wpcoder' ), |
| 104 |
2 => __( 'Authorized Users', 'wpcoder' ), |
| 105 |
3 => __( 'Unauthorized Users', 'wpcoder' ), |
| 106 |
], |
| 107 |
], |
| 108 |
|
| 109 |
// Browsers |
| 110 |
'opera' => [ |
| 111 |
'type' => 'checkbox', |
| 112 |
'name' => '[browsers][opera]', |
| 113 |
'title' => __( 'Opera', 'wpcoder' ), |
| 114 |
'text' => __( 'Disable', 'wpcoder' ), |
| 115 |
], |
| 116 |
|
| 117 |
'edge' => [ |
| 118 |
'type' => 'checkbox', |
| 119 |
'name' => '[browsers][edge]', |
| 120 |
'title' => __( 'Microsoft Edge', 'wpcoder' ), |
| 121 |
'text' => __( 'Disable', 'wpcoder' ), |
| 122 |
], |
| 123 |
|
| 124 |
'chrome' => [ |
| 125 |
'type' => 'checkbox', |
| 126 |
'name' => '[browsers][chrome]', |
| 127 |
'title' => __( 'Chrome', 'wpcoder' ), |
| 128 |
'text' => __( 'Disable', 'wpcoder' ), |
| 129 |
], |
| 130 |
|
| 131 |
'safari' => [ |
| 132 |
'type' => 'checkbox', |
| 133 |
'name' => '[browsers][safari]', |
| 134 |
'title' => __( 'Safari', 'wpcoder' ), |
| 135 |
'text' => __( 'Disable', 'wpcoder' ), |
| 136 |
], |
| 137 |
|
| 138 |
'firefox' => [ |
| 139 |
'type' => 'checkbox', |
| 140 |
'name' => '[browsers][firefox]', |
| 141 |
'title' => __( 'Firefox', 'wpcoder' ), |
| 142 |
'text' => __( 'Disable', 'wpcoder' ), |
| 143 |
], |
| 144 |
|
| 145 |
'ie' => [ |
| 146 |
'type' => 'checkbox', |
| 147 |
'name' => '[browsers][ie]', |
| 148 |
'title' => __( 'Internet Explorer', 'wpcoder' ), |
| 149 |
'text' => __( 'Disable', 'wpcoder' ), |
| 150 |
], |
| 151 |
|
| 152 |
'other' => [ |
| 153 |
'type' => 'checkbox', |
| 154 |
'name' => '[browsers][other]', |
| 155 |
'title' => __( 'Other', 'wpcoder' ), |
| 156 |
'text' => __( 'Disable', 'wpcoder' ), |
| 157 |
], |
| 158 |
|
| 159 |
'language_on' => [ |
| 160 |
'type' => 'checkbox', |
| 161 |
'name' => '[depending_language]', |
| 162 |
'title' => __( 'Depending on the language', 'wpcoder' ), |
| 163 |
'text' => __( 'Enable', 'wpcoder' ), |
| 164 |
], |
| 165 |
|
| 166 |
// Schedule |
| 167 |
'weekday' => [ |
| 168 |
'type' => 'select', |
| 169 |
'name' => '[weekday]', |
| 170 |
'title' => __( 'Weekday', 'wpcoder' ), |
| 171 |
'options' => [ |
| 172 |
'none' => __( 'Everyday', 'wpcoder' ), |
| 173 |
'1' => __( 'Monday', 'wpcoder' ), |
| 174 |
'2' => __( 'Tuesday', 'wpcoder' ), |
| 175 |
'3' => __( 'Wednesday', 'wpcoder' ), |
| 176 |
'4' => __( 'Thursday', 'wpcoder' ), |
| 177 |
'5' => __( 'Friday', 'wpcoder' ), |
| 178 |
'6' => __( 'Saturday', 'wpcoder' ), |
| 179 |
'7' => __( 'Sunday', 'wpcoder' ), |
| 180 |
], |
| 181 |
], |
| 182 |
|
| 183 |
'time_start' => [ |
| 184 |
'type' => 'time', |
| 185 |
'name' => '[time_start]', |
| 186 |
'title' => __( 'Start time', 'wpcoder' ), |
| 187 |
], |
| 188 |
|
| 189 |
'time_end' => [ |
| 190 |
'type' => 'time', |
| 191 |
'name' => '[time_end]', |
| 192 |
'title' => __( 'End time', 'wpcoder' ), |
| 193 |
], |
| 194 |
|
| 195 |
'dates' => [ |
| 196 |
'type' => 'checkbox', |
| 197 |
'name' => '[dates]', |
| 198 |
'title' => __( 'Define Dates', 'wpcoder' ), |
| 199 |
'text' => __( 'Enable', 'wpcoder' ), |
| 200 |
'class' => 'wowp-dates', |
| 201 |
], |
| 202 |
|
| 203 |
'date_start' => [ |
| 204 |
'type' => 'date', |
| 205 |
'name' => '[date_start]', |
| 206 |
'title' => __( 'Date From', 'wpcoder' ), |
| 207 |
'class' => 'wowp-date-input', |
| 208 |
], |
| 209 |
|
| 210 |
'date_end' => [ |
| 211 |
'type' => 'date', |
| 212 |
'name' => '[date_end]', |
| 213 |
'title' => __( 'Date To', 'wpcoder' ), |
| 214 |
'class' => 'wowp-date-input', |
| 215 |
], |
| 216 |
]; |