MediaWiki  1.27.2
FakeConverter.php
Go to the documentation of this file.
1 <?php
33  public $mLang;
34 
35  function __construct( $langobj ) {
36  $this->mLang = $langobj;
37  }
38 
39  function autoConvert( $text, $variant = false ) {
40  return $text;
41  }
42 
43  function autoConvertToAllVariants( $text ) {
44  return [ $this->mLang->getCode() => $text ];
45  }
46 
47  function convert( $t ) {
48  return $t;
49  }
50 
51  function convertTo( $text, $variant ) {
52  return $text;
53  }
54 
59  function convertTitle( $t ) {
60  return $t->getPrefixedText();
61  }
62 
63  function convertNamespace( $ns ) {
64  return $this->mLang->getFormattedNsText( $ns );
65  }
66 
67  function getVariants() {
68  return [ $this->mLang->getCode() ];
69  }
70 
71  function getVariantFallbacks( $variant ) {
72  return $this->mLang->getCode();
73  }
74 
75  function getPreferredVariant() {
76  return $this->mLang->getCode();
77  }
78 
79  function getDefaultVariant() {
80  return $this->mLang->getCode();
81  }
82 
83  function getURLVariant() {
84  return '';
85  }
86 
87  function getConvRuleTitle() {
88  return false;
89  }
90 
91  function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) {
92  }
93 
94  function getExtraHashOptions() {
95  return '';
96  }
97 
98  function getParsedTitle() {
99  return '';
100  }
101 
102  function markNoConversion( $text, $noParse = false ) {
103  return $text;
104  }
105 
106  function convertCategoryKey( $key ) {
107  return $key;
108  }
109 
110  function validateVariant( $variant = null ) {
111  return $variant === $this->mLang->getCode() ? $variant : null;
112  }
113 
114  function translate( $text, $variant ) {
115  return $text;
116  }
117 
118  public function updateConversionTable( Title $title ) {
119  }
120 }
magic word the default is to use $key to get the and $key value or $key value text $key value html to format the value $key
Definition: hooks.txt:2321
Language $mLang
autoConvertToAllVariants($text)
A fake language converter.
Represents a title within MediaWiki.
Definition: Title.php:34
findVariantLink(&$l, &$n, $ignoreOtherCond=false)
convertTo($text, $variant)
translate($text, $variant)
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
convertCategoryKey($key)
validateVariant($variant=null)
getVariantFallbacks($variant)
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
markNoConversion($text, $noParse=false)
autoConvert($text, $variant=false)
updateConversionTable(Title $title)
__construct($langobj)