当前位置: 首页>>代码示例>>PHP>>正文


PHP unknown_type::getAttribute方法代码示例

本文整理汇总了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')));
     }
 }
开发者ID:limi58,项目名称:fetchJD,代码行数:30,代码来源:phpQueryObject.php

示例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) {
//.........这里部分代码省略.........
开发者ID:hogeh,项目名称:htraininglogs,代码行数:101,代码来源:gpsClass.php

示例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);
 }
开发者ID:nev3rm0re,项目名称:hondex,代码行数:9,代码来源:rb127lg.php

示例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') )
			);
		}
	}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:37,代码来源:phpQuery-onefile.php


注:本文中的unknown_type::getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。