Skip to content

Commit b69c4c5

Browse files
authored
[5.3] Use str_contains function for components (#44875)
1 parent 2a96bc6 commit b69c4c5

File tree

18 files changed

+22
-22
lines changed

18 files changed

+22
-22
lines changed

administrator/components/com_associations/src/Helper/AssociationsHelper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ private static function getExtensionHelperClassName($extensionName)
193193
*/
194194
private static function getExtensionRealName($extensionName)
195195
{
196-
return strpos($extensionName, 'com_') === false ? $extensionName : substr($extensionName, 4);
196+
return !str_contains($extensionName, 'com_') ? $extensionName : substr($extensionName, 4);
197197
}
198198

199199
/**

administrator/components/com_categories/src/Field/CategoryeditField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ protected function getOptions()
196196

197197
// Filter language
198198
if (!empty($this->element['language'])) {
199-
if (strpos($this->element['language'], ',') !== false) {
199+
if (str_contains($this->element['language'], ',')) {
200200
$language = explode(',', $this->element['language']);
201201
} else {
202202
$language = $this->element['language'];

administrator/components/com_config/src/Model/ApplicationModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -959,7 +959,7 @@ public function storePermissions($permission = null)
959959
/** @var Asset $parentAsset */
960960
$parentAsset = Table::getInstance('Asset');
961961

962-
if (strpos($asset->name, '.') !== false) {
962+
if (str_contains($asset->name, '.')) {
963963
$assetParts = explode('.', $asset->name);
964964
$parentAsset->loadByName($assetParts[0]);
965965
$parentAssetId = $parentAsset->id;

administrator/components/com_content/src/Event/Model/FeatureEvent.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function __construct($name, array $arguments = [])
4242
throw new \BadMethodCallException("Argument 'extension' of event $this->name is not of type 'string'");
4343
}
4444

45-
if (strpos($arguments['extension'], '.') === false) {
45+
if (!str_contains($arguments['extension'], '.')) {
4646
throw new \BadMethodCallException("Argument 'extension' of event $this->name has wrong format. Valid format: 'component.section'");
4747
}
4848

administrator/components/com_cpanel/src/View/Cpanel/HtmlView.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function display($tpl = null)
6969
$parts = explode('.', $dashboard);
7070
$component = $parts[0];
7171

72-
if (strpos($component, 'com_') === false) {
72+
if (!str_contains($component, 'com_')) {
7373
$component = 'com_' . $component;
7474
}
7575

administrator/components/com_guidedtours/src/Model/StepModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function save($data)
8181
$tour->load($data['tour_id']);
8282

8383
// Language keys must include GUIDEDTOUR to prevent save issues
84-
if (strpos($data['description'], 'GUIDEDTOUR') !== false) {
84+
if (str_contains($data['description'], 'GUIDEDTOUR')) {
8585
$data['description'] = strip_tags($data['description']);
8686
}
8787

administrator/components/com_guidedtours/src/Model/TourModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ public function save($data)
6363
$input = Factory::getApplication()->getInput();
6464

6565
// Language keys must include GUIDEDTOUR to prevent save issues
66-
if (strpos($data['description'], 'GUIDEDTOUR') !== false) {
66+
if (str_contains($data['description'], 'GUIDEDTOUR')) {
6767
$data['description'] = strip_tags($data['description']);
6868
}
6969

administrator/components/com_installer/src/Model/LanguagesModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ protected function getLanguages()
166166

167167
if ($search) {
168168
if (
169-
strpos(strtolower($language->name), $search) === false
170-
&& strpos(strtolower($language->element), $search) === false
169+
!str_contains(strtolower($language->name), $search)
170+
&& !str_contains(strtolower($language->element), $search)
171171
) {
172172
continue;
173173
}

administrator/components/com_installer/src/Model/ManageModel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ public function remove($eid = [])
253253
$langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type);
254254
$rowtype = Text::_($langstring);
255255

256-
if (strpos($rowtype, $langstring) !== false) {
256+
if (str_contains($rowtype, $langstring)) {
257257
$rowtype = $row->type;
258258
}
259259

administrator/components/com_installer/src/Model/UpdateModel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ private function install($update)
421421
$sources = $update->get('downloadSources', []);
422422

423423
if ($extra_query = $update->get('extra_query')) {
424-
$url .= (strpos($url, '?') === false) ? '?' : '&';
424+
$url .= (!str_contains($url, '?')) ? '?' : '&';
425425
$url .= $extra_query;
426426
}
427427

@@ -432,7 +432,7 @@ private function install($update)
432432
$url = trim($name->url);
433433

434434
if ($extra_query) {
435-
$url .= (strpos($url, '?') === false) ? '?' : '&';
435+
$url .= (!str_contains($url, '?')) ? '?' : '&';
436436
$url .= $extra_query;
437437
}
438438

0 commit comments

Comments
 (0)