本文整理汇总了PHP中F::Merge方法的典型用法代码示例。如果您正苦于以下问题:PHP F::Merge方法的具体用法?PHP F::Merge怎么用?PHP F::Merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::Merge方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
}
}
}
}
$Call = F::Apply('Entity.Form', 'Generate', $Call, ['IX' => 0, 'Data!' => $Call['Data']]);
// Вывести
$Call = F::Hook('afterCreateGet', $Call);
$Call['Output']['Content']['Form Widget']['Action'] = isset($Call['Action']) ? $Call['Action'] : '';
return $Call;
});
setFn('POST', function ($Call) {
$Call = F::Hook('beforeCreatePost', $Call);
// Берём данные из запроса
if (isset($Call['Request']['Data'])) {
if (isset($Call['Data'])) {
$Call['Data'] = F::Merge($Call['Request']['Data'], $Call['Data']);
} else {
$Call['Data'] = $Call['Request']['Data'];
}
}
// Отправляем в Entity.Create
$Result = F::Run('Entity', 'Create', $Call);
if (!isset($Result['Errors']) or empty($Result['Errors'])) {
$Call['Data'] = $Result;
$Call = F::Hook('afterCreatePost', $Call);
} else {
foreach ($Result['Errors'] as $Name => $Node) {
foreach ($Node as $Error) {
$Call['Output']['Message'][] = ['Type' => 'Block', 'Class' => 'alert alert-danger', 'Value' => '<l>' . $Call['Entity'] . '.Error:' . $Name . '.' . $Error . '</l>'];
}
}
示例2: foreach
// Обходим рой
F::Log('Traversing swarm', LOG_INFO);
F::Log($Call['Honey'], LOG_INFO);
foreach ($Call['Honey'] as $Honey) {
// В рое есть и мы
if ($Honey == $Call['HTTP']['Host']) {
continue;
}
// Если мы стучим в того, кто стучал к нам, будет плохо
if (isset($Call['Request']['Honey']) && $Call['Request']['Honey'] == $Honey) {
continue;
}
F::Log('Traversing ' . $Honey, LOG_INFO);
$Response = F::Run('IO', 'Read', ['Storage' => 'Web', 'Where' => ['ID' => $Call['HTTP']['Proto'] . $Honey . '/swarm']]);
F::Log($Response, LOG_INFO);
if (empty($Response)) {
} else {
foreach ($Response as $cResponse) {
$Call['Honey'] = F::Merge($Call['Honey'], jd($cResponse, true)['Honey']);
}
}
}
// Если нам принесли медок
if (isset($Call['Request']['Honey']) && !isset($Call['Honey'][sha1($Call['Request']['Honey'])])) {
$Call['Honey'][sha1($Call['Request']['Honey'])] = $Call['Request']['Honey'];
// Медок в горшок!
F::Run('IO', 'Write', ['Storage' => 'Swarm', 'Scope' => $Call['HTTP']['Host'], 'Where' => ['ID' => $Call['Swarm']['ID']], 'Data' => $Call['Honey']]);
}
$Call['Output']['Content']['Honey'] = $Call['Honey'];
return $Call;
});
示例3: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
$Message['Scope'] = $Call['To'];
// FIXME
$Message['ID'] = $Call['Subject'];
$Message['Data'] = F::Run('View', 'Load', $Call, ['Scope' => $Call['Entity'], 'ID' => 'Show/EMail']);
$Message['Headers'] = array('Content-type:' => ' text/html; charset="utf-8"');
F::Run('Code.Run.Delayed', 'Run', ['Run' => F::Merge($Call['Sender'], ['Call' => $Message])]);
return $Call;
});
示例4: explode
$Widget['Entity'] = $Call['Entity'];
$Widget['Label'] = $Call['Entity'] . '.Entity:' . $Name;
$Widget['Node'] = $Name;
$Widget['Name'] = 'Filter';
if (strpos($Name, '.') !== false) {
$Slices = explode('.', $Name);
foreach ($Slices as $Slice) {
$Widget['Name'] .= '[' . $Slice . ']';
}
} else {
$Widget['Name'] .= '[' . $Name . ']';
}
$Widget['Key'] = $Name;
$Widget['ID'] = strtr($Name, '.', '_');
$Widget['Context'] = $Call['Context'];
$Widget = F::Merge($Node, $Widget);
if (isset($Call['Data'])) {
$Widget['Data'] = $Call['Data'];
}
if (isset($Widget['Options'])) {
$Widget['Options'] = F::Live($Widget['Options'], $Call);
} else {
$Widget['Options'] = [];
}
/* if($ic == 0)
$Widget['Autofocus'] = true;*/
// Если есть значение, добавляем
if (isset($Call['Data'])) {
if (($Widget['Value'] = F::Dot($Call['Data'], $Name)) === null) {
if (isset($Node['Default'])) {
$Widget['Value'] = F::Live($Node['Default']);
示例5: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Make', function ($Call) {
$Call['Radios'] = '';
foreach ($Call['Options'] as $Key => $Value) {
if (isset($Call['Localized']) && $Call['Localized']) {
if (!isset($Call['Values Locale'])) {
$Call['Values Locale'] = $Call['Entity'] . '.Entity:' . $Call['Key'];
}
$lValue = '<l>' . $Call['Values Locale'] . '.' . $Value . '</l>';
} else {
$lValue = $Value;
}
if (isset($Call['Keys as values']) && $Call['Keys as values']) {
$lValue = $Value;
$Value = $Key;
}
$Call['Radios'] .= F::Run('View', 'Load', ['Scope' => $Call['View']['HTML']['Widget Set'] . '/Widgets', 'ID' => 'Form/Radio', 'Data' => F::Merge($Call, ['Label' => $lValue, 'Value' => $Value, 'Checked' => $Value == $Call['Value'] ? 'checked' : ''])]);
}
return $Call;
});
示例6: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Title', function ($Call) {
if (preg_match_all('@<subtitle>(.*)<\\/subtitle>@SsUu', $Call['Output'], $Pockets)) {
$Call['View']['HTML']['Title'] = F::Merge($Call['View']['HTML']['Title'], $Pockets[1]);
$Call['Output'] = str_replace($Pockets[0], '', $Call['Output']);
}
return $Call;
});
setFn('Keywords', function ($Call) {
if (preg_match_all('@<keyword>(.*)<\\/keyword>@SsUu', $Call['Output'], $Pockets)) {
$Call['View']['HTML']['Keywords'] = F::Merge($Call['View']['HTML']['Keywords'], $Pockets[1]);
$Call['Output'] = str_replace($Pockets[0], '', $Call['Output']);
}
return $Call;
});
setFn('Description', function ($Call) {
if (preg_match_all('@<description>(.*)<\\/description>@SsUu', $Call['Output'], $Pockets)) {
$Call['View']['HTML']['Description'] = F::Merge($Call['View']['HTML']['Description'], $Pockets[1]);
$Call['Output'] = str_replace($Pockets[0], '', $Call['Output']);
}
return $Call;
});
示例7: setFn
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
if (is_array($Call['Project']['Hosts'][F::Environment()])) {
$Hosts = $Call['Project']['Hosts'][F::Environment()];
} else {
$Hosts = [$Call['Project']['Hosts'][F::Environment()]];
}
// Select Default Host
if (isset($_SERVER['HTTP_HOST'])) {
if (in_array($_SERVER['HTTP_HOST'], $Hosts)) {
$Call['HTTP']['Host'] = $_SERVER['HTTP_HOST'];
}
}
if (isset($Call['HTTP']['Host'])) {
F::Log('Host is determined: *' . $Call['HTTP']['Host'] . '*', LOG_INFO);
} else {
$Call['HTTP']['Host'] = $Hosts[0];
F::Log('Host is not determined, default selected', LOG_WARNING);
}
if (isset($Call['Project']['Active Hosts'][$Call['HTTP']['Host']])) {
$Call = F::Merge($Call, $Call['Project']['Active Hosts'][$Call['HTTP']['Host']]);
F::Log('Active host loaded: *' . $Call['HTTP']['Host'] . '*', LOG_INFO);
}
return $Call;
});
示例8: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description:
* @package Codeine
* @version 8.x
* @date 31.08.11
* @time 6:17
*/
setFn('beforeRoute', function ($Call) {
if (isset($Call['Routing']['Extension']) && is_string($Call['Run'])) {
foreach ($Call['Routing']['Extension'] as $Extension => $ExtensionMixin) {
$Pattern = '/\\.' . $Extension . '$/';
if (preg_match($Pattern, $Call['Run'])) {
$Call['Extension Call'] = $ExtensionMixin;
$Call['Run'] = preg_replace($Pattern, '', $Call['Run']);
F::Log('.' . $Extension . ' extension detected', LOG_INFO);
break;
}
}
}
return $Call;
});
setFn('afterRoute', function ($Call) {
if (isset($Call['Extension Call'])) {
$Call['Run'] = F::Merge($Call['Run'], $Call['Extension Call']);
}
return $Call;
});
示例9: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
$Call['Layouts'][] = ['Scope' => 'IO', 'ID' => 'Overview'];
return $Call;
});
setFn('Storages', function ($Call) {
$Call['Layouts'][] = ['Scope' => 'IO', 'ID' => 'Storages'];
$IO = F::loadOptions('IO');
foreach ($IO['Storages'] as $Name => $Storage) {
$Storage['Status'] = F::Run('IO', 'Open', $Call, ['Storage' => $Name]) !== null;
$Storage['Size'] = F::Run('IO', 'Execute', $Call, ['Execute' => 'Size', 'Storage' => $Name]);
$Call['Output']['Content'][] = ['Type' => 'Template', 'Scope' => 'IO', 'ID' => 'Control/Show/Short', 'Data' => F::Merge(['Name' => $Name], $Storage)];
}
return $Call;
});
示例10: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 7.1
*/
setFn('Check', function ($Call) {
if (F::isCall($Call['Run'])) {
$Call = F::Merge($Call, $Call['Run']);
}
unset($Call['Decision'], $Call['Weight']);
switch (F::Run('Security.Access', 'Check', $Call)) {
case true:
F::Log('Access to Application ' . self::hashCall($Call['Run']) . ' allowed', LOG_NOTICE, 'Security');
$Call = F::Hook('Access.Allowed', $Call);
break;
default:
F::Log('Access to Application ' . self::hashCall($Call['Run']) . ' denied', LOG_NOTICE, 'Security');
$Call = F::Hook('Access.Denied', $Call);
break;
}
return $Call;
});
示例11: foreach
if (isset($Call['Where'])) {
$Call['Where'] = F::Live($Call['Where'], $Call);
} else {
$Call['Where'] = [];
}
// FIXME User Faceting
if ($Results['hits']['total'] > 0) {
foreach ($Results['hits']['hits'] as $Hit) {
$Hit['_source']['Scope'] = $Call['Scope'];
$Call['Where']['ID'] = $Hit['_id'];
$Data = F::Run('Entity', 'Read', ['Entity' => $Call['Scope'], 'One' => true, 'Fields' => $Call['Show fields'], 'Where' => $Call['Where']]);
if (empty($Data)) {
} else {
$IX++;
if (isset($Call['Default'])) {
$Data = F::Merge($Call['Default'], $Data);
}
$Data['Snippet'] = isset($Hit['highlight'][$Call['Highlight']][0]) ? $Hit['highlight'][$Call['Highlight']][0] : '';
$Data['Provider'] = '<l>' . $Call['Scope'] . '.Control:Title</l>';
// FIXME
$SERP[$Hit['_id']] = ['Score' => $Hit['_score'], 'Type' => 'Template', 'Scope' => $Call['Scope'], 'ID' => 'Show/Search', 'Data' => $Data];
}
}
$Results['hits']['total'] = $IX;
} else {
$SERP = null;
}
$Meta = ['Hits' => [$Call['Scope'] => $Results['hits']['total']]];
return ['Meta' => $Meta, 'SERP' => $SERP];
});
setFn('Remove', function ($Call) {
示例12: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Process', function ($Call) {
if (isset($Call['Node']['Required']) && $Call['Node']['Required'] && !isset($Call['Node']['Nullable'])) {
if (isset($Call['Current'][0])) {
$Produced = F::Merge($Call['Current'][0], $Call['Data']);
} else {
$Produced = $Call['Data'];
}
if (F::Dot($Produced, $Call['Name']) === null) {
F::Log('Required key ' . $Call['Entity'] . '.' . $Call['Name'] . ' not defined', LOG_ERR);
return 'Required';
}
}
return true;
});
示例13: unset
unset($Call['HTTP']['Headers']['HTTP/1.1']);
if (isset($Call['HTTP']['Headers'])) {
foreach ($Call['HTTP']['Headers'] as $Key => $Value) {
$Headers .= $Key . ' ' . $Value . PHP_EOL;
}
}
$Call['Output'] = $Headers . PHP_EOL . time();
fwrite($Client, $Call['Output']);
}
fclose($Client);
}
}
} else {
F::Log('Server creating error', LOG_ERR);
}
return $Call;
});
setFn('Protocol', function ($Call) {
if (isset($Call['Project']['Hosts'][F::Environment()])) {
if (preg_match('/(\\S+)\\.' . $Call['Project']['Hosts'][F::Environment()] . '/', $_SERVER['HTTP_HOST'], $Subdomains) && isset($Call['Subdomains'][$Subdomains[1]])) {
$Call = F::Merge($Call, $Call['Subdomains'][$Subdomains[1]]);
F::Log('Active Subdomain detected: ' . $Subdomains[1], LOG_INFO);
}
$Call['HTTP']['Host'] = $Call['Project']['Hosts'][F::Environment()];
}
F::Log('Protocol is *' . $Call['HTTP']['Proto'] . '*', LOG_INFO);
F::Log('RHost is *' . $Call['HTTP']['Host'] . '*', LOG_INFO);
F::Log('Host is *' . $Call['HTTP']['Host'] . '*', LOG_INFO);
$Call = F::loadOptions($Call['HTTP']['Host'], null, $Call);
return $Call;
});
示例14: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Make', function ($Call) {
$Call['HTML'] = '';
for ($IC = 1; $IC <= $Call['Stars']; $IC++) {
$StarData = ['Num' => $IC];
if (isset($Call['Value']) && $Call['Value'] == $IC) {
$StarData['Checked'] = 'checked';
}
$Call['HTML'] .= F::Run('View', 'Load', ['Scope' => $Call['View']['HTML']['Widget Set'] . '/Widgets', 'ID' => 'Form/Star', 'Data' => F::Merge($Call, $StarData)]);
}
$Call['Value'] = $Call['HTML'];
return $Call;
});
示例15: empty
$Call['Output'][$Provider] = [];
$ProviderCall = $Call['Providers'][$Provider];
if (isset($ProviderCall['Non-vertical']) && $ProviderCall['Non-vertical']) {
if (in_array($Provider, $Call['Provider'])) {
} else {
continue;
}
}
$ProviderCall['Method'] = 'Query';
$Results = F::Live($ProviderCall, $Call);
if (isset($Results['Meta'])) {
$Call = F::Merge($Call, $Results['Meta']);
}
if (isset($Results['SERP']) && !empty($Results['SERP'])) {
$Call['Output']['Content'] = F::Merge($Call['Output']['Content'], $Results['SERP']);
$Call['Output'][$Provider] = F::Merge($Call['Output'][$Provider], $Results['SERP']);
}
$Call['Hits']['All'] += $Results['Meta']['Hits'][$Provider];
}
}
$Call['Output']['Content'] = F::Sort($Call['Output']['Content'], 'Score', SORT_DESC);
}
$Call['Empty Query'] = empty($Call['Query']);
if ($Call['Hits']['All'] == 0) {
$Call['Output']['Content'] = [['Type' => 'Template', 'Scope' => 'Search', 'ID' => 'Empty']];
} else {
$Call['Output']['Content'] = F::Sort($Call['Output']['Content'], 'Score', SORT_DESC);
}
$Call = F::Hook('afterSearchQuery', $Call);
return $Call;
});