PluginProbe
TablePress – Tables in WordPress made easy / 3.3.3
TablePress – Tables in WordPress made easy v3.3.3
3.3.4 3.3.3 3.3.2 3.3.1 trunk 1.12 1.14 1.9.2 2.0.4 2.1.7 2.1.8 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3 2.3.1 2.3.2 2.4 2.4.1 2.4.2 2.4.3 2.4.4 All 44 releases
tablepress / libraries / freemius / templates / connect / permissions-group.php

permissions-group.php in TablePress – Tables in WordPress made easy 3.3.3, at libraries/freemius/templates/connect/permissions-group.php

72 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2022, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 2.5.1
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 *
16 * @var array $permission_group {
17 * @type Freemius $fs
18 * @type string $id
19 * @type string $desc
20 * @type array $prompt
21 * @type array $permissions
22 * @type bool $is_enabled
23 * }
24 */
25 $permission_group = $VARS;
26
27 $fs = $permission_group[ 'fs' ];
28
29 $permission_manager = FS_Permission_Manager::instance( $fs );
30
31 $opt_out_text = $fs->get_text_x_inline( 'Opt Out', 'verb', 'opt-out' );
32 $opt_in_text = $fs->get_text_x_inline( 'Opt In', 'verb', 'opt-in' );
33
34 if ( empty( $permission_group[ 'prompt' ] ) ) {
35 $is_enabled = false;
36
37 foreach ( $permission_group[ 'permissions' ] as $permission ) {
38 if ( true === $permission[ 'default' ] ) {
39 // Even if one of the permissions is on, treat as if the entire group is on.
40 $is_enabled = true;
41 break;
42 }
43 }
44 } else {
45 $is_enabled = ( isset( $permission_group['is_enabled'] ) && true === $permission_group['is_enabled'] );
46 }
47 ?>
48 <div class="fs-permissions-section fs-<?php echo esc_attr( $permission_group[ 'id' ] ) ?>-permissions">
49 <div>
50 <div class="fs-permissions-section--header">
51 <a class="fs-group-opt-out-button"
52 data-type="<?php echo esc_attr( $permission_group['type'] ) ?>"
53 data-group-id="<?php echo esc_attr( $permission_group[ 'id' ] ) ?>"
54 data-is-enabled="<?php echo $is_enabled ? 'true' : 'false' ?>"
55 href="#"><?php echo esc_html( $is_enabled ? $opt_out_text : $opt_in_text ) ?></a>
56 <span class="fs-permissions-section--header-title"><?php
57 // The title is already HTML-escaped.
58 echo $permission_group[ 'title' ]
59 ?></span>
60 </div>
61 <p class="fs-permissions-section--desc"><?php
62 // The description is already HTML-escaped.
63 echo $permission_group['desc']
64 ?></p></div>
65 <ul>
66 <?php
67 foreach ( $permission_group['permissions'] as $permission ) {
68 $permission_manager->render_permission( $permission );
69 }
70 ?>
71 </ul>
72 </div>