本文整理汇总了PHP中getValueFromArray函数的典型用法代码示例。如果您正苦于以下问题:PHP getValueFromArray函数的具体用法?PHP getValueFromArray怎么用?PHP getValueFromArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getValueFromArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendCallDoneInfo
function sendCallDoneInfo($request)
{
$callduration = getValueFromArray($request, 'callduration');
$status = getValueFromArray($request, 'status');
$data = getValueFromArray($request, 'data');
$message = getValueFromArray($request, 'message');
}
示例2: _isValid
protected function _isValid($value, $params)
{
$result = isValidEmail($value, getValueFromArray($params, Flag::VALIDATE_DOMAIN, false));
if (!$result) {
Factory::log()->warn("O e-mail {$value} não é um e-mail válido");
return false;
}
return true;
}
示例3: getDAO
/**
*
* @param array $params
* @return mixed DAO se a Flag::DAO_NAME for setada ou null caso contrário
*/
public function getDAO($params)
{
$daoname = getValueFromArray($params, Flag::DAO_NAME, "");
if (empty($daoname)) {
Factory::log()->fatal('É necessário informar o nome do DAO... use Flag::DAO_NAME no parameter!');
return null;
}
return Factory::DAO($daoname);
}
示例4: _sanitize
/**
* Para efeitos de sanitização se $params['value'] não for vazio, concatena-o ao final do conteúdo
* @return string
*/
protected function _sanitize($value, $params)
{
$value = parent::_sanitize($value, $params);
$extra = getValueFromArray($params, 'value', '');
if (empty($extra)) {
return $value;
}
return $value . $extra;
}
示例5: getHTMLEditable
public function getHTMLEditable($name, $value, $params, $attr = array())
{
$params = $this->normalizeParams($params);
$attr = $this->getHTMLAttributes($attr, $params);
$enum = $this->getEnum($params);
$options = $enum->labels();
if (!getValueFromArray($params, Flag::REQUIRED, false)) {
array_unshift($options, getValueFromArray($params, Flag::PLACEHOLHER, 'Escolha uma opção'));
}
return HTML::select($name, $options, $value, $attr, $name . '_id');
}
示例6: sendCallDoneInfo
function sendCallDoneInfo($request, $stage)
{
global $apiurl;
global $agentid;
$callduration = getValueFromArray($request, 'callduration');
$status = getValueFromArray($request, 'status');
$recordurl = getValueFromArray($request, 'data');
$message = getValueFromArray($request, 'message');
$data = array("callduration" => $callduration, "status" => $status, "recordurl" => $data, "message" => $message, "stage" => $stage, "agent" => $agentid, "type" => "nextcall");
curlPost($apiurl . '/api/agent.php', $data);
}
示例7: getHTMLEditable
public function getHTMLEditable($name, $value, $params, $attr = array())
{
$params = $this->normalizeParams($params);
if (empty($value)) {
$attr['value'] = getValueFromArray($params, Flag::DEFAULT_VALUE, '');
} else {
$attr['value'] = $value;
}
$attr = $this->getHTMLAttributes($attr, $params);
return HTML::input($name, $attr, $name . '_id', $this->getHTMLInputType());
}
示例8: getHTMLEditable
public function getHTMLEditable($name, $value, $params, $attr = array())
{
$params = $this->normalizeParams($params);
if (!$this->_isValid($value)) {
$value = getValueFromArray($params, Flag::DEFAULT_VALUE);
}
$attr = $this->getHTMLAttributes($attr, $params);
$options = array('true' => getValueFromArray($params, Flag::TRUE_LABEL, 'Verdadeiro'), 'false' => getValueFromArray($params, Flag::FALSE_LABEL, 'Falso'));
if (!getValueFromArray($params, Flag::REQUIRED, false)) {
array_unshift($options, '');
}
return HTML::select($name, $options, var_export($value, true), $attr, $name . '_id');
}
示例9: testGetValueFromArray
public function testGetValueFromArray()
{
$vetor = array('a' => 1, 'b' => '2', 'c' => true, 'd' => false);
foreach ($vetor as $k => $v) {
$this->assertEquals($v, getValueFromArray($vetor, $k));
$this->assertEquals($v, getValueFromArray($vetor, $k, 'xyz'));
}
$this->assertNull(getValueFromArray($vetor, 'xyz'));
$this->assertEquals('default value', getValueFromArray($vetor, 'xyz', 'default value'));
$this->assertEquals(true, getValueFromArray($vetor, 'xyz', true));
$this->assertEquals(false, getValueFromArray($vetor, 'xyz', false));
$this->assertEquals('', getValueFromArray($vetor, 'xyz', ''));
}
示例10: chosen
/**
*
* nao usar por enquanto, falta definir a forma de receber os dados
* na submissão
*/
protected function chosen($name, $value, $params, $attr)
{
MemoryPage::addCss("static/bstemplates/plugins/chosen/chosen.min.css");
MemoryPage::addJs("static/bstemplates/plugins/chosen/chosen.jquery.min.js");
$params = $this->normalizeParams($params);
$dao = $this->getDAO($params);
$dao_label = getValueFromArray($params, Flag::DAO_LABEL, Flag::DAO_LABEL);
$dao_value = getValueFromArray($params, Flag::DAO_VALUE, Flag::DAO_VALUE);
$dados = $dao->listAll();
//$attr["value"] = $value;
//$attr = $this->getHTMLAttributes($attr, $params);
$template = PATH_APP . '/view/bstemplates/multiselect.mustache';
$vetor["multiselect"] = ["placeholder" => getValueFromArray($params, Flag::PLACEHOLHER, "Escolha uma opção"), 'options' => $dados];
return Template::singleton()->renderHTML(file_get_contents($template), $vetor);
}
示例11: getHTMLEditable
public function getHTMLEditable($name, $value, $params, $attr = array())
{
$params = $this->normalizeParams($params);
$attr = $this->getHTMLAttributes($attr, $params);
if (empty($value)) {
$value = getValueFromArray($params, Flag::DEFAULT_VALUE, '');
}
$maxlenght = getValueFromArray($params, Flag::MAXLENGHT, false);
if ($maxlenght) {
MemoryPage::addJs("static/js/bootstrap-maxlength.js");
MemoryPage::addJs("static/js/autosize.v3.js");
$extra = ["maxlength" => $maxlenght, "data-limite-caracteres" => $maxlenght];
$attr = array_merge($attr, $extra);
}
return HTML::textarea($name, $attr, $name . '_id', $value);
}
示例12: getHTMLEditable
public function getHTMLEditable($name, $value, $params, $attr = array())
{
$params = $this->normalizeParams($params);
if (!$this->_isValid($value)) {
$value = getValueFromArray($params, Flag::DEFAULT_VALUE);
}
$attr = $this->getHTMLAttributes($attr, $params);
if (is_bool($value) and $value) {
$attr["checked"] = "checked";
}
$element = "<div class='checkbox'>";
$element .= "<label for='{$name}_id' >";
$element .= HTML::input($name, $attr, $name . '_id', 'checkbox');
$element .= getValueFromArray($params, Flag::LABEL) . "</label></div>";
return $element;
}
示例13: getHTMLEditable
/**
* Retorna o html para renderizar o elemento na página
*
* @param string $name O nome do componente
* @param string $value O caminho da imagem
* @param array $params Parâmetros utilizados com as Flag::CONSTANTES
* @param array $attr Atributos html para o elemento
* @return string Retorna o html para o elemento
*/
public function getHTMLEditable($name, $value, $params, $attr = array())
{
MemoryPage::addCss('static/css/page/filemanager.css');
MemoryPage::addJs("js/modal-fileupload.js");
MemoryPage::addJs("static/plugin/bootstrap-fileinput-master/js/fileinput.min.js");
MemoryPage::addCss('static/plugin/bootstrap-fileinput-master/css/fileinput.min.css');
$params = $this->normalizeParams($params);
$link = 'filemanager/index?path=' . getValueFromArray($params, Flag::MOVE_TO, 'image/') . '&header=false';
$linkextra = ['data-toggle' => 'modal', 'data-target' => '#myFileUpload', 'data-up-action' => 'fileupload', 'data-hiddenid' => $name . '_id', 'data-imgid' => $name . '_img_id', 'class' => 'filemanager-action-link'];
$linkextra = array_merge($linkextra, $attr);
$imgattr = ['class' => 'imgfile img-responsive', 'id' => $name . '_img_id'];
$hasOrdenator = getValueFromArray($params, Flag::FILEIMAGE_HAS_ORDENATOR, false);
$placeholder = '<small>' . getValueFromArray($params, Flag::PLACEHOLHER, '') . '</small>';
if (empty($value)) {
$helpText = getValueFromArray($params, Flag::FILEIMAGE_HELP_TEXT, false);
if (!$helpText) {
$helpText = 'Adicionar imagem';
}
$noimg = "";
$showImgComponent = getValueFromArray($params, Flag::FILEIMAGE_SHOW_IMGCOMPONENT, true);
if ($showImgComponent) {
$noimg = HTML::img('image/icons/img-icon.png', 'Nenhuma imagem selecionada', $imgattr);
$img = $noimg . HTML::link($link, $helpText, 'Adicionar imagem', $linkextra);
} else {
$img = HTML::link($link, $noimg . $helpText, 'Adicionar imagem', $linkextra);
}
if ($hasOrdenator) {
$ordem = $linkextra["data-ordem"];
$paginaformandoid = isset($linkextra["data-pagina_id"]) ? $linkextra["data-pagina_id"] : '';
$img .= "<div class='fileimage-ordem' title='ordem da imagem nesta página personalizada'>{$ordem}</div>";
$img .= "<div class='glyphicon glyphicon-trash unselect' \n data-ordem='" . $ordem . "' data-paginaformando_id=' " . $paginaformandoid . " ' style='display:none;'\n title='clique aqui para remover esta imagem!'></div>";
}
} else {
$img = HTML::img($value, 'Imagem selecionada', $imgattr);
$img .= HTML::link($link, 'Alterar imagem', 'Trocar a imagem', $linkextra);
if ($hasOrdenator) {
$ordem = $linkextra["data-ordem"];
$paginaformandoid = isset($linkextra["data-pagina_id"]) ? $linkextra["data-pagina_id"] : '';
$img .= "<div class='fileimage-ordem' title='ordem da imagem nesta página personalizada'>{$ordem}</div>";
$img .= "<div class='glyphicon glyphicon-trash unselect' \n data-ordem='" . $ordem . "' data-paginaformando_id=' " . $paginaformandoid . " ' \n title='clique aqui para remover esta imagem!'></div>";
}
}
return $placeholder . $img . HTML::input($name, array('value' => $value), $name . '_id', 'hidden');
}
示例14: __construct
/**
* Criar um Expression
* @param array $parts Contém um array com as seguintes chaves
* where => wherearray ou um objeto Where para condição da consulta
* orderBy => Array no formado order by
* limit => Limite
* offset => Início
* groupBy => Lista de campos para agrupamento
* having => wherearray ou um objeto Where para condição do agrupamento
*/
public function __construct(array $parts = array())
{
$this->setWhere(getValueFromArray($parts, 'where', array()));
$orderBy = getValueFromArray($parts, 'orderBy', array());
if (!is_array($orderBy)) {
$orderBy = array($orderBy);
}
foreach ($orderBy as $k => $v) {
if (is_numeric($k)) {
$this->addOrderBy($v);
} else {
$this->addOrderBy($k, $v);
}
}
$this->setGroupBy(getValueFromArray($parts, 'groupBy', array()));
$this->limit = getValueFromArray($parts, 'limit');
$this->offset = getValueFromArray($parts, 'offset');
$this->setHaving(getValueFromArray($parts, 'having', array()));
}
示例15: getFromDB
function getFromDB($dataSourceName)
{
global $globalDataSource, $globalOptions, $globalDBSpecs, $globalDebug;
$filePath = $this->dbSettings->getCriteriaValue('target');
if (substr_count($filePath, '../') > 2) {
$this->logger->setErrorMessage("You can't access files in inhibit area: {$dataSourceName}.");
return null;
}
$fileContent = file_get_contents($filePath);
if ($fileContent === false) {
$this->logger->setErrorMessage("The 'target' parameter doesn't point the valid file path in context: {$dataSourceName}.");
return null;
}
eval(str_replace("<?php", "", str_replace("?>", "", str_replace("IM_Entry", "IM_Dummy_Entry", $fileContent))));
$result = array();
$seq = 0;
switch ($dataSourceName) {
case 'contexts':
foreach ($globalDataSource as $context) {
$result[] = array('id' => $seq, 'name' => getValueFromArray($context, 'name'), 'table' => getValueFromArray($context, 'table'), 'view' => getValueFromArray($context, 'view'), 'records' => getValueFromArray($context, 'records'), 'paging' => getValueFromArray($context, 'paging'), 'key' => getValueFromArray($context, 'key'), 'sequence' => getValueFromArray($context, 'sequence'), 'extending-class' => getValueFromArray($context, 'extending-class'), 'protect-writing' => getValueFromArray($context, 'protect-writing'), 'protect-reading' => getValueFromArray($context, 'protect-reading'), 'db-class' => getValueFromArray($context, 'db-class'), 'dsn' => getValueFromArray($context, 'dsn'), 'option' => getValueFromArray($context, 'option'), 'database' => getValueFromArray($context, 'database'), 'user' => getValueFromArray($context, 'user'), 'password' => getValueFromArray($context, 'password'), 'server' => getValueFromArray($context, 'server'), 'port' => getValueFromArray($context, 'port'), 'protocol' => getValueFromArray($context, 'protocol'), 'datatype' => getValueFromArray($context, 'datatype'), 'cache' => getValueFromArray($context, 'cache'), 'post-reconstruct' => getValueFromArray($context, 'post-reconstruct'), 'post-dismiss-message' => getValueFromArray($context, 'post-dismiss-message'), 'post-move-url' => getValueFromArray($context, 'post-move-url'), 'repeat-control' => getValueFromArray($context, 'repeat-control'), 'post-repeater' => getValueFromArray($context, 'post-repeater'), 'post-enclosure' => getValueFromArray($context, 'post-enclosure'), 'authentication-media-handling' => getValueFromArray($context, 'authentication', 'media-handling'), 'authentication-all-user' => getValueFromArray($context, 'authentication', 'all', 'user'), 'authentication-all-group' => getValueFromArray($context, 'authentication', 'all', 'group'), 'authentication-all-target' => getValueFromArray($context, 'authentication', 'all', 'target'), 'authentication-all-field' => getValueFromArray($context, 'authentication', 'all', 'field'), 'authentication-load-user' => getValueFromArray($context, 'authentication', 'load', 'user'), 'authentication-load-group' => getValueFromArray($context, 'authentication', 'load', 'group'), 'authentication-load-target' => getValueFromArray($context, 'authentication', 'load', 'target'), 'authentication-load-field' => getValueFromArray($context, 'authentication', 'load', 'field'), 'authentication-update-user' => getValueFromArray($context, 'authentication', 'update', 'user'), 'authentication-update-group' => getValueFromArray($context, 'authentication', 'update', 'group'), 'authentication-update-target' => getValueFromArray($context, 'authentication', 'update', 'target'), 'authentication-update-field' => getValueFromArray($context, 'authentication', 'update', 'field'), 'authentication-new-user' => getValueFromArray($context, 'authentication', 'new', 'user'), 'authentication-new-group' => getValueFromArray($context, 'authentication', 'new', 'group'), 'authentication-new-target' => getValueFromArray($context, 'authentication', 'new', 'target'), 'authentication-new-field' => getValueFromArray($context, 'authentication', 'new', 'field'), 'authentication-delete-user' => getValueFromArray($context, 'authentication', 'delete', 'user'), 'authentication-delete-group' => getValueFromArray($context, 'authentication', 'delete', 'group'), 'authentication-delete-target' => getValueFromArray($context, 'authentication', 'delete', 'target'), 'authentication-delete-field' => getValueFromArray($context, 'authentication', 'delete', 'field'));
$seq++;
}
break;
case 'relation':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['relation'])) {
foreach ($globalDataSource[$contextID]['relation'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'foreign-key' => getValueFromArray($rel, 'foreign-key'), 'join-field' => getValueFromArray($rel, 'join-field'), 'operator' => getValueFromArray($rel, 'operator'));
$seq++;
}
}
break;
case 'query':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['query'])) {
foreach ($globalDataSource[$contextID]['query'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'), 'operator' => getValueFromArray($rel, 'operator'));
$seq++;
}
}
break;
case 'sort':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['sort'])) {
foreach ($globalDataSource[$contextID]['sort'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'direction' => getValueFromArray($rel, 'direction'));
$seq++;
}
}
break;
case 'default-values':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['default-values'])) {
foreach ($globalDataSource[$contextID]['default-values'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'));
$seq++;
}
}
break;
case 'validation':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['validation'])) {
foreach ($globalDataSource[$contextID]['validation'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'rule' => getValueFromArray($rel, 'rule'), 'message' => getValueFromArray($rel, 'message'));
$seq++;
}
}
break;
case 'script':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['script'])) {
foreach ($globalDataSource[$contextID]['script'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'db-operation' => getValueFromArray($rel, 'db-operation'), 'situation' => getValueFromArray($rel, 'situation'), 'definition' => getValueFromArray($rel, 'definition'));
$seq++;
}
}
break;
case 'global':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['global'])) {
foreach ($globalDataSource[$contextID]['global'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'db-operation' => getValueFromArray($rel, 'db-operation'), 'field' => getValueFromArray($rel, 'field'), 'value' => getValueFromArray($rel, 'value'));
$seq++;
}
}
break;
case 'file-upload':
$contextID = $this->dbSettings->getForeignKeysValue('id');
if (isset($globalDataSource[$contextID]['file-upload'])) {
foreach ($globalDataSource[$contextID]['file-upload'] as $rel) {
$result[] = array('id' => $seq + $contextID * 10000, 'field' => getValueFromArray($rel, 'field'), 'context' => getValueFromArray($rel, 'context'));
$seq++;
}
}
break;
case 'options':
$result[] = array('id' => $seq, 'separator' => getValueFromArray($globalOptions, 'separator'), 'transaction' => getValueFromArray($globalOptions, 'transaction'), 'media-root-dir' => getValueFromArray($globalOptions, 'media-root-dir'), 'media-context' => getValueFromArray($globalOptions, 'media-context'), 'authentication-user-table' => getValueFromArray($globalOptions, 'authentication', 'user-table'), 'authentication-group-table' => getValueFromArray($globalOptions, 'authentication', 'group-table'), 'authentication-corresponding-table' => getValueFromArray($globalOptions, 'authentication', 'corresponding-table'), 'authentication-challenge-table' => getValueFromArray($globalOptions, 'authentication', 'challenge-table'), 'authentication-authexpired' => getValueFromArray($globalOptions, 'authentication', 'authexpired'), 'authentication-realm' => getValueFromArray($globalOptions, 'authentication', 'realm'), 'authentication-email-as-username' => getValueFromArray($globalOptions, 'authentication', 'email-as-username'));
$seq++;
break;
case 'aliases':
//.........这里部分代码省略.........