Sergey Biryukov
4f856dfae0
Code Modernization: Use stream_get_contents()
in POMO_FileReader::read_all()
.
...
`stream_get_contents()` is faster than `fread()`, because the PHP core can decide how to best read the remaining file; it could decide to issue just one `read()` call or `mmap()` the file first.
Per the PHP manual, `file_get_contents()` or `stream_get_contents()` is the preferred way to read the contents of a file into a string. It will use memory mapping techniques if supported by the OS to enhance performance.
Reference: [https://www.php.net/manual/en/function.file-get-contents.php PHP Manual: file_get_contents()].
Follow-up to [12174].
Props maxkellermann.
See #55069 .
Built from https://develop.svn.wordpress.org/trunk@52696
git-svn-id: http://core.svn.wordpress.org/trunk@52285 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-09 12:33:05 +00:00
hellofromTonya
234877c9c3
Coding Standards: Add public
visibility to methods in src
directory.
...
This commit adds the `public` visibility keyword to each method which did not have an explicit visibility keyword.
Why `public`?
With no visibility previously declared, these methods are implicitly `public` and available for use. Changing them to anything else would be a backwards-compatibility break.
Props costdev, jrf.
See #54177 .
Built from https://develop.svn.wordpress.org/trunk@51919
git-svn-id: http://core.svn.wordpress.org/trunk@51512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-18 17:52:58 +00:00
Sergey Biryukov
a30afc155e
General: Avoid a PHP warning when checking the mbstring.func_overload
PHP value.
...
This avoids "A non-numeric value encountered" warning when `mbstring.func_overload` is set to something other than a numeric string, e.g. an empty string instead of the default `'0'` value.
Props djbu.
Fixes #53282 .
Built from https://develop.svn.wordpress.org/trunk@51032
git-svn-id: http://core.svn.wordpress.org/trunk@50641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 16:05:59 +00:00
Sergey Biryukov
30d9432760
Code Modernization: Use explicit visibility for class property declarations.
...
Using `var` or only `static` to declare a class property is PHP 4 code.
This updates the codebase to use explicit visibility modifiers introduced in PHP 5.
Props jrf.
Fixes #51557 . See #22234 .
Built from https://develop.svn.wordpress.org/trunk@49184
git-svn-id: http://core.svn.wordpress.org/trunk@48946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-17 16:26:09 +00:00
John Blackbourn
905460bd5e
Docs: Standardise the type name for booleans and integers.
...
This brings these docs inline with the documentation standards.
Props ravipatel, justinahinon
Fixes #51426
Built from https://develop.svn.wordpress.org/trunk@49120
git-svn-id: http://core.svn.wordpress.org/trunk@48882 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-10 20:02:05 +00:00
desrosj
27485fd7aa
General: Continuing to work towards a passing PHP Compatibility scan.
...
This is a final pass to fix PHP compatibiilty issues in the codebase with code changes or adding `phpcs:ignore` comments.
With this change, all PHP compatibility warnings and errors without specific tickets have been addressed (see #49810 and #41750 ).
Props desrosj, johnbillion, jrf.
See #49922 .
Built from https://develop.svn.wordpress.org/trunk@47902
git-svn-id: http://core.svn.wordpress.org/trunk@47676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-03 17:40:12 +00:00
Sergey Biryukov
7932193708
Coding Standards: Use strict comparison where static strings are involved.
...
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.
Includes minor code layout fixes for better readability.
See #49542 .
Built from https://develop.svn.wordpress.org/trunk@47808
git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov
24650cbd68
Code Modernization: Call PHP 5 constructors in methods extending POMO_Reader
.
...
Follow-up to [46629].
See #48252 .
Built from https://develop.svn.wordpress.org/trunk@46632
git-svn-id: http://core.svn.wordpress.org/trunk@46432 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-02 20:49:01 +00:00
Sergey Biryukov
6cd00d098e
Docs: Correct version number in @deprecated
tags for PHP 4 constructors in pomo/entry.php
and pomo/streams.php
.
...
Follow-up to [46629].
Props jrf.
See #48252 .
Built from https://develop.svn.wordpress.org/trunk@46631
git-svn-id: http://core.svn.wordpress.org/trunk@46431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-02 20:30:01 +00:00
Sergey Biryukov
a0e7056387
Docs: Add missing @deprecated
tags to PHP 4 constructors in pomo/entry.php
and pomo/streams.php
.
...
Props jrf.
Fixes #48252 .
Built from https://develop.svn.wordpress.org/trunk@46629
git-svn-id: http://core.svn.wordpress.org/trunk@46429 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-02 20:11:04 +00:00
Gary Pendergast
55af0f0d0a
Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName
violations.
...
See #47632
Built from https://develop.svn.wordpress.org/trunk@45580
git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:01:57 +00:00
Gary Pendergast
5ed802faf4
Docs: Correct the docs for POMO_Reader::setEndian()
.
...
The parameter type and name where the wrong way around.
Props ishitaka.
Fixes #45410 .
Built from https://develop.svn.wordpress.org/trunk@44614
git-svn-id: http://core.svn.wordpress.org/trunk@44445 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-16 05:36:48 +00:00
Drew Jaynes
d738d15862
Docs: Fix the syntax for a parameter notation and separately add a missing return notation for two POMO_Reader
methods.
...
Props subrataemfluence.
Fixes #44422 .
Built from https://develop.svn.wordpress.org/trunk@44326
git-svn-id: http://core.svn.wordpress.org/trunk@44156 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 07:06:49 +00:00
Gary Pendergast
aaf99e6913
Code is Poetry.
...
WordPress' code just... wasn't.
This is now dealt with.
Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057 .
Built from https://develop.svn.wordpress.org/trunk@42343
git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Dion Hulse
048f327bfc
Merge the changes to GlotPress's POMO from upstream to WordPress's copy.
...
Fixes #34748
Built from https://develop.svn.wordpress.org/trunk@35714
git-svn-id: http://core.svn.wordpress.org/trunk@35678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-20 04:34:25 +00:00
Scott Taylor
84da11d918
Pass false
as the 2nd argument to class_exists()
to disable autoloading and to not cause problems for those who define __autoload()
.
...
Fixes #20523 .
Built from https://develop.svn.wordpress.org/trunk@34348
git-svn-id: http://core.svn.wordpress.org/trunk@34312 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-20 03:52:25 +00:00
Aaron Jorbin
1525010f74
Deprecate php4 style constructors
...
PHP7 is deprecating PHP4 style constructors, so we need to modify our code to have _construct methods that fire before the named PHP4 style constructors. The PHP4 style constructors will call the PHP5 style constructor in case it is being called directly (usually via parent::METHOD).
This modifies external libraries to add PHP5 style constructors, but doesn't add a notice for when they are used. In WordPress core code, PHP4 style constructors are being given a call to _deprecated_constructor. To the PHP4 style constructor I say "I know that I can't take no more | It ain't no lie | I wanna see you out that door | Baby, bye, bye, bye..."
Upstream: https://wiki.php.net/rfc/remove_php4_constructors
Props jdgrimes, netweb, jorbin
See #31982
Built from https://develop.svn.wordpress.org/trunk@32990
git-svn-id: http://core.svn.wordpress.org/trunk@32961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-28 15:27:24 +00:00
Scott Taylor
42d51a4f89
Add doc blocks to functions that are missing them.
...
If the function has no need for `@param` or `@return`, do an archeaological dig to find `@since`.
See #32444 .
Built from https://develop.svn.wordpress.org/trunk@32672
git-svn-id: http://core.svn.wordpress.org/trunk@32642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-31 03:18:25 +00:00
Scott Taylor
bce851dcf2
Replace array_shift()
with reset()
where appropriate for performance.
...
Props SergeyBiryukov.
Fixes #31259 .
Built from https://develop.svn.wordpress.org/trunk@31829
git-svn-id: http://core.svn.wordpress.org/trunk@31811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-03-19 03:56:27 +00:00
Scott Taylor
b35cbbfac7
Add missing @param
s to src/wp-includes/pomo
files.
...
See #30224 .
Built from https://develop.svn.wordpress.org/trunk@30663
git-svn-id: http://core.svn.wordpress.org/trunk@30653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-30 21:41:22 +00:00
Nikolay Bachiyski
dcc0729a6c
Sync POMO with GlotPress
...
See http://glotpress.trac.wordpress.org/browser/trunk/pomo/
git-svn-id: http://core.svn.wordpress.org/trunk@22349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-10-31 22:13:51 +00:00
nbachiyski
688eebdc26
Sync pomo library with the current GlotPress version
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@18528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-08-11 04:29:35 +00:00
nacin
5a20c05d27
Phpdoc argument/@param cleanups. props duck_, see #14783 .
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@15590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-09-07 11:21:11 +00:00
markjaquith
09e8d27130
Whitespace cleanup
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@13316 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-22 23:12:48 +00:00
ryan
3b98150c82
Sync pomo. Props nbachiyski. fixes #11832
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@13228 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-02-19 18:01:50 +00:00
ryan
e5a98d208a
pomo performance improvements. Props nbachiyski. fixes #10165
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@12174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-11-12 16:05:43 +00:00
westi
cd36d71ed9
Merge updated pomo code. Includes new NOOP_Translations class see #10971 props nbachiyski.
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@12079 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-10-21 07:06:55 +00:00
ryan
4c0207a772
Merge latest pomo. Works around mbstring.func_overload. Props nbachiyski. fixes #10236 for trunk
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@11626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-06-23 16:32:52 +00:00
ryan
5dfddd7b18
Switch to pomo lib. Support gettext contexts. Deprecate long form functions. Props nbachiyski. fixes #9112 #9111
...
git-svn-id: http://svn.automattic.com/wordpress/trunk@10584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-02-17 05:03:29 +00:00