本文整理汇总了PHP中zbase_config_get函数的典型用法代码示例。如果您正苦于以下问题:PHP zbase_config_get函数的具体用法?PHP zbase_config_get怎么用?PHP zbase_config_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了zbase_config_get函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: zbase_cache
/**
* Return a value from cache else save new
*
* @param string $key
* @param \Closure $callback
* @param integer $minutes number of minutes to store items. Default: 60m
* @return mixed
*/
function zbase_cache($key, \Closure $callback, array $tags = null, $minutes = 60, $options = array())
{
if ($minutes === null) {
$minutes = 60;
}
$logFile = !empty($options['logFile']) ? $options['logFile'] : __FUNCTION__;
$logMsg = !empty($options['logMsg']) ? $options['logMsg'] : __FUNCTION__;
if (zbase_cache_has($key, $tags, $options)) {
zbase_log($key . ' -- CACHE HIT' . PHP_EOL . $logMsg, null, $logFile);
return zbase_cache_get($key, $tags, $options);
}
zbase_log($key . ' -- CACHE MISS' . PHP_EOL . $logMsg, null, $logFile);
/**
* Force Cache Entity Level
*/
$forceCaching = zbase_config_get('db.cache.force', true);
if (!empty($options['forceCache']) && !empty($forceCaching)) {
$value = $callback();
zbase_cache_save($key, $value, $minutes, $tags, $options);
return $value;
}
if (!zbase_cache_enable()) {
return $callback();
}
$value = $callback();
zbase_cache_save($key, $value, $minutes, $tags, $options);
return $value;
// return \Cache::remember($key, $minutes, $callback);
}
示例2: registerEnabled
/**
* If registration is enabled
* @return boolean
*/
public function registerEnabled()
{
if ($this->authEnabled()) {
return zbase_config_get('auth.register.enable', true);
}
return false;
}
示例3: zbase_auth_minimum
/**
* Return the Minimum Access for the section
* @return string
*/
function zbase_auth_minimum()
{
if (zbase_is_back()) {
if (zbase_route_username()) {
return zbase_route_username_minimum_access();
}
return zbase_config_get('auth.access.minimum.back', 'admin');
}
return zbase_config_get('auth.access.minimum.front', 'guest');
}
示例4: zbase_url_from_route
/**
* Create a URL Based from a route $name
* @param type $name
* @param type $params
*/
function zbase_url_from_route($name, $params = [], $relative = false)
{
if (!\Route::has($name)) {
return '#';
}
$routes = zbase_config_get('routes');
$prefix = '';
$name = str_replace('admin.', zbase_admin_key() . '.', $name);
$name = str_replace('admin', zbase_admin_key(), $name);
$usernameRouteEnabled = zbase_route_username();
if (isset($routes[$name]['usernameroute'])) {
if ($routes[$name]['usernameroute'] === false) {
$usernameRouteEnabled = false;
}
}
if (!empty($usernameRouteEnabled)) {
$usernameRouteParameterName = zbase_route_username_prefix();
$usernameRoute = zbase_route_username_get();
$username = zbase_route_input(zbase_route_username_prefix(), false);
if (!empty($username)) {
$username = strtolower($username);
$user = zbase_user_by('username', $username);
if ($user instanceof \Zbase\Entity\Laravel\User\User && $user->hasUrl()) {
$usernameRoute = true;
}
}
if (empty($usernameRoute) && zbase_auth_has() && zbase_is_back()) {
$username = zbase_auth_user()->username();
$usernameRoute = true;
}
if (!empty($usernameRoute)) {
$prefix = $usernameRouteParameterName;
if (empty($params[$usernameRouteParameterName])) {
$params[$usernameRouteParameterName] = $username;
}
}
}
$name = $prefix . $name;
if (!empty($relative)) {
$home = route('index');
$url = str_replace($home, '', route($name, $params));
} else {
$url = route($name, $params);
}
if ($usernameRouteEnabled && !empty($usernameRoute)) {
$url = str_replace($usernameRoute . '/' . $usernameRoute, '/' . $usernameRoute . '/', $url);
}
return $url;
}
示例5: testzbase_data_get
/**
* @return void
* @test
*/
public function testzbase_data_get()
{
$config = ['key' => ['keyTwo' => ['keyThree' => ['keyFour' => 'keyFourValue']]]];
$this->assertEquals('keyFourValue', zbase_data_get($config, 'key.keyTwo.keyThree.keyFour'));
$this->assertSame(['keyThree' => ['keyFour' => 'keyFourValue']], zbase_data_get($config, 'key.keyTwo'));
// Test configReplace
$arrOne = ['template' => ['someTag' => ['configReplace' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$expected = ['front' => ["package" => "someOtherTagThemePackage", "theme" => "someOtherTagThemeName"]];
$this->assertSame($expected, zbase_config_get('view.template.someTag'));
// Test configMerge
$arrOne = ['template' => ['someTag' => ['configMerge' => 'view.template.otherTag', 'front' => ['package' => 'someThemePackage', 'theme' => 'someThemeName']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$expected = ['front' => ["package" => ["someThemePackage", "someOtherTagThemePackage"], "theme" => ["someThemeName", "someOtherTagThemeName"]]];
$this->assertSame($expected, zbase_config_get('view.template.someTag'));
// Test inheritedValue
$arrOne = ['template' => ['someTag' => ['front' => ['package' => 'someThemePackage', 'theme' => 'inheritValue::view.template.otherTag.front.theme']], 'otherTag' => ['front' => ['package' => 'someOtherTagThemePackage', 'theme' => 'someOtherTagThemeName']]]];
zbase_config_set('view', $arrOne);
$this->assertSame('someOtherTagThemeName', zbase_config_get('view.template.someTag.front.theme'));
}
示例6: getColor
/**
* Return the Color
*/
public function getColor()
{
$theme = zbase_config_get('theme.ui.component.button.color.' . $this->tag . '.' . $this->color, null);
if (!empty($theme)) {
return $theme;
}
if ($this->tag == 'a') {
return $this->color;
}
if ($this->color == 'green') {
return 'btn-success';
}
if ($this->color == 'blue') {
return 'btn-info';
}
if ($this->color == 'red') {
return 'btn-danger';
}
if ($this->color == 'yellow') {
return 'btn-warning';
}
return 'btn-' . $this->color;
}
示例7: sendPaymentReceiptToShane
/**
* Send Order pHoto to Shane
*/
public function sendPaymentReceiptToShane()
{
$token = zbase_config_get('zivsluck.telegram.bot.token');
$shane = zbase_config_get('zivsluck.telegram.shane');
$enable = env('ZIVSLUCK_TELEGRAM', zbase_config_get('zivsluck.telegram.enable', false));
if ($enable) {
$folder = zbase_storage_path() . '/zivsluck/order/receipts/';
$image = $folder . $this->id() . '.png';
$url = 'https://api.telegram.org/bot' . $token . '/sendPhoto?chat_id=' . $shane;
$post_fields = array('chat_id' => $shane, 'photo' => new \CURLFile(realpath($image)), 'caption' => 'Payment received from ' . $this->name . ' via ' . $this->paymentMerchant() . ' for Order ID ' . $this->maskedId());
$ch = curl_init();
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type:multipart/form-data"));
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_fields);
curl_exec($ch);
}
}
示例8: function
* @copyright Copyright (c) 2015 ClaremontDesign/MadLabs-Dx
* @version 0.0.0.1
* @since Mar 5, 2016 11:51:42 PM
* @file dsstore/module.php
*
*/
return ['id' => 'testing', 'enable' => true, 'backend' => false, 'frontend' => false, 'routes' => ['generate_password' => ['usernameRouteCheck' => false, 'url' => '/test/generate-password/{password?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$password = zbase_route_input('password');
dd($password, zbase_bcrypt($password));
}]], 'testing_email_sending' => ['usernameRouteCheck' => false, 'url' => '/test/email-sending/{action?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$user = zbase_entity('user')->by('username', 'dennesabing');
$params = [];
$params['token'] = zbase_generate_code();
$to = 'dennes.b.abing@gmail.com';
$fromEmail = zbase_config_get('email.noreply.email');
$fromName = zbase_config_get('email.noreply.name');
$subject = 'Test Subject';
$headers = "From: " . $fromName . " <{$fromEmail}>\r\n";
$headers .= "Reply-To: " . $fromName . " <{$fromEmail}>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
//$message = zbase_view_render(zbase_view_file_contents('auth.password.email.password'), $params);
//$sent = mail($to, $subject, $message, $headers);
//dd($sent, $to, $fromEmail, $message);
dd(zbase_messenger_email($to, 'noreply', $subject, zbase_view_file_contents('auth.password.email.password'), $params));
}]], 'testing_email_template' => ['usernameRouteCheck' => false, 'url' => '/test/templates/email/{type?}', 'view' => ['enable' => true, 'layout' => 'blank', 'name' => 'type.html', 'content' => function () {
$type = zbase_route_input('type');
/**
* test/templates/email/forgot-password
*/
if ($type == 'forgot-password') {
示例9: function
*
* @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' => function () {
return zbase_config_get('modules.account.widgets.username.enable', true);
}, 'config' => ['entity' => ['name' => 'user', 'node' => ['enable' => true], 'repo' => ['byId' => ['route' => 'id']]], 'event' => ['username' => ['post' => ['redirect' => ['enable' => false]]]], 'submit' => ['button' => ['label' => 'Update Username']], 'form' => ['startTag' => ['action' => function () {
return zbase_url_from_route('admin.users', ['action' => 'username', 'id' => zbase_route_input('id')]);
}, 'html' => ['attributes' => ['class' => ['zbase-ajax-form']]]]], 'elements' => ['username' => ['type' => 'text', 'id' => 'username', 'enable' => function () {
return zbase_config_get('auth.username.enable', false);
}, 'label' => 'Username', 'entity' => ['property' => 'username'], 'angular' => ['ngModel' => 'currentUser.username'], 'validations' => ['required' => ['enable' => true, 'message' => 'Username is required.'], 'unique' => ['enable' => true, 'text' => function () {
return 'unique:' . zbase_entity('user')->getTable() . ',username,' . zbase_auth_user()->id() . ',user_id';
}, 'message' => 'Username already exists.'], 'regex' => ['enable' => true, 'text' => function () {
return 'regex:/^[a-z][a-z0-9]{5,31}$/';
}, 'message' => 'Invalid username.'], 'min' => ['enable' => true, 'text' => function () {
return 'min:5';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'max' => ['enable' => true, 'text' => function () {
return 'max:32';
}, 'message' => 'Username should be of 5 up to 32 characters.'], 'not_in' => ['enable' => true, 'text' => function () {
$notAllowedUsernames = (require zbase_path_library('notallowedusernames.php'));
$notAllowedUsernames[] = zbase_auth_user()->username();
return 'not_in:' . implode(',', $notAllowedUsernames);
}, 'message' => 'Please provide a different username.']]]]]];
示例10: zbase_config_get
* @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 Sep 9, 2016 10:11:07 PM
* @file account.blade.php
* @project Zbase
* @package Expression package is undefined on line 14, column 15 in Templates/Scripting/EmptyPHP.php.
*/
$profile = zbase_config_get('modules.account.widgets.profile.enable', true);
$image = zbase_config_get('modules.account.widgets.image.enable', true);
$email = zbase_config_get('modules.account.widgets.email.enable', true);
$username = zbase_config_get('modules.account.widgets.username.enable', true);
$password = zbase_config_get('modules.account.widgets.password.enable', true);
$notification = zbase_config_get('modules.account.widgets.notifications.enable', true);
$currentUser = zbase_auth_user();
$moduleName = 'account';
$isAdmin = $currentUser->isAdmin();
$adminView = false;
if ($isAdmin && !empty(zbase_route_input('id'))) {
$adminView = true;
$moduleName = 'admin-user';
$selectedUser = zbase_user_byid(zbase_route_input('id'));
if (!$selectedUser instanceof \Zbase\Entity\Laravel\User\User) {
zbase_abort(404);
exit;
}
$page = [];
$page['title'] = '<span class="userDisplayName' . $selectedUser->id() . '">' . $selectedUser->roleTitle() . ' - ' . $selectedUser->id() . ': ' . $selectedUser->displayName() . '</span>' . $selectedUser->statusText();
$page['headTitle'] = $selectedUser->displayName();
示例11: entity
/**
* Return the Entity Model of a given entityName
*
* @param string $entityName Entity name
* @param array $entityConfig EntityConfiguration
* @param boolean|string $newInstance will create new instance.
* @return Zbase\Entity\Entity
*/
public function entity($entityName, $entityConfig = [], $newInstance = true)
{
if (empty($newInstance)) {
if (!empty($this->entityModels[$entityName])) {
return $this->entityModels[$entityName];
}
}
if (empty($entityConfig)) {
$entityConfig = zbase_config_get('entity.' . $entityName, []);
}
if (!empty($entityConfig)) {
$modelName = zbase_class_name(!empty($entityConfig['model']) ? $entityConfig['model'] : null);
if (!empty($modelName)) {
if (!empty($newInstance)) {
return new $modelName();
}
return $this->entityModels[$entityName] = new $modelName();
}
throw new Exceptions\ConfigNotFoundException('Entity "model" configuration for "' . $entityName . '" not found in ' . __CLASS__);
}
//$value = app()['config']['entity'];
//dd($value, zbase_config_get('entity'), $entityName, $entityConfig);
throw new Exceptions\ConfigNotFoundException('Entity configuration for "' . $entityName . '" not found in ' . __CLASS__);
}
示例12: zbase_domain
/**
* ZBASE_SITE_DOMAIN
* return the Site Domain
* @return string
*/
function zbase_domain()
{
return str_replace(array('http://', 'https://', 'www'), '', env('APP_URL', zbase_config_get('site.domain', 'zzbase.com')));
}
示例13: url
/**
* Create a URL based from params
* @param string $section The Section to generate the route
* @param array $params Params to generate route
* @return string
*/
public function url($section, $params)
{
if ($section == 'backend' || $section == 'back') {
$adminKey = zbase_config_get('routes.adminkey.key', 'admin');
$routeName = $adminKey . '.' . $this->id();
} else {
$routeName = $this->id();
}
return zbase_url_from_route($routeName, $params);
}
示例14: wrapperAttributes
/**
* Return the Wrapper Attributes
* @return array
*/
public function wrapperAttributes()
{
$someAttributes = property_exists($this, '_htmlWrapperAttributes') ? $this->_htmlWrapperAttributes : [];
$generalAttributes = zbase_config_get('ui.' . $this->_type . '.html.attributes.wrapper', []);
$attr = array_merge_recursive($this->_v('html.attributes.wrapper', []), $someAttributes, $generalAttributes);
$attr['class'][] = 'zbase-ui-wrapper';
$attr['id'] = 'zbase-ui-wrapper-' . $this->id();
return $attr;
}
示例15: zbase_config_get
<div class="form-group" id="form-group-material">
<label for="material">Material</label>
<select name="material" id="material" class="form-control">
<option value="stainless">Stainless</option>
<option value="silver">Silver</option>
<option value="goldplated">Gold Plated</option>
</select>
</div>
<div class="form-group" id="form-group-chain" style="display: none;">
<div class="form-group" >
<label for="chain">Chain</label>
</div>
<div class="row">
<?php
$chains = zbase_config_get('zivsluck.chains', false);
if (!empty($chains)) {
foreach ($chains as $chainType => $chainTypes) {
foreach ($chainTypes as $chainId => $chain) {
if (!empty($chain['enable'])) {
?>
<div onclick="zivsluck_selectChain('<?php
echo $chain['name'];
?>
');" data-name="<?php
echo $chain['name'];
?>
" class="col-md-4 chain-type-group-<?php
echo !empty($chain['group']) ? $chain['group'] : null;
?>
chain-type-<?php