本文整理汇总了PHP中getAttribute函数的典型用法代码示例。如果您正苦于以下问题:PHP getAttribute函数的具体用法?PHP getAttribute怎么用?PHP getAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAttribute函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Pdo\Pdo||\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
* @return $this
*/
public function setDriver($driver)
{
if ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlite' || $driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlite') {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Sqlite PDO Zend\\Db\\Adapter\\Driver, Sqlite PDO instance');
}
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:13,代码来源:Sqlite.php
示例2: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Mysqli\Mysqli|\Zend\Db\Adapter\Driver\Pdo\Pdo||\mysqli|\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
* @return $this
*/
public function setDriver($driver)
{
// handle Zend\Db drivers
if ($driver instanceof Mysqli\Mysqli || $driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Mysql' || $driver instanceof \mysqli || $driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql') {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Mysqli or Mysql PDO Zend\\Db\\Adapter\\Driver, Mysqli instance or MySQL PDO instance');
}
开发者ID:tillk,项目名称:vufind,代码行数:14,代码来源:Mysql.php
示例3: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
* @return $this
*/
public function setDriver($driver)
{
// handle Zend\Db drivers
if ($driver instanceof Pdo\Pdo && in_array($driver->getDatabasePlatformName(), array('SqlServer', 'Dblib')) || $driver instanceof \PDO && in_array($driver->getAttribute(\PDO::ATTR_DRIVER_NAME), array('sqlsrv', 'dblib'))) {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
}
开发者ID:tillk,项目名称:vufind,代码行数:14,代码来源:SqlServer.php
示例4: process
function process($obj, $contents)
{
global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
// Get Image
$node_list = $obj->getElementsByTagName('img');
foreach ($node_list as $node) {
if (getAttribute($node, 'class') == 'img-right') {
$img_url = getAttribute($node, 'src');
}
}
// biology
$pattern = '/<h1>Biography<\\/h1>([^<]*)<div>([^<]*)<h2>([^<]*)<\\/h2>([^<]*)<p>([^<]*)<img ([^>]*)>([^<]*)<\\/p>/';
$matches = '';
$cnt = preg_match_all($pattern, $contents, $matches);
if ($cnt == 1) {
$biology = $matches[7][0];
} else {
// Add a <p> open tag next to image tag
$pattern = '/<h1>Biography<\\/h1>([^<]*)<div>([^<]*)<h2>([^<]*)<\\/h2>([^<]*)<p>([^<]*)<img ([^>]*)>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
$cnt = preg_match_all($pattern, $contents, $matches);
// var_dump( $matches );
$biology = $matches[8][0];
// echo $contents;
}
// Get Speciality
$node_list = $obj->getElementsByTagName('h2');
foreach ($node_list as $node) {
$speciality = $node->nodeValue;
break;
}
$speciality = substr($speciality, strpos($speciality, '(') + 1);
$speciality = substr($speciality, 0, strlen($speciality) - 1);
// Get the Location and phone
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
if (getAttribute($node, 'style') == 'margin-bottom:10px;') {
$location = $node->nodeValue;
$phone = substr($location, strpos($location, 'Phone') + 7);
$location = substr($location, 0, strpos($location, 'Phone'));
}
}
// Get the zip code
$pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
$matches = '';
if (preg_match_all($pattern, $location, $matches) > 0) {
$zipcode = $matches[1][0];
}
}
开发者ID:jubinri,项目名称:cancer,代码行数:49,代码来源:scratch_5.php
示例5: setDriver
/**
* @param \Zend\Db\Adapter\Driver\Sqlsrv\Sqlsrv|\Zend\Db\Adapter\Driver\Pdo\Pdo||resource|\PDO $driver
* @throws \Zend\Db\Adapter\Exception\InvalidArgumentException
* @return $this
*/
public function setDriver($driver)
{
// handle Zend_Db drivers
if ($driver instanceof Pdo\Pdo && $driver->getDatabasePlatformName() == 'Sqlsrv') {
/** @var $driver \Zend\Db\Adapter\Driver\DriverInterface */
$this->resource = $driver->getConnection()->getResource();
return $this;
}
// handle
if ($driver instanceof \PDO && $driver->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'sqlsrv') {
$this->resource = $driver;
return $this;
}
throw new Exception\InvalidArgumentException('$driver must be a Sqlsrv PDO Zend\\Db\\Adapter\\Driver or Sqlsrv PDO instance');
}
开发者ID:totolouis,项目名称:ZF2-Auth,代码行数:20,代码来源:SqlServer.php
示例6: Curated
function Curated($xml)
{
$this->name = getAttribute($xml, 'name');
$this->by = getAttribute($xml, 'by');
$this->scroll = getAttribute($xml, 'scroll');
$this->resize = getAttribute($xml, 'resize');
$this->width = getAttribute($xml, 'width');
$this->height = getAttribute($xml, 'height');
$this->image = getValue($xml, 'image');
$this->description = innerHTML($xml, 'description');
$this->location = getValue($xml, 'location');
$links = $xml->getElementsByTagName('link');
$links = $links->toArray();
foreach ($links as $link) {
$this->links[] = array('href' => $link->getAttribute('href'), 'title' => $link->getText());
}
}
开发者ID:GABBAR1947,项目名称:processing-web-archive,代码行数:17,代码来源:Curated.class.php
示例7: define
<?php
define("true-access", true);
//if(!$hostname || !$user || !$password || !$dbName)
//{
//header ("Location: installation.php");
// p("Please, make sure you introduced every data");
//}
//else{
$hostname = getAttribute("Prueba/hostname.txt");
$user = getAttribute("Prueba/user.txt");
$password = getAttribute("Prueba/password.txt");
$dbName = getAttribute("Prueba/dbName.txt");
function getAttribute($path)
{
if (file_exists($path)) {
$allData = file_get_contents($path);
$arrayOfLines = file($path);
$result = $arrayOfLines[sizeof($arrayOfLines) - 1];
}
return $result;
}
define("SALT", "word");
define("DB_HOST", $hostname);
define("DB_USER", $user);
define("DB_PASSWORD", $password);
define("DB_NAME", $dbName);
//echo "estos son mis params".SALT;
//echo "host".DB_HOST;
//echo DB_USER;
//echo DB_PASSWORD;
开发者ID:pmontojo,项目名称:Blackboard,代码行数:31,代码来源:configuration.php
示例8: get_tag
<a class="addthis_button_google"></a>
<a class="addthis_button_twitter"></a>
<span class="addthis_separator">•</span>
<a href="http://www.addthis.com/bookmark.php?v=250&username=xa-4c40b32a7baba973" class="addthis_button_compact">More</a>
</div>
<script type="text/javascript" src="//s7.addthis.com/js/250/addthis_widget.js#username=xa-4c40b32a7baba973"></script>
<!-- AddThis Button END -->
<?php
}
echo '<div class="scalar_logo_wrapper">' . "\n";
// Publisher icon
if (!empty($book->publisher_thumbnail)) {
$href = '';
$link_tags = get_tag('a', $book->publisher);
if (!empty($link_tags)) {
$href = getAttribute('href', $link_tags[0]);
}
if (!empty($href)) {
echo '<a href="' . $href . '">';
}
echo '<img class="publisher-thumb" src="' . confirm_slash(base_url()) . confirm_slash($book->slug) . $book->publisher_thumbnail . '" />' . "\n";
if (!empty($href)) {
echo '</a>';
}
}
// Page version number
if (isset($page->version_index) && isset($page->versions[$page->version_index]) && !empty($page->versions[$page->version_index])) {
$title = $page->versions[$page->version_index]->title;
$created = $page->versions[$page->version_index]->created;
$version_num = $page->versions[$page->version_index]->version_num;
echo '<span class="screen-version"><a href="' . $base_uri . $page->slug . '.' . $version_num . '.versions">Version ' . $version_num . '</a> <span id="screen-version-id">id ' . $page->versions[$page->version_index]->version_id . '</span> ';
开发者ID:paulshannon,项目名称:scalar,代码行数:31,代码来源:footer.php
示例9: println
?>
</li>
</ul>
</div>
<?php
//}
?>
</td>
</tr>
<tr>
<td valign='middle' align='center'>
<span class='msjError'>
<?php
if (request . getAttribute("error") != null) {
out . println(request . getAttribute("error"));
}
?>
</span>
</td>
</tr>
<tr>
<td valign='middle' align='center'>
<input type='submit' value='Enviar' align='left' class='botns' />
<?php
if (ul != null) {
?>
<a href="registrar_usu?proceso=eliminar"><input type='button' value='Darme de Baja' align='left' class='botns' /></a>
<?php
开发者ID:villafloresmf,项目名称:EntorGrafFinal,代码行数:31,代码来源:registrarUsuario.php
示例10: process
function process($obj, $contents)
{
global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
// Get Image
$node_list = $obj->getElementsByTagName('img');
foreach ($node_list as $node) {
if (getAttribute($node, 'class') == 'attachment-post-thumbnail wp-post-image') {
$img_url = getAttribute($node, 'src');
}
}
// Get Appointment
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
if (getAttribute($node, 'class') == 'desktop') {
$appointment = $node->nodeValue;
}
}
// Get Other information
$node_list = $obj->getElementsByTagName('h3');
foreach ($node_list as $node) {
switch ($node->nodeValue) {
case 'Areas of treatment:':
$expertise = $node->nextSibling->nodeValue;
break;
case 'Specialty:':
$speciality .= $node->nextSibling->nodeValue;
break;
case 'Specialties:':
$speciality .= $node->nextSibling->nodeValue;
break;
case 'Practicing location:':
$location = $node->nextSibling->nodeValue;
break;
case 'Education:':
$education = $node->nextSibling->nodeValue;
break;
case 'Certifications:':
$certification = $node->nextSibling->nodeValue;
break;
case 'Awards:':
$honor = $node->nextSibling->nodeValue;
break;
case 'Internships:':
$training .= 'Internships : ' . $node->nextSibling->nodeValue . ', ';
break;
case 'Residencies:':
$training .= 'Residencies : ' . $node->nextSibling->nodeValue . ', ';
break;
case 'Fellowships:':
$training .= 'Fellowships : ' . $node->nextSibling->nodeValue . ', ';
break;
}
}
// Get the rank
if (strpos(strtolower($appointment), 'associate professor') !== false) {
$rank = 2;
} elseif (strpos(strtolower($appointment), 'assistant professor') !== false) {
$rank = 3;
} elseif (strpos(strtolower($appointment), 'professor') !== false) {
$rank = 1;
}
if (strlen($training) > 0) {
$training = substr($training, 0, strlen($training) - 2);
}
$phone = '(800) USC-CARE (800-872-2273)';
}
开发者ID:jubinri,项目名称:cancer,代码行数:66,代码来源:scratch_6.php
示例11: process
function process($obj, $contents)
{
global $obj, $contents, $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank;
// Get Image
$pattern = '/<div id=\'physicianHeadshot\'>([^<]*)<img src="([^"]*)"([^>]*)>([^<]*)<\\/div>/';
$matches = '';
preg_match_all($pattern, $contents, $matches);
$img_url = 'http://www.fccc.edu' . $matches[2][0];
// Get Honor
$pattern = '/<h4>Honors and Awards<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
if (preg_match_all($pattern, $contents, $matches) > 0) {
$honor = $matches[2][0];
}
// Get Education
$pattern = '/<h4>Medical Education<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
if (preg_match_all($pattern, $contents, $matches) > 0) {
$education = $matches[2][0];
}
// Get Certification
$pattern = '/<h4>Certifications:<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
if (preg_match_all($pattern, $contents, $matches) > 0) {
$certification = $matches[2][0];
}
// Get Research Interests
$pattern = '/<h4>Research Interests<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
if (preg_match_all($pattern, $contents, $matches) > 0) {
$research_interests = $matches[2][0];
}
// Get Expertise
$pattern = '/<h4>Clinical Expertise:<\\/h4>([^<]*)<p>([^<]*)<\\/p>/';
$matches = '';
if (preg_match_all($pattern, $contents, $matches) > 0) {
$expertise = $matches[2][0];
}
// Get the specility and biology
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
if (getAttribute($node, 'id') == 'physicianHeadshot') {
$speciality = $node->nextSibling->nextSibling->nodeValue;
}
if (getAttribute($node, 'id') == 'physicianQuotebox') {
$biology = $node->nodeValue;
}
// Get the location
if (getAttribute($node, 'id') == 'physicianAppt') {
$location = $node->nodeValue;
$location = trim(str_replace("New patients can request an appointment online or call", "", $location));
// The the phone and zipcode
$pos = strpos($location, " ");
$phone = substr($location, 0, $pos);
$location = substr($location, $pos);
$pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
$matches = '';
if (preg_match_all($pattern, $location, $matches) > 0) {
$zipcode = $matches[1][0];
}
}
}
// Get $speciality again
if (trim($speciality) == '') {
$node_list = $obj->getElementsByTagName('h2');
foreach ($node_list as $node) {
$speciality = $node->nodeValue;
}
}
$node_list = $obj->getElementsByTagName('h4');
$start = 0;
foreach ($node_list as $node) {
$start++;
if ($start == 1) {
$appointment = trim($node->nodeValue);
if ($appointment == 'Clinical Expertise:') {
$appointment = '';
}
if (substr($appointment, 0, 5) == 'Video') {
$start = 0;
}
if (substr($appointment, 0, 4) == 'Why ') {
$start = 0;
}
if (strpos($appointment, "Patient Stories") !== false) {
$start = 0;
}
}
$nodeValue = trim($node->nodeValue);
if ($nodeValue == 'Clinical Expertise:') {
$expertise = $node->nextSibling->nodeValue;
}
if ($nodeValue == 'Certifications:' && $certification == '') {
$certification = $node->nextSibling->nodeValue;
}
if ($nodeValue == 'Medical Education' && $education == '') {
$education = $node->nextSibling->nodeValue;
}
if ($nodeValue == 'Research Interests' && $research_interests == '') {
$research_interests = $node->nextSibling->nodeValue;
//.........这里部分代码省略.........
开发者ID:jubinri,项目名称:cancer,代码行数:101,代码来源:scratch_1.php
示例12: getAttribute
$xml .= "\t\t<" . $c . "_html5_mp3_audio>" . $mp3_audio . "</" . $c . "_html5_mp3_audio>\n";
}
}
$ogg_audio = getAttribute('ogg', $res['arp_header_shortcode']);
$ogg_audio = trim($ogg_audio, '"');
if ($ogg_audio != "") {
$ogg_audio_name = explode('/', $ogg_audio);
$ogg_audio_name = $ogg_audio_name[count($ogg_audio_name) - 1];
@copy($ogg_audio, $upload_dir . 'temp_' . $ogg_audio_name);
if (file_exists($upload_dir . "temp_" . $ogg_audio_name)) {
$filename_arry[] = 'temp_' . $ogg_audio_name;
$ogg_audio_name = 'temp_' . $ogg_audio_name;
$xml .= "\t\t<" . $c . "_html5_ogg_audio>" . $ogg_audio . "</" . $c . "_html5_ogg_audio>\n";
}
}
$wav_audio = getAttribute('wav', $res['arp_header_shortcode']);
$wav_audio = trim($wav_audio, '"');
if ($wav_audio != "") {
$wav_audio_name = explode('/', $wav_audio);
$wav_audio_name = $wav_audio_name[count($wav_audio_name) - 1];
@copy($wav_audio, $upload_dir . 'temp_' . $wav_audio_name);
if (file_exists($upload_dir . "temp_" . $wav_audio_name)) {
$filename_arry[] = 'temp_' . $wav_audio_name;
$wav_audio_name = 'temp_' . $wav_audio_name;
$xml .= "\t\t<" . $c . "_html5_wav_audio>" . $wav_audio . "</" . $c . "_html5_wav_audio>\n";
}
}
}
}
}
}
开发者ID:prosenjit-itobuz,项目名称:upages,代码行数:31,代码来源:class.arprice_export_table.php
示例13: readDOM
function readDOM($dom) {
$cur=$dom.firstChild;
while($cur) {
if($cur->nodeName=="tag") {
$this->set($cur.getAttribute("k"), $cur.getAttribute("v"));
}
$cur=$cur.nextSibling;
}
}
开发者ID:plepe,项目名称:OpenStreetBrowser,代码行数:10,代码来源:tags.php
示例14: process
function process($obj, $contents)
{
global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
// Get Image + 1
$pattern = '/<div class="profilePhotoContainer" id="provImage_MD">([^<]*)<img src="([^"]*)"([^>]*)>([^<]*)<\\/div>/';
$matches = '';
preg_match_all($pattern, $contents, $matches);
$img_url = 'http://doctors.ucsd.edu' . $matches[2][0];
// Get Dgree
$node_list = $obj->getElementsByTagName('h1');
foreach ($node_list as $node) {
$inner_name = $node->nodeValue;
$dgree = trim(substr($inner_name, strpos($inner_name, ',') + 2));
}
// Get Address
$arrAddr = array();
$node_list = $obj->getElementsByTagName('h3');
foreach ($node_list as $node) {
$arrAddr['addr1'][] = $node->nodeValue;
}
$node_list = $obj->getElementsByTagName('span');
foreach ($node_list as $node) {
switch (getAttribute($node, 'itemprop')) {
case 'addressLocality':
$arrAddr['addr4'][] = $node->nodeValue;
break;
case 'addressRegion':
$arrAddr['addr5'][] = $node->nodeValue;
break;
case 'postalCode':
$arrAddr['addr6'][] = $node->nodeValue;
break;
}
}
// Get Other information
$currentProfile = '';
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
switch (getAttribute($node, 'id')) {
case 'acadTitle':
$appointment = $node->nodeValue;
break;
case 'providerSpec_MD':
$speciality = $node->nodeValue;
break;
case 'tabs-1':
// $biology = $node->nodeValue;
break;
case 'tabs-2':
break;
case 'tabs-3':
$expertise = $node->nodeValue;
break;
case 'tabs-4':
// $location = $node->nodeValue;
break;
case 'tabs-5':
$phone = $node->nodeValue;
$phone = trim(str_replace('Contact Numbers', '', $phone));
break;
}
// Get the education, Training and Certificate
if (getAttribute($node, 'class') == 'profileLabel') {
$currentProfile = $node->nodeValue;
}
if (getAttribute($node, 'class') == 'profileData') {
switch ($currentProfile) {
case 'Medical Degree:':
$education .= $node->nodeValue . ', ';
break;
case 'Residency:':
$training .= 'Residency : ' . $node->nodeValue . ', ';
break;
case 'Fellowship:':
$training .= 'Fellowship : ' . $node->nodeValue . ', ';
break;
case 'Internship:':
$training .= 'Internship : ' . $node->nodeValue . ', ';
break;
case 'Board Certifications:':
$certification .= $node->nodeValue . ', ';
break;
}
}
// Get the address 2, 3
if (getAttribute($node, 'class') == 'profileDataNoLabel emphasize' && getAttribute($node, 'itemprop') == 'name') {
$arrAddr['addr2'][] = $node->nodeValue;
}
if (getAttribute($node, 'class') == 'profileDataNoLabel ' && getAttribute($node, 'itemprop') == 'streetAddress') {
$arrAddr['addr3'][] = $node->nodeValue . ' ' . $node->nextSibling->nodeValue;
}
}
// Get the biology
$bioloby = '';
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
if (getAttribute($node, 'class') == 'profileDataNoLabel') {
if (strlen($node->nodeValue) > strlen($biology)) {
$biology = $node->nodeValue;
}
//.........这里部分代码省略.........
开发者ID:jubinri,项目名称:cancer,代码行数:101,代码来源:scratch_3.php
示例15: saveLabelChanges
$labelChanges[] = $change;
}
if (count($labelChanges) > 0) {
saveLabelChanges($labelChanges);
}
} else {
if (!is_null($_GET) && array_key_exists("id", $_GET) && $_GET["id"] != '') {
$attributeID = intval($_GET["id"]);
}
}
if (strpos($error, "Duplicate entry") !== FALSE) {
$error = "Another attribute already exists with code [" . $_POST["attributeCode"] . "]. Codes must be unique.";
}
$attribute = null;
if (!is_null($attributeID)) {
$attribute = getAttribute($attributeID);
}
$attributeID = is_null($attribute) ? "" : $attribute->id;
$code = is_null($attribute) ? "" : $attribute->code;
$name = is_null($attribute) ? "" : $attribute->name;
$description = is_null($attribute) ? "" : $attribute->description;
?>
<h1><a href="overview.php">Overview</a> > <a href="attributes.php">Attributes</a> > Edit Attribute</h1>
<?php
if ($error != "") {
echo "<p class=\"error\">{$error}</p>";
}
?>
<form method="post">
<input type="hidden" name="oldAttributeCode" value="<?php
开发者ID:malimu,项目名称:CrisisTracker,代码行数:31,代码来源:edit_attribute.php
示例16: getPlayerInfo
function getPlayerInfo($href)
{
//$href = "playerpage.htm?ilkid=ALLENMAR01";
//$href = "playerpage.htm?ilkid=ARRINLAV01";
$debug = false;
$base_url = "http://databasefootball.com/players/";
//echo "href: $href<br>";
//echo "$base_url $href<br>";
$p_url = $base_url . $href;
//echo "player url: $p_url<br>";
$player_page = file_get_html($p_url);
$bio = $player_page->find('font.bio', 0);
//echo var_dump($bio);
$plaintext = $bio->plaintext;
$innerText = $bio->innerText;
//echo "innerText: $innerText<br>";
echo "Plaintext: {$plaintext}<br>";
$plaintext = preg_replace("(\\'\\')", "\"", $plaintext);
$plaintext = preg_replace("(\\')", "\\'", $plaintext);
$fullName = $position = $height = $weight = $dob = $hometown = $college = $drafted = $nickname = "null";
$fullName = getAttribute($plaintext, "", "Position:");
if (preg_match("/Full Name:/", $plaintext)) {
if (!(strpos($fullName, "Full Name:") === false)) {
$fullName = getAttribute($plaintext, "Full Name:", "Position:");
}
}
if (preg_match("/\\(*\\)/", $fullName)) {
$nickname = getAttribute($plaintext, "(", ")");
}
//echo "FullName: $fullName<br>";
if (preg_match("/Position:/", $plaintext)) {
if (preg_match("/Height:/", $plaintext)) {
$position = getAttribute($plaintext, "Position:", "Height:");
} else {
$position = getAttribute($plaintext, "Position:", "Born:");
}
}
if (preg_match("/Height:/", $plaintext)) {
$height = getAttribute($plaintext, "Height:", "Weight:");
}
if (preg_match("/Weight:/", $plaintext)) {
$weight = getAttribute($plaintext, "Weight:", "Born:");
}
if (preg_match("/Born:/", $plaintext)) {
if (preg_match("/, in/", $plaintext)) {
$dob = getAttribute($plaintext, "Born:", ", in");
$hometown = getAttribute($plaintext, ", in", "High School:");
} else {
if (preg_match("/High School:/", $plaintext)) {
$dob = getAttribute($plaintext, "Born:", "High School:");
$dob = preg_replace("/,/", "", $dob);
} else {
$dob = getAttribute($plaintext, "Born:", "");
}
}
$dob = preg_replace("/,/", "", $dob);
}
if (preg_match("/College:/", $plaintext)) {
$college = getAttribute($plaintext, "College:", "Drafted");
}
if (preg_match("/Drafted:/", $plaintext)) {
$drafted = getAttribute($plaintext, "Drafted:", "");
}
//$fullName = $player_page->find("a h1")->plaintext;
$header = $player_page->find("a[name] h1", 0);
$fullName = $header->plaintext;
//Jerry Da prato
//John Smith
//La var Arrington
$fullName = preg_replace("/[[:space:]]([A-Z])/", " !\$1", htmltrim($fullName));
$fullName = preg_replace("(\\')", "\\'", $fullName);
//echo var_dump($fullName)."<br>";
$name_array = explode(' !', $fullName);
$first = $name_array[0];
$last = $name_array[1];
//echo "trs: ".var_dump($player_page->find('table tr[onmouseover]'));
$teams = getTeams($player_page->find('table tbody tr td table tbody tr[onmouseover]'));
//echo "Name: $fullName<br>";
if ($debug) {
echo "plaintext: {$plaintext}<br>";
echo "nickName: {$nickname}<br>";
echo "Position: '{$position}'<br>";
echo "height: {$height}<br>";
echo "weight: {$weight}<br>";
echo "dob: {$dob}<br>";
echo "hometown: {$hometown}<br>";
echo "college: {$college}<br>";
echo "drafted: {$drafted}<br>";
echo "teams: {$teams}<br><br>";
}
$insert = "INSERT INTO players (\r\n\t\t\t\tfirst_name, last_name, height, weight, dob, position, team, college, hometown, drafted, nickname) \r\n\t\t\t\tVALUES('{$first}', '{$last}', '{$height}', {$weight}, '{$dob}', '{$position}', '{$teams}', '{$college}', '{$hometown}', '{$drafted}', '{$nickname}')";
preg_replace("/''/", "'", $insert);
echo $insert . "<br>";
//$result = mysql_query($insert);
$id = mysql_insert_id();
/***********************
///awards section
/***********************/
getAwards($id, $player_page->find('td p font.bio', 0));
//->find('a[href^=/awards]')
//.........这里部分代码省略.........
开发者ID:nguyenphucbao68,项目名称:enterprise-computing-app,代码行数:101,代码来源:player_bio_info.php
示例17: process
function process($obj, $contents)
{
global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree;
// Get Other information
$node_list = $obj->getElementsByTagName('img');
foreach ($node_list as $node) {
if (getAttribute($node, 'width') == '150') {
$img_url = 'http://hospitals.jefferson.edu' . getAttribute($node, 'src');
}
}
// Get Other information
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
// Get Speciality
if (getAttribute($node, 'class') == 'specLineItem') {
$speciality .= $node->nodeValue . ', ';
}
// Appointment
if (getAttribute($node, 'class') == 'professional-titles') {
$appointment = $node->nodeValue;
}
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl00_pnlThumbnail') {
// $img_url = getAttribute( $node->firstChild, 'src' );
}
// Get Location
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl02_pnlOffices') {
$location = $node->nodeValue;
$location = str_replace('Office Locations', '', $location);
$location = str_replace('View on Google Maps', '', $location);
}
// Get Certification
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabCertifications') {
$certification = $node->nodeValue;
$certification = str_replace('Board Certifications', '', $certification);
}
// Get Education
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabEducation') {
$education = $node->nodeValue;
$education = str_replace('Education', '', $education);
}
// Get Honor
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabAwards') {
$honor = $node->nodeValue;
$honor = str_replace('Awards and Honors', '', $honor);
}
// Training
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabInternship') {
$training .= $node->nodeValue . ', ';
}
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabResidency') {
$training .= $node->nodeValue . ', ';
}
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabFellowship') {
$training .= $node->nodeValue . ', ';
}
// Expertise
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabConditions') {
$expertise .= 'Conditions : ' . substr($node->nodeValue, strlen('Conditions')) . ', ';
}
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabTreatments') {
$expertise .= 'Treatments : ' . substr($node->nodeValue, strlen('Treatments')) . ', ';
}
if (getAttribute($node, 'id') == 'main_0_contentpanel_1_ctl04_pnlTabTests') {
$expertise .= 'Tests : ' . substr($node->nodeValue, strlen('Tests')) . ', ';
}
}
$pattern = '/Phone: *(\\([0-9]+\\) *[0-9\\-]+)/';
$matches = '';
$cntPhone = preg_match_all($pattern, $location, $matches);
if ($cntPhone > 0) {
for ($i = 0; $i < $cntPhone; $i++) {
$phone .= $matches[1][$i] . ', ';
}
} else {
$phone = ' 1-800-JEFF-NOW (800-533-3669)';
}
// Get the zip code
$pattern = '/([0-9][0-9][0-9][0-9][0-9]([0-9\\-]*))/';
$matches = '';
if (preg_match_all($pattern, $location, $matches) > 0) {
for ($i = 0; $i < count($matches[1]); $i++) {
$zipcode .= $matches[1][$i] . ', ';
}
}
// Get the rank
if (strpos(strtolower($appointment), 'associate professor') !== false) {
$rank = 2;
} elseif (strpos(strtolower($appointment), 'assistant professor') !== false) {
$rank = 3;
} elseif (strpos(strtolower($appointment), 'professor') !== false) {
$rank = 1;
}
if (strlen($training) > 0) {
$training = substr($training, 0, strlen($training) - 2);
}
if (strlen($speciality) > 0) {
$speciality = substr($speciality, 0, strlen($speciality) - 2);
}
if (strlen($expertise) > 0) {
$expertise = substr($expertise, 0, strlen($expertise) - 2);
//.........这里部分代码省略.........
开发者ID:jubinri,项目名称:cancer,代码行数:101,代码来源:scratch_9.php
示例18: set
function set($att, $value)
{
$aux = getAttribute($att);
$this->attributes[$att] = $value;
return $aux;
}
开发者ID:BackupTheBerlios,项目名称:mvc-hispano,代码行数:6,代码来源:class.request.php
示例19: process
function process($obj, $contents)
{
global $img_url, $biology, $expertise, $certification, $education, $location, $research_interests, $phone, $email, $appointment, $zipcode, $speciality, $training, $honor, $rank, $dgree, $first_name, $last_name;
// Get Image
$node_list = $obj->getElementsByTagName('img');
foreach ($node_list as $node) {
if (getAttribute($node, 'typeof') == 'foaf:Image') {
$img_url = getAttribute($node, 'src');
}
}
// Get First Name, Last Name, Degree
$node_list = $obj->getElementsByTagName('h1');
foreach ($node_list as $node) {
$inner_name = $node->nodeValue;
}
$temp = '';
do {
$dgree .= $temp;
$pos = strrpos($inner_name, ' ');
$temp = substr($inner_name, $pos);
$inner_name = substr($inner_name, 0, $pos);
} while ($temp == strtoupper($temp));
$inner_name .= $temp;
$pos = strpos($inner_name, ' ');
$dgree = trim($dgree);
$first_name = substr($inner_name, 0, $pos);
$last_name = trim(substr($inner_name, $pos));
// Get Other information
$node_list = $obj->getElementsByTagName('div');
foreach ($node_list as $node) {
if (substr(trim($node->nodeValue), 0, 12) == 'Specialties:') {
$speciality = $node->nextSibling->nodeValue;
}
if (getAttribute($node, 'class') == 'panel-pane pane-entity-field pane-node-field-clinical-interest') {
$expertise = $node->nodeValue;
$expertise = trim(str_replace('Clinical Interests:', '', $expertise));
}
if (getAttribute($node, 'class') == 'field field-name-field-physician-biography field-type-text-long field-label-hidden') {
$biology = $node->nodeValue;
}
if (getAttribute($node, 'class') == 'field field-name-field-physician-locations field-type-field-collection field-label-hidden') {
$location = $node->nodeValue;
}
if (getAttribute($node, 'class') == 'field field-name-field-research-interest field-type-text-long field-label-hidden') {
$research_interests = $node->nodeValue;
}
if (getAttribute($node, 'class') == 'field field-name-field-physician-title field-type-text field-label-hidden') {
$appointment = $node->nodeValue;
}
}
// Get the education, Training and Certificate
// Get Other information
$node_list = $obj->getElementsByTagName('ul');
foreach ($node_list as $node) {
switch (getAttribute($node, 'class')) {
case 'field field-name-field-physician-education field-type-text field-label-above':
$education .= $node->nodeValue . ', ';
break;
case 'field field-name-field-physician-residency field-type-text-long field-label-above':
$training .= 'Residency : ' . $node->nodeValue . ', ';
break;
case 'field field-name-field-physician-fellowship field-type-text field-label-above':
$training .= 'Fellowship : ' . $node->nodeValue . ', ';
break;
case 'field field-name-field-physician-internship field-type-text field-label-above':
$training .= 'Internship : ' . $node->nodeValue . ', ';
break;
case 'field field-name-field-physician-boards field-type-text field-label-above':
|
请发表评论