本文整理汇总了PHP中F::Live方法的典型用法代码示例。如果您正苦于以下问题:PHP F::Live方法的具体用法?PHP F::Live怎么用?PHP F::Live使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类F
的用法示例。
在下文中一共展示了F::Live方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description <k> tag
* @package Codeine
* @version 8.x
*/
setFn('Parse', function ($Call) {
if (preg_match_all('@<treekey(.*)>(.*)</treekey>@SsUu', $Call['Value'], $Call['Parsed'])) {
foreach ($Call['Parsed'][2] as $IX => $Match) {
$Root = simplexml_load_string('<forkey' . $Call['Parsed'][1][$IX] . '></forkey>');
$Output = '';
$Key = (string) $Root->attributes()->key;
if (($Matched = F::Live(F::Dot($Call['Data'], $Key))) !== null) {
if (is_array($Matched)) {
$Rows = [];
F::Map($Matched, function ($Key, $Value, $Data, $NewFullKey, $Array) use(&$Rows) {
if (!is_array($Value)) {
$Rows[] = [substr($NewFullKey, 1), $Value];
}
});
foreach ($Rows as $Row) {
$Output .= strtr($Match, ['<treek/>' => $Row[0], '<treev/>' => $Row[1]]);
}
$Call['Value'] = str_replace($Call['Parsed'][0][$IX], $Output, $Call['Value']);
}
} else {
$Call['Value'] = str_replace($Call['Parsed'][0][$IX], '', $Call['Value']);
}
}
示例2: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Log', function ($Call) {
return log($Call['X'], F::Live($Call['Base']));
});
示例3: setFn
setFn('GET', function ($Call) {
$Call['Layouts'][] = ['Scope' => 'Parser', 'ID' => 'URL'];
return $Call;
});
setFn('POST', function ($Call) {
$Call['URL'] = $Call['Request']['Data']['URL'];
$Call['Data'] = F::Run('Parser.URL', 'Parse', $Call);
$Call['Output']['Content'][] = ['Type' => 'Block', 'Value' => j($Call['Data'])];
return $Call;
});
setFn('Parse', function ($Call) {
if ($Call['Schema'] = F::Run('Parser', 'Discovery', $Call)) {
F::Log('Schema is ' . $Call['Schema'], LOG_INFO);
$Schema = F::loadOptions('Parser/' . $Call['Schema']);
$Call = F::Merge($Call, $Schema);
$Result = F::Live($Call['Parser']['URL']['Backend'], ['Where' => ['ID' => $Call['URL']]]);
$Result = array_pop($Result);
$Call = F::Run('Parser', 'Do', $Call, ['Markup' => $Result]);
$Slices = explode('/', $Call['Schema']);
$Call['Entity'] = array_pop($Slices);
$Call['Data']['Source'] = $Call['URL'];
if (isset($Call['Parser']['Create']['Auto']) && $Call['Parser']['Create']['Auto']) {
$Call['Data'] = F::Run('Entity', 'Create', $Call, ['One' => true]);
}
if (isset($Call['Data']['ID'])) {
$Call = F::Run('System.Interface.HTTP', 'Redirect', $Call, ['Redirect' => '/control/' . $Call['Entity'] . '/Show/' . $Call['Data']['ID']]);
}
} else {
$Call['Data'] = null;
}
return $Call['Data'];
示例4: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
if (isset($Call['Service']) && $Call['View']['Renderer'] == 'View.HTML') {
if (in_array($Call['Service'], $Call['No SEO Audit'])) {
F::Log('SEO Audit skipped', LOG_INFO, 'Marketing');
} else {
if (isset($Call['View']['HTML']) && !isset($Call['Headers']['Location:'])) {
foreach ($Call['Auditors'] as $Auditor) {
$Call = F::Live($Auditor, $Call);
}
}
}
}
return $Call;
});
示例5: foreach
$Call['Node']['Options'] = F::Live($Call['Node']['Options']);
$Data = [];
foreach ($Call['Value'] as $Value) {
if (($Value = array_search($Value, $Call['Node']['Options'])) !== false) {
$Data[] = $Value;
}
}
return $Data;
});
setFn('Read', function ($Call) {
$Call['Node']['Options'] = F::Live($Call['Node']['Options']);
if (is_array($Call['Value'])) {
foreach ($Call['Value'] as &$Value) {
if (isset($Call['Node']['Options'][$Value])) {
$Value = $Call['Node']['Options'][$Value];
}
}
}
return $Call['Value'];
});
setFn('Where', function ($Call) {
$Call['Node']['Options'] = F::Live($Call['Node']['Options']);
$Data = [];
foreach ($Call['Value'] as &$Value) {
$Data[] = (int) array_search($Value, $Call['Node']['Options']);
}
return $Data;
});
setFn('Populate', function ($Call) {
return [array_rand(F::Live($Call['Node']['Options']))];
});
示例6: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Get', function ($Call) {
if (isset($Call['Modes'][$Call['Mode']])) {
} else {
$Call['Mode'] = 'Normal';
}
return F::Live($Call['Modes'][$Call['Mode']], $Call) + $Call['Increment'];
});
示例7: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 7.4
*/
setFn('Do', function ($Call) {
$Call = F::Hook('beforeVerifyDo', $Call);
if (isset($Call['Where'])) {
$Call['Where'] = F::Live($Call['Where']);
}
// FIXME
return F::Run(null, $Call['HTTP']['Method'], $Call);
});
setFn('GET', function ($Call) {
$Call = F::Hook('beforeVerifyGet', $Call);
if (!isset($Call['Failure'])) {
$Call['Output']['Content']['Form Widget'] = ['Type' => 'Form', 'Submit' => 'Verify'];
$Call['Tag'] = isset($Call['Scope']) ? $Call['Scope'] : null;
$Call['Scope'] = isset($Call['Scope']) ? $Call['Entity'] . '/' . $Call['Scope'] : $Call['Entity'];
$Call['Layouts'][] = ['Scope' => $Call['Entity'], 'ID' => isset($Call['Custom Layouts']['Verify']) ? $Call['Custom Layouts']['Verify'] : 'Verify', 'Context' => $Call['Context']];
// Загрузить предопределённые данные и умолчания
$Call['Data'] = F::Run('Entity', 'Read', $Call, ['Time' => microtime(true)]);
if (null === $Call['Data']) {
$Call = F::Hook('onEntityVerifyNotFound', $Call);
} else {
foreach ($Call['Data'] as $IX => $cData) {
foreach ($Call['Nodes'] as $Name => $Node) {
if (isset($Node['Verifiable']) && $Node['Verifiable'] && isset($cData[$Name])) {
示例8: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Send', function ($Call) {
$Subscribes = F::Run('Entity', 'Read', ['Entity' => 'Subscribe', 'Where' => ['Event' => $Call['Event']]]);
if (empty($Subscribes)) {
} else {
foreach ($Subscribes as $Subscribe) {
F::Run('IO', 'Write', ['Storage' => $Subscribe['Transport'], 'Scope' => $Subscribe['Target'], 'Data' => F::Live($Subscribe['Message'], $Call)]);
}
}
return $Call;
});
示例9:
$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']);
}
}
}
// Упростить
if (isset($Widget['Value'])) {
$Widget['Value'] = F::Live($Widget['Value']);
} else {
$Widget['Value'] = null;
}
// Помещаем виджет в поток
$ic++;
$Call = F::Apply('Entity.Form.Layout.' . $Call['FormLayout'], 'Add', $Call, ['IC' => $ic, 'Name' => $Name, 'Widget' => $Widget]);
$Call['Widget'] = null;
}
}
}
// Вывести
$Call = F::Hook('afterFilterDo', $Call);
return $Call;
});
示例10: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description: Фронт контроллер
* @package Codeine
* @version 8.x
* @date 31.08.11
* @time 1:12
*/
setFn('Run', function ($Call) {
$Call = F::Live($Call['Apps'][$Call['Step']], $Call);
return $Call;
});
示例11: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Write', function ($Call) {
$Call['Value'] = $_FILES['file'];
$Call['ID'] = F::Run('Security.UID', 'Get', $Call);
$Call['Data'] = file_get_contents($_FILES['file']['tmp_name']);
$Call['Name'] = F::Live($Call['Naming'], $Call);
F::Run('IO', 'Write', $Call, ['Storage' => 'Uploader', 'Scope' => 'wysiwyg', 'Where' => $Call['Name']]);
$Call['Output']['Content']['filelink'] = '/uploads/wysiwyg/' . $Call['Name'];
// FIXME Scope support
return $Call;
});
setFn('Read', function ($Call) {
$Call['Output']['Content'] = F::Run('IO', 'Read', $Call, ['Storage' => 'Upload', 'Scope' => 'WYSIWYG']);
if (empty($Call['Output']['Content'])) {
$Call = F::Hook('onUploaderNotFound', $Call);
}
return $Call;
});
示例12: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
F::Log('CLI Interface Started', LOG_NOTICE);
$Call = F::Hook('beforeInterfaceRun', $Call);
$Call['HTTP']['IP'] = F::Live($Call['HTTP']['IP'], $Call);
if (isset($Call['Project']['Hosts'][F::Environment()])) {
$Call['HTTP']['Host'] = $Call['Project']['Hosts'][F::Environment()];
}
$Call['HTTP']['Proto'] = 'https';
$Call['HTTP']['URL'] = '/';
if (isset($Call['Skip Run'])) {
F::Log('Run Skipped, because ' . $Call['Skip Run'], LOG_INFO);
} else {
F::Log($Call['Service'] . ':' . $Call['Method'] . ' started', LOG_NOTICE);
$Call = F::Apply($Call['Service'], $Call['Method'], $Call);
}
$Call = F::Hook('afterInterfaceRun', $Call);
if (is_array($Call) && isset($Call['Output'])) {
F::Run('IO', 'Write', $Call, ['Storage' => 'Output', 'Where' => $Call['Service'] . ':' . $Call['Method'], 'Data' => $Call['Output']]);
if (isset($Call['Failure']) && $Call['Failure']) {
$Call['Return Code'] = 1;
}
}
F::Log('CLI Finished', LOG_NOTICE);
示例13: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Live Enum', function ($Call) {
if (isset($Call['Skip Enum Live'])) {
} else {
$Call['Node']['Options'] = F::Live($Call['Node']['Options'], ['Node' => $Call['Node'], 'Name' => $Call['Name'], 'Data' => isset($Call['Data']) ? $Call['Data'] : []]);
}
return $Call;
});
setFn('Write', function ($Call) {
$Call = F::Apply(null, 'Live Enum', $Call);
if (empty($Call['Node']['Options'])) {
return null;
} else {
return array_search($Call['Value'], $Call['Node']['Options']);
}
});
setFn('Read', function ($Call) {
$Call = F::Apply(null, 'Live Enum', $Call);
if (is_scalar($Call['Value']) && isset($Call['Node']['Options'][$Call['Value']])) {
return $Call['Node']['Options'][$Call['Value']];
} else {
return $Call['Value'];
}
});
示例14: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description
* @package Codeine
* @version 8.x
*/
setFn('Do', function ($Call) {
return F::Live($Call['Modes'][$Call['Mode']], $Call);
});
示例15: setFn
<?php
/* Codeine
* @author bergstein@trickyplan.com
* @description HTML Textfield Driver
* @package Codeine
* @version 8.x
*/
setFn('Make', function ($Call) {
$Options = [];
$NavlistScope = isset($Call['Scope']) ? $Call['Scope'] : 'Navlist';
if (isset($Call['Value'])) {
$Call['Value'] = F::Live($Call['Value']);
} else {
$Call['Value'] = 0;
}
$Call['Options'] = F::Live($Call['Options']);
foreach ($Call['Options'] as $Key => $Value) {
if (is_array($Value)) {
$Options[] = F::Run('View', 'Load', $Call, ['Scope' => $Call['View']['HTML']['Widget Set'] . '/Widgets', 'ID' => $NavlistScope . '/Element', 'Data' => $Value]);
} else {
$Options[] = F::Run('View', 'Load', $Call, ['Scope' => $Call['View']['HTML']['Widget Set'] . '/Widgets', 'ID' => $NavlistScope . '/Header', 'Data' => ['Title' => $Value]]);
}
}
$Call['Value'] = implode('', $Options);
return $Call;
});