aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaria Carolin Chabowski <laria@laria.me>2020-11-08 17:45:02 +0100
committerLaria Carolin Chabowski <laria@laria.me>2020-11-08 17:47:21 +0100
commit7b0ed66d6b972bfc88d7b9a1a0e1369f01084189 (patch)
treec45bb027cc62438774c190ffd47c5d43e19e673d
parentd90aea9e87ffc51b8d073eef070cdc313364e287 (diff)
downloadratatoeskr-cms-7b0ed66d6b972bfc88d7b9a1a0e1369f01084189.tar.gz
ratatoeskr-cms-7b0ed66d6b972bfc88d7b9a1a0e1369f01084189.tar.bz2
ratatoeskr-cms-7b0ed66d6b972bfc88d7b9a1a0e1369f01084189.zip
Replace array_repeat() with equivalent array_fill() calls
-rw-r--r--ratatoeskr/main.php2
-rw-r--r--ratatoeskr/sys/GlobalSte.php7
-rw-r--r--ratatoeskr/sys/utils.php20
3 files changed, 5 insertions, 24 deletions
diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php
index c5f0b89..c88cc8b 100644
--- a/ratatoeskr/main.php
+++ b/ratatoeskr/main.php
@@ -94,7 +94,7 @@ function _ratatoeskr()
}));
$urlpath = explode("/", @$_GET["action"]);
- $rel_path_to_root = implode("/", array_merge(["."], array_repeat("..", count($urlpath) - 1)));
+ $rel_path_to_root = implode("/", array_merge(["."], array_fill(0, count($urlpath) - 1, "..")));
$GLOBALS["rel_path_to_root"] = $rel_path_to_root;
$data = ["rel_path_to_root" => $rel_path_to_root];
$ste->vars["rel_path_to_root"] = $rel_path_to_root;
diff --git a/ratatoeskr/sys/GlobalSte.php b/ratatoeskr/sys/GlobalSte.php
index 3a5c8e6..3fad630 100644
--- a/ratatoeskr/sys/GlobalSte.php
+++ b/ratatoeskr/sys/GlobalSte.php
@@ -49,7 +49,9 @@ class GlobalSte
$repeats = empty($params["repeat"]) ? 1 : $params["repeat"] + 0;
return implode(
"\n\n",
- array_repeat(
+ array_fill(
+ 0,
+ $repeats,
"<p>Lorem ipsum dolor sit amet, consectetur adipisici elit, "
. "sed eiusmod tempor incidunt ut labore et dolore magna "
. "aliqua. Ut enim ad minim veniam, quis nostrud exercitation "
@@ -112,8 +114,7 @@ class GlobalSte
. "dolore magna aliquyam erat, sed diam voluptua. At vero eos "
. "et accusam et justo duo dolores et ea rebum. Stet clita "
. "kasd gubergren, no sea takimata sanctus est Lorem ipsum "
- . "dolor sit amet.</p>",
- $repeats
+ . "dolor sit amet.</p>"
)
);
}
diff --git a/ratatoeskr/sys/utils.php b/ratatoeskr/sys/utils.php
index 7092f4d..21d65f9 100644
--- a/ratatoeskr/sys/utils.php
+++ b/ratatoeskr/sys/utils.php
@@ -10,26 +10,6 @@
* See "ratatoeskr/licenses/ratatoeskr" for more information.
*/
-/*
- * Function: array_repeat
- *
- * Parameters:
- *
- * $val -
- * $n -
- *
- * Returns:
- *
- * An array with $val $n-times repeated.
- */
-function array_repeat($val, $n)
-{
- $rv = [];
- for ($i = 0; $i < $n; ++$i) {
- array_push($rv, $val);
- }
- return $rv;
-}
/*
* Function: intcmp