本文整理汇总了PHP中Util_Environment::normalize_file方法的典型用法代码示例。如果您正苦于以下问题:PHP Util_Environment::normalize_file方法的具体用法?PHP Util_Environment::normalize_file怎么用?PHP Util_Environment::normalize_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util_Environment
的用法示例。
在下文中一共展示了Util_Environment::normalize_file方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _link_replace_callback_checks
/**
* Link replace callback, basic checks step
*
* @param string $match
* @param string $quote
* @param string $url
* @param string $path
* @return null|string
*/
function _link_replace_callback_checks($match, $quote, $url, $path)
{
global $wpdb;
static $queue = null, $reject_files = null;
/**
* Check if URL was already replaced
*/
if (isset($this->replaced_urls[$url])) {
return $quote . $this->replaced_urls[$url];
}
/**
* Check URL for rejected files
*/
if ($reject_files === null) {
$reject_files = $this->_config->get_array('cdn.reject.files');
}
foreach ($reject_files as $reject_file) {
if ($reject_file != '') {
$reject_file = Cdn_Util::replace_folder_placeholders($reject_file);
$reject_file = Util_Environment::normalize_file($reject_file);
$reject_file_regexp = '~^(' . Cdn_Util::get_regexp_by_mask($reject_file) . ')~i';
if (preg_match($reject_file_regexp, $path)) {
return $match;
}
}
}
/**
* Don't replace URL for files that are in the CDN queue
*/
if ($queue === null) {
if (!Cdn_Util::is_engine_mirror($this->_config->get_string('cdn.engine'))) {
$sql = $wpdb->prepare('SELECT remote_path FROM ' . $wpdb->base_prefix . W3TC_CDN_TABLE_QUEUE . ' WHERE remote_path = %s', $path);
$queue = $wpdb->get_var($sql);
} else {
$queue = false;
}
}
if ($queue) {
return $match;
}
return null;
}