class csl_if in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_if
- 7.2 modules/CiteProc/CSL.inc \csl_if
Hierarchy
- class \csl_collection
- class \csl_element
- class \csl_rendering_element
- class \csl_if
- class \csl_rendering_element
- class \csl_element
Expanded class hierarchy of csl_if
File
- modules/
CiteProc/ CSL.inc, line 1927 - CiteProc-PHP.
View source
class csl_if extends csl_rendering_element {
/**
*
*/
public function evaluate($data) {
$match = ($match = $this->match) ? $match : 'all';
if ($types = $this->type) {
$types = explode(' ', $types);
$matches = 0;
foreach ($types as $type) {
if (isset($data->biblio_type)) {
if ($data->biblio_type == $type && $match == 'any') {
return TRUE;
}
if ($data->biblio_type != $type && $match == 'all') {
return FALSE;
}
if ($data->biblio_type == $type) {
$matches++;
}
}
}
if ($match == 'all' && $matches == count($types)) {
return TRUE;
}
if ($match == 'none' && $matches == 0) {
return TRUE;
}
return FALSE;
}
if ($variables = $this->variable) {
$variables = explode(' ', $variables);
$matches = 0;
foreach ($variables as $var) {
if (isset($data->{$var}) && !empty($data->{$var}) && $match == 'any') {
return TRUE;
}
if ((!isset($data->{$var}) || empty($data->{$var})) && $match == 'all') {
return FALSE;
}
if (isset($data->{$var}) && !empty($data->{$var})) {
$matches++;
}
}
if ($match == 'all' && $matches == count($variables)) {
return TRUE;
}
if ($match == 'none' && $matches == 0) {
return TRUE;
}
return FALSE;
}
if ($is_numeric = $this->{'is-numeric'}) {
$variables = explode(' ', $is_numeric);
$matches = 0;
foreach ($variables as $var) {
if (isset($data->{$var})) {
if (is_numeric($data->{$var}) && $match == 'any') {
return TRUE;
}
if (!is_numeric($data->{$var})) {
if (preg_match('/(?:^\\d+|\\d+$)/', $data->{$var})) {
$matches++;
}
elseif ($match == 'all') {
return FALSE;
}
}
if (is_numeric($data->{$var})) {
$matches++;
}
}
}
if ($match == 'all' && $matches == count($variables)) {
return TRUE;
}
if ($match == 'none' && $matches == 0) {
return TRUE;
}
return FALSE;
}
if (isset($this->locator)) {
$test = explode(' ', $this->type);
}
return FALSE;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
csl_collection:: |
protected | property | ||
csl_collection:: |
public | function | ||
csl_collection:: |
public | function | 1 | |
csl_element:: |
protected | property | ||
csl_element:: |
protected | property | ||
csl_element:: |
public | function | ||
csl_element:: |
public | function | ||
csl_element:: |
public | function | 5 | |
csl_element:: |
public | function | ||
csl_element:: |
public | function | ||
csl_element:: |
public | function | 2 | |
csl_element:: |
public | function | ||
csl_element:: |
public | function | ||
csl_element:: |
public | function | ||
csl_element:: |
public | function | ||
csl_if:: |
public | function | 1 | |
csl_rendering_element:: |
public | function |
Overrides csl_collection:: |
11 |