本文整理汇总了PHP中getArrayKey函数的典型用法代码示例。如果您正苦于以下问题:PHP getArrayKey函数的具体用法?PHP getArrayKey怎么用?PHP getArrayKey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getArrayKey函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stream_open
public function stream_open($vd6fe1d0be6347b8ef2427fa629c04485, $v15d61712450a686a7f365adf4fef581f, $v93da65a9fd0004d9477aeac024e08e15, $v6385a5865e0b96f09e4142ab2d9e3736)
{
$vb99eb979e6f6efabc396f777b503f7e7 = cacheFrontend::getInstance();
if ($v8d777f385d3dfec8815d20f7496026dc = $vb99eb979e6f6efabc396f777b503f7e7->loadData($vd6fe1d0be6347b8ef2427fa629c04485)) {
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
}
$v264a818e305e0550c3ee63761dd3d911 = $this->parsePath($vd6fe1d0be6347b8ef2427fa629c04485);
try {
if (!is_array($v8d777f385d3dfec8815d20f7496026dc)) {
$v8d777f385d3dfec8815d20f7496026dc = $this->executeMacros($v264a818e305e0550c3ee63761dd3d911);
if ($v8d777f385d3dfec8815d20f7496026dc === false) {
$v8d777f385d3dfec8815d20f7496026dc = array('error' => array('attribute:code' => 'require-more-permissions', 'node:message' => getLabel('error-require-more-permissions')));
}
}
} catch (publicException $ve1671797c52e15f763380b45e841ec32) {
$vcb5e100e5a9a3e7f6d1fd97512215282 = array();
if ($v8e95bd427d65fbeeedb980f640074ea2 = $ve1671797c52e15f763380b45e841ec32->getCode()) {
$vcb5e100e5a9a3e7f6d1fd97512215282['attribute:code'] = $v8e95bd427d65fbeeedb980f640074ea2;
}
if ($v1634f20805d929bd08a1f418a78c0615 = $ve1671797c52e15f763380b45e841ec32->getStrCode()) {
$vcb5e100e5a9a3e7f6d1fd97512215282['attribute:str-code'] = $v1634f20805d929bd08a1f418a78c0615;
}
$vcb5e100e5a9a3e7f6d1fd97512215282['node:message'] = $ve1671797c52e15f763380b45e841ec32->getMessage();
$v8d777f385d3dfec8815d20f7496026dc = array("error" => $vcb5e100e5a9a3e7f6d1fd97512215282);
}
if ($v8d777f385d3dfec8815d20f7496026dc === false) {
return true;
} else {
$v8d777f385d3dfec8815d20f7496026dc = $this->translateToXml(getArrayKey($v264a818e305e0550c3ee63761dd3d911, 'module'), getArrayKey($v264a818e305e0550c3ee63761dd3d911, 'method'), $v8d777f385d3dfec8815d20f7496026dc);
if ($this->expire) {
$vb99eb979e6f6efabc396f777b503f7e7->saveData($vd6fe1d0be6347b8ef2427fa629c04485, $v8d777f385d3dfec8815d20f7496026dc, $this->expire);
}
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
}
}
示例2: onModifyObject
public function onModifyObject(iUmiEventPoint $event) {
static $modifiedCache = array();
$object = $event->getRef("object");
$typeId = umiObjectTypesCollection::getInstance()->getBaseType('emarket', 'order');
if($object->getTypeId() != $typeId) return;
if($event->getMode() == "before") {
$data = getRequest("data");
$id = $object->getId();
$newOrderStatus = getArrayKey($data[$id], 'status_id');
$newPaymentStatus = getArrayKey($data[$id], 'payment_status_id');
$newDeliveryStatus = getArrayKey($data[$id], 'delivery_status_id');
switch(true) {
case ($newOrderStatus != $object->getValue("status_id") ) : $modifiedCache[$object->getId()] = "status_id"; break;
case ($newDeliveryStatus != $object->getValue("delivery_status_id")) : $modifiedCache[$object->getId()] = "delivery_status_id"; break;
case ($newPaymentStatus != $object->getValue("payment_status_id") ) : $modifiedCache[$object->getId()] = "payment_status_id"; break;
}
} else {
if(isset($modifiedCache[$object->getId()])) {
if ($modifiedCache[$object->getId()] == 'payment_status_id' && $object->getValue("payment_status_id") == order::getStatusByCode('accepted', 'order_payment_status')) {
self::addBonus($object->getId());
}
if ($modifiedCache[$object->getId()] == 'status_id' && ($object->getValue("status_id") == order::getStatusByCode('canceled') || $object->getValue("status_id") == order::getStatusByCode('rejected'))) {
self::returnBonus($object->getId());
}
$this->notifyOrderStatusChange(order::get($object->getId()), $modifiedCache[$object->getId()]);
}
}
}
示例3: stream_open
public function stream_open($vd6fe1d0be6347b8ef2427fa629c04485, $v15d61712450a686a7f365adf4fef581f, $v93da65a9fd0004d9477aeac024e08e15, $v6385a5865e0b96f09e4142ab2d9e3736)
{
$vb99eb979e6f6efabc396f777b503f7e7 = cacheFrontend::getInstance();
if ($v8d777f385d3dfec8815d20f7496026dc = $vb99eb979e6f6efabc396f777b503f7e7->loadData($vd6fe1d0be6347b8ef2427fa629c04485)) {
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
}
$vaf31437ce61345f416579830a98c91e5 = $this->parsePath($vd6fe1d0be6347b8ef2427fa629c04485);
$va8cfde6331bd59eb2ac96f8911c4b666 = umiObjectsCollection::getInstance()->getObject($vaf31437ce61345f416579830a98c91e5);
if ($va8cfde6331bd59eb2ac96f8911c4b666 instanceof iUmiObject) {
if (is_null($this->prop_name)) {
$v164d124aa1de584618cde85506eb8cd4 = translatorWrapper::$showEmptyFields;
if (!is_null(getArrayKey($this->params, 'show-empty'))) {
translatorWrapper::$showEmptyFields = true;
}
$v8d777f385d3dfec8815d20f7496026dc = $this->translateToXml($va8cfde6331bd59eb2ac96f8911c4b666);
translatorWrapper::$showEmptyFields = $v164d124aa1de584618cde85506eb8cd4;
} else {
$v23a5b8ab834cb5140fa6665622eb6417 = $va8cfde6331bd59eb2ac96f8911c4b666->getPropByName($this->prop_name);
if ($v23a5b8ab834cb5140fa6665622eb6417 instanceof iUmiObjectProperty) {
$v8d777f385d3dfec8815d20f7496026dc = $this->translateToXml($va8cfde6331bd59eb2ac96f8911c4b666, $v23a5b8ab834cb5140fa6665622eb6417);
} else {
return $this->setDataError('not-found');
}
}
if ($this->expire) {
$vb99eb979e6f6efabc396f777b503f7e7->saveObject($vd6fe1d0be6347b8ef2427fa629c04485, $v8d777f385d3dfec8815d20f7496026dc, $this->expire);
}
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
} else {
return $this->setDataError('not-found');
}
}
示例4: stream_open
public function stream_open($vd6fe1d0be6347b8ef2427fa629c04485, $v15d61712450a686a7f365adf4fef581f, $v93da65a9fd0004d9477aeac024e08e15, $v6385a5865e0b96f09e4142ab2d9e3736)
{
$vb99eb979e6f6efabc396f777b503f7e7 = cacheFrontend::getInstance();
if ($v8d777f385d3dfec8815d20f7496026dc = $vb99eb979e6f6efabc396f777b503f7e7->loadData($vd6fe1d0be6347b8ef2427fa629c04485)) {
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
}
$v7057e8409c7c531a1a6e9ac3df4ed549 = $this->parsePath($vd6fe1d0be6347b8ef2427fa629c04485);
$v8e2dcfd7e7e24b1ca76c1193f645902b = umiHierarchy::getInstance()->getElement($v7057e8409c7c531a1a6e9ac3df4ed549);
if ($v8e2dcfd7e7e24b1ca76c1193f645902b instanceof iUmiHierarchyElement) {
if (is_null($this->prop_name)) {
$v164d124aa1de584618cde85506eb8cd4 = translatorWrapper::$showEmptyFields;
if (!is_null(getArrayKey($this->params, 'show-empty'))) {
translatorWrapper::$showEmptyFields = true;
}
$v8d777f385d3dfec8815d20f7496026dc = $this->translateToXml($v8e2dcfd7e7e24b1ca76c1193f645902b);
translatorWrapper::$showEmptyFields = $v164d124aa1de584618cde85506eb8cd4;
} else {
$v23a5b8ab834cb5140fa6665622eb6417 = $v8e2dcfd7e7e24b1ca76c1193f645902b->getObject()->getPropByName($this->prop_name);
if ($v23a5b8ab834cb5140fa6665622eb6417 instanceof iUmiObjectProperty) {
$v8d777f385d3dfec8815d20f7496026dc = $this->translateToXml($v8e2dcfd7e7e24b1ca76c1193f645902b, $v23a5b8ab834cb5140fa6665622eb6417);
} else {
return $this->setDataError('not-found');
}
}
if ($this->expire) {
$vb99eb979e6f6efabc396f777b503f7e7->saveData($vd6fe1d0be6347b8ef2427fa629c04485, $v8d777f385d3dfec8815d20f7496026dc, $this->expire);
}
return $this->setData($v8d777f385d3dfec8815d20f7496026dc);
} else {
return $this->setDataError('not-found');
}
}
示例5: guides
public function guides() {
$objectTypes = umiObjectTypesCollection::getInstance();
if(isset($_REQUEST['search-all-text'][0])) {
$searchAllText = array_extract_values($_REQUEST['search-all-text']);
foreach($searchAllText as $i => $v) {
$searchAllText[$i] = wa_strtolower($v);
}
} else {
$searchAllText = false;
}
$rel = umiObjectTypesCollection::getInstance()->getTypeIdByGUID('root-guides-type');
if(($rels = getRequest('rel')) && sizeof($rels)) {
$rel = getArrayKey($rels, 0);
}
$per_page = getRequest('per_page_limit');
$curr_page = (int) getRequest('p');
$types = umiObjectTypesCollection::getInstance();
$guides_list = $types->getGuidesList(true, $rel);
$tmp = Array();
foreach($guides_list as $typeId => $name) {
if($searchAllText) {
$match = false;
foreach($searchAllText as $searchString) {
if(strstr(wa_strtolower($name), $searchString) !== false) {
$match = true;
}
}
if(!$match) {
continue;
}
}
$tmp[$typeId] = $name;
}
if(isset($_REQUEST['order_filter']['name'])) {
natsort($tmp);
if($_REQUEST['order_filter']['name'] == "desc") {
$tmp = array_reverse($tmp, true);
}
}
$guides_list = array_keys($tmp);
unset($tmp);
$guides_list = $this->excludeNestedTypes($guides_list);
$total = sizeof($guides_list);
$guides = array_slice($guides_list, $per_page * $curr_page, $per_page);
$this->setDataType("list");
$this->setActionType("view");
$this->setDataRange($per_page, $curr_page * $per_page);
$data = $this->prepareData($guides, "types");
$this->setData($data, $total);
return $this->doData();
}
示例6: checkCaptcha
public static function checkCaptcha()
{
$v2245023265ae4cf87d02c8b6ba991139 = mainConfiguration::getInstance();
if (!$v2245023265ae4cf87d02c8b6ba991139->get('anti-spam', 'captcha.enabled')) {
return true;
}
$v41275a535677f79ff347e01bc530c176 = permissionsCollection::getInstance();
if ($v41275a535677f79ff347e01bc530c176->isAuth()) {
return true;
}
if (isset($_COOKIE['umi_captcha']) && strlen($_COOKIE['umi_captcha'])) {
if ($_COOKIE['umi_captcha'] == md5(getArrayKey($_COOKIE, 'user_captcha')) || $_COOKIE['umi_captcha'] == md5(getRequest('captcha'))) {
$v70b29c4920daf4e51e8175179027e668 = getRequest('captcha');
if (md5($v70b29c4920daf4e51e8175179027e668) == $_COOKIE['umi_captcha']) {
setcookie("user_captcha", $v70b29c4920daf4e51e8175179027e668, time() + 3600 * 24 * 31, "/");
}
$_SESSION['is_human'] = 1;
return true;
} else {
unset($_SESSION['is_human']);
return false;
}
}
return false;
}
示例7: applyPriceCurrency
public function applyPriceCurrency($price = 0, $template = 'default')
{
list($tpl_block) = def_module::loadTemplates("emarket/{$template}", 'price_block');
$price = $this->parsePriceTpl($template, $this->formatCurrencyPrice(array('actual' => $price)));
$result = array('price' => $price);
$result['void:price-original'] = getArrayKey($result['price'], 'original');
$result['void:price-actual'] = getArrayKey($result['price'], 'actual');
return def_module::parseTemplate($tpl_block, $result);
}
示例8: basketAdd
public function basketAdd($itemType = false, $itemId = false)
{
$order = $this->getBasketOrder(false);
$itemType = $itemType ? $itemType : getRequest('param1');
$itemId = (int) ($itemId ? $itemId : getRequest('param2'));
$amount = (int) getRequest('amount');
$options = getRequest('options');
if ($amount == 0) {
$amount = 1;
}
if ($itemType == 'element') {
if (is_array($options)) {
$orderItems = $order->getItems();
foreach ($orderItems as $tOrderItem) {
if (!$tOrderItem instanceof optionedOrderItem) {
$itemOptions = null;
$tOrderItem = null;
continue;
}
$itemOptions = $tOrderItem->getOptions();
if (sizeof($itemOptions) != sizeof($options)) {
$itemOptions = null;
$tOrderItem = null;
continue;
}
if ($tOrderItem->getItemElement()->id != $itemId) {
$itemOptions = null;
$tOrderItem = null;
continue;
}
foreach ($options as $optionName => $optionId) {
$itemOption = getArrayKey($itemOptions, $optionName);
if (getArrayKey($itemOption, 'option-id') != $optionId) {
$tOrderItem = null;
continue 2;
}
}
break;
}
if ($tOrderItem) {
$orderItem = $tOrderItem;
$itemType = 'item';
$itemId = $orderItem->getId();
unset($_REQUEST['options']);
}
} else {
$orderItem = $this->getBasketItem($itemId);
}
} else {
$orderItem = $order->getItem($itemId);
}
if ($orderItem instanceof orderItem) {
$_REQUEST['amount'] = $orderItem->getAmount() + $amount;
}
$_REQUEST['no-redirect'] = 1;
return $this->basket('put', $itemType, $itemId);
}
示例9: execute
public function execute($v58309fbfe87fa90ec9f4b9d78ead9d77, $v21ffce5b8a6cc8cc6a41448dd69623c9)
{
$v7f2db423a49b305459147332fb01cf87 = outputBuffer::current();
$v7f2db423a49b305459147332fb01cf87->clear();
$v7f2db423a49b305459147332fb01cf87->charset('utf-8');
$v7f2db423a49b305459147332fb01cf87->contentType('text/xml');
$this->sendHTTPHeaders($v21ffce5b8a6cc8cc6a41448dd69623c9);
$v7f2db423a49b305459147332fb01cf87->push($v58309fbfe87fa90ec9f4b9d78ead9d77);
$v6a2a431fe8b621037ea949531c28551d = getArrayKey($v21ffce5b8a6cc8cc6a41448dd69623c9, 'output');
if ($v6a2a431fe8b621037ea949531c28551d) {
file_put_contents($v6a2a431fe8b621037ea949531c28551d, $v58309fbfe87fa90ec9f4b9d78ead9d77);
} else {
}
$v7f2db423a49b305459147332fb01cf87->end();
}
示例10: getArrayKey
function getArrayKey($arr, $value)
{
if (!is_array($arr)) {
return null;
}
foreach ($arr as $k => $v) {
$return = getArrayKey($v, $value);
if ($v == $value) {
return $k;
}
if (!is_null($return)) {
return $return;
}
}
}
示例11: discount_add
public function discount_add()
{
$inputData = array("type" => "discount");
$mode = (string) getRequest('param0');
if ($mode == "do") {
$data = getArrayKey(getRequest('data'), 'new');
//Create new dicsount
$discountName = getRequest('name');
$discountTypeId = getArrayKey($data, 'discount_type_id');
try {
$discount = discount::add($discountName, $discountTypeId);
//Apply modificator
$modificatorId = getArrayKey($data, 'discount_modificator_id');
try {
$modificatorTypeObject = $this->expectObject($modificatorId, true, true);
} catch (publicAdminException $e) {
if ($discount) {
$discount->delete();
}
$this->errorNewMessage(getLabel('error-modificator-required'));
$this->errorPanic();
}
$modificatorObject = discountModificator::create($discount, $modificatorTypeObject);
$discount->setDiscountModificator($modificatorObject);
//Apply rules
$rulesId = getArrayKey($data, 'discount_rules_id');
foreach ($rulesId as $ruleId) {
$ruleTypeObject = $this->expectObject($ruleId, true, true);
$ruleObject = discountRule::create($discount, $ruleTypeObject);
if ($ruleObject instanceof discountRule == false) {
$discount->delete();
throw new publicAdminException("discountRule #{$ruleId} \"{$ruleTypeObject->name}\" class not found");
}
$discount->appendDiscountRule($ruleObject);
}
$discount->commit();
} catch (valueRequiredException $e) {
$this->errorNewMessage($e->getMessage());
$this->errorPanic();
}
$this->chooseRedirect($this->pre_lang . "/admin/emarket/discount_edit/" . $discount->getId() . "/");
}
$this->setDataType("form");
$this->setActionType("create");
$data = $this->prepareData($inputData, "object");
$this->setData($data);
return $this->doData();
}
示例12: getType
public function getType($v94757cae63fd3e398c0811a976dd6bbe)
{
if (!$v94757cae63fd3e398c0811a976dd6bbe) {
return false;
}
if (!is_numeric($v94757cae63fd3e398c0811a976dd6bbe)) {
$v94757cae63fd3e398c0811a976dd6bbe = $this->getTypeIdByGUID($v94757cae63fd3e398c0811a976dd6bbe);
}
if ($this->isLoaded($v94757cae63fd3e398c0811a976dd6bbe)) {
return $this->types[$v94757cae63fd3e398c0811a976dd6bbe];
} else {
$this->loadType($v94757cae63fd3e398c0811a976dd6bbe);
return getArrayKey($this->types, $v94757cae63fd3e398c0811a976dd6bbe);
}
throw new coreException("Unknow error");
}
示例13: end
public function end()
{
if (!DEBUG) {
@ob_clean();
}
if (getArrayKey($this->options, 'quick-edit')) {
umiTemplater::prepareQuickEdit();
}
if (CALC_E_TAG) {
$this->sendETag();
}
$this->push($this->getCallTime());
$this->send();
session_write_close();
exit;
}
示例14: stores
public function stores($elementId, $template = 'default')
{
if (!$template) {
$tempate = 'default';
}
$hierarchy = umiHierarchy::getInstance();
$objects = umiObjectsCollection::getInstance();
list($tpl_block, $tpl_block_empty, $tpl_item) = def_module::loadTemplates("emarket/stores/" . $template, 'stores_block', 'stores_block_empty', 'stores_item');
$elementId = $this->analyzeRequiredPath($elementId);
if ($elementId == false) {
throw new publicException("Wrong element id given");
}
$element = $hierarchy->getElement($elementId);
if ($element instanceof iUmiHierarchyElement == false) {
throw new publicException("Wrong element id given");
}
$storesInfo = $element->stores_state;
$items_arr = array();
$stores = array();
$total = 0;
if (is_array($storesInfo)) {
foreach ($storesInfo as $storeInfo) {
$object = $objects->getObject(getArrayKey($storeInfo, 'rel'));
if ($object instanceof iUmiObject) {
$amount = (int) getArrayKey($storeInfo, 'int');
$total += $amount;
$store = array('attribute:amount' => $amount);
if ($object->primary) {
$reserved = (int) $element->reserved;
$store['attribute:amount'] -= $reserved;
$store['attribute:reserved'] = $reserved;
$store['attribute:primary'] = 'primary';
}
$store['item'] = $object;
$stores[] = $store;
$items_arr[] = def_module::parseTemplate($tpl_item, array('store_id' => $object->id, 'amount' => $amount, 'name' => $object->name), false, $object->id);
}
}
}
$result = array('stores' => array('attribute:total-amount' => $total, 'nodes:store' => $stores));
$result['void:total-amount'] = $total;
$result['void:items'] = $items_arr;
if (!$total) {
$tpl_block = $tpl_block_empty;
}
return def_module::parseTemplate($tpl_block, $result);
}
示例15: sendHTTPHeaders
protected function sendHTTPHeaders($v21ffce5b8a6cc8cc6a41448dd69623c9)
{
if (is_array($v21ffce5b8a6cc8cc6a41448dd69623c9)) {
$v7f2db423a49b305459147332fb01cf87 = outputBuffer::current();
$v4340fd73e75df7a9d9e45902a59ba3a4 = getArrayKey($v21ffce5b8a6cc8cc6a41448dd69623c9, 'headers');
if (is_array($v4340fd73e75df7a9d9e45902a59ba3a4)) {
foreach ($v4340fd73e75df7a9d9e45902a59ba3a4 as $v865c0c0b4ab0e063e5caa3387c1a8741 => $v9e3669d19b675bd57058fd4664205d2a) {
if (strtolower($v865c0c0b4ab0e063e5caa3387c1a8741) == 'content-type') {
$v7f2db423a49b305459147332fb01cf87->contentType($v9e3669d19b675bd57058fd4664205d2a);
continue;
}
$v7f2db423a49b305459147332fb01cf87->header($v865c0c0b4ab0e063e5caa3387c1a8741, $v9e3669d19b675bd57058fd4664205d2a);
}
}
} else {
throw new coreException("First argument must be ad array in sendHTTPHeaders()");
}
}