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


PHP AjaxResponse::setContentType方法代码示例

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


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

示例1: setHubsFeedsVariable

 static function setHubsFeedsVariable()
 {
     global $wgRequest, $wgCityId, $wgMemc, $wgUser;
     wfProfileIn(__METHOD__);
     if (!$wgUser->isAllowed('corporatepagemanager')) {
         $result['response'] = 'error';
     } else {
         $result = array('response' => 'ok');
         $tagname = $wgRequest->getVal('tag');
         $feedname = strtolower($wgRequest->getVal('feed'));
         $key = wfMemcKey('autohubs', $tagname, 'feeds_displayed');
         $oldtags = self::getHubsFeedsVariable($tagname);
         $oldtags[$tagname][$feedname] = !$oldtags[$tagname][$feedname];
         $result['disabled'] = $oldtags[$tagname][$feedname];
         if (!WikiFactory::setVarByName('wgWikiaAutoHubsFeedsDisplayed', $wgCityId, $oldtags)) {
             $result['response'] = 'error';
         } else {
             $wgMemc->delete($key);
         }
     }
     $json = json_encode($result);
     $response = new AjaxResponse($json);
     $response->setCacheDuration(0);
     $response->setContentType('text/plain; charset=utf-8');
     wfProfileOut(__METHOD__);
     return $response;
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:27,代码来源:AutoHubsPagesHelper.class.php

示例2: saveOrder

 function saveOrder($xmlsd)
 {
     global $reporterOrderTable, $readerOrderTable, $editorOrderTable;
     $response = new AjaxResponse();
     $response->setContentType('text/plain');
     $xmlstr = '' . html_entity_decode($xmlsd);
     $dbr =& wfGetDB(DB_WRITE);
     $xml = new SimpleXMLElement($xmlstr);
     //delete all in table
     $result = $dbr->delete($editorOrderTable, "*");
     $result = $dbr->delete($readerOrderTable, "*");
     $result = $dbr->delete($reporterOrderTable, "*");
     foreach ($xml->children() as $child) {
         if ($child->getName() == 'Editor') {
             $sql = 'INSERT INTO ' . $editorOrderTable . ' (id, rank) VALUES (' . $child['id'] . ',' . $child['rank'] . ')';
             $result = $dbr->query($sql);
         } elseif ($child->getName() == 'Reader') {
             $sql = 'INSERT INTO ' . $readerOrderTable . ' (id, rank) VALUES (' . $child['id'] . ',' . $child['rank'] . ')';
             $result = $dbr->query($sql);
         } elseif ($child->getName() == 'Reporter') {
             $sql = 'INSERT INTO ' . $reporterOrderTable . ' (id, rank) VALUES (' . $child['id'] . ',' . $child['rank'] . ')';
             $result = $dbr->query($sql);
         }
     }
     $response->addtext("Changes Saved");
     return $response;
 }
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:27,代码来源:MV_Staff.php

示例3: GetComboAjaxLogin

/**
 * Returns an AjaxResponse containing the combo ajax login/register code.
 */
function GetComboAjaxLogin()
{
    $tmpl = AjaxLoginForm::getTemplateForCombinedForms();
    $response = new AjaxResponse($tmpl->render('ComboAjaxLogin'));
    $response->setContentType('text/html; charset=utf-8');
    return $response;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:10,代码来源:ComboAjaxLogin.php

示例4: smwf_ws_callEQIXML

function smwf_ws_callEQIXML($query)
{
    global $IP;
    require_once $IP . '/extensions/SMWHalo/includes/webservices/SMW_EQI.php';
    $result = new AjaxResponse(query($query, "xml"));
    $result->setContentType("application/xml");
    return $result;
}
开发者ID:seedbank,项目名称:old-repo,代码行数:8,代码来源:SMW_WebInterfaces.php

示例5: getLinkSuggestImage

function getLinkSuggestImage()
{
    global $wgRequest;
    wfProfileIn(__METHOD__);
    $res = LinkSuggest::getLinkSuggestImage($wgRequest->getText('imageName'));
    $ar = new AjaxResponse($res);
    $ar->setCacheDuration(60 * 60);
    $ar->setContentType('text/plain; charset=utf-8');
    wfProfileOut(__METHOD__);
    return $ar;
}
开发者ID:yusufchang,项目名称:app,代码行数:11,代码来源:LinkSuggest.php

示例6: RecipesTemplateAjax

function RecipesTemplateAjax()
{
    global $wgRequest;
    $method = $wgRequest->getVal('method', false);
    if (method_exists('RecipesTemplateAjax', $method)) {
        $data = RecipesTemplateAjax::$method();
        $json = json_encode($data);
        $response = new AjaxResponse($json);
        $response->setContentType('application/json; charset=utf-8');
        return $response;
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:12,代码来源:RecipesTemplate_setup.php

示例7: VET

function VET()
{
    global $wgRequest;
    $method = $wgRequest->getVal('method');
    $vet = new VideoEmbedTool();
    $html = $vet->{$method}();
    $domain = $wgRequest->getVal('domain', null);
    if (!empty($domain)) {
        $html .= '<script type="text/javascript">document.domain = "' . $domain . '"</script>';
    }
    $resp = new AjaxResponse($html);
    $resp->setContentType('text/html');
    return $resp;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:VideoEmbedTool_setup.php

示例8: MyHomeAjax

function MyHomeAjax()
{
    global $wgRequest;
    $method = $wgRequest->getVal('method', false);
    if (method_exists('MyHomeAjax', $method)) {
        wfProfileIn(__METHOD__);
        $data = MyHomeAjax::$method();
        $json = json_encode($data);
        $response = new AjaxResponse($json);
        $response->setContentType('application/json; charset=utf-8');
        wfProfileOut(__METHOD__);
        return $response;
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:14,代码来源:MyHome.php

示例9: WMU

function WMU()
{
    global $wgRequest, $wgGroupPermissions, $wgAllowCopyUploads;
    // Overwrite configuration settings needed by image import functionality
    $wgAllowCopyUploads = true;
    $wgGroupPermissions['user']['upload_by_url'] = true;
    $dir = dirname(__FILE__) . '/';
    require_once $dir . 'WikiaMiniUpload_body.php';
    $method = $wgRequest->getVal('method');
    $wmu = new WikiaMiniUpload();
    $html = $wmu->{$method}();
    $ar = new AjaxResponse($html);
    $ar->setContentType('text/html; charset=utf-8');
    return $ar;
}
开发者ID:schwarer2006,项目名称:wikia,代码行数:15,代码来源:WikiaMiniUpload_setup.php

示例10: HomePageListAjax

function HomePageListAjax()
{
    global $wgRequest;
    $method = $wgRequest->getVal("method", false);
    if (method_exists("HomePageList", $method)) {
        $data = HomePageList::$method(true);
        if (is_array($data)) {
            $json = json_encode($data);
            $response = new AjaxResponse($json);
            $response->setContentType("application/json; charset=utf-8");
        } else {
            $response = new AjaxResponse($data);
            $response->setContentType("text/html; charset=utf-8");
        }
        return $response;
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:17,代码来源:HomePageList.php

示例11: smwf_qc_updateQuery

function smwf_qc_updateQuery($paramAsJSON)
{
    global $smwgQRCEnabled;
    if (!$smwgQRCEnabled) {
        $response['success'] = true;
    } else {
        $paramObj = json_decode($paramAsJSON);
        @($queryId = $paramObj->queryId);
        @($debug = $paramObj->debug);
        $qrc = new SMWQRCQueryResultsCache();
        $response['success'] = $qrc->updateQueryResult($queryId);
    }
    $response = json_encode($response);
    if (!$debug) {
        $response = new AjaxResponse($response);
        $response->setContentType("application/json");
    }
    return $response;
}
开发者ID:seedbank,项目名称:old-repo,代码行数:19,代码来源:SMW_QRC_AjaxAPI.php

示例12: wfGetDB

 function get_assigned($sitting_id)
 {
     global $reportersTable, $sitting_reporter;
     $dbr =& wfGetDB(DB_SLAVE);
     //$sql = 'SELECT * FROM '.$reportersTable.' WHERE id IN ( SELECT reporter_id FROM '.$sitting_reporter.' WHERE sitting_id='.$sitting_id.')';
     $sql = 'SELECT ug_user FROM user_groups WHERE ug_user IN (SELECT user_id FROM sitting_assignment WHERE sitting_id=' . $sitting_id . ') and ug_group="reporter"';
     $reporters = $dbr->query($sql);
     $xml = new AjaxResponse();
     $xml->setContentType('text/xml');
     $xml->addtext('<' . '?xml version="1.0" encoding="utf-8" ?' . ">");
     $xml->addtext('<Response>' . "");
     while ($rowReporters = $dbr->fetchobject($reporters)) {
         $user = User::newFromId($rowReporters->ug_user);
         $name = $user->getRealName();
         $xml->addtext('<Reporter id="' . $rowReporters->ug_user . '" name="' . $name . '">');
         $xml->addtext('</Reporter>');
     }
     $xml->addtext('</Response>');
     return $xml;
 }
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:20,代码来源:MV_Reporters.php

示例13: save

 function save($xmlstr)
 {
     global $reportersAssignmentTable;
     $response = new AjaxResponse();
     $response->setContentType('text/plain');
     $xmlsd = "" . html_entity_decode($xmlstr);
     $dbr =& wfGetDB(DB_WRITE);
     $xml = new SimpleXMLElement($xmlsd);
     $result = $dbr->delete($reportersAssignmentTable, "*");
     foreach ($xml->children() as $reader) {
         $reader_id = $reader['id'];
         foreach ($ed->children() as $reporter) {
             $reporter_id = $reporter['id'];
             $sql2 = 'INSERT INTO ' . $reportersAssignmentTable . ' (reader_id, reporter_id) VALUES (' . $reader_id . ',' . $reporter_id . ')';
             $result = $dbr->query($sql2);
         }
     }
     $response->addtext("Changes Saved");
     return $response;
 }
开发者ID:BenoitTalbot,项目名称:bungeni-portal,代码行数:20,代码来源:MV_Readers.php

示例14: RTEAjax

function RTEAjax()
{
    wfProfileIn(__METHOD__);
    global $wgRequest;
    $ret = false;
    $method = $wgRequest->getVal('method', false);
    if ($method && method_exists('RTEAjax', $method)) {
        $data = RTEAjax::$method();
        if (is_array($data)) {
            $json = json_encode($data);
            $response = new AjaxResponse($json);
            $response->setContentType('application/json; charset=utf-8');
            $ret = $response;
        } else {
            $ret = $data;
        }
    }
    wfProfileOut(__METHOD__);
    return $ret;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:20,代码来源:RTE_setup.php

示例15: CrunchyrollAjax

function CrunchyrollAjax()
{
    global $wgRequest;
    wfProfileIn(__METHOD__);
    $method = $wgRequest->getVal('method', false);
    if (method_exists('CrunchyrollAjax', $method)) {
        $data = CrunchyrollAjax::$method();
        if (is_array($data)) {
            // send array as JSON
            $json = json_encode($data);
            $response = new AjaxResponse($json);
            $response->setContentType('application/json; charset=utf-8');
        } else {
            // send text as text/html
            $response = new AjaxResponse($data);
            $response->setContentType('text/html; charset=utf-8');
        }
    }
    wfProfileOut(__METHOD__);
    return $response;
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:21,代码来源:Crunchyroll_setup.php


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