ReCaptcha.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. <?php
  2. /**
  3. * MageSpecialist
  4. *
  5. * NOTICE OF LICENSE
  6. *
  7. * This source file is subject to the Open Software License (OSL 3.0)
  8. * that is bundled with this package in the file LICENSE.txt.
  9. * It is also available through the world-wide-web at this URL:
  10. * http://opensource.org/licenses/osl-3.0.php
  11. * If you did not receive a copy of the license and are unable to
  12. * obtain it through the world-wide-web, please send an email
  13. * to info@magespecialist.it so we can send you a copy immediately.
  14. *
  15. * @category MSP
  16. * @package MSP_ReCaptcha
  17. * @copyright Copyright (c) 2017 Skeeller srl (http://www.magespecialist.it)
  18. * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
  19. */
  20. namespace MSP\ReCaptcha\Block\Adminhtml;
  21. use Magento\Framework\View\Element\Template;
  22. use MSP\ReCaptcha\Model\Config;
  23. class ReCaptcha extends Template
  24. {
  25. /**
  26. * @var array
  27. */
  28. private $data;
  29. /**
  30. * @var Config
  31. */
  32. private $config;
  33. /**
  34. * ReCaptcha constructor.
  35. * @param Template\Context $context
  36. * @param Config $config
  37. * @param array $data
  38. */
  39. public function __construct(
  40. Template\Context $context,
  41. Config $config,
  42. array $data = []
  43. ) {
  44. parent::__construct($context, $data);
  45. $this->data = $data;
  46. $this->config = $config;
  47. }
  48. /**
  49. * Get public reCaptcha key
  50. * @return string
  51. */
  52. public function getPublicKey()
  53. {
  54. return $this->config->getPublicKey();
  55. }
  56. /**
  57. * Get backend theme
  58. * @return string
  59. */
  60. public function getTheme()
  61. {
  62. return $this->config->getBackendTheme();
  63. }
  64. /**
  65. * Get backend size
  66. * @return string
  67. */
  68. public function getSize()
  69. {
  70. return $this->config->getBackendSize();
  71. }
  72. /**
  73. * Return true if can display reCaptcha
  74. * @return bool
  75. */
  76. public function canDisplayCaptcha()
  77. {
  78. return $this->config->isEnabledBackend();
  79. }
  80. }