Currency Converter

  • Currency
  • US$ Amount

General functions

Dimofinf appreciates your time and so, we offer you a selection of ready functions and constants to save your time and help you with your programming.  In the following lines, we will mention the function and its parameters. 
  • clean_user_input($text, $noscript = false)

This function cleans text from harmful HTML codes. Please note that this works in accordance with the user's Editor permissions, if the user is authorized to use HTML codes, then, the function won't clean the HTML codes.

Parameters :

      -  $text
(mandatory): the text you wish to clean.
      -  $noscript (optional): the value 'boolean true/false' is used to determine whether you want to
            clean the text as well from the tag; if so, choose the 'true' value.

Example :

{* php buffer start *} $cleaned clean_user_input($dimofinf->GPC['description']);
$dimofinf->GPC['description'] = $cleaned['text'];
$cleaned clean_user_input($dimofinf->GPC['caption'], TRUE);
$dimofinf->GPC['caption'] = $cleaned['text']; 
{* php buffer end *}

  • getpermalink($file, $args = false, $outputfiletype = false, $default = false, $caption = false)

This function returns the full URL to the form you specified in the Dimofinf settings and according to the parameters you passed for the function.

Parameters :

$file (mandatory): the file name for the URL.
      -  $args (optional): the URL variables in the form of QUERY_STRING.
      -  $outputfiletype (optional): this is the value for determining the URL extension. This is used if you want the
            file extension to be anything else other than '.php' which is the default. This function only works when
            shortened URLs are disabled.

      -  $default (optional): the value 'boolean true/false' is used to force the function to return the URL to its default
             form whether shortened URLs are activated or not.

      -  $caption (optional): add text whether a content title or anything else to insert among the URLs. This works if
            the 'Shortened URLs followed by a title' is activated.

Example :

{* php buffer start *} getpermalink('albums','action=s&id='. $row['id'],false,false,$row['caption']) 
{* php buffer end *}

  • DIM_setcookie($name, $value ='', $permanent = true, $allowsecure = true, $httponly = false, $expire = 0)

This function plants cookies for the users but this function doesn't perform its job if the constant NOCOOKIES has been defines before calling it.


$name (mandatory): the cookies name.
      -  $value (optional): the cookies value.
      -  $permanent (optional): when the value 'boolean true/false' is set to 'true', the '$expire' parameter value is set to 365
            days and this is the period of the cookies and if this value is set to 'false' and no value was set for the '$expire'
            parameter, a value will be added to the '$expire' parameter.

      -  $allowsecure (optional): the value 'boolean true/false' is used to determine whether to send cookies only through
            HTTPS safe connections for the browser or not.

      -  $httponly (optional): the value 'boolean true/false' is used to determine whether cookies are called through HTTP protocol;
             this would prevent calling it by any other method like Java script which lessens XSS threats

      -  $expire (optional): add the cookies expiration time in the form of Unix Timestamp.


{* php buffer start *} DIM_setcookie('userid', $dimofinf->userinfo['userid'], false, true, true);
DIM_setcookie('userid', $dimofinf->userinfo['userid'], false, true, true,time()+60*60*24*30); 
{* php buffer end *}

  • iif($expression, $returntrue, $returnfalse='')

This function works in the same way as conditional IF function but this function's advantage is that it can be embedded and applied anywhere in the code.


$expression (mandatory): the condition.
      -  $returntrue (optional): the value if the condition is met.
      -  $returnfalse (optional): the value if the condition isn't met.


{* php buffer start *} $countdown iif($count['total'] >$dimofinf->options['videonc'],
$dimofinf->options['videonc'], $count['total']); 
{* php buffer end *}

  • log_action($extrainfo ='', $userid = -1, $script ='', $scriptaction ='')

This function is important and it must be added at the end of executing any action in order to record this action in the database records so that the website admin/owner can review the motion and executions records that were done to/on the website.


$extrainfo (optional): the name of the table and additional information to record.
      -  $userid (optional): the user ID for the user who executed the action. If the default value is set to '-1',
             then it will be recorded with the user ID of the current user whether it is a user or a visitor.

      -  $script (optional): the name of the file which the action was executed upon. If this is left empty, it will take
             the name of the current file through which the action has been executed.

      -  $scriptaction (optional): the sent value of the variable 'Action' and it is used for determining the action done name.
             This can be recorded in another action name by assigning a value to it.


{* php buffer start *} log_action(!empty($dimofinf->GPC['id']) ?"id = ". $dimofinf->GPC['id'] :''); 
{* php buffer end *}

  • exec_shut_down()

This function is added to the end of the PHP file and it has several jobs, the most important of which is determining where it is within Dimofinf, emptying the temporary memory of pending processes and cancelling the locking of the tables with pending processes.


{* php buffer start *} exec_shut_down(); 
{* php buffer end *}

  • fopen_by_curl($remote, $ispost = false, $postdata = false)

This function allows you to surf other websites using the CURL library.


$remote (mandatory): the desired URL.
      -  $ispost (optional): the value 'boolean true/false' is set to 'true' if you want the sending method to be POST.
      -  $postdata (optional): a matrix which contains the variables and their values to be sent with the
            browser if the sending method is set to POST.


{* php buffer start *} $google fopen_by_curl(''); 
{* php buffer end *}

  • parse_xml_by_simplexml($data, $returnarray = false)

This function reads XML text and converts it to an object using the SimpleXML library and it can be returned as an object or as a matrix.


$data (optional): the XML text.
      -  $returnarray (optional): the value 'boolean true/false' is set to 'true' if you want to return the text as a matrix.


{* php buffer start *} arse_xml_by_simplexml($xml); 
{* php buffer end *}

Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read

User functions (Views: 937)

verify_id($idname, &$id, $alert = true, $selall = false, $options = 0)This function is used...

Email functions (Views: 951)

[php]DIM_mail($remail, $rname, $message, $subject, $semail ="", $sname ="", $priority = 3, $mass...

Content functions (Views: 846)

recursive($dynamic_cat_id,$module,$rate)This function is important and should be added at the end...

Numbers and dates functions (Views: 865)

DIM_date($format, $timestamp = TIMENOW, $doyestoday = false, $datemethod ="", $adjust = true,...

Files functions (Views: 1253)

file_extension($filename)This function is used to return the file extension.Parameters: ...