xref: /plugin/combo/ComboStrap/Bootstrap.php (revision 977ce05d19d8dab0a70c9a27f8da0b7039299e82)
1<?php
2/**
3 * Copyright (c) 2021. ComboStrap, Inc. and its affiliates. All Rights Reserved.
4 *
5 * This source code is licensed under the GPL license found in the
6 * COPYING  file in the root directory of this source tree.
7 *
8 * @license  GPL 3 (https://www.gnu.org/licenses/gpl-3.0.en.html)
9 * @author   ComboStrap <support@combostrap.com>
10 *
11 */
12
13namespace ComboStrap;
14
15class Bootstrap
16{
17
18    const BootStrapDefaultMajorVersion = "5";
19    const BootStrapFiveMajorVersion = "5";
20
21    const CONF_BOOTSTRAP_MAJOR_VERSION = "bootstrapMajorVersion";
22    const BootStrapFourMajorVersion = "4";
23    const CANONICAL = "bootstrap";
24
25    public static function getDataNamespace()
26    {
27        $dataToggleNamespace = "";
28        if (self::getBootStrapMajorVersion() == self::BootStrapFiveMajorVersion) {
29            $dataToggleNamespace = "-bs";
30        }
31        return $dataToggleNamespace;
32    }
33
34    public static function getBootStrapMajorVersion()
35    {
36        $default = PluginUtility::getConfValue(self::CONF_BOOTSTRAP_MAJOR_VERSION, self::BootStrapDefaultMajorVersion);
37        if (Site::isStrapTemplate()) {
38            try {
39                Site::loadStrapUtilityTemplateIfPresentAndSameVersion();
40            } catch (ExceptionCombo $e) {
41                return $default;
42            }
43            $bootstrapVersion = TplUtility::getBootStrapVersion();
44            return $bootstrapVersion[0];
45        }
46        return $default;
47
48
49    }
50}
51