Index: trunk/extensions/SemanticForms/includes/SF_TemplateField.inc |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | var $possible_values; |
19 | 19 | var $is_list; |
20 | 20 | |
21 | | - function newWithValues($name, $label) { |
| 21 | + static function newWithValues($name, $label) { |
22 | 22 | $f = new SFTemplateField(); |
23 | 23 | $f->field_name = trim(str_replace('\\', '', $name)); |
24 | 24 | $f->label = trim(str_replace('\\', '', $label)); |
Index: trunk/extensions/SemanticForms/includes/SF_FormClasses.inc |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | var $form_name; |
13 | 13 | var $templates; |
14 | 14 | |
15 | | - function create($form_name, $templates) { |
| 15 | + static function create($form_name, $templates) { |
16 | 16 | $form = new SFForm(); |
17 | 17 | $form->form_name = ucfirst(str_replace('_', ' ', $form_name)); |
18 | 18 | $form->templates = $templates; |
— | — | @@ -151,7 +151,7 @@ |
152 | 152 | return $template_fields; |
153 | 153 | } |
154 | 154 | |
155 | | - function create($name, $label, $allow_multiple, $max_allowed = null) { |
| 155 | + static function create($name, $label, $allow_multiple, $max_allowed = null) { |
156 | 156 | $tif = new SFTemplateInForm(); |
157 | 157 | $tif->template_name = str_replace('_', ' ', $name); |
158 | 158 | $tif->fields = array(); |
— | — | @@ -239,7 +239,7 @@ |
240 | 240 | var $input_name; |
241 | 241 | var $is_disabled; |
242 | 242 | |
243 | | - function create($num, $template_field) { |
| 243 | + static function create($num, $template_field) { |
244 | 244 | $f = new SFFormTemplateField(); |
245 | 245 | $f->num = $num; |
246 | 246 | $f->template_field = $template_field; |
— | — | @@ -252,7 +252,7 @@ |
253 | 253 | return $f; |
254 | 254 | } |
255 | 255 | |
256 | | - function createFromDefinition($field_name, $input_name, $is_mandatory, $is_hidden, $is_uploadable, $possible_values, $is_disabled, $is_list, $input_type, $field_args, $all_fields, $strict_parsing) { |
| 256 | + static function createFromDefinition($field_name, $input_name, $is_mandatory, $is_hidden, $is_uploadable, $possible_values, $is_disabled, $is_list, $input_type, $field_args, $all_fields, $strict_parsing) { |
257 | 257 | // see if this field matches one of the fields defined for this template - |
258 | 258 | // if it is, use all available information about that field; if it's not, |
259 | 259 | // either include it in the form or not, depending on whether the |
Index: trunk/extensions/SemanticForms/includes/SF_ParserFunctions.php |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | |
93 | 93 | class SFParserFunctions { |
94 | 94 | |
95 | | - function registerFunctions( &$parser ) { |
| 95 | + static function registerFunctions( &$parser ) { |
96 | 96 | $parser->setFunctionHook('forminput', array('SFParserFunctions', 'renderFormInput')); |
97 | 97 | $parser->setFunctionHook('formlink', array('SFParserFunctions', 'renderFormLink')); |
98 | 98 | if( defined( get_class( $parser ) . '::SFH_OBJECT_ARGS' ) ) { |
— | — | @@ -104,7 +104,7 @@ |
105 | 105 | return true; |
106 | 106 | } |
107 | 107 | |
108 | | - function languageGetMagic( &$magicWords, $langCode = "en" ) { |
| 108 | + static function languageGetMagic( &$magicWords, $langCode = "en" ) { |
109 | 109 | switch ( $langCode ) { |
110 | 110 | default: |
111 | 111 | $magicWords['forminput'] = array ( 0, 'forminput' ); |
— | — | @@ -115,7 +115,7 @@ |
116 | 116 | return true; |
117 | 117 | } |
118 | 118 | |
119 | | - function renderFormLink (&$parser, $inFormName = '', $inLinkStr = '', $inLinkType='', $inQueryStr = '') { |
| 119 | + static function renderFormLink (&$parser, $inFormName = '', $inLinkStr = '', $inLinkType='', $inQueryStr = '') { |
120 | 120 | $ad = SpecialPage::getPage('AddData'); |
121 | 121 | $link_url = $ad->getTitle()->getLocalURL() . "/$inFormName"; |
122 | 122 | $link_url = str_replace(' ', '_', $link_url); |
— | — | @@ -133,7 +133,7 @@ |
134 | 134 | return $parser->insertStripItem($str, $parser->mStripState); |
135 | 135 | } |
136 | 136 | |
137 | | - function renderFormInput (&$parser, $inFormName = '', $inSize = '25', $inValue = '', $inButtonStr = '', $inQueryStr = '') { |
| 137 | + static function renderFormInput (&$parser, $inFormName = '', $inSize = '25', $inValue = '', $inButtonStr = '', $inQueryStr = '') { |
138 | 138 | $ap = SpecialPage::getPage('AddPage'); |
139 | 139 | $ap_url = $ap->getTitle()->getLocalURL(); |
140 | 140 | $str = <<<END |
— | — | @@ -172,7 +172,7 @@ |
173 | 173 | /** |
174 | 174 | * {{#arraymap:value|delimiter|var|formula|new_delimiter}} |
175 | 175 | */ |
176 | | - function renderArrayMap( &$parser, $value = '', $delimiter = ',', $var = 'x', $formula = 'x', $new_delimiter = ', ' ) { |
| 176 | + static function renderArrayMap( &$parser, $value = '', $delimiter = ',', $var = 'x', $formula = 'x', $new_delimiter = ', ' ) { |
177 | 177 | // let '\n' represent newlines - chances that anyone will |
178 | 178 | // actually need the '\n' literal are small |
179 | 179 | $delimiter = str_replace('\n', "\n", $delimiter); |
— | — | @@ -193,7 +193,7 @@ |
194 | 194 | * SFH_OBJ_ARGS |
195 | 195 | * {{#arraymap:value|delimiter|var|formula|new_delimiter}} |
196 | 196 | */ |
197 | | - function renderArrayMapObj( &$parser, $frame, $args ) { |
| 197 | + static function renderArrayMapObj( &$parser, $frame, $args ) { |
198 | 198 | # Set variables |
199 | 199 | $value = isset($args[0]) ? trim($frame->expand($args[0])) : ''; |
200 | 200 | $delimiter = isset($args[1]) ? trim($frame->expand($args[1])) : ','; |
— | — | @@ -221,7 +221,7 @@ |
222 | 222 | /** |
223 | 223 | * {{#arraymaptemplate:value|template|delimiter|new_delimiter}} |
224 | 224 | */ |
225 | | - function renderArrayMapTemplate( &$parser, $value = '', $template = '', $delimiter = ',', $new_delimiter = ', ' ) { |
| 225 | + static function renderArrayMapTemplate( &$parser, $value = '', $template = '', $delimiter = ',', $new_delimiter = ', ' ) { |
226 | 226 | # let '\n' represent newlines |
227 | 227 | $delimiter = str_replace('\n', "\n", $delimiter); |
228 | 228 | $values_array = explode($parser->mStripState->unstripNoWiki($delimiter), $value); |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | * SFH_OBJ_ARGS |
244 | 244 | * {{#arraymaptemplate:value|template|delimiter|new_delimiter}} |
245 | 245 | */ |
246 | | - function renderArrayMapTemplateObj( &$parser, $frame, $args ) { |
| 246 | + static function renderArrayMapTemplateObj( &$parser, $frame, $args ) { |
247 | 247 | # Set variables |
248 | 248 | $value = isset($args[0]) ? trim($frame->expand($args[0])) : ''; |
249 | 249 | $template = isset($args[1]) ? trim($frame->expand($args[1])) : ''; |
Index: trunk/extensions/SemanticForms/includes/SF_FormUtils.inc |
— | — | @@ -10,7 +10,7 @@ |
11 | 11 | |
12 | 12 | class SFFormUtils { |
13 | 13 | |
14 | | - function chooserJavascript() { |
| 14 | + static function chooserJavascript() { |
15 | 15 | $javascript_text = <<<END |
16 | 16 | <script type="text/javascript">/* <![CDATA[ */ |
17 | 17 | |
— | — | @@ -63,7 +63,7 @@ |
64 | 64 | return $javascript_text; |
65 | 65 | } |
66 | 66 | |
67 | | - function validationJavascript() { |
| 67 | + static function validationJavascript() { |
68 | 68 | global $sfgJSValidationCalls; |
69 | 69 | |
70 | 70 | $form_errors_header = wfMsg('sf_formerrors_header'); |
— | — | @@ -234,7 +234,7 @@ |
235 | 235 | return $javascript_text; |
236 | 236 | } |
237 | 237 | |
238 | | - function instancesJavascript($using_choosers) { |
| 238 | + static function instancesJavascript($using_choosers) { |
239 | 239 | $remove_text = wfMsg('sf_editdata_remove'); |
240 | 240 | $javascript_text =<<<END |
241 | 241 | |
— | — | @@ -314,7 +314,7 @@ |
315 | 315 | return $javascript_text; |
316 | 316 | } |
317 | 317 | |
318 | | - function autocompletionJavascript() { |
| 318 | + static function autocompletionJavascript() { |
319 | 319 | global $wgScriptPath; |
320 | 320 | |
321 | 321 | $javascript_text =<<<END |
— | — | @@ -386,7 +386,7 @@ |
387 | 387 | return $javascript_text; |
388 | 388 | } |
389 | 389 | |
390 | | - function hiddenFieldHTML($input_name, $cur_value) { |
| 390 | + static function hiddenFieldHTML($input_name, $cur_value) { |
391 | 391 | $text =<<<END |
392 | 392 | <input type="hidden" name="$input_name" value="$cur_value" /> |
393 | 393 | |
— | — | @@ -394,7 +394,7 @@ |
395 | 395 | return $text; |
396 | 396 | } |
397 | 397 | |
398 | | - function summaryInputHTML($is_disabled, $label = null) { |
| 398 | + static function summaryInputHTML($is_disabled, $label = null) { |
399 | 399 | global $sfgTabIndex; |
400 | 400 | |
401 | 401 | $sfgTabIndex++; |
— | — | @@ -409,7 +409,7 @@ |
410 | 410 | return $text; |
411 | 411 | } |
412 | 412 | |
413 | | - function minorEditInputHTML($is_disabled, $label = null) { |
| 413 | + static function minorEditInputHTML($is_disabled, $label = null) { |
414 | 414 | global $sfgTabIndex; |
415 | 415 | |
416 | 416 | $sfgTabIndex++; |
— | — | @@ -426,8 +426,8 @@ |
427 | 427 | return $text; |
428 | 428 | } |
429 | 429 | |
430 | | - function watchInputHTML($is_disabled, $label = null) { |
431 | | - global $sfgTabIndex, $wgUser; |
| 430 | + static function watchInputHTML($is_disabled, $label = null) { |
| 431 | + global $sfgTabIndex, $wgUser, $wgTitle; |
432 | 432 | |
433 | 433 | $sfgTabIndex++; |
434 | 434 | $checked_text = ""; |
— | — | @@ -437,10 +437,10 @@ |
438 | 438 | if ($wgUser->getOption('watchdefault')) { |
439 | 439 | # Watch all edits |
440 | 440 | $checked_text = "checked"; |
441 | | - } elseif ($wgUser->getOption('watchcreations') && !$this->mPageTitle->exists() ) { |
| 441 | + } elseif ($wgUser->getOption('watchcreations') && !$wgTitle->exists() ) { |
442 | 442 | # Watch creations |
443 | 443 | $checked_text = "checked"; |
444 | | - } elseif ($this->mPageTitle->userIsWatching()) { |
| 444 | + } elseif ($wgTitle->userIsWatching()) { |
445 | 445 | # Already watched |
446 | 446 | $checked_text = "checked"; |
447 | 447 | } |
— | — | @@ -456,7 +456,7 @@ |
457 | 457 | return $text; |
458 | 458 | } |
459 | 459 | |
460 | | - function saveButtonHTML($is_disabled, $label = null) { |
| 460 | + static function saveButtonHTML($is_disabled, $label = null) { |
461 | 461 | global $sfgTabIndex; |
462 | 462 | |
463 | 463 | $sfgTabIndex++; |
— | — | @@ -477,7 +477,7 @@ |
478 | 478 | return $text; |
479 | 479 | } |
480 | 480 | |
481 | | - function showPreviewButtonHTML($is_disabled, $label = null) { |
| 481 | + static function showPreviewButtonHTML($is_disabled, $label = null) { |
482 | 482 | global $sfgTabIndex; |
483 | 483 | |
484 | 484 | $sfgTabIndex++; |
— | — | @@ -498,7 +498,7 @@ |
499 | 499 | return $text; |
500 | 500 | } |
501 | 501 | |
502 | | - function showChangesButtonHTML($is_disabled, $label = null) { |
| 502 | + static function showChangesButtonHTML($is_disabled, $label = null) { |
503 | 503 | global $sfgTabIndex; |
504 | 504 | |
505 | 505 | $sfgTabIndex++; |
— | — | @@ -519,22 +519,22 @@ |
520 | 520 | return $text; |
521 | 521 | } |
522 | 522 | |
523 | | - function cancelLinkHTML($is_disabled, $label = null) { |
524 | | - global $wgUser; |
| 523 | + static function cancelLinkHTML($is_disabled, $label = null) { |
| 524 | + global $wgUser, $wgTitle; |
525 | 525 | |
526 | 526 | $sk = $wgUser->getSkin(); |
527 | 527 | if ($label == null) |
528 | 528 | $label = wfMsgExt('cancel', array('parseinline')); |
529 | | - if ($this->mPageTitle == null) |
| 529 | + if ($wgTitle == null) |
530 | 530 | $cancel = ''; |
531 | 531 | else |
532 | | - $cancel = $sk->makeKnownLink( $this->mPageTitle->getPrefixedText(), $label); |
| 532 | + $cancel = $sk->makeKnownLink( $wgTitle->getPrefixedText(), $label); |
533 | 533 | $text = " <span class='editHelp'>$cancel</span>\n"; |
534 | 534 | return $text; |
535 | 535 | } |
536 | 536 | |
537 | 537 | // Much of this function is based on MediaWiki's EditPage::showEditForm() |
538 | | - function formBottom($is_disabled) { |
| 538 | + static function formBottom($is_disabled) { |
539 | 539 | global $wgUser; |
540 | 540 | |
541 | 541 | $summary_text = SFFormUtils::summaryInputHTML($is_disabled); |
— | — | @@ -570,7 +570,7 @@ |
571 | 571 | } |
572 | 572 | |
573 | 573 | // based on MediaWiki's EditPage::getPreloadedText() |
574 | | - function getPreloadedText($preload) { |
| 574 | + static function getPreloadedText($preload) { |
575 | 575 | if ( $preload === '' ) { |
576 | 576 | return ''; |
577 | 577 | } else { |
— | — | @@ -589,7 +589,7 @@ |
590 | 590 | } |
591 | 591 | } |
592 | 592 | |
593 | | - function getMonthNames() { |
| 593 | + static function getMonthNames() { |
594 | 594 | return array( |
595 | 595 | wfMsgForContent('january'), |
596 | 596 | wfMsgForContent('february'), |
— | — | @@ -606,7 +606,7 @@ |
607 | 607 | ); |
608 | 608 | } |
609 | 609 | |
610 | | - function getShowFCKEditor() { |
| 610 | + static function getShowFCKEditor() { |
611 | 611 | global $wgUser; |
612 | 612 | |
613 | 613 | $showFCKEditor = 0; |
— | — | @@ -631,7 +631,7 @@ |
632 | 632 | return $showFCKEditor; |
633 | 633 | } |
634 | 634 | |
635 | | - function prepareTextForFCK($text) { |
| 635 | + static function prepareTextForFCK($text) { |
636 | 636 | global $wgTitle; |
637 | 637 | |
638 | 638 | $options = new FCKeditorParserOptions(); |
— | — | @@ -642,7 +642,7 @@ |
643 | 643 | return $text; |
644 | 644 | } |
645 | 645 | |
646 | | - function mainFCKJavascript($showFCKEditor) { |
| 646 | + static function mainFCKJavascript($showFCKEditor) { |
647 | 647 | global $wgUser, $wgScriptPath, $wgFCKEditorExtDir, $wgFCKEditorDir, $wgFCKEditorToolbarSet, $wgFCKEditorHeight; |
648 | 648 | |
649 | 649 | $newWinMsg = wfMsg('rich_editor_new_window'); |
— | — | @@ -869,7 +869,7 @@ |
870 | 870 | return $javascript_text; |
871 | 871 | } |
872 | 872 | |
873 | | - function FCKToggleJavascript() { |
| 873 | + static function FCKToggleJavascript() { |
874 | 874 | //add toggle link and handler |
875 | 875 | $javascript_text = <<<END |
876 | 876 | |
— | — | @@ -957,7 +957,7 @@ |
958 | 958 | return $javascript_text; |
959 | 959 | } |
960 | 960 | |
961 | | - function FCKPopupJavascript() { |
| 961 | + static function FCKPopupJavascript() { |
962 | 962 | $javascript_text = <<<END |
963 | 963 | |
964 | 964 | function FCKeditor_OpenPopup(jsID, textareaID) |
Index: trunk/extensions/SemanticForms/includes/SF_LinkUtils.inc |
— | — | @@ -56,7 +56,7 @@ |
57 | 57 | * Gets the default form specified, if any, for a specific page |
58 | 58 | * (which should be a category, property, or namespace page) |
59 | 59 | */ |
60 | | - function getDefaultForm($page_title, $page_namespace) { |
| 60 | + static function getDefaultForm($page_title, $page_namespace) { |
61 | 61 | if ($page_title == NULL) |
62 | 62 | return null; |
63 | 63 | |
— | — | @@ -108,7 +108,7 @@ |
109 | 109 | * Gets the alternate forms specified, if any, for a specific page |
110 | 110 | * (which should always be a property page) |
111 | 111 | */ |
112 | | - function getAlternateForms($page_title, $page_namespace) { |
| 112 | + static function getAlternateForms($page_title, $page_namespace) { |
113 | 113 | if ($page_title == NULL) |
114 | 114 | return array(); |
115 | 115 | |