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


PHP Util_Environment::wp_upload_dir方法代码示例

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


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

示例1: upload_info

 /**
  * Returns upload info
  *
  * @return array
  */
 public static function upload_info()
 {
     static $upload_info = null;
     if ($upload_info === null) {
         $upload_info = Util_Environment::wp_upload_dir();
         if (empty($upload_info['error'])) {
             $parse_url = @parse_url($upload_info['baseurl']);
             if ($parse_url) {
                 $baseurlpath = !empty($parse_url['path']) ? trim($parse_url['path'], '/') : '';
             } else {
                 $baseurlpath = 'wp-content/uploads';
             }
             $upload_info['baseurlpath'] = '/' . $baseurlpath . '/';
         } else {
             $upload_info = false;
         }
     }
     return $upload_info;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:24,代码来源:Util_Http.php

示例2: rules_generate_nginx

 /**
  * Generates rules for WP dir
  *
  * @param Config  $config
  * @return string
  */
 private static function rules_generate_nginx($config)
 {
     $a = Util_Environment::wp_upload_dir();
     $parse_url = @parse_url($a['baseurl']);
     if (empty($parse_url['path'])) {
         return '';
     }
     $uploads_path = $parse_url['path'];
     $rules = W3TC_MARKER_BEGIN_FEEDBURNER . "\n";
     $rules .= "if (\$http_user_agent ~* \"(FeedBurner)\") {\n";
     $rules .= "    rewrite ^{$uploads_path}/([0-9]+)/([0-9]+)/hotlink-ok/(.*)\$ {$uploads_path}/\$1/\$2/\$3 last;\n";
     $rules .= "}\n";
     $rules .= W3TC_MARKER_END_FEEDBURNER . "\n";
     return $rules;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:21,代码来源:Extension_FeedBurner_Environment.php

示例3: uri_to_cdn_uri

 /**
  * Convert local uri path to CDN type specific path
  *
  * @param unknown $local_uri_path
  * @return string
  */
 function uri_to_cdn_uri($local_uri)
 {
     $local_uri = ltrim($local_uri, '/');
     $remote_uri = $local_uri;
     if (Util_Environment::is_wpmu() && defined('DOMAIN_MAPPING') && DOMAIN_MAPPING) {
         $remote_uri = str_replace(site_url(), '', $local_uri);
     }
     $engine = $this->_config->get_string('cdn.engine');
     if (Cdn_Util::is_engine_mirror($engine)) {
         if (Util_Environment::is_wpmu() && strpos($local_uri, 'files') === 0) {
             $upload_dir = Util_Environment::wp_upload_dir();
             $remote_uri = $this->abspath_to_relative_path(dirname($upload_dir['basedir'])) . '/' . $local_uri;
         }
     } elseif (Util_Environment::is_wpmu() && !Util_Environment::is_wpmu_subdomain() && Util_Environment::is_using_master_config() && Cdn_Util::is_engine_push($engine)) {
         // in common config files are uploaded for network home url
         // so mirror will not contain /subblog/ path in uri
         $home = trim(home_url('', 'relative'), '/') . '/';
         $network_home = trim(network_home_url('', 'relative'), '/') . '/';
         if ($home != $network_home && substr($local_uri, 0, strlen($home)) == $home) {
             $remote_uri = $network_home . substr($local_uri, strlen($home));
         }
     }
     return ltrim($remote_uri, '/');
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:30,代码来源:Cdn_Core.php

示例4: replace_folder_placeholders

 static function replace_folder_placeholders($file)
 {
     static $content_dir, $plugin_dir, $upload_dir;
     if (empty($content_dir)) {
         $content_dir = str_replace(Util_Environment::document_root(), '', WP_CONTENT_DIR);
         $content_dir = substr($content_dir, strlen(Util_Environment::site_url_uri()));
         $content_dir = trim($content_dir, '/');
         if (defined('WP_PLUGIN_DIR')) {
             $plugin_dir = str_replace(Util_Environment::document_root(), '', WP_PLUGIN_DIR);
             $plugin_dir = trim($plugin_dir, '/');
         } else {
             $plugin_dir = str_replace(Util_Environment::document_root(), '', WP_CONTENT_DIR . '/plugins');
             $plugin_dir = trim($plugin_dir, '/');
         }
         $upload_dir = Util_Environment::wp_upload_dir();
         $upload_dir = str_replace(Util_Environment::document_root(), '', $upload_dir['basedir']);
         $upload_dir = trim($upload_dir, '/');
     }
     $file = str_replace('{wp_content_dir}', $content_dir, $file);
     $file = str_replace('{plugins_dir}', $plugin_dir, $file);
     $file = str_replace('{uploads_dir}', $upload_dir, $file);
     return $file;
 }
开发者ID:developmentDM2,项目名称:Whohaha,代码行数:23,代码来源:Cdn_Util.php


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