| 1 |
<?php |
| 2 |
/** |
| 3 |
* Authorizer |
| 4 |
* |
| 5 |
* @license GPL-2.0+ |
| 6 |
* @link https://github.com/uhm-coe/authorizer |
| 7 |
* @package authorizer |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace Authorizer\Options; |
| 11 |
|
| 12 |
use Authorizer\Helper; |
| 13 |
use Authorizer\Options; |
| 14 |
|
| 15 |
/** |
| 16 |
* Contains functions for rendering the External Service tab in Authorizer Settings. |
| 17 |
*/ |
| 18 |
class External extends \Authorizer\Singleton { |
| 19 |
|
| 20 |
/** |
| 21 |
* Settings print callback. |
| 22 |
* |
| 23 |
* @param array $args Args (e.g., multisite admin mode). |
| 24 |
* @return void |
| 25 |
*/ |
| 26 |
public function print_section_info_external( $args = '' ) { |
| 27 |
?> |
| 28 |
<div id="section_info_external" class="section_info"> |
| 29 |
<p><?php esc_html_e( 'Enter your external server settings below.', 'authorizer' ); ?></p> |
| 30 |
</div> |
| 31 |
<?php |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
/** |
| 36 |
* Settings print callback. |
| 37 |
* |
| 38 |
* @param array $args Args (e.g., multisite admin mode). |
| 39 |
* @return void |
| 40 |
*/ |
| 41 |
public function print_section_info_external_oauth2( $args = '' ) { |
| 42 |
?> |
| 43 |
<div id="section_info_external_oauth2" class="section_info"> |
| 44 |
<p><?php esc_html_e( 'Enter your OAuth2 server settings below.', 'authorizer' ); ?></p> |
| 45 |
</div> |
| 46 |
<?php |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
/** |
| 51 |
* Settings print callback. |
| 52 |
* |
| 53 |
* @param array $args Args (e.g., multisite admin mode). |
| 54 |
* @return void |
| 55 |
*/ |
| 56 |
public function print_section_info_external_google( $args = '' ) { |
| 57 |
?> |
| 58 |
<div id="section_info_external_google" class="section_info"> |
| 59 |
<p><?php esc_html_e( 'Enter your Google server settings below.', 'authorizer' ); ?></p> |
| 60 |
</div> |
| 61 |
<?php |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
/** |
| 66 |
* Settings print callback. |
| 67 |
* |
| 68 |
* @param array $args Args (e.g., multisite admin mode). |
| 69 |
* @return void |
| 70 |
*/ |
| 71 |
public function print_section_info_external_cas( $args = '' ) { |
| 72 |
?> |
| 73 |
<div id="section_info_external_cas" class="section_info"> |
| 74 |
<p><?php esc_html_e( 'Enter your CAS server settings below.', 'authorizer' ); ?></p> |
| 75 |
</div> |
| 76 |
<?php |
| 77 |
} |
| 78 |
|
| 79 |
|
| 80 |
/** |
| 81 |
* Settings print callback. |
| 82 |
* |
| 83 |
* @param array $args Args (e.g., multisite admin mode). |
| 84 |
* @return void |
| 85 |
*/ |
| 86 |
public function print_section_info_external_oidc( $args = '' ) { |
| 87 |
?> |
| 88 |
<div id="section_info_external_oidc" class="section_info"> |
| 89 |
<p><?php esc_html_e( 'Enter your OIDC server settings below.', 'authorizer' ); ?></p> |
| 90 |
</div> |
| 91 |
<?php |
| 92 |
} |
| 93 |
|
| 94 |
|
| 95 |
/** |
| 96 |
* Settings print callback. |
| 97 |
* |
| 98 |
* @param array $args Args (e.g., multisite admin mode). |
| 99 |
* @return void |
| 100 |
*/ |
| 101 |
public function print_section_info_external_ldap( $args = '' ) { |
| 102 |
?> |
| 103 |
<div id="section_info_external_ldap" class="section_info"> |
| 104 |
<p><?php esc_html_e( 'Enter your LDAP server settings below.', 'authorizer' ); ?></p> |
| 105 |
</div> |
| 106 |
<?php |
| 107 |
} |
| 108 |
|
| 109 |
|
| 110 |
/** |
| 111 |
* Settings print callback. |
| 112 |
* |
| 113 |
* @param array $args Args (e.g., multisite admin mode). |
| 114 |
* @return void |
| 115 |
*/ |
| 116 |
public function print_select_auth_access_default_role( $args = '' ) { |
| 117 |
// Get plugin option. |
| 118 |
$options = Options::get_instance(); |
| 119 |
$option = 'access_default_role'; |
| 120 |
$auth_settings_option = $options->get( $option, Helper::get_context( $args ), 'allow override', 'print overlay' ); |
| 121 |
|
| 122 |
// Print option elements. |
| 123 |
?> |
| 124 |
<select id="auth_settings_<?php echo esc_attr( $option ); ?>" name="auth_settings[<?php echo esc_attr( $option ); ?>]"> |
| 125 |
<?php wp_dropdown_roles( $auth_settings_option ); ?> |
| 126 |
<option value=""<?php selected( '' === $auth_settings_option ); ?>><?php esc_html_e( '-- None --', 'authorizer' ); ?></option> |
| 127 |
</select> |
| 128 |
<?php |
| 129 |
} |
| 130 |
} |
| 131 |
|