Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Created May 3, 2017 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NateWr/c6acac198d319cc317c0862c11df4a2e to your computer and use it in GitHub Desktop.
Save NateWr/c6acac198d319cc317c0862c11df4a2e to your computer and use it in GitHub Desktop.
Generate an XML file containing test submissions which can be imported into OJS 3. No file attachments of any kind. Author details correspond to user account from test data.
$count = 100;
$lorem = explode(' ', strtolower('Lorem ipsum dolor sit amet consectetur adipiscing elit Phasellus suscipit laoreet tempus Sed et mauris eu turpis sollicitudin maximus sit amet a tortor Quisque ultrices felis sed cursus varius orci nisi imperdiet est non mattis ante neque ut leo Nam eget diam vitae magna mattis iaculis Donec vitae dignissim elit eu dignissim libero Vivamus semper arcu quis congue auctor nulla odio efficitur odio dictum sagittis nulla ex vel nisl Aenean porta varius lacus dapibus sagittis Nam quis malesuada sapien sed tincidunt urna Morbi ac metus est'));
$loremCount = count($lorem);
function getPhrase($wordCount, $ucfirst = true) {
global $lorem;
global $loremCount;
$phrase = array();
for ($i = 0; $i < $wordCount; $i++) {
$phrase[] = $lorem[rand(0, $loremCount - 1)];
$phrase = join(' ', $phrase);
return $ucfirst ? ucfirst($phrase) : $phrase;
?><?xml version="1.0"?>
<articles xmlns="" xmlns:xsi="" xsi:schemaLocation=" native.xsd">
<?php for ($i = 0; $i < $count; $i++) : ?>
<article xmlns:xsi="" locale="en_US" date_submitted="2016-05-31" stage="submission" section_ref="ART" seq="0" access_status="0">
<id type="internal" advice="ignore">1</id>
<title locale="en_US"><?php echo getPhrase(10); ?></title>
<keywords locale="en_US">
<keyword><?php echo getPhrase(1, false); ?></keyword>
<keyword><?php echo getPhrase(2, false); ?></keyword>
<authors xmlns:xsi="" xsi:schemaLocation=" native.xsd">
<author primary_contact="true" include_in_browse="true" user_group_ref="Author">
<affiliation locale="en_US">University of Bologna</affiliation>
<?php endfor; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment