r87437 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87436‎ | r87437 | r87438 >
Date:19:20, 4 May 2011
Author:svip
Status:deferred (Comments)
Tags:
Comment:
Forgot two classes. :S
Modified paths:
  • /trunk/extensions/TemplateAdventures/Templates/CitationStyleChicago.php (added) (history)
  • /trunk/extensions/TemplateAdventures/Templates/CitationStyleWiki.php (added) (history)

Diff [purge]

Index: trunk/extensions/TemplateAdventures/Templates/CitationStyleChicago.php
@@ -0,0 +1,12 @@
 2+<?php
 3+
 4+class CitationStyleChicago extends Citation {
 5+
 6+ /**
 7+ * Our construct function.
 8+ */
 9+ public function __construct( $parser, $frame, $args ) {
 10+ parent::__construct($parser, $frame, $args);
 11+ }
 12+
 13+}
Index: trunk/extensions/TemplateAdventures/Templates/CitationStyleWiki.php
@@ -0,0 +1,487 @@
 2+<?php
 3+
 4+/**
 5+ * Class for the style Wikipedia uses.
 6+ */
 7+
 8+class CitationStyleWiki extends Citation {
 9+
 10+ /**
 11+ * Our construct function.
 12+ */
 13+ public function __construct( $parser, $frame, $args ) {
 14+ parent::__construct($parser, $frame, $args);
 15+ }
 16+
 17+ /**
 18+ * Our rendition
 19+ */
 20+ public function render() {
 21+ # authors
 22+ if ( count( $this->dAuthors ) > 1 ) {
 23+ # remember element 0 is always set
 24+ $authorArea = $this->createWriterSection (
 25+ $this->dAuthors,
 26+ $this->dAuthorLinks,
 27+ $this->dAuthorTruncate );
 28+ if ( $this->notNull ( $this->dCoAuthors ) )
 29+ $authorArea = wfMsg ( 'ta-citecoauthors',
 30+ $authorArea,
 31+ $this->getSeparator( 'author' ),
 32+ $this->dCoAuthors );
 33+ if ( $this->notNull ( $this->dDate )
 34+ || $this->notNull ( $this->dYear ) ) {
 35+ $authorArea = wfMsg ( 'ta-citeauthordate',
 36+ $authorArea,
 37+ $this->notNull ( $this->dDate ) ? $this->dDate : $this->dYear );
 38+ if ( $this->notNull ( $this->dYearNote ) )
 39+ $authorArea = wfMsg ( 'ta-citeauthoryearnote',
 40+ $authorArea,
 41+ $this->dYearNote );
 42+ }
 43+ $this->addSection ( $authorArea, array ( 'writer', 'author' ) );
 44+ # editors
 45+ } elseif ( count ( $this->dEditors ) > 1 ) {
 46+ # remember element 0 is always set
 47+ $editorArea = $this->createWriterSection (
 48+ $this->dEditors,
 49+ $this->dEditorLinks,
 50+ $this->dEditorTruncate );
 51+ if ( count ( $this->dEditors ) > 2 )
 52+ $editorArea = wfMsg ( 'ta-citeeditorsplural', $editorArea );
 53+ else
 54+ $editorArea = wfMsg ( 'ta-citeeditorssingular', $editorArea );
 55+ $editorArea .= $this->getSeparator ( 'section' );
 56+ if ( $this->notNull ( $this->dDate )
 57+ || $this->notNull ( $this->dYear ) ) {
 58+ $editorArea = wfMsg ( 'ta-citeauthordate',
 59+ $editorArea,
 60+ $this->notNull ( $this->dDate ) ? $this->dDate : $this->dYear );
 61+ if ( $this->notNull ( $this->dYearNote ) )
 62+ $editorArea .= wfMsg ( 'ta-citeauthoryearnote',
 63+ $editorArea, $this->dYearNote );
 64+ }
 65+ $this->addSection ( $editorArea, array ( 'writer', 'editor' ) );
 66+ }
 67+ # included work title
 68+ if ( $this->notNull( $this->dWorkTitle['includedwork'] )
 69+ && ( $this->notNull( $this->dPeriodical['name'] )
 70+ || $this->notNull( $this->dWorkTitle['transitalic'] )
 71+ || $this->notNull( $this->dWorkTitle['transtitle'] ) ) ) {
 72+ # let's get the url
 73+ if ( $this->notNull ( $this->dWorkLink['includedwork'] ) ) {
 74+ $url = $this->dWorkLink['includedwork'];
 75+ } else {
 76+ if ( $this->notNull ( $this->dWorkLink['url'] ) ) {
 77+ $url = $this->dWorkLink['url'];
 78+ } else {
 79+ # some explain to me what exactly the following is supposed to mean:
 80+ # <!-- Only link URL if to a free full text - as at PubMedCentral (PMC)-->
 81+ # |{{#ifexpr:{{#time: U}} > {{#time: U | {{{Embargo|2001-10-10}}} }}
 82+ if ( $this->notNull ( $this->dPubMed['pmc'] ) ) {
 83+ $url = wfMsg ( 'ta-citepubmed-url', $this->dPubMed['pmc'] );
 84+ }
 85+ }
 86+ }
 87+ # and now the title
 88+ if ( $this->notNull ( $this->dPeriodical['name'] ) ) {
 89+ $tmp = $this->clean( $this->dWorkTitle['includedwork'] );
 90+ $title = wfMsg ( 'ta-citeincludedworktitle', $tmp );
 91+ } else {
 92+ $tmp = ( $this->notNull ( $this->dWorkTitle['includedwork'] )
 93+ ? $this->dWorkTitle['includedwork']
 94+ : '' );
 95+ if ( $this->dWorkTitle['transtitle'] ) {
 96+ if ( $tmp != '' )
 97+ $tmp .= ' ';
 98+ $tmp .= wfMsg( 'ta-citetranstitle-render', $this->dWorkTitle['transtitle'] );
 99+ }
 100+ $title = $tmp;
 101+ }
 102+ $this->addSection ( $this->makeLink ( $url, $title ),
 103+ array ( 'title', 'includedlink' ) );
 104+ } else if ( $this->notNull ( $this->dWorkTitle['title'] ) ) {
 105+ # if only the title is set, assume url is the URL of the title
 106+ $url = $this->dWorkLink['url'];
 107+ if ( $this->notNull ( $this->dWorkTitle['transtitle'] ) ) {
 108+ $title = wfMsg ( 'ta-citetitletrans',
 109+ $this->dWorkTitle['title'],
 110+ $this->dWorkTitle['transtitle'] );
 111+ if ( $this->notNull ( $this->dLanguage ) ) {
 112+ $this->addSection ( wfMsg ( 'ta-citeinlanguage',
 113+ $this->makeLink ( $url, $title ), $this->dLanguage ),
 114+ array ( 'title', 'transtitle', 'language' ) );
 115+ } else {
 116+ $this->addSection ( $this->makeLink ( $url, $title ),
 117+ array ( 'title', 'transtitle' ) );
 118+ }
 119+ } else {
 120+ $title = $this->dWorkTitle['title'];
 121+ $this->addSection ( $this->makeLink ( $url, $title ),
 122+ array ( 'title' ) );
 123+ }
 124+ $urlDisplayed = true;
 125+ } else if ( $this->citeType == 'book'
 126+ && $this->notNull ( $this->dBook['title'] ) ) {
 127+ $this->addSection ( wfMsg ( 'ta-citebooktitle', $this->dBook['title'] ),
 128+ array ( 'title', 'book' ) );
 129+ }
 130+ # place, but only if different from publication place.
 131+ if ( $this->notNull ( $this->dPlace )
 132+ && (
 133+ !$this->notNull ( $this->dPublication['place'] )
 134+ || $this->dPlace != $this->dPublication['place']
 135+ ) && (
 136+ $this->isTagInSections ( 'writer' )
 137+ || $this->notNull ( $this->dWorkTitle['includedwork'] )
 138+ ) && ( !in_array ( $this->citeType, array ( 'news', 'book' ) ) )
 139+ ) {
 140+ if ( $this->notNull ( $this->dPublisher )
 141+ && ( $this->citeType != 'news' ) ) {
 142+ $this->addSection ( wfMsg ( 'ta-citeplacepublisher',
 143+ $this->dPlace, $this->dPublisher ),
 144+ array ( 'place', 'publisher' ) );
 145+ } else {
 146+ $this->addSection ( wfMsg ( 'ta-citewrittenat', $this->dPlace ),
 147+ array ( 'place' ) );
 148+ }
 149+ }
 150+ if ( ( $this->citeType == 'news' )
 151+ && $this->notNull ( $this->dPublisher ) ) {
 152+ if ( $this->notNull ( $this->dPlace ) ) {
 153+ $this->addSection ( wfMsg ( 'ta-citenewspublisherplace',
 154+ $this->dPublisher, $this->dPlace ),
 155+ array ( 'publisher', 'place', 'news' ) );
 156+ } else {
 157+ $this->addSection ( wfMsg ( 'ta-citenewspublisher',
 158+ $this->dPublisher ),
 159+ array ( 'publisher', 'news' ) );
 160+ }
 161+ }
 162+ if ( ( $this->citeType == 'journal' )
 163+ && $this->notNull ( $this->dJournal['title'] ) ) {
 164+ if ( $this->notNull ( $this->dJournal['page'] ) ) {
 165+ $this->addSection ( wfMsg ( 'ta-citejournalpage',
 166+ $this->dJournal['title'],
 167+ $this->dJournal['page'] ),
 168+ array ( 'journal', 'page' ) );
 169+ } else {
 170+ $this->addSection ( wfMsg ( 'ta-citejournal',
 171+ $this->dJournal['title'] ),
 172+ array ( 'journal' ) );
 173+ }
 174+ }
 175+ if ( ( $this->citeType == 'book' )
 176+ && $this->notNull ( $this->dPublisher ) ) {
 177+ if ( $this->notNull ( $this->dPlace ) ) {
 178+ $this->addSection ( wfMsg ( 'ta-citebookpubplace',
 179+ $this->dPlace, $this->dPublisher ),
 180+ array ( 'publisher', 'place', 'book' ) );
 181+ } else {
 182+ $this->addSection ( wfMsg ( 'ta-citebookpublisher',
 183+ $this->dPublisher ),
 184+ array ( 'publisher', 'book' ) );
 185+ }
 186+ if ( $this->notNull ( $this->dBook['page'] ) ) {
 187+ $this->addSection ( wfMsg ( 'ta-citebookpage',
 188+ $this->dBook['page'] ),
 189+ array ( 'page', 'book' ) );
 190+ }
 191+ }
 192+ # editor of complication... eerrr...
 193+ # TODO: we'll do this later...
 194+
 195+ # periodicals
 196+ if ( $this->notNull ( $this->dPeriodical['name'] ) ) {
 197+ $perArea = '';
 198+ if ( $this->notNull ( $this->dOther ) )
 199+ $perArea .= wfMsg ( 'ta-citeother', $this->dOther );
 200+ # make the link!
 201+ if ( $this->notNull ( $this->dWorkTitle['title'] ) || $this->notNull ( $this->dWorkTitle['transtitle'] ) ) {
 202+ # let's get the url
 203+ if ( $this->notNull ( $this->dWorkTitle['includedwork'] ) ) {
 204+ if ( $this->notNull ( $this->dWorkLink['includedwork'] ) ) {
 205+ if ( $this->notNull ( $this->dWorkLink['url'] ) ) {
 206+ $url = $this->dWorkLink['url'];
 207+ } else {
 208+ # some explain to me what exactly the following is supposed to mean:
 209+ # <!-- Only link URL if to a free full text - as at PubMedCentral (PMC)-->
 210+ # |{{#ifexpr:{{#time: U}} > {{#time: U | {{{Embargo|2001-10-10}}} }}
 211+ if ( $this->dPubMed['pmc'] != null ) {
 212+ $url = wfMsg ( 'ta-citepubmed-url', $this->dPubMed['pmc'] );
 213+ }
 214+ }
 215+ }
 216+ } else {
 217+ if ( $this->notNull ( $this->dWorkLink['url'] ) ) {
 218+ $url = $this->dWorkLink['url'];
 219+ } else {
 220+ # some explain to me what exactly the following is supposed to mean:
 221+ # <!-- Only link URL if to a free full text - as at PubMedCentral (PMC)-->
 222+ # |{{#ifexpr:{{#time: U}} > {{#time: U | {{{Embargo|2001-10-10}}} }}
 223+ if ( $this->dPubMed['pmc'] != null ) {
 224+ $url = wfMsg ( 'ta-citepubmed-url', $this->dPubMed['pmc'] );
 225+ }
 226+ }
 227+ }
 228+ # and now the title
 229+ $tmp = $this->notNull ( $this->dWorkTitle['title'] )
 230+ ? $this->dWorkTitle['title']
 231+ : '';
 232+ if ( $this->notNull ( $this->dWorkTitle['transtitle'] ) ) {
 233+ if ( $tmp != '' )
 234+ $tmp .= ' ';
 235+ $tmp .= wfMsg ( 'ta-citetranstitle-render', $this->dWorkTitle['transtitle'] );
 236+ }
 237+ $title = "\"$tmp\"";
 238+ $perArea .= $this->makeLink ( $url, $title ) . $this->getSeparator ( 'section' );
 239+ if ( $this->notNull ( $this->dWorkTitle['note'] ) ) {
 240+ $perArea .= $this->dWorkTitle['note'] . $this->getSeparator ( 'section' );
 241+ }
 242+ }
 243+ $this->addSection ( $perArea,
 244+ array ( 'title', 'periodicals' ) );
 245+ }
 246+ # language
 247+ if ( $this->notNull ( $this->dLanguage )
 248+ && !$this->isTagInSections ( 'language' ) ) {
 249+ $this->addSection ( wfMsg ( 'ta-citeinlanguage',
 250+ $this->dLanguage ), array ( 'language' ) );
 251+ }
 252+ # format
 253+ if ( $this->notNull ( $this->dFormat ) ) {
 254+ $this->addSection ( wfMsg ( 'ta-citeformatrender',
 255+ $this->dFormat ), array ( 'format' ) );
 256+ }
 257+ # more periodical!
 258+ if ( $this->notNull ( $this->dPeriodical['name'] ) ) {
 259+ $newPerArea = '';
 260+ $newPerArea .= wfMsg ( 'ta-citeperiodical', $this->clean ( $this->dPeriodical['name'] ) );
 261+ if ( $this->notNull ( $this->dSeries ) ) {
 262+ $newPerArea .= wfMsg ( 'ta-citeseries', $this->dSeries );
 263+ }
 264+ if ( $this->notNull ( $this->dPublication['place'] ) ) {
 265+ if ( $this->notNull ( $this->dPublisher ) ) {
 266+ $newPerArea .= wfMsg ( 'ta-citepublicationplaceandpublisher', $this->dPublication['place'], $this->dPublisher );
 267+ } else {
 268+ $newPerArea .= wfMsg ( 'ta-citepublicationplace', $this->dPublication['place'] );
 269+ }
 270+ }
 271+ if ( $this->notNull ( $this->dVolume ) ) {
 272+ $newPerArea .= wfMsg ( 'ta-citevolumerender', $this->dVolume );
 273+ if ( $this->notNUll ( $this->dIssue ) ) {
 274+ $newPerArea .= wfMsg ( 'ta-citeissuerender', $this->dIssue );
 275+ }
 276+ } else {
 277+ if ( $this->notNUll ( $this->dIssue ) ) {
 278+ $newPerArea .= wfMsg ( 'ta-citeissuerender', $this->dIssue );
 279+ }
 280+ }
 281+ if ( $this->notNull ( $this->dAt ) ) {
 282+ $newPerArea .= wfMsg ( 'ta-citeatrender', $this->dAt );
 283+ }
 284+ $newPerArea .= $this->getSeparator ( 'section' );
 285+ # now we get to the title! Exciting stuff!
 286+ if ( $this->notNull ( $this->dWorkTitle['title'] )
 287+ || $this->notNull ( $this->dWorkTitle['transitalic'] ) ) {
 288+ # let's get the url
 289+ if ( $this->notNull ( $this->dWorkTitle['includedwork'] ) ) {
 290+ if ( $this->notNull ( $this->dWorkLink['includedwork'] ) ) {
 291+ if ( $this->notNull ( $this->dWorkLink['url'] ) ) {
 292+ $url = $this->dWorkLink['url'];
 293+ } else {
 294+ # some explain to me what exactly the following is supposed to mean:
 295+ # <!-- Only link URL if to a free full text - as at PubMedCentral (PMC)-->
 296+ # |{{#ifexpr:{{#time: U}} > {{#time: U | {{{Embargo|2001-10-10}}} }}
 297+ if ( $this->dPubMed['pmc'] != null ) {
 298+ $url = wfMsg ( 'ta-citepubmed-url', $this->dPubMed['pmc'] );
 299+ }
 300+ }
 301+ }
 302+ } else {
 303+ if ( $this->notNull ( $this->dWorkLink['url'] ) ) {
 304+ $url = $this->dWorkLink['url'];
 305+ } else {
 306+ # some explain to me what exactly the following is supposed to mean:
 307+ # <!-- Only link URL if to a free full text - as at PubMedCentral (PMC)-->
 308+ # |{{#ifexpr:{{#time: U}} > {{#time: U | {{{Embargo|2001-10-10}}} }}
 309+ if ( $this->dPubMed['pmc'] != null ) {
 310+ $url = wfMsg ( 'ta-citepubmed-url', $this->dPubMed['pmc'] );
 311+ }
 312+ }
 313+ }
 314+ # and now the title
 315+ $tmp = $this->notNull ( $this->dWorkTitle['title'] )
 316+ ? $this->dWorkTitle['title']
 317+ : '';
 318+ if ( $this->notNull ( $this->dWorkTitle['transitalic'] ) ) {
 319+ if ( $tmp != '' )
 320+ $tmp .= ' ';
 321+ $tmp .= wfMsg ( 'ta-citetranstitle-render', $this->dWorkTitle['transitalic'] );
 322+ }
 323+ $tmp = $this->clean ( $tmp );
 324+ $title = wfMsg ( 'ta-citeperiodicaltitle', $tmp );
 325+ $newPerArea .= $this->makeLink ( $url, $title );
 326+ }
 327+ # may change this into some if () statements though,
 328+ # it is easier to write this, but it also means that all of the
 329+ # second input is actually evaluated, even if it contains nothing.
 330+ $newPerArea .= $this->addNotNull ( $this->dWorkTitle['type'],
 331+ wfMsg ( 'ta-citetitletyperender', $this->dWorkTitle['type'] ) . $this->getSeparator ( 'section' ) );
 332+ $newPerArea .= $this->addNotNull ( $this->dSeries,
 333+ wfMsg ( 'ta-citeseries', $this->dSeries ) . $this->getSeparator ( 'section' ) );
 334+ $newPerArea .= $this->addNotNull ( $this->dVolume,
 335+ wfMsg ( 'ta-citevolumerender', $this->dVolume ) . $this->getSeparator ( 'section' ) );
 336+ $newPerArea .= $this->addNotNull ( $this->dOther,
 337+ wfMsg ( 'ta-citeother', $this->dOther ) );
 338+ $newPerArea .= $this->addNotNull ( $this->dEdition,
 339+ wfMsg ( 'ta-citeeditionrender', $this->dEdition ) . $this->getSeparator ( 'section' ) );
 340+ $newPerArea .= $this->addNotNull ( $this->dPublication['place'],
 341+ wfMsg ( 'ta-citepublication', $this->dPublication['place'] ) );
 342+ if ( $this->notNull ( $this->dPublisher ) ) {
 343+ if ( $this->notNull ( $this->dPublication['place'] ) ) {
 344+ $sep = $this->getSeparator ( 'beforepublication' );
 345+ } else {
 346+ $sep = $this->getSeparator ( 'section' );
 347+ }
 348+ $newPerArea .= $sep . wfMsg ( 'ta-citepublisherrender', $this->dPublisher );
 349+ }
 350+ $this->addSection ( $newPerArea,
 351+ array ( 'details', 'periodicals' ) );
 352+ }
 353+ # date if no author/editor
 354+ if ( !$this->isTagInSections ( 'writer' ) ) {
 355+ if ( $this->notNull ( $this->dDate )
 356+ || $this->notNull ( $this->dYear ) ) {
 357+ $tmp = wfMsg ( 'ta-citealonedate', $this->notNull ( $this->dDate ) ? $this->dDate : $this->dYear );
 358+ if ( $this->notNull ( $this->dYearNote ) ) {
 359+ $tmp = wfMsg ( 'ta-citeauthoryearnote', $tmp, $this->dYearNote );
 360+ }
 361+ $this->addSection ( $tmp, array ( 'date' ) );
 362+ }
 363+ }
 364+ # publication date
 365+ if ( $this->notNull ( $this->dPublication['date'] )
 366+ && $this->dPublication['date'] != $this->dDate ) {
 367+ if ( $this->isTagInSections ( 'editor' ) ) {
 368+ if ( $this->isTagInSections ( 'author' ) ) {
 369+ $this->addSection ( wfMsg ( 'ta-citepublicationdate', $this->dPublication['date'] ),
 370+ array ( 'publication date', 'periodical' ) );
 371+ } else {
 372+ $this->addSection ( wfMsg ( 'ta-citepublished', $this->dPublication['date'] ),
 373+ array ( 'publication date', 'periodical' ) );
 374+ }
 375+ } else {
 376+ if ( $this->notNull ( $this->dPeriodical['name'] ) ) {
 377+ $this->addSection ( wfMsg ( 'ta-citepublicationdate', $this->dPublication['date'] ),
 378+ array ( 'publication date', 'periodical' ) );
 379+ } else {
 380+ $this->addSection ( wfMsg ( 'ta-citepublished', $this->dPublication['date'] ),
 381+ array ( 'publication date', 'periodical' ) );
 382+ }
 383+ }
 384+ }
 385+ # page within included work
 386+ if ( !$this->notNull ( $this->dPeriodical['name'] )
 387+ && $this->notNull ( $this->dAt ) ) {
 388+ $this->addSection ( wfMsg ( 'ta-citeatseparated', $this->dAt ),
 389+ array ( 'at', 'periodical' ) );
 390+ }
 391+ # doi
 392+ # TODO: I'll do this code later:
 393+ # {{{Sep|,}}}&#32;{{citation/identifier |identifier=doi |input1={{{DOI|}}} |input2={{{DoiBroken|}}} }}
 394+
 395+ # misc identifier
 396+ # TODO: Awh shit.
 397+ # #if: {{{ID|}}}
 398+ # |{{
 399+ # #if: {{{Surname1|}}}{{{EditorSurname1|}}}{{{IncludedWorkTitle|}}}{{{Periodical|}}}{{{Title|}}}{{{TransItalic|}}}
 400+ # |{{{Sep|,}}}&#32;{{{ID}}}
 401+ # |{{{ID}}}
 402+ # }}
 403+ # isbn
 404+ if ( $this->citeType == 'book'
 405+ && $this->notNull ( $this->dBook['isbn'] ) ) {
 406+ $this->addSection ( wfMsg ( 'ta-citebookisbn',
 407+ $this->dBook['isbn'],
 408+ $this->createDisplayISBN ( $this->dBook['isbn'] ) ),
 409+ array ( 'isbn' ) );
 410+ }
 411+
 412+ # more identifiers:
 413+ # TODO: Do all this crap.
 414+ /*
 415+<!--============ ISSN ============-->
 416+ #if: {{{ISSN|}}}
 417+ |{{{Sep|,}}}&#32;{{citation/identifier |identifier=issn |input1={{{ISSN|}}} }}
 418+}}{{
 419+<!--============ OCLC ============-->
 420+ #if: {{{OCLC|}}}
 421+ |{{{Sep|,}}}&#32;{{citation/identifier |identifier=oclc |input1={{{OCLC|}}} }}
 422+}}{{
 423+<!--============ PMID ============-->
 424+ #if: {{{PMID|}}}
 425+ |{{{Sep|,}}}&#32;{{citation/identifier |identifier=pmid |input1={{{PMID|}}} }}
 426+}}{{
 427+<!--============ PMC ============-->
 428+ #if: {{{PMC|}}}
 429+ |{{
 430+ #if: {{{URL|}}}
 431+ |{{{Sep|,}}}&#32;{{citation/identifier |identifier=pmc |input1={{{PMC|}}} }}
 432+ |{{only in print|{{{Sep|,}}}&#32;{{citation/identifier |identifier=pmc |input1={{{PMC|}}} }} }}<!--Should only display by default in print-->
 433+ }}
 434+}}{{
 435+<!--============ BIBCODE ============-->
 436+ #if: {{{Bibcode|}}}
 437+ |{{{Sep|,}}}&#32;{{citation/identifier |identifier=bibcode |input1={{{Bibcode|}}} }}
 438+}}
 439+ */
 440+
 441+ # archive data, etc.
 442+ # TODO: Yeah, O_O
 443+
 444+ # URL and accessdate
 445+ if ( $this->notNull ( $this->dWorkLink['url'] )
 446+ || $this->notNull ( $this->dWorkLink['includedwork'] ) ) {
 447+ if ( !$urlDisplayed ) {
 448+ if ( $this->notNull ( $this->dWorkTitle['title'] )
 449+ || $this->notNull ( $this->dWorkTitle['includedwork'] )
 450+ || $this->notNull ( $this->dWorkTitle['transtitle'] ) ) {
 451+ $this->addSection ( $this->printOnly (
 452+ ( $this->notNull ( $this->dWorkLink['includedwork'] )
 453+ ? $this->dWorkLink['includedwork']
 454+ : $this->dWorkLink['url'] ) ),
 455+ array ( 'url', 'printonly' ),
 456+ false );
 457+ } else {
 458+ $this->addSection (
 459+ ( $this->notNull ( $this->dWorkLink['includedwork'] )
 460+ ? $this->dWorkLink['includedwork']
 461+ : $this->dWorkLink['url'] ),
 462+ array ( 'url' ),
 463+ false );
 464+ }
 465+ }
 466+ if ( $this->notNull ( $this->dAccessDate ) ) {
 467+ if ( $this->getSeparator ( 'section', false ) == '.' )
 468+ $tmp = wfMsg ( 'ta-citeretrievedupper', $this->dAccessDate );
 469+ else
 470+ $tmp = wfMsg ( 'ta-citeretrievedlower', $this->dAccessDate );
 471+ $this->addSection ( wfMsg ( 'ta-citeaccessdatespan', $tmp ),
 472+ array ( 'accessdate' ) );
 473+ }
 474+ }
 475+
 476+ # layman stuff
 477+ # TODO
 478+
 479+ # quote
 480+ # TODO
 481+
 482+ # some other shit nobody cares about.
 483+ # COinS? waaaaat
 484+ # TODO
 485+
 486+ $this->finishRender();
 487+ }
 488+}

Comments

#Comment by Nikerabbit (talk | contribs)   07:28, 5 May 2011

Should not use a space before parenthesis in function calls like func( ... ). And the code looks very repetitive. What is the point of constructors that do nothing?

#Comment by Svippong (talk | contribs)   07:39, 5 May 2011

I committed mainly to get something committed before I went to bed. Mainly because it was stable and a major change to the code. But I hope that the constructors are supposed to do something (otherwise I will just remove them). That and the fact I programmed too much Python lately, that requires constructors even if they just call their parent class.

#Comment by Nikerabbit (talk | contribs)   07:44, 5 May 2011

I've noticed that the number of "end of (work) day commits" has increased lately. Usually the diffs are so large I don't bother reading them. And yes PHP doesn't need to define constructors just to call the parent constructor.

Status & tagging log