include.view-sidebar.php
5 years ago
include.view.php
5 years ago
index.php
5 years ago
view.access-condition.php
5 years ago
view.contentbox.php
5 years ago
include.view.php
98 lines
| 1 | <?php |
| 2 | |
| 3 | use ProfilePress\Core\ContentProtection\ContentConditions; |
| 4 | use ProfilePress\Core\ContentProtection\SettingsPage; |
| 5 | use ProfilePress\Core\Classes\PROFILEPRESS_sql as PR; |
| 6 | |
| 7 | $dbData = PR::get_meta_value(absint(ppress_var($_GET,'id')), SettingsPage::META_DATA_KEY); |
| 8 | |
| 9 | $contentToRestrictData = ppress_var($dbData, 'content'); |
| 10 | |
| 11 | $accessConditionData = ppress_var($dbData, 'access_condition'); |
| 12 | |
| 13 | add_action('add_meta_boxes', function () use ($contentToRestrictData) { |
| 14 | add_meta_box( |
| 15 | 'ppress-content-protection-content', |
| 16 | esc_html__('Content to Protect', 'wp-user-avatar'), |
| 17 | function () use ($contentToRestrictData) { |
| 18 | require dirname(__FILE__) . '/view.contentbox.php'; |
| 19 | }, |
| 20 | 'ppcontentprotection' |
| 21 | ); |
| 22 | }); |
| 23 | |
| 24 | add_action('add_meta_boxes', function () use ($accessConditionData) { |
| 25 | add_meta_box( |
| 26 | 'ppress-content-protection-access', |
| 27 | esc_html__('Access Condition', 'wp-user-avatar'), |
| 28 | function () use ($accessConditionData) { |
| 29 | require dirname(__FILE__) . '/view.access-condition.php'; |
| 30 | }, |
| 31 | 'ppcontentprotection' |
| 32 | ); |
| 33 | }); |
| 34 | |
| 35 | add_action('add_meta_boxes', function () { |
| 36 | add_meta_box( |
| 37 | 'submitdiv', |
| 38 | __('Publish', 'wp-user-avatar'), |
| 39 | function () { |
| 40 | require dirname(__FILE__) . '/include.view-sidebar.php'; |
| 41 | }, |
| 42 | 'ppcontentprotection', |
| 43 | 'sidebar' |
| 44 | ); |
| 45 | }); |
| 46 | |
| 47 | do_action('add_meta_boxes', 'ppcontentprotection', ''); |
| 48 | ?> |
| 49 | <style type="text/css"> |
| 50 | .handle-actions { |
| 51 | display: none |
| 52 | } |
| 53 | |
| 54 | .pp-content-protection-access-box th { |
| 55 | width: 33%; |
| 56 | } |
| 57 | </style> |
| 58 | <script type="text/javascript"> |
| 59 | var ppress_cr_nonce = '<?= wp_create_nonce('ppress_cr_nonce'); ?>'; |
| 60 | var ppress_cr_conditions = <?php echo json_encode(ContentConditions::get_instance()->get_conditions()); ?>; |
| 61 | </script> |
| 62 | <div id="poststuff"> |
| 63 | <div id="post-body" class="metabox-holder columns-2"> |
| 64 | <div id="post-body-content"> |
| 65 | <div id="titlediv"> |
| 66 | <div id="titlewrap"> |
| 67 | <label class="screen-reader-text" id="title"><?= esc_html__('Add title', 'wp-user-avatar') ?></label> |
| 68 | <?php $postedData = ppress_var($_POST, 'ppress_cc_data', []); ?> |
| 69 | <input value="<?= ppressPOST_var('title', ppress_var($dbData, 'title'), false, $postedData) ?>" style="width:100%!important;max-width:100%!important;" type="text" name="ppress_cc_data[title]" id="title"> |
| 70 | </div> |
| 71 | </div> |
| 72 | </div> |
| 73 | |
| 74 | <div id="postbox-container-1" class="postbox-container"> |
| 75 | <?php do_meta_boxes('ppcontentprotection', 'sidebar', ''); ?> |
| 76 | </div> |
| 77 | <div id="postbox-container-2" class="postbox-container"> |
| 78 | <?php do_meta_boxes('ppcontentprotection', 'advanced', ''); ?> |
| 79 | </div> |
| 80 | </div> |
| 81 | <br class="clear"> |
| 82 | </div> |
| 83 | |
| 84 | <script type="text/html" id="tmpl-ppress-cr-or-rule"> |
| 85 | <?php ContentConditions::get_instance()->rule_row('{{data.facetListId}}', '{{data.facetId}}'); ?> |
| 86 | </script> |
| 87 | |
| 88 | <script type="text/html" id="tmpl-ppress-cr-and-rule"> |
| 89 | <?php ContentConditions::get_instance()->rules_group_row('{{data.facetListId}}', '{{data.facetId}}'); ?> |
| 90 | </script> |
| 91 | |
| 92 | <script type="text/html" id="tmpl-ppress-cr-unlinked-and-rule-badge"> |
| 93 | <?php ContentConditions::get_instance()->unlinked_and_rule_badge(); ?> |
| 94 | </script> |
| 95 | |
| 96 | <script type="text/html" id="tmpl-ppress-cr-linked-and-rule-badge"> |
| 97 | <?php ContentConditions::get_instance()->linked_and_rule_badge(); ?> |
| 98 | </script> |