diff options
author | Bharat Mediratta <bharat@menalto.com> | 2009-01-14 04:12:02 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2009-01-14 04:12:02 +0000 |
commit | f3ba69c1d67c425ffa180d082a373e5cce0c86ce (patch) | |
tree | 5ecbbe0ba96a94e3f4aadd26042c8ad1a32ef1bc /modules | |
parent | 02af2d8b7639fdc18fba3d69a4ca0a3f5c92b948 (diff) |
Make sure that helper functions are all static. Add new
File_Structure_Test to make sure we don't regress.
According to the PHP docs, the "public" keyword is implied on static
functions, so remove it. Also, require private static functions to
start with an _.
http://php.net/manual/en/language.oop5.visibility.php
Diffstat (limited to 'modules')
39 files changed, 94 insertions, 94 deletions
diff --git a/modules/akismet/helpers/akismet.php b/modules/akismet/helpers/akismet.php index 47353caf..d717268b 100644 --- a/modules/akismet/helpers/akismet.php +++ b/modules/akismet/helpers/akismet.php @@ -20,7 +20,7 @@ class akismet_Core { public static $test_mode = TEST_MODE; - public static function get_configure_form() { + static function get_configure_form() { $form = new Forge("admin/akismet", "", "post"); $group = $form->group("configure_akismet")->label(t("Configure Akismet")); $group->input("api_key")->label(t("API Key"))->value(module::get_var("akismet", "api_key")); @@ -34,7 +34,7 @@ class akismet_Core { * @param Comment_Model $comment A comment to check * @return $string "spam", "ham" or "unknown" */ - public static function check_comment($comment) { + static function check_comment($comment) { if (akismet::$test_mode) { return; } @@ -55,7 +55,7 @@ class akismet_Core { * Tell Akismet that this comment is spam * @param Comment_Model $comment A comment to check */ - public static function submit_spam($comment) { + static function submit_spam($comment) { if (akismet::$test_mode) { return; } @@ -68,7 +68,7 @@ class akismet_Core { * Tell Akismet that this comment is ham * @param Comment_Model $comment A comment to check */ - public static function submit_ham($comment) { + static function submit_ham($comment) { if (akismet::$test_mode) { return; } @@ -82,14 +82,14 @@ class akismet_Core { * @param string $api_key the API key * @return boolean */ - public static function validate_key($api_key) { + static function validate_key($api_key) { $request = self::_build_verify_request($api_key); $response = self::_http_post($request, "rest.akismet.com"); return "valid" == $response->body[0]; } - public static function check_config() { + static function check_config() { $api_key = module::get_var("akismet", "api_key"); if (empty($api_key)) { site_status::warning( @@ -102,7 +102,7 @@ class akismet_Core { } - public static function _build_verify_request($api_key) { + static function _build_verify_request($api_key) { $base_url = url::base(false, "http"); $query_string = "key={$api_key}&blog=$base_url"; @@ -118,7 +118,7 @@ class akismet_Core { return $http_request; } - public static function _build_request($function, $comment) { + static function _build_request($function, $comment) { $comment_data = array(); $comment_data["HTTP_ACCEPT"] = $comment->server_http_accept; $comment_data["HTTP_ACCEPT_ENCODING"] = $comment->server_http_accept_encoding; diff --git a/modules/akismet/helpers/akismet_event.php b/modules/akismet/helpers/akismet_event.php index c18b217b..1f4d53d5 100644 --- a/modules/akismet/helpers/akismet_event.php +++ b/modules/akismet/helpers/akismet_event.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class akismet_event_Core { - public static function comment_created($comment) { + static function comment_created($comment) { switch(akismet::check_comment($comment)) { case "spam": $comment->state = "spam"; @@ -36,7 +36,7 @@ class akismet_event_Core { $comment->save(); } - public static function comment_changed($old, $new) { + static function comment_changed($old, $new) { if ($old->state != "spam" && $new->state == "spam") { akismet::submit_spam($new); } else if ($old->state == "spam" && $new->state != "spam") { diff --git a/modules/akismet/helpers/akismet_installer.php b/modules/akismet/helpers/akismet_installer.php index 1a653b42..8011e85a 100644 --- a/modules/akismet/helpers/akismet_installer.php +++ b/modules/akismet/helpers/akismet_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class akismet_installer { - public static function install() { + static function install() { $version = module::get_version("akismet"); if ($version == 0) { @@ -28,7 +28,7 @@ class akismet_installer { akismet::check_config(); } - public static function uninstall() { + static function uninstall() { module::delete("akismet"); } } diff --git a/modules/akismet/helpers/akismet_menu.php b/modules/akismet/helpers/akismet_menu.php index 00bea8ad..90697533 100644 --- a/modules/akismet/helpers/akismet_menu.php +++ b/modules/akismet/helpers/akismet_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class akismet_menu_Core { - public static function admin($menu, $theme) { + static function admin($menu, $theme) { $menu->get("settings_menu") ->append(Menu::factory("link") ->id("akismet") diff --git a/modules/atom/helpers/atom.php b/modules/atom/helpers/atom.php index b1bea5d3..e2f2d9ce 100644 --- a/modules/atom/helpers/atom.php +++ b/modules/atom/helpers/atom.php @@ -30,7 +30,7 @@ class atom_Core { * @param int Unix timestamp * @return string Internet timestamp */ - public static function unix_to_internet_timestamp($timestamp) { + static function unix_to_internet_timestamp($timestamp) { return sprintf("%sZ", date("Y-m-d\TH:i:s", $timestamp)); } } diff --git a/modules/comment/helpers/comment_block.php b/modules/comment/helpers/comment_block.php index f24f19b1..d8f08feb 100644 --- a/modules/comment/helpers/comment_block.php +++ b/modules/comment/helpers/comment_block.php @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class comment_block_Core { - public static function head($theme) { + static function head($theme) { $url = url::file("modules/comment/js/comment.js"); return "<script src=\"$url\" type=\"text/javascript\"></script>\n"; } - public static function photo_bottom($theme) { + static function photo_bottom($theme) { $block = new Block; $block->css_id = "gComments"; $block->title = t("Comments"); diff --git a/modules/comment/helpers/comment_dashboard.php b/modules/comment/helpers/comment_dashboard.php index 7edee2f5..984c4cea 100644 --- a/modules/comment/helpers/comment_dashboard.php +++ b/modules/comment/helpers/comment_dashboard.php @@ -18,11 +18,11 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class comment_dashboard_Core { - public static function get_list() { + static function get_list() { return array("recent_comments" => t("Recent Comments")); } - public static function get_block($block_id) { + static function get_block($block_id) { $block = new Block(); switch ($block_id) { case "recent_comments": diff --git a/modules/comment/helpers/comment_installer.php b/modules/comment/helpers/comment_installer.php index 34968cb0..aba32566 100644 --- a/modules/comment/helpers/comment_installer.php +++ b/modules/comment/helpers/comment_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class comment_installer { - public static function install() { + static function install() { $db = Database::instance(); $version = module::get_version("comment"); @@ -56,7 +56,7 @@ class comment_installer { } } - public static function uninstall() { + static function uninstall() { $db = Database::instance(); $db->query("DROP TABLE IF EXISTS `comments`;"); module::delete("comment"); diff --git a/modules/comment/helpers/comment_menu.php b/modules/comment/helpers/comment_menu.php index 9df3024a..2a2a578c 100644 --- a/modules/comment/helpers/comment_menu.php +++ b/modules/comment/helpers/comment_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class comment_menu_Core { - public static function admin($menu, $theme) { + static function admin($menu, $theme) { $menu->get("content_menu") ->append(Menu::factory("link") ->id("comments") @@ -26,7 +26,7 @@ class comment_menu_Core { ->url(url::site("admin/comments"))); } - public static function photo($menu, $theme) { + static function photo($menu, $theme) { $menu ->append(Menu::factory("link") ->id("comments") diff --git a/modules/gmaps/helpers/gmaps_block.php b/modules/gmaps/helpers/gmaps_block.php index 4024ec55..06894005 100644 --- a/modules/gmaps/helpers/gmaps_block.php +++ b/modules/gmaps/helpers/gmaps_block.php @@ -19,7 +19,7 @@ */ class gmaps_block_Core { - public static function sidebar_blocks($theme) { + static function sidebar_blocks($theme) { if ($theme->item()) { $block = new Block(); $block->css_id = "gMaps"; diff --git a/modules/gmaps/helpers/gmaps_installer.php b/modules/gmaps/helpers/gmaps_installer.php index fd3ddbe7..747f84f7 100644 --- a/modules/gmaps/helpers/gmaps_installer.php +++ b/modules/gmaps/helpers/gmaps_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class gmaps_installer { - public static function install() { + static function install() { $version = module::get_version("gmaps"); if ($version == 0) { module::set_version("gmaps", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("gmaps"); } } diff --git a/modules/info/helpers/info_block.php b/modules/info/helpers/info_block.php index 46e2bd72..3bc51c73 100644 --- a/modules/info/helpers/info_block.php +++ b/modules/info/helpers/info_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class info_block_Core { - public static function sidebar_blocks($theme) { + static function sidebar_blocks($theme) { if ($theme->item()) { $block = new Block(); $block->css_id = "gMetadata"; @@ -28,7 +28,7 @@ class info_block_Core { } } - public static function thumb_info($theme, $item) { + static function thumb_info($theme, $item) { $results = ""; if ($item->view_count) { $results .= "<li>"; diff --git a/modules/info/helpers/info_installer.php b/modules/info/helpers/info_installer.php index 747fc639..1c6cef95 100644 --- a/modules/info/helpers/info_installer.php +++ b/modules/info/helpers/info_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class info_installer { - public static function install() { + static function install() { $version = module::get_version("info"); if ($version == 0) { module::set_version("info", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("info"); } } diff --git a/modules/media_rss/helpers/media_rss.php b/modules/media_rss/helpers/media_rss.php index c834611a..9522727d 100644 --- a/modules/media_rss/helpers/media_rss.php +++ b/modules/media_rss/helpers/media_rss.php @@ -19,12 +19,12 @@ */ class media_rss_Core { - public static function item_feed($item) { + static function item_feed($item) { $id = $item->type == "album" ? $item->id : $item->parent_id; return url::site("media_rss/albums/$id"); } - public static function tag_feed($tag) { + static function tag_feed($tag) { return url::site("media_rss/tags/$tag->id}"); } }
\ No newline at end of file diff --git a/modules/media_rss/helpers/media_rss_block.php b/modules/media_rss/helpers/media_rss_block.php index 0a88ba70..80fb009e 100644 --- a/modules/media_rss/helpers/media_rss_block.php +++ b/modules/media_rss/helpers/media_rss_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class media_rss_block_Core { - public static function head($theme) { + static function head($theme) { if ($theme->item()) { $url = media_rss::item_feed($theme->item()); } else if ($theme->tag()) { diff --git a/modules/media_rss/helpers/media_rss_installer.php b/modules/media_rss/helpers/media_rss_installer.php index aafea9d6..170f2dfb 100644 --- a/modules/media_rss/helpers/media_rss_installer.php +++ b/modules/media_rss/helpers/media_rss_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class media_rss_installer { - public static function install() { + static function install() { $version = module::get_version("media_rss"); if ($version == 0) { module::set_version("media_rss", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("media_rss"); } } diff --git a/modules/polar_rose/helpers/polar_rose_block.php b/modules/polar_rose/helpers/polar_rose_block.php index 659181ac..85486917 100644 --- a/modules/polar_rose/helpers/polar_rose_block.php +++ b/modules/polar_rose/helpers/polar_rose_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class polar_rose_block_Core { - public static function head($theme) { + static function head($theme) { if (module::is_installed("media_rss")) { if ($theme->item()) { $url = media_rss::item_feed($theme->item()); @@ -44,7 +44,7 @@ class polar_rose_block_Core { } } - public static function page_bottom($theme) { + static function page_bottom($theme) { return "<div id=\"gPolarRose\"></div>"; } } diff --git a/modules/polar_rose/helpers/polar_rose_installer.php b/modules/polar_rose/helpers/polar_rose_installer.php index 8e565a61..d8e779f4 100644 --- a/modules/polar_rose/helpers/polar_rose_installer.php +++ b/modules/polar_rose/helpers/polar_rose_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class polar_rose_installer { - public static function install() { + static function install() { $db = Database::instance(); $version = module::get_version("polar_rose"); if ($version == 0) { @@ -26,7 +26,7 @@ class polar_rose_installer { } } - public static function uninstall() { + static function uninstall() { module::delete("polar_rose"); } } diff --git a/modules/rearrange/helpers/rearrange_block.php b/modules/rearrange/helpers/rearrange_block.php index 579c9362..999be91e 100644 --- a/modules/rearrange/helpers/rearrange_block.php +++ b/modules/rearrange/helpers/rearrange_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class rearrange_block_Core { - public static function head($theme) { + static function head($theme) { $head[] = html::script("modules/rearrange/js/jquery.gallery.rearrange.tree.js"); $url = url::file("modules/rearrange/css/rearrange.css"); diff --git a/modules/rearrange/helpers/rearrange_installer.php b/modules/rearrange/helpers/rearrange_installer.php index e2a82160..46672007 100644 --- a/modules/rearrange/helpers/rearrange_installer.php +++ b/modules/rearrange/helpers/rearrange_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class rearrange_installer { - public static function install() { + static function install() { $version = module::get_version("rearrange"); if ($version == 0) { module::set_version("rearrange", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("rearrange"); } } diff --git a/modules/search/helpers/search_block.php b/modules/search/helpers/search_block.php index 0294c920..e390b9fc 100644 --- a/modules/search/helpers/search_block.php +++ b/modules/search/helpers/search_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class search_block_Core { - public static function header_top($theme) { + static function header_top($theme) { $view = new View("search_link.html"); return $view->render(); } diff --git a/modules/search/helpers/search_installer.php b/modules/search/helpers/search_installer.php index 24efe35a..7dc4c39a 100644 --- a/modules/search/helpers/search_installer.php +++ b/modules/search/helpers/search_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class search_installer { - public static function install() { + static function install() { $version = module::get_version("search"); if ($version == 0) { module::set_version("search", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("search"); } } diff --git a/modules/slideshow/helpers/slideshow_block.php b/modules/slideshow/helpers/slideshow_block.php index bd1197ef..6a5a3f95 100644 --- a/modules/slideshow/helpers/slideshow_block.php +++ b/modules/slideshow/helpers/slideshow_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class slideshow_block_Core { - public static function head($theme) { + static function head($theme) { return "<script src=\"http://lite.piclens.com/current/piclens.js\" type=\"text/javascript\">" . "</script>"; } diff --git a/modules/slideshow/helpers/slideshow_installer.php b/modules/slideshow/helpers/slideshow_installer.php index e505d32f..c62369ab 100644 --- a/modules/slideshow/helpers/slideshow_installer.php +++ b/modules/slideshow/helpers/slideshow_installer.php @@ -18,14 +18,14 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class slideshow_installer { - public static function install() { + static function install() { $version = module::get_version("slideshow"); if ($version == 0) { module::set_version("slideshow", 1); } } - public static function uninstall() { + static function uninstall() { module::delete("slideshow"); } } diff --git a/modules/slideshow/helpers/slideshow_menu.php b/modules/slideshow/helpers/slideshow_menu.php index 8cc0d7fe..0892ce89 100644 --- a/modules/slideshow/helpers/slideshow_menu.php +++ b/modules/slideshow/helpers/slideshow_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class slideshow_menu_Core { - public static function album($menu, $theme) { + static function album($menu, $theme) { $menu ->append(Menu::factory("link") ->id("slideshow") @@ -27,7 +27,7 @@ class slideshow_menu_Core { ->css_id("gSlideshowLink")); } - public static function photo($menu, $theme) { + static function photo($menu, $theme) { $menu ->append(Menu::factory("link") ->id("slideshow") diff --git a/modules/tag/helpers/tag.php b/modules/tag/helpers/tag.php index b1160db2..98c904d0 100644 --- a/modules/tag/helpers/tag.php +++ b/modules/tag/helpers/tag.php @@ -28,7 +28,7 @@ class tag_Core { * @return Tag_Model * @throws Exception("@todo {$tag_name} WAS_NOT_ADDED_TO {$item->id}") */ - public static function add($item, $tag_name) { + static function add($item, $tag_name) { $tag = ORM::factory("tag")->where("name", $tag_name)->find(); if (!$tag->loaded) { $tag->name = $tag_name; @@ -51,7 +51,7 @@ class tag_Core { * * @return ORM_Iterator of Tag_Model in descending tag count order */ - public static function popular_tags($count) { + static function popular_tags($count) { return ORM::factory("tag") ->orderby("count", "DESC") ->limit($count) @@ -64,7 +64,7 @@ class tag_Core { * @param integer $count the number of tags * @return View */ - public static function cloud($count) { + static function cloud($count) { $tags = tag::popular_tags($count)->as_array(); if ($tags) { $cloud = new View("tag_cloud.html"); @@ -75,7 +75,7 @@ class tag_Core { } } - public static function get_add_form($item) { + static function get_add_form($item) { $form = new Forge("tags", "", "post", array("id" => "gAddTagForm")); $group = $form->group("add_tag")->label(t("Add Tag")); $group->input("name")->label(t("Add tag")); @@ -85,7 +85,7 @@ class tag_Core { return $form; } - public static function get_rename_form($tag) { + static function get_rename_form($tag) { $form = new Forge("admin/tags/rename/$tag->id", "", "post", array("id" => "gRenameTagForm")); $group = $form->group("rename_tag")->label(t("Rename Tag")); $group->input("name")->label(t("Tag name"))->value($tag->name); @@ -95,7 +95,7 @@ class tag_Core { return $form; } - public static function get_delete_form($tag) { + static function get_delete_form($tag) { $form = new Forge("admin/tags/delete/$tag->id", "", "post", array("id" => "gDeleteTagForm")); $group = $form->group("delete_tag")->label(t("Really delete tag {{tag_name}}?", array("tag_name" => $tag->name))); $group->submit("")->value(t("Delete Tag")); diff --git a/modules/tag/helpers/tag_block.php b/modules/tag/helpers/tag_block.php index 3d396599..8436dd08 100644 --- a/modules/tag/helpers/tag_block.php +++ b/modules/tag/helpers/tag_block.php @@ -18,12 +18,12 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class tag_block_Core { - public static function head($theme) { + static function head($theme) { $url = url::file("modules/tag/js/tag.js"); return "<script src=\"$url\" type=\"text/javascript\"></script>"; } - public static function sidebar_blocks($theme) { + static function sidebar_blocks($theme) { $block = new Block(); $block->css_id = "gTag"; $block->title = t("Popular Tags"); @@ -40,7 +40,7 @@ class tag_block_Core { return $block; } - public static function sort_by_name($tag1, $tag2) { + static function sort_by_name($tag1, $tag2) { return strcasecmp($tag1->name, $tag2->name); } }
\ No newline at end of file diff --git a/modules/tag/helpers/tag_event.php b/modules/tag/helpers/tag_event.php index dd91d9a4..8291cbb7 100644 --- a/modules/tag/helpers/tag_event.php +++ b/modules/tag/helpers/tag_event.php @@ -24,7 +24,7 @@ class tag_event_Core { * * @param Item_Model $photo */ - public static function photo_created($photo) { + static function photo_created($photo) { $path = $photo->file_path(); $tags = array(); $size = getimagesize($photo->file_path(), $info); diff --git a/modules/tag/helpers/tag_installer.php b/modules/tag/helpers/tag_installer.php index 2e0b9085..54ad52fe 100644 --- a/modules/tag/helpers/tag_installer.php +++ b/modules/tag/helpers/tag_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class tag_installer { - public static function install() { + static function install() { $db = Database::instance(); $version = module::get_version("tag"); if ($version == 0) { @@ -42,7 +42,7 @@ class tag_installer { } } - public static function uninstall() { + static function uninstall() { $db = Database::instance(); $db->query("DROP TABLE IF EXISTS `tags`;"); $db->query("DROP TABLE IF EXISTS `items_tags`;"); diff --git a/modules/tag/helpers/tag_menu.php b/modules/tag/helpers/tag_menu.php index 5fa53b34..2740465d 100644 --- a/modules/tag/helpers/tag_menu.php +++ b/modules/tag/helpers/tag_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class tag_menu_Core { - public static function admin($menu, $theme) { + static function admin($menu, $theme) { $menu->get("content_menu") ->append(Menu::factory("link") ->id("tags") diff --git a/modules/user/helpers/group.php b/modules/user/helpers/group.php index 4ec841dc..682ef5ef 100644 --- a/modules/user/helpers/group.php +++ b/modules/user/helpers/group.php @@ -61,7 +61,7 @@ class group_Core { return model_cache::get("group", 2); } - public static function get_edit_form_admin($group) { + static function get_edit_form_admin($group) { $form = new Forge("admin/groups/edit/$group->id"); $form_group = $form->group("edit_group")->label(t("Edit Group")); $form_group->input("name")->label(t("Name"))->id("gName")->value($group->name); @@ -72,7 +72,7 @@ class group_Core { return $form; } - public static function get_add_form_admin() { + static function get_add_form_admin() { $form = new Forge("admin/groups/add"); $form_group = $form->group("add_group")->label(t("Add Group")); $form_group->input("name")->label(t("Name"))->id("gName"); @@ -84,7 +84,7 @@ class group_Core { return $form; } - public static function get_delete_form_admin($group) { + static function get_delete_form_admin($group) { $form = new Forge("admin/groups/delete/$group->id", "", "post"); $form_group = $form->group("delete_group")->label( t("Are you sure you want to delete group {{group_name}}?", array("group_name" => $group->name))); diff --git a/modules/user/helpers/user.php b/modules/user/helpers/user.php index 36bcf2e5..c1e1abba 100644 --- a/modules/user/helpers/user.php +++ b/modules/user/helpers/user.php @@ -24,7 +24,7 @@ * Note: by design, this class does not do any permission checking. */ class user_Core { - public static function get_edit_form($user, $action = NULL) { + static function get_edit_form($user, $action = NULL) { $form = new Forge("users/$user->id?_method=put", "", "post", array("id" => "gUserForm")); $group = $form->group("edit_user")->label(t("Edit User")); $group->input("name")->label(t("Name"))->id("gName")->value($user->name); @@ -37,7 +37,7 @@ class user_Core { return $form; } - public static function get_edit_form_admin($user) { + static function get_edit_form_admin($user) { $form = new Forge("admin/users/edit/$user->id"); $group = $form->group("edit_user")->label(t("Edit User")); $group->input("name")->label(t("Name"))->id("gName")->value($user->name); @@ -52,7 +52,7 @@ class user_Core { return $form; } - public static function get_add_form_admin() { + static function get_add_form_admin() { $form = new Forge("admin/users/add"); $group = $form->group("add_user")->label(t("Add User")); $group->input("name")->label(t("Name"))->id("gName"); @@ -68,7 +68,7 @@ class user_Core { return $form; } - public static function get_delete_form_admin($user) { + static function get_delete_form_admin($user) { $form = new Forge("admin/users/delete/$user->id", "", "post"); $group = $form->group("delete_user")->label( t("Are you sure you want to delete user {{name}}?", array("name" => $user->name))); @@ -79,7 +79,7 @@ class user_Core { /** * Make sure that we have a session and group_ids cached in the session. */ - public static function load_user() { + static function load_user() { // This is one of the first session operations that we'll do, so it may fail if there's no // install yet. Try to handle this situation gracefully expecting that the scaffolding will // Do The Right Thing. @@ -109,7 +109,7 @@ class user_Core { * * @return array */ - public static function group_ids() { + static function group_ids() { return Session::instance()->get("group_ids", array(1)); } @@ -118,7 +118,7 @@ class user_Core { * * @return User_Model */ - public static function active() { + static function active() { return Session::instance()->get("user", self::guest()); } @@ -129,7 +129,7 @@ class user_Core { * * @return User_Model */ - public static function guest() { + static function guest() { return model_cache::get("user", 1); } @@ -138,7 +138,7 @@ class user_Core { * * @return User_Model */ - public static function set_active($user) { + static function set_active($user) { $session = Session::instance(); $session->set("user", $user); $session->delete("group_ids"); @@ -153,7 +153,7 @@ class user_Core { * @param string $password * @return User_Model */ - public static function create($name, $full_name, $password) { + static function create($name, $full_name, $password) { $user = ORM::factory("user")->where("name", $name)->find(); if ($user->loaded) { throw new Exception("@todo USER_ALREADY_EXISTS $name"); @@ -179,7 +179,7 @@ class user_Core { * @param string $password a plaintext password * @return boolean true if the password is correct */ - public static function is_correct_password($user, $password) { + static function is_correct_password($user, $password) { $valid = $user->password; $salt = substr($valid, 0, 4); @@ -211,7 +211,7 @@ class user_Core { * @param string $password a plaintext password * @return string hashed password */ - public static function hash_password($password) { + static function hash_password($password) { return user::_md5Salt($password); } @@ -219,7 +219,7 @@ class user_Core { * Log in as a given user. * @param object $user the user object. */ - public static function login($user) { + static function login($user) { $user->login_count += 1; $user->last_login = time(); $user->save(); @@ -232,7 +232,7 @@ class user_Core { * Log out the active user and destroy the session. * @param object $user the user object. */ - public static function logout() { + static function logout() { $user = user::active(); if (!$user->guest) { try { @@ -249,7 +249,7 @@ class user_Core { * @param integer $id the user id * @return User_Model the user object, or null if the id was invalid. */ - public static function lookup($id) { + static function lookup($id) { $user = model_cache::get("user", $id); if ($user->loaded) { return $user; diff --git a/modules/user/helpers/user_block.php b/modules/user/helpers/user_block.php index 5e406fef..bb9e567f 100644 --- a/modules/user/helpers/user_block.php +++ b/modules/user/helpers/user_block.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class user_block_Core { - public static function head($theme) { + static function head($theme) { // @todo: move this into the theme $user = user::active(); if (!user::active()->guest) { @@ -27,7 +27,7 @@ class user_block_Core { } } - public static function header_top($theme) { + static function header_top($theme) { $view = new View("login.html"); $view->user = user::active(); return $view->render(); diff --git a/modules/user/helpers/user_event.php b/modules/user/helpers/user_event.php index 2d1ce171..21848e2e 100644 --- a/modules/user/helpers/user_event.php +++ b/modules/user/helpers/user_event.php @@ -21,7 +21,7 @@ class user_event_Core { /** * Initialization. */ - public static function gallery_ready() { + static function gallery_ready() { user::load_user(); } } diff --git a/modules/user/helpers/user_installer.php b/modules/user/helpers/user_installer.php index 1cbb2502..a9b605dc 100644 --- a/modules/user/helpers/user_installer.php +++ b/modules/user/helpers/user_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class user_installer { - public static function install() { + static function install() { $db = Database::instance(); $version = module::get_version("user"); @@ -87,7 +87,7 @@ class user_installer { } } - public static function uninstall() { + static function uninstall() { // Delete all users and groups so that we give other modules an opportunity to clean up foreach (ORM::factory("user")->find_all() as $user) { $user->delete(); diff --git a/modules/user/helpers/user_menu.php b/modules/user/helpers/user_menu.php index bdbe411b..5f845804 100644 --- a/modules/user/helpers/user_menu.php +++ b/modules/user/helpers/user_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class user_menu_Core { - public static function admin($menu, $theme) { + static function admin($menu, $theme) { $menu->get("users_groups_menu") ->append(Menu::factory("link") ->id("list_users") diff --git a/modules/watermark/helpers/watermark.php b/modules/watermark/helpers/watermark.php index 1e9b8990..2a32147d 100644 --- a/modules/watermark/helpers/watermark.php +++ b/modules/watermark/helpers/watermark.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class watermark_Core { - public static function get_add_form() { + static function get_add_form() { for ($i = 1; $i <= 100; $i++) { $range[$i] = $i; } @@ -36,7 +36,7 @@ class watermark_Core { return $form; } - public static function get_edit_form() { + static function get_edit_form() { for ($i = 1; $i <= 100; $i++) { $range[$i] = $i; } @@ -53,14 +53,14 @@ class watermark_Core { return $form; } - public static function get_delete_form() { + static function get_delete_form() { $form = new Forge("admin/watermarks/delete", "", "post"); $group = $form->group("delete_watermark")->label(t("Really delete Watermark?")); $group->submit("")->value(t("Delete")); return $form; } - public static function positions() { + static function positions() { return array("northwest" => t("Northwest"), "north" => t("North"), "northeast" => t("Northeast"), @@ -72,7 +72,7 @@ class watermark_Core { "southeast" => t("Southeast")); } - public static function position($key) { + static function position($key) { $positions = self::positions(); return $positions[$key]; } diff --git a/modules/watermark/helpers/watermark_installer.php b/modules/watermark/helpers/watermark_installer.php index 16ca8a9a..3fa4192e 100644 --- a/modules/watermark/helpers/watermark_installer.php +++ b/modules/watermark/helpers/watermark_installer.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class watermark_installer { - public static function install() { + static function install() { $db = Database::instance(); $version = module::get_version("watermark"); if ($version == 0) { @@ -39,7 +39,7 @@ class watermark_installer { } } - public static function uninstall() { + static function uninstall() { graphics::remove_rules("watermark"); module::delete("watermark"); Database::instance()->query("DROP TABLE `watermarks`"); diff --git a/modules/watermark/helpers/watermark_menu.php b/modules/watermark/helpers/watermark_menu.php index f8a6d3b1..852ce000 100644 --- a/modules/watermark/helpers/watermark_menu.php +++ b/modules/watermark/helpers/watermark_menu.php @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class watermark_menu_Core { - public static function admin($menu, $theme) { + static function admin($menu, $theme) { $menu->get("content_menu") ->append( Menu::factory("link") |