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


PHP Stack::stack_load_card方法代码示例

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


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

示例1: delete_card

 public static function delete_card($inbound, $outbound)
 {
     Util::keys_required($inbound, array('id', 'card_id'));
     $stack = new Stack(Util::safe_stack_id($inbound['id']), Util::optional($inbound, 'auth_hash'));
     $next_card_id = $stack->stack_delete_card($inbound['card_id']);
     $outbound['card'] = $stack->stack_load_card($next_card_id);
     $outbound['bkgnd'] = $stack->stack_load_bkgnd($outbound['card']['bkgnd_id']);
     return $outbound;
 }
开发者ID:jhawcroft,项目名称:cinsimp-web,代码行数:9,代码来源:gateway.php

示例2: open_stack

 public static function open_stack()
 {
     global $config;
     /* check request variables */
     try {
         Util::check_request_vars(array('stack' => Util::REQUIRED));
     } catch (Exception $err) {
         Util::respond_with_http_error(400, 'Bad Request', 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString());
     }
     /* sanitise input */
     try {
         $parts = explode(';', $_REQUEST['stack']);
         if (count($parts) >= 1) {
             $in_stack = Util::safe_stack_id($parts[0]);
         }
         if (count($parts) >= 2) {
             $in_card = Util::safe_card_ref($parts[1]);
         } else {
             $in_card = null;
         }
         $in_layer_art = '';
         if (count($parts) >= 3) {
             if ($parts[2] == 'card.png') {
                 $in_layer_art = 'card';
             } else {
                 if ($parts[2] == 'bkgnd.png') {
                     $in_layer_art = 'bkgnd';
                 } else {
                     Util::respond_with_http_error(400, 'Bad Request');
                 }
             }
         }
     } catch (Exception $err) {
         Util::respond_with_http_error($err->getCode(), $err->getMessage(), 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString());
     }
     /* check if the input is a directory */
     if ($in_card == null && is_dir($in_stack)) {
         Application::do_dir_list($in_stack);
         exit;
     }
     /* try to open the specified stack and load the specified card */
     $stack_handle = null;
     $stack = null;
     $card = null;
     try {
         $stack_handle = new Stack($in_stack);
         $stack = $stack_handle->stack_load();
         if ($in_card === null) {
             $in_card = $stack_handle->stack_get_first_card_id();
         }
         $card = $stack_handle->stack_load_card($in_card);
         if ($card === null) {
             throw new Exception('Card Not Found', 404);
         }
         if (!$stack_handle) {
             throw new Exception('Stack Not Found', 404);
         }
     } catch (Exception $err) {
         /* there was a problem opening the stack or card;
         			return an appropriate HTTP response */
         $code = $err->getCode();
         $msg = $err->getMessage();
         $extra = '';
         if ($code == 0) {
             $code = 500;
             $msg = 'Internal Application Error';
             $extra = 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString();
         }
         Util::respond_with_http_error($code, $msg, $extra);
         exit;
     }
     /* if a resource has been requested, provide it instead of the card */
     if ($in_layer_art != '') {
         if ($in_layer_art == 'card') {
             Application::layer_art($card, false);
         } else {
             Application::layer_art($card, true);
         }
         exit;
     }
     /* prepare the response for the loaded stack and card */
     Util::response_is_html();
     /* load the basic page template */
     $page = file_get_contents($config->base . 'html/stack.html');
     /* populate the template with the static card and appropriate meta information */
     $page = str_replace('js/', $config->url . 'js/', $page);
     $page = str_replace('icon/', $config->url . 'icon/', $page);
     $page = str_replace('?browser-warning=1', $config->url . '?browser-warning=1', $page);
     $page = str_replace('<!-- INSERT STATIC CARD -->', Application::static_page($stack, $card), $page);
     $page = str_replace('<!-- INSERT META -->', Application::meta($stack, $card), $page);
     /* populate the template with stack and card data sufficient to start the
     		web application environment on the client */
     $one = 1;
     $page = str_replace('/* INSERT PRE-LOAD SCRIPT */', 'var gBase = \'' . $config->url . "';\n" . 'var _g_init_stack = ' . json_encode($stack) . ";\n" . 'var _g_init_card = ' . json_encode($card) . ";\n" . 'var _g_icon_collections = ' . json_encode(Application::list_icon_collections()) . ";", $page, $one);
     /* send the static response page */
     print $page;
 }
开发者ID:Happy-Ferret,项目名称:cinsimp-web,代码行数:97,代码来源:application.php

示例3: open_stack

 public static function open_stack()
 {
     global $config;
     // hack for now...
     $_REQUEST['stack'] = $config->stacks_url . $_REQUEST['stack'];
     /* check request variables */
     try {
         Util::check_request_vars(array('stack' => Util::REQUIRED));
     } catch (Exception $err) {
         Util::respond_with_http_error(400, 'Bad Request', 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString());
     }
     /* sanitise input */
     try {
         $parts = explode(';', $_REQUEST['stack']);
         if (count($parts) >= 1) {
             $in_stack = Util::safe_stack_id($parts[0]);
         }
         if (count($parts) >= 2) {
             $in_card = Util::safe_card_ref($parts[1]);
         } else {
             $in_card = null;
         }
         $in_layer_art = '';
         if (count($parts) >= 3) {
             if ($parts[2] == 'card.png') {
                 $in_layer_art = 'card';
             } else {
                 if ($parts[2] == 'bkgnd.png') {
                     $in_layer_art = 'bkgnd';
                 } else {
                     Util::respond_with_http_error(400, 'Bad Request');
                 }
             }
         }
     } catch (Exception $err) {
         Util::respond_with_http_error($err->getCode(), $err->getMessage(), 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString());
     }
     /* check if the input is a directory */
     if ($in_card == null && is_dir($in_stack)) {
         Application::do_dir_list($in_stack);
         exit;
     }
     /* try to open the specified stack and load the specified card */
     $stack_handle = null;
     $stack = null;
     $card = null;
     $bkgnd = null;
     try {
         $stack_handle = new Stack($in_stack);
         $stack = $stack_handle->stack_load();
         if ($in_card === null) {
             $in_card = $stack_handle->stack_get_nth_card_id(1);
         }
         $card = $stack_handle->stack_load_card($in_card);
         if ($card === null) {
             throw new Exception('Card Not Found', 404);
         }
         $bkgnd = $stack_handle->stack_load_bkgnd($card['bkgnd_id']);
         if (!$stack_handle) {
             throw new Exception('Stack Not Found', 404);
         }
     } catch (Exception $err) {
         /* there was a problem opening the stack or card;
         			return an appropriate HTTP response */
         $code = $err->getCode();
         $msg = $err->getMessage();
         $extra = '';
         if ($code == 0) {
             $code = 500;
             $msg = 'Internal Application Error';
             $extra = 'Error: ' . $err->getMessage() . "\nTrace: " . $err->getTraceAsString();
         }
         Util::respond_with_http_error($code, $msg, $extra);
         exit;
     }
     /* if a resource has been requested, provide it instead of the card */
     if ($in_layer_art != '') {
         if ($in_layer_art == 'card') {
             Application::layer_art($card, false);
         } else {
             Application::layer_art($card, true);
         }
         exit;
     }
     /* prepare the response for the loaded stack and card */
     Util::response_is_html();
     /* load the basic page template */
     $page = file_get_contents($config->base . 'html/stack.html');
     /* populate the template with the static card and appropriate meta information */
     $page = str_replace('js/', $config->url . 'js/', $page);
     $page = str_replace('icon/', $config->url . 'icon/', $page);
     $page = str_replace('?browser-warning=1', $config->url . '?browser-warning=1', $page);
     $page = str_replace('<!-- INSERT STATIC CARD -->', Application::static_page($stack, $card), $page);
     $page = str_replace('<!-- INSERT META -->', Application::meta($stack, $card), $page);
     /* compute the stack URL */
     //$stack['url'] = substr($stack['path'], strlen($config->url . 'stacks/'));
     /* populate the template with stack and card data sufficient to start the
     		web application environment on the client */
     $one = 1;
     $client_param_block = array('base' => $config->url, 'icon_collections' => Application::list_icon_collections(), 'plugin_commands' => Plugin::get_commands_list(), 'stack' => $stack, 'card' => $card, 'bkgnd' => $bkgnd);
//.........这里部分代码省略.........
开发者ID:jhawcroft,项目名称:cinsimp-web,代码行数:101,代码来源:application.php

示例4: load_card

 public static function load_card($inbound, $outbound)
 {
     $stack = new Stack(Util::safe_stack_id($inbound['stack_id']));
     if (isset($inbound['stack_num'])) {
         $inbound['card_id'] = $stack->stack_get_nth_card_id($inbound['stack_num']);
     }
     $outbound['card'] = $stack->stack_load_card($inbound['card_id']);
     return $outbound;
 }
开发者ID:Happy-Ferret,项目名称:cinsimp-web,代码行数:9,代码来源:gateway.php


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