r34400 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r34399‎ | r34400 | r34401 >
Date:21:05, 7 May 2008
Author:brion
Status:old
Tags:
Comment:
Revert r34398 for now; near-duplicate of existing tag seems a bit odd to me
Modified paths:
  • /trunk/extensions/Cite/Cite.i18n.php (modified) (history)
  • /trunk/extensions/Cite/Cite.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Cite/Cite.i18n.php
@@ -67,7 +67,6 @@
6868 # Although I could just use # instead of <li> above and nothing here that
6969 # will break on input that contains linebreaks
7070 'cite_references_prefix' => '<ol class="references">',
71 - 'cite_references_prefix_a' => '<ol type="a" class="references">',
7271 'cite_references_suffix' => '</ol>',
7372 );
7473
Index: trunk/extensions/Cite/Cite.php
@@ -67,7 +67,7 @@
6868 * </code>
6969 *
7070 * This works because:
71 - * * PHP's datastructures are guaranteed to be returned in the
 71+ * * PHP's datastructures are guarenteed to be returned in the
7272 * order that things are inserted into them (unless you mess
7373 * with that)
7474 * * User supplied keys can't be integers, therefore avoiding
@@ -82,7 +82,7 @@
8383 *
8484 * @var int
8585 */
86 - static $mOutCnt = 0;
 86+ var $mOutCnt = 0;
8787 var $mGroupCnt = array();
8888
8989 /**
@@ -92,7 +92,7 @@
9393 *
9494 * @var int
9595 */
96 - static $mInCnt = 0;
 96+ var $mInCnt = 0;
9797
9898 /**
9999 * The backlinks, in order, to pass as $3 to
@@ -282,9 +282,9 @@
283283 if ( $key === null ) {
284284 // No key
285285 //$this->mRefs[$group][] = $str;
286 - $this->mRefs[$group][] = array('count'=>-1, 'text'=>$str, 'key'=>++self::$mOutCnt);
 286+ $this->mRefs[$group][] = array('count'=>-1, 'text'=>$str, 'key'=>++$this->mOutCnt);
287287
288 - return $this->linkRef( $group, self::$mInCnt++ );
 288+ return $this->linkRef( $group, $this->mInCnt++ );
289289 } else if ( is_string( $key ) ) {
290290 // Valid key
291291 if ( ! isset( $this->mRefs[$group][$key] ) || ! is_array( $this->mRefs[$group][$key] ) ) {
@@ -292,10 +292,10 @@
293293 $this->mRefs[$group][$key] = array(
294294 'text' => $str,
295295 'count' => 0,
296 - 'key' => ++self::$mOutCnt,
 296+ 'key' => ++$this->mOutCnt,
297297 'number' => ++$this->mGroupCnt[$group]
298298 );
299 - self::$mInCnt++;
 299+ $this->mInCnt++;
300300 return
301301 $this->linkRef(
302302 $group,
@@ -373,7 +373,7 @@
374374 *
375375 * @return string XHTML ready for output
376376 */
377 - function referencesFormat($group, $prefix='cite_references_prefix') {
 377+ function referencesFormat($group) {
378378 if (( count( $this->mRefs ) == 0 ) or (empty( $this->mRefs[$group] ) ))
379379 return '';
380380
@@ -383,7 +383,7 @@
384384 foreach ( $this->mRefs[$group] as $k => $v )
385385 $ent[] = $this->referencesFormatEntry( $k, $v );
386386
387 - $prefix = wfMsgForContentNoTrans( $prefix );
 387+ $prefix = wfMsgForContentNoTrans( 'cite_references_prefix' );
388388 $suffix = wfMsgForContentNoTrans( 'cite_references_suffix' );
389389 $content = implode( "\n", $ent );
390390
@@ -516,12 +516,6 @@
517517 }
518518 }
519519
520 - function refCounterString($counter) {
521 - global $wgContLang;
522 - return $wgContLang->formatNum($counter);
523 - }
524 -
525 -
526520 /**
527521 * Return an id for use in wikitext output based on a key and
528522 * optionally the number of it, used in <references>, not <ref>
@@ -570,18 +564,19 @@
571565 * @param int $count The index of the key, used for distinguishing
572566 * multiple occurances of the same key
573567 * @param int $label The label to use for the link, I want to
574 - * use the same label for all occurances of
 568+ * use the same label for all occourances of
575569 * the same named reference.
576570 * @return string
577571 */
578572 function linkRef( $group, $key, $count = null, $label = null, $subkey = '' ) {
 573+ global $wgContLang;
579574 return
580575 $this->parse(
581576 wfMsgForContentNoTrans(
582577 'cite_reference_link',
583578 $this->refKey( $key, $count ),
584579 $this->referencesKey( $key . $subkey ),
585 - (($group == CITE_DEFAULT_GROUP)?'':"$group ").$this->refCounterString( is_null( $label ) ? ++$this->mGroupCnt[$group] : $label )
 580+ (($group == CITE_DEFAULT_GROUP)?'':"$group ").$wgContLang->formatNum( is_null( $label ) ? ++$this->mGroupCnt[$group] : $label )
586581 )
587582 );
588583 }
@@ -685,8 +680,8 @@
686681 */
687682 function clearState() {
688683 $this->mGroupCnt = array();
689 - self::$mOutCnt = -1;
690 - self::$mInCnt = 0;
 684+ $this->mOutCnt = -1;
 685+ $this->mInCnt = 0;
691686 $this->mRefs = array();
692687
693688 return true;
@@ -737,51 +732,7 @@
738733 /**#@-*/
739734 }
740735
741 -
742 -
743 - class Note extends Cite
744 - {
745 -
746 - /**
747 - * Constructor
748 - */
749 - function Note() {
750 - $this->setHooks();
751 - }
752 -
753 - /**
754 - * Initialize the parser hooks
755 - */
756 - function setHooks() {
757 - global $wgParser, $wgHooks;
758 -
759 - $wgParser->setHook( 'note' , array( &$this, 'ref' ) );
760 - $wgParser->setHook( 'footnotes' , array( &$this, 'references' ) );
761 -
762 - $wgHooks['ParserClearState'][] = array( &$this, 'clearState' );
763 - }
764 -
765 - function refCounterString($counter) {
766 - return $this->referencesFormatEntryAlternateBacklinkLabel( $counter-1 );
767 - }
768 -
769 -
770 - /**
771 - * Make output to be returned from the references() function
772 - *
773 - * @return string XHTML ready for output
774 - */
775 - function referencesFormat($group, $prefix='cite_references_prefix_a') {
776 - return parent::referencesFormat($group, $prefix);
777 -}
778 -
779 - }
780 -
781 -
782 -
783 -
784736 new Cite;
785 - new Note;
786737 }
787738
788739 /**#@-*/

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r34398add parallel note/footnotes tags for alphabetic footnotes, which incidently a...sanbeg20:57, 7 May 2008

Status & tagging log