From 2077464d464e485a978166604faf158b654fb0cb Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 3 May 2011 09:14:32 +0200 Subject: begin bookmark model class with URL validation method --- src/SemanticScuttle/Model/Bookmark.php | 38 ++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 src/SemanticScuttle/Model/Bookmark.php (limited to 'src/SemanticScuttle/Model') diff --git a/src/SemanticScuttle/Model/Bookmark.php b/src/SemanticScuttle/Model/Bookmark.php new file mode 100644 index 0000000..2cbe38d --- /dev/null +++ b/src/SemanticScuttle/Model/Bookmark.php @@ -0,0 +1,38 @@ + + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +/** + * Bookmark model class, keeping the data of a single bookmark. + * It will slowly replace the old array style format. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class SemanticScuttle_Model_Bookmark +{ + public static function isValidUrl($url) + { + $scheme = parse_url($url, PHP_URL_SCHEME); + if (array_search($scheme, $GLOBALS['allowedProtocols']) === false) { + return false; + } + return true; + } + +} + + +?> \ No newline at end of file -- cgit v1.2.3 From 218ac05e712a85572afd0ed76ff969bcbe6c4b09 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Tue, 3 May 2011 09:19:08 +0200 Subject: docblock for isValidUrl method --- src/SemanticScuttle/Model/Bookmark.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/SemanticScuttle/Model') diff --git a/src/SemanticScuttle/Model/Bookmark.php b/src/SemanticScuttle/Model/Bookmark.php index 2cbe38d..8bda0b3 100644 --- a/src/SemanticScuttle/Model/Bookmark.php +++ b/src/SemanticScuttle/Model/Bookmark.php @@ -23,6 +23,14 @@ */ class SemanticScuttle_Model_Bookmark { + /** + * Checks if the given URL is valid and may be used with this + * SemanticScuttle installation. + * + * @param string $url URL to verify. + * + * @return boolean True if the URL is allowed, false if not + */ public static function isValidUrl($url) { $scheme = parse_url($url, PHP_URL_SCHEME); -- cgit v1.2.3