PluginProbe
Age Gate / 3.7.3
Age Gate v3.7.3
3.7.3 trunk 1.0.0 1.0.1 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 All 113 releases
age-gate / src / Resources / views / admin / post / meta-box.php

meta-box.php in Age Gate 3.7.3, at src/Resources/views/admin/post/meta-box.php

44 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 $checked = false;
3
4 if ($content->getType() === 'term') {
5 $checked = get_term_meta($content->getID(), $contentOption, true);
6 } else {
7 $checked = get_post_meta($content->getID(), $contentOption, true);
8 }
9
10 $restricted = $settings->type === 'all' ? !$checked : $checked;
11 ?>
12
13 <div class="ag-post-metabox">
14 <h4 class="ag-post-metabox__title" data-age="<?php echo esc_attr($content->getAge()) ?>" data-text-restrict="<?php echo esc_attr($settings->anonymous ? __('Restricted', 'age-gate') : __('Restricted to {0}', 'age-gate')) ?>" data-text-unrestrict="<?php echo esc_attr(__('Unrestricted', 'age-gate')) ?>">
15 <i class="dashicons <?php echo esc_attr($restricted ? 'dashicons-lock' : 'dashicons-unlock') ?>"></i>
16 <span class="ag-post-metabox__text">
17 <?php /* translators: 1: Current content age restriction */ ?>
18 <?php echo ($restricted ? esc_html($settings->anonymous ? __('Restricted', 'age-gate') : sprintf(__('Restricted to %s', 'age-gate'), $content->getAge())) : esc_html(__('Unrestricted', 'age-gate'))) ?>
19 </span>
20 <?php if ($settings->multiAge && $setAge && !$settings->anonymous) : ?>
21 <button type="button" class="button-link ag-post-metabox__age-toggle"<?php echo (!$restricted ? ' style="display: none;"' : ''); ?>><?php echo esc_html__('Change', 'age-gate' ) ?></button>
22 <?php endif; ?>
23 </h4>
24
25 <?php if ($settings->multiAge && $setAge && !$settings->anonymous) : ?>
26 <?php $this->insert('post/meta/age') ?>
27 <?php endif; ?>
28
29 <?php if ($setRestriction) : ?>
30 <div class="ag-post-metabox__item">
31 <?php $this->insert('post/type/' . $settings->type, ['checked' => $checked]) ?>
32 </div>
33 <?php endif; ?>
34 <?php if ($content->getType() === 'post' && !$checked && $content->getRestricted() && $settings->type === 'selected') : ?>
35 <?php
36 $inherited = collect($content->getTerms())->where( 'age', $content->getAge())->first();
37 if ($inherited) : ?>
38 <?php /* translators: 1: Current content age restriction. 2: Term name */ ?>
39 <p><?php echo esc_html(sprintf(__('This content is unrestricted, but is inheriting an %1$s restriction from term %1$s', 'age-gate'), $content->getAge(), $inherited->name)) ?></p>
40 <?php endif; ?>
41 <?php endif; ?>
42 <?php wp_nonce_field( 'age_gate_post_edit', '_agn') ?>
43 </div>
44