本文整理汇总了PHP中round_num函数的典型用法代码示例。如果您正苦于以下问题:PHP round_num函数的具体用法?PHP round_num怎么用?PHP round_num使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了round_num函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: act_getStockDays
/**
* 获取可用库存及天数
*/
public function act_getStockDays()
{
global $dbconn;
$skuArr = isset($_REQUEST['skuArr']) ? json_decode($_REQUEST['skuArr'], TRUE) : '';
if (empty($skuArr)) {
self::$errCode = '001';
self::$errMsg = 'skuArr param error';
return array();
}
$fields = implode(',', array('sku', 'everyday_sale', 'stock_qty', 'ow_stock', 'salensend'));
$where = 'WHERE sku IN (\'' . implode("','", $skuArr) . '\')';
$szdata = SkuStatisticsModel::getInfo($fields, $where);
$szskuarr = empty($szdata) ? array() : array_keys($szdata);
$fields = implode(',', array('sku', 'everyday_sale', 'virtual_stock'));
$where = 'WHERE sku IN (\'' . implode("','", $skuArr) . '\')';
$owdata = SkuStatisticsModel::getOwInfo($fields, $where);
$owskuarr = empty($owdata) ? array() : array_keys($owdata);
$res = array();
$skuarray = array_unique(array_merge($szskuarr, $owskuarr));
if (!empty($skuarray)) {
foreach ($skuarray as $sku) {
$sz_stock = $ow_stock = 0;
$sz_days = $ow_days = 0;
if (!empty($szdata[$sku])) {
$sz_stock = $szdata[$sku]['stock_qty'] + $szdata[$sku]['ow_stock'] - $szdata[$sku]['salensend'];
$sz_days = $szdata[$sku]['everyday_sale'] == 0 ? 0 : round_num($sz_stock / $szdata[$sku]['everyday_sale'], 2);
}
if (!empty($owdata[$sku])) {
$ow_stock = $owdata[$sku]['virtual_stock'];
$ow_days = $owdata[$sku]['everyday_sale'] == 0 ? 0 : round_num($ow_stock / $owdata[$sku]['everyday_sale'], 2);
}
$res[$sku]['sz_stock'] = $sz_stock;
$res[$sku]['sz_days'] = $sz_days;
$res[$sku]['ow_stock'] = $ow_stock;
$res[$sku]['ow_days'] = $ow_days;
}
}
return $this->_checkReturnData($res, array());
}
示例2: pagenavi
/**
* PAGINACION ARCHIVES (NOTA: partir en mas funciones - alex)
* @return [string] [html con la paginacion]
*/
function pagenavi($paged = '', $num_pages = '', $siteUrl = '', $especial = false, $simbol_url = '?', $variable_page = 'paged')
{
global $wpdb, $wp_query;
$before = '';
$after = '';
$pagenavi_options = optionsPagination();
if (!is_single()) {
$paged = $paged == '' ? intval(get_query_var($variable_page)) : $paged;
$max_page = $num_pages == '' ? $wp_query->max_num_pages : $num_pages;
if (empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = intval($pagenavi_options['num_pages']);
$larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);
$larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);
$pages_to_show_minus_1 = $pages_to_show - 1;
$half_page_start = floor($pages_to_show_minus_1 / 2);
$half_page_end = ceil($pages_to_show_minus_1 / 2);
$start_page = $paged - $half_page_start;
if ($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if ($end_page - $start_page != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if ($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if ($start_page <= 0) {
$start_page = 1;
}
$larger_per_page = $larger_page_to_show * $larger_page_multiple;
$larger_start_page_start = round_num($start_page, 10) + $larger_page_multiple - $larger_per_page;
$larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple;
$larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple;
$larger_end_page_end = round_num($end_page, 10) + $larger_per_page;
if ($larger_start_page_end - $larger_page_multiple == $start_page) {
$larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
$larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
}
if ($larger_start_page_start <= 0) {
$larger_start_page_start = $larger_page_multiple;
}
if ($larger_start_page_end > $max_page) {
$larger_start_page_end = $max_page;
}
if ($larger_end_page_end > $max_page) {
$larger_end_page_end = $max_page;
}
if ($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {
$pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
$pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
echo $before . '<div class="pagenavi">' . "\n";
if (!empty($pages_text)) {
echo '<ul class="[ pagination ][ no-margin ]">';
}
echo '<li class="pag-anterior">';
if ($especial == true) {
$pa = $paged - 1;
echo $paged > 1 ? '<a href="' . $siteUrl . $simbol_url . $variable_page . '=' . $pa . '"><img class="[ svg icon--iconed--small icon--stoke icon--thickness-3 ][ color-dark ]" src="' . THEMEPATH . 'icons/arrow-left-12.svg"></a>' : '';
} else {
previous_posts_link($pagenavi_options['prev_text']);
}
echo '</li>';
if ($start_page >= 2 && $pages_to_show < $max_page) {
$first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);
$url = $especial == true ? $siteUrl . $simbol_url . $variable_page . '=1' : esc_url(get_pagenum_link());
echo '<li><a href="' . $url . '" class="first" title="' . $first_page_text . '">1</a></li>';
if (!empty($pagenavi_options['dotleft_text'])) {
echo '<li><span class="expand">' . $pagenavi_options['dotleft_text'] . '</span></li>';
}
}
if ($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) {
for ($i = $larger_start_page_start; $i < $larger_start_page_end; $i += $larger_page_multiple) {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<li><a href="' . esc_url(get_pagenum_link($i)) . '" class="single_page" title="' . $page_text . '">' . $page_text . '</a></li>';
}
}
for ($i = $start_page; $i <= $end_page; $i++) {
if ($i == $paged) {
$current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);
echo '<li class="num-pag-current active"><span class="current">' . $current_page_text . '</span></li>';
} else {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
$url = $especial == true ? $siteUrl . $simbol_url . $variable_page . '=' . $i : esc_url(get_pagenum_link($i));
echo '<li class="num-pag"><a href="' . $url . '" class="single_page" title="' . $page_text . '">' . $page_text . '</a></li>';
}
}
if ($end_page < $max_page) {
if (!empty($pagenavi_options['dotright_text'])) {
echo '<li><span class="expand">' . $pagenavi_options['dotright_text'] . '</span></li>';
}
$last_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['last_text']);
$url = $especial == true ? $siteUrl . $simbol_url . $variable_page . '=' . $max_page : esc_url(get_pagenum_link($max_page));
//.........这里部分代码省略.........
示例3: array
/*$sql = array2sql($orderdata_detail);
$msg = DLdlModel::insertOrderDetail($sql);
if(!$msg){
echo "订单{$orderdata['recordnumber']}订单明细信息插入失败!\r\n";
BaseModel::rollback();
}*/
/***************BEGIN 订单详细扩展表数据***************/
$orderDetailExtDL = array();
$orderDetailExtDL['itemTitle'] = mysql_real_escape_string(trim($detail['Title']));
$categoryName = mysql_real_escape_string(trim($detail['CategoryName']));
$customCode = mysql_real_escape_string(trim($detail['CustomCode']));
$material = mysql_real_escape_string(trim($detail['Material']));
$skuShipfee = mysql_real_escape_string(trim($detail['SkuShipfee']));
$ShenBaoQuantity = mysql_real_escape_string(trim($detail['ShenBaoQuantity']));
$ShenBaoUnitPrice = mysql_real_escape_string(trim($detail['ShenBaoUnitPrice']));
$salePrice = round_num(mysql_real_escape_string(trim($detail['SalePrice'])), 2);
//实际SKU付款价
/*************END 订单详细扩展表数据***************/
/*$sql = array2sql($orderDetailExtDL);
$msg = DLdlModel::insertOrderDetailExtDL($sql);
if(!$msg){
echo "订单{$orderdata['recordnumber']}订单明细扩展信息插入失败!\r\n";
BaseModel::rollback();
}*/
$obj_order_detail_data[] = array('orderDetailData' => $orderdata_detail, 'orderDetailExtenData' => $orderDetailExtDL);
$ebay_fedex_remark[$categoryName][] = array('real_price' => $ShenBaoQuantity, 'qty' => $ShenBaoUnitPrice, 'hamcodes' => $customCode, 'detail' => $material);
}
$insertOrder = array('orderData' => $orderdata, 'orderExtenData' => $orderExtDL, 'orderUserInfoData' => $orderUserInfo, 'orderDetail' => $obj_order_detail_data, 'orderNote' => $orderNote);
$calcInfo = CommonModel::calcAddOrderWeight($insertOrder['orderDetail']);
//计算重量和包材
//var_dump($calcInfo); exit;
示例4: act_goodsAddXlsSave
function act_goodsAddXlsSave()
{
$uploadfile = date("Y") . date("m") . date("d") . rand(1, 3009) . ".xls";
if ($_FILES['upfile']['tmp_name'] == '') {
echo "请选择上传的excel文件";
exit;
}
if (move_uploaded_file($_FILES['upfile']['tmp_name'], './upload/' . $uploadfile)) {
echo "<font color=BLUE>文件上传成功!</font><br>";
} else {
echo "<font color=red> 文件上传失败!</font><br>";
}
echo $uploadfile;
$fileName = 'upload/' . $uploadfile;
$filePath = $fileName;
$username = $_SESSION['userName'];
$userId = $_SESSION['userId'];
$stockdetailpower = UserModel::getUserPower($userId);
$stockdetailpower = explode(',', $stockdetailpower[0]['powerName']);
$PHPExcel = new PHPExcel();
$PHPReader = new PHPExcel_Reader_Excel2007();
if (!$PHPReader->canRead($filePath)) {
$PHPReader = new PHPExcel_Reader_Excel5();
if (!$PHPReader->canRead($filePath)) {
echo 'no Excel';
return;
}
}
$PHPExcel = $PHPReader->load($filePath);
$currentSheet = $PHPExcel->getSheet(0);
$allRow = $currentSheet->getHighestRow();
for ($c = 2; $c <= $allRow; $c++) {
$data = array();
$nowtime = time();
$storeid = '';
$aa = 'A' . $c;
$bb = 'B' . $c;
$cc = 'C' . $c;
$dd = 'D' . $c;
$ee = 'E' . $c;
$ff = 'F' . $c;
$gg = 'G' . $c;
$hh = 'H' . $c;
$ii = 'I' . $c;
$jj = 'J' . $c;
$kk = 'K' . $c;
$ll = 'L' . $c;
$mm = 'M' . $c;
$nn = 'N' . $c;
$oo = 'O' . $c;
$pp = 'P' . $c;
$qq = 'Q' . $c;
$rr = 'R' . $c;
$ss = 'S' . $c;
$tt = 'T' . $c;
$sku = post_check(trim($currentSheet->getCell($bb)->getValue()));
if (!preg_match("/^[A-Z0-9]+(_[A-Z0-9]+)*\$/", $sku)) {
if ($sku != '') {
echo "数据料号:<font color='#FF0000'>" . $sku . "</font>书写不规范,请认真检查再提交...";
exit;
}
}
//检测是否导入完成
if (empty($sku)) {
$mask++;
if ($mask > 9) {
break;
}
continue;
} else {
$mask = 1;
}
// 过滤下数据
$goodsCost = trim($currentSheet->getCell($dd)->getValue());
$goodsWeight = trim($currentSheet->getCell($ff)->getValue());
if (!preg_match("/[\\d]/", $goodsCost) && $goodsCost != '') {
echo "货品成本数据有误";
exit;
} else {
if (!preg_match("/[\\d]/", $goodsWeight) && $goodsWeight != '') {
echo "货品重量数据有误";
exit;
}
}
$spu = post_check(trim($currentSheet->getCell($aa)->getValue()));
$goodsName = post_check(trim($currentSheet->getCell($cc)->getValue()));
$goodsCost = empty($goodsCost) ? 0 : round_num($goodsCost, 2);
//仓位号
$goods_location = post_check(trim($currentSheet->getCell($ee)->getValue()));
$goodsWeight = empty($goodsWeight) ? 0 : number_format($goodsWeight, 3, '.', '');
$goodsNote = post_check(trim($currentSheet->getCell($gg)->getValue()));
$goodsDecNameByEN = post_check(trim($currentSheet->getCell($hh)->getValue()));
$goodsCustomsCode = post_check(trim($currentSheet->getCell($ii)->getValue()));
$goodsDecNameByCN = post_check(trim($currentSheet->getCell($jj)->getValue()));
$goodsDecWorth = post_check(trim($currentSheet->getCell($kk)->getValue()));
$goodsLength = post_check(trim($currentSheet->getCell($ll)->getValue()));
$goodsWidth = post_check(trim($currentSheet->getCell($mm)->getValue()));
$goodsHeight = post_check(trim($currentSheet->getCell($nn)->getValue()));
//类别
$goods_categoryname = post_check(trim($currentSheet->getCell($oo)->getValue()));
//.........这里部分代码省略.........
示例5: ktz_pagenavi
function ktz_pagenavi($before = '', $after = '')
{
global $wpdb, $wp_query;
$pagenavi_options = array();
$pagenavi_options['pages_text'] = __('Page %CURRENT_PAGE% of %TOTAL_PAGES%:', ktz_theme_textdomain);
$pagenavi_options['current_text'] = __('%PAGE_NUMBER%', ktz_theme_textdomain);
$pagenavi_options['page_text'] = __('%PAGE_NUMBER%', ktz_theme_textdomain);
$pagenavi_options['first_text'] = __('First Page', ktz_theme_textdomain);
$pagenavi_options['last_text'] = __('Last Page', ktz_theme_textdomain);
$pagenavi_options['next_text'] = __('Next »', ktz_theme_textdomain);
$pagenavi_options['prev_text'] = __('« Previous', ktz_theme_textdomain);
$pagenavi_options['dotright_text'] = '...';
$pagenavi_options['dotleft_text'] = '...';
$pagenavi_options['num_pages'] = 3;
$pagenavi_options['always_show'] = 0;
$pagenavi_options['num_larger_page_numbers'] = 0;
$pagenavi_options['larger_page_numbers_multiple'] = 5;
if (!is_single()) {
$request = $wp_query->request;
$posts_per_page = intval(get_query_var('posts_per_page'));
$paged = intval(get_query_var('paged'));
$numposts = $wp_query->found_posts;
$max_page = $wp_query->max_num_pages;
if (empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = intval($pagenavi_options['num_pages']);
$larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);
$larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);
$pages_to_show_minus_1 = $pages_to_show - 1;
$half_page_start = floor($pages_to_show_minus_1 / 2);
$half_page_end = ceil($pages_to_show_minus_1 / 2);
$start_page = $paged - $half_page_start;
if ($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if ($end_page - $start_page != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if ($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if ($start_page <= 0) {
$start_page = 1;
}
$larger_per_page = $larger_page_to_show * $larger_page_multiple;
$larger_start_page_start = round_num($start_page, 10) + $larger_page_multiple - $larger_per_page;
$larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple;
$larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple;
$larger_end_page_end = round_num($end_page, 10) + $larger_per_page;
if ($larger_start_page_end - $larger_page_multiple == $start_page) {
$larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
$larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
}
if ($larger_start_page_start <= 0) {
$larger_start_page_start = $larger_page_multiple;
}
if ($larger_start_page_end > $max_page) {
$larger_start_page_end = $max_page;
}
if ($larger_end_page_end > $max_page) {
$larger_end_page_end = $max_page;
}
if ($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {
echo $before . '<ul class="pagination">' . "\n";
$pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
$pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
if (!empty($pages_text)) {
echo '<li class="disabled">';
echo '<span>' . $pages_text . '</span>';
echo '</li>';
}
if (get_previous_posts_link()) {
echo '<li>';
previous_posts_link($pagenavi_options['prev_text']);
echo '</li>';
}
if ($start_page >= 2 && $pages_to_show < $max_page) {
$first_page_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pagenavi_options['first_text']);
echo '<li><a href="' . esc_url(get_pagenum_link()) . '" class="first" title="' . $first_page_text . '">1</a></li>';
if (!empty($pagenavi_options['dotleft_text'])) {
echo '<li class="disabled"><span>' . $pagenavi_options['dotleft_text'] . '</span></li>';
}
}
if ($larger_page_to_show > 0 && $larger_start_page_start > 0 && $larger_start_page_end <= $max_page) {
for ($i = $larger_start_page_start; $i < $larger_start_page_end; $i += $larger_page_multiple) {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<li><a href="' . esc_url(get_pagenum_link($i)) . '" title="' . $page_text . '">' . $page_text . '</a></li>';
}
}
for ($i = $start_page; $i <= $end_page; $i++) {
if ($i == $paged) {
$current_page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['current_text']);
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<li class="active"><a href="' . esc_url(get_pagenum_link($i)) . '" title="' . $page_text . '">' . $current_page_text . '</a></li>';
} else {
$page_text = str_replace("%PAGE_NUMBER%", number_format_i18n($i), $pagenavi_options['page_text']);
echo '<li><a href="' . esc_url(get_pagenum_link($i)) . '" title="' . $page_text . '">' . $page_text . '</a></li>';
//.........这里部分代码省略.........
示例6: act_repeatShipments2
//.........这里部分代码省略.........
$ebay_packingCost = $packings[$pmId]['pmCost'];
//包材成本
$purchaseId = isset($goodsInfo['purchaseId']) ? $goodsInfo['purchaseId'] : '';
$cguser = $staffLists[$purchaseId];
//采购名称
$combineSku = GoodsModel::getCombineSkuinfo($orderDetailSku);
//判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false
if ($combineSku !== false) {
//为组合订单
$goods_costs = 0;
$combine_weight_list = array();
$goods_costs_list = array();
foreach ($skus as $k => $v) {
$goodsInfo2 = GoodsModel::getSkuinfo($k);
$combine_weight_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsWeight'];
//组合订单重量数组
$goods_costs_list[$k] = $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
//货本数组
$goods_costs += $orderDetailAmount * $v * $goodsInfo2['goodsCost'];
}
$row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
$excel->addRow($row);
foreach ($skus as $k => $v) {
$goodsInfo3 = GoodsModel::getSkuinfo($k);
$goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
$goods_weight = isset($goodsInfo3['goodsWeight']) ? $goodsInfo3['goodsWeight'] : 0;
$goods_location2 = CommonModel::getPositionBySku($k);
//仓位
$pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
$ebay_packingmaterial = $packings[$pmId]['pmName'];
$ebay_packingCost = $packings[$pmId]['pmCost'];
$purchaseId = isset($goodsInfo3[0]['purchaseId']) ? $goodsInfo3[0]['purchaseId'] : '';
$cguser = $staffLists[$purchaseId];
$ishipfee = round_num($goods_costs_list[$k] / array_sum($goods_costs_list) * $ebay_shipfee, 2);
//根据货本比ebay运费
$iorderweight2 = round($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderWhInfoActualWeight, 3);
$iordershipfee = round_num($combine_weight_list[$k] / array_sum($combine_weight_list) * $orderCalcShipping, 2);
$iprice = round_num(($goods_costs_list[$k] + $iordershipfee) / (array_sum($goods_costs_list) + $orderCalcShipping) * $ebay_itemprice, 2);
//根据货本比产品价格 last modified by herman.xi @20130916
$row = array('', '', '', '', $goods_location2, $k, $v, $goods_weight, $goods_cost, '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
$excel->addRow($row);
}
} else {
//非组合订单
$row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, $goods_location, $orderDetailSku, $orderDetailAmount, $goodsWeight, $goods_cost, $orderUserInfoCountryName, $OrderActualTotal, $ebay_shipfee, $orderExtenCurrency, $carrierName, $mailway_c, '', validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $totalweight, $username, $orderUserInfoPhone, $address, $orderUserInfoState, $orderUserInfoCity, $orderUserInfoZip, $orderId, $packinguser, '', $weighStaff, $districtStaff, '');
$excel->addRow($row);
}
unset($combine_weight_list);
unset($goods_costs_list);
} else {
//订单详细记录>1
$cctotal = 0;
$ebay_itemprice = 0;
$goods_costs = 0;
$goods_list = array();
$goods_lists = array();
$goods_weight_list = array();
$goods_costs_list = array();
$calculate_weight = 0;
foreach ($orderDetail as $orderDetailTotalData) {
//$orderDetailTotalData ,包括orderDetailData和orderDetailExtenData
$orderDetailData = $orderDetailTotalData['orderDetailData'];
//明细中的常用数据
$orderDetailExtenData = $orderDetailTotalData['orderDetailExtenData'];
//明细中的扩展数据
$detail_id = $orderDetailData['id'];
示例7: view_dresslinkOrderImport
//.........这里部分代码省略.........
if (empty($recordnumber)) {
$message .= "<font color=red> 第{$c}行recordnumber为空!</font><br>";
break;
}
/***************判断订单是否已存在***************/
$where = "where recordnumber='{$recordnumber}'";
$orderinfo = cndlModel::selectOrder($where);
if ($orderinfo) {
if ($is_order != 0) {
$message .= "<font color='blue'>订单 {$recordnumber}已存在!</font><br>";
}
continue;
}
/**************/
if ($is_order != 0) {
if ($cndlAccounts[$account] == "dresslink.com") {
$str = substr($recordnumber, 0, 2);
if ($str !== "DL") {
$message .= "<font color=red> {$recordnumber}不在账号{$cndlAccounts[$account]}中!</font><br>";
continue;
}
} elseif ($cndlAccounts[$account] == "cndirect.com") {
$str = substr($recordnumber, 0, 2);
if ($str !== "CN") {
$message .= "<font color=red> {$recordnumber}不在账号{$cndlAccounts[$account]}中!</font><br>";
continue;
}
}
$platformUsername = mysql_real_escape_string(trim($currentSheet->getCell($cc)->getValue()));
$email = mysql_real_escape_string(trim($currentSheet->getCell($dd)->getValue()));
$transId = mysql_real_escape_string(trim($currentSheet->getCell($ee)->getValue()));
$ordersTime = (array) PHPExcel_Shared_Date::ExcelToPHPObject(trim($currentSheet->getCell($ll)->getValue()));
$paymentTime = (array) PHPExcel_Shared_Date::ExcelToPHPObject(trim($currentSheet->getCell($mm)->getValue()));
$shippingFee = round_num(trim($currentSheet->getCell($oo)->getValue()), 2);
$calcWeight = round_num(trim($currentSheet->getCell($ahh)->getValue()), 3);
$actualTotal = round_num(trim($currentSheet->getCell($pp)->getValue()), 2);
$onlineTotal = round_num(trim($currentSheet->getCell($aff)->getValue()), 2);
$currency = mysql_real_escape_string(trim($currentSheet->getCell($qq)->getValue()));
//$orders['ebay_orderqk'] = round_num(trim($currentSheet->getCell($rr)->getValue()), 2);
$note = mysql_real_escape_string(trim($currentSheet->getCell($ss)->getValue()));
$username = mysql_real_escape_string(trim($currentSheet->getCell($tt)->getValue()));
$countryName = mysql_real_escape_string(trim($currentSheet->getCell($uu)->getValue()));
$state = mysql_real_escape_string(trim($currentSheet->getCell($vv)->getValue()));
$city = mysql_real_escape_string(trim($currentSheet->getCell($ww)->getValue()));
$street = mysql_real_escape_string(trim($currentSheet->getCell($xx)->getValue()));
$address2 = mysql_real_escape_string(trim($currentSheet->getCell($yy)->getValue()));
$zipCode = mysql_real_escape_string(trim($currentSheet->getCell($zz)->getValue()));
$phone = mysql_real_escape_string(trim($currentSheet->getCell($abb)->getValue()));
$landline = mysql_real_escape_string(trim($currentSheet->getCell($aaa)->getValue()));
if ($account == "dresslink.com") {
$feedback = mysql_real_escape_string(trim($currentSheet->getCell($ann)->getValue()));
} elseif ($account == "cndirect.com") {
$feedback = mysql_real_escape_string(trim($currentSheet->getCell($akk)->getValue()));
}
$carrierNameCn = strtolower(mysql_real_escape_string(trim($currentSheet->getCell($kk)->getValue())));
$carrierNameCn = cndlModel::carrier($carrierNameCn);
$payment_method = mysql_real_escape_string(trim($currentSheet->getCell($ff)->getValue()));
$payment_module = mysql_real_escape_string(trim($currentSheet->getCell($gg)->getValue()));
$bank_account = mysql_real_escape_string(trim($currentSheet->getCell($hh)->getValue()));
$bank_country = mysql_real_escape_string(trim($currentSheet->getCell($ii)->getValue()));
$shipping_method = mysql_real_escape_string(trim($currentSheet->getCell($jj)->getValue()));
$shipping_module = mysql_real_escape_string(trim($currentSheet->getCell($kk)->getValue()));
$dresslinks['payment_method'] = $payment_method;
$dresslinks['payment_module'] = $payment_module;
$dresslinks['bank_account'] = $bank_account;
$dresslinks['bank_country'] = $bank_country;
示例8: excel2array
function excel2array($PHPExcel, $filename, $rownums = 0, $num = 2)
{
$Worksheet = $PHPExcel->getActiveSheet();
$highestRow = $Worksheet->getHighestRow();
$highestColumn = $Worksheet->getHighestColumn();
$highestColumnIndex = empty($rownums) ? PHPExcel_Cell::columnIndexFromString($highestColumn) : $rownums;
$excelData = array();
for ($row = 1; $row <= $highestRow; $row++) {
for ($col = 0; $col < $highestColumnIndex; $col++) {
if ($highestColumnIndex > 100) {
break;
}
$value = $Worksheet->getCellByColumnAndRow($col, $row)->getValue();
if ($value instanceof PHPExcel_RichText) {
$value = $Worksheet->getCellByColumnAndRow($col, $row)->getValue()->getPlainText();
}
if (preg_match("/^[0-9]+\\.[0-9]+\$/", $value)) {
$value = empty($num) ? $value : round_num($value, $num);
}
$excelData[$row][] = $value;
}
}
return $excelData;
}
示例9: list
echo "</tr>\n</table>\n</form>\n";
}
}
## Forum Stats
if ($settings['forum_profile_statistics']) {
list($name, $posts, $age) = dbarraynum(dbquery("SELECT user_name, user_posts, user_joined FROM " . DB_USERS . " WHERE user_id=" . (int) $_GET['lookup']));
$posts = empty($posts) ? 0 : $posts;
list($threads) = dbarraynum(dbquery("SELECT COUNT(thread_id) FROM " . DB_THREADS . " WHERE thread_author=" . (int) $_GET['lookup']));
$threads = empty($threads) ? 0 : $threads;
$threadspday = round_num($threads / ((time() - $age) / (3600 * 24)));
$postspday = round_num($posts / ((time() - $age) / (3600 * 24)));
list($ranked_higher) = dbarraynum(dbquery("SELECT COUNT(user_id) FROM " . DB_USERS . " WHERE user_posts>" . $posts));
$rank = $ranked_higher + 1;
list($allposts) = dbarraynum(dbquery("SELECT SUM(forum_postcount) FROM " . DB_FORUMS));
$percentage = empty($posts) || empty($allposts) ? 0 : $posts * 100.0 / $allposts;
$percentage = round_num($percentage);
closetable();
opentable(sprintf($locale['forum_ext_title_profile'], $name));
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n\t<tr>\r\n\t\t\t\t\t<th class='forum-caption' width='1%' style='white-space: nowrap;' rowspan='2'><img alt='" . $locale['forum_ext_stats'] . "' src='" . IMAGES . "forum/forum_stats.png' /></th>\r\n\t\t\t\t\t<td class='tbl1'>\r\n\t\t\t\t\t\t" . number_format($threads) . " " . $locale['forum_ext_threads'] . " ::\r\n\t\t\t\t\t\t" . number_format($posts) . " " . $locale['forum_ext_posts'] . " ::\r\n\t\t\t\t\t\t" . $threadspday . " " . $locale['forum_ext_threadspday'] . " ::\r\n\t\t\t\t\t\t" . $postspday . " " . $locale['forum_ext_postspday'] . "\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td class='tbl1'>\r\n\t\t\t\t\t\t" . sprintf($locale['forum_ext_ranking'], $name, number_format($rank), $percentage) . "\r\n\t\t\t\t\t</td>\r\n\t\t\t\t</tr>\r\n\t\t\t</table>";
foreach (array("threads", "posts") as $type) {
$other_type = $type == "threads" ? "posts" : "threads";
if ($type == "threads") {
if (!isset($_GET['show']) || isset($_GET['show']) && $_GET['show'] != "posts") {
$visibility = "";
} else {
$visibility = "style='display: none;'";
}
} else {
if (isset($_GET['show']) && $_GET['show'] == "posts") {
$visibility = "";
} else {
示例10: act_searchPartionInfo
function act_searchPartionInfo($orderid)
{
$name = "wh_order_partion_records as a left join wh_order_partion_print as b on a.packageId=b.id";
$where = "where a.shipOrderId='{$orderid}' and a.is_delete=0";
$list = OmAvailableModel::getTNameList($name, "a.*,b.totalWeight,b.totalNum,b.status", $where);
if (empty($list)) {
return "订单号{$orderid}没有分区扫描记录!";
} else {
$show = '';
foreach ($list as $value) {
$pack_status = $value['status'] == 1 ? '已打包' : '未打包';
if (empty($value['scanUserId'])) {
$op_name = '无';
} else {
//配货人
$usermodel = UserModel::getInstance();
$iqc_user = $usermodel->getGlobalUserLists('global_user_name', "where a.global_user_id={$value['scanUserId']}", '', '');
$op_name = $iqc_user[0]['global_user_name'];
}
$scantime = $value['scanTime'] ? date('Y-m-d H:i:s', $value['scanTime']) : ' 无 ';
$weight = round_num($value['totalWeight'] / 1000, 3);
$show .= "订单号{$orderid} 扫描用户 > {$op_name} 所属包裹> {$value['packageId']} 所属分区 > {$value['partionId']} 包裹打包状态 > {$pack_status} 包裹总重 > {$weight} 包裹总数量 > {$value['totalNum']} 订单扫描日期 > {$scantime}<br>";
}
return $show;
}
}
示例11: act_ebayNoScanOutputOn
//.........这里部分代码省略.........
$totalweight = $orderWhInfoActualWeight;
// 总重量
$mailway_c = $channels[$OrderChannelId];
// 根据运输管理系统的接口获取
//$isContainCombineSku = CommonModel::judge_contain_combinesku ( $orderId ); // $ebay_combineorder 判断订单是否包含组合料号,返回true or false
$isContainCombineSku = false;
//默认订单不含虚拟料号
foreach ($orderDetail as $value) {
if (get_isCombineSku($value['orderDetail']['sku'])) {
$isContainCombineSku = true;
break;
}
}
if (count($orderDetail) == 1) {
// 订单明细中只有一条记录时,订单中只有一种料号
$orderDetailTotalData = array_pop($orderDetail);
// 取得orderDetail中的这条总记录数据,包括orderDetailData和orderDetailExtenData
$orderDetailData = $orderDetailTotalData['orderDetail'];
// 明细中的常用数据
$orderDetailExtenData = $orderDetailTotalData['orderDetailExtension'];
// 明细中的扩展数据
$orderDetailSku = $orderDetailData['sku'];
// 该明细下的$sku
$orderDetailExtenItemId = $orderDetailExtenData['itemId'];
// itemId $ebay_itemid
$orderDetailAmount = intval($orderDetailData['amount']);
// $amount 该明细下的sku对应的数量
$orderDetailRecordnumber = $orderDetailData['recordNumber'];
// 该明细对应平台的recordnumber $recordnumber
$orderDetailStoreId = $orderDetailData['storeId'];
//料号所在仓库id
$orderDetailItemPrice = round($orderDetailData['itemPrice'], 2) * $orderDetailAmount;
// itemPrice(平台对应的销售单价)*对应数量 $ebay_itemprice
$ebay_shipfee = round_num($OrderActualTotal - $orderDetailItemPrice, 2);
// 订单总价-sku对应的总价得出运费,$ebay_shipfee
//$skus = GoodsModel::get_realskuinfo ( $orderDetailSku ); // 获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息)
$skus = get_realskuinfo($orderDetailSku);
// 获取该sku下对应的真实料号信息(包括料号转换及组合料号对应真实料号信息)
$values_skus = array_values($skus);
// 得到sku的数量
//$combineSku = GoodsModel::getCombineSkuinfo ( $sku ); // 判断该sku是否是组合料号,如果是返回combineSku,sku,count关系记录数据,不是则返回false
if ($isContainCombineSku) {
// 为组合订单
$goods_costs = 0;
$combine_weight_list = array();
$goods_costs_list = array();
foreach ($skus as $k => $v) {
$goodsInfo2 = get_trueSkuInfo($k);
//获取真实料号信息
$combine_weight_list[$k] = $amount * $v * $goodsInfo2['goodsWeight'];
// 组合订单重量数组
$goods_costs_list[$k] = $amount * $v * $goodsInfo2['goodsCost'];
// 货本数组
$goods_costs += $amount * $v * $goodsInfo2['goodsCost'];
}
$row = array($orderWhInfoWeighTime, $accountName, $orderRecordnumber, $platformUsername, '', '', $amount * array_sum($values_skus), $orderUserInfoCountryName, $orderDetailItemPrice, $ebay_shipfee, $OrderActualTotal, $orderExtenCurrency, $packinguser, $orderTracknumberOne, validate_trackingnumber($orderTracknumberOne) ? '是' : '否', $orderWhInfoActualWeight, $orderCalcShipping, $carrierName, $orderId, $goods_costs, $orderExtenPayPalPaymentId, '', $isCopy, $isBuji, $isSplit, '', '', $isContainCombineSku ? '组合料号' : '', $mailway_c, $isCombinePackage, $orderExtenPayPalEmailAddress, '');
$excel->addRow($row);
foreach ($skus as $k => $v) {
$goodsInfo3 = get_trueSkuInfo($k);
$goods_cost = isset($goodsInfo3['goodsCost']) ? round($goodsInfo3['goodsCost'], 2) : 0;
$goods_location2Info = M('interfaceWh')->getSkuPosition($sku, $orderDetailStoreId);
$goods_location2 = $goods_location2Info['pName'];
// 仓位
$pmId = isset($goodsInfo3['pmId']) ? $goodsInfo3['pmId'] : '';
$ebay_packingmaterial = $packings[$pmId]['pmName'];
$ebay_packingCost = $packings[$pmId]['pmCost'];
示例12: dbquery
dbquery("UPDATE " . DB_SETTINGS . " SET settings_value=" . _db($values) . " WHERE settings_name='forum_statistics'");
}
$stat_values = explode("|", $settings['forum_statistics']);
$stat_keys = array("max_online_users");
$stats = array_combine($stat_keys, $stat_values);
$rowspan = "1";
// Forum Stats
if ($settings['forum_statistics_forumstats']) {
list($posts) = dbarraynum(dbquery("SELECT SUM(forum_postcount) FROM " . DB_FORUMS));
$posts = empty($posts) ? 0 : $posts;
list($threads) = dbarraynum(dbquery("SELECT SUM(forum_threadcount) FROM " . DB_FORUMS));
$threads = empty($threads) ? 0 : $threads;
list($age) = dbarraynum(dbquery("SELECT user_joined from " . DB_USERS . " WHERE user_id=1"));
$age = empty($age) ? 0 : $age;
$threadspday = round_num($threads / ((time() - $age) / (3600 * 24)));
$postspday = round_num($posts / ((time() - $age) / (3600 * 24)));
$rowspan++;
}
// Top Posters
if ($settings['forum_statistics_topposters']) {
list($tposter_id, $tposter_name, $tposter_status, $tposter_posts) = dbarraynum(dbquery("SELECT user_id, user_name, user_status, user_posts FROM " . DB_USERS . " ORDER BY user_posts DESC LIMIT 1"));
list($aposter_id, $aposter_name, $aposter_status, $aposter_ppday) = dbarraynum(dbquery("SELECT user_id, user_name, user_status, (user_posts/((" . time() . "-user_joined)/(24*3600))) FROM " . DB_USERS . " WHERE user_joined < (" . time() . "-(3600*24)) ORDER BY user_posts DESC LIMIT 1"));
$rowspan++;
}
// User Stats
if ($settings['forum_statistics_userstats']) {
pif_cache("online_users");
$total_online = $pif_cache['online_users']['guests'] + count($pif_cache['online_users']['members']);
list($max_online, $max_online_time) = explode(":", $stats['max_online_users']);
if ($total_online > $max_online) {
$stats['max_online_users'] = $total_online . ":" . time();
示例13: act_insertDresslinkOrder
//.........这里部分代码省略.........
if (empty($recordNumber)) {
break;
}
/***************判断订单是否已存在***************/
if (M('OrderAdd')->checkIsExists(array('recordNumber' => $recordNumber, 'accountId' => $account))) {
self::$errMsg[] = get_promptmsg(10043, $recordNumber);
//"该recordNumber已经存在<br/>";
continue;
}
/**************/
$is_order = intval($currentSheet->getCell($bb)->getValue());
//1代表为订单,0代表订单明细
if ($is_order != 0) {
//为订单
//这个验证可以不用
//if($cndlAccounts[$account]=="dresslink.com"){
// $str = substr($recordNumber,0,2);
// if($str!=="DL"){
// $message .= "<font color=red> {$recordNumber}不在账号{$cndlAccounts[$account]}中!</font><br>";
// continue;
// }
// }elseif($cndlAccounts[$account]=="cndirect.com"){
// $str = substr($recordNumber,0,2);
// if($str!=="CN"){
// $message .= "<font color=red> {$recordNumber}不在账号{$cndlAccounts[$account]}中!</font><br>";
// continue;
// }
// }
$platformUsername = mysql_real_escape_string(trim($currentSheet->getCell($cc)->getValue()));
$email = mysql_real_escape_string(trim($currentSheet->getCell($dd)->getValue()));
$transId = mysql_real_escape_string(trim($currentSheet->getCell($ee)->getValue()));
$ordersTime = (array) PHPExcel_Shared_Date::ExcelToPHPObject(trim($currentSheet->getCell($ll)->getValue()));
$paymentTime = (array) PHPExcel_Shared_Date::ExcelToPHPObject(trim($currentSheet->getCell($mm)->getValue()));
$shippingFee = round_num(trim($currentSheet->getCell($oo)->getValue()), 2);
$calcWeight = round_num(trim($currentSheet->getCell($ahh)->getValue()), 3);
$actualTotal = round_num(trim($currentSheet->getCell($pp)->getValue()), 2);
$onlineTotal = round_num(trim($currentSheet->getCell($aff)->getValue()), 2);
$currency = mysql_real_escape_string(trim($currentSheet->getCell($qq)->getValue()));
//$orders['ebay_orderqk'] = round_num(trim($currentSheet->getCell($rr)->getValue()), 2);
$note = mysql_real_escape_string(trim($currentSheet->getCell($ss)->getValue()));
$username = mysql_real_escape_string(trim($currentSheet->getCell($tt)->getValue()));
$countryName = mysql_real_escape_string(trim($currentSheet->getCell($uu)->getValue()));
$state = mysql_real_escape_string(trim($currentSheet->getCell($vv)->getValue()));
$city = mysql_real_escape_string(trim($currentSheet->getCell($ww)->getValue()));
$street = mysql_real_escape_string(trim($currentSheet->getCell($xx)->getValue()));
$address2 = mysql_real_escape_string(trim($currentSheet->getCell($yy)->getValue()));
$zipCode = mysql_real_escape_string(trim($currentSheet->getCell($zz)->getValue()));
$phone = mysql_real_escape_string(trim($currentSheet->getCell($abb)->getValue()));
$landline = mysql_real_escape_string(trim($currentSheet->getCell($aaa)->getValue()));
// if($account == 400){ //dresslink.com
// $feedback = mysql_real_escape_string(trim($currentSheet->getCell($ann)->getValue()));
// }elseif($account == 410){ //cndirect.com
// $feedback = mysql_real_escape_string(trim($currentSheet->getCell($akk)->getValue()));
// }
$carrierNameCn = strtolower(mysql_real_escape_string(trim($currentSheet->getCell($kk)->getValue())));
$payment_method = mysql_real_escape_string(trim($currentSheet->getCell($ff)->getValue()));
$payment_module = mysql_real_escape_string(trim($currentSheet->getCell($gg)->getValue()));
$bank_account = mysql_real_escape_string(trim($currentSheet->getCell($hh)->getValue()));
$bank_country = mysql_real_escape_string(trim($currentSheet->getCell($ii)->getValue()));
$shipping_method = mysql_real_escape_string(trim($currentSheet->getCell($jj)->getValue()));
$shipping_module = mysql_real_escape_string(trim($currentSheet->getCell($kk)->getValue()));
//这个dresslinks_info表在新系统已经废除了
//$dresslinks['payment_method'] = $payment_method;
// $dresslinks['payment_module'] = $payment_module;
// $dresslinks['bank_account'] = $bank_account;
// $dresslinks['bank_country'] = $bank_country;
示例14: time
//淘宝产品标价
$orderdata_detail['amount'] = $order['num'];
//SKU数量
//$orderdata_detail["shippingFee"] = '';
//$orderdata_detail["reviews"] = '';
$orderdata_detail['createdTime'] = time();
/*************END 订单详细数据***************/
/***************BEGIN 订单详细扩展表数据***************/
$orderDetailExtTaobao = array();
$orderDetailExtTaobao['itemTitle'] = $order['title'] . "#" . $order['sku_properties_name'] . "#";
//产品名称;
$orderDetailExtTaobao['itemURL'] = $order['pic_path'];
$orderDetailExtTaobao['itemId'] = $order['sku_id'];
$orderDetailExtTaobao['transId'] = $recordnumber;
// 交易id;
$orderDetailExtTaobao['note'] = round_num($order['payment'], 2);
//实际SKU付款价
/*************END 订单详细扩展表数据***************/
$obj_order_detail_data[] = array('orderDetail' => $orderdata_detail, 'orderDetailExtension' => $orderDetailExtTaobao);
}
//包含HH555料号的订单移动到淘宝待审核
if (in_array('HH555', $sku_infos)) {
$orderdata['orderType'] = C('STATEPENDING_LYNXPEND');
}
$insertOrder = array('order' => $orderdata, 'orderExtension' => $orderExtTaobao, 'orderUserInfo' => $orderUserInfo, 'orderDetail' => $obj_order_detail_data);
$calcOrderShippingObj = F('CalcOrderShipping');
$calcOrderShippingObj->setOrder($insertOrder);
$calcInfo = $calcOrderShippingObj->calcOrderWeight();
//计算重量和包材
//var_dump($calcInfo); exit;
$insertOrder['orderData']['calcWeight'] = $calcInfo[0];
示例15: pagenavi
function pagenavi($query, $before = '', $after = '')
{
wp_reset_query();
global $wpdb, $paged;
$pagenavi_options = array();
//$pagenavi_options['pages_text'] = ('Page %CURRENT_PAGE% of %TOTAL_PAGES%:');
$pagenavi_options['pages_text'] = '';
$pagenavi_options['current_text'] = '%PAGE_NUMBER%';
$pagenavi_options['page_text'] = '%PAGE_NUMBER%';
$pagenavi_options['first_text'] = __('First Page', 'swiftframework');
$pagenavi_options['last_text'] = __('Last Page', 'swiftframework');
$pagenavi_options['next_text'] = __("Next <i class='ss-navigateright'></i>", "swiftframework");
$pagenavi_options['prev_text'] = __("<i class='ss-navigateleft'></i> Previous", "swiftframework");
$pagenavi_options['dotright_text'] = '...';
$pagenavi_options['dotleft_text'] = '...';
$pagenavi_options['num_pages'] = 5;
//continuous block of page numbers
$pagenavi_options['always_show'] = 0;
$pagenavi_options['num_larger_page_numbers'] = 0;
$pagenavi_options['larger_page_numbers_multiple'] = 5;
$output = "";
//If NOT a single Post is being displayed
/*http://codex.wordpress.org/Function_Reference/is_single)*/
if (!is_single()) {
$request = $query->request;
//intval - Get the integer value of a variable
/*http://php.net/manual/en/function.intval.php*/
$posts_per_page = intval(get_query_var('posts_per_page'));
//Retrieve variable in the WP_Query class.
/*http://codex.wordpress.org/Function_Reference/get_query_var*/
if (get_query_var('paged')) {
$paged = get_query_var('paged');
} elseif (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
}
$numposts = $query->found_posts;
$max_page = $query->max_num_pages;
//empty - Determine whether a variable is empty
/*http://php.net/manual/en/function.empty.php*/
if (empty($paged) || $paged == 0) {
$paged = 1;
}
$pages_to_show = intval($pagenavi_options['num_pages']);
$larger_page_to_show = intval($pagenavi_options['num_larger_page_numbers']);
$larger_page_multiple = intval($pagenavi_options['larger_page_numbers_multiple']);
$pages_to_show_minus_1 = $pages_to_show - 1;
$half_page_start = floor($pages_to_show_minus_1 / 2);
//ceil - Round fractions up (http://us2.php.net/manual/en/function.ceil.php)
$half_page_end = ceil($pages_to_show_minus_1 / 2);
$start_page = $paged - $half_page_start;
if ($start_page <= 0) {
$start_page = 1;
}
$end_page = $paged + $half_page_end;
if ($end_page - $start_page != $pages_to_show_minus_1) {
$end_page = $start_page + $pages_to_show_minus_1;
}
if ($end_page > $max_page) {
$start_page = $max_page - $pages_to_show_minus_1;
$end_page = $max_page;
}
if ($start_page <= 0) {
$start_page = 1;
}
$larger_per_page = $larger_page_to_show * $larger_page_multiple;
//round_num() custom function - Rounds To The Nearest Value.
$larger_start_page_start = round_num($start_page, 10) + $larger_page_multiple - $larger_per_page;
$larger_start_page_end = round_num($start_page, 10) + $larger_page_multiple;
$larger_end_page_start = round_num($end_page, 10) + $larger_page_multiple;
$larger_end_page_end = round_num($end_page, 10) + $larger_per_page;
if ($larger_start_page_end - $larger_page_multiple == $start_page) {
$larger_start_page_start = $larger_start_page_start - $larger_page_multiple;
$larger_start_page_end = $larger_start_page_end - $larger_page_multiple;
}
if ($larger_start_page_start <= 0) {
$larger_start_page_start = $larger_page_multiple;
}
if ($larger_start_page_end > $max_page) {
$larger_start_page_end = $max_page;
}
if ($larger_end_page_end > $max_page) {
$larger_end_page_end = $max_page;
}
if ($max_page > 1 || intval($pagenavi_options['always_show']) == 1) {
/*http://php.net/manual/en/function.str-replace.php */
/*number_format_i18n(): Converts integer number to format based on locale (wp-includes/functions.php*/
$pages_text = str_replace("%CURRENT_PAGE%", number_format_i18n($paged), $pagenavi_options['pages_text']);
$pages_text = str_replace("%TOTAL_PAGES%", number_format_i18n($max_page), $pages_text);
$output .= $before . '<ul class="pagenavi bar-styling">' . "\n";
if (!empty($pages_text)) {
$output .= '<li><span class="pages">' . $pages_text . '</span></li>';
}
//Displays a link to the previous post which exists in chronological order from the current post.
/*http://codex.wordpress.org/Function_Reference/previous_post_link*/
if ($paged > 1) {
$output .= '<li class="prev">' . get_previous_posts_link($pagenavi_options['prev_text']) . '</li>';
}
if ($start_page >= 2 && $pages_to_show < $max_page) {
//.........这里部分代码省略.........