本文整理汇总了PHP中after函数的典型用法代码示例。如果您正苦于以下问题:PHP after函数的具体用法?PHP after怎么用?PHP after使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了after函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
function handle($uri = '')
{
try {
if (($matched = dispatch($uri)) != null) {
if (!before()) {
$handler = $matched['handler'];
if (!empty($matched['options']['router'])) {
$handler = call_user_func($handler, $matched);
}
if (!empty($matched['options']['create'])) {
$controllerClass = $handler[0];
$handler[0] = new $controllerClass();
}
if (isset($matched['params'])) {
call_user_func_array($handler, $matched['params']);
} else {
call_user_func_array($handler, $matched['segments']);
}
after();
}
} else {
notFound();
}
finish();
} catch (Exception $e) {
error_log($e->getMessage());
error_log($e->getTraceAsString());
}
exit;
}
示例2: authorize
function authorize($data = null)
{
global $authorized;
before();
?>
<div id="xicl-error" style="">
<table id="xicl-error-content"><tr><td>
<?php
login();
// показываем форму входа/выхода
?>
<?php
if (_has('message')) {
?>
<p class="message"><?php
echo _data('message');
?>
</p>
<?php
}
?>
</td></tr></table>
<a href="./" id="xicl-error-home" title="на главную"> </a>
</div>
<?php
after();
die;
// прекратить дальнейшую работу
}
示例3: pubData
function pubData($r, $i)
{
$pubd = array();
array_push($pubd, between('Artiste :', 'Matériaux :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, between('Matériaux :', 'Support :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, between('Support :', 'Format :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, between('Format :', 'Style :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, between('Style :', 'Prix :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, between('Conversion :', 'Référence :', $r['hits']['hits'][$i]['_source']['pubDate']));
array_push($pubd, after('Référence :', $r['hits']['hits'][$i]['_source']['pubDate']));
return $pubd;
}
示例4: getPlayerSkin
function getPlayerSkin($input, $list)
{
if ($input !== '[]') {
$name = after('[`', $input);
$name = before('`', $name);
if (in_array($name, $list)) {
return $name;
} else {
return "Default";
}
} else {
return "Default";
}
}
示例5: fail
function fail($message)
{
global $messages;
before();
?>
<div id="xicl-error" style="">
<table id="xicl-error-content"><tr><td>
<p class="message error"><?php
echo is_string($message) ? $message : (is_int($message) ? $messages[$message] : 'unknown param for fail page');
?>
</p>
</td></tr></table>
<a href="<?php
echo ServerRoot;
?>
" id="xicl-error-home" title="на главную"> </a>
</div>
<?php
after();
die;
// прекратить дальнейшую работу
}
示例6: gensuite
public static function gensuite($config = array(), $current_depth = 1)
{
$config = array_merge(array('befores' => 0, 'before_alls' => 0, 'afters' => 0, 'after_alls' => 0, 'tests' => 1, 'depth' => 0, 'describes' => array('L', 'R'), 'callbacks' => array('it' => function ($ctx) {
expect(true)->to->eql(true);
}, 'before' => function ($ctx) {
$ctx->value = 3;
}, 'before_all' => function ($ctx) {
$ctx->value = 5;
}, 'after' => function ($ctx) {
$ctx->value = 7;
}, 'after_all' => function ($ctx) {
$ctx->value = 11;
})), $config);
if ($config['depth'] == 0) {
return;
}
foreach ($config['describes'] as $side) {
describe("Level {$side}{$current_depth}", function ($ctx) use($config, $current_depth) {
for ($i = 1; $i <= $config['tests']; $i++) {
it("nested {$i}", $config['callbacks']['it']);
}
for ($i = 1; $i <= $config['befores']; $i++) {
before($config['callbacks']['before']);
}
for ($i = 1; $i <= $config['before_alls']; $i++) {
before_all($config['callbacks']['before_all']);
}
for ($i = 1; $i <= $config['after_alls']; $i++) {
after_all($config['callbacks']['after_all']);
}
for ($i = 1; $i <= $config['afters']; $i++) {
after($config['callbacks']['after']);
}
$config['depth']--;
Util::gensuite($config, $current_depth + 1);
});
}
}
示例7: after
after('deploy:symlink', 'deploy:cron:enable');
task('deploy:database:update', function () {
run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console doctrine:schema:update --env={{env}} --force');
});
after('deploy:vendors', 'deploy:database:update');
task('elastica:populate', function () {
run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console fos:elastica:populate --env=\'prod\'');
});
task('php:restart', function () {
run('sudo service {{php_fpm}} restart');
});
after('deploy', 'php:restart');
task('elastica:populate', function () {
run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console fos:elastica:populate --env=\'prod\'');
});
task('elastica:populate:current', function () {
run('php {{deploy_path}}/current/' . trim(get('bin_dir'), '/') . '/console fos:elastica:populate --env=\'prod\'');
});
task('seo:dump', function () {
run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console seo:metatag:patterns --env=\'prod\'');
run('php {{release_path}}/' . trim(get('bin_dir'), '/') . '/console seo:sitemap --env=\'prod\'');
});
task('deploy:cleanup', function () {
run('rm -f {{release_path}}/Vagrantfile*');
run('rm -f {{release_path}}/deploy.php');
run('rm -rf {{release_path}}/.git');
run('rm -f {{release_path}}/README*');
run('rm -f {{release_path}}/build.xml');
});
after('cleanup', 'deploy:cleanup');
示例8: server
require 'recipe/drupal8.php';
server('prod', '146.185.128.63', 9999)->user('deploy')->identityFile()->stage('production')->env('deploy_path', '/usr/share/nginx/html/kristiankaadk');
set('repository', 'git@github.com:kaa4ever/kristiankaadk.git');
task('deploy:permissions', function () {
run('if [ -d {{deploy_path}}/shared ]; then sudo chown -R deploy:deploy {{deploy_path}}/shared; fi');
run('if [ -d {{deploy_path}}/releases ]; then sudo chown -R deploy:deploy {{deploy_path}}/releases; fi');
});
task('docker:reboot', function () {
cd('{{release_path}}');
run('docker stop kristiankaa.site || true');
run('docker rm kristiankaa.site || true');
run('docker-compose -f docker-compose.prod.yml up -d');
});
task('drush:make', function () {
writeln("<info>Drush: Building site</info>");
run('docker exec kristiankaa.site bash -c "cd /var/www/html && drush make site.make -y"');
});
task('drush:updb', function () {
writeln("<info>Drush: Updating database</info>");
run('docker exec kristiankaa.site drush updb -y --root=/var/www/html');
});
task('drush:cache', function () {
writeln("<info>Drush: Rebuilding cache</info>");
run('docker exec kristiankaa.site drush cr --root=/var/www/html');
});
after('deploy:prepare', 'deploy:permissions');
after('deploy:update_code', 'docker:reboot');
after('deploy:update_code', 'drush:make');
after('deploy', 'drush:updb');
after('deploy', 'drush:cache');
示例9: task
<?php
namespace Deployer;
/**
* @author Benjamin HUBERT <benjamin@alpixel.fr>
*/
/**
* SEO
*/
task('seo:meta-tags', function () {
run("php {{release_path}}/" . trim(get('bin_dir'), '/') . "/console alpixel:seo:metatag:dump --env='prod'");
})->desc('Dump meta tags');
task('seo:sitemap', function () {
run("php {{release_path}}/" . trim(get('bin_dir'), '/') . "/console alpixel:cms:sitemap --env='prod'");
})->desc('Dump sitemap');
after('deploy:vendors', 'seo:meta-tags');
after('deploy:vendors', 'seo:sitemap');
示例10: run
/**
* Running application
*
* @param string $env
* @return void
*/
function run($env = null)
{
if (is_null($env)) {
$env = env();
}
# 0. Set default configuration
$root_dir = dirname(app_file());
$base_path = dirname(file_path($env['SERVER']['SCRIPT_NAME']));
$base_file = basename($env['SERVER']['SCRIPT_NAME']);
$base_uri = file_path($base_path, $base_file == 'index.php' ? '?' : $base_file . '?');
$lim_dir = dirname(__FILE__);
option('root_dir', $root_dir);
option('base_path', $base_path);
option('base_uri', $base_uri);
// set it manually if you use url_rewriting
option('limonade_dir', file_path($lim_dir));
option('limonade_views_dir', file_path($lim_dir, 'limonade', 'views'));
option('limonade_public_dir', file_path($lim_dir, 'limonade', 'public'));
option('public_dir', file_path($root_dir, 'public'));
option('views_dir', file_path($root_dir, 'views'));
option('controllers_dir', file_path($root_dir, 'controllers'));
option('lib_dir', file_path($root_dir, 'lib'));
option('error_views_dir', option('limonade_views_dir'));
option('env', ENV_PRODUCTION);
option('debug', true);
option('session', LIM_SESSION_NAME);
// true, false or the name of your session
option('encoding', 'utf-8');
option('x-sendfile', 0);
// 0: disabled,
// X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
// X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
# 1. Set error handling
ini_set('display_errors', 1);
set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
# 2. Set user configuration
call_if_exists('configure');
# 3. Loading libs
require_once_dir(option('lib_dir'));
# 4. Starting session
if (!defined('SID') && option('session')) {
if (!is_bool(option('session'))) {
session_name(option('session'));
}
if (!session_start()) {
trigger_error("An error occured while trying to start the session", E_USER_WARNING);
}
}
# 5. Set some default methods if needed
if (!function_exists('after')) {
function after($output)
{
return $output;
}
}
if (!function_exists('route_missing')) {
function route_missing($request_method, $request_uri)
{
halt(NOT_FOUND, "({$request_method}) {$request_uri}");
}
}
# 6. Check request
if ($rm = request_method()) {
if (request_is_head()) {
ob_start();
}
// then no output
if (!request_method_is_allowed($rm)) {
halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
}
# 6.1 Check matching route
if ($route = route_find($rm, request_uri())) {
params($route['params']);
# 6.2 Load controllers dir
require_once_dir(option('controllers_dir'));
if (is_callable($route['function'])) {
# 6.3 Call before function
call_if_exists('before');
# 6.4 Call matching controller function and output result
if ($output = call_user_func($route['function'])) {
echo after(error_notices_render() . $output);
}
stop_and_exit();
} else {
halt(SERVER_ERROR, "Routing error: undefined function '{$route['function']}'", $route);
}
} else {
route_missing($rm, request_uri());
}
} else {
halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
}
}
示例11: p
p(2);
});
});
desc('bleem');
task('bleem', function () {
p(0);
});
after('bleem:baz', function () {
p(3);
});
desc('foo');
task('foo', function () {
p(5);
});
desc('bar');
task('bar', function () {
p(8);
});
task('foo', function () {
p(6);
});
before('foo', function () {
p(4);
});
after('foo', function () {
p(7);
});
task('foo', 'bleem:baz');
desc('default');
task('default', 'foo');
task('default', 'bar');
示例12: run
function run($env = null)
{
if (is_null($env)) {
$env = env();
}
// 0. Set default configuration
$root_dir = dirname(app_file());
$lim_dir = dirname(__FILE__);
$base_path = dirname(file_path($env['SERVER']['SCRIPT_NAME']));
$base_file = basename($env['SERVER']['SCRIPT_NAME']);
$base_uri = file_path($base_path, $base_file == 'index.php' ? '?' : $base_file . '?');
option('dir.root', $root_dir);
option('dir.limonade', file_path($lim_dir));
option('dir.limonade.views', file_path($lim_dir, 'limonade', 'views'));
option('dir.limonade.public', file_path($lim_dir, 'limonade', 'public'));
option('dir.public', file_path($root_dir, 'public'));
option('dir.views', file_path($root_dir, 'views'));
option('dir.controllers', file_path($root_dir, 'controllers'));
option('dir.lib', file_path($root_dir, 'lib'));
option('dir.views.errors', option('dir.limonade.views'));
option('base.path', $base_path);
option('base.uri', $base_uri);
# set it manually if you use url_rewriting
option('env', ENV_PRODUCTION);
option('debug', true);
option('session', LIM_SESSION_NAME);
# true, false or the name of your session
option('encoding', 'utf-8');
option('signature', LIM_NAME);
# X-Limonade header value or false to hide it
option('gzip', false);
option('x-sendfile', 0);
# 0: disabled,
# X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
# X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
// 1. Set handlers
// 1.1 Set error handling
ini_set('display_errors', 1);
set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
// 1.2 Register shutdown function
register_shutdown_function('stop_and_exit');
// 2. Set user configuration
call_if_exists('configure');
// 2.1 Set gzip compression if defined
if (is_bool(option('gzip')) && option('gzip')) {
ini_set('zlib.output_compression', '1');
}
// 2.2 Set X-Limonade header
if ($signature = option('signature')) {
header("X-Limonade: {$signature}");
}
// 3. Loading libs
require_once_dir(option('dir.lib'));
fallbacks_for_not_implemented_functions();
// 4. Starting session
if (!defined('SID') && option('session')) {
if (!is_bool(option('session'))) {
session_name(option('session'));
}
if (!session_start()) {
trigger_error("An error occured while trying to start the session", E_USER_WARNING);
}
}
// 5. Set some default methods if needed
if (!function_exists('after')) {
function after($output)
{
return $output;
}
}
if (!function_exists('route_missing')) {
function route_missing($request_method, $request_uri)
{
halt(NOT_FOUND, "({$request_method}) {$request_uri}");
}
}
call_if_exists('initialize');
// 6. Check request
if ($rm = request_method($env)) {
if (request_is_head($env)) {
ob_start();
}
// then no output
if (!request_method_is_allowed($rm)) {
halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
}
// 6.1 Check matching route
if ($route = route_find($rm, request_uri($env))) {
params($route['params']);
// 6.2 Load controllers dir
if (!function_exists('autoload_controller')) {
function autoload_controller($callback)
{
require_once_dir(option('dir.controllers'));
}
}
autoload_controller($route['callback']);
if (is_callable($route['callback'])) {
// 6.3 Call before function
call_if_exists('before', $route);
//.........这里部分代码省略.........
示例13: ifFileIsADuplicate
function ifFileIsADuplicate($testFileName, $fileNameWithoutType)
{
$fileName = before('.', $testFileName);
//remove last 4 characters
$fileType = after('.', $testFileName);
//save last 3 characters
// $testFileName = $convertedData;
// $fileName = before('.', $convertedData);
// $fileType = after('.', $convertedData);
$a = 1;
while (file_exists($testFileName) == 'true') {
$testFileName = $fileName . '_' . $a . '.' . $fileType;
// return new file name and repeat until unique
$a++;
}
return $testFileName;
}
示例14: describe
});
});
});
describe('Error Capture and Reporting', function ($ctx) {
before(function ($ctx) {
$ctx->spy = $spy = Mockery::mock()->shouldIgnoreMissing();
$ctx->listener = Mockery::mock('Matura\\Events\\Listener')->shouldIgnoreMissing();
$ctx->suite = suite('Fixture', function ($inner_ctx) use($spy, $ctx) {
$ctx->before_all = before_all(array($spy, 'before_all'));
$ctx->after_all = after_all(array($spy, 'after_all'));
$ctx->after = after(array($spy, 'after'));
$ctx->before = before(array($spy, 'before'));
$ctx->describe = describe('Inner', function ($inner_ctx) use($spy, $ctx) {
$ctx->inner_before_all = before_all(array($spy, 'inner_before_all'));
$ctx->inner_after_all = after_all(array($spy, 'inner_after_all'));
$ctx->inner_after = after(array($spy, 'inner_after'));
$ctx->inner_before = before(array($spy, 'inner_before'));
$ctx->test = it('should have a test case', array($spy, 'it'));
});
});
$ctx->suite_runner = new SuiteRunner($ctx->suite, new ResultSet());
$ctx->suite_runner->addListener($ctx->listener);
});
describe('At the Suite Level', function ($ctx) {
it('should capture before_all errors', function ($ctx) {
$ctx->spy->shouldReceive('before_all')->once()->andThrow('\\Exception');
$ctx->suite_runner->run();
$failures = $ctx->suite_runner->getResultSet()->getFailures();
expect($failures)->to->have->length(1);
expect($failures[0]->getBlock())->to->be($ctx->suite);
});
示例15: set
<?php
namespace Deployer;
/**
* @author Benjamin HUBERT <benjamin@alpixel.fr>
*/
/**
* TRANSLATION
*/
set('shared_dirs', array_merge(get('shared_dirs'), ['app/Resources/translations']));
task('deploy:translation:download', function () {
run("php {{release_path}}/" . trim(get('bin_dir'), '/') . "/console alpixel:cms:translations:download --env='prod'");
})->desc('Downloading translations');
after('deploy:vendors', 'deploy:translation:download');