diff --git a/ext/featured/theme.php b/ext/featured/theme.php
index 35a64a36..9fc6a74f 100644
--- a/ext/featured/theme.php
+++ b/ext/featured/theme.php
@@ -1,26 +1,37 @@
add_block(new Block("Featured Image", $this->build_featured_html($image), "left", 3));
}
+ /**
+ * @param int $image_id
+ * @return string
+ */
public function get_buttons_html(/*int*/ $image_id) {
global $user;
return "
".make_form(make_link("featured_image/set"))."
".$user->get_auth_html()."
-
+
";
}
-
+
+ /**
+ * @param Image $image
+ * @param null|string $query
+ * @return string
+ */
public function build_featured_html(Image $image, $query=null) {
- global $config;
$i_id = int_escape($image->id);
$h_view_link = make_link("post/view/$i_id", $query);
$h_thumb_link = $image->get_thumb_link();
@@ -29,7 +40,7 @@ class FeaturedTheme extends Themelet {
return "
-
+
";
}
diff --git a/ext/rss_images/main.php b/ext/rss_images/main.php
index cef02075..4fb500af 100644
--- a/ext/rss_images/main.php
+++ b/ext/rss_images/main.php
@@ -33,6 +33,11 @@ class RSS_Images extends Extension {
}
}
+ /**
+ * @param array $images
+ * @param array $search_terms
+ * @param int $page_number
+ */
private function do_rss($images, $search_terms, /*int*/ $page_number) {
global $page;
global $config;
@@ -78,6 +83,10 @@ class RSS_Images extends Extension {
$page->set_data($xml);
}
+ /**
+ * @param Image $image
+ * @return string
+ */
private function thumb(Image $image) {
global $database;
diff --git a/ext/setup/main.php b/ext/setup/main.php
index f34e0d4d..70b94e96 100644
--- a/ext/setup/main.php
+++ b/ext/setup/main.php
@@ -24,8 +24,12 @@ class ConfigSaveEvent extends Event {
* Sent when the setup page is ready to be added to
*/
class SetupBuildingEvent extends Event {
- var $panel;
+ /** @var \SetupPanel */
+ public $panel;
+ /**
+ * @param SetupPanel $panel
+ */
public function __construct(SetupPanel $panel) {
$this->panel = $panel;
}
@@ -35,8 +39,12 @@ class SetupBuildingEvent extends Event {
*
*/
class SetupPanel {
- var $blocks = array();
+ /** @var \SetupBlock[] */
+ public $blocks = array();
+ /**
+ * @param SetupBlock $block
+ */
public function add_block(SetupBlock $block) {
$this->blocks[] = $block;
}
@@ -46,9 +54,14 @@ class SetupPanel {
*
*/
class SetupBlock extends Block {
- var $header;
- var $body;
+ /** @var string */
+ public $header;
+ /** @var string */
+ public $body;
+ /**
+ * @param string $title
+ */
public function __construct($title) {
$this->header = $title;
$this->section = "main";
@@ -56,20 +69,31 @@ class SetupBlock extends Block {
$this->body = "";
}
+ /**
+ * @param string $text
+ */
public function add_label($text) {
$this->body .= $text;
}
+ /**
+ * @param string $name
+ * @param null|string $label
+ */
public function add_text_option($name, $label=null) {
global $config;
$val = html_escape($config->get_string($name));
if(!is_null($label)) {
- $this->body .= "";
+ $this->body .= "";
}
- $this->body .= "\n";
- $this->body .= "\n";
+ $this->body .= "\n";
+ $this->body .= "\n";
}
+ /**
+ * @param string $name
+ * @param null|string $label
+ */
public function add_longtext_option($name, $label=null) {
global $config;
$val = html_escape($config->get_string($name));
@@ -81,6 +105,10 @@ class SetupBlock extends Block {
$this->body .= "\n";
}
+ /**
+ * @param string $name
+ * @param null|string $label
+ */
public function add_bool_option($name, $label=null) {
global $config;
$checked = $config->get_bool($name) ? " checked" : "";
@@ -97,6 +125,10 @@ class SetupBlock extends Block {
// $this->body .= "";
// }
+ /**
+ * @param string $name
+ * @param null|string $label
+ */
public function add_int_option($name, $label=null) {
global $config;
$val = html_escape($config->get_string($name));
@@ -107,6 +139,10 @@ class SetupBlock extends Block {
$this->body .= "\n";
}
+ /**
+ * @param string $name
+ * @param null|string $label
+ */
public function add_shorthand_int_option($name, $label=null) {
global $config;
$val = to_shorthand_int($config->get_string($name));
diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php
index 8161af83..d080d354 100644
--- a/ext/tag_edit/main.php
+++ b/ext/tag_edit/main.php
@@ -40,9 +40,15 @@
*
*/
class OwnerSetEvent extends Event {
- var $image;
- var $owner;
+ /** @var \Image */
+ public $image;
+ /** @var \User */
+ public $owner;
+ /**
+ * @param Image $image
+ * @param User $owner
+ */
public function __construct(Image $image, User $owner) {
$this->image = $image;
$this->owner = $owner;
@@ -150,7 +156,7 @@ class TagEdit extends Extension {
}
public function onImageInfoSet(ImageInfoSetEvent $event) {
- global $user, $page;
+ global $user;
if($user->can("edit_image_owner")) {
$owner = User::by_name($_POST['tag_edit__owner']);
send_event(new OwnerSetEvent($event->image, $owner));
@@ -211,7 +217,6 @@ class TagEdit extends Extension {
}
public function onImageInfoBoxBuilding(ImageInfoBoxBuildingEvent $event) {
- global $user;
$event->add_part($this->theme->get_user_editor_html($event->image), 39);
$event->add_part($this->theme->get_tag_editor_html($event->image), 40);
$event->add_part($this->theme->get_source_editor_html($event->image), 41);
@@ -230,18 +235,17 @@ class TagEdit extends Extension {
}
private function can_tag(Image $image) {
- global $config, $user;
+ global $user;
return ($user->can("edit_image_tag") || !$image->is_locked());
}
private function can_source(Image $image) {
- global $config, $user;
+ global $user;
return ($user->can("edit_image_source") || !$image->is_locked());
}
private function mass_tag_edit($search, $replace) {
global $database;
- global $config;
$search_set = Tag::explode(strtolower($search), false);
$replace_set = Tag::explode(strtolower($replace), false);
@@ -297,9 +301,6 @@ class TagEdit extends Extension {
}
private function mass_source_edit($tags, $source) {
- global $database;
- global $config;
-
$tags = Tag::explode($tags);
$last_id = -1;
diff --git a/ext/tag_editcloud/main.php b/ext/tag_editcloud/main.php
index d1cd2bd2..31ef1248 100644
--- a/ext/tag_editcloud/main.php
+++ b/ext/tag_editcloud/main.php
@@ -51,7 +51,11 @@ class TagEditCloud extends Extension {
$event->panel->add_block($sb);
}
- private function build_tag_map($image) {
+ /**
+ * @param Image $image
+ * @return string
+ */
+ private function build_tag_map(Image $image) {
global $database, $config;
$html = "";
@@ -75,23 +79,26 @@ class TagEditCloud extends Extension {
}
}
+ $tag_data = null;
+
switch($sort_method){
- case 'a':
- case 'p':
- $tag_data = $database->get_all("SELECT tag, FLOOR(LN(LN(count - :tag_min1 + 1)+1)*150)/200 AS scaled, count
- FROM tags WHERE count >= :tag_min2 ORDER BY ".($sort_method == 'a' ? "tag" : "count DESC")." LIMIT :limit",
- array("tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count));
- break;
- case 'r':
- $relevant_tags = array_diff($image->get_tag_array(),$ignore_tags);
- if(count($relevant_tags) > 0) {
- $relevant_tags = implode(",",array_map(array($database,"escape"),$relevant_tags));
- $tag_data = $database->get_all("SELECT t2.tag AS tag, COUNT(image_id) AS count, FLOOR(LN(LN(COUNT(image_id) - :tag_min1 + 1)+1)*150)/200 AS scaled
- FROM image_tags it1 JOIN image_tags it2 USING(image_id) JOIN tags t1 ON it1.tag_id = t1.id JOIN tags t2 ON it2.tag_id = t2.id
- WHERE t1.count >= :tag_min2 AND t1.tag IN($relevant_tags) GROUP BY t2.tag ORDER BY count DESC LIMIT :limit",
+ case 'a':
+ case 'p':
+ default:
+ $tag_data = $database->get_all("SELECT tag, FLOOR(LN(LN(count - :tag_min1 + 1)+1)*150)/200 AS scaled, count
+ FROM tags WHERE count >= :tag_min2 ORDER BY ".($sort_method == 'a' ? "tag" : "count DESC")." LIMIT :limit",
array("tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count));
- }
- break;
+ break;
+ case 'r':
+ $relevant_tags = array_diff($image->get_tag_array(),$ignore_tags);
+ if(count($relevant_tags) > 0) {
+ $relevant_tags = implode(",",array_map(array($database,"escape"),$relevant_tags));
+ $tag_data = $database->get_all("SELECT t2.tag AS tag, COUNT(image_id) AS count, FLOOR(LN(LN(COUNT(image_id) - :tag_min1 + 1)+1)*150)/200 AS scaled
+ FROM image_tags it1 JOIN image_tags it2 USING(image_id) JOIN tags t1 ON it1.tag_id = t1.id JOIN tags t2 ON it2.tag_id = t2.id
+ WHERE t1.count >= :tag_min2 AND t1.tag IN($relevant_tags) GROUP BY t2.tag ORDER BY count DESC LIMIT :limit",
+ array("tag_min1" => $tags_min, "tag_min2" => $tags_min, "limit" => $max_count));
+ }
+ break;
}
$counter = 1;
@@ -151,7 +158,11 @@ class TagEditCloud extends Extension {
return "
'. $title .'
'. $body .'