本文整理汇总了PHP中xml2php函数的典型用法代码示例。如果您正苦于以下问题:PHP xml2php函数的具体用法?PHP xml2php怎么用?PHP xml2php使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xml2php函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
<?php
// Load the Supplier classes
require_once 'include.php';
// Load the Translation for this Module
if (!xml2php('supplier')) {
$smarty->assign('error_msg', "Error in language file");
}
// Assign the arrays
$smarty->assign('supplier_details', display_supplier_info($db, $VAR['supplierID']));
$smarty->display('supplier' . SEP . 'supplier_details.tpl');
示例2: Date
<?php
if (!xml2php("core")) {
$smarty->assign('error_msg', "Error in language file");
}
//$employee_id = $VAR['employee_id'];
$sch_id = $VAR['sch_id'];
$today2 = Date("d");
if ($cur_date > 0) {
$y1 = $VAR['y'];
$m1 = $VAR['m'];
$d1 = $VAR['d'];
} else {
$y1 = Date("Y");
$m1 = Date("m");
$d1 = Date("d");
}
$smarty->assign('y1', $y1);
$smarty->assign('m1', $m1);
$smarty->assign('d1', $d1);
$smarty->assign('Y', $Y);
$smarty->assign('m', $m);
$smarty->assign('d', $d);
$smarty->assign('today2', $today2);
if ($VAR['wo_id'] == '' || $VAR['wo_id'] < "1") {
$wo_id = 0;
} else {
$wo_id = $VAR['wo_id'];
$woid = $VAR['wo_id'];
}
/*if ($VAR['woid'] == '' || $VAR['woid'] < "1" )
示例3: array
<?php
// Load the customer classes
require_once "include.php";
/* load translation for this module */
if (!xml2php("customer")) {
$smarty->assign('error_msg', "Error in language file");
}
$alpha = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0');
if (!isset($VAR["page_no"])) {
$page_no = 1;
} else {
$page_no = $VAR['page_no'];
}
$customer_search_result = display_customer_search($db, $name = $VAR['name'], $page_no, $smarty);
$smarty->assign('alpha', $alpha);
$smarty->assign('customer_search_result', $customer_search_result);
$smarty->display('customer' . SEP . 'search.tpl');
示例4: explode
<?php
require_once "include.php";
if (!xml2php("schedule")) {
$smarty->assign('error_msg', "Error in language file");
}
if (!xml2php("workorder")) {
$smarty->assign('error_msg', "Error in language file");
}
//Schedule Due Date
$date_part2 = explode("/", $VAR['day']);
//$timestamp2 = mktime(0,0,0,$date_part2[1],$date_part2[0],$date_part2[2]);
if ($date_format == "%d/%m/%Y") {
$cur_date = $d . "/" . $m . "/" . $Y;
}
if ($date_format == "%m/%d/%Y") {
$cur_date = $m . "/" . $d . "/" . $Y;
}
$smarty->assign('Y', $Y);
$smarty->assign('m', $m);
$smarty->assign('d', $d);
/* display new Workorders */
$where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(1);
$smarty->assign('new', display_workorders($db, $page_no, $where));
/* display new Workorders */
$where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(2);
$smarty->assign('assigned', display_workorders($db, $page_no, $where));
/* display new Workorders */
$where = "WHERE " . PRFX . "TABLE_WORK_ORDER.WORK_ORDER_CURRENT_STATUS= " . $db->qstr(3);
$smarty->assign('awaiting', display_workorders($db, $page_no, $where));
if (isset($VAR['submit'])) {
示例5:
<?php
####################################################
# IN #
# #
# #
# This program is distributed under the terms and #
# conditions of the GPL #
# Print Results #
# Version 0.0.1 Sat Nov 26 20:46:40 PST 2005 #
# #
####################################################
if (!xml2php("parts")) {
$smarty->assign('error_msg', "Error in language file");
}
$q = "SELECT * FROM " . PRFX . "ORDERS WHERE WO_ID=" . $db->qstr($VAR['wo_id']);
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
}
$order = $rs->FetchRow();
$order_id = $order['ORDER_ID'];
$q = "SELECT * FROM " . PRFX . "ORDERS_DETAILS WHERE ORDER_ID=" . $db->qstr($order_id);
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
}
$order_details = $rs->GetArray();
$smarty->assign('order', $order);
$smarty->assign('details', $order_details);
$smarty->display('parts' . SEP . 'print_results.tpl');
示例6:
<?php
// Load the Refund Functions
require_once 'include.php';
// Load the Translation for this Module
if (!xml2php('refund')) {
$smarty->assign('error_msg', "Error in language file");
}
// This sets page to number. goto_page-->page--> sets as 1 if no value
if (isset($VAR['goto_page_no'])) {
$page_no = $VAR['goto_page_no'];
} else {
if (isset($VAR['page_no'])) {
$page_no = $VAR['page_no'];
} else {
$page_no = 1;
}
}
// this allows the intial page display which is a search
if (!isset($VAR['refund_search_category'])) {
$refund_search_category = "ID";
} else {
$refund_search_category = $VAR['refund_search_category'];
}
$refund_search_term = $VAR['refund_search_term'];
// Search term validator (refund gateway), changes some variables appropiate to database values
$refund_gateway_search_term = refund_search_gateway($db, $refund_search_category, $refund_search_term);
// perform search with modified search term value - WORKS -for view page
$refund_search_result = display_refund_search($db, $refund_search_category, $refund_gateway_search_term, $page_no, $smarty);
$smarty->assign('refund_search_term', $refund_search_term);
$smarty->assign('refund_search_result', $refund_search_result);
示例7: parser
//.........这里部分代码省略.........
$this->_generator = (string) $rss->generator;
}
if (!empty($rss->lastbuilddate)) {
$this->_lastbuilddate = (string) $rss->modified;
}
if (!empty($rss->link->href)) {
$this->_link = (string) $rss->link->href;
}
if (!empty($rss->title)) {
$this->_title = (string) $rss->title;
}
if (!empty($rss->description)) {
$this->_description = (string) $rss->description;
}
} else {
//if (!empty($rss->channel['rss_language'])) $this->_language = (string) $rss->channel['rss_language'];
if (!empty($rss->channel['generator'])) {
$this->_generator = (string) $rss->channel['generator'];
}
//if (!empty($rss->channel['rss_copyright'])) $this->_copyright = (string) $rss->channel['rss_copyright'];
if (!empty($rss->channel['modified'])) {
$this->_lastbuilddate = (string) $rss->channel['modified'];
}
//if (!empty($rss->image['rss_url'])) $this->_imageurl = (string) $rss->image['rss_url'];
if (!empty($rss->channel['link'])) {
$this->_link = (string) $rss->channel['link'];
}
if (!empty($rss->channel['title'])) {
$this->_title = (string) $rss->channel['title'];
}
//if (!empty($rss->channel['rss_description'])) $this->_description = (string) $rss->channel['rss_description'];
}
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
$tmprss = xml2php($rss);
$items = $tmprss['entry'];
} else {
$items = $rss->items;
}
// With xmlparse
//var_dump($items);exit;
}
}
$i = 0;
// Loop on each record
if (is_array($items)) {
foreach ($items as $item) {
//var_dump($item);exit;
if ($rss->_format == 'rss') {
if (!empty($conf->global->EXTERNALRSS_USE_SIMPLEXML)) {
$itemLink = (string) $item->link;
$itemTitle = (string) $item->title;
$itemDescription = (string) $item->description;
$itemPubDate = (string) $item->pubDate;
$itemId = '';
$itemAuthor = '';
} else {
$itemLink = (string) $item['link'];
$itemTitle = (string) $item['title'];
$itemDescription = (string) $item['description'];
$itemPubDate = (string) $item['pubdate'];
$itemId = (string) $item['guid'];
$itemAuthor = (string) $item['author'];
}
// Loop on each category
$itemCategory = array();
if (is_array($item->category)) {
示例8: elseif
<?php
require_once 'include.php';
if (!xml2php("invoice")) {
$smarty->assign('error_msg', "Error in language file");
}
// Grab customers Information
$wo_id = $VAR['wo_id'];
$customer_id = $VAR['customer_id'];
$submit = $VAR['submit'];
$desc = $VAR['desc'];
$smarty->assign('customer_id', $VAR['customer_id']);
//$smarty->assign('invoice_id', $VAR['invoice_id']);
/* get Date Formatting value from database and assign it to $format*/
$q = 'SELECT * FROM ' . PRFX . 'TABLE_COMPANY';
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
} else {
$format = $rs->fields['COMPANY_DATE_FORMAT'];
}
// Stripping out the percentage signs so php can render it correctly
$literals = "%";
$Dformat = str_replace($literals, "", $format);
//Now lets display the right date format
if ($Dformat == 'd/m/Y' || $Dformat == 'd/m/y') {
$cur_date = $d . "/" . $m . "/" . $y;
} elseif ($Dformat == 'm/d/Y' || $Dformat == 'm/d/y') {
$cur_date = $m . "/" . $d . "/" . $y;
}
//Assign it to Smarty
示例9: elseif
<?php
require 'include.php';
if (!xml2php("schedule")) {
$smarty->assign('error_msg', "Error in language file");
}
/* load the date formate from the js calendar */
$wo_id = $_GET['wo_id'];
/* check if work order closed we don't want to reschedule a work order if it's closed */
if (isset($wo_id)) {
$q = "SELECT WORK_ORDER_CURRENT_STATUS FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_ID=" . $db->qstr($wo_id);
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
} else {
$status = $rs->fields['WORK_ORDER_CURRENT_STATUS'];
}
if ($status == '6') {
force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning');
} elseif ($status == '7') {
force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning');
} elseif ($status == '8') {
force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning');
} elseif ($status == '9') {
force_page('workorder', 'view&wo_id=' . $wo_id . '&error_msg=Can not set a schedule for closed work order&page_title=Work Order ID ' . $wo_id . '&type=warning');
}
}
$y = $VAR['y'];
$m = $VAR['m'];
$d = $VAR['d'];
/* get Date Formatting value from database and assign it to $format*/
示例10: count
<?php
require_once 'include.php';
if (!xml2php('stats')) {
$smarty->assign('error_msg', "Error in language file");
}
if (isset($VAR['submit'])) {
// General Section
/* Change dates to proper timestamps */
$start_date = date_to_timestamp($db, $VAR['start_date']);
$smarty->assign('start_date', $start_date);
$end_date = date_to_timestamp($db, $VAR['end_date']);
$smarty->assign('end_date', $end_date);
/* Count open work orders in selected period */
$q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_OPEN_DATE >= '{$start_date}' AND WORK_ORDER_OPEN_DATE <= '{$end_date}'";
if (!($rs = $db->Execute($q))) {
echo 'Error: ' . $db->ErrorMsg();
die;
}
$wo_opened = $rs->fields['count'];
$smarty->assign('wo_opened', $wo_opened);
/* Count closed work orders in selected period */
$q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_WORK_ORDER WHERE WORK_ORDER_CLOSE_DATE >= '{$start_date}' AND WORK_ORDER_CLOSE_DATE <= '{$end_date}'";
if (!($rs = $db->Execute($q))) {
echo 'Error: ' . $db->ErrorMsg();
die;
}
$wo_closed = $rs->fields['count'];
$smarty->assign('wo_closed', $wo_closed);
/* Count New Customers in selected period */
$q = "SELECT count(*) AS count FROM " . PRFX . "TABLE_CUSTOMER WHERE CREATE_DATE >= '{$start_date}' AND CREATE_DATE <= '{$end_date}'";
示例11: gateway_xml2php
<?php
// Load the Expense Functions
require_once 'include.php';
// Load the Translations for this Module
if (!xml2php('expense')) {
$smarty->assign('error_msg', "Error in language file");
}
$expenseID = $VAR['expenseID'];
// Load PHP Language Translations
$langvals = gateway_xml2php('expense');
// Make sure we got an Expense ID number
if (!isset($expenseID) || $expenseID == "") {
$smarty->assign('results', 'Please go back and select an expense record');
die;
}
// Delete the expense function call
if (!delete_expense($db, $expenseID)) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
} else {
force_page('expense', 'search&page_title=' . $langvals['expense_search_title']);
exit;
}
示例12:
<?php
/* customer Id */
require_once "include.php";
if (!xml2php("billing")) {
$smarty->assign('error_msg', "Error in language file");
}
$customer_id = $VAR['customer_id'];
$customer_name = $VAR['customer_name'];
$smarty->assign('customer_name', $customer_name);
$smarty->assign('customer_id', $customer_id);
/* if no customer id error */
if ($customer_id == '') {
force_page('core', 'error&error_msg=No Customer ID&menu=1&type=database');
exit;
}
/* check if gift cert is ebabled */
$q = "SELECT ACTIVE FROM " . PRFX . "CONFIG_BILLING_OPTIONS WHERE BILLING_OPTION='gift_billing'";
if (!($rs = $db->execute($q))) {
force_page('core', 'error&error_msg=MySQL Error: ' . $db->ErrorMsg() . '&menu=1&type=database');
exit;
}
/* if gift cert not enabled send them back */
if ($rs->fields['ACTIVE'] != 1) {
force_page('core', 'error&error_msg=Gift Certificate Billing is not enabled. To enbale gift certificates go to the Help menu and select Control Center. Then under the menu Billing Options select Payment Methods and check Gift Certificate. &menu=1&type=error');
exit;
}
/* if submit */
if (isset($VAR['submit'])) {
/* add */
if ($VAR['action'] == 'add') {
示例13: xml2php
function xml2php($xml)
{
$fils = 0;
$tab = false;
$array = array();
foreach ($xml->children() as $key => $value) {
$child = xml2php($value);
foreach ($node->attributes() as $ak => $av) {
// To deal with the attributes
$child[$ak] = (string) $av;
}
if ($tab == false && in_array($key, array_keys($array))) {
// Let's see if the new child is not in the array
$tmp = $array[$key];
// If this element is already in the array
$array[$key] = NULL;
// we will create an indexed array
$array[$key][] = $tmp;
$array[$key][] = $child;
$tab = true;
} elseif ($tab == true) {
$array[$key][] = $child;
//Add an element in an existing array
} else {
//Add a simple element
$array[$key] = $child;
}
$fils++;
}
if ($fils == 0) {
return (string) $xml;
}
return $array;
}
示例14:
<?php
//Load Language File
if (!xml2php("asset")) {
$smarty->assign('error_msg', "Error in language file");
}
$smarty->display('asset' . SEP . 'view.tpl');
示例15:
<?php
#########################################################
# This program is distributed under the terms and #
# conditions of the GPL #
# new.php #
# Version 0.0.1 Fri Sep 30 09:30:10 PDT 2005 #
# #
#########################################################
require_once "include.php";
//require_once("js/emp_new.js");
if (!xml2php("employees")) {
$smarty->assign('error_msg', "Error in language file");
}
$VAR['page_title'] = "Add New Employee";
if (isset($VAR['submit'])) {
$smarty->assign('VAR', $VAR);
if (!check_employee_ex($db, $VAR)) {
$smarty->assign('error_msg', 'The employees Display Name, ' . $VAR["displayName"] . ', already exists! Please use a differnt name.');
$smarty->display('employees' . SEP . 'new.tpl');
} else {
if (!($employee_id = insert_new_employee($db, $VAR))) {
$smarty->assign('error_msg', 'Falied to insert Employee');
} else {
force_page('employees', 'employee_details&employee_id=' . $employee_id . '&page_title=Employees');
}
}
} else {
$smarty->display('employees' . SEP . 'new.tpl');
}