• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP w3_download函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中w3_download函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_download函数的具体用法?PHP w3_download怎么用?PHP w3_download使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: _precache_file

 /**
  * Pre-caches external file
  *
  * @param string $url
  * @param string $type
  * @return string
  */
 function _precache_file($url, $type)
 {
     $lifetime = $this->_config->get_integer('minify.lifetime');
     $cache_path = sprintf('%s/minify_%s.%s', w3_cache_blog_dir('minify'), md5($url), $type);
     if (!file_exists($cache_path) || @filemtime($cache_path) < time() - $lifetime) {
         w3_require_once(W3TC_INC_DIR . '/functions/http.php');
         if (!@is_dir(dirname($cache_path))) {
             w3_require_once(W3TC_INC_DIR . '/functions/file.php');
             w3_mkdir_from(dirname($cache_path), W3TC_CACHE_DIR);
         }
         w3_download($url, $cache_path);
     }
     return file_exists($cache_path) ? $this->_get_minify_source($cache_path, $url) : false;
 }
开发者ID:easinewe,项目名称:Avec2016,代码行数:21,代码来源:Minify.php


示例2: import_library


//.........这里部分代码省略.........
                                         $upload_dir = sprintf('%s/%s', $upload_info['basedir'], $upload_subdir);
                                         $upload_url = sprintf('%s/%s', $upload_info['baseurl'], $upload_subdir);
                                     } else {
                                         $upload_subdir = '';
                                         $upload_dir = $upload_info['basedir'];
                                         $upload_url = $upload_info['baseurl'];
                                     }
                                     $src_filename = pathinfo($src, PATHINFO_FILENAME);
                                     $src_extension = pathinfo($src, PATHINFO_EXTENSION);
                                     /**
                                      * Get available filename
                                      */
                                     for ($i = 0;; $i++) {
                                         $dst = sprintf('%s/%s%s%s', $upload_dir, $src_filename, $i ? $i : '', $src_extension ? '.' . $src_extension : '');
                                         if (!file_exists($dst)) {
                                             break;
                                         }
                                     }
                                     $dst_basename = basename($dst);
                                     $dst_url = sprintf('%s/%s', $upload_url, $dst_basename);
                                     $dst_path = ltrim(str_replace($document_root, '', w3_path($dst)), '/');
                                     if ($upload_subdir) {
                                         w3_mkdir($upload_subdir, 0777, $upload_info['basedir']);
                                     }
                                     $download_result = false;
                                     /**
                                      * Check if file is remote URL
                                      */
                                     if (w3_is_url($src)) {
                                         /**
                                          * Download file
                                          */
                                         if ($import_external) {
                                             $download_result = w3_download($src, $dst);
                                             if (!$download_result) {
                                                 $error = 'Unable to download file';
                                             }
                                         } else {
                                             $error = 'External file import is disabled';
                                         }
                                     } else {
                                         /**
                                          * Otherwise copy file from local path
                                          */
                                         $src_path = $document_root . '/' . urldecode($src);
                                         if (file_exists($src_path)) {
                                             $download_result = @copy($src_path, $dst);
                                             if (!$download_result) {
                                                 $error = 'Unable to copy file';
                                             }
                                         } else {
                                             $error = 'Source file doesn\'t exists';
                                         }
                                     }
                                     /**
                                      * Check if download or copy was successful
                                      */
                                     if ($download_result) {
                                         w3_require_once(W3TC_INC_DIR . '/functions/mime.php');
                                         $title = $dst_basename;
                                         $guid = ltrim($upload_info['baseurlpath'] . $title, ',');
                                         $mime_type = w3_get_mime_type($dst);
                                         $GLOBALS['wp_rewrite'] = new WP_Rewrite();
                                         /**
                                          * Insert attachment
                                          */
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:67,代码来源:CdnAdmin.php


示例3: _precache_file

 /**
  * Pre-caches external file
  *
  * @param string $url
  * @param string $type
  * @return string
  */
 function _precache_file($url, $type)
 {
     $lifetime = $this->_config->get_integer('minify.lifetime');
     $cache_path = sprintf('%s/minify_%s.%s', W3TC_CACHE_FILE_MINIFY_DIR, md5($url), $type);
     if (!file_exists($cache_path) || @filemtime($cache_path) < time() - $lifetime) {
         require_once W3TC_INC_DIR . '/functions/http.php';
         w3_download($url, $cache_path);
     }
     return file_exists($cache_path) ? $this->_get_minify_source($cache_path, $url) : false;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:17,代码来源:Minify.php


示例4: get_files_minify

 /**
  * Exports min files to CDN
  *
  * @return array
  */
 function get_files_minify()
 {
     $files = array();
     if (W3TC_PHP5 && $this->_config->get_boolean('minify.rewrite') && (!$this->_config->get_boolean('minify.auto') || w3_is_cdn_mirror($this->_config->get_string('cdn.engine')))) {
         require_once W3TC_INC_DIR . '/functions/http.php';
         $minify =& w3_instance('W3_Plugin_Minify');
         $document_root = w3_get_document_root();
         $site_root = w3_get_site_root();
         $minify_root = w3_path(W3TC_CACHE_FILE_MINIFY_DIR);
         $minify_path = ltrim(str_replace($site_root, rtrim(w3_get_site_path(), '/'), $minify_root), '/');
         $urls = $minify->get_urls();
         if ($this->_config->get_string('minify.engine') == 'file') {
             foreach ($urls as $url) {
                 w3_http_get($url);
             }
             $files = $this->search_files($minify_root, $minify_path, '*.css;*.js');
         } else {
             foreach ($urls as $url) {
                 $file = w3_normalize_file_minify($url);
                 $file = w3_translate_file($file);
                 if (!w3_is_url($file)) {
                     $file = $document_root . '/' . $file;
                     $file = ltrim(str_replace($minify_root, '', $file), '/');
                     $dir = dirname($file);
                     if ($dir) {
                         w3_mkdir($dir, 0777, $minify_root);
                     }
                     if (w3_download($url, $minify_root . '/' . $file) !== false) {
                         $files[] = $minify_path . '/' . $file;
                     }
                 }
             }
         }
     }
     return $files;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:41,代码来源:Cdn.php


示例5: get_files_minify

 /**
  * Exports min files to CDN
  */
 function get_files_minify()
 {
     $files = array();
     if (W3TC_PHP5) {
         require_once W3TC_LIB_W3_DIR . '/Plugin/Minify.php';
         $minify =& W3_Plugin_Minify::instance();
         $urls = $minify->get_urls();
         foreach ($urls as $url) {
             $file = basename($url);
             if (w3_download($url, W3TC_CONTENT_MINIFY_DIR . '/' . $file) !== false) {
                 $files[] = W3TC_CONTENT_MINIFY_DIR_NAME . '/' . $file;
             }
         }
     }
     return $files;
 }
开发者ID:alx,项目名称:SBek-Arak,代码行数:19,代码来源:Cdn.php


示例6: _precache_file

 /**
  * Precaches external file
  *
  * @param string $url
  * @param string $type
  * @return string
  */
 function _precache_file($url, $type)
 {
     $lifetime = $this->_config->get_integer('minify.lifetime');
     $file_path = sprintf('%s/minify_%s.%s', W3TC_CACHE_FILE_MINIFY_DIR, md5($url), $type);
     $file_exists = file_exists($file_path);
     if ($file_exists && @filemtime($file_path) >= time() - $lifetime) {
         return $this->_get_minify_source($file_path, $url);
     }
     if (is_dir(W3TC_CACHE_FILE_MINIFY_DIR)) {
         if (w3_download($url, $file_path) !== false) {
             return $this->_get_minify_source($file_path, $url);
         } else {
             $this->log(sprintf('Unable to download URL: %s', $url));
         }
     } else {
         $this->log(sprintf('The cache directory %s does not exist', W3TC_CACHE_FILE_MINIFY_DIR));
     }
     return $file_exists ? $this->_get_minify_source($file_path, $url) : false;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:26,代码来源:Minify.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP w3_escape_comment函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_clean_rules函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap