Application
Table of Contents
Classes
Constants
- ALLOWED_VARS : mixed = ['$_SESSION', '$_POST', '$_GET', '$_SERVER', '$...
- Naming convention checker for helPHP converted modules.
Functions
- session_force_update() : void
- Forces the session to be closed and immediately restarted.
- convert_module() : mixed
- upgrade() : mixed
- get_string_between() : mixed
- recurse_ls() : mixed
- to get the list of file and folder
- generate_index() : mixed
- index_association_columns() : mixed
- Give every association column (id_x) an index in the tables copied from generated/sql_objects.
- beautify_db_writing() : mixed
- missing_association_indexes() : array<string|int, mixed>
- Association columns that are not the leading column of any index, in the current database.
- block_definition_is_valid() : bool
- Checks that the field definitions of a block declaration are themselves valid JSON.
- install_blocks() : mixed
- install_instance() : mixed
- super_copy() : mixed
- super_mkdir() : mixed
- writeUTF8File() : mixed
- mini2() : mixed
- writeUTF8File() : mixed
- rules_signature() : array<string|int, mixed>
- Signature of the rules of one source, to tell whether two sources carry the same CSS.
- count_rows() : mixed
- duplicate_groups() : array<string|int, mixed>
- Duplicated sources, grouped by their identity.
- is_camel_case() : bool
- to_snake_case() : string
- bare_name() : string
- check_file() : array<string|int, mixed>
- apply_renames() : string
- interactive_rename() : void
Constants
ALLOWED_VARS
Naming convention checker for helPHP converted modules.
public
mixed
ALLOWED_VARS
= ['$_SESSION', '$_POST', '$_GET', '$_SERVER', '$_COOKIE', '$_FILES', '$_ENV', '$_REQUEST', '$CONFIG', '$DB']
Detects camelCase identifiers that should be snake_case. When run from a terminal, proposes and applies renames interactively.
Checks:
- variable names ($myVar → $my_var)
- function definitions (function getData → function get_data)
- instance method/property calls ($obj->getData → $obj->get_data)
- static method calls (Class::getData → Class::get_data)
Usage: php test_naming_convention.php path/to/Module.php [more.php|dir/]
Functions
session_force_update()
Forces the session to be closed and immediately restarted.
session_force_update() : void
Useful for updating session data and cookie.
convert_module()
convert_module(mixed $module_path, mixed $module_name) : mixed
Parameters
- $module_path : mixed
- $module_name : mixed
upgrade()
upgrade(mixed $public_admin, mixed $old_module_name, mixed $module_name, mixed $old_file, mixed $new_file) : mixed
Parameters
- $public_admin : mixed
- $old_module_name : mixed
- $module_name : mixed
- $old_file : mixed
- $new_file : mixed
get_string_between()
get_string_between(mixed $string, mixed $start, mixed $end) : mixed
Parameters
- $string : mixed
- $start : mixed
- $end : mixed
recurse_ls()
to get the list of file and folder
recurse_ls(mixed $path[, mixed $base_path = '' ]) : mixed
modified version of filesystem.php to also be used by CLI call
Parameters
- $path : mixed
- $base_path : mixed = ''
generate_index()
generate_index(mixed $module_name, mixed $path, mixed $public) : mixed
Parameters
- $module_name : mixed
- $path : mixed
- $public : mixed
index_association_columns()
Give every association column (id_x) an index in the tables copied from generated/sql_objects.
index_association_columns(mixed $tables) : mixed
The schema layer indexes those columns by itself (DB::sql_from_json()), but the generated installer is also the document a module ships: it has to declare the key its joins rely on, and an older toolkit reading it then still creates the index.
Parameters
- $tables : mixed
beautify_db_writing()
beautify_db_writing(mixed $str) : mixed
Parameters
- $str : mixed
missing_association_indexes()
Association columns that are not the leading column of any index, in the current database.
missing_association_indexes(mixed $DB) : array<string|int, mixed>
Parameters
- $DB : mixed
Return values
array<string|int, mixed> —list of ['TABLE_NAME' => ..., 'COLUMN_NAME' => ..., 'COLUMN_TYPE' => ...]
block_definition_is_valid()
Checks that the field definitions of a block declaration are themselves valid JSON.
block_definition_is_valid(string $declaration) : bool
A block file (<Nom>.json) holds, in its block_data entry, a json field whose value is the list
of the block's editor fields. That value is a JSON string stored inside JSON: escaping it one
level too deep produces a file that reads fine as a whole but installs a block_data row whose
json column cannot be decoded, so the editor builds an empty form.
Parameters
- $declaration : string
-
content of the block's json file
Return values
boolinstall_blocks()
install_blocks(mixed $instance_path) : mixed
Parameters
- $instance_path : mixed
install_instance()
install_instance(mixed $home_folder, mixed $admin_user, mixed $admin_pass, mixed $db_root_user, mixed $db_root_pass, mixed $db_root_user_central, mixed $db_root_password_central, mixed $db_root_user_slave, mixed $db_root_password_slave) : mixed
Parameters
- $home_folder : mixed
- $admin_user : mixed
- $admin_pass : mixed
- $db_root_user : mixed
- $db_root_pass : mixed
- $db_root_user_central : mixed
- $db_root_password_central : mixed
- $db_root_user_slave : mixed
- $db_root_password_slave : mixed
super_copy()
super_copy(mixed $source, mixed $target, mixed $user, mixed $groupe) : mixed
Parameters
- $source : mixed
- $target : mixed
- $user : mixed
- $groupe : mixed
super_mkdir()
super_mkdir(mixed $target, mixed $right, mixed $user, mixed $groupe) : mixed
Parameters
- $target : mixed
- $right : mixed
- $user : mixed
- $groupe : mixed
writeUTF8File()
writeUTF8File(mixed $filename, mixed $content) : mixed
Parameters
- $filename : mixed
- $content : mixed
mini2()
mini2(mixed $buffer) : mixed
Parameters
- $buffer : mixed
writeUTF8File()
writeUTF8File(mixed $filename, mixed $content) : mixed
Parameters
- $filename : mixed
- $content : mixed
rules_signature()
Signature of the rules of one source, to tell whether two sources carry the same CSS.
rules_signature(mixed $DB, string $t_rules, int $id_source) : array<string|int, mixed>
Parameters
- $DB : mixed
- $t_rules : string
- $id_source : int
Return values
array<string|int, mixed>count_rows()
count_rows(mixed $DB, string $table, int $id_source) : mixed
Parameters
- $DB : mixed
- $table : string
- $id_source : int
duplicate_groups()
Duplicated sources, grouped by their identity.
duplicate_groups(mixed $DB, string $t_source) : array<string|int, mixed>
A block and a document are one source per (type, admin), whatever their path says: the pair is the identity, the path only says where the file is. A module and a theme are one source per file, so the path completes the identity.
Parameters
- $DB : mixed
- $t_source : string
Return values
array<string|int, mixed> —One entry per group: type, admin, ids (comma separated), nb, and path for a module or a theme.
is_camel_case()
is_camel_case(string $name) : bool
Parameters
- $name : string
Return values
boolto_snake_case()
to_snake_case(string $name) : string
Parameters
- $name : string
Return values
stringbare_name()
bare_name(string $kind, string $display) : string
Parameters
- $kind : string
- $display : string
Return values
stringcheck_file()
check_file(string $path) : array<string|int, mixed>
Parameters
- $path : string
Return values
array<string|int, mixed>apply_renames()
apply_renames(string $content, array<string|int, mixed> $renames) : string
Parameters
- $content : string
- $renames : array<string|int, mixed>
Return values
stringinteractive_rename()
interactive_rename(string $file, array<string|int, mixed> $violations[, bool $auto = false ]) : void
Parameters
- $file : string
- $violations : array<string|int, mixed>
- $auto : bool = false