Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private static function getExtensionHelperClassName($extensionName)
*/
private static function getExtensionRealName($extensionName)
{
return strpos($extensionName, 'com_') === false ? $extensionName : substr($extensionName, 4);
return !str_contains($extensionName, 'com_') ? $extensionName : substr($extensionName, 4);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected function getOptions()

// Filter language
if (!empty($this->element['language'])) {
if (strpos($this->element['language'], ',') !== false) {
if (str_contains($this->element['language'], ',')) {
$language = explode(',', $this->element['language']);
} else {
$language = $this->element['language'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ public function storePermissions($permission = null)
/** @var Asset $parentAsset */
$parentAsset = Table::getInstance('Asset');

if (strpos($asset->name, '.') !== false) {
if (str_contains($asset->name, '.')) {
$assetParts = explode('.', $asset->name);
$parentAsset->loadByName($assetParts[0]);
$parentAssetId = $parentAsset->id;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct($name, array $arguments = [])
throw new \BadMethodCallException("Argument 'extension' of event $this->name is not of type 'string'");
}

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function display($tpl = null)
$parts = explode('.', $dashboard);
$component = $parts[0];

if (strpos($component, 'com_') === false) {
if (!str_contains($component, 'com_')) {
$component = 'com_' . $component;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public function save($data)
$tour->load($data['tour_id']);

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function save($data)
$input = Factory::getApplication()->getInput();

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ protected function getLanguages()

if ($search) {
if (
strpos(strtolower($language->name), $search) === false
&& strpos(strtolower($language->element), $search) === false
!str_contains(strtolower($language->name), $search)
&& !str_contains(strtolower($language->element), $search)
) {
continue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function remove($eid = [])
$langstring = 'COM_INSTALLER_TYPE_TYPE_' . strtoupper($row->type);
$rowtype = Text::_($langstring);

if (strpos($rowtype, $langstring) !== false) {
if (str_contains($rowtype, $langstring)) {
$rowtype = $row->type;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ private function install($update)
$sources = $update->get('downloadSources', []);

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

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

if ($extra_query) {
$url .= (strpos($url, '?') === false) ? '?' : '&';
$url .= (!str_contains($url, '?')) ? '?' : '&';
$url .= $extra_query;
}

Expand Down
2 changes: 1 addition & 1 deletion administrator/components/com_joomlaupdate/extract.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,7 @@ public function enforceMinimumExecutionTime()
public function setFilename(string $value)
{
// Security check: disallow remote filenames
if (!empty($value) && strpos($value, '://') !== false) {
if (!empty($value) && str_contains($value, '://')) {
$this->setError('Invalid archive location');

return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ public function download()
// Remove protocol, path and query string from URL
$basename = basename($packageURL);

if (strpos($basename, '?') !== false) {
if (str_contains($basename, '?')) {
$basename = substr($basename, 0, strpos($basename, '?'));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function refresh()
// Parse all found ini files and add the strings to the database cache.
foreach ($files as $file) {
// Only process if language file is for selected language
if (strpos($file, $language, \strlen($base)) === false) {
if (!str_contains(substr($file, \strlen($base)), $language)) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ public function login()

$app->login($credentials, ['action' => 'core.login.admin']);

if (Uri::isInternal($return) && strpos($return, 'tmpl=component') === false) {
if (Uri::isInternal($return) && !str_contains($return, 'tmpl=component')) {
$app->redirect($return);
} else {
$app->redirect('index.php');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ protected function preprocessForm(Form $form, $data, $group = 'content')
if ($name == 'com_menus.items.filter') {
$clientId = $this->getState('filter.client_id');
$form->setFieldAttribute('menutype', 'clientid', $clientId);
} elseif (false !== strpos($name, 'com_menus.items.modal.')) {
} elseif (str_contains($name, 'com_menus.items.modal.')) {
$form->removeField('client_id');

$clientId = $this->getState('filter.client_id');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ protected function getTypeOptionsFromLayouts($component, $view)
// Build list of standard layout names
foreach ($layouts as $layout) {
// Ignore private layouts.
if (strpos(basename($layout), '_') === false) {
if (!str_contains(basename($layout), '_')) {
// Get the layout name.
$layoutNames[] = basename($layout, '.xml');
}
Expand Down Expand Up @@ -509,7 +509,7 @@ protected function getTypeOptionsFromLayouts($component, $view)
// Process the found layouts.
foreach ($layouts as $layout) {
// Ignore private layouts.
if (strpos(basename($layout), '_') === false) {
if (!str_contains(basename($layout), '_')) {
$file = $layout;

// Get the layout name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class PostinstallHelper
*/
public function parsePath($path)
{
if (strpos($path, 'site://') !== false) {
if (str_contains($path, 'site://')) {
$path = JPATH_ROOT . str_replace('site://', '/', $path);
} elseif (strpos($path, 'admin://') !== false) {
} elseif (str_contains($path, 'admin://')) {
$path = JPATH_ADMINISTRATOR . str_replace('admin://', '/', $path);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,7 @@ public function getCoreFile($file, $client_id)
*/
private function getSafeName($name)
{
if (strpos($name, '-') !== false && preg_match('/[0-9]/', $name)) {
if (str_contains($name, '-') && preg_match('/[0-9]/', $name)) {
// Get the extension
$extension = File::getExt($name);

Expand Down