Changeset 15
- Timestamp:
- May 21, 2003, 7:46:57 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/infos_images.php
r14 r15 164 164 if ( is_numeric( $_GET['num'] ) and $_GET['num'] >= 0 ) 165 165 { 166 $page['start'] = floor( $_GET['num'] / $page['nb_image_page'] ) * $page['nb_image_page']; 166 $page['start'] = 167 floor( $_GET['num'] / $page['nb_image_page'] ) * $page['nb_image_page']; 167 168 } 168 169 // retrieving category information -
trunk/include/functions.inc.php
r13 r15 102 102 // CSS "white-space: nowrap;" property unless space and minus 103 103 // characters are replaced like this function does. 104 // - Example : 105 // <div class="foo">My friend</div> 106 // ( 01234567891111111111222222222233 ) 107 // ( 0123456789012345678901 ) 108 // becomes : 109 // <div class="foo">My friend</div> 104 110 function replace_space( $string ) 105 111 { 106 //return $string; 107 $return_string = ""; 112 //return $string; 113 $return_string = ''; 114 // $remaining is the rest of the string where to replace spaces characters 108 115 $remaining = $string; 109 116 // $start represents the position of the next '<' character 117 // $end represents the position of the next '>' character 110 118 $start = 0; 111 119 $end = 0; 112 $start = strpos ( $remaining, '<' ); 113 $end = strpos ( $remaining, '>' ); 120 $start = strpos ( $remaining, '<' ); // -> 0 121 $end = strpos ( $remaining, '>' ); // -> 16 122 // as long as a '<' and his friend '>' are found, we loop 114 123 while ( is_numeric( $start ) and is_numeric( $end ) ) 115 124 { 125 // $treatment is the part of the string to treat 126 // In the first loop of our example, this variable is empty, but in the 127 // second loop, it equals 'My friend' 116 128 $treatment = substr ( $remaining, 0, $start ); 129 // Replacement of ' ' by his equivalent ' ' 117 130 $treatment = str_replace( ' ', ' ', $treatment ); 118 131 $treatment = str_replace( '-', '−', $treatment ); 119 $return_string.= $treatment.substr ( $remaining, $start, 120 $end - $start + 1 ); 132 // composing the string to return by adding the treated string and the 133 // following HTML tag -> 'My friend</div>' 134 $return_string.= $treatment.substr( $remaining, $start, $end-$start+1 ); 135 // the remaining string is deplaced to the part after the '>' of this 136 // loop 121 137 $remaining = substr ( $remaining, $end + 1, strlen( $remaining ) ); 122 138 $start = strpos ( $remaining, '<' ); … … 126 142 $treatment = str_replace( '-', '−', $treatment ); 127 143 $return_string.= $treatment; 128 144 129 145 return $return_string; 130 146 }
Note: See TracChangeset
for help on using the changeset viewer.