| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145 |
- <?php
- trait HTMLHomepageItem
- {
- public function htmlOneSettingsArray()
- {
- return array(
- 'name' => 'CustomHTML-1',
- 'enabled' => strpos('personal,business', $this->config['license']) !== false,
- 'image' => 'plugins/images/tabs/custom1.png',
- 'category' => 'Custom',
- 'settings' => array(
- 'Enable' => array(
- array(
- 'type' => 'switch',
- 'name' => 'homepageCustomHTMLoneEnabled',
- 'label' => 'Enable',
- 'value' => $this->config['homepageCustomHTMLoneEnabled']
- ),
- array(
- 'type' => 'select',
- 'name' => 'homepageCustomHTMLoneAuth',
- 'label' => 'Minimum Authentication',
- 'value' => $this->config['homepageCustomHTMLoneAuth'],
- 'options' => $this->groupOptions
- )
- ),
- 'Code' => array(
- array(
- 'type' => 'textbox',
- 'name' => 'customHTMLone',
- 'class' => 'hidden customHTMLoneTextarea',
- 'label' => '',
- 'value' => $this->config['customHTMLone'],
- ),
- array(
- 'type' => 'html',
- 'override' => 12,
- 'label' => 'Custom HTML/JavaScript',
- 'html' => '<button type="button" class="hidden savecustomHTMLoneTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLoneEditor" style="height:300px">' . htmlentities($this->config['customHTMLone']) . '</div>'
- ),
- )
- )
- );
- }
-
- public function htmlTwoSettingsArray()
- {
- return array(
- 'name' => 'CustomHTML-2',
- 'enabled' => strpos('personal,business', $this->config['license']) !== false,
- 'image' => 'plugins/images/tabs/custom2.png',
- 'category' => 'Custom',
- 'settings' => array(
- 'Enable' => array(
- array(
- 'type' => 'switch',
- 'name' => 'homepageCustomHTMLtwoEnabled',
- 'label' => 'Enable',
- 'value' => $this->config['homepageCustomHTMLtwoEnabled']
- ),
- array(
- 'type' => 'select',
- 'name' => 'homepageCustomHTMLtwoAuth',
- 'label' => 'Minimum Authentication',
- 'value' => $this->config['homepageCustomHTMLtwoAuth'],
- 'options' => $this->groupOptions
- )
- ),
- 'Code' => array(
- array(
- 'type' => 'textbox',
- 'name' => 'customHTMLtwo',
- 'class' => 'hidden customHTMLtwoTextarea',
- 'label' => '',
- 'value' => $this->config['customHTMLtwo'],
- ),
- array(
- 'type' => 'html',
- 'override' => 12,
- 'label' => 'Custom HTML/JavaScript',
- 'html' => '<button type="button" class="hidden savecustomHTMLtwoTextarea btn btn-info btn-circle pull-right m-r-5 m-l-10"><i class="fa fa-save"></i> </button><div id="customHTMLtwoEditor" style="height:300px">' . htmlentities($this->config['customHTMLtwo']) . '</div>'
- ),
- )
- )
- );
- }
-
- public function htmlHomepagePermissions($key = null)
- {
- $permissions = [
- 'one' => [
- 'enabled' => [
- 'homepageCustomHTMLoneEnabled'
- ],
- 'auth' => [
- 'homepageCustomHTMLoneAuth'
- ],
- 'not_empty' => [
- 'customHTMLone'
- ]
- ],
- 'two' => [
- 'enabled' => [
- 'homepageCustomHTMLtwoEnabled'
- ],
- 'auth' => [
- 'homepageCustomHTMLtwoAuth'
- ],
- 'not_empty' => [
- 'customHTMLtwo'
- ]
- ]
- ];
- if (array_key_exists($key, $permissions)) {
- return $permissions[$key];
- } elseif ($key == 'all') {
- return $permissions;
- } else {
- return [];
- }
- }
-
- public function homepageOrdercustomhtml()
- {
- if ($this->homepageItemPermissions($this->htmlHomepagePermissions('one'))) {
- return '
- <div id="' . __FUNCTION__ . '">
- ' . $this->config['customHTMLone'] . '
- </div>
- ';
- }
- }
-
- public function homepageOrdercustomhtmlTwo()
- {
- if ($this->homepageItemPermissions($this->htmlHomepagePermissions('two'))) {
- return '
- <div id="' . __FUNCTION__ . '">
- ' . $this->config['customHTMLtwo'] . '
- </div>
- ';
- }
- }
- }
|