├── index.php
├── api
├── index.php
├── deprecated.php
└── functions.php
├── lib
└── index.php
├── view
├── index.php
├── meta_box_caps.php
├── account_login.php
├── meta_box_members.php
├── meta_box_member_triggers.php
├── top_bar.php
└── meta_box_options.php
├── admin
├── index.php
├── screen_addons.php
├── screen_account.php
├── walker-nav-menu.php
├── admin.php
└── nav-menu.php
├── assets
├── index.php
├── js
│ ├── index.php
│ ├── suggest-levels.min.js
│ ├── suggest-levels.js
│ └── edit.min.js
├── css
│ ├── index.php
│ └── style.css
└── img
│ ├── index.php
│ └── icon.png
├── helpers
├── index.php
└── collection.php
├── models
├── index.php
├── level.php
└── user_level.php
├── interfaces
├── index.php
├── level.php
├── user_level.php
└── user.php
├── .gitignore
├── src
├── helpers.php
├── Repository
│ ├── RepositoryInterface.php
│ ├── AbstractRepository.php
│ ├── SettingRepository.php
│ └── SettingRepositoryInterface.php
├── Shortcode
│ ├── ShortcodeInterface.php
│ ├── ShortcodeService.php
│ ├── UserLevels.php
│ └── Restrict.php
├── Level
│ ├── Repository
│ │ ├── LevelRepositoryInterface.php
│ │ └── LevelRepository.php
│ └── LevelProvider.php
├── Support
│ ├── WPDBAwareTrait.php
│ └── InstanceTrait.php
├── Hook
│ ├── HookSubscriberInterface.php
│ ├── HookProviderTrait.php
│ └── HookService.php
├── Provider
│ ├── ProviderInterface.php
│ └── AbstractProvider.php
├── Membership
│ ├── MembershipProvider.php
│ ├── Automator
│ │ ├── UserRoleTraitAutomator.php
│ │ ├── RegistrationTriggerAutomator.php
│ │ ├── LoginStateTraitAutomator.php
│ │ ├── UserRoleTriggerAutomator.php
│ │ ├── AutomatorService.php
│ │ ├── BPMemberTypeTraitAutomator.php
│ │ ├── WooProductTriggerAutomator.php
│ │ ├── EDDProductTriggerAutomator.php
│ │ ├── GiveWPDonationTriggerAutomator.php
│ │ └── AbstractAutomator.php
│ └── QueryFilters.php
├── Container
│ ├── ContainerInterface.php
│ └── Container.php
├── Application.php
├── Module
│ ├── AdminBar.php
│ ├── AdminAccess.php
│ ├── ContentMode.php
│ └── RestApiContentProtection.php
├── Autoloader.php
└── CoreProvider.php
├── .gitmodules
├── wpml-config.xml
├── phpstan.neon
├── package.json
├── composer.json
├── .github
└── ISSUE_TEMPLATE
│ └── bug_report.md
├── phpdoc.xml
├── .php-cs-fixer.php
├── automators
└── base.php
├── gulpfile.js
├── restrict-user-access.php
├── freemius.php
└── docs
└── api
├── graphs
└── classes.html
├── reports
├── errors.html
└── markers.html
├── files
├── api-deprecated.html
├── helpers-collection.html
├── interfaces-user.html
├── interfaces-level.html
└── interfaces-user-level.html
├── packages
└── Default.html
└── css
└── template.css
/index.php:
--------------------------------------------------------------------------------
1 |
5 | * @license GPLv3
6 | * @copyright 2024 by Joachim Jensen
7 | */
8 |
--------------------------------------------------------------------------------
/src/helpers.php:
--------------------------------------------------------------------------------
1 |
5 | * @license GPLv3
6 | * @copyright 2024 by Joachim Jensen
7 | */
8 |
9 | $list_caps = new RUA_Capabilities_List();
10 | $list_caps->prepare_items();
11 | $list_caps->display();
12 |
--------------------------------------------------------------------------------
/src/Repository/RepositoryInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @license https://www.gnu.org/licenses/gpl-3.0.html
10 | */
11 | interface RepositoryInterface
12 | {
13 | }
14 |
--------------------------------------------------------------------------------
/src/Repository/AbstractRepository.php:
--------------------------------------------------------------------------------
1 |
9 | * @license https://www.gnu.org/licenses/gpl-3.0.html
10 | */
11 | abstract class AbstractRepository implements RepositoryInterface
12 | {
13 | }
14 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lib/wp-content-aware-engine"]
2 | path = lib/wp-content-aware-engine
3 | url = git@github.com:intoxstudio/wp-content-aware-engine.git
4 | [submodule "lib/wp-db-updater"]
5 | path = lib/wp-db-updater
6 | url = git@github.com:intoxstudio/wp-db-updater.git
7 | [submodule "lib/freemius"]
8 | path = lib/freemius
9 | url = git@github.com:intoxstudio/wordpress-sdk.git
10 |
--------------------------------------------------------------------------------
/src/Shortcode/ShortcodeInterface.php:
--------------------------------------------------------------------------------
1 |
9 | * @license https://www.gnu.org/licenses/gpl-3.0.html
10 | */
11 | interface ShortcodeInterface
12 | {
13 | public function get_names();
14 |
15 | public function get_callback($atts, $content = null);
16 | }
17 |
--------------------------------------------------------------------------------
/wpml-config.xml:
--------------------------------------------------------------------------------
1 |
%s
', 33 | __('Complete your Restrict User Access installation by doing one of the following:', 'restrict-user-access') 34 | ); 35 | echo '| 34 | | 35 | 36 | | 37 |
| get('handle'); echo $setting->get_title(); ?> | 40 |41 | '; 51 | ?> 52 | | 53 |
| get_title(); ?> | 56 |57 | '; 59 | echo '' . "\n"; 64 | ?> 65 | | 66 |
| get('default_access'); echo $setting->get_title(); ?> | 69 |70 | 71 | | 72 |
| get('admin_access'); echo $setting->get_title(); ?> | 75 |76 | 77 | | 78 |
| get('hide_admin_bar'); echo $setting->get_title(); ?> | 81 |82 | 83 | | 84 |
| 89 | | 90 | 91 | | 92 |
' . __('You do not have access to this screen.', 'restrict-user-access') . '
', 92 | 403 93 | ); 94 | } 95 | 96 | $freemius = rua_fs(); 97 | 98 | if ($this->enable_navbar && !$freemius->is_activation_mode()) { 99 | $path = plugin_dir_path(__FILE__) . '../view/'; 100 | $view = WPCAView::make($path . '/top_bar.php', [ 101 | 'freemius' => $freemius, 102 | 'post_type' => $this->get_restrict_type() 103 | ]); 104 | 105 | add_action('in_admin_header', [$view, 'render']); 106 | } 107 | 108 | $this->prepare_screen(); 109 | $this->add_action('admin_enqueue_scripts', 'add_general_scripts_styles', 11); 110 | } 111 | 112 | /** 113 | * Add general scripts to admin screens 114 | * 115 | * @since 1.2 116 | */ 117 | public function add_general_scripts_styles() 118 | { 119 | $this->enqueue_style('rua/admin/style', 'style'); 120 | $this->add_scripts_styles(); 121 | } 122 | 123 | /** 124 | * @return WP_Post_Type 125 | */ 126 | protected function get_restrict_type() 127 | { 128 | return get_post_type_object(RUA_App::TYPE_RESTRICT); 129 | } 130 | 131 | /** 132 | * @since 1.2 133 | * @param string $tag 134 | * @param string $callback 135 | * @param int $priority 136 | * @param int $accepted_args 137 | * 138 | * @return void 139 | */ 140 | protected function add_action($tag, $callback, $priority = 10, $accepted_args = 1) 141 | { 142 | if (is_string($callback)) { 143 | $callback = [$this, $callback]; 144 | } 145 | add_action($tag, $callback, $priority, $accepted_args); 146 | } 147 | 148 | /** 149 | * @since 1.2 150 | * @param string $tag 151 | * @param string $callback 152 | * @param int $priority 153 | * @param int $accepted_args 154 | * 155 | * @return void 156 | */ 157 | protected function add_filter($tag, $callback, $priority = 10, $accepted_args = 1) 158 | { 159 | if (is_string($callback)) { 160 | $callback = [$this, $callback]; 161 | } 162 | add_filter($tag, $callback, $priority, $accepted_args); 163 | } 164 | 165 | /** 166 | * @since 1.2 167 | * @param string $handle 168 | * @param string $filename 169 | * @param array $deps 170 | * @param bool $in_footer 171 | * @param string $ver 172 | * 173 | * @return void 174 | */ 175 | protected function enqueue_script($handle, $filename, $deps = [], $ver = '', $in_footer = false) 176 | { 177 | $this->register_script($handle, $filename, $deps, $ver, $in_footer); 178 | wp_enqueue_script($handle); 179 | } 180 | 181 | /** 182 | * @since 1.2 183 | * @param string $handle 184 | * @param string $filename 185 | * @param array $deps 186 | * @param bool $in_footer 187 | * @param string $ver 188 | * 189 | * @return void 190 | */ 191 | protected function register_script($handle, $filename, $deps = [], $ver = '', $in_footer = false) 192 | { 193 | $suffix = '.min.js'; 194 | if ($ver === '') { 195 | $ver = RUA_App::PLUGIN_VERSION; 196 | } 197 | wp_register_script($handle, plugins_url('assets/js/' . $filename . $suffix, dirname(__FILE__)), $deps, $ver, $in_footer); 198 | } 199 | 200 | /** 201 | * @since 1.2 202 | * @param string $handle 203 | * @param string $filename 204 | * @param array $deps 205 | * @param string $ver 206 | * 207 | * @return void 208 | */ 209 | protected function enqueue_style($handle, $filename, $deps = [], $ver = '') 210 | { 211 | $this->register_style($handle, $filename, $deps, $ver); 212 | wp_enqueue_style($handle); 213 | } 214 | 215 | /** 216 | * @since 1.2 217 | * @param string $handle 218 | * @param string $filename 219 | * @param array $deps 220 | * @param string $ver 221 | * 222 | * @return void 223 | */ 224 | protected function register_style($handle, $filename, $deps = [], $ver = '') 225 | { 226 | $suffix = '.css'; 227 | if ($ver === '') { 228 | $ver = RUA_App::PLUGIN_VERSION; 229 | } 230 | wp_enqueue_style($handle, plugins_url('assets/css/' . $filename . $suffix, dirname(__FILE__)), $deps, $ver); 231 | } 232 | } 233 | -------------------------------------------------------------------------------- /docs/api/packages/Default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |192 | 202 |
203 | 4 | * @license GPLv3 5 | * @copyright 2024 by Joachim Jensen 6 | */ 7 | (($,RUA,WPCA,e)=>{var r={current_section:0,sections:[],alert:null,init:function(){this.alert=new e.Views.Alert({model:new e.Models.Alert}),this.suggestUsers(),this.suggestPages(),this.tabController(),this.capController(),this.automationController(),this.extensionController(),this.handleCopyToClipboard()},extensionController:function(){var n=$("#extend_member"),a=$(".js-rua-extend-date"),t=$(".js-rua-extend-type");$(".wp-list-table.members").on("click",".js-rua-member-extend",function(e){e.preventDefault();var e=$(this),t=e.data("expiration");(t.length?(a.val(t),$(".js-rua-extend-type-1")):(a.val(a.prop("min")),$(".js-rua-extend-type-0"))).prop("checked",!0),n.data("userid",e.data("userid"))}),n.on("click",function(e){e.preventDefault(),$.ajax({url:ajaxurl,data:{user_id:$(this).data("userid"),post_id:$("#post_ID").val(),action:"rua/membership/extend",nonce:RUA.nonce,extend_date:a.val(),extend_type:t.filter(":checked").first().val()},dataType:"JSON",type:"POST",success:function(e){window.location.reload()},error:function(e,t,n){r.alert.failure(e.responseJSON.data)}})})},automationController:function(){var r=$(".js-rua-member-automations"),s=r.children().length;r.on("click",".js-rua-member-trigger-remove",function(e){e.preventDefault(),$(this).closest(".rua-member-trigger").remove()}),$(".js-rua-add-member-automator").on("change",function(e){e.preventDefault();var t,a,n=e.target.options[e.target.selectedIndex];""!==n.value&&(t=$('