Class quotation (text, author…) or maxim (text, nation…). More...
Public Member Functions | |
__construct ($id, $text, $is_maxim=false, $is_marked=false, $translation=null, $subject=null, $nation_author=null, $work=null) | |
Construct a quotation/maxim. | |
author () | |
Return null or the author of the quotation. | |
id () | |
Return the id of the quotation/maxim. | |
is_maxim () | |
Return true if is a maxim (of a possibly nation), false if is a quotation (of a possibly author). | |
is_marked () | |
Return true if is a marked quotation/maxim, else false. | |
nation () | |
Return null or the nation of the maxim. | |
subject () | |
Return null or the subject of the quotation/maxim. | |
text () | |
Return the text of the quotation/maxim. | |
to_html ($search=null, $add_link=true, $link_target=null, $subject_tag='h2', $uneOPiCitation_link='uneOPiCitation.php') | |
Return the complete quotation/maxim in a HTML format. | |
to_text () | |
Return the quotation/maxim with its author/nation and work in text format (strip HTML tags <b>, <c>, <i>, <sub>, <sup> and special character ¨ (diaeresis, U+00A8)). | |
to_text_facebook ($url='') | |
Return the quotation/maxim with its author/nation and work in text format to post to Facebook. | |
to_text_twitter ($url=null, $short_url_length=null, $max_length=140) | |
Return the quotation/maxim with its author/nation and work in short text format to post to Twitter. | |
translation () | |
Return null or the translation of the quotation/maxim. | |
work () | |
Return null or the work of the quotation. |
Protected Attributes | |
$author | |
null or the author of the quotation if is a quotation, else null. | |
$id | |
The id of the quotation/maxim (must be > 0). | |
$is_marked | |
true if marked quotation/maxim, else false. | |
$is_maxim | |
true if maxim (of a possibly nation), false if quotation (of an possibly author) | |
$nation | |
null or the nation of the maxim if is a maxim, else null. | |
$subject | |
null or the subject of the quotation/maxim. | |
$text | |
Text of the quotation/maxim. | |
$translation | |
null or the translation of the quotation/maxim. | |
$work | |
null or the work of the quotation if is a quotation, else null. |
Static Private Member Functions | |
static | _format_correct_html ($s) |
Return $s formatted in HTML to be displayed. | |
static | _highlight_html ($s, $search=null) |
If $search !== null then each occurence of $search is surrounded by '<span class="highlight">' and '</span>'. |
Class quotation (text, author…) or maxim (text, nation…).
Definition at line 24 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::__construct | ( | $id, | |
$text, | |||
$is_maxim = false , |
|||
$is_marked = false , |
|||
$translation = null , |
|||
$subject = null , |
|||
$nation_author = null , |
|||
$work = null |
|||
) |
Construct a quotation/maxim.
See to_html().
int | $id | Id of the quotation (must be > 0) |
string | $text | Text of the quotation (should not contain '@@@#' and '#@@@') |
bool | $is_maxim | true if maxim (of a possibly nation), false if quotation (of an possibly author) |
bool | $is_marked | true if marked quotation/maxim, else false |
null | string | $translation | Possibly translation of the text (should not contain '@@@#' and '#@@@') |
null | string | $subject | Possibly subject |
null | string | $nation_author | Possibly nation if maxim, else possibly author |
null | string | $work | Possibly work if quotation (must be null if $is_maxim) |
Definition at line 40 of file OPiQuotation.inc.
References $text.
|
staticprivate |
Return $s formatted in HTML to be displayed.
string | $s | (should not contain '@@@#' and '#@@@') |
Definition at line 90 of file OPiQuotation.inc.
|
staticprivate |
If $search !== null then each occurence of $search is surrounded by '<span class="highlight">' and '</span>'.
string | $s | |
null | string | $search |
Definition at line 143 of file OPiQuotation.inc.
References $search.
OPiQuotations\OPiQuotation::author | ( | ) |
Return null or the author of the quotation.
Definition at line 174 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::id | ( | ) |
Return the id of the quotation/maxim.
Definition at line 187 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::is_marked | ( | ) |
Return true if is a marked quotation/maxim, else false.
Definition at line 211 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::is_maxim | ( | ) |
Return true if is a maxim (of a possibly nation), false if is a quotation (of a possibly author).
Definition at line 199 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::nation | ( | ) |
Return null or the nation of the maxim.
Definition at line 222 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::subject | ( | ) |
Return null or the subject of the quotation/maxim.
Definition at line 235 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::text | ( | ) |
Return the text of the quotation/maxim.
Definition at line 246 of file OPiQuotation.inc.
References $text.
OPiQuotations\OPiQuotation::to_html | ( | $search = null , |
|
$add_link = true , |
|||
$link_target = null , |
|||
$subject_tag = 'h2' , |
|||
$uneOPiCitation_link = 'uneOPiCitation.php' |
|||
) |
Return the complete quotation/maxim in a HTML format.
Layout - for a quotation: @code
id subject (mark) text | translation author work *
In text and translation:
If $search !== null then each occurence of $search founded is surrounded by '<span class="highlight">' and '</span>'.
If $add_link then add links to id, subject, nation, author and work.
If $link_target then add a target attribut to each link.
The subject is surrounded by $subject_tag.
$uneOPiCitation_link is use to the external id link.
null | string | $search | |
bool | $add_link | |
null | string | $link_target | |
string | $subject_tag | |
string | $uneOPiCitation_link |
Definition at line 299 of file OPiQuotation.inc.
References $search.
OPiQuotations\OPiQuotation::to_text | ( | ) |
Return the quotation/maxim with its author/nation and work in text format (strip HTML tags <b>, <c>, <i>, <sub>, <sup> and special character ¨ (diaeresis, U+00A8)).
Definition at line 410 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::to_text_facebook | ( | $url = '' | ) |
Return the quotation/maxim with its author/nation and work in text format to post to Facebook.
If url !== '' then add url to the end on a newline.
string | $url |
Definition at line 458 of file OPiQuotation.inc.
References $url.
OPiQuotations\OPiQuotation::to_text_twitter | ( | $url = null , |
|
$short_url_length = null , |
|||
$max_length = 140 |
|||
) |
Return the quotation/maxim with its author/nation and work in short text format to post to Twitter.
If a cutting is required then reduce contiguous whitespaces.
Cut the result to not be longer than $max_length characters. See https://dev.twitter.com/docs/tco-link-wrapper/faq#How_do_I_calculate_if_a_Tweet_with_a_link_is_going_to_be_over_140_characters_or_not
If url !== null then add url to the end on a newline.
If $short_url_length === null then use the real length of the url, else assume that the url will be replaced by a short url not be longer than $short_url_length.
null | string | $url | |
null | int | $short_url_length | |
int | $max_length | (must be > 0) |
Definition at line 498 of file OPiQuotation.inc.
References $max_length, $short_url_length, $url, and OPiQuotations\text_cut().
OPiQuotations\OPiQuotation::translation | ( | ) |
Return null or the translation of the quotation/maxim.
Definition at line 529 of file OPiQuotation.inc.
OPiQuotations\OPiQuotation::work | ( | ) |
Return null or the work of the quotation.
Definition at line 540 of file OPiQuotation.inc.
|
protected |
null or the author of the quotation if is a quotation, else null.
Definition at line 553 of file OPiQuotation.inc.
|
protected |
The id of the quotation/maxim (must be > 0).
Definition at line 559 of file OPiQuotation.inc.
|
protected |
true if marked quotation/maxim, else false.
Definition at line 566 of file OPiQuotation.inc.
|
protected |
true if maxim (of a possibly nation), false if quotation (of an possibly author)
Definition at line 573 of file OPiQuotation.inc.
|
protected |
null or the nation of the maxim if is a maxim, else null.
Definition at line 580 of file OPiQuotation.inc.
|
protected |
null or the subject of the quotation/maxim.
Definition at line 586 of file OPiQuotation.inc.
|
protected |
Text of the quotation/maxim.
Maybe contains some HTML tags (see __construct()).
Definition at line 595 of file OPiQuotation.inc.
|
protected |
null or the translation of the quotation/maxim.
Maybe contains some HTML tags (see __construct()).
Definition at line 604 of file OPiQuotation.inc.
|
protected |
null or the work of the quotation if is a quotation, else null.
Definition at line 611 of file OPiQuotation.inc.