<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Check', function ($Call) { return F::file_exists(Root . '/locks/' . $Call['ID']); }); setFn('Toggle', function ($Call) { return F::file_exists(Root . '/locks/' . $Call['ID']) ? unlink(Root . '/locks/' . $Call['ID']) : touch(Root . '/locks/' . $Call['ID']); });
} } return null; }); setFn('Filename', function ($Call) { $Call = F::Hook('beforeFileSystemOperation', $Call); return DS . array_pop($Call['Where']['ID']); }); setFn('Exist', function ($Call) { $Call = F::Hook('beforeFileSystemOperation', $Call); if (empty($Call['Where']['ID'])) { $Call['Result'] = false; } else { foreach ($Call['Where']['ID'] as $ID) { $Filename = F::findFile($Call['Link'] . DS . $ID); $Call['Result'] = F::file_exists($Filename); } } $Call = F::Hook('afterFileSystemOperation', $Call); return $Call['Result']; }); setFn('Status', function ($Call) { $Call = F::Hook('beforeFileSystemOperation', $Call); $ic = 0; $Directory = new RecursiveDirectoryIterator(Root . '/' . $Call['Path']); $Iterator = new RecursiveIteratorIterator($Directory); $Regex = new RegexIterator($Iterator, '/' . $Call['Prefix'] . '(.+)' . $Call['Postfix'] . '$/i', RecursiveRegexIterator::GET_MATCH); foreach ($Regex as $File) { $ic++; } $Call = F::Hook('afterFileSystemOperation', $Call);
<?php /* Codeine * @author bergstein@trickyplan.com * @description Exec Parslet * @package Codeine * @version 6.0 */ setFn('Parse', function ($Call) { foreach ($Call['Parsed'][2] as $Ix => $Match) { if (empty($Match)) { $Match = ''; } else { if (F::file_exists($Filename = Root . '/Data/' . $Match)) { $Pathinfo = pathinfo($Match); $Filesize = F::Run('Formats.Number.Filesize', 'Do', ['Value' => filesize($Filename)]); // FIXME $Data = ['URL' => $Match, 'Filename' => $Pathinfo['basename'], 'Filesize' => $Filesize, 'Extension' => $Pathinfo['extension']]; $Match = F::Run('View', 'Load', $Call, ['Scope' => 'View/HTML/Parslets', 'ID' => 'File', 'Data' => $Data]); } else { $Match = ''; } } $Call['Output'] = str_replace($Call['Parsed'][0][$Ix], $Match, $Call['Output']); } return $Call; });
<?php /* Codeine * @author bergstein@trickyplan.com * @description * @package Codeine * @version 8.x */ setFn('Do', function ($Call) { $Call['Layouts'][] = ['Scope' => 'Project', 'ID' => 'Status']; if (F::file_exists(Root . '/Options/Version.json')) { $Call[$Call['Project']['ID']]['MTime'] = filemtime(Root . '/Options/Version.json'); } return $Call; }); setFn('Menu', function ($Call) { $Call['Project'] = F::Live(F::loadOptions('Project')); $Call['Version'] = F::loadOptions('Version'); if (isset($Call['Version'])) { return ['Count' => $Call['Version'][$Call['Project']['ID']]['Major'] . '.' . $Call['Version'][$Call['Project']['ID']]['Minor']]; } else { return null; } });
return null; } }); setFn('Exist', function ($Call) { if (!isset($Call['Scope'])) { $Call['Scope'] = 'Default'; } else { if (is_array($Call['Scope'])) { $Call['Scope'] = implode(DS, $Call['Scope']); } } $Postfix = isset($Call['Postfix']) ? $Call['Postfix'] : ''; $Prefix = isset($Call['Prefix']) ? $Call['Prefix'] : ''; if (!empty($Call['Where']['ID'])) { $Filename = F::findFile($Call['Link'] . '/' . $Call['Scope'] . '/' . $Prefix . $Call['Where']['ID'] . $Postfix); return F::file_exists($Filename); } else { return false; } }); setFn('Status', function ($Call) { if (!isset($Call['Scope'])) { $Call['Scope'] = 'Default'; } else { if (is_array($Call['Scope'])) { $Call['Scope'] = implode(DS, $Call['Scope']); } } $Postfix = isset($Call['Postfix']) ? $Call['Postfix'] : ''; $Prefix = isset($Call['Prefix']) ? $Call['Prefix'] : ''; $Path = $Call['Link'] . '/' . $Call['Scope'] . '/';
<?php /* Codeine * @author bergstein@trickyplan.com * @description: * @package Codeine * @version 8.x * @date 13.08.11 * @time 22:37 */ setFn('Open', function ($Call) { if (F::file_exists($Call['Directory'] . '/' . $Call['Filename'])) { $Call['Link'] = (array) jd(file_get_contents($Call['Directory'] . '/' . $Call['Filename']), true); } else { $Call['Link'] = []; } return $Call['Link']; }); setFn('Read', function ($Call) { $Result = array_shift($Call['Link']); file_put_contents($Call['Directory'] . '/' . $Call['Filename'], j($Call['Link'], JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); return $Result; }); setFn('Write', function ($Call) { array_push($Call['Link'], $Call['Data']); return file_put_contents($Call['Directory'] . '/' . $Call['Filename'], j($Call['Link'], JSON_NUMERIC_CHECK | JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); }); setFn('Count', function ($Call) { return count($Call['Link']); }); setFn('Close', function ($Call) {