diff --git a/build/index.php b/build/index.php index fdd05c3..9c7a9de 100644 --- a/build/index.php +++ b/build/index.php @@ -729,6 +729,20 @@ function endsWith($whole, $end) { return (strpos($whole, $end, strlen($whole) - strlen($end)) !== false); } +/** + * Replaces the first occurrence of $find with $replace. + * @param string $find The string to search for. + * @param string $replace The string to replace the search string with. + * @param string $subject The string ot perform the search and replace on. + * @return string The source string after the find and replace has been performed. + */ +function str_replace_once($find, $replace, $subject) +{ + $index = strpos($subject, $find); + if($index !== false) + return substr_replace($subject, $replace, $index, strlen($find)); + return $subject; +} /** * Returns the system's mime type mappings, considering the first extension @@ -2210,7 +2224,7 @@ register_module([ $comments_html = "\n"; + $to_comments_link = "Jump to comments"; + $parts["{extra}"] = $comments_html . $parts["{extra}"]; + + // fixme + $parts["{content}"] = str_replace_once("", "\n$to_comments_link", $parts["{content}"]); }); $reply_js_snippet = <<<'REPLYJS' @@ -6098,7 +6117,7 @@ register_module([ $page = $env->page; if(!isset($pageindex->$page)) { - // todo make this intelligent so we only redirect if the user is acutally able to create the page + // todo make this intelligent so we only redirect if the user is actually able to create the page if($settings->editing) { // Editing is enabled, redirect to the editing page diff --git a/module_index.json b/module_index.json index 539783f..abe1709 100755 --- a/module_index.json +++ b/module_index.json @@ -50,7 +50,7 @@ "author": "Starbeamrainbowlabs", "description": "Adds threaded comments to the bottom of every page.", "id": "feature-comments", - "lastupdate": 1495289583, + "lastupdate": 1495292573, "optional": false }, { @@ -230,7 +230,7 @@ "author": "Starbeamrainbowlabs", "description": "Allows you to view pages. You really should include this one.", "id": "page-view", - "lastupdate": 1482008539, + "lastupdate": 1495291771, "optional": false }, { diff --git a/modules/feature-comments.php b/modules/feature-comments.php index 6225a89..1431d88 100644 --- a/modules/feature-comments.php +++ b/modules/feature-comments.php @@ -137,7 +137,7 @@ register_module([ $comments_html = "\n"; + $to_comments_link = "Jump to comments"; + $parts["{extra}"] = $comments_html . $parts["{extra}"]; + + $parts["{content}"] = str_replace_once("", "\n$to_comments_link", $parts["{content}"]); }); $reply_js_snippet = <<<'REPLYJS' diff --git a/modules/page-view.php b/modules/page-view.php index 10e67e1..42e9cd1 100644 --- a/modules/page-view.php +++ b/modules/page-view.php @@ -34,7 +34,7 @@ register_module([ $page = $env->page; if(!isset($pageindex->$page)) { - // todo make this intelligent so we only redirect if the user is acutally able to create the page + // todo make this intelligent so we only redirect if the user is actually able to create the page if($settings->editing) { // Editing is enabled, redirect to the editing page