Commit Graph

55 Commits

Author SHA1 Message Date
Sergey Biryukov
3d623995a8 Docs: In various @return tags, list the expected type first, instead of WP_Error.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@46696


git-svn-id: http://core.svn.wordpress.org/trunk@46496 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-11 02:43:03 +00:00
John Blackbourn
7c2b9f2a2e Docs: Miscellaneous docblock fixes and improvements.
See #48303

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


git-svn-id: http://core.svn.wordpress.org/trunk@46391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 20:43:04 +00:00
Andrew Ozz
c5fed47367 Docs: Improve and update the description of multi_resize() to explain changes and expected use.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45892


git-svn-id: http://core.svn.wordpress.org/trunk@45703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-25 22:21:58 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Andrew Ozz
05302bd054 Save progress of intermediate image creation after upload. First run.
- Introduces `wp_get_missing_image_subsizes()` and `wp_update_image_subsizes()` to generate image sub-sizes that are missing or were not created after the upload.
- Adds a way to display errors that happened while creating sub-sizes.
- Introduces `wp_create_image_subsizes()` intended for use after an image was uploaded. It saves/updates the image metadata immediately after each sub-size is created. This fixes the (long standing) problem when some of the sub-size image files were created but there was a timeout or an error and the metadata was not saved. Until now such uploads were considered "failed" which usually resulted in the user trying to upload the same image again, creating even more "orphan" image files.

Note that the patch also includes some unrelated WPCS fixes.

Props mikeschroder, azaozz.
See #40439.
Built from https://develop.svn.wordpress.org/trunk@45538


git-svn-id: http://core.svn.wordpress.org/trunk@45349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-15 01:02:52 +00:00
desrosj
d11928bc65 Docs: Add missing periods to param annotations for flip() in WP_Image_Editor_GD.
Props hitendra-chopda.
Fixes #45208.
Built from https://develop.svn.wordpress.org/trunk@44550


git-svn-id: http://core.svn.wordpress.org/trunk@44381 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-10 22:10:50 +00:00
Sergey Biryukov
08227812a0 Docs: Remove @static notations from method DocBlocks in wp-includes/* classes.
This tag has been used in the past, but should no longer be used. Just using the `static` keyword in code is enough for PhpDocumentor on PHP5+ to recognize static variables and methods, and PhpDocumentor will mark them as static.

Props birgire.
See #42803.
Built from https://develop.svn.wordpress.org/trunk@42746


git-svn-id: http://core.svn.wordpress.org/trunk@42576 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-02-25 20:22:30 +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
Gary Pendergast
c90cfa3b50 General: Fix some precision alignment formatting warnings.
The WPCS `WordPress.WhiteSpace.PrecisionAlignment` rule throws warnings for a bunch of code that will likely cause issues for `wpcbf`. Fixing these manually beforehand gives us better auto-fixed results later.

See #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-26 23:57:55 +00:00
John Blackbourn
9891448a42 Media: Rename several attachment related parameters from $post_id to $attachment_id for clarity, and improve related
documentation.

See #41017

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


git-svn-id: http://core.svn.wordpress.org/trunk@41128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-22 11:12:44 +00:00
Drew Jaynes
0860bb2771 Docs: Remove @access notations from method DocBlocks in wp-includes/* classes.
Prior to about 2013, many class methods lacked even access modifiers which made the `@access` notations that much more useful. Now that we've gotten to a point where the codebase is more mature from a maintenance perspective and we can finally remove these notations. Notable exceptions to this change include standalone functions notated as private as well as some classes still considered to represent "private" APIs.

See #41452.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-27 00:41:44 +00:00
Sergey Biryukov
8c55e79bef Docs: Correct @access entry for ::load() in WP_Image_Editor, WP_Image_Editor_GD, and WP_Image_Editor_Imagick.
Props upadalavipul.
Fixes #41423.
Built from https://develop.svn.wordpress.org/trunk@41125


git-svn-id: http://core.svn.wordpress.org/trunk@40965 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-24 14:11:44 +00:00
Drew Jaynes
1d95dcfa2c Docs: Remove superfluous @package WordPress and @subpackage notations used outside of file headers in a variety of core files.
Per the inline documentation standards for PHP, there should only be one `@package` and/or `@subpackage` notation per file, and only in the file header.

See #41017.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-07-01 16:58:42 +00:00
Dominik Schilling
aa561e67a1 Bootstrap: Enhance core's memory limit handling.
* Don't lower memory limit if the current limit is greater than `WP_MAX_MEMORY_LIMIT`.
* Set `WP_MEMORY_LIMIT` and `WP_MAX_MEMORY_LIMIT` to current limit if the `memory_limit` setting can't be changed at runtime.
* Use `wp_convert_hr_to_bytes()` when parsing the value of the `memory_limit` setting because it can be a shorthand or an integer value.
* Introduce `wp_raise_memory_limit( $context )` to raise the PHP memory limit for memory intensive processes. This DRYs up some logic and includes the existing `admin_memory_limit` and `image_memory_limit` filters. The function can also be used for custom contexts, the `{$context}_memory_limit` filter allows to customize the limit.
* Introduce `wp_is_ini_value_changeable( $setting )` to determine whether a PHP ini value is changeable at runtime.
* Remove a `function_exists( 'memory_get_usage' )` check. Since PHP 5.2.1 support for memory limit is always enabled.

Related commits: [38011-38013]

Props jrf, A5hleyRich, swissspidy, ocean90.
Fixes #32075.
Built from https://develop.svn.wordpress.org/trunk@38015


git-svn-id: http://core.svn.wordpress.org/trunk@37956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-07-08 14:37:30 +00:00
Drew Jaynes
311f800907 Docs: Ensure hook and duplicate hook docs directly precede all instances of the image_memory_limit filter.
Hook docs must directly precede hooks in order for the Code Reference parser to correctly identify them as such.

Fixes #36968. 

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


git-svn-id: http://core.svn.wordpress.org/trunk@37560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-30 02:14:30 +00:00
Drew Jaynes
602b51a209 Docs: Standardize filter docs in core classes in wp-includes/* to use third-person singular verbs per the inline documentation standards for PHP.
See #36913.

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


git-svn-id: http://core.svn.wordpress.org/trunk@37460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2016-05-22 18:15:28 +00:00
Scott Taylor
d8eacd51d8 Media: add a new image size, medium_large. Bumps db version to add new options.
Adds unit tests.

Props DH-Shredder, joemcgill, azaozz.
Fixes #34196.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-31 20:50:25 +00:00
Drew Jaynes
b1b3fc5deb Docs: Re-clarify the $sizes[ $size ] section of the hash notations for WP_Image_Editor_GD::multi_resize() and WP_Image_Editor_Imagick::multi_resize() as not fully-optional.
The `$width` value is optional if `$height` is specified, and vice versa. The `$crop` value is always optional and defaults to false.

Props dh-shredder.
See #32246. See [35061] and [35062].

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


git-svn-id: http://core.svn.wordpress.org/trunk@35028 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:34:23 +00:00
Drew Jaynes
243f66836f Docs: Fix hash notation syntax for the $sizes[ $size ] section in the DocBlock for WP_Image_Editor_GD::multi_resize().
See #32246.

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


git-svn-id: http://core.svn.wordpress.org/trunk@35026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-10-12 16:26:24 +00:00
Sergey Biryukov
3fb3d2a762 Replace @returns with @return in PHP docblocks.
props kraftbj.
fixes #32865.
Built from https://develop.svn.wordpress.org/trunk@33052


git-svn-id: http://core.svn.wordpress.org/trunk@33023 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-07-02 21:05:24 +00:00
Scott Taylor
a0e373ef80 For doc block types, favor bool over the few remaining booleans
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32935 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-06-27 01:03:25 +00:00
Scott Taylor
19a3aacc94 Add @static* annotations where they are missing.
Initialize all static vars that are not, most to `null`.

See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32620 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-29 15:43:29 +00:00
Drew Jaynes
a94c16f334 Add a proper description comment for the WP_Image_Editor_GD->$image property.
See [30180]. See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32524 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-23 19:10:28 +00:00
Scott Taylor
bf43be3e9e Add missing doc blocks to wp-image-editor*.php.
See #32444.

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


git-svn-id: http://core.svn.wordpress.org/trunk@32516 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-05-22 06:18:25 +00:00
Scott Taylor
dbc38ea246 In the ->multi_resize() method of the WP_Image_Editor subclasses, when looping through potential crops, we need to make sure the crop isn't the exact same dimensions as the original image before copying it as a new crop.
This ensures that we don't save multiple copies of the same image.

Supposedly broke in [30639], but this logic was always missing. When I tested reverting [30639], there were still 2 files being created.

Fixes #31296.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31557 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-02-27 19:38:27 +00:00
Scott Taylor
de4d970d77 Preserve alpha transparency when rotating a PNG while GD is the active image editor.
Adds unit tests.

Props frankpw, voldemortensen.
Fixes #30596.

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


git-svn-id: http://core.svn.wordpress.org/trunk@31021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2015-01-03 22:02:24 +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
Scott Taylor
e02c724249 WP_Image_Editor_GD and WP_Image_Editor_Imagick should specify type in a doc block for the $image property, instead of inferring bool and null.
See #30224.

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


git-svn-id: http://core.svn.wordpress.org/trunk@30180 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-11-03 02:38:23 +00:00
Sergey Biryukov
221db8fd8d Fix setting default quality in WP_Image_Editor.
props markoheijnen.
fixes #29856 for trunk.
Built from https://develop.svn.wordpress.org/trunk@29834


git-svn-id: http://core.svn.wordpress.org/trunk@29598 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-10-04 13:12:15 +00:00
Scott Taylor
6018cd50b6 Revert [28640] as per @DH-Shredder.
See #24380.

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


git-svn-id: http://core.svn.wordpress.org/trunk@29123 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-08-01 18:43:16 +00:00
Scott Taylor
cf95c6ecc2 Add ->get_quality() method to WP_Image_Editor class.
Adds unit tests.

Props markoheijnen.
Fixes #28154.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28678 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-06-28 03:50:15 +00:00
Scott Taylor
552d84a8a8 In WP_Image_Editor_GD::_save(), pass $compression_level into the args array for ->make_image().
Props MuViMoTV, markoheijnen, SergeyBiryukov, mikemanger, ericlewis.
Fixes #24380.


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


git-svn-id: http://core.svn.wordpress.org/trunk@28458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-30 20:06:14 +00:00
Scott Taylor
df8a090193 Add missing access modifiers to methods/members in WP_Image_Editor_* classes.
See #27881, #22234.

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


git-svn-id: http://core.svn.wordpress.org/trunk@28339 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-05-19 05:53:14 +00:00
Scott Taylor
85731fc99b In multi_resize() image editor methods, assert that null can only be passed for one of the arguments, not both. Add a lot more unit test assertions to ensure this.
Props pbearne, DH-Shredder.
Fixes #26823.


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


git-svn-id: http://core.svn.wordpress.org/trunk@27630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2014-03-27 20:40:17 +00:00
Ryan Boren
07c16fd23c The Pinking Shears stir from their slumber, awakened by what may seem, to those
innocent in the ways of The Shears, a triviality, a nothing-of-consequence. But there are consequences indeed for recklessly trailing your whitespace. Naturally, they a dire!

One, two! One, two! And through and through
The Pinking Shears went snicker-snack!
They plucked your tail and with your space
They went sniksnuking back.

Let me tell you, that can be uncomfortable, so always pre-sniksnuk your trailing whites. May The Shears be with you.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-11 19:49:11 +00:00
Drew Jaynes
e59ee5e974 Two more hook docs fixes.
`image_memory_limit` filter:
* Go with int|string on the limit, and simply notate '256M' as an acceptable string value.

`wp_editor_set_quality` filter:
* Add a missing parameter description for the mime type.

See #25721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26540 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-04 23:51:19 +00:00
Drew Jaynes
b3bc78df8f Hook docs fixes following [26645].
See #25721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-04 23:32:11 +00:00
Andrew Nacin
feedbcde87 Improvements to image quality handling in the image editor classes.
props markoheijnen, DH-Shredder.
fixes #25721.

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


git-svn-id: http://core.svn.wordpress.org/trunk@26535 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-12-04 22:49:10 +00:00
Drew Jaynes
4ffec6be75 Improve inline documentation for the multi_resize() method in WP_Image_Editor, WP_Image_Editor_GD, and WP_Image_Editor_Imagick.
Props paolal for the initial patch.
Fixes #25530.

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


git-svn-id: http://core.svn.wordpress.org/trunk@25641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-10-08 17:19:09 +00:00
Ryan Boren
46ae92b9e4 Fix editing images with GD when using streams.
Props rmccue, markoheijnen, nacin
fixes #24459


git-svn-id: http://core.svn.wordpress.org/trunk@24727 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-07-17 21:16:44 +00:00
Andrew Nacin
feffc2716f Image editors: multi_resize() should require height and width. Crop is now optional and defaults to false. props DH-Shredder. fixes #23884.
git-svn-id: http://core.svn.wordpress.org/trunk@24055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-22 20:28:05 +00:00
Ryan Boren
6806d48a90 Preserve alpha in WP_Image_Editor_GD when images are not resized.
Props joehoyle
see #23039


git-svn-id: http://core.svn.wordpress.org/trunk@23884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-04-01 15:21:19 +00:00
Ryan Boren
87db798028 Clarify phpdoc for the vertical and horizontal arguments to the flip() method in WP_Image_Editor*.
Props dh-shredder
fixes #23775


git-svn-id: http://core.svn.wordpress.org/trunk@23750 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2013-03-19 03:30:04 +00:00
Andrew Nacin
aac3ea45f3 Only unset() after we have confirmed we are not dealing with a WP_Error. props DH-Shredder. fixes #22824.
git-svn-id: http://core.svn.wordpress.org/trunk@23133 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-09 17:02:22 +00:00
Andrew Nacin
8b20551951 Image editors: After cropping, request new sizes from the image. If we rely on the values passed in, they may be floats. We must see what the image results in.
Cast in update_size() for sanity.

props DH-Shredder.
fixes #22779.



git-svn-id: http://core.svn.wordpress.org/trunk@23103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-06 07:56:04 +00:00
Andrew Nacin
b20c0a5bd5 Image editor doc fixes. props DH-Shredder. see #6821.
git-svn-id: http://core.svn.wordpress.org/trunk@23038 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-12-04 19:42:28 +00:00
Ryan Boren
d4159bf041 In wp_image_editor(), use wp_image_editor_supports() to check for rotation capabilities rather than directly checking the existence of the imagerotate function.
In WP_Image_Editor_GD::test(), check for existence of imagerotate if the rotate capability is required.

Props DH-Shredder
fixes #22597


git-svn-id: http://core.svn.wordpress.org/trunk@22863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-27 14:36:55 +00:00
Andrew Nacin
9120cf3375 WP_Image_Editor: the last stand.
* Have wp_get_image_editor() rather than WP_Image_Editor::get_instance(). Having static factory methods would be less confusing if there weren't also static methods tied to individual editor implementations.
 * Lazy-load the WP_Image_Editor base class and editor implementations.
 * Have WP_Image_Editor_GD::supports_mime_type() actually check which types it supports.
 * Deprecate gd_edit_image_support() in favor of wp_image_editor_supports().

props DH-Shredder, scribu, markoheijnen. fixes #22356. see #6821.



git-svn-id: http://core.svn.wordpress.org/trunk@22817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-22 09:52:16 +00:00
Ryan Boren
6472f6d39c Add abstract methods back to WP_Image_Editor and refresh phpdoc.
Props DH-Shredder, markoheijnen, kurtpayne, nacin
see #6821


git-svn-id: http://core.svn.wordpress.org/trunk@22619 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-16 22:02:21 +00:00
Ryan Boren
31e669df5a Pass an attachment ID, not a file path, to _load_image_to_edit_path() from wp_crop_image(). This fixes handling of attachments that require url fopen to access the image.
Allow passing urls instead of just file paths to WP_Image_Editor_Imagick::load() and WP_Image_Editor_GD::load() so that attachments requiring URL fopen can be handled.

see #6821


git-svn-id: http://core.svn.wordpress.org/trunk@22538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2012-11-10 20:42:27 +00:00