本文整理汇总了PHP中IntVal函数的典型用法代码示例。如果您正苦于以下问题:PHP IntVal函数的具体用法?PHP IntVal怎么用?PHP IntVal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了IntVal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CurrencyFormatNumber
function CurrencyFormatNumber($price, $currency)
{
$arCurFormat = CCurrencyLang::GetCurrencyFormat($currency);
if (!isset($arCurFormat["DECIMALS"])) {
$arCurFormat["DECIMALS"] = 2;
}
$arCurFormat["DECIMALS"] = IntVal($arCurFormat["DECIMALS"]);
if (!isset($arCurFormat["DEC_POINT"])) {
$arCurFormat["DEC_POINT"] = ".";
}
if (!empty($arCurFormat["THOUSANDS_VARIANT"])) {
if ($arCurFormat["THOUSANDS_VARIANT"] == "N") {
$arCurFormat["THOUSANDS_SEP"] = "";
} elseif ($arCurFormat["THOUSANDS_VARIANT"] == "D") {
$arCurFormat["THOUSANDS_SEP"] = ".";
} elseif ($arCurFormat["THOUSANDS_VARIANT"] == "C") {
$arCurFormat["THOUSANDS_SEP"] = ",";
} elseif ($arCurFormat["THOUSANDS_VARIANT"] == "S") {
$arCurFormat["THOUSANDS_SEP"] = chr(32);
} elseif ($arCurFormat["THOUSANDS_VARIANT"] == "B") {
$arCurFormat["THOUSANDS_SEP"] = chr(32);
}
}
if (!isset($arCurFormat["FORMAT_STRING"])) {
$arCurFormat["FORMAT_STRING"] = "#";
}
$price = number_format($price, $arCurFormat["DECIMALS"], $arCurFormat["DEC_POINT"], $arCurFormat["THOUSANDS_SEP"]);
if ($arCurFormat["THOUSANDS_VARIANT"] == "B") {
$num = str_replace(" ", " ", $num);
}
$price = str_replace(',', '.', $price);
return $price;
}
示例2: Show
public static function Show()
{
IncludeModuleLangFile($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/interface/prolog_main_admin.php');
$supportFinishDate = COption::GetOptionString('main', '~support_finish_date', '');
if ($supportFinishDate != '' && is_array($aSupportFinishDate = ParseDate($supportFinishDate, 'ymd'))) {
$aGlobalOpt = CUserOptions::GetOption("global", "settings", array());
if ($aGlobalOpt['messages']['support'] != 'N') {
$supportFinishStamp = mktime(0, 0, 0, $aSupportFinishDate[1], $aSupportFinishDate[0], $aSupportFinishDate[2]);
$supportDateDiff = ceil(($supportFinishStamp - time()) / 86400);
$sSupportMess = '';
$sSupWIT = " (<span onclick=\"BX.toggle(BX('supdescr'))\" style='border-bottom: 1px dashed #1c91e7; color: #1c91e7; cursor: pointer;'>" . GetMessage("prolog_main_support_wit") . "</span>)";
if ($supportDateDiff >= 0 && $supportDateDiff <= 30) {
$sSupportMess = GetMessage("prolog_main_support11", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#DAYS_AGO#' => $supportDateDiff == 0 ? GetMessage("prolog_main_today") : GetMessage('prolog_main_support_days', array('#N_DAYS_AGO#' => $supportDateDiff)), '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT, '#SUP_FINISH_DATE#' => GetTime(mktime(0, 0, 0, $aSupportFinishDate[1] + 1, $aSupportFinishDate[0], $aSupportFinishDate[2]))));
} elseif ($supportDateDiff < 0 && $supportDateDiff >= -30) {
$sSupportMess = GetMessage("prolog_main_support21", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#DAYS_AGO#' => -$supportDateDiff, '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT, '#SUP_FINISH_DATE#' => GetTime(mktime(0, 0, 0, $aSupportFinishDate[1] + 1, $aSupportFinishDate[0], $aSupportFinishDate[2]))));
} elseif ($supportDateDiff < -30) {
$sSupportMess = GetMessage("prolog_main_support31", array('#FINISH_DATE#' => GetTime($supportFinishStamp), '#LICENSE_KEY#' => md5(LICENSE_KEY), '#WHAT_IS_IT#' => $sSupWIT));
}
if ($sSupportMess != '') {
$sSupportMess .= GetMessage('ACRIT_EXPORTPRO_BUY_LICENCE');
$userOption = CUserOptions::GetOption("main", "admSupInf");
if (mktime() > $userOption["showInformerDate"]) {
$prolongUrl = "/bitrix/admin/buy_support.php?lang=" . LANGUAGE_ID;
if (!in_array(LANGUAGE_ID, array("ru", "ua")) || IntVal(COption::GetOptionString("main", "~PARAM_PARTNER_ID")) <= 0) {
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/update_client.php";
$prolongUrl = "http://www.acrit-studio.ru/shop/list/lupd/";
}
echo BeginNote('style="position: relative; top: -15px;"');
?>
<div style="float: right; padding-left: 50px; margin-top: -5px; text-align: center;">
<a href="<?php
echo $prolongUrl;
?>
" target="_blank" class="adm-btn adm-btn-save" style="margin-bottom: 4px;"><?php
echo GetMessage("prolog_main_support_button_prolong");
?>
</a><br />
<a href="http://www.acrit-studio.ru/market/" target="_blank"><?php
echo GetMessage("prolog_main_support_button_prolong_modules");
?>
</a>
</div>
<?php
echo $sSupportMess;
?>
<div id="supdescr" style="display: none;"><br /><br /><b><?php
echo GetMessage("prolog_main_support_wit_descr1");
?>
</b><hr><?php
echo GetMessage("prolog_main_support_wit_descr2");
?>
</div>
<?php
echo EndNote();
}
}
}
}
}
示例3: Set
public static function Set($userID, $code, $value = false)
{
global $DB;
if (!CSocNetGroup::__ValidateID($userID)) {
return false;
}
$userID = IntVal($userID);
$code = trim($code);
if ($userID <= 0 || strlen($code) <= 0) {
return false;
}
$value = $value == "Y" ? "Y" : "N";
$rsSubscription = CSocNetSubscription::GetList(array(), array("USER_ID" => $userID, "CODE" => $code));
if ($arSubscription = $rsSubscription->Fetch()) {
if ($value != "Y") {
CSocNetSubscription::Delete($arSubscription["ID"]);
}
} else {
if ($value == "Y") {
CSocNetSubscription::Add(array("USER_ID" => $userID, "CODE" => $code));
}
}
if (defined("BX_COMP_MANAGED_CACHE")) {
$GLOBALS["CACHE_MANAGER"]->ClearByTag("sonet_subscription_" . $code);
}
return true;
}
示例4: CheckPrivileges
public function CheckPrivileges($testPrivileges, $principal, $calendarId)
{
if (is_object($principal) && $principal instanceof CDavPrincipal) {
$principal = $principal->Id();
}
if (!is_numeric($principal)) {
return false;
}
$principal = IntVal($principal);
$calendarIdNorm = implode("-", $calendarId);
static $arCalendarPrivilegesCache = array();
if (!isset($arCalendarPrivilegesCache[$calendarIdNorm][$principal])) {
$arPriv = array();
// $arPrivOrig = array('bAccess' => true/false, 'bReadOnly' => true/false, 'privateStatus' => 'time'/'title');
$arPrivOrig = CCalendar::GetUserPermissionsForCalendar($calendarId, $principal);
if ($arPrivOrig['bAccess']) {
$arPriv[] = 'urn:ietf:params:xml:ns:caldav:read-free-busy';
if (!isset($arPrivOrig['privateStatus']) || $arPrivOrig['privateStatus'] != 'time') {
$arPriv[] = 'DAV::read';
}
if (!$arPrivOrig['bReadOnly']) {
$arPriv[] = 'DAV:write';
$arPriv[] = 'DAV:bind';
$arPriv[] = 'DAV:unbind';
$arPriv[] = 'DAV:write-properties';
$arPriv[] = 'DAV:write-content';
}
}
$arCalendarPrivilegesCache[$calendarIdNorm][$principal] = CDav::PackPrivileges($arPriv);
}
$testPrivilegesBits = CDav::PackPrivileges($testPrivileges);
return ($arCalendarPrivilegesCache[$calendarIdNorm][$principal] & $testPrivilegesBits) > 0;
}
示例5: OnSearchGetURL
function OnSearchGetURL($arFields)
{
global $DB, $BX_NEWS_DETAIL_URL, $BX_NEWS_SECTION_URL;
static $arIBlockCache = array();
if ($arFields["MODULE_ID"] !== "iblock" || substr($arFields["URL"], 0, 1) !== "=") {
return $arFields["URL"];
}
if (!CModule::IncludeModule('iblock')) {
return "";
}
$IBLOCK_ID = IntVal($arFields["PARAM2"]);
if (!array_key_exists($IBLOCK_ID, $arIBlockCache)) {
$res = $DB->Query("\n\t\t\t\tSELECT\n\t\t\t\t\tDETAIL_PAGE_URL,\n\t\t\t\t\tSECTION_PAGE_URL,\n\t\t\t\t\tCODE as IBLOCK_CODE,\n\t\t\t\t\tXML_ID as IBLOCK_EXTERNAL_ID,\n\t\t\t\t\tIBLOCK_TYPE_ID\n\t\t\t\tFROM\n\t\t\t\t\tb_iblock\n\t\t\t\tWHERE ID = " . $IBLOCK_ID . "\n\t\t\t");
$arIBlockCache[$IBLOCK_ID] = $res->Fetch();
}
if (!is_array($arIBlockCache[$IBLOCK_ID])) {
return "";
}
$arFields["URL"] = LTrim($arFields["URL"], " =");
parse_str($arFields["URL"], $arr);
$arr = $arIBlockCache[$IBLOCK_ID] + $arr;
$arr["LANG_DIR"] = $arFields["DIR"];
if (substr($arFields["ITEM_ID"], 0, 1) !== 'S') {
return CIBlock::ReplaceDetailUrl($BX_NEWS_DETAIL_URL, $arr, true, "E");
} else {
return CIBlock::ReplaceDetailUrl($BX_NEWS_SECTION_URL, $arr, true, "S");
}
}
示例6: Get_Fancy_Images
function Get_Fancy_Images($orderby = 'ID', $order = 'ASC', $limit = -1)
{
global $wpdb;
// Check Parameters
if (!$orderby) {
$orderby = 'ID';
}
if (!In_Array($order, array('ASC', 'DESC', 'RAND'))) {
$order = 'ASC';
}
$limit = IntVal($limit);
// Build Statement
$stmt = '
SELECT attachment.*, gallery.ID gallery_id
FROM ' . $wpdb->posts . ' attachment, ' . $wpdb->posts . ' gallery
WHERE attachment.post_type = "attachment"
AND attachment.post_mime_type LIKE "image/%"
AND gallery.post_type = "' . $this->fancy_gallery->gallery_post_type . '"
AND attachment.post_parent = gallery.ID
GROUP BY attachment.ID ';
if ($order == 'RAND') {
$stmt .= 'ORDER BY RAND() ';
} else {
$stmt .= 'ORDER BY attachment.' . $orderby . ' ' . $order . ' ';
}
if ($limit > 0) {
$stmt .= 'LIMIT ' . $limit;
}
return $wpdb->Get_Results($stmt);
}
示例7: parse
public function parse($fraktion_id, $wahlperiode_id)
{
$fraktion_id = IntVal($fraktion_id);
$wahlperiode_id = IntVal($wahlperiode_id);
if (SITE_CALL_MODE != "cron") {
echo "- Fraktion {$fraktion_id}\n";
}
$html_details = RISTools::load_file("http://www.ris-muenchen.de/RII/RII/ris_fraktionen_detail.jsp?risid={$fraktion_id}&periodeid={$wahlperiode_id}");
$daten = new Fraktion();
$daten->id = $fraktion_id;
if (preg_match("/introheadline\">(.*)<\\/h3/siU", $html_details, $matches)) {
var_dump($matches);
$daten->name = trim(str_replace(" ", " ", $matches[1]));
}
$aenderungen = "";
/** @var Fraktion $alter_eintrag */
$alter_eintrag = Fraktion::model()->findByPk($fraktion_id);
$changed = true;
if ($alter_eintrag) {
$changed = false;
if ($alter_eintrag->name != $daten->name) {
$aenderungen .= "Name: " . $alter_eintrag->name . " => " . $daten->name . "\n";
}
if ($aenderungen != "") {
$changed = true;
}
}
if ($changed) {
if ($aenderungen == "") {
$aenderungen = "Neu angelegt\n";
}
}
if ($alter_eintrag) {
$alter_eintrag->setAttributes($daten->getAttributes(), false);
if (!$alter_eintrag->save()) {
echo "Fraktion 1\n";
var_dump($alter_eintrag->getErrors());
die("Fehler");
}
$daten = $alter_eintrag;
} else {
if (!$daten->save()) {
echo "Fraktion 2\n";
var_dump($daten->getErrors());
die("Fehler");
}
}
if ($aenderungen != "") {
echo "Fraktion {$fraktion_id}: Verändert: " . $aenderungen . "\n";
}
if ($aenderungen != "") {
$aend = new RISAenderung();
$aend->ris_id = $daten->id;
$aend->ba_nr = null;
$aend->typ = RISAenderung::$TYP_STADTRAT_FRAKTION;
$aend->datum = new CDbExpression("NOW()");
$aend->aenderungen = $aenderungen;
$aend->save();
}
}
示例8: SelectServerSettingsByService
function SelectServerSettingsByService($ServiceID)
{
#-------------------------------------------------------------------------------
$Service = DB_Select('Services', array('ID', 'Code', 'Name'), array('UNIQ', 'ID' => IntVal($ServiceID)));
switch (ValueOf($Service)) {
case 'error':
return ERROR | @Trigger_Error(500);
case 'exception':
return new gException('SERVICE_NOT_FOUND', SPrintF('Сервис (%s) не существует', $ServiceID));
case 'array':
break;
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
$ServersGroup = DB_Select('ServersGroups', '*', array('UNIQ', 'Where' => SPrintF('`ServiceID` = %u', $ServiceID), 'Limits' => array(0, 1), 'SortOn' => 'SortID'));
#-------------------------------------------------------------------------------
switch (ValueOf($ServersGroup)) {
case 'error':
return ERROR | @Trigger_Error('[Server->SelectServerByService]: не удалось выбрать группу серверов');
case 'exception':
return new gException('SERVICE_ServersGroups_NOT_FOUND', 'Для данного сервиса нет групп серверов');
case 'array':
#-------------------------------------------------------------------------------
return SelectServerSettings($ServersGroup['ID']);
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
default:
return ERROR | @Trigger_Error(101);
}
#-------------------------------------------------------------------------------
}
示例9: QueryMinecraft
function QueryMinecraft($IP, $Port = 25565, $Timeout = 2)
{
$Socket = Socket_Create(AF_INET, SOCK_STREAM, SOL_TCP);
Socket_Set_Option($Socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => (int) $Timeout, 'usec' => 0));
Socket_Set_Option($Socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => (int) $Timeout, 'usec' => 0));
if ($Socket === FALSE || @Socket_Connect($Socket, $IP, (int) $Port) === FALSE) {
return FALSE;
}
Socket_Send($Socket, "þ", 2, 0);
$Len = Socket_Recv($Socket, $Data, 512, 0);
Socket_Close($Socket);
if ($Len < 4 || $Data[0] !== "ÿ") {
return FALSE;
}
$Data = SubStr($Data, 3);
// Strip packet header (kick message packet and short length)
$Data = iconv('UTF-16BE', 'UTF-8', $Data);
// Are we dealing with Minecraft 1.4+ server?
if ($Data[1] === "§" && $Data[2] === "1") {
$Data = Explode("", $Data);
return array('HostName' => $Data[3], 'Players' => IntVal($Data[4]), 'MaxPlayers' => IntVal($Data[5]), 'Protocol' => IntVal($Data[1]), 'Version' => $Data[2]);
}
$Data = Explode("§", $Data);
return array('HostName' => SubStr($Data[0], 0, -1), 'Players' => isset($Data[1]) ? IntVal($Data[1]) : 0, 'MaxPlayers' => isset($Data[2]) ? IntVal($Data[2]) : 0, 'Protocol' => 0, 'Version' => '1.3');
}
示例10: document_pdf_metadata
/**
* @param string $filename
* @return array
*/
public static function document_pdf_metadata($filename)
{
$result = [];
exec(PATH_PDFINFO . " '" . addslashes($filename) . "'", $result);
$seiten = 0;
$datum = "";
if (preg_match("/Pages:\\s*([0-9]+)/siu", implode("\n", $result), $matches_page)) {
$seiten = IntVal($matches_page[1]);
}
if (preg_match("/CreationDate:\\s*([a-z0-9 :]+)\n/siu", implode("\n", $result), $matches_date)) {
$datum = date_parse($matches_date[1]);
if ($datum && isset($datum["year"]) && $datum["year"] > 1990) {
$datum = $datum["year"] . "-" . $datum["month"] . "-" . $datum["day"] . " " . $datum["hour"] . ":" . $datum["minute"] . ":" . $datum["second"];
} else {
$datum = "0000-00-00 00:00:00";
}
}
if ($seiten > 0) {
return ["seiten" => $seiten, "datum" => $datum];
}
$result = [];
exec(PATH_IDENTIFY . " {$filename}", $result);
$anzahl = 0;
foreach ($result as $res) {
if (strpos($res, "DirectClass")) {
$anzahl++;
}
}
return ["seiten" => $anzahl, "datum" => $datum];
}
示例11: run
public function run($args)
{
if (count($args) == 0) {
die("./yii recalc_ort2ba [Orts-ID|alle]\n");
}
if ($args[0] == "alle") {
/** @var OrtGeo[] $orte */
$orte = OrtGeo::model()->findAll(["order" => "id"]);
} else {
/** @var OrtGeo[] $orte */
$orte = OrtGeo::model()->findAll(["condition" => "id = " . IntVal($args[0])]);
}
/** @var Bezirksausschuss[] $bas */
$bas = Bezirksausschuss::model()->findAll();
foreach ($orte as $ort) {
$found_ba = null;
foreach ($bas as $ba) {
if ($ba->pointInBA($ort->lon, $ort->lat)) {
echo $ort->id . " - " . $ort->ort . ": " . $ba->ba_nr . "\n";
$found_ba = $ba->ba_nr;
}
}
if ($found_ba) {
$ort->ba_nr = $found_ba;
$ort->save();
}
}
}
示例12: ForumNumberRusEnding
function ForumNumberRusEnding($num)
{
if (LANGUAGE_ID == "ru")
{
if (strlen($num)>1 && substr($num, strlen($num)-2, 1)=="1")
{
return GetMessage("F_ENDING_OV");
}
else
{
$c = IntVal(substr($num, strlen($num)-1, 1));
if ($c==0 || ($c>=5 && $c<=9))
return GetMessage("F_ENDING_OV");
elseif ($c==1)
return "";
else
return GetMessage("F_ENDING_A");
}
}
else
{
if (IntVal($num)>1)
return "s";
return "";
}
}
示例13: process
protected function process(ViewBag $viewbag)
{
$movie = $this->movie;
$list = $this->list;
$im = imagecreate($this->W, $this->H);
$background_color = imagecolorallocate($im, 0xc0, 0xc0, 0xc0);
imagefilledrectangle($im, 0, 0, $this->W - 1, $this->H - 1, $background_color);
$black = imagecolorallocate($im, 0, 0, 0);
imagerectangle($im, 0, 0, $this->W - 1, $this->H - 1, $black);
$red = imagecolorallocate($im, 0xc0, 0, 0);
$max = $movie->getMaxSeek();
$scale = DoubleVal($this->W) / DoubleVal($max);
foreach ($list->getCutRegions() as $v) {
$left = $v[0];
$right = $v[1];
if ($right == -1) {
$right = $max;
}
$x1 = IntVal($left * $scale);
$x2 = min($this->W - 1, IntVal($right * $scale));
imagefilledrectangle($im, $x1, 1, $x2, $this->H - 2, $red);
}
header("Content-Type: image/png");
header("Cache-Control: must-revalidate");
imagepng($im);
exit;
}
示例14: run
public function run($args)
{
define("VERYFAST", true);
if (count($args) == 0) {
die("./yii recalc_documents [Dokument-ID|alle]\n");
}
if ($args[0] == "alle") {
$sql = Yii::app()->db->createCommand();
$sql->select("id")->from("dokumente")->where("id >= 579866")->order("id");
$data = $sql->queryColumn(["id"]);
} else {
$data = [IntVal($args[0])];
}
$anz = count($data);
foreach ($data as $nr => $dok_id) {
echo "{$nr} / {$anz} => {$dok_id}\n";
/** @var Dokument $dokument */
$dokument = Dokument::model()->findByPk($dok_id);
if (!$dokument) {
continue;
}
$dokument->download_if_necessary();
$dokument->geo_extract();
$absolute_filename = $dokument->getLocalPath();
$metadata = RISPDF2Text::document_pdf_metadata($absolute_filename);
$dokument->seiten_anzahl = $metadata["seiten"];
$dokument->datum_dokument = $metadata["datum"];
$dokument->save();
echo $dokument->id . " => " . $dokument->seiten_anzahl . " / " . $dokument->datum_dokument . "\n";
}
}
示例15: Update
public static function Update($ID, $arFields)
{
global $DB;
$ID = IntVal($ID);
if ($ID <= 0) {
return False;
}
$arFields1 = array();
foreach ($arFields as $key => $value) {
if (substr($key, 0, 1) == "=") {
$arFields1[substr($key, 1)] = $value;
unset($arFields[$key]);
}
}
if (!CSaleAffiliateTransact::CheckFields("UPDATE", $arFields, $ID)) {
return false;
}
$strUpdate = $DB->PrepareUpdate("b_sale_affiliate_transact", $arFields);
foreach ($arFields1 as $key => $value) {
if (strlen($strUpdate) > 0) {
$strUpdate .= ", ";
}
$strUpdate .= $key . "=" . $value . " ";
}
$strSql = "UPDATE b_sale_affiliate_transact SET " . $strUpdate . " WHERE ID = " . $ID . " ";
$DB->Query($strSql, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
return $ID;
}