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


PHP SC::jsonify方法代码示例

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


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

示例1: jsonify

 public function jsonify($callback = null)
 {
     $fields = array("from", "author", "subject", "body", "to", "bcc", "header");
     $props = array();
     foreach ($fields as $id => $field) {
         $props[$field] = $this->{$field};
     }
     return SC::jsonify($props, $callback);
 }
开发者ID:jeffreytierney,项目名称:switchcomb,代码行数:9,代码来源:SCEmail.php

示例2: handleResponse

 public function handleResponse($resp, $methodname)
 {
     $content_type = $this->getResponseContentType();
     switch ($content_type) {
         case "html":
             $partial = $this->{$methodname}(array("__partial" => true));
             if ($partial) {
                 $partial_name = $partial["partial"];
                 if (isset($partial["val"])) {
                     $resp = array($partial["val"] => $resp);
                 }
                 return SCPartial::renderToString($partial_name, $resp);
             }
             throw new APIException("There is no html associated with this.", 400);
             break;
         case "json":
             return SC::jsonify(SC::toArrayAll($resp));
             break;
     }
 }
开发者ID:jeffreytierney,项目名称:switchcomb,代码行数:20,代码来源:SCApi.php

示例3: show

 public function show()
 {
     SC::loginRequired();
     $api = new SCApi();
     $vars = $api->boards_show();
     // $board & $view_counts
     switch ($_GET["__content_type"]) {
         case "json":
             if ($_GET["since"]) {
                 $output = array("content" => SCPartial::renderToString("board/board_threads", $vars));
             } else {
                 $output = array("threads" => $vars["board"]->threads());
             }
             echo SC::jsonify($output);
             break;
         case "html":
         default:
             $cs = array("title" => htmlspecialchars($vars["board"]->boardname), "util_links" => SCPartial::renderToString("board/util_links", $vars), "content" => SCPartial::renderToString("board/board", $vars));
             SCLayout::render("main", $vars, $cs);
     }
 }
开发者ID:jeffreytierney,项目名称:switchcomb,代码行数:21,代码来源:boards.php

示例4: create

 public function create()
 {
     SC::loginRequired();
     global $current_user;
     switch ($_GET["__content_type"]) {
         case "json":
             $api = new SCApi();
             $thread = $api->boards_threads_create();
             $output = array("transfer" => SCRoutes::set("threads", "show", array("boardid" => $thread->boardid, "threadid" => $thread->messageid)));
             echo SC::jsonify($output);
             break;
         case "html":
         default:
             try {
                 $api = new SCApi();
                 $thread = $api->boards_threads_create();
                 SC::transfer(SCRoutes::set("threads", "show", array("boardid" => $thread->boardid, "threadid" => $thread->messageid)));
             } catch (Exception $ex) {
                 SC::setFlashMessage($ex->getMessage(), "error");
                 $this->_new();
             }
     }
 }
开发者ID:jeffreytierney,项目名称:switchcomb,代码行数:23,代码来源:threads.php

示例5: jsonify

 public function jsonify($callback = false)
 {
     $props = $this->toArray();
     return SC::jsonify($props, $callback);
 }
开发者ID:jeffreytierney,项目名称:switchcomb,代码行数:5,代码来源:SCBase.php


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