Helper.php
1.86 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
<?php
/**
* @package OSSystem
* @contact www.joomlashack.com, help@joomlashack.com
* @copyright 2016 Open Source Training, LLC. All rights reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
namespace Alledia\OSSystem;
use Alledia\Framework\Joomla\Extension;
use Alledia\Framework;
use JFile;
use JResponse;
defined('_JEXEC') or die();
jimport('joomla.filesystem.file');
/**
* Helper class
*/
abstract class Helper
{
public static function addCustomFooterIntoNativeComponentOutput($element)
{
// Check if the specified extension is from Alledia
$extension = Extension\Helper::getExtensionForElement($element);
$footer = $extension->getFooterMarkup();
if (!empty($footer)) {
// Inject the custom footer
if (version_compare(JVERSION, '3.0', 'lt')) {
$body = JResponse::getBody();
$body = preg_replace('#(<p\salign="center">Joomla!\s[0-9.\s&;]*</p>)#i', $footer . '$1', $body);
JResponse::setBody($body);
} else {
$app = Framework\Factory::getApplication();
$app->setBody(
str_replace('</section>', '</section>' . $footer, $app->getBody())
);
}
}
}
public static function revertCARootFileToOriginal()
{
// Get the original Joomla file
$joomlaCACertificatesPath = JPATH_SITE . '/libraries/joomla/http/transport/cacert.pem';
$backupCACertificatesPath = JPATH_SITE . '/libraries/joomla/http/transport/cacert.pem.ossystem-backup';
if (file_exists($backupCACertificatesPath)) {
if (file_exists($joomlaCACertificatesPath)) {
JFile::delete($joomlaCACertificatesPath);
}
JFile::move($backupCACertificatesPath, $joomlaCACertificatesPath);
}
}
}