Skip to content

Commit 88f981e

Browse files
committed
Replace the HTML entities
Replace them with the >, and < respectively.
1 parent a9233d4 commit 88f981e

File tree

1 file changed

+6
-6
lines changed
  • wordpress-coding-standards

1 file changed

+6
-6
lines changed

wordpress-coding-standards/php.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,9 @@ my_function( ( $x - 1 ) * 5, $y );
329329

330330
When formatting SQL statements you may break it into several lines and indent if it is sufficiently complex to warrant it. Most statements work well as one line though. Always capitalize the SQL parts of the statement like `UPDATE` or `WHERE`.
331331

332-
Functions that update the database should expect their parameters to lack SQL slash escaping when passed. Escaping should be done as close to the time of the query as possible, preferably by using `$wpdb-&gt;prepare()`
332+
Functions that update the database should expect their parameters to lack SQL slash escaping when passed. Escaping should be done as close to the time of the query as possible, preferably by using `$wpdb->prepare()`
333333

334-
`$wpdb-&gt;prepare()` is a method that handles escaping, quoting, and int-casting for SQL queries. It uses a subset of the `sprintf()` style of formatting. Example :
334+
`$wpdb->prepare()` is a method that handles escaping, quoting, and int-casting for SQL queries. It uses a subset of the `sprintf()` style of formatting. Example :
335335

336336
```php
337337
$var = "dangerous'"; // raw data that may or may not need to be escaped
@@ -340,7 +340,7 @@ $id = some_foo_number(); // data we expect to be an integer, but we're not certa
340340
$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_title = %s WHERE ID = %d", $var, $id ) );
341341
```
342342

343-
`%s` is used for string placeholders and `%d` is used for integer placeholders. Note that they are not 'quoted'! `$wpdb-&gt;prepare()` will take care of escaping and quoting for us. The benefit of this is that we don't have to remember to manually use [`esc_sql()`](https://developer.wordpress.org/reference/functions/esc_sql/), and also that it is easy to see at a glance whether something has been escaped or not, because it happens right when the query happens.
343+
`%s` is used for string placeholders and `%d` is used for integer placeholders. Note that they are not 'quoted'! `$wpdb->prepare()` will take care of escaping and quoting for us. The benefit of this is that we don't have to remember to manually use [`esc_sql()`](https://developer.wordpress.org/reference/functions/esc_sql/), and also that it is easy to see at a glance whether something has been escaped or not, because it happens right when the query happens.
344344

345345
See [Data Validation](https://developer.wordpress.org/plugins/security/data-validation/) in the Plugin Handbook for further details.
346346

@@ -454,15 +454,15 @@ eat ( 'noodles', array( 'speed' => 'moderate' ) );
454454

455455
Dynamic hooks should be named using interpolation rather than concatenation for readability and discoverability purposes.
456456

457-
Dynamic hooks are hooks that include dynamic values in their tag name, e.g. `{$new_status}_{$post-&gt;post_type}` (publish_post).
457+
Dynamic hooks are hooks that include dynamic values in their tag name, e.g. `{$new_status}_{$post->post_type}` (publish_post).
458458

459459
Variables used in hook tags should be wrapped in curly braces `{` and `}`, with the complete outer tag name wrapped in double quotes. This is to ensure PHP can correctly parse the given variables' types within the interpolated string.
460460

461461
```php
462462
do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
463463
```
464464

465-
Where possible, dynamic values in tag names should also be as succinct and to the point as possible. `$user_id` is much more self-documenting than, say, `$this-&gt;id`.
465+
Where possible, dynamic values in tag names should also be as succinct and to the point as possible. `$user_id` is much more self-documenting than, say, `$this->id`.
466466

467467
### Ternary Operator
468468

@@ -492,7 +492,7 @@ In the above example, if you omit an equals sign (admit it, it happens even to t
492492

493493
A little bizarre, it is, to read. Get used to it, you will.
494494

495-
This applies to ==, !=, ===, and !==. Yoda conditions for &lt;, &gt;, &lt;= or &gt;= are significantly more difficult to read and are best avoided.
495+
This applies to ==, !=, ===, and !==. Yoda conditions for `<`, `>`, `<=` or `>=` are significantly more difficult to read and are best avoided.
496496

497497
### Clever Code
498498

0 commit comments

Comments
 (0)