class csl_element in Bibliography Module 7
Same name and namespace in other branches
- 6.2 modules/CiteProc/CSL.inc \csl_element
- 7.2 modules/CiteProc/CSL.inc \csl_element
Hierarchy
- class \csl_collection
- class \csl_element
Expanded class hierarchy of csl_element
File
- modules/
CiteProc/ CSL.inc, line 198 - CiteProc-PHP.
View source
class csl_element extends csl_collection {
protected $attributes = array();
protected $citeproc;
/**
*
*/
public function __construct($dom_node = NULL, $citeproc = NULL) {
$this->citeproc =& $citeproc;
$this
->set_attributes($dom_node);
$this
->init($dom_node, $citeproc);
}
/**
*
*/
public function init($dom_node, $citeproc) {
if (!$dom_node) {
return;
}
foreach ($dom_node->childNodes as $node) {
if ($node->nodeType == 1) {
$this
->add_element(csl_factory::create($node, $citeproc));
}
}
}
/**
*
*/
public function __set($name, $value) {
$this->attributes[$name] = $value;
}
/**
*
*/
public function __isset($name) {
return isset($this->attributes[$name]);
}
/**
*
*/
public function __unset($name) {
unset($this->attributes[$name]);
}
/**
*
*/
public function &__get($name = NULL) {
$null = NULL;
if (array_key_exists($name, $this->attributes)) {
return $this->attributes[$name];
}
if (isset($this->{$name})) {
return $this->{$name};
}
return $null;
}
/**
*
*/
public function set_attributes($dom_node) {
$att = array();
$element_name = $dom_node->nodeName;
if (isset($dom_node->attributes->length)) {
for ($i = 0; $i < $dom_node->attributes->length; $i++) {
$value = $dom_node->attributes
->item($i)->value;
$name = str_replace(' ', '_', $dom_node->attributes
->item($i)->name);
if ($name == 'type') {
$value = $this->citeproc
->map_type($value);
}
if (($name == 'variable' || $name == 'is-numeric') && $element_name != 'label') {
$value = $this->citeproc
->map_field($value);
}
$this->{$name} = $value;
}
}
}
/**
*
*/
public function get_attributes() {
return $this->attributes;
}
/**
*
*/
public function get_hier_attributes() {
$hier_attr = array();
$hier_names = array(
'and',
'delimiter-precedes-last',
'et-al-min',
'et-al-use-first',
'et-al-subsequent-min',
'et-al-subsequent-use-first',
'initialize-with',
'name-as-sort-order',
'sort-separator',
'name-form',
'name-delimiter',
'names-delimiter',
);
foreach ($hier_names as $name) {
if (isset($this->attributes[$name])) {
$hier_attr[$name] = $this->attributes[$name];
}
}
return $hier_attr;
}
/**
*
*/
public function name($name = NULL) {
if ($name) {
$this->name = $name;
}
else {
return str_replace(' ', '_', $this->name);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
csl_collection:: |
protected | property | ||
csl_collection:: |
public | function | ||
csl_collection:: |
public | function | 1 | |
csl_collection:: |
public | function | 2 | |
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 |