本文整理汇总了PHP中CSS::find_properties_with_value方法的典型用法代码示例。如果您正苦于以下问题:PHP CSS::find_properties_with_value方法的具体用法?PHP CSS::find_properties_with_value怎么用?PHP CSS::find_properties_with_value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSS
的用法示例。
在下文中一共展示了CSS::find_properties_with_value方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_process
/**
* The second last process, should only be getting everything
* syntaxically correct, rather than doing any heavy processing
*
* @author Anthony Short
* @return $css string
*/
public static function post_process()
{
if ($found = CSS::find_properties_with_value('image-replace', 'url\\([\'\\"]?([^)]+)[\'\\"]?\\)')) {
foreach ($found[4] as $key => $value) {
$path = $url = str_replace("\\", "/", unquote($value));
# If they're getting an absolute file
if ($path[0] == "/") {
$path = DOCROOT . ltrim($path, "/");
}
# Check if it exists
if (!file_exists($path)) {
FB::log("ImageReplace - Image doesn't exist " . $path);
}
# Make sure it's an image
if (!is_image($path)) {
FB::log("ImageReplace - File is not an image: {$path}");
}
// Get the size of the image file
$size = GetImageSize($path);
$width = $size[0];
$height = $size[1];
// Make sure theres a value so it doesn't break the css
if (!$width && !$height) {
$width = $height = 0;
}
// Build the selector
$properties = "\n\t\t\t\t\tbackground:url({$url}) no-repeat 0 0;\n\t\t\t\t\theight:{$height}px;\n\t\t\t\t\twidth:{$width}px;\n\t\t\t\t\tdisplay:block;\n\t\t\t\t\ttext-indent:-9999px;\n\t\t\t\t\toverflow:hidden;\n\t\t\t\t";
CSS::replace($found[2][$key], $properties);
}
# Remove any left overs
CSS::replace($found[1], '');
}
}