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


PHP site::get_dir方法代码示例

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


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

示例1: action_template_header

 public function action_template_header()
 {
     $modified = Stack::get_sorted_stack('template_header_javascript');
     foreach ($modified as $key => $value) {
         Stack::remove('template_header_javascript', $key);
     }
     Stack::add('template_header_javascript', Site::get_url('user') . "/files/minified.js", 'Minified');
     if (!Cache::has(self::$cache_name . '_js') || !Cache::has(self::$cache_name . '_css')) {
         set_include_path(dirname(__FILE__) . '/min/lib' . PATH_SEPARATOR . get_include_path());
         require_once 'Minify/Source.php';
         require_once 'Minify/HTML.php';
         require_once 'Minify/CSS.php';
         require_once 'Minify/HTML.php';
         require_once 'Minify.php';
         require_once 'Minify/Cache/File.php';
     }
     if (!Cache::has(self::$cache_name . '_js')) {
         $js_stack = array();
         foreach ($modified as $js) {
             $js_stack[] = Site::get_path('base') . str_replace(Site::get_url('habari') . '/', '', $js);
         }
         $options = array('files' => $js_stack, 'encodeOutput' => false, 'quiet' => true, 'maxAge' => 86400);
         $result = Minify::serve('Files', $options);
         file_put_contents(site::get_dir('user') . '/files/minified.js', $result['content']);
         Cache::set(self::$cache_name . '_js', 'true');
     }
     /* CSS */
     $modified = Stack::get_sorted_stack('template_stylesheet');
     $tmp = array();
     foreach ($modified as $key => $value) {
         $tmp[] = $value[0];
         Stack::remove('template_stylesheet', $key);
     }
     Stack::add('template_stylesheet', array(Site::get_url('user') . "/files/minified.css", 'screen'), 'style');
     if (!Cache::has(self::$cache_name . '_css')) {
         $css_stack = array();
         foreach ($tmp as $css) {
             $css_stack[] = Site::get_path('base') . str_replace(Site::get_url('habari') . '/', '', $css);
         }
         $options = array('files' => $css_stack, 'encodeOutput' => false, 'quiet' => true, 'maxAge' => 86400);
         // handle request
         $result = Minify::serve('Files', $options);
         file_put_contents(site::get_dir('user') . '/files/minified.css', $result['content']);
         Cache::set(self::$cache_name . '_css', 'true');
     }
 }
开发者ID:stenehall,项目名称:habari-plugins,代码行数:46,代码来源:mini.plugin.php

示例2: action_template_header

 public function action_template_header()
 {
     //Cache::expire( self::$cache_name . '_js' );
     //Cache::expire( self::$cache_name . '_css' );
     // try to disable output_compression (may not have an effect)
     ini_set('zlib.output_compression', '0');
     $modified_js = Stack::get_sorted_stack('template_header_javascript');
     foreach ($modified_js as $key => $value) {
         Stack::remove('template_header_javascript', $key);
     }
     Stack::add('template_header_javascript', Site::get_url('user') . '/files/minified.js', 'Minified');
     $modified_css = Stack::get_sorted_stack('template_stylesheet');
     $css = array();
     foreach ($modified_css as $key => $value) {
         $css[] = $value[0];
         Stack::remove('template_stylesheet', $key);
     }
     Stack::add('template_stylesheet', array(Site::get_url('user') . "/files/minified.css", 'screen'), 'style');
     /*
      * If we have the files or the cache havent expired don't create new files.
      */
     if (!file_exists(site::get_dir('user') . '/files/minified.css') || !file_exists(site::get_dir('user') . '/files/minified.js') || (!Cache::has(self::$cache_name . '_js') || !Cache::has(self::$cache_name . '_css'))) {
         /* Taken from min/index.php */
         define('MINIFY_MIN_DIR', dirname(__FILE__) . '/min/');
         // load config
         require MINIFY_MIN_DIR . '/config.php';
         // setup include path
         set_include_path($min_libPath . PATH_SEPARATOR . get_include_path());
         require 'Minify.php';
         Minify::$uploaderHoursBehind = $min_uploaderHoursBehind;
         Minify::setCache(isset($min_cachePath) ? $min_cachePath : '', $min_cacheFileLocking);
         if ($min_documentRoot) {
             $_SERVER['DOCUMENT_ROOT'] = $min_documentRoot;
         } elseif (0 === stripos(PHP_OS, 'win')) {
             Minify::setDocRoot();
             // IIS may need help
         }
         $min_serveOptions['minifierOptions']['text/css']['symlinks'] = $min_symlinks;
         // Using jsmin+ 1.3
         $min_serveOptions['minifiers']['application/x-javascript'] = array('JSMinPlus', 'minify');
         /* Javascript */
         if (!Cache::has(self::$cache_name . '_js') || !file_exists(site::get_dir('user') . '/files/minified.js')) {
             $js_stack = array();
             foreach ($modified_js as $js) {
                 $js_stack[] = Site::get_path('base') . str_replace(Site::get_url('habari') . '/', '', $js);
             }
             $options = array('files' => $js_stack, 'encodeOutput' => false, 'quiet' => true);
             $result = Minify::serve('Files', $options);
             file_put_contents(site::get_dir('user') . '/files/minified.js', $result['content']);
             Cache::set(self::$cache_name . '_js', 'true', Options::get('minification__expire'));
         }
         /* CSS */
         if (!Cache::has(self::$cache_name . '_css') || !file_exists(site::get_dir('user') . '/files/minified.css')) {
             $css_stack = array();
             foreach ($css as $file) {
                 $css_stack[] = Site::get_path('base') . str_replace(Site::get_url('habari') . '/', '', $file);
             }
             $options = array('files' => $css_stack, 'encodeOutput' => false, 'quiet' => true);
             // handle request
             $result = Minify::serve('Files', $options);
             file_put_contents(site::get_dir('user') . '/files/minified.css', $result['content']);
             Cache::set(self::$cache_name . '_css', 'true', Options::get('minification__expire'));
         }
     }
 }
开发者ID:habari-extras,项目名称:minification,代码行数:65,代码来源:minification.plugin.php


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