functions.php
4.37 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<?php
/**
* @package Regular Labs Library
* @version 18.2.10140
*
* @author Peter van Westen <info@regularlabs.com>
* @link http://www.regularlabs.com
* @copyright Copyright © 2018 Regular Labs All Rights Reserved
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
*/
/* @DEPRECATED */
defined('_JEXEC') or die;
if (is_file(JPATH_LIBRARIES . '/regularlabs/autoload.php'))
{
require_once JPATH_LIBRARIES . '/regularlabs/autoload.php';
}
use RegularLabs\Library\Document as RL_Document;
use RegularLabs\Library\Extension as RL_Extension;
use RegularLabs\Library\File as RL_File;
use RegularLabs\Library\Http as RL_Http;
use RegularLabs\Library\Language as RL_Language;
use RegularLabs\Library\Xml as RL_Xml;
/**
* Framework Functions
*/
class RLFunctions
{
public static function getContents($url, $timeout = 20)
{
return ! class_exists('RegularLabs\Library\Http') ? '' : RL_Http::get($url, $timeout);
}
public static function getByUrl($url, $timeout = 20)
{
return ! class_exists('RegularLabs\Library\Http') ? '' : RL_Http::getFromServer($url, $timeout);
}
public static function isFeed()
{
return class_exists('RegularLabs\Library\Document') && RL_Document::isFeed();
}
public static function script($file, $version = '')
{
class_exists('RegularLabs\Library\Document') && RL_Document::script($file, $version);
}
public static function stylesheet($file, $version = '')
{
class_exists('RegularLabs\Library\Document') && RL_Document::stylesheet($file, $version);
}
public static function addScriptVersion($url)
{
jimport('joomla.filesystem.file');
$version = '';
if (JFile::exists(JPATH_SITE . $url))
{
$version = filemtime(JPATH_SITE . $url);
}
self::script($url, $version);
}
public static function addStyleSheetVersion($url)
{
jimport('joomla.filesystem.file');
$version = '';
if (JFile::exists(JPATH_SITE . $url))
{
$version = filemtime(JPATH_SITE . $url);
}
self::stylesheet($url, $version);
}
protected static function getFileByFolder($folder, $file)
{
return ! class_exists('RegularLabs\Library\File') ? '' : RL_File::getMediaFile($folder, $file);
}
public static function getComponentBuffer()
{
return ! class_exists('RegularLabs\Library\Document') ? '' : RL_Document::getBuffer();
}
public static function getAliasAndElement(&$name)
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getAliasAndElement($name);
}
public static function getNameByAlias($alias)
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getNameByAlias($alias);
}
public static function getAliasByName($name)
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getAliasByName($name);
}
public static function getElementByAlias($alias)
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getElementByAlias($alias);
}
public static function getXMLValue($key, $alias, $type = 'component', $folder = 'system')
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getXMLValue($key, $alias, $type, $folder);
}
public static function getXML($alias, $type = 'component', $folder = 'system')
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getXML($alias, $type, $folder);
}
public static function getXMLFile($alias, $type = 'component', $folder = 'system')
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getXMLFile($alias, $type, $folder);
}
public static function extensionInstalled($extension, $type = 'component', $folder = 'system')
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::isInstalled($extension, $type, $folder);
}
public static function getExtensionPath($extension = 'plg_system_regularlabs', $basePath = JPATH_ADMINISTRATOR, $check_folder = '')
{
return ! class_exists('RegularLabs\Library\Extension') ? '' : RL_Extension::getPath($extension, $basePath, $check_folder);
}
public static function loadLanguage($extension = 'plg_system_regularlabs', $basePath = '', $reload = false)
{
return class_exists('RegularLabs\Library\Language') && RL_Language::load($extension, $basePath, $reload);
}
public static function xmlToObject($url, $root = '')
{
return ! class_exists('RegularLabs\Library\Xml') ? '' : RL_Xml::toObject($url, $root);
}
}