本文整理汇总了PHP中is_int函数的典型用法代码示例。如果您正苦于以下问题:PHP is_int函数的具体用法?PHP is_int怎么用?PHP is_int使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_int函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: system_add_credentials
function system_add_credentials()
{
if (!isset($_POST['AddCredentials'])) {
$details = new stdClass();
$details->system_id = intval($this->uri->segment(3, 0));
if (!is_int($details->system_id) or $details->system_id == 0) {
redirect('main/list_devices');
}
$this->load->model("m_system");
$this->data['system_id'] = $details->system_id;
$this->data['ip_address'] = ip_address_from_db($this->m_system->check_man_ip_address($details->system_id));
$this->data['heading'] = 'Add Device SNMP Credentials';
$this->data['include'] = 'v_add_system_c';
$this->load->view('v_template', $this->data);
} else {
$system_id = $_POST['system_id'];
$this->load->model("m_system");
$this->load->library('encrypt');
if ($_POST['snmp_community'] > '' and $_POST['snmp_version'] > '' and $_POST['ip_address'] > '') {
$encode['ip_address'] = $_POST['ip_address'];
$encode['snmp_version'] = $_POST['snmp_version'];
$encode['snmp_community'] = $_POST['snmp_community'];
$encoded = json_encode($encode);
$encoded = $this->encrypt->encode($encoded);
$this->m_system->update_system_man($system_id, 'access_details', $encoded);
if ($_POST['snmp_scan'] == TRUE) {
redirect('admin_system/system_snmp/' . $system_id);
} else {
redirect('main/system_display/' . $system_id);
}
} else {
redirect('admin_system/system_add_credentials/' . $system_id);
}
}
}
开发者ID:kumarsivarajan,项目名称:ctrl-dock,代码行数:35,代码来源:admin_system.php
示例2: setSelected
public function setSelected($value = 'yes')
{
if (is_string($value) && ($value == 'yes' || $value == 'selected' || $value == 'on') || is_int($value) && $value != 0) {
return $this->attributes['selected'] = 'selected';
}
$this->removeAttribute('selected');
}
开发者ID:songyuanjie,项目名称:zabbix-stats,代码行数:7,代码来源:class.ccomboitem.php
示例3: addCommandsFromClass
public function addCommandsFromClass($className, $passThrough = null)
{
$roboTasks = new $className();
$commandNames = array_filter(get_class_methods($className), function ($m) {
return !in_array($m, ['__construct']);
});
foreach ($commandNames as $commandName) {
$command = $this->createCommand(new TaskInfo($className, $commandName));
$command->setCode(function (InputInterface $input) use($roboTasks, $commandName, $passThrough) {
// get passthru args
$args = $input->getArguments();
array_shift($args);
if ($passThrough) {
$args[key(array_slice($args, -1, 1, TRUE))] = $passThrough;
}
$args[] = $input->getOptions();
$res = call_user_func_array([$roboTasks, $commandName], $args);
if (is_int($res)) {
exit($res);
}
if (is_bool($res)) {
exit($res ? 0 : 1);
}
if ($res instanceof Result) {
exit($res->getExitCode());
}
});
$this->add($command);
}
}
开发者ID:stefanhuber,项目名称:Robo,代码行数:30,代码来源:Application.php
示例4: index
public function index()
{
$this->load_language('product/manufacturer');
$this->load->model('catalog/manufacturer');
$this->load->model('tool/image');
$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);
$this->data['breadcrumbs'][] = array('text' => $this->language->get('text_brand'), 'href' => $this->url->link('product/manufacturer'), 'separator' => $this->language->get('text_separator'));
$this->data['categories'] = array();
$results = $this->model_catalog_manufacturer->getManufacturers();
foreach ($results as $result) {
if (is_int(substr($result['name'], 0, 1))) {
$key = '0 - 9';
} else {
$key = substr(strtoupper($this->getFirstLetter($result['name'])), 0, 1);
}
if (!isset($this->data['manufacturers'][$key])) {
$this->data['categories'][$key]['name'] = $key;
}
$this->data['categories'][$key]['manufacturer'][] = array('name' => $result['name'], 'href' => $this->url->link('product/manufacturer/product', 'manufacturer_id=' . $result['manufacturer_id']));
}
sort($this->data['categories']);
$this->data['continue'] = $this->url->link('common/home');
if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/manufacturer_list.tpl')) {
$this->template = $this->config->get('config_template') . '/template/product/manufacturer_list.tpl';
} else {
$this->template = 'default/template/product/manufacturer_list.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:myjavawork,项目名称:shcoyee,代码行数:32,代码来源:manufacturer.php
示例5: indexMetadataObjects
/**
* @param KalturaMetadataFilter $filter
* @param $shouldUpdate
* @return int
*/
protected function indexMetadataObjects(KalturaMetadataFilter $filter, $shouldUpdate)
{
$filter->orderBy = KalturaMetadataOrderBy::CREATED_AT_ASC;
$metadataPlugin = KalturaMetadataClientPlugin::get(KBatchBase::$kClient);
$metadataList = $metadataPlugin->metadata->listAction($filter, $this->pager);
if (!count($metadataList->objects)) {
return 0;
}
KBatchBase::$kClient->startMultiRequest();
foreach ($metadataList->objects as $metadata) {
$metadataPlugin->metadata->index($metadata->id, $shouldUpdate);
}
$results = KBatchBase::$kClient->doMultiRequest();
foreach ($results as $index => $result) {
if (!is_int($result)) {
unset($results[$index]);
}
}
if (!count($results)) {
return 0;
}
$lastIndexId = end($results);
$this->setLastIndexId($lastIndexId);
return count($results);
}
开发者ID:DBezemer,项目名称:server,代码行数:30,代码来源:KIndexingMetadataEngine.php
示例6: detach
public function detach(odObserver $observer)
{
if (is_int($key = array_search($observer, $this->__observers, true))) {
unset($this->__observers[$key]);
}
return $this;
}
开发者ID:orchid,项目名称:orchid,代码行数:7,代码来源:odObservable.class.php
示例7: setTimeout
public function setTimeout($seconds)
{
if (is_int($seconds)) {
$this->timeout = $seconds;
return true;
}
}
开发者ID:kaushikkothiya,项目名称:crm,代码行数:7,代码来源:Mcapi.php
示例8: checkType
/**
* Returns `true` if value is of the specified type
*
* @param string $type
* @param mixed $value
* @return bool
*/
protected function checkType($type, $value)
{
switch ($type) {
case 'array':
return is_array($value);
case 'bool':
case 'boolean':
return is_bool($value);
case 'callable':
return is_callable($value);
case 'float':
case 'double':
return is_float($value);
case 'int':
case 'integer':
return is_int($value);
case 'null':
return is_null($value);
case 'numeric':
return is_numeric($value);
case 'object':
return is_object($value);
case 'resource':
return is_resource($value);
case 'scalar':
return is_scalar($value);
case 'string':
return is_string($value);
case 'mixed':
return true;
default:
return $value instanceof $type;
}
}
开发者ID:ramsey,项目名称:collection,代码行数:41,代码来源:TypeTrait.php
示例9: assertInteger
private function assertInteger($integer, $throwable = null)
{
$throwable = ThrowableUtilities::validateAndNormalizeThrowable($throwable, new Exception\InvalidArgumentException('Argument must be an integer'));
if (!is_int($integer)) {
throw $throwable;
}
}
开发者ID:tklever,项目名称:heimdall,代码行数:7,代码来源:IntegerGuardTrait.php
示例10: generate_query_string
/**
* Generates, encodes, re-orders variables for the query string.
*
* @param array $params The specific parameters for this payment
* @param array $pairs Pairs
* @param string $namespace The namespace
*
* @return string An encoded string of parameters
*/
public static function generate_query_string($params, &$pairs = array(), $namespace = null)
{
if (is_array($params)) {
foreach ($params as $k => $v) {
if (is_int($k)) {
GoCardless_Utils::generate_query_string($v, $pairs, $namespace . '[]');
} else {
GoCardless_Utils::generate_query_string($v, $pairs, $namespace !== null ? $namespace . "[{$k}]" : $k);
}
}
if ($namespace !== null) {
return $pairs;
}
if (empty($pairs)) {
return '';
}
usort($pairs, array(__CLASS__, 'sortPairs'));
$strs = array();
foreach ($pairs as $pair) {
$strs[] = $pair[0] . '=' . $pair[1];
}
return implode('&', $strs);
} else {
$pairs[] = array(rawurlencode($namespace), rawurlencode($params));
}
}
开发者ID:siparker,项目名称:gocardless-whmcs,代码行数:35,代码来源:Utils.php
示例11: setNbrPlanches
public function setNbrPlanches($nbrPlanches)
{
$nbrPlanches = (int) $nbrPlanches;
if (is_int($nbrPlanches) && $nbrPlanches >= 0) {
$this->_nbrPlanches = $nbrPlanches;
}
}
开发者ID:hodiqual,项目名称:projetWeb,代码行数:7,代码来源:Vehicule.php
示例12: add
public static function add($class, $behaviors)
{
foreach ($behaviors as $name => $parameters) {
if (is_int($name)) {
// no parameters
$name = $parameters;
} else {
// register parameters
foreach ($parameters as $key => $value) {
sfConfig::set('propel_behavior_' . $name . '_' . $class . '_' . $key, $value);
}
}
if (!isset(self::$behaviors[$name])) {
throw new sfConfigurationException(sprintf('Propel behavior "%s" is not registered', $name));
}
// register hooks
foreach (self::$behaviors[$name]['hooks'] as $hook => $callables) {
foreach ($callables as $callable) {
sfMixer::register('Base' . $class . $hook, $callable);
}
}
// register new methods
foreach (self::$behaviors[$name]['methods'] as $callable) {
sfMixer::register('Base' . $class, $callable);
}
}
}
开发者ID:Daniel-Marynicz,项目名称:symfony1-legacy,代码行数:27,代码来源:sfPropelBehavior.class.php
示例13: mf_validate_float
function mf_validate_float($value)
{
global $mf_lang;
$error_message = $mf_lang['val_float'];
$value = $value[0];
if (is_int($value)) {
return $error_message;
//it's integer
} else {
if (is_float($value)) {
return true;
//it's float
} else {
if (is_numeric($value)) {
$result = strpos($value, '.');
if ($result !== false) {
return true;
//it's float
} else {
return $error_message;
//it's integer
}
} else {
return $error_message;
//it's not even a number!
}
}
}
}
开发者ID:janssit,项目名称:machform.janss.be,代码行数:29,代码来源:common-validator.php
示例14: savedata
function savedata()
{
global $filesystem;
$top = '<?php' . "\nif (defined('VISCACHA_CORE') == false) { die('Error: Hacking Attempt'); }\n";
$top .= '$' . $this->varname . ' = array();' . "\n";
$cfg = array();
while (list($key, $val) = each($this->data)) {
if (is_array($val)) {
foreach ($val as $key2 => $val2) {
if (isset($this->opt[$key][$key2]) && $this->opt[$key][$key2] == int || is_int($val2)) {
$val2 = intval($val2);
} else {
$val2 = $this->_prepareString($val2);
}
$cfg[] = '$' . $this->varname . "['{$key}']['{$key2}'] = {$val2};";
}
} else {
if (isset($this->opt[$key]) && $this->opt[$key] == int || is_int($val)) {
$val = intval($val);
} else {
$val = $this->_prepareString($val);
}
$cfg[] = '$' . $this->varname . "['{$key}'] = {$val};";
}
}
natcasesort($cfg);
$newdata = implode("\n", $cfg);
$bottom = "\n" . '?>';
$filesystem->file_put_contents($this->file, $top . $newdata . $bottom);
}
开发者ID:BackupTheBerlios,项目名称:viscacha-svn,代码行数:30,代码来源:class.phpconfig.php
示例15: send
/**
* Send data to realplexor.
* Throw Dklab_Realplexor_Exception in case of error.
*
* @param mixed $idsAndCursors Target IDs in form of: array(id1 => cursor1, id2 => cursor2, ...)
* of array(id1, id2, id3, ...). If sending to a single ID,
* you may pass it as a plain string, not array.
* @param mixed $data Data to be sent (any format, e.g. nested arrays are OK).
* @param array $showOnlyForIds Send this message to only those who also listen any of these IDs.
* This parameter may be used to limit the visibility to a closed
* number of cliens: give each client an unique ID and enumerate
* client IDs in $showOnlyForIds to not to send messages to others.
* @return void
*/
public function send($idsAndCursors, $data, $showOnlyForIds = null)
{
$data = json_encode($data);
$pairs = array();
foreach ((array) $idsAndCursors as $id => $cursor) {
if (is_int($id)) {
$id = $cursor;
// this is NOT cursor, but ID!
$cursor = null;
}
if (!preg_match('/^\\w+$/', $id)) {
throw new Dklab_Realplexor_Exception("Identifier must be alphanumeric, \"{$id}\" given");
}
$id = $this->_namespace . $id;
if ($cursor !== null) {
if (!is_numeric($cursor)) {
throw new Dklab_Realplexor_Exception("Cursor must be numeric, \"{$cursor}\" given");
}
$pairs[] = "{$cursor}:{$id}";
} else {
$pairs[] = $id;
}
}
if (is_array($showOnlyForIds)) {
foreach ($showOnlyForIds as $id) {
$pairs[] = "*" . $this->_namespace . $id;
}
}
$this->_send(join(",", $pairs), $data);
}
开发者ID:kondrat,项目名称:chat,代码行数:44,代码来源:Realplexor.php
示例16: __construct
/**
* @param string $ip IP of the MC server
* @param int $port Port of the MC server
* @param int $timeout Timeout
* @throws InvalidArgumentException
*/
public function __construct($ip, $port = 25565, $timeout = 5)
{
$time = microtime(true);
if (!is_int($timeout) || $timeout < 0) {
throw new InvalidArgumentException('Timeout must be an integer.');
}
// Connect to the server
$this->socket = @fsockopen('udp://' . $ip, (int) $port, $errorNumber, $errorString, $timeout);
// Failure?
if ($errorNumber || $this->socket === false) {
$this->online = false;
return;
}
stream_set_blocking($this->socket, true);
stream_set_timeout($this->socket, (int) $timeout);
try {
$challenge = $this->fetchChallenge();
$this->fetchStatus($challenge);
} catch (MinecraftQueryException $e) {
fclose($this->socket);
$this->online = false;
return;
}
fclose($this->socket);
$this->duration = microtime(true) - $time;
}
开发者ID:ozzyfant,项目名称:minephpquery,代码行数:32,代码来源:MinePHPQuery.class.php
示例17: submit
function submit()
{
//Check required Fields
$missing = false;
if (!isset($_POST["sql"]) || strlen($_POST["sql"]) == 0) {
$missing = true;
}
if ($missing) {
$this->res->success = false;
$this->res->message = "missing required field!";
return null;
}
//get vars
$sql = $_POST["sql"];
$schema_id = $this->params['schema_id'];
$schema = Doo::db()->getOne('Schemata', array('where' => 'id = ' . $schema_id));
$async = isset($_POST['async']) ? $_POST['async'] : 0;
$coord_name = isset($_POST['coord_name']) ? $_POST['coord_name'] : null;
$query_id = isset($_POST["query_id"]) ? $_POST["query_id"] : strtoupper(md5(uniqid(rand(), true)));
//init
$shard_query = new ShardQuery($schema->schema_name);
//error!
if (!empty($shard_query->errors)) {
//return
$this->res->message = $shard_query->errors;
$this->res->success = false;
return null;
}
//set async
$shard_query->async = $async == true ? true : false;
//set coord shard
if (isset($coord_name)) {
$shard_query->set_coordinator($coord_name);
}
//execute query
$stmt = $shard_query->query($sql);
//error!
if (!$stmt && !empty($shard_query->errors)) {
//return
$this->res->message = $shard_query->errors;
$this->res->success = false;
return null;
}
//empty results
if ($stmt == null && empty($shard_query->errors)) {
$this->res->data = array();
}
//build data
if (!is_int($stmt)) {
$this->res->data = $this->json_format($shard_query, $stmt);
$shard_query->DAL->my_free_result($stmt);
} else {
//save job_id
$this->res->data = $stmt;
}
//save message
$this->res->message = $query_id;
//return
$this->res->success = true;
}
开发者ID:garv347,项目名称:swanhart-tools,代码行数:60,代码来源:QueryRESTController.php
示例18: setPointeur
/**
* @brief Définit la position du pointeur interne de l'itérateur
* @return void
*/
protected function setPointeur($pointeur)
{
if (!is_int($pointeur)) {
throw new IllegalArgumentException();
}
$this->_pointeur = $pointeur;
}
开发者ID:gotnospirit,项目名称:php-dpat,代码行数:11,代码来源:AbstractCollectionIterator.php
示例19: __construct
public function __construct(array $extent, array $size, array $wms = array())
{
if (!is_array($extent) || count($extent) != 4) {
throw new Exception('Extent must be an array of bottom, left, top, right coordinates');
}
if (!is_array($size) || count($size) != 2) {
throw new Exception('Size must be an array of width, height in pixel');
}
foreach ($extent as $val) {
if (!is_numeric($val)) {
throw new Exception('An extent coordinate is not numeric ' . $val);
}
}
foreach ($size as $val) {
if (!is_int($val)) {
throw new Exception('A size value is not an integer');
}
}
$this->extent = $extent;
$this->size = $size;
if (is_array($wms)) {
if (count($wms) > 0) {
try {
foreach ($wms as $val) {
$this->registerWMS($val);
}
} catch (Exception $e) {
throw $e;
}
}
} else {
throw new Exception('wms parameter must be an array of WMS urls');
}
}
开发者ID:r3-gis,项目名称:EcoGIS,代码行数:34,代码来源:r3ogcmap.php
示例20: reply
public function reply($user, $message)
{
$message = $this->prepareMessage($message);
$this->storeInput($message);
$triggers = $this->tree['topics'][$this->getMetadata('topic')]['triggers'];
if (count($triggers) > 0) {
foreach ($triggers as $key => $trigger) {
foreach ($this->triggers as $class) {
$triggerClass = "\\Vulcan\\Rivescript\\Triggers\\{$class}";
$triggerClass = new $triggerClass();
$found = $triggerClass->parse($key, $trigger['trigger'], $message);
if (isset($found['match']) and $found['match'] === true) {
log_debug('Found match', ['type' => $class, 'message' => $message, 'found' => $found]);
break 2;
}
}
}
if (isset($found['key']) and is_int($found['key'])) {
$replies = $triggers[$found['key']]['reply'];
if (isset($triggers[$found['key']]['redirect'])) {
return $this->reply($user, $triggers[$found['key']]['redirect']);
}
if (count($replies)) {
$key = array_rand($replies);
$reply = $this->parseReply($replies[$key], $found['data']);
return $reply;
}
}
}
return 'No response found.';
}
开发者ID:vulcan-project,项目名称:rivescript-php,代码行数:31,代码来源:Rivescript.php
注:本文中的is_int函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论