Completed
Push — master ( 5fe85d...a4e09c )
by Michael
01:40
created
class/common/traitversionchecks.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -16,77 +16,77 @@
 block discarded – undo
16 16
  */
17 17
 trait VersionChecks
18 18
 {
19
-    /**
20
-     *
21
-     * Verifies XOOPS version meets minimum requirements for this module
22
-     * @static
23
-     * @param \XoopsModule|null $module
24
-     *
25
-     * @param null|string $requiredVer
26
-     * @return bool true if meets requirements, false if not
27
-     */
28
-    public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
29
-    {
30
-        $moduleDirName = basename(dirname(dirname(__DIR__)));
31
-        if (null === $module) {
32
-            $module = XoopsModule::getByDirname($moduleDirName);
33
-        }
34
-        xoops_loadLanguage('admin', $moduleDirName);
35
-        //check for minimum XOOPS version
36
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
37
-        $currArray  = explode('.', $currentVer);
38
-        if (null === $requiredVer) {
39
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
40
-        }
41
-        $reqArray = explode('.', $requiredVer);
42
-        $success  = true;
43
-        foreach ($reqArray as $k => $v) {
44
-            if (isset($currArray[$k])) {
45
-                if ($currArray[$k] > $v) {
46
-                    break;
47
-                } elseif ($currArray[$k] == $v) {
48
-                    continue;
49
-                } else {
50
-                    $success = false;
51
-                    break;
52
-                }
53
-            } else {
54
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
55
-                    $success = false;
56
-                    break;
57
-                }
58
-            }
59
-        }
19
+	/**
20
+	 *
21
+	 * Verifies XOOPS version meets minimum requirements for this module
22
+	 * @static
23
+	 * @param \XoopsModule|null $module
24
+	 *
25
+	 * @param null|string $requiredVer
26
+	 * @return bool true if meets requirements, false if not
27
+	 */
28
+	public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
29
+	{
30
+		$moduleDirName = basename(dirname(dirname(__DIR__)));
31
+		if (null === $module) {
32
+			$module = XoopsModule::getByDirname($moduleDirName);
33
+		}
34
+		xoops_loadLanguage('admin', $moduleDirName);
35
+		//check for minimum XOOPS version
36
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
37
+		$currArray  = explode('.', $currentVer);
38
+		if (null === $requiredVer) {
39
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
40
+		}
41
+		$reqArray = explode('.', $requiredVer);
42
+		$success  = true;
43
+		foreach ($reqArray as $k => $v) {
44
+			if (isset($currArray[$k])) {
45
+				if ($currArray[$k] > $v) {
46
+					break;
47
+				} elseif ($currArray[$k] == $v) {
48
+					continue;
49
+				} else {
50
+					$success = false;
51
+					break;
52
+				}
53
+			} else {
54
+				if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
55
+					$success = false;
56
+					break;
57
+				}
58
+			}
59
+		}
60 60
 
61
-        if (false === $success) {
62
-            $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
63
-        }
61
+		if (false === $success) {
62
+			$module->setErrors(sprintf(_AM_WFL_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
63
+		}
64 64
 
65
-        return $success;
66
-    }
65
+		return $success;
66
+	}
67 67
 
68
-    /**
69
-     *
70
-     * Verifies PHP version meets minimum requirements for this module
71
-     * @static
72
-     * @param \XoopsModule $module
73
-     *
74
-     * @return bool true if meets requirements, false if not
75
-     */
76
-    public static function checkVerPhp(\XoopsModule $module)
77
-    {
78
-        xoops_loadLanguage('admin', $module->dirname());
79
-        // check for minimum PHP version
80
-        $success = true;
81
-        $verNum  = PHP_VERSION;
82
-        $reqVer  = $module->getInfo('min_php');
83
-        if (false !== $reqVer && '' !== $reqVer) {
84
-            if (version_compare($verNum, $reqVer, '<')) {
85
-                $module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum));
86
-                $success = false;
87
-            }
88
-        }
68
+	/**
69
+	 *
70
+	 * Verifies PHP version meets minimum requirements for this module
71
+	 * @static
72
+	 * @param \XoopsModule $module
73
+	 *
74
+	 * @return bool true if meets requirements, false if not
75
+	 */
76
+	public static function checkVerPhp(\XoopsModule $module)
77
+	{
78
+		xoops_loadLanguage('admin', $module->dirname());
79
+		// check for minimum PHP version
80
+		$success = true;
81
+		$verNum  = PHP_VERSION;
82
+		$reqVer  = $module->getInfo('min_php');
83
+		if (false !== $reqVer && '' !== $reqVer) {
84
+			if (version_compare($verNum, $reqVer, '<')) {
85
+				$module->setErrors(sprintf(_AM_WFL_ERROR_BAD_PHP, $reqVer, $verNum));
86
+				$success = false;
87
+			}
88
+		}
89 89
 
90
-        return $success;
91
-    }
90
+		return $success;
91
+	}
92 92
 }
Please login to merge, or discard this patch.
class/common/breadcrumb.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -32,48 +32,48 @@
 block discarded – undo
32 32
  */
33 33
 class Breadcrumb
34 34
 {
35
-    public $dirname;
36
-    private $bread = [];
35
+	public $dirname;
36
+	private $bread = [];
37 37
 
38
-    /**
39
-     *
40
-     */
41
-    public function __construct()
42
-    {
43
-        $this->dirname = basename(dirname(__DIR__));
44
-    }
38
+	/**
39
+	 *
40
+	 */
41
+	public function __construct()
42
+	{
43
+		$this->dirname = basename(dirname(__DIR__));
44
+	}
45 45
 
46
-    /**
47
-     * Add link to breadcrumb
48
-     *
49
-     * @param string $title
50
-     * @param string $link
51
-     */
52
-    public function addLink($title = '', $link = '')
53
-    {
54
-        $this->bread[] = [
55
-            'link'  => $link,
56
-            'title' => $title
57
-        ];
58
-    }
46
+	/**
47
+	 * Add link to breadcrumb
48
+	 *
49
+	 * @param string $title
50
+	 * @param string $link
51
+	 */
52
+	public function addLink($title = '', $link = '')
53
+	{
54
+		$this->bread[] = [
55
+			'link'  => $link,
56
+			'title' => $title
57
+		];
58
+	}
59 59
 
60
-    /**
61
-     * Render Pedigree BreadCrumb
62
-     *
63
-     */
64
-    public function render()
65
-    {
66
-        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
67
-            require_once $GLOBALS['xoops']->path('class/theme.php');
68
-            $GLOBALS['xoTheme'] = new xos_opal_Theme();
69
-        }
60
+	/**
61
+	 * Render Pedigree BreadCrumb
62
+	 *
63
+	 */
64
+	public function render()
65
+	{
66
+		if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
67
+			require_once $GLOBALS['xoops']->path('class/theme.php');
68
+			$GLOBALS['xoTheme'] = new xos_opal_Theme();
69
+		}
70 70
 
71
-        require_once $GLOBALS['xoops']->path('class/template.php');
72
-        $breadcrumbTpl = new XoopsTpl();
73
-        $breadcrumbTpl->assign('breadcrumb', $this->bread);
74
-        $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
75
-        unset($breadcrumbTpl);
71
+		require_once $GLOBALS['xoops']->path('class/template.php');
72
+		$breadcrumbTpl = new XoopsTpl();
73
+		$breadcrumbTpl->assign('breadcrumb', $this->bread);
74
+		$html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
75
+		unset($breadcrumbTpl);
76 76
 
77
-        return $html;
78
-    }
77
+		return $html;
78
+	}
79 79
 }
Please login to merge, or discard this patch.
class/utility.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -14,63 +14,63 @@
 block discarded – undo
14 14
  */
15 15
 class InstructionUtility
16 16
 {
17
-    use common\VersionChecks; //checkVerXoops, checkVerPhp Traits
17
+	use common\VersionChecks; //checkVerXoops, checkVerPhp Traits
18 18
 
19
-    use common\ServerStats; // getServerStats Trait
19
+	use common\ServerStats; // getServerStats Trait
20 20
 
21
-    use common\FilesManagement; // Files Management Trait
21
+	use common\FilesManagement; // Files Management Trait
22 22
 
23
-    // Права
24
-    public static function getItemIds($permtype = 'instruction_view')
25
-    {
26
-        //global $xoopsUser;
27
-        static $permissions = [];
28
-        // Если есть в статике
29
-        if (is_array($permissions) && array_key_exists($permtype, $permissions)) {
30
-            return $permissions[$permtype];
31
-        }
32
-        // Находим из базы
33
-        $moduleHandler          = xoops_getHandler('module');
34
-        $instrModule            = $moduleHandler->getByDirname('instruction');
35
-        $groups                 = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
36
-        $gpermHandler           = xoops_getHandler('groupperm');
37
-        $categories             = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid'));
38
-        $permissions[$permtype] = $categories;
39
-        return $categories;
40
-    }
23
+	// Права
24
+	public static function getItemIds($permtype = 'instruction_view')
25
+	{
26
+		//global $xoopsUser;
27
+		static $permissions = [];
28
+		// Если есть в статике
29
+		if (is_array($permissions) && array_key_exists($permtype, $permissions)) {
30
+			return $permissions[$permtype];
31
+		}
32
+		// Находим из базы
33
+		$moduleHandler          = xoops_getHandler('module');
34
+		$instrModule            = $moduleHandler->getByDirname('instruction');
35
+		$groups                 = is_object($GLOBALS['xoopsUser']) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
36
+		$gpermHandler           = xoops_getHandler('groupperm');
37
+		$categories             = $gpermHandler->getItemIds($permtype, $groups, $instrModule->getVar('mid'));
38
+		$permissions[$permtype] = $categories;
39
+		return $categories;
40
+	}
41 41
 
42
-    // Редактор
43
-    public static function getWysiwygForm($caption, $name, $value = '')
44
-    {
45
-        $editor                   = false;
46
-        $editor_configs           = [];
47
-        $editor_configs['name']   = $name;
48
-        $editor_configs['value']  = $value;
49
-        $editor_configs['rows']   = 35;
50
-        $editor_configs['cols']   = 60;
51
-        $editor_configs['width']  = '100%';
52
-        $editor_configs['height'] = '350px';
53
-        $editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction'));
42
+	// Редактор
43
+	public static function getWysiwygForm($caption, $name, $value = '')
44
+	{
45
+		$editor                   = false;
46
+		$editor_configs           = [];
47
+		$editor_configs['name']   = $name;
48
+		$editor_configs['value']  = $value;
49
+		$editor_configs['rows']   = 35;
50
+		$editor_configs['cols']   = 60;
51
+		$editor_configs['width']  = '100%';
52
+		$editor_configs['height'] = '350px';
53
+		$editor_configs['editor'] = strtolower(xoops_getModuleOption('form_options', 'instruction'));
54 54
 
55
-        $editor = new XoopsFormEditor($caption, $name, $editor_configs);
56
-        return $editor;
57
-    }
55
+		$editor = new XoopsFormEditor($caption, $name, $editor_configs);
56
+		return $editor;
57
+	}
58 58
 
59
-    // Получение значения переменной, переданной через GET или POST запрос
60
-    public static function cleanVars(&$global, $key, $default = '', $type = 'int')
61
-    {
62
-        switch ($type) {
63
-            case 'string':
64
-                $ret = isset($global[$key]) ? $global[$key] : $default;
65
-                break;
66
-            case 'int':
67
-            default:
68
-                $ret = isset($global[$key]) ? (int)$global[$key] : (int)$default;
69
-                break;
70
-        }
71
-        if (false === $ret) {
72
-            return $default;
73
-        }
74
-        return $ret;
75
-    }
59
+	// Получение значения переменной, переданной через GET или POST запрос
60
+	public static function cleanVars(&$global, $key, $default = '', $type = 'int')
61
+	{
62
+		switch ($type) {
63
+			case 'string':
64
+				$ret = isset($global[$key]) ? $global[$key] : $default;
65
+				break;
66
+			case 'int':
67
+			default:
68
+				$ret = isset($global[$key]) ? (int)$global[$key] : (int)$default;
69
+				break;
70
+		}
71
+		if (false === $ret) {
72
+			return $default;
73
+		}
74
+		return $ret;
75
+	}
76 76
 }
Please login to merge, or discard this patch.