xref: /plugin/combo/ComboStrap/PageProtection.php (revision 37748cd8654635afbeca80942126742f0f4cc346)
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
16use syntax_plugin_combo_tooltip;
17
18/**
19 * Class PageProtection handles the protection of page against
20 * public agent such as low quality page or late publication
21 *
22 * @package ComboStrap
23 *
24 * The test are in two separate classes {@link \LowQualityPageTest}
25 * and {@link \PublicationTest}
26 */
27class PageProtection
28{
29
30    const NAME = "page-protection";
31    const ACRONYM = "pp";
32
33    /**
34     * The possible values
35     */
36    const CONF_VALUE_ACL = "acl";
37    const CONF_VALUE_HIDDEN = "hidden";
38    const CONF_VALUE_ROBOT = "robot";
39    const CONF_VALUE_FEED = "feed";
40
41
42    const PAGE_PROTECTION_LINK_WARNING = "warning";
43    const PAGE_PROTECTION_LINK_NORMAL = "normal";
44    const PAGE_PROTECTION_LINK_LOGIN = "login";
45
46
47    /**
48     * Add the Javascript snippet
49     * We have created only one because a page
50     * may be of low quality and with a late publication.
51     * To resolve conflict between the two protections, the parameters are the same
52     * and the late publication takes precedence on low quality page
53     */
54    public static function addPageProtectionSnippet()
55    {
56        syntax_plugin_combo_tooltip::addToolTipSnippetIfNeeded();
57        PluginUtility::getSnippetManager()->attachJavascriptSnippetForBar(self::NAME);
58    }
59
60}
61