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


PHP WebRequest::response方法代码示例

本文整理汇总了PHP中WebRequest::response方法的典型用法代码示例。如果您正苦于以下问题:PHP WebRequest::response方法的具体用法?PHP WebRequest::response怎么用?PHP WebRequest::response使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebRequest的用法示例。


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

示例1: WidgetLastWikis

function WidgetLastWikis($id, $params)
{
    wfProfileIn(__METHOD__);
    global $wgSitename, $wgCookiePrefix, $wgOut;
    $cookie = isset($_COOKIE["{$wgCookiePrefix}recentlyvisited"]) ? $_COOKIE["{$wgCookiePrefix}recentlyvisited"] : false;
    $server = $_SERVER['SERVER_NAME'];
    $found = false;
    $count = 0;
    $urls = !empty($cookie) ? unserialize($cookie) : array();
    // first, prepare the existing rank
    $items = array();
    if (is_array($urls) && count($urls) > 0) {
        for ($index = 0; $index < 6; $index++) {
            $url = isset($urls[$index]['url']) ? $urls[$index]['url'] : '';
            $name = isset($urls[$index]['name']) ? $urls[$index]['name'] : '';
            if ($url == $server) {
                $found = true;
            } elseif ($url != '') {
                $items[] = array('href' => "http://" . $url, 'name' => $name);
                $count++;
            }
        }
    }
    // next, add the current Wikia into the list, if it's not already there
    if (!$found) {
        if (count($urls) == 5) {
            array_pop($urls);
        }
        if (is_array($url)) {
            array_unshift($urls, array('url' => $server, 'name' => $wgSitename));
        }
        $expire = time() + 3600 * 24 * 7;
        $req = new WebRequest();
        $req->response()->setcookie('recentlyvisited', serialize($urls), $expire);
    }
    if (count($items) > 0) {
        $ret = WidgetFramework::wrapLinks($items);
    } else {
        $ret = $wgOut->parse(wfMsg('wt_lastwikis_noresults'));
    }
    wfProfileOut(__METHOD__);
    return $ret;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:43,代码来源:WidgetLastWikis.php

示例2: dismissMessage

 /**
  * Dismisses notification about updated community message
  *
  * Moved from BeforePageDisplay into separate method by Macbre
  *
  * @author Maciej Błaszkowski <marooned at wikia-inc.com>
  */
 static function dismissMessage()
 {
     wfProfileIn(__METHOD__);
     global $wgUser, $wgMemc, $wgCityId, $wgExternalDatawareDB;
     $communityMessagesTimestamp = $wgMemc->get(wfMemcKey('CommunityMessagesTimestamp'));
     if (!$communityMessagesTimestamp) {
         //do not waste time on getting timestamp from 'community-corner' - `now` will be enough
         $communityMessagesTimestamp = time();
     }
     if ($wgUser->isLoggedIn()) {
         $userTimestamp = self::getUserTimestamp($wgUser);
         //we have newer message - update user's timestamp
         if (($userTimestamp === false || $communityMessagesTimestamp > $userTimestamp) && !wfReadOnly()) {
             $dbw = wfGetDB(DB_MASTER, array(), $wgExternalDatawareDB);
             $dbw->replace('user_flags', null, array('city_id' => $wgCityId, 'user_id' => $wgUser->getID(), 'type' => self::USER_FLAGS_COMMUNITY_MESSAGES, 'data' => wfTimestamp(TS_DB, $communityMessagesTimestamp)), __METHOD__);
             // fix for AJAX calls
             $dbw->commit();
         }
     } else {
         //anon
         $req = new WebRequest();
         $req->response()->setcookie('CommunityMessages', $communityMessagesTimestamp, time() + 86400);
     }
     //hide notice in this session [omit need to send cookie back (anon) or slave lag (logged in)]
     self::$messageSeen = true;
     wfDebug(__METHOD__ . " - message dismissed\n");
     wfProfileOut(__METHOD__);
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:35,代码来源:CommunityMessages.class.php

示例3: execute

 /**
  * Main entry point.
  *
  * @param array $session initial session array
  *
  * @return Array: new session array
  */
 public function execute(array $session)
 {
     $this->session = $session;
     if (isset($session['settings'])) {
         $this->settings = $session['settings'] + $this->settings;
     }
     $this->exportVars();
     $this->setupLanguage();
     if (($this->getVar('_InstallDone') || $this->getVar('_UpgradeDone')) && $this->request->getVal('localsettings')) {
         $this->request->response()->header('Content-type: application/x-httpd-php');
         $this->request->response()->header('Content-Disposition: attachment; filename="LocalSettings.php"');
         $ls = InstallerOverrides::getLocalSettingsGenerator($this);
         $rightsProfile = $this->rightsProfiles[$this->getVar('_RightsProfile')];
         foreach ($rightsProfile as $group => $rightsArr) {
             $ls->setGroupRights($group, $rightsArr);
         }
         echo $ls->getText();
         return $this->session;
     }
     $cssDir = $this->request->getVal('css');
     if ($cssDir) {
         $cssDir = $cssDir == 'rtl' ? 'rtl' : 'ltr';
         $this->request->response()->header('Content-type: text/css');
         echo $this->output->getCSS($cssDir);
         return $this->session;
     }
     if (isset($session['happyPages'])) {
         $this->happyPages = $session['happyPages'];
     } else {
         $this->happyPages = array();
     }
     if (isset($session['skippedPages'])) {
         $this->skippedPages = $session['skippedPages'];
     } else {
         $this->skippedPages = array();
     }
     $lowestUnhappy = $this->getLowestUnhappy();
     # Special case for Creative Commons partner chooser box.
     if ($this->request->getVal('SubmitCC')) {
         $page = $this->getPageByName('Options');
         $this->output->useShortHeader();
         $this->output->allowFrames();
         $page->submitCC();
         return $this->finish();
     }
     if ($this->request->getVal('ShowCC')) {
         $page = $this->getPageByName('Options');
         $this->output->useShortHeader();
         $this->output->allowFrames();
         $this->output->addHTML($page->getCCDoneBox());
         return $this->finish();
     }
     # Get the page name.
     $pageName = $this->request->getVal('page');
     if (in_array($pageName, $this->otherPages)) {
         # Out of sequence
         $pageId = false;
         $page = $this->getPageByName($pageName);
     } else {
         # Main sequence
         if (!$pageName || !in_array($pageName, $this->pageSequence)) {
             $pageId = $lowestUnhappy;
         } else {
             $pageId = array_search($pageName, $this->pageSequence);
         }
         # If necessary, move back to the lowest-numbered unhappy page
         if ($pageId > $lowestUnhappy) {
             $pageId = $lowestUnhappy;
             if ($lowestUnhappy == 0) {
                 # Knocked back to start, possible loss of session data.
                 $this->showSessionWarning = true;
             }
         }
         $pageName = $this->pageSequence[$pageId];
         $page = $this->getPageByName($pageName);
     }
     # If a back button was submitted, go back without submitting the form data.
     if ($this->request->wasPosted() && $this->request->getBool('submit-back')) {
         if ($this->request->getVal('lastPage')) {
             $nextPage = $this->request->getVal('lastPage');
         } elseif ($pageId !== false) {
             # Main sequence page
             # Skip the skipped pages
             $nextPageId = $pageId;
             do {
                 $nextPageId--;
                 $nextPage = $this->pageSequence[$nextPageId];
             } while (isset($this->skippedPages[$nextPage]));
         } else {
             $nextPage = $this->pageSequence[$lowestUnhappy];
         }
         $this->output->redirect($this->getUrl(array('page' => $nextPage)));
         return $this->finish();
//.........这里部分代码省略.........
开发者ID:Grprashanthkumar,项目名称:ColfusionWeb,代码行数:101,代码来源:WebInstaller.php

示例4: outputCss

 /**
  * Output stylesheet for web installer pages
  */
 public function outputCss()
 {
     $this->request->response()->header('Content-type: text/css');
     echo $this->output->getCSS();
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:8,代码来源:WebInstaller.php

示例5: WebRequest

<?php

/**
 * Check versions of installed packages
 */
$webRequest = new WebRequest(TYPEF_PROVIDER . '?output=json');
$response = $webRequest->response();
if (!is_array($response)) {
    $response = json_decode($response, true);
}
$dir = scandir(TYPEF_DIR . '/source/packages');
foreach ($dir as $file) {
    if (substr($file, -4) == '.xml') {
        $pathinfo = pathinfo($file);
        $xml = simplexml_load_file(TYPEF_DIR . '/source/packages/' . $file);
        $latest = isset($response[$pathinfo['filename']]) ? $response[$pathinfo['filename']] : 'N/A';
        echo str_pad($pathinfo['filename'], 24, '.') . str_pad("{$xml['version']}", 15, '.') . $latest . "\n";
    }
}
开发者ID:ssrsfs,项目名称:blg,代码行数:19,代码来源:versions.inc.php

示例6: isBeta

 public static function isBeta(WebRequest $request)
 {
     $tux = $request->getVal('tux', null);
     if ($tux === null) {
         $tux = $request->getCookie('tux', null, true);
     } elseif ($tux) {
         $request->response()->setCookie('tux', 1);
     } else {
         $request->response()->setCookie('tux', 0);
     }
     return $tux;
 }
开发者ID:HuijiWiki,项目名称:mediawiki-extensions-Translate,代码行数:12,代码来源:SpecialTranslate.php


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