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


PHP AjaxResponse::addText方法代码示例

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


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

示例1: wfTalkHereAjaxEditor

function wfTalkHereAjaxEditor( $page, $section, $returnto ) {
	global $wgRequest, $wgTitle, $wgOut;

	$title = Title::newFromText( $page );
	if ( !$title ) {
		return false;
	}

	//fake editor environment
	$args = array(
		'wpTalkHere' => '1',
		'wpReturnTo' => $returnto,
		'action' => 'edit',
		'section' => $section
	);

	$wgRequest = new FauxRequest( $args );
	$wgTitle = $title;

	$article = Article::newFromTitle( $title, RequestContext::getMain() );
	$editor = new TalkHereEditPage( $article );

	//generate form
	$editor->importFormData( $wgRequest );
	$editor->showEditForm();

	$response = new AjaxResponse();
	$response->addText( $wgOut->getHTML() );
	$response->setCacheDuration( false ); //don't cache, because of tokens etc

	return $response;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:32,代码来源:TalkHere.php

示例2: ajax

 /**
  * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
  * load CategoryTreeFunctions.php on demand.
  */
 function ajax($category, $mode)
 {
     global $wgDBname;
     $title = self::makeTitle($category);
     if (!$title) {
         return false;
     }
     #TODO: error message?
     $this->mIsAjaxRequest = true;
     # Retrieve page_touched for the category
     $dbkey = $title->getDBkey();
     $dbr =& wfGetDB(DB_SLAVE);
     $touched = $dbr->selectField('page', 'page_touched', array('page_namespace' => NS_CATEGORY, 'page_title' => $dbkey), __METHOD__);
     $mckey = "{$wgDBname}:categorytree({$mode}):{$dbkey}";
     //FIXME: would need to add depth parameter.
     $response = new AjaxResponse();
     if ($response->checkLastModified($touched)) {
         return $response;
     }
     if ($response->loadFromMemcached($mckey, $touched)) {
         return $response;
     }
     $html = $this->renderChildren($title, $mode);
     //FIXME: would need to pass depth parameter.
     if ($html == '') {
         $html = ' ';
     }
     #HACK: Safari doesn't like empty responses.
     #see Bug 7219 and http://bugzilla.opendarwin.org/show_bug.cgi?id=10716
     $response->addText($html);
     $response->storeInMemcached($mckey, 86400);
     return $response;
 }
开发者ID:BackupTheBerlios,项目名称:shoutwiki-svn,代码行数:37,代码来源:CategoryTreeFunctions.php

示例3: getFogbugzServiceResponse

 /**
  *
  * cmd posible values:
  * 'getCasesInfo' - in response there will be returned set of cases and subcases info formated in WikiText
  * 'getComment' - in response there will be returned comments for particular case
  */
 public static function getFogbugzServiceResponse()
 {
     global $wgRequest, $wgHTTPProxy, $wgFogbugzAPIConfig;
     $command = $wgRequest->getText('cmd');
     $myFBService = new FogbugzService($wgFogbugzAPIConfig['apiUrl'], $wgFogbugzAPIConfig['username'], $wgFogbugzAPIConfig['password'], $wgHTTPProxy);
     // there should be made some kind of protection from setting different value as cmd
     if ($command == 'getCasesInfo') {
         $outerIDs = $wgRequest->getArray('IDs');
         $results = array();
         try {
             $results = $myFBService->logon()->getCasesBasicInfo($outerIDs);
         } catch (Exception $e) {
             $results = array();
         }
         $preparedResults = FogbugzTag::sortAndMakeTickets($results);
         $response = new AjaxResponse();
         $response->addText(json_encode($preparedResults));
     } else {
         // this part is not in use now; it will be after adding displaying comments
         $outerIDs = $wgRequest->getText('ID');
         /* ... */
     }
     if (!$response) {
         $response = new AjaxResponse();
         $response->addText(json_encode(array('status' => wfMsg('fbtag-unknown-error'))));
     }
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:34,代码来源:FogbugzTag.class.php

示例4: blockArticle

 static function blockArticle()
 {
     global $wgUser, $wgExternalDatawareDB, $wgRequest;
     $response = new AjaxResponse();
     if (!$wgUser->isAllowed('corporatepagemanager') || !$wgRequest->wasPosted()) {
         $response->addText(json_encode(array('status' => "ERROR1")));
         return $response;
     }
     $dbw = wfGetDB(DB_MASTER, array(), $wgExternalDatawareDB);
     $dbw->begin();
     $article = $wgRequest->getVal('wiki') . ":" . $wgRequest->getVal('name');
     if (!WikiaGlobalStats::excludeArticle($article)) {
         $response->addText(json_encode(array('status' => "ERROR2")));
         return $response;
     }
     $response->addText(json_encode(array('status' => "OK")));
     $dbw->commit();
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:19,代码来源:CorporatePageHelper.class.php

示例5: playerAjaxHandler

function playerAjaxHandler($file, $options)
{
    $response = new AjaxResponse();
    try {
        #TODO: caching!
        $player = Player::newFromName($file, $options, 'thumbsize');
        $html = $player->getPlayerHTML();
        $response->addText($html);
    } catch (PlayerException $ex) {
        $response->setResponseCode($ex->getHTTPCode());
        $response->addText($ex->getHTML());
    }
    return $response;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:Player.php

示例6: ajaxModalChooseName

 function ajaxModalChooseName()
 {
     global $wgRequest;
     $response = new AjaxResponse();
     $specialConnect = new SpecialConnect();
     $form = new ChooseNameForm($wgRequest, 'signup');
     $form->mainLoginForm($specialConnect, '');
     $tmpl = $form->getAjaxTemplate();
     $tmpl->set('isajax', true);
     ob_start();
     $tmpl->execute();
     $html = ob_get_clean();
     $response->addText($html);
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:15,代码来源:SpecialConnect.php

示例7: ajax

 /**
  * Ajax call. This is called by efCategoryTreeAjaxWrapper, which is used to
  * load CategoryTreeFunctions.php on demand.
  * @param $category
  * @param $depth int
  * @return AjaxResponse|bool
  */
 function ajax($category, $depth = 1)
 {
     global $wgLang, $wgContLang, $wgRenderHashAppend;
     $title = self::makeTitle($category);
     if (!$title) {
         return false;
         # TODO: error message?
     }
     # Retrieve page_touched for the category
     $dbkey = $title->getDBkey();
     $dbr = wfGetDB(DB_SLAVE);
     $touched = $dbr->selectField('page', 'page_touched', array('page_namespace' => NS_CATEGORY, 'page_title' => $dbkey), __METHOD__);
     $mckey = wfMemcKey("categorytree(" . $this->getOptionsAsCacheKey($depth) . ")", $dbkey, $wgLang->getCode(), $wgContLang->getExtraHashOptions(), $wgRenderHashAppend);
     $response = new AjaxResponse();
     if ($response->checkLastModified($touched)) {
         return $response;
     }
     if ($response->loadFromMemcached($mckey, $touched)) {
         return $response;
     }
     $html = $this->renderChildren($title, $depth);
     if ($html == '') {
         # HACK: Safari doesn't like empty responses.
         # see Bug 7219 and http://bugzilla.opendarwin.org/show_bug.cgi?id=10716
         $html = ' ';
     }
     $response->addText($html);
     $response->storeInMemcached($mckey, 86400);
     return $response;
 }
开发者ID:Tjorriemorrie,项目名称:app,代码行数:37,代码来源:CategoryTreeFunctions.php

示例8: hideFeed

 static function hideFeed()
 {
     global $wgUser, $wgRequest, $wgLang;
     $response = new AjaxResponse();
     $result = array();
     if (!$wgUser->isAllowed('corporatepagemanager')) {
         $result['response'] = 'error';
         $response->addText(json_encode($result));
         return $response;
     }
     $tag_id = (int) $wgRequest->getVal('tag_id', 0);
     $city_id = (int) $wgRequest->getVal('city_id', 0);
     $page_id = (int) $wgRequest->getVal('page_id', 0);
     $dir = $wgRequest->getVal('dir', 'add');
     $ws = new WikiaStatsAutoHubsConsumerDB(DB_MASTER);
     $result = array();
     if ($dir == 'add') {
         if ($wgRequest->getVal('type') == 'article') {
             if ($ws->addExludeArticle($tag_id, $city_id, $page_id, $wgLang->getCode())) {
                 $result['response'] = 'ok';
             }
         }
         if ($wgRequest->getVal('type') == 'blog') {
             if ($ws->addExludeBlog($tag_id, $city_id, $page_id, $wgLang->getCode())) {
                 $result['response'] = 'ok';
             }
         }
         if ($wgRequest->getVal('type') == 'city') {
             if ($ws->addExludeWiki($tag_id, $city_id, $wgLang->getCode())) {
                 $result['response'] = 'ok';
             }
         }
     } else {
         $result['response'] = 'ok';
         if ($wgRequest->getVal('type') == 'article') {
             $ws->removeExludeArticle($tag_id, $city_id, $page_id, $wgLang->getCode());
         }
         if ($wgRequest->getVal('type') == 'blog') {
             $ws->removeExludeBlog($tag_id, $city_id, $page_id, $wgLang->getCode());
         }
         if ($wgRequest->getVal('type') == 'city') {
             $ws->removeExludeWiki($tag_id, $city_id, $wgLang->getCode());
         }
     }
     $result['response'] = 'ishide';
     $response->addText(json_encode($result));
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:48,代码来源:AutoHubsPagesHelper.class.php

示例9: AjaxResponse

 /**
  Returns colored markup.
 	 
  @return colored markup.
 */
 static function ajax_getColoredText($page_title_raw, $page_id_raw = NULL, $rev_id_raw = NULL)
 {
     global $wgParser, $wgWikiTrustContentServerURL, $wgWikiTrustApiURL, $wgUser;
     global $wgMemc;
     $response = new AjaxResponse("");
     $request_headers = apache_request_headers();
     // Try to use gzip for the content, if possible.
     // Ian - This isn't working with redherring, for some reason.
     if (strstr($request_headers["Accept-Encoding"], "gzip")) {
         //  $response->setContentType("gzip");
     }
     // Can set this to use client side caching, but this can also cause
     // problems.
     // Mark that the content can be cached
     // $response->setCacheDuration(self::TRUST_CACHE_VALID);
     if (!$page_id_raw || !$rev_id_raw) {
         $data = array('action' => 'query', 'prop' => 'revisions', 'titles' => $page_title_raw, 'rvlimit' => '1', 'rvprop' => 'ids', 'format' => 'json');
         $page_info_raw = file_get_contents($wgWikiTrustApiURL . http_build_query($data));
         $page_json = json_decode($page_info_raw, true);
         $pages_arr = array_keys($page_json["query"]["pages"]);
         // Now, parse out only what we need
         if (!$page_id_raw) {
             $page_id_raw = $pages_arr[0];
         }
         if (!$rev_id_raw) {
             $rev_id_raw = $page_json["query"]["pages"][$page_id_raw]["revisions"][0]["revid"];
         }
     }
     $dbr =& wfGetDB(DB_SLAVE);
     $page_id = $dbr->strencode($page_id_raw, $dbr);
     $rev_id = $dbr->strencode($rev_id_raw, $dbr);
     $page_title = $dbr->strencode($page_title_raw, $dbr);
     // Check the If-Modified-Since header.
     // If the timestamp of the requested revision is earlier than the IMS
     // header, return 304 and do nothing further.
     $rev_ts = '19700101000000';
     $res = $dbr->select(self::util_getDbTable('wikitrust_colored_markup'), array('revision_createdon'), array('revision_id' => $rev_id), array());
     if ($res && $dbr->numRows($res) > 0) {
         $row = $dbr->fetchRow($res);
         $rev_ts = $row['revision_createdon'];
         if (!$rev_ts) {
             $rev_ts = '19700101000000';
         }
     }
     $dbr->freeResult($res);
     if ($response->checkLastModified($rev_ts)) {
         return $response;
     }
     // See if we have a cached version of the colored text, or if
     // we need to generate new text.
     $memcKey = wfMemcKey('revisiontext', 'revid', $rev_id);
     $cached_text = $wgMemc->get($memcKey);
     if ($cached_text) {
         $response->addText($cached_text);
         return $response;
     }
     // Since we are here, we need to get the colored HTML the hard way.
     $ctx = stream_context_create(array('http' => array('timeout' => self::TRUST_TIMEOUT)));
     // TODO: Should we do doing this via HTTPS?  Or POST?
     // TODO: in RemoteMode, shouldn't we use local database?
     $colored_raw = file_get_contents($wgWikiTrustContentServerURL . "rev=" . urlencode($rev_id) . "&page=" . urlencode($page_id) . "&page_title=" . urlencode($page_title) . "&time=" . urlencode(wfTimestampNow()) . "&user=0", 0, $ctx);
     if ($colored_raw && $colored_raw != self::NOT_FOUND_TEXT_TOKEN) {
         // Inflate. Pick off the first 10 bytes for python-php conversion.
         $colored_raw = gzinflate(substr($colored_raw, 10));
         // Pick off the median value first.
         $colored_data = explode(",", $colored_raw, 2);
         $colored_text = $colored_data[1];
         if (preg_match("/^[+-]?(([0-9]+)|([0-9]*\\.[0-9]+|[0-9]+\\.[0-9]*)|\n\t\t\t    (([0-9]+|([0-9]*\\.[0-9]+|[0-9]+\\.[0-9]*))[eE][+-]?[0-9]+))\$/", $colored_data[0])) {
             self::$median = $colored_data[0];
             if ($colored_data[0] == 0) {
                 self::$median = self::TRUST_DEFAULT_MEDIAN;
             }
         }
         // First, make sure that there are not any instances of our tokens in the colored_text
         $colored_text = str_replace(self::TRUST_OPEN_TOKEN, "", $colored_text);
         $colored_text = str_replace(self::TRUST_CLOSE_TOKEN, "", $colored_text);
         $colored_text = preg_replace("/'/", "'", $colored_text, -1);
         $colored_text = preg_replace("/&/", "&", $colored_text, -1);
         $colored_text = preg_replace("/</", self::TRUST_OPEN_TOKEN, $colored_text, -1);
         $colored_text = preg_replace("/>/", self::TRUST_CLOSE_TOKEN, $colored_text, -1);
         $title = Title::newFromText($page_title);
         $options = ParserOptions::newFromUser($wgUser);
         $parsed = $wgParser->parse($colored_text, $title, $options);
         $text = $parsed->getText();
         $count = 0;
         // Update the trust tags
         $text = preg_replace_callback("/\\{\\{#t:(\\d+),(\\d+),(.*?)\\}\\}/", "WikiTrust::color_handleParserRe", $text, -1, $count);
         // Update open, close, images, and links.
         $text = preg_replace('/' . self::TRUST_OPEN_TOKEN . '/', "<", $text, -1, $count);
         // Regex broken for some pages.
         // Removing for now.
         /**
               $text = preg_replace('/<a href="(.*?)(File):(.*?)" (.*?)>/'
         			   , self::TRUST_OPEN_TOKEN, $text, -1, $count);
               $text = preg_replace('/<a href="(.*?)(Image):(.*?)" (.*?)>/'
//.........这里部分代码省略.........
开发者ID:xzhao314,项目名称:WikiTrust,代码行数:101,代码来源:RemoteMode.php

示例10: wfWikiTrustDebug

 /**
  Returns colored markup.
 	 
  @return colored markup.
 */
 static function ajax_getColoredText($page_title, $page_id = 0, $rev_id = 0)
 {
     global $wgTitle, $wgMemc;
     wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . ": ajax_getColoredText({$page_title}, {$page_id}, {$rev_id})");
     wfLoadExtensionMessages('WikiTrust');
     list($page_title, $page_id, $rev_id) = self::util_ResolveRevSpec($page_title, $page_id, $rev_id);
     wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . ": computed=({$page_title}, {$page_id}, {$rev_id})");
     // See if we have a cached version of the colored text, or if
     // we need to generate new text.
     $memcKey = wfMemcKey('revisiontext', 'revid', $rev_id);
     $cached_text = $wgMemc->get($memcKey);
     if ($cached_text) {
         wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . " {$rev_id}: using cached text.");
         $response = new AjaxResponse("");
         $response->addText($cached_text);
         return $response;
     }
     wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . " {$memcKey}: not cached.");
     try {
         $colored_text = WikiTrust::color_getColorData($page_title, $page_id, $rev_id);
         self::color_fixup($colored_text);
     } catch (Exception $e) {
         wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . ": exception caught: " . $e->getMessage());
     }
     $text = '';
     if (!$colored_text) {
         wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . " {$rev_id}: colored text not found.");
         // text not found.
         global $wgUser, $wgParser, $wgTitle;
         $options = ParserOptions::newFromUser($wgUser);
         $msg = $wgParser->parse(wfMsgNoTrans("wgNoTrustExplanation"), $wgTitle, $options);
         $text = $msg->getText() . $text;
     } else {
         self::color_Wiki2Html($colored_text, $text, $rev_id);
         self::vote_showButton($text);
         self::color_addTracker($text);
         // Save the finished text in the cache.
         $wgMemc->set($memcKey, $text);
         wfWikiTrustDebug(__FILE__ . ":" . __LINE__ . " {$memcKey}: saving to cache. ");
     }
     return new AjaxResponse($text);
 }
开发者ID:xzhao314,项目名称:WikiTrust,代码行数:47,代码来源:WikiTrustBase.php

示例11: showAll

 /**
  * showAll -- ajax function to show all feeds on follow list
  *
  * @static
  * @access public
  *
  *
  * @return bool
  */
 public static function showAll()
 {
     global $wgRequest, $wgUser, $wgExternalSharedDB, $wgWikiaEnableConfirmEditExt;
     wfProfileIn(__METHOD__);
     $user_id = $wgRequest->getVal('user_id');
     $head = $wgRequest->getVal('head');
     $from = $wgRequest->getVal('from');
     $response = new AjaxResponse();
     $user = User::newFromId($user_id);
     if (empty($user) || $user->getOption('hidefollowedpages')) {
         if ($user->getId() != $wgUser->getId()) {
             $response->addText(wfMsg('wikiafollowedpages-special-hidden'));
             return $response;
         }
     }
     $template = new EasyTemplate(dirname(__FILE__) . '/templates/');
     $template->set_vars(array("data" => FollowModel::getWatchList($user_id, $from, FollowModel::$ajaxListLimit, $head), "owner" => $wgUser->getId() == $user_id, "user_id" => $user_id, "more" => true));
     $text = $template->render("followedPages");
     $response->addText($text);
     wfProfileOut(__METHOD__);
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:31,代码来源:FollowHelper.class.php

示例12: createUserLogin

function createUserLogin()
{
    global $wgRequest, $wgUser, $wgExternalSharedDB, $wgWikiaEnableConfirmEditExt, $wgEnableCOPPA, $wgDefaultSkin;
    // Init session if necessary
    if (session_id() == '') {
        wfSetupSession();
    }
    $response = new AjaxResponse();
    $response->setCacheDuration(3600 * 24 * 365);
    if (!(($wgRequest->getCheck("wpCreateaccountMail") || $wgRequest->getCheck("wpCreateaccount")) && $wgRequest->wasPosted())) {
        $response->addText(json_encode(array('status' => "ERROR", 'msg' => wfMsgExt('comboajaxlogin-post-not-understood', array('parseinline')), 'type' => 'error')));
        return $response;
    }
    if ($wgRequest->getVal('type', '') == '') {
        $wgRequest->setVal('type', 'signup');
    }
    $form = new AjaxLoginForm($wgRequest);
    $form->load();
    if ($wgEnableCOPPA && !$form->checkDate()) {
        // If the users is too young to legally register.
        $response->addText(json_encode(array('status' => "ERROR", 'msg' => wfMsg('userlogin-unable-info'), 'type' => 'error')));
        return $response;
    }
    $dbw = wfGetDB(DB_MASTER, array(), $wgExternalSharedDB);
    $dbl = wfGetDB(DB_MASTER);
    $dbw->begin();
    $dbl->begin();
    $form->execute('signup');
    $dbw->commit();
    $dbl->commit();
    if ($form->msgtype == "error") {
        if (!$wgWikiaEnableConfirmEditExt) {
            /*theoretically impossible because the only possible error is captcha error*/
            $response->addText(json_encode(array('status' => "ERROR", 'msg' => $form->msg, 'type' => $form->msgtype, 'captchaUrl' => '', 'captcha' => '')));
            return $response;
        }
        $captchaObj = new FancyCaptcha();
        $captcha = $captchaObj->pickImage();
        $captchaIndex = $captchaObj->storeCaptcha($captcha);
        $titleObj = SpecialPage::getTitleFor('Captcha/image');
        $captchaUrl = $titleObj->getLocalUrl('wpCaptchaId=' . urlencode($captchaIndex));
        $response->addText(json_encode(array('status' => "ERROR", 'msg' => $form->msg, 'type' => $form->msgtype, 'captchaUrl' => $captchaUrl, 'captcha' => $captchaIndex)));
        return $response;
    }
    $response->addText(json_encode(array('status' => "OK")));
    return $response;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:47,代码来源:ComboAjaxLogin.php

示例13: efPonyDocsAjaxCloneExternalTopic

/**
 * This is used when an author wants to CLONE a title from outside the Documentation namespace into a
 * title within it.  We must be passed the title of the original/source topic and then the destination
 * title which should be a full form PONYDOCS_DOCUMENTATION_NAMESPACE_NAME . ':<manual>:<topicName>:<version>'
 * which it will then tag with the supplied version and strip out any other Category tags (since they are
 * invalid in the Documentation namespace unless a DEFINED version).
 *
 * This will return an AjaxResponse object which MAY contain an error in the case the version is not
 * valid or the topic already exists (destination).
 *
 * @FIXME:  Should validate version is defined.
 *
 * @param string $topic Title of topic to clone.
 * @param string $destTitle Title of destination topic.
 * @return AjaxResponse
 */
function efPonyDocsAjaxCloneExternalTopic($topic, $destTitle)
{
    $response = new AjaxResponse();
    $response->setCacheDuration(false);
    $pieces = split(':', $destTitle);
    if (sizeof($pieces) < 4 || strcasecmp($pieces[0], PONYDOCS_DOCUMENTATION_NAMESPACE_NAME) != 0) {
        $response->addText('Destination title is not valid.');
        return $response;
    }
    if (!PonyDocsManual::IsManual($pieces[1])) {
        $response->addText('Destination title references an invalid manual.');
        return $response;
    }
    if (!PonyDocsVersion::IsVersion($pieces[3])) {
        $response->addText('Destination title references an undefined version.');
        return $response;
    }
    $destArticle = new Article(Title::newFromText($destTitle));
    if ($destArticle->exists()) {
        $response->addText('Destination title already exists.');
        return $response;
    }
    $article = new Article(Title::newFromText($topic));
    if (!$article->exists()) {
        $response->addText('Source article could not be found.');
        return $response;
    }
    $content = $article->getContent();
    //$content = preg_replace( '/\[\[
    return $response;
}
开发者ID:Velody,项目名称:ponydocs,代码行数:47,代码来源:PonyDocsAjax.php

示例14: wfAjaxPostCollection

function wfAjaxPostCollection($collection = '', $redirect = '')
{
    $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
    if (session_id() == '') {
        wfSetupSession();
    }
    $collection = $json->decode($collection);
    $collection['enabled'] = true;
    $_SESSION['wsCollection'] = $collection;
    $r = new AjaxResponse();
    if ($redirect) {
        $title = Title::newFromText($redirect);
        $redirecturl = wfExpandUrl($title->getFullURL(), PROTO_CURRENT);
        $r->setResponseCode(302);
        header('Location: ' . $redirecturl);
    } else {
        $title = SpecialPage::getTitleFor('Book');
        $redirecturl = wfExpandUrl($title->getFullURL(), PROTO_CURRENT);
        $r->setContentType('application/json');
        $r->addText($json->encode(array('redirect_url' => $redirecturl)));
    }
    return $r;
}
开发者ID:realsoc,项目名称:mediawiki-extensions,代码行数:23,代码来源:Collection.php

示例15: disconnectFromFB

 public static function disconnectFromFB($user = null)
 {
     $response = new AjaxResponse();
     $response->addText(json_encode(self::coreDisconnectFromFB($user)));
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:6,代码来源:FBConnect.php


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