diff options
Diffstat (limited to 'core/helpers')
-rw-r--r-- | core/helpers/MY_url.php | 6 | ||||
-rw-r--r-- | core/helpers/access.php | 36 | ||||
-rw-r--r-- | core/helpers/core_block.php | 12 | ||||
-rw-r--r-- | core/helpers/core_dashboard.php | 4 | ||||
-rw-r--r-- | core/helpers/core_event.php | 12 | ||||
-rw-r--r-- | core/helpers/core_installer.php | 4 | ||||
-rw-r--r-- | core/helpers/core_menu.php | 8 | ||||
-rw-r--r-- | core/helpers/dashboard.php | 10 | ||||
-rw-r--r-- | core/helpers/dir.php | 2 | ||||
-rw-r--r-- | core/helpers/graphics.php | 30 | ||||
-rw-r--r-- | core/helpers/log.php | 20 | ||||
-rw-r--r-- | core/helpers/message.php | 22 | ||||
-rw-r--r-- | core/helpers/module.php | 32 | ||||
-rw-r--r-- | core/helpers/photo.php | 3 | ||||
-rw-r--r-- | core/helpers/rest.php | 10 | ||||
-rw-r--r-- | core/helpers/site_status.php | 24 | ||||
-rw-r--r-- | core/helpers/theme.php | 8 | ||||
-rw-r--r-- | core/helpers/xml.php | 2 |
18 files changed, 123 insertions, 122 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)) { |