More linting!

This commit is contained in:
jgen 2014-04-28 02:23:45 -04:00
parent 022c162f40
commit e37c5cb9d0
7 changed files with 42 additions and 22 deletions

View File

@ -58,6 +58,9 @@ class Image {
/** @var string */ /** @var string */
public $ext; public $ext;
/** @var string[]|null */
public $tag_array;
public $owner_id, $owner_ip; public $owner_id, $owner_ip;
public $posted, $posted_timestamp; public $posted, $posted_timestamp;
public $source; public $source;

View File

@ -9,8 +9,18 @@
* *
*/ */
class AuthorSetEvent extends Event { class AuthorSetEvent extends Event {
var $image, $user, $author; /** @var \Image */
public $image;
/** @var \User */
public $user;
/** @var string */
public $author;
/**
* @param Image $image
* @param User $user
* @param string $author
*/
public function __construct(Image $image, User $user, /*string*/ $author) public function __construct(Image $image, User $user, /*string*/ $author)
{ {
$this->image = $image; $this->image = $image;
@ -937,8 +947,11 @@ class Artists extends Extension {
return $result; return $result;
} }
/* /**
* HERE WE GET THE ID OF THE ARTIST * HERE WE GET THE ID OF THE ARTIST.
*
* @param string $name
* @return string|int
*/ */
private function get_artist_id($name){ private function get_artist_id($name){
global $database; global $database;
@ -1203,7 +1216,8 @@ class Artists extends Extension {
/* /*
* HERE WE GET THE INFO OF THE ALIAS * HERE WE GET THE INFO OF THE ALIAS
*/ */
private function get_alias($artistID){ private function get_alias($artistID)
{
if (!is_numeric($artistID)) return; if (!is_numeric($artistID)) return;
global $database; global $database;

View File

@ -12,8 +12,12 @@
* activated; new config options are in $_POST * activated; new config options are in $_POST
*/ */
class ConfigSaveEvent extends Event { class ConfigSaveEvent extends Event {
var $config; /** @var \Config */
public $config;
/**
* @param Config $config
*/
public function __construct(Config $config) { public function __construct(Config $config) {
$this->config = $config; $this->config = $config;
} }

View File

@ -42,7 +42,7 @@ class _SafeImage {
$this->posted = $img->posted_timestamp; $this->posted = $img->posted_timestamp;
$this->source = $img->source; $this->source = $img->source;
$this->owner_id = $img->owner_id; $this->owner_id = $img->owner_id;
$this->tags = $img->tag_array; $this->tags = $img->get_tag_array();
} }
} }

View File

@ -122,15 +122,15 @@ class TagEditCloud extends Extension {
$size = sprintf("%.2f", max($row['scaled'],0.5)); $size = sprintf("%.2f", max($row['scaled'],0.5));
$js = htmlspecialchars('tageditcloud_toggle_tag(this,'.json_encode($full_tag).')',ENT_QUOTES); //Ugly, but it works $js = htmlspecialchars('tageditcloud_toggle_tag(this,'.json_encode($full_tag).')',ENT_QUOTES); //Ugly, but it works
if(array_search($row['tag'],$image->tag_array) !== FALSE) { if(array_search($row['tag'],$image->get_tag_array()) !== FALSE) {
if($used_first) { if($used_first) {
$precloud .= "&nbsp;<span onclick='$js' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span>&nbsp;\n"; $precloud .= "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
continue; continue;
} else { } else {
$entry = "&nbsp;<span onclick='$js' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span>&nbsp;\n"; $entry = "&nbsp;<span onclick='{$js}' class='tag-selected' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
} }
} else { } else {
$entry = "&nbsp;<span onclick='$js' style='font-size: ${size}em$color' title='${row['count']}'>$h_tag</span>&nbsp;\n"; $entry = "&nbsp;<span onclick='{$js}' style='font-size: ${size}em$color' title='${row['count']}'>{$h_tag}</span>&nbsp;\n";
} }
if($counter++ <= $def_count) { if($counter++ <= $def_count) {
@ -141,21 +141,21 @@ class TagEditCloud extends Extension {
} }
if($precloud != '') { if($precloud != '') {
$html .= "<div id='tagcloud_set'>$precloud</div>"; $html .= "<div id='tagcloud_set'>{$precloud}</div>";
} }
if($postcloud != '') { if($postcloud != '') {
$postcloud = "<div id='tagcloud_extra' style='display: none;'>$postcloud</div>"; $postcloud = "<div id='tagcloud_extra' style='display: none;'>{$postcloud}</div>";
} }
$html .= "<div id='tagcloud_unset'>$cloud$postcloud</div>"; $html .= "<div id='tagcloud_unset'>{$cloud}{$postcloud}</div>";
if($sort_method != 'a' && $counter > $def_count) { if($sort_method != 'a' && $counter > $def_count) {
$rem = $counter - $def_count; $rem = $counter - $def_count;
$html .= "</div><br>[<span onclick='tageditcloud_toggle_extra(this);' style='color: #0000EF; font-weight:bold;'>show $rem more tags</span>]"; $html .= "</div><br>[<span onclick='tageditcloud_toggle_extra(this);' style='color: #0000EF; font-weight:bold;'>show {$rem} more tags</span>]";
} }
return "<div id='tageditcloud' class='tageditcloud'>$html</div>"; // FIXME: stupidasallhell return "<div id='tageditcloud' class='tageditcloud'>{$html}</div>"; // FIXME: stupidasallhell
} }
/** /**

View File

@ -347,7 +347,7 @@ class Tag_History extends Extension {
* This function is called just before an images tag are changed. * This function is called just before an images tag are changed.
* *
* @param Image $image * @param Image $image
* @param null|string|string[] $tags * @param string|string[] $tags
*/ */
private function add_tag_history(Image $image, $tags) { private function add_tag_history(Image $image, $tags) {
global $database, $config, $user; global $database, $config, $user;
@ -355,7 +355,7 @@ class Tag_History extends Extension {
$new_tags = Tag::implode($tags); $new_tags = Tag::implode($tags);
$old_tags = Tag::implode($image->get_tag_array()); $old_tags = Tag::implode($image->get_tag_array());
if($new_tags == $old_tags) return; if($new_tags == $old_tags) { return; }
if(empty($old_tags)) { if(empty($old_tags)) {
/* no old tags, so we are probably adding the image for the first time */ /* no old tags, so we are probably adding the image for the first time */
@ -366,7 +366,7 @@ class Tag_History extends Extension {
} }
$allowed = $config->get_int("history_limit"); $allowed = $config->get_int("history_limit");
if($allowed == 0) return; if($allowed == 0) { return; }
// if the image has no history, make one with the old tags // if the image has no history, make one with the old tags
$entries = $database->get_one("SELECT COUNT(*) FROM tag_histories WHERE image_id = ?", array($image->id)); $entries = $database->get_one("SELECT COUNT(*) FROM tag_histories WHERE image_id = ?", array($image->id));
@ -386,7 +386,7 @@ class Tag_History extends Extension {
$entries++; $entries++;
// if needed remove oldest one // if needed remove oldest one
if($allowed == -1) return; if($allowed == -1) { return; }
if($entries > $allowed) { if($entries > $allowed) {
// TODO: Make these queries better // TODO: Make these queries better
/* /*

View File

@ -376,7 +376,6 @@ class Upload extends Extension {
"No data found -- perhaps the site has hotlink protection?"); "No data found -- perhaps the site has hotlink protection?");
$ok = false; $ok = false;
}else{ }else{
global $user;
$pathinfo = pathinfo($url); $pathinfo = pathinfo($url);
$metadata = array(); $metadata = array();
$metadata['filename'] = $filename; $metadata['filename'] = $filename;