} 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); $VCall = F::Apply(null, 'Run', ['Test' => $Call['Test']['Name']], $Call); $Call['Test']['Report'] = F::Merge($Call['Test']['Report'], $VCall['Test']['Report']); } else { F::Log('Running all tests!', LOG_INFO); foreach ($Paths as $Path) { if (is_dir($Path . '/Tests')) { $Directory = new RecursiveDirectoryIterator($Path . '/Tests'); $Iterator = new RecursiveIteratorIterator($Directory); $Regex = new RegexIterator($Iterator, '@Tests/(.+).json$@', RecursiveRegexIterator::GET_MATCH); $Options = array_merge($Options, iterator_to_array($Regex)); } } sort($Options); foreach ($Options as $Option) { $VCall = F::Apply(null, 'Run', $Call, ['Test' => ['Name' => $Option[1]]]); $Call['Test']['Report'] = F::Merge($Call['Test']['Report'], $VCall['Test']['Report']); } } $Call['Output']['Content'][] = ['Type' => 'Table', 'Value' => $Call['Test']['Report']]; return $Call; });
} 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); $Amount = ceil($Total / $Call['All']['Limit']); set_time_limit(10 * $Total); $Call = F::Apply('Code.Progress', 'Start', $Call); $Call['Progress']['Max'] = $Amount; for ($i = 0; $i < $Amount; $i++) { F::Run('Entity', 'Update', ['Entity' => $Call['Entity'], 'Where' => $Call['Where'], 'Data' => [], 'One' => false, 'Limit' => ['From' => $i * $Call['All']['Limit'], 'To' => ($i + 1) * $Call['All']['Limit']]]); $Call['Progress']['Now']++; $Call = F::Apply('Code.Progress', 'Log', $Call); F::Log('Touch Iteration № ' . ($i + 1) / $Amount, LOG_NOTICE); } $Call = F::Apply('Code.Progress', 'Finish', $Call); $Call['Output']['Content'][] = $Total . ' elements processed'; return $Call; }); setFn('Test', function ($Call) { F::Run(null, "All", $Call, ['Entity' => 'User', 'Where' => ['ID' => ['$gt' => 3]], 'Live Fields' => ['VKontakte.DOB']]); });
foreach ($Locations as $Location) { if (!isset($Call['Location']['Slug']) or null === $Call['Location']['Slug']) { $Location['URL'] = '/' . $Location['Slug']; } else { if (preg_match('@^/' . $Call['Location']['Slug'] . '@Ssuu', $Call['HTTP']['URL'])) { $Location['URL'] = str_replace($Call['Location']['Slug'], $Location['Slug'], $Call['HTTP']['URL']); } else { $Location['URL'] = '/' . $Location['Slug']; } } $Location['URL'] = $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . $Location['URL']; if (isset($Call['Location']['ID']) && $Location['ID'] == $Call['Location']['ID']) { $Call['Output']['Content'][] = '<option selected value="' . $Location['Slug'] . '"><a href="' . $Location['Slug'] . '">' . $Location['Title'] . '</a></option>'; } else { $Call['Output']['Content'][] = '<option value="' . $Location['Slug'] . '"><a href="' . $Location['Slug'] . '">' . $Location['Title'] . '</a></option>'; } } } return $Call; }); setFn('Select', function ($Call) { if ($Call['Location'] != $Call['Session']['Location']) { F::Run('Session', 'Write', $Call, ['Session Data' => ['Location' => $Call['Location']]]); } if (isset($_SERVER['HTTP_REFERER'])) { $Call = F::Apply('System.Interface.HTTP', 'Redirect', $Call, ['Location' => $_SERVER['HTTP_REFERER']]); } else { $Call = F::Apply('System.Interface.HTTP', 'Redirect', $Call, ['Location' => '/']); } return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ require Root . '/vendor/autoload.php'; setFn('Open', function ($Call) { $Call['Link'] = new Airbrake\Client(new Airbrake\Configuration($Call['Airbrake']['API Key'], $Call['Airbrake']['Options'])); return $Call; }); setFn('Write', function ($Call) { $Call = F::Apply(null, 'Open', $Call); foreach ($Call['Data'] as $Row) { $Call['Link']->notifyOnError($Row[3] . ':' . $Row[2]); } return true; });
*/ setFn('Write', function ($Call) { // Грузим модель связанной сущности $Call = F::Apply('Entity', 'Load', $Call, ['Entity' => $Call['Name']]); // Приводим значение к типу данных ID связанной сущности // Если ID цифровое, то и наш ключ должен быть цифровой foreach ($Call['Value'] as &$Value) { $Value = F::Run('Data.Type.' . $Call['Nodes']['ID']['Type'], 'Write', ['Value' => $Value]); // Подгружаем связанную сущность $Element = F::Run('Entity', 'Read', ['One' => true, 'Entity' => $Call['Name'], 'Where' => $Value]); // Если такой сущности нет if (empty($Element)) { // Смиряемся $Value = null; } else { // Трогаем связанную сущность F::Run('Entity', 'Touch', ['One' => true, 'Entity' => $Call['Name'], 'Where' => $Call['Value']]); } } return $Call['Value']; }); setFn(['Read', 'Where'], function ($Call) { $Call = F::Apply('Entity', 'Load', $Call, ['Entity' => $Call['Name']]); foreach ($Call['Value'] as &$Value) { $Value = F::Run('Data.Type.' . $Call['Nodes']['ID']['Type'], 'Write', ['Value' => $Value]); } return $Call['Value']; }); setFn('Populate', function ($Call) { return null; });
} else { $Value = null; } $Data = F::Dot($Data, $Key, $Value); } $Value = F::Dot($Data, $Key); if (null !== $Value) { $Keys++; } if (count($Value) == 1) { $Data = F::Dot($Data, $Key, $Value[0]); } $Call['Data'] = $Data; } $Data['Percent'] = floor($Keys / count($Call['Nodes']) * 100); $Call = F::Apply('Parser.' . $Call['Schema'], 'Do', $Call); phpQuery::unloadDocuments(); } } else { F::Log('Parser Nodes *not defined*', LOG_ERR); } return $Call; }); setFn('Discovery', function ($Call) { foreach ($Call['Parser']['Discovery'] as $Rule) { if (preg_match($Rule['Match'], $Call['URL'])) { return $Rule['Schema']; } } return null; });
<?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; });
$Call['Data'] = F::Run('Entity', 'Read', $Call, ['One' => true, 'Limit' => ['From' => 0, 'To' => 1]]); $Call = F::Hook('afterShowBefore', $Call); return $Call; }); setFn('Do', function ($Call) { $Call = F::Hook('beforeShow', $Call); $Call = F::Hook('beforeShowDo', $Call); /*foreach ($Call['Data'] as $Node => $Value) { if (isset($Call['Nodes'][$Node]['Widgets'])) ; else unset ($Call['Data'][$Node]); }*/ if (isset($Call['Data']['Redirect']) && !empty($Call['Data']['Redirect'])) { $Call = F::Apply('System.Interface.HTTP', 'Redirect', $Call, ['Redirect' => $Call['Data']['Redirect']]); } else { $Call['Layouts'][] = ['Scope' => $Call['Entity'], 'ID' => 'Show', 'Context' => $Call['Context']]; $Call['Scope'] = isset($Call['Scope']) ? $Call['Entity'] . '/' . $Call['Scope'] : $Call['Entity']; if (empty($Call['Data'])) { $Call = F::Hook('onShowNotFound', $Call); } else { $Call['Output']['Content'][] = array('Type' => 'Template', 'Scope' => $Call['Scope'], 'ID' => 'Show/' . (isset($Call['Template']) ? $Call['Template'] : 'Full'), 'Data' => $Call['Data']); $Call = F::Hook('afterShow', $Call); } } /* if (isset($Call['Data']['Modified'])) $Call['HTTP']['Headers']['Last-Modified:'] = date(DATE_RFC2822, $Call['Data']['Modified']); else $Call['HTTP']['Headers']['Last-Modified:'] = date(DATE_RFC2822, $Call['Data']['Created']);*/ F::Log($Call['Data'], LOG_DEBUG);
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Detect', function ($Call) { $Call = F::Hook('beforeLocaleDetect', $Call); if (isset($Call['Locale'])) { F::Log('Locale selected: *' . $Call['Locale'] . '*', LOG_INFO); } else { $Call['Locale'] = $Call['Default']['Locale']; if (F::Dot($Call, 'Locales.Detect.Accept-language')) { $Call = F::Apply(null, 'Check Accept-language', $Call); } } setlocale(LC_ALL, $Call['Locales']['PHP'][$Call['Locale']]); $Call = F::Hook('afterLocaleDetect', $Call); return $Call; }); setFn('Check Accept-language', function ($Call) { if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { preg_match_all('/([a-z]{1,8}(-[a-z]{1,8})?)\\s*(;\\s*q\\s*=\\s*(1|0\\.[0-9]+))?/i', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $Parsed); $Locales = array_combine($Parsed[1], $Parsed[4]); foreach ($Locales as $Locale => $Q) { if ($Q === '') { $Locales[$Locale] = 1; } }
<?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; });
} catch (MongoException $e) { return F::Hook('IO.Mongo.Write.Failed', $Call); } return isset($Call['Data']) ? $Call['Data'] : null; }); setFn('Close', function ($Call) { return true; }); setFn('Execute', function ($Call) { F::Log($Call['Command'], LOG_INFO); return $Call['Link']->execute($Call['Command']); }); setFn('Count', function ($Call) { $Call['Scope'] = strtr($Call['Scope'], '.', '_'); if (isset($Call['Where']) and $Call['Where'] !== null) { $Call = F::Apply(null, 'Where', $Call); if (isset($Call['Distinct']) && $Call['Distinct']) { F::Log('db.*' . $Call['Scope'] . '*.distinct(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator'); $Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0], $Call['Where']); return count($Data); } else { F::Log('db.*' . $Call['Scope'] . '*.count(' . j($Call['Where']) . ')', LOG_INFO, 'Administrator'); $Cursor = $Call['Link']->{$Call}['Scope']->count($Call['Where']); } } else { if (isset($Call['Distinct']) && $Call['Distinct']) { F::Log('db.*' . $Call['Scope'] . '*.distinct()', LOG_INFO, 'Administrator'); $Data = $Call['Link']->{$Call}['Scope']->distinct($Call['Fields'][0]); return count($Data); } else { F::Log('db.*' . $Call['Scope'] . '*.count()', LOG_INFO, 'Administrator');
// Если есть значение, добавляем if (($Widget['Value'] = F::Dot($Call['Data'], $Name)) === null) { if (isset($Node['Default'])) { $Widget['Value'] = F::Live($Node['Default']); } else { $Widget['Value'] = null; } } else { $Widget['Value'] = F::Live($Widget['Value']); } if (is_scalar($Widget['Value'])) { $Widget['Value'] = htmlspecialchars($Widget['Value']); } // Упростить if (!isset($Widget['Weight'])) { $Widget['Weight'] = $IC; } // Magic //$Widget['Label'] .=$Widget['Weight']; // Помещаем виджет в поток $Call = F::Apply('Entity.Form.Layout.' . $Call['FormLayout'], 'Add', $Call, ['Name' => $Name, 'Widget' => $Widget]); $Call['Widget'] = null; } } } $Call = F::Apply('Entity.Form.Layout.' . $Call['FormLayout'], 'Finish', $Call); if (isset($Call['Output']['Form'])) { $Call['Output']['Form'] = F::Sort($Call['Output']['Form'], 'Weight', SORT_ASC); } return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { $Call = F::Apply('Entity', 'Load', $Call); if (isset($Call['Where'])) { $Call['Where'] = F::Live($Call['Where'], $Call); } $Call = F::Hook('beforeCount', $Call); $Call['Count'] = F::Run('Entity', 'Count', $Call); $Call = F::Hook('afterCount', $Call); return $Call['Count']; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { $Call = F::Apply('Entity', 'Load', $Call); $Call = F::Hook('beforeDisallowDo', $Call); $Call['Where'] = F::Live($Call['Where']); // FIXME return F::Run(null, $Call['HTTP']['Method'], $Call); }); setFn('GET', function ($Call) { $Call = F::Hook('beforeDisallowGet', $Call); $Call = F::Apply('Entity.List', 'Do', $Call); $Call = F::Hook('afterDisallowGet', $Call); return $Call; }); setFn('POST', function ($Call) { $Call = F::Hook('beforeDisallowPost', $Call); $Call['Data'] = F::Run('Entity', 'Update', $Call, ['Data' => ['Verdict' => $Call['Request']['Verdict'], 'Status' => -1, 'Moderated' => F::Run('System.Time', 'Get', $Call), 'Moderator' => $Call['Session']['User']['ID']]]); $Call = F::Hook('afterDisallowPost', $Call); return $Call; });
/* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { if (!isset($Call['Bundle'])) { $Call['Bundle'] = isset($Call['Start']) ? $Call['Start'] : 'Project'; } if (!isset($Call['Option'])) { $Call['Option'] = 'Do'; } F::Log($Call['Bundle'] . ' ' . $Call['Option'] . ' started', LOG_NOTICE); $Call = F::loadOptions($Call['Bundle'] . '.Control', null, $Call); $Call = F::Apply($Call['Bundle'] . '.Control', $Call['Option'], $Call); $Call['Layouts'][] = ['Scope' => $Call['Bundle'], 'ID' => 'Control']; $Navigation = []; F::Log('Control Panel Navigation', LOG_NOTICE); if (isset($Call['Bundles'])) { foreach ($Call['Bundles'] as $Group => $Bundles) { if (in_array($Call['Bundle'], $Bundles)) { $Call['Group'] = $Group; } $GroupOptions = []; foreach ($Bundles as $Bundle) { $Options = ['ID' => $Bundle, 'Bundle' => strtr($Bundle, '.', '/'), 'URL' => '/control/' . $Bundle, 'Title' => '<l>' . $Bundle . '.Control:Title</l>', 'Group' => $Group, 'Status' => 'default']; if (isset($Call['Icons'][$Bundle])) { $Options['Icon'] = $Call['Icons'][$Bundle]; } if (($BundleOptions = F::Run($Bundle . '.Control', 'Menu', ['Bundle' => $Bundle])) !== null) {
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']; } }); setFn('Where', function ($Call) { $Call = F::Apply(null, 'Live Enum', $Call); return array_search($Call['Value'], $Call['Node']['Options']); }); setFn('Populate', function ($Call) { $Call = F::Apply(null, 'Live Enum', $Call); return array_rand($Call['Node']['Options']); });
* @date 13.08.11 * @time 22:37 */ setFn('Open', function ($Call) { if (isset($Call['IO']['FileSystem']['Append Host']) && $Call['IO']['FileSystem']['Append Host']) { $Call['Directory'] .= DS . $Call['HTTP']['Host']; } return $Call['Directory']; }); setFn('Read', function ($Call) { $Call = F::Hook('beforeFileSystemOperation', $Call); $Call = F::Hook('beforeFileSystemRead', $Call); if (isset($Call['Where'])) { $Call = F::Apply(null, 'Read.File', $Call); } else { $Call = F::Apply(null, 'Read.Directory', $Call); } $Call = F::Hook('afterFileSystemRead', $Call); $Call = F::Hook('afterFileSystemOperation', $Call); return $Call['Result']; }); setFn('Read.File', function ($Call) { foreach ($Call['Where']['ID'] as &$ID) { $ID = $Call['Link'] . DS . $ID; } $Filenames = F::findFiles($Call['Where']['ID']); if ($Filenames !== null) { $Filenames = array_reverse($Filenames); $Call['Result'] = []; foreach ($Filenames as $Filename) { $Call['Result'][] = file_get_contents($Filename);
/* 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); return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ self::_loadSource('Entity.Control'); setFn('Delete Others', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Entity', 'ID' => 'Delete']; return F::Apply('Entity.Delete', 'Do', $Call, ['Entity' => $Call['Bundle'], 'Scope' => 'Control', 'Where' => ['ID' => ['$ne' => $Call['Session']['ID']]]]); });
<?php /* Codeine * @author bergstein@trickyplan.com * @description Access Interface * @package Codeine * @version 8.x */ setFn('Check', function ($Call) { if (isset($Call['System'])) { $Call['System'] = (array) $Call['System']; foreach ($Call['System'] as $System) { $Call = F::Apply('Security.Access.' . $System, 'Check', $Call); } } return $Call['Decision']; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { F::Log('User ' . $Call['Session']['User']['ID'] . ' logged in ' . $Call['Where'], LOG_INFO, 'Security'); $Call = F::Apply('Session', 'Write', $Call, ['Session Data' => ['Secondary' => $Call['Where']]]); $Call = F::Apply('Entity', 'Load', $Call, ['Entity' => 'User']); $Call = F::Hook('afterLogin', $Call); return $Call; });
setFn('Export', function ($Call) { return F::Apply('Entity.Export', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Search', function ($Call) { return F::Apply('Entity.Search', 'Do', $Call, ['Entity' => $Call['Bundle'], 'Scope' => 'Control']); }); setFn('Allow', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Entity', 'ID' => 'Allow']; return F::Apply('Entity.Allow', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Disallow', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Entity', 'ID' => 'Disallow']; return F::Apply('Entity.Disallow', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Touch', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Entity', 'ID' => 'Touch']; return F::Apply('Entity.Touch', 'Do', $Call, ['Entity' => $Call['Bundle'], 'Scope' => 'Control']); }); setFn('Import', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Entity', 'ID' => 'Import']; return F::Apply('Entity.Import', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Populate', function ($Call) { return F::Apply('Entity.Populator', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Renumerate', function ($Call) { return F::Apply('Entity.Renumerate', 'Do', $Call, ['Entity' => $Call['Bundle']]); }); setFn('Search', function ($Call) { return F::Apply('Entity.Search', 'Do', $Call, ['Provider' => $Call['Bundle'], 'Query' => $Call['Where']]); });
} } } // Вывести $Call['Output']['Content']['Form Widget']['Action'] = isset($Call['Action']) ? $Call['Action'] : ''; } $Call = F::Hook('afterVerifyGet', $Call); return $Call; }); setFn('POST', function ($Call) { if (isset($Call['Request']['Data'])) { $Call['Data'] = $Call['Request']['Data']; } else { $Call['Data'] = []; } $Call = F::Hook('beforeVerifyPost', $Call); // Отправляем в Entity.Verify $Call['Data'] = F::Merge(F::Run('Entity', 'Read', $Call, ['Time' => microtime(true)]), F::Apply('Entity', 'Update', $Call)); // Выводим результат if (empty($Call['Errors'])) { $Call = F::Hook('afterVerifyPost', $Call); } else { foreach ($Call['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>']; } } $Call = F::Apply(null, 'GET', $Call); } return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { if (isset($Call['JS']['Compress']['Modes']) && !empty($Call['JS']['Compress']['Modes'])) { F::Log('JS Compressors loaded: ' . implode(',', $Call['JS']['Compress']['Modes']), LOG_DEBUG); foreach ($Call['JS']['Compress']['Modes'] as $Compressor) { $Call = F::Apply('View.JS.Compress.' . $Compressor, null, $Call); } } return $Call; });
for ($SI = 1; $SI <= $IndexesCount; $SI++) { $Call['Sitemap Indexes'][] = $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . '/sitemap/' . $Name . '-' . $SI . '.xml'; $Call['Output']['Content'][] = ['sitemap' => ['loc' => $Call['HTTP']['Proto'] . $Call['HTTP']['Host'] . '/sitemap/' . $Name . '-' . $SI . '.xml']]; } } return $Call; }); setFn('Show Sitemap Index', function ($Call) { $Call = F::Hook('beforeSitemapIndexShow', $Call); $Call['Output'] = ['Root' => 'sitemapindex', 'Content' => []]; $Handler = $Call['Sitemap']['Handlers'][$Call['Index']]; $Call = F::Apply($Handler['Driver'], null, $Call, $Handler); $Call = F::Hook('afterSitemapIndexShow', $Call); return $Call; }); setFn('Sitemap', function ($Call) { $Call = F::Hook('beforeSitemapShow', $Call); $Call['Output'] = ['Root' => 'urlset', 'Content' => []]; $Handler = $Call['Sitemap']['Handlers'][$Call['Index']]; $Call = F::Apply($Handler['Driver'], null, $Call, $Handler); $Call = F::Hook('afterSitemapShow', $Call); return $Call; }); setFn('Sitemaps.Generate', function ($Call) { $Call = F::Hook('beforeSitemapShow', $Call); $Call['Output'] = ['Root' => 'urlset', 'Content' => []]; $Handler = $Call['Sitemap']['Handlers'][$Call['Index']]; $Call = F::Apply($Handler['Driver'], null, $Call, $Handler); $Call = F::Hook('afterSitemapShow', $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 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; });
* @package Codeine * @version 8.x */ setFn('Do', function ($Call) { $Call = F::Apply('Entity', 'Load', $Call); if (isset($Call['Where'])) { $Call['Where'] = F::Live($Call['Where']); } // FIXME $Call = F::Hook('beforeAllowDo', $Call); if ($Call['Allow']['Mode'] == 'Confirmation') { $Call = F::Run(null, $Call['HTTP']['Method'], $Call); } elseif ($Call['Allow']['Mode'] == 'Direct') { $Call = F::Run(null, 'POST', $Call); } $Call = F::Hook('afterAllowDo', $Call); return $Call; }); setFn('GET', function ($Call) { $Call = F::Hook('beforeAllowGet', $Call); $Call = F::Apply('Entity.List', 'Do', $Call, ['Context' => 'app']); $Call['Context'] = ''; $Call = F::Hook('afterAllowGet', $Call); return $Call; }); setFn('POST', function ($Call) { $Call = F::Hook('beforeAllowPost', $Call); $Call['Data'] = F::Run('Entity', 'Update', $Call, ['Data!' => ['Status' => 1, 'Moderated' => F::Run('System.Time', 'Get', $Call), 'Moderator' => $Call['Session']['User']['ID']]]); $Call = F::Hook('afterAllowPost', $Call); return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { $Call = F::Apply(null, 'Input', $Call); $Call = F::Apply(null, 'Render', $Call); $Call = F::Apply(null, 'Output', $Call); return $Call; }); setFn('Input', function ($Call) { return $Call; }); setFn('Render', function ($Call) { return $Call; }); setFn('Output', function ($Call) { return $Call; });
$Call['Layouts'][] = ['Scope' => 'User.Login', 'ID' => isset($Call['Session']['User']['ID']) ? 'Logged' : 'Guest']; $Call = F::Hook('afterIdentificate', $Call); return $Call; }); setFn('Authenticate', function ($Call) { $Call = F::Hook('beforeAuthenticate', $Call); $Call = F::Apply('Security.Auth.' . $Call['Mode'], null, $Call); if (!empty($Call['User'])) { if (isset($Call['Request']['Remember'])) { $Call['TTL'] = $Call['TTLs']['Long']; } $Call = F::Apply('Session', 'Write', $Call, ['Session Data' => ['User' => $Call['User']['ID']]]); if ($Call['Session']['User']['ID'] == $Call['User']['ID']) { F::Log('User authorized ' . $Call['User']['ID'], LOG_INFO, 'Security'); $Call = F::Hook('afterAuthenticate', $Call); } else { F::Log('User is not authorized', LOG_INFO, 'Security'); } } else { $Call = F::Hook('Authenticating.Failed', $Call); F::Log('Authentification failed', LOG_INFO, 'Security'); } return $Call; }); setFn('Annulate', function ($Call) { $Call = F::Hook('beforeAnnulate', $Call); $Call = F::Apply('Security.Auth.' . $Call['Mode'], null, $Call); $Call['Layouts'][] = ['Scope' => 'User.Login', 'ID' => isset($Call['Session']['User']['ID']) ? 'Logged' : 'Guest']; $Call = F::Hook('afterAnnulate', $Call); return $Call; });