xref: /plugin/combo/ComboStrap/Bootstrap.php (revision c3437056399326d621a01da73b649707fbb0ae69)
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        if (Site::isStrapTemplate()) {
37            $loaded = PluginUtility::loadStrapUtilityTemplateIfPresentAndSameVersion();
38            if ($loaded) {
39                $bootstrapVersion = TplUtility::getBootStrapVersion();
40                return $bootstrapVersion[0];
41            }
42        }
43
44        return PluginUtility::getConfValue(self::CONF_BOOTSTRAP_MAJOR_VERSION, self::BootStrapDefaultMajorVersion);
45
46
47    }
48}
49