1<?php 2 3/* 4 This example file shows how to use web hyphenation 5 in 3 easy steps. 6 7 STEP 1: ENCODING 8 Use UTF-8 encoding: 9*/ 10 11 header('content-type: text/html; charset=utf-8'); 12 13/* 14 STEP 2: SETTINGS 15 Settings must be applied before including the 16 "hyphenation.php". These are the default values: 17 18 $GLOBALS["language"] = "en"; 19 Values: de, en, fr, nl 20 21 $GLOBALS["path_to_patterns"] = "patterns/"; 22 Where the patterns are located. 23 24 $GLOBALS["dictionary"] = "dictionary.txt"; 25 You can create a text file with special words 26 and those hyphenations line by line. 27 Use the / to mark a hyphenation. 28 For example: hyphe/nation 29 30 $GLOBALS["hyphen"] = "­"; 31 Entity or single character for hyphenation. 32 33 $GLOBALS["leftmin"] = 2; 34 $GLOBALS["rightmin"] = 2; 35 $GLOBALS["charmin"] = 2; 36 $GLOBALS["charmax"] = 10; 37 Minimum characters on left / right side and 38 characters length of a word. 39 40 $GLOBALS["exclude_tags"] = array("code", "pre", "script", "style"); 41 HTML tags to exclude from hyphenation. 42 43 44 STEP 3: INCLUDING HYPHENATION.PHP 45*/ 46 47 include("hyphenation.php"); 48 49/* 50 After including the file, hyphenation is available as 51 normal function. 52*/ 53 54 $text = 'But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and I will give you a complete account of the system, and expound the actual teachings of the great explorer of the truth, the master-builder of human happiness. No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances occur in which toil and pain can procure him some great pleasure. To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?'; 55 56 echo hyphenation($text); 57?>