本文整理汇总了PHP中formatXmlString函数的典型用法代码示例。如果您正苦于以下问题:PHP formatXmlString函数的具体用法?PHP formatXmlString怎么用?PHP formatXmlString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了formatXmlString函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: pestle_cli
/**
* Generates bin/magento command files
* This command generates the necessary files and configuration
* for a new command for Magento 2's bin/magento command line program.
*
* pestle.phar Pulsestorm_Generate Example
*
* Creates
* app/code/Pulsestorm/Generate/Command/Example.php
* app/code/Pulsestorm/Generate/etc/di.xml
*
* @command generate_command
* @argument module_name In which module? [Pulsestorm_Helloworld]
* @argument command_name Command Name? [Testbed]
*/
function pestle_cli($argv)
{
$module_info = getModuleInformation($argv['module_name']);
$namespace = $module_info->vendor;
$module_name = $module_info->name;
$module_shortname = $module_info->short_name;
$module_dir = $module_info->folder;
$command_name = $argv['command_name'];
// $command_name = input("Command Name?", 'Testbed');
output($module_dir);
createPhpClass($module_dir, $namespace, $module_shortname, $command_name);
$path_di_xml = createDiIfNeeded($module_dir);
$xml_di = simplexml_load_file($path_di_xml);
//get commandlist node
$nodes = $xml_di->xpath('/config/type[@name="Magento\\Framework\\Console\\CommandList"]');
$xml_type_commandlist = array_shift($nodes);
if (!$xml_type_commandlist) {
throw new Exception("Could not find CommandList node");
}
$argument = simpleXmlAddNodesXpath($xml_type_commandlist, '/arguments/argument[@name=commands,@xsi:type=array]');
$full_class = $namespace . '\\' . $module_shortname . '\\Command\\' . $command_name;
$item_name = str_replace('\\', '_', strToLower($full_class));
$item = $argument->addChild('item', $full_class);
$item->addAttribute('name', $item_name);
$item->addAttribute('xsi:type', 'object', 'http://www.w3.org/2001/XMLSchema-instance');
$xml_di = formatXmlString($xml_di->asXml());
writeStringToFile($path_di_xml, $xml_di);
}
开发者ID:astorm,项目名称:pestle,代码行数:43,代码来源:module.php
示例2: pestle_cli
/**
* Creates a Route XML
* generate_route module area id
* @command generate_route
*/
function pestle_cli($argv)
{
$module_info = askForModuleAndReturnInfo($argv);
$module = $module_info->name;
$legend = ['frontend' => 'standard', 'adminhtml' => 'admin'];
$areas = array_keys($legend);
$area = inputOrIndex('Which area? [frontend, adminhtml]', 'frontend', $argv, 1);
$router_id = $legend[$area];
if (!in_array($area, $areas)) {
throw new Exception("Invalid areas");
}
$frontname = inputOrIndex('Frontname/Route ID?', null, $argv, 2);
$route_id = $frontname;
$path = $module_info->folder . '/etc/' . $area . '/routes.xml';
if (!file_exists($path)) {
$xml = simplexml_load_string(getBlankXml('routes'));
writeStringToFile($path, $xml->asXml());
}
$xml = simplexml_load_file($path);
simpleXmlAddNodesXpath($xml, "router[@id={$router_id}]/" . "route[@id={$route_id},@frontName={$frontname}]/" . "module[@name={$module}]");
writeStringToFile($path, formatXmlString($xml->asXml()));
$class = str_replace('_', '\\', $module) . '\\Controller\\Index\\Index';
$controllerClass = createControllerClass($class, $area);
$path_controller = getPathFromClass($class);
writeStringToFile($path_controller, $controllerClass);
output($path);
output($path_controller);
}
开发者ID:mrtuvn,项目名称:pestle,代码行数:33,代码来源:module.php
示例3: lsf_xml_save
function lsf_xml_save($doc)
{
// Save XML data to file
$xml = $doc->saveXML();
$file_handle = fopen('data/raumplan.xml', 'w');
fwrite($file_handle, formatXmlString($xml));
fclose($file_handle);
}
开发者ID:ItsLines,项目名称:ThePreviouslyDesigned,代码行数:8,代码来源:lsf_lib.php
示例4: createViewXmlFile
function createViewXmlFile($base_folder, $package, $theme, $area)
{
$path = $base_folder . '/etc/view.xml';
$xml = simplexml_load_string(getBlankXml('view'));
$media = simpleXmlAddNodesXpath($xml, 'media');
output("Creating: {$path}");
writeStringToFile($path, formatXmlString($xml->asXml()));
}
开发者ID:astorm,项目名称:pestle,代码行数:8,代码来源:module.php
示例5: generateDiConfiguration
function generateDiConfiguration($argv)
{
$moduleInfo = getModuleInformation($argv['module']);
$pathAndXml = loadOrCreateDiXml($moduleInfo);
$path = $pathAndXml['path'];
$di_xml = $pathAndXml['xml'];
$preference = $di_xml->addChild('preference');
$preference['for'] = $argv['for'];
$preference['type'] = $argv['type'];
writeStringToFile($path, formatXmlString($di_xml->asXml()));
}
开发者ID:astorm,项目名称:pestle,代码行数:11,代码来源:module.php
示例6: pestle_cli
/**
* Generates a Magento 2.1 ui grid listing and support classes.
*
* @command magento2:generate:ui:add-column-sections
* @argument listing_file Which Listing File? []
* @argument column_name Column Name? [ids]
* @argument index_field Index Field/Primary Key? [entity_id]
*/
function pestle_cli($argv)
{
$xml = simplexml_load_file($argv['listing_file']);
validateAsListing($xml);
$columns = getOrCreateColumnsNode($xml);
$sectionsColumn = $columns->addChild('selectionsColumn');
$sectionsColumn->addAttribute('name', $argv['column_name']);
$argument = addArgument($sectionsColumn, 'data', 'array');
$configItem = addItem($argument, 'config', 'array');
$indexField = addItem($configItem, 'indexField', 'string', $argv['index_field']);
writeStringToFile($argv['listing_file'], formatXmlString($xml->asXml()));
}
开发者ID:astorm,项目名称:pestle,代码行数:20,代码来源:module.php
示例7: createRoutesXmlFile
function createRoutesXmlFile($module_info, $area, $frontname, $router_id, $route_id)
{
$module = $module_info->name;
$path = $module_info->folder . '/etc/' . $area . '/routes.xml';
if (!file_exists($path)) {
$xml = simplexml_load_string(getBlankXml('routes'));
writeStringToFile($path, $xml->asXml());
}
$xml = simplexml_load_file($path);
simpleXmlAddNodesXpath($xml, "router[@id={$router_id}]/" . "route[@id={$route_id},@frontName={$frontname}]/" . "module[@name={$module}]");
writeStringToFile($path, formatXmlString($xml->asXml()));
output($path);
return $xml;
}
开发者ID:astorm,项目名称:pestle,代码行数:14,代码来源:module.php
示例8: pestle_cli
/**
* One Line Description
*
* @command generate_acl
* @argument module_name Which Module? [Pulsestorm_HelloWorld]
* @argument rule_ids Rule IDs? [<$module_name$>::top,<$module_name$>::config,]
*/
function pestle_cli($argv)
{
extract($argv);
$rule_ids = explode(',', $rule_ids);
$rule_ids = array_filter($rule_ids);
$xml = simplexml_load_string(getBlankXml('acl'));
$nodes = $xml->xpath('//resource[@id="Magento_Backend::admin"]');
$node = array_shift($nodes);
foreach ($rule_ids as $id) {
$id = trim($id);
$node = $node->addChild('resource');
$node->addAttribute('id', $id);
$node->addAttribute('title', 'TITLE HERE FOR ' . $id);
}
$path = getBaseModuleDir($module_name) . '/etc/acl.xml';
writeStringToFile($path, formatXmlString($xml->asXml()));
output("Created {$path}");
}
开发者ID:cmykna,项目名称:pestle,代码行数:25,代码来源:module.php
示例9: backupOldCode
function backupOldCode($arguments, $options)
{
$xmls = [];
$frontend_models = getFrontendModelNodesFromMagento1SystemXml($xmls);
foreach ($frontend_models as $file => $nodes) {
$new_file = str_replace(['/Users/alanstorm/Sites/magento-1-9-2-2.dev', '/local'], '', $file);
$new_file = getBaseMagentoDir() . str_replace('/etc/', '/etc/adminhtml/', $new_file);
$xml = simplexml_load_file($new_file);
foreach ($nodes as $node) {
list($path, $frontend_alias) = explode('::', $node);
list($section, $group, $field) = explode('/', $path);
$node = getSectionXmlNodeFromSectionGroupAndField($xml, $section, $group, $field);
if ($node->frontend_model) {
output("The frontend_model node already exists: " . $path);
continue;
}
$class = convertAliasToClass($frontend_alias);
$node->frontend_model = $class;
}
file_put_contents($new_file, formatXmlString($xml->asXml()));
}
//search XML files
// $base = getBaseMagentoDir();
// $files = `find $base -name '*.xml'`;
// $files = preg_split('%[\r\n]%', $files);
// $files = array_filter($files, function($file){
// return strpos($file, '/view/') !== false &&
// !is_dir($file);
// });
//
// $report;
// foreach($files as $file)
// {
// $xml = simplexml_load_file($file);
// if(!$xml->head){ continue; }
// output($file);
// foreach($xml->head->children() as $node)
// {
// output(' ' . $node->getName());
// }
// }
}
开发者ID:astorm,项目名称:pestle,代码行数:42,代码来源:module.php
示例10: download_specific_timetable
function download_specific_timetable($place_origin, $name_origin, $place_destination, $type_destination, $filepath)
{
$xml_string = getUnfilteredWebData($place_origin, $name_origin, $place_destination, $type_destination);
$xml_string_array = cut_xml_per_route($xml_string);
$timetable_dom = new DomDocument('1.0');
$rootNode = $timetable_dom->createElement('fahrplan');
$timetable_dom->appendChild($rootNode);
$rootNode->setAttribute("datum", date("H:i - d.m.y"));
foreach ($xml_string_array as $xml_string) {
$dom = new domDocument();
@$dom->loadHTML($xml_string);
$dom->preserveWhiteSpace = false;
$transport_type_array = get_transport_type_array($dom);
$time_array = get_time_array($dom);
$station_array = get_station_array($dom);
$rootNode->setAttribute("start", $station_array[0]);
$rootNode->setAttribute("stop", $station_array[sizeof($station_array) - 1]);
$rootNode->appendChild(create_route_node($timetable_dom, $station_array, $transport_type_array, $time_array));
}
$xml_timetable = $timetable_dom->saveXML();
$file_handle = fopen($filepath, 'w');
fwrite($file_handle, formatXmlString($xml_timetable));
fclose($file_handle);
}
开发者ID:ItsLines,项目名称:ThePreviouslyDesigned,代码行数:24,代码来源:efa_lib.php
示例11: str_replace
$formattedResults = str_replace('<DIV>', '', $formattedResults);
$formattedResults = str_replace('<pre>', '', $formattedResults);
$formattedResults = str_replace('</pre>', '', $formattedResults);
$formattedResults = str_replace('</div>', "\n", $formattedResults);
$formattedResults = str_replace('</DIV>', "\n", $formattedResults);
$formattedResults = str_replace(' ', " ", $formattedResults);
$formattedResults = str_replace('', " ", $formattedResults);
$sysout .= $clientName . "\n" . $formattedResults . "\n\n";
}
$xml->addAttribute('errors', $errors);
$xml->addAttribute('tests', $tests);
$xml->addAttribute('failures', $failures);
$xml->addChild('system-out')->addCData($sysout);
$userAgentName = $useragent['name'];
echo '<strong>' . $userAgentName . '</strong> finished';
echo "<pre>" . htmlentities(formatXmlString($xml->asXML())) . "</pre>";
if ($_REQUEST['output'] == "file") {
$fileName = "{$outputDir}/{$userAgentName}.xml";
$fileName = preg_replace('/\\s+/', '_', $fileName);
$xml->asXML($fileName);
echo " and file writen to " . $fileName;
//$root->asXML("/tmp/testswarm/job-$jobId-".date('Ymd-His').".xml");
}
echo "<br/>";
}
}
echo 'finished';
//==============================================================================
// helper
//==============================================================================
class SimpleXMLExtended extends SimpleXMLElement
开发者ID:hoschi,项目名称:testswarm,代码行数:31,代码来源:getxml.php
示例12: formatOutput
function formatOutput($input, $_level_key_name)
{
$pattern = array('/\\<\\?xml.*\\?\\>/', '/\\<__rootnode .*\\">|\\<\\/__rootnode\\>/', "/ {$_level_key_name}=\".*?\"/");
$output = preg_replace($pattern, '', $input);
$pattern = array('/\\s*>/', '/^ /', '/\\n /');
$replacement = array('>', '', "\n");
$char_list = "\t\n\r\v";
$output = trim($output, $char_list);
$output = preg_replace($pattern, $replacement, $output);
$output = formatXmlString($output);
$output = preg_replace('/_#_void_value_#_/', '', $output);
return $output;
}
开发者ID:jhbsz,项目名称:ossimTest,代码行数:13,代码来源:utils.php
示例13: XMLsave
/**
* save XML to file
*
* @since 2.0
*
* @param object $xml simple xml object to save to file via asXml
* @param string $file Filename that it will be saved as
* @return bool
*/
function XMLsave($xml, $file)
{
if (!is_object($xml)) {
debugLog(__FUNCTION__ . ' failed to save xml');
return false;
}
$data = @$xml->asXML();
if (getDef('GSFORMATXML', true)) {
$data = formatXmlString($data);
}
// format xml if config setting says so
$data = exec_filter('xmlsave', $data);
// @filter xmlsave executed before writing string to file
$success = save_file($file, $data);
// LOCK_EX ?
return $success;
}
开发者ID:HelgeSverre,项目名称:GetSimpleCMS,代码行数:26,代码来源:basic.php
示例14: container
}
echo container('Edit Templates', '<table class="page rowHover">
<thead>
<tr class="ui-widget-header">
<td width="80%">Template</td>
<td width="20%">Actions</td>
</tr>
</thead>
<tbody>
' . $rows . '
</tbody>
</table>');
break;
case 'edit':
$template = $json[$request['templateName']];
$template = str_replace(array('<', '>'), array('<', '>'), formatXmlString($template));
$template = preg_replace('/template\\.([A-Z])/e', '"template." . lcfirst($1)', $template);
echo container("Edit Template \"{$request['templateName']}\"", "<form action=\"./moderate.php?do=templates&do2=edit2&templateName={$request['templateName']}\" method=\"post\">\n\n <label for=\"data\">New Value:</label><br />\n <textarea name=\"data\" id=\"textXml\" style=\"width: 100%; height: 300px;\">{$template}</textarea><br /><br />\n\n <button type=\"submit\">Update</button>\n</form>");
break;
case 'edit2':
$template = $request['data'];
$template = str_replace(array("\r", "\n", "\r\n"), '', $template);
// Remove new lines (required for JSON).
$template = preg_replace("/\\>(\\ +)/", ">", $template);
// Remove extra space between (looks better).
$json[$request['templateName']] = $template;
// Update the JSON object with the new template data.
file_put_contents('client/data/templates.json', json_encode($json)) or die('Unable to write');
// Send the new JSON data to the server.
$database->modLog('templateEdit', $template['templateName'] . '-' . $template['interfaceId']);
$database->fullLog('templateEdit', array('template' => $template));
开发者ID:udaybhan9,项目名称:freeze-messenger,代码行数:31,代码来源:templates.php
示例15: trim
for ($i = 0; $i < $size_m - 1; $i++) {
$pattern = trim($match[0][$i]);
$copy_cf = str_replace($pattern, "", $copy_cf);
}
$pattern = trim($match[0][$size_m - 1]);
$copy_cf = str_replace($pattern, $unique_id, $copy_cf);
} else {
if (preg_match("/<\\s*ossec_config\\s*>/", $copy_cf)) {
$copy_cf = preg_replace("/<\\/\\s*ossec_config\\s*>/", "{$unique_id}</ossec_config>", $copy_cf, 1);
} else {
$copy_cf = "<ossec_config>{$unique_id}</ossec_config>";
}
}
$agentless_xml = implode("", $agentless_xml);
$copy_cf = preg_replace("/{$unique_id}/", $agentless_xml, $copy_cf);
$output = formatXmlString($copy_cf);
if (@file_put_contents($path, $output, LOCK_EX) === false) {
@unlink($path);
@copy($path_tmp, $path);
$info_error = _("Failure to update") . " <b>{$ossec_conf}</b>";
} else {
$result = test_conf();
if ($result !== true) {
$info_error = "<div class='errors_ossec'>{$result}</div>";
$error_conf = true;
@copy($path_tmp, $path);
@copy($path_tmp2, $path_passlist);
} else {
$result = system("sudo /var/ossec/bin/ossec-control restart > /tmp/ossec-action 2>&1");
$result = file('/tmp/ossec-control');
$size = count($result);
开发者ID:jhbsz,项目名称:ossimTest,代码行数:31,代码来源:al_applyconf.php
示例16: download_consultation_times
function download_consultation_times()
{
global $config_url_consultation_times;
$doc = new DomDocument('1.0');
$root = $doc->createElement('mitglieder');
$root->setAttribute("von", "Fachbereich 3");
$doc->appendChild($root);
@($dom = loadNprepare($config_url_consultation_times, 'UTF-8'));
$dom->preserveWhiteSpace = false;
$employee_table_wrapper = $dom->getElementById('c13016');
$table_rows = $employee_table_wrapper->getElementsByTagName('tr');
$table_rows->item(0);
$current_person_function = "";
foreach ($table_rows as $table_row) {
$person_node = $doc->createElement('person');
$headlines = $table_row->getElementsByTagName('h3');
if ($headlines->length > 0) {
$current_person_function = $headlines->item(0)->textContent;
continue;
}
$current_entry = trim($table_row->getElementsByTagName('td')->item(0)->textContent);
if (strpos($current_entry, "\n") > -1) {
$text_parts_array = explode("\n", $current_entry);
$person_node->appendChild($doc->createElement("titel", trim($text_parts_array[1])));
$person_node->appendChild($doc->createElement("name", $text_parts_array[0]));
} else {
$person_node->appendChild($doc->createElement("name", $current_entry));
}
$person_node->appendChild($doc->createElement("funktion", $current_person_function));
if ($table_row->getElementsByTagName('span')->length >= 1) {
$person_node->appendChild($doc->createElement("sprechzeiten", $table_row->getElementsByTagName('span')->item(0)->textContent));
if ($table_row->getElementsByTagName('span')->length == 2) {
$person_node->appendChild($doc->createElement("raum", $table_row->getElementsByTagName('span')->item(1)->textContent));
}
}
$root->appendChild($person_node);
}
$xml = combine_person_entries($doc);
$xml = $doc->saveXML();
$file_handle = fopen('data/sprechzeiten.xml', 'w');
fwrite($file_handle, formatXmlString($xml));
fclose($file_handle);
}
开发者ID:ItsLines,项目名称:ThePreviouslyDesigned,代码行数:43,代码来源:api.php
示例17: header
}
}
}
if (isset($data['error'])) {
$node = $xmlDoc->createElement("error");
$errorNode = $parentNode->appendChild($node);
$errorNode->setAttribute("id", $data['error']);
}
// Output
// Check whether we want XML or JSON output
if ($data['format'] == "xml" || $data['format'] == "xmlp" || $data['format'] == "xmlt") {
if ($data['format'] == "xml" || $data['format'] == "xmlp") {
// Set the content-type for browsers
header("Content-type: text/xml");
}
echo formatXmlString($xmlDoc->saveXML());
} else {
if ($data['format'] == "json") {
// Set the content-type for browsers
header("Content-type: application/json");
// For now, our JSON output is simply the XML re-parsed with SimpleXML and
// then re-encoded with json_encode
$x = simplexml_load_string($xmlDoc->saveXML());
$j = json_encode($x);
echo $j;
} else {
echo "Error: Unknown format type '" . $data['format'] . "'.";
}
}
// This function tidies up the outputted XML
function formatXmlString($xml)
开发者ID:orio33,项目名称:Cloudlog,代码行数:31,代码来源:index.php
示例18: i18n
" ><?php
i18n('VIEW');
?>
</a>
<a href="sitemap.php?refresh" accesskey="<?php
echo find_accesskey(i18n_r('REFRESH'));
?>
" ><?php
i18n('REFRESH');
?>
</a>
</div>
<div class="unformatted"><code><?php
if (file_exists('../sitemap.xml')) {
echo htmlentities(formatXmlString(file_get_contents('../sitemap.xml')));
}
?>
</code></div>
</div>
</div>
<div id="sidebar" >
<?php
include 'template/sidebar-theme.php';
?>
</div>
</div>
<?php
开发者ID:hatasu,项目名称:appdroid,代码行数:31,代码来源:sitemap.php
示例19: stdClass
$space = $itr_count == 0 ? '' : ' ';
$filename_pretty .= $space . $filename_part;
$itr_count++;
}
$token = new stdClass();
$token->prettyname = $filename_pretty;
$token->filename = $filename;
$token_array[] = $token;
}
//Create single token xml string and add it to an array
$token_xml_string_array = array();
foreach ($token_array as $token) {
$string = '<File path="docs/' . $token->filename . '">';
$string .= '<Token><TokenIdentifier>';
$string .= '//apple_ref/cpp/cl/' . $token->prettyname;
$string .= '</TokenIdentifier></Token>';
$string .= '</File>';
$token_xml_string_array[] = $string;
}
//Contruct full xml string
$xml_string = '<?xml version="1.0" encoding="UTF-8"?>';
$xml_string .= '<Tokens version="1.0">';
//Insert all tokens
foreach ($token_xml_string_array as $token_string) {
$xml_string .= $token_string;
}
$xml_string .= '</Tokens>';
$xml_string = formatXmlString($xml_string);
//Write to Tokens.xml file
$file_path = 'output/' . $config['docset_filename'] . '/Contents/Resources/Tokens.xml';
file_put_contents($file_path, $xml_string);
开发者ID:MauricioAndrades,项目名称:Dash-Docset-Creator,代码行数:31,代码来源:create-tokens.php
示例20: generateUiComponentXmlFile
function generateUiComponentXmlFile($gridId, $databaseIdName, $module_info)
{
$pageActionsClassName = generatePageActionClassNameFromPackageModuleAndGridId($module_info->vendor, $module_info->short_name, $gridId);
$requestIdName = generateRequestIdName();
$providerClass = generateProdiverClassFromGridIdAndModuleInfo($gridId, $module_info);
$dataSourceName = generateDataSourceNameFromGridId($gridId);
$columnsName = generateColumnsNameFromGridId($gridId);
$xml = simplexml_load_string(getBlankXml('uigrid'));
$argument = generateArgumentNode($xml, $gridId, $dataSourceName, $columnsName);
$dataSource = generateDatasourceNode($xml, $dataSourceName, $providerClass, $databaseIdName, $requestIdName);
$columns = generateColumnsNode($xml, $columnsName, $databaseIdName, $pageActionsClassName);
generateListingToolbar($xml);
$path = $module_info->folder . '/view/adminhtml/ui_component/' . $gridId . '.xml';
output("Creating New {$path}");
writeStringToFile($path, formatXmlString($xml->asXml()));
return $xml;
}
开发者ID:astorm,项目名称:pestle,代码行数:17,代码来源:module.php
注:本文中的formatXmlString函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论