本文整理汇总了PHP中getAttribute函数的典型用法代码示例。如果您正苦于以下问题:PHP getAttribute函数的具体用法?PHP getAttribute怎么用?PHP getAttribute使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getAttribute函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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');
}
示例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');
}
示例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');
}
示例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];
}
}
示例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');
}
示例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());
}
}
示例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;
示例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> ';
示例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
示例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)';
}
示例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;
//.........这里部分代码省略.........
示例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";
}
}
}
}
}
}
示例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;
}
}
示例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;
}
//.........这里部分代码省略.........
示例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