本文整理汇总了PHP中is_integer函数的典型用法代码示例。如果您正苦于以下问题:PHP is_integer函数的具体用法?PHP is_integer怎么用?PHP is_integer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_integer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: seek_log_object
/**
* Get log object based on creation time and creator of the object
*
* @return midgardmvc_helper_location_log
*/
function seek_log_object($person = null, $time = null)
{
if (is_integer($person) || is_string($person)) {
$person_guid = $person;
} elseif (is_null($person)) {
$person_guid = $this->object->metadata->creator;
// TODO: Use metadata.authors?
} else {
$person_guid = $person->guid;
}
if (is_null($time)) {
$time = $this->object->metadata->published;
}
$person = new midgard_person($person_guid);
$qb = midgardmvc_helper_location_log::new_query_builder();
$qb->add_constraint('person', '=', $person->id);
$qb->add_constraint('date', '<=', $time);
$qb->add_order('date', 'DESC');
$qb->set_limit(1);
$matches = $qb->execute();
if (count($matches) > 0) {
return $matches[0];
}
return null;
}
开发者ID:bergie,项目名称:midgardmvc_helper_location,代码行数:30,代码来源:object.php
示例2: addFilter
/**
* Add a filter specific to this writer.
*
* @param Zend_Log_Filter_Interface $filter
* @return void
*/
public function addFilter($filter)
{
if (is_integer($filter)) {
$filter = new Zend_Log_Filter_Priority($filter);
}
$this->_filters[] = $filter;
}
开发者ID:klando,项目名称:pgpiwik,代码行数:13,代码来源:Abstract.php
示例3: create
/**
* Create destination object
*
* @param Zend_Pdf_Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @param float $top Top edge of displayed page
* @param float $zoom Zoom factor
* @return Zend_Pdf_Destination_Zoom
* @throws Zend_Pdf_Exception
*/
public static function create($page, $left = null, $top = null, $zoom = null)
{
$destinationArray = new Zend_Pdf_Element_Array();
if ($page instanceof Zend_Pdf_Page) {
$destinationArray->items[] = $page->getPageDictionary();
} else {
if (is_integer($page)) {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($page);
} else {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Page entry must be a Zend_Pdf_Page object or a page number.');
}
}
$destinationArray->items[] = new Zend_Pdf_Element_Name('XYZ');
if ($left === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($left);
}
if ($top === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($top);
}
if ($zoom === null) {
$destinationArray->items[] = new Zend_Pdf_Element_Null();
} else {
$destinationArray->items[] = new Zend_Pdf_Element_Numeric($zoom);
}
return new Zend_Pdf_Destination_Zoom($destinationArray);
}
开发者ID:basdog22,项目名称:Qool,代码行数:41,代码来源:Zoom.php
示例4: addError
/**
* Adds an error.
*
* This method merges sfValidatorErrorSchema errors with the current instance.
*
* @param sfValidatorError $error An sfValidatorError instance
* @param string $name The error name
*/
public function addError(sfValidatorError $error, $name = null)
{
if (is_null($name) || is_integer($name)) {
if ($error instanceof sfValidatorErrorSchema) {
$this->addErrors($error);
} else {
$this->globalErrors[] = $error;
$this->errors[] = $error;
}
} else {
if (!isset($this->namedErrors[$name]) && !$error instanceof sfValidatorErrorSchema) {
$this->namedErrors[$name] = $error;
$this->errors[$name] = $error;
} else {
if (!isset($this->namedErrors[$name])) {
$this->namedErrors[$name] = new sfValidatorErrorSchema($error->getValidator());
$this->errors[$name] = new sfValidatorErrorSchema($error->getValidator());
} else {
if (!$this->namedErrors[$name] instanceof sfValidatorErrorSchema) {
$current = $this->namedErrors[$name];
$this->namedErrors[$name] = new sfValidatorErrorSchema($current->getValidator());
$this->errors[$name] = new sfValidatorErrorSchema($current->getValidator());
$method = $current instanceof sfValidatorErrorSchema ? 'addErrors' : 'addError';
$this->namedErrors[$name]->{$method}($current);
$this->errors[$name]->{$method}($current);
}
}
$method = $error instanceof sfValidatorErrorSchema ? 'addErrors' : 'addError';
$this->namedErrors[$name]->{$method}($error);
$this->errors[$name]->{$method}($error);
}
}
$this->updateCode();
$this->updateMessage();
}
开发者ID:JimmyVB,项目名称:Symfony-v1.2,代码行数:43,代码来源:sfValidatorErrorSchema.class.php
示例5: onStartCacheSet
function onStartCacheSet(&$key, &$value, &$flag, &$expiry, &$success)
{
if (empty($value)) {
if (is_array($value)) {
$this->log(LOG_INFO, "Setting empty array for key '{$key}'");
} else {
if (is_null($value)) {
$this->log(LOG_INFO, "Setting null value for key '{$key}'");
} else {
if (is_string($value)) {
$this->log(LOG_INFO, "Setting empty string for key '{$key}'");
} else {
if (is_integer($value)) {
$this->log(LOG_INFO, "Setting integer 0 for key '{$key}'");
} else {
$this->log(LOG_INFO, "Setting empty value '{$value}' for key '{$key}'");
}
}
}
}
} else {
$this->log(LOG_INFO, "Setting non-empty value for key '{$key}'");
}
return true;
}
开发者ID:sukhjindersingh,项目名称:PHInest-Solutions,代码行数:25,代码来源:CacheLogPlugin.php
示例6: getProperties
protected function getProperties($object)
{
$reflClass = new \ReflectionClass($object);
$codeAnnotation = $this->annotationReader->getClassAnnotation($reflClass, Segment::class);
if (!$codeAnnotation) {
throw new AnnotationMissing(sprintf("Missing @Segment annotation for class %", $reflClass->getName()));
}
$properties = [$codeAnnotation->value];
foreach ($reflClass->getProperties() as $propRefl) {
$propRefl->setAccessible(true);
/** @var SegmentPiece $isSegmentPiece */
$isSegmentPiece = $this->annotationReader->getPropertyAnnotation($propRefl, SegmentPiece::class);
if ($isSegmentPiece) {
if (!$isSegmentPiece->parts) {
$properties[$isSegmentPiece->position] = $propRefl->getValue($object);
} else {
$parts = $isSegmentPiece->parts;
$value = $propRefl->getValue($object);
$valuePieces = [];
foreach ($parts as $key => $part) {
if (is_integer($key)) {
$partName = $part;
} else {
$partName = $key;
}
$valuePieces[] = isset($value[$partName]) ? $value[$partName] : null;
}
$properties[$isSegmentPiece->position] = $this->weedOutEmpty($valuePieces);
}
}
}
$properties = $this->weedOutEmpty($properties);
return $properties;
}
开发者ID:progrupa,项目名称:edifact,代码行数:34,代码来源:AnnotationPrinter.php
示例7: create
/**
* Create destination object
*
* @param \Zend\Pdf\Page|integer $page Page object or page number
* @param float $left Left edge of displayed page
* @param float $top Top edge of displayed page
* @param float $zoom Zoom factor
* @return \Zend\Pdf\Destination\Zoom
* @throws \Zend\Pdf\Exception\ExceptionInterface
*/
public static function create($page, $left = null, $top = null, $zoom = null)
{
$destinationArray = new InternalType\ArrayObject();
if ($page instanceof Pdf\Page) {
$destinationArray->items[] = $page->getPageDictionary();
} elseif (is_integer($page)) {
$destinationArray->items[] = new InternalType\NumericObject($page);
} else {
throw new Exception\InvalidArgumentException('$page parametr must be a \\Zend\\Pdf\\Page object or a page number.');
}
$destinationArray->items[] = new InternalType\NameObject('XYZ');
if ($left === null) {
$destinationArray->items[] = new InternalType\NullObject();
} else {
$destinationArray->items[] = new InternalType\NumericObject($left);
}
if ($top === null) {
$destinationArray->items[] = new InternalType\NullObject();
} else {
$destinationArray->items[] = new InternalType\NumericObject($top);
}
if ($zoom === null) {
$destinationArray->items[] = new InternalType\NullObject();
} else {
$destinationArray->items[] = new InternalType\NumericObject($zoom);
}
return new self($destinationArray);
}
开发者ID:robertodormepoco,项目名称:zf2,代码行数:38,代码来源:Zoom.php
示例8: __construct
/**
* Object constructor
*
* @param Zend_Pdf_Element $val
* @param integer $objNum
* @param integer $genNum
* @param Zend_Pdf_ElementFactory $factory
* @throws Zend_Pdf_Exception
*/
public function __construct(Zend_Pdf_Element $val, $objNum, $genNum, Zend_Pdf_ElementFactory $factory)
{
if ($val instanceof self) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Object number must not be an instance of Zend_Pdf_Element_Object.');
}
if ( !(is_integer($objNum) && $objNum > 0) ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Object number must be positive integer.');
}
if ( !(is_integer($genNum) && $genNum >= 0) ) {
require_once 'Zend/Pdf/Exception.php';
throw new Zend_Pdf_Exception('Generation number must be non-negative integer.');
}
$this->_value = $val;
$this->_objNum = $objNum;
$this->_genNum = $genNum;
$this->_factory = $factory;
$this->setParentObject($this);
$factory->registerObject($this, $objNum . ' ' . $genNum);
}
开发者ID:nhp,项目名称:shopware-4,代码行数:35,代码来源:Object.php
示例9: stringify
/**
* Stringifies any provided value.
*
* @param mixed $value
* @param boolean $exportObject
*
* @return string
*/
public function stringify($value, $exportObject = true)
{
if (is_array($value)) {
if (range(0, count($value) - 1) === array_keys($value)) {
return '[' . implode(', ', array_map(array($this, __FUNCTION__), $value)) . ']';
}
$stringify = array($this, __FUNCTION__);
return '[' . implode(', ', array_map(function ($item, $key) use($stringify) {
return (is_integer($key) ? $key : '"' . $key . '"') . ' => ' . call_user_func($stringify, $item);
}, $value, array_keys($value))) . ']';
}
if (is_resource($value)) {
return get_resource_type($value) . ':' . $value;
}
if (is_object($value)) {
return $exportObject ? ExportUtil::export($value) : sprintf('%s:%s', get_class($value), spl_object_hash($value));
}
if (true === $value || false === $value) {
return $value ? 'true' : 'false';
}
if (is_string($value)) {
$str = sprintf('"%s"', str_replace("\n", '\\n', $value));
if (50 <= strlen($str)) {
return substr($str, 0, 50) . '"...';
}
return $str;
}
if (null === $value) {
return 'null';
}
return (string) $value;
}
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:40,代码来源:StringUtil.php
示例10: isValid
/**
* Validate the error code, and if applicable, return an Exception to be thrown.
* @return
* \OhUpload\Validate\Exception\UnknownInvalidErrorCodeException
* \OhUpload\Validate\Exception\MaximumFileSizeExceededException
* \OhUpload\Validate\Exception\NoFileUploadedException
* \OhUpload\Validate\Exception\TmpFolderMissingException
* \OhUpload\Validate\Exception\FailedToWriteToDiskException
* \OhUpload\Validate\Exception\ExtensionStoppedUploadException
* boolean true
*/
public function isValid()
{
$code = @$this->file['error'];
if (!is_integer($code)) {
return new UnknownInvalidErrorCodeException('Upload error code was not an integer. Got "' . gettype($code) . '"');
}
switch ($code) {
case 0:
return true;
case 1:
return new MaximumFileSizeExceededException('The uploaded file exceeds the upload_max_filesize directive in php.ini.');
break;
case 2:
return new MaximumFileSizeExceededException('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.');
break;
case 4:
return new NoFileUploadedException('No file was uploaded.');
break;
case 6:
return new TmpFolderMissingException('Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.');
break;
case 7:
return new FailedToWriteToDiskException('Failed to write file to disk. Introduced in PHP 5.1.0.');
break;
case 8:
return new ExtensionStoppedUploadException('A PHP extension stopped the file upload. PHP does not provide a way to ascertain which ' . 'extension caused the file upload to stop; examining the list of loaded extensions with ' . 'phpinfo() may help. Introduced in PHP 5.2.0.');
break;
default:
break;
}
return new UnknownInvalidErrorCodeException('Unhandled error code detected. Received: "' . $code . '"');
}
开发者ID:rogerthomas84,项目名称:ohupload,代码行数:43,代码来源:ErrorCode.php
示例11: wppb_changeDefaultAvatar
function wppb_changeDefaultAvatar($avatar, $id_or_email, $size, $default, $alt)
{
global $wpdb;
/* Get user info. */
if (is_object($id_or_email)) {
$my_user_id = $id_or_email->user_id;
} elseif (is_numeric($id_or_email)) {
$my_user_id = $id_or_email;
} elseif (!is_integer($id_or_email)) {
$user_info = get_user_by_email($id_or_email);
$my_user_id = $user_info->ID;
} else {
$my_user_id = $id_or_email;
}
$arraySettingsPresent = get_option('wppb_custom_fields', 'not_found');
if ($arraySettingsPresent != 'not_found') {
$wppbFetchArray = get_option('wppb_custom_fields');
foreach ($wppbFetchArray as $value) {
if ($value['item_type'] == 'avatar') {
$customUserAvatar = get_user_meta($my_user_id, 'resized_avatar_' . $value['id'], true);
if ($customUserAvatar != '' || $customUserAvatar != null) {
$avatar = "<img alt='{$alt}' src='{$customUserAvatar}' class='avatar avatar-{$value['item_options']} photo avatar-default' height='{$size}' width='{$size}' />";
}
}
}
}
return $avatar;
}
开发者ID:serker72,项目名称:T3S,代码行数:28,代码来源:premium.functions.load.php
示例12: calculatePagingHeaders
/**
* Calculate the link meta-data for paging purposes, return an array with paging information
*
* @param integer $limit
* @param integer $offset
* @param integer $total_rows The total amount of objects
*
* @return array
*/
public static function calculatePagingHeaders($limit, $offset, $total_rows)
{
$paging = array();
// Check if limit and offset are integers
if (!is_integer((int) $limit) || !is_integer((int) $offset)) {
\App::abort(400, "Please make sure limit and offset are integers.");
}
// Calculate the paging parameters and pass them with the data object
if ($offset + $limit < $total_rows) {
$paging['next'] = array($limit + $offset, $limit);
$last_page = round($total_rows / $limit, 1);
$last_full_page = round($total_rows / $limit, 0);
if ($last_page - $last_full_page > 0) {
$paging['last'] = array($last_full_page * $limit, $limit);
} else {
$paging['last'] = array(($last_full_page - 1) * $limit, $limit);
}
}
if ($offset > 0 && $total_rows > 0) {
$previous = $offset - $limit;
if ($previous < 0) {
$previous = 0;
}
$paging['previous'] = array($previous, $limit);
}
return $paging;
}
开发者ID:jalbertbowden,项目名称:core,代码行数:36,代码来源:Pager.php
示例13: _conversationReply
/**
* A user has replied to a conversation.
*
* @param \Cake\Event\Event $event The event that was fired.
*
* @return bool
*/
protected function _conversationReply(Event $event)
{
if (!is_integer($event->data['conversation_id'])) {
return false;
}
$this->Conversations = TableRegistry::get('Conversations');
$this->Users = TableRegistry::get('Users');
$conversation = $this->Conversations->find()->where(['Conversations.id' => $event->data['conversation_id']])->select(['id', 'user_id', 'title', 'last_message_id'])->first();
$sender = $this->Users->find('medium')->where(['Users.id' => $event->data['sender_id']])->first();
//Check if this user hasn't already a notification. (Prevent for spam)
$hasReplied = $this->Notifications->find()->where(['Notifications.foreign_key' => $conversation->id, 'Notifications.type' => $event->data['type'], 'Notifications.user_id' => $event->data['participant']->user->id])->first();
if (!is_null($hasReplied)) {
$hasReplied->data = serialize(['sender' => $sender, 'conversation' => $conversation]);
$hasReplied->is_read = 0;
$this->Notifications->save($hasReplied);
} else {
$data = [];
$data['user_id'] = $event->data['participant']->user->id;
$data['type'] = $event->data['type'];
$data['data'] = serialize(['sender' => $sender, 'conversation' => $conversation]);
$data['foreign_key'] = $conversation->id;
$entity = $this->Notifications->newEntity($data);
$this->Notifications->save($entity);
}
return true;
}
开发者ID:Xety,项目名称:Xeta,代码行数:33,代码来源:Notifications.php
示例14: getHash
/**
* Generate a [salted] hash.
*
* $salt can be:
* false - a random will be generated
* integer - a random with specified length will be generated
* string
*
* @param string $password
* @param mixed $salt
* @return string
*/
public function getHash($password, $salt = false)
{
if (is_integer($salt)) {
$salt = $this->_helper->getRandomString($salt);
}
return $salt === false ? $this->hash($password) : $this->hash($salt . $password) . ':' . $salt;
}
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:19,代码来源:Encryption.php
示例15: testMuxGetId
public function testMuxGetId()
{
$mux = new \Pux\Mux();
$id = $mux->getId();
ok(is_integer($id));
is($id, $mux->getId());
}
开发者ID:magicdice,项目名称:Pux,代码行数:7,代码来源:MuxTest.php
示例16: send
/**
* Send email to user
*
* Send an email to a site user. Using the given view file and data
*
* @access public
* @param mixed $user User email or ID
* @param string $subject Email subject
* @param string $view View file to use
* @param array $data Variable replacement array
* @return boolean Whether the email was sent
*/
function send($user = NULL, $subject = 'No Subject', $view = NULL, $data = array())
{
if (valid_email($user)) {
// Email given
$email = $user;
} elseif (is_integer($user)) {
// Get users email
$query = $this->CI->user_model->fetch('Users', 'email', NULL, array('id' => $user));
$user = $query->row();
$email = $user->email;
} else {
// Error
return FALSE;
}
// Build email
$subject = "[" . $this->CI->preference->item('site_name') . "] " . $subject;
$message = $this->CI->parser->parse($view, $data, TRUE);
// Setup Email settings
$this->_initialize_email();
// Send email
$this->CI->email->from($this->CI->preference->item('automated_from_email'), $this->CI->preference->item('automated_from_name'));
$this->CI->email->to($email);
$this->CI->email->subject($subject);
$this->CI->email->message($message);
if (!$this->CI->email->send()) {
return FALSE;
}
return TRUE;
}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:41,代码来源:User_email.php
示例17: delete
/**
* delete the eventIndex
*
* @param integer|Tx_CzSimpleCal_Domain_Model_Event $event
*/
public function delete($event)
{
if (is_integer($event)) {
$event = $this->fetchEventObject($event);
}
$this->doDelete($event);
}
开发者ID:TYPO3-typo3org,项目名称:community,代码行数:12,代码来源:Event.php
示例18: get_size_info
public function get_size_info($size_name = 'thumbnail')
{
global $_wp_additional_image_sizes;
if (is_integer($size_name)) {
return;
}
if (is_array($size_name)) {
return;
}
if (isset($_wp_additional_image_sizes[$size_name]['width'])) {
$width = intval($_wp_additional_image_sizes[$size_name]['width']);
} else {
$width = get_option($size_name . '_size_w');
}
if (isset($_wp_additional_image_sizes[$size_name]['height'])) {
$height = intval($_wp_additional_image_sizes[$size_name]['height']);
} else {
$height = get_option($size_name . '_size_h');
}
if (isset($_wp_additional_image_sizes[$size_name]['crop'])) {
$crop = intval($_wp_additional_image_sizes[$size_name]['crop']);
} else {
$crop = get_option($size_name . '_crop') ? true : false;
}
return array('width' => $width, 'height' => $height, 'crop' => $crop);
}
开发者ID:christocmp,项目名称:bingopaws,代码行数:26,代码来源:media.php
示例19: installFilterGroups
/**
* @verbatim
* Helper method that installs filter groups based on
* the given XML node which represents a <filterGroups>
* element.
* @endverbatim
* @param $filterGroupsNode XMLNode
*/
function installFilterGroups($filterGroupsNode)
{
// Install filter groups.
$filterGroupDao = DAORegistry::getDAO('FilterGroupDAO');
/* @var $filterGroupDao FilterGroupDAO */
import('lib.pkp.classes.filter.FilterGroup');
foreach ($filterGroupsNode->getChildren() as $filterGroupNode) {
/* @var $filterGroupNode XMLNode */
$filterGroupSymbolic = $filterGroupNode->getAttribute('symbolic');
// Make sure that the filter group has not been
// installed before to guarantee idempotence.
$existingFilterGroup =& $filterGroupDao->getObjectBySymbolic($filterGroupSymbolic);
if (!is_null($existingFilterGroup)) {
continue;
}
// Instantiate and configure the filter group.
$filterGroup = new FilterGroup();
$filterGroup->setSymbolic($filterGroupSymbolic);
$filterGroup->setDisplayName($filterGroupNode->getAttribute('displayName'));
$filterGroup->setDescription($filterGroupNode->getAttribute('description'));
$filterGroup->setInputType($filterGroupNode->getAttribute('inputType'));
$filterGroup->setOutputType($filterGroupNode->getAttribute('outputType'));
// Install the filter group.
$installedGroupId = $filterGroupDao->insertObject($filterGroup);
assert(is_integer($installedGroupId));
unset($filterGroup);
}
}
开发者ID:PublishingWithoutWalls,项目名称:pkp-lib,代码行数:36,代码来源:FilterHelper.inc.php
示例20: LeerRegistro
function LeerRegistro()
{
global $llamada, $valortag, $maxmfn, $arrHttp, $Bases, $xWxis, $Wxis, $Mfn, $db_path, $wxisUrl;
// en la variable $arrHttp vienen los parámetros que se le van a pasar al script .xis
// el índice IsisScript contiene el nombre del script .xis que va a ser invocado
// la variable $llave permite retornar alguna marca que esté en el formato de salida
// identificada entre $$LLAVE= .....$$
$llave_pft = "";
$IsisScript = $xWxis . "login.xis";
$query = "&base=acces&cipar={$db_path}" . "par/acces.par" . "&login=" . $_SESSION["login"] . "&password=" . $_SESSION["password"];
include "../common/wxis_llamar.php";
$ic = -1;
$tag = "";
foreach ($contenido as $linea) {
if ($ic == -1) {
$ic = 1;
$pos = strpos($linea, '##LLAVE=');
if (is_integer($pos)) {
$llave_pft = substr($linea, $pos + 8);
$pos = strpos($llave_pft, '##');
$llave_pft = substr($llave_pft, 0, $pos);
}
} else {
$linea = trim($linea);
$pos = strpos($linea, " ");
if (is_integer($pos)) {
$tag = trim(substr($linea, 0, $pos));
}
}
}
return $llave_pft;
}
开发者ID:rgevaert,项目名称:ABCD,代码行数:32,代码来源:inicio_main.php
注:本文中的is_integer函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论