mosHTML Class Reference

List of all members.

Static Public Member Functions

static makeOption ($value, $text='')
static writableCell ($folder)
static selectList ($arr, $tag_name, $tag_attribs, $key, $text, $selected=NULL)
static integerSelectList ($start, $end, $inc, $tag_name, $tag_attribs, $selected, $format="")
static monthSelectList ($tag_name, $tag_attribs, $selected)
static yesnoSelectList ($tag_name, $tag_attribs, $selected, $yes=_CMN_YES, $no=_CMN_NO)
static radioList ($arr, $tag_name, $tag_attribs, $selected=null, $key='value', $text='text')
static yesnoRadioList ($tag_name, $tag_attribs, $selected, $yes=_CMN_YES, $no=_CMN_NO)
static idBox ($rowNum, $recId, $checkedOut=false, $name='cid')
static sortIcon ($base_href, $field, $state='none')
static CloseButton (&$params, $hide_js=NULL)
static BackButton (&$params, $hide_js=NULL)
static cleanText (&$text)
static PrintIcon (&$row, &$params, $hide_js, $link, $status=NULL)
static emailCloaking ($mail, $mailto=1, $text='', $email=1)
static encoding_converter ($text)
static mosToolTip ($tooltip, $title='', $width='', $image='tooltip.png', $text='', $href='#')


Detailed Description

Backwards compatibility HTML class

Definition at line 7 of file mosHTML.php.


Member Function Documentation

static mosHTML::makeOption ( value,
text = '' 
) [static]

static mosHTML::writableCell ( folder  )  [static]

Definition at line 13 of file mosHTML.php.

00013                                             {
00014         echo '<tr>';
00015         echo '<td class="item">' . $folder . '/</td>';
00016         echo '<td align="left">';
00017         echo is_writable( "../$folder" ) ? '<b><span class="green">'.T_('Writeable').'</span></b>' : '<b><span class="red">'.T_('Unwriteable').'</span></b>' . '</td>';
00018         echo '</tr>';
00019     }

static mosHTML::selectList ( arr,
tag_name,
tag_attribs,
key,
text,
selected = NULL 
) [static]

Generates an HTML select list

Parameters:
array An array of objects
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
string The name of the object variable for the option value
string The name of the object variable for the option text
mixed The key that is selected
Returns:
string HTML for the select list

Definition at line 31 of file mosHTML.php.

References aliroHTML::getInstance().

Referenced by mosAdminMenus::Access(), mosAdminMenus::Category(), mosAdminMenus::ComponentCategory(), mosAdminMenus::GetImageFolders(), mosAdminMenus::GetImages(), mosAdminMenus::GetSavedImages(), mosAdminMenus::Images(), integerSelectList(), mosAdminMenus::MenuSelect(), monthSelectList(), mosAdminMenus::Ordering(), mosAdminMenus::Positions(), mosAdminMenus::Section(), mosAdminMenus::SelectSection(), mosAdminMenus::SpecificOrdering(), mosAdminMenus::Target(), mosAdminMenus::UserSelect(), widgetAdminHTML::yesNoList(), and yesnoSelectList().

00031                                                                                               {
00032         return aliroHTML::getInstance()->selectList($arr, $tag_name, $tag_attribs, $key, $text, $selected);
00033     }

static mosHTML::integerSelectList ( start,
end,
inc,
tag_name,
tag_attribs,
selected,
format = "" 
) [static]

Writes a select list of integers

Parameters:
int The start integer
int The end integer
int The increment
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
mixed The key that is selected
string The printf format to be applied to the number
Returns:
string HTML for the select list

Definition at line 46 of file mosHTML.php.

References makeOption(), and selectList().

00046                                                                                                             {
00047         $start = intval( $start );
00048         $end = intval( $end );
00049         $inc = intval( $inc );
00050         $arr = array();
00051         for ($i=$start; $i <= $end; $i+=$inc) {
00052             $fi = $format ? sprintf( "$format", $i ) : "$i";
00053             $arr[] = mosHTML::makeOption( $fi, $fi );
00054         }
00055 
00056         return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
00057     }

static mosHTML::monthSelectList ( tag_name,
tag_attribs,
selected 
) [static]

Writes a select list of month names based on Language settings

Parameters:
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
mixed The key that is selected
Returns:
string HTML for the select list values

Definition at line 66 of file mosHTML.php.

References makeOption(), and selectList().

00066                                                                           {
00067         $arr = array(
00068         mosHTML::makeOption( '01', _JAN ),
00069         mosHTML::makeOption( '02', _FEB ),
00070         mosHTML::makeOption( '03', _MAR ),
00071         mosHTML::makeOption( '04', _APR ),
00072         mosHTML::makeOption( '05', _MAY ),
00073         mosHTML::makeOption( '06', _JUN ),
00074         mosHTML::makeOption( '07', _JUL ),
00075         mosHTML::makeOption( '08', _AUG ),
00076         mosHTML::makeOption( '09', _SEP ),
00077         mosHTML::makeOption( '10', _OCT ),
00078         mosHTML::makeOption( '11', _NOV ),
00079         mosHTML::makeOption( '12', _DEC )
00080         );
00081 
00082         return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
00083     }

static mosHTML::yesnoSelectList ( tag_name,
tag_attribs,
selected,
yes = _CMN_YES,
no = _CMN_NO 
) [static]

Writes a yes/no select list

Parameters:
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
mixed The key that is selected
Returns:
string HTML for the select list values

Definition at line 92 of file mosHTML.php.

References makeOption(), and selectList().

00092                                                                                                       {
00093         $arr = array(
00094         mosHTML::makeOption( '0', $no ),
00095         mosHTML::makeOption( '1', $yes ),
00096         );
00097 
00098         return mosHTML::selectList( $arr, $tag_name, $tag_attribs, 'value', 'text', $selected );
00099     }

static mosHTML::radioList ( arr,
tag_name,
tag_attribs,
selected = null,
key = 'value',
text = 'text' 
) [static]

Generates an HTML radio list

Parameters:
array An array of objects
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
mixed The key that is selected
string The name of the object variable for the option value
string The name of the object variable for the option text
Returns:
string HTML for the select list

Definition at line 111 of file mosHTML.php.

References aliroHTML::getInstance().

00111                                                                                                            {
00112         return aliroHTML::getInstance()->radioList($arr, $tag_name, $tag_attribs, $selected, $key, $text);
00113     }

static mosHTML::yesnoRadioList ( tag_name,
tag_attribs,
selected,
yes = _CMN_YES,
no = _CMN_NO 
) [static]

Writes a yes/no radio list

Parameters:
string The value of the HTML name attribute
string Additional HTML attributes for the <select> tag
mixed The key that is selected
Returns:
string HTML for the radio list

Definition at line 122 of file mosHTML.php.

References aliroHTML::getInstance().

Referenced by mosAdminMenus::Published().

00122                                                                                                      {
00123         return aliroHTML::getInstance()->yesnoRadioList($tag_name, $tag_attribs, $selected, $yes, $no);
00124     }

static mosHTML::idBox ( rowNum,
recId,
checkedOut = false,
name = 'cid' 
) [static]

Parameters:
int The row index
int The record id
boolean 
string The name of the form element
Returns:
string

Definition at line 133 of file mosHTML.php.

References aliroHTML::getInstance().

00133                                                                              {
00134         return aliroHTML::getInstance()->idBox($rowNum, $recId, $checkedOut, $name);
00135     }

static mosHTML::sortIcon ( base_href,
field,
state = 'none' 
) [static]

Definition at line 137 of file mosHTML.php.

References aliroCore::getInstance().

00137                                                                   {
00138         $config = aliroCore::getInstance();
00139         $alts = array(
00140         'none' => _CMN_SORT_NONE,
00141         'asc' => _CMN_SORT_ASC,
00142         'desc' => _CMN_SORT_DESC,
00143         );
00144         $next_state = 'asc';
00145         if ($state == 'asc') {
00146             $next_state = 'desc';
00147         } else if ($state == 'desc') {
00148             $next_state = 'none';
00149         }
00150 
00151         $html = "<a href=\"$base_href&field=$field&order=$next_state\">"
00152         . "<img src=\"{$config->getCfg('live_site')}/images/M_images/sort_$state.png\" width=\"12\" height=\"12\" border=\"0\" alt=\"{$alts[$next_state]}\" />"
00153         . "</a>";
00154         return $html;
00155     }

static mosHTML::CloseButton ( &$  params,
hide_js = NULL 
) [static]

Writes Close Button

Definition at line 160 of file mosHTML.php.

References align.

00160                                                             {
00161         // displays close button in Pop-up window
00162         if ( $params->get( 'popup' ) && !$hide_js ) {
00163             ?>
00164             <div align="center" style="margin-top: 30px; margin-bottom: 30px;">
00165             <a href='javascript:window.close();'>
00166             <span class="small">
00167             <?php echo _PROMPT_CLOSE;?>
00168             </span>
00169             </a>
00170             </div>
00171             <?php
00172         }
00173     }

static mosHTML::BackButton ( &$  params,
hide_js = NULL 
) [static]

Writes Back Button

Definition at line 178 of file mosHTML.php.

00178                                                            {
00179         // Back Button
00180         if ( $params->get( 'back_button' ) && !$params->get( 'popup' ) && !$hide_js) {
00181             ?>
00182             <div class="back_button">
00183             <a href='javascript:history.go(-1)'>
00184             <?php echo _BACK; ?>
00185             </a>
00186             </div>
00187             <?php
00188         }
00189     }

static mosHTML::cleanText ( &$  text  )  [static]

Cleans text of all formating and scripting code

Definition at line 194 of file mosHTML.php.

00194                                          {
00195         $text = preg_replace( "'<script[^>]*>.*?</script>'si", '', $text );
00196         $text = preg_replace( '/<a\s+.*?href="([^"]+)"[^>]*>([^<]+)<\/a>/is', '\2 (\1)', $text );
00197         $text = preg_replace( '/<!--.+?-->/', '', $text );
00198         $text = preg_replace( '/{.+?}/', '', $text );
00199         $text = preg_replace( '/&nbsp;/', ' ', $text );
00200         $text = preg_replace( '/&amp;/', ' ', $text );
00201         $text = preg_replace( '/&quot;/', ' ', $text );
00202         $text = strip_tags( $text );
00203         $text = htmlspecialchars( $text );
00204         return $text;
00205     }

static mosHTML::PrintIcon ( &$  row,
&$  params,
hide_js,
link,
status = NULL 
) [static]

Writes Print icon

Definition at line 210 of file mosHTML.php.

References $mainframe, align, mosMainFrame::getInstance(), and NULL.

00210                                                                                 {
00211         if ( $params->get( 'print' )  && !$hide_js ) {
00212             // use default settings if none declared
00213             if ( !$status ) {
00214                 $status = 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no';
00215             }
00216 
00217             // checks template image directory for image, if non found default are loaded
00218             if ( $params->get( 'icons' ) ) {
00219                 $mainframe = mosMainFrame::getInstance();
00220                 $image = $mainframe->ImageCheck( 'printButton.png', '/images/M_images/', NULL, NULL, _CMN_PRINT );
00221             } else {
00222                 $image = _ICON_SEP .'&nbsp;'. _CMN_PRINT. '&nbsp;'. _ICON_SEP;
00223             }
00224 
00225             if ( $params->get( 'popup' ) && !$hide_js ) {
00226                 // Print Preview button - used when viewing page
00227                 ?>
00228                 <td align="right" width="100%" class="buttonheading">
00229                 <a href="#" onclick="javascript:window.print(); return false" title="<?php echo _CMN_PRINT;?>">
00230                 <?php echo $image;?>
00231                 </a>
00232                 </td>
00233                 <?php
00234             } else {
00235                 // Print Button - used in pop-up window
00236                 ?>
00237                 <td align="right" width="100%" class="buttonheading">
00238                 <a href="javascript:void window.open('<?php echo $link; ?>', 'win2', '<?php echo $status; ?>');" title="<?php echo _CMN_PRINT;?>">
00239                 <?php echo $image;?>
00240                 </a>
00241                 </td>
00242                 <?php
00243             }
00244         }
00245     }

static mosHTML::emailCloaking ( mail,
mailto = 1,
text = '',
email = 1 
) [static]

simple Javascript Cloaking email cloacking by default replaces an email with a mailto link with email cloacked

Definition at line 252 of file mosHTML.php.

References encoding_converter().

00252                                                                           {
00253         // convert text
00254         $mail       = mosHTML::encoding_converter( $mail );
00255         // split email by @ symbol
00256         $mail       = explode( '@', $mail );
00257         $mail_parts = explode( '.', $mail[1] );
00258         // random number
00259         $rand   = rand( 1, 100000 );
00260 
00261         $replacement    = "\n<script language='JavaScript' type='text/javascript'> \n";
00262         $replacement    .= "<!-- \n";
00263         $replacement    .= "var prefix = '&#109;a' + 'i&#108;' + '&#116;o'; \n";
00264         $replacement    .= "var path = 'hr' + 'ef' + '='; \n";
00265         $replacement    .= "var addy". $rand ." = '". @$mail[0] ."' + '&#64;' + '". implode( "' + '&#46;' + '", $mail_parts ) ."'; \n";
00266         if ( $mailto ) {
00267             // special handling when mail text is different from mail addy
00268             if ( $text ) {
00269                 if ( $email ) {
00270                     // convert text
00271                     $text   = mosHTML::encoding_converter( $text );
00272                     // split email by @ symbol
00273                     $text   = explode( '@', $text );
00274                     $text_parts = explode( '.', $text[1] );
00275                     $replacement    .= "var addy_text". $rand ." = '". @$text[0] ."' + '&#64;' + '". implode( "' + '&#46;' + '", @$text_parts ) ."'; \n";
00276                 } else {
00277                     $text   = mosHTML::encoding_converter( $text );
00278                     $replacement    .= "var addy_text". $rand ." = '". $text ."';\n";
00279                 }
00280                 $replacement    .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n";
00281                 $replacement    .= "document.write( addy_text". $rand ." ); \n";
00282                 $replacement    .= "document.write( '<\/a>' ); \n";
00283             } else {
00284                 $replacement    .= "document.write( '<a ' + path + '\'' + prefix + ':' + addy". $rand ." + '\'>' ); \n";
00285                 $replacement    .= "document.write( addy". $rand ." ); \n";
00286                 $replacement    .= "document.write( '<\/a>' ); \n";
00287             }
00288         } else {
00289             $replacement    .= "document.write( addy". $rand ." ); \n";
00290         }
00291         $replacement    .= "//--> \n";
00292         $replacement    .= "</script> \n";
00293         $replacement    .= "<noscript> \n";
00294         $replacement    .= _CLOAKING;
00295         $replacement    .= "\n</noscript> \n";
00296 
00297         return $replacement;
00298     }

static mosHTML::encoding_converter ( text  )  [static]

Definition at line 300 of file mosHTML.php.

Referenced by emailCloaking().

00300                                                 {
00301         // replace vowels with character encoding
00302         $text   = str_replace( 'a', '&#97;', $text );
00303         $text   = str_replace( 'e', '&#101;', $text );
00304         $text   = str_replace( 'i', '&#105;', $text );
00305         $text   = str_replace( 'o', '&#111;', $text );
00306         $text   = str_replace( 'u', '&#117;', $text );
00307 
00308         return $text;
00309     }

static mosHTML::mosToolTip ( tooltip,
title = '',
width = '',
image = 'tooltip.png',
text = '',
href = '#' 
) [static]

Utility function to provide ToolTips

Parameters:
string ToolTip text
string Box title
Returns:
HTML code for ToolTip

Definition at line 317 of file mosHTML.php.

References aliroHTML::getInstance().

00317                                                                                                                    {
00318         return aliroHTML::getInstance()->toolTip ($tooltip, $title, $width, $image, $text, $href);
00319     }


The documentation for this class was generated from the following file:

Generated on Wed May 14 13:02:02 2008 for ALIRO by  doxygen 1.5.5