/ojs-generate-submissions.php Secret
Created
May 3, 2017 10:57
Star
You must be signed in to star a gist
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$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="http://pkp.sfu.ca" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pkp.sfu.ca native.xsd"> | |
<?php for ($i = 0; $i < $count; $i++) : ?> | |
<article xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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> | |
</keywords> | |
<authors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pkp.sfu.ca native.xsd"> | |
<author primary_contact="true" include_in_browse="true" user_group_ref="Author"> | |
<firstname>Carlo</firstname> | |
<lastname>Corino</lastname> | |
<affiliation locale="en_US">University of Bologna</affiliation> | |
<country>IT</country> | |
<email>ccorino@mailinator.com</email> | |
</author> | |
</authors> | |
</article> | |
<?php endfor; ?> | |
</articles> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment