SamanthaNguyen has uploaded a new change for review. ( https://gerrit.wikimedia.org/r/365407 )
Change subject: Reorganize directory structure + file renaming ...................................................................... Reorganize directory structure + file renaming Bug: T160849 Change-Id: Idd058e9a66f0cc43d635b6a781db6832b2d4f7c4 --- M extension.json R includes/SiteScout.alias.php R includes/SiteScout.class.php A includes/SiteScoutHTML.class.php A includes/SiteScoutXML.class.php R includes/specials/SpecialSiteScout.php R includes/specials/SpecialSiteScoutUpdate.php 7 files changed, 144 insertions(+), 144 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SiteScout refs/changes/07/365407/1 diff --git a/extension.json b/extension.json index c9d1cb6..86e0747 100644 --- a/extension.json +++ b/extension.json @@ -1,6 +1,6 @@ { "name": "SiteScout", - "version": "2.0", + "version": "2.1.0", "author": [ "David Pean", "Jack Phoenix" @@ -19,14 +19,14 @@ ] }, "ExtensionMessagesFiles": { - "SiteScoutAliases": "SiteScout.alias.php" + "SiteScoutAliases": "includes/SiteScout.alias.php" }, "AutoloadClasses": { - "SiteScout": "SiteScoutClass.php", - "SiteScoutHTML": "SiteScoutClass.php", - "SiteScoutXML": "SiteScoutClass.php", - "SiteScoutPage": "SpecialSiteScout.php", - "SiteScoutUpdate": "SiteScout_Update.php" + "SiteScout": "includes/SiteScout.class.php", + "SiteScoutHTML": "includes/SiteScoutHTML.class.php", + "SiteScoutXML": "includes/SiteScoutXML.class.php", + "SiteScoutPage": "includes/specials/SpecialSiteScout.php", + "SiteScoutUpdate": "includes/specials/SiteScoutUpdate.php" }, "ResourceFileModulePaths": { "localBasePath": "", diff --git a/SiteScout.alias.php b/includes/SiteScout.alias.php similarity index 100% rename from SiteScout.alias.php rename to includes/SiteScout.alias.php diff --git a/SiteScoutClass.php b/includes/SiteScout.class.php similarity index 76% rename from SiteScoutClass.php rename to includes/SiteScout.class.php index 23d5327..a708646 100644 --- a/SiteScoutClass.php +++ b/includes/SiteScout.class.php @@ -610,140 +610,3 @@ } } } - -class SiteScoutHTML extends SiteScout { - - function displayItems() { - global $wgExtensionAssetsPath, $wgUserBoard; - - $output = ''; - $imgPath = $wgExtensionAssetsPath . '/SocialProfile/images/'; - $this->populateItems(); - $x = 1; - - foreach ( $this->items as $item ) { - if ( $x <= 30 ) { - $title = Title::makeTitle( $item['namespace'], $item['pagetitle'] ); - $user_title = Title::makeTitle( NS_USER, $item['username'] ); - $output .= '<div id="comment-' . $x . '" class="site-scout"><span class="item-info">'; - $output .= '<img src="' . $imgPath . $this->getTypeIcon( $item['type'] ) . '" alt="" />'; - - if ( $item['minor'] == 1 ) { - $output .= '<br /><span class="edit-minor">' . wfMessage( 'sitescout-minor' )->plain() . '</span>'; - } - if ( $item['new'] == 1 ) { - $output .= '<br /><span class="edit-new">' . wfMessage( 'sitescout-new' )->plain() . '</span>'; - } - $output .= '</span>'; - - if ( $item['type'] != 'networkupdate' ) { - $output .= Linker::link( - $title, - $title->getPrefixedText(), - array( 'class' => 'item-title' ) - ); - } else { - if ( $item['team_id'] ) { - $team = SportsTeams::getTeam( $item['team_id'] ); - $network_name = $team['name']; - } else { - $sport = SportsTeams::getSport( $item['sport_id'] ); - $network_name = $sport['name']; - } - $output .= '<span class="site-scout-network"><a href="' . - SportsTeams::getNetworkURL( $item['sport_id'], $item['team_id'] ) . - '" class="item-title">' . $network_name . '</a></span>'; - } - - // $output .= '<span class="item-time">' . date( 'g:i a, m.d.y', $item['timestamp'] ) . '</span>'; - $comment = $item['comment']; - if ( $item['type'] == 'comment' ) { - $comment = '<a href="' . - htmlspecialchars( $title->getFullURL(), ENT_QUOTES ) . - '#comment-' . $item['id'] . '" title="' . - htmlspecialchars( $title->getText(), ENT_QUOTES ) . '">' . - htmlspecialchars( $item['comment'], ENT_QUOTES ) . '</a>'; - } - $output .= '<span class="item-comment">' . $comment . '</span>'; - - $avatar = new wAvatar( $item['userid'], 's' ); - $commentIcon = $avatar->getAvatarURL(); - $talk_page = htmlspecialchars( $user_title->getTalkPage()->getFullURL(), ENT_QUOTES ); - if ( $wgUserBoard ) { - $talk_page = UserBoard::getUserBoardURL( $item['username'] ); - } - $output .= '<span class="item-user"><a href="' . htmlspecialchars( $user_title->getFullURL(), ENT_QUOTES ) . '" class="item-user-link">' . $commentIcon . ' ' . $item['username'] . '</a><a href="' . $talk_page . '" class="item-user-talk"><img src="' . $wgExtensionAssetsPath . '/SiteScout/resources/images/talkPageIcon.png" alt="" /></a></span>'; - $output .= '</div>'; - $x++; - } - } - - return $output; - } -} - -class SiteScoutXML extends SiteScout { - - function displayItems() { - global $wgUserBoard; - - $output = ''; - $this->populateItems(); - $x = 1; - - foreach ( $this->items as $item ) { - $avatar = new wAvatar( $item['userid'], 's' ); - $commentIcon = $avatar->getAvatarImage(); - if ( $item['username'] == '' ) { - $item['username'] = '-'; - } - $title = Title::makeTitle( $item['namespace'], $item['pagetitle'] ); - $user_title = Title::makeTitle( NS_USER, $item['username'] ); - $talk_page = $user_title->getTalkPage()->getFullURL(); - if ( $wgUserBoard ) { - $talk_page = UserBoard::getUserBoardURL( $item['username'] ); - } - - $page_title = str_replace( '&', '%26', $title->getPrefixedText() ); - $page_url = $title->getFullURL(); - - if ( $item['type'] == 'networkupdate' ) { - if ( $item['team_id'] ) { - $team = SportsTeams::getTeam( $item['team_id'] ); - $network_name = $team['name']; - } else { - $sport = SportsTeams::getSport( $item['sport_id'] ); - $network_name = $sport['name']; - } - $page_title = $network_name; - $page_url = SportsTeams::getNetworkURL( $item['sport_id'], $item['team_id'] ); - } - - $output .= '<item>'; - $output .= '<type_icon>' . $this->getTypeIcon( $item['type'] ) . '</type_icon> - <type>' . $item['type'] . '</type> - <date>' . date( 'g:i a , m.d.y', $item['timestamp'] ) . '</date> - <timestamp>' . $item['timestamp'] . "</timestamp> - <title>{$page_title}</title> - <url>{$page_url}</url> - <comment>" . $item['comment'] . '</comment> - <user>' . str_replace( '&', '%26', $item['username'] ) . '</user> - <user_page>' . $user_title->getFullURL() . '</user_page> - <user_talkpage>' . $talk_page . '</user_talkpage> - <avatar>' . $commentIcon . '</avatar> - <edit_new>' . $item['new'] . '</edit_new> - <edit_minor>' . $item['minor'] . '</edit_minor> - <id>' . $item['id'] . '</id>'; - $output .= '</item>'; - - $x++; - } - - if ( $output ) { - $output = '<items>' . $output . '</items>'; - } - - return $output; - } - -} \ No newline at end of file diff --git a/includes/SiteScoutHTML.class.php b/includes/SiteScoutHTML.class.php new file mode 100644 index 0000000..ff8ca89 --- /dev/null +++ b/includes/SiteScoutHTML.class.php @@ -0,0 +1,71 @@ +<?php +class SiteScoutHTML extends SiteScout { + + function displayItems() { + global $wgExtensionAssetsPath, $wgUserBoard; + + $output = ''; + $imgPath = $wgExtensionAssetsPath . '/SocialProfile/images/'; + $this->populateItems(); + $x = 1; + + foreach ( $this->items as $item ) { + if ( $x <= 30 ) { + $title = Title::makeTitle( $item['namespace'], $item['pagetitle'] ); + $user_title = Title::makeTitle( NS_USER, $item['username'] ); + $output .= '<div id="comment-' . $x . '" class="site-scout"><span class="item-info">'; + $output .= '<img src="' . $imgPath . $this->getTypeIcon( $item['type'] ) . '" alt="" />'; + + if ( $item['minor'] == 1 ) { + $output .= '<br /><span class="edit-minor">' . wfMessage( 'sitescout-minor' )->plain() . '</span>'; + } + if ( $item['new'] == 1 ) { + $output .= '<br /><span class="edit-new">' . wfMessage( 'sitescout-new' )->plain() . '</span>'; + } + $output .= '</span>'; + + if ( $item['type'] != 'networkupdate' ) { + $output .= Linker::link( + $title, + $title->getPrefixedText(), + array( 'class' => 'item-title' ) + ); + } else { + if ( $item['team_id'] ) { + $team = SportsTeams::getTeam( $item['team_id'] ); + $network_name = $team['name']; + } else { + $sport = SportsTeams::getSport( $item['sport_id'] ); + $network_name = $sport['name']; + } + $output .= '<span class="site-scout-network"><a href="' . + SportsTeams::getNetworkURL( $item['sport_id'], $item['team_id'] ) . + '" class="item-title">' . $network_name . '</a></span>'; + } + + // $output .= '<span class="item-time">' . date( 'g:i a, m.d.y', $item['timestamp'] ) . '</span>'; + $comment = $item['comment']; + if ( $item['type'] == 'comment' ) { + $comment = '<a href="' . + htmlspecialchars( $title->getFullURL(), ENT_QUOTES ) . + '#comment-' . $item['id'] . '" title="' . + htmlspecialchars( $title->getText(), ENT_QUOTES ) . '">' . + htmlspecialchars( $item['comment'], ENT_QUOTES ) . '</a>'; + } + $output .= '<span class="item-comment">' . $comment . '</span>'; + + $avatar = new wAvatar( $item['userid'], 's' ); + $commentIcon = $avatar->getAvatarURL(); + $talk_page = htmlspecialchars( $user_title->getTalkPage()->getFullURL(), ENT_QUOTES ); + if ( $wgUserBoard ) { + $talk_page = UserBoard::getUserBoardURL( $item['username'] ); + } + $output .= '<span class="item-user"><a href="' . htmlspecialchars( $user_title->getFullURL(), ENT_QUOTES ) . '" class="item-user-link">' . $commentIcon . ' ' . $item['username'] . '</a><a href="' . $talk_page . '" class="item-user-talk"><img src="' . $wgExtensionAssetsPath . '/SiteScout/resources/images/talkPageIcon.png" alt="" /></a></span>'; + $output .= '</div>'; + $x++; + } + } + + return $output; + } +} diff --git a/includes/SiteScoutXML.class.php b/includes/SiteScoutXML.class.php new file mode 100644 index 0000000..e96d70f --- /dev/null +++ b/includes/SiteScoutXML.class.php @@ -0,0 +1,66 @@ +<?php +class SiteScoutXML extends SiteScout { + + function displayItems() { + global $wgUserBoard; + + $output = ''; + $this->populateItems(); + $x = 1; + + foreach ( $this->items as $item ) { + $avatar = new wAvatar( $item['userid'], 's' ); + $commentIcon = $avatar->getAvatarImage(); + if ( $item['username'] == '' ) { + $item['username'] = '-'; + } + $title = Title::makeTitle( $item['namespace'], $item['pagetitle'] ); + $user_title = Title::makeTitle( NS_USER, $item['username'] ); + $talk_page = $user_title->getTalkPage()->getFullURL(); + if ( $wgUserBoard ) { + $talk_page = UserBoard::getUserBoardURL( $item['username'] ); + } + + $page_title = str_replace( '&', '%26', $title->getPrefixedText() ); + $page_url = $title->getFullURL(); + + if ( $item['type'] == 'networkupdate' ) { + if ( $item['team_id'] ) { + $team = SportsTeams::getTeam( $item['team_id'] ); + $network_name = $team['name']; + } else { + $sport = SportsTeams::getSport( $item['sport_id'] ); + $network_name = $sport['name']; + } + $page_title = $network_name; + $page_url = SportsTeams::getNetworkURL( $item['sport_id'], $item['team_id'] ); + } + + $output .= '<item>'; + $output .= '<type_icon>' . $this->getTypeIcon( $item['type'] ) . '</type_icon> + <type>' . $item['type'] . '</type> + <date>' . date( 'g:i a , m.d.y', $item['timestamp'] ) . '</date> + <timestamp>' . $item['timestamp'] . "</timestamp> + <title>{$page_title}</title> + <url>{$page_url}</url> + <comment>" . $item['comment'] . '</comment> + <user>' . str_replace( '&', '%26', $item['username'] ) . '</user> + <user_page>' . $user_title->getFullURL() . '</user_page> + <user_talkpage>' . $talk_page . '</user_talkpage> + <avatar>' . $commentIcon . '</avatar> + <edit_new>' . $item['new'] . '</edit_new> + <edit_minor>' . $item['minor'] . '</edit_minor> + <id>' . $item['id'] . '</id>'; + $output .= '</item>'; + + $x++; + } + + if ( $output ) { + $output = '<items>' . $output . '</items>'; + } + + return $output; + } + +} diff --git a/SpecialSiteScout.php b/includes/specials/SpecialSiteScout.php similarity index 100% rename from SpecialSiteScout.php rename to includes/specials/SpecialSiteScout.php diff --git a/SiteScout_Update.php b/includes/specials/SpecialSiteScoutUpdate.php similarity index 100% rename from SiteScout_Update.php rename to includes/specials/SpecialSiteScoutUpdate.php -- To view, visit https://gerrit.wikimedia.org/r/365407 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Idd058e9a66f0cc43d635b6a781db6832b2d4f7c4 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/SiteScout Gerrit-Branch: master Gerrit-Owner: SamanthaNguyen <samanthanguyen1...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits