SmallworldCorePreload::eventCoreIncludeCommonEnd()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
/*
3
 * You may not change or alter any portion of this comment or credits
4
 * of supporting developers from this source code or any supporting source code
5
 * which is considered copyrighted (c) material of the original comment or credit authors.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10
 */
11
12
/**
13
 * SmallWorld
14
 *
15
 * @package      \XoopsModules\Smallworld
16
 * @license      GNU GPL (https://www.gnu.org/licenses/gpl-2.0.html/)
17
 * @copyright    The XOOPS Project (https://xoops.org)
18
 * @copyright    2011 Culex
19
 * @author       Michael Albertsen (http://culex.dk) <[email protected]>
20
 * @link         https://github.com/XoopsModules25x/smallworld
21
 * @since        1.0
22
 */
23
24
defined('XOOPS_ROOT_PATH') || die('Restricted access');
25
require_once XOOPS_ROOT_PATH . '/modules/smallworld/include/functions.php';
26
27
/**
28
 * Class SmallworldCorePreload
29
 */
30
class SmallworldCorePreload extends \XoopsPreloadItem
31
{
32
    // to add PSR-4 autoloader
33
    /**
34
     * @param $args
35
     */
36
    public static function eventCoreIncludeCommonEnd($args)
37
    {
38
        include __DIR__ . '/autoloader.php';
39
    }
40
41
    public static function eventCoreHeaderAddmeta()
42
    {
43
        //Load language if not defined
44
        smallworld_isDefinedLanguage('_SMALLWORLD_SYSERROR', 'main.php');
45
		
46
		// Include jquery new or framework ?
47
		$jq  = "if(jQuery.fn.jquery.split('.')" . "\n";
48
		$jq .= ".map(function(i){return('0'+i).slice(-2)})" . "\n";
49
		$jq .= "		.join('.') > '01.08.03')" . "\n";
50
		$jq .= "	{" . "\n";
51
		$jq .= "		console.log('yes! Version is ' + jQuery.fn.jquery);" . "\n";
52
		$jq .= "	}" . "\n";
53
		$jq .= "	else" . "\n";
54
		$jq .= "	{" . "\n";
55
		$jq .= "		console.log('no! Version is ' + jQuery.fn.jquery);" . "\n";
56
		$jq .= "		var script = document.createElement('script');" . "\n";
57
		$jq .= "		script.src = 'https://code.jquery.com/jquery-latest.min.js';" . "\n";
58
		$jq .= "		script.type = 'text/javascript';" . "\n";
59
		$jq .= "		document.getElementsByTagName('head')[0].appendChild(script);" . "\n";
60
		$jq .= "	};";
61
		//$GLOBALS['xoTheme']->addScript(null, array( 'type' => 'text/javascript' ), $jq, 'CheckJquery');
62
		
63
        //$GLOBALS['xoTheme']->addScript("http://code.jquery.com/jquery-1.9.1.js");
64
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.min.js');
65
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jqueryui.min.js');
66
        //$GLOBALS['xoTheme']->addScript("http://code.jquery.com/ui/1.10.2/jquery-ui.js");
67
        $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/smallworld/assets/css/base/jquery.ui.all.css');
68
        $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/smallworld/assets/css/smallworld.css');
69
70
        //Get variables
71
        smallworld_SetCoreScript();
72
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.colorbox.js');
73
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.validate.js');
74
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.validation.functions.js');
75
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.stepy.js');
76
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.elastic.source.js');
77
        $GLOBALS['xoTheme']->addStylesheet(XOOPS_URL . '/modules/smallworld/assets/css/smallworld.css');
78
79
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/jquery.countdown.js');
80
81
        if (file_exists(XOOPS_ROOT_PATH . '/modules/smallworld/language/' . $GLOBALS['xoopsConfig']['language'] . '/js/jquery.ui.datepicker-language.js')) {
82
            $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/language/' . $GLOBALS['xoopsConfig']['language'] . '/js/jquery.ui.datepicker-language.js');
83
            $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/language/' . $GLOBALS['xoopsConfig']['language'] . '/js/jquery.countdown.js');
84
        } else {
85
            $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/language/english/js/jquery.ui.datepicker-language.js');
86
            $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/language/english/js/jquery.countdown.js');
87
        }
88
        $GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/smallworld.js');
89
		//$GLOBALS['xoTheme']->addScript(XOOPS_URL . '/modules/smallworld/assets/js/domaps.js');
90
    }
91
}
92