Skip to content

Commit

Permalink
Code Modernization: Replace strpos() with str_starts_with() (#34135)
Browse files Browse the repository at this point in the history
Co-authored-by: Brad Jorsch <[email protected]>

Committed via a GitHub action: https://github.com/Automattic/jetpack/actions/runs/6932111860
  • Loading branch information
jeherve authored and matticbot committed Nov 20, 2023
1 parent e92d769 commit cfbe0fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
This is an alpha version! The changes listed here are not final.

### Changed
- Code Modernization: Replace usage of strpos() with str_starts_with().
- The package now requires PHP >= 7.0.

### Fixed
Expand Down
6 changes: 3 additions & 3 deletions src/contact-form/class-contact-form-plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -572,9 +572,9 @@ public function process_form_submission() {
check_admin_referer( "contact-form_{$id}" );
}

$is_widget = 0 === strpos( $id, 'widget-' );
$is_block_template = 0 === strpos( $id, 'block-template-' );
$is_block_template_part = 0 === strpos( $id, 'block-template-part-' );
$is_widget = str_starts_with( $id, 'widget-' );
$is_block_template = str_starts_with( $id, 'block-template-' );
$is_block_template_part = str_starts_with( $id, 'block-template-part-' );

$form = false;

Expand Down

0 comments on commit cfbe0fb

Please sign in to comment.