Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like Skin often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Skin, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 34 | abstract class Skin extends ContextSource { |
||
| 35 | protected $skinname = null; |
||
| 36 | protected $mRelevantTitle = null; |
||
| 37 | protected $mRelevantUser = null; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string Stylesheets set to use. Subdirectory in skins/ where various stylesheets are |
||
| 41 | * located. Only needs to be set if you intend to use the getSkinStylePath() method. |
||
| 42 | */ |
||
| 43 | public $stylename = null; |
||
| 44 | |||
| 45 | /** |
||
| 46 | * Fetch the set of available skins. |
||
| 47 | * @return array Associative array of strings |
||
| 48 | */ |
||
| 49 | static function getSkinNames() { |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Fetch the skinname messages for available skins. |
||
| 55 | * @return string[] |
||
| 56 | */ |
||
| 57 | static function getSkinNameMessages() { |
||
| 64 | |||
| 65 | /** |
||
| 66 | * Fetch the list of user-selectable skins in regards to $wgSkipSkins. |
||
| 67 | * Useful for Special:Preferences and other places where you |
||
| 68 | * only want to show skins users _can_ use. |
||
| 69 | * @return string[] |
||
| 70 | * @since 1.23 |
||
| 71 | */ |
||
| 72 | public static function getAllowedSkins() { |
||
| 83 | |||
| 84 | /** |
||
| 85 | * Normalize a skin preference value to a form that can be loaded. |
||
| 86 | * |
||
| 87 | * If a skin can't be found, it will fall back to the configured default ($wgDefaultSkin), or the |
||
| 88 | * hardcoded default ($wgFallbackSkin) if the default skin is unavailable too. |
||
| 89 | * |
||
| 90 | * @param string $key 'monobook', 'vector', etc. |
||
| 91 | * @return string |
||
| 92 | */ |
||
| 93 | static function normalizeKey( $key ) { |
||
| 94 | global $wgDefaultSkin, $wgFallbackSkin; |
||
| 95 | |||
| 96 | $skinNames = Skin::getSkinNames(); |
||
| 97 | |||
| 98 | // Make keys lowercase for case-insensitive matching. |
||
| 99 | $skinNames = array_change_key_case( $skinNames, CASE_LOWER ); |
||
| 100 | $key = strtolower( $key ); |
||
| 101 | $defaultSkin = strtolower( $wgDefaultSkin ); |
||
| 102 | $fallbackSkin = strtolower( $wgFallbackSkin ); |
||
| 103 | |||
| 104 | if ( $key == '' || $key == 'default' ) { |
||
| 105 | // Don't return the default immediately; |
||
| 106 | // in a misconfiguration we need to fall back. |
||
| 107 | $key = $defaultSkin; |
||
| 108 | } |
||
| 109 | |||
| 110 | if ( isset( $skinNames[$key] ) ) { |
||
| 111 | return $key; |
||
| 112 | } |
||
| 113 | |||
| 114 | // Older versions of the software used a numeric setting |
||
| 115 | // in the user preferences. |
||
| 116 | $fallback = [ |
||
| 117 | 0 => $defaultSkin, |
||
| 118 | 2 => 'cologneblue' |
||
| 119 | ]; |
||
| 120 | |||
| 121 | if ( isset( $fallback[$key] ) ) { |
||
| 122 | $key = $fallback[$key]; |
||
| 123 | } |
||
| 124 | |||
| 125 | if ( isset( $skinNames[$key] ) ) { |
||
| 126 | return $key; |
||
| 127 | } elseif ( isset( $skinNames[$defaultSkin] ) ) { |
||
| 128 | return $defaultSkin; |
||
| 129 | } else { |
||
| 130 | return $fallbackSkin; |
||
| 131 | } |
||
| 132 | } |
||
| 133 | |||
| 134 | /** |
||
| 135 | * @return string Skin name |
||
| 136 | */ |
||
| 137 | public function getSkinName() { |
||
| 138 | return $this->skinname; |
||
| 139 | } |
||
| 140 | |||
| 141 | /** |
||
| 142 | * @param OutputPage $out |
||
| 143 | */ |
||
| 144 | function initPage( OutputPage $out ) { |
||
| 145 | |||
| 146 | $this->preloadExistence(); |
||
| 147 | |||
| 148 | } |
||
| 149 | |||
| 150 | /** |
||
| 151 | * Defines the ResourceLoader modules that should be added to the skin |
||
| 152 | * It is recommended that skins wishing to override call parent::getDefaultModules() |
||
| 153 | * and substitute out any modules they wish to change by using a key to look them up |
||
| 154 | * @return array Array of modules with helper keys for easy overriding |
||
| 155 | */ |
||
| 156 | public function getDefaultModules() { |
||
| 198 | |||
| 199 | /** |
||
| 200 | * Preload the existence of three commonly-requested pages in a single query |
||
| 201 | */ |
||
| 202 | function preloadExistence() { |
||
| 231 | |||
| 232 | /** |
||
| 233 | * Get the current revision ID |
||
| 234 | * |
||
| 235 | * @return int |
||
| 236 | */ |
||
| 237 | public function getRevisionId() { |
||
| 240 | |||
| 241 | /** |
||
| 242 | * Whether the revision displayed is the latest revision of the page |
||
| 243 | * |
||
| 244 | * @return bool |
||
| 245 | */ |
||
| 246 | public function isRevisionCurrent() { |
||
| 250 | |||
| 251 | /** |
||
| 252 | * Set the "relevant" title |
||
| 253 | * @see self::getRelevantTitle() |
||
| 254 | * @param Title $t |
||
| 255 | */ |
||
| 256 | public function setRelevantTitle( $t ) { |
||
| 259 | |||
| 260 | /** |
||
| 261 | * Return the "relevant" title. |
||
| 262 | * A "relevant" title is not necessarily the actual title of the page. |
||
| 263 | * Special pages like Special:MovePage use set the page they are acting on |
||
| 264 | * as their "relevant" title, this allows the skin system to display things |
||
| 265 | * such as content tabs which belong to to that page instead of displaying |
||
| 266 | * a basic special page tab which has almost no meaning. |
||
| 267 | * |
||
| 268 | * @return Title |
||
| 269 | */ |
||
| 270 | public function getRelevantTitle() { |
||
| 276 | |||
| 277 | /** |
||
| 278 | * Set the "relevant" user |
||
| 279 | * @see self::getRelevantUser() |
||
| 280 | * @param User $u |
||
| 281 | */ |
||
| 282 | public function setRelevantUser( $u ) { |
||
| 285 | |||
| 286 | /** |
||
| 287 | * Return the "relevant" user. |
||
| 288 | * A "relevant" user is similar to a relevant title. Special pages like |
||
| 289 | * Special:Contributions mark the user which they are relevant to so that |
||
| 290 | * things like the toolbox can display the information they usually are only |
||
| 291 | * able to display on a user's userpage and talkpage. |
||
| 292 | * @return User |
||
| 293 | */ |
||
| 294 | public function getRelevantUser() { |
||
| 318 | |||
| 319 | /** |
||
| 320 | * Outputs the HTML generated by other functions. |
||
| 321 | * @param OutputPage $out |
||
| 322 | */ |
||
| 323 | abstract function outputPage( OutputPage $out = null ); |
||
| 324 | |||
| 325 | /** |
||
| 326 | * @param array $data |
||
| 327 | * @return string |
||
| 328 | */ |
||
| 329 | static function makeVariablesScript( $data ) { |
||
| 338 | |||
| 339 | /** |
||
| 340 | * Get the query to generate a dynamic stylesheet |
||
| 341 | * |
||
| 342 | * @return array |
||
| 343 | */ |
||
| 344 | public static function getDynamicStylesheetQuery() { |
||
| 355 | |||
| 356 | /** |
||
| 357 | * Add skin specific stylesheets |
||
| 358 | * Calling this method with an $out of anything but the same OutputPage |
||
| 359 | * inside ->getOutput() is deprecated. The $out arg is kept |
||
| 360 | * for compatibility purposes with skins. |
||
| 361 | * @param OutputPage $out |
||
| 362 | * @todo delete |
||
| 363 | */ |
||
| 364 | abstract function setupSkinUserCss( OutputPage $out ); |
||
| 365 | |||
| 366 | /** |
||
| 367 | * TODO: document |
||
| 368 | * @param Title $title |
||
| 369 | * @return string |
||
| 370 | */ |
||
| 371 | function getPageClasses( $title ) { |
||
| 394 | |||
| 395 | /** |
||
| 396 | * Return values for <html> element |
||
| 397 | * @return array Array of associative name-to-value elements for <html> element |
||
| 398 | */ |
||
| 399 | public function getHtmlElementAttributes() { |
||
| 407 | |||
| 408 | /** |
||
| 409 | * This will be called by OutputPage::headElement when it is creating the |
||
| 410 | * "<body>" tag, skins can override it if they have a need to add in any |
||
| 411 | * body attributes or classes of their own. |
||
| 412 | * @param OutputPage $out |
||
| 413 | * @param array $bodyAttrs |
||
| 414 | */ |
||
| 415 | function addToBodyAttributes( $out, &$bodyAttrs ) { |
||
| 418 | |||
| 419 | /** |
||
| 420 | * URL to the logo |
||
| 421 | * @return string |
||
| 422 | */ |
||
| 423 | function getLogo() { |
||
| 427 | |||
| 428 | /** |
||
| 429 | * @return string HTML |
||
| 430 | */ |
||
| 431 | function getCategoryLinks() { |
||
| 493 | |||
| 494 | /** |
||
| 495 | * Render the array as a series of links. |
||
| 496 | * @param array $tree Categories tree returned by Title::getParentCategoryTree |
||
| 497 | * @return string Separated by >, terminate with "\n" |
||
| 498 | */ |
||
| 499 | function drawCategoryBrowser( $tree ) { |
||
| 518 | |||
| 519 | /** |
||
| 520 | * @return string HTML |
||
| 521 | */ |
||
| 522 | function getCategories() { |
||
| 542 | |||
| 543 | /** |
||
| 544 | * This runs a hook to allow extensions placing their stuff after content |
||
| 545 | * and article metadata (e.g. categories). |
||
| 546 | * Note: This function has nothing to do with afterContent(). |
||
| 547 | * |
||
| 548 | * This hook is placed here in order to allow using the same hook for all |
||
| 549 | * skins, both the SkinTemplate based ones and the older ones, which directly |
||
| 550 | * use this class to get their data. |
||
| 551 | * |
||
| 552 | * The output of this function gets processed in SkinTemplate::outputPage() for |
||
| 553 | * the SkinTemplate based skins, all other skins should directly echo it. |
||
| 554 | * |
||
| 555 | * @return string Empty by default, if not changed by any hook function. |
||
| 556 | */ |
||
| 557 | protected function afterContentHook() { |
||
| 577 | |||
| 578 | /** |
||
| 579 | * Generate debug data HTML for displaying at the bottom of the main content |
||
| 580 | * area. |
||
| 581 | * @return string HTML containing debug data, if enabled (otherwise empty). |
||
| 582 | */ |
||
| 583 | protected function generateDebugHTML() { |
||
| 586 | |||
| 587 | /** |
||
| 588 | * This gets called shortly before the "</body>" tag. |
||
| 589 | * |
||
| 590 | * @return string HTML-wrapped JS code to be put before "</body>" |
||
| 591 | */ |
||
| 592 | function bottomScripts() { |
||
| 601 | |||
| 602 | /** |
||
| 603 | * Text with the permalink to the source page, |
||
| 604 | * usually shown on the footer of a printed page |
||
| 605 | * |
||
| 606 | * @return string HTML text with an URL |
||
| 607 | */ |
||
| 608 | function printSource() { |
||
| 622 | |||
| 623 | /** |
||
| 624 | * @return string HTML |
||
| 625 | */ |
||
| 626 | function getUndeleteLink() { |
||
| 650 | |||
| 651 | /** |
||
| 652 | * @return string |
||
| 653 | */ |
||
| 654 | function subPageSubtitle() { |
||
| 703 | |||
| 704 | /** |
||
| 705 | * @deprecated since 1.27, feature removed |
||
| 706 | * @return bool Always false |
||
| 707 | */ |
||
| 708 | function showIPinHeader() { |
||
| 712 | |||
| 713 | /** |
||
| 714 | * @return string |
||
| 715 | */ |
||
| 716 | function getSearchLink() { |
||
| 720 | |||
| 721 | /** |
||
| 722 | * @return string |
||
| 723 | */ |
||
| 724 | function escapeSearchLink() { |
||
| 727 | |||
| 728 | /** |
||
| 729 | * @param string $type |
||
| 730 | * @return string |
||
| 731 | */ |
||
| 732 | function getCopyright( $type = 'detect' ) { |
||
| 774 | |||
| 775 | /** |
||
| 776 | * @return null|string |
||
| 777 | */ |
||
| 778 | function getCopyrightIcon() { |
||
| 803 | |||
| 804 | /** |
||
| 805 | * Gets the powered by MediaWiki icon. |
||
| 806 | * @return string |
||
| 807 | */ |
||
| 808 | function getPoweredBy() { |
||
| 826 | |||
| 827 | /** |
||
| 828 | * Get the timestamp of the latest revision, formatted in user language |
||
| 829 | * |
||
| 830 | * @return string |
||
| 831 | */ |
||
| 832 | protected function lastModified() { |
||
| 854 | |||
| 855 | /** |
||
| 856 | * @param string $align |
||
| 857 | * @return string |
||
| 858 | */ |
||
| 859 | function logoText( $align = '' ) { |
||
| 875 | |||
| 876 | /** |
||
| 877 | * Renders a $wgFooterIcons icon according to the method's arguments |
||
| 878 | * @param array $icon The icon to build the html for, see $wgFooterIcons |
||
| 879 | * for the format of this array. |
||
| 880 | * @param bool|string $withImage Whether to use the icon's image or output |
||
| 881 | * a text-only footericon. |
||
| 882 | * @return string HTML |
||
| 883 | */ |
||
| 884 | function makeFooterIcon( $icon, $withImage = 'withImage' ) { |
||
| 902 | |||
| 903 | /** |
||
| 904 | * Gets the link to the wiki's main page. |
||
| 905 | * @return string |
||
| 906 | */ |
||
| 907 | function mainPageLink() { |
||
| 915 | |||
| 916 | /** |
||
| 917 | * Returns an HTML link for use in the footer |
||
| 918 | * @param string $desc The i18n message key for the link text |
||
| 919 | * @param string $page The i18n message key for the page to link to |
||
| 920 | * @return string HTML anchor |
||
| 921 | */ |
||
| 922 | public function footerLink( $desc, $page ) { |
||
| 943 | |||
| 944 | /** |
||
| 945 | * Gets the link to the wiki's privacy policy page. |
||
| 946 | * @return string HTML |
||
| 947 | */ |
||
| 948 | function privacyLink() { |
||
| 951 | |||
| 952 | /** |
||
| 953 | * Gets the link to the wiki's about page. |
||
| 954 | * @return string HTML |
||
| 955 | */ |
||
| 956 | function aboutLink() { |
||
| 959 | |||
| 960 | /** |
||
| 961 | * Gets the link to the wiki's general disclaimers page. |
||
| 962 | * @return string HTML |
||
| 963 | */ |
||
| 964 | function disclaimerLink() { |
||
| 967 | |||
| 968 | /** |
||
| 969 | * Return URL options for the 'edit page' link. |
||
| 970 | * This may include an 'oldid' specifier, if the current page view is such. |
||
| 971 | * |
||
| 972 | * @return array |
||
| 973 | * @private |
||
| 974 | */ |
||
| 975 | function editUrlOptions() { |
||
| 984 | |||
| 985 | /** |
||
| 986 | * @param User|int $id |
||
| 987 | * @return bool |
||
| 988 | */ |
||
| 989 | function showEmailUser( $id ) { |
||
| 1001 | |||
| 1002 | /** |
||
| 1003 | * Return a fully resolved style path url to images or styles stored in the current skins's folder. |
||
| 1004 | * This method returns a url resolved using the configured skin style path |
||
| 1005 | * and includes the style version inside of the url. |
||
| 1006 | * |
||
| 1007 | * Requires $stylename to be set, otherwise throws MWException. |
||
| 1008 | * |
||
| 1009 | * @param string $name The name or path of a skin resource file |
||
| 1010 | * @return string The fully resolved style path url including styleversion |
||
| 1011 | * @throws MWException |
||
| 1012 | */ |
||
| 1013 | function getSkinStylePath( $name ) { |
||
| 1023 | |||
| 1024 | /* these are used extensively in SkinTemplate, but also some other places */ |
||
| 1025 | |||
| 1026 | /** |
||
| 1027 | * @param string $urlaction |
||
| 1028 | * @return string |
||
| 1029 | */ |
||
| 1030 | static function makeMainPageUrl( $urlaction = '' ) { |
||
| 1036 | |||
| 1037 | /** |
||
| 1038 | * Make a URL for a Special Page using the given query and protocol. |
||
| 1039 | * |
||
| 1040 | * If $proto is set to null, make a local URL. Otherwise, make a full |
||
| 1041 | * URL with the protocol specified. |
||
| 1042 | * |
||
| 1043 | * @param string $name Name of the Special page |
||
| 1044 | * @param string $urlaction Query to append |
||
| 1045 | * @param string|null $proto Protocol to use or null for a local URL |
||
| 1046 | * @return string |
||
| 1047 | */ |
||
| 1048 | static function makeSpecialUrl( $name, $urlaction = '', $proto = null ) { |
||
| 1056 | |||
| 1057 | /** |
||
| 1058 | * @param string $name |
||
| 1059 | * @param string $subpage |
||
| 1060 | * @param string $urlaction |
||
| 1061 | * @return string |
||
| 1062 | */ |
||
| 1063 | static function makeSpecialUrlSubpage( $name, $subpage, $urlaction = '' ) { |
||
| 1067 | |||
| 1068 | /** |
||
| 1069 | * @param string $name |
||
| 1070 | * @param string $urlaction |
||
| 1071 | * @return string |
||
| 1072 | */ |
||
| 1073 | static function makeI18nUrl( $name, $urlaction = '' ) { |
||
| 1078 | |||
| 1079 | /** |
||
| 1080 | * @param string $name |
||
| 1081 | * @param string $urlaction |
||
| 1082 | * @return string |
||
| 1083 | */ |
||
| 1084 | static function makeUrl( $name, $urlaction = '' ) { |
||
| 1090 | |||
| 1091 | /** |
||
| 1092 | * If url string starts with http, consider as external URL, else |
||
| 1093 | * internal |
||
| 1094 | * @param string $name |
||
| 1095 | * @return string URL |
||
| 1096 | */ |
||
| 1097 | static function makeInternalOrExternalUrl( $name ) { |
||
| 1104 | |||
| 1105 | /** |
||
| 1106 | * this can be passed the NS number as defined in Language.php |
||
| 1107 | * @param string $name |
||
| 1108 | * @param string $urlaction |
||
| 1109 | * @param int $namespace |
||
| 1110 | * @return string |
||
| 1111 | */ |
||
| 1112 | static function makeNSUrl( $name, $urlaction = '', $namespace = NS_MAIN ) { |
||
| 1118 | |||
| 1119 | /** |
||
| 1120 | * these return an array with the 'href' and boolean 'exists' |
||
| 1121 | * @param string $name |
||
| 1122 | * @param string $urlaction |
||
| 1123 | * @return array |
||
| 1124 | */ |
||
| 1125 | View Code Duplication | static function makeUrlDetails( $name, $urlaction = '' ) { |
|
| 1134 | |||
| 1135 | /** |
||
| 1136 | * Make URL details where the article exists (or at least it's convenient to think so) |
||
| 1137 | * @param string $name Article name |
||
| 1138 | * @param string $urlaction |
||
| 1139 | * @return array |
||
| 1140 | */ |
||
| 1141 | View Code Duplication | static function makeKnownUrlDetails( $name, $urlaction = '' ) { |
|
| 1150 | |||
| 1151 | /** |
||
| 1152 | * make sure we have some title to operate on |
||
| 1153 | * |
||
| 1154 | * @param Title $title |
||
| 1155 | * @param string $name |
||
| 1156 | */ |
||
| 1157 | static function checkTitle( &$title, $name ) { |
||
| 1165 | |||
| 1166 | /** |
||
| 1167 | * Build an array that represents the sidebar(s), the navigation bar among them. |
||
| 1168 | * |
||
| 1169 | * BaseTemplate::getSidebar can be used to simplify the format and id generation in new skins. |
||
| 1170 | * |
||
| 1171 | * The format of the returned array is array( heading => content, ... ), where: |
||
| 1172 | * - heading is the heading of a navigation portlet. It is either: |
||
| 1173 | * - magic string to be handled by the skins ('SEARCH' / 'LANGUAGES' / 'TOOLBOX' / ...) |
||
| 1174 | * - a message name (e.g. 'navigation'), the message should be HTML-escaped by the skin |
||
| 1175 | * - plain text, which should be HTML-escaped by the skin |
||
| 1176 | * - content is the contents of the portlet. It is either: |
||
| 1177 | * - HTML text (<ul><li>...</li>...</ul>) |
||
| 1178 | * - array of link data in a format accepted by BaseTemplate::makeListItem() |
||
| 1179 | * - (for a magic string as a key, any value) |
||
| 1180 | * |
||
| 1181 | * Note that extensions can control the sidebar contents using the SkinBuildSidebar hook |
||
| 1182 | * and can technically insert anything in here; skin creators are expected to handle |
||
| 1183 | * values described above. |
||
| 1184 | * |
||
| 1185 | * @return array |
||
| 1186 | */ |
||
| 1187 | function buildSidebar() { |
||
| 1216 | |||
| 1217 | /** |
||
| 1218 | * Add content from a sidebar system message |
||
| 1219 | * Currently only used for MediaWiki:Sidebar (but may be used by Extensions) |
||
| 1220 | * |
||
| 1221 | * This is just a wrapper around addToSidebarPlain() for backwards compatibility |
||
| 1222 | * |
||
| 1223 | * @param array $bar |
||
| 1224 | * @param string $message |
||
| 1225 | */ |
||
| 1226 | public function addToSidebar( &$bar, $message ) { |
||
| 1229 | |||
| 1230 | /** |
||
| 1231 | * Add content from plain text |
||
| 1232 | * @since 1.17 |
||
| 1233 | * @param array $bar |
||
| 1234 | * @param string $text |
||
| 1235 | * @return array |
||
| 1236 | */ |
||
| 1237 | function addToSidebarPlain( &$bar, $text ) { |
||
| 1321 | |||
| 1322 | /** |
||
| 1323 | * Gets new talk page messages for the current user and returns an |
||
| 1324 | * appropriate alert message (or an empty string if there are no messages) |
||
| 1325 | * @return string |
||
| 1326 | */ |
||
| 1327 | function getNewtalks() { |
||
| 1413 | |||
| 1414 | /** |
||
| 1415 | * Get a cached notice |
||
| 1416 | * |
||
| 1417 | * @param string $name Message name, or 'default' for $wgSiteNotice |
||
| 1418 | * @return string|bool HTML fragment, or false to indicate that the caller |
||
| 1419 | * should fall back to the next notice in its sequence |
||
| 1420 | */ |
||
| 1421 | private function getCachedNotice( $name ) { |
||
| 1466 | |||
| 1467 | /** |
||
| 1468 | * Get the site notice |
||
| 1469 | * |
||
| 1470 | * @return string HTML fragment |
||
| 1471 | */ |
||
| 1472 | function getSiteNotice() { |
||
| 1494 | |||
| 1495 | /** |
||
| 1496 | * Create a section edit link. This supersedes editSectionLink() and |
||
| 1497 | * editSectionLinkForOther(). |
||
| 1498 | * |
||
| 1499 | * @param Title $nt The title being linked to (may not be the same as |
||
| 1500 | * the current page, if the section is included from a template) |
||
| 1501 | * @param string $section The designation of the section being pointed to, |
||
| 1502 | * to be included in the link, like "§ion=$section" |
||
| 1503 | * @param string $tooltip The tooltip to use for the link: will be escaped |
||
| 1504 | * and wrapped in the 'editsectionhint' message |
||
| 1505 | * @param string $lang Language code |
||
| 1506 | * @return string HTML to use for edit link |
||
| 1507 | */ |
||
| 1508 | public function doEditSectionLink( Title $nt, $section, $tooltip = null, $lang = false ) { |
||
| 1563 | |||
| 1564 | /** @deprecated in 1.21 */ |
||
| 1565 | public function accesskey() { |
||
| 1569 | /** @deprecated in 1.21 */ |
||
| 1570 | public function blockLink() { |
||
| 1574 | /** @deprecated in 1.21 */ |
||
| 1575 | public function buildRollbackLink() { |
||
| 1579 | /** @deprecated in 1.21 */ |
||
| 1580 | public function commentBlock() { |
||
| 1584 | /** @deprecated in 1.21 */ |
||
| 1585 | public function emailLink() { |
||
| 1589 | /** @deprecated in 1.21 */ |
||
| 1590 | public function formatComment() { |
||
| 1594 | /** @deprecated in 1.21 */ |
||
| 1595 | public function formatHiddenCategories() { |
||
| 1599 | /** @deprecated in 1.21 */ |
||
| 1600 | public function formatLinksInComment() { |
||
| 1604 | /** @deprecated in 1.21 */ |
||
| 1605 | public function formatRevisionSize() { |
||
| 1609 | /** @deprecated in 1.21 */ |
||
| 1610 | public function formatSize() { |
||
| 1614 | /** @deprecated in 1.21 */ |
||
| 1615 | public function formatTemplates() { |
||
| 1619 | /** @deprecated in 1.21 */ |
||
| 1620 | public function generateRollback() { |
||
| 1624 | /** @deprecated in 1.21 */ |
||
| 1625 | public function generateTOC() { |
||
| 1629 | /** @deprecated in 1.21 */ |
||
| 1630 | public function getInternalLinkAttributes() { |
||
| 1634 | /** @deprecated in 1.21 */ |
||
| 1635 | public function getInternalLinkAttributesObj() { |
||
| 1639 | /** @deprecated in 1.21 */ |
||
| 1640 | public function getInterwikiLinkAttributes() { |
||
| 1644 | /** @deprecated in 1.21 */ |
||
| 1645 | public function getInvalidTitleDescription() { |
||
| 1649 | /** @deprecated in 1.21 */ |
||
| 1650 | public function getLinkColour() { |
||
| 1654 | /** @deprecated in 1.21 */ |
||
| 1655 | public function getRevDeleteLink() { |
||
| 1659 | /** @deprecated in 1.21 */ |
||
| 1660 | public function getRollbackEditCount() { |
||
| 1664 | /** @deprecated in 1.21 */ |
||
| 1665 | public function link() { |
||
| 1669 | /** @deprecated in 1.21 */ |
||
| 1670 | public function linkKnown() { |
||
| 1674 | /** @deprecated in 1.21 */ |
||
| 1675 | public function makeBrokenImageLinkObj() { |
||
| 1679 | /** @deprecated in 1.21 */ |
||
| 1680 | public function makeCommentLink() { |
||
| 1684 | /** @deprecated in 1.21 */ |
||
| 1685 | public function makeExternalImage() { |
||
| 1689 | /** @deprecated in 1.21 */ |
||
| 1690 | public function makeExternalLink() { |
||
| 1694 | /** @deprecated in 1.21 */ |
||
| 1695 | public function makeHeadline() { |
||
| 1699 | /** @deprecated in 1.21 */ |
||
| 1700 | public function makeImageLink() { |
||
| 1704 | /** @deprecated in 1.21 */ |
||
| 1705 | public function makeMediaLinkFile() { |
||
| 1709 | /** @deprecated in 1.21 */ |
||
| 1710 | public function makeMediaLinkObj() { |
||
| 1714 | /** @deprecated in 1.21 */ |
||
| 1715 | public function makeSelfLinkObj() { |
||
| 1719 | /** @deprecated in 1.21 */ |
||
| 1720 | public function makeThumbLink2() { |
||
| 1724 | /** @deprecated in 1.21 */ |
||
| 1725 | public function makeThumbLinkObj() { |
||
| 1729 | /** @deprecated in 1.21 */ |
||
| 1730 | public function normaliseSpecialPage() { |
||
| 1734 | /** @deprecated in 1.21 */ |
||
| 1735 | public function normalizeSubpageLink() { |
||
| 1739 | /** @deprecated in 1.21 */ |
||
| 1740 | public function processResponsiveImages() { |
||
| 1744 | /** @deprecated in 1.21 */ |
||
| 1745 | public function revComment() { |
||
| 1749 | /** @deprecated in 1.21 */ |
||
| 1750 | public function revDeleteLink() { |
||
| 1754 | /** @deprecated in 1.21 */ |
||
| 1755 | public function revDeleteLinkDisabled() { |
||
| 1759 | /** @deprecated in 1.21 */ |
||
| 1760 | public function revUserLink() { |
||
| 1764 | /** @deprecated in 1.21 */ |
||
| 1765 | public function revUserTools() { |
||
| 1769 | /** @deprecated in 1.21 */ |
||
| 1770 | public function specialLink() { |
||
| 1774 | /** @deprecated in 1.21 */ |
||
| 1775 | public function splitTrail() { |
||
| 1779 | /** @deprecated in 1.21 */ |
||
| 1780 | public function titleAttrib() { |
||
| 1784 | /** @deprecated in 1.21 */ |
||
| 1785 | public function tocIndent() { |
||
| 1789 | /** @deprecated in 1.21 */ |
||
| 1790 | public function tocLine() { |
||
| 1794 | /** @deprecated in 1.21 */ |
||
| 1795 | public function tocLineEnd() { |
||
| 1799 | /** @deprecated in 1.21 */ |
||
| 1800 | public function tocList() { |
||
| 1804 | /** @deprecated in 1.21 */ |
||
| 1805 | public function tocUnindent() { |
||
| 1809 | /** @deprecated in 1.21 */ |
||
| 1810 | public function tooltip() { |
||
| 1814 | /** @deprecated in 1.21 */ |
||
| 1815 | public function tooltipAndAccesskeyAttribs() { |
||
| 1819 | /** @deprecated in 1.21 */ |
||
| 1820 | public function userLink() { |
||
| 1824 | /** @deprecated in 1.21 */ |
||
| 1825 | public function userTalkLink() { |
||
| 1829 | /** @deprecated in 1.21 */ |
||
| 1830 | public function userToolLinks() { |
||
| 1834 | /** @deprecated in 1.21 */ |
||
| 1835 | public function userToolLinksRedContribs() { |
||
| 1839 | |||
| 1840 | } |
||
| 1841 |
This check looks for the bodies of
ifstatements that have no statements or where all statements have been commented out. This may be the result of changes for debugging or the code may simply be obsolete.These
ifbodies can be removed. If you have an empty if but statements in theelsebranch, consider inverting the condition.could be turned into
This is much more concise to read.