• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP xml_to_object函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中xml_to_object函数的典型用法代码示例。如果您正苦于以下问题:PHP xml_to_object函数的具体用法?PHP xml_to_object怎么用?PHP xml_to_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了xml_to_object函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: processXML

 function processXML($rawXML)
 {
     global $messageStack;
     //echo '<pre>' . $rawXML . '</pre>';
     $rawXML = utf8_decode($rawXML);
     $rawXML = iconv("UTF-8", "UTF-8//IGNORE", $rawXML);
     //echo '<pre>' . $rawXML . '</pre>';
     if (!($objXML = xml_to_object($rawXML))) {
         return false;
     }
     // parse the submitted string, check for errors
     //echo 'parsed string = '; print_r($objXML); echo '<br />';
     if (DEBUG) {
         $messageStack->debug("\n\nobjXML array = " . serialize($objXML));
     }
     $this->username = $objXML->Request->UserID;
     $this->password = $objXML->Request->Password;
     $this->version = $objXML->Request->Version;
     $this->function = $objXML->Request->Function;
     $this->action = $objXML->Request->Action;
     $this->validateUser($this->username, $this->password);
     $this->processOrder($objXML);
     $extra_response = NULL;
     if (sizeof($this->successful) > 0) {
         $result_code = '0';
         $result_flag = 'success';
         $extra_response .= xmlEntry('SuccessfulOrders', implode(', ', $this->successful));
     }
     if (sizeof($this->failed) > 0) {
         $result_code = '90';
         $result_flag = 'error';
         $extra_response .= xmlEntry('FailedOrders', implode(', ', $this->failed));
     }
     $this->responseXML($result_code, implode("<br />", $this->response), $result_flag, $extra_response);
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:35,代码来源:orders.php


示例2: ODD_Import

/**
 * Import an ODD document.
 *
 * @param string $xml The XML ODD.
 *
 * @return ODDDocument
 */
function ODD_Import($xml)
{
    // Parse XML to an array
    $elements = xml_to_object($xml);
    // Sanity check 1, was this actually XML?
    if (!$elements || !$elements->children) {
        return false;
    }
    // Create ODDDocument
    $document = new ODDDocument();
    // Itterate through array of elements and construct ODD document
    $cnt = 0;
    foreach ($elements->children as $child) {
        $odd = ODD_factory($child);
        if ($odd) {
            $document->addElement($odd);
            $cnt++;
        }
    }
    // Check that we actually found something
    if ($cnt == 0) {
        return false;
    }
    return $document;
}
开发者ID:redvabel,项目名称:Vabelgg,代码行数:32,代码来源:opendd.php


示例3: _parse

 /**
  * Parse the xml into its components according to spec.
  * This first version is a little primitive.
  *
  * @param string $xml XML
  *
  * @return void
  */
 private function _parse($xml)
 {
     $xml = xml_to_object($xml);
     // sanity check
     if (isset($xml->name) && strcasecmp($xml->name, "methodCall") != 0) {
         throw new CallException(elgg_echo('CallException:NotRPCCall'));
     }
     // method name
     $this->methodname = $xml->children[0]->content;
     // parameters
     $this->params = $xml->children[1]->children;
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:20,代码来源:XMLRPCCall.php


示例4: submitXML

 function submitXML($id, $action = '', $hide_success = false, $inc_image = true)
 {
     global $messageStack;
     switch ($action) {
         case 'product_ul':
             if (!$this->buildProductUploadXML($id, $inc_image)) {
                 return false;
             }
             $url = 'products.php';
             break;
         case 'product_sync':
             if (!$this->buildProductSyncXML()) {
                 return false;
             }
             $url = 'sync.php';
             break;
         case 'confirm':
             if (!$this->buildConfirmXML()) {
                 return false;
             }
             $url = 'confirm.php';
             break;
         default:
             $messageStack->add(ZENCART_INVALID_ACTION, 'error');
             return false;
     }
     //echo 'Submit to ' . ZENCART_URL . '/soap/' . $url . ' and XML string = <pre>' . htmlspecialchars($this->strXML) . '</pre><br />';
     $this->response = doCURLRequest('POST', ZENCART_URL . '/soap/' . $url, $this->strXML);
     //echo 'XML response (at the PhreeBooks side from Zencart) => <pre>' . htmlspecialchars($this->response) . '</pre><br />' . chr(10);
     if (!$this->response) {
         return false;
     }
     if (!($results = xml_to_object($this->response))) {
         return false;
     }
     //echo 'Parsed string = '; print_r($results); echo '<br />';
     $this->result = $results->Response->Result;
     $this->code = $results->Response->Code;
     $this->text = $results->Response->Text;
     if ($this->code == 0) {
         if (!$hide_success) {
             $messageStack->add($this->text, strtolower($this->result));
         }
         return true;
     } else {
         $messageStack->add(ZENCART_TEXT_ERROR . $this->code . ' - ' . $this->text, strtolower($this->result));
         return false;
     }
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:49,代码来源:zencart.php


示例5: xml_builder

require_once DIR_FS_MODULES . 'phreedom/classes/backup.php';
/**************   page specific initialization  *************************/
$working = new xml_builder();
$mod_xml = new backup();
/***************   Act on the action request   *************************/
switch ($_REQUEST['action']) {
    case 'save':
        validate_security($security_level, 2);
        // read the input variables
        $mod = $_POST['mod'];
        $mod_admin = $mod . '_admin';
        require_once DIR_FS_MODULES . $mod . '/classes/install.php';
        $mod_info = new $mod_admin();
        // read the existing xml file to set as base, if it exists
        if (file_exists(DIR_FS_MODULES . $mod . '/' . $mod . '.xml')) {
            $working->output = xml_to_object(file_get_contents(DIR_FS_MODULES . $mod . '/' . $mod . '.xml'));
            // fix some lists
            if (!is_array($working->output->Module->Table)) {
                $working->output->Module->Table = array($working->output->Module->Table);
            }
            $temp = array();
            foreach ($working->output->Module->Table as $tkey => $table) {
                $tname = $table->Name;
                $temp[$tname] = $working->output->Module->Table[$tkey];
                // copy most of the info
                // index keys
                if (isset($table->Key)) {
                    if (!is_array($table->Key)) {
                        $table->Key = array($table->Key);
                    }
                    foreach ($table->Key as $kkey => $index) {
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php


示例6: loop_write

//function to write text to a file pointer. The function is called
//params: file_pointer, text variable, value
function loop_write($file, $txt, $num)
{
    for ($x = 1; $x <= $num; $x++) {
        fwrite($file, $txt);
    }
}
$x = 1;
$y = 0;
$z = 0;
$val = 1;
//Getting all the file_pointers, read and write pointers
list($read_file, $write_file) = file_open();
//$output is the array which consists of the text fields which is obtained from the xml schema file
list($data, $apparatus, $tabs) = xml_to_object($read_file[0], $val);
//$number is the number of pages which will be present in the easyauthor framework wizard
$aim = $data[$z++];
//****************************************************Generating process starts*****************************************************//
//echo $read_file[$x];
fwrite($write_file, $read_file[$x++] . $data[$z++] . $read_file[$x++] . $aim . "</h4>\n                </div>\n                    <div id='rootwizard'>\n                        <ul>");
for ($y = 1; $y <= $tabs[0]; $y++) {
    fwrite($write_file, "<li><a href='#tab" . $y . "' data-toggle='tab'>" . $tabs[$y] . "</a></li>");
}
fwrite($write_file, $read_file[$x++]);
loop_write($write_file, $read_file[$x++], 1);
fwrite($write_file, $read_file[$x++]);
for ($y = 1; $y <= $apparatus[0]; $y++) {
    fwrite($write_file, "<button type='button'>" . $apparatus[$y] . "</button> Click to get a " . $apparatus[$y] . "<br><br>");
}
fwrite($write_file, $read_file[$x++] . "<img src=" . $data[$z++] . " alt='Finding g' style='width:600px;height:350px;'>" . $read_file[$x++]);
开发者ID:kiran4399,项目名称:virtlab_3D,代码行数:31,代码来源:pages.php


示例7: deleteLabel

 function deleteLabel($method = '', $shipment_id = '')
 {
     global $db, $messageStack;
     if (!$shipment_id) {
         $messageStack->add('Cannot delete shipment, shipment ID was not provided!', 'error');
         return false;
     }
     $shipments = $db->Execute("select ship_date, tracking_id from " . TABLE_SHIPPING_LOG . " where shipment_id = " . $shipment_id);
     $tracking_number = $shipments->fields['tracking_id'];
     $strXML = $this->FormatUPSDeleteRequest($tracking_number);
     $url = MODULE_SHIPPING_UPS_TEST_MODE == 'Test' ? MODULE_SHIPPING_UPS_VOID_SHIPMENT_TEST : MODULE_SHIPPING_UPS_VOID_SHIPMENT;
     $SubmitXML = GetXMLString($strXML, $url, "POST");
     // Check for XML request errors
     if ($SubmitXML['result'] == 'error') {
         $messageStack->add(SHIPPING_UPS_CURL_ERROR . $SubmitXML['message'], 'error');
         return false;
     }
     $ResponseXML = xml_to_object($SubmitXML['xmlString']);
     $XMLFail = $ResponseXML->VoidShipmentResponse->Response->Error->ErrorCode;
     $XMLWarn = $ResponseXML->VoidShipmentResponse->Response->Error->ErrorSeverity;
     if ($XMLFail && $XMLWarn == 'Warning') {
         // soft error, report it and continue
         $messageStack->add('Label Delete Warning # ' . $XMLFail . ' - ' . $ResponseXML->VoidShipmentResponse->Response->Error->ErrorDescription, 'caution');
     } elseif ($XMLFail && $XMLWarn != 'Warning') {
         // hard error - return with bad news
         $messageStack->add('Label Delete Error # ' . $XMLFail . ' - ' . $ResponseXML->VoidShipmentResponse->Response->Error->ErrorDescription, 'error');
         return false;
     }
     // delete the label file
     $date = explode('-', $shipments->fields['ship_date']);
     $file_path = DIR_FS_MY_FILES . $_SESSION['company'] . '/shipping/labels/' . $this->code . '/' . $date[0] . '/' . $date[1] . '/' . $date[2] . '/';
     if (file_exists($file_path . $shipments->fields['tracking_id'] . '.lpt')) {
         $file_name = $shipments->fields['tracking_id'] . '.lpt';
     } elseif (file_exists($file_path . $shipments->fields['tracking_id'] . '.gif')) {
         $file_name = $shipments->fields['tracking_id'] . '.gif';
     } else {
         $file_name = false;
         // file does not exist, skip
     }
     if ($file_name) {
         if (!unlink($file_path . $file_name)) {
             $messageStack->add_session('Trouble deleting label file (' . $file_path . $file_name . ')', 'caution');
         }
     }
     // if we are here the delete was successful, the lack of an error indicates success
     $messageStack->add_session('Successfully deleted the shipping label. Tracking # ' . $tracking_number, 'success');
     return true;
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:48,代码来源:ups.php


示例8: table_import_xml

function table_import_xml($structure, $db_table, $filename)
{
    //echo 'structure = '; print_r($structure); echo '<br>';
    global $db;
    $data = file_get_contents($_FILES[$filename]['tmp_name'], "r");
    $temp = $structure->Module->Table;
    foreach ($structure->Module->Table as $table) {
        if ($table->Name == $db_table) {
            $tbl_active = $table;
            $tbl_tagname = $table->TagName;
            break;
        }
    }
    if (!($result = xml_to_object($data))) {
        return false;
    }
    // fix some special cases, multi elements with single entries convert to arrays
    if (is_object($result->{$tbl_tagname})) {
        $result = array($result);
    }
    foreach ($result->{$tbl_tagname} as $entry) {
        $sql_array = array();
        foreach ($tbl_active->Field as $field) {
            $tag = $field->TagName;
            if (isset($entry->{$tag})) {
                $sql_array[$field->Name] = $entry->{$tag};
            }
        }
        //echo 'sql_array to write to table ' . DB_PREFIX . $db_table . ': '; print_r($sql_array); echo '<br>';
        db_perform(DB_PREFIX . $db_table, $sql_array, 'insert');
        // fetch the id for use with dependent tables
        $id = db_insert_id();
        // now look into dependent tables
        if (is_object($tbl_active->LinkTable)) {
            $tbl_active->LinkTable = array($tbl_active->LinkTable);
        }
        if (isset($tbl_active->LinkTable)) {
            foreach ($tbl_active->LinkTable as $subtable) {
                $sub_sql_array = array();
                $sub_sql_array[$subtable->DependentField] = $id;
                $sub_table_name = $subtable->Name;
                foreach ($temp as $working) {
                    if ($subtable->Name == $working->Name) {
                        $subtag = $working->TagName;
                        foreach ($working->Field as $field) {
                            $fieldtag = $field->TagName;
                            if (isset($entry->{$subtag}->{$fieldtag})) {
                                $sub_sql_array[$field->Name] = $entry->{$subtag}->{$fieldtag};
                            }
                        }
                    }
                }
                //echo 'sql_array to write to subtable ' . DB_PREFIX . $sub_table_name . ': '; print_r($sub_sql_array); echo '<br><br>';
                db_perform(DB_PREFIX . $sub_table_name, $sub_sql_array, 'insert');
            }
        }
    }
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:58,代码来源:phreedom.php


示例9: xml_to_object

     $start_period = $start_period + 12;
     $runaway++;
     if ($runaway > 10) {
         break;
     }
 }
 if (DEBUG) {
     $messageStack->debug("\n  loading chart of accounts");
 }
 // load the retail chart as default if the chart of accounts table is empty
 $result = $db->Execute("select id from " . TABLE_JOURNAL_MAIN . " limit 1");
 $entries_exist = $result->RecordCount() > 0 ? true : false;
 $result = $db->Execute("select id from " . TABLE_CHART_OF_ACCOUNTS . " limit 1");
 $chart_exists = $result->RecordCount() > 0 ? true : false;
 if (!$entries_exist && !$chart_exists) {
     $accounts = xml_to_object(file_get_contents($default_chart));
     if (is_object($accounts->ChartofAccounts)) {
         $accounts = $accounts->ChartofAccounts;
     }
     // just pull the first one
     if (is_object($accounts->account)) {
         $accounts->account = array($accounts->account);
     }
     // in case of only one chart entry
     if (is_array($accounts->account)) {
         foreach ($accounts->account as $account) {
             $sql_data_array = array('id' => $account->id, 'description' => $account->description, 'heading_only' => $account->heading, 'primary_acct_id' => $account->primary, 'account_type' => $account->type);
             db_perform(TABLE_CHART_OF_ACCOUNTS, $sql_data_array, 'insert');
         }
     }
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php


示例10: validateAddress

 function validateAddress($address)
 {
     // this can be called with ajax or directly
     global $messageStack;
     $output = array();
     $xml = '?input=<VERIFYADDRESS>';
     $xml .= '<COMMAND>ZIP1</COMMAND>';
     $xml .= '<SERIALNO>830413</SERIALNO>';
     // Phreesoft, LLC common Dial-A-Zip validation login info for use only with this module
     $xml .= '<USER>830413</USER>';
     $xml .= '<PASSWORD>Phreedom_2012_LLC</PASSWORD>';
     $xml .= '<ADDRESS0>' . urlencode(remove_special_chars($address->ship_primary_name)) . '</ADDRESS0>';
     $xml .= '<ADDRESS1>' . urlencode(remove_special_chars($address->ship_contact)) . '</ADDRESS1>';
     $xml .= '<ADDRESS2>' . urlencode(remove_special_chars($address->ship_address1) . ' ' . remove_special_chars($address->ship_address2)) . '</ADDRESS2>';
     $xml .= '<ADDRESS3>' . urlencode(strtoupper($address->ship_city_town) . ', ' . strtoupper($address->ship_state_province) . ' ' . strip_alphanumeric($address->ship_postal_code)) . '</ADDRESS3>';
     $xml .= '</VERIFYADDRESS>';
     $result = file_get_contents(MODULE_SHIPPING_ENDICIA_DIAL_A_ZIP_URL . $xml);
     $result = substr($result, strpos($result, '>') + 1);
     $result = str_replace('<Dial-A-ZIP_Response>', '', trim($result));
     $result = str_replace('</Dial-A-ZIP_Response>', '', trim($result));
     $parts = xml_to_object($result);
     if ($parts->ReturnCode == '31') {
         $address->ship_contact = '';
         $address->ship_address1 = $parts->AddrLine1;
         $address->ship_address2 = $parts->AddrLine2;
         $address->ship_city_town = $parts->City;
         $address->ship_state_province = $parts->State;
         $address->ship_postal_code = $parts->ZIP5 . '-' . $parts->Plus4;
         $response = array('result' => 'success', 'xmlString' => '<address>' . object_to_xml($address) . '</address>', 'message' => 'The address will be corrected per results from Dial-A-Zip.');
     } else {
         $response = array('result' => 'error', 'message' => sprintf(SHIPPING_ENDICIA_ADD_VAL_ERROR, $parts->ReturnCode, $this->dialAZipCodes[$parts->ReturnCode]));
     }
     return $response;
     // xml string response
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:35,代码来源:endicia.php


示例11: array

             $install_mod = new $classname();
             $install_mod->load_reports($entry);
         }
     }
 }
 // load the files, parse, insert into db
 $rpt_cnt = 0;
 $orph_cnt = 0;
 $name_map = array();
 $reports = scandir(PF_DIR_MY_REPORTS);
 foreach ($reports as $report) {
     if (substr($report, 0, 3) != 'pf_') {
         continue;
     }
     $rpt_id = substr($report, 3);
     $rpt = xml_to_object(file_get_contents(PF_DIR_MY_REPORTS . $report));
     if ($rpt->PhreeformReport) {
         $rpt = $rpt->PhreeformReport;
     }
     // lose the container
     if ($rpt->security == 'u:-1;g:-1') {
         $rpt->security = 'u:' . $_SESSION['admin_id'] . 'g:-1';
     }
     // orphaned, set so current user can access
     $result = $db->Execute("select id from " . TABLE_PHREEFORM . " where doc_group = '" . $rpt->groupname . "' and doc_type = '0'");
     if ($result->RecordCount() == 0) {
         // orphaned put into misc category
         $orph_cnt++;
         $search_type = $rpt->reporttype == 'frm' ? 'misc:misc' : 'misc';
         // put in misc
         $result = $db->Execute("select id from " . TABLE_PHREEFORM . " where doc_group = '" . $search_type . "' and doc_type = '0'");
开发者ID:TrinityComputers,项目名称:PhreeBooksERP,代码行数:31,代码来源:pre_process.php


示例12: xml_to_object

function xml_to_object($xml = '')
{
    global $messageStack;
    $xml = trim($xml);
    if ($xml == '') {
        return '';
    }
    $output = new objectInfo();
    $runaway = 0;
    while (strlen($xml) > 0) {
        if (strpos($xml, '<?xml') === 0) {
            // header xml, ignore
            $xml = trim(substr($xml, strpos($xml, '>') + 1));
        } elseif (strpos($xml, '</') === 0) {
            // ending tag, should not happen
            $xml = trim(substr($xml, strpos($xml, '>') + 1));
        } elseif (substr($xml, 0, 3) == '<![') {
            // it's data, clean up and return
            return substr($xml, strpos($xml, '[CDATA[') + 7, strrpos($xml, ']]') - strpos($xml, '[CDATA[') - 7);
        } elseif (substr($xml, 0, 1) == '<') {
            // beginning tag, process
            $tag = substr($xml, 1, strpos($xml, '>') - 1);
            $attr = array();
            if (substr($tag, -1) == '/') {
                // the tag is self closing
                $selfclose = true;
                $tag = substr($xml, 1, strpos($xml, '>') - 2);
                $end_tag = '<' . $tag . '/>';
                $taglen = strlen($tag) + 3;
            } else {
                $selfclose = false;
                $end_tag = '</' . $tag . '>';
                $taglen = strlen($tag) + 2;
            }
            if (strpos($tag, ' ') !== false) {
                // there are tag properites
                $new_tag = substr($tag, 0, strpos($tag, ' '));
                $end_tag = $selfclose ? '<' . $tag . '/>' : '</' . $new_tag . '>';
                $temp = explode(' ', $tag);
                $tag = array_shift($temp);
                if (sizeof($temp) > 0) {
                    foreach ($temp as $prop) {
                        if ($prop) {
                            $oneval = explode('=', $prop);
                            $attr[$oneval[0]] = $onveal[1];
                        }
                    }
                }
            }
            // TBD, the attr array is set but how to add to output?
            if (!$selfclose && strpos($xml, $end_tag) === false) {
                $messageStack->add('PhreeBooks XML parse error looking for end tag: ' . $tag . ' but could not find it!', 'error');
                return false;
            }
            while (true) {
                $runaway++;
                if ($runaway > 10000) {
                    return $messageStack->add('Runaway counter 1 reached. There is an error in the xml entry!', 'error');
                }
                $data = $selfclose ? '' : trim(substr($xml, $taglen, strpos($xml, $end_tag) - $taglen));
                if (isset($output->{$tag})) {
                    if (!is_array($output->{$tag})) {
                        $output->{$tag} = array($output->{$tag});
                    }
                    array_push($output->{$tag}, xml_to_object($data));
                } else {
                    $output->{$tag} = xml_to_object($data);
                }
                $xml = trim(substr($xml, strpos($xml, $end_tag) + strlen($end_tag)));
                $next_tag = substr($xml, 1, strpos($xml, '>') - 1);
                if ($next_tag != $tag) {
                    break;
                }
            }
        } else {
            // it's probably just plain data, return with it
            return $xml;
        }
        $runaway++;
        if ($runaway > 10000) {
            $messageStack->add('Runaway counter 2 reached. There is an error in the xml entry!', 'error');
        }
    }
    return $output;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:85,代码来源:common_functions.php


示例13: array

            } else {
                if ($tag['tag'] == 'num' && $tag['level'] == 2) {
                    $count[0] = $tag['value'];
                }
            }
            $elements[$index]->name = $tag['tag'];
            $elements[$index]->attributes = $tag['attributes'];
            $elements[$index]->content = $tag['value'];
            if ($tag['type'] == "open") {
                // push
                $elements[$index]->children = array();
                $stack[count($stack)] =& $elements;
                $elements =& $elements[$index]->children;
            }
        }
        if ($tag['type'] == "close") {
            // pop
            $elements =& $stack[count($stack) - 1];
            unset($stack[count($stack) - 1]);
        }
    }
    //return array($tabs, $data);
    return array($type, $data, $count);
}
//Give the name of the xml file to be parsed
$rfile1 = fopen("/var/www/html/config/telugu.xml", "r") or die("Unable to open file!");
$xml = fread($rfile1, filesize("/var/www/html/config/telugu.xml"));
//Give the name of the attribute to be compared
$val = 'name';
list($output1, $output2, $count) = xml_to_object($xml, $val);
开发者ID:kiran4399,项目名称:virtual_lab,代码行数:30,代码来源:parse.php


示例14: ImportReport

function ImportReport($RptName = '', $RptFileName = '', $import_path = PF_DIR_DEF_REPORTS, $save_path = PF_DIR_MY_REPORTS)
{
    global $db, $messageStack;
    $rID = '';
    if ($RptFileName != '') {
        // then a locally stored report was chosen
        $path = $import_path . $RptFileName;
    } else {
        if (validate_upload('reportfile')) {
            $path = $_FILES['reportfile']['tmp_name'];
        } else {
            $messageStack->add(PHREEFORM_IMPORT_ERROR, 'error');
            return false;
        }
    }
    $handle = fopen($path, "r");
    $contents = fread($handle, filesize($path));
    fclose($handle);
    if (strpos($contents, 'Report Builder Export Tool')) {
        // it's an old style report
        require_once DIR_FS_MODULES . 'phreeform/functions/reportwriter.php';
        if (!($report = import_text_params(file($path)))) {
            return false;
        }
    } else {
        // assume it's a new xml type
        if (!($report = xml_to_object($contents))) {
            return false;
        }
        if (is_object($report->PhreeformReport)) {
            $report = $report->PhreeformReport;
        }
        // remove container tag
    }
    if ($RptName != '') {
        $report->title = $RptName;
    }
    // replace the title if provided
    // error check
    $result = $db->Execute("select id from " . TABLE_PHREEFORM . "\n\t  where doc_title = '" . addslashes($report->title) . "' and doc_type <> '0'");
    if ($result->RecordCount() > 0) {
        // the report name already exists, if file exists error, else write
        $rID = $result->fields['id'];
        if (file_exists($save_path . 'pf_' . $rID)) {
            // file exists - error and return
            $messageStack->add(sprintf(PHREEFORM_REPDUP, $report->title), 'error');
            return false;
        }
    }
    if (!($result = save_report($report, $rID, $save_path))) {
        return false;
    }
    return true;
}
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:54,代码来源:phreeform.php


示例15: fopen

}
//file pointers initialized and pointed
$wfile = fopen("/var/www/html/easyauthor/test.php", "w") or die("Unable to open file!");
$rfile = fopen("/var/www/html/config/telugu.xml", "r") or die("Unable to open file!");
$rfile1 = fopen("/var/www/html/src/stitch-1.txt", "r") or die("Unable to open file!");
$rfile3 = fopen("/var/www/html/src/stitch-3.txt", "r") or die("Unable to open file!");
$rfile5 = fopen("/var/www/html/src/stitch-5.txt", "r") or die("Unable to open file!");
//file pointers reading or writing
$xml = fread($rfile, filesize("/var/www/html/config/telugu.xml"));
$txt1 = fread($rfile1, filesize("/var/www/html/src/stitch-1.txt"));
$txt3 = fread($rfile3, filesize("/var/www/html/src/stitch-3.txt"));
$txt5 = fread($rfile5, filesize("/var/www/html/src/stitch-5.txt"));
//$val is the variable which consists of the attribute in the xml file. You get the data which is enclosed in the attribute
$val = 'name';
//$output is the array which consists of the text fields which is obtained from the xml schema file
list($type, $data, $count, $tabs) = xml_to_object($xml, $val);
//$number is the number of pages which will be present in the easyauthor framework wizard
$number = $count[0];
//*********************************Generating process starts*******************************//
//Initializing HTML and scripts
fwrite($wfile, $txt1);
//Specifing the language
$txt = "\$" + "lang = {$lang}";
fwrite($wfile, $txt);
//Tab generating,initializing and naming
for ($x = 1; $x <= $number; $x++) {
    $word = $tabs[$x];
    $txt2 = "<li><a href='#tab{$x}' data-toggle='tab'>{$word}</a></li>";
    fwrite($wfile, $txt2);
}
fwrite($wfile, $txt3);
开发者ID:kiran4399,项目名称:virtual_lab,代码行数:31,代码来源:pages.php


示例16: queryUSPS

 function queryUSPS($pkg, $user_choices, $num_packages)
 {
     // Fetch the book rates from USPS
     global $messageStack;
     $arrRates = array();
     if (MODULE_SHIPPING_USPS_SERVER == 'production') {
         $strXML = 'API=RateV2&XML=' . $this->production_FormatUSPSRateRequest($pkg, $num_packages);
         $RateURL = 'http://Production.ShippingAPIs.com/ShippingAPI.dll';
     } else {
         $strXML = 'API=RateV2&XML=' . $this->FormatUSPSRateRequest($pkg, $num_packages);
         $RateURL = 'http://testing.shippingapis.com/ShippingAPITest.dll';
     }
     $SubmitXML = GetXMLString($strXML, $RateURL, "GET");
     // Check for XML request errors
     if ($SubmitXML['result'] == 'error') {
         $messageStack->add(SHIPPING_USPS_CURL_ERROR . $SubmitXML['message'], 'error');
         return false;
     }
     $ResponseXML = xml_to_object($SubmitXML['xmlString']);
     // Check for errors
     $XMLFail = $ResponseXML->Error->Number;
     if ($XMLFail) {
         // fetch the error code
         $XMLErrorDesc = $ResponseXML->Error->Description;
         $messageStack->add($this->code . ' - ' . $XMLFail . ' - ' . $XMLErrorDesc, 'error');
         return false;
     }
     // Fetch the USPS Rates
     return $this->GetUSPSRateArray($ResponseXML);
 }
开发者ID:siwiwit,项目名称:PhreeBooksERP,代码行数:30,代码来源:usps.php


示例17: testElggPluginManifestFromXMLEntity

 public function testElggPluginManifestFromXMLEntity()
 {
     $xml = xml_to_object($manifest_file = file_get_contents(get_config('path') . 'engine/tests/test_files/plugin_17/manifest.xml'));
     $manifest = new ElggPluginManifest($xml);
     $this->assertIsA($manifest, 'ElggPluginManifest');
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:6,代码来源:plugins.php


示例18: sizeof

$x->close();
######## CREATE GEOJSON ######## CREATE GEOJSON ######## CREATE GEOJSON ######
$eventsCount = sizeof($events);
$x2GeoStruct = array();
$x2ImpactStruct = array();
$toBeEncoded1 = array("type" => "FeatureCollection", "features" => []);
for ($i = 0; $i < $eventsCount; $i++) {
    $toBeEncoded1[features][$i] = array("type" => "Feature", "geometry" => ["type" => "null", "coordinates" => []], "properties" => array("id" => $events[$i][id], "location" => "null", "description" => $events[$i][description], "planned" => "null", "alternativeRoute" => "N/A", "eventType" => $events[$i][eventType], "expectedResolution" => "null", "impact" => "null", "locationAreas" => "null", "status" => "null", "eventCreated" => $events[$i][startDate], "eventModified" => $events[$i][lastModified]));
    //function call to XMLStructReader.php script for conversion to struct
    $x2ImpactStruct[] = xml_to_object($events[$i][trafficImpactsXML]);
    $impactCount = sizeof($x2ImpactStruct[$i]->children);
    $tmpImpactString = "";
    for ($p = 0; $p < $impactCount; $p++) {
        $tmpImpactString .= $x2ImpactStruct[$i]->children[$p]->content . ". ";
    }
    $x2GeoStruct[] = xml_to_object($events[$i][geoXML]);
    $geoCount = sizeof($x2GeoStruct[$i]->children);
    for ($j = 0; $j < $geoCount; $j++) {
        $tmpGeoType = $x2GeoStruct[$i]->children[0]->children[1]->content;
        $tmpCoords = $x2GeoStruct[$i]->children[0]->children[2]->content;
        //function call to helperFunctions.php
        $coordsFinal = convertCoords($tmpCoords);
        $closePolygon = array((double) $coordsFinal[0][0], (double) $coordsFinal[0][1]);
        $tmpFinalCoordLen = sizeof($coordsFinal);
        $coordsFinal[$tmpFinalCoordLen] = $closePolygon;
    }
    $toBeEncoded1[features][$i][properties][impact] = $tmpImpactString;
    $toBeEncoded1[features][$i][geometry][type] = "Polygon";
    $toBeEncoded1[features][$i][geometry][coordinates] = [$coordsFinal];
}
//
开发者ID:HamishClulee,项目名称:NZRoadInfo,代码行数:31,代码来源:chchTraffic.php


示例19: load_plugin_manifest

/**
 * Load and parse a plugin manifest from a plugin XML file.
 *
 * Example file:
 *
 * <plugin_manifest>
 * 	<field key="author" value="Curverider Ltd" />
 *  	<field key="version" value="1.0" />
 * 	<field key="description" value="My plugin description, keep it short" />
 *  	<field key="website" value="http://www.elgg.org/" />
 *  	<field key="copyright" value="(C) Curverider 2008-2010" />
 *  	<field key="licence" value="GNU Public License version 2" />
 * </plugin_manifest>
 *
 * @param string $plugin Plugin name.
 * @return array of values
 */
function load_plugin_manifest($plugin)
{
    global $CONFIG;
    $xml = xml_to_object(file_get_contents($CONFIG->pluginspath . $plugin . "/manifest.xml"));
    if ($xml) {
        $elements = array();
        foreach ($xml->children as $element) {
            $key = $element->attributes['key'];
            $value = $element->attributes['value'];
            $elements[$key] = $value;
        }
        return $elements;
    }
    return false;
}
开发者ID:ashwiniravi,项目名称:Elgg-Social-Network-Single-Sign-on-and-Web-Statistics,代码行数:32,代码来源:plugins.php


示例20: __construct

 /**
  * Load a manifest file, XmlElement or path to manifest.xml file
  *
  * @param mixed  $manifest  A string, XmlElement, or path of a manifest file.
  * @param string $plugin_id Optional ID of the owning plugin. Used to
  *                          fill in some values automatically.
  */
 public function __construct($manifest, $plugin_id = null)
 {
     if ($plugin_id) {
         $this->pluginID = $plugin_id;
     }
     // see if we need to construct the xml object.
     if ($manifest instanceof XmlElement) {
         $manifest_obj = $manifest;
     } else {
         if (substr(trim($manifest), 0, 1) == '<') {
             // this is a string
             $raw_xml = $manifest;
         } elseif (is_file($manifest)) {
             // this is a file
             $raw_xml = file_get_contents($manifest);
         }
         $manifest_obj = xml_to_object($raw_xml);
     }
     if (!$manifest_obj) {
         throw new PluginException(elgg_echo('PluginException:InvalidManifest', array($this->getPluginID())));
     }
     // set manifest api version
     if (isset($manifest_obj->attributes['xmlns'])) {
         $namespace = $manifest_obj->attributes['xmlns'];
         $version = str_replace($this->namespace_root, '', $namespace);
     } else {
         $version = 1.7;
     }
     $this->apiVersion = $version;
     $parser_class_name = 'ElggPluginManifestParser' . str_replace('.', '', $this->apiVersion);
     // @todo currently the autoloader freaks out if a class doesn't exist.
     try {
         $class_exists = class_exists($parser_class_name);
     } catch (Exception $e) {
         $class_exists = false;
     }
     if ($class_exists) {
         $this->parser = new $parser_class_name($manifest_obj, $this);
     } else {
         throw new PluginException(elgg_echo('PluginException:NoAvailableParser', array($this->apiVersion, $this->getPluginID())));
     }
     if (!$this->parser->parse()) {
         throw new PluginException(elgg_echo('PluginException:ParserError', array($this->apiVersion, $this->getPluginID())));
     }
     return true;
 }
开发者ID:redvabel,项目名称:Vabelgg,代码行数:53,代码来源:ElggPluginManifest.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP xml_unserialize函数代码示例发布时间:2022-05-23
下一篇:
PHP xml_to_array函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap