當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stack::stack_inject_card方法代碼示例

本文整理匯總了PHP中Stack::stack_inject_card方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stack::stack_inject_card方法的具體用法?PHP Stack::stack_inject_card怎麽用?PHP Stack::stack_inject_card使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Stack的用法示例。


在下文中一共展示了Stack::stack_inject_card方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: import_card

 public static function import_card($id, $seq)
 {
     //return 'CARD: '.$id;
     HCImport::load_stack();
     HCImport::index_blocks();
     HCImport::decode_stak();
     HCImport::decode_font_table();
     HCImport::decode_style_table();
     $old_card = HCImport::decode_card(intval($id));
     $new_file = new Stack(HCImport::stack_temp());
     $new_card = array();
     $new_card['card_id'] = intval($id);
     $new_card['card_name'] = $old_card['name'];
     $new_card['card_cant_delete'] = $old_card['cant_delete'];
     $new_card['card_dont_search'] = $old_card['dont_search'];
     $new_card['card_script'] = array('content' => $old_card['script'], 'selection' => 0);
     $new_card['card_has_art'] = false;
     $new_card['card_bkgnd_id'] = $old_card['bkgnd_id'];
     $new_card['card_seq'] = intval($seq) * 10;
     $new_parts = array();
     $part_index = array();
     $n = 1;
     foreach ($old_card['parts'] as $part) {
         $new_part = HCImport::convert_part($part);
         $part_index[$part['pid']] = count($new_parts);
         $new_parts[] = $new_part;
         $n++;
     }
     $datas = array();
     foreach ($old_card['content'] as $fdata) {
         $pid = $fdata['part_id'];
         $is_bkgnd = true;
         if ($pid > 32765) {
             $pid = 65536 - $pid;
             $is_bkgnd = false;
             //print 'ID: '.$pid.' (card)<br>';
         }
         if (isset($part_index[$pid]) && !$is_bkgnd) {
             $idx = $part_index[$pid];
             $new_parts[$idx][-99] = nl2br($fdata['text'], false);
             //print 'IDX: '.$idx.' = '.$fdata['text'].'<br>';
         } else {
             $datas[] = array($fdata['part_id'], nl2br($fdata['text'], false));
         }
     }
     $new_card['card_object_data'] = json_encode($new_parts);
     $new_card['data'] = json_encode($datas);
     $new_card['content'] = '';
     $new_file->stack_inject_card($new_card);
     return $old_card;
 }
開發者ID:jhawcroft,項目名稱:cinsimp-web,代碼行數:51,代碼來源:hcimport.php


注:本文中的Stack::stack_inject_card方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。