New plugin HTML Code

This commit is contained in:
Diego Najar 2018-01-07 12:45:47 +01:00
parent 6fb9dcda85
commit d4bda55521
2 changed files with 24 additions and 5 deletions

View File

@ -2,6 +2,9 @@
"plugin-data": "plugin-data":
{ {
"name": "HTML Code", "name": "HTML Code",
"description": "Add HTML, CSS or Javascript code in the header or footer of your site." "description": "Add HTML, CSS or Javascript code in the head metadata, header or footer of your site."
} },
"insert-code-in-the-theme-inside-the-tag-head": "Insert code in the theme inside the tag <head> </head>",
"insert-code-in-the-theme-at-the-top": "Insert code in the theme at the top.",
"insert-code-in-the-theme-at-the-bottom": "IInsert code in the theme at the bottom."
} }

View File

@ -5,6 +5,7 @@ class pluginHTMLCode extends Plugin {
public function init() public function init()
{ {
$this->dbFields = array( $this->dbFields = array(
'head'=>'',
'header'=>'', 'header'=>'',
'footer'=>'' 'footer'=>''
); );
@ -12,20 +13,35 @@ class pluginHTMLCode extends Plugin {
public function form() public function form()
{ {
global $Language;
$html = '<div>'; $html = '<div>';
$html .= '<label>Header</label>'; $html .= '<label>Theme Head</label>';
$html .= '<textarea name="header" id="jsheader">'.$this->getValue('header').'</textarea>'; $html .= '<textarea name="head" id="jshead">'.$this->getValue('head').'</textarea>';
$html .= '<span class="tip">'.$Language->get('insert-code-in-the-theme-inside-the-tag-head').'</span>';
$html .= '</div>'; $html .= '</div>';
$html .= '<div>'; $html .= '<div>';
$html .= '<label>Footer</label>'; $html .= '<label>Theme Header</label>';
$html .= '<textarea name="header" id="jsheader">'.$this->getValue('header').'</textarea>';
$html .= '<span class="tip">'.$Language->get('insert-code-in-the-theme-at-the-top').'</span>';
$html .= '</div>';
$html .= '<div>';
$html .= '<label>Theme Footer</label>';
$html .= '<textarea name="footer" id="jsfooter">'.$this->getValue('footer').'</textarea>'; $html .= '<textarea name="footer" id="jsfooter">'.$this->getValue('footer').'</textarea>';
$html .= '<span class="tip">'.$Language->get('insert-code-in-the-theme-at-the-bottom').'</span>';
$html .= '</div>'; $html .= '</div>';
return $html; return $html;
} }
public function siteHead() public function siteHead()
{
return html_entity_decode($this->getValue('head'));
}
public function siteBodyBegin()
{ {
return html_entity_decode($this->getValue('header')); return html_entity_decode($this->getValue('header'));
} }