Commit graph

28 commits

Author SHA1 Message Date
Kunal Mehta
6e9b4f0e9c Convert all array() syntax to []
Per wikitech-l consensus:
 https://lists.wikimedia.org/pipermail/wikitech-l/2016-February/084821.html

Notes:
* Disabled CallTimePassByReference due to false positives (T127163)

Change-Id: I2c8ce713ce6600a0bb7bf67537c87044c7a45c4b
2016-02-17 01:33:00 -08:00
jenkins-bot
d4ecfc1a5c Merge "Don't modify $wgHooks on language object construction" 2016-02-11 04:05:56 +00:00
Tim Starling
f43e0d840f Use autoloader for PHP data files instead of include/require
Move ZhConversion.php and Names.php to languages/data and make them both
expose their data as static class variables instead of in the local
scope. This means that the autoloader can be used to load the data,
which is efficient and secure. This also makes additional request-local
caching of the arrays unnecessary.

Change-Id: Iafb96ac4165d0965fcb9a69f1d0a91139ea9790c
2016-01-30 13:08:46 +11:00
Tim Starling
059fd9a2ae Don't modify $wgHooks on language object construction
Previously various language objects would install a hook to update the
shared conversion table cache when the object was constructed. This is
not a good idea since language objects may be constructed even when they
are not the content language, but only the content language is
associated with variant conversion and the conversion cache.

Instead, have WikiPage call a method on $wgContLang directly. I put this
with message cache update since the logic is almost identical.

Change-Id: Ief9c0ef993e39645e74a6e158cb4e6e2139ce91d
2016-01-29 15:03:56 +11:00
Tim Starling
e0a74a848c Remove require_once for language classes
Remove require_once for LanguageConverter and base classes. These
are in the autoloader now, so an explicit require is no longer
necessary.

Change-Id: Ie34ffc58fd9ec89fb57cf077dd5ac1746c35c48e
2016-01-29 10:05:25 +11:00
Siebrand Mazeland
03b2b42084 Make languages/classes pass phpcs-strict
Change-Id: I0985f3c7e4b36338c68a4a63cfba4eaa4af567c0
2014-04-22 14:13:02 +02:00
umherirrender
55e8a9abfd Fixed some @params documentation (languages)
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.

Change-Id: I7a4dec6a8de96ee21ef34e52bb755f723aa3b0e6
2014-04-17 13:32:54 +00:00
Timo Tijhof
beb1c4a0ec phpcs: More require/include is not a function
Follows-up I1343872de7, Ia533aedf63 and I2df2f80b81.

Also updated usage in text in documentation and the
installer LocalSettingsGenerator.

Most of them were handled by this regex:
- find: (require|include|require_once|include_once)\s*\(\s*(.+?)\s*\)\s*;$
- replace: $1 $2;

Change-Id: I6b38aad9a5149c9c43ce18bd8edbab14b8ce43fa
2013-05-21 23:26:28 +02:00
umherirrender
3c7bcf4658 Fixed spacing in languages folder
Added spaces before if
Added some braces for one line statements

Change-Id: I980771894369499646532b13b801db6447381773
2013-04-17 21:10:02 +02:00
Kevin Israel
4c69569db7 Get rid of preg_replace( '/.../e', ... )
This is deprecated as of PHP 5.5, and the remaining uses are quite
silly. Tim said I should remove his easter egg from Special:Version,
as it already was broken, and a new one can be added in a separate
commit.

Change-Id: I0f09f4efc7afe5933c8317462026a475530a5324
2013-04-09 02:31:57 +00:00
Liangent
e01adbfc0b Clean up Language::markNoConversion().
* IRIs are getting more and more widely used these days so Chinese
  characters are also needed to be prevented from being converted
  in text of external links.
* So now all markNoConversion() functions in languages with variants
  do the same thing. Merge them into a single function in the
  Language class and drop implementations in individual languages.
* By the way rephrase phpdoc of that function, and (bug 24798) fix
  the link detection regex to use wfUrlProtocolsWithoutProtRel().
  Protocol-relative regex is excluded to avoid false positives.
* Add parser test for it.

Change-Id: I2ec0ac2b9b11221584adb72555168498de209d57
2012-11-18 03:46:53 +08:00
Siebrand Mazeland
4b62b0339c Prefix new ContentHandler hooks in WikiPage with Page instead of Article
Covers 3 hooks:
* ArticleContentInsertComplete -> PageContentInsertComplete
* ArticleContentSave -> PageContentSave
* ArticleContentSaveComplete -> PageContentSaveComplete

Change-Id: I186669a5941d8982725ed364b481215d291b2043
2012-10-11 18:22:52 +02:00
daniel
a138706729 Fix usage of deprecated ArticleSaveComplete hook in core
Change-Id: Ic01fd95d50a909470d6f0ffd93c972322789d49a
2012-10-08 14:13:59 +02:00
daniel
9994968774 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 15:20:15 +02:00
Daniel Kinzler
392af46809 Revert "merged master"
This reverts commit 67bfdc7a68
2012-08-29 13:14:49 +00:00
daniel
67bfdc7a68 merged master
Change-Id: Ib2b879c4daa17401eeeb50767c0e5a54254855c3
2012-08-29 12:06:38 +02:00
Alexandre Emsenhuber
32eaef76b4 Added missing GPLv2 headers in some places.
Also made file/class documentation more consistent.

Change-Id: I7144b26103ef644fbec751ea476760566757cae3
2012-06-06 22:44:55 +02:00
Sam Reed
b6b807b2bc More documentation! 2011-05-29 16:32:05 +00:00
Sam Reed
e476b51e3a Stylize languages/*, languages/classes/*, but not languages/messages/* 2010-07-29 09:43:18 +00:00
Philip Tzou
279a29cdc1 1. Fix the underline bug in the title(namespace) conversion, which displayed title like "User_talk:Example".
2. Improve the function of namespace conversion. Allow admins to custom namespace conversion in MediaWiki's messages([[MediaWiki:conversion-nsX]]).
2010-07-06 05:00:15 +00:00
Philip Tzou
d6b6766f3a Follow up r60742, r60743, r60764, r60766, r61214, r61390. Split stripForSearch into wordSegmentation and normalizeForSearch. So the wordSegmentation could be called by search engines separately. 2010-02-02 15:09:01 +00:00
Tim Starling
750b8f7c04 In LanguageConverter:
* Rewrote convertArray() as an RD parser (with inline tokenizer) as suggested on CR r60986. Fixes unclosed rule issue (with parser test). Fixes O(N^2) timing.
* Removed $this->mMarkup abstraction. Life is complicated enough as it is.
* Replaced a couple of instances of explode() with StringUtils::explode(), limited element count in a couple more.

In ConverterRule:
* Removed mConvTable initialisation from the constructor, unnecessary
* Optimised the "-{xxx}-" tight loop by replacing function calls such as count() and in_array() with language constructs such as isset(). Reduced execution time from 356us to 275us.
* Cached $varsep_pattern for further reduction to 243us.
* A couple more parseFlags() hacks brings it back to 230us.
* Split out $this->mVariantFlags from $this->mFlags. Rearranged flag detection into a foreach/switch to avoid unnecessary isset() calls. 189us.
* Added a special-case optimisation to generateConvTable() for the case where there are no tables defined inline in the article. 116us.
* Fixed bug from r37499: "!R || !N" is always true since they are mutually exclusive, "!R && !N" was intended (with parser test).
* Fixed E_NOTICE from "-{N|foo}-"
2010-01-19 02:36:33 +00:00
Philip Tzou
5c8e60f959 follow-up r60764. compatible fix. 2010-01-07 17:48:52 +00:00
Philip Tzou
8bbfbf5628 follow-up r60743.
1. Changed the conditions, not only for LuceneSearch, but also more commonly to others.
2. Reduced code duplication.
2010-01-07 04:50:32 +00:00
Philip Tzou
339f0bb3d9 1. Add conditions to stripForSearch for LuceneSearch / MWSearch.
2. Add double-width roman characters conversion support to zh, gan, and yue.
2010-01-06 19:51:29 +00:00
Alexandre Emsenhuber
c3ec19debc Replaced all @fixme with "@todo Fixme" since doxygen doesn't have a @fixme command 2009-12-15 21:26:58 +00:00
Alexandre Emsenhuber
6cf8499edf * svn:mime-type application/octet-stream -> svn:eol-style native in includes/zhtable
* svn:eol-style native elsewhere
2009-03-23 19:10:28 +00:00
Philip Tzou
b8b9e1e477 1. LanguageConverter enabled for LanguageGan, per the request from Gan Wikipedia.
2. Update the Chinese conversion tables.
2009-03-12 05:04:19 +00:00