The official, canonical postActiv repository. http://www.postactiv.com

apiconnections.php 3.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. /* ============================================================================
  3. * Title: APIConnections
  4. * Simple API endpoint that displays the number of nodes that this one
  5. * connects to.
  6. *
  7. * postActiv:
  8. * the micro-blogging software
  9. *
  10. * Copyright:
  11. * Copyright (C) 2016-2018, Maiyannah Bishop
  12. *
  13. * Derived from code copyright various sources:
  14. * o GNU Social (C) 2013-2016, Free Software Foundation, Inc
  15. * o StatusNet (C) 2008-2012, StatusNet, Inc
  16. * ----------------------------------------------------------------------------
  17. * License:
  18. * This program is free software: you can redistribute it and/or modify
  19. * it under the terms of the GNU Affero General Public License as published by
  20. * the Free Software Foundation, either version 3 of the License, or
  21. * (at your option) any later version.
  22. *
  23. * This program is distributed in the hope that it will be useful,
  24. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. * GNU Affero General Public License for more details.
  27. *
  28. * You should have received a copy of the GNU Affero General Public License
  29. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. *
  31. * <https://www.gnu.org/licenses/agpl.html>
  32. * ----------------------------------------------------------------------------
  33. * About:
  34. * Simple API endpoint that displays the number of nodes that this one
  35. * connects to.
  36. *
  37. * Output in JSON:
  38. * "connections": {"total":"123" ,unique:"69"}
  39. *
  40. * Output in XML:
  41. * <connections>
  42. * <total>123</total>
  43. * <unique>69</unique>
  44. * </connections>
  45. *
  46. * Output in YAML:
  47. * connections:
  48. * - total: 123
  49. * - unique: 69
  50. *
  51. * PHP version:
  52. * Tested with PHP 7.0
  53. * ----------------------------------------------------------------------------
  54. * File Authors:
  55. * o Maiyannah Bishop <maiyannah.bishop@postactiv.com>
  56. *
  57. * Web:
  58. * o postActiv <http://www.postactiv.com>
  59. * o GNU social <https://www.gnu.org/s/social/>
  60. * ============================================================================
  61. */
  62. // This file is formatted so that it provides useful documentation output in
  63. // NaturalDocs. Please be considerate of this before changing formatting.
  64. // ============================================================================
  65. // Class: ApiConnectionsAction
  66. // Class which handles the API connections display endpoint.
  67. class ApiConnectionsAction extends ApiAction {
  68. // -------------------------------------------------------------------------
  69. // Function: prepare
  70. // Get the endpoint ready for action
  71. protected function prepare(array $args=array()) {
  72. parent::prepare($args);
  73. }
  74. // -------------------------------------------------------------------------
  75. // Function: handle
  76. // Display the number of connections in the given format.
  77. protected function handle() {
  78. parent::handle();
  79. }
  80. // -------------------------------------------------------------------------
  81. // Function: isReadOnly
  82. // Is this end-point read-only? (yes)
  83. function isReadOnly($args) {
  84. return true;
  85. }
  86. }
  87. // END OF FILE
  88. // ============================================================================
  89. ?>