MediaWiki  master
FakeConverter.php
Go to the documentation of this file.
1 <?php
38  public $mLang;
39 
40  function __construct( Language $langobj ) {
41  $this->mLang = $langobj;
42  }
43 
44  function autoConvert( $text, $variant = false ) {
45  return $text;
46  }
47 
48  function autoConvertToAllVariants( $text ) {
49  return [ $this->mLang->getCode() => $text ];
50  }
51 
52  function convert( $t ) {
53  return $t;
54  }
55 
56  function convertTo( $text, $variant ) {
57  return $text;
58  }
59 
64  function convertTitle( $t ) {
65  return $t->getPrefixedText();
66  }
67 
68  function convertNamespace( $ns ) {
69  return $this->mLang->getFormattedNsText( $ns );
70  }
71 
75  function getVariants() {
76  return [ $this->mLang->getCode() ];
77  }
78 
79  function getVariantFallbacks( $variant ) {
80  return $this->mLang->getCode();
81  }
82 
83  function getPreferredVariant() {
84  return $this->mLang->getCode();
85  }
86 
87  function getDefaultVariant() {
88  return $this->mLang->getCode();
89  }
90 
91  function getURLVariant() {
92  return '';
93  }
94 
95  function getConvRuleTitle() {
96  return false;
97  }
98 
99  function findVariantLink( &$l, &$n, $ignoreOtherCond = false ) {
100  }
101 
102  function getExtraHashOptions() {
103  return '';
104  }
105 
106  function getParsedTitle() {
107  return '';
108  }
109 
110  function markNoConversion( $text, $noParse = false ) {
111  return $text;
112  }
113 
114  function convertCategoryKey( $key ) {
115  return $key;
116  }
117 
118  function validateVariant( $variant = null ) {
119  if ( $variant === null ) {
120  return null;
121  }
122  $variant = strtolower( $variant );
123  return $variant === $this->mLang->getCode() ? $variant : null;
124  }
125 
126  function translate( $text, $variant ) {
127  return $text;
128  }
129 
130  public function updateConversionTable( Title $title ) {
131  }
132 
138  private function reloadTables() {
139  }
140 }
markNoConversion( $text, $noParse=false)
reloadTables()
Used by test suites which need to reset the converter state.
Language $mLang
validateVariant( $variant=null)
A fake language variant converter.
__construct(Language $langobj)
findVariantLink(&$l, &$n, $ignoreOtherCond=false)
translate( $text, $variant)
convertNamespace( $ns)
autoConvertToAllVariants( $text)
convertCategoryKey( $key)
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that When $user is not null
Definition: hooks.txt:767
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:912
getVariantFallbacks( $variant)
convertTo( $text, $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
updateConversionTable(Title $title)
autoConvert( $text, $variant=false)