本文整理汇总了PHP中SimplePie_Misc::strendpos方法的典型用法代码示例。如果您正苦于以下问题:PHP SimplePie_Misc::strendpos方法的具体用法?PHP SimplePie_Misc::strendpos怎么用?PHP SimplePie_Misc::strendpos使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SimplePie_Misc
的用法示例。
在下文中一共展示了SimplePie_Misc::strendpos方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: absolutize_url
function absolutize_url($relative, $base)
{
$relative = trim($relative);
$base = trim($base);
if (!empty($relative)) {
$relative = SimplePie_Misc::parse_url($relative, false);
$relative = array('scheme' => $relative[2], 'authority' => $relative[3], 'path' => $relative[5], 'query' => $relative[7], 'fragment' => $relative[9]);
if (!empty($relative['scheme'])) {
$target = $relative;
} else {
if (!empty($base)) {
$base = SimplePie_Misc::parse_url($base, false);
$base = array('scheme' => $base[2], 'authority' => $base[3], 'path' => $base[5], 'query' => $base[7], 'fragment' => $base[9]);
$target['scheme'] = $base['scheme'];
if (!empty($relative['authority'])) {
$target = array_merge($relative, $target);
} else {
$target['authority'] = $base['authority'];
if (!empty($relative['path'])) {
if (strpos($relative['path'], '/') === 0) {
$target['path'] = $relative['path'];
} else {
if (!empty($base['path'])) {
$target['path'] = dirname("{$base['path']}.") . '/' . $relative['path'];
} else {
$target['path'] = '/' . $relative['path'];
}
}
if (!empty($relative['query'])) {
$target['query'] = $relative['query'];
}
$input = $target['path'];
$target['path'] = '';
while (!empty($input)) {
if (strpos($input, '../') === 0) {
$input = substr($input, 3);
} else {
if (strpos($input, './') === 0) {
$input = substr($input, 2);
} else {
if (strpos($input, '/./') === 0) {
$input = substr_replace($input, '/', 0, 3);
} else {
if (strpos($input, '/.') === 0 && SimplePie_Misc::strendpos($input, '/.') === 0) {
$input = substr_replace($input, '/', -2);
} else {
if (strpos($input, '/../') === 0) {
$input = substr_replace($input, '/', 0, 4);
$target['path'] = preg_replace('/(\\/)?([^\\/]+)$/msiU', '', $target['path']);
} else {
if (strpos($input, '/..') === 0 && SimplePie_Misc::strendpos($input, '/..') === 0) {
$input = substr_replace($input, '/', 0, 3);
$target['path'] = preg_replace('/(\\/)?([^\\/]+)$/msiU', '', $target['path']);
} else {
if ($input == '.' || $input == '..') {
$input = '';
} else {
if (preg_match('/^(.+)(\\/|$)/msiU', $input, $match)) {
$target['path'] .= $match[1];
$input = substr_replace($input, '', 0, strlen($match[1]));
}
}
}
}
}
}
}
}
}
} else {
if (!empty($base['path'])) {
$target['path'] = $base['path'];
} else {
$target['path'] = '/';
}
if (!empty($relative['query'])) {
$target['query'] = $relative['query'];
} else {
if (!empty($base['query'])) {
$target['query'] = $base['query'];
}
}
}
}
if (!empty($relative['fragment'])) {
$target['fragment'] = $relative['fragment'];
}
} else {
return false;
}
}
$return = '';
if (!empty($target['scheme'])) {
$return .= "{$target['scheme']}:";
}
if (!empty($target['authority'])) {
$return .= $target['authority'];
}
if (!empty($target['path'])) {
$return .= $target['path'];
//.........这里部分代码省略.........