Commit Graph

31 Commits

Author SHA1 Message Date
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
desrosj
038904da7c I18N: Correct recurring lenghts typo.
Props mikaelmayer.
Fixes #53600.
Built from https://develop.svn.wordpress.org/trunk@51342


git-svn-id: http://core.svn.wordpress.org/trunk@50951 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 13:52:57 +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
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
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Drew Jaynes
9992044ce6 Docs: Add missing @return notations to three MO method DocBlocks.
Props subrataemfluence.
Fixes #44421.

Built from https://develop.svn.wordpress.org/trunk@44336


git-svn-id: http://core.svn.wordpress.org/trunk@44166 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-19 17:04:48 +00:00
Dominik Schilling
a7bb083120 I18N: In the POMO library, replace chr() calls for static values with their string representation.
Props ccismaru, ocean90.
Fixes #17128.
Built from https://develop.svn.wordpress.org/trunk@43635


git-svn-id: http://core.svn.wordpress.org/trunk@43464 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-09-12 06:11:26 +00:00
Gary Pendergast
56c162fbc9 Coding Standards: Upgrade WPCS to 1.0.0
WPCS 1.0.0 includes a bunch of new auto-fixers, which drops the number of coding standards issues across WordPress significantly. Prior to running the auto-fixers, there were 15,312 issues detected. With this commit, we now drop to 4,769 issues.

This change includes three notable additions:
- Multiline function calls must now put each parameter on a new line.
- Auto-formatting files is now part of the `grunt precommit` script. 
- Auto-fixable coding standards issues will now cause Travis failures.

Fixes #44600.


Built from https://develop.svn.wordpress.org/trunk@43571


git-svn-id: http://core.svn.wordpress.org/trunk@43400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-08-17 01:51:36 +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
Dominik Schilling
7819e2b4ba I18N: Introduce a locale-switching function.
With the introduction of user-specific languages in [38705] it's necessary to be able to switch translations on the fly. For example emails should be sent in the language of the recipient and not the one of the current user.

This introduces a new `WP_Locale_Switcher` class which is used for switching locales and translations. It holds the stack of locales whenever `switch_to_locale( $locale )` is called. With `restore_previous_locale()` you can restore the previous locale. `restore_current_locale()` empties the stack and sets the locale back to the initial value.

`switch_to_locale()` is added to most of core's email functions, either with the value of `get_locale()` (site language) or `get_user_locale()` (user language with fallback to site language).

Props yoavf, tfrommen, swissspidy, pbearne, ocean90.
See #29783.
Fixes #26511.
Built from https://develop.svn.wordpress.org/trunk@38961


git-svn-id: http://core.svn.wordpress.org/trunk@38904 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-10-26 15:36:31 +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
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
b35cbbfac7 Add missing @params 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
Sergey Biryukov
9ceb642b2a Introduce a binary-safe wrapper for strlen() and use it in seems_utf8(), utf8_uri_encode(), and wp_read_image_metadata().
Use binary-safe POMO_Reader::strlen() in MO::export_to_file_handle().

fixes #28162.
Built from https://develop.svn.wordpress.org/trunk@28806


git-svn-id: http://core.svn.wordpress.org/trunk@28615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-23 14:48:14 +00:00
Scott Taylor
87730b879f Eliminate the use of extract() in MO::import_from_reader().
See #22400.

Built from https://develop.svn.wordpress.org/trunk@28472


git-svn-id: http://core.svn.wordpress.org/trunk@28299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-17 17:21:14 +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
Ryan Boren
51a5715967 Restore return by ref for make_entry(). Props SergeyBiryukov. fixes #21839
git-svn-id: http://core.svn.wordpress.org/trunk@21793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 17:34:34 +00:00
Ryan Boren
f483a85676 Remove unnecessary return by refs. Props wonderboymusic. fixes #21839
git-svn-id: http://core.svn.wordpress.org/trunk@21792 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-10 17:00:11 +00:00
ryan
e261ac43e7 Avoid 'Only variables should be passed by reference' warnings. Props SergeyBiryukov. see #18975
git-svn-id: http://svn.automattic.com/wordpress/trunk@19072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-10-27 20:00:09 +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
40773a776b Remove trailing whites and double semicolons.
git-svn-id: http://svn.automattic.com/wordpress/trunk@13830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-03-26 19:36:49 +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
e8b6fe7347 Trim trailing whitespace
git-svn-id: http://svn.automattic.com/wordpress/trunk@10810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2009-03-18 02:43:45 +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