jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/402873 )
Change subject: Moved hook function to new class, DTHooks ...................................................................... Moved hook function to new class, DTHooks Change-Id: Ie5b5d19b64c10b3907826f5d27ffbf2326aaa3fb --- M DataTransfer.php A includes/DT_Hooks.php 2 files changed, 29 insertions(+), 22 deletions(-) Approvals: Yaron Koren: Looks good to me, approved jenkins-bot: Verified diff --git a/DataTransfer.php b/DataTransfer.php index a502a5a..7bfc9e5 100644 --- a/DataTransfer.php +++ b/DataTransfer.php @@ -49,7 +49,8 @@ $wgAutoloadClasses['DTXMLParser'] = $dtgIP . '/includes/DT_XMLParser.php'; $wgAutoloadClasses['DTWikiTemplate'] = $dtgIP . '/includes/DT_WikiTemplate.php'; $wgAutoloadClasses['DTWikiPage'] = $dtgIP . '/includes/DT_WikiPage.php'; -$wgHooks['AdminLinks'][] = 'dtfAddToAdminLinks'; +$wgAutoloadClasses['DTHooks'] = $dtgIP . '/includes/DT_Hooks.php'; +$wgHooks['AdminLinks'][] = 'DTHooks::addToAdminLinks'; // Only enable spreadsheet import if PHPExcel is installed. if ( class_exists( 'PHPExcel' )) { @@ -76,24 +77,4 @@ $wgDataTransferViewXMLParseFreeText = true; $wgMessagesDirs['DataTransfer'] = __DIR__ . '/i18n'; -$wgExtensionMessagesFiles['DataTransferAlias'] = $dtgIP . '/languages/DT_Aliases.php'; - -/**********************************************/ -/***** other global helpers *****/ -/**********************************************/ - -/** - * Add links to the 'AdminLinks' special page, defined by the Admin Links - * extension - */ -function dtfAddToAdminLinks( $admin_links_tree ) { - $import_export_section = $admin_links_tree->getSection( wfMessage( 'adminlinks_importexport' )->text() ); - $main_row = $import_export_section->getRow( 'main' ); - $main_row->addItem( ALItem::newFromSpecialPage( 'ViewXML' ) ); - $main_row->addItem( ALItem::newFromSpecialPage( 'ImportXML' ) ); - $main_row->addItem( ALItem::newFromSpecialPage( 'ImportCSV' ) ); - if ( class_exists( 'PHPExcel' )) { - $main_row->addItem( ALItem::newFromSpecialPage( 'ImportSpreadsheet' ) ); - } - return true; -} +$wgExtensionMessagesFiles['DataTransferAlias'] = $dtgIP . '/languages/DT_Aliases.php'; \ No newline at end of file diff --git a/includes/DT_Hooks.php b/includes/DT_Hooks.php new file mode 100644 index 0000000..9599933 --- /dev/null +++ b/includes/DT_Hooks.php @@ -0,0 +1,26 @@ +<?php +/** + * Static functions called by various outside hooks. + * + * @author Yaron Koren + * @ingroup DataTransfer + */ +class DTHooks { + + /** + * Add links to the 'AdminLinks' special page, defined by the Admin Links + * extension + */ + public static function addToAdminLinks( $admin_links_tree ) { + $import_export_section = $admin_links_tree->getSection( wfMessage( 'adminlinks_importexport' )->text() ); + $main_row = $import_export_section->getRow( 'main' ); + $main_row->addItem( ALItem::newFromSpecialPage( 'ViewXML' ) ); + $main_row->addItem( ALItem::newFromSpecialPage( 'ImportXML' ) ); + $main_row->addItem( ALItem::newFromSpecialPage( 'ImportCSV' ) ); + if ( class_exists( 'PHPExcel' )) { + $main_row->addItem( ALItem::newFromSpecialPage( 'ImportSpreadsheet' ) ); + } + return true; + } + +} \ No newline at end of file -- To view, visit https://gerrit.wikimedia.org/r/402873 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ie5b5d19b64c10b3907826f5d27ffbf2326aaa3fb Gerrit-PatchSet: 2 Gerrit-Project: mediawiki/extensions/DataTransfer Gerrit-Branch: master Gerrit-Owner: Yaron Koren <yaro...@gmail.com> Gerrit-Reviewer: Yaron Koren <yaro...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits