More linting and removing dead code.

This commit is contained in:
jgen 2014-04-28 02:43:49 -04:00
parent 3cd8c33ed1
commit 8fd532e5a8
5 changed files with 65 additions and 15 deletions

View file

@ -11,9 +11,15 @@
*/
class AddAliasEvent extends Event {
var $oldtag;
var $newtag;
/** @var string */
public $oldtag;
/** @var string */
public $newtag;
/**
* @param string $oldtag
* @param string $newtag
*/
public function __construct($oldtag, $newtag) {
$this->oldtag = trim($oldtag);
$this->newtag = trim($newtag);
@ -124,6 +130,10 @@ class AliasEditor extends Extension {
}
}
/**
* @param Database $database
* @return string
*/
private function get_alias_csv(Database $database) {
$csv = "";
$aliases = $database->get_pairs("SELECT oldtag, newtag FROM aliases ORDER BY newtag");
@ -133,6 +143,10 @@ class AliasEditor extends Extension {
return $csv;
}
/**
* @param Database $database
* @param string $csv
*/
private function add_alias_csv(Database $database, /*string*/ $csv) {
$csv = str_replace("\r", "\n", $csv);
foreach(explode("\n", $csv) as $line) {
@ -148,9 +162,15 @@ class AliasEditor extends Extension {
}
}
// add alias *after* mass tag editing, else the MTE will
// search for the images and be redirected to the alias,
// missing out the images tagged with the oldtag
/**
* Get the priority for this extension.
*
* Add alias *after* mass tag editing, else the MTE will
* search for the images and be redirected to the alias,
* missing out the images tagged with the old tag.
*
* @return int
*/
public function get_priority() {return 60;}
}

View file

@ -1,11 +1,14 @@
<?php
class AliasEditorTheme extends Themelet {
/*
* Show a page of aliases:
/**
* Show a page of aliases.
*
* $aliases = an array of ($old_tag => $new_tag)
* $can_manage = whether things like "add new alias" should be shown
* Note: $can_manage = whether things like "add new alias" should be shown
*
* @param array $aliases An array of ($old_tag => $new_tag)
* @param int $pageNumber
* @param int $totalPages
*/
public function display_aliases($aliases, $pageNumber, $totalPages) {
global $page, $user;

View file

@ -9,14 +9,22 @@
* Simply enable this extention in the extention manager to enable arrow key navigation.
*/
class ArrowkeyNavigation extends Extension {
# Adds functionality for post/view on images
/**
* Adds functionality for post/view on images.
*
* @param DisplayingImageEvent $event
*/
public function onDisplayingImage(DisplayingImageEvent $event) {
$prev_url = make_http(make_link("post/prev/".$event->image->id));
$next_url = make_http(make_link("post/next/".$event->image->id));
$this->add_arrowkeys_code($prev_url, $next_url);
}
# Adds functionality for post/list
/**
* Adds functionality for post/list.
*
* @param PageRequestEvent $event
*/
public function onPageRequest(PageRequestEvent $event) {
if($event->page_matches("post/list")) {
$pageinfo = $this->get_list_pageinfo($event);
@ -26,7 +34,12 @@ class ArrowkeyNavigation extends Extension {
}
}
# adds the javascript to the page with the given urls
/**
* Adds the javascript to the page with the given urls.
*
* @param string $prev_url
* @param string $next_url
*/
private function add_arrowkeys_code($prev_url, $next_url) {
global $page;
@ -41,8 +54,13 @@ class ArrowkeyNavigation extends Extension {
</script>", 60);
}
# returns info about the current page number
private function get_list_pageinfo($event) {
/**
* Returns info about the current page number.
*
* @param PageRequestEvent $event
* @return array
*/
private function get_list_pageinfo(PageRequestEvent $event) {
global $config, $database;
// get the amount of images per page

View file

@ -1,6 +1,10 @@
<?php
class ArtistsTheme extends Themelet {
/**
* @param string $author
* @return string
*/
public function get_author_editor_html(/*string*/ $author) {
$h_author = html_escape($author);
return "
@ -14,6 +18,11 @@ class ArtistsTheme extends Themelet {
";
}
/**
* @param string $mode
* @param null|int $artistID
* @param bool $is_admin
*/
public function sidebar_options(/*string*/ $mode, $artistID=NULL, $is_admin=FALSE){
global $page, $user;

View file

@ -32,7 +32,7 @@ class Blocks extends Extension {
}
public function onPageRequest(PageRequestEvent $event) {
global $config, $database, $page, $user;
global $database, $page, $user;
$blocks = $database->cache->get("blocks");
if($blocks === false) {