access-denied-redirect.php
1 year ago
admin-toolbar.php
1 year ago
api-route.php
1 year ago
backend-menu.php
1 year ago
capability.php
1 year ago
content.php
1 year ago
identity.php
1 year ago
jwt.php
5 months ago
login-redirect.php
1 year ago
logout-redirect.php
1 year ago
metabox.php
1 year ago
not-found-redirect.php
1 year ago
policy.php
1 year ago
url.php
1 year ago
welcome.php
1 year ago
widget.php
1 year ago
widget.php
187 lines
| 1 | <?php /** @version 7.0.0 **/ ?> |
| 2 | |
| 3 | <?php if (defined('AAM_KEY')) { ?> |
| 4 | <?php |
| 5 | $access_level = AAM_Backend_AccessLevel::get_instance(); |
| 6 | $service = $access_level->widgets(); |
| 7 | ?> |
| 8 | <div class="aam-feature" id="widget-content"> |
| 9 | <?php if (AAM::api()->config->get('core.settings.ui.tips')) { ?> |
| 10 | <div class="row"> |
| 11 | <div class="col-xs-12"> |
| 12 | <p class="aam-info"> |
| 13 | <?php echo AAM_Backend_View::replace_aam_urls( |
| 14 | __('Manage access to WordPress widgets on both admin dashboard and frontend. The premium %sadd-on%s also allows defining default visibility for all widgets.', 'advanced-access-manager'), |
| 15 | '/premium' |
| 16 | ); ?> |
| 17 | </p> |
| 18 | </div> |
| 19 | </div> |
| 20 | <?php } ?> |
| 21 | |
| 22 | <div class="aam-feature-top-actions text-right"> |
| 23 | <a |
| 24 | href="#" |
| 25 | class="btn btn-xs btn-primary" |
| 26 | id="refresh_widget_list" |
| 27 | ><i class="icon-arrows-cw"></i> <?php echo __('Refresh', 'advanced-access-manager'); ?></a> |
| 28 | </div> |
| 29 | |
| 30 | <div class="row"> |
| 31 | <div class="col-xs-12"> |
| 32 | <div class="aam-overwrite" id="aam-widget-overwrite" style="display: <?php echo ($service->is_customized() ? 'block' : 'none'); ?>"> |
| 33 | <span><i class="icon-check"></i> <?php echo __('Settings are customized', 'advanced-access-manager'); ?></span> |
| 34 | <span><a href="#" id="widget_reset" class="btn btn-xs btn-primary"><?php echo __('Reset to default', 'advanced-access-manager'); ?></a></span> |
| 35 | </div> |
| 36 | </div> |
| 37 | </div> |
| 38 | |
| 39 | <?php |
| 40 | $first = false; |
| 41 | $list = AAM_Service_Widgets::get_instance()->get_widget_list($service); |
| 42 | |
| 43 | // Group all the components by screen |
| 44 | $grouped = [ |
| 45 | 'dashboard' => [], |
| 46 | 'frontend' => [] |
| 47 | ]; |
| 48 | |
| 49 | foreach($list as $item) { |
| 50 | $screen = $item['area']; |
| 51 | |
| 52 | array_push($grouped[$screen], $item); |
| 53 | } |
| 54 | ?> |
| 55 | |
| 56 | <?php if (!empty($list)) { ?> |
| 57 | <div class="panel-group" id="widget-list" role="tablist"> |
| 58 | <?php foreach ($grouped as $area => $widgets) { ?> |
| 59 | <div class="panel panel-default"> |
| 60 | <div class="panel-heading" role="tab" id="group-<?php echo esc_js($area); ?>-heading"> |
| 61 | <h4 class="panel-title"> |
| 62 | <a |
| 63 | role="button" |
| 64 | data-toggle="collapse" |
| 65 | data-parent="#widget-list" |
| 66 | href="#group-<?php echo esc_js($area); ?>" |
| 67 | aria-controls="group-<?php echo esc_js($area); ?>" |
| 68 | <?php if (!$first) { echo 'aria-expanded="true"'; } ?> |
| 69 | > |
| 70 | <?php |
| 71 | switch ($area) { |
| 72 | case 'dashboard': |
| 73 | echo __('Dashboard Widgets', 'advanced-access-manager'); |
| 74 | break; |
| 75 | |
| 76 | case 'frontend': |
| 77 | echo AAM_Backend_View_Helper::preparePhrase('Frontend Widgets [(including Appearance->Widgets)]', 'small'); |
| 78 | break; |
| 79 | |
| 80 | default: |
| 81 | break; |
| 82 | } |
| 83 | ?> |
| 84 | </a> |
| 85 | </h4> |
| 86 | </div> |
| 87 | <div |
| 88 | id="group-<?php echo esc_js($area); ?>" |
| 89 | class="panel-collapse collapse<?php if (!$first) { echo ' in'; $first = true; } ?>" |
| 90 | role="tabpanel" |
| 91 | aria-labelledby="group-<?php echo esc_js($area); ?>-heading" |
| 92 | > |
| 93 | <div class="panel-body"> |
| 94 | <div class="row"> |
| 95 | <?php foreach ($widgets as $widget) { ?> |
| 96 | <div class="col-xs-12 col-md-6 aam-submenu-item"> |
| 97 | <div class="aam-menu-details"> |
| 98 | <?php echo esc_js($widget['title']); ?> |
| 99 | <small><a |
| 100 | href="#widget_details_modal" |
| 101 | data-toggle="modal" |
| 102 | data-title="<?php echo esc_attr($widget['title']); ?>" |
| 103 | data-screen="<?php echo esc_attr($area); ?>" |
| 104 | data-id="<?php echo esc_attr($widget['slug']); ?>" |
| 105 | class="aam-widget-item"><?php echo __('more details', 'advanced-access-manager'); ?> |
| 106 | </a></small> |
| 107 | </div> |
| 108 | |
| 109 | <?php if ($widget['is_restricted']) { ?> |
| 110 | <i |
| 111 | class="aam-accordion-action icon-lock text-danger" |
| 112 | id="widget_<?php echo esc_attr($widget['slug']); ?>" |
| 113 | data-widget="<?php echo esc_attr($widget['slug']); ?>" |
| 114 | ></i> |
| 115 | <?php } else { ?> |
| 116 | <i |
| 117 | class="aam-accordion-action icon-lock-open text-success" |
| 118 | id="widget_<?php echo esc_attr($widget['slug']); ?>" |
| 119 | data-widget="<?php echo esc_attr($widget['slug']); ?>" |
| 120 | ></i> |
| 121 | <?php } ?> |
| 122 | |
| 123 | <label |
| 124 | for="widget_<?php echo esc_attr($widget['slug']); ?>" |
| 125 | data-toggle="tooltip" |
| 126 | title="<?php echo ($widget['is_restricted'] ? __('Uncheck to show', 'advanced-access-manager') : __('Check to hide', 'advanced-access-manager')); ?>" |
| 127 | ></label> |
| 128 | </div> |
| 129 | <?php } ?> |
| 130 | </div> |
| 131 | |
| 132 | <?php echo apply_filters( |
| 133 | 'aam_ui_widgets_screen_mode_filter', |
| 134 | '', |
| 135 | AAM_Backend_AccessLevel::get_instance(), |
| 136 | $area |
| 137 | ); ?> |
| 138 | </div> |
| 139 | </div> |
| 140 | </div> |
| 141 | <?php } ?> |
| 142 | </div> |
| 143 | <?php } else { ?> |
| 144 | <div class="row"> |
| 145 | <div class="col-xs-12 text-center"> |
| 146 | <p class="alert alert-info text-larger"> |
| 147 | <?php echo __('The list is not initialized. Select the "Refresh" button above.', 'advanced-access-manager'); ?> |
| 148 | </p> |
| 149 | </div> |
| 150 | </div> |
| 151 | <?php } ?> |
| 152 | |
| 153 | <div class="hidden" id="aam_widget_screen_list"><?php echo json_encode($this->get_screen_urls()); ?></div> |
| 154 | |
| 155 | <div class="modal fade" id="widget_details_modal" tabindex="-1" role="dialog"> |
| 156 | <div class="modal-dialog" role="document"> |
| 157 | <div class="modal-content"> |
| 158 | <div class="modal-header"> |
| 159 | <button type="button" class="close" data-dismiss="modal" aria-label="<?php echo __('Close', 'advanced-access-manager'); ?>"><span aria-hidden="true">×</span></button> |
| 160 | <h4 class="modal-title"><?php echo __('Widget Details', 'advanced-access-manager'); ?></h4> |
| 161 | </div> |
| 162 | <div class="modal-body"> |
| 163 | <table class="table table-striped table-bordered"> |
| 164 | <tbody> |
| 165 | <tr> |
| 166 | <th width="20%"><?php echo __('Title', 'advanced-access-manager'); ?></th> |
| 167 | <td id="widget_title"></td> |
| 168 | </tr> |
| 169 | <tr> |
| 170 | <th width="20%"><?php echo __('Area', 'advanced-access-manager'); ?></th> |
| 171 | <td id="widget_screen_id"></td> |
| 172 | </tr> |
| 173 | <tr> |
| 174 | <th width="20%"><?php echo __('Widget Slug', 'advanced-access-manager'); ?></th> |
| 175 | <td id="widget_id"></td> |
| 176 | </tr> |
| 177 | </tbody> |
| 178 | </table> |
| 179 | </div> |
| 180 | <div class="modal-footer"> |
| 181 | <button type="button" class="btn btn-default" data-dismiss="modal"><?php echo __('Close', 'advanced-access-manager'); ?></button> |
| 182 | </div> |
| 183 | </div> |
| 184 | </div> |
| 185 | </div> |
| 186 | </div> |
| 187 | <?php } |