From d4ac6ca451736aa38f3f1b5ea463a821bdc9749e Mon Sep 17 00:00:00 2001 From: jgen Date: Mon, 28 Apr 2014 02:56:58 -0400 Subject: [PATCH] Such linting, such wow. Much clean. --- ext/qr_code/theme.php | 5 ++- ext/regen_thumb/main.php | 2 +- ext/regen_thumb/theme.php | 12 +++++-- ext/relatationships/main.php | 12 ++++++- ext/relatationships/theme.php | 4 +++ ext/rotate/main.php | 6 +++- ext/rotate/theme.php | 18 ++++++++--- ext/tag_list/main.php | 59 +++++++++++++++++++++++++++++------ ext/tag_list/theme.php | 38 ++++++++++++++++++++-- 9 files changed, 133 insertions(+), 23 deletions(-) diff --git a/ext/qr_code/theme.php b/ext/qr_code/theme.php index 3e82351d..c0600f23 100644 --- a/ext/qr_code/theme.php +++ b/ext/qr_code/theme.php @@ -1,9 +1,12 @@ add_block( new Block( - "QR Code","QR Code","left",50)); + "QR Code","QR Code","left",50)); } } diff --git a/ext/regen_thumb/main.php b/ext/regen_thumb/main.php index 4c12f0c4..ec48c649 100644 --- a/ext/regen_thumb/main.php +++ b/ext/regen_thumb/main.php @@ -15,7 +15,7 @@ class RegenThumb extends Extension { public function onPageRequest(PageRequestEvent $event) { - global $config, $database, $page, $user; + global $page, $user; if($event->page_matches("regen_thumb") && $user->can("delete_image") && isset($_POST['image_id'])) { $image = Image::by_id(int_escape($_POST['image_id'])); diff --git a/ext/regen_thumb/theme.php b/ext/regen_thumb/theme.php index 68d7904c..ad2d852d 100644 --- a/ext/regen_thumb/theme.php +++ b/ext/regen_thumb/theme.php @@ -1,8 +1,11 @@ set_title("Thumbnail Regenerated"); diff --git a/ext/relatationships/main.php b/ext/relatationships/main.php index 846687a1..dc4fe6b1 100644 --- a/ext/relatationships/main.php +++ b/ext/relatationships/main.php @@ -21,7 +21,6 @@ class Relationships extends Extension { } public function onImageInfoSet(ImageInfoSetEvent $event) { - global $user; if(isset($_POST['tag_edit__tags']) ? !preg_match('/parent[=|:]/', $_POST["tag_edit__tags"]) : TRUE) { //Ignore tag_edit__parent if tags contain parent metatag if (isset($_POST["tag_edit__parent"]) ? ctype_digit($_POST["tag_edit__parent"]) : FALSE) { $this->set_parent($event->image->id, (int) $_POST["tag_edit__parent"]); @@ -91,6 +90,10 @@ class Relationships extends Extension { } } + /** + * @param int $imageID + * @param int $parentID + */ private function set_parent(/*int*/ $imageID, /*int*/ $parentID){ global $database; @@ -100,6 +103,10 @@ class Relationships extends Extension { } } + /** + * @param int $parentID + * @param int $childID + */ private function set_child(/*int*/ $parentID, /*int*/ $childID){ global $database; @@ -109,6 +116,9 @@ class Relationships extends Extension { } } + /** + * @param int $imageID + */ private function remove_parent(/*int*/ $imageID){ global $database; $parentID = $database->get_one("SELECT parent_id FROM images WHERE id = :iid", array("iid"=>$imageID)); diff --git a/ext/relatationships/theme.php b/ext/relatationships/theme.php index a73e2293..7656facf 100644 --- a/ext/relatationships/theme.php +++ b/ext/relatationships/theme.php @@ -1,6 +1,9 @@ parent_id; $s_parent_id = $h_parent_id ?: "None."; diff --git a/ext/rotate/main.php b/ext/rotate/main.php index 5e1c8af8..0946e7a2 100644 --- a/ext/rotate/main.php +++ b/ext/rotate/main.php @@ -16,8 +16,12 @@ * This class is just a wrapper around SCoreException. */ class ImageRotateException extends SCoreException { - var $error; + /** @var string */ + public $error; + /** + * @param string $error + */ public function __construct($error) { $this->error = $error; } diff --git a/ext/rotate/theme.php b/ext/rotate/theme.php index c6481469..a9ddeaa0 100644 --- a/ext/rotate/theme.php +++ b/ext/rotate/theme.php @@ -1,12 +1,13 @@ @@ -17,7 +18,14 @@ class RotateImageTheme extends Themelet { return $html; } - + + /** + * Display the error. + * + * @param Page $page + * @param string $title + * @param string $message + */ public function display_rotate_error(Page $page, /*string*/ $title, /*string*/ $message) { $page->set_title("Rotate Image"); $page->set_heading("Rotate Image"); diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 53f748ea..0342ae59 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -121,6 +121,10 @@ class TagList extends Extension { } // }}} // misc {{{ + /** + * @param string $tag + * @return string + */ private function tag_link(/*string*/ $tag) { $u_tag = url_escape($tag); return make_link("post/list/$u_tag/1"); @@ -129,7 +133,8 @@ class TagList extends Extension { /** * Get the minimum number of times a tag needs to be used * in order to be considered in the tag list. - * @retval int + * + * @return int */ private function get_tags_min() { if(isset($_GET['mincount'])) { @@ -141,6 +146,9 @@ class TagList extends Extension { } } + /** + * @return string + */ private function get_starts_with() { global $config; if(isset($_GET['starts_with'])) { @@ -156,6 +164,9 @@ class TagList extends Extension { } } + /** + * @return string + */ private function build_az() { global $database; @@ -179,6 +190,10 @@ class TagList extends Extension { } // }}} // maps {{{ + + /** + * @return string + */ private function build_navigation() { $h_index = "Index"; $h_map = "Map"; @@ -189,6 +204,9 @@ class TagList extends Extension { return "$h_index
 
$h_map
$h_alphabetic
$h_popularity
$h_cats
 
$h_all"; } + /** + * @return string + */ private function build_tag_map() { global $config, $database; @@ -226,6 +244,9 @@ class TagList extends Extension { return $html; } + /** + * @return string + */ private function build_tag_alphabetic() { global $config, $database; @@ -279,6 +300,9 @@ class TagList extends Extension { return $html; } + /** + * @return string + */ private function build_tag_popularity() { global $database; @@ -318,6 +342,9 @@ class TagList extends Extension { return $html; } + /** + * @return string + */ private function build_tag_list() { global $database; @@ -344,9 +371,12 @@ class TagList extends Extension { } // }}} // blocks {{{ + /** + * @param Page $page + * @param Image $image + */ private function add_related_block(Page $page, Image $image) { - global $database; - global $config; + global $database, $config; $query = " SELECT t3.tag AS tag, t3.count AS calc_count, it3.tag_id @@ -376,9 +406,12 @@ class TagList extends Extension { } } + /** + * @param Page $page + * @param Image $image + */ private function add_split_tags_block(Page $page, Image $image) { global $database; - global $config; $query = " SELECT tags.tag, tags.count as calc_count @@ -395,9 +428,12 @@ class TagList extends Extension { } } + /** + * @param Page $page + * @param Image $image + */ private function add_tags_block(Page $page, Image $image) { global $database; - global $config; $query = " SELECT tags.tag, tags.count as calc_count @@ -414,9 +450,11 @@ class TagList extends Extension { } } + /** + * @param Page $page + */ private function add_popular_block(Page $page) { - global $database; - global $config; + global $database, $config; $tags = $database->cache->get("popular_tags"); if(empty($tags)) { @@ -437,9 +475,12 @@ class TagList extends Extension { } } + /** + * @param Page $page + * @param string[] $search + */ private function add_refine_block(Page $page, /*array(string)*/ $search) { - global $database; - global $config; + global $database, $config; $wild_tags = Tag::explode($search); $str_search = Tag::implode($search); diff --git a/ext/tag_list/theme.php b/ext/tag_list/theme.php index 525330e2..b777ad55 100644 --- a/ext/tag_list/theme.php +++ b/ext/tag_list/theme.php @@ -1,13 +1,23 @@ heading = $text; } + /** + * @param string|string[] $list + */ public function set_tag_list($list) { $this->list = $list; } @@ -219,6 +229,11 @@ class TagListTheme extends Themelet { return array($category, $display_html); } + /** + * @param string $tag + * @param string[] $tags + * @return string + */ protected function ars(/*string*/ $tag, /*array(string)*/ $tags) { assert(is_array($tags)); @@ -234,6 +249,11 @@ class TagListTheme extends Themelet { return $html; } + /** + * @param array $tags + * @param string $tag + * @return string + */ protected function get_remove_link($tags, $tag) { if(!in_array($tag, $tags) && !in_array("-$tag", $tags)) { return ""; @@ -245,6 +265,11 @@ class TagListTheme extends Themelet { } } + /** + * @param array $tags + * @param string $tag + * @return string + */ protected function get_add_link($tags, $tag) { if(in_array($tag, $tags)) { return ""; @@ -256,6 +281,11 @@ class TagListTheme extends Themelet { } } + /** + * @param array $tags + * @param string $tag + * @return string + */ protected function get_subtract_link($tags, $tag) { if(in_array("-$tag", $tags)) { return ""; @@ -267,6 +297,10 @@ class TagListTheme extends Themelet { } } + /** + * @param string $tag + * @return string + */ protected function tag_link($tag) { $u_tag = url_escape($tag); return make_link("post/list/$u_tag/1");