modjsonrpcresource.class.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. /**
  11. * Represents a MODX Resource that services JSON-RPC client requests.
  12. *
  13. * @package modx
  14. * @subpackage jsonrpc
  15. */
  16. class modJSONRPCResource extends modResource {
  17. public $allowListingInClassKeyDropdown = false;
  18. /**
  19. * Overrides the modResource constructor to set the response class and class_key for this Resource type
  20. * @param xPDO $xpdo
  21. */
  22. function __construct(xPDO &$xpdo) {
  23. parent :: __construct($xpdo);
  24. $this->_fields['class_key']= 'modJSONRPCResource';
  25. $this->xpdo->setOption('modResponse.class','jsonrpc.modJSONRPCResponse');
  26. $this->showInContextMenu = false;
  27. }
  28. /**
  29. * Overrides modResource::process to provide a custom response
  30. *
  31. * @see modResource::process()
  32. * @return string The processed content
  33. */
  34. public function process() {
  35. $this->xpdo->getResponse('jsonrpc.modJSONRPCResponse');
  36. parent :: process();
  37. return $this->_content;
  38. }
  39. }