Code Duplication    Length = 33-33 lines in 2 locations

class/utilities.php 1 location

@@ 40-72 (lines=33) @@
37
     *
38
     * @return bool true if meets requirements, false if not
39
     */
40
    public static function checkXoopsVer(XoopsModule $module)
41
    {
42
        xoops_loadLanguage('admin', $module->dirname());
43
        //check for minimum XOOPS version
44
        $currentVer  = substr(XOOPS_VERSION, 6); // get the numeric part of string
45
        $currArray   = explode('.', $currentVer);
46
        $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
47
        $reqArray    = explode('.', $requiredVer);
48
        $success     = true;
49
        foreach ($reqArray as $k => $v) {
50
            if (isset($currArray[$k])) {
51
                if ($currArray[$k] > $v) {
52
                    break;
53
                } elseif ($currArray[$k] == $v) {
54
                    continue;
55
                } else {
56
                    $success = false;
57
                    break;
58
                }
59
            } else {
60
                if ((int)$v > 0) { // handles things like x.x.x.0_RC2
61
                    $success = false;
62
                    break;
63
                }
64
            }
65
        }
66
67
        if (!$success) {
68
            $module->setErrors(sprintf(_AM_TAG_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
69
        }
70
71
        return $success;
72
    }
73
74
    /**
75
     *

class/utility.php 1 location

@@ 88-120 (lines=33) @@
85
     *
86
     * @return bool true if meets requirements, false if not
87
     */
88
    public static function checkVerXoops(XoopsModule $module)
89
    {
90
        xoops_loadLanguage('admin', $module->dirname());
91
        //check for minimum XOOPS version
92
        $currentVer  = substr(XOOPS_VERSION, 6); // get the numeric part of string
93
        $currArray   = explode('.', $currentVer);
94
        $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
95
        $reqArray    = explode('.', $requiredVer);
96
        $success     = true;
97
        foreach ($reqArray as $k => $v) {
98
            if (isset($currArray[$k])) {
99
                if ($currArray[$k] > $v) {
100
                    break;
101
                } elseif ($currArray[$k] == $v) {
102
                    continue;
103
                } else {
104
                    $success = false;
105
                    break;
106
                }
107
            } else {
108
                if ((int)$v > 0) { // handles things like x.x.x.0_RC2
109
                    $success = false;
110
                    break;
111
                }
112
            }
113
        }
114
115
        if (!$success) {
116
            $module->setErrors(sprintf(_AM_XXXXX_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
117
        }
118
119
        return $success;
120
    }
121
122
    /**
123
     *