本文整理汇总了PHP中HSetting类的典型用法代码示例。如果您正苦于以下问题:PHP HSetting类的具体用法?PHP HSetting怎么用?PHP HSetting使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HSetting类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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 (HSetting::Get('enable', 'tour') == 0 || Yii::app()->user->getModel()->getSetting("hideTourPanel", "tour") == 1) {
return;
}
$this->loadResources();
// save current module and controller id's
$currentModuleId = Yii::app()->controller->module->id;
$currentControllerId = Yii::app()->controller->id;
if ($currentModuleId == "dashboard" && $currentControllerId == "dashboard") {
$this->render('guide_interface');
} elseif ($currentModuleId == "space" && $currentControllerId == "space") {
$this->render('guide_spaces', array());
} elseif ($currentModuleId == "user" && $currentControllerId == "profile") {
$this->render('guide_profile', array());
} elseif ($currentModuleId == "admin" && $currentControllerId == "module") {
$this->render('guide_administration', array());
}
}
开发者ID:nomaan-alkurn,项目名称:thooth,代码行数:34,代码来源:TourWidget.php
示例2: attachFiles
/**
* Attaches files by url which found in content text.
* This is experimental and only supports image files at the moment.
*
* @param HActiveRecord $record to bind files to
* @param String $text to parse for links
*/
public static function attachFiles($record, $text)
{
if (!$record instanceof HActiveRecord) {
throw new CException("Invalid content object given!");
}
$max = 5;
$count = 1;
$text = preg_replace_callback('/http(.*?)(\\s|$)/i', function ($match) use(&$count, &$max, &$record) {
if ($max > $count) {
$url = $match[0];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);
curl_setopt($ch, CURLOPT_HEADER, true);
curl_setopt($ch, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
curl_setopt($ch, CURLOPT_REDIR_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS);
if (HSetting::Get('enabled', 'proxy')) {
curl_setopt($ch, CURLOPT_PROXY, HSetting::Get('server', 'proxy'));
curl_setopt($ch, CURLOPT_PROXYPORT, HSetting::Get('port', 'proxy'));
if (defined('CURLOPT_PROXYUSERNAME')) {
curl_setopt($ch, CURLOPT_PROXYUSERNAME, HSetting::Get('user', 'proxy'));
}
if (defined('CURLOPT_PROXYPASSWORD')) {
curl_setopt($ch, CURLOPT_PROXYPASSWORD, HSetting::Get('pass', 'proxy'));
}
if (defined('CURLOPT_NOPROXY')) {
curl_setopt($ch, CURLOPT_NOPROXY, HSetting::Get('noproxy', 'proxy'));
}
}
$ret = curl_exec($ch);
$contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
list($headers, $outputContent) = explode("\r\n\r\n", $ret, 2);
curl_close($ch);
if ($httpCode == 200 && substr($contentType, 0, 6) == 'image/') {
$extension = 'img';
if ($contentType == 'image/jpeg' || $contentType == 'image/jpg') {
$extension = 'jpg';
} elseif ($contentType == 'image/gif') {
$extension = 'gif';
} elseif ($contentType == 'image/png') {
$extension = 'png';
}
$file = new File();
$file->object_model = get_class($record);
$file->object_id = $record->getPrimaryKey();
$file->mime_type = $contentType;
$file->title = "Link Image";
$file->file_name = "LinkImage." . $extension;
$file->newFileContent = $outputContent;
$file->validate();
$file->save();
}
}
$count++;
}, $text);
}
开发者ID:alefernie,项目名称:intranet,代码行数:67,代码来源:RemoteFileDownloader.php
示例3: up
public function up()
{
if (HSetting::isInstalled()) {
$this->alterColumn('profile', 'zip', 'VARCHAR(10) DEFAULT NULL');
$this->update('profile_field', array('field_type_class' => 'ProfileFieldTypeText', 'field_type_config' => '{"minLength":null,"maxLength":10,"validator":null,"default":null,"regexp":null,"regexpErrorMessage":null}'), 'internal_name="zip"');
}
}
开发者ID:alefernie,项目名称:intranet,代码行数:7,代码来源:m140907_140822_zip_field_to_text.php
示例4: actionIndex
/**
* Configuration Action for Super Admins
*/
public function actionIndex()
{
Yii::import('library.forms.*');
$form = new LibraryAdminForm();
// uncomment the following code to enable ajax-based validation
//if (isset($_POST['ajax']) && $_POST['ajax'] === 'LibraryAdminForm') {
// echo CActiveForm::validate($form);
// Yii::app()->end();
//}
if (isset($_POST['LibraryAdminForm'])) {
$_POST['LibraryAdminForm'] = Yii::app()->input->stripClean($_POST['LibraryAdminForm']);
$form->attributes = $_POST['LibraryAdminForm'];
if ($form->validate()) {
$form->globalPublicLibrary = HSetting::Set('globalPublicLibrary', $form->globalPublicLibrary, 'library');
$form->disclaimerWidget = HSetting::Set('disclaimerWidget', $form->disclaimerWidget, 'library');
$form->disclaimerTitle = HSetting::Set('disclaimerTitle', $form->disclaimerTitle, 'library');
$form->disclaimerContent = HSetting::Set('disclaimerContent', $form->disclaimerContent, 'library');
$this->redirect(Yii::app()->createUrl('library/admin/index'));
}
} else {
$form->globalPublicLibrary = HSetting::Get('globalPublicLibrary', 'library');
$form->disclaimerWidget = HSetting::Get('disclaimerWidget', 'library');
$form->disclaimerTitle = HSetting::Get('disclaimerTitle', 'library');
$form->disclaimerContent = HSetting::Get('disclaimerContent', 'library');
}
$this->render('index', array('model' => $form));
}
开发者ID:tejrajs,项目名称:humhub-modules-library,代码行数:30,代码来源:AdminController.php
示例5: actionIndex
/**
* This is the action to handle external exceptions.
*/
public function actionIndex()
{
if ($error = Yii::app()->errorHandler->error) {
if (Yii::app()->request->isAjaxRequest) {
echo CHtml::encode($error['message']);
return;
}
/**
* Switch to plain base layout, in case the user is not logged in
* and public access is disabled.
*/
if (Yii::app()->user->isGuest && !HSetting::Get('allowGuestAccess', 'authentication_internal')) {
$this->layout = "application.views.error._layout";
}
if ($error['type'] == 'CHttpException') {
switch ($error['code']) {
case 401:
Yii::app()->user->returnUrl = Yii::app()->request->requestUri;
return $this->render('401', $error);
break;
}
}
$this->render('index', $error);
}
}
开发者ID:skapl,项目名称:design,代码行数:28,代码来源:ErrorController.php
示例6: up
public function up()
{
$connection = $this->getDbConnection();
$command = $connection->commandBuilder->createFindCommand('user', new CDbCriteria());
$reader = $command->query();
foreach ($reader as $row) {
// Ignore deleted users
if ($row['status'] == 3) {
continue;
}
$userId = $row['id'];
$receive_email_notifications = $row['receive_email_notifications'];
$receive_email_messaging = $row['receive_email_messaging'];
$receive_email_activities = $row['receive_email_activities'];
$insertCommand = $connection->commandBuilder->createInsertCommand('user_setting', array('user_id' => $userId, 'module_id' => 'core', 'name' => 'receive_email_notifications', 'value' => $receive_email_notifications));
$insertCommand->execute();
$insertCommand = $connection->commandBuilder->createInsertCommand('user_setting', array('user_id' => $userId, 'module_id' => 'core', 'name' => 'receive_email_messaging', 'value' => $receive_email_messaging));
$insertCommand->execute();
$insertCommand = $connection->commandBuilder->createInsertCommand('user_setting', array('user_id' => $userId, 'module_id' => 'core', 'name' => 'receive_email_activities', 'value' => $receive_email_activities));
$insertCommand->execute();
}
$this->dropColumn('user', 'receive_email_notifications');
$this->dropColumn('user', 'receive_email_messaging');
$this->dropColumn('user', 'receive_email_activities');
if (HSetting::isInstalled()) {
$this->insert('setting', array('name' => 'receive_email_activities', 'value' => '1', 'name' => 'mailing'));
$this->insert('setting', array('name' => 'receive_email_notifications', 'value' => '2', 'name' => 'mailing'));
}
}
开发者ID:alefernie,项目名称:intranet,代码行数:29,代码来源:m140705_065525_emailing_settings.php
示例7: run
/**
* Executes the widget.
*/
public function run()
{
$blacklisted_objects = explode(',', HSetting::GetText('showFilesWidgetBlacklist', 'file'));
if (!in_array(get_class($this->object), $blacklisted_objects)) {
$files = File::getFilesOfObject($this->object);
$this->render('showFiles', array('files' => $files, 'maxPreviewImageWidth' => HSetting::Get('maxPreviewImageWidth', 'file'), 'maxPreviewImageHeight' => HSetting::Get('maxPreviewImageHeight', 'file'), 'hideImageFileInfo' => HSetting::Get('hideImageFileInfo', 'file')));
}
}
开发者ID:skapl,项目名称:design,代码行数:11,代码来源:ShowFilesWidget.php
示例8: actionIndex
/**
* Dashboard Index
*
* Show recent wall entries for this user
*/
public function actionIndex()
{
if (Yii::app()->user->isGuest) {
$this->render('index_guest', array());
} else {
$this->render('index', array('showProfilePostForm' => HSetting::Get('showProfilePostForm', 'dashboard')));
}
}
开发者ID:skapl,项目名称:design,代码行数:13,代码来源:DashboardController.php
示例9: up
public function up()
{
if (HSetting::isInstalled()) {
$this->insert('setting', array('name' => 'enable_html5_desktop_notifications', 'value' => 0, 'module_id' => 'notification'));
}
$this->addColumn('notification', 'desktop_notified', 'tinyint(1) DEFAULT 0');
$this->update('notification', array('desktop_notified' => 1));
}
开发者ID:skapl,项目名称:design,代码行数:8,代码来源:m150204_103433_html5_notified.php
示例10: doBaseTasks
/**
* Do general tasks used application whide
*/
protected function doBaseTasks()
{
$this->showTestHeadline("Checking application base structure");
if (HSetting::Get('secret') == "" || HSetting::Get('secret') == null) {
HSetting::Set('secret', UUID::v4());
$this->showFix('Setting missing application secret!');
}
}
开发者ID:skapl,项目名称:design,代码行数:11,代码来源:IntegrityChecker.php
示例11: setupRequestInfo
/**
* Sets some mandatory request infos to ensure absolute url creation.
* These values are extracted from baseUrl which is stored as HSetting.
*/
private function setupRequestInfo()
{
$parsedUrl = parse_url(HSetting::Get('baseUrl'));
$path = isset($parsedUrl['path']) ? $parsedUrl['path'] : '';
$port = isset($parsedUrl['port']) ? ':' . $parsedUrl['port'] : '';
Yii::app()->request->setHostInfo($parsedUrl['scheme'] . '://' . $parsedUrl['host'] . $port);
Yii::app()->request->setBaseUrl(HSetting::Get('baseUrl'));
Yii::app()->request->setScriptUrl($path . '/index.php');
}
开发者ID:alefernie,项目名称:intranet,代码行数:13,代码来源:HConsoleApplication.php
示例12: onDashboardSidebarInit
public static function onDashboardSidebarInit($event)
{
if (Yii::app()->user->isGuest) {
return;
}
if (HSetting::Get('enable', 'tour') == 1 && Yii::app()->user->getModel()->getSetting("hideTourPanel", "tour") != 1) {
$event->sender->addWidget('application.modules_core.tour.widgets.TourDashboardWidget', array(), array('sortOrder' => 0));
}
}
开发者ID:skapl,项目名称:design,代码行数:9,代码来源:TourModule.php
示例13: run
public function run()
{
$disclaimerWidget = HSetting::Get('disclaimerWidget', 'library');
$disclaimerTitle = HSetting::Get('disclaimerTitle', 'library');
$disclaimerContent = HSetting::Get('disclaimerContent', 'library');
if ($disclaimerWidget) {
$this->render('disclaimerPanel', array('disclaimerTitle' => $disclaimerTitle, 'disclaimerContent' => $disclaimerContent));
}
}
开发者ID:tejrajs,项目名称:humhub-modules-library,代码行数:9,代码来源:DisclaimerWidget.php
示例14: send
public function send($email)
{
$message = new HMailMessage();
$message->addFrom(HSetting::Get('systemEmailAddress', 'mailing'), HSetting::Get('systemEmailName', 'mailing'));
$message->addTo($email);
$message->view = "application.views.mail.TextOnly";
$message->subject = $this->subject;
$message->setBody(array('message' => $this->message), 'text/html');
Yii::app()->mail->send($message);
}
开发者ID:alefernie,项目名称:intranet,代码行数:10,代码来源:ApproveUserForm.php
示例15: actionIndex
public function actionIndex()
{
$criteria = new CDbCriteria();
if (HSetting::Get('roomOrder', 'room') == 0) {
$criteria->order = 'name ASC';
} else {
$criteria->order = 'last_visit DESC';
}
$memberships = RoomMembership::model()->with('room')->findAllByAttributes(array('user_id' => Yii::app()->user->id, 'status' => RoomMembership::STATUS_MEMBER), $criteria);
$this->renderPartial('index', array('memberships' => $memberships), false, true);
}
开发者ID:verdin12345,项目名称:humhub-modules-rooms,代码行数:11,代码来源:LController.php
示例16: actionSearchJson
/**
* Returns a workspace list by json
*
* It can be filtered by by keyword.
*/
public function actionSearchJson()
{
$keyword = Yii::app()->request->getParam('keyword', "");
// guid of user/workspace
$page = (int) Yii::app()->request->getParam('page', 1);
// current page (pagination)
$limit = (int) Yii::app()->request->getParam('limit', HSetting::Get('paginationSize'));
// current page (pagination)
$keyword = Yii::app()->input->stripClean($keyword);
$hitCount = 0;
$query = "model:Space ";
if (strlen($keyword) > 2) {
// Include Keyword
if (strpos($keyword, "@") === false) {
$keyword = str_replace(".", "", $keyword);
$query .= "AND (title:" . $keyword . "* OR tags:" . $keyword . "*)";
}
}
//, $limit, $page
$hits = new ArrayObject(HSearch::getInstance()->Find($query));
$hitCount = count($hits);
// Limit Hits
$hits = new LimitIterator($hits->getIterator(), ($page - 1) * $limit, $limit);
$json = array();
#$json['totalHits'] = $hitCount;
#$json['limit'] = $limit;
#$results = array();
foreach ($hits as $hit) {
$doc = $hit->getDocument();
$model = $doc->getField("model")->value;
if ($model == "Space") {
$workspaceId = $doc->getField('pk')->value;
$workspace = Space::model()->findByPk($workspaceId);
if ($workspace != null) {
$wsInfo = array();
$wsInfo['guid'] = $workspace->guid;
$wsInfo['title'] = CHtml::encode($workspace->name);
$wsInfo['tags'] = CHtml::encode($workspace->tags);
$wsInfo['image'] = $workspace->getProfileImage()->getUrl();
$wsInfo['link'] = $workspace->getUrl();
#$results[] = $wsInfo;
$json[] = $wsInfo;
} else {
Yii::log("Could not load workspace with id " . $userId . " from search index!", CLogger::LEVEL_ERROR);
}
} else {
Yii::log("Got no workspace hit from search index!", CLogger::LEVEL_ERROR);
}
}
#$json['results'] = $results;
print CJSON::encode($json);
Yii::app()->end();
}
开发者ID:alefernie,项目名称:intranet,代码行数:58,代码来源:BrowseController.php
示例17: GetLikes
/**
* Like Count for specifc model
*/
public static function GetLikes($objectModel, $objectId)
{
$cacheId = "likes_" . $objectModel . "_" . $objectId;
$cacheValue = Yii::app()->cache->get($cacheId);
if ($cacheValue === false) {
$newCacheValue = Like::model()->findAllByAttributes(array('object_model' => $objectModel, 'object_id' => $objectId));
Yii::app()->cache->set($cacheId, $newCacheValue, HSetting::Get('expireTime', 'cache'));
return $newCacheValue;
} else {
return $cacheValue;
}
}
开发者ID:skapl,项目名称:design,代码行数:15,代码来源:Like.php
示例18: validateExtension
/**
* Validate the file extensions.
*/
public function validateExtension($attribute, $params)
{
$allowedExtensions = HSetting::get('allowedExtensions', 'album');
if ($allowedExtensions != "") {
$extension = $this->getExtension();
$extension = trim(strtolower($extension));
$allowed = array_map('trim', explode(",", $allowedExtensions));
if (!in_array($extension, $allowed)) {
$this->addError($attribute, 'This file type is not allowed!');
}
}
}
开发者ID:rafapaul,项目名称:humhub-modules-album,代码行数:15,代码来源:PublicFile.php
示例19: up
public function up()
{
$allowedExtensions = HSetting::Get('allowedExtensions', 'file');
if ($allowedExtensions != "") {
HSetting::Set('allowedExtensions', '', 'file');
HSetting::SetText('allowedExtensions', $allowedExtensions, 'file');
}
$showFilesWidgetBlacklist = HSetting::Get('showFilesWidgetBlacklist', 'file');
if ($showFilesWidgetBlacklist != "") {
HSetting::Set('showFilesWidgetBlacklist', '', 'file');
HSetting::SetText('showFilesWidgetBlacklist', $showFilesWidgetBlacklist, 'file');
}
}
开发者ID:skapl,项目名称:design,代码行数:13,代码来源:m150322_195619_allowedExt2Text.php
示例20: sendChangeEmail
/**
* Sends Change E-Mail E-Mail
*
*/
public function sendChangeEmail()
{
if ($this->validate()) {
$user = User::model()->findByPk(Yii::app()->user->id);
$token = md5(HSetting::Get('secret') . $user->guid . $this->newEmail);
$message = new HMailMessage();
$message->view = "application.modules_core.user.views.mails.ChangeEmail";
$message->addFrom(HSetting::Get('systemEmailAddress', 'mailing'), HSetting::Get('systemEmailName', 'mailing'));
$message->addTo($this->newEmail);
$message->subject = Yii::t('UserModule.forms_AccountChangeEmailForm', 'E-Mail change');
$message->setBody(array('user' => $user, 'newEmail' => $this->newEmail, 'token' => $token), 'text/html');
Yii::app()->mail->send($message);
}
}
开发者ID:alefernie,项目名称:intranet,代码行数:18,代码来源:AccountChangeEmailForm.php
注:本文中的HSetting类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论