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/tag/helpers | |
| 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/tag/helpers')
| -rw-r--r-- | modules/tag/helpers/tag.php | 12 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_block.php | 6 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_event.php | 2 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_installer.php | 4 | ||||
| -rw-r--r-- | modules/tag/helpers/tag_menu.php | 2 |
5 files changed, 13 insertions, 13 deletions
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") |
