From 7b68d8ebfda08fc7e8abed213cdd9af4c7b0ae4f Mon Sep 17 00:00:00 2001 From: Shish Date: Sat, 22 Mar 2014 09:00:59 +0000 Subject: [PATCH] use new-style constructors everywhere --- core/config.class.php | 2 +- core/database.class.php | 8 ++++---- core/imageboard.pack.php | 2 +- core/user.class.php | 2 +- ext/admin/main.php | 2 +- ext/alias_editor/main.php | 2 +- ext/artists/main.php | 2 +- ext/ext_manager/main.php | 2 +- ext/favorites/main.php | 2 +- ext/handle_svg/main.php | 2 +- ext/image/main.php | 10 +++++----- ext/image_hash_ban/main.php | 4 ++-- ext/index/main.php | 2 +- ext/ipban/main.php | 4 ++-- ext/numeric_score/main.php | 2 +- ext/rating/main.php | 2 +- ext/report_image/main.php | 4 ++-- ext/simpletest/main.php | 2 +- ext/simpletest/theme.php | 2 +- ext/tag_edit/main.php | 10 +++++----- ext/upload/main.php | 2 +- ext/view/main.php | 6 +++--- 22 files changed, 38 insertions(+), 38 deletions(-) diff --git a/core/config.class.php b/core/config.class.php index 538dd496..96e6e156 100644 --- a/core/config.class.php +++ b/core/config.class.php @@ -181,7 +181,7 @@ class DatabaseConfig extends BaseConfig { /* * Load the config table from a database */ - public function DatabaseConfig(Database $database) { + public function __construct(Database $database) { $this->database = $database; $cached = $this->database->cache->get("config"); diff --git a/core/database.class.php b/core/database.class.php index bd3032a9..2ee4db23 100644 --- a/core/database.class.php +++ b/core/database.class.php @@ -5,7 +5,7 @@ class Querylet { var $sql; var $variables; - public function Querylet($sql, $variables=array()) { + public function __construct($sql, $variables=array()) { $this->sql = $sql; $this->variables = $variables; } @@ -28,7 +28,7 @@ class TagQuerylet { var $tag; var $positive; - public function TagQuerylet($tag, $positive) { + public function __construct($tag, $positive) { $this->tag = $tag; $this->positive = $positive; } @@ -37,7 +37,7 @@ class ImgQuerylet { var $qlet; var $positive; - public function ImgQuerylet($qlet, $positive) { + public function __construct($qlet, $positive) { $this->qlet = $qlet; $this->positive = $positive; } @@ -290,7 +290,7 @@ class Database { * need it. There are some pages where all the data is in cache, so the * DB connection is on-demand. */ - public function Database() { + public function __construct() { $this->connect_cache(); } diff --git a/core/imageboard.pack.php b/core/imageboard.pack.php index 36e1d678..26582333 100644 --- a/core/imageboard.pack.php +++ b/core/imageboard.pack.php @@ -49,7 +49,7 @@ class Image { * One will very rarely construct an image directly, more common * would be to use Image::by_id, Image::by_hash, etc */ - public function Image($row=null) { + public function __construct($row=null) { if(!is_null($row)) { foreach($row as $name => $value) { // some databases use table.name rather than name diff --git a/core/user.class.php b/core/user.class.php index cb99bf79..50034926 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -30,7 +30,7 @@ class User { * One will very rarely construct a user directly, more common * would be to use User::by_id, User::by_session, etc */ - public function User($row) { + public function __construct($row) { global $_user_classes; $this->id = int_escape($row['id']); diff --git a/ext/admin/main.php b/ext/admin/main.php index c987c6bf..68273195 100644 --- a/ext/admin/main.php +++ b/ext/admin/main.php @@ -25,7 +25,7 @@ */ class AdminBuildingEvent extends Event { var $page; - public function AdminBuildingEvent(Page $page) { + public function __construct(Page $page) { $this->page = $page; } } diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index fb52ce2e..54015ab9 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -14,7 +14,7 @@ class AddAliasEvent extends Event { var $oldtag; var $newtag; - public function AddAliasEvent($oldtag, $newtag) { + public function __construct($oldtag, $newtag) { $this->oldtag = trim($oldtag); $this->newtag = trim($newtag); } diff --git a/ext/artists/main.php b/ext/artists/main.php index 48a0d3ca..38c614f9 100644 --- a/ext/artists/main.php +++ b/ext/artists/main.php @@ -11,7 +11,7 @@ class AuthorSetEvent extends Event { var $image, $user, $author; - public function AuthorSetEvent(Image $image, User $user, /*string*/ $author) + public function __construct(Image $image, User $user, /*string*/ $author) { $this->image = $image; $this->user = $user; diff --git a/ext/ext_manager/main.php b/ext/ext_manager/main.php index 4d4dd645..d79cfbed 100644 --- a/ext/ext_manager/main.php +++ b/ext/ext_manager/main.php @@ -22,7 +22,7 @@ class ExtensionInfo { var $ext_name, $name, $link, $author, $email; var $description, $documentation, $version, $visibility; - function ExtensionInfo($main) { + function __construct($main) { $matches = array(); $lines = file($main); $number_of_lines = count($lines); diff --git a/ext/favorites/main.php b/ext/favorites/main.php index 35730893..fb8ba57a 100644 --- a/ext/favorites/main.php +++ b/ext/favorites/main.php @@ -16,7 +16,7 @@ class FavoriteSetEvent extends Event { var $image_id, $user, $do_set; - public function FavoriteSetEvent(/*int*/ $image_id, User $user, /*boolean*/ $do_set) { + public function __construct(/*int*/ $image_id, User $user, /*boolean*/ $do_set) { assert(is_numeric($image_id)); assert(is_bool($do_set)); diff --git a/ext/handle_svg/main.php b/ext/handle_svg/main.php index 25f47015..a0bc04e7 100644 --- a/ext/handle_svg/main.php +++ b/ext/handle_svg/main.php @@ -88,7 +88,7 @@ class SVGFileHandler extends Extension { class MiniSVGParser { var $valid=false, $width=0, $height=0; - function MiniSVGParser($file) { + function __construct($file) { $xml_parser = xml_parser_create(); xml_set_element_handler($xml_parser, array($this, "startElement"), array($this, "endElement")); $this->valid = xml_parse($xml_parser, file_get_contents($file), true); diff --git a/ext/image/main.php b/ext/image/main.php index 4addd849..59369dd9 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -22,7 +22,7 @@ class ImageAdditionEvent extends Event { * @sa TagSetEvent * @param $image The new image to add. */ - public function ImageAdditionEvent(Image $image) { + public function __construct(Image $image) { $this->image = $image; } } @@ -48,7 +48,7 @@ class ImageDeletionEvent extends Event { * * @param $image The image being deleted */ - public function ImageDeletionEvent(Image $image) { + public function __construct(Image $image) { $this->image = $image; } } @@ -70,7 +70,7 @@ class ImageReplaceEvent extends Event { * @param $image * The image object of the new image to use */ - public function ImageReplaceEvent(/*int*/ $id, Image $image) { + public function __construct(/*int*/ $id, Image $image) { $this->id = $id; $this->image = $image; } @@ -96,7 +96,7 @@ class ThumbnailGenerationEvent extends Event { * @param $hash The unique hash of the image * @param $type The type of the image */ - public function ThumbnailGenerationEvent($hash, $type, $force=false) { + public function __construct($hash, $type, $force=false) { $this->hash = $hash; $this->type = $type; $this->force = $force; @@ -113,7 +113,7 @@ class ThumbnailGenerationEvent extends Event { class ParseLinkTemplateEvent extends Event { var $link, $original, $image; - public function ParseLinkTemplateEvent($link, Image $image) { + public function __construct($link, Image $image) { $this->link = $link; $this->original = $link; $this->image = $image; diff --git a/ext/image_hash_ban/main.php b/ext/image_hash_ban/main.php index 9ca7eaaf..410f0b41 100644 --- a/ext/image_hash_ban/main.php +++ b/ext/image_hash_ban/main.php @@ -13,7 +13,7 @@ class RemoveImageHashBanEvent extends Event { var $hash; - public function RemoveImageHashBanEvent($hash) { + public function __construct($hash) { $this->hash = $hash; } } @@ -23,7 +23,7 @@ class AddImageHashBanEvent extends Event { var $hash; var $reason; - public function AddImageHashBanEvent($hash, $reason) { + public function __construct($hash, $reason) { $this->hash = $hash; $this->reason = $reason; } diff --git a/ext/index/main.php b/ext/index/main.php index 1ca555a7..e2664883 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -163,7 +163,7 @@ class SearchTermParseEvent extends Event { var $context = null; var $querylets = array(); - public function SearchTermParseEvent($term, $context) { + public function __construct($term, $context) { $this->term = $term; $this->context = $context; } diff --git a/ext/ipban/main.php b/ext/ipban/main.php index cbd122a0..c566f47a 100644 --- a/ext/ipban/main.php +++ b/ext/ipban/main.php @@ -16,7 +16,7 @@ class RemoveIPBanEvent extends Event { var $id; - public function RemoveIPBanEvent($id) { + public function __construct($id) { $this->id = $id; } } @@ -27,7 +27,7 @@ class AddIPBanEvent extends Event { var $reason; var $end; - public function AddIPBanEvent(/*string(ip)*/ $ip, /*string*/ $reason, /*string*/ $end) { + public function __construct(/*string(ip)*/ $ip, /*string*/ $reason, /*string*/ $end) { $this->ip = trim($ip); $this->reason = trim($reason); $this->end = trim($end); diff --git a/ext/numeric_score/main.php b/ext/numeric_score/main.php index 1471fb70..e9a471f5 100644 --- a/ext/numeric_score/main.php +++ b/ext/numeric_score/main.php @@ -13,7 +13,7 @@ class NumericScoreSetEvent extends Event { var $image_id, $user, $score; - public function NumericScoreSetEvent(/*int*/ $image_id, User $user, /*int*/ $score) { + public function __construct(/*int*/ $image_id, User $user, /*int*/ $score) { $this->image_id = $image_id; $this->user = $user; $this->score = $score; diff --git a/ext/rating/main.php b/ext/rating/main.php index 1b41b89f..eda01145 100644 --- a/ext/rating/main.php +++ b/ext/rating/main.php @@ -22,7 +22,7 @@ class RatingSetEvent extends Event { var $image, $rating; - public function RatingSetEvent(Image $image, /*char*/ $rating) { + public function __construct(Image $image, /*char*/ $rating) { assert(in_array($rating, array("s", "q", "e", "u"))); $this->image = $image; $this->rating = $rating; diff --git a/ext/report_image/main.php b/ext/report_image/main.php index 16980169..a21a0581 100644 --- a/ext/report_image/main.php +++ b/ext/report_image/main.php @@ -12,7 +12,7 @@ class RemoveReportedImageEvent extends Event { var $id; - public function RemoveReportedImageEvent($id) { + public function __construct($id) { $this->id = $id; } } @@ -22,7 +22,7 @@ class AddReportedImageEvent extends Event { var $image_id; var $reason; - public function AddReportedImageEvent($image_id, $reporter_id, $reason) { + public function __construct($image_id, $reporter_id, $reason) { $this->reporter_id = $reporter_id; $this->image_id = $image_id; $this->reason = $reason; diff --git a/ext/simpletest/main.php b/ext/simpletest/main.php index 116a7ff7..523204cb 100644 --- a/ext/simpletest/main.php +++ b/ext/simpletest/main.php @@ -207,7 +207,7 @@ class ShimmieWebTestCase extends SCoreWebTestCase { /** @private */ class TestFinder extends TestSuite { - function TestFinder($hint) { + function __construct($hint) { if(strpos($hint, "..") !== FALSE) return; // Select the test cases for "All" extensions. diff --git a/ext/simpletest/theme.php b/ext/simpletest/theme.php index de1573ea..4ed982d9 100644 --- a/ext/simpletest/theme.php +++ b/ext/simpletest/theme.php @@ -10,7 +10,7 @@ class SCoreWebReporter extends HtmlReporter { var $fails; var $exceptions; - public function SCoreReporter(Page $page) { + public function __construct(Page $page) { $this->page = $page; $this->fails = 0; $this->exceptions = 0; diff --git a/ext/tag_edit/main.php b/ext/tag_edit/main.php index 30867f84..cc807d2e 100644 --- a/ext/tag_edit/main.php +++ b/ext/tag_edit/main.php @@ -43,7 +43,7 @@ class OwnerSetEvent extends Event { var $image; var $owner; - public function OwnerSetEvent(Image $image, User $owner) { + public function __construct(Image $image, User $owner) { $this->image = $image; $this->owner = $owner; } @@ -60,7 +60,7 @@ class SourceSetEvent extends Event { var $image; var $source; - public function SourceSetEvent(Image $image, $source) { + public function __construct(Image $image, $source) { $this->image = $image; $this->source = $source; } @@ -77,7 +77,7 @@ class TagSetEvent extends Event { var $image; var $tags; - public function TagSetEvent(Image $image, $tags) { + public function __construct(Image $image, $tags) { $this->image = $image; $this->tags = Tag::explode($tags); } @@ -93,7 +93,7 @@ class LockSetEvent extends Event { var $image; var $locked; - public function LockSetEvent(Image $image, $locked) { + public function __construct(Image $image, $locked) { assert(is_bool($locked)); $this->image = $image; $this->locked = $locked; @@ -109,7 +109,7 @@ class TagTermParseEvent extends Event { var $id = null; var $metatag = false; - public function TagTermParseEvent($term, $id) { + public function __construct($term, $id) { $this->term = $term; $this->id = $id; } diff --git a/ext/upload/main.php b/ext/upload/main.php index b92fc479..4c3d19b4 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -19,7 +19,7 @@ class DataUploadEvent extends Event { * @param $tmpname The temporary file used for upload. * @param $metadata Info about the file, should contain at least "filename", "extension", "tags" and "source". */ - public function DataUploadEvent(/*string*/ $tmpname, /*array*/ $metadata) { + public function __construct(/*string*/ $tmpname, /*array*/ $metadata) { assert(file_exists($tmpname)); $this->tmpname = $tmpname; diff --git a/ext/view/main.php b/ext/view/main.php index 7d23826c..c97e0592 100644 --- a/ext/view/main.php +++ b/ext/view/main.php @@ -31,7 +31,7 @@ class ImageInfoBoxBuildingEvent extends Event { var $image; var $user; - public function ImageInfoBoxBuildingEvent(Image $image, User $user) { + public function __construct(Image $image, User $user) { $this->image = $image; $this->user = $user; } @@ -45,7 +45,7 @@ class ImageInfoBoxBuildingEvent extends Event { class ImageInfoSetEvent extends Event { var $image; - public function ImageInfoSetEvent(Image $image) { + public function __construct(Image $image) { $this->image = $image; } } @@ -55,7 +55,7 @@ class ImageAdminBlockBuildingEvent extends Event { var $image = null; var $user = null; - public function ImageAdminBlockBuildingEvent(Image $image, User $user) { + public function __construct(Image $image, User $user) { $this->image = $image; $this->user = $user; }