本文整理汇总了PHP中Stylesheet::get_base_path方法的典型用法代码示例。如果您正苦于以下问题:PHP Stylesheet::get_base_path方法的具体用法?PHP Stylesheet::get_base_path怎么用?PHP Stylesheet::get_base_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stylesheet
的用法示例。
在下文中一共展示了Stylesheet::get_base_path方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trim
/**
* Set the background image url
*
* @link http://www.w3.org/TR/CSS21/colors.html#background-properties
* @param string $url
*/
function set_background_image($val)
{
if (mb_strpos($val, "url") !== false) {
$val = preg_replace("/url\\(['\"]?([^'\")]+)['\"]?\\)/", "\\1", trim($val));
} else {
$val = "none";
}
// Resolve the url now in the context of the current stylesheet
$parsed_url = explode_url($val);
if ($parsed_url["protocol"] == "" && $this->_stylesheet->get_protocol() == "") {
$url = realpath($this->_stylesheet->get_base_path() . $parsed_url["file"]);
} else {
$url = build_url($this->_stylesheet->get_protocol(), $this->_stylesheet->get_host(), $this->_stylesheet->get_base_path(), $val);
}
$this->_props["background_image"] = $url;
}
示例2: _image
protected function _image($val)
{
$DEBUGCSS = DEBUGCSS;
$parsed_url = "none";
if (mb_strpos($val, "url") === false) {
$path = "none";
//Don't resolve no image -> otherwise would prefix path and no longer recognize as none
} else {
$val = preg_replace("/url\\(['\"]?([^'\")]+)['\"]?\\)/", "\\1", trim($val));
// Resolve the url now in the context of the current stylesheet
$parsed_url = explode_url($val);
if ($parsed_url["protocol"] == "" && $this->_stylesheet->get_protocol() == "") {
if ($parsed_url["path"][0] === '/' || $parsed_url["path"][0] === '\\') {
$path = $_SERVER["DOCUMENT_ROOT"] . '/';
} else {
$path = $this->_stylesheet->get_base_path();
}
$path .= $parsed_url["path"] . $parsed_url["file"];
$path = realpath($path);
// If realpath returns FALSE then specifically state that there is no background image
if (!$path) {
$path = 'none';
}
} else {
$path = build_url($this->_stylesheet->get_protocol(), $this->_stylesheet->get_host(), $this->_stylesheet->get_base_path(), $val);
}
}
if ($DEBUGCSS) {
print "<pre>[_image\n";
print_r($parsed_url);
print $this->_stylesheet->get_protocol() . "\n" . $this->_stylesheet->get_base_path() . "\n" . $path . "\n";
print "_image]</pre>";
}
return $path;
}