initial commit
This commit is contained in:
commit
8eeedc3a3c
54 changed files with 179682 additions and 0 deletions
62
typography.php
Normal file
62
typography.php
Normal file
|
@ -0,0 +1,62 @@
|
|||
<?php
|
||||
/*
|
||||
* Name: Typography
|
||||
* Description: Applies typographical enhancements to the postings before displaying them
|
||||
* Version: 0.1
|
||||
* Author: Tobias Diekershoff <tobias@f.diekershoff.de>
|
||||
* License: GPL 2.0
|
||||
*/
|
||||
|
||||
function typography_install () {
|
||||
register_hook ('prepare_body', 'addon/typography/typography.php', 'typography_render' );
|
||||
}
|
||||
function typography_uninstall () {
|
||||
unregister_hook ('prepare_body', 'addon/typography/typography.php', 'typography_render' );
|
||||
}
|
||||
function typography_render ( &$a, &$o) {
|
||||
require_once('php-typography/php-typography.php');
|
||||
require_once('library/langdet/Text/LanguageDetect.php');
|
||||
$typo = new phpTypography();
|
||||
$lng_id = array(
|
||||
'hu',
|
||||
'is',
|
||||
'tr',
|
||||
'bg',
|
||||
'cs',
|
||||
'fi',
|
||||
'fr',
|
||||
'it',
|
||||
'ro',
|
||||
'es',
|
||||
'pt',
|
||||
'no',
|
||||
'ru',
|
||||
'sv',
|
||||
'pl',
|
||||
'en_GB',
|
||||
'de');
|
||||
$lng_long = array(
|
||||
'hungarian',
|
||||
'icelandic',
|
||||
'turkish',
|
||||
'bulgarian',
|
||||
'czech',
|
||||
'finnish',
|
||||
'french',
|
||||
'italian',
|
||||
'romanian',
|
||||
'spanish',
|
||||
'portuguese',
|
||||
'norwegian',
|
||||
'russian',
|
||||
'swedish',
|
||||
'polish',
|
||||
'english',
|
||||
'german');
|
||||
$l = new Text_LanguageDetect;
|
||||
$lng = $l->detectSimple($o['html']);
|
||||
$lng = str_replace( $lng_long, $lng_id, $lng);
|
||||
$typo->settings["diacriticLanguage"] = $lng;
|
||||
$o['html'] = $typo->process($o['html']);
|
||||
unset($l);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue