elementor
1 year ago
logs
1 month ago
strong-testimonials-beaver-block
1 year ago
submodules
8 months ago
class-strong-gutemberg.php
1 year ago
class-strong-log.php
1 year ago
class-strong-mail.php
1 year ago
class-strong-testimonials-average-shortcode.php
1 year ago
class-strong-testimonials-count-shortcode.php
1 year ago
class-strong-testimonials-defaults.php
1 month ago
class-strong-testimonials-form.php
1 month ago
class-strong-testimonials-order.php
1 year ago
class-strong-testimonials-privacy.php
1 year ago
class-strong-testimonials-render.php
1 month ago
class-strong-testimonials-templates.php
1 year ago
class-strong-testimonials-view-shortcode.php
1 week ago
class-strong-testimonials-view-widget.php
1 year ago
class-strong-view-display.php
6 days ago
class-strong-view-form.php
6 days ago
class-strong-view-slideshow.php
6 days ago
class-strong-view.php
6 days ago
class-walker-strong-category-checklist-front.php
1 year ago
deprecated.php
1 year ago
filters.php
1 month ago
functions-activation.php
1 month ago
functions-content.php
11 months ago
functions-image.php
5 months ago
functions-rating.php
1 year ago
functions-template-form.php
1 week ago
functions-template.php
4 months ago
functions-views.php
1 year ago
functions.php
1 month ago
l10n-polylang.php
1 year ago
l10n-wpml.php
1 year ago
post-types.php
1 week ago
retro.php
1 year ago
scripts.php
1 month ago
class-strong-testimonials-defaults.php
874 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * Class Strong_Testimonials_Defaults |
| 5 | * |
| 6 | * @since 2.28.0 |
| 7 | */ |
| 8 | class Strong_Testimonials_Defaults { |
| 9 | |
| 10 | /** |
| 11 | * Strong_Testimonials_Defaults constructor. |
| 12 | */ |
| 13 | public function __construct() { } |
| 14 | |
| 15 | /** |
| 16 | * Settings |
| 17 | * |
| 18 | * @since 1.13.0 reorder |
| 19 | * @since 2.2.11 scrolltop |
| 20 | * @since 2.3.0 remove whitespace |
| 21 | * @since 2.6.0 embed width |
| 22 | * @since 2.6.2 slideshow z-index |
| 23 | * @since 2.10.0 pending indicator |
| 24 | * @since 2.21.0 load Font Awesome |
| 25 | * @since 2.22.5 nofollow |
| 26 | * @since 2.27.0 no_lazyload |
| 27 | * |
| 28 | * @return array |
| 29 | */ |
| 30 | public static function get_options() { |
| 31 | $default_options = array( |
| 32 | 'embed_width' => '', |
| 33 | 'nofollow' => true, |
| 34 | 'noopener' => true, |
| 35 | 'noreferrer' => true, |
| 36 | 'disable_rewrite' => false, |
| 37 | 'pending_indicator' => true, |
| 38 | 'remove_whitespace' => true, |
| 39 | //@todo : delete commented line. For the moment let it be |
| 40 | //'reorder' => false, |
| 41 | 'support_comments' => false, |
| 42 | 'support_custom_fields' => false, |
| 43 | 'single_testimonial_slug' => 'testimonial', |
| 44 | 'scrolltop' => true, |
| 45 | 'scrolltop_offset' => 80, |
| 46 | 'lazyload' => false, |
| 47 | 'no_lazyload_plugin' => true, |
| 48 | 'touch_enabled' => true, |
| 49 | 'disable_upsells' => false, |
| 50 | ); |
| 51 | |
| 52 | return $default_options; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Custom field base. |
| 57 | * |
| 58 | * @since 2.28.0 Use 'action' to register a callback. |
| 59 | * |
| 60 | * @return array |
| 61 | */ |
| 62 | public static function get_field_base() { |
| 63 | return apply_filters( |
| 64 | 'wpmtst_field_base', |
| 65 | array( |
| 66 | 'name' => '', |
| 67 | 'name_mutable' => 1, |
| 68 | 'label' => '', |
| 69 | 'show_label' => 1, |
| 70 | 'input_type' => '', |
| 71 | 'action_input' => '', |
| 72 | 'action_output' => '', |
| 73 | 'text' => '', |
| 74 | 'show_text_option' => 0, |
| 75 | 'required' => 0, |
| 76 | 'show_required_option' => 1, |
| 77 | 'default_form_value' => '', |
| 78 | 'default_display_value' => '', |
| 79 | 'show_default_options' => 1, |
| 80 | 'error' => esc_html__( 'This field is required.', 'strong-testimonials' ), |
| 81 | 'placeholder' => '', |
| 82 | 'show_placeholder_option' => 1, |
| 83 | 'before' => '', |
| 84 | 'after' => '', |
| 85 | 'admin_table' => 0, |
| 86 | 'admin_table_option' => 1, |
| 87 | 'show_admin_table_option' => 1, |
| 88 | 'shortcode_on_form' => '', |
| 89 | 'shortcode_on_display' => '', |
| 90 | 'show_shortcode_options' => 0, |
| 91 | 'show_length_option' => 0, |
| 92 | 'max_length' => '', |
| 93 | ) |
| 94 | ); |
| 95 | } |
| 96 | |
| 97 | /** |
| 98 | * Custom fields. |
| 99 | * |
| 100 | * @return array |
| 101 | */ |
| 102 | public static function get_fields() { |
| 103 | $field_base = self::get_field_base(); |
| 104 | $field_types = array(); |
| 105 | |
| 106 | /* |
| 107 | * Assemble post field types |
| 108 | */ |
| 109 | $field_types['post'] = array( |
| 110 | 'post_title' => array( |
| 111 | 'input_type' => 'text', |
| 112 | 'option_label' => esc_html__( 'Testimonial Title', 'strong-testimonials' ), |
| 113 | 'map' => 'post_title', |
| 114 | 'show_default_options' => 0, |
| 115 | 'admin_table' => 1, |
| 116 | 'admin_table_option' => 0, |
| 117 | 'show_admin_table_option' => 0, |
| 118 | 'name_mutable' => 0, |
| 119 | 'show_length_option' => 1, |
| 120 | ), |
| 121 | 'post_content' => array( |
| 122 | 'input_type' => 'textarea', |
| 123 | 'option_label' => esc_html__( 'Testimonial Content', 'strong-testimonials' ), |
| 124 | 'map' => 'post_content', |
| 125 | 'required' => 1, |
| 126 | 'show_default_options' => 0, |
| 127 | 'core' => 0, |
| 128 | 'admin_table' => 0, |
| 129 | 'show_admin_table_option' => 0, |
| 130 | 'name_mutable' => 0, |
| 131 | 'show_length_option' => 1, |
| 132 | ), |
| 133 | 'featured_image' => array( |
| 134 | 'input_type' => 'file', |
| 135 | 'option_label' => esc_html__( 'Featured Image', 'strong-testimonials' ), |
| 136 | 'map' => 'featured_image', |
| 137 | 'show_default_options' => 0, |
| 138 | 'show_placeholder_option' => 0, |
| 139 | 'admin_table' => 0, |
| 140 | 'name_mutable' => 0, |
| 141 | ), |
| 142 | ); |
| 143 | foreach ( $field_types['post'] as $key => $array ) { |
| 144 | $field_types['post'][ $key ] = array_merge( $field_base, $array ); |
| 145 | } |
| 146 | |
| 147 | /* |
| 148 | * Assemble custom field types |
| 149 | */ |
| 150 | $field_types['custom'] = array( |
| 151 | 'text' => array( |
| 152 | 'input_type' => 'text', |
| 153 | 'option_label' => esc_html__( 'text', 'strong-testimonials' ), |
| 154 | ), |
| 155 | 'email' => array( |
| 156 | 'input_type' => 'email', |
| 157 | 'option_label' => esc_html__( 'email', 'strong-testimonials' ), |
| 158 | 'show_default_options' => 0, |
| 159 | ), |
| 160 | 'url' => array( |
| 161 | 'input_type' => 'url', |
| 162 | 'option_label' => esc_html__( 'URL', 'strong-testimonials' ), |
| 163 | 'show_default_options' => 0, |
| 164 | ), |
| 165 | 'checkbox' => array( |
| 166 | 'input_type' => 'checkbox', |
| 167 | 'option_label' => esc_html__( 'checkbox', 'strong-testimonials' ), |
| 168 | 'show_text_option' => 1, |
| 169 | 'show_placeholder_option' => 0, |
| 170 | ), |
| 171 | ); |
| 172 | foreach ( $field_types['custom'] as $key => $array ) { |
| 173 | $field_types['custom'][ $key ] = array_merge( $field_base, $array ); |
| 174 | } |
| 175 | |
| 176 | /* |
| 177 | * Assemble special field types (FKA Optional) |
| 178 | * |
| 179 | * @since 1.18 |
| 180 | * @since 2.2.2 Fix bug caused by localizing 'categories' |
| 181 | */ |
| 182 | $field_types['optional'] = array( |
| 183 | 'category-selector' => array( |
| 184 | 'input_type' => 'category-selector', |
| 185 | 'option_label' => esc_html__( 'category selector', 'strong-testimonials' ), |
| 186 | 'show_default_options' => 0, |
| 187 | 'show_placeholder_option' => 0, |
| 188 | 'show_admin_table_option' => 0, |
| 189 | 'name_mutable' => 0, |
| 190 | ), |
| 191 | 'category-checklist' => array( |
| 192 | 'input_type' => 'category-checklist', |
| 193 | 'option_label' => esc_html__( 'category checklist', 'strong-testimonials' ), |
| 194 | 'show_default_options' => 0, |
| 195 | 'show_placeholder_option' => 0, |
| 196 | 'show_admin_table_option' => 0, |
| 197 | 'name_mutable' => 0, |
| 198 | ), |
| 199 | 'shortcode' => array( |
| 200 | 'input_type' => 'shortcode', |
| 201 | 'option_label' => esc_html__( 'shortcode', 'strong-testimonials' ), |
| 202 | 'show_label' => 0, |
| 203 | 'required' => 0, |
| 204 | 'show_required_option' => 0, |
| 205 | 'show_default_options' => 0, |
| 206 | 'show_placeholder_option' => 0, |
| 207 | 'show_admin_table_option' => 0, |
| 208 | 'show_shortcode_options' => 1, |
| 209 | ), |
| 210 | 'rating' => array( |
| 211 | 'input_type' => 'rating', |
| 212 | 'option_label' => esc_html__( 'star rating', 'strong-testimonials' ), |
| 213 | 'show_placeholder_option' => 0, |
| 214 | 'admin_table' => 1, |
| 215 | 'admin_table_option' => 1, |
| 216 | 'show_admin_table_option' => 1, |
| 217 | ), |
| 218 | ); |
| 219 | |
| 220 | /* |
| 221 | * Merge each one onto base field |
| 222 | */ |
| 223 | foreach ( $field_types['optional'] as $key => $array ) { |
| 224 | $field_types['optional'][ $key ] = array_merge( $field_base, $array ); |
| 225 | } |
| 226 | |
| 227 | /* |
| 228 | * Assemble all fields |
| 229 | */ |
| 230 | $default_fields = array( |
| 231 | 'field_base' => $field_base, |
| 232 | 'field_types' => $field_types, |
| 233 | ); |
| 234 | |
| 235 | return apply_filters( 'wpmtst_default_fields', $default_fields ); |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Default forms. |
| 240 | * |
| 241 | * @return array |
| 242 | */ |
| 243 | public static function get_base_forms() { |
| 244 | $default_fields = self::get_fields(); |
| 245 | |
| 246 | // Assemble field groups. |
| 247 | $forms = array( |
| 248 | 'default' => array( |
| 249 | 'name' => 'default', |
| 250 | 'label' => esc_html__( 'Default Form', 'strong-testimonials' ), |
| 251 | 'readonly' => 1, |
| 252 | 'fields' => array( |
| 253 | // ------ |
| 254 | // CUSTOM |
| 255 | // ------ |
| 256 | 0 => array( |
| 257 | 'record_type' => 'custom', |
| 258 | 'name' => 'client_name', |
| 259 | 'label' => esc_html__( 'Full Name', 'strong-testimonials' ), |
| 260 | 'input_type' => 'text', |
| 261 | 'required' => 1, |
| 262 | 'after' => esc_html__( 'What is your full name?', 'strong-testimonials' ), |
| 263 | 'admin_table' => 1, |
| 264 | ), |
| 265 | 1 => array( |
| 266 | 'record_type' => 'custom', |
| 267 | 'name' => 'email', |
| 268 | 'label' => esc_html__( 'Email', 'strong-testimonials' ), |
| 269 | 'input_type' => 'email', |
| 270 | 'required' => 1, |
| 271 | 'after' => esc_html__( 'What is your email address?', 'strong-testimonials' ), |
| 272 | ), |
| 273 | 3 => array( |
| 274 | 'record_type' => 'custom', |
| 275 | 'name' => 'company_name', |
| 276 | 'label' => esc_html__( 'Company Name', 'strong-testimonials' ), |
| 277 | 'input_type' => 'text', |
| 278 | 'after' => esc_html__( 'What is your company name?', 'strong-testimonials' ), |
| 279 | ), |
| 280 | 4 => array( |
| 281 | 'record_type' => 'custom', |
| 282 | 'name' => 'company_website', |
| 283 | 'label' => esc_html__( 'Company Website', 'strong-testimonials' ), |
| 284 | 'input_type' => 'url', |
| 285 | 'after' => esc_html__( 'Does your company have a website?', 'strong-testimonials' ), |
| 286 | ), |
| 287 | // ---- |
| 288 | // POST |
| 289 | // ---- |
| 290 | 5 => array( |
| 291 | 'record_type' => 'post', |
| 292 | 'name' => 'post_title', |
| 293 | 'label' => esc_html__( 'Heading', 'strong-testimonials' ), |
| 294 | 'input_type' => 'text', |
| 295 | 'required' => 0, |
| 296 | 'after' => esc_html__( 'A headline for your testimonial.', 'strong-testimonials' ), |
| 297 | 'max_length' => '', |
| 298 | ), |
| 299 | 6 => array( |
| 300 | 'record_type' => 'post', |
| 301 | 'name' => 'post_content', |
| 302 | 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ), |
| 303 | 'input_type' => 'textarea', |
| 304 | 'required' => 1, |
| 305 | 'after' => esc_html__( 'What do you think about us?', 'strong-testimonials' ), |
| 306 | 'max_length' => '', |
| 307 | ), |
| 308 | 7 => array( |
| 309 | 'record_type' => 'post', |
| 310 | 'name' => 'featured_image', |
| 311 | 'label' => esc_html__( 'Photo', 'strong-testimonials' ), |
| 312 | 'input_type' => 'file', |
| 313 | 'after' => esc_html__( 'Would you like to include a photo?', 'strong-testimonials' ), |
| 314 | 'admin_table' => 1, |
| 315 | ), |
| 316 | 8 => array( |
| 317 | 'record_type' => 'optional', |
| 318 | 'name' => 'star_rating', |
| 319 | 'label' => esc_html__( 'Star rating', 'strong-testimonials' ), |
| 320 | 'input_type' => 'rating', |
| 321 | 'required' => 0, |
| 322 | 'after' => esc_html__( 'Would you like to include star rating?', 'strong-testimonials' ), |
| 323 | ), |
| 324 | ), |
| 325 | ), |
| 326 | ); |
| 327 | |
| 328 | $forms['minimal'] = array( |
| 329 | 'name' => 'minimal', |
| 330 | 'label' => esc_html__( 'Minimal Form', 'strong-testimonials' ), |
| 331 | 'readonly' => 1, |
| 332 | 'fields' => array( |
| 333 | // ------ |
| 334 | // CUSTOM |
| 335 | // ------ |
| 336 | 0 => array( |
| 337 | 'record_type' => 'custom', |
| 338 | 'name' => 'client_name', |
| 339 | 'label' => esc_html__( 'Name', 'strong-testimonials' ), |
| 340 | 'input_type' => 'text', |
| 341 | 'required' => 1, |
| 342 | 'after' => '', |
| 343 | 'admin_table' => 1, |
| 344 | ), |
| 345 | 1 => array( |
| 346 | 'record_type' => 'custom', |
| 347 | 'name' => 'email', |
| 348 | 'label' => esc_html__( 'Email', 'strong-testimonials' ), |
| 349 | 'input_type' => 'email', |
| 350 | 'required' => 1, |
| 351 | 'after' => '', |
| 352 | ), |
| 353 | // ---- |
| 354 | // POST |
| 355 | // ---- |
| 356 | 2 => array( |
| 357 | 'record_type' => 'post', |
| 358 | 'name' => 'post_content', |
| 359 | 'label' => esc_html__( 'Testimonial', 'strong-testimonials' ), |
| 360 | 'input_type' => 'textarea', |
| 361 | 'required' => 1, |
| 362 | 'after' => '', |
| 363 | ), |
| 364 | ), |
| 365 | ); |
| 366 | |
| 367 | foreach ( $forms as $form_name => $form ) { |
| 368 | foreach ( $form['fields'] as $key => $array ) { |
| 369 | if ( 'post' === $array['record_type'] ) { |
| 370 | $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['post'][ $array['name'] ], $array ); |
| 371 | } elseif ( 'custom' === $array['record_type'] ) { |
| 372 | $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['custom'][ $array['input_type'] ], $array ); |
| 373 | } else { |
| 374 | $forms[ $form_name ]['fields'][ $key ] = array_merge( $default_fields['field_types']['optional'][ $array['input_type'] ], $array ); |
| 375 | } |
| 376 | } |
| 377 | } |
| 378 | |
| 379 | return $forms; |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Custom forms. |
| 384 | * |
| 385 | * @return array |
| 386 | */ |
| 387 | public static function get_custom_forms() { |
| 388 | |
| 389 | $base_forms = self::get_base_forms(); |
| 390 | |
| 391 | // Copy default fields to custom fields. |
| 392 | $forms[1] = array( |
| 393 | 'name' => 'custom', |
| 394 | 'label' => esc_html__( 'Custom Form', 'strong-testimonials' ), |
| 395 | 'readonly' => 0, |
| 396 | 'fields' => $base_forms['default']['fields'], |
| 397 | ); |
| 398 | |
| 399 | return apply_filters( 'wpmtst_update_custom_form', $forms ); |
| 400 | } |
| 401 | |
| 402 | /** |
| 403 | * Form options. |
| 404 | * |
| 405 | * @return array |
| 406 | */ |
| 407 | public static function get_form_options() { |
| 408 | /** |
| 409 | * Messages |
| 410 | * |
| 411 | * @since 1.13 |
| 412 | */ |
| 413 | $default_messages = array( |
| 414 | 'required-field' => array( |
| 415 | 'order' => 1, |
| 416 | /* translators: Settings > Form > Messages tab */ |
| 417 | 'description' => esc_html_x( 'Required', 'setting description', 'strong-testimonials' ), |
| 418 | 'text' => esc_html_x( 'Required', 'Default message for required notice at top of form.', 'strong-testimonials' ), |
| 419 | 'enabled' => 1, |
| 420 | ), |
| 421 | 'form-submit-button' => array( |
| 422 | 'order' => 2, |
| 423 | /* translators: Settings > Form > Messages tab */ |
| 424 | 'description' => esc_html_x( 'Submit Button', 'description', 'strong-testimonials' ), |
| 425 | /* translators: Default label for the Submit button on testimonial form. */ |
| 426 | 'text' => esc_html_x( 'Add Testimonial', 'the Submit button', 'strong-testimonials' ), |
| 427 | ), |
| 428 | 'submission-error' => array( |
| 429 | 'order' => 3, |
| 430 | /* translators: Settings > Form > Messages tab */ |
| 431 | 'description' => esc_html_x( 'Submission Error', 'description', 'strong-testimonials' ), |
| 432 | /* translators: Default message for submission form error. */ |
| 433 | 'text' => esc_html_x( 'There was a problem processing your testimonial.', 'error message', 'strong-testimonials' ), |
| 434 | ), |
| 435 | 'submission-success' => array( |
| 436 | 'order' => 4, |
| 437 | /* translators: Settings > Form > Messages tab */ |
| 438 | 'description' => esc_html_x( 'Submission Success', 'description', 'strong-testimonials' ), |
| 439 | /* translators: Default message for submission form success message. */ |
| 440 | 'text' => esc_html_x( 'Thank you! Your testimonial is waiting to be approved.', 'success message', 'strong-testimonials' ), |
| 441 | ), |
| 442 | ); |
| 443 | |
| 444 | uasort( $default_messages, 'wpmtst_uasort' ); |
| 445 | |
| 446 | $default_form_options = array( |
| 447 | 'post_status' => 'pending', |
| 448 | 'admin_notify' => false, |
| 449 | 'customer-notify' => false, |
| 450 | 'approved-notify' => false, |
| 451 | 'sender_name_for_customer' => false, |
| 452 | 'sender_customer_email' => false, |
| 453 | 'sender_site_customer_email' => true, |
| 454 | 'sender_name_for_customer_approval' => false, |
| 455 | 'sender_site_customer_approval_email' => true, |
| 456 | 'sender_approval_email' => false, |
| 457 | 'mail_queue' => false, |
| 458 | 'sender_name' => get_bloginfo( 'name' ), |
| 459 | 'sender_site_email' => true, |
| 460 | 'sender_email' => '', |
| 461 | 'recipients' => array( |
| 462 | array( |
| 463 | 'admin_name' => '', |
| 464 | 'admin_email' => '', |
| 465 | 'admin_site_email' => true, |
| 466 | 'primary' => true, // cannot be deleted |
| 467 | ), |
| 468 | ), |
| 469 | 'default_recipient' => array( |
| 470 | 'admin_name' => '', |
| 471 | 'admin_email' => '', |
| 472 | ), |
| 473 | /* translators: Default subject line for new testimonial notification email. */ |
| 474 | 'email_subject' => esc_html__( 'New testimonial for %BLOGNAME%', 'strong-testimonials' ), |
| 475 | 'customer_approval_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ), |
| 476 | 'customer_email_subject' => esc_html__( 'Testimonial for %BLOGNAME%', 'strong-testimonials' ), |
| 477 | /* translators: Default message for new testimonial notification email. */ |
| 478 | 'email_message' => esc_html__( 'New testimonial submission for %BLOGNAME%. This is awaiting action from the website administrator.', 'strong-testimonials' ), |
| 479 | 'customer_approval_email_message' => esc_html__( 'Your testimonial was published for %BLOGNAME%. Thank you!', 'strong-testimonials' ), |
| 480 | 'customer_email_message' => esc_html__( 'Your testimonial was received for %BLOGNAME% and awaiting approval from the website administrator. Thank you!', 'strong-testimonials' ), |
| 481 | 'messages' => $default_messages, |
| 482 | 'scrolltop_success' => true, |
| 483 | 'scrolltop_success_offset' => 80, |
| 484 | 'scrolltop_error' => true, |
| 485 | 'scrolltop_error_offset' => 80, |
| 486 | 'success_action' => 'message', // message | id | url |
| 487 | 'success_redirect_id' => '', |
| 488 | 'success_redirect_url' => '', |
| 489 | 'members_only' => false, |
| 490 | 'members_only_message' => esc_html__( 'You need to be logged in to access this form.', 'strong-testimonials' ), |
| 491 | 'mailchimp' => false, |
| 492 | 'mailchimp_message' => esc_html__( 'Subscribe to our newsletter.', 'strong-testimonials' ), |
| 493 | 'mailchimp_list' => '', |
| 494 | ); |
| 495 | |
| 496 | return apply_filters( 'wpmtst_default_form_options', $default_form_options ); |
| 497 | } |
| 498 | |
| 499 | /** |
| 500 | * Default view options. |
| 501 | * |
| 502 | * @since 1.21.0 |
| 503 | * |
| 504 | * @return array |
| 505 | */ |
| 506 | public static function get_view_options() { |
| 507 | $default_view_options = array( |
| 508 | |
| 509 | 'mode' => array( |
| 510 | 'display' => array( |
| 511 | 'name' => 'display', |
| 512 | 'label' => esc_html__( 'Display', 'strong-testimonials' ), |
| 513 | 'description' => esc_html__( 'Display your testimonials in a list or a grid.', 'strong-testimonials' ), |
| 514 | ), |
| 515 | 'slideshow' => array( |
| 516 | 'name' => 'slideshow', |
| 517 | 'label' => esc_html__( 'Slideshow', 'strong-testimonials' ), |
| 518 | 'description' => esc_html__( 'Create a slideshow of your testimonials.', 'strong-testimonials' ), |
| 519 | ), |
| 520 | 'form' => array( |
| 521 | 'name' => 'form', |
| 522 | 'label' => esc_html__( 'Form', 'strong-testimonials' ), |
| 523 | 'description' => esc_html__( 'Display a testimonial submission form.', 'strong-testimonials' ), |
| 524 | ), |
| 525 | ), |
| 526 | |
| 527 | 'order' => array( |
| 528 | 'random' => esc_html_x( 'random', 'display order', 'strong-testimonials' ), |
| 529 | 'menu_order' => esc_html_x( 'menu order', 'display order', 'strong-testimonials' ), |
| 530 | 'newest' => esc_html_x( 'newest first', 'display order', 'strong-testimonials' ), |
| 531 | 'oldest' => esc_html_x( 'oldest first', 'display order', 'strong-testimonials' ), |
| 532 | 'submit_date' => esc_html_x( 'submit date', 'display order', 'strong-testimonials' ), |
| 533 | ), |
| 534 | |
| 535 | 'slideshow_effect' => array( |
| 536 | 'none' => esc_html_x( 'no transition effect', 'slideshow transition option', 'strong-testimonials' ), |
| 537 | 'fade' => esc_html_x( 'fade', 'slideshow transition option', 'strong-testimonials' ), |
| 538 | 'horizontal' => esc_html_x( 'scroll horizontally', 'slideshow transition option', 'strong-testimonials' ), |
| 539 | 'vertical' => esc_html_x( 'scroll vertically', 'slideshow transition option', 'strong-testimonials' ), |
| 540 | ), |
| 541 | |
| 542 | 'slideshow_height' => array( |
| 543 | 'dynamic' => esc_html_x( 'Adjust height for each slide', 'slideshow option', 'strong-testimonials' ), |
| 544 | 'static' => esc_html_x( 'Set height to match the tallest slide', 'slideshow option', 'strong-testimonials' ), |
| 545 | ), |
| 546 | |
| 547 | 'slideshow_nav_method' => array( |
| 548 | 'controls' => array( |
| 549 | 'none' => array( |
| 550 | 'label' => esc_html_x( 'none', 'slideshow controls option', 'strong-testimonials' ), |
| 551 | 'args' => array( // base args; style will add more args |
| 552 | 'controls' => 0, |
| 553 | 'pager' => 0, |
| 554 | 'autoControls' => 0, |
| 555 | ), |
| 556 | ), |
| 557 | 'full' => array( |
| 558 | 'label' => esc_html_x( 'Bottom: previous / play-pause / next', 'slideshow controls option', 'strong-testimonials' ), |
| 559 | 'class' => 'controls-type-full', |
| 560 | 'add_position_class' => 1, |
| 561 | 'args' => array( |
| 562 | 'pager' => 0, |
| 563 | 'autoControls' => 1, |
| 564 | 'autoControlsCombine' => 1, |
| 565 | 'fullSetButtons' => 1, |
| 566 | 'fullSetText' => 1, |
| 567 | ), |
| 568 | ), |
| 569 | 'simple' => array( |
| 570 | 'label' => esc_html_x( 'Bottom: previous / next', 'slideshow controls option', 'strong-testimonials' ), |
| 571 | 'class' => 'controls-type-simple', |
| 572 | 'add_position_class' => 1, |
| 573 | 'args' => array( |
| 574 | 'controls' => 1, |
| 575 | 'autoControls' => 0, |
| 576 | ), |
| 577 | ), |
| 578 | 'sides' => array( |
| 579 | 'label' => esc_html_x( 'Sides: previous / next', 'slideshow controls option', 'strong-testimonials' ), |
| 580 | 'class' => 'controls-type-sides', |
| 581 | 'add_position_class' => 0, |
| 582 | 'args' => array( |
| 583 | 'controls' => 1, |
| 584 | 'autoControls' => 0, |
| 585 | 'prevText' => '', |
| 586 | 'nextText' => '', |
| 587 | ), |
| 588 | ), |
| 589 | ), |
| 590 | 'pager' => array( |
| 591 | 'none' => array( |
| 592 | 'label' => esc_html_x( 'none', 'slideshow navigation option', 'strong-testimonials' ), |
| 593 | 'args' => array(), |
| 594 | ), |
| 595 | 'full' => array( |
| 596 | 'label' => esc_html_x( 'full', 'slideshow navigation option', 'strong-testimonials' ), |
| 597 | //'class' => 'controls-pager-full', |
| 598 | 'class' => 'pager-type-full', |
| 599 | 'args' => array( |
| 600 | 'pager' => 1, |
| 601 | ), |
| 602 | ), |
| 603 | ), |
| 604 | ), |
| 605 | |
| 606 | 'slideshow_nav_style' => array( |
| 607 | 'controls' => array( |
| 608 | 'buttons' => array( |
| 609 | 'label' => esc_html_x( 'buttons 1', 'slideshow navigation option', 'strong-testimonials' ), |
| 610 | 'class' => 'controls-style-buttons', |
| 611 | 'args' => array( |
| 612 | 'startText' => '', |
| 613 | 'stopText' => '', |
| 614 | 'prevText' => '', |
| 615 | 'nextText' => '', |
| 616 | ), |
| 617 | ), |
| 618 | 'buttons2' => array( |
| 619 | 'label' => esc_html_x( 'buttons 2', 'slideshow navigation option', 'strong-testimonials' ), |
| 620 | 'class' => 'controls-style-buttons2', |
| 621 | 'args' => array( |
| 622 | 'startText' => '', |
| 623 | 'stopText' => '', |
| 624 | 'prevText' => '', |
| 625 | 'nextText' => '', |
| 626 | ), |
| 627 | ), |
| 628 | 'buttons3' => array( |
| 629 | 'label' => esc_html_x( 'buttons 3', 'slideshow navigation option', 'strong-testimonials' ), |
| 630 | 'class' => 'controls-style-buttons3', |
| 631 | 'args' => array( |
| 632 | 'startText' => '', |
| 633 | 'stopText' => '', |
| 634 | 'prevText' => '', |
| 635 | 'nextText' => '', |
| 636 | ), |
| 637 | ), |
| 638 | 'text' => array( |
| 639 | 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ), |
| 640 | 'class' => 'controls-style-text', |
| 641 | 'args' => array( |
| 642 | 'startText' => esc_html_x( 'Play', 'slideshow control', 'strong-testimonials' ), |
| 643 | 'stopText' => esc_html_x( 'Pause', 'slideshow control', 'strong-testimonials' ), |
| 644 | 'prevText' => esc_html_x( 'Previous', 'slideshow_control', 'strong-testimonials' ), |
| 645 | 'nextText' => esc_html_x( 'Next', 'slideshow_control', 'strong-testimonials' ), |
| 646 | ), |
| 647 | ), |
| 648 | ), |
| 649 | 'pager' => array( |
| 650 | 'buttons' => array( |
| 651 | 'label' => esc_html_x( 'buttons', 'slideshow navigation option', 'strong-testimonials' ), |
| 652 | 'class' => 'pager-style-buttons', |
| 653 | 'args' => array( |
| 654 | 'buildPager' => 'icons', |
| 655 | 'simpleSetPager' => 1, |
| 656 | ), |
| 657 | ), |
| 658 | 'text' => array( |
| 659 | 'label' => esc_html_x( 'text', 'slideshow navigation option', 'strong-testimonials' ), |
| 660 | 'class' => 'pager-style-text', |
| 661 | 'args' => array( |
| 662 | 'buildPager' => null, |
| 663 | 'simpleSetText' => 1, |
| 664 | ), |
| 665 | ), |
| 666 | ), |
| 667 | ), |
| 668 | |
| 669 | // Position is shared by Controls and Pagination. |
| 670 | 'slideshow_nav_position' => array( |
| 671 | 'inside' => esc_html_x( 'inside', 'slideshow navigation option', 'strong-testimonials' ), |
| 672 | 'outside' => esc_html_x( 'outside', 'slideshow navigation option', 'strong-testimonials' ), |
| 673 | ), |
| 674 | ); |
| 675 | |
| 676 | return apply_filters( 'wpmtst_view_options', $default_view_options ); |
| 677 | } |
| 678 | |
| 679 | /** |
| 680 | * Default view configuration. |
| 681 | * |
| 682 | * @since 1.21.0 |
| 683 | * |
| 684 | * @return array |
| 685 | */ |
| 686 | public static function get_default_view() { |
| 687 | $default_view = array( |
| 688 | 'background' => array( |
| 689 | 'color' => '', |
| 690 | 'type' => '', |
| 691 | 'preset' => '', |
| 692 | 'gradient1' => '', |
| 693 | 'gradient2' => '', |
| 694 | ), |
| 695 | 'category' => 'all', |
| 696 | 'class' => '', |
| 697 | 'client_section' => array( |
| 698 | 0 => array( |
| 699 | 'field' => 'client_name', |
| 700 | 'type' => 'text', |
| 701 | 'before' => '', |
| 702 | 'class' => 'testimonial-name', |
| 703 | ), |
| 704 | 1 => array( |
| 705 | 'field' => 'company_name', |
| 706 | 'type' => 'link', |
| 707 | 'before' => '', |
| 708 | 'url' => 'company_website', |
| 709 | 'class' => 'testimonial-company', |
| 710 | 'new_tab' => true, |
| 711 | ), |
| 712 | ), |
| 713 | 'column_count' => 2, |
| 714 | 'container_class' => '', |
| 715 | 'container_data' => '', |
| 716 | 'content' => 'entire', |
| 717 | 'count' => -1, |
| 718 | 'divi_builder' => 0, |
| 719 | 'excerpt_length' => 55, |
| 720 | 'font-color' => array( |
| 721 | 'color' => '', |
| 722 | 'type' => '', |
| 723 | ), |
| 724 | 'form_ajax' => 0, |
| 725 | 'form_id' => 1, |
| 726 | 'gravatar' => 'no', |
| 727 | 'initials_font_size' => '42', |
| 728 | 'initials_font_color' => '#000000', |
| 729 | 'initials_bg_color' => '#ffffff', |
| 730 | 'id' => '', |
| 731 | 'layout' => '', |
| 732 | 'lightbox' => '', |
| 733 | 'lightbox_class' => '', |
| 734 | 'mode' => 'display', |
| 735 | 'more_full_post' => false, |
| 736 | 'more_post' => true, |
| 737 | 'more_post_ellipsis' => true, |
| 738 | 'more_post_text' => esc_html_x( 'Read more', 'link', 'strong-testimonials' ), |
| 739 | 'more_post_text_inline' => false, |
| 740 | 'more_post_in_place' => false, |
| 741 | 'less_post' => false, |
| 742 | 'less_post_text' => esc_html__( 'Show less', 'strong-testimonials' ), |
| 743 | 'more_page' => false, |
| 744 | 'more_page_hook' => 'wpmtst_view_footer', |
| 745 | 'more_page_id' => 0, |
| 746 | 'more_page_text' => esc_html_x( 'Read more testimonials', 'link', 'strong-testimonials' ), |
| 747 | 'note' => '', |
| 748 | 'order' => 'oldest', |
| 749 | 'page' => '', |
| 750 | 'pagination' => false, |
| 751 | 'pagination_settings' => array( |
| 752 | 'type' => 'simple', |
| 753 | 'nav' => 'after', |
| 754 | 'per_page' => 5, |
| 755 | 'show_all' => 0, |
| 756 | 'end_size' => 1, |
| 757 | 'mid_size' => 2, |
| 758 | 'prev_next' => 1, |
| 759 | 'prev_text' => esc_html__( '« Previous', 'strong-testimonials' ), |
| 760 | 'next_text' => esc_html__( 'Next »', 'strong-testimonials' ), |
| 761 | 'before_page_number' => '', |
| 762 | 'after_page_number' => '', |
| 763 | ), |
| 764 | 'slideshow_settings' => array( |
| 765 | 'type' => 'show_single', // or show_multiple |
| 766 | 'show_single' => array( |
| 767 | 'max_slides' => 1, |
| 768 | 'move_slides' => 1, |
| 769 | 'margin' => 1, |
| 770 | ), |
| 771 | 'breakpoints' => array( |
| 772 | 'desktop' => array( |
| 773 | 'description' => 'Desktop', |
| 774 | 'width' => 1200, |
| 775 | 'max_slides' => 2, |
| 776 | 'move_slides' => 1, |
| 777 | 'margin' => 20, |
| 778 | ), |
| 779 | 'large' => array( |
| 780 | 'description' => 'Large', |
| 781 | 'width' => 1024, |
| 782 | 'max_slides' => 2, |
| 783 | 'move_slides' => 1, |
| 784 | 'margin' => 20, |
| 785 | ), |
| 786 | 'medium' => array( |
| 787 | 'description' => 'Medium', |
| 788 | 'width' => 640, |
| 789 | 'max_slides' => 1, |
| 790 | 'move_slides' => 1, |
| 791 | 'margin' => 10, |
| 792 | ), |
| 793 | 'small' => array( |
| 794 | 'description' => 'Small', |
| 795 | 'width' => 480, |
| 796 | 'max_slides' => 1, |
| 797 | 'move_slides' => 1, |
| 798 | 'margin' => 1, |
| 799 | ), |
| 800 | ), |
| 801 | 'effect' => 'fade', |
| 802 | 'speed' => 1, |
| 803 | 'pause' => 8, |
| 804 | 'auto_start' => true, |
| 805 | 'continuous_sliding' => false, |
| 806 | 'auto_hover' => true, |
| 807 | 'adapt_height' => true, |
| 808 | 'adapt_height_speed' => .5, |
| 809 | 'stretch' => 0, |
| 810 | 'stop_auto_on_click' => true, |
| 811 | 'controls_type' => 'none', |
| 812 | 'controls_style' => 'buttons', |
| 813 | 'pager_type' => 'none', |
| 814 | 'pager_style' => 'buttons', |
| 815 | 'nav_position' => 'inside', |
| 816 | ), |
| 817 | 'template' => 'default', |
| 818 | 'form_template' => 'default-form', |
| 819 | 'template_settings' => array(), |
| 820 | 'thumbnail' => true, |
| 821 | 'thumbnail_size' => 'thumbnail', |
| 822 | 'thumbnail_height' => null, |
| 823 | 'thumbnail_width' => null, |
| 824 | 'title' => true, |
| 825 | 'title_link' => 'none', |
| 826 | 'use_default_length' => true, |
| 827 | 'use_default_more' => false, |
| 828 | 'view' => '', |
| 829 | ); |
| 830 | ksort( $default_view ); |
| 831 | |
| 832 | return $default_view; |
| 833 | } |
| 834 | |
| 835 | /** |
| 836 | * Compatibility options. |
| 837 | * |
| 838 | * @since 2.28.0 |
| 839 | * @since 2.31.0 controller |
| 840 | * @since 2.31.0 lazyload |
| 841 | * @return array |
| 842 | */ |
| 843 | public static function get_compat_options() { |
| 844 | $options = array( |
| 845 | 'page_loading' => '', // (blank) | general | advanced |
| 846 | 'prerender' => 'current', // current | all | none |
| 847 | 'ajax' => array( |
| 848 | 'method' => '', // (blank) | universal | observer | event | script |
| 849 | 'universal_timer' => 0.5, |
| 850 | 'observer_timer' => 0.5, |
| 851 | 'container_id' => 'page', // = what we listen to (try page > content > primary) |
| 852 | 'addednode_id' => 'content', // = what we listen for |
| 853 | 'event' => '', |
| 854 | 'script' => '', |
| 855 | ), |
| 856 | 'controller' => array( |
| 857 | 'initialize_on' => 'documentReady', // or windowLoad |
| 858 | ), |
| 859 | 'lazyload' => array( |
| 860 | 'enabled' => '', |
| 861 | 'classes' => array( // may be multiple pairs |
| 862 | array( |
| 863 | 'start' => '', |
| 864 | 'finish' => '', |
| 865 | ), |
| 866 | ), |
| 867 | ), |
| 868 | 'random_js' => false, |
| 869 | ); |
| 870 | |
| 871 | return $options; |
| 872 | } |
| 873 | } |
| 874 |