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


PHP validation::is_integer_no_zero方法代码示例

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


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

示例1: tu_validation


//.........这里部分代码省略.........
    $description = trim(stripslashes(InPost('description')));
    if (!$validator->required($description)) {
        $errors['description'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($description, 4, 5000)) {
        $errors['description'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    //$tservice->requirement = trim(htmlspecialchars(InPost('requirement'),ENT_QUOTES, "cp1251"));
    //$requirement = trim(InPost('requirement'));
    $tservice->requirement = trim(__paramInit('html', null, 'requirement', null, 5000, true));
    $requirement = trim(stripslashes(InPost('requirement')));
    if (!$validator->required($requirement)) {
        $errors['requirement'] = validation::VALIDATION_MSG_REQUIRED;
    } elseif (!$validator->symbols_interval($requirement, 4, 5000)) {
        $errors['requirement'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 5000);
    }
    //---
    $extra = __paramInit('array', null, 'extra', array());
    $extra = is_array($extra) ? array_values($extra) : array();
    $total_extra_price = 0;
    if (count($extra)) {
        $key = 0;
        $tservice->extra = null;
        foreach ($extra as $el) {
            if (isset($el['title'], $el['price'], $el['days_db_id'])) {
                $el['title'] = stripslashes($el['title']);
                $title = trim(htmlspecialchars($el['title'], ENT_QUOTES, 'cp1251'));
                $title_native = trim($el['title']);
                $price = trim($el['price']);
                if (!$validator->required($title_native) && !$validator->required($price)) {
                    continue;
                }
                $is_title = $validator->min_length($title_native, 4) && $validator->max_length($title_native, 255);
                $is_price = $validator->is_integer_no_zero($price) && $validator->numeric_interval($price, -999999, 999999);
                if (!$is_price) {
                    $errors['extra'][$key]['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
                }
                if (!$is_title) {
                    $errors['extra'][$key]['title'] = sprintf(validation::VALIDATION_MSG_SYMBOLS_INTERVAL, 4, 255);
                }
                $days = trim($el['days_db_id']);
                $is_days = $validator->is_natural($days) && $validator->less_than_equal_to($days, 5);
                if (!$is_days) {
                    $errors['extra'][$key]['days'] = sprintf(validation::VALIDATION_MSG_INTERVAL, '0', '5 дней');
                    $days = 1;
                }
                $price = intval($price);
                $days = intval($days);
                $tservice->extra[$key] = array('title' => $title, 'price' => $price, 'days' => $days);
                ++$key;
                if ($price < 0) {
                    $total_extra_price += $price;
                }
            }
        }
    }
    //---
    $tservice->is_express = 'f';
    $tservice->express_price = 0;
    $tservice->express_days = 1;
    if (InPost('express_activate') == 1 && $tservice->days > 1) {
        $express = InPost('express');
        $price = trim($express['price']);
        if (!$validator->is_natural_no_zero($price) || !$validator->less_than_equal_to($price, 999999)) {
            $errors['express']['price'] = validation::VALIDATION_MSG_REQUIRED_PRICE;
        }
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:67,代码来源:functions.php


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