*/ if (isset($args['relational_id'])) { $laws->law_id = filter_var($args['relational_id'], FILTER_SANITIZE_STRING); /* * Retrieve a copy of the law. */ $law = $laws->get_law(); } if (!isset($law) || $law === FALSE) { send_404(); } /* * Get our permalink data */ $permalink_obj = new Permalink(array('db' => $db)); $law->permalink = $permalink_obj->get_permalink($law->law_id, 'law', $law->edition_id); /* * Store a record that this section was viewed. */ $laws->record_view(); /* * If this is a request for a plain text version of this law, simply display that and exit. */ if (isset($_GET['plain_text'])) { /* * Instruct the browser that this is plain text. */ header("Content-Type: text/plain"); /* * Send the text, which is already formatted properly. */
* yields the proper index for the row class. */ $class_index = $counter % count($row_classes); $row_class = $row_classes[$class_index]; $body .= ' <dt class="' . $row_class . '"><a href="' . $law->url . '">' . SECTION_SYMBOL . ' ' . $law->section_number . '</a></dt> <dd class="' . $row_class . '"><a href="' . $law->url . '">' . $law->catch_line . '</a></dd>'; $counter++; } $body .= '</dl>'; } /* * If this isn't the canonical page, show a canonical meta tag. */ $permalink_obj = new Permalink(array('db' => $db)); $permalink = $permalink_obj->get_permalink($struct->structure_id, 'structure', $struct->edition_id); if ($args['url'] !== $permalink->url) { $content->append('meta_tags', '<link rel="canonical" href="' . $permalink->url . '" />'); } /* * Put the shorthand $body variable into its proper place. */ $content->set('body', $body); unset($body); /* * Show edition info. */ $edition_data = $edition->find_by_id($struct->edition_id); $edition_list = $edition->all(); if ($edition_data && count($edition_list) > 1) { $content->set('edition', '<p class="edition">This is the <strong>' . $edition_data->name . '</strong> edition of the code. ');