Index: trunk/extensions/EducationProgram/includes/EPLogFormatter.php |
— | — | @@ -0,0 +1,42 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +/** |
| 5 | + * Class for logging changes to objects managed by the Education Program extension. |
| 6 | + * |
| 7 | + * @since 0.1 |
| 8 | + * |
| 9 | + * @file EPLogFormatter.php |
| 10 | + * @ingroup EducationProgram |
| 11 | + * |
| 12 | + * @licence GNU GPL v3 or later |
| 13 | + * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
| 14 | + */ |
| 15 | +class EPLogFormatter extends LogFormatter { |
| 16 | + |
| 17 | + /** |
| 18 | + * (non-PHPdoc) |
| 19 | + * @see LogFormatter::makePageLink() |
| 20 | + * |
| 21 | + * @since 0.1 |
| 22 | + * |
| 23 | + * This is overriden to change the link text to only include the name of the object, |
| 24 | + * rather then the full name of it's page. |
| 25 | + */ |
| 26 | + protected function makePageLink( Title $title = null, $parameters = array() ) { |
| 27 | + if ( !$title instanceof Title ) { |
| 28 | + throw new MWException( "Expected title, got null" ); |
| 29 | + } |
| 30 | + |
| 31 | + $text = explode( '/', $title->getText(), 2 ); |
| 32 | + $text = $text[count( $text ) - 1]; |
| 33 | + |
| 34 | + if ( !$this->plaintext ) { |
| 35 | + $link = Linker::link( $title, htmlspecialchars( $text ), array(), $parameters ); |
| 36 | + } else { |
| 37 | + |
| 38 | + $link = '[[' . $title->getPrefixedText() . '|' . $text . ']]'; |
| 39 | + } |
| 40 | + return $link; |
| 41 | + } |
| 42 | + |
| 43 | +} |
Property changes on: trunk/extensions/EducationProgram/includes/EPLogFormatter.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 44 | + native |
Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -63,6 +63,7 @@ |
64 | 64 | $wgAutoloadClasses['EPCourse'] = dirname( __FILE__ ) . '/includes/EPCourse.php'; |
65 | 65 | $wgAutoloadClasses['EPCoursePager'] = dirname( __FILE__ ) . '/includes/EPCoursePager.php'; |
66 | 66 | $wgAutoloadClasses['EPDBObject'] = dirname( __FILE__ ) . '/includes/EPDBObject.php'; |
| 67 | +$wgAutoloadClasses['EPLogFormatter'] = dirname( __FILE__ ) . '/includes/EPLogFormatter.php'; |
67 | 68 | $wgAutoloadClasses['EPMentor'] = dirname( __FILE__ ) . '/includes/EPMentor.php'; |
68 | 69 | $wgAutoloadClasses['EPMentorPager'] = dirname( __FILE__ ) . '/includes/EPMentorPager.php'; |
69 | 70 | $wgAutoloadClasses['EPOrg'] = dirname( __FILE__ ) . '/includes/EPOrg.php'; |
— | — | @@ -153,13 +154,13 @@ |
154 | 155 | $wgLogTypes[] = 'ambassador'; |
155 | 156 | $wgLogTypes[] = 'instructor'; |
156 | 157 | |
157 | | -if ( array_key_exists( 'LogFormatter', $wgAutoloadClasses ) ) { |
158 | | - $wgLogActionsHandlers['institution/*'] = 'LogFormatter'; |
159 | | - $wgLogActionsHandlers['course/*'] = 'LogFormatter'; |
160 | | - $wgLogActionsHandlers['term/*'] = 'LogFormatter'; |
161 | | - $wgLogActionsHandlers['student/*'] = 'LogFormatter'; |
162 | | - $wgLogActionsHandlers['ambassador/*'] = 'LogFormatter'; |
163 | | - $wgLogActionsHandlers['instructor/*'] = 'LogFormatter'; |
| 158 | +if ( array_key_exists( 'LogFormatter', $wgAutoloadLocalClasses ) ) { |
| 159 | + $wgLogActionsHandlers['institution/*'] = 'EPLogFormatter'; |
| 160 | + $wgLogActionsHandlers['course/*'] = 'EPLogFormatter'; |
| 161 | + $wgLogActionsHandlers['term/*'] = 'EPLogFormatter'; |
| 162 | + $wgLogActionsHandlers['student/*'] = 'EPLogFormatter'; |
| 163 | + $wgLogActionsHandlers['ambassador/*'] = 'EPLogFormatter'; |
| 164 | + $wgLogActionsHandlers['instructor/*'] = 'EPLogFormatter'; |
164 | 165 | } |
165 | 166 | else { |
166 | 167 | // Compatibility with MediaWiki 1.18. |