summaryrefslogtreecommitdiff
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
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
-rw-r--r--core/helpers/MY_url.php6
-rw-r--r--core/helpers/access.php36
-rw-r--r--core/helpers/core_block.php12
-rw-r--r--core/helpers/core_dashboard.php4
-rw-r--r--core/helpers/core_event.php12
-rw-r--r--core/helpers/core_installer.php4
-rw-r--r--core/helpers/core_menu.php8
-rw-r--r--core/helpers/dashboard.php10
-rw-r--r--core/helpers/dir.php2
-rw-r--r--core/helpers/graphics.php30
-rw-r--r--core/helpers/log.php20
-rw-r--r--core/helpers/message.php22
-rw-r--r--core/helpers/module.php32
-rw-r--r--core/helpers/photo.php3
-rw-r--r--core/helpers/rest.php10
-rw-r--r--core/helpers/site_status.php24
-rw-r--r--core/helpers/theme.php8
-rw-r--r--core/helpers/xml.php2
-rw-r--r--core/tests/File_Structure_Test.php40
-rw-r--r--installer/helpers/installer.php64
-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
-rw-r--r--modules/atom/helpers/atom.php2
-rw-r--r--modules/comment/helpers/comment_block.php4
-rw-r--r--modules/comment/helpers/comment_dashboard.php4
-rw-r--r--modules/comment/helpers/comment_installer.php4
-rw-r--r--modules/comment/helpers/comment_menu.php4
-rw-r--r--modules/gmaps/helpers/gmaps_block.php2
-rw-r--r--modules/gmaps/helpers/gmaps_installer.php4
-rw-r--r--modules/info/helpers/info_block.php4
-rw-r--r--modules/info/helpers/info_installer.php4
-rw-r--r--modules/media_rss/helpers/media_rss.php4
-rw-r--r--modules/media_rss/helpers/media_rss_block.php2
-rw-r--r--modules/media_rss/helpers/media_rss_installer.php4
-rw-r--r--modules/polar_rose/helpers/polar_rose_block.php4
-rw-r--r--modules/polar_rose/helpers/polar_rose_installer.php4
-rw-r--r--modules/rearrange/helpers/rearrange_block.php2
-rw-r--r--modules/rearrange/helpers/rearrange_installer.php4
-rw-r--r--modules/search/helpers/search_block.php2
-rw-r--r--modules/search/helpers/search_installer.php4
-rw-r--r--modules/slideshow/helpers/slideshow_block.php2
-rw-r--r--modules/slideshow/helpers/slideshow_installer.php4
-rw-r--r--modules/slideshow/helpers/slideshow_menu.php4
-rw-r--r--modules/tag/helpers/tag.php12
-rw-r--r--modules/tag/helpers/tag_block.php6
-rw-r--r--modules/tag/helpers/tag_event.php2
-rw-r--r--modules/tag/helpers/tag_installer.php4
-rw-r--r--modules/tag/helpers/tag_menu.php2
-rw-r--r--modules/user/helpers/group.php6
-rw-r--r--modules/user/helpers/user.php30
-rw-r--r--modules/user/helpers/user_block.php4
-rw-r--r--modules/user/helpers/user_event.php2
-rw-r--r--modules/user/helpers/user_installer.php4
-rw-r--r--modules/user/helpers/user_menu.php2
-rw-r--r--modules/watermark/helpers/watermark.php10
-rw-r--r--modules/watermark/helpers/watermark_installer.php4
-rw-r--r--modules/watermark/helpers/watermark_menu.php2
59 files changed, 280 insertions, 257 deletions
diff --git a/core/helpers/MY_url.php b/core/helpers/MY_url.php
index 12c51f8d..fa358543 100644
--- a/core/helpers/MY_url.php
+++ b/core/helpers/MY_url.php
@@ -21,7 +21,7 @@ class url extends url_Core {
/**
* Just like url::file() except that it returns an absolute URI
*/
- public static function abs_file($path) {
+ static function abs_file($path) {
return url::base(false, "http") . $path;
}
@@ -29,14 +29,14 @@ class url extends url_Core {
* Just like url::site() except that it returns an absolute URI and
* doesn't take a protocol parameter.
*/
- public static function abs_site($path) {
+ static function abs_site($path) {
return url::site($path, "http");
}
/**
* Just like url::current except that it returns an absolute URI
*/
- public static function abs_current($qs=false) {
+ static function abs_current($qs=false) {
return self::abs_site(url::current($qs));
}
}
diff --git a/core/helpers/access.php b/core/helpers/access.php
index a42391bd..4aba5e9a 100644
--- a/core/helpers/access.php
+++ b/core/helpers/access.php
@@ -77,7 +77,7 @@ class access_Core {
* @param Item_Model $item
* @return boolean
*/
- public static function can($perm_name, $item) {
+ static function can($perm_name, $item) {
if (!$item->loaded) {
return false;
}
@@ -103,7 +103,7 @@ class access_Core {
* @param Item_Model $item
* @return boolean
*/
- public static function required($perm_name, $item) {
+ static function required($perm_name, $item) {
if (!self::can($perm_name, $item)) {
self::forbidden();
}
@@ -117,7 +117,7 @@ class access_Core {
* @param Item_Model $item
* @return boolean
*/
- public static function group_can($group, $perm_name, $item) {
+ static function group_can($group, $perm_name, $item) {
$resource = $perm_name == "view" ?
$item : model_cache::get("access_cache", $item->id, "item_id");
return $resource->__get("{$perm_name}_{$group->id}") === self::ALLOW;
@@ -131,7 +131,7 @@ class access_Core {
* @param Item_Model $item
* @return integer access::ALLOW, access::DENY or null for no intent
*/
- public static function group_intent($group, $perm_name, $item) {
+ static function group_intent($group, $perm_name, $item) {
$intent = model_cache::get("access_intent", $item->id, "item_id");
return $intent->__get("{$perm_name}_{$group->id}");
}
@@ -145,7 +145,7 @@ class access_Core {
* @param Item_Model $item
* @return ORM_Model item that locks this one
*/
- public static function locked_by($group, $perm_name, $item) {
+ static function locked_by($group, $perm_name, $item) {
if ($perm_name != "view") {
return null;
}
@@ -172,7 +172,7 @@ class access_Core {
/**
* Terminate immediately with an HTTP 503 Forbidden response.
*/
- public static function forbidden() {
+ static function forbidden() {
throw new Exception("@todo FORBIDDEN", 503);
}
@@ -211,7 +211,7 @@ class access_Core {
* @param string $perm_name
* @param Item_Model $item
*/
- public static function allow($group, $perm_name, $item) {
+ static function allow($group, $perm_name, $item) {
self::_set($group, $perm_name, $item, self::ALLOW);
}
@@ -222,7 +222,7 @@ class access_Core {
* @param string $perm_name
* @param Item_Model $item
*/
- public static function deny($group, $perm_name, $item) {
+ static function deny($group, $perm_name, $item) {
self::_set($group, $perm_name, $item, self::DENY);
}
@@ -233,7 +233,7 @@ class access_Core {
* @param string $perm_name
* @param Item_Model $item
*/
- public static function reset($group, $perm_name, $item) {
+ static function reset($group, $perm_name, $item) {
if ($item->id == 1) {
throw new Exception("@todo CANT_RESET_ROOT_PERMISSION");
}
@@ -247,7 +247,7 @@ class access_Core {
* @param string $display_name The internationalized version of the displayable name
* @return void
*/
- public static function register_permission($name, $display_name) {
+ static function register_permission($name, $display_name) {
$permission = ORM::factory("permission", $name);
if ($permission->loaded) {
throw new Exception("@todo PERMISSION_ALREADY_EXISTS $name");
@@ -267,7 +267,7 @@ class access_Core {
* @param string $perm_name
* @return void
*/
- public static function delete_permission($name) {
+ static function delete_permission($name) {
foreach (self::_get_all_groups() as $group) {
self::_drop_columns($name, $group);
}
@@ -283,7 +283,7 @@ class access_Core {
* @param Group_Model $group
* @return void
*/
- public static function add_group($group) {
+ static function add_group($group) {
foreach (ORM::factory("permission")->find_all() as $perm) {
self::_add_columns($perm->name, $group);
}
@@ -295,7 +295,7 @@ class access_Core {
* @param Group_Model $group
* @return void
*/
- public static function delete_group($group) {
+ static function delete_group($group) {
foreach (ORM::factory("permission")->find_all() as $perm) {
self::_drop_columns($perm->name, $group);
}
@@ -307,7 +307,7 @@ class access_Core {
* @param Item_Model $item
* @return void
*/
- public static function add_item($item) {
+ static function add_item($item) {
$access_intent = ORM::factory("access_intent", $item->id);
if ($access_intent->loaded) {
throw new Exception("@todo ITEM_ALREADY_ADDED $item->id");
@@ -343,7 +343,7 @@ class access_Core {
* @param Item_Model $item
* @return void
*/
- public static function delete_item($item) {
+ static function delete_item($item) {
ORM::factory("access_intent")->where("item_id", $item->id)->find()->delete();
ORM::factory("access_cache")->where("item_id", $item->id)->find()->delete();
}
@@ -351,7 +351,7 @@ class access_Core {
/**
* Verify our Cross Site Request Forgery token is valid, else throw an exception.
*/
- public static function verify_csrf() {
+ static function verify_csrf() {
$input = Input::instance();
if ($input->post("csrf", $input->get("csrf", null)) !== Session::instance()->get("csrf")) {
self::forbidden();
@@ -362,7 +362,7 @@ class access_Core {
* Get the Cross Site Request Forgery token for this session.
* @return string
*/
- public static function csrf_token() {
+ static function csrf_token() {
$session = Session::instance();
$csrf = $session->get("csrf");
if (empty($csrf)) {
@@ -376,7 +376,7 @@ class access_Core {
* Generate an <input> element containing the Cross Site Request Forgery token for this session.
* @return string
*/
- public static function csrf_form_field() {
+ static function csrf_form_field() {
return "<input type=\"hidden\" name=\"csrf\" value=\"" . self::csrf_token() . "\"/>";
}
diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php
index e005b67d..35bba06f 100644
--- a/core/helpers/core_block.php
+++ b/core/helpers/core_block.php
@@ -19,7 +19,7 @@
*/
class core_block_Core {
- public static function head($theme) {
+ static function head($theme) {
$buf = "";
if (Session::instance()->get("debug")) {
$buf .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
@@ -33,34 +33,34 @@ class core_block_Core {
return $buf;
}
- public static function thumb_top($theme, $child) {
+ static function thumb_top($theme, $child) {
if ($child->type == "photo" && access::can("edit", $child)) {
$edit_link = url::site("quick/pane/$child->id");
return "<div class=\"gQuick\" href=\"$edit_link\">";
}
}
- public static function thumb_bottom($theme, $child) {
+ static function thumb_bottom($theme, $child) {
if ($child->type == "photo" && access::can("edit", $child)) {
return "</div>";
}
}
- public static function admin_head($theme) {
+ static function admin_head($theme) {
if (Session::instance()->get("debug")) {
return "<link rel=\"stylesheet\" type=\"text/css\" href=\"" .
url::file("core/css/debug.css") . "\" />";
}
}
- public static function page_bottom($theme) {
+ static function page_bottom($theme) {
if (Session::instance()->get("profiler", false)) {
$profiler = new Profiler();
$profiler->render();
}
}
- public static function admin_page_bottom($theme) {
+ static function admin_page_bottom($theme) {
if (Session::instance()->get("profiler", false)) {
$profiler = new Profiler();
$profiler->render();
diff --git a/core/helpers/core_dashboard.php b/core/helpers/core_dashboard.php
index 2e017351..8efba3ea 100644
--- a/core/helpers/core_dashboard.php
+++ b/core/helpers/core_dashboard.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class core_dashboard_Core {
- public static function get_list() {
+ static function get_list() {
return array(
"welcome" => t("Welcome to Gallery 3!"),
"photo_stream" => t("Photo Stream"),
@@ -28,7 +28,7 @@ class core_dashboard_Core {
"project_news" => t("Gallery Project News"));
}
- public static function get_block($block_id) {
+ static function get_block($block_id) {
$block = new Block();
switch($block_id) {
case "welcome":
diff --git a/core/helpers/core_event.php b/core/helpers/core_event.php
index f9ab2ed0..819a6a63 100644
--- a/core/helpers/core_event.php
+++ b/core/helpers/core_event.php
@@ -19,27 +19,27 @@
*/
class core_event_Core {
- public static function group_created($group) {
+ static function group_created($group) {
access::add_group($group);
}
- public static function group_before_delete($group) {
+ static function group_before_delete($group) {
access::delete_group($group);
}
- public static function photo_created($photo) {
+ static function photo_created($photo) {
access::add_item($photo);
}
- public static function photo_before_delete($photo) {
+ static function photo_before_delete($photo) {
access::delete_item($photo);
}
- public static function album_created($album) {
+ static function album_created($album) {
access::add_item($album);
}
- public static function album_before_delete($album) {
+ static function album_before_delete($album) {
access::delete_item($album);
}
}
diff --git a/core/helpers/core_installer.php b/core/helpers/core_installer.php
index 20edd47d..3ee67358 100644
--- a/core/helpers/core_installer.php
+++ b/core/helpers/core_installer.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class core_installer {
- public static function install() {
+ static function install() {
$db = Database::instance();
$version = 0;
try {
@@ -246,7 +246,7 @@ class core_installer {
}
}
- public static function uninstall() {
+ static function uninstall() {
$db = Database::instance();
$db->query("DROP TABLE IF EXISTS `access_caches`;");
$db->query("DROP TABLE IF EXISTS `access_intents`;");
diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php
index 30c8e419..6246f3f6 100644
--- a/core/helpers/core_menu.php
+++ b/core/helpers/core_menu.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class core_menu_Core {
- public static function site($menu, $theme) {
+ static function site($menu, $theme) {
$menu
->append(Menu::factory("link")
->id("browse")
@@ -74,7 +74,7 @@ class core_menu_Core {
}
}
- public static function album($menu, $theme) {
+ static function album($menu, $theme) {
$menu
->append(Menu::factory("link")
->id("hybrid")
@@ -83,7 +83,7 @@ class core_menu_Core {
->css_id("gHybridLink"));
}
- public static function photo($menu, $theme) {
+ static function photo($menu, $theme) {
$menu
->append(Menu::factory("link")
->id("fullsize")
@@ -97,7 +97,7 @@ class core_menu_Core {
->css_id("gAlbumLink"));
}
- public static function admin($menu, $theme) {
+ static function admin($menu, $theme) {
$menu
->append(Menu::factory("link")
->id("dashboard")
diff --git a/core/helpers/dashboard.php b/core/helpers/dashboard.php
index 1c46b218..8e6f6aaa 100644
--- a/core/helpers/dashboard.php
+++ b/core/helpers/dashboard.php
@@ -18,24 +18,24 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class dashboard_Core {
- public static function get_active() {
+ static function get_active() {
return unserialize(module::get_var("core", "dashboard_blocks", "a:0:{}"));
}
- public static function add_block($location, $module_name, $block_id) {
+ static function add_block($location, $module_name, $block_id) {
$blocks = self::get_active();
$blocks[$location][rand()] = array($module_name, $block_id);
module::set_var("core", "dashboard_blocks", serialize($blocks));
}
- public static function remove_block($location, $block_id) {
+ static function remove_block($location, $block_id) {
$blocks = self::get_active();
unset($blocks[$location][$block_id]);
unset($blocks[$location][$block_id]);
module::set_var("core", "dashboard_blocks", serialize($blocks));
}
- public static function get_available() {
+ static function get_available() {
$blocks = array();
foreach (module::installed() as $module) {
@@ -48,7 +48,7 @@ class dashboard_Core {
return $blocks;
}
- public static function get_blocks($blocks) {
+ static function get_blocks($blocks) {
$result = "";
foreach ($blocks as $id => $desc) {
if (method_exists("$desc[0]_dashboard", "get_block")) {
diff --git a/core/helpers/dir.php b/core/helpers/dir.php
index 02599467..33767f87 100644
--- a/core/helpers/dir.php
+++ b/core/helpers/dir.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class dir_Core {
- public static function unlink($path) {
+ static function unlink($path) {
if (is_dir($path) && is_writable($path)) {
foreach (new DirectoryIterator($path) as $resource) {
if ($resource->isDot()) {
diff --git a/core/helpers/graphics.php b/core/helpers/graphics.php
index 847de665..738c7d45 100644
--- a/core/helpers/graphics.php
+++ b/core/helpers/graphics.php
@@ -37,9 +37,9 @@ class graphics_Core {
* @param string $target the target for this operation ("thumb" or "resize")
* @param string $operation the name of the operation
* @param array $args arguments to the operation
- * @param integer $priority the priority for this function (lower priorities are run first)
+ * @param integer $priority the priority for this rule (lower priorities are run first)
*/
- public static function add_rule($module_name, $target, $operation, $args, $priority) {
+ static function add_rule($module_name, $target, $operation, $args, $priority) {
$rule = ORM::factory("graphics_rule");
$rule->module_name = $module_name;
$rule->target = $target;
@@ -55,7 +55,7 @@ class graphics_Core {
* Remove all rules for this module
* @param string $module_name
*/
- public static function remove_rules($module_name) {
+ static function remove_rules($module_name) {
$db = Database::instance();
$result = $db->query("DELETE FROM `graphics_rules` WHERE `module_name` = '$module_name'");
if ($result->count()) {
@@ -67,7 +67,7 @@ class graphics_Core {
* Rebuild the thumb and resize for the given item.
* @param Item_Model $item
*/
- public static function generate($item) {
+ static function generate($item) {
if ($item->type == "album") {
$cover = $item->album_cover();
if (!$cover) {
@@ -127,7 +127,7 @@ class graphics_Core {
* @param string $output_file
* @param array $options
*/
- public static function resize($input_file, $output_file, $options) {
+ static function resize($input_file, $output_file, $options) {
if (!self::$init) {
self::init_toolkit();
}
@@ -144,7 +144,7 @@ class graphics_Core {
* @param string $output_file
* @param array $options
*/
- public static function rotate($input_file, $output_file, $options) {
+ static function rotate($input_file, $output_file, $options) {
if (!self::$init) {
self::init_toolkit();
}
@@ -163,7 +163,7 @@ class graphics_Core {
* @param string $output_file
* @param array $options
*/
- public static function composite($input_file, $output_file, $options) {
+ static function composite($input_file, $output_file, $options) {
if (!self::$init) {
self::init_toolkit();
}
@@ -200,7 +200,7 @@ class graphics_Core {
* Return a query result that locates all items with dirty images.
* @return Database_Result Query result
*/
- public static function find_dirty_images_query() {
+ static function find_dirty_images_query() {
return Database::instance()->query(
"SELECT `id` FROM `items` " .
"WHERE (`thumb_dirty` = 1 AND (`type` <> 'album' OR `right` - `left` > 1))" .
@@ -210,7 +210,7 @@ class graphics_Core {
/**
* Mark all thumbnails and resizes as dirty. They will have to be rebuilt.
*/
- public static function mark_all_dirty() {
+ static function mark_all_dirty() {
$db = Database::instance();
$db->query("UPDATE `items` SET `thumb_dirty` = 1, `resize_dirty` = 1");
@@ -232,7 +232,7 @@ class graphics_Core {
* Task that rebuilds all dirty images.
* @param Task_Model the task
*/
- public static function rebuild_dirty_images($task) {
+ static function rebuild_dirty_images($task) {
$db = Database::instance();
$result = self::find_dirty_images_query();
@@ -279,7 +279,7 @@ class graphics_Core {
* about that toolkit. For GD we return the version string, and for ImageMagick and
* GraphicsMagick we return the path to the directory containing the appropriate binaries.
*/
- public static function detect_toolkits() {
+ static function detect_toolkits() {
return array("gd" => gd_info(),
"imagemagick" => dirname(exec("which convert")),
"graphicsmagick" => dirname(exec("which gm")));
@@ -288,7 +288,7 @@ class graphics_Core {
/**
* Choose which driver the Kohana Image library uses.
*/
- public static function init_toolkit() {
+ static function init_toolkit() {
switch(module::get_var("core", "graphics_toolkit")) {
case "gd":
Kohana::config_set("image.driver", "GD");
@@ -312,12 +312,12 @@ class graphics_Core {
/**
* Verify that a specific graphics function is available with the active toolkit.
- * @param string $function the function name (eg rotate, resize)
+ * @param string $func (eg rotate, resize)
* @return boolean
*/
- function can($function) {
+ static function can($func) {
if (module::get_var("core", "graphics_toolkit") == "gd" &&
- $function == "rotate" &&
+ $func == "rotate" &&
!function_exists("imagerotate")) {
return false;
}
diff --git a/core/helpers/log.php b/core/helpers/log.php
index 4b135465..181efaa9 100644
--- a/core/helpers/log.php
+++ b/core/helpers/log.php
@@ -29,8 +29,8 @@ class log_Core {
* @param string $message a detailed log message
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
- public static function success($category, $message, $html="") {
- self::add($category, $message, $html, self::SUCCESS);
+ static function success($category, $message, $html="") {
+ self::_add($category, $message, $html, self::SUCCESS);
}
/**
@@ -39,8 +39,8 @@ class log_Core {
* @param string $message a detailed log message
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
- public static function info($category, $message, $html="") {
- self::add($category, $message, $html, self::INFO);
+ static function info($category, $message, $html="") {
+ self::_add($category, $message, $html, self::INFO);
}
/**
@@ -49,8 +49,8 @@ class log_Core {
* @param string $message a detailed log message
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
- public static function warning($category, $message, $html="") {
- self::add($category, $message, $html, self::WARNING);
+ static function warning($category, $message, $html="") {
+ self::_add($category, $message, $html, self::WARNING);
}
/**
@@ -59,8 +59,8 @@ class log_Core {
* @param string $message a detailed log message
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
- public static function error($category, $message, $html="") {
- self::add($category, $message, $html, self::ERROR);
+ static function error($category, $message, $html="") {
+ self::_add($category, $message, $html, self::ERROR);
}
/**
@@ -71,7 +71,7 @@ class log_Core {
* @param integer $severity INFO, WARNING or ERROR
* @param string $html an html snippet presented alongside the log message to aid the admin
*/
- private static function add($category, $message, $html, $severity) {
+ private static function _add($category, $message, $html, $severity) {
$log = ORM::factory("log");
$log->category = $category;
$log->message = $message;
@@ -92,7 +92,7 @@ class log_Core {
* @param integer $severity
* @return string
*/
- public function severity_class($severity) {
+ static function severity_class($severity) {
switch($severity) {
case self::SUCCESS:
return "gSuccess";
diff --git a/core/helpers/message.php b/core/helpers/message.php
index 482b6c1a..7fd62285 100644
--- a/core/helpers/message.php
+++ b/core/helpers/message.php
@@ -27,32 +27,32 @@ class message_Core {
* Report a successful event.
* @param string $msg a detailed message
*/
- public static function success($msg) {
- self::add($msg, self::SUCCESS);
+ static function success($msg) {
+ self::_add($msg, self::SUCCESS);
}
/**
* Report an informational event.
* @param string $msg a detailed message
*/
- public static function info($msg) {
- self::add($msg, self::INFO);
+ static function info($msg) {
+ self::_add($msg, self::INFO);
}
/**
* Report that something went wrong, not fatal, but worth investigation.
* @param string $msg a detailed message
*/
- public static function warning($msg) {
- self::add($msg, self::WARNING);
+ static function warning($msg) {
+ self::_add($msg, self::WARNING);
}
/**
* Report that something went wrong that should be fixed.
* @param string $msg a detailed message
*/
- public static function error($msg) {
- self::add($msg, self::ERROR);
+ static function error($msg) {
+ self::_add($msg, self::ERROR);
}
/**
@@ -60,7 +60,7 @@ class message_Core {
* @param string $msg a detailed message
* @param integer $severity one of the severity constants
*/
- private function add($msg, $severity) {
+ private static function _add($msg, $severity) {
$session = Session::instance();
$status = $session->get("messages");
$status[] = array($msg, $severity);
@@ -73,7 +73,7 @@ class message_Core {
* issues that need to be resolved. Transient ones are only displayed once.
* @return html text
*/
- public function get() {
+ static function get() {
$buf = array();
$messages = Session::instance()->get_once("messages", array());
@@ -90,7 +90,7 @@ class message_Core {
* @param integer $severity
* @return string
*/
- public function severity_class($severity) {
+ static function severity_class($severity) {
switch($severity) {
case self::SUCCESS:
return "gSuccess";
diff --git a/core/helpers/module.php b/core/helpers/module.php
index 18b745a8..bded9dc6 100644
--- a/core/helpers/module.php
+++ b/core/helpers/module.php
@@ -27,7 +27,7 @@ class module_Core {
private static $module_names = array();
private static $modules = array();
- public static function get_version($module_name) {
+ static function get_version($module_name) {
return ORM::factory("module")->where("name", $module_name)->find()->version;
}
@@ -36,7 +36,7 @@ class module_Core {
* @param string $module_name
* @param integer $version
*/
- public static function set_version($module_name, $version) {
+ static function set_version($module_name, $version) {
$module = ORM::factory("module")->where("name", $module_name)->find();
if (!$module->loaded) {
$module->name = $module_name;
@@ -50,7 +50,7 @@ class module_Core {
* Load the corresponding Module_Model
* @param string $module_name
*/
- public static function get($module_name) {
+ static function get($module_name) {
return model_cache::get("module", $module_name, "name");
}
@@ -58,7 +58,7 @@ class module_Core {
* Delete the corresponding Module_Model
* @param string $module_name
*/
- public static function delete($module_name) {
+ static function delete($module_name) {
$module = ORM::factory("module")->where("name", $module_name)->find();
if ($module->loaded) {
$db = Database::instance();
@@ -76,21 +76,21 @@ class module_Core {
* Check to see if a module is installed
* @param string $module_name
*/
- public static function is_installed($module_name) {
+ static function is_installed($module_name) {
return !empty(self::$module_names[$module_name]);
}
/**
* Return the list of installed modules.
*/
- public static function installed() {
+ static function installed() {
return self::$modules;
}
/**
* Return the list of available modules.
*/
- public static function available() {
+ static function available() {
$modules = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
foreach (array_merge(array("core/module.info"), glob(MODPATH . "*/module.info")) as $file) {
$module_name = basename(dirname($file));
@@ -112,7 +112,7 @@ class module_Core {
/**
* Install a module.
*/
- public static function install($module_name) {
+ static function install($module_name) {
$installer_class = "{$module_name}_installer";
Kohana::log("debug", "$installer_class install (initial)");
if ($module_name != "core") {
@@ -136,7 +136,7 @@ class module_Core {
* Uninstall a module.
*/
- public static function uninstall($module_name) {
+ static function uninstall($module_name) {
$installer_class = "{$module_name}_installer";
Kohana::log("debug", "$installer_class uninstall");
call_user_func(array($installer_class, "uninstall"));
@@ -146,7 +146,7 @@ class module_Core {
/**
* Load the active modules. This is called at bootstrap time.
*/
- public static function load_modules() {
+ static function load_modules() {
// Reload module list from the config file since we'll do a refresh after calling install()
$core = Kohana::config_load("core");
$kohana_modules = $core["modules"];
@@ -181,14 +181,14 @@ class module_Core {
self::event("gallery_ready");
}
- public static function dummy_error_handler() { }
+ static function dummy_error_handler() { }
/**
* Run a specific event on all active modules.
* @param string $name the event name
* @param mixed $data data to pass to each event handler
*/
- public static function event($name, &$data=null) {
+ static function event($name, &$data=null) {
foreach (self::installed() as $module) {
$class = "{$module->name}_event";
$function = str_replace(".", "_", $name);
@@ -207,7 +207,7 @@ class module_Core {
* @param string $default_value
* @return the value
*/
- public static function get_var($module_name, $name, $default_value=null) {
+ static function get_var($module_name, $name, $default_value=null) {
$var = ORM::factory("var")
->where("module_name", $module_name)
->where("name", $name)
@@ -221,7 +221,7 @@ class module_Core {
* @param string $name
* @param string $value
*/
- public static function set_var($module_name, $name, $value) {
+ static function set_var($module_name, $name, $value) {
$var = ORM::factory("var")
->where("module_name", $module_name)
->where("name", $name)
@@ -241,7 +241,7 @@ class module_Core {
* @param string $name
* @param string $increment (optional, default is 1)
*/
- public static function incr_var($module_name, $name, $increment=1) {
+ static function incr_var($module_name, $name, $increment=1) {
Database::instance()->query(
"UPDATE `vars` SET `value` = `value` + $increment " .
"WHERE `module_name` = '$module_name' " .
@@ -253,7 +253,7 @@ class module_Core {
* @param string $module_name
* @param string $name
*/
- public static function clear_var($module_name, $name) {
+ static function clear_var($module_name, $name) {
$var = ORM::factory("var")
->where("module_name", $module_name)
->where("name", $name)
diff --git a/core/helpers/photo.php b/core/helpers/photo.php
index 63845612..9178ad8c 100644
--- a/core/helpers/photo.php
+++ b/core/helpers/photo.php
@@ -33,7 +33,8 @@ class photo_Core {
* @param string $description (optional) the longer description of this photo
* @return Item_Model
*/
- static function create($parent, $filename, $name, $title, $description=null, $owner_id=null) {
+ static function create($parent, $filename, $name, $title,
+ $description=null, $owner_id=null) {
if (!$parent->loaded || $parent->type != "album") {
throw new Exception("@todo INVALID_PARENT");
}
diff --git a/core/helpers/rest.php b/core/helpers/rest.php
index 061c2f6b..51f066eb 100644
--- a/core/helpers/rest.php
+++ b/core/helpers/rest.php
@@ -58,7 +58,7 @@ class rest_Core {
* Returns the HTTP request method taking into consideration PUT/DELETE tunneling.
* @return string HTTP request method
*/
- public static function request_method() {
+ static function request_method() {
Kohana::log("debug", "request::method: " . request::method());
if (request::method() == "get") {
return "get";
@@ -76,7 +76,7 @@ class rest_Core {
* Choose an output format based on what the client prefers to accept.
* @return string "html", "xml" or "json"
*/
- public static function output_format() {
+ static function output_format() {
// Pick a format, but let it be overridden.
$input = Input::instance();
$fmt = $input->get(
@@ -95,7 +95,7 @@ class rest_Core {
* Set HTTP response code.
* @param string Use one of the status code constants defined in this class.
*/
- public static function http_status($status_code) {
+ static function http_status($status_code) {
header("HTTP/1.1 " . $status_code);
}
@@ -103,7 +103,7 @@ class rest_Core {
* Set HTTP Location header.
* @param string URL
*/
- public static function http_location($url) {
+ static function http_location($url) {
header("Location: " . $url);
}
@@ -111,7 +111,7 @@ class rest_Core {
* Set HTTP Content-Type header.
* @param string content type
*/
- public static function http_content_type($type) {
+ static function http_content_type($type) {
header("Content-Type: " . $type);
}
}
diff --git a/core/helpers/site_status.php b/core/helpers/site_status.php
index eb9abb6b..4b465e45 100644
--- a/core/helpers/site_status.php
+++ b/core/helpers/site_status.php
@@ -28,8 +28,8 @@ class site_status_Core {
* @param string $msg a detailed message
* @param string $permanent_key make this message permanent and store it under this key
*/
- public static function success($msg, $permanent_key) {
- self::add($msg, self::SUCCESS, $permanent_key);
+ static function success($msg, $permanent_key) {
+ self::_add($msg, self::SUCCESS, $permanent_key);
}
/**
@@ -37,8 +37,8 @@ class site_status_Core {
* @param string $msg a detailed message
* @param string $permanent_key make this message permanent and store it under this key
*/
- public static function info($msg, $permanent_key) {
- self::add($msg, self::INFO, $permanent_key);
+ static function info($msg, $permanent_key) {
+ self::_add($msg, self::INFO, $permanent_key);
}
/**
@@ -46,8 +46,8 @@ class site_status_Core {
* @param string $msg a detailed message
* @param string $permanent_key make this message permanent and store it under this key
*/
- public static function warning($msg, $permanent_key) {
- self::add($msg, self::WARNING, $permanent_key);
+ static function warning($msg, $permanent_key) {
+ self::_add($msg, self::WARNING, $permanent_key);
}
/**
@@ -55,8 +55,8 @@ class site_status_Core {
* @param string $msg a detailed message
* @param string $permanent_key make this message permanent and store it under this key
*/
- public static function error($msg, $permanent_key) {
- self::add($msg, self::ERROR, $permanent_key);
+ static function error($msg, $permanent_key) {
+ self::_add($msg, self::ERROR, $permanent_key);
}
/**
@@ -65,7 +65,7 @@ class site_status_Core {
* @param integer $severity one of the severity constants
* @param string $permanent_key make this message permanent and store it under this key
*/
- private function add($msg, $severity, $permanent_key) {
+ private static function _add($msg, $severity, $permanent_key) {
$message = ORM::factory("message")
->where("key", $permanent_key)
->find();
@@ -81,7 +81,7 @@ class site_status_Core {
* Remove any permanent message by key.
* @param string $permanent_key
*/
- public function clear($permanent_key) {
+ static function clear($permanent_key) {
$message = ORM::factory("message")->where("key", $permanent_key)->find();
if ($message->loaded) {
$message->delete();
@@ -94,7 +94,7 @@ class site_status_Core {
* issues that need to be resolved. Transient ones are only displayed once.
* @return html text
*/
- public function get() {
+ static function get() {
if (!user::active()->admin) {
return;
}
@@ -114,7 +114,7 @@ class site_status_Core {
* @param integer $severity
* @return string
*/
- public function severity_class($severity) {
+ static function severity_class($severity) {
switch($severity) {
case self::SUCCESS:
return "gSuccess";
diff --git a/core/helpers/theme.php b/core/helpers/theme.php
index 8f977e0c..74a41459 100644
--- a/core/helpers/theme.php
+++ b/core/helpers/theme.php
@@ -28,7 +28,7 @@ class theme_Core {
* Load the active theme. This is called at bootstrap time. We will only ever have one theme
* active for any given request.
*/
- public static function load_themes() {
+ static function load_themes() {
$modules = Kohana::config('core.modules');
if (Router::$controller == "admin") {
array_unshift($modules, THEMEPATH . 'admin_default');
@@ -38,7 +38,7 @@ class theme_Core {
Kohana::config_set('core.modules', $modules);
}
- public static function get_edit_form_admin($theme) {
+ static function get_edit_form_admin($theme) {
$form = new Forge("admin/themes/edit/{$theme->id}",
'', null, array("id" =>"gThemeDetailsForm"));
$group = $form->group("edit_theme")->label($theme->description);
@@ -55,12 +55,12 @@ class theme_Core {
return $form;
}
- public static function get_edit_form_content($theme_name) {
+ static function get_edit_form_content($theme_name) {
$file = THEMEPATH . $theme_name . "/theme.info";
$theme_info = new ArrayObject(parse_ini_file($file), ArrayObject::ARRAY_AS_PROPS);
}
- public static function get_var($theme_id, $name, $default_value = null) {
+ static function get_var($theme_id, $name, $default_value = null) {
return module::get_var($theme_id, $name, module::get_var("core", $name, $default_value));
}
}
diff --git a/core/helpers/xml.php b/core/helpers/xml.php
index 09168ce8..0fb0c01d 100644
--- a/core/helpers/xml.php
+++ b/core/helpers/xml.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class xml_Core {
- public static function to_xml($array, $element_names) {
+ static function to_xml($array, $element_names) {
$xml = "<$element_names[0]>\n";
foreach ($array as $key => $value) {
if (is_array($value)) {
diff --git a/core/tests/File_Structure_Test.php b/core/tests/File_Structure_Test.php
index d1ebec81..2c6bd239 100644
--- a/core/tests/File_Structure_Test.php
+++ b/core/tests/File_Structure_Test.php
@@ -21,7 +21,6 @@ class File_Structure_Test extends Unit_Test_Case {
public function no_trailing_closing_php_tag_test() {
$dir = new GalleryCodeFilterIterator(
new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
- $incorrect = array();
foreach ($dir as $file) {
if (!preg_match("|\.html\.php$|", $file->getPathname())) {
$this->assert_false(
@@ -86,15 +85,14 @@ class File_Structure_Test extends Unit_Test_Case {
}
public function no_tabs_in_our_code_test() {
- $dir = new GalleryCodeFilterIterator(
- new RecursiveIteratorIterator(new RecursiveDirectoryIterator(DOCROOT)));
- $incorrect = array();
+ $dir = new PhpCodeFilterIterator(
+ new GalleryCodeFilterIterator(
+ new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator(DOCROOT))));
foreach ($dir as $file) {
- if (substr($file->getFilename(), -4) == ".php") {
- $this->assert_false(
- preg_match('/\t/', file_get_contents($file)),
- "{$file->getPathname()} has tabs in it");
- }
+ $this->assert_false(
+ preg_match('/\t/', file_get_contents($file)),
+ "{$file->getPathname()} has tabs in it");
}
}
@@ -109,6 +107,30 @@ class File_Structure_Test extends Unit_Test_Case {
}
return $copy;
}
+
+ public function helpers_are_static_test() {
+ $dir = new PhpCodeFilterIterator(
+ new GalleryCodeFilterIterator(
+ new RecursiveIteratorIterator(
+ new RecursiveDirectoryIterator(DOCROOT))));
+ foreach ($dir as $file) {
+ if (basename(dirname($file)) == "helpers") {
+ foreach (file($file) as $line) {
+ $this->assert_true(
+ !preg_match("/\sfunction\s.*\(/", $line) ||
+ preg_match("/^\s*(private static function _|static function)/", $line),
+ "should be \"static function foo\" or \"private static function _foo\":\n" .
+ "$file\n$line\n");
+ }
+ }
+ }
+ }
+}
+
+class PhpCodeFilterIterator extends FilterIterator {
+ public function accept() {
+ return substr($this->getInnerIterator()->getPathName(), -4) == ".php";
+ }
}
class GalleryCodeFilterIterator extends FilterIterator {
diff --git a/installer/helpers/installer.php b/installer/helpers/installer.php
index 5eaaa79d..3e1dd6a3 100644
--- a/installer/helpers/installer.php
+++ b/installer/helpers/installer.php
@@ -22,8 +22,8 @@ class installer {
private static $config = array();
private static $database = null;
private static $config_errors = false;
-
- public static function environment_check() {
+
+ static function environment_check() {
$failed = false;
$section = array("header" => "Environment Test",
"description" => "The following tests have been run to determine if " .
@@ -31,7 +31,7 @@ class installer {
"failed, consult the documention on http://gallery.menalto.com for " .
"more information on how to correct the problem.",
"msgs" => array());
-
+
if (version_compare(PHP_VERSION, "5.2", "<")) {
$section["msgs"]["PHP Version"] = array("error" => true,
"text" => sprintf("Gallery3 requires PHP 5.2 or newer, current version: %s.", PHP_VERSION));
@@ -41,16 +41,16 @@ class installer {
"text" => PHP_VERSION);
}
-
- if (!(is_dir(SYSPATH) AND is_file(SYSPATH.'core/Bootstrap'.EXT))) {
+
+ if (!(is_dir(SYSPATH) AND is_file(SYSPATH.'core/Bootstrap'.EXT))) {
$section["msgs"]["Kohana Directory"] = array("error" => true,
"text" => "The configured Kohana directory does not exist or does not contain the required files.");
} else {
$section["msgs"]["Kohana Directory"] = array("error" => false,
"text" => SYSPATH);
}
-
- if (!(is_dir(APPPATH) AND is_file(APPPATH.'config/config'.EXT))) {
+
+ if (!(is_dir(APPPATH) AND is_file(APPPATH.'config/config'.EXT))) {
$section["msgs"]["Application Directory"] = array("error" => true,
"text" => "The configured Gallery3 application directory does not exist or does not contain the required files.");
$failed = true;
@@ -58,8 +58,8 @@ class installer {
$section["msgs"]["Application Directory"] = array("error" => false,
"text" => APPPATH);
}
-
- if (!(is_dir(MODPATH))) {
+
+ if (!(is_dir(MODPATH))) {
$section["msgs"]["Modules Directory"] = array("error" => true,
"text" => "The configured Gallery3 modules directory does not exist or does not contain the required files.");
$failed = true;
@@ -67,8 +67,8 @@ class installer {
$section["msgs"]["Modules Directory"] = array("error" => false,
"text" => MODPATH);
}
-
- if (!(is_dir(THEMEPATH))) {
+
+ if (!(is_dir(THEMEPATH))) {
$section["msgs"]["Theme Directory"] = array("error" => true,
"text" => "The configured Gallery3 themes directory does not exist or does not contain the required files.");
$failed = true;
@@ -76,13 +76,13 @@ class installer {
$section["msgs"]["Themes Directory"] = array("error" => false,
"text" => THEMEPATH);
}
-
+
if (!@preg_match("/^.$/u", utf8_encode("\xF1"))) {
$section["msgs"]["PCRE UTF-8"] = array("error" => true,
"text" => "Perl-Compatible Regular Expressions has not been compiled with UTF-8 support.",
"html" => "<a href=\"http://php.net/pcre\">PCRE</a> has not been compiled with UTF-8 support.");
$failed = true;
- } else if (!@preg_match("/^\pL$/u", utf8_encode("\xF1"))) {
+ } else if (!@preg_match("/^\pL$/u", utf8_encode("\xF1"))) {
$section["msgs"]["PCRE UTF-8"] = array("error" => true,
"text" => "Perl-Compatible Regular Expressions has not been compiled with Unicode support.",
"html" => "<a href=\"http://php.net/pcre\">PCRE</a> has not been compiled with Unicode property support.");
@@ -101,7 +101,7 @@ class installer {
$section["msgs"]["Reflection Enabled"] = array("error" => false,
"text" => "Pass");
}
-
+
if (!(function_exists("filter_list"))) {
$section["msgs"]["Filters Enabled"] = array("error" => true,
"text" => "The filter extension is either not loaded or not compiled in.",
@@ -154,11 +154,11 @@ class installer {
"text" => "Pass");
}
self::$messages[] = $section;
-
+
return !$failed;
}
- public static function display_requirements($errors=false) {
+ static function display_requirements($errors=false) {
self::$config_errors = $errors;
if (PHP_SAPI == 'cli') {
print self::_render("installer/views/installer.txt");
@@ -167,7 +167,7 @@ class installer {
}
}
- public static function parse_cli_parms($argv) {
+ static function parse_cli_parms($argv) {
$section = array("header" => "Installation Parameters",
"description" => "The following parameters will be used to install and " .
"configure your Gallery3 installation.",
@@ -219,16 +219,16 @@ class installer {
if (!empty($arguments["modules"])) {
$modules = explode(",", $arguments["modules"]);
-
+
$config["modules"] = array_merge($config["modules"], array_fill_keys($modules, 1));
unset($arguments["modules"]);
- }
+ }
foreach (array_keys($config["modules"]) as $module) {
unset($config["modules"][$module]);
$config["modules"][trim($module)] = 1;
}
-
+
self::$config = array_merge($config, $arguments);
foreach (self::$config as $key => $value) {
@@ -248,7 +248,7 @@ class installer {
self::$messages[] = $section;
}
- public static function check_database_authorization() {
+ static function check_database_authorization() {
$section = array("header" => "Database Configuration",
"description" => "Gallery3 requires the following database configuration.",
"msgs" => array());
@@ -282,7 +282,7 @@ class installer {
$section["msgs"]["Database Empty"] = array("text" => "Database '$dbname' is not empty",
"error" => true);
}
-
+
$missing = array();
$rights = self::$database->get_access_rights($dbname);
@@ -300,13 +300,13 @@ class installer {
$section["msgs"]["Privileges"] = array("text" => "Required priviledges defined.",
"error" => false);
}
-
+
self::$messages[] = $section;
return $db_config_valid;
}
- public static function check_docroot_writable() {
+ static function check_docroot_writable() {
$section = array("header" => "File System Access",
"description" => "The requires the following file system configuration.",
"msgs" => array());
@@ -325,7 +325,7 @@ class installer {
return $writable;
}
- public static function setup_kohana() {
+ static function setup_kohana() {
define('KOHANA_VERSION', '2.3');
define('KOHANA_CODENAME', 'accipiter');
@@ -352,7 +352,7 @@ class installer {
Kohana::config("locale.language");
}
- public static function install() {
+ static function install() {
ob_start();
$step = 0;
$modules[] = array();
@@ -405,7 +405,7 @@ class installer {
$step = -1;
}
}
-
+
} catch (Exception $e) {
self::print_exception($e);
}
@@ -414,7 +414,7 @@ class installer {
return $return;
}
- public static function print_exception($exception) {
+ static function print_exception($exception) {
// Beautify backtrace
try {
$trace = self::_backtrace($exception);
@@ -426,7 +426,7 @@ class installer {
$message = $exception->getMessage();
$file = $exception->getFile();
$line = $exception->getLine();
-
+
print "$type Occurred: $message \nin {$file}[$line]\n$trace";
// Turn off error reporting
error_reporting(0);
@@ -486,7 +486,7 @@ class installer {
* @param array backtrace generated by an exception or debug_backtrace
* @return string
*/
- public static function _backtrace($exception) {
+ private static function _backtrace($exception) {
$trace = $exception->getTrace();
if ( ! is_array($trace)) {
return;
@@ -501,8 +501,8 @@ class installer {
if ($exception instanceof ErrorException) {
$last = array_shift($trace);
$args = !empty($last["args"]) ? $last["args"] : $args;
- }
-
+ }
+
foreach ($trace as $entry) {
$temp = $cli ? "" : "<li>";
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")