File/nasmail/functions/html.php

Description

html.php

The idea is to inlcude here some functions to make easier the right to left implementation by "functionize" some html outputs.

  • version: $Id: html.php 1428 2009-01-13 10:14:30Z tokul $
  • copyright: (c) 1999-2006 The SquirrelMail Project Team
  • copyright: (c) 2006-2007 The NaSMail Project
  • license: GNU Public License
Functions
echo_template_var (line 186)

Temporary test function to process template vars with formatting.

I use it for viewing the message_header (view_header.php) with a sort of template.

  • deprecated: 1.2 - 2007.06.16 - function will be removed in NaSMail 2.0. Don't use it in released plugins. NaSMail core scripts don't use it since 1.4.
void echo_template_var (string|array $var, [array $format_ar = array()])
  • string|array $var
  • array $format_ar
html_tag (line 28)

Generate html tags

Function flips 'left' and 'right' alignment tags in RTL translations

  • return: HTML ready for output
string html_tag (string $tag, [string $val = ''], [string $align = ''], [string $bgcolor = ''], [string $xtra = ''])
  • string $tag: Tag to output
  • string $val: Value between tags
  • string $align: Alignment (left, center, etc)
  • string $bgcolor: Back color in hexadecimal
  • string $xtra: Extra options
nsm_fix_session_url (line 251)

Adds session id to URL, if it is needed

Function makes sure that session id is included in URLs unsupported by PHP session.use_trans_sid.

If you want to do HTTP redirect with PHP header() function, use nsm_http_redirect().

WARNING: don't use function with external urls.

  • return: html encoded url.
  • since: 1.2
string nsm_fix_session_url (string $url, [boolean $link = true])
  • string $url: URL which needs session id.
  • boolean $link: Is URL html encoded. HTTP redirects, HTML meta redirects and JavaScript calls need urls that are not html sanitized.
nsm_html2txt (line 269)

Converts HTML to plain text.

  • return: plain text (in utf-8)
  • since: 1.3
string nsm_html2txt (string $string, string $input_charset)
  • string $string: HTML text
  • string $input_charset: character set
nsm_http_redirect (line 226)

Function sends HTTP 302 header and handles session.use_trans_sid differences.

WARNING: don't use function for redirection to external urls.

  • since: 1.2
void nsm_http_redirect (string $url)
  • string $url: redirection url
set_url_var (line 104)

handy function to set url vars

especially usefull when $url = $PHP_SELF

string set_url_var (string $url, string $var, [string $val = null], [boolean $link = true])
  • string $url: url URL
  • string $var: name of added, removed or modified variable
  • string $val: variable value. if value is null, it is removed from url. if value is not null, it is added or replaced. Zero value is handled correctly only in NaSMail 1.2+
  • boolean $link: Controls if $url contains html encoded url or plain url.
stripos (line 384)

Case insensitive strpos for PHP 4.x

int stripos (string $haystack, string $needle, [int $offset = 0])
  • string $haystack
  • string $needle
  • int $offset

Documentation generated on Sun, 22 Nov 2009 17:36:37 +0200 by phpDocumentor 1.4.3