Copy and paste the citation below into your work.
';
452 | $html .= '
' . styleconvert($style) . ' ';
453 | echo $html;
454 | }
455 |
456 | //Closes a single citation container
457 | function citationcontainend() {
458 | $html = '
';
459 | echo $html;
460 | }
461 |
462 | /*******************************************************/
463 | /* Include citation format function files below */
464 | /*******************************************************/
465 | include 'formats/apa6_format.php';
466 | include 'formats/mla7_format.php';
467 |
468 | ?>
--------------------------------------------------------------------------------
/citationbuild.php:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/includes/jquery_plugins/jquery.form.js:
--------------------------------------------------------------------------------
1 | /*!
2 | * jQuery Form Plugin
3 | * version: 2.49 (18-OCT-2010)
4 | * @requires jQuery v1.3.2 or later
5 | *
6 | * Examples and documentation at: http://malsup.com/jquery/form/
7 | * Dual licensed under the MIT and GPL licenses:
8 | * http://www.opensource.org/licenses/mit-license.php
9 | * http://www.gnu.org/licenses/gpl.html
10 | */
11 | ;(function($) {
12 |
13 | /*
14 | Usage Note:
15 | -----------
16 | Do not use both ajaxSubmit and ajaxForm on the same form. These
17 | functions are intended to be exclusive. Use ajaxSubmit if you want
18 | to bind your own submit handler to the form. For example,
19 |
20 | $(document).ready(function() {
21 | $('#myForm').bind('submit', function(e) {
22 | e.preventDefault(); // <-- important
23 | $(this).ajaxSubmit({
24 | target: '#output'
25 | });
26 | });
27 | });
28 |
29 | Use ajaxForm when you want the plugin to manage all the event binding
30 | for you. For example,
31 |
32 | $(document).ready(function() {
33 | $('#myForm').ajaxForm({
34 | target: '#output'
35 | });
36 | });
37 |
38 | When using ajaxForm, the ajaxSubmit function will be invoked for you
39 | at the appropriate time.
40 | */
41 |
42 | /**
43 | * ajaxSubmit() provides a mechanism for immediately submitting
44 | * an HTML form using AJAX.
45 | */
46 | $.fn.ajaxSubmit = function(options) {
47 | // fast fail if nothing selected (http://dev.jquery.com/ticket/2752)
48 | if (!this.length) {
49 | log('ajaxSubmit: skipping submit process - no element selected');
50 | return this;
51 | }
52 |
53 | if (typeof options == 'function') {
54 | options = { success: options };
55 | }
56 |
57 | var url = $.trim(this.attr('action'));
58 | if (url) {
59 | // clean url (don't include hash vaue)
60 | url = (url.match(/^([^#]+)/)||[])[1];
61 | }
62 | url = url || window.location.href || '';
63 |
64 | options = $.extend(true, {
65 | url: url,
66 | type: this.attr('method') || 'GET',
67 | iframeSrc: /^https/i.test(window.location.href || '') ? 'javascript:false' : 'about:blank'
68 | }, options);
69 |
70 | // hook for manipulating the form data before it is extracted;
71 | // convenient for use with rich editors like tinyMCE or FCKEditor
72 | var veto = {};
73 | this.trigger('form-pre-serialize', [this, options, veto]);
74 | if (veto.veto) {
75 | log('ajaxSubmit: submit vetoed via form-pre-serialize trigger');
76 | return this;
77 | }
78 |
79 | // provide opportunity to alter form data before it is serialized
80 | if (options.beforeSerialize && options.beforeSerialize(this, options) === false) {
81 | log('ajaxSubmit: submit aborted via beforeSerialize callback');
82 | return this;
83 | }
84 |
85 | var n,v,a = this.formToArray(options.semantic);
86 | if (options.data) {
87 | options.extraData = options.data;
88 | for (n in options.data) {
89 | if(options.data[n] instanceof Array) {
90 | for (var k in options.data[n]) {
91 | a.push( { name: n, value: options.data[n][k] } );
92 | }
93 | }
94 | else {
95 | v = options.data[n];
96 | v = $.isFunction(v) ? v() : v; // if value is fn, invoke it
97 | a.push( { name: n, value: v } );
98 | }
99 | }
100 | }
101 |
102 | // give pre-submit callback an opportunity to abort the submit
103 | if (options.beforeSubmit && options.beforeSubmit(a, this, options) === false) {
104 | log('ajaxSubmit: submit aborted via beforeSubmit callback');
105 | return this;
106 | }
107 |
108 | // fire vetoable 'validate' event
109 | this.trigger('form-submit-validate', [a, this, options, veto]);
110 | if (veto.veto) {
111 | log('ajaxSubmit: submit vetoed via form-submit-validate trigger');
112 | return this;
113 | }
114 |
115 | var q = $.param(a);
116 |
117 | if (options.type.toUpperCase() == 'GET') {
118 | options.url += (options.url.indexOf('?') >= 0 ? '&' : '?') + q;
119 | options.data = null; // data is null for 'get'
120 | }
121 | else {
122 | options.data = q; // data is the query string for 'post'
123 | }
124 |
125 | var $form = this, callbacks = [];
126 | if (options.resetForm) {
127 | callbacks.push(function() { $form.resetForm(); });
128 | }
129 | if (options.clearForm) {
130 | callbacks.push(function() { $form.clearForm(); });
131 | }
132 |
133 | // perform a load on the target only if dataType is not provided
134 | if (!options.dataType && options.target) {
135 | var oldSuccess = options.success || function(){};
136 | callbacks.push(function(data) {
137 | var fn = options.replaceTarget ? 'replaceWith' : 'html';
138 | $(options.target)[fn](data).each(oldSuccess, arguments);
139 | });
140 | }
141 | else if (options.success) {
142 | callbacks.push(options.success);
143 | }
144 |
145 | options.success = function(data, status, xhr) { // jQuery 1.4+ passes xhr as 3rd arg
146 | var context = options.context || options; // jQuery 1.4+ supports scope context
147 | for (var i=0, max=callbacks.length; i < max; i++) {
148 | callbacks[i].apply(context, [data, status, xhr || $form, $form]);
149 | }
150 | };
151 |
152 | // are there files to upload?
153 | var fileInputs = $('input:file', this).length > 0;
154 | var mp = 'multipart/form-data';
155 | var multipart = ($form.attr('enctype') == mp || $form.attr('encoding') == mp);
156 |
157 | // options.iframe allows user to force iframe mode
158 | // 06-NOV-09: now defaulting to iframe mode if file input is detected
159 | if (options.iframe !== false && (fileInputs || options.iframe || multipart)) {
160 | // hack to fix Safari hang (thanks to Tim Molendijk for this)
161 | // see: http://groups.google.com/group/jquery-dev/browse_thread/thread/36395b7ab510dd5d
162 | if (options.closeKeepAlive) {
163 | $.get(options.closeKeepAlive, fileUpload);
164 | }
165 | else {
166 | fileUpload();
167 | }
168 | }
169 | else {
170 | $.ajax(options);
171 | }
172 |
173 | // fire 'notify' event
174 | this.trigger('form-submit-notify', [this, options]);
175 | return this;
176 |
177 |
178 | // private function for handling file uploads (hat tip to YAHOO!)
179 | function fileUpload() {
180 | var form = $form[0];
181 |
182 | if ($(':input[name=submit],:input[id=submit]', form).length) {
183 | // if there is an input with a name or id of 'submit' then we won't be
184 | // able to invoke the submit fn on the form (at least not x-browser)
185 | alert('Error: Form elements must not have name or id of "submit".');
186 | return;
187 | }
188 |
189 | var s = $.extend(true, {}, $.ajaxSettings, options);
190 | s.context = s.context || s;
191 | var id = 'jqFormIO' + (new Date().getTime()), fn = '_'+id;
192 | window[fn] = function() {
193 | var f = $io.data('form-plugin-onload');
194 | if (f) {
195 | f();
196 | window[fn] = undefined;
197 | try { delete window[fn]; } catch(e){}
198 | }
199 | }
200 | var $io = $('
');
201 | var io = $io[0];
202 |
203 | $io.css({ position: 'absolute', top: '-1000px', left: '-1000px' });
204 |
205 | var xhr = { // mock object
206 | aborted: 0,
207 | responseText: null,
208 | responseXML: null,
209 | status: 0,
210 | statusText: 'n/a',
211 | getAllResponseHeaders: function() {},
212 | getResponseHeader: function() {},
213 | setRequestHeader: function() {},
214 | abort: function() {
215 | this.aborted = 1;
216 | $io.attr('src', s.iframeSrc); // abort op in progress
217 | }
218 | };
219 |
220 | var g = s.global;
221 | // trigger ajax global events so that activity/block indicators work like normal
222 | if (g && ! $.active++) {
223 | $.event.trigger("ajaxStart");
224 | }
225 | if (g) {
226 | $.event.trigger("ajaxSend", [xhr, s]);
227 | }
228 |
229 | if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false) {
230 | if (s.global) {
231 | $.active--;
232 | }
233 | return;
234 | }
235 | if (xhr.aborted) {
236 | return;
237 | }
238 |
239 | var cbInvoked = false;
240 | var timedOut = 0;
241 |
242 | // add submitting element to data if we know it
243 | var sub = form.clk;
244 | if (sub) {
245 | var n = sub.name;
246 | if (n && !sub.disabled) {
247 | s.extraData = s.extraData || {};
248 | s.extraData[n] = sub.value;
249 | if (sub.type == "image") {
250 | s.extraData[n+'.x'] = form.clk_x;
251 | s.extraData[n+'.y'] = form.clk_y;
252 | }
253 | }
254 | }
255 |
256 | // take a breath so that pending repaints get some cpu time before the upload starts
257 | function doSubmit() {
258 | // make sure form attrs are set
259 | var t = $form.attr('target'), a = $form.attr('action');
260 |
261 | // update form attrs in IE friendly way
262 | form.setAttribute('target',id);
263 | if (form.getAttribute('method') != 'POST') {
264 | form.setAttribute('method', 'POST');
265 | }
266 | if (form.getAttribute('action') != s.url) {
267 | form.setAttribute('action', s.url);
268 | }
269 |
270 | // ie borks in some cases when setting encoding
271 | if (! s.skipEncodingOverride) {
272 | $form.attr({
273 | encoding: 'multipart/form-data',
274 | enctype: 'multipart/form-data'
275 | });
276 | }
277 |
278 | // support timout
279 | if (s.timeout) {
280 | setTimeout(function() { timedOut = true; cb(); }, s.timeout);
281 | }
282 |
283 | // add "extra" data to form if provided in options
284 | var extraInputs = [];
285 | try {
286 | if (s.extraData) {
287 | for (var n in s.extraData) {
288 | extraInputs.push(
289 | $('
')
290 | .appendTo(form)[0]);
291 | }
292 | }
293 |
294 | // add iframe to doc and submit the form
295 | $io.appendTo('body');
296 | $io.data('form-plugin-onload', cb);
297 | form.submit();
298 | }
299 | finally {
300 | // reset attrs and remove "extra" input elements
301 | form.setAttribute('action',a);
302 | if(t) {
303 | form.setAttribute('target', t);
304 | } else {
305 | $form.removeAttr('target');
306 | }
307 | $(extraInputs).remove();
308 | }
309 | }
310 |
311 | if (s.forceSync) {
312 | doSubmit();
313 | }
314 | else {
315 | setTimeout(doSubmit, 10); // this lets dom updates render
316 | }
317 |
318 | var data, doc, domCheckCount = 50;
319 |
320 | function cb() {
321 | if (cbInvoked) {
322 | return;
323 | }
324 |
325 | $io.removeData('form-plugin-onload');
326 |
327 | var ok = true;
328 | try {
329 | if (timedOut) {
330 | throw 'timeout';
331 | }
332 | // extract the server response from the iframe
333 | doc = io.contentWindow ? io.contentWindow.document : io.contentDocument ? io.contentDocument : io.document;
334 |
335 | var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
336 | log('isXml='+isXml);
337 | if (!isXml && window.opera && (doc.body == null || doc.body.innerHTML == '')) {
338 | if (--domCheckCount) {
339 | // in some browsers (Opera) the iframe DOM is not always traversable when
340 | // the onload callback fires, so we loop a bit to accommodate
341 | log('requeing onLoad callback, DOM not available');
342 | setTimeout(cb, 250);
343 | return;
344 | }
345 | // let this fall through because server response could be an empty document
346 | //log('Could not access iframe DOM after mutiple tries.');
347 | //throw 'DOMException: not available';
348 | }
349 |
350 | //log('response detected');
351 | cbInvoked = true;
352 | xhr.responseText = doc.documentElement ? doc.documentElement.innerHTML : null;
353 | xhr.responseXML = doc.XMLDocument ? doc.XMLDocument : doc;
354 | xhr.getResponseHeader = function(header){
355 | var headers = {'content-type': s.dataType};
356 | return headers[header];
357 | };
358 |
359 | var scr = /(json|script)/.test(s.dataType);
360 | if (scr || s.textarea) {
361 | // see if user embedded response in textarea
362 | var ta = doc.getElementsByTagName('textarea')[0];
363 | if (ta) {
364 | xhr.responseText = ta.value;
365 | }
366 | else if (scr) {
367 | // account for browsers injecting pre around json response
368 | var pre = doc.getElementsByTagName('pre')[0];
369 | var b = doc.getElementsByTagName('body')[0];
370 | if (pre) {
371 | xhr.responseText = pre.innerHTML;
372 | }
373 | else if (b) {
374 | xhr.responseText = b.innerHTML;
375 | }
376 | }
377 | }
378 | else if (s.dataType == 'xml' && !xhr.responseXML && xhr.responseText != null) {
379 | xhr.responseXML = toXml(xhr.responseText);
380 | }
381 | data = $.httpData(xhr, s.dataType);
382 | }
383 | catch(e){
384 | log('error caught:',e);
385 | ok = false;
386 | xhr.error = e;
387 | $.handleError(s, xhr, 'error', e);
388 | }
389 |
390 | // ordering of these callbacks/triggers is odd, but that's how $.ajax does it
391 | if (ok) {
392 | s.success.call(s.context, data, 'success', xhr);
393 | if (g) {
394 | $.event.trigger("ajaxSuccess", [xhr, s]);
395 | }
396 | }
397 | if (g) {
398 | $.event.trigger("ajaxComplete", [xhr, s]);
399 | }
400 | if (g && ! --$.active) {
401 | $.event.trigger("ajaxStop");
402 | }
403 | if (s.complete) {
404 | s.complete.call(s.context, xhr, ok ? 'success' : 'error');
405 | }
406 |
407 | // clean up
408 | setTimeout(function() {
409 | $io.removeData('form-plugin-onload');
410 | $io.remove();
411 | xhr.responseXML = null;
412 | }, 100);
413 | }
414 |
415 | function toXml(s, doc) {
416 | if (window.ActiveXObject) {
417 | doc = new ActiveXObject('Microsoft.XMLDOM');
418 | doc.async = 'false';
419 | doc.loadXML(s);
420 | }
421 | else {
422 | doc = (new DOMParser()).parseFromString(s, 'text/xml');
423 | }
424 | return (doc && doc.documentElement && doc.documentElement.tagName != 'parsererror') ? doc : null;
425 | }
426 | }
427 | };
428 |
429 | /**
430 | * ajaxForm() provides a mechanism for fully automating form submission.
431 | *
432 | * The advantages of using this method instead of ajaxSubmit() are:
433 | *
434 | * 1: This method will include coordinates for
elements (if the element
435 | * is used to submit the form).
436 | * 2. This method will include the submit element's name/value data (for the element that was
437 | * used to submit the form).
438 | * 3. This method binds the submit() method to the form for you.
439 | *
440 | * The options argument for ajaxForm works exactly as it does for ajaxSubmit. ajaxForm merely
441 | * passes the options argument along after properly binding events for submit elements and
442 | * the form itself.
443 | */
444 | $.fn.ajaxForm = function(options) {
445 | // in jQuery 1.3+ we can fix mistakes with the ready state
446 | if (this.length === 0) {
447 | var o = { s: this.selector, c: this.context };
448 | if (!$.isReady && o.s) {
449 | log('DOM not ready, queuing ajaxForm');
450 | $(function() {
451 | $(o.s,o.c).ajaxForm(options);
452 | });
453 | return this;
454 | }
455 | // is your DOM ready? http://docs.jquery.com/Tutorials:Introducing_$(document).ready()
456 | log('terminating; zero elements found by selector' + ($.isReady ? '' : ' (DOM not ready)'));
457 | return this;
458 | }
459 |
460 | return this.ajaxFormUnbind().bind('submit.form-plugin', function(e) {
461 | if (!e.isDefaultPrevented()) { // if event has been canceled, don't proceed
462 | e.preventDefault();
463 | $(this).ajaxSubmit(options);
464 | }
465 | }).bind('click.form-plugin', function(e) {
466 | var target = e.target;
467 | var $el = $(target);
468 | if (!($el.is(":submit,input:image"))) {
469 | // is this a child element of the submit el? (ex: a span within a button)
470 | var t = $el.closest(':submit');
471 | if (t.length == 0) {
472 | return;
473 | }
474 | target = t[0];
475 | }
476 | var form = this;
477 | form.clk = target;
478 | if (target.type == 'image') {
479 | if (e.offsetX != undefined) {
480 | form.clk_x = e.offsetX;
481 | form.clk_y = e.offsetY;
482 | } else if (typeof $.fn.offset == 'function') { // try to use dimensions plugin
483 | var offset = $el.offset();
484 | form.clk_x = e.pageX - offset.left;
485 | form.clk_y = e.pageY - offset.top;
486 | } else {
487 | form.clk_x = e.pageX - target.offsetLeft;
488 | form.clk_y = e.pageY - target.offsetTop;
489 | }
490 | }
491 | // clear form vars
492 | setTimeout(function() { form.clk = form.clk_x = form.clk_y = null; }, 100);
493 | });
494 | };
495 |
496 | // ajaxFormUnbind unbinds the event handlers that were bound by ajaxForm
497 | $.fn.ajaxFormUnbind = function() {
498 | return this.unbind('submit.form-plugin click.form-plugin');
499 | };
500 |
501 | /**
502 | * formToArray() gathers form element data into an array of objects that can
503 | * be passed to any of the following ajax functions: $.get, $.post, or load.
504 | * Each object in the array has both a 'name' and 'value' property. An example of
505 | * an array for a simple login form might be:
506 | *
507 | * [ { name: 'username', value: 'jresig' }, { name: 'password', value: 'secret' } ]
508 | *
509 | * It is this array that is passed to pre-submit callback functions provided to the
510 | * ajaxSubmit() and ajaxForm() methods.
511 | */
512 | $.fn.formToArray = function(semantic) {
513 | var a = [];
514 | if (this.length === 0) {
515 | return a;
516 | }
517 |
518 | var form = this[0];
519 | var els = semantic ? form.getElementsByTagName('*') : form.elements;
520 | if (!els) {
521 | return a;
522 | }
523 |
524 | var i,j,n,v,el,max,jmax;
525 | for(i=0, max=els.length; i < max; i++) {
526 | el = els[i];
527 | n = el.name;
528 | if (!n) {
529 | continue;
530 | }
531 |
532 | if (semantic && form.clk && el.type == "image") {
533 | // handle image inputs on the fly when semantic == true
534 | if(!el.disabled && form.clk == el) {
535 | a.push({name: n, value: $(el).val()});
536 | a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
537 | }
538 | continue;
539 | }
540 |
541 | v = $.fieldValue(el, true);
542 | if (v && v.constructor == Array) {
543 | for(j=0, jmax=v.length; j < jmax; j++) {
544 | a.push({name: n, value: v[j]});
545 | }
546 | }
547 | else if (v !== null && typeof v != 'undefined') {
548 | a.push({name: n, value: v});
549 | }
550 | }
551 |
552 | if (!semantic && form.clk) {
553 | // input type=='image' are not found in elements array! handle it here
554 | var $input = $(form.clk), input = $input[0];
555 | n = input.name;
556 | if (n && !input.disabled && input.type == 'image') {
557 | a.push({name: n, value: $input.val()});
558 | a.push({name: n+'.x', value: form.clk_x}, {name: n+'.y', value: form.clk_y});
559 | }
560 | }
561 | return a;
562 | };
563 |
564 | /**
565 | * Serializes form data into a 'submittable' string. This method will return a string
566 | * in the format: name1=value1&name2=value2
567 | */
568 | $.fn.formSerialize = function(semantic) {
569 | //hand off to jQuery.param for proper encoding
570 | return $.param(this.formToArray(semantic));
571 | };
572 |
573 | /**
574 | * Serializes all field elements in the jQuery object into a query string.
575 | * This method will return a string in the format: name1=value1&name2=value2
576 | */
577 | $.fn.fieldSerialize = function(successful) {
578 | var a = [];
579 | this.each(function() {
580 | var n = this.name;
581 | if (!n) {
582 | return;
583 | }
584 | var v = $.fieldValue(this, successful);
585 | if (v && v.constructor == Array) {
586 | for (var i=0,max=v.length; i < max; i++) {
587 | a.push({name: n, value: v[i]});
588 | }
589 | }
590 | else if (v !== null && typeof v != 'undefined') {
591 | a.push({name: this.name, value: v});
592 | }
593 | });
594 | //hand off to jQuery.param for proper encoding
595 | return $.param(a);
596 | };
597 |
598 | /**
599 | * Returns the value(s) of the element in the matched set. For example, consider the following form:
600 | *
601 | *
609 | *
610 | * var v = $(':text').fieldValue();
611 | * // if no values are entered into the text inputs
612 | * v == ['','']
613 | * // if values entered into the text inputs are 'foo' and 'bar'
614 | * v == ['foo','bar']
615 | *
616 | * var v = $(':checkbox').fieldValue();
617 | * // if neither checkbox is checked
618 | * v === undefined
619 | * // if both checkboxes are checked
620 | * v == ['B1', 'B2']
621 | *
622 | * var v = $(':radio').fieldValue();
623 | * // if neither radio is checked
624 | * v === undefined
625 | * // if first radio is checked
626 | * v == ['C1']
627 | *
628 | * The successful argument controls whether or not the field element must be 'successful'
629 | * (per http://www.w3.org/TR/html4/interact/forms.html#successful-controls).
630 | * The default value of the successful argument is true. If this value is false the value(s)
631 | * for each element is returned.
632 | *
633 | * Note: This method *always* returns an array. If no valid value can be determined the
634 | * array will be empty, otherwise it will contain one or more values.
635 | */
636 | $.fn.fieldValue = function(successful) {
637 | for (var val=[], i=0, max=this.length; i < max; i++) {
638 | var el = this[i];
639 | var v = $.fieldValue(el, successful);
640 | if (v === null || typeof v == 'undefined' || (v.constructor == Array && !v.length)) {
641 | continue;
642 | }
643 | v.constructor == Array ? $.merge(val, v) : val.push(v);
644 | }
645 | return val;
646 | };
647 |
648 | /**
649 | * Returns the value of the field element.
650 | */
651 | $.fieldValue = function(el, successful) {
652 | var n = el.name, t = el.type, tag = el.tagName.toLowerCase();
653 | if (successful === undefined) {
654 | successful = true;
655 | }
656 |
657 | if (successful && (!n || el.disabled || t == 'reset' || t == 'button' ||
658 | (t == 'checkbox' || t == 'radio') && !el.checked ||
659 | (t == 'submit' || t == 'image') && el.form && el.form.clk != el ||
660 | tag == 'select' && el.selectedIndex == -1)) {
661 | return null;
662 | }
663 |
664 | if (tag == 'select') {
665 | var index = el.selectedIndex;
666 | if (index < 0) {
667 | return null;
668 | }
669 | var a = [], ops = el.options;
670 | var one = (t == 'select-one');
671 | var max = (one ? index+1 : ops.length);
672 | for(var i=(one ? index : 0); i < max; i++) {
673 | var op = ops[i];
674 | if (op.selected) {
675 | var v = op.value;
676 | if (!v) { // extra pain for IE...
677 | v = (op.attributes && op.attributes['value'] && !(op.attributes['value'].specified)) ? op.text : op.value;
678 | }
679 | if (one) {
680 | return v;
681 | }
682 | a.push(v);
683 | }
684 | }
685 | return a;
686 | }
687 | return $(el).val();
688 | };
689 |
690 | /**
691 | * Clears the form data. Takes the following actions on the form's input fields:
692 | * - input text fields will have their 'value' property set to the empty string
693 | * - select elements will have their 'selectedIndex' property set to -1
694 | * - checkbox and radio inputs will have their 'checked' property set to false
695 | * - inputs of type submit, button, reset, and hidden will *not* be effected
696 | * - button elements will *not* be effected
697 | */
698 | $.fn.clearForm = function() {
699 | return this.each(function() {
700 | $('input,select,textarea', this).clearFields();
701 | });
702 | };
703 |
704 | /**
705 | * Clears the selected form elements.
706 | */
707 | $.fn.clearFields = $.fn.clearInputs = function() {
708 | return this.each(function() {
709 | var t = this.type, tag = this.tagName.toLowerCase();
710 | if (t == 'text' || t == 'password' || tag == 'textarea') {
711 | this.value = '';
712 | }
713 | else if (t == 'checkbox' || t == 'radio') {
714 | this.checked = false;
715 | }
716 | else if (tag == 'select') {
717 | this.selectedIndex = -1;
718 | }
719 | });
720 | };
721 |
722 | /**
723 | * Resets the form data. Causes all form elements to be reset to their original value.
724 | */
725 | $.fn.resetForm = function() {
726 | return this.each(function() {
727 | // guard against an input with the name of 'reset'
728 | // note that IE reports the reset function as an 'object'
729 | if (typeof this.reset == 'function' || (typeof this.reset == 'object' && !this.reset.nodeType)) {
730 | this.reset();
731 | }
732 | });
733 | };
734 |
735 | /**
736 | * Enables or disables any matching elements.
737 | */
738 | $.fn.enable = function(b) {
739 | if (b === undefined) {
740 | b = true;
741 | }
742 | return this.each(function() {
743 | this.disabled = !b;
744 | });
745 | };
746 |
747 | /**
748 | * Checks/unchecks any matching checkboxes or radio buttons and
749 | * selects/deselects and matching option elements.
750 | */
751 | $.fn.selected = function(select) {
752 | if (select === undefined) {
753 | select = true;
754 | }
755 | return this.each(function() {
756 | var t = this.type;
757 | if (t == 'checkbox' || t == 'radio') {
758 | this.checked = select;
759 | }
760 | else if (this.tagName.toLowerCase() == 'option') {
761 | var $sel = $(this).parent('select');
762 | if (select && $sel[0] && $sel[0].type == 'select-one') {
763 | // deselect all other options
764 | $sel.find('option').selected(false);
765 | }
766 | this.selected = select;
767 | }
768 | });
769 | };
770 |
771 | // helper fn for console logging
772 | // set $.fn.ajaxSubmit.debug to true to enable debug logging
773 | function log() {
774 | if ($.fn.ajaxSubmit.debug) {
775 | var msg = '[jquery.form] ' + Array.prototype.join.call(arguments,'');
776 | if (window.console && window.console.log) {
777 | window.console.log(msg);
778 | }
779 | else if (window.opera && window.opera.postError) {
780 | window.opera.postError(msg);
781 | }
782 | }
783 | };
784 |
785 | })(jQuery);
--------------------------------------------------------------------------------
/includes/formats/apa6_format.php:
--------------------------------------------------------------------------------
1 | 1) {
76 | //There is more than one author
77 | $html .= uppercasewords($contributors[$i]['lname']);
78 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
79 | //The author is a person and not a corporation
80 | //Check for a hyphen in the first name
81 | $hyphentest = stripos($contributors[$i]['fname'], '-');
82 | if ($hyphentest!=false) {
83 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
84 | }else{
85 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.';
86 | }
87 | if ($contributors[$i]['mi']) {
88 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '., ';
89 | }else{
90 | $html .= ', ';
91 | }
92 | }else{
93 | //The author is a corporation and not a person
94 | $html .= ', ';
95 | }
96 | }else{
97 | //There is only one author
98 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
99 | //The author is not Anonymous or blank
100 | $html .= uppercasewords($contributors[$i]['lname']);
101 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
102 | //The author is a person and not a corporation
103 | //Check for a hyphen in the first name
104 | $hyphentest = stripos($contributors[$i]['fname'], '-');
105 | if ($hyphentest!=false) {
106 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
107 | }else{
108 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '. ';
109 | }
110 | if ($contributors[$i]['mi']) {
111 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
112 | }
113 | }else{
114 | //The author is a corporation and not a person
115 | $html .= '. ';
116 | }
117 | }
118 | }
119 | }elseif ($i>=5) {
120 | //Sixth or more time through the loop
121 | if ($countauthors>7 && $i==5) {
122 | //There are more than 7 authors and this is the sixth time through the loop
123 | $html .= ' ' . uppercasewords($contributors[$i]['lname']) . ', ';
124 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
125 | //The author is a person and not a corporation
126 | //Check for a hyphen in the first name
127 | $hyphentest = stripos($contributors[$i]['fname'], '-');
128 | if ($hyphentest!=false) {
129 | $html .= firstinitial($contributors[$i]['fname']) . '.-';
130 | }else{
131 | $html .= firstinitial($contributors[$i]['fname']) . '.';
132 | }
133 | if ($contributors[$i]['mi']) {
134 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '.';
135 | }
136 | $html .= ', . . . ';
137 | }else{
138 | //The author is a corporation and not a person
139 | $html .= ', . . . ';
140 | }
141 | }elseif ($countauthors==7 && $i==5) {
142 | //There are 7 authors and this is the sixth time through the loop
143 | $html .= ' ' . uppercasewords($contributors[$i]['lname']);
144 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
145 | //The author is a person and not a corporation
146 | //Check for a hyphen in the first name
147 | $hyphentest = stripos($contributors[$i]['fname'], '-');
148 | if ($hyphentest!=false) {
149 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
150 | }else{
151 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '. ';
152 | }
153 | if ($contributors[$i]['mi']) {
154 | $html .= uppercasewords($contributors[$i]['mi']) . '., & ';
155 | }else{
156 | $html .= uppercasewords($contributors[$i]['mi']) . ', & ';
157 | }
158 | }else{
159 | //The author is a corporation and not a person
160 | $html .= ', & ';
161 | }
162 | }elseif (($i+1)==$countcontributors) {
163 | //This is the last time through the loop
164 | //If there are 6 authors add an ampersand before the name, otherwise do not
165 | if ($countauthors==6) {
166 | $html .= ' & ' . uppercasewords($contributors[$i]['lname']);
167 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
168 | //The author is a person and not a corporation
169 | //Check for a hyphen in the first name
170 | $hyphentest = stripos($contributors[$i]['fname'], '-');
171 | if ($hyphentest!=false) {
172 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
173 | }else{
174 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '. ';
175 | }
176 | if ($contributors[$i]['mi']) {
177 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
178 | }
179 | }else{
180 | //The author is a corporation and not a person
181 | $html .= '. ';
182 | }
183 | }else{
184 | $html .= ' ' . uppercasewords($contributors[$i]['lname']);
185 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
186 | //The author is a person and not a corporation
187 | //Check for a hyphen in the first name
188 | $hyphentest = stripos($contributors[$i]['fname'], '-');
189 | if ($hyphentest!=false) {
190 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
191 | }else{
192 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '. ';
193 | }
194 | if ($contributors[$i]['mi']) {
195 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
196 | }
197 | }else{
198 | //The author is a corporation and not a person
199 | $html .= '. ';
200 | }
201 | }
202 | }
203 | }else{
204 | if (($i+1)==$countcontributors) {
205 | //This is the last time through the loop
206 | if ($countauthors>1) {
207 | //There is more than one author
208 | $html .= ' & ' . uppercasewords($contributors[$i]['lname']);
209 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
210 | //The author is a person and not a corporation
211 | //Check for a hyphen in the first name
212 | $hyphentest = stripos($contributors[$i]['fname'], '-');
213 | if ($hyphentest!=false) {
214 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
215 | }else{
216 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.';
217 | }
218 | if ($contributors[$i]['mi']) {
219 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
220 | }
221 | $html .= ' ';
222 | }else{
223 | //The author is a corporation and not a person
224 | $html .= '. ';
225 | }
226 | }else{
227 | //There is only one author
228 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
229 | //The author is not Anonymous or blank
230 | $html .= uppercasewords($contributors[$i]['lname']);
231 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
232 | //The author is a person and not a corporation
233 | //Check for a hyphen in the first name
234 | $hyphentest = stripos($contributors[$i]['fname'], '-');
235 | if ($hyphentest!=false) {
236 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
237 | }else{
238 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '. ';
239 | }
240 | if ($contributors[$i]['mi']) {
241 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
242 | }
243 | }else{
244 | //The author is a corporation and not a person
245 | $html .= '. ';
246 | }
247 | }
248 | }
249 | }else{
250 | $html .= ' ' . uppercasewords($contributors[$i]['lname']);
251 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
252 | //The author is a person and not a corporation
253 | //Check for a hyphen in the first name
254 | $hyphentest = stripos($contributors[$i]['fname'], '-');
255 | if ($hyphentest!=false) {
256 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.-';
257 | }else{
258 | $html .= ', ' . firstinitial($contributors[$i]['fname']) . '.';
259 | }
260 | if ($contributors[$i]['mi']) {
261 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '.,';
262 | }else{
263 | $html .= ', ';
264 | }
265 | }else{
266 | //The author is a corporation and not a person
267 | $html .= ', ';
268 | }
269 | }
270 | }
271 | }
272 | }
273 | return $html;
274 | }
275 |
276 | //Format the translator names (APA)
277 | function apatranslators($contributors) {
278 | $countcontributors = count($contributors);
279 | //Count the number of authors in the array
280 | $countauthors = 0;
281 | //Count the number of translators in the array
282 | $counttranslators = 0;
283 | foreach ($contributors as $contributor) {
284 | if ($contributor['cselect']=='author') {
285 | $countauthors++;
286 | }elseif($contributor['cselect']=='translator') {
287 | $counttranslators++;
288 | }
289 | }
290 | $html = '';
291 | //Translator iterative counter
292 | $t=0;
293 | for ($i=0; $i<$countcontributors; $i++) {
294 | if ($contributors[$i]['cselect']=='translator') {
295 | //If this contributor is an translator
296 | if ($t==0) {
297 | //First time through the loop
298 | if ($counttranslators>1) {
299 | //There is more than one translator
300 | $html .= '(';
301 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
302 | if ($contributors[$i]['mi']) {
303 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
304 | }
305 | $html .= uppercasewords($contributors[$i]['lname']);
306 | if ($counttranslators>2) {
307 | //There are more than two translators
308 | $html .= ',';
309 | }
310 | }else{
311 | //There is only one translator
312 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
313 | //The translator is not Anonymous or blank
314 | $html .= '(';
315 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
316 | if ($contributors[$i]['mi']) {
317 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
318 | }
319 | $html .= uppercasewords($contributors[$i]['lname']);
320 | }
321 | }
322 | }elseif (($t+1)==$counttranslators) {
323 | //Last time through the loop
324 | if ($counttranslators>1) {
325 | //There is more than one translator
326 | $html .= ' & ' . substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
327 | if ($contributors[$i]['mi']) {
328 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
329 | }
330 | $html .= uppercasewords($contributors[$i]['lname']);
331 | }else{
332 | //There is only one translator
333 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
334 | //The translator is not Anonymous or blank
335 | $html .= '(';
336 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
337 | if ($contributors[$i]['mi']) {
338 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
339 | }
340 | $html .= uppercasewords($contributors[$i]['lname']);
341 | }
342 | }
343 | }elseif (($t+2)==$counttranslators) {
344 | //Second to last time through the loop
345 | $html .= ' ' . substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
346 | if ($contributors[$i]['mi']) {
347 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
348 | }
349 | $html .= uppercasewords($contributors[$i]['lname']);
350 | }else{
351 | $html .= ' ' . substr(uppercasewords($contributors[$i]['fname']), 0, 1) . '. ';
352 | if ($contributors[$i]['mi']) {
353 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
354 | }
355 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
356 | }
357 | $t++;
358 | }
359 | }
360 | if ($counttranslators>0) {
361 | $html .= ', Trans.).';
362 | }
363 | return $html;
364 | }
365 |
366 | //Format the editor names (APA)
367 | function apaeditors($contributors) {
368 | $countcontributors = count($contributors);
369 | //Count the number of authors in the array
370 | $countauthors = 0;
371 | //Count the number of editors in the array
372 | $counteditors = 0;
373 | foreach ($contributors as $contributor) {
374 | if ($contributor['cselect']=='author') {
375 | $countauthors++;
376 | }elseif($contributor['cselect']=='editor') {
377 | $counteditors++;
378 | }
379 | }
380 | $html = '';
381 | //editor iterative counter
382 | $t=0;
383 | for ($i=0; $i<$countcontributors; $i++) {
384 | if ($contributors[$i]['cselect']=='editor') {
385 | //If this contributor is an editor
386 | if ($t==0) {
387 | //First time through the loop
388 | if ($counteditors>1) {
389 | //There is more than one editor
390 | $html .= 'In ';
391 | if ($contributors[$i]['fname']) {
392 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
393 | }
394 | if ($contributors[$i]['mi']) {
395 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
396 | }
397 | $html .= uppercasewords($contributors[$i]['lname']);
398 | if ($counteditors>2) {
399 | //There are more than two editors
400 | $html .= ',';
401 | }
402 | }else{
403 | //There is only one editor
404 | $html .= 'In ';
405 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
406 | //The editor is not Anonymous or blank
407 | if ($contributors[$i]['fname']) {
408 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
409 | }
410 | if ($contributors[$i]['mi']) {
411 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
412 | }
413 | $html .= uppercasewords($contributors[$i]['lname']);
414 | }
415 | }
416 | }elseif (($t+1)==$counteditors) {
417 | //Last time through the loop
418 | if ($counteditors>1) {
419 | //There is more than one editor
420 | if ($contributors[$i]['fname']) {
421 | $html .= ' & ' . substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
422 | }
423 | if ($contributors[$i]['mi']) {
424 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
425 | }
426 | $html .= uppercasewords($contributors[$i]['lname']);
427 | }else{
428 | //There is only one editor
429 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
430 | //The editor is not Anonymous or blank
431 | if ($contributors[$i]['fname']) {
432 | $html .= substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
433 | }
434 | if ($contributors[$i]['mi']) {
435 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
436 | }
437 | $html .= uppercasewords($contributors[$i]['lname']);
438 | }
439 | }
440 | }elseif (($t+2)==$counteditors) {
441 | //Second to last time through the loop
442 | if ($contributors[$i]['fname']) {
443 | $html .= ' ' . substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
444 | }
445 | if ($contributors[$i]['mi']) {
446 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
447 | }
448 | $html .= uppercasewords($contributors[$i]['lname']);
449 | }else{
450 | if ($contributors[$i]['fname']) {
451 | $html .= ' ' . substr(uppercasewords($contributors[$i]['fname']), 0 ,1) . '. ';
452 | }
453 | if ($contributors[$i]['mi']) {
454 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '. ';
455 | }
456 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
457 | }
458 | $t++;
459 | }
460 | }
461 | if ($counteditors==1) {
462 | $html .= ' (Ed.),';
463 | }
464 | if ($counteditors>1) {
465 | $html .= ' (Eds.),';
466 | }
467 | return $html;
468 | }
469 |
470 | //Format an article title (APA)
471 | function articletitleapaformat($articletitleinput) {
472 | //Uppercase the first word in article title
473 | $articletitleinput = uppercasefirstword($articletitleinput);
474 | //If the article title contains a subtitle, capitalize the first word after the colon
475 | if (preg_match('/:[ ]+[a-z]/', $articletitleinput, $regs)) {
476 | $articletitleinput = subtitleucfirst($articletitleinput, $regs);
477 | }
478 | //Punctuate after the article title
479 | $articletitleinput = articleperiod($articletitleinput);
480 | return $articletitleinput;
481 | }
482 |
483 | //Format a book title (APA)
484 | /**
485 | * @param string $addpunctuation
486 | */
487 | function booktitleapaformat($booktitleinput, $addpunctuation) {
488 | //Uppercase the first word in article title
489 | $html = uppercasefirstword($booktitleinput);
490 | //If the article title contains a subtitle, capitalize the first word after the colon
491 | if (preg_match('/:[ ]+[a-z]/', $html, $regs)) {
492 | $html = subtitleucfirst($html, $regs);
493 | }
494 | if ($addpunctuation=="yes") {
495 | //Punctuate after the book title, if necessary
496 | $html = articleperiod($html);
497 | }
498 | $html = '
' . $html . ' ';
499 | return $html;
500 | }
501 |
502 | /********************************/
503 | /* Citation parsing */
504 | /********************************/
505 |
506 | //Creates a book (in entirety) citation
507 | function apa6bookcite($style, $medium, $contributors, $publicationyearinput, $booktitleinput, $publisherlocationinput, $publisherinput, $websitetitleinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $doiwebsiteinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput, $yearpublishedinput, $mediuminput, $urlebookinput, $doiebookinput) {
508 | //Add the contributors
509 | $html = apaauthorformat($contributors);
510 | //Add the publishing date (if provided)
511 | if ($publicationyearinput) {
512 | $html .= ' (' . $publicationyearinput . '). ';
513 | }
514 | //Add the book title (if provided)
515 | if ($booktitleinput) {
516 | $html .= booktitleapaformat($booktitleinput, "yes") . ' ';
517 | }
518 | //Add the translators (if provided)
519 | $html .= apatranslators($contributors) . ' ';
520 | //Add the editors (if provided)
521 | $html .= apaeditors($contributors) . ' ';
522 | //in print
523 | if ($medium=="print") {
524 | //Add the publisher location (if provided)
525 | if ($publisherlocationinput) {
526 | $html .= uppercasewords($publisherlocationinput) . ': ';
527 | }
528 | //Add the publisher (if provided)
529 | if ($publisherinput) {
530 | $html .= uppercasewords($publisherinput) . '.';
531 | }
532 | }
533 | //on a website
534 | if ($medium=="website") {
535 | //Add the URL (if provided)
536 | if ($urlwebsiteinput) {
537 | $html .= 'Retrieved from ' . checkurlprepend($urlwebsiteinput);
538 | }elseif($doiwebsiteinput) {
539 | //Add the DOI (if provided)
540 | $html .= 'doi:' . $doiwebsiteinput;
541 | }
542 | }
543 | //in a database
544 | if ($medium=="db") {
545 | //Add the URL (if provided)
546 | if ($urldbinput) {
547 | $html .= 'Retrieved from ' . checkurlprepend($urldbinput);
548 | }elseif($doidbinput) {
549 | //Add the DOI (if provided)
550 | $html .= 'doi:' . $doidbinput;
551 | }
552 | }
553 | //as an ebook
554 | if ($medium=="ebook") {
555 | //Add the URL (if provided)
556 | if ($urlebookinput) {
557 | $html .= 'Retrieved from ' . checkurlprepend($urlebookinput);
558 | }elseif($doiebookinput) {
559 | //Add the DOI (if provided)
560 | $html .= 'doi:' . $doiebookinput;
561 | }
562 | }
563 | echo $html;
564 | }
565 |
566 | //Creates a chapter or essay from a book citation
567 | function apa6chapteressaycite($style, $medium, $contributors, $publicationyearinput, $chapteressayinput, $booktitleinput, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $publisherlocationinput, $publisherinput, $websitetitleinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $doiwebsiteinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput) {
568 | //Add the contributors
569 | $html = apaauthorformat($contributors);
570 | //Add the publishing date (if provided)
571 | if ($publicationyearinput) {
572 | $html .= ' (' . $publicationyearinput . '). ';
573 | }
574 | //Add the chapter/essay title (if provided)
575 | if ($chapteressayinput) {
576 | $html .= articletitleapaformat($chapteressayinput) . ' ';
577 | }
578 | //Add the translators (if provided)
579 | $html .= apatranslators($contributors) . ' ';
580 | //Add the editors (if provided)
581 | if (apaeditors($contributors)) {
582 | $html .= apaeditors($contributors) . ' ';
583 | }else{
584 | $html .= 'In ';
585 | }
586 | //Add the book title and page numbers (if provided)
587 | $pageholder = apanewspaperpages($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput);
588 | if ($pageholder) {
589 | //There are page numbers to display
590 | if ($booktitleinput) {
591 | //There is a book title to display
592 | $html .= booktitleapaformat($booktitleinput, "no") . ' ';
593 | }
594 | $html .= '(' . $pageholder . '). ';
595 | }else{
596 | //There are no page numbers to display
597 | if ($booktitleinput) {
598 | //There is a book title to display
599 | $html .= booktitleapaformat($booktitleinput, "yes") . ' ';
600 | }
601 | }
602 | //Add the publisher location (if provided)
603 | if ($publisherlocationinput) {
604 | $html .= uppercasewords($publisherlocationinput) . ': ';
605 | }
606 | //Add the publisher (if provided)
607 | if ($publisherinput) {
608 | $html .= uppercasewords($publisherinput) . '. ';
609 | }
610 | //on a website
611 | if ($medium=="website") {
612 | //Add the URL (if provided)
613 | if ($urlwebsiteinput) {
614 | $html .= 'Retrieved from ' . checkurlprepend($urlwebsiteinput);
615 | }elseif($doiwebsiteinput) {
616 | //Add the DOI (if provided)
617 | $html .= 'doi:' . $doiwebsiteinput;
618 | }
619 | }
620 | //in a database
621 | if ($medium=="db") {
622 | //Add the URL (if provided)
623 | if ($urldbinput) {
624 | $html .= 'Retrieved from ' . checkurlprepend($urldbinput);
625 | }elseif($doidbinput) {
626 | //Add the DOI (if provided)
627 | $html .= 'doi:' . $doidbinput;
628 | }
629 | }
630 | echo $html;
631 | }
632 |
633 | //Creates a magazine article citation
634 | function apa6magazinecite($style, $medium, $contributors, $articletitleinput, $magazinetitleinput, $datepublishedday, $datepublishedmonth, $datepublishedyear, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $printadvancedinfovolume, $printadvancedinfoissue, $websitetitleinput, $webpagesstartinput, $webpagesendinput, $webpagesnonconsecutiveinput, $webpagesnonconsecutivepagenumsinput, $websiteadvancedinfovolume, $websiteadvancedinfoissue, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput, $dbadvancedinfovolume, $dbadvancedinfoissue, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput) {
635 | //Add the contributors
636 | $html = apaauthorformat($contributors);
637 | //Add the publishing date
638 | $html .= apamagnewsdate($datepublishedday, $datepublishedmonth, $datepublishedyear) . '. ';
639 | //Add the article title (if provided)
640 | if ($articletitleinput) {
641 | $html .= articletitleapaformat($articletitleinput) . ' ';
642 | }
643 | //Add the magazine title (if provided)
644 | if ($magazinetitleinput) {
645 | $magtitleholder = uppercasewords($magazinetitleinput);
646 | $html .= '
' . forcearticlelower($magtitleholder) . ' ';
647 | }
648 | if ($medium=="print") {
649 | //Add the volume and issue numbers (if provided)
650 | if ($printadvancedinfovolume || $printadvancedinfoissue) {
651 | //Add a comma after the magazine title (if provided)
652 | if ($magazinetitleinput) {
653 | $html .= ', ';
654 | }
655 | $html .= '
' . $printadvancedinfovolume . ' ';
656 | if ($printadvancedinfoissue) {
657 | //Add the issue number (if provided)
658 | $html .= '(' . $printadvancedinfoissue . ')';
659 | }
660 | }
661 | //Add the page numbers (if provided)
662 | $pageholder = apascholarjournalpages($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput);
663 | if ($pageholder) {
664 | //There are page numbers
665 | if ($printadvancedinfovolume || $printadvancedinfoissue) {
666 | //There is a volume & issue number preceeding
667 | $html .= ', ' . $pageholder;
668 | }else{
669 | //There is no volume & issue number preceeding
670 | if ($magazinetitleinput) {
671 | //There is a magazine title preceeding
672 | $html .= ', ' . $pageholder;
673 | }else{
674 | //There is no magazine title preceeding
675 | $html .= $pageholder;
676 | }
677 | }
678 | }
679 | //Add a period
680 | $html .= '. ';
681 | }
682 | if ($medium=="website") {
683 | //Add the volume and issue numbers (if provided)
684 | if ($websiteadvancedinfovolume || $websiteadvancedinfoissue) {
685 | //Add a comma after the magazine title (if provided)
686 | if ($magazinetitleinput) {
687 | $html .= ', ';
688 | }
689 | $html .= '
' . $websiteadvancedinfovolume . ' ';
690 | if ($websiteadvancedinfoissue) {
691 | //Add the issue number (if provided)
692 | $html .= '(' . $websiteadvancedinfoissue . ')';
693 | }
694 | }
695 | //Add the page numbers (if provided)
696 | $pageholder = apascholarjournalpages($webpagesstartinput, $webpagesendinput, $webpagesnonconsecutiveinput, $webpagesnonconsecutivepagenumsinput);
697 | if ($pageholder) {
698 | //There are page numbers
699 | if ($printadvancedinfovolume || $printadvancedinfoissue) {
700 | //There is a volume & issue number preceeding
701 | $html .= ', ' . $pageholder;
702 | }else{
703 | //There is no volume & issue number preceeding
704 | if ($magazinetitleinput) {
705 | //There is a magazine title preceeding
706 | $html .= ', ' . $pageholder;
707 | }else{
708 | //There is no magazine title preceeding
709 | $html .= $pageholder;
710 | }
711 | }
712 | }
713 | //Add a period
714 | $html .= '. ';
715 | //Add the URL (if provided)
716 | if ($urlwebsiteinput) {
717 | $html .= 'Retrieved from ' . checkurlprepend($urlwebsiteinput);
718 | }
719 | }
720 | if ($medium=="db") {
721 | //Add the volume and issue numbers (if provided)
722 | if ($dbadvancedinfovolume || $dbadvancedinfoissue) {
723 | //Add a comma after the magazine title (if provided)
724 | if ($magazinetitleinput) {
725 | $html .= ', ';
726 | }
727 | $html .= '
' . $dbadvancedinfovolume . ' ';
728 | if ($dbadvancedinfoissue) {
729 | //Add the issue number (if provided)
730 | $html .= '(' . $dbadvancedinfoissue . ')';
731 | }
732 | }
733 | //Add the page numbers (if provided)
734 | $pageholder = apascholarjournalpages($dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput, $dbpagesnonconsecutivepagenumsinput);
735 | if ($pageholder) {
736 | //There are page numbers
737 | if ($dbadvancedinfovolume || $dbadvancedinfoissue) {
738 | //There is a volume & issue number preceeding
739 | $html .= ', ' . $pageholder;
740 | }else{
741 | //There is no volume & issue number preceeding
742 | if ($magazinetitleinput) {
743 | //There is a magazine title preceeding
744 | $html .= ', ' . $pageholder;
745 | }else{
746 | //There is no magazine title preceeding
747 | $html .= $pageholder;
748 | }
749 | }
750 | }
751 | //Add a period
752 | $html .= '. ';
753 | //Add the URL (if provided)
754 | if ($urldbinput) {
755 | $html .= 'Retrieved from ' . checkurlprepend($urldbinput);
756 | }
757 | }
758 | echo $html;
759 | }
760 |
761 | //Creates a newspaper article citation
762 | function apa6newspapercite($style, $medium, $contributors, $articletitleinput, $newspapertitleinput, $newspapercityinput, $datepublishedday, $datepublishedmonth, $datepublishedyear, $editioninput, $sectioninput, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $websitetitleinput, $urlwebsiteinput, $electronicpublishday, $electronicpublishmonth, $electronicpublishyear, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $dbnewspapercityinput, $dbdatepublisheddateday, $dbdatepublisheddatemonth, $dbdatepublisheddateyear, $dbeditioninput, $dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput) {
763 | //Add the contributors
764 | $html = apaauthorformat($contributors);
765 | //Add the publishing date
766 | if ($medium=="print") {
767 | $html .= apamagnewsdate($datepublishedday, $datepublishedmonth, $datepublishedyear) . '. ';
768 | }
769 | if ($medium=="website") {
770 | $html .= apamagnewsdate($electronicpublishday, $electronicpublishmonth, $electronicpublishyear) . '. ';
771 | }
772 | if ($medium=="db") {
773 | $html .= apamagnewsdate($dbdatepublisheddateday, $dbdatepublisheddatemonth, $dbdatepublisheddateyear) . '. ';
774 | }
775 | //Add the article title (if provided)
776 | if ($articletitleinput) {
777 | $html .= articletitleapaformat($articletitleinput) . ' ';
778 | }
779 | //in print
780 | if ($medium=="print") {
781 | //Add the newspaper title
782 | $html .= '
' . uppercasewords($newspapertitleinput) . ' ';
783 | //Add a comma after the newspaper title
784 | $html .= ', ';
785 | //Add the page numbers
786 | $html .= apanewspaperpages($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput) . '.';
787 | }
788 | //on a website
789 | if ($medium=="website") {
790 | //Add the newspaper title
791 | $html .= '
' . uppercasewords($newspapertitleinput) . ' ';
792 | //Add a period after the newspaper title
793 | $html .= '. ';
794 | //Add the Home page URL (if provided)
795 | if ($urlwebsiteinput) {
796 | //Add the URL
797 | $html .= 'Retrieved from ' . $urlwebsiteinput;
798 | }
799 | }
800 | //in a database
801 | if ($medium=="db") {
802 | //Add the newspaper title
803 | $html .= '
' . uppercasewords($newspapertitleinput) . ' ';
804 | //Add a period after the newspaper title
805 | $html .= '. ';
806 | //Add the Home page URL (if provided)
807 | if ($urldbinput) {
808 | //Add the URL
809 | $html .= 'Retrieved from ' . $urldbinput;
810 | }
811 | }
812 | echo $html;
813 | }
814 |
815 | //Creates a scholarly journal article citation
816 | function apa6scholarjournalcite($style, $medium, $contributors, $yearpublishedinput, $articletitleinput, $journaltitleinput, $volume, $issue, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $urlwebsiteinput, $doiwebsiteinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput) {
817 | //Add the contributors
818 | $html = apaauthorformat($contributors);
819 | //Add the publishing date (if provided)
820 | if ($yearpublishedinput) {
821 | $html .= ' (' . $yearpublishedinput . '). ';
822 | }
823 | //Add the article title (if provided)
824 | if ($articletitleinput) {
825 | $html .= articletitleapaformat($articletitleinput) . ' ';
826 | }
827 | //Add the journal title (if provided)
828 | if ($journaltitleinput) {
829 | $journaltitleholder = uppercasewords($journaltitleinput);
830 | $html .= '
' . forcearticlelower($journaltitleholder) . ' ';
831 | }
832 | //Add the volume and issue numbers (if provided)
833 | if ($volume || $issue) {
834 | //Add a comma after the journal title (if provided)
835 | if ($journaltitleinput) {
836 | $html .= ', ';
837 | }
838 | $html .= '
' . $volume . ' ';
839 | if ($issue) {
840 | //Add the issue number (if provided)
841 | $html .= '(' . $issue . ')';
842 | }
843 | }
844 | //Add the page numbers (if provided)
845 | $pageholder = apascholarjournalpages($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput);
846 | if ($pageholder) {
847 | //There are page numbers
848 | if ($volume || $issue) {
849 | //There is a volume & issue number preceeding
850 | $html .= ', ' . $pageholder;
851 | }else{
852 | //There is no volume & issue number preceeding
853 | if ($journaltitleinput) {
854 | //There is a magazine title preceeding
855 | $html .= ', ' . $pageholder;
856 | }else{
857 | //There is no journal title preceeding
858 | $html .= $pageholder;
859 | }
860 | }
861 | }
862 | //Add a period
863 | $html .= '. ';
864 | //on a website
865 | if ($medium=="website") {
866 | //Add the URL (if provided)
867 | if ($urlwebsiteinput) {
868 | $html .= 'Retrieved from ' . checkurlprepend($urlwebsiteinput);
869 | }elseif($doiwebsiteinput) {
870 | //Add the DOI (if provided)
871 | $html .= 'doi:' . $doiwebsiteinput;
872 | }
873 | }
874 | //in a database
875 | if ($medium=="db") {
876 | //Add the URL (if provided)
877 | if ($urldbinput) {
878 | $html .= 'Retrieved from ' . checkurlprepend($urldbinput);
879 | }elseif($doidbinput) {
880 | //Add the DOI (if provided)
881 | $html .= 'doi:' . $doidbinput;
882 | }
883 | }
884 | echo $html;
885 | }
886 |
887 | //Creates a web site citation
888 | function apa6websitecite($style, $medium, $contributors, $articletitleinput, $websitetitleinput, $publishersponsorinput, $urlwebsiteinput, $electronicpublishday, $electronicpublishmonth, $electronicpublishyear, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear) {
889 | //Add the contributors
890 | $html = apaauthorformat($contributors);
891 | //Add the publishing date
892 | $html .= apamagnewsdate($electronicpublishday, $electronicpublishmonth, $electronicpublishyear) . '. ';
893 | //Add the article title (if provided)
894 | if ($articletitleinput) {
895 | $html .= articletitleapaformat($articletitleinput) . ' ';
896 | }
897 | //Add the website title (if provided)
898 | if ($websitetitleinput) {
899 | $html .= 'Retrieved from ' . $websitetitleinput . ' ';
900 | }
901 | //Add the URL (if provided)
902 | if ($urlwebsiteinput) {
903 | $html .= 'website: ' . checkurlprepend($urlwebsiteinput);
904 | }
905 | echo $html;
906 | }
907 | ?>
--------------------------------------------------------------------------------
/includes/formats/mla7_format.php:
--------------------------------------------------------------------------------
1 | 1) {
144 | //There is more than one author
145 | $html .= uppercasewords($contributors[$i]['lname']);
146 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
147 | //The author is a person and not a corporation
148 | $html .= ', ' . uppercasewords($contributors[$i]['fname']);
149 | if ($contributors[$i]['mi']) {
150 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '.';
151 | }
152 | }
153 | $html .= ',';
154 | }else{
155 | //There is only one author
156 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
157 | //The author is not Anonymous or blank
158 | $html .= uppercasewords($contributors[$i]['lname']);
159 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
160 | //The author is a person and not a corporation
161 | $html .= ', ' . uppercasewords($contributors[$i]['fname']);
162 | if ($contributors[$i]['mi']) {
163 | $html .= ' ' . uppercasewords($contributors[$i]['mi']);
164 | }
165 | }
166 | $html .= '. ';
167 | }
168 | }
169 | }elseif (($i+1)==$countcontributors) {
170 | //Last time through the loop
171 | if ($countauthors>1) {
172 | //There is more than one author
173 | $html .= ' and ' . uppercasewords($contributors[$i]['fname']) . ' ';
174 | if ($contributors[$i]['mi']) {
175 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
176 | }
177 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
178 | }else{
179 | //There is only one author
180 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
181 | //The author is not Anonymous or blank
182 | $html .= uppercasewords($contributors[$i]['lname']) . ', ';
183 | $html .= uppercasewords($contributors[$i]['fname']);
184 | if ($contributors[$i]['mi']) {
185 | $html .= ' ' . uppercasewords($contributors[$i]['mi']);
186 | }
187 | $html .= '. ';
188 | }
189 | }
190 | }else{
191 | $html .= ' ' . uppercasewords($contributors[$i]['fname']) . ' ';
192 | if ($contributors[$i]['mi']) {
193 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
194 | }
195 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
196 | }
197 | }elseif(($contributors[$i]['cselect']=='editor' && $countauthors==0)) {
198 | //If this contributor is an editor and there are no authors listed
199 | if ($i==0) {
200 | //First time through the loop
201 | if ($counteditors>1) {
202 | //There is more than one editor
203 | $html .= uppercasewords($contributors[$i]['lname']);
204 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
205 | //The editor is a person and not a corporation
206 | $html .= ', ' . uppercasewords($contributors[$i]['fname']);
207 | if ($contributors[$i]['mi']) {
208 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . '.';
209 | }
210 | }
211 | if ($counteditors>2) {
212 | $html .= ',';
213 | }
214 | }else{
215 | //There is only one editor
216 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
217 | //The editor is not Anonymous or blank
218 | $html .= uppercasewords($contributors[$i]['lname']);
219 | if (($contributors[$i]['fname'] || $contributors[$i]['mi'])) {
220 | //The editor is a person and not a corporation
221 | $html .= ', ' . uppercasewords($contributors[$i]['fname']);
222 | if ($contributors[$i]['mi']) {
223 | $html .= ' ' . uppercasewords($contributors[$i]['mi']);
224 | }
225 | }
226 | $html .= ', ed. ';
227 | }
228 | }
229 | }elseif (($i+1)==$countcontributors) {
230 | //Last time through the loop
231 | if ($counteditors>1) {
232 | //There is more than one editor
233 | $html .= ' and ' . uppercasewords($contributors[$i]['fname']) . ' ';
234 | if ($contributors[$i]['mi']) {
235 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
236 | }
237 | $html .= uppercasewords($contributors[$i]['lname']) . ', eds. ';
238 | }else{
239 | //There is only one editor
240 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
241 | //The editor is not Anonymous or blank
242 | $html .= uppercasewords($contributors[$i]['lname']) . ', ';
243 | $html .= uppercasewords($contributors[$i]['fname']);
244 | if ($contributors[$i]['mi']) {
245 | $html .= ' ' . uppercasewords($contributors[$i]['mi']);
246 | }
247 | $html .= ', ed. ';
248 | }
249 | }
250 | }else{
251 | $html .= ' ' . uppercasewords($contributors[$i]['fname']) . ' ';
252 | if ($contributors[$i]['mi']) {
253 | $html .= uppercasewords($contributors[$i]['mi']) . '. ';
254 | }
255 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
256 | }
257 | }
258 | }
259 | return $html;
260 | }
261 |
262 | //Format the translator names (MLA)
263 | function mlatranslators($contributors) {
264 | $countcontributors = count($contributors);
265 | //Count the number of authors in the array
266 | $countauthors = 0;
267 | //Count the number of translators in the array
268 | $counttranslators = 0;
269 | foreach ($contributors as $contributor) {
270 | if ($contributor['cselect']=='author') {
271 | $countauthors++;
272 | }elseif($contributor['cselect']=='translator') {
273 | $counttranslators++;
274 | }
275 | }
276 | $html = '';
277 | //Translator iterative counter
278 | $t=0;
279 | for ($i=0; $i<$countcontributors; $i++) {
280 | if ($contributors[$i]['cselect']=='translator') {
281 | //If this contributor is an translator
282 | if ($t==0) {
283 | //First time through the loop
284 | if ($counttranslators>1) {
285 | //There is more than one translator
286 | $html .= 'Trans. ';
287 | $html .= uppercasewords($contributors[$i]['fname']) . ' ';
288 | if ($contributors[$i]['mi']) {
289 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
290 | }
291 | $html .= uppercasewords($contributors[$i]['lname']);
292 | //If there are more than two translators, add a comma after the name
293 | if ($countranslators>2) {
294 | $html .= ',';
295 | }
296 | }else{
297 | //There is only one translator
298 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
299 | //The translator is not Anonymous or blank
300 | $html .= 'Trans. ';
301 | $html .= uppercasewords($contributors[$i]['fname']) . ' ';
302 | if ($contributors[$i]['mi']) {
303 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
304 | }
305 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
306 | }
307 | }
308 | }elseif (($t+1)==$counttranslators) {
309 | //Last time through the loop
310 | if ($counttranslators>1) {
311 | //There is more than one translator
312 | $html .= ' and ' . uppercasewords($contributors[$i]['fname']) . ' ';
313 | if ($contributors[$i]['mi']) {
314 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
315 | }
316 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
317 | }else{
318 | //There is only one translator
319 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
320 | //The translator is not Anonymous or blank
321 | $html .= 'Trans. ';
322 | $html .= uppercasewords($contributors[$i]['fname']) . ' ';
323 | if ($contributors[$i]['mi']) {
324 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
325 | }
326 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
327 | }
328 | }
329 | }else{
330 | $html .= ' ' . uppercasewords($contributors[$i]['fname']) . ' ';
331 | if ($contributors[$i]['mi']) {
332 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
333 | }
334 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
335 | }
336 | $t++;
337 | }
338 | }
339 | return $html;
340 | }
341 |
342 | //Format the editor names, if there is an author (MLA)
343 | function mlaeditors($contributors) {
344 | $countcontributors = count($contributors);
345 | //Count the number of authors in the array
346 | $countauthors = 0;
347 | //Count the number of editors in the array
348 | $counteditors = 0;
349 | foreach ($contributors as $contributor) {
350 | if ($contributor['cselect']=='author') {
351 | $countauthors++;
352 | }elseif($contributor['cselect']=='editor') {
353 | $counteditors++;
354 | }
355 | }
356 | $html = '';
357 | //editor iterative counter
358 | $t=0;
359 | for ($i=0; $i<$countcontributors; $i++) {
360 | if (($contributors[$i]['cselect']=='editor')&&($countauthors!=0)) {
361 | //If this contributor is an editor and there are no authors
362 | if ($t==0) {
363 | //First time through the loop
364 | if ($counteditors>1) {
365 | //There is more than one editor
366 | $html .= 'Ed. ';
367 | $html .= uppercasewords($contributors[$i]['fname']);
368 | if ($contributors[$i]['mi']) {
369 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . ' ';
370 | }
371 | $html .= uppercasewords($contributors[$i]['lname']);
372 | //If there are more than two editors, add a comma after the name
373 | if ($counteditors>2) {
374 | $html .= ',';
375 | }
376 | }else{
377 | //There is only one editor
378 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
379 | //The editor is not Anonymous or blank
380 | $html .= 'Ed. ';
381 | $html .= uppercasewords($contributors[$i]['fname']) . ' ';
382 | if ($contributors[$i]['mi']) {
383 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . ' ';
384 | }
385 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
386 | }
387 | }
388 | }elseif (($t+1)==$counteditors) {
389 | //Last time through the loop
390 | if ($counteditors>1) {
391 | //There is more than one editor
392 | $html .= ' and ' . uppercasewords($contributors[$i]['fname']) . ' ';
393 | if ($contributors[$i]['mi']) {
394 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
395 | }
396 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
397 | }else{
398 | //There is only one editor
399 | if (($contributors[$i]['lname']!='Anonymous') || (!$contributors[$i]['lname'] && !$contributors[$i]['fname'] && !$contributors[$i]['mi'])) {
400 | //The editor is not Anonymous or blank
401 | $html .= 'Ed. ';
402 | $html .= uppercasewords($contributors[$i]['fname']);
403 | if ($contributors[$i]['mi']) {
404 | $html .= ' ' . uppercasewords($contributors[$i]['mi']) . ' ';
405 | }
406 | $html .= uppercasewords($contributors[$i]['lname']) . '. ';
407 | }
408 | }
409 | }else{
410 | $html .= ' ' . uppercasewords($contributors[$i]['fname']) . ' ';
411 | if ($contributors[$i]['mi']) {
412 | $html .= uppercasewords($contributors[$i]['mi']) . ' ';
413 | }
414 | $html .= uppercasewords($contributors[$i]['lname']) . ',';
415 | }
416 | $t++;
417 | }
418 | }
419 | return $html;
420 | }
421 |
422 | //Format a scholarly journal year published (MLA)
423 | function mlasjyearpublished($yearpublishedinput) {
424 | $html = '(' . $yearpublishedinput . '): ';
425 | return $html;
426 | }
427 |
428 | //Format a book title (MLA)
429 | /**
430 | * @param string $addpunctuation
431 | */
432 | function mlabooktitleformat($booktitleinput, $addpunctuation) {
433 | //Uppercase the words in book title
434 | $html = uppercasewords($booktitleinput);
435 | //Lowercase all articles, prepositions, & conjunctions
436 | $html = forcearticlelower($html);
437 | //If the article title contains a subtitle, capitalize the first word after the colon
438 | if (preg_match('/:[ ]+[a-z]/', $html, $regs)) {
439 | $html = subtitleucfirst($html, $regs);
440 | }
441 | if ($addpunctuation=="yes") {
442 | //Punctuate after the book title, if necessary
443 | $html = articleperiod($html);
444 | }
445 | $html = '
' . $html . ' ';
446 | return $html;
447 | }
448 |
449 | //Format an eBook medium (MLA)
450 | function mlaebookmediumformat($mediuminput) {
451 | if (preg_match('/[ ]+file/', $mediuminput, $regs)) {
452 | //has the word "file" at the end of the string
453 | $html = $mediuminput;
454 | }elseif(!$mediuminput) {
455 | //the Medium field is blank
456 | $html = '
Digital file ';
457 | }else{
458 | //does not have the word "file" at the end of the string
459 | $html = $mediuminput . ' file';
460 | }
461 | return $html;
462 | }
463 |
464 | /********************************/
465 | /* Citation parsing */
466 | /********************************/
467 |
468 | //Creates a book citation
469 | function mla7bookcite($style, $medium, $contributors, $publicationyearinput, $booktitleinput, $publisherlocationinput, $publisherinput, $websitetitleinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $doiwebsiteinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput, $yearpublishedinput, $mediuminput, $urlebookinput, $doiebookinput) {
470 | //Add the contributors
471 | $html = mlaauthorformat($contributors);
472 | //Add the book title (if provided)
473 | if ($booktitleinput) {
474 | $html .= mlabooktitleformat($booktitleinput, "yes") . ' ';
475 | }
476 | //Add the translators (if no authors)
477 | $html .= mlatranslators($contributors);
478 | //Add the editors (if no authors)
479 | $html .= mlaeditors($contributors);
480 | //Add the publisher location (if provided)
481 | if ($publisherlocationinput) {
482 | $html .= uppercasewords($publisherlocationinput) . ': ';
483 | }
484 | //Add the publisher (if provided)
485 | if ($publisherinput) {
486 | $html .= uppercasewords($publisherinput) . ', ';
487 | }
488 | //Add the publication year (if provided)
489 | if ($publicationyearinput) {
490 | $html .= $publicationyearinput . '. ';
491 | }
492 | //in print
493 | if ($medium=="print") {
494 | //Add the medium
495 | $html .= 'Print.';
496 | }
497 | //on a website
498 | if ($medium=="website") {
499 | //Add the title of the website (if provided)
500 | if ($websitetitleinput) {
501 | $html .= '
' . uppercasewords($websitetitleinput) . ' ' . '. ';
502 | }
503 | //Add the medium
504 | $html .= 'Web. ';
505 | //Add the access date (if provided)
506 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
507 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
508 | }
509 | //Add the URL (if provided)
510 | if ($urlwebsiteinput) {
511 | $html .= '<';
512 | $html .= checkurlprepend($urlwebsiteinput);
513 | $html .= '>';
514 | $html .= '. ';
515 | }
516 |
517 | }
518 | //in a database
519 | if ($medium=="db") {
520 | //Add the database title (if provided)
521 | if ($databaseinput) {
522 | $html .= '
' . uppercasewords($databaseinput) . ' ' . '. ';
523 | }
524 | //Add the medium
525 | $html .= 'Web. ';
526 | //Add the access date (if provided)
527 | if ($dbaccessdateday || $dbaccessdatemonth || $dbaccessdateyear) {
528 | $html .= mlaaccessdate($dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear) . '. ';
529 | }
530 | //Add the URL (if provided)
531 | if ($urldbinput) {
532 | $html .= '<';
533 | $html .= checkurlprepend($urldbinput);
534 | $html .= '>';
535 | $html .= '. ';
536 | }
537 | }
538 | //as a digital file
539 | if ($medium=="ebook") {
540 | //Add the Medium
541 | $html .= mlaebookmediumformat($mediuminput) . '. ';
542 | //Add the URL (if provided)
543 | if ($urlebookinput) {
544 | $html .= '<';
545 | $html .= checkurlprepend($urlebookinput);
546 | $html .= '>';
547 | $html .= '. ';
548 | }
549 | }
550 | echo $html;
551 | }
552 |
553 | //Creates a chapter or essay from a book citation
554 | function mla7chapteressaycite($style, $medium, $contributors, $publicationyearinput, $chapteressayinput, $booktitleinput, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $publisherlocationinput, $publisherinput, $websitetitleinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $doiwebsiteinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput) {
555 | //Add the contributors
556 | $html = mlaauthorformat($contributors);
557 | //Add the translators (if no authors)
558 | $html .= mlatranslators($contributors);
559 | //Add the chapter/essay title (if provided)
560 | if ($chapteressayinput) {
561 | //Uppercase all words in chapter/essay title, lowercase all articles, prepositions, & conjunctions, append a period, and encapsulate in double quotes
562 | $chapteressayinput = uppercasewords($chapteressayinput);
563 | $chapteressayinput = forcearticlelower($chapteressayinput);
564 | $chapteressayinput = articleperiod($chapteressayinput);
565 | $html .= '"' . $chapteressayinput . '" ';
566 | }
567 | //Add the book title (if provided)
568 | if ($booktitleinput) {
569 | $html .= mlabooktitleformat($booktitleinput, "yes") . ' ';
570 | }
571 | //Add the translators (if no authors)
572 | $html .= mlatranslators($contributors);
573 | //Add the editors (if no authors)
574 | $html .= mlaeditors($contributors);
575 | //Add the publisher location (if provided)
576 | if ($publisherlocationinput) {
577 | $html .= uppercasewords($publisherlocationinput) . ': ';
578 | }
579 | //Add the publisher (if provided)
580 | if ($publisherinput) {
581 | $html .= uppercasewords($publisherinput) . ', ';
582 | }
583 | //Add the publication year (if provided)
584 | if ($publicationyearinput) {
585 | $html .= $publicationyearinput . '. ';
586 | }
587 | //Add the page numbers
588 | $html .= mlapagenumbers($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput);
589 | //in print
590 | if ($medium=="print") {
591 | //Add the medium
592 | $html .= 'Print.';
593 | }
594 | //on a website
595 | if ($medium=="website") {
596 | //Add the title of the website (if provided)
597 | if ($websitetitleinput) {
598 | $html .= '
' . uppercasewords($websitetitleinput) . ' ' . '. ';
599 | }
600 | //Add the medium
601 | $html .= 'Web. ';
602 | //Add the access date (if provided)
603 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
604 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
605 | }
606 | //Add the URL (if provided)
607 | if ($urlwebsiteinput) {
608 | $html .= '<';
609 | $html .= checkurlprepend($urlwebsiteinput);
610 | $html .= '>';
611 | $html .= '. ';
612 | }
613 |
614 | }
615 | //in a database
616 | if ($medium=="db") {
617 | //Add the database title (if provided)
618 | if ($databaseinput) {
619 | $html .= '
' . uppercasewords($databaseinput) . ' ' . '. ';
620 | }
621 | //Add the medium
622 | $html .= 'Web. ';
623 | //Add the access date (if provided)
624 | if ($dbaccessdateday || $dbaccessdatemonth || $dbaccessdateyear) {
625 | $html .= mlaaccessdate($dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear) . '. ';
626 | }
627 | //Add the URL (if provided)
628 | if ($urldbinput) {
629 | $html .= '<';
630 | $html .= checkurlprepend($urldbinput);
631 | $html .= '>';
632 | $html .= '. ';
633 | }
634 | }
635 | echo $html;
636 | }
637 |
638 | //Creates a magazine article citation
639 | function mla7magazinecite($style, $medium, $contributors, $articletitleinput, $magazinetitleinput, $datepublishedday, $datepublishedmonth, $datepublishedyear, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $printadvancedinfovolume, $printadvancedinfoissue, $websitetitleinput, $webpagesstartinput, $webpagesendinput, $webpagesnonconsecutiveinput, $webpagesnonconsecutivepagenumsinput, $websiteadvancedinfovolume, $websiteadvancedinfoissue, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $urlwebsiteinput, $dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput, $dbadvancedinfovolume, $dbadvancedinfoissue, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput) {
640 | //Add the contributors
641 | $html = mlaauthorformat($contributors);
642 | //Add the article title (if provided)
643 | if ($articletitleinput) {
644 | //Uppercase all words in article title, lowercase all art., prep., & conj., append a period, and encapsulate in double quotes
645 | $articletitle = uppercasewords($articletitleinput);
646 | $articletitle = forcearticlelower($articletitle);
647 | $articletitle = articleperiod($articletitle);
648 | $html .= '"' . $articletitle . '" ';
649 | }
650 | //in print
651 | if ($medium=="print") {
652 | //Add the magazine title (if provided)
653 | if ($magazinetitleinput) {
654 | $magtitleholder = uppercasewords($magazinetitleinput);
655 | $html .= '
' . forcearticlelower($magtitleholder) . ' ' . ' ';
656 | }
657 | //Add the date published (if provided)
658 | if ($datepublishedday || $datepublishedmonth || $datepublishedyear) {
659 | $html .= mlanewspublishdate($datepublishedday, $datepublishedmonth, $datepublishedyear);
660 | //Add a colon
661 | $html .= ': ';
662 | }
663 | //Add the page numbers
664 | $html .= mlapagenumbers($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput);
665 | //Add the medium
666 | $html .= 'Print.';
667 | }
668 | //on website
669 | if ($medium=="website") {
670 | //Add the website publisher/sponsor (if provided)
671 | if ($magazinetitleinput) {
672 | $html .= '
' . uppercasewords($magazinetitleinput) . ' ' . '. ';
673 | }else{
674 | $html .= 'N.p., ';
675 | }
676 | //Add the website title (if provided)
677 | if ($websitetitleinput) {
678 | $html .= uppercasewords($websitetitleinput) . ', ';
679 | }
680 | //Add the date published (if provided)
681 | $html .= mlanewspublishdate($datepublishedday, $datepublishedmonth, $datepublishedyear);
682 | //Add a period
683 | $html .= '. ';
684 | //Add the medium
685 | $html .= 'Web. ';
686 | //Add the access date (if provided)
687 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
688 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
689 | }
690 | //Add the URL (if provided)
691 | if ($urlwebsiteinput) {
692 | $html .= '<';
693 | $html .= checkurlprepend($urlwebsiteinput);
694 | $html .= '>';
695 | $html .= '. ';
696 | }
697 | }
698 | //in a database
699 | if ($medium=="db") {
700 | //Add the magazine title (if provided)
701 | if ($magazinetitleinput) {
702 | $magtitleholder = uppercasewords($magazinetitleinput);
703 | $html .= '
' . forcearticlelower($magtitleholder) . ' ' . ' ';
704 | }
705 | //Add the date published (if provided)
706 | $html .= mlanewspublishdate($datepublishedday, $datepublishedmonth, $datepublishedyear);
707 | //Add a period
708 | $html .= '. ';
709 | //Add the page numbers
710 | $html .= mlapagenumbers($dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput);
711 | //Add the database title (if provided)
712 | if ($databaseinput) {
713 | $html .= '
' . uppercasewords($databaseinput) . ' ' . '. ';
714 | }
715 | //Add the medium
716 | $html .= 'Web. ';
717 | //Add the access date (if provided)
718 | if ($dbaccessdateday || $dbaccessdatemonth || $dbaccessdateyear) {
719 | $html .= mlaaccessdate($dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear) . '. ';
720 | }
721 | //Add the URL (if provided)
722 | if ($urldbinput) {
723 | $html .= '<';
724 | $html .= checkurlprepend($urldbinput);
725 | $html .= '>';
726 | $html .= '. ';
727 | }
728 | }
729 | echo $html;
730 | }
731 |
732 | //Creates a newspaper article citation
733 | function mla7newspapercite($style, $medium, $contributors, $articletitleinput, $newspapertitleinput, $newspapercityinput, $datepublishedday, $datepublishedmonth, $datepublishedyear, $editioninput, $sectioninput, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $websitetitleinput, $urlwebsiteinput, $electronicpublishday, $electronicpublishmonth, $electronicpublishyear, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $dbnewspapercityinput, $dbdatepublisheddateday, $dbdatepublisheddatemonth, $dbdatepublisheddateyear, $dbeditioninput, $dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput) {
734 | //Add the contributors
735 | $html = mlaauthorformat($contributors);
736 | //Add the article title (if provided)
737 | if ($articletitleinput) {
738 | //Uppercase all words in article title, lowercase all art., prep., & conj., append a period, and encapsulate in double quotes
739 | $articletitle = uppercasewords($articletitleinput);
740 | $articletitle = forcearticlelower($articletitle);
741 | $articletitle = articleperiod($articletitle);
742 | $html .= '"' . $articletitle . '" ';
743 | }
744 | //in print
745 | if ($medium=="print") {
746 | //Add the newspaper title (if provided)
747 | if ($newspapertitleinput) {
748 | //Uppercase all words in a newspaper's title
749 | $newspapertitleinput = uppercasewords($newspapertitleinput);
750 | //Remove articles (A, An, The) before the newspaper title
751 | $newspapertitleinput = removearticle($newspapertitleinput);
752 | $html .= '
' . $newspapertitleinput . ' ' . ' ';
753 | }
754 | //Add the newspaper city (if provided)
755 | if ($newspapercityinput) {
756 | $html .= '[' . uppercasewords($newspapercityinput) . ']' . ' ';
757 | }
758 | //Add the date published (if provided)
759 | if ($datepublishedday || $datepublishedmonth || $datepublishedyear) {
760 | $html .= mlanewspublishdate($datepublishedday, $datepublishedmonth, $datepublishedyear);
761 | }
762 | //Add the edition (if provided)
763 | if ($editioninput) {
764 | $editioninput = lowercasewords($editioninput);
765 | $html .= ', ' . editionabbrev($editioninput);
766 | }
767 | //Add the section (if provided)
768 | if ($sectioninput) {
769 | $html .= ', ' . mlanewspapersection($sectioninput);
770 | }
771 | //Add a colon
772 | $html .= ': ';
773 | //Add the page numbers
774 | $html .= mlapagenumbers($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput);
775 | //Add the medium
776 | $html .= 'Print.';
777 | }
778 | //on a website
779 | if ($medium=="website") {
780 | //Add the web site title (if provided)
781 | if ($websitetitleinput) {
782 | $html .= '
' . uppercasewords($websitetitleinput) . ' ' . '. ';
783 | }
784 | //Add the newspaper title (if provided)
785 | if ($newspapertitleinput) {
786 | //Uppercase all words in a newspaper's title
787 | $newspapertitleinput = uppercasewords($newspapertitleinput);
788 | //Remove articles (A, An, The) before the newspaper title
789 | $newspapertitleinput = removearticle($newspapertitleinput);
790 | $html .= '
' . $newspapertitleinput . ' ' . ', ';
791 | }
792 | //Add the electronically published date (if provided)
793 | if ($electronicpublishday || $electronicpublishmonth || $electronicpublishyear) {
794 | $html .= mlanewspublishdate($electronicpublishday, $electronicpublishmonth, $electronicpublishyear) . '. ';
795 | }
796 | //Add the medium
797 | $html .= 'Web. ';
798 | //Add the access date (if provided)
799 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
800 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
801 | }
802 | //Add the URL (if provided)
803 | if ($urlwebsiteinput) {
804 | $html .= '<';
805 | $html .= checkurlprepend($urlwebsiteinput);
806 | $html .= '>';
807 | $html .= '. ';
808 | }
809 | }
810 | //in a database
811 | if ($medium=="db") {
812 | //Add the newspaper title (if provided)
813 | if ($newspapertitleinput) {
814 | //Uppercase all words in a newspaper's title
815 | $newspapertitleinput = uppercasewords($newspapertitleinput);
816 | //Remove articles (A, An, The) before the newspaper title
817 | $newspapertitleinput = removearticle($newspapertitleinput);
818 | $html .= '
' . $newspapertitleinput . ' ' . ' ';
819 | }
820 | //Add the newspaper city (if provided)
821 | if ($dbnewspapercityinput) {
822 | $html .= '[' . uppercasewords($dbnewspapercityinput) . ']' . ' ';
823 | }
824 | //Add the date published (if provided)
825 | if ($dbdatepublisheddateday || $dbdatepublisheddatemonth || $dbdatepublisheddateyear) {
826 | $html .= mlanewspublishdate($dbdatepublisheddateday, $dbdatepublisheddatemonth, $dbdatepublisheddateyear);
827 | }
828 | //Add the edition (if provided)
829 | if ($dbeditioninput) {
830 | $dbeditioninput = lowercasewords($dbeditioninput);
831 | $html .= ', ' . editionabbrev($dbeditioninput);
832 | }
833 | //Add a colon
834 | $html .= ': ';
835 | //Add the page numbers
836 | $html .= mlapagenumbers($dbpagesstartinput, $dbpagesendinput, $dbpagesnonconsecutiveinput);
837 | //Add the database title (if provided)
838 | if ($databaseinput) {
839 | $html .= '
' . uppercasewords($databaseinput) . ' ' . '. ';
840 | }
841 | //Add the medium
842 | $html .= 'Web. ';
843 | //Add the access date
844 | $html .= mlaaccessdate($dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear) . '. ';
845 | //Add the URL (if provided)
846 | if ($urldbinput) {
847 | $html .= '<';
848 | $html .= checkurlprepend($urldbinput);
849 | $html .= '>';
850 | $html .= '. ';
851 | }
852 | }
853 | echo $html;
854 | }
855 |
856 | //Creates a scholarly journal article citation
857 | function mla7scholarjournalcite($style, $medium, $contributors, $yearpublishedinput, $articletitleinput, $journaltitleinput, $volume, $issue, $pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput, $pagesnonconsecutivepagenumsinput, $urlwebsiteinput, $doiwebsiteinput, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear, $databaseinput, $dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear, $urldbinput, $doidbinput) {
858 | //Add the contributors
859 | $html = mlaauthorformat($contributors);
860 | //Add the article title (if provided)
861 | if ($articletitleinput) {
862 | //Uppercase all words in article title, lowercase all art., prep., & conj., append a period, and encapsulate in double quotes
863 | $articletitle = uppercasewords($articletitleinput);
864 | $articletitle = forcearticlelower($articletitle);
865 | $articletitle = articleperiod($articletitle);
866 | $html .= '"' . $articletitle . '" ';
867 | }
868 | //Add the journal title (if provided)
869 | if ($journaltitleinput) {
870 | $journaltitleholder = uppercasewords($journaltitleinput);
871 | $html .= '
' . forcearticlelower($journaltitleholder) . ' ';
872 | }
873 | //Add the volume number (if provided)
874 | if ($volume) {
875 | $html .= $volume;
876 | }
877 | //Add the issue number (if provided)
878 | if ($issue) {
879 | $html .= '.' . $issue . ' ';
880 | }
881 | //Add the date published (if provided)
882 | if ($yearpublishedinput) {
883 | $html .= mlasjyearpublished($yearpublishedinput);
884 | }
885 | //Add the page numbers
886 | $html .= mlapagenumbers($pagesstartinput, $pagesendinput, $pagesnonconsecutiveinput);
887 | //in print
888 | if ($medium=="print") {
889 | //Add the medium
890 | $html .= 'Print.';
891 | }
892 | //on a website
893 | if ($medium=="website") {
894 | //Add the medium
895 | $html .= 'Web. ';
896 | //Add the access date (if provided)
897 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
898 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
899 | }
900 | //Add the URL (if provided)
901 | if ($urlwebsiteinput) {
902 | $html .= '<';
903 | $html .= checkurlprepend($urlwebsiteinput);
904 | $html .= '>';
905 | $html .= '. ';
906 | }
907 | }
908 | //in a database
909 | if ($medium=="db") {
910 | //Add the database title (if provided)
911 | if ($databaseinput) {
912 | $html .= '
' . uppercasewords($databaseinput) . ' ' . '. ';
913 | }
914 | //Add the medium
915 | $html .= 'Web. ';
916 | //Add the access date (if provided)
917 | if ($dbaccessdateday || $dbaccessdatemonth || $dbaccessdateyear) {
918 | $html .= mlaaccessdate($dbaccessdateday, $dbaccessdatemonth, $dbaccessdateyear) . '. ';
919 | }
920 | //Add the URL (if provided)
921 | if ($urldbinput) {
922 | $html .= '<';
923 | $html .= checkurlprepend($urldbinput);
924 | $html .= '>';
925 | $html .= '. ';
926 | }
927 | }
928 | echo $html;
929 | }
930 |
931 | //Creates a web site citation
932 | function mla7websitecite($style, $medium, $contributors, $articletitleinput, $websitetitleinput, $publishersponsorinput, $urlwebsiteinput, $electronicpublishday, $electronicpublishmonth, $electronicpublishyear, $webaccessdateday, $webaccessdatemonth, $webaccessdateyear) {
933 | //Add the contributors
934 | $html = mlaauthorformat($contributors);
935 | //Add the article title (if provided)
936 | if ($articletitleinput) {
937 | //Uppercase all words in article title, lowercase all art., prep., & conj., append a period, and encapsulate in double quotes
938 | $articletitle = uppercasewords($articletitleinput);
939 | $articletitle = forcearticlelower($articletitle);
940 | $articletitle = articleperiod($articletitle);
941 | $html .= '"' . $articletitle . '" ';
942 | }
943 | //Add the web site title (if provided)
944 | if ($websitetitleinput) {
945 | $html .= '
' . uppercasewords($websitetitleinput) . ' ' . '. ';
946 | }
947 | //Add the web site publisher/sponsor (if provided)
948 | if ($publishersponsorinput) {
949 | $html .= uppercasewords($publishersponsorinput) . ', ';
950 | }else{
951 | $html .= 'N.p., ';
952 | }
953 | //Add the electronically published date (if provided)
954 | $html .= mlanewspublishdate($electronicpublishday, $electronicpublishmonth, $electronicpublishyear);
955 | //Add a period
956 | $html .= '. ';
957 | //Add the medium
958 | $html .= 'Web. ';
959 | //Add the access date (if provided)
960 | if ($webaccessdateday || $webaccessdatemonth || $webaccessdateyear) {
961 | $html .= mlaaccessdate($webaccessdateday, $webaccessdatemonth, $webaccessdateyear) . '. ';
962 | }
963 | //Add the URL (if provided)
964 | if ($urlwebsiteinput) {
965 | $html .= '<';
966 | $html .= checkurlprepend($urlwebsiteinput);
967 | $html .= '>';
968 | $html .= '. ';
969 | }
970 | echo $html;
971 | }
972 | ?>
--------------------------------------------------------------------------------