public static function replace_shortcodes($html, $form, $title = false, $description = false, $values = array()) { foreach (array('form_name' => $title, 'form_description' => $description, 'entry_key' => true) as $code => $show) { if ($code == 'form_name') { $replace_with = $form->name; } else { if ($code == 'form_description') { $replace_with = FrmAppHelper::use_wpautop($form->description); } else { if ($code == 'entry_key' && isset($_GET) && isset($_GET['entry'])) { $replace_with = FrmAppHelper::simple_get('entry'); } else { $replace_with = ''; } } } FrmFieldsHelper::remove_inline_conditions(FrmAppHelper::is_true($show) && $replace_with != '', $code, $replace_with, $html); } //replace [form_key] $html = str_replace('[form_key]', $form->form_key, $html); //replace [frmurl] $html = str_replace('[frmurl]', FrmFieldsHelper::dynamic_default_values('frmurl'), $html); if (strpos($html, '[button_label]')) { add_filter('frm_submit_button', 'FrmFormsHelper::submit_button_label', 1); $replace_with = apply_filters('frm_submit_button', $title, $form); $html = str_replace('[button_label]', $replace_with, $html); } $html = apply_filters('frm_form_replace_shortcodes', $html, $form, $values); if (strpos($html, '[if back_button]')) { $html = preg_replace('/(\\[if\\s+back_button\\])(.*?)(\\[\\/if\\s+back_button\\])/mis', '', $html); } if (strpos($html, '[if save_draft]')) { $html = preg_replace('/(\\[if\\s+save_draft\\])(.*?)(\\[\\/if\\s+save_draft\\])/mis', '', $html); } if (apply_filters('frm_do_html_shortcodes', true)) { $html = do_shortcode($html); } return $html; }
/** * @since 2.0.8 */ private static function do_get_shortcode($args) { // reverse compatability for [get-param] shortcode if (strpos($args['matches'][0][$args['match_key']], '[get-') === 0) { $val = $args['matches'][0][$args['match_key']]; $param = str_replace('[get-', '', $val); if (preg_match('/\\[/s', $param)) { $val .= ']'; } else { $param = trim($param, ']'); //only if is doesn't create an imbalanced [] } $new_value = FrmFieldsHelper::process_get_shortcode(compact('param'), $args['allow_array']); } else { $atts = $args['shortcode_atts']; $atts['prev_val'] = $args['prev_val']; $new_value = FrmFieldsHelper::dynamic_default_values($args['shortcode'], $atts, $args['allow_array']); } return $new_value; }