docbook.php
来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PHP 代码 · 共 1,110 行 · 第 1/2 页
PHP
1,110 行
// {{{ function end_function($cdata) /** * @param string * @return string * @access public */ function end_function($cdata) { return array( trim($cdata) . '</b></code>', FALSE ); } // }}} // {{{ function start_graphic($attributes) /** * @param array * @return string * @access public */ function start_graphic($attributes) { return sprintf( '<img alt="%s" border="0" src="%s"%s%s/>', isset($attributes['srccredit']) ? $attributes['srccredit'] : '', isset($attributes['fileref']) ? $attributes['fileref'] : '', isset($attributes['width']) ? ' width="' . $attributes['width'] . '"' : '', isset($attributes['height']) ? ' height="' . $attributes['height'] . '"' : '' ); } // }}} // {{{ function end_graphic($cdata) /** * @param string * @return string * @access public */ function end_graphic($cdata) { return $cdata; } // }}} // {{{ function start_itemizedlist($attributes) /** * @param array * @return string * @access public */ function start_itemizedlist($attributes) { return '<ul>'; } // }}} // {{{ function end_itemizedlist($cdata) /** * @param string * @return string * @access public */ function end_itemizedlist($cdata) { return $cdata . '</ul>'; } // }}} // {{{ function start_listitem($attributes) /** * @param array * @return string * @access public */ function start_listitem($attributes) { return '<li>'; } // }}} // {{{ function end_listitem($cdata) /** * @param string * @return string * @access public */ function end_listitem($cdata) { return $cdata . '</li>'; } // }}} // {{{ function start_orderedlist($attributes) /** * @param array * @return string * @access public */ function start_orderedlist($attributes) { return '<ol>'; } // }}} // {{{ function end_orderedlist($cdata) /** * @param string * @return string * @access public */ function end_orderedlist($cdata) { return $cdata . '</ol>'; } // }}} // {{{ function start_para($attributes) /** * @param array * @return string * @access public */ function start_para($attributes) { return '<p>'; } // }}} // {{{ function end_para($cdata) /** * @param string * @return string * @access public */ function end_para($cdata) { return $cdata . '</p>'; } // }}} // {{{ function start_programlisting($attributes) /** * @param array * @return string * @access public */ function start_programlisting($attributes) { $this->_roles['programlisting'] = isset($attributes['role']) ? $attributes['role'] : ''; switch ($this->_roles['programlisting']) { case 'php': { return ''; } break; default: { return '<code>'; } } } // }}} // {{{ function end_programlisting($cdata) /** * @param string * @return mixed * @access public */ function end_programlisting($cdata) { switch ($this->_roles['programlisting']) { case 'php': { $cdata = array( str_replace( ' ', ' ', highlight_string($cdata, 1) ), FALSE ); } break; default: { $cdata = array( $cdata . '</code>', FALSE ); } } $this->_roles['programlisting'] = ''; return $cdata; } // }}} // {{{ function start_section($attributes) /** * @param array * @return string * @access public */ function start_section($attributes) { $id = $this->_startSection( 'section', isset($attributes['id']) ? $attributes['id'] : '' ); return '<div class="section">' . $id; } // }}} // {{{ function end_section($cdata) /** * @param string * @return string * @access public */ function end_section($cdata) { $this->_endSection('section'); return $cdata . '</div>'; } // }}} // {{{ function start_surname($attributes) /** * @param array * @return string * @access public */ function start_surname($attributes) {} // }}} // {{{ function end_surname($cdata) /** * @param string * @return string * @access public */ function end_surname($cdata) { return trim($cdata); } // }}} // {{{ function start_title($attributes) /** * @param array * @return string * @access public */ function start_title($attributes) { switch ($this->_context[sizeof($this->_context)-1]) { case 'chapter': case 'section': { return '<h2 class="title">' . $this->_currentSectionNumber . '. '; } break; case 'example': { return '<h3 class="title">Example ' . $this->_currentExampleNumber; } break; case 'figure': { return '<h3 class="title">Figure ' . $this->_currentFigureNumber; } break; } } // }}} // {{{ function end_title($cdata) /** * @param string * @return string * @access public */ function end_title($cdata) { $cdata = trim($cdata); if (!empty($this->_ids[sizeof($this->_ids)-1])) { $this->_xref[$this->_ids[sizeof($this->_ids)-1]] = strip_tags($cdata); } switch ($this->_context[sizeof($this->_context)-1]) { case 'article': case 'book': { $this->_title = $cdata; } break; case 'chapter': case 'section': { return $cdata . '</h2>'; } break; case 'example': case 'figure': { return $cdata . '</h3>'; } break; default: { return $cdata; } } } // }}} // {{{ function start_ulink($attributes) /** * @param array * @return string * @access public */ function start_ulink($attributes) { return '<a href="' . $attributes['url'] . '">'; } // }}} // {{{ function end_ulink($cdata) /** * @param string * @return string * @access public */ function end_ulink($cdata) { return $cdata . '</a>'; } // }}} // {{{ function start_xref($attributes) /** * @param array * @return string * @access public */ function start_xref($attributes) { if ($this->_secondPass) { return sprintf( '<a href="#%s">%s</a>', isset($attributes['linkend']) ? $attributes['linkend'] : '', isset($this->_xref[$attributes['linkend']]) ? $this->_xref[$attributes['linkend']] : '' ); } else { return sprintf( '<xref%s>', XML_Util::attributesToString($attributes) ); } } // }}} // {{{ function end_xref($cdata) /** * @param string * @return string * @access public */ function end_xref($cdata) { if (!$this->_secondPass) { $cdata = $cdata . '</xref>'; } return array( $cdata, FALSE ); } // }}} // {{{ function _startDocument($type, $attributes) /** * @param string * @param array * @return string * @access private */ function _startDocument($type, $attributes) { if (!$this->_secondPass) { $id = $this->_startSection( $type, isset($attributes['id']) ? $attributes['id'] : '' ); return sprintf( '<%s>%s', $type, $id ); } else { return sprintf( '<html><head><title>%s: %s</title><body><h1 class="title">%s: %s</h1>', $this->_author, $this->_title, $this->_author, $this->_title ); } } // }}} // {{{ function _endDocument($type, $cdata) /** * @param string * @param string * @return string * @access private */ function _endDocument($type, $cdata) { if (!$this->_secondPass) { $this->_endSection($type); $this->_secondPass = TRUE; $cdata = sprintf( '%s</%s>', $cdata, $type ); } else { $cdata = $cdata . '</body></html>'; } return array( $cdata, FALSE ); } // }}} // {{{ function _startSection($type, $id) /** * @param string * @return string * @access private */ function _startSection($type, $id) { array_push($this->_context, $type); array_push($this->_ids, $id); switch ($type) { case 'article': case 'book': case 'chapter': case 'section': { $this->_currentSectionNumber = ''; if (!isset($this->_sections[$type]['open'])) { $this->_sections[$type]['open'] = 1; } else { $this->_sections[$type]['open']++; } if (!isset($this->_sections[$type]['id'][$this->_sections[$type]['open']])) { $this->_sections[$type]['id'][$this->_sections[$type]['open']] = 1; } else { $this->_sections[$type]['id'][$this->_sections[$type]['open']]++; } for ($i = 1; $i <= $this->_sections[$type]['open']; $i++) { if (!empty($this->_currentSectionNumber)) { $this->_currentSectionNumber .= '.'; } $this->_currentSectionNumber .= $this->_sections[$type]['id'][$i]; } } break; case 'example': { if (!isset($this->_examples[$this->_currentSectionNumber])) { $this->_examples[$this->_currentSectionNumber] = 1; } else { $this->_examples[$this->_currentSectionNumber]++; } $this->_currentExampleNumber = $this->_currentSectionNumber . '.' . $this->_examples[$this->_currentSectionNumber]; } break; case 'figure': { if (!isset($this->_figures[$this->_currentFigureNumber])) { $this->_figures[$this->_currentSectionNumber] = 1; } else { $this->_figures[$this->_currentSectionNumber]++; } $this->_currentFigureNumber = $this->_currentSectionNumber . '.' . $this->_figures[$this->_currentSectionNumber]; } break; } if (!empty($id)) { $id = '<a id="' . $id . '" />'; } return $id; } // }}} // {{{ function _endSection($type) /** * @param string * @access private */ function _endSection($type) { array_pop($this->_context); switch ($type) { case 'article': case 'book': case 'chapter': case 'section': { $this->_sections[$type]['open']--; } break; } } // }}}}/* * vim600: et sw=2 ts=2 fdm=marker * vim<600: et sw=2 ts=2 */?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?