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

PHP w3_mkdir函数代码示例

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

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



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

示例1: set

 /**
  * Sets data
  *
  * @param string $key
  * @param string $var
  * @return boolean
  */
 function set($key, $var)
 {
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (is_dir($dir) || w3_mkdir($sub_dir, 0755, $this->_cache_dir)) {
         $fp = @fopen($path, 'w');
         if ($fp) {
             @fputs($fp, $var);
             @fclose($fp);
             return true;
         }
     }
     return false;
 }
开发者ID:alx,项目名称:SBek-Arak,代码行数:23,代码来源:PgCache.php


示例2: set

 /**
  * Sets data
  *
  * @param string $key
  * @param mixed $var
  * @param integer $expire
  * @return boolean
  */
 function set($key, $var, $expire = 0)
 {
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (is_dir($dir) || w3_mkdir($sub_dir, 0755, $this->_cache_dir)) {
         $fp = @fopen($path, 'wb');
         if ($fp) {
             @fputs($fp, pack('L', $expire));
             @fputs($fp, @serialize($var));
             @fclose($fp);
             return true;
         }
     }
     return false;
 }
开发者ID:kennethreitz-archive,项目名称:wordpress-skeleton,代码行数:25,代码来源:File.php


示例3: store

 /**
  * Write data to cache.
  *
  * @param string $id cache id (e.g. a filename)
  *
  * @param string $data
  *
  * @return bool success
  */
 public function store($id, $data)
 {
     $path = $this->_path . '/' . $id;
     $flag = $this->_locking ? LOCK_EX : null;
     if (is_file($path)) {
         @unlink($path);
     }
     $dir = dirname($id);
     if ($dir) {
         w3_mkdir($dir, 0777, $this->_path);
     }
     if (!@file_put_contents($path, $data, $flag)) {
         return false;
     }
     // write control
     if ($data != $this->fetch($id)) {
         @unlink($path);
         return false;
     }
     return true;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:30,代码来源:File.php


示例4: set

 /**
  * Sets data
  *
  * @param string $key
  * @param string $var
  * @return boolean
  */
 function set($key, $var)
 {
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . '/' . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (@is_dir($dir) || w3_mkdir($sub_dir, 0777, $this->_cache_dir)) {
         $fp = @fopen($path, 'w');
         if ($fp) {
             if ($this->_locking) {
                 @flock($fp, LOCK_EX);
             }
             @fputs($fp, $var);
             @fclose($fp);
             if ($this->_locking) {
                 @flock($fp, LOCK_UN);
             }
             return true;
         }
     }
     return false;
 }
开发者ID:nuevomediagroup,项目名称:nmg-code,代码行数:29,代码来源:Generic.php


示例5: add_index_files_if_required

 /**
  * Add index.html to minify folder
  */
 function add_index_files_if_required()
 {
     if ($this->_config->get_string('minify.engine') == 'file') {
         if (!file_exists(W3TC_CACHE_MINIFY_DIR . '/index.html')) {
             if (!is_dir(W3TC_CACHE_MINIFY_DIR)) {
                 w3_mkdir(W3TC_CACHE_MINIFY_DIR, W3TC_CACHE_DIR);
             }
             @file_put_contents(W3TC_CACHE_MINIFY_DIR . '/index.html', '');
         }
     }
 }
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:14,代码来源:MinifyAdmin.php


示例6: import_library


//.........这里部分代码省略.........
                             }
                             if (preg_match($regexp, $check_src)) {
                                 /**
                                  * Check for already uploaded attachment
                                  */
                                 if (isset($attachments[$src])) {
                                     list($dst, $dst_url) = $attachments[$src];
                                     $result = true;
                                 } else {
                                     if ($uploads_use_yearmonth_folders) {
                                         $upload_subdir = date('Y/m', strtotime($post->post_date));
                                         $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';
                                         }
                                     }
                                     /**
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:67,代码来源:CdnAdmin.php


示例7: 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


示例8: set

 /**
  * Sets data
  *
  * @param string $key
  * @param mixed $var
  * @param integer $expire
  * @return boolean
  */
 function set($key, &$var, $expire = 0)
 {
     $sub_path = $this->_get_path($key);
     $path = $this->_cache_dir . DIRECTORY_SEPARATOR . $sub_path;
     $sub_dir = dirname($sub_path);
     $dir = dirname($path);
     if (@is_dir($dir) || w3_mkdir($sub_dir, 0777, $this->_cache_dir)) {
         $fp = @fopen($path, 'wb');
         if ($fp) {
             if ($this->_locking) {
                 @flock($fp, LOCK_EX);
             }
             @fputs($fp, pack('L', $expire));
             @fputs($fp, @serialize($var));
             @fclose($fp);
             if ($this->_locking) {
                 @flock($fp, LOCK_UN);
             }
             return true;
         }
     }
     return false;
 }
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:31,代码来源:File.php


示例9: w3_wp_create_folder

/**
 * @param $folder
 * @param string $method Which method to use when creating
 * @param string $url Where to redirect after creation
 * @param bool|string $context folder to create folder in
 * @throws FilesystemCredentialException with S/FTP form if it can't get the required filesystem credentials
 * @throws FileOperationException
 */
function w3_wp_create_folder($folder, $method = '', $url = '', $context = false)
{
    if (!@is_dir($folder) && !@w3_mkdir($folder)) {
        w3_wp_request_filesystem_credentials($method, $url, $context);
        global $wp_filesystem;
        if (!$wp_filesystem->mkdir($folder, FS_CHMOD_DIR)) {
            throw new FileOperationException('Could not create directory:' . $folder, 'create', 'folder', $folder);
        }
    }
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:18,代码来源:activation.php


示例10: import_library

 /**
  * Imports library
  *
  * @param integer $limit
  * @param integer $offset
  * @param integer $count
  * @param integer $total
  * @param array $results
  * @return boolean
  */
 function import_library($limit, $offset, &$count, &$total, &$results)
 {
     global $wpdb;
     $count = 0;
     $total = 0;
     $results = array();
     $site_url = w3_get_site_url();
     $upload_info = w3_upload_info();
     if ($upload_info) {
         $sql = sprintf('SELECT
     		ID,
     		post_content,
     		post_date
         FROM
             %sposts
         WHERE
             post_status = "publish"
             AND (post_type = "post" OR post_type = "page") 
             AND (post_content LIKE "%%src=%%"
             	OR post_content LIKE "%%href=%%")
    		', $wpdb->prefix);
         if ($limit) {
             $sql .= sprintf(' LIMIT %d', $limit);
             if ($offset) {
                 $sql .= sprintf(' OFFSET %d', $offset);
             }
         }
         $posts = $wpdb->get_results($sql);
         if ($posts) {
             $count = count($posts);
             $total = $this->get_import_posts_count();
             $regexp = $this->get_regexp_by_mask($this->_config->get_string('cdn.import.files'));
             $import_external = $this->_config->get_boolean('cdn.import.external');
             foreach ($posts as $post) {
                 $matches = null;
                 $post_content = $post->post_content;
                 if (preg_match_all('~(href|src)=[\'"]?([^\'"<>\\s]+)[\'"]?~', $post_content, $matches, PREG_SET_ORDER)) {
                     foreach ($matches as $match) {
                         $src = w3_normalize_file($match[2]);
                         if (preg_match('~(' . $regexp . ')$~', $src)) {
                             $src_dir = date('Y/m', strtotime($post->post_date));
                             $src_base = basename($src);
                             $dst = sprintf('%s/%s/%s', $upload_info['upload_dir'], $src_dir, $src_base);
                             $dst_dir = dirname($dst);
                             $dst_path = ABSPATH . $dst;
                             $dst_url = sprintf('%s%s/%s/%s', $site_url, $upload_info['upload_url'], $src_dir, $src_base);
                             $result = false;
                             $error = '';
                             $download_result = null;
                             w3_mkdir($dst_dir, 0755, ABSPATH);
                             // file already exists
                             if (!file_exists($dst_path)) {
                                 // source is external URL
                                 if (w3_is_url($src)) {
                                     if ($import_external) {
                                         $download_result = $this->download($src, $dst_path);
                                     } else {
                                         $error = 'External file import is disabled';
                                     }
                                     // source is local file not in wp-content/uploads dir
                                 } elseif (strstr($src, $upload_info['upload_dir']) === false) {
                                     $src_path = ABSPATH . $src;
                                     $download_result = @copy($src_path, $dst_path);
                                     // file is already in wp-content/uploads dir
                                 } else {
                                     $error = 'Source file already exists';
                                 }
                                 if ($download_result !== null) {
                                     if ($download_result) {
                                         $title = $src_base;
                                         $guid = $upload_info['upload_url'] . '/' . $title;
                                         $mime_type = w3_get_mime_type($src_base);
                                         $GLOBALS['wp_rewrite'] =& new WP_Rewrite();
                                         $id = wp_insert_attachment(array('post_mime_type' => $mime_type, 'guid' => $guid, 'post_title' => $title, 'post_content' => ''), $dst_path);
                                         if (!is_wp_error($id)) {
                                             require_once ABSPATH . 'wp-admin/includes/image.php';
                                             wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $dst_path));
                                             $post_content = str_replace($src, $dst_url, $post_content);
                                             $result = true;
                                             $error = 'OK';
                                         } else {
                                             $error = 'Unable to insert attachment';
                                         }
                                     } else {
                                         $error = 'Unable to download file';
                                     }
                                 }
                             } else {
                                 $error = 'Destination file already exists';
                             }
//.........这里部分代码省略.........
开发者ID:TheReaCompany,项目名称:pooplog,代码行数:101,代码来源:Cdn.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP w3_mkdir_from函数代码示例发布时间:2022-05-23
下一篇:
PHP w3_is_xml函数代码示例发布时间: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