¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
JScms_varname_blocked
The JScms_varname_blocked
function checks whether a given value (such as a variable name or slug) is reserved or already exists in a specified database table. This ensures protection against duplicate or disallowed variable names.
JScms_varname_blocked(object $jakdb, string $table, string $value, ?int $id = null): bool
$jakdb
: (object) Database connection instance.$table
: (string) The name of the database table to check against.$value
: (string) The variable name or slug to check.$id
: (int|null) Optional. The ID of the current entry to exclude from duplicate checks.
(bool) true
if the value is blocked (either reserved or already exists in the database), or false
otherwise.
<?php
$value = "reserved_name";
$table = "pages";
$id = 10;
if (JScms_varname_blocked($jakdb, $table, $value, $id)) {
echo "The value is blocked or already exists.";
} else {
echo "The value is allowed.";
}
?>
BLOCKED_VARIABLES
constant can be found in your include/db.php file.BLOCKED_VARIABLES
: Ensure the BLOCKED_VARIABLES
constant is defined and contains a comma-separated list of reserved variable names.