customfooter.php
3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
/**
* @package AllediaFreeDefaultFiles
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright Copyright (C) Open Sources Training, LLC, All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
defined('_JEXEC') or die('Restricted access');
require_once "base.php";
/**
* Form field to show an advertisement for the pro version
*/
class JFormFieldCustomFooter extends JFormFieldBase
{
protected function getInput()
{
$html = '';
$mediaPath = JPATH_SITE . '/media/' . $this->getAttribute('media');
$mediaURI = JURI::root() . 'media/' . $this->getAttribute('media');
$logoURL = $mediaURI . "/images/joomlashack-logo.png";
$html .= $this->getStyle($mediaPath . '/css/field_customfooter.css');
$html .= $this->getStyle($mediaPath . '/css/admin-default.css');
if ($this->fromInstaller) {
$this->class .= ' installer';
}
$html .= "<div class=\"joomlashack-footer {$this->class} row-fluid\">";
$html .= "<div class=\"span-12\">";
if ((bool) $this->getAttribute('showgoproad', 0)) {
// Go Pro ad
$html .= "<div class=\"gopro-ad\">";
$html .= "<a href=\"https://www.joomlashack.com/plans/\" class=\"gopto-btn\" target=\"_blank\">";
$html .= "<i class=\"icon-publish\"></i> " . JText::_('JOOMLASHACK_FOOTER_GO_PRO_MORE_FEATURES') . "</a>";
$html .= "</div>";
}
// JED Link
$jedUrl = $this->getAttribute('jedurl');
if (!empty($jedUrl)) {
$html .= "<div class=\"joomlashack-jedlink\">";
$html .= JText::_('JOOMLASHACK_FOOTER_LIKE_THIS_EXTENSION') . " ";
$html .= "<a href=\"{$jedUrl}\" target=\"_blank\">" . JText::_('JOOMLASHACK_FOOTER_LEAVE_A_REVIEW_ON_JED') . "</a> ";
$html .= str_repeat("<i class=\"icon-star\"></i>", 5);
$html .= "</div>";
}
// Powered by
$html .= "<div class=\"poweredby\">Powered by ";
$html .= "<a href=\"https://www.joomlashack.com\" target=\"_blank\">";
$html .= "<img class=\"joomlashack-logo\" src=\"{$logoURL}\" width=\"150\" />";
$html .= "</a></div>";
// Copyright
$year = date('Y');
$html .= "<div class=\"joomlashack-copyright\">© {$year} Joomlashack.com. All rights reserved.</div>";
$html .= "</div></div>";
// Add the JS code that will move the footer out of the params container
if (version_compare(JVERSION, '3.0', 'lt')) {
$html .= "
<script>
var footer = document.getElementsByClassName('joomlashack-footer')[0];
if (footer.parentElement.tagName === 'LI'
|| footer.parentElement.parentElement.id === 'element-box') {
var wrapper = document.getElementById('element-box').parentNode.parentNode;
wrapper.insertBefore(footer, wrapper.nextSibling);
}
</script>";
} else {
$html .= "
<script>
document.addEventListener('DOMContentLoaded', function(event) {
var footer = document.getElementsByClassName('joomlashack-footer')[0],
parent = footer.parentElement;
function hasClass(elem, className) {
return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
}
if (hasClass(parent, 'controls')) {
var wrapper = document.getElementById('content');
wrapper.parentNode.insertBefore(footer, wrapper.nextSibling);
}
});
</script>";
}
return $html;
}
}