• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP utf8_truncate函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中utf8_truncate函数的典型用法代码示例。如果您正苦于以下问题:PHP utf8_truncate函数的具体用法?PHP utf8_truncate怎么用?PHP utf8_truncate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: truncate

 private function truncate($string)
 {
     if (preg_match('/[^0-9]/', $string)) {
         $string = utf8_truncate($string, 11, '');
     } else {
         $string = substr($string, 0, 15);
     }
     return $string;
 }
开发者ID:riano2010,项目名称:reg,代码行数:9,代码来源:sms16.php


示例2: GetMessage

 function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
 {
     debugLog("IMAP-GetMessage: (fid: '{$folderid}'  id: '{$id}'  truncsize: {$truncsize})");
     // Get flags, etc
     $stat = $this->StatMessage($folderid, $id);
     if ($stat) {
         $this->imap_reopenFolder($folderid);
         $mail = @imap_fetchheader($this->_mbox, $id, FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
         $mobj = new Mail_mimeDecode($mail);
         $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'charset' => 'utf-8'));
         $output = new SyncMail();
         $body = $this->getBody($message);
         $output->bodysize = strlen($body);
         // truncate body, if requested
         if (strlen($body) > $truncsize) {
             $body = utf8_truncate($body, $truncsize);
             $output->bodytruncated = 1;
         } else {
             $body = $body;
             $output->bodytruncated = 0;
         }
         $body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
         $output->body = $body;
         $output->datereceived = isset($message->headers["date"]) ? $this->cleanupDate($message->headers["date"]) : null;
         $output->displayto = isset($message->headers["to"]) ? $message->headers["to"] : null;
         $output->importance = isset($message->headers["x-priority"]) ? preg_replace("/\\D+/", "", $message->headers["x-priority"]) : null;
         $output->messageclass = "IPM.Note";
         $output->subject = isset($message->headers["subject"]) ? $message->headers["subject"] : "";
         $output->read = $stat["flags"];
         $output->to = isset($message->headers["to"]) ? $message->headers["to"] : null;
         $output->cc = isset($message->headers["cc"]) ? $message->headers["cc"] : null;
         $output->from = isset($message->headers["from"]) ? $message->headers["from"] : null;
         $output->reply_to = isset($message->headers["reply-to"]) ? $message->headers["reply-to"] : null;
         // Attachments are only searched in the top-level part
         if (isset($message->parts)) {
             $mparts = $message->parts;
             for ($i = 0; $i < count($mparts); $i++) {
                 $part = $mparts[$i];
                 //recursively add parts
                 if ($part->ctype_primary == "multipart" && ($part->ctype_secondary == "mixed" || $part->ctype_secondary == "alternative" || $part->ctype_secondary == "related")) {
                     foreach ($part->parts as $spart) {
                         $mparts[] = $spart;
                     }
                     continue;
                 }
                 //add part as attachment if it's disposition indicates so or if it is not a text part
                 if (isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline") || isset($part->ctype_primary) && $part->ctype_primary != "text") {
                     $attachment = new SyncAttachment();
                     if (isset($part->body)) {
                         $attachment->attsize = strlen($part->body);
                     }
                     if (isset($part->d_parameters['filename'])) {
                         $attname = $part->d_parameters['filename'];
                     } else {
                         if (isset($part->ctype_parameters['name'])) {
                             $attname = $part->ctype_parameters['name'];
                         } else {
                             if (isset($part->headers['content-description'])) {
                                 $attname = $part->headers['content-description'];
                             } else {
                                 $attname = "unknown attachment";
                             }
                         }
                     }
                     $attachment->displayname = $attname;
                     $attachment->attname = $folderid . ":" . $id . ":" . $i;
                     $attachment->attmethod = 1;
                     $attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : "";
                     array_push($output->attachments, $attachment);
                 }
             }
         }
         // unset mimedecoder & mail
         unset($mobj);
         unset($mail);
         return $output;
     }
     return false;
 }
开发者ID:nnaannoo,项目名称:paskot,代码行数:79,代码来源:imap.php


示例3: _getEmail


//.........这里部分代码省略.........
             $message->bodytruncated = 0;
         }
         $message->body = str_replace("\n", "\r\n", w2u(str_replace("\r", "", $body)));
         if (!isset($message->body) || strlen($message->body) == 0) {
             $message->body = " ";
         }
     } else {
         $rtf = mapi_message_openproperty($mapimessage, PR_RTF_COMPRESSED);
         if (!$rtf) {
             $message->airsyncbasenativebodytype = 1;
         } else {
             $rtf = preg_replace("/(\n.*)/m", "", mapi_decompressrtf($rtf));
             if (strpos($rtf, "\\fromtext") != false) {
                 $message->airsyncbasenativebodytype = 1;
             } else {
                 $message->airsyncbasenativebodytype = 2;
             }
         }
         if (!isset($bodypreference[1]["TruncationSize"])) {
             $bodypreference[1]["TruncationSize"] = 1024 * 1024;
         }
         if (isset($bodypreference[4]) && function_exists("mapi_inetmapi_imtoinet") && (!defined('ICS_IMTOINET_SEGFAULT') || ICS_IMTOINET_SEGFAULT === false)) {
             $addrBook = mapi_openaddressbook($this->_session);
             $mstream = mapi_inetmapi_imtoinet($this->_session, $addrBook, $mapimessage, array());
             $mstreamstat = mapi_stream_stat($mstream);
         }
         $message->airsyncbasebody = new SyncAirSyncBaseBody();
         debugLog("airsyncbasebody!");
         if (isset($bodypreference[4]) && isset($mstream) && ($mimesupport == 2 || $mimesupport == 1 && strtolower(substr($messageprops[PR_MESSAGE_CLASS], 0, 14)) == 'ipm.note.smime')) {
             $mstreamcontent = mapi_stream_read($mstream, MAX_EMBEDDED_SIZE);
             $message->airsyncbasebody->type = 4;
             if ($truncsize != false && isset($bodypreference[4]["TruncationSize"])) {
                 $hdrend = strpos("\r\n\r\n", $mstreamcontent);
                 $message->airsyncbasebody->data = utf8_truncate($mstreamcontent, $hdrend + $bodypreference[4]["TruncationSize"]);
             } else {
                 $message->airsyncbasebody->data = $mstreamcontent;
             }
             if (strlen($message->airsyncbasebody->data) < $mstreamstat["cb"]) {
                 $message->airsyncbasebody->truncated = 1;
             }
             $message->airsyncbasebody->estimateddatasize = strlen($mstreamcontent);
         } elseif (isset($bodypreference[3]) && $message->airsyncbasenativebodytype == 3) {
             $message->airsyncbasebody->type = 3;
             $rtf = mapi_openproperty($mapimessage, PR_RTF_COMPRESSED);
             $message->airsyncbasebody->data = base64_encode($rtf);
             $message->airsyncbasebody->estimateddatasize = strlen($rtf);
             debugLog("RTF Body!");
         } elseif (isset($bodypreference[2])) {
             $message->airsyncbasebody->type = 2;
             $html = mapi_openproperty($mapimessage, PR_HTML);
             if (strpos(strtoupper($html), "<HTML>") == 0 && strpos(strtoupper($html), "<HEAD>") == 0 && strpos(strtoupper($html), "<BODY>") == 0) {
                 debugLog("Malformed html message, (HTML, HEAD, BODY missing");
                 $html = '<HTML>' . '<HEAD>' . '<META NAME="Generator" CONTENT="Z-Push">' . '<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">' . '</HEAD>' . '<BODY>' . iconv(getCodepageCharset($message->internetcpid), "utf-8", $html) . '</BODY></HTML>';
                 $message->internetcpid = 65001;
             } else {
                 if ($message->internetcpid != 65001) {
                     $html = iconv(getCodepageCharset($message->internetcpid), "utf-8", $html);
                 }
             }
             /* This should be removed 110422
             			if ($message->airsyncbasenativebodytype==2) {
             			    $html = mapi_openproperty($mapimessage, PR_HTML);
             			} else {
             			    $html = '<html>'.
             				    '<head>'.
             				    '<meta name="Generator" content="Z-Push">'.
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:67,代码来源:ics.php


示例4: GetMessage

 function GetMessage($folderid, $id, $truncsize, $mimesupport = 0)
 {
     debugLog("IMAP-GetMessage: (fid: '{$folderid}'  id: '{$id}'  truncsize: {$truncsize})");
     // Get flags, etc
     $stat = $this->StatMessage($folderid, $id);
     if ($stat) {
         $this->imap_reopenFolder($folderid);
         $mail = @imap_fetchheader($this->_mbox, $id, FT_PREFETCHTEXT | FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
         $mobj = new Mail_mimeDecode($mail);
         $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => 'utf-8'));
         $output = new SyncMail();
         $body = $this->getBody($message);
         // truncate body, if requested
         if (strlen($body) > $truncsize) {
             $body = utf8_truncate($body, $truncsize);
             $output->bodytruncated = 1;
         } else {
             $body = $body;
             $output->bodytruncated = 0;
         }
         $body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
         $output->bodysize = strlen($body);
         $output->body = $body;
         $output->datereceived = isset($message->headers["date"]) ? strtotime($message->headers["date"]) : null;
         $output->displayto = isset($message->headers["to"]) ? $message->headers["to"] : null;
         $output->importance = isset($message->headers["x-priority"]) ? preg_replace("/\\D+/", "", $message->headers["x-priority"]) : null;
         $output->messageclass = "IPM.Note";
         $output->subject = isset($message->headers["subject"]) ? $message->headers["subject"] : "";
         $output->read = $stat["flags"];
         $output->to = isset($message->headers["to"]) ? $message->headers["to"] : null;
         $output->cc = isset($message->headers["cc"]) ? $message->headers["cc"] : null;
         $output->from = isset($message->headers["from"]) ? $message->headers["from"] : null;
         $output->reply_to = isset($message->headers["reply-to"]) ? $message->headers["reply-to"] : null;
         // Attachments are only searched in the top-level part
         $n = 0;
         if (isset($message->parts)) {
             foreach ($message->parts as $part) {
                 if (isset($part->disposition) && ($part->disposition == "attachment" || $part->disposition == "inline")) {
                     $attachment = new SyncAttachment();
                     if (isset($part->body)) {
                         $attachment->attsize = strlen($part->body);
                     }
                     if (isset($part->d_parameters['filename'])) {
                         $attname = $part->d_parameters['filename'];
                     } else {
                         if (isset($part->ctype_parameters['name'])) {
                             $attname = $part->ctype_parameters['name'];
                         } else {
                             if (isset($part->headers['content-description'])) {
                                 $attname = $part->headers['content-description'];
                             } else {
                                 $attname = "unknown attachment";
                             }
                         }
                     }
                     $attachment->displayname = $attname;
                     $attachment->attname = $folderid . ":" . $id . ":" . $n;
                     $attachment->attmethod = 1;
                     $attachment->attoid = isset($part->headers['content-id']) ? $part->headers['content-id'] : "";
                     array_push($output->attachments, $attachment);
                 }
                 $n++;
             }
         }
         // unset mimedecoder & mail
         unset($mobj);
         unset($mail);
         return $output;
     }
     return false;
 }
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:71,代码来源:imap.php


示例5: update

 public function update()
 {
     $this->language->load('checkout/cart');
     $json = array();
     if (isset($this->request->post['product_id'])) {
         $this->load->model('catalog/product');
         $product_info = $this->model_catalog_product->getProduct($this->request->post['product_id']);
         if ($product_info) {
             if (isset($this->request->post['quantity'])) {
                 $quantity = $this->request->post['quantity'];
             } else {
                 $quantity = 1;
             }
             $product_total = 0;
             $products = $this->cart->getProducts();
             foreach ($products as $product_2) {
                 if ($product_2['product_id'] == $this->request->post['product_id']) {
                     $product_total += $product_2['quantity'];
                 }
             }
             if ($product_info['minimum'] > $product_total + $quantity) {
                 $json['error']['warning'] = sprintf($this->language->get('error_minimum'), $product_info['name'], $product_info['minimum']);
             }
             if (isset($this->request->post['option'])) {
                 $option = array_filter($this->request->post['option']);
             } else {
                 $option = array();
             }
             $product_options = $this->model_catalog_product->getProductOptions($this->request->post['product_id']);
             foreach ($product_options as $product_option) {
                 if ($product_option['required'] && (!isset($this->request->post['option'][$product_option['product_option_id']]) || !$this->request->post['option'][$product_option['product_option_id']])) {
                     $json['error'][$product_option['product_option_id']] = sprintf($this->language->get('error_required'), $product_option['name']);
                 }
             }
         }
         if (!isset($json['error'])) {
             $this->cart->add($this->request->post['product_id'], $quantity, $option);
             $json['success'] = sprintf($this->language->get('text_success'), $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']), $product_info['name'], $this->url->link('checkout/cart'));
             unset($this->session->data['shipping_methods']);
             unset($this->session->data['shipping_method']);
             unset($this->session->data['payment_methods']);
             unset($this->session->data['payment_method']);
         } else {
             $json['redirect'] = str_replace('&amp;', '&', $this->url->link('product/product', 'product_id=' . $this->request->post['product_id']));
         }
     }
     if (isset($this->request->post['remove'])) {
         $this->cart->remove($this->request->post['remove']);
         unset($this->session->data['shipping_methods']);
         unset($this->session->data['shipping_method']);
         unset($this->session->data['payment_methods']);
         unset($this->session->data['payment_method']);
     }
     if (isset($this->request->post['voucher'])) {
         if ($this->session->data['vouchers'][$this->request->post['voucher']]) {
             unset($this->session->data['vouchers'][$this->request->post['voucher']]);
         }
     }
     $this->load->model('tool/image');
     $this->data['text_empty'] = $this->language->get('text_empty');
     $this->data['button_checkout'] = $this->language->get('button_checkout');
     $this->data['button_remove'] = $this->language->get('button_remove');
     $this->data['products'] = array();
     foreach ($this->cart->getProducts() as $result) {
         if ($result['image']) {
             $image = $this->model_tool_image->resize($result['image'], 40, 40);
         } else {
             $image = '';
         }
         $option_data = array();
         foreach ($result['option'] as $option) {
             if ($option['type'] != 'file') {
                 $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['option_value']));
             } else {
                 $this->load->library('encryption');
                 $encryption = new Encryption($this->config->get('config_encryption'));
                 $file = substr($encryption->decrypt($option['option_value']), 0, strrpos($encryption->decrypt($option['option_value']), '.'));
                 $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($file));
             }
         }
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $price = $this->currency->format($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $price = false;
         }
         if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
             $total = $this->currency->format($this->tax->calculate($result['total'], $result['tax_class_id'], $this->config->get('config_tax')));
         } else {
             $total = false;
         }
         $this->data['products'][] = array('key' => $result['key'], 'product_id' => $result['product_id'], 'thumb' => $image, 'name' => $result['name'], 'model' => $result['model'], 'option' => $option_data, 'quantity' => $result['quantity'], 'stock' => $result['stock'], 'price' => $price, 'total' => $total, 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']));
     }
     // Gift Voucher
     $this->data['vouchers'] = array();
     if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
         foreach ($this->session->data['vouchers'] as $key => $voucher) {
             $this->data['vouchers'][] = array('key' => $key, 'description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount']));
         }
     }
     // Calculate Totals
//.........这里部分代码省略.........
开发者ID:rb2,项目名称:ocstoreru,代码行数:101,代码来源:cart.php


示例6: index

 public function index()
 {
     $this->language->load('product/compare');
     $this->load->model('catalog/product');
     $this->load->model('tool/image');
     if (!isset($this->session->data['compare'])) {
         $this->session->data['compare'] = array();
     }
     if (isset($this->request->post['remove'])) {
         $key = array_search($this->request->post['remove'], $this->session->data['compare']);
         if ($key !== false) {
             unset($this->session->data['compare'][$key]);
         }
         $this->redirect($this->url->link('product/compare'));
     }
     $this->document->setTitle($this->language->get('heading_title'));
     $this->data['breadcrumbs'] = array();
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('text_home'), 'href' => $this->url->link('common/home'), 'separator' => false);
     $url = '';
     if (isset($this->request->get['compare'])) {
         $url .= 'compare=' . $this->request->get['compare'];
     }
     $this->data['breadcrumbs'][] = array('text' => $this->language->get('heading_title'), 'href' => $this->url->link('product/compare', $url), 'separator' => $this->language->get('text_separator'));
     $this->data['heading_title'] = $this->language->get('heading_title');
     $this->data['text_product'] = $this->language->get('text_product');
     $this->data['text_name'] = $this->language->get('text_name');
     $this->data['text_image'] = $this->language->get('text_image');
     $this->data['text_price'] = $this->language->get('text_price');
     $this->data['text_model'] = $this->language->get('text_model');
     $this->data['text_manufacturer'] = $this->language->get('text_manufacturer');
     $this->data['text_availability'] = $this->language->get('text_availability');
     $this->data['text_rating'] = $this->language->get('text_rating');
     $this->data['text_summary'] = $this->language->get('text_summary');
     $this->data['text_weight'] = $this->language->get('text_weight');
     $this->data['text_dimension'] = $this->language->get('text_dimension');
     $this->data['text_remove'] = $this->language->get('text_remove');
     $this->data['text_empty'] = $this->language->get('text_empty');
     $this->data['button_cart'] = $this->language->get('button_cart');
     $this->data['button_continue'] = $this->language->get('button_continue');
     $this->data['action'] = $this->url->link('product/compare');
     $this->data['products'] = array();
     $this->data['attribute_groups'] = array();
     foreach ($this->session->data['compare'] as $product_id) {
         $product_info = $this->model_catalog_product->getProduct($product_id);
         if ($product_info) {
             if ($product_info['image']) {
                 $image = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_compare_width'), $this->config->get('config_image_compare_height'));
             } else {
                 $image = false;
             }
             if ($this->config->get('config_customer_price') && $this->customer->isLogged() || !$this->config->get('config_customer_price')) {
                 $price = $this->currency->format($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $price = false;
             }
             if ((double) $product_info['special']) {
                 $special = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
             } else {
                 $special = false;
             }
             if ($product_info['quantity'] <= 0) {
                 $availability = $product_info['stock_status'];
             } elseif ($this->config->get('config_stock_display')) {
                 $availability = $product_info['quantity'];
             } else {
                 $availability = $this->language->get('text_instock');
             }
             $attribute_data = array();
             $attribute_groups = $this->model_catalog_product->getProductAttributes($product_id);
             foreach ($attribute_groups as $attribute_group) {
                 foreach ($attribute_group['attribute'] as $attribute) {
                     $attribute_data[$attribute['attribute_id']] = $attribute['text'];
                 }
             }
             $this->data['products'][$product_id] = array('product_id' => $product_info['product_id'], 'name' => $product_info['name'], 'thumb' => $image, 'price' => $price, 'special' => $special, 'description' => utf8_truncate(strip_tags(html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8')), 400, '&nbsp;&hellip;', true), 'model' => $product_info['model'], 'manufacturer' => $product_info['manufacturer'], 'availability' => $availability, 'rating' => (int) $product_info['rating'], 'reviews' => sprintf($this->language->get('text_reviews'), (int) $product_info['reviews']), 'weight' => $this->weight->format($product_info['weight'], $product_info['weight_class_id']), 'length' => $this->length->format($product_info['length'], $product_info['length_class_id']), 'width' => $this->length->format($product_info['width'], $product_info['length_class_id']), 'height' => $this->length->format($product_info['height'], $product_info['length_class_id']), 'attribute' => $attribute_data, 'href' => $this->url->link('product/product', 'product_id=' . $product_id), 'remove' => $this->url->link('product/product', 'product_id=' . $product_id));
             foreach ($attribute_groups as $attribute_group) {
                 $this->data['attribute_groups'][$attribute_group['attribute_group_id']]['name'] = $attribute_group['name'];
                 foreach ($attribute_group['attribute'] as $attribute) {
                     $this->data['attribute_groups'][$attribute_group['attribute_group_id']]['attribute'][$attribute['attribute_id']]['name'] = $attribute['name'];
                 }
             }
         }
     }
     $this->data['continue'] = $this->url->link('common/home');
     if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/compare.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/product/compare.tpl';
     } else {
         $this->template = 'default/template/product/compare.tpl';
     }
     $this->children = array('common/column_left', 'common/column_right', 'common/content_top', 'common/content_bottom', 'common/footer', 'common/header');
     $this->response->setOutput($this->render());
 }
开发者ID:riano2010,项目名称:reg,代码行数:92,代码来源:compare.php


示例7: note2messagenote

 /**
  * Convert note to requested bodypreference format and truncate if requested
  *
  * @param $note string containing the plaintext message
  * @param $bodypreference object
  * @param &$airsyncbasebody the airsyncbasebody object to send to the client
  *
  * @return string plain textbody for message or false
  */
 public function note2messagenote($note, $bodypreference, &$airsyncbasebody)
 {
     //error_log (__METHOD__);
     if ($bodypreference == false) {
         return $note;
     } else {
         if (isset($bodypreference[2])) {
             debugLog("HTML Body");
             $airsyncbasebody->type = 2;
             $html = '<html>' . '<head>' . '<meta name="Generator" content="eGroupware/Z-Push">' . '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">' . '</head>' . '<body>' . str_replace(array("\n", "\r", "\r\n"), "<br />", $note) . '</body>' . '</html>';
             if (isset($bodypreference[2]["TruncationSize"]) && strlen($html) > $bodypreference[2]["TruncationSize"]) {
                 $html = utf8_truncate($html, $bodypreference[2]["TruncationSize"]);
                 $airsyncbasebody->truncated = 1;
             }
             $airsyncbasebody->estimateddatasize = strlen($html);
             $airsyncbasebody->data = $html;
         } else {
             debugLog("Plaintext Body");
             $airsyncbasebody->type = 1;
             $plainnote = str_replace("\n", "\r\n", str_replace("\r", "", $note));
             if (isset($bodypreference[1]["TruncationSize"]) && strlen($plainnote) > $bodypreference[1]["TruncationSize"]) {
                 $plainnote = utf8_truncate($plainnote, $bodypreference[1]["TruncationSize"]);
                 $airsyncbasebody->truncated = 1;
             }
             $airsyncbasebody->estimateddatasize = strlen($plainnote);
             $airsyncbasebody->data = $plainnote;
         }
         if ($airsyncbasebody->type != 3 && (!isset($airsyncbasebody->data) || strlen($airsyncbasebody->data) == 0)) {
             $airsyncbasebody->data = " ";
         }
     }
 }
开发者ID:netconstructor,项目名称:activesync,代码行数:41,代码来源:egw.php


示例8: index


//.........这里部分代码省略.........
             $data['shipping_city'] = '';
             $data['shipping_postcode'] = '';
             $data['shipping_zone'] = '';
             $data['shipping_zone_id'] = '';
             $data['shipping_country'] = '';
             $data['shipping_country_id'] = '';
             $data['shipping_address_format'] = '';
             $data['shipping_method'] = '';
         }
         $this->load->library('encryption');
         $product_data = array();
         foreach ($this->cart->getProducts() as $product) {
             $option_data = array();
             foreach ($product['option'] as $option) {
                 if ($option['type'] != 'file') {
                     $option_data[] = array('product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'option_id' => $option['option_id'], 'option_value_id' => $option['option_value_id'], 'name' => $option['name'], 'value' => $option['option_value'], 'type' => $option['type']);
                 } else {
                     $encryption = new Encryption($this->config->get('config_encryption'));
                     $option_data[] = array('product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'product_option_id' => $option['product_option_id'], 'product_option_value_id' => $option['product_option_value_id'], 'option_id' => $option['option_id'], 'option_value_id' => $option['option_value_id'], 'name' => $option['name'], 'value' => $encryption->decrypt($option['option_value']), 'type' => $option['type']);
                 }
             }
             $product_data[] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'download' => $product['download'], 'quantity' => $product['quantity'], 'subtract' => $product['subtract'], 'price' => $product['price'], 'total' => $product['total'], 'tax' => $this->tax->getTax($product['total'], $product['tax_class_id']));
         }
         // Gift Voucher
         if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
             foreach ($this->session->data['vouchers'] as $voucher) {
                 $product_data[] = array('product_id' => 0, 'name' => $voucher['description'], 'model' => '', 'option' => array(), 'download' => array(), 'quantity' => 1, 'subtract' => false, 'price' => $voucher['amount'], 'total' => $voucher['amount'], 'tax' => 0);
             }
         }
         $data['products'] = $product_data;
         $data['totals'] = $total_data;
         $data['comment'] = $this->session->data['comment'];
         $data['total'] = $total;
         $data['reward'] = $this->cart->getTotalRewardPoints();
         if (isset($this->request->cookie['tracking'])) {
             $this->load->model('affiliate/affiliate');
             $affiliate_info = $this->model_affiliate_affiliate->getAffiliateByCode($this->request->cookie['tracking']);
             if ($affiliate_info) {
                 $data['affiliate_id'] = $affiliate_info['affiliate_id'];
                 $data['commission'] = $total / 100 * $affiliate_info['commission'];
             } else {
                 $data['affiliate_id'] = 0;
                 $data['commission'] = 0;
             }
         } else {
             $data['affiliate_id'] = 0;
             $data['commission'] = 0;
         }
         $data['language_id'] = $this->config->get('config_language_id');
         $data['currency_id'] = $this->currency->getId();
         $data['currency_code'] = $this->currency->getCode();
         $data['currency_value'] = $this->currency->getValue($this->currency->getCode());
         $data['ip'] = $this->request->server['REMOTE_ADDR'];
         $this->load->model('checkout/order');
         $this->session->data['order_id'] = $this->model_checkout_order->create($data);
         // Gift Voucher
         if (isset($this->session->data['vouchers']) && is_array($this->session->data['vouchers'])) {
             $this->load->model('checkout/voucher');
             foreach ($this->session->data['vouchers'] as $voucher) {
                 $this->model_checkout_voucher->addVoucher($this->session->data['order_id'], $voucher);
             }
         }
         $this->data['column_name'] = $this->language->get('column_name');
         $this->data['column_model'] = $this->language->get('column_model');
         $this->data['column_quantity'] = $this->language->get('column_quantity');
         $this->data['column_price'] = $this->language->get('column_price');
         $this->data['column_total'] = $this->language->get('column_total');
         $this->data['products'] = array();
         foreach ($this->cart->getProducts() as $product) {
             $option_data = array();
             foreach ($product['option'] as $option) {
                 if ($option['type'] != 'file') {
                     $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($option['option_value']));
                 } else {
                     $this->load->library('encryption');
                     $encryption = new Encryption($this->config->get('config_encryption'));
                     $file = substr($encryption->decrypt($option['option_value']), 0, strrpos($encryption->decrypt($option['option_value']), '.'));
                     $option_data[] = array('name' => $option['name'], 'value' => utf8_truncate($file));
                 }
             }
             $this->data['products'][] = array('product_id' => $product['product_id'], 'name' => $product['name'], 'model' => $product['model'], 'option' => $option_data, 'quantity' => $product['quantity'], 'subtract' => $product['subtract'], 'tax' => $this->tax->getTax($product['total'], $product['tax_class_id']), 'price' => $this->currency->format($product['price']), 'total' => $this->currency->format($product['total']), 'href' => $this->url->link('product/product', 'product_id=' . $product['product_id']));
         }
         // Gift Voucher
         $this->data['vouchers'] = array();
         if (isset($this->session->data['vouchers']) && $this->session->data['vouchers']) {
             foreach ($this->session->data['vouchers'] as $key => $voucher) {
                 $this->data['vouchers'][] = array('description' => $voucher['description'], 'amount' => $this->currency->format($voucher['amount']));
             }
         }
         $this->data['totals'] = $total_data;
         $this->data['payment'] = $this->getChild('payment/' . $this->session->data['payment_method']['code']);
         if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/checkout/confirm.tpl')) {
             $this->template = $this->config->get('config_template') . '/template/checkout/confirm.tpl';
         } else {
             $this->template = 'default/template/checkout/confirm.tpl';
         }
         $json['output'] = $this->render();
     }
     $this->response->setOutput(json_encode($json));
 }
开发者ID:rb2,项目名称:ocstoreru,代码行数:101,代码来源:confirm.php


示例9: GetMessage

 function GetMessage($folderid, $id, $truncsize, $bodypreference = false, $optionbodypreference = false, $mimesupport = 0)
 {
     debugLog("IMAP-GetMessage: (fid: '" . $this->_folders[$folderid] . "'  id: '" . $id . "'  truncsize: {$truncsize})");
     // Get flags, etc
     $stat = $this->StatMessage($folderid, $id);
     if ($stat) {
         $this->imap_reopenFolder($folderid);
         if (defined("IMAP_USE_FETCHHEADER") && IMAP_USE_FETCHHEADER === false) {
             $mail = @imap_fetchbody($this->_mbox, $id, "", FT_UID | FT_PEEK);
         } else {
             $mail = @imap_fetchheader($this->_mbox, $id, FT_UID) . @imap_body($this->_mbox, $id, FT_PEEK | FT_UID);
         }
         // Return in case any errors occured...
         $errors = imap_errors();
         if (is_array($errors)) {
             foreach ($errors as $e) {
                 debugLog("IMAP-errors: {$e}");
                 $fields = explode(':', $e);
                 switch (strtolower(trim($fields[0]))) {
                     case 'security problem':
                         // don't care about security problems!
                         break;
                     default:
                         return false;
                 }
             }
         }
         $mobj = new Mail_mimeDecode($mail);
         $message = $mobj->decode(array('decode_headers' => true, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
         $output = new SyncMail();
         // start AS12 Stuff (bodypreference === false) case = old behaviour
         if ($bodypreference === false) {
             $body = $this->getBody($message);
             $body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
             // truncate body, if requested
             if (strlen($body) > $truncsize) {
                 $body = utf8_truncate($body, $truncsize);
                 $output->bodytruncated = 1;
             } else {
                 $body = $body;
                 $output->bodytruncated = 0;
             }
             $output->bodysize = strlen($body);
             $output->body = $body;
         } else {
             if (isset($bodypreference[1]) && !isset($bodypreference[1]["TruncationSize"])) {
                 $bodypreference[1]["TruncationSize"] = 1024 * 1024;
             }
             if (isset($bodypreference[2]) && !isset($bodypreference[2]["TruncationSize"])) {
                 $bodypreference[2]["TruncationSize"] = 1024 * 1024;
             }
             if (isset($bodypreference[3]) && !isset($bodypreference[3]["TruncationSize"])) {
                 $bodypreference[3]["TruncationSize"] = 1024 * 1024;
             }
             if (isset($bodypreference[4]) && !isset($bodypreference[4]["TruncationSize"])) {
                 $bodypreference[4]["TruncationSize"] = 1024 * 1024;
             }
             $output->airsyncbasebody = new SyncAirSyncBaseBody();
             debugLog("airsyncbasebody!");
             $body = "";
             $this->getBodyRecursive($message, "html", $body);
             if ($body != "") {
                 $output->airsyncbasenativebodytype = 2;
             } else {
                 $output->airsyncbasenativebodytype = 1;
                 $this->getBodyRecursive($message, "plain", $body);
             }
             $body = str_replace("\n", "\r\n", str_replace("\r", "", $body));
             if (isset($bodypreference[4]) && ($mimesupport == 2 || $mimesupport == 1 && strtolower($message->ctype_secondary) == 'signed')) {
                 debugLog("MIME Body");
                 $output->airsyncbasebody->type = 4;
                 $rawmessage = $mobj->decode(array('decode_headers' => false, 'decode_bodies' => true, 'rfc_822bodies' => true, 'include_bodies' => true, 'input' => $mail, 'crlf' => "\n", 'charset' => BACKEND_CHARSET));
                 $body = "";
                 foreach ($rawmessage->headers as $key => $value) {
                     if ($key != "content-type" && $key != "mime-version" && $key != "content-transfer-encoding" && !is_array($value)) {
                         $body .= $key . ":";
                         // Split -> Explode replace
                         $tokens = explode(" ", trim($value));
                         $line = "";
                         foreach ($tokens as $valu) {
                             if (strlen($line) + strlen($valu) + 2 > 60) {
                                 $line .= "\n";
                                 $body .= $line;
                                 $line = " " . $valu;
                             } else {
                                 $line .= " " . $valu;
                             }
                         }
                         $body .= $line . "\n";
                     }
                 }
                 unset($rawmessage);
                 $mimemsg = new Mail_mime(array('head_encoding' => 'quoted-printable', 'text_encoding' => 'quoted-printable', 'html_encoding' => 'base64', 'head_charset' => 'utf-8', 'text_charset' => 'utf-8', 'html_charset' => 'utf-8', 'eol' => "\n", 'delay_file_io' => false));
                 $this->getAllAttachmentsRecursive($message, $mimemsg);
                 if ($output->airsyncbasenativebodytype == 1) {
                     $this->getBodyRecursive($message, "plain", $plain);
                     $this->getBodyRecursive($message, "html", $html);
                     if ($html == "") {
                         $this->getBodyRecursive($message, "plain", $html);
                     }
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:z-push-svn,代码行数:101,代码来源:imap.php


示例10: info


//.........这里部分代码省略.........
         $this->data['text_shipping_method'] = $this->language->get('text_shipping_method');
         $this->data['text_shipping_address'] = $this->language->get('text_shipping_address');
         $this->data['text_payment_method'] = $this->language->get('text_payment_method');
         $this->data['text_payment_address'] = $this->language->get('text_payment_address');
         $this->data['text_history'] = $this->language->get('text_history');
         $this->data['text_comment'] = $this->language->get('text_comment');
         $this->data['text_action'] = $this->language->get('text_action');
         $this->data['text_selected'] = $this->language->get('text_selected');
         $this->data['text_reorder'] = $this->language->get('text_reorder');
         $this->data['text_return'] = $this->language->get('text_return');
         $this->data['column_name'] = $this->language->get('column_name');
         $this->data['column_model'] = $this->language->get('column_model');
         $this->data['column_quantity'] = $this->language->get('column_quantity');
         $this->data['column_price'] = $this->language->get('column_price');
         $this->data['column_total'] = $this->language->get('column_total');
         $this->data['column_date_added'] = $this->language->get('column_date_added');
         $this->data['column_status'] = $this->language->get('column_status');
         $this->data['column_comment'] = $this->language->get('column_comment');
         $this->data['button_continue'] = $this->language->get('button_continue');
         if (isset($this->error['warning'])) {
             $this->data['error_warning'] = $this->error['warning'];
         } else {
             $this->data['error_warning'] = '';
         }
         $this->data['action'] = $this->url->link('account/order/info', 'order_id=' . $this->request->get['order_id'], 'SSL');
         if ($order_info['invoice_no']) {
             $this->data['invoice_no'] = $order_info['invoice_prefix'] . $order_info['invoice_no'];
         } else {
             $this->data['invoice_no'] = '';
         }
         $this->data['order_id'] = $this->request->get['order_id'];
         $this->data['date_added'] = date($this->language->get('date_format_short'), strtotime($order_info['date_added']));
         if ($order_info['shipping_address_format']) {
             $format = $order_info['shipping_address_format'];
         } else {
             $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
         }
         $find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
         $replace = array('firstname' => $order_info['shipping_firstname'], 'lastname' => $order_info['shipping_lastname'], 'company' => $order_info['shipping_company'], 'address_1' => $order_info['shipping_address_1'], 'address_2' => $order_info['shipping_address_2'], 'city' => $order_info['shipping_city'], 'postcode' => $order_info['shipping_postcode'], 'zone' => $order_info['shipping_zone'], 'zone_code' => $order_info['shipping_zone_code'], 'country' => $order_info['shipping_country']);
         $this->data['shipping_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
         $this->data['shipping_method'] = $order_info['shipping_method'];
         if ($order_info['payment_address_format']) {
             $format = $order_info['payment_address_format'];
         } else {
             $format = '{firstname} {lastname}' . "\n" . '{company}' . "\n" . '{address_1}' . "\n" . '{address_2}' . "\n" . '{city} {postcode}' . "\n" . '{zone}' . "\n" . '{country}';
         }
         $find = array('{firstname}', '{lastname}', '{company}', '{address_1}', '{address_2}', '{city}', '{postcode}', '{zone}', '{zone_code}', '{country}');
         $replace = array('firstname' => $order_info['payment_firstname'], 'lastname' => $order_info['payment_lastname'], 'company' => $order_info['payment_company'], 'address_1' => $order_info['payment_address_1'], 'address_2' => $order_info['payment_address_2'], 'city' => $order_info['payment_city'], 'postcode' => $order_info['payment_postcode'], 'zone' => $order_info['payment_zone'], 'zone_code' => $order_info['payment_zone_code'], 'country' => $order_info['payment_country']);
         $this->data['payment_address'] = str_replace(array("\r\n", "\r", "\n"), '<br />', preg_replace(array("/\\s\\s+/", "/\r\r+/", "/\n\n+/"), '<br />', trim(str_replace($find, $replace, $format))));
         $this->data['payment_method'] = $order_info['payment_method'];
         $this->data['products'] = array();
         $products = $this->model_account_order->getOrderProducts($this->request->get['order_id']);
         foreach ($products as $product) {
             $option_data = array();
             $options = $this->model_account_order->getOrderOptions($this->request->get['order_id'], $product['order_product_id']);
             foreach ($options as $option) {
                 if ($option['type'] != 'file') {
               

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP utf8_ucfirst函数代码示例发布时间:2022-05-23
下一篇:
PHP utf8_trim函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap