本文整理汇总了PHP中Context::setResponseMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP Context::setResponseMethod方法的具体用法?PHP Context::setResponseMethod怎么用?PHP Context::setResponseMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::setResponseMethod方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: procFileUpload
/**
* Upload attachments in the editor
*
* Determine the upload target srl from editor_sequence and uploadTargetSrl variables.
* Create and return the UploadTargetSrl if not exists so that UI can use the value
* for sync.
*
* @return void
*/
function procFileUpload()
{
Context::setRequestMethod('JSON');
$file_info = $_FILES['Filedata'];
// An error appears if not a normally uploaded file
if (!is_uploaded_file($file_info['tmp_name'])) {
exit;
}
// Basic variables setting
$oFileModel = getModel('file');
$editor_sequence = Context::get('editor_sequence');
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
if (!$upload_target_srl) {
$upload_target_srl = intval(Context::get('upload_target_srl'));
}
$module_srl = $this->module_srl;
// Exit a session if there is neither upload permission nor information
if (!$_SESSION['upload_info'][$editor_sequence]->enabled) {
exit;
}
// Extract from session information if upload_target_srl is not specified
if (!$upload_target_srl) {
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
}
// Create if upload_target_srl is not defined in the session information
if (!$upload_target_srl) {
$_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
}
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
Context::setResponseMethod('JSON');
if ($output->error != '0') {
$this->stop($output->message);
}
}
示例2: dispPageIndex
/**
* @brief Page information
*/
function dispPageIndex(&$oModule)
{
$page_content = Context::get('page_content');
$oWidgetController = getController('widget');
$requestMethod = Context::getRequestMethod();
Context::setResponseMethod('HTML');
$oWidgetController->triggerWidgetCompile($page_content);
Context::setResponseMethod($requestMethod);
$oModule->add('page_content', $page_content);
}
示例3: testRequsetResponseMethod
public function testRequsetResponseMethod()
{
$this->assertEquals(Context::getRequestMethod(), 'GET');
$_SERVER['REQUEST_METHOD'] = 'POST';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'POST');
$GLOBALS['HTTP_RAW_POST_DATA'] = 'abcde';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'XMLRPC');
$_SERVER['CONTENT_TYPE'] = 'application/json';
Context::setRequestMethod();
$this->assertEquals(Context::getRequestMethod(), 'JSON');
Context::setRequestMethod('POST');
$this->assertEquals(Context::getRequestMethod(), 'POST');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
Context::setRequestMethod('JSON');
$this->assertEquals(Context::getResponseMethod(), 'JSON');
Context::setResponseMethod('WRONG_TYPE');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
Context::setResponseMethod('XMLRPC');
$this->assertEquals(Context::getResponseMethod(), 'XMLRPC');
Context::setResponseMethod('HTML');
$this->assertEquals(Context::getResponseMethod(), 'HTML');
}
示例4: dispLivexeMyFeedsOPML
function dispLivexeMyFeedsOPML()
{
if (Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
Context::set('myname', $logged_info->nick_name);
$rss_args->module_srl = $this->module_srl;
$rss_args->member_srl = $logged_info->member_srl;
$output = executeQueryArray('livexe.getRssListWithoutNav', $rss_args);
Context::set('my_feed_list', $output->data);
} else {
return $this->dispLivexeContent();
}
$this->setTemplatePath($this->module_path . 'tpl/');
$this->setTemplateFile('opml');
Context::setResponseMethod("XMLRPC");
}
示例5: rss
//.........这里部分代码省略.........
$oModuleController->replaceDefinedLangCode($info->title);
$info->title = str_replace('\'', ''', $info->title);
if ($config->feed_description) {
$info->description = str_replace('\'', ''', htmlspecialchars($config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
} else {
$info->description = str_replace('\'', ''', htmlspecialchars($this->module_info->description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
$info->link = getUrl('', 'mid', $mid);
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($feed_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
if (!$info->feed_copyright) {
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
}
}
}
if (!$info->title) {
if ($rss_title) {
$info->title = $rss_title;
} else {
if ($total_config->feed_title) {
$info->title = $total_config->feed_title;
} else {
$site_module_info = Context::get('site_module_info');
$info->title = $site_module_info->browser_title;
}
}
$oModuleController->replaceDefinedLangCode($info->title);
$info->title = str_replace('\'', ''', htmlspecialchars($info->title, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$info->description = str_replace('\'', ''', htmlspecialchars($total_config->feed_description, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
$info->link = Context::getRequestUri();
$info->feed_copyright = str_replace('\'', ''', htmlspecialchars($total_config->feed_copyright, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
if ($add_description) {
$info->description .= "\r\n" . $add_description;
}
if ($total_config->image) {
$info->image = Context::getRequestUri() . str_replace('\'', ''', htmlspecialchars($total_config->image, ENT_COMPAT | ENT_HTML401, 'UTF-8', false));
}
switch (Context::get('format')) {
case 'atom':
$info->date = date('Y-m-d\\TH:i:sP');
if ($mid) {
$info->id = getUrl('', 'mid', $mid, 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date'));
} else {
$info->id = getUrl('', 'module', 'rss', 'act', 'atom', 'page', Context::get('page'), 'start_date', Context::get('start_date'), 'end_date', Context::get('end_date'));
}
break;
case 'rss1.0':
$info->date = date('Y-m-d\\TH:i:sP');
break;
default:
$info->date = date("D, d M Y H:i:s") . ' ' . $GLOBALS['_time_zone'];
break;
}
if ($_SERVER['HTTPS'] == 'on') {
$proctcl = 'https://';
} else {
$proctcl = 'http://';
}
$temp_link = explode('/', $info->link);
if ($temp_link[0] == '' && $info->link) {
$info->link = $proctcl . $_SERVER['HTTP_HOST'] . $info->link;
}
$temp_id = explode('/', $info->id);
if ($temp_id[0] == '' && $info->id) {
$info->id = $proctcl . $_SERVER['HTTP_HOST'] . $info->id;
}
$info->language = str_replace('jp', 'ja', Context::getLangType());
// Set the variables used in the RSS output
Context::set('info', $info);
Context::set('feed_config', $config);
Context::set('open_rss_config', $open_rss_config);
Context::set('document_list', $document_list);
// Force the result output to be of XMLRPC
Context::setResponseMethod("XMLRPC");
// Perform the preprocessing function of the editor component as the results are obtained
$path = $this->module_path . 'tpl/';
//if($args->start_date || $args->end_date) $file = 'xe_rss';
//else $file = 'rss20';
switch (Context::get('format')) {
case 'xe':
$file = 'xe_rss';
break;
case 'atom':
$file = 'atom10';
break;
case 'rss1.0':
$file = 'rss10';
break;
default:
$file = 'rss20';
break;
}
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($path, $file);
Context::set('content', $content);
// Set the template file
$this->setTemplatePath($path);
$this->setTemplateFile('display');
}
示例6: getSyndicationList
//.........这里部分代码省略.........
$next_url = Context::get('articles')->next_url;
break;
case 'deleted':
// 문서 전체를 신디케이션에서 삭제
Context::set('deleted', $this->getArticles($module_srl, $page, $startTime, $endTime, 'deleted', $site_info->id));
$next_url = Context::get('deleted')->next_url;
break;
default:
$this->setTemplateFile('site.info');
break;
}
// 다음 페이지가 있다면 다시 신디케이션 호출
if ($next_url) {
$oSyndicationController = getController('syndication');
$oSyndicationController->ping(Context::get('id'), Context::get('type'), ++$page);
}
break;
case 'channel':
$channel_info = new stdClass();
$channel_info->id = $this->getID('channel', $module_info->module_srl);
$channel_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl);
$channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl);
$channel_info->updated = date("Y-m-d\\TH:i:s") . $time_zone;
$channel_info->self_href = $this->getSelfHref($channel_info->id, $type);
$channel_info->alternative_href = $this->getAlternativeHref($module_info);
$channel_info->summary = $module_info->description;
if ($module_info->module == "textyle") {
$channel_info->type = "blog";
$channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss');
} else {
$channel_info->type = "web";
}
$except_module_srls = $this->getExceptModuleSrls();
if ($except_module_srls) {
$args->except_modules = implode(',', $except_module_srls);
}
$output = executeQuery('syndication.getSiteUpdatedTime', $args);
if ($output->data) {
$channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)) . $time_zone;
}
Context::set('channel_info', $channel_info);
$this->setTemplateFile('channel');
switch ($type) {
case 'article':
Context::set('articles', $this->getArticles($module_srl, $page, $startTime, $endTime, 'article', $channel_info->id));
break;
case 'deleted':
Context::set('deleted', $this->getDeleted($module_srl, $page, $startTime, $endTime, 'deleted', $channel_info->id));
break;
default:
$this->setTemplateFile('channel.info');
break;
}
break;
case 'article':
$channel_info = new stdClass();
$channel_info->id = $this->getID('channel', $module_info->module_srl);
$channel_info->site_title = $this->handleLang($site_module_info->browser_title, $site_module_info->site_srl);
$channel_info->title = $this->handleLang($module_info->browser_title, $module_info->site_srl);
$channel_info->updated = date("Y-m-d\\TH:i:s") . $time_zone;
$channel_info->self_href = $this->getSelfHref($channel_info->id, $type);
$channel_info->alternative_href = $this->getAlternativeHref($module_info);
$channel_info->summary = $module_info->description;
if ($module_info->module == "textyle") {
$channel_info->type = "blog";
$channel_info->rss_href = getFullSiteUrl($module_info->domain, '', 'mid', $module_info->mid, 'act', 'rss');
} else {
$channel_info->type = "web";
}
$except_module_srls = $this->getExceptModuleSrls();
if ($except_module_srls) {
$args->except_modules = implode(',', $except_module_srls);
}
$output = executeQuery('syndication.getSiteUpdatedTime', $args);
if ($output->data) {
$channel_info->updated = date("Y-m-d\\TH:i:s", ztime($output->data->last_update)) . $time_zone;
}
Context::set('channel_info', $channel_info);
$this->setTemplateFile('channel');
switch ($type) {
case "article":
$articles = new stdClass();
$articles->list = array($this->getArticle($document_srl));
Context::set('articles', $articles);
break;
case "deleted":
$deleted = new stdClass();
$deleted->list = $this->getDeletedByDocumentSrl($document_srl);
Context::set('deleted', $deleted);
break;
}
break;
}
} else {
Context::set('message', $error);
$this->setTemplateFile('error');
}
$this->setTemplatePath($this->module_path . 'tpl');
Context::setResponseMethod('XMLRPC');
}
示例7: procPlanetInsertSMS
/**
* @brief SMS를 받는다
*
**/
function procPlanetInsertSMS()
{
$phone_number = Context::get('phone_number');
$message = Context::get('message');
$message = Context::convertEncodingStr($message);
//@골뱅이를 빼자
if (substr($message, 0, 1) == '@') {
$message = substr($message, 1);
}
$args->phone_number = $phone_number;
$oPlanetModel =& getModel('planet');
$output = $oPlanetModel->getSMSUser($args);
// SMS 사용자가 있으면 해당 planet에 등록
if ($output->data) {
$args->content = $message;
$args->module_srl = $output->data->module_srl;
$args->member_srl = $output->data->member_srl;
$oMemberModel =& getModel('member');
$output = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
$args->user_id = $output->user_id;
$args->user_name = $output->user_name;
$args->nick_name = $output->nick_name;
$args->email_address = $output->email_address;
$args->homepage = $output->homepage;
$module_info = $oPlanetModel->getPlanetConfig();
$args->tags = join(',', $module_info->smstag);
$manual_inserted = true;
$output = $this->insertContent($args, $manual_inserted);
} else {
// SMS 사용자가 아니라면 planet_sms_resv에 쌓는다
$output = $this->insertSMSRecv($phone_number, $message);
}
if ($output->toBool()) {
header("X-SMSMORESPONSE:0");
} else {
header("X-SMSMORESPONSE:1");
}
// response를 XMLRPC로 변환
Context::setResponseMethod('XMLRPC');
return $output;
}