comments standars

This commit is contained in:
Diego Najar 2021-06-07 20:18:53 +02:00
parent ed1edb902f
commit 1edd3eec53
3 changed files with 67 additions and 67 deletions

View file

@ -19,12 +19,12 @@ Backend:
## Comments for functions and methods
Please add the following structure commenting what it does the function, also add the stamp `=== Bludit v4` so I know what is new.
```
/* Delete a page === Bludit v4
@key string Array => (key: string)
@return string/bool Returns the page key on successful delete, FALSE otherwise
*/
function deletePage($args) {
/**
* Create a new category. === Bludit v4
* @param array $args [string $name, string $template, string $description]
* @return string|bool Returns the category key on successful create, FALSE otherwise
*/
function createCategory($args) {
...
}
```

View file

@ -1,21 +1,21 @@
<?php defined('BLUDIT') or die('Bludit CMS.');
/* ----------------------------------------------------------------------------
Global functions
These functions provide connectivity between different objects and databases.
These functions should provide different checks and logic before add/edit/delete into the databases.
For example, the creation of a user should check:
- if the user already exists
- if the username is not empty
- if the password match with the differents security rules such as min length
/* ----------------------------------------------------------------------------
/* Create a new page === Bludit v4
@args array The array $args supports all the keys from the variable $dbFields of the class pages.class.php
@return string/bool Returns the page key on successful create, FALSE otherwise
/*
* Global functions
* These functions provide connectivity between different objects and databases.
* These functions should provide different checks and logic before add/edit/delete into the databases.
*
* For example, the creation of a user should check:
* - if the user already exists
* - if the username is not empty
* - if the password match with the security rules such as min length
*/
/**
* Create a new page. === bludit v4
* @param array $args All supported keys are defined in the class pages.class.php variable $dbFields
* @return string|bool Returns the page key on successful create, FALSE otherwise
*/
function createPage($args) {
global $pages;
global $syslog;
@ -51,12 +51,12 @@ function createPage($args) {
return false;
}
/* Edit a page === Bludit v4
@args array The array $args supports all the keys from the variable $dbFields of the class pages.class.php
@args['key'] string The key of the page to be edited
@return string/bool Returns the page key on successful edit, FALSE otherwise
*/
/**
* Edit a page. === Bludit v4
* @param array $args All supported keys are defined in the class pages.class.php variable $dbFields
* @param string $args['key'] The key of the page to be edited
* @return string|bool Returns the page key on successful edit, FALSE otherwise
*/
function editPage($args) {
global $pages;
global $syslog;
@ -99,11 +99,11 @@ function editPage($args) {
return false;
}
/* Delete a page === Bludit v4
@key string Array => (key: string)
@return string/bool Returns the page key on successful delete, FALSE otherwise
*/
/**
* Delete a page. === Bludit v4
* @param array $args [string $key]
* @return string|bool Returns the page key on successful delete, FALSE otherwise
*/
function deletePage($args) {
global $pages;
global $syslog;
@ -133,11 +133,11 @@ function deletePage($args) {
return false;
}
/* Create a new category === Bludit v4
@args array Array => (name: string, template: string, description: string)
@return string/bool Returns the category key on successful create, FALSE otherwise
*/
/**
* Create a new category. === Bludit v4
* @param array $args [string $name, string $template, string $description]
* @return string|bool Returns the category key on successful create, FALSE otherwise
*/
function createCategory($args) {
global $categories;
global $syslog;
@ -162,11 +162,11 @@ function createCategory($args) {
return false;
}
/* Edit a category === Bludit v4
@args array Array => (key: string, name: string, friendlyURL: string, template: string, description: string)
@return string/bool Returns the category key on successful edit, FALSE otherwise
*/
/**
* Edit a category. === Bludit v4
* @param array $args [string $key, string $name, string $friendlyURL, string $template, string $description]
* @return string|bool Returns the category key on successful edit, FALSE otherwise
*/
function editCategory($args) {
global $pages;
global $categories;
@ -210,11 +210,11 @@ function editCategory($args) {
return $finalKey;
}
/* Delete a category === Bludit v4
@args array Array => (key: string)
@return bool Returns TRUE on successful delete, FALSE otherwise
*/
/**
* Delete a category. === Bludit v4
* @param array $args [string $key]
* @return string|bool Returns TRUE on successful delete, FALSE otherwise
*/
function deleteCategory($args) {
global $categories;
global $syslog;
@ -238,12 +238,12 @@ function deleteCategory($args) {
return true;
}
/* Create a new user === Bludit v4
This function should check everthing, such as empty username, emtpy password, password lenght, etc
@args array The array $args supports all the keys from the variable $dbFields of the class users.class.php
@return string/bool Returns the username on successful create, FALSE otherwise
*/
/**
* Create an user. === Bludit v4
* This function should check everthing, such as empty username, emtpy password, password lenght, etc
* @param array $args All supported keys are defined in the class users.class.php variable $dbFields
* @return string|bool Returns the username on successful create, FALSE otherwise
*/
function createUser($args) {
global $users;
global $syslog;
@ -275,13 +275,13 @@ function createUser($args) {
return false;
}
/* Edit an user === Bludit v4
@args array The array $args supports all the keys from the variable $dbFields of the class users.class.php
@args['disable'] bool If you set this variable the user will be disabled
@args['password'] string If you set this variable a new password will be set for the user
@return string/bool Returns the username on successful edit, FALSE otherwise
*/
/**
* Edit an user. === Bludit v4
* @param array $args All supported keys are defined in the class users.class.php variable $dbFields
* @param bool $args['disable'] If you set this variable the user will be disabled
* @param string $args['password'] If you set this variable a new password will be set for the user
* @return string|bool Returns TRUE on successful delete, FALSE otherwise
*/
function editUser($args) {
global $users;
global $syslog;

View file

@ -586,8 +586,8 @@ class pluginAPI extends Plugin {
}
/**
* Edit settings.
* @param array $args Keys defined in the class site.class.php variable $dbFields
* Edit settings
* @param array $args All supported keys are defined in the class site.class.php variable $dbFields
* @return array
*/
private function editSettings($args)
@ -610,7 +610,7 @@ class pluginAPI extends Plugin {
| The list of pages are the page's key
|
| @return array
*/
*/
private function getCategories()
{
global $categories;
@ -634,7 +634,7 @@ class pluginAPI extends Plugin {
| @key string Category key
|
| @return array
*/
*/
private function getCategory($key)
{
try {
@ -729,7 +729,7 @@ class pluginAPI extends Plugin {
| @username string Username
|
| @return array
*/
*/
private function getUser($username)
{
try {
@ -753,7 +753,7 @@ class pluginAPI extends Plugin {
| Returns all the users
|
| @return array
*/
*/
private function getUsers()
{
global $users;
@ -939,7 +939,7 @@ class pluginAPI extends Plugin {
@pageKey string The page's key
@return['data'] array The list of files
*/
*/
private function getFiles($pageKey)
{
$chunk = false;