| 1 |
<?php |
| 2 |
/** |
| 3 |
* The Carousel section Meta-box configurations. |
| 4 |
* |
| 5 |
* @package Smart_Post_Show |
| 6 |
* @subpackage Smart_Post_Show/admin |
| 7 |
*/ |
| 8 |
|
| 9 |
if ( ! defined( 'ABSPATH' ) ) { |
| 10 |
die; |
| 11 |
} // Cannot access pages directly. |
| 12 |
|
| 13 |
/** |
| 14 |
* The Carousel building class. |
| 15 |
*/ |
| 16 |
class SPS_Carousel { |
| 17 |
|
| 18 |
/** |
| 19 |
* Carousel section metabox. |
| 20 |
* |
| 21 |
* @param string $prefix The metabox key. |
| 22 |
* @return void |
| 23 |
*/ |
| 24 |
public static function section( $prefix ) { |
| 25 |
SP_PC::createSection( |
| 26 |
$prefix, |
| 27 |
array( |
| 28 |
'title' => __( 'Carousel Settings', 'post-carousel' ), |
| 29 |
'icon' => 'sps-icon-carousel-settings', |
| 30 |
'fields' => array( |
| 31 |
array( |
| 32 |
'type' => 'tabbed', |
| 33 |
'class' => 'pcp-carousel-tabs', |
| 34 |
'tabs' => array( |
| 35 |
array( |
| 36 |
'title' => __( 'Carousel Controls', 'post-carousel' ), |
| 37 |
'icon' => '<i class="sps-icon-carousel-basic" aria-hidden="true"></i>', |
| 38 |
'fields' => array( |
| 39 |
array( |
| 40 |
'id' => 'pcp_carousel_direction', |
| 41 |
'type' => 'button_set', |
| 42 |
'title' => __( 'Carousel Direction', 'post-carousel' ), |
| 43 |
'subtitle' => __( 'Choose a carousel direction.', 'post-carousel' ), |
| 44 |
'options' => array( |
| 45 |
'ltr' => __( 'Right to Left', 'post-carousel' ), |
| 46 |
'rtl' => __( 'Left to Right', 'post-carousel' ), |
| 47 |
), |
| 48 |
'default' => 'ltr', |
| 49 |
), |
| 50 |
array( |
| 51 |
'id' => 'pcp_autoplay', |
| 52 |
'type' => 'switcher', |
| 53 |
'title' => __( 'AutoPlay', 'post-carousel' ), |
| 54 |
'subtitle' => __( 'Enable/Disable carousel autoplay.', 'post-carousel' ), |
| 55 |
'default' => true, |
| 56 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 57 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 58 |
'text_width' => 100, |
| 59 |
), |
| 60 |
array( |
| 61 |
'id' => 'pcp_autoplay_speed', |
| 62 |
'type' => 'slider', |
| 63 |
'title' => __( 'AutoPlay Delay', 'post-carousel' ), |
| 64 |
'subtitle' => __( 'Set autoplay delay time in millisecond.', 'post-carousel' ), |
| 65 |
'default' => 2000, |
| 66 |
'sanitize' => 'spf_pcp_sanitize_number_field', |
| 67 |
'min' => 0, |
| 68 |
'max' => 10000, |
| 69 |
'step' => 100, |
| 70 |
'unit' => 'ms', |
| 71 |
'title_info' => '<div class="spf-info-label">' . __( 'AutoPlay Delay Time', 'post-carousel' ) . '</div> <div class="spf-short-content">' . __( 'Set autoplay delay or interval time. The amount of time to delay between automatically cycling a member. e.g. 1000 milliseconds(ms) = 1 second.', 'post-carousel' ) . '</div>', |
| 72 |
'dependency' => array( 'pcp_autoplay', '==', true ), |
| 73 |
), |
| 74 |
array( |
| 75 |
'id' => 'pcp_carousel_speed', |
| 76 |
'type' => 'slider', |
| 77 |
'title' => __( 'Carousel Speed', 'post-carousel' ), |
| 78 |
'subtitle' => __( 'Set carousel speed in millisecond.', 'post-carousel' ), |
| 79 |
'sanitize' => 'spf_pcp_sanitize_number_field', |
| 80 |
'class' => 'carousel_auto_play_ranger', |
| 81 |
'default' => 600, |
| 82 |
'min' => 0, |
| 83 |
'max' => 20000, |
| 84 |
'step' => 100, |
| 85 |
'unit' => 'ms', |
| 86 |
), |
| 87 |
array( |
| 88 |
'id' => 'pcp_pause_hover', |
| 89 |
'type' => 'switcher', |
| 90 |
'title' => __( 'Pause on Hover', 'post-carousel' ), |
| 91 |
'subtitle' => __( 'Enable/Disable carousel stop on hover.', 'post-carousel' ), |
| 92 |
'default' => true, |
| 93 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 94 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 95 |
'text_width' => 100, |
| 96 |
'dependency' => array( 'pcp_autoplay', '==', true ), |
| 97 |
|
| 98 |
), |
| 99 |
array( |
| 100 |
'id' => 'pcp_infinite_loop', |
| 101 |
'type' => 'switcher', |
| 102 |
'title' => __( 'Infinite Loop', 'post-carousel' ), |
| 103 |
'subtitle' => __( 'Enable/Disable carousel infinite loop.', 'post-carousel' ), |
| 104 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 105 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 106 |
'text_width' => 100, |
| 107 |
'default' => true, |
| 108 |
), |
| 109 |
array( |
| 110 |
'id' => 'pcp_lazy_load', |
| 111 |
'type' => 'switcher', |
| 112 |
'title' => __( 'Lazy Load', 'post-carousel' ), |
| 113 |
'subtitle' => __( 'Enable/Disable lazy load.', 'post-carousel' ), |
| 114 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 115 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 116 |
'text_width' => 100, |
| 117 |
'default' => true, |
| 118 |
), |
| 119 |
array( |
| 120 |
'type' => 'notice', |
| 121 |
'class' => 'taxonomy-ajax-filter-notice', |
| 122 |
'content' => __( 'Ready to fascinate your audience with beautiful transitions, such as Fade, Flip Cube and Coverflow?', 'post-carousel' ) . ' <a href="https://wpsmartpost.com/pricing/?ref=1" target="_blank"><b>' . __( 'Upgrade To Pro!', 'post-carousel' ) . '</b></a>', |
| 123 |
), |
| 124 |
), |
| 125 |
), |
| 126 |
array( |
| 127 |
'title' => __( 'Navigation', 'post-carousel' ), |
| 128 |
'icon' => '<i class="sps-icon-navigation" aria-hidden="true"></i>', |
| 129 |
'fields' => array( |
| 130 |
// Navigation Settings. |
| 131 |
array( |
| 132 |
'id' => 'pcp_navigation_data', |
| 133 |
'class' => 'navigation-and-pagination-style', |
| 134 |
'type' => 'fieldset', |
| 135 |
'fields' => array( |
| 136 |
array( |
| 137 |
'id' => 'pcp_navigation', |
| 138 |
'type' => 'switcher', |
| 139 |
'title' => __( 'Navigation', 'post-carousel' ), |
| 140 |
'class' => 'pcp_navigation', |
| 141 |
'subtitle' => __( 'Show/hide navigation.', 'post-carousel' ), |
| 142 |
'text_on' => __( 'Show', 'post-carousel' ), |
| 143 |
'text_off' => __( 'Hide', 'post-carousel' ), |
| 144 |
'text_width' => 80, |
| 145 |
'default' => true, |
| 146 |
), |
| 147 |
array( |
| 148 |
'id' => 'nev_hide_on_mobile', |
| 149 |
'type' => 'checkbox', |
| 150 |
'class' => 'pcp_hide_on_mobile', |
| 151 |
'title' => __( 'Hide on Mobile', 'post-carousel' ), |
| 152 |
'default' => false, |
| 153 |
'dependency' => array( 'pcp_navigation', '==', 'true', true ), |
| 154 |
), |
| 155 |
), |
| 156 |
), |
| 157 |
array( |
| 158 |
'id' => 'pcp_carousel_nav_position', |
| 159 |
'class' => 'pcp_carousel_nav_position', |
| 160 |
'type' => 'select', |
| 161 |
'preview' => true, |
| 162 |
'title' => __( 'Navigation Position', 'post-carousel' ), |
| 163 |
'subtitle' => __( 'Select a position for the navigation arrows.', 'post-carousel' ), |
| 164 |
'options' => array( |
| 165 |
'top_right' => __( 'Top Right', 'post-carousel' ), |
| 166 |
'top_left' => __( 'Top Left', 'post-carousel' ), |
| 167 |
'top_center' => __( 'Top Center (Pro)', 'post-carousel' ), |
| 168 |
'bottom_left' => __( 'Bottom Left (Pro)', 'post-carousel' ), |
| 169 |
'bottom_center' => __( 'Bottom Center (Pro)', 'post-carousel' ), |
| 170 |
'bottom_right' => __( 'Bottom Right (Pro)', 'post-carousel' ), |
| 171 |
'vertically_center_outer' => __( 'Vertical Center Outer (Pro)', 'post-carousel' ), |
| 172 |
'vertical_center' => __( 'Vertical Center (Pro)', 'post-carousel' ), |
| 173 |
'vertical_center_inner' => __( 'Vertical Center Inner (Pro)', 'post-carousel' ), |
| 174 |
), |
| 175 |
'default' => 'top_right', |
| 176 |
'dependency' => array( 'pcp_navigation', '!=', 'hide', true ), |
| 177 |
), |
| 178 |
array( |
| 179 |
'id' => 'nev_visible_on_hover', |
| 180 |
'type' => 'checkbox', |
| 181 |
'title' => __( 'Visible On Hover', 'post-carousel' ), |
| 182 |
'subtitle' => __( 'Check to show navigation on hover in the carousel or slider area.', 'post-carousel' ), |
| 183 |
'default' => false, |
| 184 |
'dependency' => array( 'pcp_navigation|pcp_carousel_nav_position', '==|any', 'true|vertically_center_outer,vertical_center,vertical_center_inner', true ), |
| 185 |
), |
| 186 |
array( |
| 187 |
'id' => 'pcp_nav_colors', |
| 188 |
'type' => 'color_group', |
| 189 |
'title' => __( 'Color', 'post-carousel' ), |
| 190 |
'subtitle' => __( 'Set color for the carousel navigation.', 'post-carousel' ), |
| 191 |
'sanitize' => 'spf_pcp_sanitize_color_group_field', |
| 192 |
'options' => array( |
| 193 |
'color' => __( 'Color', 'post-carousel' ), |
| 194 |
'hover-color' => __( 'Hover Color', 'post-carousel' ), |
| 195 |
'bg' => __( 'Background', 'post-carousel' ), |
| 196 |
'hover-bg' => __( 'Hover Background', 'post-carousel' ), |
| 197 |
), |
| 198 |
'default' => array( |
| 199 |
'color' => '#aaa', |
| 200 |
'hover-color' => '#fff', |
| 201 |
'bg' => '#fff', |
| 202 |
'hover-bg' => '#D64224', |
| 203 |
), |
| 204 |
'dependency' => array( 'pcp_navigation', '==', 'true' ), |
| 205 |
), |
| 206 |
array( |
| 207 |
'id' => 'pcp_nav_border', |
| 208 |
'type' => 'border', |
| 209 |
'title' => __( 'Border', 'post-carousel' ), |
| 210 |
'subtitle' => __( 'Set border for the navigation.', 'post-carousel' ), |
| 211 |
'all' => true, |
| 212 |
'border_radius' => true, |
| 213 |
'hover_color' => true, |
| 214 |
'show_units' => true, |
| 215 |
'units' => array( 'px', '%' ), |
| 216 |
'default' => array( |
| 217 |
'all' => '1', |
| 218 |
'style' => 'solid', |
| 219 |
'color' => '#aaa', |
| 220 |
'hover_color' => '#e1624b', |
| 221 |
'border_radius' => '0', |
| 222 |
'unit' => 'px', |
| 223 |
), |
| 224 |
'dependency' => array( 'pcp_navigation', '==', 'true', true ), |
| 225 |
), |
| 226 |
array( |
| 227 |
'type' => 'notice', |
| 228 |
'class' => 'taxonomy-ajax-filter-notice', |
| 229 |
'content' => __( 'Want even more fine-tuned control over your Carousel Navigation display?', 'post-carousel' ) . ' <a href="https://wpsmartpost.com/pricing/?ref=1" target="_blank"><b>' . __( 'Upgrade To Pro!', 'post-carousel' ) . '</b></a>', |
| 230 |
), |
| 231 |
), |
| 232 |
), |
| 233 |
array( |
| 234 |
'title' => __( 'Pagination', 'post-carousel' ), |
| 235 |
'icon' => '<i class="sps-icon-pagination" aria-hidden="true"></i>', |
| 236 |
'fields' => array( |
| 237 |
array( |
| 238 |
'id' => 'carousel_pagination_group', |
| 239 |
'class' => 'navigation-and-pagination-style', |
| 240 |
'type' => 'fieldset', |
| 241 |
'fields' => array( |
| 242 |
array( |
| 243 |
'id' => 'pcp_pagination', |
| 244 |
'type' => 'switcher', |
| 245 |
'title' => __( 'Pagination', 'post-carousel' ), |
| 246 |
'class' => 'pcp_pagination', |
| 247 |
'subtitle' => __( 'Show/hide navigation.', 'post-carousel' ), |
| 248 |
'text_on' => __( 'Show', 'post-carousel' ), |
| 249 |
'text_off' => __( 'Hide', 'post-carousel' ), |
| 250 |
'text_width' => 77, |
| 251 |
'default' => true, |
| 252 |
), |
| 253 |
array( |
| 254 |
'id' => 'pagination_hide_on_mobile', |
| 255 |
'type' => 'checkbox', |
| 256 |
'class' => 'pcp_hide_on_mobile', |
| 257 |
'title' => __( 'Hide on Mobile', 'post-carousel' ), |
| 258 |
'default' => false, |
| 259 |
'dependency' => array( 'pcp_pagination', '==', 'true', true ), |
| 260 |
), |
| 261 |
), |
| 262 |
), |
| 263 |
array( |
| 264 |
'id' => 'bullet_types', |
| 265 |
'type' => 'layout_preset', |
| 266 |
'class' => 'hide-active-sign', |
| 267 |
'title' => __( 'Pagination Type', 'post-carousel' ), |
| 268 |
'subtitle' => __( 'Select a style for pagination.', 'post-carousel' ), |
| 269 |
'options' => array( |
| 270 |
'dots' => array( |
| 271 |
'image' => SP_PC_URL . 'admin/img/pagination-type/bullets.svg', |
| 272 |
'text' => __( 'Dots', 'post-carousel' ), |
| 273 |
), |
| 274 |
'dynamic' => array( |
| 275 |
'image' => SP_PC_URL . 'admin/img/pagination-type/dynamic.svg', |
| 276 |
'text' => __( 'Dynamic', 'post-carousel' ), |
| 277 |
), |
| 278 |
'strokes' => array( |
| 279 |
'image' => SP_PC_URL . 'admin/img/pagination-type/strokes.svg', |
| 280 |
'text' => __( 'Strokes', 'post-carousel' ), |
| 281 |
'pro_only' => true, |
| 282 |
), |
| 283 |
'scrollbar' => array( |
| 284 |
'image' => SP_PC_URL . 'admin/img/pagination-type/scrollbar.svg', |
| 285 |
'text' => __( 'Scrollbar', 'post-carousel' ), |
| 286 |
'pro_only' => true, |
| 287 |
), |
| 288 |
'fraction' => array( |
| 289 |
'image' => SP_PC_URL . 'admin/img/pagination-type/fraction.svg', |
| 290 |
'text' => __( 'Fraction', 'post-carousel' ), |
| 291 |
'pro_only' => true, |
| 292 |
), |
| 293 |
'number' => array( |
| 294 |
'image' => SP_PC_URL . 'admin/img/pagination-type/numbers.svg', |
| 295 |
'text' => __( 'Number', 'post-carousel' ), |
| 296 |
'pro_only' => true, |
| 297 |
), |
| 298 |
), |
| 299 |
'default' => 'dots', |
| 300 |
'dependency' => array( 'pcp_pagination', '==', 'true', true ), |
| 301 |
), |
| 302 |
array( |
| 303 |
'id' => 'pcp_pagination_color_set', |
| 304 |
'type' => 'fieldset', |
| 305 |
'class' => 'pcp-pagination-color-set', |
| 306 |
'title' => __( 'Pagination Color', 'post-carousel' ), |
| 307 |
'subtitle' => __( 'Set color for the carousel pagination.', 'post-carousel' ), |
| 308 |
'fields' => array( |
| 309 |
array( |
| 310 |
'id' => 'pcp_pagination_color', |
| 311 |
'type' => 'color_group', |
| 312 |
'options' => array( |
| 313 |
'color' => __( 'Color', 'post-carousel' ), |
| 314 |
'active-color' => __( 'Active Color', 'post-carousel' ), |
| 315 |
), |
| 316 |
'default' => array( |
| 317 |
'color' => '#cccccc', |
| 318 |
'active-color' => '#D64224', |
| 319 |
), |
| 320 |
), |
| 321 |
), |
| 322 |
'dependency' => array( 'pcp_pagination', '!=', 'hide' ), |
| 323 |
), |
| 324 |
array( |
| 325 |
'type' => 'notice', |
| 326 |
'class' => 'taxonomy-ajax-filter-notice', |
| 327 |
'content' => __( 'Want even more fine-tuned control over your Carousel Pagination display?', 'post-carousel' ) . ' <a href="https://wpsmartpost.com/pricing/?ref=1" target="_blank"><b>' . __( 'Upgrade To Pro!', 'post-carousel' ) . '</b></a>', |
| 328 |
), |
| 329 |
), |
| 330 |
), |
| 331 |
array( |
| 332 |
'title' => __( 'Miscellaneous', 'post-carousel' ), |
| 333 |
'icon' => '<i class="sps-icon-others" aria-hidden="true"></i>', |
| 334 |
'fields' => array( |
| 335 |
array( |
| 336 |
'id' => 'pcp_adaptive_height', |
| 337 |
'type' => 'switcher', |
| 338 |
'title' => __( 'Adaptive Carousel Height', 'post-carousel' ), |
| 339 |
'subtitle' => __( 'Dynamically adjust post carousel height based on each slide\'s height.', 'post-carousel' ), |
| 340 |
'default' => false, |
| 341 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 342 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 343 |
'text_width' => 100, |
| 344 |
), |
| 345 |
array( |
| 346 |
'id' => 'pcp_accessibility', |
| 347 |
'type' => 'switcher', |
| 348 |
'title' => __( 'Tab and Key Navigation', 'post-carousel' ), |
| 349 |
'subtitle' => __( 'Enable/Disable carousel scroll with tab and keyboard.', 'post-carousel' ), |
| 350 |
'default' => true, |
| 351 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 352 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 353 |
'text_width' => 100, |
| 354 |
), |
| 355 |
array( |
| 356 |
'id' => 'touch_swipe', |
| 357 |
'type' => 'switcher', |
| 358 |
'title' => __( 'Touch Swipe', 'post-carousel' ), |
| 359 |
'subtitle' => __( 'Enable/Disable touch swipe mode.', 'post-carousel' ), |
| 360 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 361 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 362 |
'text_width' => 100, |
| 363 |
'default' => true, |
| 364 |
), |
| 365 |
array( |
| 366 |
'id' => 'slider_draggable', |
| 367 |
'type' => 'switcher', |
| 368 |
'title' => __( 'Mouse Draggable', 'post-carousel' ), |
| 369 |
'subtitle' => __( 'Enable/Disable mouse draggable mode.', 'post-carousel' ), |
| 370 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 371 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 372 |
'text_width' => 100, |
| 373 |
'default' => true, |
| 374 |
), |
| 375 |
array( |
| 376 |
'id' => 'free_mode', |
| 377 |
'type' => 'switcher', |
| 378 |
'title' => __( 'Free Mode', 'post-carousel' ), |
| 379 |
'subtitle' => __( 'Enable/Disable free mode.', 'post-carousel' ), |
| 380 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 381 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 382 |
'text_width' => 100, |
| 383 |
'default' => false, |
| 384 |
), |
| 385 |
array( |
| 386 |
'id' => 'slider_mouse_wheel', |
| 387 |
'type' => 'switcher', |
| 388 |
'title' => __( 'Mouse Wheel', 'post-carousel' ), |
| 389 |
'subtitle' => __( 'Enable/Disable mouse wheel mode.', 'post-carousel' ), |
| 390 |
'text_on' => __( 'Enabled', 'post-carousel' ), |
| 391 |
'text_off' => __( 'Disabled', 'post-carousel' ), |
| 392 |
'text_width' => 100, |
| 393 |
'default' => false, |
| 394 |
), |
| 395 |
), |
| 396 |
), |
| 397 |
), |
| 398 |
), |
| 399 |
), // End of fields array. |
| 400 |
) |
| 401 |
); // Carousel Controls section end. |
| 402 |
} |
| 403 |
} |
| 404 |
|