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


PHP Settings::copyDefaultScopeSetting方法代码示例

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


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

示例1: runConfigureUploads

 public function runConfigureUploads(framework\Request $request)
 {
     $this->uploads_enabled = framework\Context::getScope()->isUploadsEnabled();
     if ($this->uploads_enabled && $request->isPost()) {
         $this->forward403unless($this->access_level == framework\Settings::ACCESS_FULL);
         if ($request['enable_uploads']) {
             if (framework\Context::getScope()->isDefault()) {
                 $settings = array('upload_restriction_mode', 'upload_extensions_list', 'upload_max_file_size', 'upload_storage', 'upload_localpath');
                 if ($request['upload_storage'] == 'files' && (bool) $request['enable_uploads']) {
                     if (!is_dir($request['upload_localpath'])) {
                         mkdir($request['upload_localpath'], 0744, true);
                     }
                     if (!is_writable($request['upload_localpath'])) {
                         $this->getResponse()->setHttpStatus(400);
                         return $this->renderJSON(array('error' => framework\Context::getI18n()->__("The upload path isn't writable")));
                     }
                 }
             } else {
                 $settings = array('upload_restriction_mode', 'upload_extensions_list', 'upload_max_file_size');
                 framework\Settings::copyDefaultScopeSetting('upload_localpath');
             }
             if (!is_numeric($request['upload_max_file_size'])) {
                 $this->getResponse()->setHttpStatus(400);
                 return $this->renderJSON(array('error' => framework\Context::getI18n()->__("The maximum file size must be a number")));
             }
             foreach ($settings as $setting) {
                 if (framework\Context::getRequest()->hasParameter($setting)) {
                     framework\Settings::saveSetting($setting, framework\Context::getRequest()->getParameter($setting));
                 }
             }
         }
         framework\Settings::saveSetting('upload_allow_image_caching', framework\Context::getRequest()->getParameter('upload_allow_image_caching'));
         framework\Settings::saveSetting('upload_delivery_use_xsend', framework\Context::getRequest()->getParameter('upload_delivery_use_xsend'));
         framework\Settings::saveSetting('enable_uploads', framework\Context::getRequest()->getParameter('enable_uploads'));
         return $this->renderJSON(array('title' => framework\Context::getI18n()->__('All settings saved')));
     }
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:37,代码来源:Main.php


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