*/ function footnoteOpen(ODTInternalParams $params, $element=NULL, $attributes=NULL) { // $element and $attributes are actually unused // Move current content to store and record footnote $params->document->store = $params->content; $params->content = ''; $note = new ODTElementNote(); $params->document->state->enter($note); $note->setHTMLElement ($element); } /** * Close/end a footnote. * * All content is moved to the $footnotes array and the old * content is restored from $store again. * * @author Andreas Gohr */ function footnoteClose(ODTInternalParams $params) { // Close any open paragraph first $params->document->paragraphClose(); ODTUtility::closeHTMLElement ($params, $params->document->state->getHTMLElement()); $params->document->closeCurrentElement(); // Recover footnote into the stack and restore old content $footnote = $params->content; $params->content = $params->document->store; $params->document->store = ''; // Check to see if this footnote has been seen before $i = array_search($footnote, $params->document->footnotes); $label = ($i+1).')'; if ($i === false) { $i = count($params->document->footnotes); $label = ($i+1).')'; // Its a new footnote, add it to the $footnotes array $params->document->footnotes[$i] = $footnote; $params->content .= ''; $params->content .= ''.$label.''; $params->content .= ''; $params->content .= $footnote; $params->content .= ''; $params->content .= ''; } else { // Seen this one before - just reference it $params->document->spanOpen($params->document->getStyleName('footnote anchor')); $params->content .= ''.$label.''; $params->document->spanClose(); } // Only for debugging... //$params->document->trace_dump .= $params->document->state->toString(); } }