html.php 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. <?php
  2. trait HTMLHomepageItem
  3. {
  4. public function htmlOneSettingsArray($infoOnly = false)
  5. {
  6. $homepageInformation = [
  7. 'name' => 'CustomHTML-1',
  8. 'enabled' => strpos('personal,business', $this->config['license']) !== false,
  9. 'image' => 'plugins/images/tabs/custom1.png',
  10. 'category' => 'Custom',
  11. 'settingsArray' => __FUNCTION__
  12. ];
  13. if ($infoOnly) {
  14. return $homepageInformation;
  15. }
  16. $homepageSettings = [
  17. 'debug' => true,
  18. 'settings' => [
  19. 'Enable' => [
  20. $this->settingsOption('enable', 'homepageCustomHTMLoneEnabled'),
  21. $this->settingsOption('auth', 'homepageCustomHTMLoneAuth'),
  22. ],
  23. 'Code' => [
  24. $this->settingsOption('pre-code-editor', 'customHTMLone'),
  25. $this->settingsOption('code-editor', 'customHTMLone'),
  26. ]
  27. ]
  28. ];
  29. return array_merge($homepageInformation, $homepageSettings);
  30. }
  31. public function htmlTwoSettingsArray($infoOnly = false)
  32. {
  33. $homepageInformation = [
  34. 'name' => 'CustomHTML-2',
  35. 'enabled' => strpos('personal,business', $this->config['license']) !== false,
  36. 'image' => 'plugins/images/tabs/custom2.png',
  37. 'category' => 'Custom',
  38. 'settingsArray' => __FUNCTION__
  39. ];
  40. if ($infoOnly) {
  41. return $homepageInformation;
  42. }
  43. $homepageSettings = [
  44. 'debug' => true,
  45. 'settings' => [
  46. 'Enable' => [
  47. $this->settingsOption('enable', 'homepageCustomHTMLtwoEnabled'),
  48. $this->settingsOption('auth', 'homepageCustomHTMLtwoAuth'),
  49. ],
  50. 'Code' => [
  51. $this->settingsOption('pre-code-editor', 'customHTMLtwo'),
  52. $this->settingsOption('code-editor', 'customHTMLtwo'),
  53. ]
  54. ]
  55. ];
  56. return array_merge($homepageInformation, $homepageSettings);
  57. }
  58. public function htmlHomepagePermissions($key = null)
  59. {
  60. $permissions = [
  61. 'one' => [
  62. 'enabled' => [
  63. 'homepageCustomHTMLoneEnabled'
  64. ],
  65. 'auth' => [
  66. 'homepageCustomHTMLoneAuth'
  67. ],
  68. 'not_empty' => [
  69. 'customHTMLone'
  70. ]
  71. ],
  72. 'two' => [
  73. 'enabled' => [
  74. 'homepageCustomHTMLtwoEnabled'
  75. ],
  76. 'auth' => [
  77. 'homepageCustomHTMLtwoAuth'
  78. ],
  79. 'not_empty' => [
  80. 'customHTMLtwo'
  81. ]
  82. ]
  83. ];
  84. if (array_key_exists($key, $permissions)) {
  85. return $permissions[$key];
  86. } elseif ($key == 'all') {
  87. return $permissions;
  88. } else {
  89. return [];
  90. }
  91. }
  92. public function homepageOrdercustomhtml()
  93. {
  94. if ($this->homepageItemPermissions($this->htmlHomepagePermissions('one'))) {
  95. return '
  96. <div id="' . __FUNCTION__ . '">
  97. ' . $this->config['customHTMLone'] . '
  98. </div>
  99. ';
  100. }
  101. }
  102. public function homepageOrdercustomhtmlTwo()
  103. {
  104. if ($this->homepageItemPermissions($this->htmlHomepagePermissions('two'))) {
  105. return '
  106. <div id="' . __FUNCTION__ . '">
  107. ' . $this->config['customHTMLtwo'] . '
  108. </div>
  109. ';
  110. }
  111. }
  112. }