hosting_quota.api.php

Hooks provided by the hosting quota module.

Functions

Namesort descending Description
hook_hosting_quota_get_usage Definition of hook_hosting_quota_get_usage
hook_hosting_quota_resource Definition of hook_hosting_quota_resource
hook_hosting_quota_resource_render Definition of hook_hosting_quota_resource_render

File

quota/hosting_quota.api.php
View source
  1. <?php
  2. /**
  3. * @file
  4. * Hooks provided by the hosting quota module.
  5. */
  6. /**
  7. * @addtogroup hostinghooks
  8. * @{
  9. */
  10. /**
  11. * Definition of hook_hosting_quota_resource
  12. */
  13. function hook_hosting_quota_resource() {
  14. $resources = array();
  15. $resources['foo'] = array(
  16. 'title' => t('Foo'),
  17. 'description' => t('Limit for foo. Enter in 23rds of foo units.'),
  18. 'module' => 'hook',
  19. );
  20. return $resources;
  21. }
  22. /**
  23. * Definition of hook_hosting_quota_get_usage
  24. *
  25. * @param $client int
  26. * The nid of the client node
  27. * @param $resource string
  28. * The machine name of the resource
  29. * @param $start string
  30. * A MySQL format date
  31. * @param $end string
  32. * Another MySQL format date
  33. * @return int
  34. * Return an integer that can be compared to what the quota is set to
  35. */
  36. function hook_hosting_quota_get_usage($client, $resource, $start, $end) {
  37. if (hosting_get_client($client)) {
  38. switch ($resource) {
  39. case 'foo':
  40. // Do some things
  41. return $usage;
  42. }
  43. }
  44. }
  45. /**
  46. * Definition of hook_hosting_quota_resource_render
  47. *
  48. * @param $resource string
  49. * Machine name of the resource
  50. * @param $usage int
  51. * Usage as returned by hosting_quota_get_usage
  52. *
  53. * @return string
  54. */
  55. function hook_hosting_quota_resource_render($resource, $usage) {
  56. switch ($resource) {
  57. case 'foo':
  58. $bar = 23;
  59. return $usage * $bar . ' units';
  60. }
  61. }
  62. /**
  63. * @} End of "addtogroup hooks".
  64. */