• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP fmt函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: chownPages

 function chownPages(&$dbi, &$request, $pages, $newowner)
 {
     $ul = HTML::ul();
     $count = 0;
     foreach ($pages as $name) {
         $page = $dbi->getPage($name);
         if ($owner = $page->getOwner() and $newowner != $owner) {
             if (!mayAccessPage('change', $name)) {
                 $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", WikiLink($name))));
             } else {
                 $page->set('owner', $newowner);
                 if ($page->get('owner') === $newowner) {
                     $ul->pushContent(HTML::li(fmt("Chown page '%s' to '%s'.", WikiLink($name), WikiLink($newowner))));
                     $count++;
                 } else {
                     $ul->pushContent(HTML::li(fmt("Couldn't chown page '%s' to '%s'.", WikiLink($name), $newowner)));
                 }
             }
         }
     }
     if ($count) {
         $dbi->touch();
         return HTML($ul, HTML::p(fmt("%s pages have been permanently changed.", $count)));
     } else {
         return HTML($ul, HTML::p(fmt("No pages changed.")));
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:WikiAdminChown.php


示例2: WikiDB_backend_dba

 function WikiDB_backend_dba($dbparams)
 {
     $directory = '/tmp';
     $prefix = 'wiki_';
     $dba_handler = 'gdbm';
     $timeout = 20;
     extract($dbparams);
     if ($directory) {
         $directory .= "/";
     }
     $dbfile = $directory . $prefix . 'pagedb' . '.' . $dba_handler;
     // FIXME: error checking.
     $db = new DbaDatabase($dbfile, false, $dba_handler);
     $db->set_timeout($timeout);
     // Workaround for BDB 4.1 bugs
     if (file_exists($dbfile)) {
         $mode = 'w';
     } else {
         $mode = 'c';
     }
     if (!$db->open($mode)) {
         trigger_error(sprintf(_("%s: Can't open dba database"), $dbfile), E_USER_ERROR);
         global $request;
         $request->finish(fmt("%s: Can't open dba database", $dbfile));
     }
     $this->WikiDB_backend_dbaBase($db);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:27,代码来源:dba.php


示例3: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     if (!defined('ENABLE_RAW_HTML') || !ENABLE_RAW_HTML) {
         return $this->disabled(_("Raw HTML is disabled in this wiki."));
     }
     if (!$basepage) {
         return $this->error("{$basepage} unset?");
     }
     $page = $request->getPage($basepage);
     if (ENABLE_RAW_HTML_LOCKEDONLY) {
         if (!$page->get('locked')) {
             return $this->disabled(fmt("%s is only allowed in locked pages.", _("Raw HTML")));
         }
     }
     if (ENABLE_RAW_HTML_SAFE) {
         // check for javascript handlers (on*) and style tags with external urls. no javascript urls.
         // See also http://simon.incutio.com/archive/2003/02/23/safeHtmlChecker
         // But we should allow not only code semantic meaning,  presentational markup also.
         // http://chxo.com/scripts/safe_html-test.php looks better
         $argstr = $this->safe_html($argstr);
         /*return $this->disabled(HTML(fmt("This %s plugin on %s is disabled because of unsafe HTML code. ",$this->getName(), $basepage),
                                       fmt("See PhpWiki:allowing%20safe%20HTML")
                                       ));
           */
     }
     return HTML::raw($argstr);
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:27,代码来源:RawHtml.php


示例4: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (empty($page)) {
         return '';
     }
     $backend =& $dbi->_backend;
     $html = HTML(HTML::h3(fmt("Querying backend directly for '%s'", $page)));
     $table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
     $pagedata = $backend->get_pagedata($page);
     if (!$pagedata) {
         // FIXME: invalid HTML
         $html->pushContent(HTML::p(fmt("No pagedata for %s", $page)));
     } else {
         $this->_fixupData($pagedata);
         $table->pushContent($this->_showhash("get_pagedata('{$page}')", $pagedata));
     }
     for ($version = $backend->get_latest_version($page); $version; $version = $backend->get_previous_version($page, $version)) {
         $vdata = $backend->get_versiondata($page, $version, true);
         $this->_fixupData($vdata);
         $table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
         $table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
     }
     $html->pushContent($table);
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:27,代码来源:_BackendInfo.php


示例5: purgePages

 function purgePages(&$request, $pages)
 {
     $result = HTML::div();
     $ul = HTML::ul();
     $dbi = $request->getDbh();
     $count = 0;
     foreach ($pages as $name) {
         $name = str_replace(array('%5B', '%5D'), array('[', ']'), $name);
         if (mayAccessPage('purge', $name)) {
             $dbi->purgePage($name);
             $ul->pushContent(HTML::li(fmt("Purged page '%s' successfully.", $name)));
             $count++;
         } else {
             $ul->pushContent(HTML::li(fmt("Didn't purge page '%s'. Access denied.", $name)));
         }
     }
     if ($count) {
         $dbi->touch();
         $result->setAttr('class', 'feedback');
         if ($count == 1) {
             $result->pushContent(HTML::p("One page has been permanently purged:"));
         } else {
             $result->pushContent(HTML::p(fmt("%s pages have been permanently purged:", $count)));
         }
         $result->pushContent($ul);
         return $result;
     } else {
         $result->setAttr('class', 'error');
         $result->pushContent(HTML::p("No pages purged."));
         return $result;
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:32,代码来源:WikiAdminPurge.php


示例6: 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


示例7: box

 function box($args = false, $request = false, $basepage = false)
 {
     if (!$request) {
         $request =& $GLOBALS['request'];
     }
     $stats = $this->getStats($request->_dbi, $request, 'summary');
     return $this->makeBox(_("Who is online"), HTML(HTML::Raw('· '), WikiLink(_("WhoIsOnline"), 'auto', fmt("%d online users", $stats['NUM_USERS']))));
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:8,代码来源:WhoIsOnline.php


示例8: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     // Any text that is returned will not be further transformed,
     // so use html where necessary.
     $html = HTML::tt(fmt('%s: %s', $salutation, WikiLink($name, 'auto')), THE_END);
     return $html;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:8,代码来源:HelloWorld.php


示例9: 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


示例10: getHtmlFields

 public function getHtmlFields()
 {
     $this->notifyUrl .= "&processor=jcc";
     $this->returnUrl .= "&processor=jcc";
     //Version
     $version = "1.0.0";
     //Merchant ID
     $merchantID = $this->merchantId;
     //Acquirer ID
     $acquirerID = $this->acquirerId;
     //The SSL secured URL of the merchant to which JCC will send the transaction result
     //This should be SSL enabled – note https:// NOT http://
     //Purchase Amount
     $purchaseAmt = fmt($this->amount);
     //Pad the purchase amount with 0's so that the total length is 13 characters, i.e. 20.50 will become 0000000020.50
     $purchaseAmt = str_pad($purchaseAmt, 13, "0", STR_PAD_LEFT);
     //Remove the dot (.) from the padded purchase amount(JCC will know from currency how many digits to	consider as decimal)
     //0000000020.50 will become 000000002050 (notice there is no dot)
     $formattedPurchaseAmt = substr($purchaseAmt, 0, 10) . substr($purchaseAmt, 11);
     //Euro currency ISO Code; see relevant appendix for ISO codes of other currencies
     $currency = 978;
     //The number of decimal points for transaction currency, i.e. in this example we indicate that Euro has 2 decimal points
     $currencyExp = 2;
     //Order number
     $orderID = $this->itemNumber;
     //Specify we want not only to authorize the amount but also capture at the same time. Alternative value	could be M (for capturing later)
     $captureFlag = "A";
     //Password
     $password = $this->password;
     //Form the plaintext string to encrypt by concatenating Password, Merchant ID, Acquirer ID, Order ID,Formatter Purchase Amount and Currency
     //This will give 1234abcd | 0011223344 | 402971 | TestOrder12345 | 000000002050 | 978 (spaces and |	introduced here for clarity)
     $toEncrypt = $password . $merchantID . $acquirerID . $orderID . $formattedPurchaseAmt . $currency;
     //Produce the hash using SHA1
     //This will give b14dcc7842a53f1ec7a621e77c106dfbe8283779
     $sha1Signature = sha1($toEncrypt);
     //Encode the signature using Base64 before transmitting to JCC
     //This will give sU3MeEKlPx7HpiHnfBBt++goN3k=
     $base64Sha1Signature = base64_encode(pack("H*", $sha1Signature));
     //The name of the hash algorithm use to create the signature; can be MD5 or SHA1; the latter is preffered and is what we used in this example
     $signatureMethod = "SHA1";
     $html = '';
     $html .= sprintf('<input type="hidden" name="Version" value="%s"/>', $version);
     $html .= sprintf('<input type="hidden" name="MerID" value="%s"/>', $merchantID);
     $html .= sprintf('<input type="hidden" name="AcqID" value="%s"/>', $acquirerID);
     $html .= sprintf('<input type="hidden" name="MerRespURL" value="%s"/>', $this->notifyUrl);
     $html .= sprintf('<input type="hidden" name="PurchaseAmt" value="%s"/>', $formattedPurchaseAmt);
     $html .= sprintf('<input type="hidden" name="PurchaseCurrency" value="%s"/>', $currency);
     $html .= sprintf('<input type="hidden" name="PurchaseCurrencyExponent" value="%s"/>', $currencyExp);
     $html .= sprintf('<input type="hidden" name="OrderID" value="%s"/>', $orderID);
     $html .= sprintf('<input type="hidden" name="CaptureFlag" value="%s"/>', $captureFlag);
     $html .= sprintf('<input type="hidden" name="Signature" value="%s"/>', $base64Sha1Signature);
     $html .= sprintf('<input type="hidden" name="SignatureMethod" value="%s"/>', $signatureMethod);
     //echo $html; exit;
     return $html;
 }
开发者ID:jmangarret,项目名称:webtuagencia24,代码行数:55,代码来源:jcc.php


示例11: checkname

 function checkname()
 {
     $name = isset($_POST['name']) ? $_POST['name'] : "";
     $name = fmt($name);
     $data = $this->find("user_name=" . $name, "users");
     if (!empty($data)) {
         echo "用户名已存在";
     } else {
         echo "OK";
     }
 }
开发者ID:kim-test,项目名称:test,代码行数:11,代码来源:member.php


示例12: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (empty($page)) {
         return $this->error("page missing");
     }
     $backend =& $dbi->_backend;
     $this->chunk_split = true;
     $this->readonly_pagemeta = array();
     $this->hidden_pagemeta = array('_cached_html');
     $html = HTML(HTML::h3(fmt("Querying backend directly for '%s'", $page)));
     $table = HTML::table(array('border' => 1, 'cellpadding' => 2, 'cellspacing' => 0));
     $pagedata = $backend->get_pagedata($page);
     if (!$pagedata) {
         // FIXME: invalid HTML
         $html->pushContent(HTML::p(fmt("No pagedata for %s", $page)));
     } else {
         $this->_fixupData($pagedata);
         $table->pushContent($this->_showhash("get_pagedata('{$page}')", $pagedata));
     }
     if (!$notallversions) {
         $version = $backend->get_latest_version($page);
         $vdata = $backend->get_versiondata($page, $version, true);
         $this->_fixupData($vdata);
         $table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
         $table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
     } else {
         for ($version = $backend->get_latest_version($page); $version; $version = $backend->get_previous_version($page, $version)) {
             $vdata = $backend->get_versiondata($page, $version, true);
             $this->_fixupData($vdata);
             $table->pushContent(HTML::tr(HTML::td(array('colspan' => 2))));
             $table->pushContent($this->_showhash("get_versiondata('{$page}',{$version})", $vdata));
         }
     }
     $linkdata = $backend->get_links($page, false);
     if ($linkdata->count()) {
         $table->pushContent($this->_showhash("get_links('{$page}')", $linkdata->asArray()));
     }
     $relations = $backend->get_links($page, false, false, false, false, false, true);
     if ($relations->count()) {
         $table->pushContent($this->_showhash("get_relations('{$page}')", array()));
         while ($rel = $relations->next()) {
             $table->pushContent($this->_showhash(false, $rel));
         }
     }
     $linkdata = $backend->get_links($page, true);
     if ($linkdata->count()) {
         $table->pushContent($this->_showhash("get_backlinks('{$page}')", $linkdata->asArray()));
     }
     $html->pushContent($table);
     return $html;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:53,代码来源:_BackendInfo.php


示例13: showNotify

 function showNotify(&$request, $messages, $page, $pagelist, $verified)
 {
     $isNecessary = !$this->contains($pagelist, $page);
     $form = HTML::form(array('action' => $request->getPostURL(), 'method' => 'post'), HiddenInputs(array('verify' => 1)), HiddenInputs($request->getArgs(), false, array('verify')), $messages, HTML::p(_("Your current watchlist: "), $this->showWatchList($pagelist)));
     if ($isNecessary) {
         $form->pushContent(HTML::p(_("New watchlist: "), $this->showWatchList($this->addpagelist($page, $pagelist))), HTML::p(sprintf(_("Do you %s want to add this page \"%s\" to your WatchList?"), $verified ? _("really") : "", $page)), HTML::p(Button('submit:add', _("Yes")), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"))));
     } else {
         $form->pushContent(HTML::p(fmt("The page %s is already watched!", $page)), HTML::p(Button('submit:edit', _("Edit")), HTML::Raw('&nbsp;'), Button('submit:cancel', _("Cancel"))));
     }
     $fieldset = HTML::fieldset(HTML::legend("Watch Page"), $form);
     return $fieldset;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:12,代码来源:WatchPage.php


示例14: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if (empty($page) && empty($prefix) && empty($suffix)) {
         return '';
     }
     if ($prefix) {
         $suffix = false;
         $descrip = fmt("Page names with prefix '%s'", $prefix);
     } elseif ($suffix) {
         $descrip = fmt("Page names with suffix '%s'", $suffix);
     } elseif ($page) {
         $words = preg_split('/[\\s:-;.,]+/', SplitPagename($page));
         $words = preg_grep('/\\S/', $words);
         $prefix = reset($words);
         $suffix = end($words);
         $descrip = fmt("These pages share an initial or final title word with '%s'", WikiLink($page, 'auto'));
     }
     // Search for pages containing either the suffix or the prefix.
     $search = $match = array();
     if (!empty($prefix)) {
         $search[] = $this->_quote($prefix);
         $match[] = '^' . preg_quote($prefix, '/');
     }
     if (!empty($suffix)) {
         $search[] = $this->_quote($suffix);
         $match[] = preg_quote($suffix, '/') . '$';
     }
     if ($search) {
         $query = new TextSearchQuery(join(' OR ', $search));
     } else {
         $query = new NullTextSearchQuery();
     }
     // matches nothing
     $match_re = '/' . join('|', $match) . '/';
     $pagelist = new PageList($info, $exclude, $args);
     if (!$noheader) {
         $pagelist->setCaption($descrip);
     }
     $pages = $dbi->titleSearch($query);
     while ($page = $pages->next()) {
         $name = $page->getName();
         if (!preg_match($match_re, $name)) {
             continue;
         }
         $pagelist->addPage($page);
     }
     return $pagelist;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:50,代码来源:LikePages.php


示例15: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     $args = $this->getArgs($argstr, $request);
     if ($args['basepage']) {
         $pagename = $args['basepage'];
     } else {
         $pagename = $request->getArg('pagename');
     }
     // FIXME: explodePageList from stdlib doesn't seem to work as
     // expected when there are no subpages. (see also
     // UnfoldSubPages plugin)
     $subpages = explodePageList($pagename . SUBPAGE_SEPARATOR . '*');
     if (!$subpages) {
         return $this->error(_("The current page has no subpages defined."));
     }
     extract($args);
     $content = HTML();
     $subpages = array_reverse($subpages);
     if ($maxpages) {
         $subpages = array_slice($subpages, 0, $maxpages);
     }
     $descrip = fmt("SubPages of %s:", WikiLink($pagename, 'auto'));
     if ($info) {
         $info = explode(",", $info);
         if (in_array('count', $info)) {
             $args['types']['count'] = new _PageList_Column_ListSubpages_count('count', _("#"), 'center');
         }
     }
     $pagelist = new PageList($info, $exclude, $args);
     if (!$noheader) {
         $pagelist->setCaption($descrip);
     }
     foreach ($subpages as $page) {
         // A page cannot include itself. Avoid doublettes.
         static $included_pages = array();
         if (in_array($page, $included_pages)) {
             $content->pushContent(HTML::p(sprintf(_("recursive inclusion of page %s ignored"), $page)));
             continue;
         }
         array_push($included_pages, $page);
         //if ($relative) {
         // TODO: add relative subpage name display to PageList class
         //}
         $pagelist->addPage($page);
         array_pop($included_pages);
     }
     $content->pushContent($pagelist);
     return $content;
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:49,代码来源:ListSubpages.php


示例16: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     global $WikiTheme;
     $args = $this->getArgs($argstr, $request);
     extract($args);
     if ($Longitude === '') {
         return $this->error(fmt("%s parameter missing", "'Longitude'"));
     }
     if ($Latitude === '') {
         return $this->error(fmt("%s parameter missing", "'Latitude'"));
     }
     $maps = JavaScript('', array('src' => "http://maps.google.com/maps?file=api&v=1&key=" . GOOGLE_LICENSE_KEY));
     $id = GenerateId("googlemap");
     switch ($MapType) {
         case "Satellite":
             $type = "_SATELLITE_TYPE";
             break;
         case "Map":
             $type = "_MAP_TYPE";
             break;
         case "Hybrid":
             $type = "_HYBRID_TYPE";
             break;
         default:
             return $this->error(sprintf(_("invalid argument %s"), $MapType));
     }
     $div = HTML::div(array('id' => $id, 'style' => 'width: ' . $width . '; height: ' . $height));
     // TODO: Check for multiple markers or polygons
     if (!$InfoText) {
         $Marker = false;
     }
     // Create a marker whose info window displays the given text
     if ($Marker) {
         if ($InfoText) {
             include_once "lib/BlockParser.php";
             $page = $dbi->getPage($request->getArg('pagename'));
             $rev = $page->getCurrentRevision(false);
             $markup = $rev->get('markup');
             $markertext = TransformText($InfoText, $markup, $basepage);
         }
         $markerjs = JavaScript("\nfunction createMarker(point, text) {\n  var marker = new GMarker(point);\n  var html = text + \"<br><br><font size='-1'>[" . _("new&nbsp;window") . "]</font>\";\n  GEvent.addListener(marker, \"click\", function() {marker.openInfoWindowHtml(html);});\n  return marker;\n}");
     }
     $run = JavaScript("\nvar map = new GMap(document.getElementById('" . $id . "'));\n" . ($SmallMapControl ? "map.addControl(new GSmallMapControl());\n" : "map.addControl(new GLargeMapControl());\n") . "\nmap.addControl(new GMapTypeControl());\nmap.centerAndZoom(new GPoint(" . $Longitude . ", " . $Latitude . "), " . $ZoomFactor . ");\nmap.setMapType(" . $type . ");" . ($Marker ? "\nvar point = new GPoint(" . $Longitude . "," . $Latitude . ");\nvar marker = createMarker(point, '" . $markertext->asXml() . "'); map.addOverlay(marker);" : ""));
     if ($Marker) {
         return HTML($markerjs, $maps, $div, $run);
     } else {
         return HTML($maps, $div, $run);
     }
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:49,代码来源:GoogleMaps.php


示例17: run

 function run($dbi, $argstr, &$request, $basepage)
 {
     extract($this->getArgs($argstr, $request));
     $h = HTML();
     $this->_generatePageheader($info, $h);
     if (!REQUIRE_ADMIN || $request->_user->isadmin()) {
         $h->pushContent(HTML::h2(_("Plugins")));
         $table = HTML::table(array('class' => "pagelist"));
         $this->_generateColheadings($info, $table);
         $this->_generateTableBody($info, $dbi, $request, $table);
         $h->pushContent($table);
     } else {
         $h->pushContent(fmt("You must be an administrator to %s.", _("use this plugin")));
     }
     return $h;
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:16,代码来源:PluginManager.php


示例18: chownPages

 function chownPages(&$dbi, &$request, $pages, $newowner)
 {
     $result = HTML::div();
     $ul = HTML::ul();
     $count = 0;
     foreach ($pages as $name) {
         $page = $dbi->getPage($name);
         $current = $page->getCurrentRevision();
         if ($owner = $page->getOwner() and $newowner != $owner) {
             if (!mayAccessPage('change', $name)) {
                 $ul->pushContent(HTML::li(fmt("Access denied to change page '%s'.", WikiLink($name))));
             } else {
                 $version = $current->getVersion();
                 $meta = $current->_data;
                 $text = $current->getPackedContent();
                 $meta['summary'] = "Change page owner from '" . $owner . "' to '" . $newowner . "'";
                 $meta['is_minor_edit'] = 1;
                 $meta['author'] = $request->_user->UserName();
                 unset($meta['mtime']);
                 // force new date
                 $page->set('owner', $newowner);
                 $page->save($text, $version + 1, $meta);
                 if ($page->get('owner') === $newowner) {
                     $ul->pushContent(HTML::li(fmt("Change owner of page '%s' to '%s'.", WikiLink($name), WikiLink($newowner))));
                     $count++;
                 } else {
                     $ul->pushContent(HTML::li(fmt("Could not change owner of page '%s' to '%s'.", WikiLink($name), $newowner)));
                 }
             }
         }
     }
     if ($count) {
         $dbi->touch();
         $result->setAttr('class', 'feedback');
         if ($count == 1) {
             $result->pushContent(HTML::p("One page has been permanently changed:"));
         } else {
             $result->pushContent(HTML::p(fmt("%s pages have been permanently changed:", $count)));
         }
         $result->pushContent($ul);
         return $result;
     } else {
         $result->setAttr('class', 'error');
         $result->pushContent(HTML::p("No pages changed."));
         return $result;
     }
 }
开发者ID:hugcoday,项目名称:wiki,代码行数:47,代码来源:WikiAdminChown.php


示例19: TextSearchQuery

 /**
  * Create a new query.
  *
  * @param $search_query string The query.  Syntax is as described above.
  * Note that an empty $search_query will match anything.
  * @param $case_exact boolean
  * @param $regex string one of 'auto', 'none', 'glob', 'posix', 'pcre', 'sql'
  * @see TextSearchQuery
  */
 function TextSearchQuery($search_query, $case_exact = false, $regex = 'auto')
 {
     if ($regex == 'none' or !$regex) {
         $this->_regex = 0;
     } elseif (defined("TSQ_REGEX_" . strtoupper($regex))) {
         $this->_regex = constant("TSQ_REGEX_" . strtoupper($regex));
     } else {
         trigger_error(fmt("Unsupported argument: %s=%s", 'regex', $regex));
         $this->_regex = 0;
     }
     $this->_case_exact = $case_exact;
     $parser = new TextSearchQuery_Parser();
     $this->_tree = $parser->parse($search_query, $case_exact, $this->_regex);
     $this->_optimize();
     // broken under certain circumstances: "word -word -word"
     $this->_stoplist = '(A|An|And|But|By|For|From|In|Is|It|Of|On|Or|The|To|With)';
 }
开发者ID:pombredanne,项目名称:tuleap,代码行数:26,代码来源:TextSearchQuery.php


示例20: 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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fnColumnToField函数代码示例发布时间:2022-05-15
下一篇:
PHP fmpath函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap