本文整理汇总了PHP中simpledom_load_string函数的典型用法代码示例。如果您正苦于以下问题:PHP simpledom_load_string函数的具体用法?PHP simpledom_load_string怎么用?PHP simpledom_load_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了simpledom_load_string函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test
public function test()
{
$xml = '<root><child1 /><child2 /><child3 /></root>';
$node = simpledom_load_string($xml);
$this->assertSame('SimpleDOM', get_class($node), 'Wrong class returned');
$this->assertXmlStringEqualsXmlString($xml, $node->asXML());
}
示例2: defined
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
$basPath = JURI::base(false) . 'components/com_bookingforconnector/assets/';
$this->document->addScript('components/com_bookingforconnector/assets/js/royalslider/jquery.royalslider.min.js');
$this->document->addStyleSheet('components/com_bookingforconnector/assets/js/royalslider/royalslider.css');
$this->document->addStyleSheet('components/com_bookingforconnector/assets/js/royalslider/skins/universal/rs-universal.css');
$resource = $this->item;
$images = array();
try {
// $imageData = new SimpleXmlElement($resource->PlanimetryData);
if (!empty($resource->PlanimetryData)) {
if (strpos($resource->PlanimetryData, '<xmlhashtable>') !== false) {
$imageData = simpledom_load_string($resource->PlanimetryData);
if (!empty($imageData)) {
// valore xml
//$nodes = $imageData;
if (strpos($resource->ImageData, 'order') !== false) {
$nodes = $imageData->sortedXPath('//image', '@order');
//dati ordinati per "order"
} else {
$nodes = $imageData;
}
}
foreach ($nodes as $image) {
$images[] = $image;
}
} else {
foreach (explode(',', $resource->PlanimetryData) as $image) {
$images[] = $image;
示例3: JDate
$jdate = new JDate($checkInDate);
// 3:20 PM, December 1st, 2012
$checkInDateLabel = sprintf(JTEXT::_('COM_BOOKINGFORCONNECTOR_MERCHANTS_VIEW_MERCHANTDETAILS_RATING_CHECKINDATE_LABEL'), $jdate->format('F Y'));
}
$location = "";
if ($rating->City != "") {
$location .= $rating->City . ", ";
}
$location .= $rating->Nation;
$t = BFCHelper::convertTotal($rating->Total);
//Reply=<risposte><risposta><![CDATA[Test risposta]]></risposta></risposte>
$reply = "";
$replydateLabel = "";
if (!empty($rating->Reply)) {
if (strpos($rating->Reply, '<replies>') !== false) {
$replies = simpledom_load_string($rating->Reply);
$reply = $replies->reply[0];
$replydate = $replies->reply[0]["date"];
if (!empty($replydate)) {
// $jdatereply = new JDate(strtotime($replydate),2); // 3:20 PM, December 1st, 2012
$jdatereply = DateTime::createFromFormat('Ymd', $replydate);
$replydateLabel = sprintf(JTEXT::_('COM_BOOKINGFORCONNECTOR_MERCHANTS_VIEW_MERCHANTDETAILS_RATING_DATEREPLY_LABEL'), $jdatereply->format('d/m/Y'));
}
} else {
$reply = $rating->Reply;
}
}
?>
<div class="<?php
echo COM_BOOKINGFORCONNECTOR_BOOTSTRAP_ROW;
?>
示例4: _createConfigXml
protected function _createConfigXml($schemaPath)
{
$schemaPath = str_replace(array_keys($this->_schemas), array_values($this->_schemas), $schemaPath);
return simpledom_load_string('<?xml version="1.0"?>
<config xmlns:xsi="' . $this->_schemas['@XSI'] . '" xsi:noNamespaceSchemaLocation="' . $schemaPath . '">
</config>');
}
示例5: _createConfigXml
/**
* @param string $schemaPath
* @param string $rootTagName
* @return SimpleDOM
*/
protected function _createConfigXml($schemaPath, $rootTagName = 'config')
{
$schemaPath = str_replace(array_keys($this->_schemas), array_values($this->_schemas), $schemaPath);
return simpledom_load_string('<?xml version="1.0" encoding="UTF-8"?>
<' . $rootTagName . ' xmlns:xsi="' . $this->_schemas['@XSI'] . '" xsi:noNamespaceSchemaLocation="' . $schemaPath . '">
</' . $rootTagName . '>');
}
示例6: createConfigXml
/**
* @param string $schemaPath
* @param string $rootTagName
* @return SimpleDOM
*/
public function createConfigXml($schemaPath, $rootTagName = 'config')
{
return simpledom_load_string('<?xml version="1.0" encoding="UTF-8"?>
<' . $rootTagName . ' xmlns:xsi="' . self::XSI . '" xsi:noNamespaceSchemaLocation="' . $schemaPath . '">
</' . $rootTagName . '>');
}
示例7: defined
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
JHTML::_('behavior.mootools');
// this will make sure mootools loads first so we can load jquery with noconflict
$basPath = JURI::base(false) . 'components/com_bookingforconnector/assets/';
$this->document->addScript('components/com_bookingforconnector/assets/js/royalslider/jquery.royalslider.min.js');
$this->document->addStyleSheet('components/com_bookingforconnector/assets/js/royalslider/royalslider.css');
$this->document->addStyleSheet('components/com_bookingforconnector/assets/js/royalslider/skins/universal/rs-universal.css');
$resource = $this->item->OnSellUnit;
$images = array();
try {
// $imageData = new SimpleXmlElement($resource->VideoData);
if (!empty($resource->VideoData)) {
$imageData = simpledom_load_string($resource->VideoData);
$nodes = $imageData->sortedXPath('//video', '@order');
//dati ordinati per "order"
foreach ($nodes as $image) {
$images[] = $image;
}
}
} catch (Exception $e) {
// suppressing any errors
}
?>
<?php
if (count($images) > 0) {
?>
<div class="royalSlider rsUni" id="resourceVideogallery">
示例8: display
function display($tpl = NULL, $preparecontent = false)
{
$document = JFactory::getDocument();
$language = $document->getLanguage();
// load scripts
$document->addScript('components/com_bookingforconnector/assets/js/jquery.validate.min.js');
$document->addScript('components/com_bookingforconnector/assets/js/additional-methods.min.js');
// Initialise variables
$trackorder = false;
$state = $this->get('State');
$actionmode = JRequest::getVar('actionmode', "");
$item = $this->get('Item');
$params =& $state->params;
$this->assignRef('state', $state);
$this->assignRef('params', $params);
$this->assignRef('language', $language);
$this->assignRef('item', $item);
$this->assignRef('actionmode', $actionmode);
if ($actionmode == "orderpayment") {
//recupero quanti pagamenti sono stati effettuati
$item->paymentCount = BFCHelper::getTotalOrderPayments($item->order->OrderId);
$item->overrideAmount = JRequest::getFloat('overrideAmount');
//sostituisco i dati dell'ordine da pagare con i dati passati e l'ordine con un suffisso in più
/*$item = $this->get('Item');*/
/*$item = "fet";*/
}
if ($actionmode == "orderpaid") {
$trackorder = true;
}
if ($actionmode != '' && $actionmode != 'cancel' && $actionmode != 'donation' && $actionmode != 'orderpayment') {
if ($item->order->Status != 5) {
$hasPayed = $this->processPayment($actionmode, $item->order->OrderId);
/* eccezione per setefi che pretende un url di ritorno */
} else {
//$hasPayed = true;
$hasPayed = $this->processOrderPayment($actionmode, $item->order->OrderId, $language);
}
/*
$link = '';
if ($hasPayed){
}
$app = JFactory::getApplication();
$app->redirect($link, $msg);
*/
}
if ($actionmode == '' && $actionmode != 'donation') {
if ($item->order->Status != 5) {
$this->inizializePayment($item->order->OrderId);
}
}
if ($actionmode == 'orderpaid') {
$hasPayed = $item->order->Status == 5;
}
if (isset($trackorder) && $trackorder) {
$merchants = array();
$merchants[] = $item->order->MerchantId;
$criteoConfig = BFCHelper::getCriteoConfiguration(4, $merchants, $item->order->OrderId);
if (isset($criteoConfig) && isset($criteoConfig->enabled) && $criteoConfig->enabled && count($criteoConfig->merchants) > 0) {
$document->addScript('//static.criteo.net/js/ld/ld.js');
$document->addScriptDeclaration('window.criteo_q = window.criteo_q || [];
window.criteo_q.push(
{ event: "setAccount", account: ' . $criteoConfig->campaignid . '},
{ event: "setSiteType", type: "d" },
{ event: "setEmail", email: "" },
{ event: "trackTransaction", id: "' . $criteoConfig->transactionid . '", item: [' . json_encode($criteoConfig->orderdetails) . '] }
);');
}
$analyticsEnabled = $this->checkAnalytics("Sales Resource List");
if ($analyticsEnabled && $config->get('eecenabled', 0) == 1) {
$purchaseObject = new stdClass();
$purchaseObject->id = "" . $item->order->OrderId;
$purchaseObject->affiliation = "" . $item->order->Label;
$purchaseObject->revenue = "" . $item->order->TotalAmount;
$purchaseObject->tax = 0.0;
$allobjects = array();
$svcTotal = 0;
$allservices = array_values(array_filter(simpledom_load_string($order->NotesData)->xpath("//price"), function ($prc) {
return (string) $prc->tag == "extrarequested";
}));
foreach ($allservices as $svc) {
$svcObj = new stdClass();
$svcObj->id = "" . (int) $svc->priceId . " - Service";
$svcObj->name = (string) $svc->name;
$svcObj->category = "Services";
$svcObj->brand = $item->Name;
$svcObj->variant = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
$svcObj->price = round((double) $svc->discountedamount / (int) $svc->quantity, 2);
$svcObj->quantity = (int) $svc->quantity;
$allobjects[] = $svcObj;
$svcTotal += (double) $svc->discountedamount;
}
$mainObj = new stdClass();
$mainObj->id = "" . $item->order->RequestedItemId . " - Resource";
$mainObj->name = (string) BFCHelper::getItem($order->NotesData, 'nome', 'unita');
$mainObj->variant = (string) BFCHelper::getItem($order->NotesData, 'refid', 'rateplan');
$mainObj->category = $item->MainCategoryName;
$mainObj->brand = $item->Name;
$mainObj->price = $item->order->TotalAmount - $svcTotal;
$mainObj->quantity = 1;
//.........这里部分代码省略.........
示例9: get
/**
* @overrides get() from RestResource
*/
public function get()
{
if (parent::get() !== false) {
if ($this->_logfile != '') {
try {
$oldvalue = '';
$newvalue = '';
$list = array();
if (is_numeric($this->getParam('id'))) {
$id = $this->getParam('id');
} elseif (substr($this->getParam('id'), 0, 2) === "s:") {
db()->setFetchMode(Zend_Db::FETCH_BOTH);
$id = db()->query("(SELECT id FROM applications WHERE cname ILIKE '" . pg_escape_string(substr($this->getParam('id'), 2)) . "\n' FETCH FIRST 1 ROWS ONLY)")->fetchAll();
try {
$id = $id[0][0];
$this->_pars["id"] = $id;
} catch (Exception $e) {
debug_log('could not find if for application with cname `' . pg_escape_string(substr($this->getParam('id'), 2)) . "'");
}
}
$log = '';
$f = fopen($this->_logfile, "r");
if ($f !== false) {
error_log('Acquiring shared lock on logfile "' . $this->_logfile . '"');
if (flock($f, LOCK_SH)) {
error_log('Shared lock on logfile "' . $this->_logfile . '" acquired');
$log = file_get_contents($this->_logfile);
// error_log('Logfile "' . $this->_logfile . '" loaded as text');
flock($f, LOCK_UN);
} else {
error_log('Could not acquire shared lock on logfile "' . $this->_logfile . '"');
}
fclose($f);
}
if ($log == '') {
$this->setError(RestErrorEnum::RE_BACKEND_ERROR, "Could not access history database.");
return false;
}
$log = "<log>" . $log . "</log>";
//$log = new SimpleXMLElement($log);
$log = simpledom_load_string($log);
// error_log("Logfile loaded as XML");
$xpath = $log->sortedXPath('action[@target="application" and @id="' . $id . '" and (@event="update" or @event="delete")]', '@timestamp');
// error_log("Got sorted XPath from XML log");
//$xpath = $log->xpath('action[@target="application" and @id="'.$id.'"]');
$counter = 0;
foreach ($xpath as $x) {
$counter = $counter + 1;
if ($x->attributes()->event) {
$event = strval($x->attributes()->event);
} else {
$event = '';
}
if ($x->attributes()->userid) {
$userid = strval($x->attributes()->userid);
} else {
$userid = '';
}
if ($x->attributes()->username) {
$username = strval($x->attributes()->username);
} else {
$username = '';
}
if ($x->attributes()->usercontact) {
$usercontact = strval($x->attributes()->usercontact);
} else {
$usercontact = '';
}
if ($x->attributes()->apiver) {
$apiver = strval($x->attributes()->apiver);
} else {
$apiver = '1.0';
}
if ($x->attributes()->disposition) {
$disposition = strval($x->attributes()->disposition);
} else {
$disposition = '';
}
if ($x->attributes()->timestamp) {
$timestamp = strval($x->attributes()->timestamp);
} else {
$timestamp = '';
}
if ($timestamp != '') {
$timestamp = str_replace(' ', 'T', $timestamp);
$timestamp = substr($timestamp, 0, 4) . "-" . substr($timestamp, 6, 2) . "-" . substr($timestamp, 4, 2) . substr($timestamp, 8);
}
if ($userid !== '') {
$ppl = new Default_Model_Researchers();
// retreive the user's CName even if the record has been marked as deleted
$ppl->viewModerated = true;
$ppl->filter->id->numequals($userid);
if (count($ppl->items) > 0) {
$userCname = $ppl->items[0]->cname;
} else {
$userCname = '';
}
//.........这里部分代码省略.........