示例#1
0
文件: parse.php 项目: ale-roy/comp
/**
 * The merge() function merges left and right coeff's sides */
function merge($left, $right)
{
    $mrgd = array();
    apply($mrgd, $left, 1);
    apply($mrgd, $right, -1);
    return $mrgd;
}
示例#2
0
文件: iterTest.php 项目: nikic/iter
 public function testApply()
 {
     $range = range(0, 5);
     $result = [];
     apply(function ($n) use(&$result) {
         $result[] = $n;
     }, $range);
     $this->assertSame([0, 1, 2, 3, 4, 5], $result);
 }
示例#3
0
    function show($act)
    {
        $acc = current(apply($this->scheme, $this));
        //		dbg($acc);
        $acc = '<table border="1">' . "\r\n" . $acc . '</table>' . "\r\n";
        $acc = '<form method="post" id="del">
				<input type="hidden" name="act" value="del" />
				<input type="hidden" name="id" value="id" />
				</form>' . "\r\n" . '<form method="post">' . "\r\n" . $acc . "\r\n" . '<input type="hidden" name="act" value="' . $act . '" />
				<input type="submit" value="ќтправить" />
				</form>
				';
        //		dbg($acc);
        return $acc;
    }
 protected function format()
 {
     $object = $this->object;
     return preg_replace_callback(['/\\{\\{([a-zA-Z0-9_]+)(\\(([0-9a-zA-Z\\,_ ]*)\\))?(|[a-zA-Z0-9,_\\|]+)?\\}\\}/', '/:([a-zA-Z0-9_]+)/'], function ($matches) use(&$object) {
         $key = $matches[1];
         if (count($matches) > 2) {
             if ($matches[2] !== '') {
                 $params = explode(',', $matches[3]);
                 $value = call_user_func_array([$this, $key], $params);
             } else {
                 $value = $this->find($key);
             }
             $modifiers = explode("|", trim($matches[4], '|'));
             $value = apply($value, $modifiers);
         } else {
             $value = $this->find($key);
         }
         return $value;
     }, $this->template());
 }
示例#5
0
    function show()
    {
        $acc = '';
        while ($this->v = $this->each()) {
            $acc .= current(apply($this->scheme, $this));
        }
        //		dbg($acc);
        $hd = '<tr>' . "\r\n";
        foreach ($this->titles as $v) {
            $hd .= "\t" . '<th>' . $v . '</th>' . "\r\n";
        }
        $hd .= '</tr>' . "\r\n";
        //		dbg($hd);
        $acc = $hd . $acc;
        $acc = '<table border="1">' . "\r\n" . $acc . '</table>' . "\r\n";
        $acc = '<form method="post" id="del">
				<input type="hidden" name="act" value="del" />
				<input type="hidden" name="id" value="id" />
				</form>' . "\r\n" . $acc;
        //		dbg($acc);
        return $acc;
    }
				mapcraft.pieces as p, 
				mapcraft.pieces_comments as c 

			WHERE 
				c.piece = p.id AND type = \'info\' AND p.pie = pies.id

			ORDER BY
				timestamp DESC LIMIT 1
			)
		WHERE pies.updated IS NULL');
}
function revert()
{
    global $connection;
    pg_query($connection, 'ALTER TABLE pies DROP COLUMN updated');
}
#
# Main
#
try {
    if (count($argv) > 1 && $argv[1] == '-r') {
        echo "Reverting ...\n";
        revert();
    } else {
        echo "Applying ...\n";
        apply();
    }
} catch (Exception $e) {
    echo "Error: " . $e->getMessage() . "\n";
    exit(1);
}
示例#7
0
文件: ch04.php 项目: luijar/fp-php
};
$divide = function ($a, $b) {
    return $a / $b;
};
apply($add)(5, 5);
//-> 10
apply($divide, 5, 5);
//-> 1
println(apply($add)(5, 5));
println(apply($divide)(5, 5));
$safeDivide = function ($a, $b) {
    return empty($b) ? NAN : $a / $b;
};
apply($safeDivide)(5, 0);
//-> NAN
println(apply($safeDivide)(5, 0));
require_once '../../vendor/autoload.php';
require_once '../ch08/model/User.php';
require_once '../ch08/model/Account.php';
use Model\Account;
use Model\User;
use Rx\Observable;
use Rx\Observer;
// SELECT firstname
// FROM users
// WHERE firstname IS NOT NULL
// ORDER BY firstname DESC
// LIMIT 1;
print_r(P::pipe('\\Model\\User::query', P::map(P::prop('firstname')), P::filter(function ($n) {
    return !empty($n);
}), 'P::reverse', P::take(1))());
<?php

/**
 * Somewhere within your application:
 * 
 * This is just an example of what you can do.
 */
namespace FileSystem;

class Space extends Directory
{
}
$application->bind('FileSystem\\Space', function (User $user) {
    return new Space($user->allocatedSpacePath);
});
// In your business logic:
use FileSystem\File;
use FileSystem\FileSystem;
use FileSystem\Space;
when('i want to make a directory inside my space', then(apply(a(function (FileSystem $fileSystem, Space $space, File $file) {
    $fileSystem->write($file, inside($space));
}))));
示例#9
0
/**
 * Returns `$a >= $b`.
 *
 * @signature * -> * -> Boolean
 * @param  mixed $a
 * @param  mixed $b
 * @return bool
 */
function gte()
{
    return apply(curry(function ($a, $b) {
        return $a >= $b;
    }), func_get_args());
}
示例#10
0
/**
 * Processes a single talk page from the JoindIn API.
 *
 * Because this processor requires the event as the first parameter, it must
 * be partially applied before passed to fetchPages().
 *
 * @param array $event
 *   The event record these talk pages are associated with.
 * @param \SplQueue $pages
 *   A queue of pages in the current processing set.
 * @param \Psr\Http\Message\ResponseInterface $response
 *   The response for a single page.
 * @param int $index
 *   The index of the page being processed, 0-based.
 */
function processTalkPage(array $event, \SplQueue $pages, ResponseInterface $response, $index)
{
    $talks = new TalksResponse($response);
    if ($next = $talks->nextPage()) {
        $pages->enqueue($next);
    }
    apply($talks, function ($talk) use($event) {
        //print "Processing Talk: {$talk['talk_title']}" . PHP_EOL;
        addTalkToDatabase($event, $talk);
    });
    //print "Downloaded Talk Page {$index}" . PHP_EOL;
}
示例#11
0
/**
 * Converts a variable to its string value.
 * ```php
 * toString(53)); // '53'
 * toString(true)); // 'true'
 * toString(false)); // 'false'
 * toString(null)); // 'null'
 * toString('Hello World')); // '"Hello World"'
 * toString([])); // '[]'
 * toString(new \stdClass)); // '{}'
 * toString(function(){})); // '[Function]'
 * toString(Error::of('Ooops'))); // '[Error: Ooops]'
 * toString(fopen('php://temp', 'r'))); // '[Resource]'
 * toString(['hi', 'hello', 'yo'])); // '["hi", "hello", "yo"]'
 * toString([
 *     'object' => Stream::of(null),
 *     'numbers' => [1, 2, 3],
 *     'message'
 * ]); // '{object: Stream(Null), numbers: [1, 2, 3], 0: "message"]'
 * ```
 *
 * @signature * -> String
 * @param  mixed $something
 * @return string
 */
function toString()
{
    $toString = function ($something) {
        switch (type($something)) {
            case 'String':
                return "\"{$something}\"";
                break;
            case 'Boolean':
                return $something ? 'true' : 'false';
                break;
            case 'Null':
                return 'null';
                break;
            case 'Number':
                return (string) $something;
                break;
            case 'List':
                return '[' . join(', ', map(toString(), $something)) . ']';
                break;
            case 'Error':
            case 'Stream':
                return $something->__toString();
            case 'Object':
            case 'Array':
                return '{' . join(', ', map(function ($pair) {
                    return $pair[0] . ': ' . toString($pair[1]);
                }, toPairs($something))) . '}';
            default:
                return '[' . type($something) . ']';
        }
    };
    return apply(curry($toString), func_get_args());
}
示例#12
0
/**
 * Converts an array to an associative array, based on the result of calling `$fn`
 * on each element, and grouping the results according to values returned.
 * Note that `$fn` should take an item from the list and return a string.
 * ```php
 * $persons = [
 *     ['name' => 'foo', 'age' => 11],
 *     ['name' => 'bar', 'age' => 9],
 *     ['name' => 'baz', 'age' => 16],
 *     ['name' => 'zeta', 'age' => 33],
 *     ['name' => 'beta', 'age' => 25]
 * ];
 * $phase = function($person) {
 *     $age = $person['age'];
 *     if ($age < 13) return 'child';
 *     if ($age < 19) return 'teenager';
 *     return 'adult';
 * };
 * groupBy($phase, $persons);
 * // [
 * //  'child' => [['name' => 'foo', 'age' => 11], ['name' => 'bar', 'age' => 9]],
 * //  'teenager' => [['name' => 'baz', 'age' => 16]],
 * //  'adult' => [['name' => 'zeta', 'age' => 33], ['name' => 'beta', 'age' => 25]]
 * // ]
 * ```
 *
 * @signature (a -> String) -> [a] -> {String: a}
 * @param  callable $fn
 * @param  array $list
 * @return array
 */
function groupBy()
{
    $groupBy = function ($fn, $list) {
        return reduce(function ($result, $item) use($fn) {
            $index = $fn($item);
            if (!isset($result[$index])) {
                $result[$index] = [];
            }
            $result[$index][] = $item;
            return $result;
        }, [], $list);
    };
    return apply(curry($groupBy), func_get_args());
}
    $user = $tmp[2];
    $date = time();
    $cmd = "SELECT * FROM `jos_users` WHERE id=" . $acc;
    $inf = mysql_fetch_assoc(mysql_query($cmd));
    $inc = $inf['mua_' . $add] + $count;
    $cmd = "UPDATE `jos_users` SET mua_" . $add . '=' . $inc . ' WHERE id=' . $acc;
    mysql_query($cmd);
    $cmd = "INSERT INTO `jos_history` (userid,time,method," . $add . ",tongcong) VALUES (" . $user . "," . $date . ",'Tin nhắn SMS','" . $count . "|" . $price / $count . "'," . $price . ")";
    mysql_query($cmd);
    response($phone, $note);
}
switch ($tmp[1]) {
    case 'NUP':
        apply('day tin', 1, 5000);
        break;
    case 'NDD':
        apply('danh dau tin', 2, 10000);
        break;
    case 'NNB':
        apply('noi bat tin', 3, 15000);
        break;
    case 'MUP':
        buy('nap quyen day tin', 1, 2, 5000);
        break;
    case 'MDD':
        buy('nap quyen danh dau tin', 2, 1, 10000);
        break;
    case 'MNB':
        buy('nap quyen noi bat tin', 3, 1, 15000);
        break;
}
示例#14
0
// ADD_BREADCRUMBS
$BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
// ---------------------------
if (!$bFlagLastModule) {
    return;
}
// ---------------------------
$scheme = file_get_contents(FLGR_SCHEMES . '/gr_base.txt');
$EnvBase = new EnvGroup($off, $scheme, DB_PREFIX . DB_TBL_GROUPS);
$base = current(apply(parse($scheme), $EnvBase));
$scheme = file_get_contents(FLGR_SCHEMES . '/gr_chk.txt');
$EnvChk = new EnvGroup($off, $scheme, DB_PREFIX . DB_TBL_GROUPS);
$chk = current(apply(parse($scheme), $EnvChk));
$scheme = file_get_contents(FLGR_SCHEMES . '/gr_rad.txt');
$EnvRad = new EnvGroup($off, $scheme, DB_PREFIX . DB_TBL_GROUPS);
$radioblock = current(apply(parse($scheme), $EnvRad));
//dbg($radioblock);
// CONTROLLER
//dbg($_POST);
if (isset($_POST['act'])) {
    unset($_POST['act']);
    //	dbg($_POST);
    $EnvBase->save($_POST['values']);
    unset($_POST['values']);
    $EnvChk->save($_POST);
    $EnvRad->save($_POST);
    header('Location: ' . $sRequest);
    include_once FLGR_COMMON . '/exit.php';
}
// CSS
stylesheet('profile.css');
示例#15
0
}, 'lte' => function ($x, $y) {
    return $x <= $y;
}, 'gte' => function ($x, $y) {
    return $x >= $y;
}, 'instance' => function ($x, $y) {
    return $x instanceof $y;
}, 'power' => nary('pow', 2), 'apply' => nary('call_user_func'), 'array_' => nary('func_get_args'), 'discard_keys' => function ($arr) {
    return array_combine($arr, $arr);
}, 'map' => nary('array_map', 2), 'map_keys' => function ($f, $a) {
    return array_combine(map($f, keys($a)), $a);
}, 'flip' => function ($f) {
    return nary(function ($x, $y) use($f) {
        return $f($y, $x);
    }, arity($f));
}]);
defuns(['with' => flip(apply(2)), 'over' => flip('map')]);
function compose($a, $b)
{
    $funcs = array_reverse(func_get_args());
    $f = op(array_shift($funcs));
    return function ($x) use($funcs, $f) {
        static $curried = true;
        return array_reduce($funcs, function ($x, $f) {
            return call_user_func(op($f), $x);
        }, call_user_func_array($f, func_get_args()));
    };
}
defun('implode_', 'implode');
defun('join_', implode_(''));
defun('concat', function ($n) {
    return compose('join_', array_($n));
示例#16
0
	include_once('ressources/class.ldap.inc');
	include_once('ressources/class.users.menus.inc');
	include_once('ressources/class.clamav.inc');

	$user=new usersMenus();
	if($user->AsSystemAdministrator==false){
		$tpl=new templates();
		echo "alert('". $tpl->javascript_parse_text("{ERROR_NO_PRIVS}")."');";
		die();exit();
	}
	
	if(isset($_GET["popup"])){popup();exit;}
	if(isset($_POST["CloseWizard"])){CloseWizard();exit;}
	if(isset($_POST["RoundCubeMySQLServiceType"])){MySQLSyslogType_save();exit;}
	if(isset($_POST["ListenPort"])){MySQLSyslogType_save();exit;}
	if(isset($_POST["apply"])){apply();exit;}
	if(isset($_POST["RemotePort"])){remote_save();exit;}
	
	if(isset($_GET["Next1"])){Next1();exit;}
	if(isset($_GET["Next2"])){Next2();exit;}
	if(isset($_GET["Next3"])){Next3();exit;}
js();
	
function js(){
	$usersmenus=new usersMenus();
	$tpl=new templates();
	$page=CurrentPageName();		
	header("content-type: application/x-javascript");
	$title=$tpl->_ENGINE_parse_body("{APP_ROUNDCUBE_DB}");
	echo "YahooWin3('700','$page?popup=yes','$title')";
	
示例#17
0
/**
 * Zips the iterables that were passed as arguments.
 *
 * Afterwards keys and values will be arrays containing the keys/values of
 * the individual iterables. This function stops as soon as the first iterable
 * becomes invalid.
 *
 * Examples:
 *
 *     iter\zip([1, 2, 3], [4, 5, 6], [7, 8, 9])
 *     => iter([1, 4, 7], [2, 5, 8], [3, 6, 9])
 *
 * @param mixed[] ...$iterables Iterables to zip
 *
 * @return \Iterator
 */
function zip()
{
    $iterators = array_map('iter\\toIter', func_get_args());
    for (apply(fn\method('rewind'), $iterators); all(fn\method('valid'), $iterators); apply(fn\method('next'), $iterators)) {
        (yield toArray(map(fn\method('key'), $iterators)) => toArray(map(fn\method('current'), $iterators)));
    }
}
示例#18
0
/**
 * Computes the product of an array of numbers.
 * ```php
 * product([1, 2, 3, 4]) // 24
 * product([]) // 1
 * ```
 *
 * @signature [Number] -> Number
 * @param  array $numbers
 * @return int|float
 */
function product()
{
    return apply(curry(function ($numbers) {
        return reduce(multiply(), 1, $numbers);
    }), func_get_args());
}
示例#19
0
文件: process.php 项目: guoyu07/NYAF
    exit;
}
$startdir = isset($argv[2]) ? $argv[2] : '.';
echo "Constructing list of all xml-files (may take a while)...";
$files = all_xml_files($startdir);
echo " done (" . count($files) . " xml files found)\n";
foreach ($files as $file) {
    echo "[Processing {$file}]\n";
    $fp = fopen($file, 'r');
    $old = fread($fp, filesize($file));
    fclose($fp);
    if (!$old) {
        echo "WARNING: problem reading {$file}, skipping\n";
        continue;
    }
    $new = apply($old);
    if ($new === FALSE) {
        echo "NO MODIFICATION: {$file} not modified\n";
    } else {
        $fp = fopen($file, 'w');
        $res = fwrite($fp, $new);
        fclose($fp);
        if (!$res) {
            echo "WARNING: problem writing {$file}, file might be damaged\n";
            continue;
        }
    }
}
/* Utility functions: */
function all_xml_files($startdir)
{
示例#20
0
function apply($in, &$env)
{
    //	dbg($env);
    $prepare_call = '
		$arguments = $in;
		array_shift($arguments);
		foreach ($arguments as $c=>$w) {
			if (is_array($w)) {
				$arguments[$c] = apply($w, $env);
			}
		}
	';
    foreach ($in as $k => $v) {
        if (is_array($v)) {
            $in[$k] = apply($v, $env);
        } else {
            if ($k == 0) {
                if (method_exists($env, 'method_exist') && $env->method_exist($v)) {
                    eval($prepare_call);
                    return $env->call_method($v, $arguments);
                } elseif (method_exists($env, $v)) {
                    eval($prepare_call);
                    return call_user_func_array(array(&$env, $v), $arguments);
                }
            }
        }
    }
    return $in;
}
示例#21
0
文件: lib.php 项目: blackwood/vervel
function distinct()
{
    $args = func_get_args();
    return apply('array_unique', $args);
}
示例#22
0
<?php

use FileSystem\File;
use FileSystem\FileSystem;
when('i want to rename a file', then(apply(a(function (FileSystem $fileSystem, File $file) {
    $fileSystem->rename($file);
}))));
/*
|--------------------------------------------------------------------------
| Notes: renaming behind the scenes.
|--------------------------------------------------------------------------
|
| Behind the scenes in your technical code you call:
| $file->renameTo ( 'new name' );
|
| The business code here can choose to save it to the file
| system as it has done in the above code. Other options
| might include just ignoring the technical provided name
| and renaming the file to something else.
*/
示例#23
0
<?php

use FileSystem\Directory;
use FileSystem\FileSystem;
when('i want to make a new directory', then(apply(a(function (FileSystem $fileSystem, Directory $directory) {
    $fileSystem->make($directory);
}))));
示例#24
0
/**
 * Checks if a list of attribute/value of an object/array passes any of the given predicates.
 * ```php
 * $persons = [
 *     ['name' => 'foo', 'age' => 11],
 *     ['name' => 'bar', 'age' => 9],
 *     ['name' => 'baz', 'age' => 16],
 *     ['name' => 'zeta', 'age' => 33],
 *     ['name' => 'beta', 'age' => 25]
 * ];
 * 
 * $isValid = satisfiesAny([
 *     'name' => startsWith('b'),
 *     'age' => gt(__(), 15)
 * ]);
 * 
 * filter($isValid, $persons);
 * // [
 * //   ['name' => 'bar', 'age' => 9],
 * //   ['name' => 'baz', 'age' => 16],
 * //   ['name' => 'zeta', 'age' => 33],
 * //   ['name' => 'beta', 'age' => 25]
 * // ]
 * ```
 *
 * @signature {String: (a -> Boolean)} -> {k : a} -> Boolean
 * @param  array $predicates
 * @param  mixed $object
 * @return bool
 */
function satisfiesAny()
{
    $satisfiesAny = function ($predicates, $object) {
        $predicates = map(function ($pair) {
            return satisfies($pair[1], $pair[0]);
        }, toPairs($predicates));
        $predicates = apply(_f('any'), $predicates);
        return $predicates($object);
    };
    return apply(curry($satisfiesAny), func_get_args());
}
示例#25
0
文件: bento.php 项目: nramenta/bento
/**
 * Dispatches incoming request. This function may trigger the 'before',
 * and 'after' events.
 *
 * @param string $method Request method
 * @param string $path   Request path
 */
function dispatch($method, $path)
{
    $callbacks = route();
    foreach ($callbacks as $route => $methods) {
        if (route_match($route, $path, $matches, $redirect)) {
            if ($redirect) {
                $url = url_for($path . '/' . (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) ? '?' . $_SERVER['QUERY_STRING'] : ''));
                redirect($url, 301);
            }
            config('_route', $route);
            if ($method === 'HEAD') {
                if (isset($methods['HEAD'])) {
                    $callback = $methods['HEAD'];
                } elseif (isset($methods['GET'])) {
                    $callback = $methods['GET'];
                } else {
                    $callback = null;
                }
            } elseif ($method === 'OPTIONS') {
                $allowed = array_keys($methods);
                if (in_array('GET', $allowed) && !in_array('HEAD', $allowed)) {
                    $allowed[] = 'HEAD';
                }
                header('Allow: ' . implode(',', $allowed));
                if (isset($methods['OPTIONS'])) {
                    $callback = $methods['OPTIONS'];
                } else {
                    halt();
                }
            } else {
                $callback = isset($methods[$method]) ? $methods[$method] : null;
            }
            if (!isset($callback)) {
                $allowed = array_keys($methods);
                if (in_array('GET', $allowed) && !in_array('HEAD', $allowed)) {
                    $allowed[] = 'HEAD';
                }
                header('Allow: ' . implode(',', array_keys($methods)));
                halt(405);
            }
            $params = array();
            foreach ($matches as $key => $val) {
                if (is_string($key)) {
                    params($key, $params[$key] = urldecode($val));
                }
            }
            $pass = false;
            try {
                ($before = before()) && apply($before, $params);
                apply($callback, $params);
                ($after = after()) && apply($after, $params);
            } catch (\PassException $e) {
                $pass = true;
            }
            if (!$pass) {
                return;
            }
        }
    }
    halt(404);
}
示例#26
0
文件: fn.php 项目: jgswift/filtratr
/**
 * Helper function to create reduce query
 * @param mixed $callable
 * @param array $data
 * @return \filtratr\ArrayQuery|\filtratr\ObjectQuery
 */
function reduce($callable, array $data)
{
    $query = apply($data)->reduce($callable);
    return $query();
}
示例#27
0
$sTpl = microkernel(FLGR_TEMPLATES . '/' . $sModuleTpl . '.htm');
$_t = new KTemplate();
$_t->loadTemplateContent($sTpl);
//dbg($_POST, 'wef');
// SCHEME
if (!file_exists(FLGR_SCHEMES . '/registration.txt')) {
    die('Scheme not found');
}
$scheme = file_get_contents(FLGR_SCHEMES . '/registration.txt');
//dbg(parse($scheme));
// ENV
$user_id = 0;
$EnvUser = new EnvUser($user_id, $scheme, DB_PREFIX . DB_TBL_USERS);
//dbg($EnvUser);
// VIEW
$view = apply(parse($scheme), $EnvUser);
//dbg($view, '$view');
$view = join('', $view);
//echo $v;
// CONTROLLER
if (isset($_POST['act'])) {
    //	dbg($_POST);
    switch ($_POST['act']) {
        case 'registration':
            if (isset($_POST['rules'])) {
                if (isset($_POST['18year'])) {
                    $acc = 'if (' . "\r\n";
                    foreach (current(parse(file_get_contents(FLGR_SCHEMES . '/registration.txt'))) as $v) {
                        if (is_array($v)) {
                            $acc .= '(!empty($_POST["values"]["' . $v[1] . '"])) &&' . "\r\n";
                        }
示例#28
0
    header('Location: ' . $sRequest . '/main');
    include_once FLGR_COMMON . '/exit.php';
}
// user_id
$user_id = $Permissions->getLoggedUserId();
//dbg($user_id);
// SCHEME
if (!file_exists(FLGR_SCHEMES . '/' . $aRequest[$nLevel + 1] . '.txt')) {
    die('Scheme not found');
}
$scheme = file_get_contents(FLGR_SCHEMES . '/' . $aRequest[$nLevel + 1] . '.txt');
//Console::log(parse($scheme));
// ENV
$EnvUser = new EnvUser($user_id, $scheme, DB_PREFIX . DB_TBL_USERS);
// VIEW
$view = current(apply(parse($scheme), $EnvUser));
//dbg($view, '$view');
//echo $view;
// CONTROLLER
if (isset($_POST['act'])) {
    switch ($_POST['act']) {
        case 'frm':
            Console::log($_POST);
            $EnvUser->save($_POST['values']);
            header('Location: ' . $sRequest);
            include_once FLGR_COMMON . '/exit.php';
            break;
        default:
            Console::log($_POST);
            break;
    }
<?php

use FileSystem\FileSystem;
use FileSystem\File;
when('i want to delete a file', then(apply(a(function (FileSystem $fileSystem, File $file) {
    $fileSystem->delete($file);
    echo $file->content;
}))));
/*
|--------------------------------------------------------------------------
| Note: The file stays intact.
|--------------------------------------------------------------------------
|
| After you call delete with $file on the file system it goes
| through the delete process of the file system, it is being 
| removed from the file tree and it is removed from the 
| parent inside the file tree. 
|
| BUT: The file stays intact, all its data and even the parent
| will stay intact meaning you can do with that file whatever
| you want.
*/
示例#30
0
<?php

// ADD_BREADCRUMBS
$BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
// ---------------------------
if (!$bFlagLastModule) {
    return;
}
// ---------------------------
$scheme = file_get_contents(FLGR_SCHEMES . '/gr_new.txt');
$EnvNew = new EnvGroup(0, $scheme, DB_PREFIX . DB_TBL_GROUPS);
$gr_new = current(apply(parse($scheme), $EnvNew));
//dbg($gr_new);
// POST
if (isset($_POST['act'])) {
    switch ($_POST['act']) {
        case 'frm':
            //			dbg($_POST);
            unset($_POST['act']);
            header('Location: /group/' . $Groups->create($_POST['values']));
            include_once FLGR_COMMON . '/exit.php';
            break;
        default:
            //			dbg($_POST);
            break;
    }
}
FirstBreadCrumb($Permissions->getLoggedUserId());
stylesheet('profile.css');
// OPEN
if ('' == $sModuleTpl) {