Commit Graph

93 Commits

Author SHA1 Message Date
Sergey Biryukov 5e10227d76 Coding Standards: Use strict comparison for return type checks in a few functions:
* `get_bookmark()`
* `get_comment()`
* `get_post()`
* `get_children()`
* `wp_get_recent_posts()`
* `wp_get_post_revision()`
* `wp_get_nav_menu_items()`

Follow-up to [45710] for `get_term()`, [48507] for `wpdb::get_row()` and `wpdb::get_results()`.

See #52627.
Built from https://develop.svn.wordpress.org/trunk@50558


git-svn-id: http://core.svn.wordpress.org/trunk@50171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-21 12:41:04 +00:00
Sergey Biryukov d936f2c959 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48591


git-svn-id: http://core.svn.wordpress.org/trunk@48353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:55:04 +00:00
John Blackbourn 57a3f803ae Docs: First pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48586


git-svn-id: http://core.svn.wordpress.org/trunk@48348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 20:01:04 +00:00
Sergey Biryukov 58ad216087 Docs: Improve documentation for optional parameters per the documentation standards.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48197


git-svn-id: http://core.svn.wordpress.org/trunk@47966 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 11:49:02 +00:00
Sergey Biryukov e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02: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 38676936ba Coding Standards: Use strict type check for `in_array()` and `array_search()` where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +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 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
Sergey Biryukov dd79e6e107 Docs: Correct DocBlock formatting for filters accepting the `$parsed_args` parameter.
Follow-up to [45667].

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


git-svn-id: http://core.svn.wordpress.org/trunk@46896 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-21 15:41:04 +00:00
John Blackbourn 9ac1d82f23 Docs: Further improve documentation of known return types, plus other docs fixes.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46461 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:27:02 +00:00
Sergey Biryukov a1a5df805c Docs: Improve documentation for `get_bookmarks()`.
Props pbiron.
Fixes #48053.
Built from https://develop.svn.wordpress.org/trunk@46152


git-svn-id: http://core.svn.wordpress.org/trunk@45964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-16 19:55:56 +00:00
Sergey Biryukov 18bd01985b Coding Standards: Rename `$r` variable used with `wp_parse_args()` to `$parsed_args` for clarity.
Props freewebmentor.
Fixes #45059.
Built from https://develop.svn.wordpress.org/trunk@45667


git-svn-id: http://core.svn.wordpress.org/trunk@45478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 00:48:58 +00:00
Gary Pendergast 4803fc405e Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in `wp-includes`.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Felix Arntz a71d208785 General: Fix problematic string to array parsing.
WordPress has historically often used code like `preg_split( '/[\s,]+/', $var )` to parse a string of comma-separated values into an array. However, this approach was causing an empty string to not be parsed into an empty array as expected, but rather into an array with the empty string as its sole element.

This was among other areas causing problems in the REST API where passing an empty request parameter could cause that request to fail because, instead of it being ignored, that parameter would be compared against the valid values for it, which typically do not include an empty string.

Props david.binda, sstoqnov.
Fixes #43977.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44377 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 21: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
John Blackbourn 4548b08236 General: Use interpolation instead of concatenation for all dynamic hook names.
This fixes the rendering of the hook names on developer.wordpress.org.

Props keesiemeijer
Fixes #39148

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


git-svn-id: http://core.svn.wordpress.org/trunk@39540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-12-14 04:18:42 +00:00
John Blackbourn b9033ad6a1 Docs: Improve the documentation for parameters which accept `OBJECT`, `ARRAY_A`, and `ARRAY_N` as parameters.
See #37770

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


git-svn-id: http://core.svn.wordpress.org/trunk@39128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-11-09 23:00:32 +00:00
Drew Jaynes 543dc8bef5 Docs: Improve formatting in the DocBlock for `sanitize_bookmark_field()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-27 17:16:27 +00:00
Boone Gorges 20301c4f6f In `get_bookmarks()`, don't cache if 'orderby=rand'.
Props lukecavanagh, prettyboymp, c3mdigital, MikeHansenMe.
Fixes #18356.
Built from https://develop.svn.wordpress.org/trunk@37565


git-svn-id: http://core.svn.wordpress.org/trunk@37533 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-25 18:29:28 +00:00
Drew Jaynes da78aeffe9 Docs: Apply inline `@see` tags to hooks referenced in DocBlocks in a variety of wp-includes/* files.
Applying these specially-crafted `@see` tags allows the Code Reference parser to recognize and link these elements as actions and filters.

See #36921.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37510 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-23 18:59:27 +00:00
Drew Jaynes 9cb5247392 Docs: Standardize filter docs in remaining wp-includes/* files to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37486 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:50:28 +00:00
Drew Jaynes 907e0ce6f1 Docs: Add a missing notation for the `$bookmark_id` parameter in the DocBlock for `clean_bookmark_cache()`.
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-12-18 23:01:28 +00:00
Sergey Biryukov bc1e479fd0 After [35718], update the location of some files in `This filter is documented in` docs.
Partially reverts [33954].

Fixes #33413.
Built from https://develop.svn.wordpress.org/trunk@35725


git-svn-id: http://core.svn.wordpress.org/trunk@35689 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-11-22 03:51:28 +00:00
Scott Taylor c1bb5b5ce3 After [33843], update the location of some files in `This filter is documented in` docs
Props dimadin.
See #33413.

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


git-svn-id: http://core.svn.wordpress.org/trunk@33923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-09-08 22:17:26 +00:00
Scott Taylor e4c19c591f In `bookmark.php`, clarify some `return` docs.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32497 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-21 20:13:25 +00:00
Scott Taylor 60b0cd7943 The keyword `elseif` should be used instead of `else if` so that all control keywords look like single words.
This was a mess, is now standardized across the codebase, except for a few 3rd-party libs. 

See #30799.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-08 07:05:25 +00:00
Scott Taylor e619abda6e Improve various `@param` docs for `src/wp-includes/*`.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-12-01 01:34:24 +00:00
Drew Jaynes 66c47f29bb Correct references of `@uses $wpdb` in core documentation to use `@global`.
See #30191, [30105].
Fixes #30217.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30122 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-31 17:56:22 +00:00
Drew Jaynes f8657d5890 Remove redundant and erroneous `@uses` tag from most core inline documentation.
Per our inline documentation standards, no further use of the `@uses` tag is recommended as used and used-by relationships can be derived through other means. This removes most uses of the tag in core documentation, with remaining tags to be converted to `@global` or `@see` as they apply.

Fixes #30191.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30105 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-30 01:05:24 +00:00
Scott Taylor b646f9df6a Allow bookmarks to be ordered by `link_description` in `get_bookmarks()`.
Fixes #29763.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-09-29 03:12:17 +00:00
Drew Jaynes bcf0dc9ce1 Convert default arguments documentation for `get_bookmarks()` into a hash notation.
Props coffee2code for the initial patch.
See #28841.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-07-11 23:03:13 +00:00
Scott Taylor 05eeb16e30 Replace all uses of `like_escape()` with `$wpdb->esc_like()`.
Props miqrogroove.
See #10041.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28528 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-10 00:44:15 +00:00
Scott Taylor 12a5b389ab Eliminate use of `extract()` in `get_bookmarks()`.
See #22400.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28230 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-15 01:58:15 +00:00
Scott Taylor 63a210e7c8 In `wp-includes/bookmark.php`, remove dead code:
* In `get_bookmarks()`, `$cache` is set twice before it is used. 
* In `sanitize_bookmark_field()`, `break` is unreachable after `return`

See #27882.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28144 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-06 18:22:16 +00:00
Andrew Nacin 803d4ff54d Remove old links_recently_updated_* DB options that never had a UI.
fixes #27649.

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


git-svn-id: http://core.svn.wordpress.org/trunk@27746 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-04-03 03:10:15 +00:00
Dion Hulse 90b6ccc88d Add some missing braces to get_bookmarks() which was causing an early return. Introduced in [25934]. See #25468. Fixes #25874
Built from https://develop.svn.wordpress.org/trunk@26046


git-svn-id: http://core.svn.wordpress.org/trunk@25971 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-11-08 02:20:10 +00:00
Drew Jaynes 3c22a3fd6d Inline documentation for hooks in wp-includes/bookmark.php.
Props ShinichiN, kpdesign.
Fixes #25468.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25893 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-26 16:53:09 +00:00
Jon Cave 5c57c78afa Fix potential SQLi through improper use of API functions.
git-svn-id: http://core.svn.wordpress.org/trunk@24875 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-29 18:16:47 +00:00
Andrew Nacin 94c34141b3 Don't cache a non-existent link in get_bookmark(). props wonderboymusic, fixes #21159.
git-svn-id: http://core.svn.wordpress.org/trunk@21829 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-09-13 16:41:43 +00:00
ryan 4cf5450a81 Use wp_cache_add() instead of wp_cache_set() when priming the object term cache in update_object_term_cache(). Pass the real post_type to clean_object_term_cache() instead of hard-coding post. Call clean_object_term_cache() from clean_bookmark_cache(). Props leewillis77. fixes #19690
git-svn-id: http://svn.automattic.com/wordpress/trunk@19729 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-11 21:26:18 +00:00
ryan e3b46b25d3 Lose EOF ?>. Clean up EOF newlines. fixes #12307
git-svn-id: http://svn.automattic.com/wordpress/trunk@19712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-01-08 17:01:11 +00:00
nacin 97c1b24db9 get_bookmarks() doc fix. props hearvox, fixes #19508.
git-svn-id: http://svn.automattic.com/wordpress/trunk@19615 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-12-20 22:01:43 +00:00
nacin acbc9144dd Allow 'id' to work in get_bookmarks(). Add link_notes even though such sorting is a bad idea. see #18068 for 3.3.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18840 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-09-30 17:03:46 +00:00
ryan 05b3172a32 Allow sorting by id in get_bookmarks(). Props SergeyBiryukov. see #18234 for trunk
git-svn-id: http://svn.automattic.com/wordpress/trunk@18470 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-07-26 21:22:13 +00:00
ryan 2010842d10 Sanitize order and orderby in get_bookmarks()
git-svn-id: http://svn.automattic.com/wordpress/trunk@18345 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2011-06-27 15:46:11 +00:00
ryan c626339cca link_notes and term_description escaping fixes. Props garyc40. fixes #15454
git-svn-id: http://svn.automattic.com/wordpress/trunk@17146 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-12-25 22:45:09 +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
ryan 37d86213db Fix array handling in sanitize_bookmark_field(). Props mdawaffe. fixes #13098
git-svn-id: http://svn.automattic.com/wordpress/trunk@14239 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-26 14:10:12 +00:00
nacin 144af9f1a4 Allow orberby in wp_list_bookmarks to accept a comma-delimited list of fields, per docs. fixes #12421, props sorich87, scribu.
git-svn-id: http://svn.automattic.com/wordpress/trunk@14131 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2010-04-18 04:45:09 +00:00