1 | <?php |
||
20 | class MovePageNotice implements SpecialMovepageAfterMoveHook { |
||
21 | |||
22 | /** |
||
23 | * @var SiteLinkLookup |
||
24 | */ |
||
25 | private $siteLinkLookup; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | private $siteId; |
||
31 | |||
32 | /** |
||
33 | * @var RepoLinker |
||
34 | */ |
||
35 | private $repoLinker; |
||
36 | |||
37 | /** |
||
38 | * @param SiteLinkLookup $siteLinkLookup |
||
39 | * @param string $siteId Global id of the client wiki |
||
40 | * @param RepoLinker $repoLinker |
||
41 | */ |
||
42 | public function __construct( SiteLinkLookup $siteLinkLookup, $siteId, RepoLinker $repoLinker ) { |
||
47 | |||
48 | public static function factory() { |
||
49 | $wikibaseClient = WikibaseClient::getDefaultInstance(); |
||
50 | $siteLinkLookup = $wikibaseClient->getStore()->getSiteLinkLookup(); |
||
51 | $repoLinker = $wikibaseClient->newRepoLinker(); |
||
52 | |||
53 | return new self( |
||
54 | $siteLinkLookup, |
||
55 | $wikibaseClient->getSettings()->getSetting( 'siteGlobalID' ), |
||
56 | $repoLinker |
||
57 | ); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * Hook for injecting a message on [[Special:MovePage]] |
||
62 | * @see https://www.mediawiki.org/wiki/Manual:Hooks/SpecialMovepageAfterMove |
||
63 | * |
||
64 | * @param MovePageForm $movePage |
||
65 | * @param Title $oldTitle |
||
66 | * @param Title $newTitle |
||
67 | */ |
||
68 | public function onSpecialMovepageAfterMove( $movePage, $oldTitle, $newTitle ) { |
||
73 | |||
74 | /** |
||
75 | * Create a repo link directly to the item. |
||
76 | * We can't use Special:ItemByTitle here as the item might have already been updated. |
||
77 | * |
||
78 | * @param Title $title |
||
79 | * |
||
80 | * @return string|null |
||
81 | */ |
||
82 | private function getItemUrl( Title $title ) { |
||
94 | |||
95 | /** |
||
96 | * @param Title $oldTitle Title of the page before the move |
||
97 | * @param Title $newTitle Title of the page after the move |
||
98 | * |
||
99 | * @return string|null |
||
100 | */ |
||
101 | private function getPageMoveNoticeHtml( Title $oldTitle, Title $newTitle ) { |
||
121 | |||
122 | private function getPageMoveMessage( Title $newTitle ) { |
||
132 | |||
133 | } |
||
134 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: