Index: trunk/extensions/LastModified/LastModified.i18n.php |
— | — | @@ -36,6 +36,7 @@ |
37 | 37 | 'lastmodified-label-months' => 'months', |
38 | 38 | 'lastmodified-label-years' => 'years', |
39 | 39 | 'lastmodified-options' => 'Options', |
| 40 | + 'lastmodified-display' => 'Display:', |
40 | 41 | 'lastmodified-display-range-value' => 'Display range value:', |
41 | 42 | 'lastmodified-title-tag' => 'View the revision history for this article.', |
42 | 43 | 'lastmodified-seconds' => 'Last updated $1 seconds ago', |
Index: trunk/extensions/LastModified/modules/lastmodified.js |
— | — | @@ -24,9 +24,9 @@ |
25 | 25 | */ |
26 | 26 | function extensionsLastModified() { |
27 | 27 | |
28 | | - // Get the last-edit value |
29 | | - var lastEdited = extensionsLastModifiedGetMetaLastEdited(); |
30 | | - //console.log( 'lastEdited: ' + lastEdited ); |
| 28 | + // Get the last-modified-timestamp value |
| 29 | + var lastModifiedTimestamp = extensionsLastModifiedGetMetaLastModifiedTimestamp(); |
| 30 | + //console.log( 'lastModifiedTimestamp: ' + lastModifiedTimestamp ); |
31 | 31 | |
32 | 32 | // Get the last-modified-range value |
33 | 33 | var displayRange = extensionsLastModifiedGetMetaRange(); |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | //console.log( 'nowStamp: ' + nowStamp ); |
39 | 39 | |
40 | 40 | // Get the difference in the time from when it was last edited. |
41 | | - var modifiedDifference = nowStamp - lastEdited; |
| 41 | + var modifiedDifference = nowStamp - lastModifiedTimestamp; |
42 | 42 | //console.log( 'modifiedDifference: ' + modifiedDifference ); |
43 | 43 | |
44 | 44 | // Get the last modified text |
— | — | @@ -87,14 +87,14 @@ |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | | - * Get the value from the meta tag: last-edited |
| 91 | + * Get the value from the meta tag: last-modified-timestamp |
92 | 92 | * |
93 | 93 | * @return integer |
94 | 94 | */ |
95 | | -function extensionsLastModifiedGetMetaLastEdited() { |
| 95 | +function extensionsLastModifiedGetMetaLastModifiedTimestamp() { |
96 | 96 | |
97 | 97 | // Fetch the meta tag |
98 | | - var metaTag = $("meta[name=last-edited]"); |
| 98 | + var metaTag = $("meta[name=last-modified-timestamp]"); |
99 | 99 | |
100 | 100 | // If the tag was found, parse the value |
101 | 101 | if ( metaTag ) { |
— | — | @@ -137,7 +137,7 @@ |
138 | 138 | |
139 | 139 | // minutes |
140 | 140 | if ( displayRange <= 4 ) { |
141 | | - lastEdit = parseInt( modifiedDifference / 60 ); |
| 141 | + myLastEdit = parseInt( modifiedDifference / 60 ); |
142 | 142 | message = ( mw.msg( 'lastmodified-minutes', myLastEdit ) ); |
143 | 143 | } |
144 | 144 | |
Index: trunk/extensions/LastModified/LastModified.php |
— | — | @@ -84,9 +84,10 @@ |
85 | 85 | $title = $context->getTitle(); |
86 | 86 | $article = Article::newFromTitle( $title, $context ); |
87 | 87 | |
88 | | - if ( $article && ( method_exists( $title, 'getNamespace' ) && $title->getNamespace() == 0 ) ) { |
89 | | - $timestamp = $article->getTimestamp(); |
90 | | - $out->addMeta( 'last-edited', wfTimestamp ( TS_UNIX, $timestamp ) ); |
| 88 | + if ( $article && ( ( $title instanceof Title ) && $title->getNamespace() == 0 ) ) { |
| 89 | + $timestamp = wfTimestamp ( TS_UNIX, $article->getTimestamp() ); |
| 90 | + $out->addMeta( 'http:last-modified', date( 'r', $timestamp ) ); |
| 91 | + $out->addMeta( 'last-modified-timestamp', $timestamp ); |
91 | 92 | $out->addMeta( 'last-modified-range', $wgLastModifiedRange ); |
92 | 93 | $out->addModules( 'last.modified' ); |
93 | 94 | } |
Index: trunk/extensions/LastModified/SpecialLastModified.php |
— | — | @@ -49,7 +49,7 @@ |
50 | 50 | $out->addHTML( wfMsg( 'lastmodified-display-range-value' ) . ' ' . $wgLastModifiedRange ); |
51 | 51 | $out->addHTML( Xml::closeElement( 'p' ) ); |
52 | 52 | |
53 | | - $rangeMessage = '<p>Display: '; |
| 53 | + $rangeMessage = wfMsg( 'lastmodified-display' ) . ' '; |
54 | 54 | $rangeMessageDatetime = ''; |
55 | 55 | |
56 | 56 | $displayRange = array( |
— | — | @@ -62,7 +62,6 @@ |
63 | 63 | ); |
64 | 64 | |
65 | 65 | // Display seconds |
66 | | - |
67 | 66 | foreach ( $displayRange as $key => $value ) { |
68 | 67 | |
69 | 68 | // Check to see which values to display. |
— | — | @@ -77,8 +76,9 @@ |
78 | 77 | } |
79 | 78 | |
80 | 79 | $rangeMessage .= $rangeMessageDatetime; |
81 | | - $rangeMessage .= '</p>'; |
82 | 80 | |
| 81 | + $out->addHTML( Xml::openElement( 'p' ) ); |
83 | 82 | $out->addHTML( $rangeMessage ); |
| 83 | + $out->addHTML( Xml::closeElement( 'p' ) ); |
84 | 84 | } |
85 | 85 | } |