Skip to content

Commit

Permalink
Parameternamen vereinheitlicht (#3824)
Browse files Browse the repository at this point in the history
  • Loading branch information
gharlan committed Aug 5, 2020
1 parent c6333d5 commit e872713
Show file tree
Hide file tree
Showing 28 changed files with 326 additions and 304 deletions.
4 changes: 2 additions & 2 deletions redaxo/src/addons/mediapool/lib/form_element/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class rex_form_widget_media_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
}

public function setCategoryId($category_id)
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/addons/mediapool/lib/form_element/medialist.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class rex_form_widget_medialist_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
}

public function setCategoryId($category_id)
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/addons/metainfo/lib/restrictions_element.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class rex_form_restrictons_element extends rex_form_select_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_metainfo_table_expander $table = null, array $attributes = [])
public function __construct($tag = '', rex_metainfo_table_expander $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);

$this->setNotice(rex_i18n::msg('ctrl'));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class rex_form_widget_linklist_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
}

public function setCategoryId($category_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class rex_form_widget_linkmap_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstruktorparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
}

public function setCategoryId($category_id)
Expand Down
6 changes: 3 additions & 3 deletions redaxo/src/core/functions/function_rex_other.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ function rex_delete_cache()
}

/**
* @param string $val
* @param string $varname
*
* @return mixed
*
* @package redaxo\core
*/
function rex_ini_get($val)
function rex_ini_get($varname)
{
$val = trim(ini_get($val));
$val = trim(ini_get($varname));
if ('' != $val) {
$last = strtolower($val[strlen($val) - 1]);
} else {
Expand Down
6 changes: 3 additions & 3 deletions redaxo/src/core/lib/be/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -704,15 +704,15 @@ public function getRequiredPermissions()
*
* @return bool
*/
public function checkPermission(rex_user $rexUser)
public function checkPermission(rex_user $user)
{
foreach ($this->requiredPermissions as $perm) {
if (!$rexUser->hasPerm($perm)) {
if (!$user->hasPerm($perm)) {
return false;
}
}
if ($parent = $this->getParent()) {
return $parent->checkPermission($rexUser);
return $parent->checkPermission($user);
}
return true;
}
Expand Down
18 changes: 9 additions & 9 deletions redaxo/src/core/lib/clang/clang.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,30 +182,30 @@ public function isOnline()
/**
* Checks whether the clang has the given value.
*
* @param string $value
* @param string $key
*
* @return bool
*/
public function hasValue($value)
public function hasValue($key)
{
return isset($this->$value) || isset($this->{'clang_' . $value});
return isset($this->$key) || isset($this->{'clang_' . $key});
}

/**
* Returns the given value.
*
* @param string $value
* @param string $key
*
* @return mixed
*/
public function getValue($value)
public function getValue($key)
{
if (isset($this->$value)) {
return $this->$value;
if (isset($this->$key)) {
return $this->$key;
}

if (isset($this->{'clang_' . $value})) {
return $this->{'clang_' . $value};
if (isset($this->{'clang_' . $key})) {
return $this->{'clang_' . $key};
}

return null;
Expand Down
6 changes: 4 additions & 2 deletions redaxo/src/core/lib/clang/perm.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
class rex_clang_perm extends rex_complex_perm
{
/**
* @param int $clangId
*
* @return bool
*/
public function hasPerm($clang)
public function hasPerm($clangId)
{
return $this->hasAll() || in_array($clang, $this->perms);
return $this->hasAll() || in_array($clangId, $this->perms);
}

/**
Expand Down
1 change: 1 addition & 0 deletions redaxo/src/core/lib/console/setup/run.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ static function ($value) use ($createdbOptions) {
$io->success('Database successfully updated');
} elseif ('import' == $createdb) {
$import_name = $input->getOption('db-import') ?? $io->askQuestion(new ChoiceQuestion('Please choose a database export', $backups));
assert(is_string($import_name));
if (!in_array($import_name, $backups, true)) {
throw new InvalidArgumentException('Unknown import file "'.$import_name.'" specified');
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/checkbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class rex_form_checkbox_element extends rex_form_options_element
{
// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
// Jede checkbox bekommt eingenes Label
$this->setLabel('');
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/container.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class rex_form_container_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
$this->fields = [];
$this->multiple = true;
}
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/control.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ class rex_form_control_element extends rex_form_element
*/
private $abortElement;

public function __construct(rex_form_base $table, rex_form_element $saveElement = null, rex_form_element $applyElement = null, rex_form_element $deleteElement = null, rex_form_element $resetElement = null, rex_form_element $abortElement = null)
public function __construct(rex_form_base $form, rex_form_element $saveElement = null, rex_form_element $applyElement = null, rex_form_element $deleteElement = null, rex_form_element $resetElement = null, rex_form_element $abortElement = null)
{
parent::__construct('', $table);
parent::__construct('', $form);

$this->saveElement = $saveElement;
$this->applyElement = $applyElement;
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/element.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class rex_form_element
/**
* @param string $tag
*/
public function __construct($tag, rex_form_base $table = null, array $attributes = [], $separateEnding = false)
public function __construct($tag, rex_form_base $form = null, array $attributes = [], $separateEnding = false)
{
$this->value = null;
$this->label = '';
$this->tag = $tag;
$this->table = $table;
$this->table = $form;
$this->setAttributes($attributes);
$this->separateEnding = $separateEnding;
$this->setHeader('');
Expand Down
16 changes: 8 additions & 8 deletions redaxo/src/core/lib/form/elements/options.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ abstract class rex_form_options_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct($tag, $table, $attributes);
parent::__construct($tag, $form, $attributes);
$this->options = [];
}

Expand Down Expand Up @@ -63,21 +63,21 @@ public function addArrayOptions(array $options, $useKeys = true)
}

/**
* @param string $qry
* @param string $query
*/
public function addSqlOptions($qry)
public function addSqlOptions($query)
{
$sql = rex_sql::factory();
$this->addOptions($sql->getArray($qry, [], PDO::FETCH_NUM));
$this->addOptions($sql->getArray($query, [], PDO::FETCH_NUM));
}

/**
* @param string $qry
* @param string $query
*/
public function addDBSqlOptions($qry)
public function addDBSqlOptions($query)
{
$sql = rex_sql::factory();
$this->addOptions($sql->getDBArray($qry, [], PDO::FETCH_NUM));
$this->addOptions($sql->getDBArray($query, [], PDO::FETCH_NUM));
}

/**
Expand Down
6 changes: 3 additions & 3 deletions redaxo/src/core/lib/form/elements/prio.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ class rex_form_prio_element extends rex_form_select_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag, rex_form $table, array $attributes = [])
public function __construct($tag, rex_form $form, array $attributes = [])
{
parent::__construct('', $table, $attributes);
$this->table = $table;
parent::__construct('', $form, $attributes);
$this->table = $form;

$this->labelField = '';
$this->whereCondition = '';
Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/radio.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ class rex_form_radio_element extends rex_form_options_element
{
// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);
// Jedes radio bekommt eingenes Label
}

Expand Down
4 changes: 2 additions & 2 deletions redaxo/src/core/lib/form/elements/raw.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ class rex_form_raw_element extends rex_form_element
{
private $html;

public function __construct($html = '', rex_form_base $table = null)
public function __construct($html = '', rex_form_base $form = null)
{
$this->html = $html;

parent::__construct('', $table);
parent::__construct('', $form);
}

public function formatElement()
Expand Down
12 changes: 6 additions & 6 deletions redaxo/src/core/lib/form/elements/select.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ class rex_form_select_element extends rex_form_element

// 1. Parameter nicht genutzt, muss aber hier stehen,
// wg einheitlicher Konstrukturparameter
public function __construct($tag = '', rex_form_base $table = null, array $attributes = [])
public function __construct($tag = '', rex_form_base $form = null, array $attributes = [])
{
parent::__construct('', $table, $attributes);
parent::__construct('', $form, $attributes);

$this->select = new rex_select();
$this->separator = '|';
Expand Down Expand Up @@ -63,11 +63,11 @@ public function getSelect()
return $this->select;
}

public function setSelect(rex_select $selectObj)
public function setSelect(rex_select $select)
{
$this->select = $selectObj;
if ($selectObj->hasAttribute('multiple')) {
$this->setAttribute('multiple', $selectObj->getAttribute('multiple'));
$this->select = $select;
if ($select->hasAttribute('multiple')) {
$this->setAttribute('multiple', $select->getAttribute('multiple'));
}
}
}
Loading

0 comments on commit e872713

Please sign in to comment.