Index: trunk/extensions/SemanticForms/includes/SF_FormPrinter.inc |
— | — | @@ -124,8 +124,7 @@ |
125 | 125 | return false; |
126 | 126 | } |
127 | 127 | |
128 | | - |
129 | | - function formHTML($form_def, $form_submitted, $source_is_page, $existing_page_content = null, $page_title = null, $page_name_formula = null, $is_query = false, $embedded = false) { |
| 128 | + function formHTML($form_def, $form_id, $form_submitted, $source_is_page, $existing_page_content = null, $page_title = null, $page_name_formula = null, $is_query = false, $embedded = false) { |
130 | 129 | global $wgRequest, $wgUser, $wgParser; |
131 | 130 | global $sfgTabIndex; // used to represent the current tab index in the form |
132 | 131 | global $sfgFieldNum; // used for setting various HTML IDs |
— | — | @@ -219,7 +218,22 @@ |
220 | 219 | $wgParser->mStripState = new StripState(); |
221 | 220 | $wgParser->mOptions = new ParserOptions(); |
222 | 221 | $wgParser->mOptions->initialiseFromUser($wgUser); |
223 | | - $form_def = $wgParser->parse($form_def, $this->mPageTitle, $wgParser->mOptions)->getText(); |
| 222 | + |
| 223 | + // get the form definition from the cache, if we're using caching and it's |
| 224 | + // there |
| 225 | + $got_form_def_from_cache = false; |
| 226 | + global $sfgCacheFormDefinitions; |
| 227 | + if ($sfgCacheFormDefinitions) { |
| 228 | + $db =& wfGetDB( DB_MASTER ); |
| 229 | + $res = $db->select('page_props', 'pp_value', "pp_propname = 'formdefinition' AND pp_page = $form_id"); |
| 230 | + if ($res->numRows() > 0) { |
| 231 | + $form_def = $res->fetchObject()->pp_value; |
| 232 | + $got_form_def_from_cache = true; |
| 233 | + } |
| 234 | + } |
| 235 | + // otherwise, parse it |
| 236 | + if (! $got_form_def_from_cache) |
| 237 | + $form_def = $wgParser->parse($form_def, $this->mPageTitle, $wgParser->mOptions)->getText(); |
224 | 238 | $wgParser->mStripState = $old_strip_state; |
225 | 239 | |
226 | 240 | // turn form definition file into an array of sections, one for each |
— | — | @@ -1175,9 +1189,6 @@ |
1176 | 1190 | } |
1177 | 1191 | } else { |
1178 | 1192 | $showFCKEditor = 0; |
1179 | | - // for some reason, the following call was once necessary, but now |
1180 | | - // causes problems |
1181 | | - //$free_text = Sanitizer::safeEncodeAttribute($free_text); |
1182 | 1193 | } |
1183 | 1194 | // now that we have it, substitute free text into the form and page |
1184 | 1195 | $escaped_free_text = Sanitizer::safeEncodeAttribute( $free_text ); |