PluginProbe ʕ •ᴥ•ʔ
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel / trunk
Photo Gallery by FooGallery : Responsive Image Gallery, Masonry Gallery & Carousel vtrunk
trunk 1.10.3 2.0.24 2.1.34 2.2.44 2.3.3 2.4.32 3.0.6 3.1.11 3.1.12 3.1.13 3.1.20 3.1.25 3.1.26 3.1.26.1 3.1.26.2
foogallery / freemius / templates / connect / permissions-group.php
foogallery / freemius / templates / connect Last commit date
index.php 3 years ago permission.php 3 years ago permissions-group.php 3 years ago
permissions-group.php
72 lines
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>