本文整理匯總了PHP中lessc::toBool方法的典型用法代碼示例。如果您正苦於以下問題:PHP lessc::toBool方法的具體用法?PHP lessc::toBool怎麽用?PHP lessc::toBool使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lessc
的用法示例。
在下文中一共展示了lessc::toBool方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: embeddable
/**
* Check if an image file reference is suitable for embedding.
* An image is embeddable if it (a) exists, (b) has a suitable MIME-type,
* (c) does not exceed IE<9 size limit of 32kb. This is a LESS predicate
* function; it returns a LESS boolean value and can thus be used as a
* mixin guard.
*
* @par Example:
* @code
* .background-image(@url) when(embeddable(@url)) {
* background-image: url(@url) !ie;
* }
* @endcode
* @param array $frame
* @param lessc $less
*/
public static function embeddable($frame, $less)
{
$base = pathinfo($less->parser->sourceName, PATHINFO_DIRNAME);
$url = trim($less->compileValue($frame), '"\'');
$file = realpath($base . '/' . $url);
return $less->toBool($file && strpos($url, '//') === false && filesize($file) < CSSMin::EMBED_SIZE_LIMIT && CSSMin::getMimeType($file) !== false);
}