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; }