本文整理汇总了PHP中zbase函数的典型用法代码示例。如果您正苦于以下问题:PHP zbase函数的具体用法?PHP zbase怎么用?PHP zbase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
zbase()->setConsoleCommand($this);
$phpCommand = env('ZBASE_PHP_COMMAND', 'php');
$packages = zbase()->packages();
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\TestCommandInterface) {
$this->info($this->signature . '.pre - ' . $packageName);
$zbase->testCommand($phpCommand, ['test.pre' => true, 'command' => $this]);
}
}
}
$commands = [];
if (!empty($commands)) {
foreach ($commands as $command) {
if ($command instanceof \Closure) {
$command();
}
}
}
zbase_package('zbase')->testCommand($phpCommand, ['test.post' => true, 'command' => $this]);
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\TestCommandInterface) {
$this->info($this->signature . '.post - ' . $packageName);
$zbase->testCommand($phpCommand, ['test.post' => true, 'command' => $this]);
}
}
}
}
示例2: testModuleRoute
/**
* Added module can be added dynamically to route
* and can be accessed
* @group Modules
*/
function testModuleRoute()
{
$modules = zbase()->modules();
foreach ($modules as $module) {
$this->assertTrue(zbase()->module($module->id()) instanceof \Zbase\Module\ModuleInterface);
}
}
示例3: register
public function register()
{
$this->app->singleton(zivsluck_tag(), function () {
return new Zivsluck();
});
zbase()->addPackage(zivsluck_tag());
}
示例4: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
zbase()->setConsoleCommand($this);
$phpCommand = env('ZBASE_PHP_COMMAND', 'php');
$packages = zbase()->packages();
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\AssetsCommandInterface) {
$this->info($this->signature . '.pre - ' . $packageName);
$zbase->assetsCommand($phpCommand, ['assets.pre' => true, 'command' => $this]);
}
}
}
echo shell_exec($phpCommand . ' artisan vendor:publish --tag=public --force');
$commands = [];
if (!empty($commands)) {
foreach ($commands as $command) {
if ($command instanceof \Closure) {
$command();
} else {
echo shell_exec($phpCommand . ' artisan ' . $command);
}
}
}
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\AssetsCommandInterface) {
$this->info($this->signature . '.post - ' . $packageName);
$zbase->assetsCommand($phpCommand, ['assets.post' => true, 'command' => $this]);
}
}
}
}
示例5: register
public function register()
{
$this->app->singleton(packagename_tag(), function () {
return new Packagename();
});
zbase()->addPackage(packagename_tag());
}
示例6: form
/**
* Used only for testing
* @return view
*/
public function form()
{
if ($this->isPost()) {
$validatorMessages = ['email.required' => _zt('Email Address is required.'), 'email.email' => _zt('Invalid email address.')];
$valid = $this->validateInputs(zbase()->request()->inputs(), ['email' => 'required|email'], $validatorMessages);
if (!empty($valid)) {
$this->message('success', _zt('Successfull!'));
}
}
return $this->view('form');
}
示例7: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
zbase_maintenance_set();
zbase()->setConsoleCommand($this);
$phpCommand = env('ZBASE_PHP_COMMAND', 'php');
$packages = zbase()->packages();
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\MigrateCommandInterface) {
$this->info($this->signature . '.pre - ' . $packageName);
$zbase->migrateCommand($phpCommand, ['migrate.pre' => true, 'command' => $this]);
}
}
}
\File::cleanDirectory(database_path() . '/migrations');
\File::cleanDirectory(database_path() . '/seeds');
\File::cleanDirectory(database_path() . '/factories');
\File::cleanDirectory(storage_path() . '/zbase');
\File::cleanDirectory(storage_path() . '/framework/cache');
\File::cleanDirectory(storage_path() . '/framework/views');
\File::cleanDirectory(storage_path() . '/logs');
echo shell_exec($phpCommand . ' artisan vendor:publish --tag=migrations --force');
echo shell_exec($phpCommand . ' artisan optimize');
echo shell_exec($phpCommand . ' artisan migrate:refresh --seed --force');
$commands = [];
// zbase()->commands('migrate');
if (!empty($commands)) {
foreach ($commands as $command) {
if ($command instanceof \Closure) {
$command();
} else {
echo shell_exec($phpCommand . ' artisan ' . $command);
}
}
}
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\MigrateCommandInterface) {
$this->info($this->signature . '.post - ' . $packageName);
$zbase->migrateCommand($phpCommand, ['migrate.post' => true, 'command' => $this]);
}
}
}
zbase_maintenance_unset();
}
示例8: zbase_module_widget_contents
/**
* Return contents for a certain module and widget
*
* @param string $module The module that is asking for content
* @param string $widget The widget that is asking for content
* @param string $section The current section [default: front] front|back
* @param boolean $adminView IF for admin [default: false]
* @param string $key key to search
* @param array $contents Some contents
* @return array
*/
function zbase_module_widget_contents($module, $widget, $section = 'front', $adminView = false, $key = null, $contents = [])
{
$modules = zbase()->modules();
foreach ($modules as $mod) {
$widgetContent = $mod->widgetContents($widget, $module, $section, $adminView, $key);
if (!empty($widgetContent)) {
foreach ($widgetContent as $index => $content) {
$contents[] = $content;
}
}
}
if (!empty($contents)) {
return zbase_collection($contents)->sortByDesc(function ($itm) {
return !empty($itm['position']) ? $itm['position'] : 0;
})->toArray();
}
}
示例9: handle
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
zbase()->setConsoleCommand($this);
$phpCommand = env('ZBASE_PHP_COMMAND', 'php');
$packages = zbase()->packages();
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\ClearCommandInterface) {
$this->info($this->signature . '.pre - ' . $packageName);
$zbase->clearCommand($phpCommand, ['clear.pre' => true, 'command' => $this]);
}
}
}
echo shell_exec($phpCommand . ' artisan clear-compiled');
echo shell_exec($phpCommand . ' artisan cache:clear');
echo shell_exec($phpCommand . ' artisan view:clear');
echo shell_exec($phpCommand . ' artisan config:clear');
echo shell_exec($phpCommand . ' artisan route:clear');
\File::cleanDirectory(zbase_storage_path('tmp/images'));
\File::cleanDirectory(zbase_storage_path(zbase_tag() . '_tmp/images'));
$commands = [];
// zbase()->commands('clear');
if (!empty($commands)) {
foreach ($commands as $command) {
if ($command instanceof \Closure) {
$command();
} else {
echo shell_exec($phpCommand . ' artisan ' . $command);
}
}
}
if (!empty($packages)) {
foreach ($packages as $packageName) {
$zbase = zbase_package($packageName);
if ($zbase instanceof Interfaces\ClearCommandInterface) {
$this->info($this->signature . '.post - ' . $packageName);
$zbase->clearCommand($phpCommand, ['clear.post' => true, 'command' => $this]);
}
}
}
}
示例10: _postEvent
/**
* Event after Action
* @param string $action
* @param string $url The Default URL to redirect
*/
protected function _postEvent($action)
{
if ($this->isPublic() && $this->isNode() && $this->isCreating()) {
return zbase_redirect()->to($this->entity()->alphaUrl());
}
$isAjax = zbase_request_is_ajax();
$requestMethod = strtolower(zbase_request_method());
if ($isAjax) {
if ($requestMethod == 'post') {
$e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json.post', $this->_v('event.' . $action . '.post-json'));
} else {
$e = $this->_v('event.' . zbase_section() . '.' . $action . '.post-json', $this->_v('event.' . zbase_section() . '.' . $action . '.post'));
}
} else {
if ($requestMethod == 'post') {
$e = $this->_v('event.' . zbase_section() . '.' . $action . '.post.post', $this->_v('event.' . $action . '.post.post', null));
} else {
$e = $this->_v('event.' . zbase_section() . '.' . $action . '.post', $this->_v('event.' . $action . '.post', null));
}
}
if (is_null($e)) {
if (zbase_is_back()) {
if ($this->isCreating()) {
$action = 'update';
}
$byAlphaId = $this->_v('entity.repo.byAlphaId.route', false);
if ($this->entityIsPostInterface($this->entity())) {
if (!empty($byAlphaId)) {
$params = ['action' => $action, 'id' => $this->entity()->postAlphaId()];
} else {
$params = ['action' => $action, 'id' => $this->entity()->postId()];
}
} else {
if (!empty($byAlphaId)) {
$params = ['action' => $action, 'id' => $this->entity()->alphaId()];
} else {
$params = ['action' => $action, 'id' => $this->entity()->id()];
}
}
} else {
$params = ['action' => $action, 'id' => $this->entity()->alphaId()];
}
if ($action == 'delete') {
$params = [];
}
$url = $this->getModule()->url(zbase_section(), $params);
if ($action == 'restore' || $action == 'ddelete') {
$url = zbase_url_previous();
}
}
if (!empty($e)) {
if (!empty($e['data'])) {
if ($isAjax) {
zbase()->json()->addVariables($e['data']);
}
}
if (!empty($e['route'])) {
$params = zbase_route_inputs();
if (!empty($e['route']['params'])) {
$params = array_merge($params, $e['route']['params']);
}
if (zbase_is_back()) {
$byAlphaId = $this->_v('entity.repo.byAlphaId.route', false);
if (!empty($byAlphaId)) {
$params['id'] = $this->entity()->alphaId();
} else {
$params['id'] = $this->entity()->id();
}
}
if ($action == 'ddelete') {
if (isset($params['id']) && isset($params['action'])) {
unset($params['id']);
unset($params['action']);
}
}
$e['route']['params'] = $params;
$url = zbase_url_from_config($e);
}
$toUrl = zbase_value_get($e, 'url', false);
if (!empty($toUrl)) {
$url = $toUrl;
}
}
$enableRedirect = $this->_v('event.' . zbase_section() . '.' . $action . '.post.redirect.enable', $this->_v('event.' . $action . '.post.redirect.enable', true));
if (!empty($url) && !empty($enableRedirect)) {
return zbase_redirect()->to($url);
}
return true;
}
示例11: zbase
* Dx
*
* @link http://dennesabing.com
* @author Dennes B Abing <dennes.b.abing@gmail.com>
* @license proprietary
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Aug 22, 2016 8:29:03 PM
* @file maintenance-notice.blade.php
* @project Zbase
* @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
*/
if (zbase()->system()->hasScheduledDowntime() && !zbase()->system()->inMaintenance()) {
?>
<?php
$details = zbase()->system()->scheduledDowntimeDetails();
?>
<div class="alert alert-warning">
<h3>Temporary Downtime Notice.</h3>
<p>
<?php
$message = null;
if (!empty($details['maintenance-message'])) {
$message = $details['maintenance-message'];
}
if (!empty($details['start-datetime'])) {
$startTime = zbase_date_from_format('Y-m-d H:i:s', $details['start-datetime']);
$endTime = zbase_date_from_format('Y-m-d H:i:s', $details['end-datetime']);
echo str_replace(array('{START_TIME}', '{END_TIME}'), array('<strong>' . $startTime->format('F d, Y h:i A') . '</strong>', '<strong>' . $endTime->format('F d, Y h:i A') . '</strong>'), nl2br($message));
}
?>
示例12: findUserByEmail
/**
* User By Email
* @param string $email
* @return object|array
*/
public static function findUserByEmail($email, $object = false)
{
if (is_array($email) && !empty($email['email'])) {
$email = $email['email'];
}
if (!empty($email)) {
$entity = zbase()->entity('user', [], true);
return ['user' => self::userApi($entity->repo()->by('email', $email)->first())];
}
}
示例13: zbase
<!DOCTYPE html>
<html>
<head>
<title>@yield('title')<?php
echo zbase()->view()->pageTitle();
?>
</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style type="text/css">
body {
background-color: #eee;
}
body, h1, p {
font-family: "Helvetica Neue", "Segoe UI", Segoe, Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: normal;
margin: 0;
padding: 0;
text-align: center;
}
.container {
margin-left: auto;
margin-right: auto;
margin-top: 177px;
max-width: 1170px;
padding-right: 15px;
padding-left: 15px;
}
示例14: factory
/**
* Element Factory
* @param array $configuration
* @return \Zbase\Ui\Form\Element
*/
public static function factory($configuration)
{
/**
* Load a widget
*/
if (!empty($configuration['widget'])) {
if (!empty($configuration['validations'])) {
$widget = zbase()->widget($configuration['widget'], [], true)->setAttribute('validations', $configuration['validations']);
} else {
$widget = zbase()->widget($configuration['widget'], [], true);
}
return $widget;
}
if (!empty($configuration['ui'])) {
$ui = \Zbase\Ui\Ui::factory($configuration['ui']);
if ($ui->enabled()) {
return $ui;
}
return null;
}
$type = !empty($configuration['type']) ? $configuration['type'] : 'text';
$id = !empty($configuration['id']) ? $configuration['id'] : null;
if (is_null($id)) {
throw new Exceptions\ConfigNotFoundException('Index:id is not set on Form Element Factory');
}
if (!empty($type)) {
$className = zbase_model_name(null, 'class.ui.form.type.' . strtolower($type), '\\Zbase\\Ui\\Form\\Type\\' . ucfirst($type));
$element = new $className($configuration);
if ($element->enabled()) {
$element->prepare();
return $element;
}
}
return null;
}
示例15: function
<?php
/**
* Dx
*
* @link http://dennesabing.com
* @author Dennes B Abing <dennes.b.abing@gmail.com>
* @license proprietary
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Mar 8, 2016 10:37:59 AM
* @file widget.php
* @project Expression project.name is undefined on line 13, column 15 in Templates/Scripting/EmptyPHP.php.
* @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
*
*/
return ['type' => 'form', 'enable' => true, 'config' => ['access' => 'only::sudo', 'values' => ['default' => ['enable' => true, 'array' => function () {
return zbase()->telegram()->settings();
}]], 'entity' => null, 'elements' => ['status' => ['type' => 'select', 'id' => 'status', 'label' => 'Status', 'multiOptions' => 'enableDisable', 'help' => ['text' => 'Disable telegram messaging.']], 'botusername' => ['type' => 'text', 'id' => 'botusername', 'label' => 'Bot Name', 'html' => ['attributes' => ['input' => ['placeholder' => 'Bot Username']]]], 'bottoken' => ['type' => 'text', 'id' => 'bottoken', 'label' => 'Bot Token', 'html' => ['attributes' => ['input' => ['placeholder' => 'Bot Token']]]], 'webhook' => ['type' => 'text', 'id' => 'webhook', 'label' => 'WebHook (Optional)', 'html' => ['attributes' => ['input' => ['value' => function () {
$token = zbase()->telegram()->token();
if (!empty($token)) {
return zbase_url_from_route('telegramhook', ['token' => $token]);
}
}, 'placeholder' => 'Webhook']]]], 'testmessage' => ['type' => 'select', 'id' => 'testmessage', 'label' => 'Send Test Message', 'multiOptions' => 'yesNo', 'help' => ['text' => 'Will send test message to Dennes.']]]]];