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


PHP Gdn::config方法代码示例

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


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

示例1: folders

 /**
  * Returns an array of all folder names within the source folder or FALSE
  * if SourceFolder does not exist.
  *
  * @param string $SourceFolder
  */
 public static function folders($SourceFolders)
 {
     if (!is_array($SourceFolders)) {
         $SourceFolders = array($SourceFolders);
     }
     $BlackList = Gdn::config('Garden.FolderBlacklist');
     if (!is_array($BlackList)) {
         $BlackList = array('.', '..');
     }
     $Result = array();
     foreach ($SourceFolders as $SourceFolder) {
         if ($DirectoryHandle = opendir($SourceFolder)) {
             while (($Item = readdir($DirectoryHandle)) !== false) {
                 $SubFolder = combinePaths(array($SourceFolder, $Item));
                 if (!in_array($Item, $BlackList) && is_dir($SubFolder)) {
                     $Result[] = $Item;
                 }
             }
             closedir($DirectoryHandle);
         }
     }
     if (count($Result) == 0) {
         return false;
     }
     return $Result;
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:32,代码来源:class.filesystem.php

示例2: __construct

 /**
  *
  */
 public function __construct()
 {
     $this->Dispatcher = new Gdn_Dispatcher();
     $EnabledApplications = Gdn::config('EnabledApplications');
     $this->Dispatcher->enabledApplicationFolders($EnabledApplications);
     $this->Dispatcher->passProperty('EnabledApplications', $EnabledApplications);
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:10,代码来源:class.slice.php

示例3: get

 /**
  * Get list of conversations.
  *
  * Events: BeforeGet.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $ViewingUserID Unique ID of current user.
  * @param int $Offset Number to skip.
  * @param int $Limit Maximum to return.
  * @return Gdn_DataSet SQL results.
  */
 public function get($ViewingUserID, $Offset = '0', $Limit = '')
 {
     if ($Limit == '') {
         $Limit = Gdn::config('Conversations.Conversations.PerPage', 30);
     }
     $Offset = !is_numeric($Offset) || $Offset < 0 ? 0 : $Offset;
     // Grab the base list of conversations.
     $Data = $this->SQL->select('c.*')->select('uc.CountReadMessages')->select('uc.LastMessageID', '', 'UserLastMessageID')->from('UserConversation uc')->join('Conversation c', 'uc.ConversationID = c.ConversationID')->where('uc.UserID', $ViewingUserID)->where('uc.Deleted', 0)->orderBy('c.DateUpdated', 'desc')->limit($Limit, $Offset)->get()->resultArray();
     $this->joinLastMessages($Data);
     return $Data;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:24,代码来源:class.conversationmodel.php

示例4: get

 /**
  * Get messages by conversation.
  *
  * Events: BeforeGet.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $ConversationID Unique ID of conversation being viewed.
  * @param int $ViewingUserID Unique ID of current user.
  * @param int $Offset Number to skip.
  * @param int $Limit Maximum to return.
  * @param array $Wheres SQL conditions.
  * @return Gdn_DataSet SQL results.
  */
 public function get($ConversationID, $ViewingUserID, $Offset = '0', $Limit = '', $Wheres = '')
 {
     if ($Limit == '') {
         $Limit = Gdn::config('Conversations.Messages.PerPage', 50);
     }
     $Offset = !is_numeric($Offset) || $Offset < 0 ? 0 : $Offset;
     if (is_array($Wheres)) {
         $this->SQL->where($Wheres);
     }
     $this->fireEvent('BeforeGet');
     return $this->SQL->select('cm.*')->select('iu.Name', '', 'InsertName')->select('iu.Email', '', 'InsertEmail')->select('iu.Photo', '', 'InsertPhoto')->from('ConversationMessage cm')->join('Conversation c', 'cm.ConversationID = c.ConversationID')->join('UserConversation uc', 'c.ConversationID = uc.ConversationID and uc.UserID = ' . $ViewingUserID, 'left')->join('User iu', 'cm.InsertUserID = iu.UserID', 'left')->beginWhereGroup()->where('uc.DateCleared is null')->orWhere('uc.DateCleared <', 'cm.DateInserted', true, false)->endWhereGroup()->where('cm.ConversationID', $ConversationID)->orderBy('cm.DateInserted', 'asc')->limit($Limit, $Offset)->get();
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:27,代码来源:class.conversationmessagemodel.php

示例5: index

 /**
  * Statistics setup & configuration.
  *
  * @since 2.0.17
  * @access public
  */
 public function index()
 {
     $this->permission('Garden.Settings.Manage');
     $this->addSideMenu('dashboard/statistics');
     //$this->addJsFile('statistics.js');
     $this->title(t('Vanilla Statistics'));
     $this->enableSlicing($this);
     if ($this->Form->authenticatedPostBack()) {
         $Flow = true;
         if ($Flow && $this->Form->getFormValue('Reregister')) {
             Gdn::Statistics()->register();
         }
         if ($Flow && $this->Form->getFormValue('Save')) {
             Gdn::installationID($this->Form->getFormValue('InstallationID'));
             Gdn::installationSecret($this->Form->getFormValue('InstallationSecret'));
             $this->informMessage(t("Your settings have been saved."));
         }
         if ($Flow && $this->Form->getFormValue('AllowLocal')) {
             saveToConfig('Garden.Analytics.AllowLocal', true);
         }
         if ($Flow && $this->Form->getFormValue('Allow')) {
             saveToConfig('Garden.Analytics.Enabled', true);
         }
         if ($Flow && $this->Form->getFormValue('ClearCredentials')) {
             Gdn::installationID(false);
             Gdn::installationSecret(false);
             Gdn::statistics()->Tick();
             $Flow = false;
         }
     } else {
         $this->Form->setValue('InstallationID', Gdn::installationID());
         $this->Form->setValue('InstallationSecret', Gdn::installationSecret());
     }
     $AnalyticsEnabled = Gdn_Statistics::checkIsEnabled();
     if ($AnalyticsEnabled) {
         $ConfFile = Gdn::config()->defaultPath();
         $this->setData('ConfWritable', $ConfWritable = is_writable($ConfFile));
         if (!$ConfWritable) {
             $AnalyticsEnabled = false;
         }
     }
     $this->setData('AnalyticsEnabled', $AnalyticsEnabled);
     $NotifyMessage = Gdn::get('Garden.Analytics.Notify', false);
     $this->setData('NotifyMessage', $NotifyMessage);
     if ($NotifyMessage !== false) {
         Gdn::set('Garden.Analytics.Notify', null);
     }
     $this->render();
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:55,代码来源:class.statisticscontroller.php

示例6: settingsController_PostUrl_create

 public function settingsController_PostUrl_create($Sender, $args)
 {
     $Sender->permission('Garden.Settings.Manage');
     $Cf = new ConfigurationModule($Sender);
     if (c('Plugins.PostUrl.Display1') == "") {
         Gdn::config()->set('Plugins.PostUrl.Display1', "from: %post_url%", false, false);
     }
     $Description = '<p>可接受下列占位符号,该符号和wordpress兼容: <br />%site_url% - the URI of your site<br />%site_name% - the name of your site<br />%post_url% - the URI of the post where the text is displayed<br />%post_title% - the title of the post where the text is displayed</p>';
     $Cf->initialize(array('Plugins.PostUrl.ItemName1' => array('LabelCode' => '版权名称一', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display1' => array('LabelCode' => '版权信息一', 'Control' => 'TextBox', 'Description' => $Description, 'Items' => array(), 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.ItemName2' => array('LabelCode' => '<hr /><br />版权名称二', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display2' => array('LabelCode' => '版权信息二', 'Control' => 'TextBox', 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.ItemName3' => array('LabelCode' => '<hr /><br />版权名称三', 'Control' => 'TextBox', 'Description' => "该字段用于发布话题时选择方便记忆"), 'Plugins.PostUrl.Display3' => array('LabelCode' => '版权信息三', 'Control' => 'TextBox', 'Options' => array("MultiLine" => true, "rows" => "20", "cols" => 30)), 'Plugins.PostUrl.Default' => array('LabelCode' => '默认版权信息', 'Control' => 'DropDown', 'Description' => "没有选择或者历史文章将会使用该设定", 'Items' => array(0 => '', 1 => '版权一', 2 => '版权二', 3 => '版权三'), 'Options' => array('Value' => c('Plugins.PostUrl.Default')))));
     $c = Gdn::controller();
     $c->addJsFile('settings.js', 'plugins/CDNManager');
     $Sender->addSideMenu();
     $Sender->setData('Title', t('Add Post Url'));
     $Cf->renderAll();
 }
开发者ID:xjtdy888,项目名称:vanilla-posturl,代码行数:15,代码来源:class.posturl.plugin.php

示例7: settingsController_cdnmanager_create

    public function settingsController_cdnmanager_create($Sender, $args)
    {
        $Sender->permission('Garden.Settings.Manage');
        $Cf = new ConfigurationModule($Sender);
        if (c('Plugins.CDNManager.CDNSources') == "") {
            $defaultCDNValue = "jquery.js = \"http://libs.baidu.com/jquery/1.10.2/jquery.min.js\"\r\njquery-ui.js = \"http://apps.bdimg.com/libs/jqueryui/1.10.4/jquery-ui.min.js\"";
            Gdn::config()->set('Plugins.CDNManager.CDNSources', $defaultCDNValue, false, false);
        }
        $Cf->initialize(array('Plugins.CDNManager.CDNSources' => array('LabelCode' => 'CDN使用源列表', 'Control' => 'TextBox', 'Options' => array('MultiLine' => true, 'rows' => 20, 'cols' => 50), 'Description' => '<p>输入需要用CDN加速的文件和对应的地址,如jquery等国内国外都有开放的CDN源,也可申请<font color="red"><a href="https://portal.qiniu.com/signup?code=3lcqpvqtedfma" target="_blank">七牛</a></font>免费的空间来加速您的网站,<a href="https://portal.qiniu.com/signup?code=3lcqpvqtedfma" target="_blank">点击这里免费申请七牛加速空间</a></p> <p><small><strong>
</strong> </small></p>', 'Items' => array())));
        $c = Gdn::controller();
        $c->addJsFile('settings.js', 'plugins/CDNManager');
        $Sender->addSideMenu();
        $Sender->setData('Title', t('CDN源设置'));
        $Cf->renderAll();
    }
开发者ID:xjtdy888,项目名称:Vanilla-Plugin-CDNManager,代码行数:16,代码来源:class.cdnmanager.plugin.php

示例8: advanced

 /**
  * Advanced settings.
  *
  * Allows setting configuration values via form elements.
  *
  * @since 2.0.0
  * @access public
  */
 public function advanced()
 {
     // Check permission
     $this->permission('Garden.Settings.Manage');
     // Load up config options we'll be setting
     $Validation = new Gdn_Validation();
     $ConfigurationModel = new Gdn_ConfigurationModel($Validation);
     $ConfigurationModel->setField(array('Vanilla.Discussions.PerPage', 'Vanilla.Comments.AutoRefresh', 'Vanilla.Comments.PerPage', 'Garden.Html.AllowedElements', 'Vanilla.Archive.Date', 'Vanilla.Archive.Exclude', 'Garden.EditContentTimeout', 'Vanilla.AdminCheckboxes.Use', 'Vanilla.Discussions.SortField' => 'd.DateLastComment', 'Vanilla.Discussions.UserSortField', 'Vanilla.Comment.MaxLength', 'Vanilla.Comment.MinLength'));
     // Set the model on the form.
     $this->Form->setModel($ConfigurationModel);
     // If seeing the form for the first time...
     if ($this->Form->authenticatedPostBack() === false) {
         // Apply the config settings to the form.
         $this->Form->setData($ConfigurationModel->Data);
     } else {
         // Define some validation rules for the fields being saved
         $ConfigurationModel->Validation->applyRule('Vanilla.Discussions.PerPage', 'Required');
         $ConfigurationModel->Validation->applyRule('Vanilla.Discussions.PerPage', 'Integer');
         $ConfigurationModel->Validation->applyRule('Vanilla.Comments.AutoRefresh', 'Integer');
         $ConfigurationModel->Validation->applyRule('Vanilla.Comments.PerPage', 'Required');
         $ConfigurationModel->Validation->applyRule('Vanilla.Comments.PerPage', 'Integer');
         $ConfigurationModel->Validation->applyRule('Vanilla.Archive.Date', 'Date');
         $ConfigurationModel->Validation->applyRule('Garden.EditContentTimeout', 'Integer');
         $ConfigurationModel->Validation->applyRule('Vanilla.Comment.MaxLength', 'Required');
         $ConfigurationModel->Validation->applyRule('Vanilla.Comment.MaxLength', 'Integer');
         // Grab old config values to check for an update.
         $ArchiveDateBak = Gdn::config('Vanilla.Archive.Date');
         $ArchiveExcludeBak = (bool) Gdn::config('Vanilla.Archive.Exclude');
         // Save new settings
         $Saved = $this->Form->save();
         if ($Saved) {
             $ArchiveDate = Gdn::config('Vanilla.Archive.Date');
             $ArchiveExclude = (bool) Gdn::config('Vanilla.Archive.Exclude');
             if ($ArchiveExclude != $ArchiveExcludeBak || $ArchiveExclude && $ArchiveDate != $ArchiveDateBak) {
                 $DiscussionModel = new DiscussionModel();
                 $DiscussionModel->UpdateDiscussionCount('All');
             }
             $this->informMessage(t("Your changes have been saved."));
         }
     }
     $this->addSideMenu('vanilla/settings/advanced');
     $this->addJsFile('settings.js');
     $this->title(t('Advanced Forum Settings'));
     // Render default view (settings/advanced.php)
     $this->render();
 }
开发者ID:akratiani,项目名称:vanilla,代码行数:54,代码来源:class.settingscontroller.php

示例9: __construct

 /**
  * Class constructor
  *
  * @param object $Sender
  */
 public function __construct($Sender = '', $ApplicationFolder = false)
 {
     if (!$Sender) {
         $Sender = Gdn::controller();
     }
     if (is_object($Sender)) {
         $this->_ApplicationFolder = $Sender->ApplicationFolder;
         $this->_ThemeFolder = $Sender->Theme;
     } else {
         $this->_ApplicationFolder = 'dashboard';
         $this->_ThemeFolder = Gdn::config('Garden.Theme');
     }
     if ($ApplicationFolder !== false) {
         $this->_ApplicationFolder = $ApplicationFolder;
     }
     if (is_object($Sender)) {
         $this->_Sender = $Sender;
     }
     parent::__construct();
 }
开发者ID:karanjitsingh,项目名称:iecse-forum,代码行数:25,代码来源:class.module.php

示例10: index

 /**
  * Default all drafts view: chronological by time saved.
  *
  * @since 2.0.0
  * @access public
  *
  * @param int $Offset Number of drafts to skip.
  */
 public function index($Offset = '0')
 {
     Gdn_Theme::section('DiscussionList');
     // Setup head
     $this->permission('Garden.SignIn.Allow');
     $this->addJsFile('jquery.gardenmorepager.js');
     $this->addJsFile('discussions.js');
     $this->title(t('My Drafts'));
     // Validate $Offset
     if (!is_numeric($Offset) || $Offset < 0) {
         $Offset = 0;
     }
     // Set criteria & get drafts data
     $Limit = Gdn::config('Vanilla.Discussions.PerPage', 30);
     $Session = Gdn::session();
     $Wheres = array('d.InsertUserID' => $Session->UserID);
     $this->DraftData = $this->DraftModel->getByUser($Session->UserID, $Offset, $Limit);
     $CountDrafts = $this->DraftModel->getCountByUser($Session->UserID);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $this->Pager = $PagerFactory->GetPager('MorePager', $this);
     $this->Pager->MoreCode = 'More drafts';
     $this->Pager->LessCode = 'Newer drafts';
     $this->Pager->ClientID = 'Pager';
     $this->Pager->configure($Offset, $Limit, $CountDrafts, 'drafts/%1$s');
     // Deliver JSON data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL) {
         $this->setJson('LessRow', $this->Pager->toString('less'));
         $this->setJson('MoreRow', $this->Pager->toString('more'));
         $this->View = 'drafts';
     }
     // Add modules
     $this->addModule('DiscussionFilterModule');
     $this->addModule('NewDiscussionModule');
     $this->addModule('CategoriesModule');
     $this->addModule('BookmarkedModule');
     // Render default view (drafts/index.php)
     $this->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:47,代码来源:class.draftscontroller.php

示例11: enabledApplications

 /**
  * Gets an array of all of the enabled applications.
  *
  * @return array
  */
 public function enabledApplications()
 {
     if (!is_array($this->enabledApplications)) {
         $EnabledApplications = Gdn::config('EnabledApplications', array('Dashboard' => 'dashboard'));
         // Add some information about the applications to the array.
         foreach ($EnabledApplications as $Name => $Folder) {
             $EnabledApplications[$Name] = array('Folder' => $Folder);
             //$EnabledApplications[$Name]['Version'] = Gdn::Config($Name.'.Version', '');
             $EnabledApplications[$Name]['Version'] = '';
             $EnabledApplications[$Name]['Index'] = $Name;
             // Get the application version from it's about file.
             $AboutPath = PATH_APPLICATIONS . '/' . strtolower($Name) . '/settings/about.php';
             if (file_exists($AboutPath)) {
                 $ApplicationInfo = array();
                 include $AboutPath;
                 $EnabledApplications[$Name]['Version'] = GetValueR("{$Name}.Version", $ApplicationInfo, '');
             }
         }
         $this->enabledApplications = $EnabledApplications;
     }
     return $this->enabledApplications;
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:27,代码来源:class.applicationmanager.php

示例12: processAvatars

 /**
  * Create different sizes of user photos.
  */
 public function processAvatars()
 {
     $UploadImage = new Gdn_UploadImage();
     $UserData = $this->SQL->select('u.Photo')->from('User u')->get();
     foreach ($UserData->result() as $User) {
         try {
             $Image = PATH_ROOT . DS . 'uploads' . DS . str_replace('userpics', 'attachments', $User->Photo);
             // Check extension length
             $ImageExtension = strlen(pathinfo($Image, PATHINFO_EXTENSION));
             $ImageBaseName = pathinfo($Image, PATHINFO_BASENAME) + 1;
             if (!file_exists($Image)) {
                 rename(substr($Image, 0, -$ImageExtension), $Image);
             }
             // Make sure the avatars folder exists.
             if (!file_exists(PATH_ROOT . '/uploads/userpics')) {
                 mkdir(PATH_ROOT . '/uploads/userpics');
             }
             // Save the uploaded image in profile size
             if (!file_exists(PATH_ROOT . '/uploads/userpics/p' . $ImageBaseName)) {
                 $UploadImage->SaveImageAs($Image, PATH_ROOT . '/uploads/userpics/p' . $ImageBaseName, Gdn::config('Garden.Profile.MaxHeight', 1000), Gdn::config('Garden.Profile.MaxWidth', 250));
             }
             // Save the uploaded image in preview size
             /*if (!file_exists(PATH_ROOT.'/uploads/userpics/t'.$ImageBaseName))
               $UploadImage->SaveImageAs(
                  $Image,
                  PATH_ROOT.'/uploads/userpics/t'.$ImageBaseName,
                  Gdn::config('Garden.Preview.MaxHeight', 100),
                  Gdn::config('Garden.Preview.MaxWidth', 75)
               );*/
             // Save the uploaded image in thumbnail size
             $ThumbSize = Gdn::config('Garden.Thumbnail.Size', 40);
             if (!file_exists(PATH_ROOT . '/uploads/userpics/n' . $ImageBaseName)) {
                 $UploadImage->SaveImageAs($Image, PATH_ROOT . '/uploads/userpics/n' . $ImageBaseName, $ThumbSize, $ThumbSize, true);
             }
         } catch (Exception $ex) {
         }
     }
 }
开发者ID:caidongyun,项目名称:vanilla,代码行数:41,代码来源:class.smf2importmodel.php

示例13: initialize

 /**
  * The initialize method is called by the dispatcher after the constructor
  * has completed, objects have been passed along, assets have been
  * retrieved, and before the requested method fires. Use it in any extended
  * controller to do things like loading script and CSS into the head.
  */
 public function initialize()
 {
     if (in_array($this->SyndicationMethod, array(SYNDICATION_ATOM, SYNDICATION_RSS))) {
         $this->_Headers['Content-Type'] = 'text/xml; charset=' . c('Garden.Charset', 'utf-8');
     }
     if (is_object($this->Menu)) {
         $this->Menu->Sort = Gdn::config('Garden.Menu.Sort');
     }
     $ResolvedPath = strtolower(combinePaths(array(Gdn::dispatcher()->application(), Gdn::dispatcher()->ControllerName, Gdn::dispatcher()->ControllerMethod)));
     $this->ResolvedPath = $ResolvedPath;
     $this->FireEvent('Initialize');
 }
开发者ID:battaglia01,项目名称:vanilla,代码行数:18,代码来源:class.controller.php

示例14: config

 /**
  * Retrieves a configuration setting.
  *
  * @param string|bool $Name The name of the configuration setting.
  * Settings in different sections are separated by dots.
  * @param mixed $Default The result to return if the configuration setting is not found.
  * @return mixed The configuration setting.
  * @see Gdn::config()
  */
 function config($Name = false, $Default = false)
 {
     return Gdn::config($Name, $Default);
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:13,代码来源:functions.general.php

示例15: sendPasswordEmail

 /**
  * Send password email.
  *
  * @param $UserID
  * @param $Password
  * @throws Exception
  */
 public function sendPasswordEmail($UserID, $Password)
 {
     $Session = Gdn::session();
     $Sender = $this->getID($Session->UserID);
     $User = $this->getID($UserID);
     $AppTitle = Gdn::config('Garden.Title');
     $Email = new Gdn_Email();
     $Email->subject(sprintf(t('[%s] Password Reset'), $AppTitle));
     $Email->to($User->Email);
     $Data = array();
     $Data['User'] = arrayTranslate((array) $User, array('Name', 'Email'));
     $Data['Sender'] = arrayTranslate((array) $Sender, array('Name', 'Email'));
     $Data['Title'] = $AppTitle;
     $EmailFormat = t('EmailPassword');
     if (strpos($EmailFormat, '{') !== false) {
         $Message = formatString($EmailFormat, $Data);
     } else {
         $Message = sprintf($EmailFormat, $User->Name, $Sender->Name, $AppTitle, ExternalUrl('/'), $Password, $User->Email);
     }
     $Message = $this->_addEmailHeaderFooter($Message, $Data);
     $Email->message($Message);
     $Email->send();
 }
开发者ID:RodSloan,项目名称:vanilla,代码行数:30,代码来源:class.usermodel.php


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