Before render callback. beforeRender is called before the view file is rendered.
Overridden in subclasses.
void
beforeRender
()
n回連続したダッシュを長いダッシュに変換します。
# 出力すると以下のようになります。
# ————
string
horizontal
(string $string, [integer $int = 2])
-
string
$string: 処理を行う文字列
-
integer
$int: 何回連続したダッシュを変換するのか
数学記号に変換します。
# 出力すると以下のようになります。
# Multiplication 100×100 Fraction <sup>1</sup>⁄<sub>2</sub>
string
mathCharacters
(string $string)
基本的にはnl2brと同じ処理をしますが特定の要素内での処理は除くことができます。
$typography->nl2brExcept("foo isn't\n bar\n\n<pre>\n pre Element\n</pre>");
# 出力すると以下のようになります。
# foo isn't<br />
# bar<br />
# <br />
# <pre>
# pre Element
# </pre>
string
nl2brExcept
(string $string, [array $except = array('pre')], [boolean $is_xhtml = true])
-
string
$string: 入力する文字列
-
array
$except: 処理を除く要素の配列
-
boolean
$is_xhtml: trueの場合はXHTMLに対応した<br />、falseの場合はHTMLに対応した<br>になります。
改行の前にリターン記号を追加します。
# 出力すると以下のようになります。
# foo↵
# bar
string
nl2carriageReturn
(string $string, [return $return = '↵'])
-
string
$string: 処理を行う文字列
-
return
$return: リターン記号
URLを正規化します。
$typography->normalizeUrl('hxxp URL ttp://example.com/ or hxxp://example.com/example/');
# 出力すると以下のようになります。
# hxxp URL http://example.com/ or http://example.com/example/
string
normalizeUrl
(string $string)
URLを正規化してリンクに変換します。
$typography->normalizeUrlLink('hxxp URL ttp://example.com/ or hxxp://example.com/example/', array('rel' =>
'nofollow'));
# 出力すると以下のようになります。
# hxxp URL <a href="http://example.com/" rel="nofollow">http://example.com/</a> or <a href="http://example.com/example/" rel="nofollow">http://example.com/example/</a>
string
normalizeUrlLink
(string $string, [array $options = array()])
-
string
$string: 処理を行う文字列
-
array
$options: Array of HTML options.
文字列を一行にし、2回以上連続するスペースを1つにします。
$typography->oneLine("oneLine Test.\r\nDouble Scrape and\tTab");
# 出力すると以下のようになります。
# oneLine Test. Double Scrape and Tab
string
oneLine
(string $string)
改行をp要素とbr要素に変換します。
2回以上連続する改行をp要素に変換します。単一の改行はbr要素に変換します。
$typography->paragraph("paragraph method Test\r\nbr Elements\r\n\r\np Elements\r\n\r\n\r\nend.");
# 出力すると以下のようになります。
# <p>paragraph method Test<br />
# br Elements</p><p>p Elements</p><p>end.</p>
string
paragraph
(string $string, [array $options = array()])
-
string
$string: 処理を行う文字列
-
array
$options: p要素のオプション
a要素内のURLを短くします。
echo
$typography->shortenUrl('The Aristotle <a href="http://ja.wikipedia.org/wiki/%E3%82%A2%E3%83%AA%E3%82%B9%E3%83%88%E3%83%86%E3%83%AC%E3%82%B9">http://ja.wikipedia.org/wiki/%E3%82%A2%E3%83%AA%E3%82%B9%E3%83%88%E3%83%86%E3%83%AC%E3%82%B9</a>', 30, '…');
# 出力すると以下のようになります。
# The Aristotle <a href="http://ja.wikipedia.org/wiki/%E3%82%A2%E3%83%AA%E3%82%B9%E3%83%88%E3%83%86%E3%83%AC%E3%82%B9">http://ja.wikipedia.org/wiki/%…</a>
string
shortenUrl
(string $string, [integer $length = 50], [string $ending = null])
-
string
$string: 入力する文字列
-
integer
$length: 何文字まで切り詰めるか
-
string
$ending: 切り詰めた後の文字列
一部の記述を記号文字へ変換します。
$typography->specialCharacters('Copyright (C) 2011 example.com All Rights Reserved.');
# 出力すると以下のようになります。
# Copyright © 2011 example.com All Rights Reserved.
string
specialCharacters
(string $string)
タブ文字をスペースに変換します。
# 出力すると以下のようになります。
# tabToScrape Test
string
tabToScrape
(string $string, [integer $multiplier = 4])
-
string
$string: 処理を行う文字列
-
integer
$multiplier: タブ文字をスペース何個分に変換するか
ASCI文字に変換します。
string
transliteration
(string $string)
改行やタブ文字などを消去します。
$typography->trim("<p>\r\nWelcome This is my HTML document\r\n</p>");
# 出力すると以下のようになります。
# <p>Welcome This is my HTML document</p>
string
trim
(string $string)
基本的にはtrimと同じ処理をしますが特定の要素内での処理は除くことができます。
$typography->trimExcept("<p>\r\nWelcome This is my HTML document\r\n</p>\r\n<pre>\r\n pre Element\r\n</pre>");
# 出力すると以下のようになります。
# <p>Welcome This is my HTML document</p><pre>
# pre Element
# </pre>
string
trimExcept
(string $string, [array $except = array('pre', 'script')])
-
string
$string: 入力する文字列
-
array
$except: 処理を除く要素の配列
2回以上連続するスペースとタブ文字を1つのスペースに変換します。
# 出力すると以下のようになります。
# Double Scrape and Tab
string
trimScrapes
(string $string)
単位記号に変換します。
# 出力すると以下のようになります。
# 100 ℓ 100℃ 100℃ № 100
string
unitCharacters
(string $string)
void
__replaceDecode
( $string)
void
__replaceEncode
( $string, [ $except = array()])