本文整理汇总了PHP中ArrayUtil::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtil::get方法的具体用法?PHP ArrayUtil::get怎么用?PHP ArrayUtil::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayUtil
的用法示例。
在下文中一共展示了ArrayUtil::get方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupDataSource
private static function setupDataSource($view, $source, $params)
{
$source->setStart(ArrayUtil::get($params, 'start', 0));
$source->setLimit(ArrayUtil::get($params, 'limit', self::DEFAULT_PROXY_LIMIT));
$sortColumn = ArrayUtil::get($params, 'sort', null);
if ($sortColumn) {
$sortColumn = self::getSortColumn($view, $sortColumn);
$source->setSort($sortColumn, ArrayUtil::get($params, 'dir', 'ASC'));
}
}
示例2: where
function where($query)
{
$qb = $this->_em->createQueryBuilder()->select(['subdivisionAltName'])->from('app\\Models\\Geography\\SubdivisionAltName', 'subdivisionAltName');
// Order by
if (is_null(ArrayUtil::get($query['orderBy'], NULL))) {
$qb->orderBy('subdivisionAltName.id', 'ASC');
}
$limit = is_null(ArrayUtil::get($query['limit'], NULL)) ? 80 : (int) $query['limit'];
$qb->setMaxResults($limit);
return $qb->getQuery()->getResult();
}
示例3: getWidgetUrl
/**
* Returns the "module/action" url for the current widget.
*/
public static function getWidgetUrl($parse)
{
$action = ArrayUtil::get($parse, 'component_name', null);
if ($action) {
$module = $parse['module'];
} else {
$context = sfContext::getInstance();
$action = $context->getActionName();
$module = $context->getModuleName();
}
return sprintf('%s/%s', $module, $action);
}
示例4: execute
public function execute($filterChain)
{
$context = $this->context;
if ($this->isFirstCall() && $context->getRequest()->getMethod() == sfRequest::POST) {
$actionInstance = $this->context->getActionStack()->getLastEntry()->getActionInstance();
$formcfg = self::getFormConfig($context);
if ($formcfg === null) {
$edit = $actionInstance->getRequestParameter('edit');
$apikey = $context->getRequest()->hasParameter('af_apikey');
if (!is_array($edit) || !$apikey) {
// Normal AJAX POST requests and plain forms don't have
// validators from the XML config.
$validators = array();
$formcfg = array();
} else {
self::renderErrors(array(), 'The form is outdated. Please, refresh it.');
}
} else {
$validators = $formcfg['validators'];
$fileTypes = $formcfg['fileTypes'];
}
if (ArrayUtil::get($formcfg, 'wizard', false)) {
afWizard::checkStepOrRenderError();
}
$errors = array();
$errorMessage = null;
$requestParameters = sfToolkit13::arrayDeepMerge($context->getRequest()->getParameterHolder()->getAll(), $context->getRequest()->getFiles());
foreach ($validators as $field => $fieldValidators) {
$tmp_field = $field;
if ($fileTypes[$field] == 'combo') {
$tmp_field = substr($field, 0, -1) . "_value]";
}
foreach ($fieldValidators as $class => $args) {
$params = ArrayUtil::get($args, 'params', array());
$validator = afValidatorFactory::createValidator($class, $params);
$value = afValidatorFactory::prepareValue($tmp_field, $validator, $requestParameters);
try {
$validator->clean($value);
} catch (sfValidatorError $e) {
$errors[] = array($tmp_field, $e->getMessage());
}
}
}
if (!empty($errors)) {
self::renderErrors($errors, $errorMessage);
}
if (ArrayUtil::get($formcfg, 'wizard', false)) {
$this->updateWizardState();
}
self::removeIterationNumber($this->context->getRequest()->getParameterHolder());
}
return $filterChain->execute();
}
示例5: getAccessToken
/**
* Example value in $headers: ['Authorization' => 'Bearer TOKEN_GOES_HERE'];
* @param array $headers
* @param string $key
* @param string $tokenType
* @param string $separator
* @return string|null
*/
public static function getAccessToken($headers, $key = 'Authorization', $tokenType = 'Bearer', $separator = ' ')
{
$value = ArrayUtil::get($headers[strtolower($key)]);
if (is_null($value)) {
return null;
}
if (!is_array($value)) {
return null;
}
if (sizeof($value) != 1) {
return null;
}
$tokenString = $value[0];
$tokenArray = explode($tokenType . $separator, $tokenString);
if (sizeof($tokenArray) != 2) {
return null;
}
return $tokenArray[1];
}
示例6: extractValues
private static function extractValues($row, $keys)
{
$values = array();
foreach ($keys as $key) {
$values[] = StringUtil::removeTagsAndEntities(ArrayUtil::get($row, $key, ''));
}
return $values;
}
示例7: get
/**
* Get a specific key from the settings data.
*
* @param string|array $key
* @param mixed $default Optional default value.
*
* @return mixed
*/
public function get($key, $default = null)
{
$this->checkLoaded();
return ArrayUtil::get($this->data, $key, $default);
}
示例8: end
public function end()
{
$this->afExtjs->public['init'] = ArrayUtil::get($this->afExtjs->public, 'init', '');
$this->afExtjs->public['init'] .= "\r\n\t Ext.QuickTips.init();\r\n\t Ext.apply(Ext.QuickTips.getQuickTip(), {\r\n\t\t trackMouse: true\r\n\t\t});\r\n\t\tExt.form.Field.prototype.msgTarget = 'side';\r\n\t\tExt.History.init();\r\n\t\tafApp.urlPrefix = '" . sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . "';\r\n\t afApp.sharpPrefix = '" . $this->sharpPrefix . "';\r\n\t\t";
$this->afExtjs->init();
}
示例9: getProxyAttributes
private static function getProxyAttributes($parse)
{
$start = ArrayUtil::get($parse, 'params', 'proxystart', 0);
$limit = ArrayUtil::get($parse, 'params', 'maxperpage', afDataFacade::DEFAULT_PROXY_LIMIT);
$proxyUrl = UrlUtil::getListjsonUrl(afExtjsWidgets::getWidgetUrl($parse));
$customProxyUrl = ArrayUtil::get($parse, 'proxy', $proxyUrl);
if ($customProxyUrl !== 'parser/listjson') {
$proxyUrl = $customProxyUrl;
}
$proxyUrl = UrlUtil::abs($proxyUrl);
$proxyUrl = self::setupProxyUrl($proxyUrl, $parse);
$args = array('url' => $proxyUrl, 'limit' => $limit, 'start' => $start);
if (isset($parse["stateId"]) && $parse["stateId"] === "true") {
$args['stateId'] = true;
}
return $args;
}
示例10: __construct
public function __construct($containerObject, $attributes = array(), $submitContainerObject = false)
{
$this->afExtjs = afExtjs::getInstance();
$this->afExtjs->setAddons(array('js' => array($this->afExtjs->getPluginsDir() . 'submit/RobustSubmitAction.js')));
$pe = isset($attributes['preExecute']) ? $attributes['preExecute'] : '';
if (isset($attributes['label'])) {
$this->attributes['text'] = $attributes['label'];
unset($attributes['label']);
}
if (isset($attributes['action'])) {
$this->attributes['url'] = $attributes['action'];
$attributes['action'] = UrlUtil::addParam($attributes['action'], '_csrf_token', sfContext::getInstance()->getRequest()->getAttribute('_csrf_token'));
if (!isset($attributes['method'])) {
$attributes['method'] = 'post';
}
$submitContainerObject = $submitContainerObject ? $submitContainerObject : $containerObject;
if (isset($submitContainerObject->attributes['classic']) && $submitContainerObject->attributes['classic']) {
$source = 'Ext.getCmp("' . $submitContainerObject->attributes['id'] . '").submit(' . $this->afExtjs->asAnonymousClass(array('url' => $attributes['action'], 'method' => $attributes['method'])) . ');';
if (isset($attributes['preExecute']) && $attributes['preExecute']) {
$pe_file = isset($attributes['preExecute']) ? $attributes['preExecute'] : '';
$source = $this->preExecuteSource($pe_file, $source);
}
$this->attributes['handler'] = $this->afExtjs->asMethod(array('parameters' => '', 'source' => $source));
} else {
if (!isset($attributes['params'])) {
$attributes['params'] = array();
}
$submitUrl = $attributes['action'];
if (!StringUtil::startsWith($submitUrl, 'http')) {
$submitUrl = sfContext::getInstance()->getRequest()->getUriPrefix() . sfContext::getInstance()->getRequest()->getRelativeUrlRoot() . $submitUrl;
}
if (method_exists($submitContainerObject, 'getValidators')) {
$attributes['params']['af_formcfg'] = afEditJsonRenderer::buildFormcfg($submitUrl, $submitContainerObject->getValidators(), $submitContainerObject->getFieldTypes(), ArrayUtil::get($attributes, 'wizard', false));
}
unset($attributes['wizard']);
/**
* timeout, sets the submit timeout action in milisecs, default to 300000ms(300s)
*/
if (!isset($attributes['timeout'])) {
$attributes['timeout'] = '300000';
}
$source = 'Ext.getCmp("' . $submitContainerObject->attributes['id'] . '").getForm().doAction("robustsubmit", ' . $this->afExtjs->asAnonymousClass(array('url' => $submitUrl, 'waitMsg' => 'loading...', 'params' => $attributes['params'], 'timeout' => $attributes['timeout'], 'failure' => $this->afExtjs->asMethod(array('parameters' => 'form,action', 'source' => 'var onclose=function(){if(action.result && action.result.redirect){var load=action.result.load || "center";afApp.load(action.result.redirect,load);}}; if(action.result){ if(action.result.message){Ext.Msg.alert("Failure", action.result.message, onclose);}}else{Ext.Msg.alert("Failure", "Some error appeared!", onclose);}')), 'success' => $this->afExtjs->asMethod(array('parameters' => 'form,action', 'source' => '
/**
* Test for popuped window
*/
var _form = Ext.getCmp("' . $submitContainerObject->attributes['id'] . '");
var _win = null;
if(_form){
_win = _form.findParentByType("window");
}
/*************************************************************/
var showInstantNotification = function(){
if(message){
if(showInWindow){
var w = new Ext.Window({
html:message,
title:"Success",
bodyStyle:"padding:10px",
autoScroll:true,
frame:true,
resizable:true,
maximizable:true
}).show();
if(w.getBox().width > 600) w.setWidth(600);
if(w.getBox().height > 400){ w.setHeight(400);w.setWidth(w.getWidth()+20)}
w.center();
}else{
afApp.notify("Success",message);
}
}
if(_win){
if(winProp.hidePopup === false) return;
if(!afApp.hasDesktop()) { // destroy method cousing error on desktop layout
//destroy the popup because content most probably have been changed, see ticket #891 for more info
_win.destroy();
}
_win.close();
return false;
}
}
/*reload load_widgets store*/
var load_widgets=action.result.load_widgets ||action.options.params.load_widgets;
if(load_widgets && load_widgets.length>0)
afApp.reloadGridsData(load_widgets);
/*executeAfter - can execute a js code after submit, the js code comes from json response*/
var executeAfter=action.result.executeAfter || false;
if(executeAfter)eval(executeAfter);
var confirm=action.result.confirm ||action.options.params.confirm;
var ajax=action.result.ajax ||action.options.params.ajax;
var message=action.result.message ||action.options.params.message;
var redirect=action.result.redirect ||action.options.params.redirect;
var target=action.result.target ||action.options.params.target;
var winProp=action.result.winProp ||action.options.params.winProp;
var load=action.result.load || "center";
//.........这里部分代码省略.........