Changeset View
Changeset View
Standalone View
Standalone View
src/infrastructure/markup/markuprule/PhutilRemarkupRule.php
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | abstract class PhutilRemarkupRule extends Phobject { | ||||
* @param wild Ostensibly flat text. | * @param wild Ostensibly flat text. | ||||
* @return bool True if the text is flat. | * @return bool True if the text is flat. | ||||
*/ | */ | ||||
protected function isFlatText($text) { | protected function isFlatText($text) { | ||||
$text = (string)hsprintf('%s', phutil_safe_html($text)); | $text = (string)hsprintf('%s', phutil_safe_html($text)); | ||||
return (strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) === false); | return (strpos($text, PhutilRemarkupBlockStorage::MAGIC_BYTE) === false); | ||||
} | } | ||||
/** | |||||
* Check whenever an URI is an anchor | |||||
* | |||||
* @param string $uri | |||||
* @return bool | |||||
*/ | |||||
protected function isURIAnchor($uri) { | |||||
return strncmp($uri, '#', 1) == 0; | |||||
} | |||||
/** | |||||
* Check whenever an URI is a relative one | |||||
* | |||||
* @param string $uri Example '/path' etc. | |||||
* @return bool | |||||
*/ | |||||
protected function isURIRelativePath($uri) { | |||||
// NOTE: This was the original check, but at | |||||
// the moment '/' is assumed as relative but | |||||
// './' is assumed as not relative, and this | |||||
// may be confusing and may deserve a future update | |||||
return strncmp($uri, '/', 1) == 0; | |||||
} | |||||
} | } |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0