PHP Typography 1.21


PHP Typog­ra­phy is a PHP based solu­tion to greatly improve web typog­ra­phy. It fea­tures the fol­low­ing capa­bil­i­ties (includ­ing gran­u­lar control):

  • Hyphen­ation
  • Spac­ing con­trol, includ­ing: glu­ing val­ues to units, widow pro­tec­tion, and forced inter­nal wrap­ping of long URLs & email addresses.
  • Intel­li­gent char­ac­ter replace­ment, includ­ing smart han­dling of: quote marks ( “foo” ), dashes ( foo – bar ), ellipses ( … ), trade­marks ( ™ ), math sym­bols ( 1024×768 ), frac­tions ( 1223 ), and ordi­nal suf­fixes ( 3rd )
  • CSS hooks for styling: amper­sands (class “amp”), acronyms (class “caps”), num­bers (class “num­bers”), ini­tial sin­gle quotes (class “quo”), and ini­tial dou­ble quotes & guillemets (class “dquo”).

This project merges, builds upon, and gen­er­al­izes the func­tion­al­ity of wp-​​Typogrify, wp-​​Hyphenate and SmartyPants.


While com­pli­ca­tion is added when manip­u­lat­ing the many options, imple­ment­ing PHP Typog­ra­phy can be as easy as this:

$html = "raw HTML here... ";

$typo = new phpTypography();
$html = $typo->process($html);

echo $html;

PHP Typog­ra­phy is designed for easy inte­gra­tion with plu­gin archi­tec­tures of PHP based con­tent man­age­ment sys­tems. It has already been ported to Word­Press and Zikula CMS. We would like to see other devel­op­ers pick up this code and imple­ment it for other CMSs. Specifically:

  • Dru­pal
  • Joomla
  • Expres­sion Engine

If you are a devel­oper for these (or any other PHP based CMS), the heavy lift­ing is done. You just need to hook it into your CMS.


Here is a fine tes­ti­mo­nial from Jenny (who also pro­vided some valu­able feed­back to fur­ther improve the project):

I’ve been eval­u­at­ing PHP Typog­ra­phy for use in a cus­tom CMS and have been very pleased so far…. It was, as you promised, easy to inte­grate in our frame­work (ZF) by wrap­ping it in a sim­ple class imple­ment­ing Zend_​Filter_​Interface. I am using PHP Typog­ra­phy after run­ning the text through HTMLPu­ri­fier, and the out­put has been beau­ti­ful thus far.


PHP Typog­ra­phy has the fol­low­ing requirements:

  • the host server must run PHP 5 or later
  • text must be encoded UTF-​​8
  • all markup must be valid xHTML, specifically:
    • every ele­ment must be closed,
    • every attribute must have a value enclosed in quotes, and
    • tag names and attrib­utes must be lowercase.


It should also be noted, PHP Typog­ra­phy would not have been pos­si­ble with­out another tool we have recently released: PHP Parser. PHP Parser is an amaz­ingly pow­er­ful resource that allows HTML to be parsed, mod­i­fied and recon­structed in ways pre­vi­ously not possible.

Your feed­back is much appre­ci­ated. How can we make this plu­gin bet­ter? Have you devel­oped a plu­gin using PHP Typog­ra­phy? Email us at info@​kingdesk.​com


  1. A com­menter on the wp-​​Typography project noti­fied us a false pos­i­tive was returned when the wp-​​Typography project files were scanned by Avira anti-​​virus. This issue appears to also occur with the PHP-​​Typography project.

    We have con­firmed false pos­i­tives for the cy.php, en-GB.php, es.php, ga.php, hr.php, and pr.php lan­guage files. We have been unable to divine the cause. We have reported the false pos­i­tives to Avira and pro­vided them with a copy of the files.

    Avira’s review of the faslse pos­i­tives may be viewed here.

    We have also tested the files in AVG, and are happy to report no false pos­i­tives with their anti-​​virus solution.

  2. From your arti­cle I def­i­nitely think that PHP typog­ra­phy sounds great. I will down­load it, try it and will con­tact you after that.

    Web­de­sign Stuttgart

  3. Does the hyphen­ation pro­vide an excep­tion for cap­i­tal­ized words? I love the Hyphen­ate plu­gin, but pro­tect­ing proper nouns is essen­tial for many pub­li­ca­tions, so I can’t use it if I can’t fil­ter cap­i­tal­ized words.

  4. @Stephen Coles #24

    A new method set_hyphenate_title_case() was added to ver­sion 1.5 to meet your need.

  5. The new WP-​​MU beta plu­gin is great news. I tried it out, and this time it actu­ally works under MU as well. Or at least, I can change the hyphen­ation lan­guage this time…

    BTW: A ter­rific fea­ture would be if the default hyphen­ation lan­guage would be the same as the blog lan­guage. Even more so on a MU site, when I acti­vate that plu­gin for all blogs. And how would you deal with a mul­ti­lan­guage blog? Most of the blogs on my MU install are ger­man, some of them eng­lish, and a few are multi-​​language (ger­man, eng­lish, french, maybe ital­ian, take your choice — the last three are offi­cial lan­guages within Switzer­land), where the user can switch to his favorite lan­guage on-​​the-​​fly.

    Thanks a lot for a won­der­ful plu­gin!
     — Daniel

  6. Hi,

    the typog­ra­phy plu­gin is really great. It just hap­pens to make a mis­take with dates writ­ten in ISO for­mat, e.g. “2009 – 08-​​02″. In these, the first hyphen is enlarged, the sec­ond is not. The whole date looks quite gar­bled. Per­haps you can fix that in some new release? Apart from this, the pro­duced out­put is really nice and improves the “usage expe­ri­ence” of “the aver­age blog” quite con­sid­er­ably. Thank you!

    Best regards,

  7. @Dirk Hill­brecht #5

    Thank you for bring­ing this issue to my atten­tion. It has been cor­rected in ver­sion 1.8

  8. …just installed 1.8 and date for­mat­ting now works mar­vel­lous. Thanks again for this great piece of soft­ware! Dirk

  9. There seems to be bug in style_​initial_​quotes(). All 3 mb_​substr() there are with­out encod­ing para­me­ter. Only after adding “UTF-​​8″ it works.

  10. While inte­grat­ing this with my project (run­ning on Kohana VO3) I ran into some prob­lems. It works great until it finds any tags, classes, or IDs set to ignore. I’m not sure what the prob­lem is, but when I try to add any­thing that is listed in the settings[“ignoreTags”], settings[“ignoreClasses”], or settings[“ignoreIDs”] arrays of the php­Ty­pog­ra­phy class, I get an error that says the following:

    ErrorEx­cep­tion [ Notice ]: Unde­fined index: openPos.

  11. @Priit Pirita #8 & Bill # 9,

    Both your issues should be resolved in the new ver­sion 1.19 release.

  12. I found a bug in ver­sion 1.19: on line 1950, $encod­ings is used with­out being ini­tial­ized. Oth­er­wise, works great!

  13. @Erik Spann #12

    Thanks for point­ing this out. I have updated this post with a link.

  14. @Andrew Hutch­ings #11

    Thank you for point­ing this out. It will be addressed in ver­sion 1.20.

  15. Hi,

    Is it pos­si­ble to add two replace­ment pos­si­bil­i­ties : the strait quote to the curly one in any case; and the punc­tu­a­tion replacement.

    The punc­tu­a­tion replace­ment has its inter­est with french lan­guage, where dou­ble punc­tu­a­tion signs (as “;”, “:”, “?” or “!”) must be pre­ceded by an inse­ca­ble space.

    Thanks for your essen­tial wp plu­gin and this php library.

  16. Hi Jeff,

    Found a bug in ver­sion 1.20. php-typography.php, line 412, $cus­tom­Re­place­mentChunks is not ini­tial­ized. From your inden­ta­tion it looks like most of the func­tion is sup­posed to be wrapped in the if state­ment, but you left out the curly brackets.

  17. @Jenny #16

    Yeah, that is some of the ugli­est code I have writ­ten. I fixed it in ver­sion 1.21 about a week ago, but haven’t got to post­ing it yet. I will try to get it up today.

  18. @Jenny #16

    Finally got around to post­ing 1.21. your issue should be resolved.

  19. This looks inter­est­ing. I’d writ­ten my own ‘typog­ra­phy engine’, but this it prob­a­bly bet­ter made than mine. Going to com­pare fea­tures. Keep up the good work.

  20. great tool!!!

  21. Wow. Just knew PHP Typog­ra­phy as WordPress-​​Plugin, inte­grated it in http://​www​.kikidu​.de and it works – fan­tas­tic! Thanks for your great efforts!

  22. +1 Ghusse

    Does it replace the space in these par­tic­u­lar cases* with alt+0160?
    *”Le code typographique français recom­mande, con­traire­ment à d’autres langues telles que l’anglais, une espace insé­ca­ble devant les signes de ponc­tu­a­tion dou­bles (point-​​virgule, deux-​​points, point d’interrogation, point d’exclamation), entre les guillemets et le texte qu’ils ren­fer­ment, ainsi que comme sépara­teur des groupes de car­ac­tères (sépara­teur de groupes de 3 chiffres dans les nom­bres supérieurs au mil­lier, sépara­teur sans valeur facil­i­tant la lec­ture des numéros de télé­phone ou des numéros et codes d’identification, etc.).”

    No-​​break thin space, known in Uni­code as “NARROW NO-​​BREAK SPACE” (U+202F). This is required for French punc­tu­a­tion (before ?, !, : or ;).

  23. and “espace fine insé­ca­ble : &#x202F”

  24. Love the poten­tial of your tools, and would love them more if you could make them a bit more acces­si­ble for those of us who haven’t made it to the 500 level. But whether or not I man­age to imple­ment your mod­ules, I truly appre­ci­ate your sim­ply offer­ing the code (because proper quotes matter).

    The fol­low­ing are notions from my trainer/​tech writer side, in case any resonate:

    - A clear “What it affects and what it shouldn’t man­gle” for those who can’t read PHP like Eng­lish, don’t nec­es­sar­ily have time to exper­i­ment, and get strangely twitchy about unknown per­va­sive code ;-)

    - Examples/​recipes/​snippets – even with­out com­ments some­thing real is so use­ful vs. try­ing to grok a mod­ule as theory.

    - HTML or PDF addi­tion to the cur­rent docs for absorb­ing big pic­tures from gen­eral con­cepts (hyphen­ation, frac­tions), rather than small bites from known terms (set_​dewidow).

    - Could you add to http://​king​desk​.com/​p​r​o​j​e​c​t​s​/​p​h​p​-​t​y​p​o​g​r​a​p​h​y​-​d​o​c​u​m​e​n​t​a​t​i​on/ a set of String/​Action/​etc. links? Or maybe turn it into a table indi­cat­ing what’s what? Took me a cou­ple min­utes to real­ize there were 2+ des­ti­na­tion pages :-)

    - In the func­tion ref­er­ence, a cou­ple instances of the code boxes such as for “set_​​tags_​​to_​​ignore()” seem to crop on print. Right now I think that info is rel­a­tively minor, but just wanted to men­tion for future writ­ing or style updates. (Keep see­ing some great wrapped #ed line for­mats on blogs – must be a plu­gin or JS framework?)

  25. I was try­ing to use this with -moz-column-count & -webkit-column-count and it doesn’t seem to make any dif­fer­ence. Is there a way to make it work with columns? Thanks!

  26. Thanks for an excel­lent piece of soft­ware! I have a few com­ments based on my expe­ri­ence of it in Word­Press which I’d like to share.

    With ref­er­ence to what I’ve read in “The Oxford Guide to Style” and “The Ele­ments of Typo­graphic Style”, I’ve always under­stood that there is a choice between using spaced en dashes (e.g., “nearly – but not quite!”) or close-​​set em dashes (e.g., “nearly — but not quite!”) between words. Most US pub­lish­ers adopt the lat­ter, most UK pub­lish­ers the for­mer. I would like to see a choice between these styles in PHP Typog­ra­phy, which cur­rently uses a rather uncon­ven­tial style – spaced em dashes.

    Sim­i­larly, with numer­i­cal ranges (e.g., “1950 – 1953″), the accepted form is close-​​set en dashes, but in this instance PHP Typog­ra­phy uses spaced en dashes. Could this also have its own option?

    Thanks again.

  27. I’ve just realised the soft­ware has for­mat­ted the exam­ples in my pre­vi­ous com­ment so the points I’m mak­ing aren’t ter­ri­bly clear, but I hope it still makes sense nevertheless.

  28. Hello,

    Has any­one tried using this plug-​​in to hyphen­ate text returned by Flut­ter? In case any­one has please post how you got it working.

    Thank you!

  29. Hi,

    is it pos­si­ble to con­fig­ure php­Ty­pog­ra­phy to return HTML enti­ties instead of encoded UTF-​​8 characters?

  30. Thank you very much. You saved me a lot of work. There are some bugs in pol­ish lan­guage, but still script works very good.

  31. Hey there!

    This library is pretty cool, but there’s one thing I noticed: if you end your quote with a digit it is con­sid­ered as a inch symbol.

    eg. This is a “test 23″.

    Hope you can fix that!

  32. This is nice but it is very slow (in the mean­ing of uses a lot of cpu). Did you ever thought about add some caching?

  33. Here is a Joomla plu­gin based on PHP-​​typography: http://​exten​sions​.joomla​.org/​e​x​t​e​n​s​i​o​n​s​/​s​t​y​l​e​-​a​-​d​e​s​i​g​n​/​t​y​p​o​g​r​a​p​h​y​/​1​8​823 Now Joomla fans can have nice typog­ra­phy too. Many thanks to King­Desk for the orig­i­nal script.

  34. I need help with people’s names. I have inter­na­tional web­site and there are span­ish, finnish peo­ple whose names have dia­crit­i­cal marks. Those let­ters just dis­ap­pear once they leave com­ment. I am work­ing in word­press. any help is welcome.

  35. ok it was font…

  36. Great tool. But I dis­cov­ered (maybe) one bug with “set_​unit_​spacing”. Look what is hap­pen­ing here:
    …16 s¶or maybe 6¶s is the dif­fer­ence…
    or …0,58¶cm diam­e­ter vs. 2,4 m¶in length…
    See what I want to say? While using sin­gle let­ter SI units (like m, s…) the ¶ (stand­ing for nbsp) is appended but should be inserted. And it’s always fine with dig­its < 10.

  37. Hi!

    I use php­Ty­pog­ra­phy and I have an issue: in some of my doc­u­ments (blog related things), my blog engine have Dublin Core meta­datas wrapped in CDATA thing (here’s one exam­ple: http://​paste​bin​.com/​U​4​c​p​Y​8Ca).

    php­Ty­pog­ra­phy mess the first char­ac­ters, trans­form­ing the pre­vi­ous exam­ple into this: http://​paste​bin​.com/​N​D​g​B​p​3Zp.

    Those things are in the mid­dle of the page, not in any tags that I would like to exclude from php­Ty­pog­ra­phy pro­cess­ing (as I try to make a dis­tribuable plu­gin for the Dot­clear blog engine, I can’t just solve the issue on my site by adding a html tag for this pur­pose and then exclud­ing this tag from processing).

    Dis­abling the CAPS wrap­ping fea­ture doesn’t help, the > and < are still get­ting converted.

    Any fix for this?

    (Sorry for eng­lish, not my native language.)

  38. Because the sup­port for the new CSS hyphens: auto func­tion­al­ity is still limeted this is a life-​​safer, I’m so glad I found this!

  39. Hi guys i can’t con­fig­ure the plug-​​in can you help me?

  40. i try to down­load plu­gin but don’t start down­load can help me?

  41. great plu­gin, thanks for share!

  42. Hi,

    Upgraded to a more recent php 5.3 version:

    PHP Notice: Array to string con­ver­sion in php-typography.php on line 1377


  43. php-​​pagination-​​class-​​more-​​advanced

    debug =$debug;

    ##default Limit
    $this->limit =20;

    ## Set default css classes.
    $this->classFirstPage =’first-​​page’;
    $this->classLastPage =’last-​​page’;
    $this->classNumbers =’numbers-​​page’;
    $this->classNextPage =’next-​​page’;
    $this->classPrevPage =’prev-​​page’;
    $this->classCurrentPage =’current-​​page’;

    ## Set default link (pages ) texts.
    $this->txtFirstPage =’First’;
    $this->txtLastPage =’Last’;
    $this->txtCurrentPage =‘[cur­rent] of [last] ‘;
    $this->txtNextPage =’Next’;
    $this->txtPrevPage =’Previous’;

    /​/​ Set default url/​tag
    $this->base_url =’http://’.$_SERVER[“SERVER_NAME”].$_SERVER[“REQUEST_URI”];
    $this->page_tag =’p=’;// Set get var for pages: page– , Page etc.{ page-1,Page1}

    $this->page =’1′; /​/​ cur­rent page.
    $this->total_items =false;
    $this->max_pages =false;

    # how many (num­ber) links on page ? ( 1 t/​m 10 == 10 )
    # set default @ 10.
    $this->links_on_page =10;


    /​* =====================================================================================

    Set­ting /​Overwriting needed variables.


    Over­write default limit

    pub­lic func­tion setLimit ( $limit ){

    $this->limit =$limit;

    Set cur­rent page
    pub­lic func­tion set­Page ( $page =1 ){

    $this->page =$page;


    Set total items/​rows
    pub­lic func­tion set­To­tal­Items ( $total ){

    $this->total_items =$total;


    Over­write default base_​url

    pub­lic func­tion set­BaseUrl( $url ){

    $this->base_url =$url;


    Over­write default page tag
    e.g. : p= /​ page– /​ Page
    Exam­ple url:

    pub­lic func­tion set­Page­Tag( $tag ){

    $this->page_tag =$tag;


    Over­write default links per page
    Default =10;
    Num­ber of links , 1 t/​m 10 pages = 10

    pub­lic func­tion setLinksOn­Page( $number ){

    $this->links_on_page =$number;


    Set max_​pages,


    pri­vate func­tion setMaxPages (){

    if( $this->max_pages )
    return false;

    $this->max_pages =ceil($this->total_items /​ $this->limit );


    /​* =====================================================================================

    Func­tion cre­at­ing the actual links


    Check needed Vars to Proceed.

    pri­vate func­tion checkVars(){

    if( $this->limit notice(__METHOD__.’ Limit is set below 1 item per/​page.’ );
    return false;

    if( $this->total_items notice(__METHOD__.’ Not enough Items/​Rows To out­put pages’ );
    return false;


    if( $this->total_items limit ){
    $this->notice(__METHOD__.’ Not enough Items/​Rows To out­put pages’ );
    return false;


    ## reset appended classes.
    $this->classAppended =false;

    return true;


    Cre­ate page Url

    pri­vate func­tion cre­a­teUrl( $page ){

    $url =’ERROR_​RUN_​DEBUG’;

    ## is the baseUrl valid ?
    if( !preg_match(‘/www|http/i’,$this->base_url) )
    $this->notice(” BASE_​URL not valid ! “. $this->base_url);

    ##page tag present?
    if( !$this->page_tag )
    $this->notice(” PAGE TAG nog valid ! “);

    ## cur­rent page present?
    if( !$page )
    $this->notice(__METHOD__.” PAGE not valid ! “);

    ## GET var or Mod Rewrite Url ( /​page1/​ ) ?
    # rewrite url with needed link page.
    if( preg_match(‘/=/’,$this->page_tag ) ){
    $url =preg_replace(‘/(\?|&)?’.$this->page_tag.’\d{1,100}/’,”,$this->base_url );
    if( preg_match(‘/=/’,$url) )
    $url =$url.’&’.$this->page_tag.$page;
    $url =$url.’?’.$this->page_tag.$page;
    ## mod rewrite pages.
    ## Not very good , need to rewrite it with a bet­ter func­tion.
    if( preg_match(‘/’.str_replace(‘/’,’\/’,$this->page_tag).’/i’,$this->base_url ) )
    $url =preg_replace(‘/’.str_replace(‘/’,’\/’,$this->page_tag).’\d{1,100}/’,’$1′.$this->page_tag.$page,$this->base_url );
    $url =$this->base_url.$;

    return $url;


    Cre­ate Href link

    pri­vate func­tion cre­ateLink( $url , $class, $txt ‚$selected ){

    $link =’‘;
    $link .=’class=”‘.$class.’ ‘.$this->classSelected.’” >’;
    $link .=$txt;
    $link .=’

    return $link;


    /​* =====================================================================================

    Ren­der­ing Pages links.


    First Page.

    pub­lic func­tion ren­der­First(){
    if( !$this->checkVars() )
    return false;

    if( $this->page ==1 )
    $this->classAppended =true;

    ##cre­ate && return link
    return $this->createLink( $this->createUrl( 1 ),
    $this->classAppended );


    Last Page.

    pub­lic func­tion ren­der­Last(){
    if( !$this->checkVars() )
    return false;

    ## set max pages ( if not already set).

    #selected ?
    if( $this->page == $max_​pages )
    $this->classAppended =true;

    ##cre­ate && return link
    return $this->createLink( $this->createUrl( $this->max_pages ),
    $this->classAppended );


    Next page

    pub­lic func­tion ren­derNext(){
    if( !$this->checkVars() )
    return false;

    ## set max pages ( if not already set).

    ##cre­ate && return link
    if ($this->page max_​pages )
    return $this->createLink( $this->createUrl( $this->page +1 ),
    false );

    return false;


    Pre­vous page

    pub­lic func­tion ren­der­Prev(){
    if( !$this->checkVars() )
    return false;

    ##cre­ate && return link
    if ($this->page > 1 )
    return $this->createLink( $this->createUrl( $this->page –1 ),
    false );

    return false;


    Ren­der num­ber pages

    pub­lic func­tion renderNumbers(){

    if( !$this->checkVars() )
    return false;

    ## check if num­ber of links is valid
    if ( $this->links_on_page setMaxPages();

    ## Cac­u­late pages for links.
    $split =ceil( $this->links_on_page /​ 2 );
    $start =$this->page – $split;
    $end =$this->page + $split;
    if( $start $this->max_pages ){

    $batch = ceil( $this->page /​ $this->links_on_page );
    $end = $batch * $this->links_on_page;
    if( $end > $this->max_pages )
    $end =$this->max_pages;

    $start =( $end – $this->links_on_page ) +1;
    if( $start < 1 )
    $start =1;

    ##Loop and cre­ate links.
    $links =”;

    for($i = $start; $i page )
    $links .=$this->createLink( $this->createUrl( $i ),

    ## cre­ate num­bers
    $links .=$this->createLink( $this->createUrl( $i ),


    if(strlen($links) > 0 )
    return $links;
    return false;


    Cre­ate spe­cial Text for cur­rent page on num­ber links

    exam­ple :
    cur­rent page = 1 && total pages = 10
    out­put = 1 of 10 ( on default $this->txtCurrentPage )

    pri­vate func­tion cur­rent­Name (){
    $link_​name =”;

    ## set max pages ( if not already set).

    #replace [cur­rent] with cur­rent page.
    $link_​name =preg_replace(‘/\[current\]/i’,$this->page,$this->txtCurrentPage);

    #replace [last] with total pages
    $link_​name =preg_replace(‘/\[last\]/i’,$this->max_pages,$link_name);

    return $link_​name;

    Ren­der com­plete page set.
    @param pre­fix : wrap­per around page link ele­ments.
    @param suf­fix : end wrap­per tag.
    @param num­bers : show num­bers ?
    @param first_​last : show first/​next ?


    pub­lic func­tion ren­der­Page­Set( $pre­fix =”, $suf­fix=”, $numbers=true , $first_​last =true ){

    if( !$this->checkVars() )
    return ”;

    $string =$prefix;

    # cre­ate first but­ton
    if( $first_​last )
    $string .=$this->renderFirst();

    # cre­ate pre­vi­ous but­ton
    $string .=$this->renderPrev();

    #cre­ate num­bers
    if( $num­bers )
    $string .=$this->renderNumbers();

    #cre­ate next but­ton
    $string .=$this->renderNext();

    #cre­ate last but­ton.
    if( $first_​last )


    return $string;

    /​* =====================================================================================

    Over­writ­ing Default vari­ables [ classes/​ text ] links.


    Over­write defaults css Classes


    pub­lic func­tion set­Class­First­Page( $class ){

    $this->classFirstPage =$class;


    pub­lic func­tion set­Class­Last­Page( $class ){

    $this->classLastPage =$class;


    pub­lic func­tion set­Class­Num­bers( $class ){

    $this->classNumbers =$class;


    pub­lic func­tion set­Class­NextPage( $class ){

    $this->classNextPage =$class;


    pub­lic func­tion set­ClassPre­vPage( $class ){

    $this->classPrevPage =$class;


    pub­lic func­tion set­Class­Cur­rent­Page( $class ){

    $this->classCurrentPage =$class;


    ## will be appended to the classes above if selected.
    pub­lic func­tion set­Class­S­e­lected( $class ){

    $this->classSelected =$class;


    Over­write defaults link texts.


    pub­lic func­tion set­TxtFirst­Page( $txt ){

    $this->txtFirstPage =$txt;


    pub­lic func­tion set­Txt­Last­Page( $txt ){

    $this->txtLastPage =$txt;


    ## needs tags [cur­rent] && [last]
    ## Exam­ple : 23 of 100 Pages
    ## @param $txt = [cur­rent] of [last] Pages

    pub­lic func­tion set­TxtCur­rent­Page( $txt ){

    if( !preg_match(‘/\[current\]/i’,$txt) )
    $this->notice(__METHOD__.’ NEED [cur­rent] TAG in text’);

    if( !preg_match(‘/\[last\]/i’,$txt) )
    $this->notice(__METHOD__.’ NEED [last] TAG in text’);

    $this->txtCurrentPage =$txt;


    pub­lic func­tion set­TxtNextPage( $txt ){

    $this->txtNextPage =$txt;


    pub­lic func­tion set­TxtPre­vPage( $txt ){

    $this->txtPrevPage =$txt;


    Notice debug.
    pub­lic func­tion notice ( $msg ){
    if( !$this->debug )
    return false;

    echo ”;
    echo $msg;
    echo ”;




Leave a Comment

Please note our comment and privacy policies.



  1. […] here: PHP Typog­ra­phy 1.0 beta 4 • KING­desk Share and […]

  2. […] A script named php-​​typography (Also avail­able in a word­press plu­gin) enables more advanced type­set­ting options. Some […]

  3. […] wp-​​Typography ist­nieje także jako zwykły kod PHP, który można przys­tosować do włas­nych potrzeb (np. w innych niż Word­Press CMS-​​ach). Szczegółowe infor­ma­cje na ten temat dostępne są na stronie inter­ne­towej autora (PHP Typography). […]

  4. […] sagen wäre: die Auto­ren stel­len die Funk­tio­nen auch ohne Word­press zum Ein­bin­den in eigene PHP-​​Projekte zur Ver­fü­gung Diese Icons ver­lin­ken auf Book­mark Dien­ste bei denen Nut­zer neue Inhalte […]

  5. […] mas sim­ple con este plu­gin. wp-​​Typography es un proyecto de KING­desk y su código se basa en el PHP Typog­ra­phy. Al ser con­fig­u­rado como nos sea mas con­ve­niente, pro­cede a hacer reem­pla­zos automáti­cos de […]

  6. […] wp-​​Typography WP-​​Typography is one for all the type nerds out there. It adds hyphen­a­tion, spa­cing con­trol, intel­li­gent char­ac­ter replace­ment, and CSS hooks, all of which greatly improve the look and feel of your blog. At the moment I have the hyphen­a­tion, char­ac­ter replace­ment, and widow pre­ven­tion turned on. […]

  7. […] Ist halt lei­der schwierig wenn’s nicht nach den US-​​Regeln gehen soll. Pro­biert mal die von Kingdesk […]

  8. […] PHP Typog­ra­phy 1.12 que viene tam­bién como plu­gin para WordPress […]

  9. […] can eas­ily be ported to any other PHP based con­tent man­age­ment sys­tem. A sis­ter project — PHP Typog­ra­phy assem­bles all typo­graphic func­tion­al­ity (with­out any Word­Press spe­cific code) in an object oriented […]

  10. […] top right are now picked from all the images pos­ted so far. Finally, thanks to the won­der­ful php-​​​typography class the typo­graphy of the posts should be cleaner, and best of all: there’s now […]

  11. […] que “ty­po­gra­phie” né veut pas dire “choi­sir une po­lice”. Ai­dez vos clients à amé­lio­rer le rendu ty­po­gra­phique de leus conte­nus grâce à des lignes CSS, des plu­gins comme wp-​​typography ou des mo­dules PHP comme php-​​typography. […]

  12. […] given string or URL, gen­er­ate a descrip­tion and does all with not using any banned words you define.PHP Typog­ra­phyA PHP class for improv­ing web typog­ra­phy with fea­tures like hyphen­ation, spac­ing con­trol, wrapping […]

  13. […] PHP Typography […]

  14. […] PHP Typography […]

  15. […] PHP Typography […]

  16. […] PHP Typography […]

  17. […] PHP Typography […]

  18. […] wp-​​​Typography Wer­sja pol­ska — PO­BIERZ [1,1 MB] Wty­czka w re­po­zy­to­rium Word­Pressa Strona do­mowa Li­cencja FAQ PHP Typography […]

  19. […] fig­ured out how to plug PHP Typog­ra­phy into Sym­fony so I could ren­der my sen­tences with smart quotes and nice hyphen­ation. And learned a […]

  20. Обработка текстов разными типограферами…

    Для сравнения и проверки качества взял короткий, но показательный текст примера и прогнал через 3 (известных мне, их может существовать и больше) типографера. Результаты каждый может оценить самостоятельно, или по книгам (…

  21. […] Php-​​typography jest łatwy i wygodny w użyciu. […]

  22. […] PHP Typography […]

  23. […] php typo­gra­phy, une abs­trac­tion), suc­ces­seur de Typo­grify, est une excel­lente exten­sion pour […]

  24. […] PHP Typography […]

  25. […] PHP Typography […]

  26. […] PHP Typography […]

  27. […] hyphens (Uni­code: U+00AD, HTML: ­ or ­). This means, for any­one using the good old PHP Typog­ra­phy tool or its Word­Press plu­gin equiv­a­lent, wp-​​typography, that you’re in trou­ble if you have […]