Index: trunk/extensions/Hanp/Hanp.body.php |
— | — | @@ -0,0 +1,116 @@ |
| 2 | +<?php |
| 3 | +class Hanp { |
| 4 | + |
| 5 | + /** |
| 6 | + * {{#hanp:word|particle}} |
| 7 | + */ |
| 8 | + static function hangulParticle( $parser, $word = '', $particle = '') { |
| 9 | + switch ($particle) { |
| 10 | + |
| 11 | + case '로': # ro |
| 12 | + case '으로': # euro |
| 13 | + if ( self::endsInHangulRieul($word) ) { |
| 14 | + return $word . '로'; |
| 15 | + } elseif ( self::endsInHangulConsonant($word) ) { |
| 16 | + return $word . '으로'; |
| 17 | + } else { |
| 18 | + return $word . '로'; // Vowel or non-hangul |
| 19 | + } |
| 20 | + break; |
| 21 | + |
| 22 | + case '을': # eul |
| 23 | + case '이': # i |
| 24 | + case '와': # wa |
| 25 | + case '은': # eun |
| 26 | + case '를': # reul |
| 27 | + case '가': # ga |
| 28 | + case '과': # gwa |
| 29 | + case '는': # neun |
| 30 | + if ( self::endsInHangulConsonant($word) ) { |
| 31 | + return $word . self::particleMap( $particle, self::SOFT ); |
| 32 | + } else { |
| 33 | + return $word . self::particleMap( $particle, self::HARD ); |
| 34 | + } |
| 35 | + break; |
| 36 | + |
| 37 | + case '의': # yi |
| 38 | + return $word . $particle; |
| 39 | + break; |
| 40 | + |
| 41 | + default: return $word; |
| 42 | + |
| 43 | + } |
| 44 | + } |
| 45 | + |
| 46 | + // Not real terms, but I do not know how to call these |
| 47 | + const SOFT = 1; // without consonant |
| 48 | + const HARD = 2; // with consonant |
| 49 | + /** |
| 50 | + * Returns the correct version of the particle. |
| 51 | + * Use Hanp::SOFT to get version that can be attached to words ending in a |
| 52 | + * consonant and Hanp::HARD for others. |
| 53 | + */ |
| 54 | + static function particleMap( $particle, $dir ) { |
| 55 | + $map = array( |
| 56 | + '을' => '를', # (r)eul |
| 57 | + '이' => '가', # i, ga |
| 58 | + '과' => '와', # gwa, wa |
| 59 | + '은' => '는', # (n)eun |
| 60 | + ); |
| 61 | + |
| 62 | + if ( $dir === self::SOFT ) $map = array_flip( $map ); |
| 63 | + |
| 64 | + if ( isset($map[$particle]) ) { |
| 65 | + return $map[$particle]; |
| 66 | + } else { |
| 67 | + return $particle; # We want only valid input, so it is already correct |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + static function lastLetterToCodePoint( $string ) { |
| 72 | + require_once ( dirname( __FILE__ ) . '/php-utf8/utf8.inc' ); |
| 73 | + $matches = array(); |
| 74 | + if ( !preg_match( '/.$/u', $string, $matches ) ) return false; |
| 75 | + // I hate php |
| 76 | + $returnValue = utf8toUnicode( $matches[0] ); |
| 77 | + return array_pop( $returnValue ); |
| 78 | + } |
| 79 | + |
| 80 | + static function endsInHangul( $string ) { |
| 81 | + $rangeStart = hexdec( 'AC00' ); # GA |
| 82 | + $rangeEnd = hexdec( 'D7A3' ); # HIH |
| 83 | + $lastLetter = self::lastLetterToCodePoint( $string ); |
| 84 | + return $rangeStart < $lastLetter && $lastLetter < $rangeEnd; |
| 85 | + } |
| 86 | + |
| 87 | + static function endsInHangulVowel( $string ) { |
| 88 | + $lastLetter = self::lastLetterToCodePoint( $string ); |
| 89 | + $candidate = hexdec( 'AC00' ); # GA |
| 90 | + $increment = hexdec( '1C' ); |
| 91 | + $lastValue = hexdec( 'D788' ); |
| 92 | + do { |
| 93 | + if ( $lastLetter < $candidate ) return false; // Fast out |
| 94 | + if ( $lastLetter === $candidate ) return true; |
| 95 | + $candidate += $increment; |
| 96 | + } while ( $candidate < $lastValue ); |
| 97 | + return false; |
| 98 | + } |
| 99 | + |
| 100 | + static function endsInHangulRieul( $string ) { |
| 101 | + $lastLetter = self::lastLetterToCodePoint( $string ); |
| 102 | + $candidate = hexdec( 'AC08' ); # GA |
| 103 | + $increment = hexdec( '1C' ); |
| 104 | + $lastValue = hexdec( 'D790' ); |
| 105 | + do { |
| 106 | + if ( $lastLetter < $candidate ) return false; // Fast out |
| 107 | + if ( $lastLetter === $candidate ) return true; |
| 108 | + $candidate += $increment; |
| 109 | + } while ( $candidate < $lastValue ); |
| 110 | + return false; |
| 111 | + } |
| 112 | + |
| 113 | + static function endsInHangulConsonant( $string ) { |
| 114 | + return self::endsInHangul( $string ) && !self::endsInHangulVowel( $string ); |
| 115 | + } |
| 116 | + |
| 117 | +} |
\ No newline at end of file |
Property changes on: trunk/extensions/Hanp/Hanp.body.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 118 | + native |
Index: trunk/extensions/Hanp/Hanp.i18n.php |
— | — | @@ -0,0 +1,13 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 5 | + */ |
| 6 | + |
| 7 | +$messages = array(); |
| 8 | + |
| 9 | +/** English |
| 10 | + * @author Nike |
| 11 | + */ |
| 12 | +$messages['en'] = array( |
| 13 | + 'hanp-desc' => 'Provides <nowiki>{{#hanp:word|particle}}</nowiki> parser function for choosing correct korean particle', |
| 14 | +); |
\ No newline at end of file |
Property changes on: trunk/extensions/Hanp/Hanp.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 15 | + native |
Index: trunk/extensions/Hanp/php-utf8/gpl.txt |
— | — | @@ -0,0 +1,340 @@ |
| 2 | + GNU GENERAL PUBLIC LICENSE |
| 3 | + Version 2, June 1991 |
| 4 | + |
| 5 | + Copyright (C) 1989, 1991 Free Software Foundation, Inc. |
| 6 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 7 | + Everyone is permitted to copy and distribute verbatim copies |
| 8 | + of this license document, but changing it is not allowed. |
| 9 | + |
| 10 | + Preamble |
| 11 | + |
| 12 | + The licenses for most software are designed to take away your |
| 13 | +freedom to share and change it. By contrast, the GNU General Public |
| 14 | +License is intended to guarantee your freedom to share and change free |
| 15 | +software--to make sure the software is free for all its users. This |
| 16 | +General Public License applies to most of the Free Software |
| 17 | +Foundation's software and to any other program whose authors commit to |
| 18 | +using it. (Some other Free Software Foundation software is covered by |
| 19 | +the GNU Library General Public License instead.) You can apply it to |
| 20 | +your programs, too. |
| 21 | + |
| 22 | + When we speak of free software, we are referring to freedom, not |
| 23 | +price. Our General Public Licenses are designed to make sure that you |
| 24 | +have the freedom to distribute copies of free software (and charge for |
| 25 | +this service if you wish), that you receive source code or can get it |
| 26 | +if you want it, that you can change the software or use pieces of it |
| 27 | +in new free programs; and that you know you can do these things. |
| 28 | + |
| 29 | + To protect your rights, we need to make restrictions that forbid |
| 30 | +anyone to deny you these rights or to ask you to surrender the rights. |
| 31 | +These restrictions translate to certain responsibilities for you if you |
| 32 | +distribute copies of the software, or if you modify it. |
| 33 | + |
| 34 | + For example, if you distribute copies of such a program, whether |
| 35 | +gratis or for a fee, you must give the recipients all the rights that |
| 36 | +you have. You must make sure that they, too, receive or can get the |
| 37 | +source code. And you must show them these terms so they know their |
| 38 | +rights. |
| 39 | + |
| 40 | + We protect your rights with two steps: (1) copyright the software, and |
| 41 | +(2) offer you this license which gives you legal permission to copy, |
| 42 | +distribute and/or modify the software. |
| 43 | + |
| 44 | + Also, for each author's protection and ours, we want to make certain |
| 45 | +that everyone understands that there is no warranty for this free |
| 46 | +software. If the software is modified by someone else and passed on, we |
| 47 | +want its recipients to know that what they have is not the original, so |
| 48 | +that any problems introduced by others will not reflect on the original |
| 49 | +authors' reputations. |
| 50 | + |
| 51 | + Finally, any free program is threatened constantly by software |
| 52 | +patents. We wish to avoid the danger that redistributors of a free |
| 53 | +program will individually obtain patent licenses, in effect making the |
| 54 | +program proprietary. To prevent this, we have made it clear that any |
| 55 | +patent must be licensed for everyone's free use or not licensed at all. |
| 56 | + |
| 57 | + The precise terms and conditions for copying, distribution and |
| 58 | +modification follow. |
| 59 | + |
| 60 | + GNU GENERAL PUBLIC LICENSE |
| 61 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 62 | + |
| 63 | + 0. This License applies to any program or other work which contains |
| 64 | +a notice placed by the copyright holder saying it may be distributed |
| 65 | +under the terms of this General Public License. The "Program", below, |
| 66 | +refers to any such program or work, and a "work based on the Program" |
| 67 | +means either the Program or any derivative work under copyright law: |
| 68 | +that is to say, a work containing the Program or a portion of it, |
| 69 | +either verbatim or with modifications and/or translated into another |
| 70 | +language. (Hereinafter, translation is included without limitation in |
| 71 | +the term "modification".) Each licensee is addressed as "you". |
| 72 | + |
| 73 | +Activities other than copying, distribution and modification are not |
| 74 | +covered by this License; they are outside its scope. The act of |
| 75 | +running the Program is not restricted, and the output from the Program |
| 76 | +is covered only if its contents constitute a work based on the |
| 77 | +Program (independent of having been made by running the Program). |
| 78 | +Whether that is true depends on what the Program does. |
| 79 | + |
| 80 | + 1. You may copy and distribute verbatim copies of the Program's |
| 81 | +source code as you receive it, in any medium, provided that you |
| 82 | +conspicuously and appropriately publish on each copy an appropriate |
| 83 | +copyright notice and disclaimer of warranty; keep intact all the |
| 84 | +notices that refer to this License and to the absence of any warranty; |
| 85 | +and give any other recipients of the Program a copy of this License |
| 86 | +along with the Program. |
| 87 | + |
| 88 | +You may charge a fee for the physical act of transferring a copy, and |
| 89 | +you may at your option offer warranty protection in exchange for a fee. |
| 90 | + |
| 91 | + 2. You may modify your copy or copies of the Program or any portion |
| 92 | +of it, thus forming a work based on the Program, and copy and |
| 93 | +distribute such modifications or work under the terms of Section 1 |
| 94 | +above, provided that you also meet all of these conditions: |
| 95 | + |
| 96 | + a) You must cause the modified files to carry prominent notices |
| 97 | + stating that you changed the files and the date of any change. |
| 98 | + |
| 99 | + b) You must cause any work that you distribute or publish, that in |
| 100 | + whole or in part contains or is derived from the Program or any |
| 101 | + part thereof, to be licensed as a whole at no charge to all third |
| 102 | + parties under the terms of this License. |
| 103 | + |
| 104 | + c) If the modified program normally reads commands interactively |
| 105 | + when run, you must cause it, when started running for such |
| 106 | + interactive use in the most ordinary way, to print or display an |
| 107 | + announcement including an appropriate copyright notice and a |
| 108 | + notice that there is no warranty (or else, saying that you provide |
| 109 | + a warranty) and that users may redistribute the program under |
| 110 | + these conditions, and telling the user how to view a copy of this |
| 111 | + License. (Exception: if the Program itself is interactive but |
| 112 | + does not normally print such an announcement, your work based on |
| 113 | + the Program is not required to print an announcement.) |
| 114 | + |
| 115 | +These requirements apply to the modified work as a whole. If |
| 116 | +identifiable sections of that work are not derived from the Program, |
| 117 | +and can be reasonably considered independent and separate works in |
| 118 | +themselves, then this License, and its terms, do not apply to those |
| 119 | +sections when you distribute them as separate works. But when you |
| 120 | +distribute the same sections as part of a whole which is a work based |
| 121 | +on the Program, the distribution of the whole must be on the terms of |
| 122 | +this License, whose permissions for other licensees extend to the |
| 123 | +entire whole, and thus to each and every part regardless of who wrote it. |
| 124 | + |
| 125 | +Thus, it is not the intent of this section to claim rights or contest |
| 126 | +your rights to work written entirely by you; rather, the intent is to |
| 127 | +exercise the right to control the distribution of derivative or |
| 128 | +collective works based on the Program. |
| 129 | + |
| 130 | +In addition, mere aggregation of another work not based on the Program |
| 131 | +with the Program (or with a work based on the Program) on a volume of |
| 132 | +a storage or distribution medium does not bring the other work under |
| 133 | +the scope of this License. |
| 134 | + |
| 135 | + 3. You may copy and distribute the Program (or a work based on it, |
| 136 | +under Section 2) in object code or executable form under the terms of |
| 137 | +Sections 1 and 2 above provided that you also do one of the following: |
| 138 | + |
| 139 | + a) Accompany it with the complete corresponding machine-readable |
| 140 | + source code, which must be distributed under the terms of Sections |
| 141 | + 1 and 2 above on a medium customarily used for software interchange; or, |
| 142 | + |
| 143 | + b) Accompany it with a written offer, valid for at least three |
| 144 | + years, to give any third party, for a charge no more than your |
| 145 | + cost of physically performing source distribution, a complete |
| 146 | + machine-readable copy of the corresponding source code, to be |
| 147 | + distributed under the terms of Sections 1 and 2 above on a medium |
| 148 | + customarily used for software interchange; or, |
| 149 | + |
| 150 | + c) Accompany it with the information you received as to the offer |
| 151 | + to distribute corresponding source code. (This alternative is |
| 152 | + allowed only for noncommercial distribution and only if you |
| 153 | + received the program in object code or executable form with such |
| 154 | + an offer, in accord with Subsection b above.) |
| 155 | + |
| 156 | +The source code for a work means the preferred form of the work for |
| 157 | +making modifications to it. For an executable work, complete source |
| 158 | +code means all the source code for all modules it contains, plus any |
| 159 | +associated interface definition files, plus the scripts used to |
| 160 | +control compilation and installation of the executable. However, as a |
| 161 | +special exception, the source code distributed need not include |
| 162 | +anything that is normally distributed (in either source or binary |
| 163 | +form) with the major components (compiler, kernel, and so on) of the |
| 164 | +operating system on which the executable runs, unless that component |
| 165 | +itself accompanies the executable. |
| 166 | + |
| 167 | +If distribution of executable or object code is made by offering |
| 168 | +access to copy from a designated place, then offering equivalent |
| 169 | +access to copy the source code from the same place counts as |
| 170 | +distribution of the source code, even though third parties are not |
| 171 | +compelled to copy the source along with the object code. |
| 172 | + |
| 173 | + 4. You may not copy, modify, sublicense, or distribute the Program |
| 174 | +except as expressly provided under this License. Any attempt |
| 175 | +otherwise to copy, modify, sublicense or distribute the Program is |
| 176 | +void, and will automatically terminate your rights under this License. |
| 177 | +However, parties who have received copies, or rights, from you under |
| 178 | +this License will not have their licenses terminated so long as such |
| 179 | +parties remain in full compliance. |
| 180 | + |
| 181 | + 5. You are not required to accept this License, since you have not |
| 182 | +signed it. However, nothing else grants you permission to modify or |
| 183 | +distribute the Program or its derivative works. These actions are |
| 184 | +prohibited by law if you do not accept this License. Therefore, by |
| 185 | +modifying or distributing the Program (or any work based on the |
| 186 | +Program), you indicate your acceptance of this License to do so, and |
| 187 | +all its terms and conditions for copying, distributing or modifying |
| 188 | +the Program or works based on it. |
| 189 | + |
| 190 | + 6. Each time you redistribute the Program (or any work based on the |
| 191 | +Program), the recipient automatically receives a license from the |
| 192 | +original licensor to copy, distribute or modify the Program subject to |
| 193 | +these terms and conditions. You may not impose any further |
| 194 | +restrictions on the recipients' exercise of the rights granted herein. |
| 195 | +You are not responsible for enforcing compliance by third parties to |
| 196 | +this License. |
| 197 | + |
| 198 | + 7. If, as a consequence of a court judgment or allegation of patent |
| 199 | +infringement or for any other reason (not limited to patent issues), |
| 200 | +conditions are imposed on you (whether by court order, agreement or |
| 201 | +otherwise) that contradict the conditions of this License, they do not |
| 202 | +excuse you from the conditions of this License. If you cannot |
| 203 | +distribute so as to satisfy simultaneously your obligations under this |
| 204 | +License and any other pertinent obligations, then as a consequence you |
| 205 | +may not distribute the Program at all. For example, if a patent |
| 206 | +license would not permit royalty-free redistribution of the Program by |
| 207 | +all those who receive copies directly or indirectly through you, then |
| 208 | +the only way you could satisfy both it and this License would be to |
| 209 | +refrain entirely from distribution of the Program. |
| 210 | + |
| 211 | +If any portion of this section is held invalid or unenforceable under |
| 212 | +any particular circumstance, the balance of the section is intended to |
| 213 | +apply and the section as a whole is intended to apply in other |
| 214 | +circumstances. |
| 215 | + |
| 216 | +It is not the purpose of this section to induce you to infringe any |
| 217 | +patents or other property right claims or to contest validity of any |
| 218 | +such claims; this section has the sole purpose of protecting the |
| 219 | +integrity of the free software distribution system, which is |
| 220 | +implemented by public license practices. Many people have made |
| 221 | +generous contributions to the wide range of software distributed |
| 222 | +through that system in reliance on consistent application of that |
| 223 | +system; it is up to the author/donor to decide if he or she is willing |
| 224 | +to distribute software through any other system and a licensee cannot |
| 225 | +impose that choice. |
| 226 | + |
| 227 | +This section is intended to make thoroughly clear what is believed to |
| 228 | +be a consequence of the rest of this License. |
| 229 | + |
| 230 | + 8. If the distribution and/or use of the Program is restricted in |
| 231 | +certain countries either by patents or by copyrighted interfaces, the |
| 232 | +original copyright holder who places the Program under this License |
| 233 | +may add an explicit geographical distribution limitation excluding |
| 234 | +those countries, so that distribution is permitted only in or among |
| 235 | +countries not thus excluded. In such case, this License incorporates |
| 236 | +the limitation as if written in the body of this License. |
| 237 | + |
| 238 | + 9. The Free Software Foundation may publish revised and/or new versions |
| 239 | +of the General Public License from time to time. Such new versions will |
| 240 | +be similar in spirit to the present version, but may differ in detail to |
| 241 | +address new problems or concerns. |
| 242 | + |
| 243 | +Each version is given a distinguishing version number. If the Program |
| 244 | +specifies a version number of this License which applies to it and "any |
| 245 | +later version", you have the option of following the terms and conditions |
| 246 | +either of that version or of any later version published by the Free |
| 247 | +Software Foundation. If the Program does not specify a version number of |
| 248 | +this License, you may choose any version ever published by the Free Software |
| 249 | +Foundation. |
| 250 | + |
| 251 | + 10. If you wish to incorporate parts of the Program into other free |
| 252 | +programs whose distribution conditions are different, write to the author |
| 253 | +to ask for permission. For software which is copyrighted by the Free |
| 254 | +Software Foundation, write to the Free Software Foundation; we sometimes |
| 255 | +make exceptions for this. Our decision will be guided by the two goals |
| 256 | +of preserving the free status of all derivatives of our free software and |
| 257 | +of promoting the sharing and reuse of software generally. |
| 258 | + |
| 259 | + NO WARRANTY |
| 260 | + |
| 261 | + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY |
| 262 | +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN |
| 263 | +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES |
| 264 | +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED |
| 265 | +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| 266 | +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS |
| 267 | +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE |
| 268 | +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, |
| 269 | +REPAIR OR CORRECTION. |
| 270 | + |
| 271 | + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING |
| 272 | +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR |
| 273 | +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, |
| 274 | +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING |
| 275 | +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED |
| 276 | +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY |
| 277 | +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER |
| 278 | +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE |
| 279 | +POSSIBILITY OF SUCH DAMAGES. |
| 280 | + |
| 281 | + END OF TERMS AND CONDITIONS |
| 282 | + |
| 283 | + How to Apply These Terms to Your New Programs |
| 284 | + |
| 285 | + If you develop a new program, and you want it to be of the greatest |
| 286 | +possible use to the public, the best way to achieve this is to make it |
| 287 | +free software which everyone can redistribute and change under these terms. |
| 288 | + |
| 289 | + To do so, attach the following notices to the program. It is safest |
| 290 | +to attach them to the start of each source file to most effectively |
| 291 | +convey the exclusion of warranty; and each file should have at least |
| 292 | +the "copyright" line and a pointer to where the full notice is found. |
| 293 | + |
| 294 | + <one line to give the program's name and a brief idea of what it does.> |
| 295 | + Copyright (C) <year> <name of author> |
| 296 | + |
| 297 | + This program is free software; you can redistribute it and/or modify |
| 298 | + it under the terms of the GNU General Public License as published by |
| 299 | + the Free Software Foundation; either version 2 of the License, or |
| 300 | + (at your option) any later version. |
| 301 | + |
| 302 | + This program is distributed in the hope that it will be useful, |
| 303 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 304 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 305 | + GNU General Public License for more details. |
| 306 | + |
| 307 | + You should have received a copy of the GNU General Public License |
| 308 | + along with this program; if not, write to the Free Software |
| 309 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 310 | + |
| 311 | + |
| 312 | +Also add information on how to contact you by electronic and paper mail. |
| 313 | + |
| 314 | +If the program is interactive, make it output a short notice like this |
| 315 | +when it starts in an interactive mode: |
| 316 | + |
| 317 | + Gnomovision version 69, Copyright (C) year name of author |
| 318 | + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. |
| 319 | + This is free software, and you are welcome to redistribute it |
| 320 | + under certain conditions; type `show c' for details. |
| 321 | + |
| 322 | +The hypothetical commands `show w' and `show c' should show the appropriate |
| 323 | +parts of the General Public License. Of course, the commands you use may |
| 324 | +be called something other than `show w' and `show c'; they could even be |
| 325 | +mouse-clicks or menu items--whatever suits your program. |
| 326 | + |
| 327 | +You should also get your employer (if you work as a programmer) or your |
| 328 | +school, if any, to sign a "copyright disclaimer" for the program, if |
| 329 | +necessary. Here is a sample; alter the names: |
| 330 | + |
| 331 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the program |
| 332 | + `Gnomovision' (which makes passes at compilers) written by James Hacker. |
| 333 | + |
| 334 | + <signature of Ty Coon>, 1 April 1989 |
| 335 | + Ty Coon, President of Vice |
| 336 | + |
| 337 | +This General Public License does not permit incorporating your program into |
| 338 | +proprietary programs. If your program is a subroutine library, you may |
| 339 | +consider it more useful to permit linking proprietary applications with the |
| 340 | +library. If this is what you want to do, use the GNU Library General |
| 341 | +Public License instead of this License. |
Property changes on: trunk/extensions/Hanp/php-utf8/gpl.txt |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 342 | + native |
Index: trunk/extensions/Hanp/php-utf8/NPL-1.1.txt |
— | — | @@ -0,0 +1,569 @@ |
| 2 | + |
| 3 | + AMENDMENTS |
| 4 | + |
| 5 | + The Netscape Public License Version 1.1 ("NPL") consists of the |
| 6 | + Mozilla Public License Version 1.1 with the following Amendments, |
| 7 | + including Exhibit A-Netscape Public License. Files identified with |
| 8 | + "Exhibit A-Netscape Public License" are governed by the Netscape |
| 9 | + Public License Version 1.1. |
| 10 | + |
| 11 | + Additional Terms applicable to the Netscape Public License. |
| 12 | + I. Effect. |
| 13 | + These additional terms described in this Netscape Public |
| 14 | + License -- Amendments shall apply to the Mozilla Communicator |
| 15 | + client code and to all Covered Code under this License. |
| 16 | + |
| 17 | + II. "Netscape's Branded Code" means Covered Code that Netscape |
| 18 | + distributes and/or permits others to distribute under one or more |
| 19 | + trademark(s) which are controlled by Netscape but which are not |
| 20 | + licensed for use under this License. |
| 21 | + |
| 22 | + III. Netscape and logo. |
| 23 | + This License does not grant any rights to use the trademarks |
| 24 | + "Netscape", the "Netscape N and horizon" logo or the "Netscape |
| 25 | + lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", |
| 26 | + "Smart Browsing" even if such marks are included in the Original |
| 27 | + Code or Modifications. |
| 28 | + |
| 29 | + IV. Inability to Comply Due to Contractual Obligation. |
| 30 | + Prior to licensing the Original Code under this License, Netscape |
| 31 | + has licensed third party code for use in Netscape's Branded Code. |
| 32 | + To the extent that Netscape is limited contractually from making |
| 33 | + such third party code available under this License, Netscape may |
| 34 | + choose to reintegrate such code into Covered Code without being |
| 35 | + required to distribute such code in Source Code form, even if |
| 36 | + such code would otherwise be considered "Modifications" under |
| 37 | + this License. |
| 38 | + |
| 39 | + V. Use of Modifications and Covered Code by Initial Developer. |
| 40 | + V.1. In General. |
| 41 | + The obligations of Section 3 apply to Netscape, except to |
| 42 | + the extent specified in this Amendment, Section V.2 and V.3. |
| 43 | + |
| 44 | + V.2. Other Products. |
| 45 | + Netscape may include Covered Code in products other than the |
| 46 | + Netscape's Branded Code which are released by Netscape |
| 47 | + during the two (2) years following the release date of the |
| 48 | + Original Code, without such additional products becoming |
| 49 | + subject to the terms of this License, and may license such |
| 50 | + additional products on different terms from those contained |
| 51 | + in this License. |
| 52 | + |
| 53 | + V.3. Alternative Licensing. |
| 54 | + Netscape may license the Source Code of Netscape's Branded |
| 55 | + Code, including Modifications incorporated therein, without |
| 56 | + such Netscape Branded Code becoming subject to the terms of |
| 57 | + this License, and may license such Netscape Branded Code on |
| 58 | + different terms from those contained in this License. |
| 59 | + |
| 60 | + VI. Litigation. |
| 61 | + Notwithstanding the limitations of Section 11 above, the |
| 62 | + provisions regarding litigation in Section 11(a), (b) and (c) of |
| 63 | + the License shall apply to all disputes relating to this License. |
| 64 | + |
| 65 | + EXHIBIT A-Netscape Public License. |
| 66 | + |
| 67 | + "The contents of this file are subject to the Netscape Public |
| 68 | + License Version 1.1 (the "License"); you may not use this file |
| 69 | + except in compliance with the License. You may obtain a copy of |
| 70 | + the License at http://www.mozilla.org/NPL/ |
| 71 | + |
| 72 | + Software distributed under the License is distributed on an "AS |
| 73 | + IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or |
| 74 | + implied. See the License for the specific language governing |
| 75 | + rights and limitations under the License. |
| 76 | + |
| 77 | + The Original Code is Mozilla Communicator client code, released |
| 78 | + March 31, 1998. |
| 79 | + |
| 80 | + The Initial Developer of the Original Code is Netscape |
| 81 | + Communications Corporation. Portions created by Netscape are |
| 82 | + Copyright (C) 1998-1999 Netscape Communications Corporation. All |
| 83 | + Rights Reserved. |
| 84 | + |
| 85 | + Contributor(s): ______________________________________. |
| 86 | + |
| 87 | + Alternatively, the contents of this file may be used under the |
| 88 | + terms of the _____ license (the "[___] License"), in which case |
| 89 | + the provisions of [______] License are applicable instead of |
| 90 | + those above. If you wish to allow use of your version of this |
| 91 | + file only under the terms of the [____] License and not to allow |
| 92 | + others to use your version of this file under the NPL, indicate |
| 93 | + your decision by deleting the provisions above and replace them |
| 94 | + with the notice and other provisions required by the [___] |
| 95 | + License. If you do not delete the provisions above, a recipient |
| 96 | + may use your version of this file under either the NPL or the |
| 97 | + [___] License." |
| 98 | + |
| 99 | + ---------------------------------------------------------------------- |
| 100 | + |
| 101 | + MOZILLA PUBLIC LICENSE |
| 102 | + Version 1.1 |
| 103 | + |
| 104 | + --------------- |
| 105 | + |
| 106 | +1. Definitions. |
| 107 | + |
| 108 | + 1.0.1. "Commercial Use" means distribution or otherwise making the |
| 109 | + Covered Code available to a third party. |
| 110 | + |
| 111 | + 1.1. "Contributor" means each entity that creates or contributes to |
| 112 | + the creation of Modifications. |
| 113 | + |
| 114 | + 1.2. "Contributor Version" means the combination of the Original |
| 115 | + Code, prior Modifications used by a Contributor, and the Modifications |
| 116 | + made by that particular Contributor. |
| 117 | + |
| 118 | + 1.3. "Covered Code" means the Original Code or Modifications or the |
| 119 | + combination of the Original Code and Modifications, in each case |
| 120 | + including portions thereof. |
| 121 | + |
| 122 | + 1.4. "Electronic Distribution Mechanism" means a mechanism generally |
| 123 | + accepted in the software development community for the electronic |
| 124 | + transfer of data. |
| 125 | + |
| 126 | + 1.5. "Executable" means Covered Code in any form other than Source |
| 127 | + Code. |
| 128 | + |
| 129 | + 1.6. "Initial Developer" means the individual or entity identified |
| 130 | + as the Initial Developer in the Source Code notice required by Exhibit |
| 131 | + A. |
| 132 | + |
| 133 | + 1.7. "Larger Work" means a work which combines Covered Code or |
| 134 | + portions thereof with code not governed by the terms of this License. |
| 135 | + |
| 136 | + 1.8. "License" means this document. |
| 137 | + |
| 138 | + 1.8.1. "Licensable" means having the right to grant, to the maximum |
| 139 | + extent possible, whether at the time of the initial grant or |
| 140 | + subsequently acquired, any and all of the rights conveyed herein. |
| 141 | + |
| 142 | + 1.9. "Modifications" means any addition to or deletion from the |
| 143 | + substance or structure of either the Original Code or any previous |
| 144 | + Modifications. When Covered Code is released as a series of files, a |
| 145 | + Modification is: |
| 146 | + A. Any addition to or deletion from the contents of a file |
| 147 | + containing Original Code or previous Modifications. |
| 148 | + |
| 149 | + B. Any new file that contains any part of the Original Code or |
| 150 | + previous Modifications. |
| 151 | + |
| 152 | + 1.10. "Original Code" means Source Code of computer software code |
| 153 | + which is described in the Source Code notice required by Exhibit A as |
| 154 | + Original Code, and which, at the time of its release under this |
| 155 | + License is not already Covered Code governed by this License. |
| 156 | + |
| 157 | + 1.10.1. "Patent Claims" means any patent claim(s), now owned or |
| 158 | + hereafter acquired, including without limitation, method, process, |
| 159 | + and apparatus claims, in any patent Licensable by grantor. |
| 160 | + |
| 161 | + 1.11. "Source Code" means the preferred form of the Covered Code for |
| 162 | + making modifications to it, including all modules it contains, plus |
| 163 | + any associated interface definition files, scripts used to control |
| 164 | + compilation and installation of an Executable, or source code |
| 165 | + differential comparisons against either the Original Code or another |
| 166 | + well known, available Covered Code of the Contributor's choice. The |
| 167 | + Source Code can be in a compressed or archival form, provided the |
| 168 | + appropriate decompression or de-archiving software is widely available |
| 169 | + for no charge. |
| 170 | + |
| 171 | + 1.12. "You" (or "Your") means an individual or a legal entity |
| 172 | + exercising rights under, and complying with all of the terms of, this |
| 173 | + License or a future version of this License issued under Section 6.1. |
| 174 | + For legal entities, "You" includes any entity which controls, is |
| 175 | + controlled by, or is under common control with You. For purposes of |
| 176 | + this definition, "control" means (a) the power, direct or indirect, |
| 177 | + to cause the direction or management of such entity, whether by |
| 178 | + contract or otherwise, or (b) ownership of more than fifty percent |
| 179 | + (50%) of the outstanding shares or beneficial ownership of such |
| 180 | + entity. |
| 181 | + |
| 182 | +2. Source Code License. |
| 183 | + |
| 184 | + 2.1. The Initial Developer Grant. |
| 185 | + The Initial Developer hereby grants You a world-wide, royalty-free, |
| 186 | + non-exclusive license, subject to third party intellectual property |
| 187 | + claims: |
| 188 | + (a) under intellectual property rights (other than patent or |
| 189 | + trademark) Licensable by Initial Developer to use, reproduce, |
| 190 | + modify, display, perform, sublicense and distribute the Original |
| 191 | + Code (or portions thereof) with or without Modifications, and/or |
| 192 | + as part of a Larger Work; and |
| 193 | + |
| 194 | + (b) under Patents Claims infringed by the making, using or |
| 195 | + selling of Original Code, to make, have made, use, practice, |
| 196 | + sell, and offer for sale, and/or otherwise dispose of the |
| 197 | + Original Code (or portions thereof). |
| 198 | + |
| 199 | + (c) the licenses granted in this Section 2.1(a) and (b) are |
| 200 | + effective on the date Initial Developer first distributes |
| 201 | + Original Code under the terms of this License. |
| 202 | + |
| 203 | + (d) Notwithstanding Section 2.1(b) above, no patent license is |
| 204 | + granted: 1) for code that You delete from the Original Code; 2) |
| 205 | + separate from the Original Code; or 3) for infringements caused |
| 206 | + by: i) the modification of the Original Code or ii) the |
| 207 | + combination of the Original Code with other software or devices. |
| 208 | + |
| 209 | + 2.2. Contributor Grant. |
| 210 | + Subject to third party intellectual property claims, each Contributor |
| 211 | + hereby grants You a world-wide, royalty-free, non-exclusive license |
| 212 | + |
| 213 | + (a) under intellectual property rights (other than patent or |
| 214 | + trademark) Licensable by Contributor, to use, reproduce, modify, |
| 215 | + display, perform, sublicense and distribute the Modifications |
| 216 | + created by such Contributor (or portions thereof) either on an |
| 217 | + unmodified basis, with other Modifications, as Covered Code |
| 218 | + and/or as part of a Larger Work; and |
| 219 | + |
| 220 | + (b) under Patent Claims infringed by the making, using, or |
| 221 | + selling of Modifications made by that Contributor either alone |
| 222 | + and/or in combination with its Contributor Version (or portions |
| 223 | + of such combination), to make, use, sell, offer for sale, have |
| 224 | + made, and/or otherwise dispose of: 1) Modifications made by that |
| 225 | + Contributor (or portions thereof); and 2) the combination of |
| 226 | + Modifications made by that Contributor with its Contributor |
| 227 | + Version (or portions of such combination). |
| 228 | + |
| 229 | + (c) the licenses granted in Sections 2.2(a) and 2.2(b) are |
| 230 | + effective on the date Contributor first makes Commercial Use of |
| 231 | + the Covered Code. |
| 232 | + |
| 233 | + (d) Notwithstanding Section 2.2(b) above, no patent license is |
| 234 | + granted: 1) for any code that Contributor has deleted from the |
| 235 | + Contributor Version; 2) separate from the Contributor Version; |
| 236 | + 3) for infringements caused by: i) third party modifications of |
| 237 | + Contributor Version or ii) the combination of Modifications made |
| 238 | + by that Contributor with other software (except as part of the |
| 239 | + Contributor Version) or other devices; or 4) under Patent Claims |
| 240 | + infringed by Covered Code in the absence of Modifications made by |
| 241 | + that Contributor. |
| 242 | + |
| 243 | +3. Distribution Obligations. |
| 244 | + |
| 245 | + 3.1. Application of License. |
| 246 | + The Modifications which You create or to which You contribute are |
| 247 | + governed by the terms of this License, including without limitation |
| 248 | + Section 2.2. The Source Code version of Covered Code may be |
| 249 | + distributed only under the terms of this License or a future version |
| 250 | + of this License released under Section 6.1, and You must include a |
| 251 | + copy of this License with every copy of the Source Code You |
| 252 | + distribute. You may not offer or impose any terms on any Source Code |
| 253 | + version that alters or restricts the applicable version of this |
| 254 | + License or the recipients' rights hereunder. However, You may include |
| 255 | + an additional document offering the additional rights described in |
| 256 | + Section 3.5. |
| 257 | + |
| 258 | + 3.2. Availability of Source Code. |
| 259 | + Any Modification which You create or to which You contribute must be |
| 260 | + made available in Source Code form under the terms of this License |
| 261 | + either on the same media as an Executable version or via an accepted |
| 262 | + Electronic Distribution Mechanism to anyone to whom you made an |
| 263 | + Executable version available; and if made available via Electronic |
| 264 | + Distribution Mechanism, must remain available for at least twelve (12) |
| 265 | + months after the date it initially became available, or at least six |
| 266 | + (6) months after a subsequent version of that particular Modification |
| 267 | + has been made available to such recipients. You are responsible for |
| 268 | + ensuring that the Source Code version remains available even if the |
| 269 | + Electronic Distribution Mechanism is maintained by a third party. |
| 270 | + |
| 271 | + 3.3. Description of Modifications. |
| 272 | + You must cause all Covered Code to which You contribute to contain a |
| 273 | + file documenting the changes You made to create that Covered Code and |
| 274 | + the date of any change. You must include a prominent statement that |
| 275 | + the Modification is derived, directly or indirectly, from Original |
| 276 | + Code provided by the Initial Developer and including the name of the |
| 277 | + Initial Developer in (a) the Source Code, and (b) in any notice in an |
| 278 | + Executable version or related documentation in which You describe the |
| 279 | + origin or ownership of the Covered Code. |
| 280 | + |
| 281 | + 3.4. Intellectual Property Matters |
| 282 | + (a) Third Party Claims. |
| 283 | + If Contributor has knowledge that a license under a third party's |
| 284 | + intellectual property rights is required to exercise the rights |
| 285 | + granted by such Contributor under Sections 2.1 or 2.2, |
| 286 | + Contributor must include a text file with the Source Code |
| 287 | + distribution titled "LEGAL" which describes the claim and the |
| 288 | + party making the claim in sufficient detail that a recipient will |
| 289 | + know whom to contact. If Contributor obtains such knowledge after |
| 290 | + the Modification is made available as described in Section 3.2, |
| 291 | + Contributor shall promptly modify the LEGAL file in all copies |
| 292 | + Contributor makes available thereafter and shall take other steps |
| 293 | + (such as notifying appropriate mailing lists or newsgroups) |
| 294 | + reasonably calculated to inform those who received the Covered |
| 295 | + Code that new knowledge has been obtained. |
| 296 | + |
| 297 | + (b) Contributor APIs. |
| 298 | + If Contributor's Modifications include an application programming |
| 299 | + interface and Contributor has knowledge of patent licenses which |
| 300 | + are reasonably necessary to implement that API, Contributor must |
| 301 | + also include this information in the LEGAL file. |
| 302 | + |
| 303 | + (c) Representations. |
| 304 | + Contributor represents that, except as disclosed pursuant to |
| 305 | + Section 3.4(a) above, Contributor believes that Contributor's |
| 306 | + Modifications are Contributor's original creation(s) and/or |
| 307 | + Contributor has sufficient rights to grant the rights conveyed by |
| 308 | + this License. |
| 309 | + |
| 310 | + 3.5. Required Notices. |
| 311 | + You must duplicate the notice in Exhibit A in each file of the Source |
| 312 | + Code. If it is not possible to put such notice in a particular Source |
| 313 | + Code file due to its structure, then You must include such notice in a |
| 314 | + location (such as a relevant directory) where a user would be likely |
| 315 | + to look for such a notice. If You created one or more Modification(s) |
| 316 | + You may add your name as a Contributor to the notice described in |
| 317 | + Exhibit A. You must also duplicate this License in any documentation |
| 318 | + for the Source Code where You describe recipients' rights or ownership |
| 319 | + rights relating to Covered Code. You may choose to offer, and to |
| 320 | + charge a fee for, warranty, support, indemnity or liability |
| 321 | + obligations to one or more recipients of Covered Code. However, You |
| 322 | + may do so only on Your own behalf, and not on behalf of the Initial |
| 323 | + Developer or any Contributor. You must make it absolutely clear than |
| 324 | + any such warranty, support, indemnity or liability obligation is |
| 325 | + offered by You alone, and You hereby agree to indemnify the Initial |
| 326 | + Developer and every Contributor for any liability incurred by the |
| 327 | + Initial Developer or such Contributor as a result of warranty, |
| 328 | + support, indemnity or liability terms You offer. |
| 329 | + |
| 330 | + 3.6. Distribution of Executable Versions. |
| 331 | + You may distribute Covered Code in Executable form only if the |
| 332 | + requirements of Section 3.1-3.5 have been met for that Covered Code, |
| 333 | + and if You include a notice stating that the Source Code version of |
| 334 | + the Covered Code is available under the terms of this License, |
| 335 | + including a description of how and where You have fulfilled the |
| 336 | + obligations of Section 3.2. The notice must be conspicuously included |
| 337 | + in any notice in an Executable version, related documentation or |
| 338 | + collateral in which You describe recipients' rights relating to the |
| 339 | + Covered Code. You may distribute the Executable version of Covered |
| 340 | + Code or ownership rights under a license of Your choice, which may |
| 341 | + contain terms different from this License, provided that You are in |
| 342 | + compliance with the terms of this License and that the license for the |
| 343 | + Executable version does not attempt to limit or alter the recipient's |
| 344 | + rights in the Source Code version from the rights set forth in this |
| 345 | + License. If You distribute the Executable version under a different |
| 346 | + license You must make it absolutely clear that any terms which differ |
| 347 | + from this License are offered by You alone, not by the Initial |
| 348 | + Developer or any Contributor. You hereby agree to indemnify the |
| 349 | + Initial Developer and every Contributor for any liability incurred by |
| 350 | + the Initial Developer or such Contributor as a result of any such |
| 351 | + terms You offer. |
| 352 | + |
| 353 | + 3.7. Larger Works. |
| 354 | + You may create a Larger Work by combining Covered Code with other code |
| 355 | + not governed by the terms of this License and distribute the Larger |
| 356 | + Work as a single product. In such a case, You must make sure the |
| 357 | + requirements of this License are fulfilled for the Covered Code. |
| 358 | + |
| 359 | +4. Inability to Comply Due to Statute or Regulation. |
| 360 | + |
| 361 | + If it is impossible for You to comply with any of the terms of this |
| 362 | + License with respect to some or all of the Covered Code due to |
| 363 | + statute, judicial order, or regulation then You must: (a) comply with |
| 364 | + the terms of this License to the maximum extent possible; and (b) |
| 365 | + describe the limitations and the code they affect. Such description |
| 366 | + must be included in the LEGAL file described in Section 3.4 and must |
| 367 | + be included with all distributions of the Source Code. Except to the |
| 368 | + extent prohibited by statute or regulation, such description must be |
| 369 | + sufficiently detailed for a recipient of ordinary skill to be able to |
| 370 | + understand it. |
| 371 | + |
| 372 | +5. Application of this License. |
| 373 | + |
| 374 | + This License applies to code to which the Initial Developer has |
| 375 | + attached the notice in Exhibit A and to related Covered Code. |
| 376 | + |
| 377 | +6. Versions of the License. |
| 378 | + |
| 379 | + 6.1. New Versions. |
| 380 | + Netscape Communications Corporation ("Netscape") may publish revised |
| 381 | + and/or new versions of the License from time to time. Each version |
| 382 | + will be given a distinguishing version number. |
| 383 | + |
| 384 | + 6.2. Effect of New Versions. |
| 385 | + Once Covered Code has been published under a particular version of the |
| 386 | + License, You may always continue to use it under the terms of that |
| 387 | + version. You may also choose to use such Covered Code under the terms |
| 388 | + of any subsequent version of the License published by Netscape. No one |
| 389 | + other than Netscape has the right to modify the terms applicable to |
| 390 | + Covered Code created under this License. |
| 391 | + |
| 392 | + 6.3. Derivative Works. |
| 393 | + If You create or use a modified version of this License (which you may |
| 394 | + only do in order to apply it to code which is not already Covered Code |
| 395 | + governed by this License), You must (a) rename Your license so that |
| 396 | + the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", |
| 397 | + "MPL", "NPL" or any confusingly similar phrase do not appear in your |
| 398 | + license (except to note that your license differs from this License) |
| 399 | + and (b) otherwise make it clear that Your version of the license |
| 400 | + contains terms which differ from the Mozilla Public License and |
| 401 | + Netscape Public License. (Filling in the name of the Initial |
| 402 | + Developer, Original Code or Contributor in the notice described in |
| 403 | + Exhibit A shall not of themselves be deemed to be modifications of |
| 404 | + this License.) |
| 405 | + |
| 406 | +7. DISCLAIMER OF WARRANTY. |
| 407 | + |
| 408 | + COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, |
| 409 | + WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, |
| 410 | + WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF |
| 411 | + DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. |
| 412 | + THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE |
| 413 | + IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, |
| 414 | + YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE |
| 415 | + COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER |
| 416 | + OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF |
| 417 | + ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. |
| 418 | + |
| 419 | +8. TERMINATION. |
| 420 | + |
| 421 | + 8.1. This License and the rights granted hereunder will terminate |
| 422 | + automatically if You fail to comply with terms herein and fail to cure |
| 423 | + such breach within 30 days of becoming aware of the breach. All |
| 424 | + sublicenses to the Covered Code which are properly granted shall |
| 425 | + survive any termination of this License. Provisions which, by their |
| 426 | + nature, must remain in effect beyond the termination of this License |
| 427 | + shall survive. |
| 428 | + |
| 429 | + 8.2. If You initiate litigation by asserting a patent infringement |
| 430 | + claim (excluding declatory judgment actions) against Initial Developer |
| 431 | + or a Contributor (the Initial Developer or Contributor against whom |
| 432 | + You file such action is referred to as "Participant") alleging that: |
| 433 | + |
| 434 | + (a) such Participant's Contributor Version directly or indirectly |
| 435 | + infringes any patent, then any and all rights granted by such |
| 436 | + Participant to You under Sections 2.1 and/or 2.2 of this License |
| 437 | + shall, upon 60 days notice from Participant terminate prospectively, |
| 438 | + unless if within 60 days after receipt of notice You either: (i) |
| 439 | + agree in writing to pay Participant a mutually agreeable reasonable |
| 440 | + royalty for Your past and future use of Modifications made by such |
| 441 | + Participant, or (ii) withdraw Your litigation claim with respect to |
| 442 | + the Contributor Version against such Participant. If within 60 days |
| 443 | + of notice, a reasonable royalty and payment arrangement are not |
| 444 | + mutually agreed upon in writing by the parties or the litigation claim |
| 445 | + is not withdrawn, the rights granted by Participant to You under |
| 446 | + Sections 2.1 and/or 2.2 automatically terminate at the expiration of |
| 447 | + the 60 day notice period specified above. |
| 448 | + |
| 449 | + (b) any software, hardware, or device, other than such Participant's |
| 450 | + Contributor Version, directly or indirectly infringes any patent, then |
| 451 | + any rights granted to You by such Participant under Sections 2.1(b) |
| 452 | + and 2.2(b) are revoked effective as of the date You first made, used, |
| 453 | + sold, distributed, or had made, Modifications made by that |
| 454 | + Participant. |
| 455 | + |
| 456 | + 8.3. If You assert a patent infringement claim against Participant |
| 457 | + alleging that such Participant's Contributor Version directly or |
| 458 | + indirectly infringes any patent where such claim is resolved (such as |
| 459 | + by license or settlement) prior to the initiation of patent |
| 460 | + infringement litigation, then the reasonable value of the licenses |
| 461 | + granted by such Participant under Sections 2.1 or 2.2 shall be taken |
| 462 | + into account in determining the amount or value of any payment or |
| 463 | + license. |
| 464 | + |
| 465 | + 8.4. In the event of termination under Sections 8.1 or 8.2 above, |
| 466 | + all end user license agreements (excluding distributors and resellers) |
| 467 | + which have been validly granted by You or any distributor hereunder |
| 468 | + prior to termination shall survive termination. |
| 469 | + |
| 470 | +9. LIMITATION OF LIABILITY. |
| 471 | + |
| 472 | + UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT |
| 473 | + (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL |
| 474 | + DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, |
| 475 | + OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR |
| 476 | + ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY |
| 477 | + CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, |
| 478 | + WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER |
| 479 | + COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN |
| 480 | + INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF |
| 481 | + LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY |
| 482 | + RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW |
| 483 | + PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE |
| 484 | + EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO |
| 485 | + THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. |
| 486 | + |
| 487 | +10. U.S. GOVERNMENT END USERS. |
| 488 | + |
| 489 | + The Covered Code is a "commercial item," as that term is defined in |
| 490 | + 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer |
| 491 | + software" and "commercial computer software documentation," as such |
| 492 | + terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 |
| 493 | + C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), |
| 494 | + all U.S. Government End Users acquire Covered Code with only those |
| 495 | + rights set forth herein. |
| 496 | + |
| 497 | +11. MISCELLANEOUS. |
| 498 | + |
| 499 | + This License represents the complete agreement concerning subject |
| 500 | + matter hereof. If any provision of this License is held to be |
| 501 | + unenforceable, such provision shall be reformed only to the extent |
| 502 | + necessary to make it enforceable. This License shall be governed by |
| 503 | + California law provisions (except to the extent applicable law, if |
| 504 | + any, provides otherwise), excluding its conflict-of-law provisions. |
| 505 | + With respect to disputes in which at least one party is a citizen of, |
| 506 | + or an entity chartered or registered to do business in the United |
| 507 | + States of America, any litigation relating to this License shall be |
| 508 | + subject to the jurisdiction of the Federal Courts of the Northern |
| 509 | + District of California, with venue lying in Santa Clara County, |
| 510 | + California, with the losing party responsible for costs, including |
| 511 | + without limitation, court costs and reasonable attorneys' fees and |
| 512 | + expenses. The application of the United Nations Convention on |
| 513 | + Contracts for the International Sale of Goods is expressly excluded. |
| 514 | + Any law or regulation which provides that the language of a contract |
| 515 | + shall be construed against the drafter shall not apply to this |
| 516 | + License. |
| 517 | + |
| 518 | +12. RESPONSIBILITY FOR CLAIMS. |
| 519 | + |
| 520 | + As between Initial Developer and the Contributors, each party is |
| 521 | + responsible for claims and damages arising, directly or indirectly, |
| 522 | + out of its utilization of rights under this License and You agree to |
| 523 | + work with Initial Developer and Contributors to distribute such |
| 524 | + responsibility on an equitable basis. Nothing herein is intended or |
| 525 | + shall be deemed to constitute any admission of liability. |
| 526 | + |
| 527 | +13. MULTIPLE-LICENSED CODE. |
| 528 | + |
| 529 | + Initial Developer may designate portions of the Covered Code as |
| 530 | + "Multiple-Licensed". "Multiple-Licensed" means that the Initial |
| 531 | + Developer permits you to utilize portions of the Covered Code under |
| 532 | + Your choice of the NPL or the alternative licenses, if any, specified |
| 533 | + by the Initial Developer in the file described in Exhibit A. |
| 534 | + |
| 535 | +EXHIBIT A -Mozilla Public License. |
| 536 | + |
| 537 | + ``The contents of this file are subject to the Mozilla Public License |
| 538 | + Version 1.1 (the "License"); you may not use this file except in |
| 539 | + compliance with the License. You may obtain a copy of the License at |
| 540 | + http://www.mozilla.org/MPL/ |
| 541 | + |
| 542 | + Software distributed under the License is distributed on an "AS IS" |
| 543 | + basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the |
| 544 | + License for the specific language governing rights and limitations |
| 545 | + under the License. |
| 546 | + |
| 547 | + The Original Code is ______________________________________. |
| 548 | + |
| 549 | + The Initial Developer of the Original Code is ________________________. |
| 550 | + Portions created by ______________________ are Copyright (C) ______ |
| 551 | + _______________________. All Rights Reserved. |
| 552 | + |
| 553 | + Contributor(s): ______________________________________. |
| 554 | + |
| 555 | + Alternatively, the contents of this file may be used under the terms |
| 556 | + of the _____ license (the "[___] License"), in which case the |
| 557 | + provisions of [______] License are applicable instead of those |
| 558 | + above. If you wish to allow use of your version of this file only |
| 559 | + under the terms of the [____] License and not to allow others to use |
| 560 | + your version of this file under the MPL, indicate your decision by |
| 561 | + deleting the provisions above and replace them with the notice and |
| 562 | + other provisions required by the [___] License. If you do not delete |
| 563 | + the provisions above, a recipient may use your version of this file |
| 564 | + under either the MPL or the [___] License." |
| 565 | + |
| 566 | + [NOTE: The text of this Exhibit A may differ slightly from the text of |
| 567 | + the notices in the Source Code files of the Original Code. You should |
| 568 | + use the text of this Exhibit A rather than the text found in the |
| 569 | + Original Code Source Code for Your Modifications.] |
| 570 | + |
Property changes on: trunk/extensions/Hanp/php-utf8/NPL-1.1.txt |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 571 | + native |
Index: trunk/extensions/Hanp/php-utf8/CHANGES.txt |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +Checked out intl/uconv/src/nsUTF8ToUnicode.cpp 1.7 |
| 3 | +from cvs-mirror.mozilla.org on 2003-05-29 |
| 4 | + |
| 5 | +Checked out intl/uconv/src/nsUnicodeToUTF8.cpp 1.11 |
| 6 | +from cvs-mirror.mozilla.org on 2003-05-30 |
| 7 | + |
| 8 | +Changes made (by Henri Sivonen, hsivonen@iki.fi) |
| 9 | + |
| 10 | +Adapted pointer usage to PHP array / string usage. |
| 11 | +Inlined Reset in UTF-8 to Unicode conversion. |
| 12 | +Switched from UTF-16 to code points in array (sort of UCS-4). |
| 13 | +Removed output buffer bound checks. |
| 14 | +Added Unicode range checks to Unicode to UTF-8 converter. |
| 15 | +Removed C++isms around the functions of interest. |
| 16 | +Moved the functions to one PHP file (utf8.inc). |
\ No newline at end of file |
Property changes on: trunk/extensions/Hanp/php-utf8/CHANGES.txt |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 17 | + native |
Index: trunk/extensions/Hanp/php-utf8/lgpl.txt |
— | — | @@ -0,0 +1,504 @@ |
| 2 | + GNU LESSER GENERAL PUBLIC LICENSE |
| 3 | + Version 2.1, February 1999 |
| 4 | + |
| 5 | + Copyright (C) 1991, 1999 Free Software Foundation, Inc. |
| 6 | + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 7 | + Everyone is permitted to copy and distribute verbatim copies |
| 8 | + of this license document, but changing it is not allowed. |
| 9 | + |
| 10 | +[This is the first released version of the Lesser GPL. It also counts |
| 11 | + as the successor of the GNU Library Public License, version 2, hence |
| 12 | + the version number 2.1.] |
| 13 | + |
| 14 | + Preamble |
| 15 | + |
| 16 | + The licenses for most software are designed to take away your |
| 17 | +freedom to share and change it. By contrast, the GNU General Public |
| 18 | +Licenses are intended to guarantee your freedom to share and change |
| 19 | +free software--to make sure the software is free for all its users. |
| 20 | + |
| 21 | + This license, the Lesser General Public License, applies to some |
| 22 | +specially designated software packages--typically libraries--of the |
| 23 | +Free Software Foundation and other authors who decide to use it. You |
| 24 | +can use it too, but we suggest you first think carefully about whether |
| 25 | +this license or the ordinary General Public License is the better |
| 26 | +strategy to use in any particular case, based on the explanations below. |
| 27 | + |
| 28 | + When we speak of free software, we are referring to freedom of use, |
| 29 | +not price. Our General Public Licenses are designed to make sure that |
| 30 | +you have the freedom to distribute copies of free software (and charge |
| 31 | +for this service if you wish); that you receive source code or can get |
| 32 | +it if you want it; that you can change the software and use pieces of |
| 33 | +it in new free programs; and that you are informed that you can do |
| 34 | +these things. |
| 35 | + |
| 36 | + To protect your rights, we need to make restrictions that forbid |
| 37 | +distributors to deny you these rights or to ask you to surrender these |
| 38 | +rights. These restrictions translate to certain responsibilities for |
| 39 | +you if you distribute copies of the library or if you modify it. |
| 40 | + |
| 41 | + For example, if you distribute copies of the library, whether gratis |
| 42 | +or for a fee, you must give the recipients all the rights that we gave |
| 43 | +you. You must make sure that they, too, receive or can get the source |
| 44 | +code. If you link other code with the library, you must provide |
| 45 | +complete object files to the recipients, so that they can relink them |
| 46 | +with the library after making changes to the library and recompiling |
| 47 | +it. And you must show them these terms so they know their rights. |
| 48 | + |
| 49 | + We protect your rights with a two-step method: (1) we copyright the |
| 50 | +library, and (2) we offer you this license, which gives you legal |
| 51 | +permission to copy, distribute and/or modify the library. |
| 52 | + |
| 53 | + To protect each distributor, we want to make it very clear that |
| 54 | +there is no warranty for the free library. Also, if the library is |
| 55 | +modified by someone else and passed on, the recipients should know |
| 56 | +that what they have is not the original version, so that the original |
| 57 | +author's reputation will not be affected by problems that might be |
| 58 | +introduced by others. |
| 59 | + |
| 60 | + Finally, software patents pose a constant threat to the existence of |
| 61 | +any free program. We wish to make sure that a company cannot |
| 62 | +effectively restrict the users of a free program by obtaining a |
| 63 | +restrictive license from a patent holder. Therefore, we insist that |
| 64 | +any patent license obtained for a version of the library must be |
| 65 | +consistent with the full freedom of use specified in this license. |
| 66 | + |
| 67 | + Most GNU software, including some libraries, is covered by the |
| 68 | +ordinary GNU General Public License. This license, the GNU Lesser |
| 69 | +General Public License, applies to certain designated libraries, and |
| 70 | +is quite different from the ordinary General Public License. We use |
| 71 | +this license for certain libraries in order to permit linking those |
| 72 | +libraries into non-free programs. |
| 73 | + |
| 74 | + When a program is linked with a library, whether statically or using |
| 75 | +a shared library, the combination of the two is legally speaking a |
| 76 | +combined work, a derivative of the original library. The ordinary |
| 77 | +General Public License therefore permits such linking only if the |
| 78 | +entire combination fits its criteria of freedom. The Lesser General |
| 79 | +Public License permits more lax criteria for linking other code with |
| 80 | +the library. |
| 81 | + |
| 82 | + We call this license the "Lesser" General Public License because it |
| 83 | +does Less to protect the user's freedom than the ordinary General |
| 84 | +Public License. It also provides other free software developers Less |
| 85 | +of an advantage over competing non-free programs. These disadvantages |
| 86 | +are the reason we use the ordinary General Public License for many |
| 87 | +libraries. However, the Lesser license provides advantages in certain |
| 88 | +special circumstances. |
| 89 | + |
| 90 | + For example, on rare occasions, there may be a special need to |
| 91 | +encourage the widest possible use of a certain library, so that it becomes |
| 92 | +a de-facto standard. To achieve this, non-free programs must be |
| 93 | +allowed to use the library. A more frequent case is that a free |
| 94 | +library does the same job as widely used non-free libraries. In this |
| 95 | +case, there is little to gain by limiting the free library to free |
| 96 | +software only, so we use the Lesser General Public License. |
| 97 | + |
| 98 | + In other cases, permission to use a particular library in non-free |
| 99 | +programs enables a greater number of people to use a large body of |
| 100 | +free software. For example, permission to use the GNU C Library in |
| 101 | +non-free programs enables many more people to use the whole GNU |
| 102 | +operating system, as well as its variant, the GNU/Linux operating |
| 103 | +system. |
| 104 | + |
| 105 | + Although the Lesser General Public License is Less protective of the |
| 106 | +users' freedom, it does ensure that the user of a program that is |
| 107 | +linked with the Library has the freedom and the wherewithal to run |
| 108 | +that program using a modified version of the Library. |
| 109 | + |
| 110 | + The precise terms and conditions for copying, distribution and |
| 111 | +modification follow. Pay close attention to the difference between a |
| 112 | +"work based on the library" and a "work that uses the library". The |
| 113 | +former contains code derived from the library, whereas the latter must |
| 114 | +be combined with the library in order to run. |
| 115 | + |
| 116 | + GNU LESSER GENERAL PUBLIC LICENSE |
| 117 | + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
| 118 | + |
| 119 | + 0. This License Agreement applies to any software library or other |
| 120 | +program which contains a notice placed by the copyright holder or |
| 121 | +other authorized party saying it may be distributed under the terms of |
| 122 | +this Lesser General Public License (also called "this License"). |
| 123 | +Each licensee is addressed as "you". |
| 124 | + |
| 125 | + A "library" means a collection of software functions and/or data |
| 126 | +prepared so as to be conveniently linked with application programs |
| 127 | +(which use some of those functions and data) to form executables. |
| 128 | + |
| 129 | + The "Library", below, refers to any such software library or work |
| 130 | +which has been distributed under these terms. A "work based on the |
| 131 | +Library" means either the Library or any derivative work under |
| 132 | +copyright law: that is to say, a work containing the Library or a |
| 133 | +portion of it, either verbatim or with modifications and/or translated |
| 134 | +straightforwardly into another language. (Hereinafter, translation is |
| 135 | +included without limitation in the term "modification".) |
| 136 | + |
| 137 | + "Source code" for a work means the preferred form of the work for |
| 138 | +making modifications to it. For a library, complete source code means |
| 139 | +all the source code for all modules it contains, plus any associated |
| 140 | +interface definition files, plus the scripts used to control compilation |
| 141 | +and installation of the library. |
| 142 | + |
| 143 | + Activities other than copying, distribution and modification are not |
| 144 | +covered by this License; they are outside its scope. The act of |
| 145 | +running a program using the Library is not restricted, and output from |
| 146 | +such a program is covered only if its contents constitute a work based |
| 147 | +on the Library (independent of the use of the Library in a tool for |
| 148 | +writing it). Whether that is true depends on what the Library does |
| 149 | +and what the program that uses the Library does. |
| 150 | + |
| 151 | + 1. You may copy and distribute verbatim copies of the Library's |
| 152 | +complete source code as you receive it, in any medium, provided that |
| 153 | +you conspicuously and appropriately publish on each copy an |
| 154 | +appropriate copyright notice and disclaimer of warranty; keep intact |
| 155 | +all the notices that refer to this License and to the absence of any |
| 156 | +warranty; and distribute a copy of this License along with the |
| 157 | +Library. |
| 158 | + |
| 159 | + You may charge a fee for the physical act of transferring a copy, |
| 160 | +and you may at your option offer warranty protection in exchange for a |
| 161 | +fee. |
| 162 | + |
| 163 | + 2. You may modify your copy or copies of the Library or any portion |
| 164 | +of it, thus forming a work based on the Library, and copy and |
| 165 | +distribute such modifications or work under the terms of Section 1 |
| 166 | +above, provided that you also meet all of these conditions: |
| 167 | + |
| 168 | + a) The modified work must itself be a software library. |
| 169 | + |
| 170 | + b) You must cause the files modified to carry prominent notices |
| 171 | + stating that you changed the files and the date of any change. |
| 172 | + |
| 173 | + c) You must cause the whole of the work to be licensed at no |
| 174 | + charge to all third parties under the terms of this License. |
| 175 | + |
| 176 | + d) If a facility in the modified Library refers to a function or a |
| 177 | + table of data to be supplied by an application program that uses |
| 178 | + the facility, other than as an argument passed when the facility |
| 179 | + is invoked, then you must make a good faith effort to ensure that, |
| 180 | + in the event an application does not supply such function or |
| 181 | + table, the facility still operates, and performs whatever part of |
| 182 | + its purpose remains meaningful. |
| 183 | + |
| 184 | + (For example, a function in a library to compute square roots has |
| 185 | + a purpose that is entirely well-defined independent of the |
| 186 | + application. Therefore, Subsection 2d requires that any |
| 187 | + application-supplied function or table used by this function must |
| 188 | + be optional: if the application does not supply it, the square |
| 189 | + root function must still compute square roots.) |
| 190 | + |
| 191 | +These requirements apply to the modified work as a whole. If |
| 192 | +identifiable sections of that work are not derived from the Library, |
| 193 | +and can be reasonably considered independent and separate works in |
| 194 | +themselves, then this License, and its terms, do not apply to those |
| 195 | +sections when you distribute them as separate works. But when you |
| 196 | +distribute the same sections as part of a whole which is a work based |
| 197 | +on the Library, the distribution of the whole must be on the terms of |
| 198 | +this License, whose permissions for other licensees extend to the |
| 199 | +entire whole, and thus to each and every part regardless of who wrote |
| 200 | +it. |
| 201 | + |
| 202 | +Thus, it is not the intent of this section to claim rights or contest |
| 203 | +your rights to work written entirely by you; rather, the intent is to |
| 204 | +exercise the right to control the distribution of derivative or |
| 205 | +collective works based on the Library. |
| 206 | + |
| 207 | +In addition, mere aggregation of another work not based on the Library |
| 208 | +with the Library (or with a work based on the Library) on a volume of |
| 209 | +a storage or distribution medium does not bring the other work under |
| 210 | +the scope of this License. |
| 211 | + |
| 212 | + 3. You may opt to apply the terms of the ordinary GNU General Public |
| 213 | +License instead of this License to a given copy of the Library. To do |
| 214 | +this, you must alter all the notices that refer to this License, so |
| 215 | +that they refer to the ordinary GNU General Public License, version 2, |
| 216 | +instead of to this License. (If a newer version than version 2 of the |
| 217 | +ordinary GNU General Public License has appeared, then you can specify |
| 218 | +that version instead if you wish.) Do not make any other change in |
| 219 | +these notices. |
| 220 | + |
| 221 | + Once this change is made in a given copy, it is irreversible for |
| 222 | +that copy, so the ordinary GNU General Public License applies to all |
| 223 | +subsequent copies and derivative works made from that copy. |
| 224 | + |
| 225 | + This option is useful when you wish to copy part of the code of |
| 226 | +the Library into a program that is not a library. |
| 227 | + |
| 228 | + 4. You may copy and distribute the Library (or a portion or |
| 229 | +derivative of it, under Section 2) in object code or executable form |
| 230 | +under the terms of Sections 1 and 2 above provided that you accompany |
| 231 | +it with the complete corresponding machine-readable source code, which |
| 232 | +must be distributed under the terms of Sections 1 and 2 above on a |
| 233 | +medium customarily used for software interchange. |
| 234 | + |
| 235 | + If distribution of object code is made by offering access to copy |
| 236 | +from a designated place, then offering equivalent access to copy the |
| 237 | +source code from the same place satisfies the requirement to |
| 238 | +distribute the source code, even though third parties are not |
| 239 | +compelled to copy the source along with the object code. |
| 240 | + |
| 241 | + 5. A program that contains no derivative of any portion of the |
| 242 | +Library, but is designed to work with the Library by being compiled or |
| 243 | +linked with it, is called a "work that uses the Library". Such a |
| 244 | +work, in isolation, is not a derivative work of the Library, and |
| 245 | +therefore falls outside the scope of this License. |
| 246 | + |
| 247 | + However, linking a "work that uses the Library" with the Library |
| 248 | +creates an executable that is a derivative of the Library (because it |
| 249 | +contains portions of the Library), rather than a "work that uses the |
| 250 | +library". The executable is therefore covered by this License. |
| 251 | +Section 6 states terms for distribution of such executables. |
| 252 | + |
| 253 | + When a "work that uses the Library" uses material from a header file |
| 254 | +that is part of the Library, the object code for the work may be a |
| 255 | +derivative work of the Library even though the source code is not. |
| 256 | +Whether this is true is especially significant if the work can be |
| 257 | +linked without the Library, or if the work is itself a library. The |
| 258 | +threshold for this to be true is not precisely defined by law. |
| 259 | + |
| 260 | + If such an object file uses only numerical parameters, data |
| 261 | +structure layouts and accessors, and small macros and small inline |
| 262 | +functions (ten lines or less in length), then the use of the object |
| 263 | +file is unrestricted, regardless of whether it is legally a derivative |
| 264 | +work. (Executables containing this object code plus portions of the |
| 265 | +Library will still fall under Section 6.) |
| 266 | + |
| 267 | + Otherwise, if the work is a derivative of the Library, you may |
| 268 | +distribute the object code for the work under the terms of Section 6. |
| 269 | +Any executables containing that work also fall under Section 6, |
| 270 | +whether or not they are linked directly with the Library itself. |
| 271 | + |
| 272 | + 6. As an exception to the Sections above, you may also combine or |
| 273 | +link a "work that uses the Library" with the Library to produce a |
| 274 | +work containing portions of the Library, and distribute that work |
| 275 | +under terms of your choice, provided that the terms permit |
| 276 | +modification of the work for the customer's own use and reverse |
| 277 | +engineering for debugging such modifications. |
| 278 | + |
| 279 | + You must give prominent notice with each copy of the work that the |
| 280 | +Library is used in it and that the Library and its use are covered by |
| 281 | +this License. You must supply a copy of this License. If the work |
| 282 | +during execution displays copyright notices, you must include the |
| 283 | +copyright notice for the Library among them, as well as a reference |
| 284 | +directing the user to the copy of this License. Also, you must do one |
| 285 | +of these things: |
| 286 | + |
| 287 | + a) Accompany the work with the complete corresponding |
| 288 | + machine-readable source code for the Library including whatever |
| 289 | + changes were used in the work (which must be distributed under |
| 290 | + Sections 1 and 2 above); and, if the work is an executable linked |
| 291 | + with the Library, with the complete machine-readable "work that |
| 292 | + uses the Library", as object code and/or source code, so that the |
| 293 | + user can modify the Library and then relink to produce a modified |
| 294 | + executable containing the modified Library. (It is understood |
| 295 | + that the user who changes the contents of definitions files in the |
| 296 | + Library will not necessarily be able to recompile the application |
| 297 | + to use the modified definitions.) |
| 298 | + |
| 299 | + b) Use a suitable shared library mechanism for linking with the |
| 300 | + Library. A suitable mechanism is one that (1) uses at run time a |
| 301 | + copy of the library already present on the user's computer system, |
| 302 | + rather than copying library functions into the executable, and (2) |
| 303 | + will operate properly with a modified version of the library, if |
| 304 | + the user installs one, as long as the modified version is |
| 305 | + interface-compatible with the version that the work was made with. |
| 306 | + |
| 307 | + c) Accompany the work with a written offer, valid for at |
| 308 | + least three years, to give the same user the materials |
| 309 | + specified in Subsection 6a, above, for a charge no more |
| 310 | + than the cost of performing this distribution. |
| 311 | + |
| 312 | + d) If distribution of the work is made by offering access to copy |
| 313 | + from a designated place, offer equivalent access to copy the above |
| 314 | + specified materials from the same place. |
| 315 | + |
| 316 | + e) Verify that the user has already received a copy of these |
| 317 | + materials or that you have already sent this user a copy. |
| 318 | + |
| 319 | + For an executable, the required form of the "work that uses the |
| 320 | +Library" must include any data and utility programs needed for |
| 321 | +reproducing the executable from it. However, as a special exception, |
| 322 | +the materials to be distributed need not include anything that is |
| 323 | +normally distributed (in either source or binary form) with the major |
| 324 | +components (compiler, kernel, and so on) of the operating system on |
| 325 | +which the executable runs, unless that component itself accompanies |
| 326 | +the executable. |
| 327 | + |
| 328 | + It may happen that this requirement contradicts the license |
| 329 | +restrictions of other proprietary libraries that do not normally |
| 330 | +accompany the operating system. Such a contradiction means you cannot |
| 331 | +use both them and the Library together in an executable that you |
| 332 | +distribute. |
| 333 | + |
| 334 | + 7. You may place library facilities that are a work based on the |
| 335 | +Library side-by-side in a single library together with other library |
| 336 | +facilities not covered by this License, and distribute such a combined |
| 337 | +library, provided that the separate distribution of the work based on |
| 338 | +the Library and of the other library facilities is otherwise |
| 339 | +permitted, and provided that you do these two things: |
| 340 | + |
| 341 | + a) Accompany the combined library with a copy of the same work |
| 342 | + based on the Library, uncombined with any other library |
| 343 | + facilities. This must be distributed under the terms of the |
| 344 | + Sections above. |
| 345 | + |
| 346 | + b) Give prominent notice with the combined library of the fact |
| 347 | + that part of it is a work based on the Library, and explaining |
| 348 | + where to find the accompanying uncombined form of the same work. |
| 349 | + |
| 350 | + 8. You may not copy, modify, sublicense, link with, or distribute |
| 351 | +the Library except as expressly provided under this License. Any |
| 352 | +attempt otherwise to copy, modify, sublicense, link with, or |
| 353 | +distribute the Library is void, and will automatically terminate your |
| 354 | +rights under this License. However, parties who have received copies, |
| 355 | +or rights, from you under this License will not have their licenses |
| 356 | +terminated so long as such parties remain in full compliance. |
| 357 | + |
| 358 | + 9. You are not required to accept this License, since you have not |
| 359 | +signed it. However, nothing else grants you permission to modify or |
| 360 | +distribute the Library or its derivative works. These actions are |
| 361 | +prohibited by law if you do not accept this License. Therefore, by |
| 362 | +modifying or distributing the Library (or any work based on the |
| 363 | +Library), you indicate your acceptance of this License to do so, and |
| 364 | +all its terms and conditions for copying, distributing or modifying |
| 365 | +the Library or works based on it. |
| 366 | + |
| 367 | + 10. Each time you redistribute the Library (or any work based on the |
| 368 | +Library), the recipient automatically receives a license from the |
| 369 | +original licensor to copy, distribute, link with or modify the Library |
| 370 | +subject to these terms and conditions. You may not impose any further |
| 371 | +restrictions on the recipients' exercise of the rights granted herein. |
| 372 | +You are not responsible for enforcing compliance by third parties with |
| 373 | +this License. |
| 374 | + |
| 375 | + 11. If, as a consequence of a court judgment or allegation of patent |
| 376 | +infringement or for any other reason (not limited to patent issues), |
| 377 | +conditions are imposed on you (whether by court order, agreement or |
| 378 | +otherwise) that contradict the conditions of this License, they do not |
| 379 | +excuse you from the conditions of this License. If you cannot |
| 380 | +distribute so as to satisfy simultaneously your obligations under this |
| 381 | +License and any other pertinent obligations, then as a consequence you |
| 382 | +may not distribute the Library at all. For example, if a patent |
| 383 | +license would not permit royalty-free redistribution of the Library by |
| 384 | +all those who receive copies directly or indirectly through you, then |
| 385 | +the only way you could satisfy both it and this License would be to |
| 386 | +refrain entirely from distribution of the Library. |
| 387 | + |
| 388 | +If any portion of this section is held invalid or unenforceable under any |
| 389 | +particular circumstance, the balance of the section is intended to apply, |
| 390 | +and the section as a whole is intended to apply in other circumstances. |
| 391 | + |
| 392 | +It is not the purpose of this section to induce you to infringe any |
| 393 | +patents or other property right claims or to contest validity of any |
| 394 | +such claims; this section has the sole purpose of protecting the |
| 395 | +integrity of the free software distribution system which is |
| 396 | +implemented by public license practices. Many people have made |
| 397 | +generous contributions to the wide range of software distributed |
| 398 | +through that system in reliance on consistent application of that |
| 399 | +system; it is up to the author/donor to decide if he or she is willing |
| 400 | +to distribute software through any other system and a licensee cannot |
| 401 | +impose that choice. |
| 402 | + |
| 403 | +This section is intended to make thoroughly clear what is believed to |
| 404 | +be a consequence of the rest of this License. |
| 405 | + |
| 406 | + 12. If the distribution and/or use of the Library is restricted in |
| 407 | +certain countries either by patents or by copyrighted interfaces, the |
| 408 | +original copyright holder who places the Library under this License may add |
| 409 | +an explicit geographical distribution limitation excluding those countries, |
| 410 | +so that distribution is permitted only in or among countries not thus |
| 411 | +excluded. In such case, this License incorporates the limitation as if |
| 412 | +written in the body of this License. |
| 413 | + |
| 414 | + 13. The Free Software Foundation may publish revised and/or new |
| 415 | +versions of the Lesser General Public License from time to time. |
| 416 | +Such new versions will be similar in spirit to the present version, |
| 417 | +but may differ in detail to address new problems or concerns. |
| 418 | + |
| 419 | +Each version is given a distinguishing version number. If the Library |
| 420 | +specifies a version number of this License which applies to it and |
| 421 | +"any later version", you have the option of following the terms and |
| 422 | +conditions either of that version or of any later version published by |
| 423 | +the Free Software Foundation. If the Library does not specify a |
| 424 | +license version number, you may choose any version ever published by |
| 425 | +the Free Software Foundation. |
| 426 | + |
| 427 | + 14. If you wish to incorporate parts of the Library into other free |
| 428 | +programs whose distribution conditions are incompatible with these, |
| 429 | +write to the author to ask for permission. For software which is |
| 430 | +copyrighted by the Free Software Foundation, write to the Free |
| 431 | +Software Foundation; we sometimes make exceptions for this. Our |
| 432 | +decision will be guided by the two goals of preserving the free status |
| 433 | +of all derivatives of our free software and of promoting the sharing |
| 434 | +and reuse of software generally. |
| 435 | + |
| 436 | + NO WARRANTY |
| 437 | + |
| 438 | + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO |
| 439 | +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. |
| 440 | +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR |
| 441 | +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY |
| 442 | +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE |
| 443 | +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 444 | +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE |
| 445 | +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME |
| 446 | +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. |
| 447 | + |
| 448 | + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN |
| 449 | +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY |
| 450 | +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU |
| 451 | +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR |
| 452 | +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE |
| 453 | +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING |
| 454 | +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A |
| 455 | +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF |
| 456 | +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 457 | +DAMAGES. |
| 458 | + |
| 459 | + END OF TERMS AND CONDITIONS |
| 460 | + |
| 461 | + How to Apply These Terms to Your New Libraries |
| 462 | + |
| 463 | + If you develop a new library, and you want it to be of the greatest |
| 464 | +possible use to the public, we recommend making it free software that |
| 465 | +everyone can redistribute and change. You can do so by permitting |
| 466 | +redistribution under these terms (or, alternatively, under the terms of the |
| 467 | +ordinary General Public License). |
| 468 | + |
| 469 | + To apply these terms, attach the following notices to the library. It is |
| 470 | +safest to attach them to the start of each source file to most effectively |
| 471 | +convey the exclusion of warranty; and each file should have at least the |
| 472 | +"copyright" line and a pointer to where the full notice is found. |
| 473 | + |
| 474 | + <one line to give the library's name and a brief idea of what it does.> |
| 475 | + Copyright (C) <year> <name of author> |
| 476 | + |
| 477 | + This library is free software; you can redistribute it and/or |
| 478 | + modify it under the terms of the GNU Lesser General Public |
| 479 | + License as published by the Free Software Foundation; either |
| 480 | + version 2.1 of the License, or (at your option) any later version. |
| 481 | + |
| 482 | + This library is distributed in the hope that it will be useful, |
| 483 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 484 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 485 | + Lesser General Public License for more details. |
| 486 | + |
| 487 | + You should have received a copy of the GNU Lesser General Public |
| 488 | + License along with this library; if not, write to the Free Software |
| 489 | + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 490 | + |
| 491 | +Also add information on how to contact you by electronic and paper mail. |
| 492 | + |
| 493 | +You should also get your employer (if you work as a programmer) or your |
| 494 | +school, if any, to sign a "copyright disclaimer" for the library, if |
| 495 | +necessary. Here is a sample; alter the names: |
| 496 | + |
| 497 | + Yoyodyne, Inc., hereby disclaims all copyright interest in the |
| 498 | + library `Frob' (a library for tweaking knobs) written by James Random Hacker. |
| 499 | + |
| 500 | + <signature of Ty Coon>, 1 April 1990 |
| 501 | + Ty Coon, President of Vice |
| 502 | + |
| 503 | +That's all there is to it! |
| 504 | + |
| 505 | + |
Property changes on: trunk/extensions/Hanp/php-utf8/lgpl.txt |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 506 | + native |
Index: trunk/extensions/Hanp/php-utf8/utf8.inc |
— | — | @@ -0,0 +1,212 @@ |
| 2 | +<?php |
| 3 | +/* ***** BEGIN LICENSE BLOCK ***** |
| 4 | + * Version: NPL 1.1/GPL 2.0/LGPL 2.1 |
| 5 | + * |
| 6 | + * The contents of this file are subject to the Netscape Public License |
| 7 | + * Version 1.1 (the "License"); you may not use this file except in |
| 8 | + * compliance with the License. You may obtain a copy of the License at |
| 9 | + * http://www.mozilla.org/NPL/ |
| 10 | + * |
| 11 | + * Software distributed under the License is distributed on an "AS IS" basis, |
| 12 | + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License |
| 13 | + * for the specific language governing rights and limitations under the |
| 14 | + * License. |
| 15 | + * |
| 16 | + * The Original Code is Mozilla Communicator client code. |
| 17 | + * |
| 18 | + * The Initial Developer of the Original Code is |
| 19 | + * Netscape Communications Corporation. |
| 20 | + * Portions created by the Initial Developer are Copyright (C) 1998 |
| 21 | + * the Initial Developer. All Rights Reserved. |
| 22 | + * |
| 23 | + * Contributor(s): |
| 24 | + * Henri Sivonen, hsivonen@iki.fi |
| 25 | + * |
| 26 | + * |
| 27 | + * Alternatively, the contents of this file may be used under the terms of |
| 28 | + * either the GNU General Public License Version 2 or later (the "GPL"), or |
| 29 | + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), |
| 30 | + * in which case the provisions of the GPL or the LGPL are applicable instead |
| 31 | + * of those above. If you wish to allow use of your version of this file only |
| 32 | + * under the terms of either the GPL or the LGPL, and not to allow others to |
| 33 | + * use your version of this file under the terms of the NPL, indicate your |
| 34 | + * decision by deleting the provisions above and replace them with the notice |
| 35 | + * and other provisions required by the GPL or the LGPL. If you do not delete |
| 36 | + * the provisions above, a recipient may use your version of this file under |
| 37 | + * the terms of any one of the NPL, the GPL or the LGPL. |
| 38 | + * |
| 39 | + * ***** END LICENSE BLOCK ***** */ |
| 40 | + |
| 41 | +/* |
| 42 | + * For the original C++ code, see |
| 43 | + * http://lxr.mozilla.org/seamonkey/source/intl/uconv/src/nsUTF8ToUnicode.cpp |
| 44 | + * http://lxr.mozilla.org/seamonkey/source/intl/uconv/src/nsUnicodeToUTF8.cpp |
| 45 | + * |
| 46 | + * The latest version of this file can be obtained from |
| 47 | + * http://iki.fi/hsivonen/php-utf8/ |
| 48 | + * |
| 49 | + * Version 1.0, 2003-05-30 |
| 50 | + */ |
| 51 | + |
| 52 | +/** |
| 53 | + * Takes an UTF-8 string and returns an array of ints representing the |
| 54 | + * Unicode characters. Astral planes are supported ie. the ints in the |
| 55 | + * output can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates |
| 56 | + * are not allowed. |
| 57 | + * |
| 58 | + * Returns false if the input string isn't a valid UTF-8 octet sequence. |
| 59 | + */ |
| 60 | +function utf8ToUnicode(&$str) |
| 61 | +{ |
| 62 | + $mState = 0; // cached expected number of octets after the current octet |
| 63 | + // until the beginning of the next UTF8 character sequence |
| 64 | + $mUcs4 = 0; // cached Unicode character |
| 65 | + $mBytes = 1; // cached expected number of octets in the current sequence |
| 66 | + |
| 67 | + $out = array(); |
| 68 | + |
| 69 | + $len = strlen($str); |
| 70 | + for($i = 0; $i < $len; $i++) { |
| 71 | + $in = ord($str{$i}); |
| 72 | + if (0 == $mState) { |
| 73 | + // When mState is zero we expect either a US-ASCII character or a |
| 74 | + // multi-octet sequence. |
| 75 | + if (0 == (0x80 & ($in))) { |
| 76 | + // US-ASCII, pass straight through. |
| 77 | + $out[] = $in; |
| 78 | + $mBytes = 1; |
| 79 | + } else if (0xC0 == (0xE0 & ($in))) { |
| 80 | + // First octet of 2 octet sequence |
| 81 | + $mUcs4 = ($in); |
| 82 | + $mUcs4 = ($mUcs4 & 0x1F) << 6; |
| 83 | + $mState = 1; |
| 84 | + $mBytes = 2; |
| 85 | + } else if (0xE0 == (0xF0 & ($in))) { |
| 86 | + // First octet of 3 octet sequence |
| 87 | + $mUcs4 = ($in); |
| 88 | + $mUcs4 = ($mUcs4 & 0x0F) << 12; |
| 89 | + $mState = 2; |
| 90 | + $mBytes = 3; |
| 91 | + } else if (0xF0 == (0xF8 & ($in))) { |
| 92 | + // First octet of 4 octet sequence |
| 93 | + $mUcs4 = ($in); |
| 94 | + $mUcs4 = ($mUcs4 & 0x07) << 18; |
| 95 | + $mState = 3; |
| 96 | + $mBytes = 4; |
| 97 | + } else if (0xF8 == (0xFC & ($in))) { |
| 98 | + /* First octet of 5 octet sequence. |
| 99 | + * |
| 100 | + * This is illegal because the encoded codepoint must be either |
| 101 | + * (a) not the shortest form or |
| 102 | + * (b) outside the Unicode range of 0-0x10FFFF. |
| 103 | + * Rather than trying to resynchronize, we will carry on until the end |
| 104 | + * of the sequence and let the later error handling code catch it. |
| 105 | + */ |
| 106 | + $mUcs4 = ($in); |
| 107 | + $mUcs4 = ($mUcs4 & 0x03) << 24; |
| 108 | + $mState = 4; |
| 109 | + $mBytes = 5; |
| 110 | + } else if (0xFC == (0xFE & ($in))) { |
| 111 | + // First octet of 6 octet sequence, see comments for 5 octet sequence. |
| 112 | + $mUcs4 = ($in); |
| 113 | + $mUcs4 = ($mUcs4 & 1) << 30; |
| 114 | + $mState = 5; |
| 115 | + $mBytes = 6; |
| 116 | + } else { |
| 117 | + /* Current octet is neither in the US-ASCII range nor a legal first |
| 118 | + * octet of a multi-octet sequence. |
| 119 | + */ |
| 120 | + return false; |
| 121 | + } |
| 122 | + } else { |
| 123 | + // When mState is non-zero, we expect a continuation of the multi-octet |
| 124 | + // sequence |
| 125 | + if (0x80 == (0xC0 & ($in))) { |
| 126 | + // Legal continuation. |
| 127 | + $shift = ($mState - 1) * 6; |
| 128 | + $tmp = $in; |
| 129 | + $tmp = ($tmp & 0x0000003F) << $shift; |
| 130 | + $mUcs4 |= $tmp; |
| 131 | + |
| 132 | + if (0 == --$mState) { |
| 133 | + /* End of the multi-octet sequence. mUcs4 now contains the final |
| 134 | + * Unicode codepoint to be output |
| 135 | + * |
| 136 | + * Check for illegal sequences and codepoints. |
| 137 | + */ |
| 138 | + |
| 139 | + // From Unicode 3.1, non-shortest form is illegal |
| 140 | + if (((2 == $mBytes) && ($mUcs4 < 0x0080)) || |
| 141 | + ((3 == $mBytes) && ($mUcs4 < 0x0800)) || |
| 142 | + ((4 == $mBytes) && ($mUcs4 < 0x10000)) || |
| 143 | + (4 < $mBytes) || |
| 144 | + // From Unicode 3.2, surrogate characters are illegal |
| 145 | + (($mUcs4 & 0xFFFFF800) == 0xD800) || |
| 146 | + // Codepoints outside the Unicode range are illegal |
| 147 | + ($mUcs4 > 0x10FFFF)) { |
| 148 | + return false; |
| 149 | + } |
| 150 | + if (0xFEFF != $mUcs4) { |
| 151 | + // BOM is legal but we don't want to output it |
| 152 | + $out[] = $mUcs4; |
| 153 | + } |
| 154 | + //initialize UTF8 cache |
| 155 | + $mState = 0; |
| 156 | + $mUcs4 = 0; |
| 157 | + $mBytes = 1; |
| 158 | + } |
| 159 | + } else { |
| 160 | + /* ((0xC0 & (*in) != 0x80) && (mState != 0)) |
| 161 | + * |
| 162 | + * Incomplete multi-octet sequence. |
| 163 | + */ |
| 164 | + return false; |
| 165 | + } |
| 166 | + } |
| 167 | + } |
| 168 | + return $out; |
| 169 | +} |
| 170 | + |
| 171 | +/** |
| 172 | + * Takes an array of ints representing the Unicode characters and returns |
| 173 | + * a UTF-8 string. Astral planes are supported ie. the ints in the |
| 174 | + * input can be > 0xFFFF. Occurrances of the BOM are ignored. Surrogates |
| 175 | + * are not allowed. |
| 176 | + * |
| 177 | + * Returns false if the input array contains ints that represent |
| 178 | + * surrogates or are outside the Unicode range. |
| 179 | + */ |
| 180 | +function unicodeToUtf8(&$arr) |
| 181 | +{ |
| 182 | + $dest = ''; |
| 183 | + foreach ($arr as $src) { |
| 184 | + if($src < 0) { |
| 185 | + return false; |
| 186 | + } else if ( $src <= 0x007f) { |
| 187 | + $dest .= chr($src); |
| 188 | + } else if ($src <= 0x07ff) { |
| 189 | + $dest .= chr(0xc0 | ($src >> 6)); |
| 190 | + $dest .= chr(0x80 | ($src & 0x003f)); |
| 191 | + } else if($src == 0xFEFF) { |
| 192 | + // nop -- zap the BOM |
| 193 | + } else if ($src >= 0xD800 && $src <= 0xDFFF) { |
| 194 | + // found a surrogate |
| 195 | + return false; |
| 196 | + } else if ($src <= 0xffff) { |
| 197 | + $dest .= chr(0xe0 | ($src >> 12)); |
| 198 | + $dest .= chr(0x80 | (($src >> 6) & 0x003f)); |
| 199 | + $dest .= chr(0x80 | ($src & 0x003f)); |
| 200 | + } else if ($src <= 0x10ffff) { |
| 201 | + $dest .= chr(0xf0 | ($src >> 18)); |
| 202 | + $dest .= chr(0x80 | (($src >> 12) & 0x3f)); |
| 203 | + $dest .= chr(0x80 | (($src >> 6) & 0x3f)); |
| 204 | + $dest .= chr(0x80 | ($src & 0x3f)); |
| 205 | + } else { |
| 206 | + // out of range |
| 207 | + return false; |
| 208 | + } |
| 209 | + } |
| 210 | + return $dest; |
| 211 | +} |
| 212 | + |
| 213 | +?> |
Property changes on: trunk/extensions/Hanp/php-utf8/utf8.inc |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 214 | + native |
Index: trunk/extensions/Hanp/Hanp.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php |
| 3 | +if (!defined('MEDIAWIKI')) die(); |
| 4 | +/** |
| 5 | + * This exension provides a parser function that aids in choosing the correct |
| 6 | + * particle that is attached to the words. |
| 7 | + * |
| 8 | + * @addtogroup Extensions |
| 9 | + * @file |
| 10 | + * |
| 11 | + * @author Niklas Laxström |
| 12 | + * @copyright Copyright © 2008, Niklas Laxström |
| 13 | + * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later |
| 14 | + */ |
| 15 | + |
| 16 | +$wgExtensionCredits['other'][] = array( |
| 17 | + 'name' => 'Hangul particle chooser', |
| 18 | + 'version' => '2008-09-21', |
| 19 | + 'author' => 'Niklas Laxström', |
| 20 | + 'url' => 'https://bugzilla.wikimedia.org/show_bug.cgi?id=13712', |
| 21 | + 'descriptionmsg' => 'hanp-desc', |
| 22 | +); |
| 23 | + |
| 24 | +$dir = dirname(__FILE__) . '/'; |
| 25 | +$wgExtensionMessagesFiles['hanp'] = $dir . 'Hanp.i18n.php'; |
| 26 | +$wgAutoloadClasses['Hanp'] = $dir . 'Hanp.body.php'; |
| 27 | +$wgHooks['LanguageGetMagic'][] = 'efHanpLanguageGetMagic'; |
| 28 | + |
| 29 | +if ( defined( 'MW_SUPPORTS_PARSERFIRSTCALLINIT' ) ) { |
| 30 | + $wgHooks['ParserFirstCallInit'][] = 'efHanpInit'; |
| 31 | +} else { |
| 32 | + $wgExtensionFunctions[] = 'efHanpInit'; |
| 33 | +} |
| 34 | + |
| 35 | +function efHanpInit() { |
| 36 | + global $wgParser; |
| 37 | + $wgParser->setFunctionHook( 'hanp', array( 'Hanp', 'hangulParticle' ) ); |
| 38 | + return true; |
| 39 | +} |
| 40 | + |
| 41 | +function efHanpLanguageGetMagic( &$magicWords, $langCode = 'en' ) { |
| 42 | + $magicWords['hanp'] = array( 0, 'hanp' ); |
| 43 | + return true; |
| 44 | +} |
Property changes on: trunk/extensions/Hanp/Hanp.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 45 | + native |