MediaWiki fundraising/REL1_35
Site.php
Go to the documentation of this file.
1<?php
2
4
31class Site implements Serializable {
32 public const TYPE_UNKNOWN = 'unknown';
33 public const TYPE_MEDIAWIKI = 'mediawiki';
34
35 public const GROUP_NONE = 'none';
36
37 public const ID_INTERWIKI = 'interwiki';
38 public const ID_EQUIVALENT = 'equivalent';
39
40 public const SOURCE_LOCAL = 'local';
41
42 public const PATH_LINK = 'link';
43
51 public const SERIAL_VERSION_ID = '2013-01-23';
52
58 protected $globalId = null;
59
66
73
80
86 protected $languageCode = null;
87
96 protected $localIds = [];
97
103 protected $extraData = [];
104
110 protected $extraConfig = [];
111
117 protected $forward = false;
118
124 protected $internalId = null;
125
131 public function __construct( $type = self::TYPE_UNKNOWN ) {
132 $this->type = $type;
133 }
134
142 public function getGlobalId() {
143 return $this->globalId;
144 }
145
155 public function setGlobalId( $globalId ) {
156 if ( $globalId !== null && !is_string( $globalId ) ) {
157 throw new MWException( '$globalId needs to be string or null' );
158 }
159
160 $this->globalId = $globalId;
161 }
162
170 public function getType() {
171 return $this->type;
172 }
173
181 public function getGroup() {
182 return $this->group;
183 }
184
194 public function setGroup( $group ) {
195 if ( !is_string( $group ) ) {
196 throw new MWException( '$group needs to be a string' );
197 }
198
199 $this->group = $group;
200 }
201
209 public function getSource() {
210 return $this->source;
211 }
212
222 public function setSource( $source ) {
223 if ( !is_string( $source ) ) {
224 throw new MWException( '$source needs to be a string' );
225 }
226
227 $this->source = $source;
228 }
229
238 public function shouldForward() {
239 return $this->forward;
240 }
241
252 public function setForward( $shouldForward ) {
253 if ( !is_bool( $shouldForward ) ) {
254 throw new MWException( '$shouldForward needs to be a boolean' );
255 }
256
257 $this->forward = $shouldForward;
258 }
259
268 public function getDomain(): ?string {
269 $path = $this->getLinkPath();
270
271 if ( $path === null ) {
272 return null;
273 }
274
275 $domain = parse_url( $path, PHP_URL_HOST );
276
277 if ( $domain === false ) {
278 $domain = null;
279 }
280
281 return $domain;
282 }
283
292 public function getProtocol() {
293 $path = $this->getLinkPath();
294
295 if ( $path === null ) {
296 return '';
297 }
298
299 $protocol = parse_url( $path, PHP_URL_SCHEME );
300
301 // Malformed URL
302 if ( $protocol === false ) {
303 throw new MWException( "failed to parse URL '$path'" );
304 }
305
306 // No schema
307 if ( $protocol === null ) {
308 // Used for protocol relative URLs
309 $protocol = '';
310 }
311
312 return $protocol;
313 }
314
325 public function setLinkPath( $fullUrl ) {
326 $type = $this->getLinkPathType();
327
328 if ( $type === null ) {
329 throw new MWException( "This Site does not support link paths." );
330 }
331
332 $this->setPath( $type, $fullUrl );
333 }
334
342 public function getLinkPath() {
343 $type = $this->getLinkPathType();
344 return $type === null ? null : $this->getPath( $type );
345 }
346
359 public function getLinkPathType() {
360 return self::PATH_LINK;
361 }
362
378 public function getPageUrl( $pageName = false ) {
379 $url = $this->getLinkPath();
380
381 if ( $url === null ) {
382 return null;
383 }
384
385 if ( $pageName !== false ) {
386 $url = str_replace( '$1', rawurlencode( $pageName ), $url );
387 }
388
389 return $url;
390 }
391
406 public function normalizePageName( $pageName ) {
407 return $pageName;
408 }
409
417 public function getExtraData() {
418 return $this->extraData;
419 }
420
428 public function setExtraData( array $extraData ) {
429 $this->extraData = $extraData;
430 }
431
439 public function getExtraConfig() {
440 return $this->extraConfig;
441 }
442
450 public function setExtraConfig( array $extraConfig ) {
451 $this->extraConfig = $extraConfig;
452 }
453
462 public function getLanguageCode() {
463 return $this->languageCode;
464 }
465
473 public function setLanguageCode( $languageCode ) {
474 if ( $languageCode !== null
475 && !MediaWikiServices::getInstance()
476 ->getLanguageNameUtils()
477 ->isValidCode( $languageCode )
478 ) {
479 throw new InvalidArgumentException( "$languageCode is not a valid language code." );
480 }
481 $this->languageCode = $languageCode;
482 }
483
491 public function getInternalId() {
492 return $this->internalId;
493 }
494
503 public function setInternalId( $internalId = null ) {
504 $this->internalId = $internalId;
505 }
506
515 public function addLocalId( $type, $identifier ) {
516 if ( $this->localIds === false ) {
517 $this->localIds = [];
518 }
519
520 if ( !array_key_exists( $type, $this->localIds ) ) {
521 $this->localIds[$type] = [];
522 }
523
524 if ( !in_array( $identifier, $this->localIds[$type] ) ) {
525 $this->localIds[$type][] = $identifier;
526 }
527 }
528
536 public function addInterwikiId( $identifier ) {
537 $this->addLocalId( self::ID_INTERWIKI, $identifier );
538 }
539
547 public function addNavigationId( $identifier ) {
548 $this->addLocalId( self::ID_EQUIVALENT, $identifier );
549 }
550
558 public function getInterwikiIds() {
559 return array_key_exists( self::ID_INTERWIKI, $this->localIds )
560 ? $this->localIds[self::ID_INTERWIKI]
561 : [];
562 }
563
572 public function getNavigationIds() {
573 return array_key_exists( self::ID_EQUIVALENT, $this->localIds )
574 ? $this->localIds[self::ID_EQUIVALENT] :
575 [];
576 }
577
585 public function getLocalIds() {
586 return $this->localIds;
587 }
588
600 public function setPath( $pathType, $fullUrl ) {
601 if ( !is_string( $fullUrl ) ) {
602 throw new MWException( '$fullUrl needs to be a string' );
603 }
604
605 if ( !array_key_exists( 'paths', $this->extraData ) ) {
606 $this->extraData['paths'] = [];
607 }
608
609 $this->extraData['paths'][$pathType] = $fullUrl;
610 }
611
621 public function getPath( $pathType ) {
622 $paths = $this->getAllPaths();
623 return array_key_exists( $pathType, $paths ) ? $paths[$pathType] : null;
624 }
625
634 public function getAllPaths() {
635 return array_key_exists( 'paths', $this->extraData ) ? $this->extraData['paths'] : [];
636 }
637
645 public function removePath( $pathType ) {
646 if ( array_key_exists( 'paths', $this->extraData ) ) {
647 unset( $this->extraData['paths'][$pathType] );
648 }
649 }
650
658 public static function newForType( $siteType ) {
659 global $wgSiteTypes;
660
661 if ( array_key_exists( $siteType, $wgSiteTypes ) ) {
662 return new $wgSiteTypes[$siteType]();
663 }
664
665 return new Site();
666 }
667
675 public function serialize(): string {
676 return serialize( $this->__serialize() );
677 }
678
686 public function __serialize() {
687 return [
688 'globalid' => $this->globalId,
689 'type' => $this->type,
690 'group' => $this->group,
691 'source' => $this->source,
692 'language' => $this->languageCode,
693 'localids' => $this->localIds,
694 'config' => $this->extraConfig,
695 'data' => $this->extraData,
696 'forward' => $this->forward,
697 'internalid' => $this->internalId,
698 ];
699 }
700
708 public function unserialize( $serialized ): void {
710 }
711
719 public function __unserialize( $fields ) {
720 $this->__construct( $fields['type'] );
721
722 $this->setGlobalId( $fields['globalid'] );
723 $this->setGroup( $fields['group'] );
724 $this->setSource( $fields['source'] );
725 $this->setLanguageCode( $fields['language'] );
726 $this->localIds = $fields['localids'];
727 $this->setExtraConfig( $fields['config'] );
728 $this->setExtraData( $fields['data'] );
729 $this->setForward( $fields['forward'] );
730 $this->setInternalId( $fields['internalid'] );
731 }
732}
__unserialize( $data)
serialize()
unserialize( $serialized)
__serialize()
$wgSiteTypes
Register handlers for specific types of sites.
return[ 'abap'=> true, 'abl'=> true, 'abnf'=> true, 'aconf'=> true, 'actionscript'=> true, 'actionscript3'=> true, 'ada'=> true, 'ada2005'=> true, 'ada95'=> true, 'adl'=> true, 'agda'=> true, 'aheui'=> true, 'ahk'=> true, 'alloy'=> true, 'ambienttalk'=> true, 'ambienttalk/2'=> true, 'ampl'=> true, 'antlr'=> true, 'antlr-actionscript'=> true, 'antlr-as'=> true, 'antlr-c#'=> true, 'antlr-cpp'=> true, 'antlr-csharp'=> true, 'antlr-java'=> true, 'antlr-objc'=> true, 'antlr-perl'=> true, 'antlr-python'=> true, 'antlr-rb'=> true, 'antlr-ruby'=> true, 'apache'=> true, 'apacheconf'=> true, 'apl'=> true, 'applescript'=> true, 'arduino'=> true, 'arexx'=> true, 'arrow'=> true, 'as'=> true, 'as3'=> true, 'asm'=> true, 'aspectj'=> true, 'aspx-cs'=> true, 'aspx-vb'=> true, 'asy'=> true, 'asymptote'=> true, 'at'=> true, 'augeas'=> true, 'autohotkey'=> true, 'autoit'=> true, 'awk'=> true, 'b3d'=> true, 'bare'=> true, 'basemake'=> true, 'bash'=> true, 'basic'=> true, 'bat'=> true, 'batch'=> true, 'bbcbasic'=> true, 'bbcode'=> true, 'bc'=> true, 'befunge'=> true, 'bf'=> true, 'bib'=> true, 'bibtex'=> true, 'blitzbasic'=> true, 'blitzmax'=> true, 'bmax'=> true, 'bnf'=> true, 'boa'=> true, 'boo'=> true, 'boogie'=> true, 'bplus'=> true, 'brainfuck'=> true, 'bro'=> true, 'bsdmake'=> true, 'bst'=> true, 'bst-pybtex'=> true, 'bugs'=> true, 'c'=> true, 'c#'=> true, 'c++'=> true, 'c++-objdumb'=> true, 'c-objdump'=> true, 'ca65'=> true, 'cadl'=> true, 'camkes'=> true, 'capdl'=> true, 'capnp'=> true, 'cbmbas'=> true, 'ceylon'=> true, 'cf3'=> true, 'cfc'=> true, 'cfengine3'=> true, 'cfg'=> true, 'cfm'=> true, 'cfs'=> true, 'chai'=> true, 'chaiscript'=> true, 'chapel'=> true, 'charmci'=> true, 'cheetah'=> true, 'chpl'=> true, 'cirru'=> true, 'cl'=> true, 'clay'=> true, 'clean'=> true, 'clipper'=> true, 'clj'=> true, 'cljs'=> true, 'clojure'=> true, 'clojurescript'=> true, 'cmake'=> true, 'cobol'=> true, 'cobolfree'=> true, 'coffee'=> true, 'coffee-script'=> true, 'coffeescript'=> true, 'common-lisp'=> true, 'componentpascal'=> true, 'console'=> true, 'control'=> true, 'coq'=> true, 'cp'=> true, 'cpp'=> true, 'cpp-objdump'=> true, 'cpsa'=> true, 'cr'=> true, 'crmsh'=> true, 'croc'=> true, 'cry'=> true, 'cryptol'=> true, 'crystal'=> true, 'csh'=> true, 'csharp'=> true, 'csound'=> true, 'csound-csd'=> true, 'csound-document'=> true, 'csound-orc'=> true, 'csound-sco'=> true, 'csound-score'=> true, 'css'=> true, 'css+django'=> true, 'css+erb'=> true, 'css+genshi'=> true, 'css+genshitext'=> true, 'css+jinja'=> true, 'css+lasso'=> true, 'css+mako'=> true, 'css+mozpreproc'=> true, 'css+myghty'=> true, 'css+php'=> true, 'css+ruby'=> true, 'css+smarty'=> true, 'cu'=> true, 'cucumber'=> true, 'cuda'=> true, 'cxx-objdump'=> true, 'cypher'=> true, 'cython'=> true, 'd'=> true, 'd-objdump'=> true, 'dart'=> true, 'dasm16'=> true, 'debcontrol'=> true, 'debsources'=> true, 'delphi'=> true, 'devicetree'=> true, 'dg'=> true, 'diff'=> true, 'django'=> true, 'dmesg'=> true, 'do'=> true, 'docker'=> true, 'dockerfile'=> true, 'dosbatch'=> true, 'doscon'=> true, 'dosini'=> true, 'dpatch'=> true, 'dtd'=> true, 'dts'=> true, 'duby'=> true, 'duel'=> true, 'dylan'=> true, 'dylan-console'=> true, 'dylan-lid'=> true, 'dylan-repl'=> true, 'earl-grey'=> true, 'earlgrey'=> true, 'easytrieve'=> true, 'ebnf'=> true, 'ec'=> true, 'ecl'=> true, 'eg'=> true, 'eiffel'=> true, 'elisp'=> true, 'elixir'=> true, 'elm'=> true, 'emacs'=> true, 'emacs-lisp'=> true, 'email'=> true, 'eml'=> true, 'erb'=> true, 'erl'=> true, 'erlang'=> true, 'evoque'=> true, 'ex'=> true, 'execline'=> true, 'exs'=> true, 'extempore'=> true, 'ezhil'=> true, 'f#'=> true, 'factor'=> true, 'fan'=> true, 'fancy'=> true, 'felix'=> true, 'fennel'=> true, 'fish'=> true, 'fishshell'=> true, 'flatline'=> true, 'flo'=> true, 'floscript'=> true, 'flx'=> true, 'fnl'=> true, 'forth'=> true, 'fortran'=> true, 'fortranfixed'=> true, 'foxpro'=> true, 'freefem'=> true, 'fsharp'=> true, 'fstar'=> true, 'fy'=> true, 'gap'=> true, 'gas'=> true, 'gawk'=> true, 'gd'=> true, 'gdscript'=> true, 'genshi'=> true, 'genshitext'=> true, 'gherkin'=> true, 'glsl'=> true, 'gnuplot'=> true, 'go'=> true, 'golo'=> true, 'gooddata-cl'=> true, 'gosu'=> true, 'groff'=> true, 'groovy'=> true, 'gst'=> true, 'haml'=> true, 'handlebars'=> true, 'haskell'=> true, 'haxe'=> true, 'haxeml'=> true, 'hexdump'=> true, 'hlsl'=> true, 'hs'=> true, 'hsa'=> true, 'hsail'=> true, 'hspec'=> true, 'html'=> true, 'html+cheetah'=> true, 'html+django'=> true, 'html+erb'=> true, 'html+evoque'=> true, 'html+genshi'=> true, 'html+handlebars'=> true, 'html+jinja'=> true, 'html+kid'=> true, 'html+lasso'=> true, 'html+mako'=> true, 'html+myghty'=> true, 'html+ng2'=> true, 'html+php'=> true, 'html+ruby'=> true, 'html+smarty'=> true, 'html+spitfire'=> true, 'html+twig'=> true, 'html+velocity'=> true, 'htmlcheetah'=> true, 'htmldjango'=> true, 'http'=> true, 'hx'=> true, 'hxml'=> true, 'hxsl'=> true, 'hy'=> true, 'hybris'=> true, 'hylang'=> true, 'i6'=> true, 'i6t'=> true, 'i7'=> true, 'icon'=> true, 'idl'=> true, 'idl4'=> true, 'idr'=> true, 'idris'=> true, 'iex'=> true, 'igor'=> true, 'igorpro'=> true, 'ik'=> true, 'inform6'=> true, 'inform7'=> true, 'ini'=> true, 'io'=> true, 'ioke'=> true, 'irb'=> true, 'irc'=> true, 'isabelle'=> true, 'j'=> true, 'jade'=> true, 'jags'=> true, 'jasmin'=> true, 'jasminxt'=> true, 'java'=> true, 'javascript'=> true, 'javascript+cheetah'=> true, 'javascript+django'=> true, 'javascript+erb'=> true, 'javascript+genshi'=> true, 'javascript+genshitext'=> true, 'javascript+jinja'=> true, 'javascript+lasso'=> true, 'javascript+mako'=> true, 'javascript+mozpreproc'=> true, 'javascript+myghty'=> true, 'javascript+php'=> true, 'javascript+ruby'=> true, 'javascript+smarty'=> true, 'javascript+spitfire'=> true, 'jbst'=> true, 'jcl'=> true, 'jinja'=> true, 'jl'=> true, 'jlcon'=> true, 'jproperties'=> true, 'js'=> true, 'js+cheetah'=> true, 'js+django'=> true, 'js+erb'=> true, 'js+genshi'=> true, 'js+genshitext'=> true, 'js+jinja'=> true, 'js+lasso'=> true, 'js+mako'=> true, 'js+myghty'=> true, 'js+php'=> true, 'js+ruby'=> true, 'js+smarty'=> true, 'js+spitfire'=> true, 'jsgf'=> true, 'json'=> true, 'json-ld'=> true, 'json-object'=> true, 'jsonld'=> true, 'jsonml+bst'=> true, 'jsp'=> true, 'julia'=> true, 'juttle'=> true, 'kal'=> true, 'kconfig'=> true, 'kernel-config'=> true, 'kid'=> true, 'kmsg'=> true, 'koka'=> true, 'kotlin'=> true, 'ksh'=> true, 'lagda'=> true, 'lasso'=> true, 'lassoscript'=> true, 'latex'=> true, 'lcry'=> true, 'lcryptol'=> true, 'lean'=> true, 'less'=> true, 'lhaskell'=> true, 'lhs'=> true, 'lid'=> true, 'lidr'=> true, 'lidris'=> true, 'lighttpd'=> true, 'lighty'=> true, 'limbo'=> true, 'linux-config'=> true, 'liquid'=> true, 'lisp'=> true, 'literate-agda'=> true, 'literate-cryptol'=> true, 'literate-haskell'=> true, 'literate-idris'=> true, 'live-script'=> true, 'livescript'=> true, 'llvm'=> true, 'llvm-mir'=> true, 'llvm-mir-body'=> true, 'logos'=> true, 'logtalk'=> true, 'lsl'=> true, 'lua'=> true, 'm2'=> true, 'make'=> true, 'makefile'=> true, 'mako'=> true, 'man'=> true, 'maql'=> true, 'mask'=> true, 'mason'=> true, 'mathematica'=> true, 'matlab'=> true, 'matlabsession'=> true, 'mawk'=> true, 'md'=> true, 'menuconfig'=> true, 'mf'=> true, 'mime'=> true, 'minid'=> true, 'miniscript'=> true, 'mma'=> true, 'modelica'=> true, 'modula2'=> true, 'moin'=> true, 'monkey'=> true, 'monte'=> true, 'moo'=> true, 'moocode'=> true, 'moon'=> true, 'moonscript'=> true, 'mosel'=> true, 'mozhashpreproc'=> true, 'mozpercentpreproc'=> true, 'mq4'=> true, 'mq5'=> true, 'mql'=> true, 'mql4'=> true, 'mql5'=> true, 'ms'=> true, 'msc'=> true, 'mscgen'=> true, 'mupad'=> true, 'mxml'=> true, 'myghty'=> true, 'mysql'=> true, 'nasm'=> true, 'nawk'=> true, 'nb'=> true, 'ncl'=> true, 'nemerle'=> true, 'nesc'=> true, 'newlisp'=> true, 'newspeak'=> true, 'ng2'=> true, 'nginx'=> true, 'nim'=> true, 'nimrod'=> true, 'nit'=> true, 'nix'=> true, 'nixos'=> true, 'notmuch'=> true, 'nroff'=> true, 'nsh'=> true, 'nsi'=> true, 'nsis'=> true, 'numpy'=> true, 'nusmv'=> true, 'obj-c'=> true, 'obj-c++'=> true, 'obj-j'=> true, 'objc'=> true, 'objc++'=> true, 'objdump'=> true, 'objdump-nasm'=> true, 'objective-c'=> true, 'objective-c++'=> true, 'objective-j'=> true, 'objectivec'=> true, 'objectivec++'=> true, 'objectivej'=> true, 'objectpascal'=> true, 'objj'=> true, 'ocaml'=> true, 'octave'=> true, 'odin'=> true, 'ooc'=> true, 'opa'=> true, 'openbugs'=> true, 'openedge'=> true, 'pacmanconf'=> true, 'pan'=> true, 'parasail'=> true, 'pas'=> true, 'pascal'=> true, 'pawn'=> true, 'pcmk'=> true, 'peg'=> true, 'perl'=> true, 'perl6'=> true, 'php'=> true, 'php3'=> true, 'php4'=> true, 'php5'=> true, 'pig'=> true, 'pike'=> true, 'pkgconfig'=> true, 'pl'=> true, 'pl6'=> true, 'plpgsql'=> true, 'po'=> true, 'pointless'=> true, 'pony'=> true, 'posh'=> true, 'postgres'=> true, 'postgres-console'=> true, 'postgresql'=> true, 'postgresql-console'=> true, 'postscr'=> true, 'postscript'=> true, 'pot'=> true, 'pov'=> true, 'powershell'=> true, 'praat'=> true, 'progress'=> true, 'prolog'=> true, 'promql'=> true, 'properties'=> true, 'proto'=> true, 'protobuf'=> true, 'ps1'=> true, 'ps1con'=> true, 'psm1'=> true, 'psql'=> true, 'psysh'=> true, 'pug'=> true, 'puppet'=> true, 'py'=> true, 'py2'=> true, 'py2tb'=> true, 'py3'=> true, 'py3tb'=> true, 'pycon'=> true, 'pypy'=> true, 'pypylog'=> true, 'pyrex'=> true, 'pytb'=> true, 'python'=> true, 'python2'=> true, 'python3'=> true, 'pyx'=> true, 'qbasic'=> true, 'qbs'=> true, 'qml'=> true, 'qvt'=> true, 'qvto'=> true, 'r'=> true, 'racket'=> true, 'ragel'=> true, 'ragel-c'=> true, 'ragel-cpp'=> true, 'ragel-d'=> true, 'ragel-em'=> true, 'ragel-java'=> true, 'ragel-objc'=> true, 'ragel-rb'=> true, 'ragel-ruby'=> true, 'raku'=> true, 'raw'=> true, 'rb'=> true, 'rbcon'=> true, 'rconsole'=> true, 'rd'=> true, 'reason'=> true, 'reasonml'=> true, 'rebol'=> true, 'red'=> true, 'red/system'=> true, 'redcode'=> true, 'registry'=> true, 'resource'=> true, 'resourcebundle'=> true, 'rest'=> true, 'restructuredtext'=> true, 'rexx'=> true, 'rhtml'=> true, 'ride'=> true, 'rkt'=> true, 'rnc'=> true, 'rng-compact'=> true, 'roboconf-graph'=> true, 'roboconf-instances'=> true, 'robotframework'=> true, 'rout'=> true, 'rql'=> true, 'rs'=> true, 'rsl'=> true, 'rst'=> true, 'rts'=> true, 'ruby'=> true, 'rust'=> true, 's'=> true, 'sage'=> true, 'salt'=> true, 'sarl'=> true, 'sas'=> true, 'sass'=> true, 'sbatch'=> true, 'sc'=> true, 'scala'=> true, 'scaml'=> true, 'scd'=> true, 'scdoc'=> true, 'scheme'=> true, 'scilab'=> true, 'scm'=> true, 'scss'=> true, 'sgf'=> true, 'sh'=> true, 'shell'=> true, 'shell-session'=> true, 'shen'=> true, 'shex'=> true, 'shexc'=> true, 'sieve'=> true, 'silver'=> true, 'singularity'=> true, 'slash'=> true, 'slim'=> true, 'sls'=> true, 'slurm'=> true, 'smali'=> true, 'smalltalk'=> true, 'smarty'=> true, 'sml'=> true, 'snobol'=> true, 'snowball'=> true, 'solidity'=> true, 'sources.list'=> true, 'sourceslist'=> true, 'sp'=> true, 'sparql'=> true, 'spec'=> true, 'spitfire'=> true, 'splus'=> true, 'sql'=> true, 'sqlite3'=> true, 'squeak'=> true, 'squid'=> true, 'squid.conf'=> true, 'squidconf'=> true, 'ssp'=> true, 'st'=> true, 'stan'=> true, 'stata'=> true, 'supercollider'=> true, 'sv'=> true, 'swift'=> true, 'swig'=> true, 'systemverilog'=> true, 't-sql'=> true, 'tads3'=> true, 'tap'=> true, 'tasm'=> true, 'tcl'=> true, 'tcsh'=> true, 'tcshcon'=> true, 'tea'=> true, 'teraterm'=> true, 'teratermmacro'=> true, 'termcap'=> true, 'terminfo'=> true, 'terraform'=> true, 'tex'=> true, 'text'=> true, 'tf'=> true, 'thrift'=> true, 'tid'=> true, 'tnt'=> true, 'todotxt'=> true, 'toml'=> true, 'trac-wiki'=> true, 'trafficscript'=> true, 'treetop'=> true, 'ts'=> true, 'tsql'=> true, 'ttl'=> true, 'turtle'=> true, 'twig'=> true, 'typescript'=> true, 'typoscript'=> true, 'typoscriptcssdata'=> true, 'typoscripthtmldata'=> true, 'ucode'=> true, 'udiff'=> true, 'unicon'=> true, 'urbiscript'=> true, 'usd'=> true, 'usda'=> true, 'v'=> true, 'vala'=> true, 'vapi'=> true, 'vb.net'=> true, 'vbnet'=> true, 'vbscript'=> true, 'vcl'=> true, 'vclsnippet'=> true, 'vclsnippets'=> true, 'vctreestatus'=> true, 'velocity'=> true, 'verilog'=> true, 'vfp'=> true, 'vgl'=> true, 'vhdl'=> true, 'vim'=> true, 'wdiff'=> true, 'webidl'=> true, 'whiley'=> true, 'winbatch'=> true, 'winbugs'=> true, 'x10'=> true, 'xbase'=> true, 'xml'=> true, 'xml+cheetah'=> true, 'xml+django'=> true, 'xml+erb'=> true, 'xml+evoque'=> true, 'xml+genshi'=> true, 'xml+jinja'=> true, 'xml+kid'=> true, 'xml+lasso'=> true, 'xml+mako'=> true, 'xml+myghty'=> true, 'xml+php'=> true, 'xml+ruby'=> true, 'xml+smarty'=> true, 'xml+spitfire'=> true, 'xml+velocity'=> true, 'xorg.conf'=> true, 'xq'=> true, 'xql'=> true, 'xqm'=> true, 'xquery'=> true, 'xqy'=> true, 'xslt'=> true, 'xten'=> true, 'xtend'=> true, 'xul+mozpreproc'=> true, 'yaml'=> true, 'yaml+jinja'=> true, 'yang'=> true, 'zeek'=> true, 'zephir'=> true, 'zig'=> true, 'zsh'=> true,]
MediaWiki exception.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition Site.php:31
__unserialize( $fields)
Definition Site.php:719
normalizePageName( $pageName)
Attempt to normalize the page name in some fashion.
Definition Site.php:406
shouldForward()
Gets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
Definition Site.php:238
setPath( $pathType, $fullUrl)
Sets the path used to construct links with.
Definition Site.php:600
const TYPE_MEDIAWIKI
Definition Site.php:33
getExtraData()
Returns the type specific fields.
Definition Site.php:417
setGroup( $group)
Sets the group of the site (ie wikipedia).
Definition Site.php:194
addInterwikiId( $identifier)
Adds an interwiki id to the site.
Definition Site.php:536
getPath( $pathType)
Returns the path of the provided type or false if there is no such path.
Definition Site.php:621
const GROUP_NONE
Definition Site.php:35
setForward( $shouldForward)
Sets if site.tld/path/key:pageTitle should forward users to the page on the actual site,...
Definition Site.php:252
setSource( $source)
Sets the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
Definition Site.php:222
string $type
Definition Site.php:65
array $extraConfig
Definition Site.php:110
array $extraData
Definition Site.php:103
getSource()
Returns the source of the site data (ie 'local', 'wikidata', 'my-magical-repo').
Definition Site.php:209
__serialize()
Definition Site.php:686
static newForType( $siteType)
Definition Site.php:658
getProtocol()
Returns the protocol of the site.
Definition Site.php:292
getType()
Returns the type of the site (ie mediawiki).
Definition Site.php:170
int null $internalId
Definition Site.php:124
removePath( $pathType)
Removes the path of the provided type if it's set.
Definition Site.php:645
addLocalId( $type, $identifier)
Adds a local identifier.
Definition Site.php:515
setLanguageCode( $languageCode)
Sets language code of the sites primary language.
Definition Site.php:473
getGlobalId()
Returns the global site identifier (ie enwiktionary).
Definition Site.php:142
setGlobalId( $globalId)
Sets the global site identifier (ie enwiktionary).
Definition Site.php:155
array[] false $localIds
Holds the local ids for this site.
Definition Site.php:96
getLinkPathType()
Returns the main path type, that is the type of the path that should generally be used to construct l...
Definition Site.php:359
const PATH_LINK
Definition Site.php:42
const TYPE_UNKNOWN
Definition Site.php:32
const ID_EQUIVALENT
Definition Site.php:38
getExtraConfig()
Returns the type specific config.
Definition Site.php:439
addNavigationId( $identifier)
Adds a navigation id to the site.
Definition Site.php:547
getPageUrl( $pageName=false)
Returns the full URL for the given page on the site.
Definition Site.php:378
string null $languageCode
Definition Site.php:86
getAllPaths()
Returns the paths as associative array.
Definition Site.php:634
getLocalIds()
Returns all local ids.
Definition Site.php:585
unserialize( $serialized)
Definition Site.php:708
const ID_INTERWIKI
Definition Site.php:37
getGroup()
Gets the group of the site (ie wikipedia).
Definition Site.php:181
setInternalId( $internalId=null)
Sets the internal identifier for the site.
Definition Site.php:503
string $source
Definition Site.php:79
serialize()
Definition Site.php:675
getLanguageCode()
Returns language code of the sites primary language.
Definition Site.php:462
getInternalId()
Returns the set internal identifier for the site.
Definition Site.php:491
bool $forward
Definition Site.php:117
const SOURCE_LOCAL
Definition Site.php:40
setExtraConfig(array $extraConfig)
Sets the type specific config.
Definition Site.php:450
__construct( $type=self::TYPE_UNKNOWN)
Definition Site.php:131
getNavigationIds()
Returns the equivalent link identifiers that can be used to make the site show up in interfaces such ...
Definition Site.php:572
string null $globalId
Definition Site.php:58
string $group
Definition Site.php:72
getDomain()
Returns the domain of the site, ie en.wikipedia.org Or null if it's not known.
Definition Site.php:268
getLinkPath()
Returns the path used to construct links with or false if there is no such path.
Definition Site.php:342
setLinkPath( $fullUrl)
Sets the path used to construct links with.
Definition Site.php:325
getInterwikiIds()
Returns the interwiki link identifiers that can be used for this site.
Definition Site.php:558
setExtraData(array $extraData)
Sets the type specific fields.
Definition Site.php:428
$source
foreach( $res as $row) $serialized