本文整理汇总了PHP中Formatter::get_javascripts方法的典型用法代码示例。如果您正苦于以下问题:PHP Formatter::get_javascripts方法的具体用法?PHP Formatter::get_javascripts怎么用?PHP Formatter::get_javascripts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formatter
的用法示例。
在下文中一共展示了Formatter::get_javascripts方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processor_folding
function processor_folding($formatter, $value = "", $options = array())
{
// unique id of the folding area
$id = isset($GLOBALS['_folding_id_']) ? $GLOBALS['_folding_id_'] : 0;
$id++;
$GLOBALS['_folding_id_'] = $id;
if ($value[0] == '#' and $value[1] == '!') {
list($line, $value) = explode("\n", $value, 2);
}
$init_state = 'none';
$title = _("More");
$class = '';
$opened = '';
// parse args
if (isset($line[0]) and ($p = strpos($line, ' ')) !== false) {
$tag = substr($line, 0, $p);
$args = substr($line, $p + 1);
if (preg_match("/^(?:(open|\\+))?(?(1)[ ]*,[ ]*)?((?:(?:[a-zA-Z][a-z0-9_-]+)[ ]*)*)?(?(2)[ ]*,[ ]*)?/", $args, $matches)) {
$class = isset($matches[2][0]) ? ' ' . $matches[2] : '';
$tmp = substr($args, strlen($matches[0]));
if (isset($tmp[0])) {
$title = $tmp;
}
if ($matches[1] == 'open' or $matches[1] == '+') {
$init_state = 'block';
$opened = ' class="opened"';
}
}
}
// FIXME footnote prefix
$fn_prefix = 'fn' . substr(md5(substr($value, 0, 32)), 0, 3);
// allow wiki syntax in folding content
ob_start();
$params = array('notoc' => 1);
$params['nosisters'] = 1;
$f = new Formatter($formatter->page, $params);
$f->foot_prefix = $fn_prefix;
$f->get_javascripts();
// trash default javascripts
$f->pi['#linenum'] = 0;
// do not use linenum
$f->send_page($value, $params);
$out = ob_get_contents();
ob_end_clean();
$onclick = " onclick=\"var f=document.getElementById('folding_{$id}');var s=f.style.display=='block';" . "f.style.display=s?'none':'block';this.className=s?'':'opened';\"";
return <<<HERE
<div class="folding-area{$class}">
<dl class="folding">
<dt{$onclick}{$opened}>{$title}</dt>
<dd id="folding_{$id}" style="display:{$init_state};">{$out}</dd>
</dl>
</div>
HERE;
}
示例2: macro_Include
//.........这里部分代码省略.........
// check some built-in vars
// set style or class
if (in_array($key, array('style', 'class', 'debug'))) {
if (empty($val)) {
continue;
}
if ($key == 'style') {
$styles[] = $val;
} else {
if ($key == 'class') {
$class .= ' ' . $val;
} else {
$debug = true;
}
}
continue;
}
if (empty($key) and $i < 3) {
if ($i == 1) {
$title = $val;
} else {
$level = intval($val);
}
$i++;
continue;
}
if (!empty($key)) {
$vars[$key] = $val;
} else {
$vars[$i] = $val;
}
$i++;
} else {
break;
}
}
}
if (!isset($pagename[0])) {
return '';
}
// empty page
// out debug msg;
$msg = '';
if ($debug) {
ob_start();
var_dump($vars);
$msg = ob_get_contents();
ob_end_clean();
}
// set title
if (isset($title[0]) && $title[0] != '=') {
if (empty($level) || $level > 5) {
$level = 3;
}
$tag = str_repeat('=', $level);
$title = $tag . ' ' . $title . ' ' . $tag;
}
if ($DBInfo->hasPage($pagename)) {
// default class for template
if (!empty($vars)) {
$class .= ' template';
}
// add some default variables
if (!isset($vars['pagename'])) {
$vars['pagename'] = $formatter->page->name;
}
$repl = new _localDict($vars);
$page = $DBInfo->getPage($pagename);
$f = new Formatter($page);
// for recursion detect
$f->recursion = isset($formatter->recursion) ? $formatter->recursion + 1 : 1;
$body = $page->_get_raw_body();
// get raw body
// mediawiki like replace variables
// @foo@ or @foo[separator]default value@ are accepted
// the separator can be space , and |
$body = $repl->replace('/@([a-z0-9_-]+)(?:(?:,|\\|)((?!\\s)(?:[^@]|@@)*(?!\\s)))?@/', $body);
if (isset($title[0])) {
$body = $title . "\n" . $body;
}
$params['nosisters'] = 1;
$f->get_javascripts();
// trash default javascripts
ob_start();
$f->pi['#linenum'] = 0;
// FIXME
$f->send_page($body, $params);
$out = ob_get_contents();
ob_end_clean();
if (!empty($class)) {
$class = ' class="' . $class . '"';
}
if (!empty($styles)) {
$style = ' style="' . implode(';', $styles) . '"';
}
return '<div' . $class . $style . '>' . $msg . $out . '</div>';
} else {
return $formatter->link_repl($pagename);
}
}
示例3: render
function render($pagename, $type, $params = array())
{
global $DBInfo;
$p = $DBInfo->getPage($pagename);
$opts = array();
// parameters for mdict
if ($type == 'mdict') {
$opts = array('prefix' => 'entry:/');
}
$formatter = new Formatter($p, $opts);
if (isset($params['filters'])) {
$formatter->filters = $params['filters'];
}
// trash javascripts
$formatter->get_javascripts();
// init wordrule
if (empty($formatter->wordrule)) {
$formatter->set_wordrule();
}
// render
ob_start();
$formatter->send_page();
flush();
$out = ob_get_contents();
ob_end_clean();
// filter for mdict
if ($type == 'mdict') {
return $formatter->postfilter_repl('mdict', $out);
} else {
return $out;
}
}