File/core/internal_components/common/globals/php_functions.inc.php

Description

All the function available into PLICI

  • author: SimpliciWeb
  • version: $Id: php_functions.inc.php 859 2008-01-23 08:50:43Z stephanet $
  • filesource: Source Code for this file
Includes
 include (dirname(__FILE__)."/php5_function.inc.php") (line 3340)

Load php5 function for php4

 include_once (dirname(__FILE__)."/plicitag_function.inc.php") (line 54)

Include dirname(__FILE__)."/plicitag_function.inc.php"

Constants
PLICI_ADMIN_PLICI_DIRECTORY = "admin_plici" (line 67)
PLICI_ADMIN_SITES_DIRECTORY = "admin_sites" (line 66)
PLICI_BD_DIRECTORY = "bd" (line 68)
PLICI_BD_FOR_PLICI_ADMIN_SUPER_DIRECTORY = PLICI_BD_DIRECTORY."/".PLICI_FOR_PLICI_DIRECTORY."/admin_super" (line 73)
PLICI_BD_FOR_PLICI_DIRECTORY = PLICI_BD_DIRECTORY."/".PLICI_FOR_PLICI_DIRECTORY (line 72)
PLICI_BD_MY_ADMIN_SUPER_DIRECTORY = PLICI_BD_MY_DIRECTORY."/admin_super" (line 70)
PLICI_BD_MY_ALL_SITES_DIRECTORY = PLICI_BD_MY_DIRECTORY."/_all_sites" (line 71)
PLICI_BD_MY_DIRECTORY = PLICI_BD_DIRECTORY."/".PLICI_MY_DIRECTORY (line 69)
PLICI_CORE_DIRECTORY = "core" (line 76)
PLICI_CORE_ENTREES_ADMIN_SITES_DIRECTORY = PLICI_CORE_ENTREES_DIRECTORY."/".PLICI_ADMIN_SITES_DIRECTORY (line 79)
PLICI_CORE_ENTREES_ADMIN_SITES_MY_DIRECTORY = PLICI_CORE_ENTREES_ADMIN_SITES_DIRECTORY."/".PLICI_MY_DIRECTORY (line 83)
PLICI_CORE_ENTREES_DIRECTORY = PLICI_CORE_DIRECTORY."/entrees" (line 77)
PLICI_CORE_ENTREES_FRONT_SITES_DIRECTORY = PLICI_CORE_ENTREES_DIRECTORY."/front_sites" (line 78)
PLICI_CORE_ENTREES_FRONT_SITES_FOR_PLICI_DIRECTORY = PLICI_CORE_ENTREES_FRONT_SITES_DIRECTORY."/".PLICI_FOR_PLICI_DIRECTORY (line 82)
PLICI_CORE_ENTREES_FRONT_SITES_MY_DIRECTORY = PLICI_CORE_ENTREES_FRONT_SITES_DIRECTORY."/".PLICI_MY_DIRECTORY (line 81)
PLICI_CORE_EXTERNAL_COMPONENTS_PEAR_DIRECTORY = PLICI_CORE_DIRECTORY.'/external_components/pears' (line 85)
PLICI_CORE_INTERNAL_COMMON_GLOBALS = PLICI_CORE_DIRECTORY.'/internal_components/common/globals' (line 86)
PLICI_CORE_INTERNAL_COMPONENTS_FRONT_SITES_THEME_ELEMENT_DIRECTORY = PLICI_CORE_DIRECTORY."/internal_components/front_sites/theme_elements" (line 87)
PLICI_CORE_INTERNAL_COMPONENTS_FRONT_SITES_THEME_ELEMENT_MY_DIRECTORY = PLICI_CORE_INTERNAL_COMPONENTS_FRONT_SITES_THEME_ELEMENT_DIRECTORY."/".PLICI_MY_DIRECTORY (line 88)
PLICI_CORE_MODULE_DIRECTORY = PLICI_CORE_DIRECTORY."/module" (line 89)
PLICI_FOR_PLICI_DIRECTORY = 'for_plici' (line 59)
PLICI_INCLUDE_ENTREES_FRONT_SITES_FOR_PLICI_DIRECTORY = "entrees/front_sites/".PLICI_FOR_PLICI_DIRECTORY (line 80)
PLICI_LOG_DIRECTORY = 'log' (line 61)
PLICI_MOD_SRC_DIRECTORY = "original_module" (line 92)
PLICI_MOD_SRC_MY_DIRECTORY = PLICI_MOD_SRC_DIRECTORY."/".PLICI_MY_DIRECTORY (line 93)
PLICI_MOD_USER_DIRECTORY = "module" (line 64)
PLICI_MY_DIRECTORY = 'my' (line 58)
PLICI_PICTURE_DIRECTORY = "picture" (line 109)
PLICI_PICTURE_EXT_DIRECTORY = PLICI_PICTURE_DIRECTORY."/ext" (line 110)
PLICI_TMP_DIRECTORY = 'tmp' (line 62)
PLICI_VIEW_DIRECTORY = "view" (line 96)
PLICI_VIEW_EXTERNAL_COMPONENTS_DIRECTORY = PLICI_VIEW_DIRECTORY.'/external_components' (line 105)
PLICI_VIEW_EXTERNAL_COMPONENTS_MY_DIRECTORY = PLICI_VIEW_EXTERNAL_COMPONENTS_DIRECTORY."/".PLICI_MY_DIRECTORY (line 106)
PLICI_VIEW_EXTERNAL_COMPONENTS_STATS_PHPMV2_LIBS_DIRECTORY = PLICI_VIEW_DIRECTORY.'/external_components/stats/phpmv2/libs' (line 104)
PLICI_VIEW_SITES_DIRECTORY = PLICI_VIEW_DIRECTORY."/sites" (line 97)
PLICI_VIEW_SITES_FOR_PLICI_ADMIN_PLICI_DIRECTORY = PLICI_VIEW_SITES_FOR_PLICI_DIRECTORY."/".PLICI_ADMIN_PLICI_DIRECTORY (line 101)
PLICI_VIEW_SITES_FOR_PLICI_DIRECTORY = PLICI_VIEW_SITES_DIRECTORY."/".PLICI_FOR_PLICI_DIRECTORY (line 100)
PLICI_VIEW_SITES_MY_ADMIN_SITES_DIRECTORY = PLICI_VIEW_SITES_DIRECTORY."/".PLICI_MY_DIRECTORY.'/'.PLICI_ADMIN_SITES_DIRECTORY (line 99)
PLICI_VIEW_SITES_MY_DIRECTORY = PLICI_VIEW_SITES_DIRECTORY."/".PLICI_MY_DIRECTORY (line 98)
Functions
array_to_php_script (line 156)

Translate an array in a PHP script file wich declare this array

string array_to_php_script (array $array, string $array_name_in_php)
  • array $array
  • string $array_name_in_php
createMyDirectories (line 207)

Create the /my directories for PLICI environnement

  • return: TRUE on error
bool createMyDirectories (string $p_racin_path)
  • string $p_racin_path
deleteCacheForMyDatabase (line 1586)

Delete database cache (/bd/my/website/*.already_made) for a specific website

unknown deleteCacheForMyDatabase (unknown_type $p_database, unknown_type $p_racine_web_path, [unknown_type $echo = true])
  • unknown_type $p_database
  • unknown_type $p_racine_web_path
  • unknown_type $echo
deleteCacheForPliciDatabase (line 1598)

Delete database cache (/bd/for_plici/website/*.already_made) for a specific website

unknown deleteCacheForPliciDatabase (unknown_type $p_database, unknown_type $p_racine_web_path, [unknown_type $echo = true])
  • unknown_type $p_database
  • unknown_type $p_racine_web_path
  • unknown_type $echo
deleteCacheForWebSite (line 1682)

Delete Smarty file cache (/tmp/websitename/cache/websitename/) for a specific website

void deleteCacheForWebSite (string $p_web_site_name, string $p_racine_web_path, [bool $echo = true])
  • string $p_web_site_name
  • string $p_racine_web_path
  • bool $echo
deleteCompleteCacheForWebSite (line 1653)

Delete all cache (/tmp/website/) for a specific website

void deleteCompleteCacheForWebSite (string $p_web_site_name, string $p_racine_web_path, [bool $echo = true])
  • string $p_web_site_name
  • string $p_racine_web_path
  • bool $echo
echo_net (line 733)

PLICI Debug echo

void echo_net (mixed $string)
  • mixed $string
generatePassword (line 1547)

Generate a random password

string generatePassword ([integer $length = 8])
  • integer $length
generateUniqueId (line 1777)

Generate a unique id (35 characters)

unknown generateUniqueId ()
getAdminDirectory (line 1808)

Find the admin directory of a web site

string getAdminDirectory (string $p_dbname)
  • string $p_dbname
getArrayListOfMyDirectories (line 175)

Get list of MY directories needed for PLICI

array getArrayListOfMyDirectories (string $p_racin_path)
  • string $p_racin_path
getDateSmartyFromArray (line 505)

Transform a Smarty date to a string

string getDateSmartyFromArray (string $p_var_name,  &$p_array, string $p_default_value, array $p_array)
  • string $p_var_name
  • array $p_array
  • string $p_default_value
  • &$p_array
getDateSmartyFromArrayAndAssign (line 530)

Transform a Smarty date to a string and assign to smarty

string getDateSmartyFromArrayAndAssign (string $p_var_name,  &$p_array, string $p_default_value,  &$smarty, array $p_array, Smarty_custom $smarty)
  • string $p_var_name
  • array $p_array
  • string $p_default_value
  • Smarty_custom $smarty
  • &$p_array
  • &$smarty
getForRunDbDirectory (line 2272)

For run_db_directory, make vars

void getForRunDbDirectory (array $_PLICI_CFG,  &$_3d6f_loc_bd_director_name,  &$_3d6f_loc_extention_must_be_redone,  &$_3d6f_loc_directory_to_redo,  &$_3d6f_loc_accepted_extension,  &$_3d6f_loc_racine_web_path,  &$_3d6f_loc_bd_path, string $_3d6f_loc_bd_director_name, string $_3d6f_loc_extention_must_be_redone, array $_3d6f_loc_directory_to_redo, array $_3d6f_loc_accepted_extension, string $_3d6f_loc_racine_web_path, string $_3d6f_loc_bd_path)
  • array $_PLICI_CFG
  • string $_3d6f_loc_bd_director_name
  • string $_3d6f_loc_extention_must_be_redone
  • array $_3d6f_loc_directory_to_redo
  • array $_3d6f_loc_accepted_extension
  • string $_3d6f_loc_racine_web_path
  • string $_3d6f_loc_bd_path
  • &$_3d6f_loc_bd_director_name
  • &$_3d6f_loc_extention_must_be_redone
  • &$_3d6f_loc_directory_to_redo
  • &$_3d6f_loc_accepted_extension
  • &$_3d6f_loc_racine_web_path
  • &$_3d6f_loc_bd_path
getFromArray (line 561)

Find a key in an array an return it or return default value

mixed getFromArray (string $p_var_name,  &$p_array, string $p_default_value, array $p_array)
  • string $p_var_name
  • array $p_array
  • string $p_default_value
  • &$p_array
getFromArrayAndAssign (line 574)

Find a key (or default value) in an array an assign it to smarty

mixed getFromArrayAndAssign (string $p_var_name,  &$p_array, string $p_default_value,  &$smarty, array $p_array, Smarty_custom $smarty)
  • string $p_var_name
  • array $p_array
  • string $p_default_value
  • Smarty_custom $smarty
  • &$p_array
  • &$smarty
getNewAdminSuperDirectory (line 1787)

No return new directory, only return the actual admin dir.

  • todo: It is really wath we need ?
string getNewAdminSuperDirectory ()
get_mysql_link_for_database (line 2029)

Find the link to connect to a database

resource get_mysql_link_for_database (string $database_name,  &$p_dbc_inherited_sitename, string $p_dbc_inherited_sitename)
  • string $database_name
  • string $p_dbc_inherited_sitename: Inherited site name
  • &$p_dbc_inherited_sitename
isWindows (line 143)

Test if is a Windows server or not

bool isWindows ()
make_writable (line 3127)

Returns true if the given file/dir has been made writable (or is already writable).

bool make_writable (string $file)
  • string $file
multilang (line 790)

Usefull function to support multilanguage request.

It change a "param_name" to "param_name_l1" for language 1 for example.

string multilang (string $param_name, [bool $p_for_insert = FALSE])
  • string $param_name
  • bool $p_for_insert: (deprecated)
mysql_drop_database (line 2177)

Drop a database.

BECAREFULL : Use it with care !

  • return: TRUE on error
bool mysql_drop_database (string $host, string $databasename, string $login, string $pass, [bool $echo = true])
  • string $host
  • string $databasename
  • string $login
  • string $pass
  • bool $echo
mysql_execute_multiplerequest (line 1916)

execute multiple SQL requests in a string BECAREFULL : She is also declared in databaseconnexion object

  • return: TRUE on error
bool mysql_execute_multiplerequest (string $sql_to_play,  &$mysql_link, [string $end_line = "<br/>"], resource $mysql_link)
  • string $sql_to_play
  • resource $mysql_link
  • string $end_line
  • &$mysql_link
mysql_execute_script (line 1894)

run an SQL script file

  • return: TRUE on error
bool mysql_execute_script (string $file_path,  &$mysql_link, [string $end_line = "<br/>"], resource $mysql_link)
  • string $file_path
  • resource $mysql_link
  • string $end_line
  • &$mysql_link
mysql_exec_script_and_search_login_from_admin (line 2219)

Execute an SQL script an find the login to connect to the good database

  • return: TRUE on error
bool mysql_exec_script_and_search_login_from_admin ( &$database_name, string $script_filename, string $database_name)
  • string $database_name
  • string $script_filename
  • &$database_name
net_copy (line 1717)

Copy a directory to another

  • return: TRUE on error
bool net_copy (string $base_src, string $base_dest, array $extension_to_copy, [string $filename_for_not_copy_directory = ".not_copy_this_directory"], [bool $is_no_error_if_file_exist_and_no_overwrite = false])
  • string $base_src
  • string $base_dest
  • array $extension_to_copy: Becareful sample $array ('html'=>'OK', 'php'=>'OK')
  • string $filename_for_not_copy_directory
  • bool $is_no_error_if_file_exist_and_no_overwrite
net_file_put_contents (line 1528)

Put a string into a file

  • return: TRUE on error
bool net_file_put_contents (string $filename, string $data_string)
  • string $filename
  • string $data_string
net_mkdirs (line 301)

Create multiple directories

  • return: TRUE if all is of (BECAREFUL)
bool net_mkdirs (string $path, [bool $all_is_ok = true])
  • string $path
  • bool $all_is_ok
net_rmdir (line 1157)

delete a directory recursively

  • return: TRUE on error
bool net_rmdir (array|string $p_array_dir)
  • array|string $p_array_dir
net_scandir (line 1225)

Scan a directory to list is files and directory (replace the php scan_dir function and add functionnalities)

  • return: on error, else false
true net_scandir (string $dir,  &$r_files, [bool $p_only_path = false], [string $parent_dir = ""], [string $filename_for_not_copy_directory = ""], [bool $recurse_sub_folder = true], [array $exclude_dirs = array()], [array $p_directory_not_parsed = array(".svn"=>"no")], [bool $p_get_filie_size = false], [bool $p_not_get_symbolic_links = true], [false $p_echo = false], [integer $p_deep = 1], array $r_files)
  • string $dir
  • array $r_files
  • bool $p_only_path
  • string $parent_dir
  • string $filename_for_not_copy_directory
  • bool $recurse_sub_folder
  • array $exclude_dirs
  • array $p_directory_not_parsed
  • bool $p_get_filie_size
  • bool $p_not_get_symbolic_links
  • false $p_echo
  • integer $p_deep
  • &$r_files
net_url (line 323)

Net url build a PLICI URL

string net_url (array $params, [bool $print_stdout = true], [Smarty_custom $smarty = NULL])
net_urlencode (line 773)

encode url

string net_urlencode (string $p_value)
  • string $p_value
net_value (line 242)

Escape a string to replace " and ' by html codes

string net_value (string $string)
  • string $string
plici_debug_backtrace (line 742)

A plici debug function

  • return: ['file'] => filename,['call']=> error
array plici_debug_backtrace ()
plici_lang (line 1090)

Retreive from an id the convert string in the good language

string plici_lang (string $p_id, [array $params = array()], [string $p_type = "TPL"])
  • string $p_id
  • array $params
  • string $p_type
plici_makeInherit (line 2782)

For the run_db_directory

  • return: TRUE on error
bool plici_makeInherit (array $_PLICI_CFG, string $p_br_or_n, [bool $echo = false])
  • array $_PLICI_CFG
  • string $p_br_or_n
  • bool $echo
plici_make_writable (line 3058)

Returns true if the given file/dir has been made writable (or is already writable).

bool plici_make_writable (string $file)
  • string $file
plici_mkdir (line 3265)

Make a directory with path ending by a slash or not

  • return: TRUE on success or FALSE on failure.
bool plici_mkdir (string $pathname)
  • string $pathname
plici_mysql_connect (line 257)

Connect to a database and wait 10 times for a free connexion if mysql is out.

resource plici_mysql_connect (string $p_hostname, string $p_username, string $p_password, [integer $p_max_attempt = 10], [ $p_force_new_connection = false])
  • string $p_hostname
  • string $p_username
  • string $p_password
  • integer $p_max_attempt
  • $p_force_new_connection
plici_round_price (line 3114)

Function roud price

float plici_round_price (float $p_price)
  • float $p_price
plici_rssToArray (line 2998)

Translate a RSS to an Array

array plici_rssToArray (string $url)
  • string $url
print_byte (line 888)

Print an integer in byte

string print_byte (integer $p_param)
  • integer $p_param: Value in Octets
print_date (line 1055)

Print a string to the PLICI date format

string print_date (string $p_param)
  • string $p_param
print_day (line 1073)

Print an integer with day or days.

Sample : 4 days, 0 day

string print_day (integer $p_param)
  • integer $p_param
print_perct (line 985)

Print an integer to the format 0.00%

  • return: Ex : 0.40 %
string print_perct (string $p_param)
  • string $p_param: Ex : 0.4
print_price (line 944)

Print a price from a float

string print_price (float $p_param)
  • float $p_param
print_price_2dec (line 1016)

Print price with 2 decimals

unknown print_price_2dec (unknown_type $p_param)
  • unknown_type $p_param
print_r_net (line 724)

PLICI debug function

void print_r_net (mixed $array)
  • mixed $array
print_weight (line 914)

Print formated weight

string print_weight (integer $p_param)
  • integer $p_param
protect_email (line 873)

Protect email

string protect_email (string $tpl_output,  &$smarty, Smarty_custom $smarty)
recursive_is_writable (line 3224)

Recursibly test if is writable

bool recursive_is_writable (string $start_file)
  • string $start_file
recursive_make_writable (line 3183)

Recursive make writable

bool recursive_make_writable (string $start_file)
  • string $start_file
replace_in_files (line 1830)

Replace in files

  • return: TRUE on error
bool replace_in_files (array $array_files_to_parse, array $parameters, [string $suffix_for_file_generated = ""])
  • array $array_files_to_parse
  • array $parameters
  • string $suffix_for_file_generated
run_db_directory (line 2295)

Run the database scripts on /db/

  • return: TRUE on error
bool run_db_directory (array $_PLICI_CFG, [string $p_unique_database_to_load = ""], [string $p_br_or_n = "<br/>"], [bool $p_is_simulation = false])
  • array $_PLICI_CFG
  • string $p_unique_database_to_load
  • string $p_br_or_n
  • bool $p_is_simulation
smarty_bloc_dynamique (line 824)

A Smarty bloc forcing to not use cache

string smarty_bloc_dynamique (array $param, string $content,  &$smarty, Smarty_custom $smarty)
SuppAccents (line 547)

Delete accent from a string

$tofind = "+-àáâãäåÒÓÔÖØ=óôõöøèéêë>ÇçÝÏìíîïÝ<ùúûüÿÑñ"; $replac = "--aaaaaaOOOOO-oooooeeee-CcYIiiiiY-uuuuyNn";

string SuppAccents (string $chaine)
  • string $chaine
transformStringAndWriteToFile (line 1876)

Transform a string and write it

void transformStringAndWriteToFile (string $string, array $parameters, string $filename)
  • string $string
  • array $parameters: [to_change]=>"change by"
  • string $filename
transformWithParameters (line 1862)

Transform a string

string transformWithParameters (string $insert_for_admin_super, array $parameters)
  • string $insert_for_admin_super
  • array $parameters
update_config_file (line 231)

Update the PLICI config

void update_config_file (array $array_cfg)
  • array $array_cfg
xDeleteCacheForDatabase (line 1611)

Delete the database script cache (already made)

  • access: private
void xDeleteCacheForDatabase (string $p_database, string $p_racine_web_path, [bool $echo = true], [string $p_my_or_plici = &quot;&quot;])
  • string $p_database
  • string $p_racine_web_path
  • bool $echo
  • string $p_my_or_plici
xDumpVar (line 590)

Dump a var

  • access: private
string xDumpVar (mixed $data)
  • mixed $data
xnet_scandir (line 1279)

List of file into a folder and sub folder $exclude_dirs = Keys are the dirs to excludes

  • return: TRUE on error
  • access: private
bool xnet_scandir (string $dir,  &$r_files, bool $p_only_path, string $parent_dir, stirng $filename_for_not_copy_directory, bool $recurse_sub_folder, array $exclude_dirs, array $p_directory_not_parsed, bool $p_get_filie_size, bool $p_not_get_symbolic_links, [bool $p_echo = false], [integer $p_deep = 1], array $r_files)
  • string $dir
  • array $r_files
  • bool $p_only_path
  • string $parent_dir
  • stirng $filename_for_not_copy_directory
  • bool $recurse_sub_folder
  • array $exclude_dirs
  • array $p_directory_not_parsed
  • bool $p_get_filie_size
  • bool $p_not_get_symbolic_links
  • bool $p_echo
  • integer $p_deep
  • &$r_files
x_smarty_function_net_img (line 3279)

Print an image from t_graphic by smarty

  • access: private
string x_smarty_function_net_img (array $params,  &$smarty, Smarty_custom $smarty)
x_smarty_function_plici_lang (line 1113)

Print a string translated in the current language from smarty

  • access: private
string x_smarty_function_plici_lang (array $params,  &$smarty, [bool $print_stdout = true], Smarty_custom $smarty)
  • array $params
  • Smarty_custom $smarty
  • bool $print_stdout
  • &$smarty

Documentation generated on Tue, 25 Mar 2008 15:35:28 +0100 by phpDocumentor 1.3.2