本文整理汇总了PHP中XML2Array::parse方法的典型用法代码示例。如果您正苦于以下问题:PHP XML2Array::parse方法的具体用法?PHP XML2Array::parse怎么用?PHP XML2Array::parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XML2Array
的用法示例。
在下文中一共展示了XML2Array::parse方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: touch
$xmlName[0] = $testXmlFile;
}
if ($testXmlFile != '') {
$xmlStr = file_get_contents($testXmlFile);
if (!file_exists($dir . '/' . basename($xmlName[0]))) {
touch($dir . '/' . basename($xmlName[0]));
$handle = fopen($dir . '/' . basename($xmlName[0]), 'w+');
fwrite($handle, $xmlStr);
fclose($handle);
}
include_once "xml2array.php";
$xml_debugger = new XML2Array();
if ($xmlStr != '') {
$xmlStr = preg_replace('/\\<transition(.*?)\\>/', '<transition empty="true"$1>', $xmlStr);
}
$arrXml = $xml_debugger->parse($xmlStr);
if (!is_array($arrXml)) {
$xmlStr = cu3er__our_fopen($testXmlFile);
if ($xmlStr == false) {
echo $cu3er_messages['missingXML'];
} else {
$xmlStr = preg_replace('/\\<transition(.*?)\\>/', '<transition empty="true"$1>', $xmlStr);
$arrXml = $xml_debugger->parse($xmlStr);
}
}
if (!is_array($arrXml)) {
echo $cu3er_messages['notXML'];
} else {
$xml_parse = simplexml_load_string($xmlStr);
/*@chmod($testXmlFile, 0777);
@chmod($cu3er_pathDir . '/CU3ER.swf', 0777);*/
示例2: cu3er__admin_manage
//.........这里部分代码省略.........
if ($pth[$i] == $wpContentDir) {
unset($pth[$i], $pth[$i + 1]);
$delFlag = false;
}
if ($delFlag == true) {
unset($pth[$i]);
}
}
unset($pth[$size - 1]);
$cu3er_pathDir = $uploadsDir['baseurl'] . '/' . implode("/", $pth);
$dir = $uploadsDir['basedir'] . '/' . implode("/", $pth);
$uploadErrors = array(0 => "There is no error, the file uploaded with success", 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini", 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form", 3 => "The uploaded file was only partially uploaded", 4 => "No file was uploaded", 6 => "Missing a temporary folder");
if ($_FILES['newXML']['name'] != '' && ($_FILES['newXML']["tmp_name"] != '' || $_FILES['newXML']['error'] > 0)) {
// if uploaded file //
$file_name = preg_replace('/[^.A-Z0-9_ !@#$%^&()+={}\\[\\]\',~`-]|\\.+$/i', "", basename($_FILES['newXML']['name']));
@unlink($dir . '/' . $file_name);
if (!move_uploaded_file($_FILES['newXML']["tmp_name"], $dir . '/' . $file_name)) {
echo "<div class='error'>File could not be saved. " . $uploadErrors[$_FILES['newXML']['error']] . '</div>';
exit(0);
} else {
$testXmlFile = $dir . '/' . $file_name;
}
}
$xmlName[0] = $testXmlFile;
$xmlStr = file_get_contents($testXmlFile);
if (!file_exists($dir . '/' . basename($xmlName[0]))) {
touch($dir . '/' . basename($xmlName[0]));
$handle = fopen($dir . '/' . basename($xmlName[0]), 'w+');
fwrite($handle, $xmlStr);
fclose($handle);
}
include_once "php/xml2array.php";
$xml_debugger = new XML2Array();
$arrXml = $xml_debugger->parse($xmlStr);
if (!is_array($arrXml)) {
$xmlStr = cu3er__our_fopen($testXmlFile);
if ($xmlStr == false) {
$message .= $cu3er_messages['missingXML'];
$continue = false;
} else {
$arrXml = $xml_debugger->parse($xmlStr);
}
}
if ($continue) {
if (!is_array($arrXml)) {
$message .= $cu3er_messages['notXML'];
} else {
cu3er__chmodDir($dir, 0777, 0777);
$arrXml = cu3er__array_remove_empty($arrXml['data']);
$width_type = explode("%", $arrXml['project_settings']['width']['value'] . 'perc');
$width_type = $width_type[1] == 'perc' ? '%' : 'px';
$height_type = explode("%", $arrXml['project_settings']['height']['value'] . 'perc');
$height_type = $height_type[1] == 'perc' ? '%' : 'px';
$xml['Slideshows'] = array('width' => $arrXml['project_settings']['width']['value'] != '' ? str_replace('%', '', $arrXml['project_settings']['width']['value']) : $w, 'height' => $arrXml['project_settings']['height']['value'] != '' ? str_replace('%', '', $arrXml['project_settings']['height']['value']) : $h, 'width_type' => $width_type, 'height_type' => $height_type, 'background' => $arrXml['settings']['background']['color']['value'], 'backgroundType' => $arrXml['settings']['background']['color']['attr']['transparent'] == 'true' ? 'transparent' : 'color', 'bg_use_image' => $arrXml['settings']['background']['image']['attr']['use_image'], 'bg_align_to' => $arrXml['settings']['background']['image']['attr']['align_to'], 'bg_align_pos' => $arrXml['settings']['background']['image']['attr']['align_pos'], 'bg_x' => $arrXml['settings']['background']['image']['attr']['x'], 'bg_y' => $arrXml['settings']['background']['image']['attr']['y'], 'sdw_show' => $arrXml['settings']['shadow']['attr']['show'], 'sdw_use_image' => $arrXml['settings']['shadow']['attr']['use_image'], 'sdw_color' => $arrXml['settings']['shadow']['attr']['color'], 'sdw_alpha' => $arrXml['settings']['shadow']['attr']['alpha'], 'sdw_blur' => $arrXml['settings']['shadow']['attr']['blur'], 'sdw_corner_tl' => $arrXml['settings']['shadow']['attr']['corner_TL'], 'sdw_corner_tr' => $arrXml['settings']['shadow']['attr']['corner_TR'], 'sdw_corner_bl' => $arrXml['settings']['shadow']['attr']['corner_BL'], 'sdw_corner_br' => $arrXml['settings']['shadow']['attr']['corner_BR'], 'pr_image' => $arrXml['preloader']['image']['url']['value'], 'pr_align_to' => $arrXml['preloader']['image']['attr']['align_to'], 'pr_align_pos' => $arrXml['preloader']['image']['attr']['align_pos'], 'pr_x' => $arrXml['preloader']['image']['attr']['x'], 'pr_y' => $arrXml['preloader']['image']['attr']['y'], 'pr_scaleX' => $arrXml['preloader']['image']['attr']['scaleX'], 'pr_scaleY' => $arrXml['preloader']['image']['attr']['scaleY'], 'pr_loader_direction' => $arrXml['preloader']['image']['attr']['loader_direction'], 'pr_alpha_loader' => $arrXml['preloader']['image']['attr']['alpha_loader'], 'pr_alpha_bg' => $arrXml['preloader']['image']['attr']['alpha_bg'], 'pr_tint_loader' => $arrXml['preloader']['image']['attr']['tint_loader'], 'pr_tint_bg' => $arrXml['preloader']['image']['attr']['tint_bg'], 'pr_width' => $arrXml['preloader']['image']['attr']['height'], 'pr_height' => $arrXml['preloader']['image']['attr']['height'], 'xml_location' => $cu3er_pathDir . '/' . basename($xmlName[0]), 'modified' => date('Y-n-d H:i:s'), 'id' => $_GET['id']);
if (is_array($arrXml['settings']['branding'])) {
$xml['Slideshows']['br_align_to'] = $arrXml['settings']['branding']['attr']['align_to'];
$xml['Slideshows']['br_align_pos'] = $arrXml['settings']['branding']['attr']['align_pos'];
$xml['Slideshows']['br_x'] = $arrXml['settings']['branding']['attr']['x'];
$xml['Slideshows']['br_y'] = $arrXml['settings']['branding']['attr']['y'];
}
$xml['Defaults'] = array('salign_pos' => $arrXml['slides']['attr']['align_pos'], 'sx' => $arrXml['slides']['attr']['x'], 'sy' => $arrXml['slides']['attr']['y'], 'swidth' => $arrXml['slides']['attr']['width'], 'sheight' => $arrXml['slides']['attr']['height'], 'scaleX' => $arrXml['defaults']['slide']['image']['attr']['scaleX'], 'scaleY' => $arrXml['defaults']['slide']['image']['attr']['scaleY'], 'id' => $_GET['id']);
foreach ($xml['Slideshows'] as $key => $value) {
if ($value == '') {
$xml['Slideshows'][$key] = 'emp7y';
}
}