PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.8.8.9
Advanced Custom Fields: Extended v0.8.8.9
0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / modules / forms-shortcode.php
acf-extended / includes / modules Last commit date
author.php 3 years ago autosync.php 3 years ago block-types.php 3 years ago dev-clean-meta.php 3 years ago dev-delete-meta.php 3 years ago dev.php 3 years ago forms-action-custom.php 3 years ago forms-action-email.php 3 years ago forms-action-post.php 3 years ago forms-action-redirect.php 3 years ago forms-action-term.php 3 years ago forms-action-user.php 3 years ago forms-cheatsheet.php 3 years ago forms-front.php 3 years ago forms-helpers.php 3 years ago forms-hooks.php 3 years ago forms-shortcode.php 3 years ago forms.php 3 years ago module.php 3 years ago options-pages.php 3 years ago options.class.php 3 years ago options.php 3 years ago post-types.php 3 years ago single-meta.php 3 years ago taxonomies.php 3 years ago ui-attachment.php 3 years ago ui-settings.php 3 years ago ui-term.php 3 years ago ui-user.php 3 years ago ui.php 3 years ago
forms-shortcode.php
98 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_form_shortcode')):
8
9 class acfe_form_shortcode{
10
11 function __construct(){
12
13 // shortcode
14 add_shortcode('acfe_form', array($this, 'render_shortcode'));
15
16 // ajax
17 add_action('wp_ajax_acfe/form/shortcode', array($this, 'ajax_shortcode'), 20);
18 add_action('wp_ajax_nopriv_acfe/form/shortcode', array($this, 'ajax_shortcode'), 20);
19
20 }
21
22 function render_shortcode($atts){
23
24 // bail early on gutenberg screen
25 // avoid bug with media modal css in wp back-end
26 if(acfe_is_block_editor()){
27 return false;
28 }
29
30 // attributes array
31 $atts = acf_get_array($atts);
32
33 // allow array atts
34 foreach(array_keys($atts) as $key){
35
36 // sub array compatibility
37 foreach(array('form_attributes_', 'fields_attributes_') as $allowed){
38
39 // check found allowed
40 if(!acfe_starts_with($key, $allowed)) continue;
41
42 // explode
43 $explode = explode($allowed, $key);
44 $sub_key = $explode[1];
45
46 // set attributes array
47 $atts[ substr($allowed, 0, -1) ][ $sub_key ] = $atts[ $key ];
48 unset($atts[ $key ]);
49
50 }
51
52 }
53
54 // render
55 ob_start();
56
57 acfe_form($atts);
58
59 return ob_get_clean();
60
61 }
62
63 function ajax_shortcode(){
64
65 // validate
66 if(!acf_verify_ajax()) die;
67
68 // vars
69 $args = acf_maybe_get_POST('args', array());
70 $title = '';
71
72 // loop thru args
73 foreach(array('name', 'id') as $key){
74
75 if(!acf_maybe_get($args, $key)) continue;
76
77 $title = acf_maybe_get($args, $key);
78 break;
79
80 }
81
82 $title = is_numeric($title) ? "#{$title}" : "\"{$title}\"";
83
84 ob_start();
85 ?>
86 <div style="border:1px solid #ddd; padding:100px 25px; background:#f8f8f8; text-align:center;">
87 <?php _e('Form', 'acfe'); ?> <?php echo $title; ?>
88 </div>
89 <?php echo ob_get_clean();
90 die;
91
92 }
93
94 }
95
96 acf_new_instance('acfe_form_shortcode');
97
98 endif;