<?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']); } }
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Log', function ($Call) { return log($Call['X'], F::Live($Call['Base'])); });
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'];
<?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; });
$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']))]; });
<?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']; });
<?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])) {
<?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; });
$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; });
<?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; });
<?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; });
<?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);
<?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']; } });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { return F::Live($Call['Modes'][$Call['Mode']], $Call); });
<?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; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description HTML Textfield Driver * @package Codeine * @version 8.x */ setFn('Make', function ($Call) { $Options = []; if (isset($Call['Multiple']) && $Call['Multiple']) { $Call['Name'] .= '[]'; } $Call['Options'] = F::Live($Call['Options'], $Call); if ($Call['Options'] === null) { } else { if (isset($Call['Flip Keys'])) { $Call['Options'] = array_flip($Call['Options']); } if (isset($Call['Values as Keys'])) { $Flushed = []; foreach ($Call['Options'] as $Option) { $Flushed[$Option] = $Option; } $Call['Options'] = $Flushed; } if (isset($Call['Nullable']) && $Call['Nullable']) { $Call['Options'][] = [null, null]; } foreach ($Call['Options'] as $Key => $Option) { if (is_array($Option)) {
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Check', function ($Call) { $Response = F::Run('IO', 'Write', ['Storage' => 'Web', 'Where' => 'http://' . $Call['Akismet']['Key'] . '.rest.akismet.com/1.1/comment-check', 'Agent' => 'Codeine/7.x | Akismet/1.0', 'Data' => ['blog' => $Call['HTTP']['Host'], 'user_ip' => F::Live($Call['HTTP']['IP']), 'user_agent' => $Call['HTTP']['Agent'], 'referrer' => '', 'permalink' => $Call['HTTP']['URL'], 'comment_type' => 'comment', 'comment_author' => isset($Call['User']['Title']) ? $Call['User']['Title'] : '', 'comment_author_email' => isset($Call['User']['EMail']) ? $Call['User']['Title'] : '', 'comment_content' => $Call['Value']]]); F::Log('Akismet response: ' . $Response[0], LOG_INFO); return !($Response === 'false'); }); setFn('Calculate', function ($Call) { if (isset($Call['Data']['User'])) { $Call['User'] = F::Run('Entity', 'Read', ['Entity' => 'User', 'Where' => $Call['Data']['User'], 'One' => true]); } return F::Run(null, 'Check', $Call) ? 50 : 0; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Run', function ($Call) { F::Log('Delayed Run ' . $Call['Run']['Service'] . ' queued', LOG_INFO); return F::Run('IO', 'Write', ['Storage' => 'Delayed', 'Queue' => $Call['Priority'], 'Data' => $Call['Run']]); }); setFn('Execute', function ($Call) { foreach ($Call['Priorities'] as $Call['Priority']) { if ($Call['Run'] = F::Run('IO', 'Read', ['Time' => microtime(true), 'Queue' => $Call['Priority'], 'Storage' => 'Delayed'])) { F::Log('Running delayed task', LOG_INFO, 'Developer'); return F::Live($Call['Run']); } else { F::Log('No tasks at ' . $Call['Priority'], LOG_DEBUG, 'Developer'); } } return null; }); setFn('Count', function ($Call) { foreach ($Call['Priorities'] as $Call['Priority']) { $Queued[$Call['Priority']] = F::Run('IO', 'Execute', ['Execute' => 'Count', 'Time' => microtime(true), 'Storage' => 'Delayed', 'Queue' => $Call['Priority']]); F::Log('Queued ' . $Call['Priority'] . ' priority tasks: ' . $Queued[$Call['Priority']], LOG_INFO); } return implode('/', $Queued); });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Run', function ($Call) { $Result = F::Run('IO', 'Read', array('Storage' => 'Run Once', 'Where' => $Call['ID'])); if (null !== $Result) { foreach ($Result[0]['Code'] as $Code) { $Call = F::Live($Code, $Call); } F::Run('IO', 'Write', array('Storage' => 'Run Once', 'Where' => $Call['ID'], 'Data' => null)); } return $Call; }); setFn('Prepare', function ($Call) { $UID = F::Run('Security.UID', 'Get', ['Mode' => 'Secure+']); F::Run('IO', 'Write', array('Storage' => 'Run Once', 'Data' => ['ID' => $UID, 'Code' => $Call['Run']])); return $UID; });
* @package Codeine * @version 7.1 */ setFn('Open', function ($Call) { return true; }); setFn('Select User Agent', function ($Call) { if (isset($Call['CURL']['Random User Agent'])) { $Call['CURL']['Agent'] = $Call['CURL']['Agents'][array_rand($Call['CURL']['Agents'])]; F::Log('UA: ' . $Call['CURL']['Agent'] . ' selected', LOG_INFO, 'Administrator'); } return $Call; }); setFn('Select Proxy', function ($Call) { if (isset($Call['CURL']['Random Proxy']) && isset($Call['CURL']['Proxies'])) { $Call['CURL']['Proxies'] = F::Live($Call['CURL']['Proxies']); $Random = $Call['CURL']['Proxies'][array_rand($Call['CURL']['Proxies'])]; if (strpos($Random, ':') === false) { $Call['CURL']['Proxy']['Host'] = $Random; $Call['CURL']['Proxy']['Port'] = 80; } else { list($Call['CURL']['Proxy']['Host'], $Call['CURL']['Proxy']['Port']) = explode(':', $Random); } } if (isset($Call['CURL']['Proxy']['Host'])) { F::Log('Proxy: ' . $Call['CURL']['Proxy']['Host'] . ':' . $Call['CURL']['Proxy']['Port'] . ' selected', LOG_INFO, 'Administrator'); } return $Call; }); setFn('Read', function ($Call) { $Return = null;
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 7.4.5 */ setFn('Do', function ($Call) { F::Run('Entity', 'Create', ['Entity' => 'Notify', 'Data!' => F::Live($Call['Notify'], $Call), 'Session' => $Call['Session']]); unset($Call['Notify']); return $Call; });
* @description * @package Sphinx * @version 7.2 */ setFn('Do', function ($Call) { $Location = ''; if (isset($Call['Session']['Location'])) { $Location = $Call['Session']['Location']; } if (isset($Call['Location'])) { $Location = $Call['Location']; } if (isset($Call['Request']['Location'])) { $Location = F::Live($Call['Request']['Location']); } if (isset($Call['Call']['Where']['Location'])) { $Location = F::Live($Call['Call']['Where']['Location']); } $Location = F::Live($Location); if (isset($Location) && !empty($Location)) { $Call['Session']['Location'] = $Location; $Call['Session']['LocationURL'] = '/' . F::Run('Entity', 'Far', ['Entity' => 'Location', 'Where' => $Location, 'Key' => 'Slug']); } else { $Call['Session']['Location'] = 0; $Call['Session']['LocationURL'] = '/'; } if ($Location != $Call['Session']['Location']) { F::Run('Session', 'Write', $Call, ['Session Data' => ['Location' => $Location]]); } return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Run', function ($Call) { $Result = F::Live($Call['Run']); if ($Result === null) { return F::Live($Call['Replace']); } else { return $Result; } });
/* Codeine * @author BreathLess * @description * @package Codeine * @version 7.x */ setFn('Run', function ($Call) { if (isset($Call['Script'])) { } else { $Call['Script'] = ''; } if (isset($Call['Proxy'])) { $Proxy = '--proxy=' . $Call['Proxy']; } else { if (isset($Call['Random Proxy'])) { $Call['Proxies'] = F::Live($Call['Proxies']); $Call['Proxy'] = $Call['Proxies'][array_rand($Call['Proxies'])]; $Proxy = '--proxy=' . $Call['Proxy'] . ' --proxy-type=http'; } else { $Proxy = ''; } } $Command = 'xvfb-run --auto-servernum --server-num=100 ' . Root . '/slimerjs/slimerjs ' . $Proxy . ' --ssl-protocol=any ' . $Call['Script'] . ' ' . $Call['Where']['ID']; F::Log($Command, LOG_INFO); // exec($Command, $Result, $Return); $Result = shell_exec($Command); F::Log('Size of Slimer output: ' . mb_strlen($Result), LOG_INFO); F::Log($Result, LOG_INFO); return [$Result]; });
* @package Codeine * @version 8.x */ setFn('Add', function ($Call) { if (isset($Call['Modes'][$Call['Mode']])) { return F::Run($Call['Modes'][$Call['Mode']], null, F::Live($Call)); } else { return null; } }); setFn('Substract', function ($Call) { if (isset($Call['Modes'][$Call['Mode']])) { return F::Run($Call['Modes'][$Call['Mode']], null, F::Live($Call)); } else { return null; } }); setFn('Multiply', function ($Call) { if (isset($Call['Modes'][$Call['Mode']])) { return F::Run($Call['Modes'][$Call['Mode']], null, F::Live($Call)); } else { return null; } }); setFn('Divide', function ($Call) { if (isset($Call['Modes'][$Call['Mode']])) { return F::Run($Call['Modes'][$Call['Mode']], null, F::Live($Call)); } else { return null; } });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Get', function ($Call) { $finfo = new finfo(FILEINFO_MIME); list($Type) = explode(';', $finfo->buffer($Call['Data'])); if (isset($Call['Map'][$Type])) { return F::Live($Call['ID']) . $Call['Map'][$Type]; } else { return null; } });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 7.6,2 */ setFn('Widget', function ($Call) { return F::Apply($Call['Modes'][$Call['Mode']], 'Widget', $Call); }); setFn('Check', function ($Call) { if (!isset($Call['CAPTCHA']['Bypass'])) { if (!F::Run($Call['Modes'][$Call['Mode']], 'Check', $Call)) { F::Log('CAPTCHA Failed from IP ' . F::Live($Call['HTTP']['IP']), LOG_ERR, 'Security'); $Call['Failure'] = true; $Call = F::Hook('CAPTCHA.Failed', $Call); } } return $Call; });
} $Call['Value'] = F::Run('IO', 'Read', ['Scope' => isset($Call['Scope']) ? $Call['Scope'] : null, 'Storage' => 'Layout', 'Where' => ['ID' => $IDs]])[0]; if (isset($Call['Data']) && $Call['Data'] !== (array) $Call['Data']) { $Call['Data'] = ['Value' => $Call['Data']]; } if ($Call['Value'] !== null) { $Call = F::Hook('afterViewLoad', $Call); } return $Call['Value']; }); setFn('Render', function ($Call) { $Call = F::Hook('beforeRender', $Call); $Call['Environment'] = self::$_Environment; if (isset($Call['View']['Renderer'])) { F::Log('Start ' . $Call['View']['Renderer']['Service'] . ' Rendering', LOG_NOTICE); $Call = F::Live($Call['View']['Renderer'], $Call); F::Log('Finish ' . $Call['View']['Renderer']['Service'] . ' Rendering', LOG_NOTICE); } return F::Hook('afterRender', $Call); }); setFn('Asset.Route', function ($Call) { if (strpos($Call['Value'], ':') !== false) { list($Scope, $ID) = explode(':', $Call['Value']); if (isset($Call['Scope']) && $Scope != '') { $Scope .= '/' . $Call['Scope']; } } else { $Scope = $Call['Value']; $ID = $Scope; if (isset($Call['Scope']) && $Scope != '') { $Scope .= '/' . $Call['Scope'];
/* Codeine * @author bergstein@trickyplan.com * @description: Фронт контроллер * @package Codeine * @version 8.x * @date 31.08.11 * @time 1:12 */ setFn('Run', function ($Call) { // В этом месте, практически всегда, происходит роутинг. $Call = F::Hook('beforeFrontRun', $Call); // Если передан нормальный вызов, совершаем его F::Log('Front Controlled *' . $Call['Service'] . ':' . $Call['Method'] . '* started', LOG_NOTICE); if (F::Dot($Call, 'Skip Front')) { F::Log('Front Skip Enabled', LOG_NOTICE); } else { if (F::isCall($Call['Run'])) { if (!isset($Call['Run']['Method'])) { $Call['Run']['Method'] = 'Do'; } list($Call['Service'], $Call['Method']) = [$Call['Run']['Service'], $Call['Run']['Method']]; if (isset($Call['Run']['Call'])) { F::Log($Call['Run']['Call'], LOG_INFO); } $Call = F::Live($Call['Run'], $Call); } } // А здесь - рендеринг $Call = F::Hook('afterFrontRun', $Call); return $Call; });
* @version 8.x */ setFn('Parse', function ($Call) { $Call['Parsed'] = F::Run('Text.Regex', 'All', ['Pattern' => $Call['Key Pattern'], 'Value' => $Call['Value']]); if ($Call['Parsed'] && isset($Call['Data'])) { $Call['Parsed'][0] = array_unique($Call['Parsed'][0]); $Call['Parsed'][1] = array_unique($Call['Parsed'][1]); foreach ($Call['Parsed'][1] as $IX => &$Match) { if (mb_strpos($Match, ',') !== false) { $Match = explode(',', $Match); } else { $Match = [$Match]; } $Matched = ''; foreach ($Match as $CMatch) { $Matched = F::Live(F::Dot($Call['Data'], $CMatch)); if (empty($Matched)) { } else { if ((array) $Matched === $Matched) { $Matched = array_shift($Matched); } if ($Matched === false or $Matched === 0) { $Matched = '0'; } break; } } if (is_array($Matched)) { $Match = array_pop($Matched); } else { $Match = $Matched;