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
15
16require_once('PluginUtility.php');
17
18/**
19 * Class LowQualityPage
20 * @package ComboStrap
21 *
22 */
23class LowQualityPage
24{
25
26    const LOW_QUALITY_PROTECTION_ACRONYM = "LQPP"; // low quality page protection
27    const CONF_LOW_QUALITY_PAGE_PROTECTION_ENABLE = "lowQualityPageProtectionEnable";
28
29    /**
30     *
31     */
32    const CONF_LOW_QUALITY_PAGE_PROTECTION_MODE = "lowQualityPageProtectionMode";
33
34    const CONF_LOW_QUALITY_PAGE_LINK_TYPE = "lowQualityPageLinkType";
35    const CLASS_SUFFIX = "low-quality-page";
36    public const LOW_QUALITY_PAGE_CANONICAL = "low_quality_page";
37    public const LQPP_CANONICAL = "lqpp";
38
39    public static function getLowQualityProtectionMode()
40    {
41        if (SiteConfig::getConfValue(LowQualityPage::CONF_LOW_QUALITY_PAGE_PROTECTION_ENABLE, true)) {
42            return SiteConfig::getConfValue(LowQualityPage::CONF_LOW_QUALITY_PAGE_PROTECTION_MODE, PageProtection::CONF_VALUE_ACL);
43        } else {
44            return false;
45        }
46    }
47
48    /**
49     * The protection does not occur on the HTML
50     * because the created page is valid for a anonymous or logged-in user
51     * @return mixed|null
52     */
53    public static function isProtectionEnabled()
54    {
55
56        return SiteConfig::getConfValue(LowQualityPage::CONF_LOW_QUALITY_PAGE_PROTECTION_ENABLE, true);
57
58    }
59
60    public static function getLowQualityLinkType()
61    {
62
63        return SiteConfig::getConfValue(LowQualityPage::CONF_LOW_QUALITY_PAGE_LINK_TYPE, PageProtection::PAGE_PROTECTION_LINK_NORMAL);
64
65    }
66
67}
68