. */ require_once('ShortCodeLoader.php'); require_once('CFDBPostDataConverter.php'); class CFDBShortCodeSavePostData extends ShortCodeLoader { const FORM_TITLE_FIELD = 'form_title'; /** * @param $atts array of short code attributes * @param $content string not used * @return void */ public function handleShortcode($atts, $content = null) { $atts = $this->decodeAttributes($atts); if (is_array($atts) && isset($atts['debug']) && $atts['debug'] == 'true') { echo '
';
            print_r($_POST);
            echo "\n";
            print_r($_FILES);
            echo '
'; } $converter = new CFDBPostDataConverter(); $converter->addExcludeField(self::FORM_TITLE_FIELD); $title = isset($_POST[self::FORM_TITLE_FIELD]) ? $_POST[self::FORM_TITLE_FIELD] : 'Untitled'; $data = $converter->convert($title); if ($data) { // Call hook to submit data do_action_ref_array('cfdb_submit', array(&$data)); } } }