当前位置: 首页>>代码示例>>PHP>>正文


PHP WikiURL函数代码示例

本文整理汇总了PHP中WikiURL函数的典型用法代码示例。如果您正苦于以下问题:PHP WikiURL函数的具体用法?PHP WikiURL怎么用?PHP WikiURL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了WikiURL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PurgePage

function PurgePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML::p(array('class' => 'error'), _("Sorry, this page does not exist."));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $purgeB = Button('submit:verify', _("Purge Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $fieldset = HTML::fieldset(HTML::p(fmt("You are about to purge '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'purge')), HTML::div(array('class' => 'toolbar'), $purgeB, $WikiTheme->getButtonSeparator(), $cancelB)));
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html = HTML($fieldset, HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::p(array('class' => 'error'), _("Someone has edited the page!")), HTML::p(fmt("Since you started the purge process, someone has saved a new version of %s.  Please check to make sure you still want to permanently purge the page from the database.", $pagelink)));
    } else {
        // Real purge.
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->purgePage($pagename);
        $dbi->touch();
        $html = HTML::div(array('class' => 'feedback'), fmt("Purged page '%s' successfully.", $pagename));
    }
    GeneratePage($html, _("Purge Page"));
}
开发者ID:hugcoday,项目名称:wiki,代码行数:35,代码来源:purgepage.php

示例2: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $request->setArg('action', false);
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($goto = $request->getArg('goto')) {
         // The user has pressed 'Go'; process request
         $request->setArg('goto', false);
         $target = $goto['target'];
         if ($dbi->isWikiPage($target)) {
             $url = WikiURL($target, 0, 1);
         } else {
             $url = WikiURL($target, array('action' => 'edit'), 1);
         }
         $request->redirect($url);
         // User should see nothing after redirect
         return '';
     }
     $action = $request->getURLtoSelf();
     $form = HTML::form(array('action' => $action, 'method' => 'post'));
     $form->pushContent(HiddenInputs($request->getArgs()));
     $textfield = HTML::input(array('type' => 'text', 'size' => $size, 'name' => 'goto[target]'));
     $button = Button('submit:goto[go]', _("Go"), false);
     $form->pushContent($textfield, $button);
     return $form;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:26,代码来源:GoTo.php

示例3: makeActionButton

 function makeActionButton($action, $label = false, $page_or_rev = false, $options = false)
 {
     extract($this->_get_name_and_rev($page_or_rev));
     if (is_array($action)) {
         $attr = $action;
         $action = isset($attr['action']) ? $attr['action'] : 'browse';
     } else {
         $attr['action'] = $action;
     }
     $class = is_safe_action($action) ? 'new' : 'wikiadmin';
     /* if selected action is current then prepend selected */
     global $request;
     if ($request->getArg("action") == $action) {
         $class = "selected {$class}";
     }
     //$class = "selected";
     if (!empty($options['class'])) {
         $class = $options['class'];
     }
     if (!$label) {
         $label = $this->_labelForAction($action);
     }
     if ($version) {
         $attr['version'] = $version;
     }
     if ($action == 'browse') {
         unset($attr['action']);
     }
     $options = $this->fixAccesskey($options);
     return $this->makeButton($label, WikiURL($pagename, $attr), $class, $options);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:31,代码来源:themeinfo.php

示例4: linkUnknownWikiWord

 function linkUnknownWikiWord($wikiword, $linktext = '')
 {
     global $request;
     // Get rid of anchors on unknown wikiwords
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
         $wikiword = $wikiword->name;
     } else {
         $default_text = $wikiword;
     }
     $url = WikiURL($wikiword, array('action' => 'create'));
     //$link = HTML::span(HTML::a(array('href' => $url), '?'));
     $button = $this->makeButton('?', $url);
     $button->addTooltip(sprintf(_("Create: %s"), $wikiword));
     $link = HTML::span($button);
     if (!empty($linktext)) {
         $link->unshiftContent(HTML::u($linktext));
         $link->setAttr('class', 'named-wikiunknown');
     } else {
         $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
         $link->setAttr('class', 'wikiunknown');
     }
     if ($request->getArg('frame')) {
         $link->setAttr('target', '_top');
     }
     return $link;
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:27,代码来源:themeinfo.php

示例5: RemovePage

function RemovePage(&$request)
{
    global $WikiTheme;
    $page = $request->getPage();
    $pagelink = WikiLink($page);
    if ($request->getArg('cancel')) {
        $request->redirect(WikiURL($page));
        // noreturn
    }
    $current = $page->getCurrentRevision();
    if (!$current or !($version = $current->getVersion())) {
        $html = HTML(HTML::h2(_("Already deleted")), HTML::p(_("Sorry, this page is not in the database.")));
    } elseif (!$request->isPost() || !$request->getArg('verify')) {
        $removeB = Button('submit:verify', _("Remove Page"), 'wikiadmin');
        $cancelB = Button('submit:cancel', _("Cancel"), 'button');
        // use generic wiki button look
        $html = HTML(HTML::h2(fmt("You are about to remove '%s'!", $pagelink)), HTML::form(array('method' => 'post', 'action' => $request->getPostURL()), HiddenInputs(array('currentversion' => $version, 'pagename' => $page->getName(), 'action' => 'remove')), HTML::div(array('class' => 'toolbar'), $removeB, $WikiTheme->getButtonSeparator(), $cancelB)), HTML::hr());
        $sample = HTML::div(array('class' => 'transclusion'));
        // simple and fast preview expanding only newlines
        foreach (explode("\n", firstNWordsOfContent(100, $current->getPackedContent())) as $s) {
            $sample->pushContent($s, HTML::br());
        }
        $html->pushContent(HTML::div(array('class' => 'wikitext'), $sample));
    } elseif ($request->getArg('currentversion') != $version) {
        $html = HTML(HTML::h2(_("Someone has edited the page!")), HTML::p(fmt("Since you started the deletion process, someone has saved a new version of %s.  Please check to make sure you still want to permanently remove the page from the database.", $pagelink)));
    } else {
        // Codendi specific: remove the deleted wiki page from ProjectWantedPages
        $projectPageName = 'ProjectWantedPages';
        $pagename = $page->getName();
        $dbi = $request->getDbh();
        require_once PHPWIKI_DIR . "/lib/loadsave.php";
        $pagehandle = $dbi->getPage($projectPageName);
        if ($pagehandle->exists()) {
            // don't replace default contents
            $current = $pagehandle->getCurrentRevision();
            $version = $current->getVersion();
            $text = $current->getPackedContent();
            $meta = $current->_data;
        }
        $text = str_replace("* [{$pagename}]", "", $text);
        $meta['summary'] = $GLOBALS['Language']->getText('wiki_lib_wikipagewrap', 'page_added', array($pagename));
        $meta['author'] = user_getname();
        $pagehandle->save($text, $version + 1, $meta);
        //Codendi specific: remove permissions for this page @codenditodo: may be transferable otherwhere.
        require_once 'common/wiki/lib/WikiPage.class.php';
        $wiki_page = new WikiPage(GROUP_ID, $_REQUEST['pagename']);
        $wiki_page->resetPermissions();
        // Real delete.
        //$pagename = $page->getName();
        $dbi = $request->getDbh();
        $dbi->deletePage($pagename);
        $dbi->touch();
        $link = HTML::a(array('href' => 'javascript:history.go(-2)'), _("Back to the previous page."));
        $html = HTML(HTML::h2(fmt("Removed page '%s' successfully.", $pagename)), HTML::div($link), HTML::hr());
    }
    GeneratePage($html, _("Remove Page"));
}
开发者ID:nterray,项目名称:tuleap,代码行数:57,代码来源:removepage.php

示例6: getFormElements

 function getFormElements()
 {
     $el = array();
     if (!$this->request->getSessionVar('captcha_ok')) {
         $el['CAPTCHA_INPUT'] = HTML::input(array('type' => 'text', 'class' => 'wikitext', 'id' => 'edit:captcha_input', 'name' => 'edit[captcha_input]', 'size' => $this->length + 2, 'maxlength' => 256));
         $url = WikiURL("", array("action" => "captcha", "id" => time()), false);
         $el['CAPTCHA_IMAGE'] = "<img src=\"{$url}\" alt=\"captcha\" />";
         $el['CAPTCHA_LABEL'] = '<label for="edit:captcha_input">' . _("Type word above:") . ' </label>';
     }
     return $el;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:11,代码来源:Captcha.php

示例7: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($request->getArg('action') != 'browse') {
         return $this->disabled("(action != 'browse')");
     }
     if (!$request->isGetOrHead()) {
         return $this->disabled("(method != 'GET')");
     }
     if (!$src and $page) {
         if ($page == $request->get('pagename')) {
             return $this->error(sprintf(_("recursive inclusion of page %s"), $page));
         }
         $src = WikiURL($page);
     }
     if (!$src) {
         return $this->error(sprintf(_("%s or %s parameter missing"), 'src', 'page'));
     }
     // FIXME: How to normalize url's to compare against recursion?
     if ($src == $request->getURLtoSelf()) {
         return $this->error(sprintf(_("recursive inclusion of url %s"), $src));
     }
     static $noframes = false;
     if ($noframes) {
         // Content for noframes version of page.
         return HTML::p(fmt("See %s", HTML::a(array('href' => $src), $src)));
     }
     $noframes = true;
     if ($which = $request->getArg('frame')) {
         // Generate specialized frame output (header, footer, etc...)
         $request->discardOutput();
         displayPage($request, new Template("frame-{$which}", $request));
         $request->finish();
         //noreturn
     }
     // Generate the outer frameset
     $frame = HTML::frame(array('name' => $name, 'src' => $src, 'title' => $title, 'frameborder' => (int) $frameborder, 'scrolling' => (string) $scrolling, 'noresize' => (bool) $noresize));
     if ($marginwidth) {
         $frame->setArg('marginwidth', $marginwidth);
     }
     if ($marginheight) {
         $frame->setArg('marginheight', $marginheight);
     }
     $tokens = array('CONTENT_FRAME' => $frame, 'ROWS' => $rows, 'COLS' => $cols, 'FRAMEARGS' => sprintf('frameborder="%d"', $frameborder));
     // Produce the frameset.
     $request->discardOutput();
     displayPage($request, new Template('frameset', $request, $tokens));
     $request->finish();
     //noreturn
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:52,代码来源:FrameInclude.php

示例8: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     // fix deprecated arg
     if (is_integer($pages)) {
         $numpages = $pages;
         $pages = false;
         // fix new pages handling in arg preprozessor.
     } elseif (is_array($pages)) {
         $numpages = (int) $pages[0];
         if ($numpages > 0 and !$dbi->isWikiPage($numpages)) {
             $pages = false;
         } else {
             $numpages = 1;
         }
     }
     $allpages = $dbi->getAllPages(false, $sortby, $limit, $exclude);
     $pagearray = $allpages->asArray();
     better_srand();
     // Start with a good seed.
     if ($numpages == 1 && $pagearray) {
         $page = $pagearray[array_rand($pagearray)];
         $pagename = $page->getName();
         if ($redirect) {
             $request->redirect(WikiURL($pagename, false, 'absurl'));
         }
         // noreturn
         if ($hidename) {
             return WikiLink($pagename, false, _("RandomPage"));
         } else {
             return WikiLink($pagename);
         }
     }
     $numpages = min(max(1, (int) $numpages), 20, count($pagearray));
     $pagelist = new PageList($info, $exclude, $args);
     $shuffle = array_rand($pagearray, $numpages);
     if (is_array($shuffle)) {
         foreach ($shuffle as $i) {
             if (isset($pagearray[$i])) {
                 $pagelist->addPage($pagearray[$i]);
             }
         }
     } else {
         // if $numpages = 1
         if (isset($pagearray[$shuffle])) {
             $pagelist->addPage($pagearray[$shuffle]);
         }
     }
     return $pagelist;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:51,代码来源:RandomPage.php

示例9: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     $href = $args['href'];
     $page = $args['page'];
     if ($href) {
         // If URL is urlencoded, decode it.
         if (strpos('%', $href) !== false) {
             $href = urldecode($href);
         }
         $url = strip_tags($href);
         if ($url != $href) {
             // URL contains tags
             return $this->disabled(_("Illegal characters in external URL."));
         }
         $thispage = $request->getPage();
         if (!$thispage->get('locked')) {
             return $this->disabled(_("Redirect to an external URL is only allowed in locked pages."));
         }
     } else {
         if ($page) {
             $url = WikiURL($page, array('redirectfrom' => $request->getArg('pagename')), 'abs_path');
         } else {
             return $this->error(_("'href' or 'page' parameter missing."));
         }
     }
     if ($page == $request->getArg('pagename')) {
         return $this->error(fmt("Recursive redirect to self: '%s'", $url));
     }
     if ($request->getArg('action') != 'browse') {
         return $this->disabled("(action != 'browse')");
     }
     $redirectfrom = $request->getArg('redirectfrom');
     if ($redirectfrom !== false) {
         if ($redirectfrom) {
             return $this->disabled(_("Double redirect not allowed."));
         } else {
             // Got here by following the "Redirected from ..." link
             // on a browse page.
             return $this->disabled(_("Viewing redirecting page."));
         }
     }
     return $request->redirect($url);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:44,代码来源:RedirectTo.php

示例10: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     $href = $args['href'];
     $page = $args['page'];
     if ($href) {
         /*
          * Use quotes on the href argument value, like:
          *   <?plugin RedirectTo href="http://funky.com/a b \" c.htm" ?>
          *
          * Do we want some checking on href to avoid malicious
          * uses of the plugin? Like stripping tags or hexcode.
          */
         $url = preg_replace('/%\\d\\d/', '', strip_tags($href));
         $thispage = $request->getPage();
         if (!$thispage->get('locked')) {
             return $this->disabled(fmt("%s is only allowed in locked pages.", _("Redirect to an external url")));
         }
     } else {
         if ($page) {
             $url = WikiURL($page, array('redirectfrom' => $request->getArg('pagename')), 'abs_path');
         } else {
             return $this->error(fmt("%s or %s parameter missing", "'href'", "'page'"));
         }
     }
     if ($page == $request->getArg('pagename')) {
         return $this->error(fmt("Recursive redirect to self: '%s'", $url));
     }
     if ($request->getArg('action') != 'browse') {
         return $this->disabled("(action != 'browse')");
     }
     $redirectfrom = $request->getArg('redirectfrom');
     if ($redirectfrom !== false) {
         if ($redirectfrom) {
             return $this->disabled(_("Double redirect not allowed."));
         } else {
             // Got here by following the "Redirected from ..." link
             // on a browse page.
             return $this->disabled(_("Viewing redirecting page."));
         }
     }
     return $request->redirect($url);
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:43,代码来源:RedirectTo.php

示例11: linkUnknownWikiWord

 function linkUnknownWikiWord($wikiword, $linktext = '')
 {
     global $request;
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
         $wikiword = $wikiword->name;
     } else {
         $default_text = $wikiword;
     }
     $url = WikiURL($wikiword, array('action' => 'create'));
     $link = HTML::span(HTML::a(array('href' => $url, 'rel' => 'nofollow'), '?'));
     if (!empty($linktext)) {
         $link->unshiftContent(HTML::u($linktext));
         $link->setAttr('class', 'named-wikiunknown');
     } else {
         $link->unshiftContent(HTML::u($this->maybeSplitWikiWord($default_text)));
         $link->setAttr('class', 'wikiunknown');
     }
     return $link;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:20,代码来源:themeinfo.php

示例12: makeActionButton

 function makeActionButton($action, $label = false, $page_or_rev = false)
 {
     extract($this->_get_name_and_rev($page_or_rev));
     if (is_array($action)) {
         $attr = $action;
         $action = isset($attr['action']) ? $attr['action'] : 'browse';
     } else {
         $attr['action'] = $action;
     }
     $class = is_safe_action($action) ? 'named-wiki' : 'wikiadmin';
     if (!$label) {
         $label = $this->_labelForAction($action);
     }
     if ($version) {
         $attr['version'] = $version;
     }
     if ($action == 'browse') {
         unset($attr['action']);
     }
     return $this->makeButton($label, WikiURL($pagename, $attr), $class);
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:21,代码来源:themeinfo.php

示例13: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request, false);
     $page =& $args['page'];
     if (ENABLE_AJAX) {
         if ($args['state']) {
             $html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
         } else {
             $html = HTML(HTML::p(array('class' => 'transclusion-title'), fmt(" %s :", WikiLink($page))), HTML::div(array('class' => 'transclusion'), ''));
         }
         $ajaxuri = WikiURL($page, array('format' => 'xml'));
     } else {
         $html = WikiPlugin_IncludePage::run($dbi, $argstr, $request, $basepage);
     }
     $header = $html->_content[0];
     $body = $html->_content[1];
     $id = 'DynInc-' . MangleXmlIdentifier($page);
     $body->setAttr('id', $id . '-body');
     $png = $WikiTheme->_findData('images/folderArrow' . ($args['state'] ? 'Open' : 'Closed') . '.png');
     $icon = HTML::img(array('id' => $id . '-img', 'src' => $png, 'onclick' => ENABLE_AJAX ? "showHideAsync('" . $ajaxuri . "','{$id}')" : "showHideFolder('{$id}')", 'alt' => _("Click to hide/show"), 'title' => _("Click to hide/show")));
     $header = HTML::p(array('class' => 'transclusion-title', 'style' => "text-decoration: none;"), $icon, fmt(" %s :", WikiLink($page)));
     if ($args['state']) {
         // show base
         $body->setAttr('style', 'display:block');
         return HTML($header, $body);
     } else {
         // do not show base
         $body->setAttr('style', 'display:none');
         if (ENABLE_AJAX) {
             return HTML($header, $body);
         } else {
             return HTML($header, $body);
         }
         // sync (load but display:none)
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:37,代码来源:DynamicIncludePage.php

示例14: channel_properties

 function channel_properties()
 {
     global $request;
     $rc_url = WikiURL($request->getArg('pagename'), false, 'absurl');
     return array('title' => WIKI_NAME, 'link' => $rc_url, 'description' => _("RecentChanges"), 'dc:date' => Iso8601DateTime(time()), 'dc:language' => $GLOBALS['LANG']);
     /* FIXME: other things one might like in <channel>:
      * sy:updateFrequency
      * sy:updatePeriod
      * sy:updateBase
      * dc:subject
      * dc:publisher
      * dc:language
      * dc:rights
      * rss091:language
      * rss091:managingEditor
      * rss091:webmaster
      * rss091:lastBuildDate
      * rss091:copyright
      */
 }
开发者ID:neymanna,项目名称:fusionforge,代码行数:20,代码来源:RecentChanges.php

示例15: linkExistingWikiWord

 function linkExistingWikiWord($wikiword, $linktext = '', $version = false)
 {
     global $request;
     if ($version !== false and !$this->HTML_DUMP_SUFFIX) {
         $url = WikiURL($wikiword, array('version' => $version));
     } else {
         $url = WikiURL($wikiword);
     }
     // Extra steps for dumping page to an html file.
     if ($this->HTML_DUMP_SUFFIX) {
         $url = preg_replace('/^\\./', '%2e', $url);
         // dot pages
     }
     $link = HTML::a(array('href' => $url));
     if (isa($wikiword, 'WikiPageName')) {
         $default_text = $wikiword->shortName;
     } else {
         $default_text = $wikiword;
     }
     if (!empty($linktext)) {
         $link->pushContent($linktext);
         $link->setAttr('class', 'named-wiki');
         $link->setAttr('title', $this->maybeSplitWikiWord($default_text));
     } else {
         //TODO: check if wikiblog
         $link->pushContent($this->maybeSplitWikiWord($default_text));
         $link->setAttr('class', 'wiki');
     }
     return $link;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:30,代码来源:themeinfo.php


注:本文中的WikiURL函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。