about
7 years ago
css
7 years ago
img
8 years ago
js
7 years ago
menu
8 years ago
partials
7 years ago
scss
7 years ago
settings
7 years ago
admin-notices.php
8 years ago
admin.php
7 years ago
class-strong-testimonials-admin-category-list.php
8 years ago
class-strong-testimonials-admin-list.php
7 years ago
class-strong-testimonials-admin-scripts.php
8 years ago
class-strong-testimonials-defaults.php
7 years ago
class-strong-testimonials-help.php
8 years ago
class-strong-testimonials-list-table.php
7 years ago
class-strong-testimonials-page-shortcodes.php
7 years ago
class-strong-testimonials-post-editor.php
7 years ago
class-strong-testimonials-updater.php
7 years ago
class-strong-views-list-table.php
8 years ago
class-walker-strong-category-checklist.php
7 years ago
class-walker-strong-form-category-checklist.php
7 years ago
compat.php
8 years ago
custom-fields-ajax.php
8 years ago
custom-fields.php
7 years ago
form-preview.php
8 years ago
view-list-order.php
8 years ago
views-ajax.php
7 years ago
views-validate.php
7 years ago
views.php
7 years ago
views-ajax.php
120 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Views Ajax Functions |
| 4 | */ |
| 5 | |
| 6 | |
| 7 | /** |
| 8 | * Check for forced options. |
| 9 | * |
| 10 | * @since 1.25.0 |
| 11 | */ |
| 12 | function wpmtst_force_check() { |
| 13 | $atts = array( 'template' => $_REQUEST['template'] ); |
| 14 | $force = WPMST()->templates->get_template_config( $atts, 'force', false ); |
| 15 | if ( $force ) { |
| 16 | wp_send_json_success( (array) $force ); |
| 17 | } |
| 18 | wp_send_json_error(); |
| 19 | } |
| 20 | add_action( 'wp_ajax_wpmtst_force_check', 'wpmtst_force_check' ); |
| 21 | |
| 22 | |
| 23 | /** |
| 24 | * [Add New Field] Ajax receiver |
| 25 | * |
| 26 | * @since 1.21.0 |
| 27 | */ |
| 28 | function wpmtst_view_add_field_function() { |
| 29 | $new_key = (int) $_REQUEST['key']; |
| 30 | $empty_field = array( 'field' => '', 'type' => 'text', 'class' => '' ); |
| 31 | wpmtst_view_field_inputs( $new_key, $empty_field, true ); |
| 32 | wp_die(); |
| 33 | } |
| 34 | add_action( 'wp_ajax_wpmtst_view_add_field', 'wpmtst_view_add_field_function' ); |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * [Field Type: Link] Ajax receiver |
| 39 | * |
| 40 | * @since 1.21.0 |
| 41 | */ |
| 42 | function wpmtst_view_add_field_link_function() { |
| 43 | $key = (int) $_REQUEST['key']; |
| 44 | $field_name = $_REQUEST['fieldName']; |
| 45 | $type = $_REQUEST['fieldType']; |
| 46 | $empty_field = array( 'url' => '', 'link_text' => '', 'new_tab' => true ); |
| 47 | wpmtst_view_field_link( $key, $field_name, $type, $empty_field ); |
| 48 | wp_die(); |
| 49 | } |
| 50 | add_action( 'wp_ajax_wpmtst_view_add_field_link', 'wpmtst_view_add_field_link_function' ); |
| 51 | |
| 52 | |
| 53 | /** |
| 54 | * [Field name change] Ajax receiver |
| 55 | * |
| 56 | * @since 1.24.0 |
| 57 | */ |
| 58 | function wpmtst_view_get_label_function() { |
| 59 | $field = array( 'field' => $_REQUEST['name'] ); |
| 60 | $label = wpmtst_get_field_label( $field ); |
| 61 | echo $label; |
| 62 | wp_die(); |
| 63 | } |
| 64 | add_action( 'wp_ajax_wpmtst_view_get_label', 'wpmtst_view_get_label_function' ); |
| 65 | |
| 66 | |
| 67 | /** |
| 68 | * [Field Type: Date] Ajax receiver |
| 69 | * |
| 70 | * @since 1.21.0 |
| 71 | */ |
| 72 | function wpmtst_view_add_field_date_function() { |
| 73 | $key = (int) $_REQUEST['key']; |
| 74 | $empty_field = array( 'format' => '' ); |
| 75 | wpmtst_view_field_date( $key, $empty_field ); |
| 76 | wp_die(); |
| 77 | } |
| 78 | add_action( 'wp_ajax_wpmtst_view_add_field_date', 'wpmtst_view_add_field_date_function' ); |
| 79 | |
| 80 | |
| 81 | /** |
| 82 | * Fetch the view mode description. |
| 83 | * |
| 84 | * @since 2.22.0 |
| 85 | */ |
| 86 | function wpmtst_view_get_mode_description() { |
| 87 | $mode = $_REQUEST['mode']; |
| 88 | $options = get_option( 'wpmtst_view_options' ); |
| 89 | if ( isset( $options['mode'][ $mode ]['description'] ) ) { |
| 90 | echo $options['mode'][ $mode ]['description']; |
| 91 | } |
| 92 | wp_die(); |
| 93 | } |
| 94 | add_action( 'wp_ajax_wpmtst_view_get_mode_description', 'wpmtst_view_get_mode_description' ); |
| 95 | |
| 96 | |
| 97 | /** |
| 98 | * Get background color presets in View editor. |
| 99 | */ |
| 100 | function wpmtst_get_background_preset_colors() { |
| 101 | $preset = wpmtst_get_background_presets( $_REQUEST['key'] ); |
| 102 | echo json_encode( $preset ); |
| 103 | wp_die(); |
| 104 | } |
| 105 | add_action( 'wp_ajax_wpmtst_get_background_preset_colors', 'wpmtst_get_background_preset_colors' ); |
| 106 | |
| 107 | |
| 108 | /** |
| 109 | * [Restore Default Breakpoints] Ajax receiver. |
| 110 | * |
| 111 | * @since 2.32.2 |
| 112 | */ |
| 113 | function wpmtst_restore_default_breakpoints_function() { |
| 114 | $options = Strong_Testimonials_Defaults::get_default_view(); |
| 115 | $breakpoints = $options['slideshow_settings']['breakpoints']; |
| 116 | echo json_encode( $breakpoints ); |
| 117 | wp_die(); |
| 118 | } |
| 119 | add_action( 'wp_ajax_wpmtst_restore_default_breakpoints', 'wpmtst_restore_default_breakpoints_function' ); |
| 120 |