예제 #1
0
function parse_post_data($post_data)
{
    // This returns an array containing two arrays. One for line one, one for line two.
    $indent = '      ';
    switch ($post_data['type']) {
        case 'book':
            // Author. _Title of Book_. City of Publication: Publisher, Year.
            return parse_names($post_data['author_first_name'], $post_data['author_last_name']) . '. ' . '<u>' . $post_data['title'] . '</u>. ' . $post_data['city'] . ': ' . $post_data['publisher'] . ', ' . $post_data['year'] . '.';
        case 'essay':
            // Author of Story. "Title of Story." _Title of Book_. Name of Editor. Edition (if given).
            //     City of Publication: Publisher, Year. Page numbers.
            return parse_names($post_data['author_first_name'], $post_data['author_last_name']) . '. ' . '"' . $post_data['title'] . '." <u>' . $post_data['book'] . '</u>. ' . $post_data['editor'] . '.<br />' . $indent . $post_data['city'] . ': ' . $post_data['publisher'] . ', ' . $post_data['year'] . '. ' . $post_data['pages'] . '.';
        case 'ref':
            // Author of Article (if given). "Article Title." _Title of Book_. City of Publication:
            //     Publisher, Year.
            return parse_names($post_data['author_first_name'], $post_data['author_last_name']) . '. ' . '"' . $post_data['title'] . '." <u>' . $post_data['title'] . '</u>. ' . $post_data['city'] . ':<br />' . $indent . $post_data['publisher'] . ', ' . $post_data['year'] . '.';
        case 'magazine':
            // Author. "Title of Article." _Title of Magazine_ Date: Page(s).
            return parse_names($post_data['author_first_name'], $post_data['author_last_name']) . '. ' . '"' . $post_data['title'] . '." <u>' . $post_data['magtitle'] . '</u>. ' . $post_data['date'] . ': ' . $post_data['pages'] . '.';
        case 'article':
            // Author. "Title of Article." _Name of Newspaper_ Date, edition: Page(s).
            return parse_names($post_data['author_first_name'], $post_data['author_last_name']) . '. ' . '"' . $post_data['title'] . '." <u>' . $post_data['newstitle'] . '</u>. ' . $post_data['date'] . ', ' . $post_data['edition'] . ': ' . $post_data['pages'] . '.';
        case 'web':
            // _Title of the Site_. Editor. Date and/or Version Number. Name of Sponsoring Institution.
            //     Date of Access <URL>.
            return '<u>' . fetch_url_title($post_data['ur']) . '</u>. ' . $post_data['editor'] . '. ' . $post_data['date_written'] . '. ' . $post_data['sponsor'] . '.<br />' . $indent . $post_data['date_access'] . ' <' . $post_data['url'] . '>.';
        case 'tv':
            // "Title of Episode or Segment."  _Title of Program or Series_. Credit (Performer, writer, \
            //     etc). Name of Network. Call Letters (if any), City of Local Station (if any).
            //     Broadcast Date.
            return '"' . $post_data['episode'] . '." <u>' . $post_data['program'] . '</u>. ' . $post_data['credit'] . '. ' . $post_data['network'] . '. ' . $post_data['call'] . ', ' . $post_data['city'] . '.<br />' . $indent . $post_data['date'];
        case 'interview':
            // Person Interviewed. Type of Interview (personal, telephone, email, etc.). Date.
            return $post_data['person'] . ' ' . $post_data['type'] . '. ' . $post_data['date'];
    }
}
예제 #2
0
파일: mla.php 프로젝트: relrod/WebCite
?>

<b>session: <?php 
echo $_SESSION['csrf_token'];
?>
</b>
<pre style="text-align: left;">
<?php 
print_r($_POST);
?>
</pre>

<?php 
if ($_POST['website'] != '') {
    if (is_valid_url($_POST['website'])) {
        $title = fetch_url_title($_POST['website']);
        if (!$title) {
            $title = "&lt;title&gt; tag could not be found.";
        }
    } else {
        $title = "INVALID URL given.";
    }
} else {
    // They didn't pass us a website, it must be something else.
    // I'm beginning to think a ?type=website, ?type=book, etc would be easier.
    $title = "&lt;not website&gt;";
}
?>
<b><?php 
echo $title;
?>