summaryrefslogtreecommitdiff
path: root/modules/akismet
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-01-14 04:12:02 +0000
committerBharat Mediratta <bharat@menalto.com>2009-01-14 04:12:02 +0000
commitf3ba69c1d67c425ffa180d082a373e5cce0c86ce (patch)
tree5ecbbe0ba96a94e3f4aadd26042c8ad1a32ef1bc /modules/akismet
parent02af2d8b7639fdc18fba3d69a4ca0a3f5c92b948 (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/akismet')
-rw-r--r--modules/akismet/helpers/akismet.php16
-rw-r--r--modules/akismet/helpers/akismet_event.php4
-rw-r--r--modules/akismet/helpers/akismet_installer.php4
-rw-r--r--modules/akismet/helpers/akismet_menu.php2
4 files changed, 13 insertions, 13 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")