本文整理汇总了PHP中toUpper函数的典型用法代码示例。如果您正苦于以下问题:PHP toUpper函数的具体用法?PHP toUpper怎么用?PHP toUpper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toUpper函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: berekenSom
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<p><?php
echo $getal1 . " + " . $getal2 . " = " . berekenSom($getal1, $getal2);
?>
</p>
<p><?php
echo $getal1 . " * " . $getal2 . " = " . vermenigvuldig($getal1, $getal2);
?>
</p>
<p><?php
echo $getal . " is ";
if (isEven($getal)) {
echo " even";
} else {
echo " oneven";
}
?>
</p>
<p><?php
echo var_dump(toUpper($tekst));
?>
</p>
</body>
</html>
示例2: testToUpper
public function testToUpper()
{
$this->assertEquals(toUpper('Hello World'), 'HELLO WORLD');
}
示例3: array
$element_type = "photo";
}
$arElement["SECTION_PATH"] = array();
if ($arElement["IBLOCK_SECTION_ID"] > 0) {
$rsPath = GetIBlockSectionPath($arElement["IBLOCK_ID"], $arElement["IBLOCK_SECTION_ID"]);
while ($arPath = $rsPath->GetNext()) {
$arElement["SECTION_PATH"][] = $arPath;
}
}
$strUrl = "";
$arChainBody[] = '<a href="' . CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_USER_" . toUpper($element_type)], array("user_id" => $arParams["SOCNET_USER_ID"], "path" => "")) . '">' . $arFeaturesTitles[$element_type] . '</a>';
$k = 0;
foreach ($arElement["SECTION_PATH"] as $arPath) {
if ($k > 0) {
$strUrl .= $arPath["NAME"] . "/";
$arPath["URL"] = CComponentEngine::MakePathFromTemplate($arParams["~PATH_TO_USER_" . toUpper($element_type) . "_SECTION"], array("user_id" => $arParams["SOCNET_USER_ID"], "path" => rtrim($strUrl, "/"), "section_id" => $arPath["ID"], "user_alias" => "user_" . $arParams["SOCNET_USER_ID"]));
if ($element_type != "calendar") {
$arChainBody[] = '<a href="' . $arPath["URL"] . '">' . htmlspecialcharsex($arPath["NAME"]) . '</a>';
} else {
$arChainBody[] = htmlspecialcharsex($arPath["NAME"]);
}
}
$k++;
}
$arResult["SEARCH"][$i]["CHAIN_PATH"] = implode(' / ', $arChainBody);
}
if (!$file && $element_type && $element_type != "files") {
if (file_exists($abs_path . $element_type . "_default.gif")) {
$file = $element_type . "_default.gif";
}
}
示例4: array
}
}
$arListParams = array('SELECT' => array('UF_*'));
if (!$bExcel && $arParams['USERS_PER_PAGE'] > 0) {
$arListParams['NAV_PARAMS'] = array('nPageSize' => $arParams['USERS_PER_PAGE'], 'bShowAll' => false);
}
if ($bDisable) {
$dbUsers = new CDBResult();
$dbUsers->InitFromArray(array());
} else {
if ($arFilter['LAST_NAME_RANGE']) {
//input format: a-z (letter - letter)
$letterRange = explode('-', $arFilter['LAST_NAME_RANGE'], 2);
$startLetterRange = array_shift($letterRange);
$endLetterRange = array_shift($letterRange);
$arFilter[] = array('LOGIC' => 'OR', array('><F_LAST_NAME' => array(toUpper($startLetterRange), toUpper($endLetterRange))), array('><F_LAST_NAME' => array(toLower($startLetterRange), toLower($endLetterRange))));
unset($arFilter['LAST_NAME_RANGE']);
}
$dbUsers = $obUser->GetList($sort_by = 'last_name', $sort_dir = 'asc', $arFilter, $arListParams);
}
$arDepartments = array();
$strUserIDs = '';
while ($arUser = $dbUsers->Fetch()) {
$arResult['USERS'][$arUser['ID']] = $arUser;
$strUserIDs .= ($strUserIDs == '' ? '' : '|') . $arUser['ID'];
}
//head
$dbRes = CIBlockSection::GetList(array(), array('UF_HEAD' => array_keys($arResult['USERS']), 'IBLOCK_ID' => COption::GetOptionInt('intranet', 'iblock_structure')), false, array('ID', 'NAME', 'UF_HEAD'));
while ($arSection = $dbRes->Fetch()) {
$arResult['USERS'][$arSection['UF_HEAD']]["DEP_HEAD"][$arSection["ID"]] = $arSection["NAME"];
}
示例5: bxStatSort
function bxStatSort($a, $b)
{
global $by, $order, $arPrices, $arCurUsed;
$by = toUpper($by);
$order = toUpper($order);
if (in_array($by, array("PRODUCT_ID", "PAYED", "ALLOW_DELIVERY", "ORDER_COUNT", "COUNT", "QUANTITY", "DELAY", "ORDER_QUANTITY", "BASKET_QUANTITY"))) {
if (DoubleVal($a[$by]) == DoubleVal($b[$by])) {
return 0;
} elseif (DoubleVal($a[$by]) > DoubleVal($b[$by])) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
} elseif ($by == "PAYED_PROC" || $by == "ALLOW_DELIVERY_PROC") {
if ($by == "PAYED_PROC") {
$k = "PAYED";
} else {
$k = "ALLOW_DELIVERY";
}
if (IntVal($a[$k]) == IntVal($b[$k]) && IntVal($b[$k]) == 0) {
return 0;
} elseif (IntVal($a[$k]) > 0 && IntVal($b[$k]) > 0) {
if (DoubleVal($a[$k] * 100 / $a["ORDER_COUNT"]) > DoubleVal($b[$k] * 100 / $b["ORDER_COUNT"])) {
return $order == "DESC" ? -1 : 1;
} elseif (DoubleVal($a[$k] * 100 / $a["ORDER_COUNT"]) < DoubleVal($b[$k] * 100 / $b["ORDER_COUNT"])) {
return $order == "DESC" ? 1 : -1;
} else {
return 0;
}
} elseif (IntVal($a[$k]) > 0 && IntVal($b[$k]) <= 0) {
return $order == "DESC" ? -1 : 1;
} elseif (IntVal($a[$k]) <= 0 && IntVal($b[$k]) > 0) {
return $order == "DESC" ? 1 : -1;
} else {
return 0;
}
} else {
$bFound = false;
foreach ($arCurUsed as $cur) {
foreach ($arPrices as $price) {
if ($by == $price . "_" . $cur) {
$bFound = true;
$k = $cur;
$v = $price;
break;
}
}
if ($bFound) {
break;
}
}
if ($bFound) {
if (IntVal($a[$v][$k]) == IntVal($b[$v][$k])) {
return 0;
} elseif (IntVal($a[$v][$k]) > IntVal($b[$v][$k])) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
} else {
if ($a[$by] == $b[$by]) {
return 0;
} elseif ($a[$by] > $b[$by]) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
}
}
}
示例6: GetMessage
if (strlen($loader->strError) > 0) {
echo $loader->strError;
}
} else {
echo "failure\n" . GetMessage("CC_BSC1_EMPTY_CML");
}
}
} else {
echo "failure\n", GetMessage("CC_BSC1_ERROR_UNKNOWN_COMMAND");
}
}
$contents = ob_get_contents();
ob_end_clean();
if (!$bDesignMode) {
if (!$bCrmMode) {
if (toUpper(LANG_CHARSET) != "WINDOWS-1251") {
$contents = $APPLICATION->ConvertCharset($contents, LANG_CHARSET, "windows-1251");
}
}
if ($gzCompressionSupported) {
$contents = gzcompress($contents);
header("Content-Type: application/octet-stream");
header("Content-Length: " . (function_exists("mb_strlen") ? mb_strlen($contents, 'latin1') : strlen($contents)));
} else {
$str = function_exists("mb_strlen") ? mb_strlen($contents, 'latin1') : strlen($contents);
if ($_GET["mode"] == "query" || $_POST["mode"] == "query") {
header("Content-Type: application/xml; charset=windows-1251");
header("Content-Length: " . $str);
} else {
header("Content-Type: text/html; charset=windows-1251");
}
示例7: array
if (!$bExtranetUser || CMobile::getApiVersion() >= 9 || intval($_GET["api_version"]) >= 9) {
$data = array("status" => "success", "page_mark" => "<!--bitrix_mobile_app-->", "sessid_md5" => bitrix_sessid(), "target" => md5($USER->GetID() . CMain::GetServerUniqID()), "photoUrl" => $img_src, "useModernStyle" => true, "appmap" => array("main" => array("url" => $params["START_PAGE"] ? $params["START_PAGE"] : "", "bx24ModernStyle" => true), "menu" => array("url" => $params["MENU_PAGE"] ? $params["MENU_PAGE"] : "")));
if (\Bitrix\MobileApp\Mobile::getInstance()->getApiVersion() >= 10 && strlen($params["CHAT_PAGE"]) > 0) {
$data["appmap"]["right"] = array("url" => $params["CHAT_PAGE"]);
}
if ($bExtranetUser) {
$rsSites = CSite::GetByID(CExtranet::GetExtranetSiteID());
if (($arExtranetSite = $rsSites->Fetch()) && $arExtranetSite["ACTIVE"] != "N") {
$data["whiteList"] = array($arExtranetSite["DIR"] . "mobile/");
$data["appmap"] = array("main" => array("url" => $arExtranetSite["DIR"] . "mobile/index.php", "bx24ModernStyle" => true), "menu" => array("url" => $arExtranetSite["DIR"] . "mobile/left.php"), "right" => array("url" => $arExtranetSite["DIR"] . "mobile/im/right.php"));
if (\Bitrix\MobileApp\Mobile::getInstance()->getApiVersion() >= 10) {
$data["appmap"]["right"] = array("url" => $arExtranetSite["DIR"] . "mobile/im/right.php");
}
}
}
if (toUpper(SITE_CHARSET) != "UTF-8") {
$data = $APPLICATION->ConvertCharsetArray($data, SITE_CHARSET, "utf-8");
}
}
$needAppPass = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_APP_PASS");
$appUUID = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_APP_UUID");
$deviceName = \Bitrix\Main\Context::getCurrent()->getServer()->get("HTTP_BX_DEVICE_NAME");
if ($needAppPass == 'mobile' && $USER->GetParam("APPLICATION_ID") === null) {
if (strlen($appUUID) > 0) {
$result = ApplicationPasswordTable::getList(array('select' => array('ID'), 'filter' => array('USER_ID' => $USER->GetID(), 'CODE' => $appUUID)));
if ($row = $result->fetch()) {
ApplicationPasswordTable::delete($row['ID']);
}
}
$password = ApplicationPasswordTable::generatePassword();
$res = ApplicationPasswordTable::add(array('USER_ID' => $USER->GetID(), 'APPLICATION_ID' => 'mobile', 'PASSWORD' => $password, 'CODE' => $appUUID, 'DATE_CREATE' => new Main\Type\DateTime(), 'COMMENT' => GetMessage("MD_GENERATE_BY_MOBILE") . (strlen($deviceName) > 0 ? " (" . $deviceName . ")" : ""), 'SYSCOMMENT' => GetMessage("MD_MOBILE_APPLICATION")));
示例8: getViewPort
/**
* Use it to get current value of "viewport"-metadata
*
* @param string $width
*
* @return mixed|string
*/
public function getViewPort($width = "")
{
if ($width == "") {
$width = $this->getDevicewidth();
}
if ($this->largeScreenSupport == true) {
//we need to change densitydpi for large screens
if ($this->getDevice() == "iPad") {
//ipad large screen setting
return $this->getIPadViewPort();
} elseif ($this->getScreenCategory() == "LARGE" || $this->getScreenCategory() == "XLARGE") {
//android large screen setting
return $this->getLargeScreenViewPort();
}
}
$viewPortMeta = "<meta id=\"bx_mobile_viewport\" name=\"viewport\" content=\"#content_value#\">";
if ($this->getIniscale()) {
$contentAttributes[] = "initial-scale=" . $this->getIniscale();
}
if ($this->getMaxscale()) {
$contentAttributes[] = "maximum-scale=" . $this->getMaxscale();
}
if ($this->getMinscale()) {
$contentAttributes[] = "minimum-scale=" . $this->getMinscale();
}
if ($this->getWidth()) {
$contentAttributes[] = "width=" . $this->getWidth();
} elseif ($this->getIniscale()) {
$contentAttributes[] = "width=" . $width / $this->getIniscale();
}
if (toUpper($this->getPlatform()) == "ANDROID") {
if (!$this->getWidth()) {
$contentAttributes[] = "width=device-width";
}
$contentAttributes[] = "target-densitydpi=" . $this->getTargetDpi();
}
$contentAttributes[] = "user-scalable=" . $this->getUserScalable();
return str_replace("#content_value#", implode(", ", $contentAttributes), $viewPortMeta);
}
示例9: generirajUpit
function generirajUpit()
{
$listaUpit = array();
if (!empty($_REQUEST['oib'])) {
$listaUpit[] = 'contains(@oib, "' . $_REQUEST['oib'] . '")';
}
if (!empty($_REQUEST['ime'])) {
$listaUpit[] = 'contains(' . toUpper('ime') . ', "' . strToUpper($_REQUEST['ime']) . '")';
}
if (!empty($_REQUEST['prezime'])) {
$listaUpit[] = 'contains(' . toUpper('prezime') . ', "' . strToUpper($_REQUEST['prezime']) . '")';
}
if (!empty($_REQUEST['kategorija'])) {
$kategorijaUpit = array();
foreach ($_REQUEST['kategorija'] as $kategorija) {
$kategorijaUpit[] = '@kategorija="' . $kategorija . '"';
}
if (!empty($kategorijaUpit)) {
$listaUpit[] = '(' . implode(' or ', $kategorijaUpit) . ')';
}
}
$telefonUpit = array();
if (!empty($_REQUEST['tiptelefon'])) {
$telefonUpit[] = '@tip="' . $_REQUEST['tiptelefon'] . '"';
}
if (!empty($_REQUEST['broj'])) {
$telefonUpit[] = 'contains(broj, "' . $_REQUEST['broj'] . '")';
}
if (!empty($_REQUEST['pozivni'])) {
$pozivniUpit = array();
foreach ($_REQUEST['pozivni'] as $pozivni) {
$pozivniUpit[] = '@pozivni_broj="' . $pozivni . '"';
}
if (!empty($pozivniUpit)) {
$telefonUpit[] = 'broj[' . implode(' or ', $pozivniUpit) . ']';
}
}
if (!empty($telefonUpit)) {
$listaUpit[] = 'telefon[' . implode(' and ', $telefonUpit) . ']';
}
$adresaUpit = array();
if (!empty($_REQUEST['ulica'])) {
$adresaUpit[] = 'contains(' . toUpper('ulica') . ', "' . strToUpper($_REQUEST['ulica']) . '")';
}
if (!empty($_REQUEST['kucni_broj'])) {
$adresaUpit[] = 'contains(kucni_broj, "' . $_REQUEST['kucni_broj'] . '")';
}
if (!empty($_REQUEST['mjesto'])) {
$adresaUpit[] = 'contains(' . toUpper('mjesto') . ', "' . strToUpper($_REQUEST['mjesto']) . '")';
}
if (!empty($_REQUEST['postanski_broj'])) {
$adresaUpit[] = 'mjesto[contains(@postanski_broj, "' . $_REQUEST['postanski_broj'] . '")]';
}
if (!empty($_REQUEST['drzava'])) {
$adresaUpit[] = 'contains(' . toUpper('drzava') . ', "' . strToUpper($_REQUEST['drzava']) . '")';
}
if (!empty($adresaUpit)) {
$listaUpit[] = 'adresa[' . implode(' and ', $adresaUpit) . ']';
}
$zanimanjeUpit = array();
if (!empty($_REQUEST['vrsta_djelatnosti'])) {
if ($_REQUEST['vrsta_djelatnosti'] != 'none') {
$zanimanjeUpit[] = '@vrsta_djelatnosti="' . $_REQUEST['vrsta_djelatnosti'] . '"';
}
}
if (!empty($_REQUEST['kljucne_rijeci'])) {
$zanimanjeUpit[] = 'contains(' . toUpper('kljucne_rijeci') . ', "' . strToUpper($_REQUEST['kljucne_rijeci']) . '")';
}
if (!empty($_REQUEST['naziv_tvrtke'])) {
$zanimanjeUpit[] = 'contains(' . toUpper('naziv_tvrtke') . ', "' . strToUpper($_REQUEST['naziv_tvrtke']) . '")';
}
if (!empty($zanimanjeUpit)) {
$listaUpit[] = 'zanimanje[' . implode(' and ', $zanimanjeUpit) . ']';
}
if (!empty($_REQUEST['mail_adresa'])) {
$listaUpit[] = 'contains(mail_adresa, "' . $_REQUEST['mail_adresa'] . '")';
}
if (!empty($_REQUEST['datum_rodjenja'])) {
$listaUpit[] = 'datum_rodjenja="' . $_REQUEST['datum_rodjenja'] . '"';
}
$strUpit = implode(' and ', $listaUpit);
if (empty($strUpit)) {
return '/telefonski_imenik/osoba';
} else {
return '/telefonski_imenik/osoba[' . $strUpit . ']';
}
}
示例10: str_replace
$count++;
$table = $row;
$table = str_replace("##EDITFORMNAME##", "editform" . $count, $table);
$table = str_replace("##NID##", $nres["id"], $table);
$qpause_hour_time_dropdown = html_drop_down_arrays("pause_hour_time_drop", $qpause_hour_time, $qpause_hour_time, $pause_hour_time_drop);
//date("H",time()));
$qpause_min_time_dropdown = html_drop_down_arrays("pause_min_time_drop", $qpause_min_time, $qpause_min_time, $pause_min_time_drop);
//date("H",time()));
$table = str_replace("##PAUSEHOUR##", $qpause_hour_time_dropdown, $table);
$table = str_replace("##PAUSEMINUTES##", $qpause_min_time_dropdown, $table);
$qrating_dropdown = html_drop_down_arrays("rating_drop", $qrating, $qrating, "3");
//date("H",time()));
$table = str_replace("##RATING##", $qrating_dropdown, $table);
$table = str_replace("##NSTART##", $nres["begin"], $table);
$table = str_replace("##ACTIVITYSTOP##", substr($nres[aname], 0, 8) . "... " . $nres[wname], $table);
$table = str_replace("##NAMEDROPSTOP##", toUpper($nres['last']) . " " . $nres['first'], $table);
$table = str_replace("##DDESCRIPTION##", $nres["comm"], $table);
$table = str_replace("##FORM_NUM##", $count, $table);
// za Javascript hide
$nwhole_table .= $table;
// $pausintest.=print_r( $pause_hour_time_drop[$i]);
}
$tem = str_replace("##NLOGS##", $nwhole_table, $tem);
$tem = str_replace("##NMESSAGE##", $message, $tem);
for ($i = 1; $i < $count + 1; $i++) {
if ($_REQUEST['editform' . $i] == "Končaj") {
$stop_time = time();
$pht = $pause_hour_time_drop[0];
$pmt .= $pause_min_time_drop[0];
$pause_time = $pht * 3600 + $pmt * 60;
//dejansko vnesemo
示例11: ConvertCharset
private function ConvertCharset($data)
{
global $APPLICATION;
if (toUpper(LANG_CHARSET) != "UTF-8") {
return $APPLICATION->ConvertCharsetArray($data, 'utf-8', LANG_CHARSET);
} else {
return $data;
}
}
示例12: swapCase
/**
* Makes a case swapped version of the string
* @param string $string the input string
* @param boolean $mb to use or not to use multibyte character feature
* @return string case swapped version of the input string
*
* @author Rod Elias <rod@wgo.com.br>
*/
function swapCase($string, $mb = false)
{
return array_reduce(str_split($string), function ($carry, $item) use($mb) {
return $carry .= isLower($item, $mb) ? toUpper($item, $mb) : toLower($item, $mb);
}, '');
}
示例13: foreach
if (el)
{
if (val)
el.style.display = "none";
else
el.style.display = "block";
}
}
//-->
</script>
<form method="POST" name="log_filter">
<select name="flt_event_id" onChange="javascript:document.log_filter.submit()">
<?php
foreach ($arResult["Features"] as $featureID) {
$featureName = GetMessage(toUpper("SONET_ACTIVITY_T_" . $featureID));
?>
<option value="<?php
echo $featureID;
?>
" <?php
echo $featureID == $_REQUEST["flt_event_id"] ? "selected" : "";
?>
><?php
echo $featureName;
?>
</option><?php
}
?>
</select>
</form>
示例14: bxStatSort
function bxStatSort($a, $b)
{
global $by, $order;
$by = toUpper($by);
$order = toUpper($order);
if (in_array($by, array("COUNT", "PAYED", "ALLOW_DELIVERY", "CANCELED"))) {
if (DoubleVal($a[$by]) == DoubleVal($b[$by])) {
return 0;
} elseif (DoubleVal($a[$by]) > DoubleVal($b[$by])) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
} elseif ($by == "PAYED_PROC" || $by == "ALLOW_DELIVERY_PROC" || $by == "CANCELED_PROC") {
if ($by == "PAYED_PROC") {
$k = "PAYED";
} else {
$k = "ALLOW_DELIVERY";
}
if (IntVal($a[$k]) == IntVal($b[$k]) && IntVal($b[$k]) == 0) {
return 0;
} elseif (IntVal($a[$k]) > 0 && IntVal($b[$k]) > 0) {
if (DoubleVal($a[$k] * 100 / $a["COUNT"]) > DoubleVal($b[$k] * 100 / $b["COUNT"])) {
return $order == "DESC" ? -1 : 1;
} elseif (DoubleVal($a[$k] * 100 / $a["COUNT"]) < DoubleVal($b[$k] * 100 / $b["COUNT"])) {
return $order == "DESC" ? 1 : -1;
} else {
return 0;
}
} elseif (IntVal($a[$k]) > 0 && IntVal($b[$k]) <= 0) {
return $order == "DESC" ? -1 : 1;
} elseif (IntVal($a[$k]) <= 0 && IntVal($b[$k]) > 0) {
return $order == "DESC" ? 1 : -1;
} else {
return 0;
}
} elseif (strpos($by, "STATUS_") !== false || strpos($by, "STATUS_PRICE_") !== false || strpos($by, "PRICE_DELIVERY_") !== false || strpos($by, "TAX_VALUE_") !== false || strpos($by, "DISCOUNT_VALUE_") !== false || strpos($by, "PRICE_") !== false || strpos($by, "PRICE_PAYED_") !== false || strpos($by, "PRICE_ALLOW_DELIVERY_") !== false || strpos($by, "PRICE_CANCELED_") !== false) {
if (strpos($by, "STATUS_PRICE_") !== false) {
$k = substr($by, strlen("STATUS_PRICE_"));
$v = "STATUS_PRICE";
} elseif (strpos($by, "STATUS_") !== false) {
$k = substr($by, strlen("STATUS_"));
$v = "STATUS";
} elseif (strpos($by, "PRICE_DELIVERY_") !== false) {
$k = substr($by, strlen("PRICE_DELIVERY_"));
$v = "PRICE_DELIVERY";
} elseif (strpos($by, "TAX_VALUE_") !== false) {
$k = substr($by, strlen("TAX_VALUE_"));
$v = "TAX_VALUE";
} elseif (strpos($by, "DISCOUNT_VALUE_") !== false) {
$k = substr($by, strlen("DISCOUNT_VALUE_"));
$v = "DISCOUNT_VALUE";
} elseif (strpos($by, "PRICE_PAYED_") !== false) {
$k = substr($by, strlen("PRICE_PAYED_"));
$v = "PRICE_PAYED";
} elseif (strpos($by, "PRICE_CANCELED_") !== false) {
$k = substr($by, strlen("PRICE_CANCELED_"));
$v = "PRICE_CANCELED";
} elseif (strpos($by, "PRICE_ALLOW_DELIVERY_") !== false) {
$k = substr($by, strlen("PRICE_ALLOW_DELIVERY_"));
$v = "PRICE_ALLOW_DELIVERY";
} else {
$k = substr($by, strlen("PRICE_"));
$v = "PRICE";
}
if (IntVal($a[$v][$k]) == IntVal($b[$v][$k])) {
return 0;
} elseif (IntVal($a[$v][$k]) > IntVal($b[$v][$k])) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
} else {
if (MakeTimeStamp($a["DATE"]) == MakeTimeStamp($b["DATE"])) {
return 0;
} elseif (MakeTimeStamp($a["DATE"]) > MakeTimeStamp($b["DATE"])) {
return $order == "DESC" ? -1 : 1;
} else {
return $order == "DESC" ? 1 : -1;
}
}
}
示例15: getConfigJSON
/**
* Return configuration in JSON format
*
* @param $appCode - application code
* @param bool $platform - platform code
*
* @see ConfigTable::getSupportedPlatforms for details on availible platforms
* @return string
* @throws \Bitrix\Main\ArgumentException
*/
public static function getConfigJSON($appCode, $platform = false)
{
$map = new \Bitrix\MobileApp\Designer\ConfigMap();
$res = ConfigTable::getList(array("filter" => array("APP_CODE" => $appCode)));
$configs = $res->fetchAll();
$targetConfig = array();
for ($i = 0; $i < count($configs); $i++) {
if ($configs[$i]["PLATFORM"] == $platform) {
$targetConfig = $configs[$i];
break;
} elseif ($configs[$i]["PLATFORM"] == "global") {
$targetConfig = $configs[$i];
}
}
$params = array_key_exists("PARAMS", $targetConfig) ? $targetConfig["PARAMS"] : array();
$imageParamList = $map->getParamsByType(ParameterType::IMAGE);
$imageSetParamList = $map->getParamsByType(ParameterType::IMAGE_SET);
$structuredConfig = array();
foreach ($params as $key => $value) {
if (!$map->has($key)) {
continue;
}
if (array_key_exists($key, $imageParamList)) {
$imagePath = \CFile::GetPath($value);
if (strlen($imagePath) > 0) {
$value = $imagePath;
} else {
continue;
}
}
if (array_key_exists($key, $imageSetParamList)) {
$tmpValue = array();
foreach ($value as $imageCode => $imageId) {
$imagePath = \CFile::GetPath($imageId);
if (strlen($imagePath) > 0) {
$tmpValue[$imageCode] = $imagePath;
} else {
continue;
}
}
$value = $tmpValue;
}
$structuredConfig = array_merge_recursive(self::nameSpaceToArray($key, $value), $structuredConfig);
}
$structuredConfig["info"] = array("designer_version" => ConfigMap::VERSION, "platform" => $platform);
if (toUpper(SITE_CHARSET) != "UTF-8") {
$structuredConfig = Encoding::convertEncodingArray($structuredConfig, SITE_CHARSET, "UTF-8");
}
return json_encode($structuredConfig);
}