| 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; } // Cannot access pages directly. |
| 11 |
|
| 12 |
/** |
| 13 |
* The Carousel building class. |
| 14 |
*/ |
| 15 |
class SPS_Carousel { |
| 16 |
|
| 17 |
/** |
| 18 |
* Carousel section metabox. |
| 19 |
* |
| 20 |
* @param string $prefix The metabox key. |
| 21 |
* @return void |
| 22 |
*/ |
| 23 |
public static function section( $prefix ) { |
| 24 |
SP_PC::createSection( |
| 25 |
$prefix, |
| 26 |
array( |
| 27 |
'title' => __( 'Carousel Controls', 'smart-post-show' ), |
| 28 |
'icon' => 'fa fa-sliders', |
| 29 |
'fields' => array( |
| 30 |
array( |
| 31 |
'id' => 'pcp_carousel_mode', |
| 32 |
'type' => 'button_set', |
| 33 |
'title' => __( 'Carousel Mode', 'smart-post-show' ), |
| 34 |
'subtitle' => __( 'Choose a mode for the carousel.', 'smart-post-show' ), |
| 35 |
'options' => array( |
| 36 |
'standard' => __( 'Standard', 'smart-post-show' ), |
| 37 |
'center' => array( |
| 38 |
'text' => __( 'Center', 'smart-post-show' ), |
| 39 |
'pro_only' => true, |
| 40 |
), |
| 41 |
'ticker' => array( |
| 42 |
'text' => __( 'Ticker', 'smart-post-show' ), |
| 43 |
'pro_only' => true, |
| 44 |
), |
| 45 |
), |
| 46 |
'default' => 'standard', |
| 47 |
), |
| 48 |
array( |
| 49 |
'id' => 'pcp_carousel_speed', |
| 50 |
'type' => 'spinner', |
| 51 |
'title' => __( 'Carousel Speed', 'smart-post-show' ), |
| 52 |
'subtitle' => __( 'Set carousel speed in millisecond.', 'smart-post-show' ), |
| 53 |
'default' => '600', |
| 54 |
'min' => 0, |
| 55 |
'max' => 20000, |
| 56 |
'step' => 100, |
| 57 |
'unit' => 'ms', |
| 58 |
), |
| 59 |
array( |
| 60 |
'id' => 'pcp_autoplay', |
| 61 |
'type' => 'switcher', |
| 62 |
'title' => __( 'AutoPlay', 'smart-post-show' ), |
| 63 |
'subtitle' => __( 'On/Off carousel autoplay.', 'smart-post-show' ), |
| 64 |
'default' => true, |
| 65 |
), |
| 66 |
array( |
| 67 |
'id' => 'pcp_autoplay_speed', |
| 68 |
'type' => 'spinner', |
| 69 |
'title' => __( 'AutoPlay Speed', 'smart-post-show' ), |
| 70 |
'subtitle' => __( 'Set autoplay speed in millisecond.', 'smart-post-show' ), |
| 71 |
'default' => '2000', |
| 72 |
'min' => 0, |
| 73 |
'max' => 10000, |
| 74 |
'step' => 100, |
| 75 |
'unit' => 'ms', |
| 76 |
'dependency' => array( 'pcp_autoplay', '==', true ), |
| 77 |
), |
| 78 |
array( |
| 79 |
'id' => 'pcp_pause_hover', |
| 80 |
'type' => 'switcher', |
| 81 |
'title' => __( 'Pause on Hover', 'smart-post-show' ), |
| 82 |
'subtitle' => __( 'On/Off carousel stop on hover.', 'smart-post-show' ), |
| 83 |
'default' => true, |
| 84 |
'dependency' => array( 'pcp_autoplay', '==', true ), |
| 85 |
|
| 86 |
), |
| 87 |
array( |
| 88 |
'id' => 'pcp_infinite_loop', |
| 89 |
'type' => 'switcher', |
| 90 |
'title' => __( 'Infinite Loop', 'smart-post-show' ), |
| 91 |
'subtitle' => __( 'On/Off carousel infinite loop.', 'smart-post-show' ), |
| 92 |
'default' => true, |
| 93 |
), |
| 94 |
array( |
| 95 |
'id' => 'pcp_lazy_load', |
| 96 |
'type' => 'switcher', |
| 97 |
'title' => __( 'Lazy Load', 'smart-post-show' ), |
| 98 |
'subtitle' => __( 'On/Off lazy load.', 'smart-post-show' ), |
| 99 |
'default' => true, |
| 100 |
), |
| 101 |
array( |
| 102 |
'id' => 'pcp_carousel_direction', |
| 103 |
'type' => 'button_set', |
| 104 |
'title' => __( 'Carousel Direction', 'smart-post-show' ), |
| 105 |
'subtitle' => __( 'Choose a carousel direction.', 'smart-post-show' ), |
| 106 |
'options' => array( |
| 107 |
'ltr' => __( 'Right to Left', 'smart-post-show' ), |
| 108 |
'rtl' => __( 'Left to Right', 'smart-post-show' ), |
| 109 |
), |
| 110 |
'default' => 'ltr', |
| 111 |
), |
| 112 |
array( |
| 113 |
'id' => 'pcp_slide_effect', |
| 114 |
'type' => 'select', |
| 115 |
'title' => __( 'Transition Effect', 'smart-post-show' ), |
| 116 |
'subtitle' => __( 'Select a slide transition effect.', 'smart-post-show' ), |
| 117 |
'help' => __( 'Fade, cube, and flip transition effects work only for the single column view.', 'smart-post-show' ), |
| 118 |
'options' => array( |
| 119 |
'slide' => __( 'Slide', 'smart-post-show' ), |
| 120 |
'fade' => __( 'Fade (Pro)', 'smart-post-show' ), |
| 121 |
'coverflow' => __( 'Coverflow (Pro)', 'smart-post-show' ), |
| 122 |
'cube' => __( 'Cube (Pro)', 'smart-post-show' ), |
| 123 |
'flip' => __( 'Flip (Pro)', 'smart-post-show' ), |
| 124 |
), |
| 125 |
'default' => 'slide', |
| 126 |
), |
| 127 |
array( |
| 128 |
'id' => 'pcp_number_of_row', |
| 129 |
'type' => 'column', |
| 130 |
'class' => 'pcp_only_pro', |
| 131 |
'title' => __( 'Row', 'smart-post-show-pro' ), |
| 132 |
'subtitle' => __( 'Set number of row in different devices for responsive view.', 'smart-post-show-pro' ), |
| 133 |
'default' => array( |
| 134 |
'lg_desktop' => '1', |
| 135 |
'desktop' => '1', |
| 136 |
'tablet' => '1', |
| 137 |
'mobile_landscape' => '1', |
| 138 |
'mobile' => '1', |
| 139 |
), |
| 140 |
'min' => '1', |
| 141 |
), |
| 142 |
array( |
| 143 |
'type' => 'subheading', |
| 144 |
'content' => __( 'Navigation', 'smart-post-show' ), |
| 145 |
), |
| 146 |
|
| 147 |
// Navigation Settings. |
| 148 |
array( |
| 149 |
'id' => 'pcp_navigation', |
| 150 |
'type' => 'button_set', |
| 151 |
'title' => __( 'Navigation', 'smart-post-show' ), |
| 152 |
'subtitle' => __( 'Show/Hide carousel navigation.', 'smart-post-show' ), |
| 153 |
'options' => array( |
| 154 |
'show' => __( 'Show', 'smart-post-show' ), |
| 155 |
'hide' => __( 'Hide', 'smart-post-show' ), |
| 156 |
'hide_on_mobile' => __( 'Hide on Mobile', 'smart-post-show' ), |
| 157 |
), |
| 158 |
'default' => 'show', |
| 159 |
), |
| 160 |
array( |
| 161 |
'id' => 'pcp_nav_colors', |
| 162 |
'type' => 'color_group', |
| 163 |
'title' => __( 'Navigation Color', 'smart-post-show' ), |
| 164 |
'subtitle' => __( 'Set color for the carousel navigation.', 'smart-post-show' ), |
| 165 |
'options' => array( |
| 166 |
'color' => __( 'Color', 'smart-post-show' ), |
| 167 |
'hover-color' => __( 'Hover Color', 'smart-post-show' ), |
| 168 |
'bg' => __( 'Background', 'smart-post-show' ), |
| 169 |
'hover-bg' => __( 'Hover Background', 'smart-post-show' ), |
| 170 |
'border-color' => __( 'Border', 'smart-post-show' ), |
| 171 |
'hover-border-color' => __( 'Hover Border', 'smart-post-show' ), |
| 172 |
), |
| 173 |
'default' => array( |
| 174 |
'color' => '#aaa', |
| 175 |
'hover-color' => '#fff', |
| 176 |
'bg' => '#fff', |
| 177 |
'hover-bg' => '#e1624b', |
| 178 |
'border-color' => '#aaa', |
| 179 |
'hover-border-color' => '#e1624b', |
| 180 |
), |
| 181 |
'dependency' => array( 'pcp_navigation', '!=', 'hide' ), |
| 182 |
), |
| 183 |
|
| 184 |
// Pagination Settings. |
| 185 |
array( |
| 186 |
'type' => 'subheading', |
| 187 |
'content' => __( 'Pagination', 'smart-post-show' ), |
| 188 |
), |
| 189 |
array( |
| 190 |
'id' => 'pcp_pagination', |
| 191 |
'type' => 'button_set', |
| 192 |
'title' => __( 'Pagination', 'smart-post-show' ), |
| 193 |
'subtitle' => __( 'Show/Hide carousel pagination.', 'smart-post-show' ), |
| 194 |
'options' => array( |
| 195 |
'show' => __( 'Show', 'smart-post-show' ), |
| 196 |
'hide' => __( 'Hide', 'smart-post-show' ), |
| 197 |
'hide_on_mobile' => __( 'Hide on Mobile', 'smart-post-show' ), |
| 198 |
), |
| 199 |
'default' => 'show', |
| 200 |
), |
| 201 |
array( |
| 202 |
'id' => 'pcp_pagination_color_set', |
| 203 |
'type' => 'fieldset', |
| 204 |
'class' => 'pcp-pagination-color-set', |
| 205 |
'title' => __( 'Pagination Color', 'smart-post-show' ), |
| 206 |
'subtitle' => __( 'Set color for the carousel pagination.', 'smart-post-show' ), |
| 207 |
'fields' => array( |
| 208 |
array( |
| 209 |
'id' => 'pcp_pagination_color', |
| 210 |
'type' => 'color_group', |
| 211 |
'options' => array( |
| 212 |
'color' => __( 'Color', 'smart-post-show' ), |
| 213 |
'active-color' => __( 'Active Color', 'smart-post-show' ), |
| 214 |
), |
| 215 |
'default' => array( |
| 216 |
'color' => '#cccccc', |
| 217 |
'active-color' => '#e1624b', |
| 218 |
), |
| 219 |
), |
| 220 |
), |
| 221 |
'dependency' => array( 'pcp_pagination', '!=', 'hide' ), |
| 222 |
), |
| 223 |
|
| 224 |
// Miscellaneous Settings. |
| 225 |
array( |
| 226 |
'type' => 'subheading', |
| 227 |
'content' => __( 'Miscellaneous', 'smart-post-show' ), |
| 228 |
), |
| 229 |
array( |
| 230 |
'id' => 'pcp_adaptive_height', |
| 231 |
'type' => 'switcher', |
| 232 |
'title' => __( 'Adaptive Carousel Height', 'smart-post-show' ), |
| 233 |
'subtitle' => __( 'Dynamically adjust post carousel height based on each slide\'s height.', 'smart-post-show' ), |
| 234 |
'default' => false, |
| 235 |
'text_on' => __( 'Enabled', 'smart-post-show' ), |
| 236 |
'text_off' => __( 'Disabled', 'smart-post-show' ), |
| 237 |
'text_width' => 94, |
| 238 |
), |
| 239 |
array( |
| 240 |
'id' => 'pcp_accessibility', |
| 241 |
'type' => 'switcher', |
| 242 |
'title' => __( 'Tab and Key Navigation', 'smart-post-show' ), |
| 243 |
'subtitle' => __( 'Enable/Disable carousel scroll with tab and keyboard.', 'smart-post-show' ), |
| 244 |
'default' => true, |
| 245 |
'text_on' => __( 'Enabled', 'smart-post-show' ), |
| 246 |
'text_off' => __( 'Disabled', 'smart-post-show' ), |
| 247 |
'text_width' => 94, |
| 248 |
), |
| 249 |
array( |
| 250 |
'id' => 'touch_swipe', |
| 251 |
'type' => 'switcher', |
| 252 |
'title' => __( 'Touch Swipe', 'smart-post-show' ), |
| 253 |
'subtitle' => __( 'Enable/Disable touch swipe mode.', 'smart-post-show' ), |
| 254 |
'text_on' => __( 'Enabled', 'smart-post-show' ), |
| 255 |
'text_off' => __( 'Disabled', 'smart-post-show' ), |
| 256 |
'text_width' => 94, |
| 257 |
'default' => true, |
| 258 |
), |
| 259 |
array( |
| 260 |
'id' => 'slider_draggable', |
| 261 |
'type' => 'switcher', |
| 262 |
'title' => __( 'Mouse Draggable', 'smart-post-show' ), |
| 263 |
'subtitle' => __( 'Enable/Disable mouse draggable mode.', 'smart-post-show' ), |
| 264 |
'text_on' => __( 'Enabled', 'smart-post-show' ), |
| 265 |
'text_off' => __( 'Disabled', 'smart-post-show' ), |
| 266 |
'text_width' => 94, |
| 267 |
'default' => true, |
| 268 |
), |
| 269 |
array( |
| 270 |
'id' => 'slider_mouse_wheel', |
| 271 |
'type' => 'switcher', |
| 272 |
'title' => __( 'Mouse Wheel', 'smart-post-show' ), |
| 273 |
'subtitle' => __( 'Enable/Disable mouse wheel mode.', 'smart-post-show' ), |
| 274 |
'text_on' => __( 'Enabled', 'smart-post-show' ), |
| 275 |
'text_off' => __( 'Disabled', 'smart-post-show' ), |
| 276 |
'text_width' => 94, |
| 277 |
'default' => false, |
| 278 |
), |
| 279 |
), // End of fields array. |
| 280 |
) |
| 281 |
); // Carousel Controls section end. |
| 282 |
} |
| 283 |
} |
| 284 |
|