本文整理汇总了PHP中humhub\models\Setting::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP Setting::Get方法的具体用法?PHP Setting::Get怎么用?PHP Setting::Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类humhub\models\Setting
的用法示例。
在下文中一共展示了Setting::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: request
/**
* HumHub API
*
* @param string $action
* @param array $params
* @return array
*/
public static function request($action, $params = [])
{
if (!Yii::$app->params['humhub']['apiEnabled']) {
return [];
}
$url = Yii::$app->params['humhub']['apiUrl'] . '/' . $action;
$params['version'] = urlencode(Yii::$app->version);
$params['installId'] = Setting::Get('installationId', 'admin');
$url .= '?';
foreach ($params as $name => $value) {
$url .= urlencode($name) . '=' . urlencode($value) . "&";
}
try {
$http = new \Zend\Http\Client($url, array('adapter' => '\\Zend\\Http\\Client\\Adapter\\Curl', 'curloptions' => CURLHelper::getOptions(), 'timeout' => 30));
$response = $http->send();
$json = $response->getBody();
} catch (\Zend\Http\Client\Adapter\Exception\RuntimeException $ex) {
Yii::error('Could not connect to HumHub API! ' . $ex->getMessage());
return [];
} catch (Exception $ex) {
Yii::error('Could not get HumHub API response! ' . $ex->getMessage());
return [];
}
try {
return Json::decode($json);
} catch (\yii\base\InvalidParamException $ex) {
Yii::error('Could not parse HumHub API response! ' . $ex->getMessage());
return [];
}
}
示例2: init
/**
* @inheritdoc
*/
public function init()
{
parent::init();
if (Setting::Get('defaultDateInputFormat', 'admin') != '') {
$this->dateInputFormat = Setting::Get('defaultDateInputFormat', 'admin');
}
}
示例3: actionIndex
/**
* Configuration Action for Super Admins.
*/
public function actionIndex()
{
$post = $this->getPost(array('SmsProviderConfigureForm', 'AnySmsConfigureForm', 'ClickatellConfigureForm', 'SpryngConfigureForm'));
if ($post != null) {
$provider = $post['provider'];
$form = $this->getSmsProviderForm($provider);
// provider changed => just change the provider setting and reload the correct form
if ($provider != Setting::Get('provider', 'sms')) {
$form = new \humhub\modules\sms\forms\SmsProviderConfigureForm();
} else {
$form = $this->getSmsProviderForm($provider);
}
$form->setAttributes($post);
if ($form->validate()) {
foreach ($form->attributeNames() as $attributeName) {
Setting::Set($attributeName, $form->{$attributeName}, 'sms');
}
return $this->redirect(['/sms/config']);
}
} else {
$provider = Setting::Get('provider', 'sms');
$form = $this->getSmsProviderForm($provider);
foreach ($form->attributeNames() as $attributeName) {
$form->{$attributeName} = Setting::Get($attributeName, 'sms');
}
}
return $this->render('index', array('model' => $form));
}
示例4: beforeAction
/**
* @inheritdoc
*/
public function beforeAction($action)
{
$identity = Yii::$app->user->getIdentity();
if ($identity != null && !$identity->isActive()) {
Yii::$app->user->logout();
Yii::$app->response->redirect(Yii::$app->urlManager->createUrl('user/auth/login'));
}
if (Yii::$app->user->isGuest) {
if (!$this->loggedInOnly && !$this->adminOnly) {
return true;
}
if (in_array($action->id, $this->guestAllowedActions) && Setting::Get('allowGuestAccess', 'authentication_internal') == 1) {
return true;
}
Yii::$app->user->loginRequired();
return false;
}
if ($this->adminOnly && !Yii::$app->user->isAdmin()) {
$this->forbidden();
}
if ($this->loggedInOnly) {
return true;
}
return false;
}
示例5: run
/**
* Broadcast a message to all users
*/
public function run()
{
//Send GCM notifications
$model = new $this->modelClass();
$records = $model->findBySql("SELECT * FROM gcm_relation")->all();
$params = Yii::$app->getRequest()->getBodyParams();
$data = array('message' => $params['message'], 'url' => $params['url']);
$results = array();
foreach ($records as $record) {
if ($record->register_key) {
//Enviar missatge
$gcm = new GoogleCloudMessage();
$gcm->apiKey = Setting::Get('gcmAPIKey', 'gcm');
$gcm->url = Setting::Get('gcmURL', 'gcm');
$result = $gcm->send($data, array($record->register_key));
$results[$record->register_key] = $result;
}
}
//Send mail notificacion
$users = User::find()->distinct()->joinWith(['httpSessions', 'profile'])->where(['status' => User::STATUS_ENABLED]);
Yii::setAlias('@gcmmodule', Yii::$app->getModule('gcm')->getBasePath());
foreach ($users->each() as $user) {
$mail = Yii::$app->mailer->compose(['html' => '@gcmmodule/views/emails/NewMessage'], ['message' => $params['message'], 'url' => $params['url']]);
$mail->setFrom([Setting::Get('systemEmailAddress', 'mailing') => Setting::Get('systemEmailName', 'mailing')]);
$mail->setTo($user->email);
$mail->setSubject('Nova notícia al web: ' . $params['message']);
$mail->send();
}
return true;
}
示例6: getMailUpdate
public function getMailUpdate(User $user, $interval)
{
$output = "";
foreach (Session::find()->where(['<', 'expire', time()])->all() as $session) {
$session->delete();
}
$receive_email_notifications = $user->getSetting("receive_email_notifications", 'core', Setting::Get('receive_email_notifications', 'mailing'));
// Never receive notifications
if ($receive_email_notifications == User::RECEIVE_EMAIL_NEVER) {
return "";
}
// We are in hourly mode and user wants daily
if ($interval == CronController::EVENT_ON_HOURLY_RUN && $receive_email_notifications == User::RECEIVE_EMAIL_DAILY_SUMMARY) {
return "";
}
// We are in daily mode and user dont wants daily reports
if ($interval == CronController::EVENT_ON_DAILY_RUN && $receive_email_notifications != User::RECEIVE_EMAIL_DAILY_SUMMARY) {
return "";
}
// User wants only when offline and is online
if ($interval == CronController::EVENT_ON_HOURLY_RUN) {
$isOnline = count($user->httpSessions) > 0;
if ($receive_email_notifications == User::RECEIVE_EMAIL_WHEN_OFFLINE && $isOnline) {
return "";
}
}
$query = Notification::find()->where(['user_id' => $user->id])->andWhere(['!=', 'seen', 1])->andWhere(['!=', 'emailed', 1]);
foreach ($query->all() as $notification) {
$output .= $notification->getClass()->render(BaseNotification::OUTPUT_MAIL);
$notification->emailed = 1;
$notification->save();
}
return $output;
}
示例7: run
/**
* Executes the widgets
*/
public function run()
{
if (Yii::$app->user->isGuest) {
return;
}
// Active tour flag not set
if (!isset($_GET['tour'])) {
return;
}
// Tour only possible when we are in a module
if (Yii::$app->controller->module === null) {
return;
}
// Check if tour is activated by admin and users
if (Setting::Get('enable', 'tour') == 0 || Yii::$app->user->getIdentity()->getSetting("hideTourPanel", "tour") == 1) {
return;
}
// save current module and controller id's
$currentModuleId = Yii::$app->controller->module->id;
$currentControllerId = Yii::$app->controller->id;
if ($currentModuleId == "dashboard" && $currentControllerId == "dashboard") {
return $this->render('guide_interface');
} elseif ($currentModuleId == "space" && $currentControllerId == "space") {
return $this->render('guide_spaces', array());
} elseif ($currentModuleId == "user" && $currentControllerId == "profile") {
return $this->render('guide_profile', array());
} elseif ($currentModuleId == "admin" && $currentControllerId == "module") {
return $this->render('guide_administration', array());
}
}
示例8: isConfigured
/**
* Checks if the application is already configured.
*/
public function isConfigured()
{
if (\humhub\models\Setting::Get('secret') != "") {
return true;
}
return false;
}
示例9: onCronDailyRun
/**
* Check if there is a new Humhub Version available and sends a notification
* to super admins
*
* @param \yii\base\Event $event
*/
public static function onCronDailyRun($event)
{
$controller = $event->sender;
if (!Yii::$app->getModule('admin')->dailyCheckForNewVersion) {
return;
}
if (!Yii::$app->params['humhub']['apiEnabled']) {
return;
}
$controller->stdout("Checking for new HumHub version... ");
$latestVersion = libs\HumHubAPI::getLatestHumHubVersion();
if ($latestVersion != "") {
$adminUserQuery = User::find()->where(['super_admin' => 1]);
$latestNotifiedVersion = Setting::Get('lastVersionNotify', 'admin');
$adminsNotified = !($latestNotifiedVersion == "" || version_compare($latestVersion, $latestNotifiedVersion, ">"));
$newVersionAvailable = version_compare($latestVersion, Yii::$app->version, ">");
$updateNotification = new notifications\NewVersionAvailable();
// Cleanup existing notifications
if (!$newVersionAvailable || $newVersionAvailable && !$adminsNotified) {
foreach ($adminUserQuery->all() as $admin) {
$updateNotification->delete($admin);
}
}
// Create new notification
if ($newVersionAvailable && !$adminsNotified) {
$updateNotification->sendBulk($adminUserQuery);
Setting::Set('lastVersionNotify', $latestVersion, 'admin');
}
}
$controller->stdout('done. ' . PHP_EOL, \yii\helpers\Console::FG_GREEN);
}
示例10: actionIndex
public function actionIndex()
{
$keyword = Yii::$app->request->get('keyword', "");
$scope = Yii::$app->request->get('scope', "");
$page = (int) Yii::$app->request->get('page', 1);
$limitSpaceGuids = Yii::$app->request->get('limitSpaceGuids', "");
$limitSpaces = array();
if ($limitSpaceGuids !== "") {
foreach (explode(",", $limitSpaceGuids) as $guid) {
$guid = trim($guid);
if ($guid != "") {
$space = Space::findOne(['guid' => trim($guid)]);
if ($space !== null) {
$limitSpaces[] = $space;
}
}
}
}
$options = ['page' => $page, 'sort' => $keyword == '' ? 'title' : null, 'pageSize' => Setting::Get('paginationSize'), 'limitSpaces' => $limitSpaces];
if ($scope == self::SCOPE_CONTENT) {
$options['type'] = \humhub\modules\search\engine\Search::DOCUMENT_TYPE_CONTENT;
} elseif ($scope == self::SCOPE_SPACE) {
$options['model'] = Space::className();
} elseif ($scope == self::SCOPE_USER) {
$options['model'] = User::className();
} else {
$scope = self::SCOPE_ALL;
}
$searchResultSet = Yii::$app->search->find($keyword, $options);
$pagination = new \yii\data\Pagination();
$pagination->totalCount = $searchResultSet->total;
$pagination->pageSize = $searchResultSet->pageSize;
return $this->render('index', array('scope' => $scope, 'keyword' => $keyword, 'results' => $searchResultSet->getResultInstances(), 'pagination' => $pagination, 'totals' => $this->getTotals($keyword, $options), 'limitSpaceGuids' => $limitSpaceGuids));
}
示例11: actionIndex
public function actionIndex()
{
if (!Setting::Get('apiKey', 'dropbox')) {
return $this->render('errorMissingKey', array());
}
$model = new CreateDropboxPostForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
$dropboxPost = new DropboxPost();
$dropboxPost->message = $model->message;
$dropboxPost->content->container = $this->contentContainer;
$dropboxPost->content->visibility = $this->contentContainer->visibility;
$dropboxPost->save();
$dropboxFileIds = explode(",", $model->dropboxFileId);
foreach ($dropboxFileIds as $dropboxFileId) {
if ($dropboxFileId != null) {
$dropboxFile = DropboxFile::findOne(['id' => $dropboxFileId]);
if ($dropboxFile->object_model != DropboxPost::className() || $dropboxFile->object_id != $dropboxPost->id) {
$dropboxFile->object_model = DropboxPost::className();
$dropboxFile->object_id = $dropboxPost->id;
$dropboxFile->save();
}
}
}
return $this->htmlRedirect($this->contentContainer->createUrl());
}
return $this->render('index', array('model' => $model));
}
示例12: actionDownloadZippedFolder
/**
* Action to download a folder defined by request param "fid" as a zip file.
*
* @throws HttpException
*/
public function actionDownloadZippedFolder()
{
// cleanup all old files
$this->cleanup();
// init output directory
$outputPath = $this->getZipOutputPath();
// check validity of currentFolder
$currentFolder = $this->getCurrentFolder();
if (empty($currentFolder)) {
throw new HttpException(404, Yii::t('CfilesModule.base', 'The folder with the id %id% does not exist.', ['%id%' => (int) Yii::$app->request->get('fid')]));
}
// zip the current folder
$zipTitle = $this->zipDir($currentFolder, $outputPath);
$zipPath = $outputPath . DIRECTORY_SEPARATOR . $zipTitle;
// check if the zip was created
if (!file_exists($zipPath)) {
throw new HttpException(404, Yii::t('CfilesModule.base', 'The archive could not be created.'));
}
// deliver the zip
$options = ['inline' => false, 'mimeType' => FileHelper::getMimeTypeByExtension($zipPath)];
if (!Setting::Get('useXSendfile', 'file')) {
Yii::$app->response->sendFile($zipPath, $zipTitle, $options);
} else {
if (strpos($_SERVER['SERVER_SOFTWARE'], 'nginx') === 0) {
// set nginx specific X-Sendfile header name
$options['xHeader'] = 'X-Accel-Redirect';
// make path relative to docroot
$docroot = rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR);
if (substr($zipPath, 0, strlen($docroot)) == $docroot) {
$zipPath = substr($zipPath, strlen($docroot));
}
}
Yii::$app->response->xSendFile($zipPath, null, $options);
}
}
示例13:
function __construct()
{
$this->baseUrl = "http://api.clickatell.com/http/sendmsg";
$this->api_id = Setting::Get('apiid_clickatell', 'sms');
$this->user_id = Setting::Get('username_clickatell', 'sms');
$this->pass = Setting::Get('password_clickatell', 'sms');
}
示例14: init
public function init()
{
$this->addItemGroup(array('id' => 'manage', 'label' => \Yii::t('AdminModule.widgets_AdminMenuWidget', '<strong>Administration</strong> menu'), 'sortOrder' => 100));
$this->addItem(array('label' => \Yii::t('AdminModule.widgets_AdminMenuWidget', 'Users'), 'url' => Url::toRoute(['/admin/user']), 'icon' => '<i class="fa fa-user"></i>', 'group' => 'manage', 'sortOrder' => 200, 'isActive' => \Yii::$app->controller->module && \Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'user', 'isVisible' => \Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'User approval'), 'id' => 'approval', 'url' => Url::toRoute('/admin/approval'), 'icon' => '<i class="fa fa-check-circle"></i>', 'group' => 'manage', 'sortOrder' => 201, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'approval', 'isVisible' => Setting::Get('needApproval', 'authentication_internal') && Yii::$app->user->getIdentity()->canApproveUsers()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Groups'), 'id' => 'groups', 'url' => Url::toRoute('/admin/group'), 'icon' => '<i class="fa fa-group"></i>', 'group' => 'manage', 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'group', 'sortOrder' => 300, 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Spaces'), 'id' => 'spaces', 'url' => Url::toRoute('/admin/space'), 'icon' => '<i class="fa fa-inbox"></i>', 'group' => 'manage', 'sortOrder' => 400, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'space', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Modules'), 'id' => 'modules', 'url' => Url::toRoute('/admin/module'), 'icon' => '<i class="fa fa-rocket"></i>', 'sortOrder' => 500, 'group' => 'manage', 'newItemCount' => 0, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'module', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'About'), 'url' => Url::toRoute('/admin/about'), 'icon' => '<i class="fa fa-info-circle"></i>', 'sortOrder' => 10000, 'group' => 'manage', 'newItemCount' => 0, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'about', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItemGroup(array('id' => 'settings', 'label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Settings'), 'sortOrder' => 200));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Basic'), 'url' => Url::toRoute('/admin/setting/index'), 'icon' => '<i class="fa fa-cogs"></i>', 'group' => 'settings', 'sortOrder' => 100, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'basic', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Design'), 'url' => Url::toRoute('/admin/setting/design'), 'icon' => '<i class="fa fa-magic"></i>', 'group' => 'settings', 'sortOrder' => 200, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'design', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Authentication'), 'url' => Url::toRoute('/admin/setting/authentication'), 'icon' => '<i class="fa fa-lock"></i>', 'group' => 'settings', 'sortOrder' => 500, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && (Yii::$app->controller->action->id == 'authentication' || Yii::$app->controller->action->id == 'authenticationLdap'), 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'User profiles'), 'url' => Url::toRoute('/admin/user-profile/index'), 'icon' => '<i class="fa fa-wrench"></i>', 'group' => 'settings', 'sortOrder' => 500, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'user-profile', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Mailing'), 'url' => Url::toRoute('/admin/setting/mailing'), 'icon' => '<i class="fa fa-envelope"></i>', 'group' => 'settings', 'sortOrder' => 600, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'mailing', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Caching'), 'url' => Url::toRoute(['/admin/setting/caching']), 'icon' => '<i class="fa fa-dashboard"></i>', 'group' => 'settings', 'sortOrder' => 800, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'caching', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Files'), 'url' => Url::toRoute('/admin/setting/file'), 'icon' => '<i class="fa fa-file"></i>', 'group' => 'settings', 'sortOrder' => 800, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'file', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Proxy'), 'url' => Url::toRoute('/admin/setting/proxy'), 'icon' => '<i class="fa fa-sitemap"></i>', 'group' => 'settings', 'sortOrder' => 800, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'proxy', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Statistics'), 'url' => Url::toRoute('/admin/setting/statistic'), 'icon' => '<i class="fa fa-bar-chart-o"></i>', 'group' => 'settings', 'sortOrder' => 900, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'statistic', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Cron jobs'), 'url' => Url::toRoute('/admin/setting/cronjob'), 'icon' => '<i class="fa fa-history"></i>', 'group' => 'settings', 'sortOrder' => 1000, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'cronjob', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Logging'), 'url' => Url::toRoute('/admin/logging'), 'icon' => '<i class="fa fa-keyboard-o"></i>', 'group' => 'settings', 'sortOrder' => 1100, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'logging', 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'OEmbed Provider'), 'url' => Url::toRoute('/admin/setting/oembed'), 'icon' => '<i class="fa fa-cloud"></i>', 'group' => 'settings', 'sortOrder' => 1200, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && (Yii::$app->controller->action->id == 'oembed' || Yii::$app->controller->action->id == 'oembedEdit'), 'isVisible' => Yii::$app->user->isAdmin()));
$this->addItem(array('label' => Yii::t('AdminModule.widgets_AdminMenuWidget', 'Self test & update'), 'url' => Url::toRoute('/admin/setting/self-test'), 'icon' => '<i class="fa fa-warning"></i>', 'group' => 'settings', 'sortOrder' => 1300, 'isActive' => Yii::$app->controller->module && Yii::$app->controller->module->id == 'admin' && Yii::$app->controller->id == 'setting' && Yii::$app->controller->action->id == 'selftest', 'isVisible' => Yii::$app->user->isAdmin()));
parent::init();
}
示例15: run
/**
* Executes the widget.
*/
public function run()
{
$blacklisted_objects = explode(',', Setting::GetText('showFilesWidgetBlacklist', 'file'));
if (!in_array(get_class($this->object), $blacklisted_objects)) {
$files = \humhub\modules\file\models\File::getFilesOfObject($this->object);
return $this->render('showFiles', array('files' => $files, 'maxPreviewImageWidth' => Setting::Get('maxPreviewImageWidth', 'file'), 'maxPreviewImageHeight' => Setting::Get('maxPreviewImageHeight', 'file'), 'hideImageFileInfo' => Setting::Get('hideImageFileInfo', 'file')));
}
}