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 ## 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. 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 /**
* Create a new category. === Bludit v4
@key string Array => (key: string) * @param array $args [string $name, string $template, string $description]
@return string/bool Returns the page key on successful delete, FALSE otherwise * @return string|bool Returns the category key on successful create, FALSE otherwise
*/ */
function deletePage($args) { function createCategory($args) {
... ...
} }
``` ```

View file

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

View file

@ -586,8 +586,8 @@ class pluginAPI extends Plugin {
} }
/** /**
* Edit settings. * Edit settings
* @param array $args Keys defined in the class site.class.php variable $dbFields * @param array $args All supported keys are defined in the class site.class.php variable $dbFields
* @return array * @return array
*/ */
private function editSettings($args) private function editSettings($args)