当前位置: 首页>>代码示例>>PHP>>正文


PHP HSetting::Get方法代码示例

本文整理汇总了PHP中HSetting::Get方法的典型用法代码示例。如果您正苦于以下问题:PHP HSetting::Get方法的具体用法?PHP HSetting::Get怎么用?PHP HSetting::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在HSetting的用法示例。


在下文中一共展示了HSetting::Get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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

示例2: testFixedSettings

 public function testFixedSettings()
 {
     Yii::app()->params['HSettingFixed'] = array('test' => 'abc');
     $this->assertEquals(HSetting::Get('test'), 'abc');
     HSetting::Set('test', 'bcd');
     $this->assertEquals(HSetting::Get('test'), 'abc');
 }
开发者ID:alefernie,项目名称:intranet,代码行数:7,代码来源:HSettingTest.php

示例3: 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

示例4: 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

示例5: 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

示例6: isConfigured

 /**
  * Checks if the application is already configured.
  */
 public function isConfigured()
 {
     if (HSetting::Get('secret') != "") {
         return true;
     }
     return false;
 }
开发者ID:skapl,项目名称:design,代码行数:10,代码来源:InstallerModule.php

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: 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

示例15: 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


注:本文中的HSetting::Get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。