本文整理汇总了PHP中w3_upload_info函数的典型用法代码示例。如果您正苦于以下问题:PHP w3_upload_info函数的具体用法?PHP w3_upload_info怎么用?PHP w3_upload_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了w3_upload_info函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: ewww_image_optimizer_w3tc_update_files
function ewww_image_optimizer_w3tc_update_files($files)
{
// global $ewww_debug;
global $ewww_attachment;
list($file, $upload_path) = ewww_image_optimizer_attachment_path($ewww_attachment['meta'], $ewww_attachment['id']);
$file_info = array();
$upload_info = w3_upload_info();
if ($upload_info) {
$remote_file = ltrim($upload_info['baseurlpath'] . $ewww_attachment['meta']['file'], '/');
$home_url = get_site_url();
$original_url = $home_url . $file;
$file_info[] = array('local_path' => $file, 'remote_path' => $remote_file, 'original_url' => $original_url);
$files = array_merge($files, $file_info);
// $ewww_debug .= "w3tc remote path: $remote_file<br>";
// $ewww_debug .= "w3tc original url: $original_url<br>";
//$ewww_debug .= print_r($files, true) . '<br>';
//ewww_image_optimizer_debug_log();
}
return $files;
}
开发者ID:Rudchyk,项目名称:wp-framework,代码行数:20,代码来源:common.php
示例2: get_server_info
/**
* Returns server info
*
* @return array
*/
function get_server_info()
{
global $wp_version, $wp_db_version, $wpdb;
$wordpress_plugins = get_plugins();
$wordpress_plugins_active = array();
foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
if (is_plugin_active($wordpress_plugin_file)) {
$wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
}
}
$mysql_version = $wpdb->get_var('SELECT VERSION()');
$mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
$mysql_variables = array();
foreach ($mysql_variables_result as $mysql_variables_row) {
$mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
}
$server_info = array('w3tc' => array('version' => W3TC_VERSION, 'server' => !empty($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown', 'dir' => W3TC_DIR, 'cache_dir' => W3TC_CACHE_DIR, 'blog_id' => w3_get_blog_id(), 'document_root' => w3_get_document_root(), 'home_root' => w3_get_home_root(), 'site_root' => w3_get_site_root(), 'base_path' => w3_get_base_path(), 'home_path' => w3_get_home_path(), 'site_path' => w3_get_site_path()), 'wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'abspath' => ABSPATH, 'home' => get_option('home'), 'siteurl' => get_option('siteurl'), 'email' => get_option('admin_email'), 'upload_info' => (array) w3_upload_info(), 'theme' => w3tc_get_current_theme(), 'wp_cache' => defined('WP_CACHE') && WP_CACHE ? 'true' : 'false', 'plugins' => $wordpress_plugins_active), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
return $server_info;
}
开发者ID:easinewe,项目名称:Avec2016,代码行数:24,代码来源:SupportActionsAdmin.php
示例3: options
//.........这里部分代码省略.........
w3_require_once(W3TC_INC_DIR . '/functions/file.php');
$wp_content_mode = w3_get_file_permissions(WP_CONTENT_DIR);
if ($wp_content_mode > 0755) {
$this->_notes[] = sprintf(__('<strong>%s</strong> is write-able. When finished installing the plugin,
change the permissions back to the default: <strong>chmod 755 %s</strong>.
Permissions are currently %s. %s', 'w3-total-cache'), WP_CONTENT_DIR, WP_CONTENT_DIR, base_convert(w3_get_file_permissions(WP_CONTENT_DIR), 10, 8), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_content_perms'));
}
}
/**
* Check wp-content permissions
*/
if (!W3TC_WIN && $this->_config->get_boolean('notes.wp_content_changed_perms')) {
$perm = get_transient('w3tc_prev_permission');
$current_perm = w3_get_file_permissions(WP_CONTENT_DIR);
if ($perm && $perm != base_convert($current_perm, 10, 8) && ($current_perm > 0755 || $perm < base_convert($current_perm, 10, 8))) {
$this->_notes[] = sprintf(__('<strong>%s</strong> permissions were changed during the setup process.
Permissions are currently %s.<br />To restore permissions run
<strong>chmod %s %s</strong>. %s', 'w3-total-cache'), WP_CONTENT_DIR, base_convert($current_perm, 10, 8), $perm, WP_CONTENT_DIR, w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'wp_content_changed_perms'));
}
}
/**
* Check permalinks
*/
if ($this->_config->get_boolean('notes.no_permalink_rules') && ($this->_config->get_boolean('pgcache.enabled') && $this->_config->get_string('pgcache.engine') == 'file_generic' || $this->_config->get_boolean('browsercache.enabled') && $this->_config->get_boolean('browsercache.no404wp')) && !w3_is_permalink_rules()) {
$this->_errors[] = sprintf(__('The required directives for fancy permalinks could not be detected, please confirm they are available: <a href="http://codex.wordpress.org/Using_Permalinks#Creating_and_editing_.28.htaccess.29">Creating and editing</a> %s', 'w3-total-cache'), w3_button_hide_note(__('Hide this message', 'w3-total-cache'), 'no_permalink_rules'));
}
/**
* CDN
*/
if ($this->_config->get_boolean('cdn.enabled')) {
/**
* Check upload settings
*/
$upload_info = w3_upload_info();
if (!$upload_info) {
$upload_path = get_option('upload_path');
$upload_path = trim($upload_path);
if (empty($upload_path)) {
$upload_path = WP_CONTENT_DIR . '/uploads';
$this->_errors[] = sprintf(__('The uploads directory is not available. Default WordPress directories will be created: <strong>%s</strong>.', 'w3-total-cache'), $upload_path);
}
if (!w3_is_multisite()) {
$this->_errors[] = sprintf(__('The uploads path found in the database (%s) is inconsistent with the actual path. Please manually adjust the upload path either in miscellaneous settings or if not using a custom path %s automatically to resolve the issue.', 'w3-total-cache'), $upload_path, w3_button_link(__('update the path', 'w3-total-cache'), wp_nonce_url(sprintf('admin.php?page=%s&w3tc_config_update_upload_path', $this->_page), 'w3tc')));
}
}
/**
* Check CDN settings
*/
$cdn_engine = $this->_config->get_string('cdn.engine');
$error = '';
switch (true) {
case $cdn_engine == 'ftp' && !count($this->_config->get_array('cdn.ftp.domain')):
$this->_errors[] = __('A configuration issue prevents <acronym title="Content Delivery Network">CDN</acronym> from working:
The <strong>"Replace default hostname with"</strong>
field cannot be empty. Enter <acronym
title="Content Delivery Network">CDN</acronym>
provider hostname <a href="?page=w3tc_cdn#configuration">here</a>.
<em>(This is the hostname used in order to view objects
in a browser.)</em>', 'w3-total-cache');
break;
case $cdn_engine == 's3' && ($this->_config->get_string('cdn.s3.key') == '' || $this->_config->get_string('cdn.s3.secret') == '' || $this->_config->get_string('cdn.s3.bucket') == ''):
$error = __('The <strong>"Access key", "Secret key" and "Bucket"</strong> fields cannot be empty.', 'w3-total-cache');
break;
case $cdn_engine == 'cf' && ($this->_config->get_string('cdn.cf.key') == '' || $this->_config->get_string('cdn.cf.secret') == '' || $this->_config->get_string('cdn.cf.bucket') == '' || $this->_config->get_string('cdn.cf.id') == '' && !count($this->_config->get_array('cdn.cf.cname'))):
$error = __('The <strong>"Access key", "Secret key", "Bucket" and "Replace default hostname with"</strong> fields cannot be empty.', 'w3-total-cache');
break;
开发者ID:easinewe,项目名称:Avec2016,代码行数:67,代码来源:PluginView.php
示例4: ewww_image_optimizer_w3tc_update_files
function ewww_image_optimizer_w3tc_update_files($files)
{
global $ewww_attachment;
list($file, $upload_path) = ewww_image_optimizer_attachment_path($ewww_attachment['meta'], $ewww_attachment['id']);
$file_info = array();
if (function_exists('w3_upload_info')) {
$upload_info = w3_upload_info();
} else {
$upload_info = ewww_image_optimizer_upload_info();
}
if ($upload_info) {
$remote_file = ltrim($upload_info['baseurlpath'] . $ewww_attachment['meta']['file'], '/');
$home_url = get_site_url();
$original_url = $home_url . $file;
$file_info[] = array('local_path' => $file, 'remote_path' => $remote_file, 'original_url' => $original_url);
$files = array_merge($files, $file_info);
}
return $files;
}
开发者ID:amprog,项目名称:ewww-image-optimizer,代码行数:19,代码来源:common.php
示例5: normalize_attachment_file
/**
* Normalizes attachment file
*
* @param string $file
* @return string
*/
function normalize_attachment_file($file)
{
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
$upload_info = w3_upload_info();
if ($upload_info) {
$file = ltrim(str_replace($upload_info['basedir'], '', $file), '/\\');
$matches = null;
if (preg_match('~(\\d{4}/\\d{2}/)?[^/]+$~', $file, $matches)) {
$file = $matches[0];
}
}
return $file;
}
开发者ID:gumbysgoo,项目名称:bestilblomster,代码行数:19,代码来源:CdnCommon.php
示例6: rename_domain
/**
* Rename domain
*
* @param array $names
* @param integer $limit
* @param integer $offset
* @param integer $count
* @param integer $total
* @param integer $results
* @return void
*/
function rename_domain($names, $limit, $offset, &$count, &$total, &$results)
{
global $wpdb;
@set_time_limit($this->_config->get_integer('timelimit.domain_rename'));
$count = 0;
$total = 0;
$results = array();
$upload_info = w3_upload_info();
foreach ($names as $index => $name) {
$names[$index] = str_ireplace('www.', '', $name);
}
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_rename_posts_count();
$names_quoted = array_map('w3_preg_quote', $names);
foreach ($posts as $post) {
$matches = null;
$post_content = $post->post_content;
$regexp = '~(href|src)=[\'"]?(https?://(www\\.)?(' . implode('|', $names_quoted) . ')' . w3_preg_quote($upload_info['baseurlpath']) . '([^\'"<>\\s]+))[\'"]~';
if (preg_match_all($regexp, $post_content, $matches, PREG_SET_ORDER)) {
foreach ($matches as $match) {
$old_url = $match[2];
$new_url = sprintf('%s/%s', $upload_info['baseurl'], $match[5]);
$post_content = str_replace($old_url, $new_url, $post_content);
$results[] = array('old' => $old_url, 'new' => $new_url, 'result' => true, 'error' => 'OK');
}
}
if ($post_content != $post->post_content) {
wp_update_post(array('ID' => $post->ID, 'post_content' => $post_content));
}
}
}
}
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:65,代码来源:CdnAdmin.php
示例7: ob_callback
/**
* OB Callback
*
* @param string $buffer
* @return string
*/
function ob_callback(&$buffer)
{
if ($buffer != '' && w3_is_xml($buffer)) {
if ($this->can_cdn2($buffer)) {
$regexps = array();
$site_path = w3_get_site_path();
$domain_url_regexp = w3_get_domain_url_regexp();
if ($this->_config->get_boolean('cdn.uploads.enable')) {
require_once W3TC_INC_DIR . '/functions/http.php';
$upload_info = w3_upload_info();
if ($upload_info) {
if (preg_match('~' . $domain_url_regexp . '~i', $upload_info['baseurl'])) {
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\'>]+)))~';
} else {
$regexps[] = '~(["\'])((' . w3_preg_quote($upload_info['baseurl']) . ')(([^"\'>]+)))~';
}
}
}
if ($this->_config->get_boolean('cdn.includes.enable')) {
$mask = $this->_config->get_string('cdn.includes.files');
if ($mask != '') {
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
if ($this->_config->get_boolean('cdn.theme.enable')) {
$theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
$mask = $this->_config->get_string('cdn.theme.files');
if ($mask != '') {
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
if ($this->_config->get_boolean('cdn.minify.enable')) {
if ($this->_config->get_boolean('minify.auto')) {
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . W3TC_CONTENT_MINIFY_DIR_NAME) . '/[a-f0-9]+\\.[a-f0-9]+\\.(css|js)))~U';
} else {
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . W3TC_CONTENT_MINIFY_DIR_NAME) . '/[a-f0-9]+/.+\\.include(-(footer|body))?(-nb)?\\.[a-f0-9]+\\.(css|js)))~U';
}
}
if ($this->_config->get_boolean('cdn.custom.enable')) {
$masks = $this->_config->get_array('cdn.custom.files');
$masks = array_map('w3_parse_path', $masks);
if (count($masks)) {
$mask_regexps = array();
foreach ($masks as $mask) {
if ($mask != '') {
$mask = w3_normalize_file($mask);
$mask_regexps[] = $this->get_regexp_by_mask($mask);
}
}
$regexps[] = '~(["\'])((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
}
}
foreach ($regexps as $regexp) {
$buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
}
}
if ($this->_config->get_boolean('cdn.debug')) {
$buffer .= "\r\n\r\n" . $this->get_debug_info();
}
}
return $buffer;
}
开发者ID:pyropictures,项目名称:wordpress-plugins,代码行数:68,代码来源:Cdn.php
示例8: test
/**
* Tests FTP server
*
* @param string $error
* @return boolean
*/
function test(&$error)
{
$rand = md5(time());
$upload_info = w3_upload_info();
$tmp_dir = 'test_dir_' . $rand;
$tmp_file = 'test_file_' . $rand;
$tmp_path = $upload_info['path'] . '/' . $tmp_file;
if (!@file_put_contents($tmp_path, $rand)) {
$error = sprintf('Unable to create file: %s.', $tmp_path);
return false;
}
if (!$this->_connect($error)) {
return false;
}
if (!@ftp_mkdir($this->_ftp, $tmp_dir)) {
$this->_disconnect();
$error = sprintf('Unable to make directory: %s.', $tmp_dir);
return false;
} else {
@ftp_chmod($this->_ftp, 0755, $tmp_dir);
}
if (!@ftp_chdir($this->_ftp, $tmp_dir)) {
$this->_disconnect();
$error = sprintf('Unable to change directory to: %s.', $tmp_dir);
return false;
}
if (!@ftp_put($this->_ftp, $tmp_file, $tmp_path, FTP_BINARY)) {
@ftp_cdup($this->_ftp);
@ftp_rmdir($this->_ftp, $tmp_dir);
@unlink($tmp_path);
$this->_disconnect();
$error = sprintf('Unable to upload file: %s.', $tmp_path);
return false;
}
@ftp_delete($this->_ftp, $tmp_file);
@ftp_cdup($this->_ftp);
@ftp_rmdir($this->_ftp, $tmp_dir);
@unlink($tmp_path);
$this->_disconnect();
return true;
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:47,代码来源:Ftp.php
示例9: ob_callback
/**
* OB Callback
*
* @param string $buffer
* @return string
*/
function ob_callback(&$buffer)
{
if ($buffer != '' && w3_is_xml($buffer)) {
if ($this->can_cdn2($buffer)) {
$regexps = array();
$site_path = w3_get_site_path();
$domain_url_regexp = w3_get_domain_url_regexp();
if ($this->_config->get_boolean('cdn.uploads.enable')) {
w3_require_once(W3TC_INC_DIR . '/functions/http.php');
$upload_info = w3_upload_info();
if ($upload_info) {
if (preg_match('~' . $domain_url_regexp . '~i', $upload_info['baseurl'])) {
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($upload_info['baseurlpath']) . '([^"\')>]+)))~';
} else {
$parsed = @parse_url($upload_info['baseurl']);
$upload_url_domain_regexp = isset($parsed['host']) ? w3_get_url_regexp($parsed['scheme'] . '://' . $parsed['host']) : '';
$baseurlpath = isset($parsed['path']) ? rtrim($parsed['path'], '/') : '';
if ($baseurlpath) {
$regexps[] = '~(["\'])\\s*((' . $upload_url_domain_regexp . ')?(' . w3_preg_quote($baseurlpath) . '([^"\'>]+)))~';
} else {
$regexps[] = '~(["\'])\\s*((' . $upload_url_domain_regexp . ')([^"\'>]+))~';
}
}
}
}
if ($this->_config->get_boolean('cdn.includes.enable')) {
$mask = $this->_config->get_string('cdn.includes.files');
if ($mask != '') {
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path . WPINC) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
if ($this->_config->get_boolean('cdn.theme.enable')) {
$theme_dir = preg_replace('~' . $domain_url_regexp . '~i', '', get_theme_root_uri());
$mask = $this->_config->get_string('cdn.theme.files');
if ($mask != '') {
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($theme_dir) . '/(' . $this->get_regexp_by_mask($mask) . ')))~';
}
}
if ($this->_config->get_boolean('cdn.custom.enable')) {
$masks = $this->_config->get_array('cdn.custom.files');
$masks = array_map('w3_parse_path', $masks);
if (count($masks)) {
$mask_regexps = array();
foreach ($masks as $mask) {
if ($mask != '') {
$mask = w3_normalize_file($mask);
$mask_regexps[] = $this->get_regexp_by_mask($mask);
}
}
$regexps[] = '~(["\'(])\\s*((' . $domain_url_regexp . ')?(' . w3_preg_quote($site_path) . '(' . implode('|', $mask_regexps) . ')))~i';
}
}
foreach ($regexps as $regexp) {
$buffer = preg_replace_callback($regexp, array(&$this, 'link_replace_callback'), $buffer);
}
if ($this->_config->get_boolean('cdn.minify.enable')) {
if ($this->_config->get_boolean('minify.auto')) {
$regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-zA-Z0-9-_]+\\.(css|js)') . '~U';
if (w3_is_cdn_mirror($this->_config->get_string('cdn.engine'))) {
$processor = 'link_replace_callback';
} else {
$processor = 'minify_auto_pushcdn_link_replace_callback';
}
} else {
$regexp = '~(["\'(])\\s*' . $this->_minify_url_regexp('/[a-z0-9]+/.+\\.include(-(footer|body))?(-nb)?\\.[a-f0-9]+\\.(css|js)') . '~U';
$processor = 'link_replace_callback';
}
$buffer = preg_replace_callback($regexp, array(&$this, $processor), $buffer);
}
}
if ($this->_config->get_boolean('cdn.debug')) {
$buffer .= "\r\n\r\n" . $this->get_debug_info();
}
}
return $buffer;
}
开发者ID:marqui678,项目名称:finalchance.Panopta,代码行数:82,代码来源:Cdn.php
示例10: get_server_info
/**
* Returns server info
*/
function get_server_info()
{
global $wp_version, $wp_db_version, $wpdb;
$wordpress_plugins = get_plugins();
$wordpress_plugins_active = array();
foreach ($wordpress_plugins as $wordpress_plugin_file => $wordpress_plugin) {
if (is_plugin_active($wordpress_plugin_file)) {
$wordpress_plugins_active[$wordpress_plugin_file] = $wordpress_plugin;
}
}
$w3tc_config = (array) @(include W3TC_CONFIG_PATH);
$mysql_version = (array) $wpdb->get_var('SELECT VERSION()');
$mysql_variables_result = (array) $wpdb->get_results('SHOW VARIABLES', ARRAY_N);
$mysql_variables = array();
foreach ($mysql_variables_result as $mysql_variables_row) {
$mysql_variables[$mysql_variables_row[0]] = $mysql_variables_row[1];
}
return array('wp' => array('version' => $wp_version, 'db_version' => $wp_db_version, 'w3tc_version' => W3TC_VERSION, 'url' => w3_get_domain_url(), 'path' => ABSPATH, 'email' => get_option('admin_email'), 'upload_info' => (array) w3_upload_info(), 'theme' => get_theme(get_current_theme()), 'plugins' => $wordpress_plugins_active, 'wp_cache' => defined('WP_CACHE') ? 'true' : 'false'), 'mysql' => array('version' => $mysql_version, 'variables' => $mysql_variables));
}
开发者ID:alx,项目名称:SBek-Arak,代码行数:22,代码来源:TotalCache.php
注:本文中的w3_upload_info函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论