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


PHP Settings::isUploadsImageCachingEnabled方法代码示例

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


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

示例1: runGetFile

 public function runGetFile(framework\Request $request)
 {
     $file = new entities\File((int) $request['id']);
     if ($file instanceof entities\File) {
         if ($file->hasAccess()) {
             $disableCache = true;
             $isFile = false;
             $this->getResponse()->cleanBuffer();
             $this->getResponse()->clearHeaders();
             $this->getResponse()->setDecoration(\thebuggenie\core\framework\Response::DECORATE_NONE);
             if ($file->isImage() && \thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) {
                 $this->getResponse()->addHeader('Pragma: public');
                 $this->getResponse()->addHeader('Cache-Control: public, max-age: 15768000');
                 $this->getResponse()->addHeader("Expires: " . gmdate('D, d M Y H:i:s', time() + 15768000) . " GMT");
                 $disableCache = false;
             }
             $this->getResponse()->addHeader('Content-disposition: ' . ($request['mode'] == 'download' ? 'attachment' : 'inline') . '; filename="' . $file->getOriginalFilename() . '"');
             $this->getResponse()->setContentType($file->getContentType());
             if (framework\Settings::getUploadStorage() == 'files') {
                 $fh = fopen(framework\Settings::getUploadsLocalpath() . $file->getRealFilename(), 'r');
                 $isFile = true;
             } else {
                 $fh = $file->getContent();
             }
             if (is_resource($fh)) {
                 if ($isFile && \thebuggenie\core\framework\Settings::isUploadsDeliveryUseXsend()) {
                     $this->getResponse()->addHeader('X-Sendfile: ' . framework\Settings::getUploadsLocalpath() . $file->getRealFilename());
                     $this->getResponse()->addHeader('X-Accel-Redirect: /files/' . $file->getRealFilename());
                     $this->getResponse()->renderHeaders($disableCache);
                 } else {
                     $this->getResponse()->renderHeaders($disableCache);
                     fpassthru($fh);
                 }
             } else {
                 $this->getResponse()->renderHeaders($disableCache);
                 echo $fh;
             }
             exit;
         }
     }
     $this->return404(framework\Context::getI18n()->__('This file does not exist'));
 }
开发者ID:nrensen,项目名称:thebuggenie,代码行数:42,代码来源:Main.php

示例2: __

                            <td style="width: auto;">
                                <?php 
    if ($access_level == \thebuggenie\core\framework\Settings::ACCESS_FULL) {
        ?>
                                <input type="radio" name="upload_allow_image_caching" value="1" id="upload_allow_image_caching_yes"<?php 
        if (\thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) {
            ?>
 checked<?php 
        }
        ?>
 onclick="toggleSettings();"><label for="upload_allow_image_caching_yes"><?php 
        echo __('Yes');
        ?>
</label>&nbsp;&nbsp;
                                <input type="radio" name="upload_allow_image_caching" value="0" id="upload_allow_image_caching_no"<?php 
        if (!\thebuggenie\core\framework\Settings::isUploadsImageCachingEnabled()) {
            ?>
 checked<?php 
        }
        ?>
 onclick="toggleSettings();"><label for="upload_allow_image_caching_no"><?php 
        echo __('No');
        ?>
</label>
                                <?php 
    }
    ?>
                            </td>
                        </tr>
                        <tr>
                            <td class="config_explanation" colspan="2"><?php 
开发者ID:pkdevboxy,项目名称:thebuggenie,代码行数:31,代码来源:configureuploads.html.php


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