function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); if (!$args['pagename']) { return $this->error(_("No pagename specified")); } // Get our form args. $comment = $request->getArg("comment"); $request->setArg('comment', false); if ($request->isPost() and !empty($comment['addcomment'])) { $this->add($request, $comment, 'comment'); // noreturn } if ($args['jshide'] and isBrowserIE() and browserDetect("Mac")) { //trigger_error(_("jshide set to 0 on Mac IE"), E_USER_NOTICE); $args['jshide'] = 0; } // Now we display previous comments and/or provide entry box // for new comments $html = HTML(); if ($args['jshide']) { $div = HTML::div(array('id' => 'comments', 'style' => 'display:none;')); //$list->setAttr('style','display:none;'); $div->pushContent(Javascript("\nfunction togglecomments(a) {\n comments=document.getElementById('comments');\n if (comments.style.display=='none') {\n comments.style.display='block';\n a.title='" . _("Click to hide the comments") . "';\n } else {\n comments.style.display='none';\n a.title='" . _("Click to display all comments") . "';\n }\n}")); $html->pushContent(HTML::h4(HTML::a(array('name' => 'comment-header', 'class' => 'wikiaction', 'title' => _("Click to display"), 'onclick' => "togglecomments(this)"), _("Comments")))); } else { $div = HTML::div(array('id' => 'comments')); } foreach (explode(',', $args['mode']) as $show) { if (!empty($seen[$show])) { continue; } $seen[$show] = 1; switch ($show) { case 'show': $show = $this->showAll($request, $args, 'comment'); //if ($args['jshide']) $show->setAttr('style','display:none;'); $div->pushContent($show); break; case 'add': global $WikiTheme; if (!$WikiTheme->DUMP_MODE) { $add = $this->showForm($request, $args, 'addcomment'); //if ($args['jshide']) $add->setAttr('style','display:none;'); $div->pushContent($add); } break; default: return $this->error(sprintf("Bad mode ('%s')", $show)); } } $html->pushContent($div); return $html; }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; $args = $this->getArgs($argstr, $request); extract($args); if (!$url && !$file) { return $this->error(_("Both 'url' or 'file' parameters missing.")); } elseif ($url && $file) { return $this->error(_("Choose only one of 'url' or 'file' parameters.")); } elseif ($file) { // $url = SERVER_URL . getUploadDataPath() . '/' . $file; $url = getUploadDataPath() . '/' . $file; } if (string_ends_with($url, ".ogg")) { return HTML::video(array('autoplay' => 'true', 'controls' => 'true', 'src' => $url), _("Your browser does not understand the HTML 5 video tag.")); } $html = HTML(); if (isBrowserIE()) { $object = HTML::object(array('id' => 'flowplayer', 'classid' => 'clsid:D27CDB6E-AE6D-11cf-96B8-444553540000', 'width' => $width, 'height' => $height)); $param = HTML::param(array('name' => 'movie', 'value' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf'))); $object->pushContent($param); $param = HTML::param(array('name' => "allowfullscreen", 'value' => "true")); $object->pushContent($param); $param = HTML::param(array('name' => "allowscriptaccess", 'value' => "false")); $object->pushContent($param); $flashvars = "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}"; $param = HTML::param(array('name' => 'flashvars', 'value' => $flashvars)); $object->pushContent($param); $embed = HTML::embed(array('type' => 'application/x-shockwave-flash', 'width' => $width, 'height' => $height, 'src' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf'), 'flashvars' => $flashvars)); $object->pushContent($embed); $html->pushContent($object); } else { $object = HTML::object(array('data' => SERVER_URL . $WikiTheme->_findData('flowplayer-3.2.4.swf'), 'type' => "application/x-shockwave-flash", 'width' => $width, 'height' => $height)); $param = HTML::param(array('name' => "allowfullscreen", 'value' => "true")); $object->pushContent($param); $param = HTML::param(array('name' => "allowscriptaccess", 'value' => "false")); $object->pushContent($param); $value = "config={'clip':{'url':'" . $url . "','autoPlay':" . $autoplay . "}}"; $param = HTML::param(array('name' => "flashvars", 'value' => $value)); $object->pushContent($param); $html->pushContent($object); } return $html; }
function load() { // CSS file defines fonts, colors and background images for this // style. // override sidebar definitions: $this->setDefaultCSS(_("blog"), 'Kubrick.css'); if (isBrowserIE()) { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IEFixes.css'), 'all')); } $this->addButtonAlias(_("(diff)"), "[diff]"); $this->addButtonAlias("...", "alltime"); $this->setButtonSeparator(""); /** * WikiWords can automatically be split by inserting spaces between * the words. The default is to leave WordsSmashedTogetherLikeSo. */ $this->setAutosplitWikiWords(false); /** * If true (default) show create '?' buttons on not existing pages, even if the * user is not signed in. * If false, anon users get no links and it looks cleaner, but then they * cannot easily fix missing pages. */ $this->setAnonEditUnknownLinks(false); /* * You may adjust the formats used for formatting dates and times * below. (These examples give the default formats.) * Formats are given as format strings to PHP strftime() function See * http://www.php.net/manual/en/function.strftime.php for details. * Do not include the server's zone (%Z), times are converted to the * user's time zone. */ //$this->setDateFormat("%B %d, %Y"); $this->setDateFormat("%A, %B %e, %Y"); // must not contain time $this->setTimeFormat("%H:%M:%S"); }
return $this->makeButton($label, WikiURL($pagename, $attr), $class); } } $WikiTheme = new Theme_smaller('smaller'); // CSS file defines fonts, colors and background images for this // style. The companion '*-heavy.css' file isn't defined, it's just // expected to be in the same directory that the base style is in. // This should result in phpwiki-printer.css being used when // printing or print-previewing with style "PhpWiki" or "MacOSX" selected. $WikiTheme->setDefaultCSS('PhpWiki', array('' => 'phpwiki.css', 'print' => 'phpwiki-printer.css')); // This allows one to manually select "Printer" style (when browsing page) // to see what the printer style looks like. $WikiTheme->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen'); $WikiTheme->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css'); $WikiTheme->addAlternateCSS(_("Modern"), 'phpwiki-modern.css'); if (isBrowserIE()) { $WikiTheme->addMoreHeaders($WikiTheme->_CSSlink(0, $WikiTheme->_findFile('IEFixes.css'), 'all')); $WikiTheme->addMoreHeaders("\n"); } /** * The logo image appears on every page and links to the HomePage. */ $WikiTheme->addImageAlias('logo', WIKI_NAME . 'Logo.png'); /** * The Signature image is shown after saving an edited page. If this * is set to false then the "Thank you for editing..." screen will * be omitted. */ $WikiTheme->addImageAlias('signature', WIKI_NAME . "Signature.png"); // Uncomment this next line to disable the signature. $WikiTheme->addImageAlias('signature', false);
function load() { $this->addMoreHeaders(JavaScript("var ta;\nvar skin = '" . $this->_name . "';\n")); $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("wikibits.js")))); if (isBrowserIE()) { $ver = browserVersion(); if ($ver > 5.1 and $ver < 5.9) { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE55Fixes.css'), 'all')); } elseif ($ver > 5.5 and $ver < 7.0) { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE60Fixes.css'), 'all')); } elseif ($ver >= 7.0) { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE70Fixes.css'), 'all')); } else { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IE50Fixes.css'), 'all')); } unset($ver); $this->addMoreHeaders("\n"); $this->addMoreHeaders(JavaScript('', array('src' => $this->_findData("IEFixes.js")))); $this->addMoreHeaders("\n"); $this->addMoreHeaders(HTML::Raw('<meta http-equiv="imagetoolbar" content="no" />')); } $this->addMoreAttr('body', "class-ns-0", HTML::Raw('class="ns-0"')); // CSS file defines fonts, colors and background images for this // style. The companion '*-heavy.css' file isn't defined, it's just // expected to be in the same directory that the base style is in. // This should result in phpwiki-printer.css being used when // printing or print-previewing with style "PhpWiki" or "MacOSX" selected. $this->setDefaultCSS('PhpWiki', array('' => 'monobook.css', 'print' => 'commonPrint.css')); // This allows one to manually select "Printer" style (when browsing page) // to see what the printer style looks like. $this->addAlternateCSS(_("Printer"), 'commonPrint.css', 'print, screen'); $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css'); $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css'); /** * The logo image appears on every page and links to the HomePage. */ $this->addImageAlias('logo', 'MonoBook-Logo.png'); //$this->addImageAlias('logo', WIKI_NAME . 'Logo.png'); /** * The Signature image is shown after saving an edited page. If this * is set to false then the "Thank you for editing..." screen will * be omitted. */ $this->addImageAlias('signature', "Signature.png"); // Uncomment this next line to disable the signature. $this->addImageAlias('signature', false); /* * Link icons. */ /* $this->setLinkIcon('http'); $this->setLinkIcon('https'); $this->setLinkIcon('ftp'); $this->setLinkIcon('mailto'); //$this->setLinkIcon('interwiki'); */ $this->setLinkIcon('wikiuser'); //$this->setLinkIcon('*', 'url'); // front or after //$this->setLinkIconAttr('after'); //$this->setButtonSeparator("\n | "); /** * WikiWords can automatically be split by inserting spaces between * the words. The default is to leave WordsSmashedTogetherLikeSo. */ //$this->setAutosplitWikiWords(false); /** * Layout improvement with dangling links for mostly closed wiki's: * If false, only users with edit permissions will be presented the * special wikiunknown class with "?" and Tooltip. * If true (default), any user will see the ?, but will be presented * the PrintLoginForm on a click. */ $this->setAnonEditUnknownLinks(false); /* * You may adjust the formats used for formatting dates and times * below. (These examples give the default formats.) * Formats are given as format strings to PHP strftime() function See * http://www.php.net/manual/en/function.strftime.php for details. * Do not include the server's zone (%Z), times are converted to the * user's time zone. */ $this->setDateFormat("%B %d, %Y"); $this->setTimeFormat("%H:%M"); /* * To suppress times in the "Last edited on" messages, give a * give a second argument of false: */ //$this->setDateFormat("%B %d, %Y", false); }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; extract($this->getArgs($argstr, $request)); if ($pagename) { // Expand relative page names. $page = new WikiPageName($pagename, $basepage); $pagename = $page->name; } if (!$pagename) { return $this->error(_("no page specified")); } if ($jshide and isBrowserIE() and browserDetect("Mac")) { //trigger_error(_("jshide set to 0 on Mac IE"), E_USER_NOTICE); $jshide = 0; } $page = $dbi->getPage($pagename); $current = $page->getCurrentRevision(); //FIXME: I suspect this only to crash with Apache2 if (!$current->get('markup') or $current->get('markup') < 2) { if (in_array(php_sapi_name(), array('apache2handler', 'apache2filter'))) { trigger_error(_("CreateToc disabled for old markup"), E_USER_WARNING); return ''; } } $content = $current->getContent(); $html = HTML::div(array('class' => 'toc', 'id' => 'toc')); /*if ($liststyle == 'dl') $list = HTML::dl(array('id'=>'toclist','class' => 'toc')); elseif ($liststyle == 'ul') $list = HTML::ul(array('id'=>'toclist','class' => 'toc')); elseif ($liststyle == 'ol') $list = HTML::ol(array('id'=>'toclist','class' => 'toc')); */ $list = HTML::ul(array('id' => 'toclist', 'class' => 'toc')); if (!strstr($headers, ",")) { $headers = array($headers); } else { $headers = explode(",", $headers); } $levels = array(); foreach ($headers as $h) { //replace !!! with level 1, ... if (strstr($h, "!")) { $hcount = substr_count($h, '!'); $level = min(max(1, $hcount), 3); $levels[] = $level; } else { $level = min(max(1, (int) $h), 3); $levels[] = $level; } } if (TOC_FULL_SYNTAX) { require_once "lib/InlineParser.php"; } if ($headers = $this->extractHeaders($content, $dbi->_markup, $with_toclink, $with_counter, $levels, $basepage)) { $container = $list; $levelRefs = array(); $previousLevel = 3; foreach ($headers as $k => $h) { if ($h['level'] < $previousLevel) { // h2 -> h3 (level 3 -> level 2) // Keep track of previous points $levelRefs[$previousLevel] = $container; // Create new container $ul = HTML::ul(); $container->pushContent($ul); $container = $ul; } elseif ($h['level'] > $previousLevel) { // h4 -> h3 (level 1 -> level 2) if (isset($levelRefs[$h['level']])) { $container = $levelRefs[$h['level']]; } } $h = $headers[$k]; $link = new WikiPageName($pagename, $page, $h['anchor']); $li = WikiLink($link, 'known', $h['text']); $container->pushContent(HTML::li($li)); $previousLevel = $h['level']; } } $list->setAttr('style', 'display:' . ($jshide ? 'none;' : 'block;')); $open = DATA_PATH . '/' . $WikiTheme->_findFile("images/folderArrowOpen.png"); $close = DATA_PATH . '/' . $WikiTheme->_findFile("images/folderArrowClosed.png"); $html->pushContent(Javascript("\nfunction toggletoc(a) {\n var toc=document.getElementById('toclist')\n //toctoggle=document.getElementById('toctoggle')\n var open='" . $open . "'\n var close='" . $close . "'\n if (toc.style.display=='none') {\n toc.style.display='block'\n a.title='" . _("Click to hide the TOC") . "'\n a.src = open\n } else {\n toc.style.display='none';\n a.title='" . _("Click to display") . "'\n a.src = close\n }\n}")); if ($extracollapse) { $toclink = HTML(_("Table Of Contents"), " ", HTML::a(array('name' => 'TOC')), HTML::img(array('id' => 'toctoggle', 'class' => 'wikiaction', 'title' => _("Click to display to TOC"), 'onClick' => "toggletoc(this)", 'height' => 15, 'width' => 15, 'border' => 0, 'src' => $jshide ? $close : $open))); } else { $toclink = HTML::a(array('name' => 'TOC', 'class' => 'wikiaction', 'title' => _("Click to display"), 'onclick' => "toggletoc(this)"), _("Table Of Contents"), HTML::span(array('style' => 'display:none', 'id' => 'toctoggle'), " ")); } $html->pushContent(HTML::h4($toclink)); $html->pushContent($list); return $html; }
function isBrowserIE55() { return isBrowserIE() and browserVersion() > 5.1 and browserVersion() < 6.0; }
/** * The ->load() method replaces the formerly global code in themeinfo.php. * This is run only once for the selected theme, and not for the parent themes. * Without this you would not be able to derive from other themes. */ function load() { $this->initGlobals(); // CSS file defines fonts, colors and background images for this // style. The companion '*-heavy.css' file isn't defined, it's just // expected to be in the same directory that the base style is in. // This should result in phpwiki-printer.css being used when // printing or print-previewing with style "PhpWiki" or "MacOSX" selected. $this->setDefaultCSS('PhpWiki', array('' => 'phpwiki.css', 'print' => 'phpwiki-printer.css')); // This allows one to manually select "Printer" style (when browsing page) // to see what the printer style looks like. $this->addAlternateCSS(_("Printer"), 'phpwiki-printer.css', 'print, screen'); $this->addAlternateCSS(_("Top & bottom toolbars"), 'phpwiki-topbottombars.css'); $this->addAlternateCSS(_("Modern"), 'phpwiki-modern.css'); if (isBrowserIE()) { $this->addMoreHeaders($this->_CSSlink(0, $this->_findFile('IEFixes.css'), 'all')); $this->addMoreHeaders("\n"); } /** * The logo image appears on every page and links to the HomePage. */ $this->addImageAlias('logo', WIKI_NAME . 'Logo.png'); $this->addImageAlias('search', 'search.png'); /** * The Signature image is shown after saving an edited page. If this * is set to false then the "Thank you for editing..." screen will * be omitted. */ $this->addImageAlias('signature', WIKI_NAME . "Signature.png"); // Uncomment this next line to disable the signature. //$this->addImageAlias('signature', false); /* * Link icons. */ $this->setLinkIcon('http'); $this->setLinkIcon('https'); $this->setLinkIcon('ftp'); $this->setLinkIcon('mailto'); $this->setLinkIcon('interwiki'); $this->setLinkIcon('wikiuser'); $this->setLinkIcon('*', 'url'); $this->setButtonSeparator("\n | "); /** * WikiWords can automatically be split by inserting spaces between * the words. The default is to leave WordsSmashedTogetherLikeSo. */ $this->setAutosplitWikiWords(false); /** * Layout improvement with dangling links for mostly closed wiki's: * If false, only users with edit permissions will be presented the * special wikiunknown class with "?" and Tooltip. * If true (default), any user will see the ?, but will be presented * the PrintLoginForm on a click. */ //$this->setAnonEditUnknownLinks(false); /* * You may adjust the formats used for formatting dates and times * below. (These examples give the default formats.) * Formats are given as format strings to PHP strftime() function See * http://www.php.net/manual/en/function.strftime.php for details. * Do not include the server's zone (%Z), times are converted to the * user's time zone. * * Suggestion for french: * $this->setDateFormat("%A %e %B %Y"); * $this->setTimeFormat("%H:%M:%S"); * Suggestion for capable php versions, using the server locale: * $this->setDateFormat("%x"); * $this->setTimeFormat("%X"); */ //$this->setDateFormat("%B %d, %Y"); //$this->setTimeFormat("%I:%M %p"); /* * To suppress times in the "Last edited on" messages, give a * give a second argument of false: */ //$this->setDateFormat("%B %d, %Y", false); /** * Custom UserPreferences: * A list of name => _UserPreference class pairs. * Rationale: Certain themes should be able to extend the predefined list * of preferences. Display/editing is done in the theme specific userprefs.tmpl * but storage/sanification/update/... must be extended to the Get/SetPreferences methods. * See themes/wikilens/themeinfo.php */ //$this->customUserPreference(); /** * Register custom PageList type and define custom PageList classes. * Rationale: Certain themes should be able to extend the predefined list * of pagelist types. E.g. certain plugins, like MostPopular might use * info=pagename,hits,rating * which displays the rating column whenever the wikilens theme is active. * See themes/wikilens/themeinfo.php */ //$this->addPageListColumn(); }
function run($dbi, $argstr, &$request, $basepage) { global $WikiTheme; extract($this->getArgs($argstr, $request)); if ($pagename) { // Expand relative page names. $page = new WikiPageName($pagename, $basepage); $pagename = $page->name; } if (!$pagename) { return $this->error(_("no page specified")); } if (isBrowserIE() and browserDetect("Mac")) { $jshide = 0; } if ($notoc or $liststyle == 'ol') { $with_counter = 1; } // Check if user is allowed to get the Page. if (!mayAccessPage('view', $pagename)) { return $this->error(sprintf(_("Illegal access to page %s: no read access"), $pagename)); } $page = $dbi->getPage($pagename); $current = $page->getCurrentRevision(); //FIXME: I suspect this only to crash with Apache2 if (!$current->get('markup') or $current->get('markup') < 2) { if (in_array(php_sapi_name(), array('apache2handler', 'apache2filter'))) { trigger_error(_("CreateToc disabled for old markup"), E_USER_WARNING); return ''; } } $content = $current->getContent(); $html = HTML::div(array('class' => 'toc', 'id' => GenerateId("toc"))); if ($notoc) { $html->setAttr('style', 'display:none;'); } if ($position == "left" or $position == "right") { $html->setAttr('style', 'float:' . $position . '; width:' . $width . ';'); } $toclistid = GenerateId("toclist"); $list = HTML::div(array('id' => $toclistid, 'class' => 'toclist')); if (!strstr($headers, ",")) { $headers = array($headers); } else { $headers = explode(",", $headers); } $levels = array(); foreach ($headers as $h) { //replace !!! with level 1, ... if (strstr($h, "!")) { $hcount = substr_count($h, '!'); $level = min(max(1, $hcount), 3); $levels[] = $level; } else { $level = min(max(1, (int) $h), 5); $levels[] = $level; } } if (TOC_FULL_SYNTAX) { require_once "lib/InlineParser.php"; } if ($headers = $this->extractHeaders($content, $dbi->_markup, $with_toclink, $with_counter, $levels, $firstlevelstyle, $basepage)) { foreach ($headers as $h) { // proper heading indent $level = $h['level']; $indent = $level - 1; $link = new WikiPageName($pagename, $page, $h['anchor']); $li = WikiLink($link, 'known', $h['text']); // Hack to suppress pagename before # // $li->_attr["href"] = strstr($li->_attr["href"], '#'); $list->pushContent(HTML::p(HTML::raw(str_repeat($indentstr, $indent)), $li)); } } $list->setAttr('style', 'display:' . ($jshide ? 'none;' : 'block;')); $open = DATA_PATH . '/' . $WikiTheme->_findFile("images/folderArrowOpen.png"); $close = DATA_PATH . '/' . $WikiTheme->_findFile("images/folderArrowClosed.png"); if ($noheader) { } else { $toctoggleid = GenerateId("toctoggle"); if ($extracollapse) { $toclink = HTML(_("Table of Contents"), " ", HTML::a(array('id' => 'TOC')), HTML::img(array('id' => $toctoggleid, 'class' => 'wikiaction', 'title' => _("Click to display to TOC"), 'onclick' => "toggletoc(this, '" . $open . "', '" . $close . "', '" . $toclistid . "')", 'alt' => 'toctoggle', 'src' => $jshide ? $close : $open))); } else { $toclink = HTML::a(array('id' => 'TOC', 'class' => 'wikiaction', 'title' => _("Click to display"), 'onclick' => "toggletoc(this, '" . $open . "', '" . $close . "', '" . $toclistid . "')"), _("Table of Contents"), HTML::span(array('style' => 'display:none', 'id' => $toctoggleid), " ")); } $html->pushContent(HTML::p(array('class' => 'toctitle'), $toclink)); } $html->pushContent($list); if (count($headers) == 0) { // Do not display an empty TOC $html->setAttr('style', 'display:none;'); } return $html; }