$nam = $pag ? '' : ' <div class="rht">' . J_NAME . '</div>'; echo "{$pag}<h2>{$year}, Vol. {$vol}, Issue {$abs['issue']}{$nam}</h2>"; echo linker($doi, $doi, 'rht') . plural(count($cur), 'article'); foreach ($cur as $abs) { if ($cursec != $subj[$abs['section']]) { $cursec = $subj[$abs['section']]; echo "<h3>{$cursec}</h3>"; } $loc = array_values(array_slice($abs, 0, 4)); $url = linkabs($loc); $pdf = linkpdf($loc); $edt = $user ? linkedt($loc, 'rht') : ''; echo '<div class="entry">'; echo $edt . '<h4>' . linker($url, $abs['title']) . '</h4>'; echo '<div>' . $abs['author'] . '</div>'; echo cite($loc) . ' ' . linker(mkdoi($abs['doi'])); if (file_exists($_SERVER['DOCUMENT_ROOT'] . $pdf)) { echo '<div>' . linker($url, 'Abstract') . ' | Full text: ' . linker($pdf, 'PDF [' . getlang($abs['pdf']) . ']') . '</div>'; } echo '</div>'; } } echo '</div>'; } else { echo '<div class="panel">'; echo '<h3 class="h">' . "{$year}, Volume {$vol}" . '</h3>'; echo '<div>'; foreach (array_keys($issue) as $num) { echo '<a href="/archive/' . $vol . '/' . $num . '" class="issue btn">' . '<img src="/img/cover-' . $year . '-' . $num . '.jpg" alt="cover">' . '<span class="btn">Issue ' . $num . '</span>' . '</a>' . PHP_EOL; } echo '</div></div>';
<?php ## Использование wordwrap(). function cite($ourText, $maxlen = 60, $prefix = "> ") { $st = wordwrap($ourText, $maxlen - strlen($prefix), "\n"); $st = $prefix . str_replace("\n", "\n{$prefix}", $st); return $st; } echo "<pre>"; echo cite("The first Matrix I designed was quite naturally \r\nperfect, it was a work of art - flawless, sublime. A triumph \r\nequalled only by its monumental failure. The inevitability \r\nof its doom is apparent to me now as a consequence of the \r\nimperfection inherent in every human being. Thus, I \r\nredesigned it based on your history to more accurately reflect \r\nthe varying grotesqueries of your nature. However, I was again \r\nfrustrated by failure.", 20); echo "</pre>";
function show_parent($person, $gender) { // print names and lifespans of parents. // valid $gender values are 1=father, 2=mother global $language, $_Add, $_Insert, $_edit, $_delete, $_Father, $_father, $_Mother, $_mother, $_toolhelp_edit_parent, $_toolhelp_add_parent, $_toolhelp_insert_parent, $_toolhelp_delete_parent; $parent_id = fetch_val("SELECT get_parent({$person}, {$gender})"); $surety = fetch_val("\n SELECT get_lsurety((\n SELECT surety_fk\n FROM relations\n WHERE parent_fk = {$parent_id}\n AND child_fk = {$person}\n ), '{$language}')\n "); if ($gender == 1) { $Parent = $_Father; $parent = $_father; $para = '<p>'; $newline = '<br />'; } else { // $gender == 2 $Parent = $_Mother; $parent = $_mother; $para = ''; $newline = '</p>'; } echo $para . conc(bold($Parent) . ':') . conc(get_name_and_dates('', $parent_id)); if ($parent_id) { echo conc(curly_brace($surety)) . conc(span_type(paren(to_url('./forms/relation_edit.php', array('person' => $person, 'parent' => $parent_id), $_edit, sprintf($_toolhelp_edit_parent, $parent)) . ' / ' . to_url('./forms/relation_delete.php', array('person' => $person, 'parent' => $parent_id), $_delete, sprintf($_toolhelp_delete_parent, $parent))), "hotlink")) . cite(get_relation_id($person, $gender), 'relation', $person); } else { echo conc(span_type(paren(to_url('./forms/person_insert.php', array('person' => $person, 'addparent' => 'true', 'gender' => $gender), "{$_Add} {$parent}", sprintf($_toolhelp_add_parent, $parent)) . ' / ' . to_url('./forms/relation_edit.php', array('person' => $person, 'gender' => $gender), "{$_Insert} {$parent}", sprintf($_toolhelp_insert_parent, $parent))), "hotlink")); } echo "{$newline}\n"; }