本文整理汇总了PHP中unknown_type::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown_type::getAttribute方法的具体用法?PHP unknown_type::getAttribute怎么用?PHP unknown_type::getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown_type
的用法示例。
在下文中一共展示了unknown_type::getAttribute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: matchClasses
/**
* Enter description here...
*
* In the future, when PHP will support XLS 2.0, then we would do that this way:
* contains(tokenize(@class, '\s'), "something")
* @param unknown_type $class
* @param unknown_type $node
* @return boolean
* @access private
*/
protected function matchClasses($class, $node)
{
// multi-class
if (mb_strpos($class, '.', 1)) {
$classes = explode('.', substr($class, 1));
$classesCount = count($classes);
$nodeClasses = explode(' ', $node->getAttribute('class'));
$nodeClassesCount = count($nodeClasses);
if ($classesCount > $nodeClassesCount) {
return false;
}
$diff = count(array_diff($classes, $nodeClasses));
if (!$diff) {
return true;
}
// single-class
} else {
return in_array(substr($class, 1), explode(' ', $node->getAttribute('class')));
}
}
示例2: extractCoordsGPX
/**
* function_description
*
* @param unknown_type $xmlcontents XMLreader object
*
* @return return_description
*/
private function extractCoordsGPX($xmlcontents)
{
$this->trackname = '';
$this->trackCount = 0;
// Iterate nodes
$countElements = 0;
$i_wpt = 0;
$i_trk = 0;
$wp = array();
$this->trackCount = 0;
while ($xmlcontents->read()) {
// Check to ensure nodeType is an Element not attribute or #Text
if ($xmlcontents->nodeType == XMLReader::ELEMENT) {
// Start element found
$currentElement = $xmlcontents->localName;
$endElement = '';
$countElements++;
switch ($currentElement) {
case 'time':
// GPS file Time
$xmlcontents->read();
$time = $xmlcontents->value;
$dt = new DateTime($time);
$this->Date = $dt->format('Y-m-d');
// Read end tag
$xmlcontents->read();
break;
case 'wpt':
$wp[] = (array) $xmlcontents->readInnerXML();
$i_wpt++;
$this->wps[$i_wpt] = new WpClass();
$lat = (double) $xmlcontents->getAttribute('lat');
$lon = (double) $xmlcontents->getAttribute('lon');
$this->wps[$i_wpt]->sym = 'wp';
$this->wps[$i_wpt]->lat = $lat;
$this->wps[$i_wpt]->lon = $lon;
if ($lat > $this->bbox_lat_max) {
$this->bbox_lat_max = $lat;
}
if ($lat < $this->bbox_lat_min) {
$this->bbox_lat_min = $lat;
}
if ($lon > $this->bbox_lon_max) {
$this->bbox_lon_max = $lon;
}
if ($lon < $this->bbox_lon_min) {
$this->bbox_lon_min = $lon;
}
$endWptElement = false;
while (!$endWptElement) {
$xmlcontents->read();
if ($xmlcontents->nodeType == XMLReader::END_ELEMENT) {
$endWptElement = $xmlcontents->localName == 'wpt';
} else {
$endWptElement = false;
}
// Extract wpt data
if ($xmlcontents->nodeType == XMLReader::ELEMENT) {
$key = $xmlcontents->localName;
$xmlcontents->read();
$value = $xmlcontents->value;
$this->wps[$i_wpt]->{$key} = $value;
$xmlcontents->read();
}
}
break;
case 'trk':
// Track
$trackname = '';
$i_trk++;
while ('trk' !== $endElement) {
$xmlcontents->read();
if ($xmlcontents->nodeType == XMLReader::END_ELEMENT) {
// </xxx> found
$endElement = $xmlcontents->localName;
} else {
$endElement = '';
}
// Extract trk data
if ($xmlcontents->name == 'name' and $xmlcontents->nodeType == XMLReader::ELEMENT) {
$xmlcontents->read();
$trackname = $xmlcontents->value;
// Read end tag
$xmlcontents->read();
} elseif ($xmlcontents->name == 'trkseg' and $xmlcontents->nodeType == XMLReader::ELEMENT) {
// Trkseg found
$endTrksegElement = false;
$coords = array();
//TODOTODO$trackname = '';
$i_trkpt = 0;
$ele = 0;
$time = '0';
while (!$endTrksegElement) {
//.........这里部分代码省略.........
示例3: getDatabaseVersion
/**
* Returns the version number of the database.
* @return mixed $version
*/
public function getDatabaseVersion()
{
$this->connect();
return $this->pdo->getAttribute(PDO::ATTR_CLIENT_VERSION);
}
示例4: matchClasses
/**
* Enter description here...
*
* In the future, when PHP will support XLS 2.0, then we would do that this way:
* contains(tokenize(@class, '\s'), "something")
* @param unknown_type $class
* @param unknown_type $node
* @return boolean
* @access private
*/
protected function matchClasses($class, $node) {
// multi-class
if ( mb_strpos($class, '.', 1)) {
$classes = explode('.', substr($class, 1));
$classesCount = count( $classes );
$nodeClasses = explode(' ', $node->getAttribute('class') );
$nodeClassesCount = count( $nodeClasses );
if ( $classesCount > $nodeClassesCount )
return false;
$diff = count(
array_diff(
$classes,
$nodeClasses
)
);
if (! $diff )
return true;
// single-class
} else {
return in_array(
// strip leading dot from class name
substr($class, 1),
// get classes for element as array
explode(' ', $node->getAttribute('class') )
);
}
}