Overview

Namespaces

  • academicpuma
    • citeproc

Classes

  • Bibliography
  • Choose
  • Citation
  • CiteProc
  • Collection
  • CSLUtils
  • Date
  • DatePart
  • Element
  • EtAl
  • Factory
  • Format
  • Group
  • Info
  • Label
  • Layout
  • Locale
  • Macro
  • Macros
  • Mapper
  • Name
  • Names
  • Number
  • Option
  • Options
  • PElse
  • PElseIf
  • PIf
  • RenderingElement
  • Sort
  • Style
  • Substitute
  • Terms
  • Text
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: /*
  4:  * To change this license header, choose License Headers in Project Properties.
  5:  * To change this template file, choose Tools | Templates
  6:  * and open the template in the editor.
  7:  */
  8: 
  9: namespace academicpuma\citeproc;
 10: 
 11: /**
 12:  * Description of csl_mapper
 13:  *
 14:  * @author sebastian
 15:  */
 16: 
 17: class Mapper {
 18: 
 19:     // In the map_field and map_type function below, the array keys hold the "CSL" variable and type names
 20:     // and the array values contain the variable and type names of the incomming data object.  If the naming
 21:     // convention of your incomming data object differs from the CSL standard (http://citationstyles.org/downloads/specification.html#id78)
 22:     // you should adjust the array values accordingly.
 23: 
 24:     function map_field($field) {
 25:         if (!isset($this->field_map)) {
 26:             $this->field_map = array('title' => 'title',
 27:                 'container-title' => 'container-title',
 28:                 'collection-title' => 'collection-title',
 29:                 'original-title' => 'original-title',
 30:                 'publisher' => 'publisher',
 31:                 'publisher-place' => 'publisher-place',
 32:                 'original-publisher' => 'original-publisher',
 33:                 'original-publisher-place' => 'original-publisher-place',
 34:                 'archive' => 'archive',
 35:                 'archive-place' => 'archive-place',
 36:                 'authority' => 'authority',
 37:                 'archive_location' => 'authority',
 38:                 'event' => 'event',
 39:                 'event-place' => 'event-place',
 40:                 'page' => 'page',
 41:                 'page-first' => 'page',
 42:                 'locator' => 'locator',
 43:                 'version' => 'version',
 44:                 'volume' => 'volume',
 45:                 'number-of-volumes' => 'number-of-volumes',
 46:                 'number-of-pages' => 'number-of-pages',
 47:                 'issue' => 'issue',
 48:                 'chapter-number' => 'chapter-number',
 49:                 'medium' => 'medium',
 50:                 'status' => 'status',
 51:                 'edition' => 'edition',
 52:                 'section' => 'section',
 53:                 'genre' => 'genre',
 54:                 'note' => 'note',
 55:                 'annote' => 'annote',
 56:                 'abstract' => 'abstract',
 57:                 'keyword' => 'keyword',
 58:                 'number' => 'number',
 59:                 'references' => 'references',
 60:                 'URL' => 'URL',
 61:                 'DOI' => 'DOI',
 62:                 'ISBN' => 'ISBN',
 63:                 'call-number' => 'call-number',
 64:                 'citation-number' => 'citation-number',
 65:                 'citation-label' => 'citation-label',
 66:                 'first-reference-note-number' => 'first-reference-note-number',
 67:                 'year-suffix' => 'year-suffix',
 68:                 'jurisdiction' => 'jurisdiction',
 69:                 //Date Variables'
 70:                 'issued' => 'issued',
 71:                 'event' => 'event',
 72:                 'accessed' => 'accessed',
 73:                 'container' => 'container',
 74:                 'original-date' => 'original-date',
 75:                 //Name Variables'
 76:                 'author' => 'author',
 77:                 'editor' => 'editor',
 78:                 'translator' => 'translator',
 79:                 'recipient' => 'recipient',
 80:                 'interviewer' => 'interviewer',
 81:                 'publisher' => 'publisher',
 82:                 'composer' => 'composer',
 83:                 'original-publisher' => 'original-publisher',
 84:                 'original-author' => 'original-author',
 85:                 'container-author' => 'container-author',
 86:                 'collection-editor' => 'collection-editor',
 87:             );
 88:         }
 89: 
 90:         $vars = explode(' ', $field);
 91:         foreach ($vars as $key => $value) {
 92:             $vars[$key] = (!empty($this->field_map[$value])) ? $this->field_map[$value] : '';
 93:         }
 94: 
 95:         return implode(' ', $vars);
 96:     }
 97: 
 98:     function map_type($types) {
 99:         if (!isset($this->type_map)) {
100:             $this->type_map = array(
101:                 'article' => 'article',
102:                 'article-magazine' => 'article-magazine',
103:                 'article-newspaper' => 'article-newspaper',
104:                 'article-journal' => 'article-journal',
105:                 'bill' => 'bill',
106:                 'book' => 'book',
107:                 'broadcast' => 'broadcast',
108:                 'chapter' => 'chapter',
109:                 'entry' => 'entry',
110:                 'entry-dictionary' => 'entry-dictionary',
111:                 'entry-encyclopedia' => 'entry-encyclopedia',
112:                 'figure' => 'figure',
113:                 'graphic' => 'graphic',
114:                 'interview' => 'interview',
115:                 'legislation' => 'legislation',
116:                 'legal_case' => 'legal_case',
117:                 'manuscript' => 'manuscript',
118:                 'map' => 'map',
119:                 'motion_picture' => 'motion_picture',
120:                 'musical_score' => 'musical_score',
121:                 'pamphlet' => 'pamphlet',
122:                 'paper-conference' => 'paper-conference',
123:                 'patent' => 'patent',
124:                 'post' => 'post',
125:                 'post-weblog' => 'post-weblog',
126:                 'personal_communication' => 'personal_communication',
127:                 'report' => 'report',
128:                 'review' => 'review',
129:                 'review-book' => 'review-book',
130:                 'song' => 'song',
131:                 'speech' => 'speech',
132:                 'thesis' => 'thesis',
133:                 'treaty' => 'treaty',
134:                 'webpage' => 'webpage',
135:             );
136:         }
137:         $vars = explode(' ', $types);
138:         foreach ($vars as $key => $value) {
139:             $vars[$key] = (!empty($this->type_map[$value])) ? $this->type_map[$value] : '';
140:         }
141: 
142:         return implode(' ', $vars);
143:     }
144: 
145: }
API documentation generated by ApiGen