本文整理汇总了PHP中Validator::isValidInt方法的典型用法代码示例。如果您正苦于以下问题:PHP Validator::isValidInt方法的具体用法?PHP Validator::isValidInt怎么用?PHP Validator::isValidInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Validator
的用法示例。
在下文中一共展示了Validator::isValidInt方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onAction
/**
*
*/
function onAction()
{
global $application;
$request = $application->getInstance('Request');
$mode = $request->getValueByKey('mode');
if (!$mode && modApiFunc('Session', 'is_Set', 'SupportMode')) {
modApiFunc('Session', 'un_Set', 'SupportMode');
} else {
$_mode = explode("|", $mode);
$mode = modApiFunc('Session', 'is_Set', 'SupportMode') ? modApiFunc('Session', 'get', 'SupportMode') : ASC_S_DISABLE;
foreach ($_mode as $flag) {
if (Validator::isValidInt($flag)) {
$mode |= $flag;
} elseif (defined($flag)) {
$mode |= constant($flag);
}
}
if ($mode == ASC_S_DISABLE) {
if (modApiFunc('Session', 'is_Set', 'SupportMode')) {
modApiFunc('Session', 'un_Set', 'SupportMode');
}
} else {
modApiFunc('Session', 'set', 'SupportMode', $mode);
}
}
}
示例2: initSource
function initSource()
{
$type = modApiFunc('Request', 'getValueByKey', 'type');
if ($type == "robot") {
$id = modApiFunc('Request', 'getValueByKey', 'id');
//$date = modApiFunc('Request','getValueByKey','date');
$this->__source->setParams('id', $id);
//$this->__source->setParams('date', $date);
} else {
parent::initSource();
$seance_id = modApiFunc('Request', 'getValueByKey', 'sid');
if (Validator::isValidInt($seance_id) == true) {
$this->__source->setParams('seance_ids', array($seance_id));
}
}
}
示例3: outputReportRows
function outputReportRows()
{
$x = 0;
$y = 1;
$field_list = $this->__report_settings->getColumnList();
foreach ($this->__report_settings->getReportData() as $row_data) {
$x = 0;
foreach ($field_list as $field) {
$value = isset($row_data[$field]) ? $row_data[$field] : '';
if (Validator::isValidInt($value) or Validator::isValidFloat($value)) {
$this->__excel->writeNumber($y, $x, $value);
} else {
$this->__excel->writeLabel($y, $x, $value);
}
$x++;
}
$y++;
}
}
示例4: check
function check()
{
$this->errors = array();
if (empty($this->id)) {
$this->errors[] = GC_E_FIELD_ID;
}
if (empty($this->code)) {
$this->errors[] = GC_E_FIELD_CODE;
}
if (empty($this->to)) {
$this->errors[] = GC_E_FIELD_TO;
}
if (empty($this->from)) {
$this->errors[] = GC_E_FIELD_FROM;
}
if (Validator::isValidFloat($this->amount) == false || $this->amount < 0.01) {
$this->errors[] = GC_E_FIELD_AMOUNT;
}
if (!preg_match('/^[0-9\\.]+$/', $this->amount)) {
$this->errors[] = GC_E_FIELD_AMOUNT_SEPARATOR;
}
$this->amount = floor($this->amount * 100) / 100;
if (Validator::isValidFloat($this->remainder) == false || $this->remainder < 0) {
$this->errors[] = GC_E_FIELD_REMAINDER;
}
$this->remainder = floor($this->remainder * 100) / 100;
if ($this->remainder > $this->amount) {
$this->errors[] = GC_E_AMOUNT_LESS_REMAINDER;
}
if (Validator::isValidInt($this->date_created) == false) {
$this->errors[] = GC_E_FIELD_DATE_CREATED;
}
if ($this->sendtype != GC_SENDTYPE_EMAIL && $this->sendtype != GC_SENDTYPE_POST) {
$this->errors[] = GC_E_FIELD_SENDTYPE;
}
if ($this->status != GC_STATUS_ACTIVE && $this->status != GC_STATUS_BLOCKED && $this->status != GC_STATUS_PENDING) {
$this->errors[] = GC_E_FIELD_STATUS;
}
if ($this->sendtype == GC_SENDTYPE_EMAIL && !Validator::isValidEmail($this->email)) {
$this->errors[] = GC_E_FIELD_EMAIL;
}
if ($this->sendtype == GC_SENDTYPE_POST) {
if (empty($this->fname)) {
$this->errors[] = GC_E_FIELD_FNAME;
}
if (empty($this->lname)) {
$this->errors[] = GC_E_FIELD_LNAME;
}
if (empty($this->address)) {
$this->errors[] = GC_E_FIELD_ADDRESS;
}
if (empty($this->city)) {
$this->errors[] = GC_E_FIELD_CITY;
}
if (empty($this->zip)) {
$this->errors[] = GC_E_FIELD_ZIP;
}
if (empty($this->country_id)) {
$this->errors[] = GC_E_FIELD_COUNTRYID;
}
if (empty($this->state_id)) {
$this->errors[] = GC_E_FIELD_STATEID;
}
}
return empty($this->errors);
}
示例5: getTag
//.........这里部分代码省略.........
break;
case 'To':
$value = $this->To;
break;
case 'CategoryStatistics':
$value = $this->outputCategoryStatistics();
break;
case 'CurrensySign':
$value = modApiFunc("Localization", "getCurrencySign");
break;
case 'ProductOfflineStatusReason':
$prod_status_id = $this->_Current_Product->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA);
$value = $prod_status_id == PRODUCT_STATUS_ONLINE ? getMsg('SYS', "PRODUCT_PARENT_STATUS_ONLINE") : "";
break;
case 'ProductOfflineStatusColor':
// Offline.
// Online, , Offline - .
$prod_status_id = $this->_Current_Product->getProductTagValue('Available', PRODUCTINFO_NOT_LOCALIZED_DATA);
$value = $prod_status_id == PRODUCT_STATUS_ONLINE ? "rgb(175, 175, 175)" : "#FF0000";
break;
case 'ProductCatsCount':
$value = count($this->_Current_Product->getCategoriesIDs());
break;
case 'ProductCatsList':
$_ps = array();
$_cts = $this->_Current_Product->getCategoriesIDs();
foreach ($_cts as $cid) {
$_ps[] = $this->_cats_paths[$cid];
}
asort($_ps);
$_ps = array_map("addslashes", array_map("_ml_htmlentities", $_ps));
$value = implode("<br>", $_ps);
break;
case 'ProductQuantityInStock':
if ($this->_Current_Product->whichStockControlMethod() == PRODUCT_OPTIONS_INVENTORY_TRACKING) {
$value = "";
$inv_qty = modApiFunc('Product_Options', 'getQuantityInStockByInventoryTable', 'product', $this->_Current_Product->getProductTagValue('ID'));
if (Validator::isValidInt($inv_qty) == true) {
$value = $inv_qty . ' ' . modApiFunc('Localization', 'getUnitTypeValue', 'item');
}
} else {
$value = $this->_Current_Product->getProductTagValue('QuantityInStock', PRODUCTINFO_NOT_LOCALIZED_DATA);
if (Validator::isValidInt($value) == true) {
$value = $this->_Current_Product->getProductTagValue('QuantityInStock', PRODUCTINFO_LOCALIZED_DATA);
}
}
break;
case 'HeaderData':
if (empty($this->psf_filter)) {
$value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-header-category-data.tpl.html", array());
} else {
$value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-header-searchform-data.tpl.html", array());
}
break;
case 'SearchFilterData':
$value = $this->getSearchFilterDataText();
break;
case 'FooterData':
if (empty($this->psf_filter)) {
$value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-footer-category-data.tpl.html", array());
} else {
$value = modApiFunc('TmplFiller', 'fill', "catalog/prod_list/", "list-footer-searchform-data.tpl.html", array());
}
break;
case 'IfSearchFormActive':
$value = empty($this->psf_filter) ? '' : 'Y';
break;
case 'ProductThumbnail':
$value = modApiFunc('TmplFiller', 'fill', 'catalog/prod_list/', 'list_item_image.tpl.html', array());
break;
case 'Local_NoImageSrc':
$value = $application->getAppIni('URL_IMAGES_DIR') . 'noimage.png';
break;
case 'Local_SelectCategoriesProducts':
$categorylist = modApiFunc("Catalog", "getSubcategoriesFullListWithParent", 1, false);
foreach ($categorylist as $val => $data) {
$catvalid = $data["id"];
if ($data['level'] == 2) {
$value = '<option value="' . $catvalid . '" ' . ($CatID == $catvalid ? 'selected' : '') . '> ' . $data["name"] . '</option>';
} else {
$value = '<option value="' . $catvalid . '" ' . ($CatID == $catvalid ? 'selected' : '') . '>' . $data["name"] . '</option>';
}
}
break;
default:
if (_ml_strpos($tag, 'Local_SortBy') === 0) {
$tag = _ml_substr($tag, _ml_strlen('Local_SortBy'));
$value = $this->getSortLink($tag);
break;
}
if (_ml_strpos($tag, 'Product') === 0) {
$tag = _ml_substr($tag, _ml_strlen('Product'));
}
if (is_object($this->_Current_Product) && $this->_Current_Product->isTagExists($tag)) {
$value = $this->_Current_Product->getProductTagValue($tag);
}
break;
}
return $value;
}
示例6: formatTimeDuration
function formatTimeDuration($seconds)
{
if (Validator::isValidInt($seconds) == false) {
return $seconds;
}
if ($seconds < 60) {
return $this->__formatSecondsDuration($seconds);
} elseif ($seconds < 3600) {
return $this->__formatMinutesDuration($seconds);
} else {
return $this->__formatHoursDuration($seconds);
}
}
示例7: __isValidParamValue
function __isValidParamValue($group_name, $param_name, $value)
{
loadCoreFile('validator.php');
$param_info = $this->getParamBaseInfo($group_name, $param_name);
$result = false;
switch ($param_info['PARAM_TYPE']) {
case PARAM_TYPE_FLOAT:
$result = Validator::isValidFloat($value);
break;
case PARAM_TYPE_INT:
$result = Validator::isValidInt($value);
break;
case PARAM_TYPE_LIST:
$result = in_array($value, $this->getParamValueList($param_info['GROUP_NAME'], $param_info['PARAM_NAME']));
break;
case PARAM_TYPE_STRING:
$result = true;
break;
}
if ($result == true) {
$validator_class = $param_info['PARAM_VALIDATOR']['CLASS'];
$validator_method = $param_info['PARAM_VALIDATOR']['METHOD'];
if (!class_exists($validator_class)) {
loadClass($validator_class);
if (!class_exists($validator_class) or !method_exists($validator_class, $validator_method)) {
_fatal(__CLASS__ . '::' . __FUNCTION__ . ":<br>Method <i>{$validator_method}</i> or class <i>{$validator_class}</i> does not exist!");
}
}
return call_user_func(array($validator_class, $validator_method), $value);
} else {
return false;
}
}