| [ Index ] |
|
Code source de Mantis 1.1.0rc3 |
1 <?php 2 3 /** 4 * Projax 5 * 6 * An open source set of php helper classes for prototype and script.aculo.us. 7 * 8 * @package Projax 9 * @author Vikas Patial 10 * @copyright Copyright (c) 2006, ngcoders. 11 * @license http://www.gnu.org/copyleft/gpl.html 12 * @link http://www.ngcoders.com 13 * @since Version 0.2 14 * @filesource 15 */ 16 17 class JavaScript { 18 19 function button_to_function($name,$function=null) 20 { 21 return '<input type="button" value="'.$name.'" onclick="'.$function.'" />'; 22 23 } 24 25 26 function escape($javascript) 27 { 28 $javascript=addslashes($javascript); 29 $javascript=str_replace(array("\r\n","\n","\r"),array("\n"),$javascript); 30 return $javascript; 31 32 } 33 34 35 function tag($content) 36 { 37 return '<script type="text/javascript">'.$content.'</script>'; 38 } 39 40 41 function link_to_function($name,$function,$html_options=null) 42 { 43 return '<a href="'.((isset($html_options['href']))?$html_options['href']:'#').'" onclick="'.((isset($html_options['onclick']))?$html_options['onclick'].';':'').$function.'; return false;" />'.$name.'</a>'; 44 } 45 46 ///////////////////////////////////////////////////////////////////////////////////// 47 // Private functions 48 ///////////////////////////////////////////////////////////////////////////////////// 49 50 function _array_or_string_for_javascript($option) 51 { 52 $return_val=''; 53 if(is_array($option)) 54 { 55 foreach ($option as $value) { 56 if(!empty($return_val))$ret_val.=', '; 57 $return_val.=$value; 58 } 59 return '['.$return_val.']'; 60 } 61 return "'$option'"; 62 } 63 64 65 function _options_for_javascript($options) 66 { 67 $return_val=''; 68 69 if (is_array($options)) { 70 71 foreach ($options as $var=>$val) 72 { 73 if (!empty($return_val)) $return_val.=', '; 74 $return_val.="$var:$val"; 75 } 76 } 77 return '{'.$return_val.'}'; 78 } 79 } 80 81 82 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
| Généré le : Thu Nov 29 09:42:17 2007 | par Balluche grâce à PHPXref 0.7 |
|