1
0
mirror of https://github.com/php/web-php.git synced 2026-03-23 23:02:13 +01:00
Commit Graph

19 Commits

Author SHA1 Message Date
Andreas Möller
d9bcfed482 Enhancement: Enable array_syntax fixer
Co-authored-by: MathiasReker <mathias@reker.dk>

Closes GH-659.
2022-08-22 18:59:14 +02:00
Andreas Möller
b3c9551c93 Enhancement: Enable no_extra_blank_lines fixer
Closes GH-646.
2022-07-12 14:26:18 +02:00
Christoph M. Becker
16fd981d27 Include spam_challenge.php only once
The file contains only definitions, and as such multiple inclusion
would never make sense.
2022-07-12 11:49:01 +02:00
Andreas Möller
c68e5a9e4a Enhancement: Enable single_space_after_construct fixer
Closes GH-640.
2022-07-12 11:44:23 +02:00
Ayesh Karunaratne
746d3d71ef HTML A11y improvements in add-note.php, my.php and vote-note.php
Also use strict comparison in pages that are changed.

Closes GH-610.
2022-07-04 13:25:36 +02:00
Ayesh Karunaratne
1b83fd7ab7 Multiple micro-optimizations
* Replace `ob_get_contents();ob_clean()` with `ob_get_clean()`

`ob_get_clean()` is equivalent to `ob_get_contents()` followed by `ob_clean()`.

* Replace `intval()` calls with `(int)` type cast

This is a micro-optimization because `intval()` is a function call, and the type cast is about 6 times fast.

* Replace `preg_replace` call that could be done with an `rtrim()` call

In `./error.php`, there is a `preg_replace('!/+$!', '', $URI);` call that essentially is equivalent to `rtrim()`, that both calls removing trailing slash characters in `$URI`.
The `rtim()` call is more legible and faster.

* Combine consecutive `str_replace` calls to a single `str_replace` call

* Use short ternary operator where possible

Improves code readability.

* Cascade various `else` statements where possible

Cleans up the code by removing unnecessary `else` blocks and moving the code to the parent context if the previous `if` block exits the function by either terminating the script, or with a `return` statement.

* Combine multiple `isset()` calls to a single `isset()`

`isset()` accepts multiple parameters and returns `true` only if all of the parameters are `isset`. It makes sense to combine multiple individual `isset` calls to a single call for better readability.

* Replace `for` loop with a `foreach` loop

* Remove unnecessary character escapes in regular expressions

Regular expression special characters are context-sensitive. For example, special characters such as `.` are not considered special within square braces (`[]`).
This removes several of such instances that certain characters are escaped, but it is not strictly necessary within the context. This improves the readability of the expression.

See more information at [PHP.Watch: Writing better Regular Expressions in PHP](https://php.watch/articles/php-regex-readability#reduce-escape)

* Remove unnecessary break statement

* Remove unnecessary PHP close tags

* Remove redundant JSON_ERROR_NONE check

Remove unnecessary `json_last_error() == JSON_ERROR_NONE` where the decoded object is inspected already.

Closes GH-603.
2022-07-03 12:24:14 +02:00
Mathias Reker ⚡️
ede0cad42f Ternary to null coalescing
Use null coalescing operator ?? where possible.

Closes GH-528.
2022-06-17 18:43:40 +02:00
Mathias Reker ⚡️
11866535bf Combine consecutive issets
Using isset($var) && multiple times should be done in one call.

Co-authored-by: Andreas Möller <am@localheinz.com>

Closes GH-542.
2022-06-17 16:29:04 +02:00
Mathias Reker ⚡️
63f1e9d004 No superfluous elseif
Replaces superfluous elseif with if.

Closes GH-549.
2022-06-17 16:00:47 +02:00
Nikita Popov
16f4045cf0 Replace master -> main in more places 2021-04-06 15:42:28 +02:00
Sara Golemon
c0afd74bf7 Swap uses of _SERVER[DOCUMENT_ROOT] for __DIR__
2/4 - Update remaining except archives/ and release/.
2019-05-31 12:31:21 -04:00
Peter Kokot
0f95b8c709 Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-10-17 07:29:46 +02:00
Michael
5bfef25e70 Kill off XHTML
Long live HTML5! =)
2014-06-04 19:39:27 +02:00
Sherif Ramadan
7a6b418656 Revert commit 5408728245
Problem was fixed in prepend.inc instead
2013-12-11 00:47:27 -05:00
Sherif Ramadan
5408728245 Fix potential Access-Control-Allow-Origin bug in vote-note.php - Bug #65887 2013-12-10 16:55:48 -05:00
Sherif Ramadan
d2524744a9 Fixing minor typo and output_buffering issue with site headers. 2012-12-13 15:38:21 -05:00
Sherif Ramadan
3d109b9178 Fixed bug on vote-note.php. 2012-12-12 13:36:55 -05:00
Sherif Ramadan
8fb7c3de19 Modified the response handling from the API on master to return a useful error message in case of failure for the voting feature. 2012-12-12 12:49:10 -05:00
Sherif Ramadan
61152c6ae9 Added new user notes voting features. This provides users to vote on user contributed notes in the manual throughout php.net. 2012-12-12 10:14:37 -05:00