本文整理匯總了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;
}