@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | margin: 0.5em 0; |
32 | 32 | } |
33 | 33 | |
34 | - <?php echo "\n" . $cssStyles; ?> |
|
34 | + <?php echo "\n".$cssStyles; ?> |
|
35 | 35 | </style> |
36 | 36 | </head> |
37 | 37 | <body> |
@@ -87,20 +87,20 @@ discard block |
||
87 | 87 | "bibliography" => [ |
88 | 88 | "author" => function($authorItem, $renderedText) { |
89 | 89 | if (isset($authorItem->id)) { |
90 | - return '<a href="https://example.org/author/' . $authorItem->id . '">' . $renderedText . '</a>'; |
|
90 | + return '<a href="https://example.org/author/'.$authorItem->id.'">'.$renderedText.'</a>'; |
|
91 | 91 | } |
92 | 92 | return $renderedText; |
93 | 93 | }, |
94 | 94 | "title" => function($cslItem, $renderedText) { |
95 | - return '<a href="https://example.org/publication/' . $cslItem->id . '">' . $renderedText . '</a>'; |
|
95 | + return '<a href="https://example.org/publication/'.$cslItem->id.'">'.$renderedText.'</a>'; |
|
96 | 96 | }, |
97 | 97 | "csl-entry" => function($cslItem, $renderedText) { |
98 | - return '<a id="' . $cslItem->id .'" href="#' . $cslItem->id .'"></a>' . $renderedText; |
|
98 | + return '<a id="'.$cslItem->id.'" href="#'.$cslItem->id.'"></a>'.$renderedText; |
|
99 | 99 | } |
100 | 100 | ], |
101 | 101 | "citation" => [ |
102 | 102 | "citation-number" => function($cslItem, $renderedText) { |
103 | - return '<a href="#' . $cslItem->id .'">'.$renderedText.'</a>'; |
|
103 | + return '<a href="#'.$cslItem->id.'">'.$renderedText.'</a>'; |
|
104 | 104 | } |
105 | 105 | ] |
106 | 106 | ]); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | foreach ($node->children() as $child) { |
98 | 98 | if ($child->getName() === "date-part") { |
99 | 99 | $datePartName = (string) $child->attributes()["name"]; |
100 | - $this->dateParts->set($this->form . "-" . $datePartName, Util\Factory::create($child)); |
|
100 | + $this->dateParts->set($this->form."-".$datePartName, Util\Factory::create($child)); |
|
101 | 101 | } |
102 | 102 | } |
103 | 103 | |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | $toRender = 0; |
175 | 175 | if ($interval->y > 0 && in_array('year', $dateParts)) { |
176 | 176 | $toRender |= self::DATE_RANGE_STATE_YEAR; |
177 | - $delimiter = $this->dateParts->get($this->form . "-year")->getRangeDelimiter(); |
|
177 | + $delimiter = $this->dateParts->get($this->form."-year")->getRangeDelimiter(); |
|
178 | 178 | } |
179 | 179 | if ($interval->m > 0 && $from->getMonth() - $to->getMonth() !== 0 && in_array('month', $dateParts)) { |
180 | 180 | $toRender |= self::DATE_RANGE_STATE_MONTH; |
181 | - $delimiter = $this->dateParts->get($this->form . "-month")->getRangeDelimiter(); |
|
181 | + $delimiter = $this->dateParts->get($this->form."-month")->getRangeDelimiter(); |
|
182 | 182 | } |
183 | 183 | if ($interval->d > 0 && $from->getDay() - $to->getDay() !== 0 && in_array('day', $dateParts)) { |
184 | 184 | $toRender |= self::DATE_RANGE_STATE_DAY; |
185 | - $delimiter = $this->dateParts->get($this->form . "-day")->getRangeDelimiter(); |
|
185 | + $delimiter = $this->dateParts->get($this->form."-day")->getRangeDelimiter(); |
|
186 | 186 | } |
187 | 187 | if ($toRender === self::DATE_RANGE_STATE_NONE) { |
188 | 188 | $ret .= $this->iterateAndRenderDateParts($dateParts, $data_); |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | } |
193 | 193 | |
194 | 194 | if (isset($var->raw) && preg_match("/(\p{L}+)\s?([\-\–&,])\s?(\p{L}+)/u", $var->raw, $matches)) { |
195 | - return $matches[1] . $matches[2] . $matches[3]; |
|
195 | + return $matches[1].$matches[2].$matches[3]; |
|
196 | 196 | } |
197 | 197 | } elseif (!empty($this->datePartsAttribute)) { |
198 | 198 | // fallback: |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | if (!empty($dateFromLocale)) { |
276 | 276 | $dateForm = array_filter( |
277 | 277 | is_array($dateFromLocale) ? $dateFromLocale : [$dateFromLocale], |
278 | - function ($element) use ($format) { |
|
278 | + function($element) use ($format) { |
|
279 | 279 | /** @var SimpleXMLElement $element */ |
280 | 280 | $dateForm = (string) $element->attributes()["form"]; |
281 | 281 | return $dateForm === $format; |
@@ -337,7 +337,7 @@ discard block |
||
337 | 337 | if ($this->dateParts->count() < 1 && in_array($form, self::$localizedDateFormats)) { |
338 | 338 | if ($this->hasDatePartsFromLocales($form)) { |
339 | 339 | $datePartsFromLocales = $this->getDatePartsFromLocales($form); |
340 | - array_filter($datePartsFromLocales, function (SimpleXMLElement $item) use ($dateParts) { |
|
340 | + array_filter($datePartsFromLocales, function(SimpleXMLElement $item) use ($dateParts) { |
|
341 | 341 | return in_array($item["name"], $dateParts); |
342 | 342 | }); |
343 | 343 | |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | $this->dateParts->add( |
351 | 351 | "$form-$datePart", |
352 | 352 | new DatePart( |
353 | - new SimpleXMLElement('<date-part name="' . $datePart . '" form="' . $form . '" />') |
|
353 | + new SimpleXMLElement('<date-part name="'.$datePart.'" form="'.$form.'" />') |
|
354 | 354 | ) |
355 | 355 | ); |
356 | 356 | } |
@@ -133,8 +133,8 @@ |
||
133 | 133 | public function renderNumeric() |
134 | 134 | { |
135 | 135 | $ret = $this->year; |
136 | - $ret .= $this->month > 0 && $this->month < 13 ? "-" . sprintf("%02s", $this->month) : ""; |
|
137 | - $ret .= $this->day > 0 && $this->day < 32 ? "-" . sprintf("%02s", $this->day) : ""; |
|
136 | + $ret .= $this->month > 0 && $this->month < 13 ? "-".sprintf("%02s", $this->month) : ""; |
|
137 | + $ret .= $this->day > 0 && $this->day < 32 ? "-".sprintf("%02s", $this->day) : ""; |
|
138 | 138 | return $ret; |
139 | 139 | } |
140 | 140 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | $dp = $dateParts->toArray(); |
31 | 31 | $dateParts_ = []; |
32 | - array_walk($dp, function ($datePart, $key) use (&$dateParts_) { |
|
32 | + array_walk($dp, function($datePart, $key) use (&$dateParts_) { |
|
33 | 33 | if (strpos($key, "year") !== false || strpos($key, "month") !== false) { |
34 | 34 | $dateParts_["yearmonth"][] = $datePart; |
35 | 35 | } |
@@ -29,7 +29,7 @@ |
||
29 | 29 | { |
30 | 30 | $dp = $dateParts->toArray(); |
31 | 31 | $dateParts_ = []; |
32 | - array_walk($dp, function ($datePart, $key) use (&$dateParts_) { |
|
32 | + array_walk($dp, function($datePart, $key) use (&$dateParts_) { |
|
33 | 33 | if (strpos($key, "year") !== false || strpos($key, "day") !== false) { |
34 | 34 | $dateParts_["yearday"][] = $datePart; |
35 | 35 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | { |
29 | 29 | $dp = $dateParts->toArray(); |
30 | 30 | $dateParts_ = []; |
31 | - array_walk($dp, function ($datePart, $key) use (&$dateParts_) { |
|
31 | + array_walk($dp, function($datePart, $key) use (&$dateParts_) { |
|
32 | 32 | //$bit = sprintf("%03d", decbin($differentParts)); |
33 | 33 | if (strpos($key, "month") !== false || strpos($key, "day") !== false) { |
34 | 34 | $dateParts_["monthday"][] = $datePart; |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | // test case group_ShortOutputOnly.json |
196 | 196 | $renderedText = ""; |
197 | 197 | if (in_array($this->form, ["short", "long"])) { |
198 | - $attrWithPrefix = $this->form . ucfirst($this->toRenderTypeValue); |
|
199 | - $attrWithSuffix = $this->toRenderTypeValue . "-" . $this->form; |
|
198 | + $attrWithPrefix = $this->form.ucfirst($this->toRenderTypeValue); |
|
199 | + $attrWithSuffix = $this->toRenderTypeValue."-".$this->form; |
|
200 | 200 | if (isset($data->{$attrWithPrefix}) && !empty($data->{$attrWithPrefix})) { |
201 | 201 | $renderedText = $this->applyTextCase( |
202 | 202 | StringHelper::clearApostrophes( |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | $macro = CiteProc::getContext()->getMacro($this->toRenderTypeValue); |
273 | 273 | if (is_null($macro)) { |
274 | 274 | try { |
275 | - throw new CiteProcException("Macro \"" . $this->toRenderTypeValue . "\" does not exist."); |
|
275 | + throw new CiteProcException("Macro \"".$this->toRenderTypeValue."\" does not exist."); |
|
276 | 276 | } catch (CiteProcException $e) { |
277 | 277 | $renderedText = ""; |
278 | 278 | } |
@@ -92,15 +92,14 @@ discard block |
||
92 | 92 | } |
93 | 93 | |
94 | 94 | if (CiteProc::getContext()->isModeBibliography()) { |
95 | - foreach ($data as $citationNumber => $item) { |
|
96 | - ++self::$numberOfCitedItems; |
|
95 | + foreach ($data as $citationNumber => $item) {++self::$numberOfCitedItems; |
|
97 | 96 | CiteProc::getContext()->getResults()->append( |
98 | 97 | $this->wrapBibEntry($item, $this->renderSingle($item, $citationNumber)) |
99 | 98 | ); |
100 | 99 | } |
101 | 100 | $ret .= implode($this->delimiter, CiteProc::getContext()->getResults()->toArray()); |
102 | 101 | $ret = StringHelper::clearApostrophes($ret); |
103 | - return "<div class=\"csl-bib-body\">" . $ret . "\n</div>"; |
|
102 | + return "<div class=\"csl-bib-body\">".$ret."\n</div>"; |
|
104 | 103 | } elseif (CiteProc::getContext()->isModeCitation()) { |
105 | 104 | if ($citationItems->count() > 0) { //is there a filter for specific citations? |
106 | 105 | if ($this->isGroupedCitations($citationItems)) { //if citation items grouped? |
@@ -148,11 +147,11 @@ discard block |
||
148 | 147 | if (!empty($inMargin) && !empty($margin) && CiteProc::getContext()->isModeBibliography()) { |
149 | 148 | $leftMargin = $this->removeConsecutiveChars($this->htmlentities($this->format(implode("", $inMargin)))); |
150 | 149 | $rightInline = $this->removeConsecutiveChars( |
151 | - $this->htmlentities($this->format(implode("", $margin))) . |
|
150 | + $this->htmlentities($this->format(implode("", $margin))). |
|
152 | 151 | $this->suffix |
153 | 152 | ); |
154 | - $res = '<div class="csl-left-margin">' . $leftMargin . '</div>'; |
|
155 | - $res .= '<div class="csl-right-inline">' . $rightInline . '</div>'; |
|
153 | + $res = '<div class="csl-left-margin">'.$leftMargin.'</div>'; |
|
154 | + $res .= '<div class="csl-right-inline">'.$rightInline.'</div>'; |
|
156 | 155 | return $res; |
157 | 156 | } elseif (!empty($inMargin)) { |
158 | 157 | $res = $this->format(implode("", $inMargin)); |
@@ -177,9 +176,9 @@ discard block |
||
177 | 176 | private function wrapBibEntry($dataItem, $value) |
178 | 177 | { |
179 | 178 | $value = $this->addAffixes($value); |
180 | - return "\n " . |
|
181 | - "<div class=\"csl-entry\">" . |
|
182 | - $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value) . |
|
179 | + return "\n ". |
|
180 | + "<div class=\"csl-entry\">". |
|
181 | + $renderedItem = CiteProcHelper::applyAdditionMarkupFunction($dataItem, "csl-entry", $value). |
|
183 | 182 | "</div>"; |
184 | 183 | } |
185 | 184 | |
@@ -219,7 +218,7 @@ discard block |
||
219 | 218 | { |
220 | 219 | $arr = $data->toArray(); |
221 | 220 | |
222 | - $arr_ = array_filter($arr, function ($dataItem) use ($citationItems) { |
|
221 | + $arr_ = array_filter($arr, function($dataItem) use ($citationItems) { |
|
223 | 222 | foreach ($citationItems as $citationItem) { |
224 | 223 | if ($dataItem->id === $citationItem->id) { |
225 | 224 | return true; |
@@ -112,9 +112,9 @@ |
||
112 | 112 | } |
113 | 113 | } |
114 | 114 | if ($this->constraints->count() > 1 && $this->match === "all") { |
115 | - return (bool)$result; |
|
115 | + return (bool) $result; |
|
116 | 116 | } elseif ($this->match === "none") { |
117 | - return !((bool)$result); |
|
117 | + return !((bool) $result); |
|
118 | 118 | } |
119 | 119 | return false; |
120 | 120 | } |