本文整理汇总了PHP中F::Dot方法的典型用法代码示例。如果您正苦于以下问题:PHP F::Dot方法的具体用法?PHP F::Dot怎么用?PHP F::Dot使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::Dot方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
$Call['Data'] = $Call['Current'];
} else {
if (isset($Call['Data'])) {
} else {
$Call['Data'] = [];
}
foreach ($Call['Nodes'] as $Name => $Node) {
$UpdatedValue = F::Dot($Call['Updates'], $Name);
if (null === $UpdatedValue) {
if (isset($Node['Nullable']) && $Node['Nullable']) {
$Call['Data'] = F::Dot($Call['Data'], $Name, null);
} else {
$Call['Data'] = F::Dot($Call['Data'], $Name, F::Dot($Call['Current'], $Name));
}
} else {
$Call['Data'] = F::Dot($Call['Data'], $Name, F::Dot($Call['Updates'], $Name));
}
}
}
$Call['Data']['EV'] = $Call['EV'];
$Call = F::Hook('beforeEntityUpdate', $Call);
$Call = F::Hook('beforeEntityCreateOrUpdate', $Call);
$Call = F::Hook('beforeEntityWrite', $Call);
/*
TODO: необходимо щепитильно проверить обновлялку
*/
if (isset($Call['Failure']) and $Call['Failure']) {
F::Log('Update Skipped due Failure Flag', LOG_WARNING, 'Administrator');
$Call['Data'] = null;
} else {
if (isset($Call['Dry'])) {
示例2: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Log', function ($Call) {
if (preg_match_all('@\\$([\\.\\w]+)@', $Call['Message'], $Vars)) {
foreach ($Vars[0] as $IX => $Key) {
$Call['Message'] = str_replace($Key, F::Dot($Call, $Vars[1][$IX]), $Call['Message']);
}
}
F::Log($Call['Message'], $Call['Type']);
return $Call;
});
示例3: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('beforeIOWrite', function ($Call) {
if (F::Dot($Call, 'Storages.' . $Call['Storage'] . '.Journal') == true) {
F::Log([F::Dot($Call, 'Storage'), F::Dot($Call, 'Where'), F::Dot($Call, 'Data'), F::Dot($Call, 'Reason')], LOG_WARNING, 'Administrator');
}
return $Call;
});
示例4: http_build_query
}
}
if (!isset($Call['Call']['locale'])) {
$Call['Call']['locale'] = $Call['Facebook']['Default Locale'];
}
if (isset($Call['Call'])) {
$Query = '?' . http_build_query($Call['Call']);
} else {
$Query = '';
}
$URL = $Call['Facebook']['Entry Point'] . $Call['Method'] . $Query;
$Result = F::Run($Call['Backend']['Service'], $Call['Backend']['Method'], $Call['Backend']['Options'], ['Where' => $URL]);
$Result = array_pop($Result);
if (isset($Call['Return Key'])) {
if (F::Dot($Result, $Call['Return Key'])) {
$Result = F::Dot($Result, $Call['Return Key']);
} else {
$Result = null;
}
}
return $Result;
});
setFn('Access Token', function ($Call) {
$Result = null;
if (isset($Call['Data']['Facebook']['Auth'])) {
F::Log('Using FB Token from Data', LOG_INFO);
$Result['Auth'] = $Call['Data']['Facebook']['Auth'];
} elseif (isset($Call['Session']['User']['Facebook']['Auth'])) {
F::Log('Using FB Token from Session', LOG_INFO);
$Result['Auth'] = $Call['Session']['User']['Facebook']['Auth'];
} else {
示例5: setFn
setFn('Do', function ($Call) {
$Call = F::Apply('Entity', 'Load', $Call);
$Call = F::Hook('beforeTouch', $Call);
$Old = F::Run('Entity', 'Read', $Call, ['One' => false]);
if (empty($Old)) {
} else {
foreach ($Old as $IX => $Object) {
$New = F::Run('Entity', 'Update', $Call, ['Entity' => $Call['Entity'], 'Data' => $Object, 'Where' => $Object['ID'], 'One' => false]);
if (isset($Object['ID'])) {
$Table = [['ID', $Object['ID']]];
} else {
$Table = [];
}
foreach ($Call['Nodes'] as $Name => $Node) {
$NewValue = F::Dot($New, $Name);
$OldValue = F::Dot($Old[$IX], $Name);
if ($OldValue == $NewValue || $Name == 'ID') {
} else {
$Table[] = ['<l>' . $Call['Entity'] . '.Entity:' . $Name . '</l>', $OldValue, $NewValue];
}
}
$Call['Output']['Content'][] = ['Type' => 'Table', 'Value' => $Table];
}
$Call['Output']['Content'][] = ['Type' => 'Block', 'Class' => 'alert alert-success', 'Value' => count($New) . ' object touched'];
}
$Call = F::Hook('afterTouch', $Call);
return $Call;
});
setFn('All', function ($Call) {
$Call = F::Apply('Entity', 'Load', $Call);
$Total = F::Run('Entity', 'Count', $Call);
示例6: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Process', function ($Call) {
if ($Call['Locale'] !== $Call['Default']['Locale']) {
if (F::Dot($Call, 'LocalizedURLs.Enabled') && preg_match_all('@a href="(/.*)"@SsUu', $Call['Output'], $Links)) {
$Pair = [];
foreach ($Links[1] as $IX => $Link) {
$Localize = true;
if (in_array($Link, F::Dot($Call, 'LocalizedURLs.Excluded'))) {
$Localize = false;
}
foreach ($Call['Locales']['Available'] as $Locale) {
if (preg_match('@^/' . $Locale . '/@Ssu', $Link)) {
$Localize = false;
}
}
if ($Link == '/') {
$Localize = false;
}
if ($Localize) {
$Pair['href="' . $Link] = 'href="/' . $Call['Locale'] . $Link;
}
}
$Call['Output'] = strtr($Call['Output'], $Pair);
}
示例7: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Run', function ($Call) {
if (isset($Call['Hooks'])) {
if ($Hooks = F::Dot($Call, 'Hooks.' . $Call['On'])) {
foreach ($Hooks as $Name => $Hook) {
$Call = F::Apply($Hook['Service'], $Hook['Method'], $Call, isset($Hook['Call']) ? $Hook['Call'] : array());
}
}
}
return $Call;
});
示例8: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description Default value support
* @package Codeine
* @version 8.x
*/
setFn('Process', function ($Call) {
if (isset($Call['Data'])) {
foreach ($Call['Nodes'] as $Name => $Node) {
foreach ($Call['Data'] as &$Data) {
if (empty(F::Dot($Data, $Name))) {
$Data = F::Dot($Data, $Name, null);
}
}
}
}
return $Call;
});
示例9: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description HTML Textfield Driver
* @package Codeine
* @version 8.x
*/
setFn('Make', function ($Call) {
if (is_array($Call['Value'])) {
$Call['Value'] = implode(F::Dot($Call, 'Textarea.Delimiter'), $Call['Value']);
}
$Call = F::Apply('View.HTML.Widget.Base', 'Make', $Call, ['Tag' => 'textarea']);
return $Call;
});
示例10: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
*/
setFn('Get', function ($Call) {
$Total = 0;
$Filled = 0;
$Data = $Call['Data'];
foreach ($Call['Nodes'] as $Name => $Node) {
if (isset($Node['Widgets']['Write'])) {
$Total++;
$Value = F::Dot($Data, $Name);
if ($Value !== null) {
$Filled++;
}
}
}
return round($Filled / $Total * 100);
});
示例11: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Generate', function ($Call) {
$Call['Value'] = '';
if (is_array($Call['Key'])) {
foreach ($Call['Key'] as $cKey) {
if (F::Dot($Call['Data'], $cKey) != null) {
$Call['Data'][$cKey] = trim(F::Dot($Call['Data'], $cKey));
if (!empty($Call['Data'][$cKey])) {
$Call['Value'][] = F::Dot($Call['Data'], $cKey);
}
}
}
if (!empty($Call['Value'])) {
$Call['Value'] = implode($Call['Delimiter'], $Call['Value']);
}
} else {
if (isset($Call['Data'][$Call['Key']])) {
$Call['Value'] = trim($Call['Data'][$Call['Key']]);
}
}
if (empty($Call['Value'])) {
return null;
}
$Call['Value'] = mb_strtolower($Call['Value']);
示例12: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Get', function ($Call) {
$Index = [];
foreach ($Call['Nodes'] as $Name => $Node) {
if (isset($Node['Index']) && $Node['Index']) {
if (preg_match_all('/(\\w+)/Ssu', F::Dot($Call['Data'], $Name), $Pockets)) {
foreach ($Pockets[1] as $Pocket) {
$Index[] = mb_strtolower(strip_tags($Pocket));
}
}
}
}
return array_unique($Index);
// TODO Relevancy
});
示例13: time
$Call['User'] = F::Run('Entity', 'Read', $Call, ['Entity' => 'User', 'One' => true, 'Sort' => ['ID' => true], 'Where' => ['Facebook.ID' => $Facebook['id']]]);
}
if (empty($Call['User'])) {
$Call['User'] = F::Run('Entity', 'Create', $Call, ['Entity' => 'User', 'One' => true, 'Data' => ['Facebook' => ['Active' => true, 'ID' => $Facebook['id'], 'Auth' => $Result['access_token'], 'Expire' => time() + $Result['expires']], 'Status' => 1]]);
}
$Call = F::Hook('afterFacebookIdentification', $Call);
$Updated = $Call['User'];
$Updated['Facebook'] = ['Active' => true, 'ID' => $Facebook['id'], 'Auth' => $Result['access_token'], 'Expire' => time() + $Result['expires'], 'Logged' => time()];
if (isset($Call['User']['Facebook']['LoginCount'])) {
$Call['User']['Facebook']['LoginCount']++;
} else {
$Call['User']['Facebook']['LoginCount'] = 1;
}
$Updated['Facebook']['LoginCount'] = $Call['User']['Facebook']['LoginCount'];
if ($Updated['Facebook']['LoginCount'] == 1) {
$Call = F::Hook('Facebook.FirstLogin', $Call);
}
foreach ($Call['Facebook']['Mapping'] as $FacebookField => $CodeineField) {
if (isset($Facebook[$FacebookField]) && !empty($Facebook[$FacebookField])) {
$Updated = F::Dot($Updated, $CodeineField, $Facebook[$FacebookField]);
}
}
F::Run('Entity', 'Update', ['Entity' => 'User', 'Where' => $Call['User']['ID'], 'Data' => $Updated]);
}
$Call = F::Hook('afterFacebookAuthenticate', $Call);
return $Call;
});
setFn('Annulate', function ($Call) {
F::Run('Entity', 'Update', ['Entity' => 'User', 'Where' => $Call['Session']['User']['ID'], 'Data' => ['Facebook' => ['ID' => null]]]);
return $Call;
});
示例14: foreach
if (isset($Test) && isset($Test['Suites'])) {
F::Log('Test *' . $Call['Test']['Name'] . '* loaded', LOG_INFO);
foreach ($Test['Suites'] as $SuiteName => $Suite) {
foreach ($Suite as $CaseName => $Call['Case']) {
$Call['Case']['Result']['Actual'] = F::Live($Call['Case']['Run'], $Call);
if (isset($Call['Case']['Output']['Content'])) {
$Call['Case']['Result']['Actual'] = print_r($Call['Return']['Output']['Content'], true);
}
foreach ($Call['Case']['Assert'] as $Assert => $Call['Checker']) {
$TestTime = microtime(true);
// FIXME
$Call['Decision'] = F::Run('Test.Assert.' . $Assert, 'Do', $Call);
$TestTime = microtime(true) - $TestTime;
}
if (isset($Call['Case']['Result Key'])) {
$Call['Case']['Result']['Actual'] = F::Dot($Call['Case']['Result']['Actual'], $Call['Case']['Result Key']);
}
$Call['Test']['Report'][$Call['Test']['Name'] . $SuiteName . $CaseName] = [$Call['Test']['Name'], $SuiteName, $CaseName, '<pre>' . j($Call['Case']['Result']['Actual']) . '</pre>', round($TestTime, 5) * 1000, '_Class' => $Call['Decision'] ? 'success' : 'danger'];
$Call['Decision'] ? F::Log('Test case ' . $CaseName . ' passed', LOG_INFO) : F::Log('Test case ' . $CaseName . ' failed', LOG_ERR);
}
}
} else {
$Call = F::Hook('onTestNotFound', $Call);
}
return $Call;
});
setFn('Do', function ($Call) {
$Paths = F::getPaths();
$Options = [];
if (isset($Call['Test']['Name'])) {
F::Log('Test *' . $Call['Test']['Name'] . '* selected', LOG_INFO);
示例15: foreach
foreach ($Call['Parsed'][1] as $IX => $Match) {
if (mb_strpos($Match, ':') !== false) {
list($Options, $Key) = explode(':', $Match);
$Call = F::Dot($Call, $Options, F::loadOptions($Options));
$Match = $Options . '.' . $Key;
}
if (mb_strpos($Match, ',') !== false) {
$Submatches = explode(',', $Match);
foreach ($Submatches as $Submatch) {
if (($Matched = F::Dot($Call, $Submatch)) !== null) {
$Match = $Submatch;
break;
}
}
}
if (($Matched = F::Dot($Call, $Match)) !== null) {
if (is_array($Matched)) {
$Matched = j($Matched);
}
if ($Matched === false || $Matched === 0) {
$Matched = '0';
}
$Call['Parsed'][1][$IX] = $Matched;
F::Log('Call to *' . $Match . '* resolved as ' . $Call['Parsed'][1][$IX], LOG_DEBUG);
} else {
F::Log('Call to *' . $Match . '* cannot resolved', $Call['Verbosity']['Calltag']['Unresolved']);
if (isset($Call['Remove empty'])) {
$Call['Parsed'][1][$IX] = '';
} else {
unset($Call['Parsed'][0][$IX], $Call['Parsed'][1][$IX]);
}