| 1 |
<?php |
| 2 |
|
| 3 |
/******************************************* |
| 4 |
* Restrict Content Settings Page |
| 5 |
*******************************************/ |
| 6 |
|
| 7 |
|
| 8 |
function rc_settings_page() |
| 9 |
{ |
| 10 |
global $rc_options; |
| 11 |
|
| 12 |
?> |
| 13 |
<div class="wrap"> |
| 14 |
<div id="upb-wrap" class="upb-help"> |
| 15 |
<h2><?php _e('Restrict Content Settings', 'restrict-content'); ?></h2> |
| 16 |
<?php |
| 17 |
if ( ! isset( $_REQUEST['updated'] ) ) |
| 18 |
$_REQUEST['updated'] = false; |
| 19 |
?> |
| 20 |
<?php if ( false !== $_REQUEST['updated'] ) : ?> |
| 21 |
<div class="updated fade"><p><strong><?php _e( 'Options saved', 'restrict-content'); ?> ); ?></strong></p></div> |
| 22 |
<?php endif; ?> |
| 23 |
<form method="post" action="options.php"> |
| 24 |
|
| 25 |
<?php settings_fields( 'rc_settings_group' ); ?> |
| 26 |
|
| 27 |
<table class="form-table"> |
| 28 |
<tr valign="top"> |
| 29 |
<th colspan="2"><strong><?php _e('Short Code Messages', 'restrict-content'); ?></strong></th> |
| 30 |
</tr> |
| 31 |
<tr valign="top"> |
| 32 |
<th><?php _e('Restricted Message', 'restrict-content'); ?></th> |
| 33 |
<td> |
| 34 |
<input id="rc_settings[shortcode_message]" class="large-text" name="rc_settings[shortcode_message]" type="text" value="<?php echo isset( $rc_options['shortcode_message'] ) ? esc_html( $rc_options['shortcode_message'] ) : ''; ?>" /><br/> |
| 35 |
<label class="description" for="rc_settings[shortcode_message]"><?php _e( 'When using the [restrict ... ] .... [/restrict] Short Code, this is the message displayed when a user does not have the appropriate permissions.', 'restrict-content'); ?></label><br/> |
| 36 |
<small style="color: #666;"><?php _e('The <strong>{userlevel}</strong> tag will be automatically replaced with the permission level needed.', 'restrict-content'); ?></small> |
| 37 |
</td> |
| 38 |
</tr> |
| 39 |
<tr> |
| 40 |
<th colspan="2"><strong><?php _e('User Level Restriction Messages', 'restrict-content'); ?></strong></th> |
| 41 |
</tr> |
| 42 |
<tr valign="top"> |
| 43 |
<th><?php _e('Adminstrators', 'restrict-content'); ?></th> |
| 44 |
<td> |
| 45 |
<input id="rc_settings[administrator_message]" class="large-text" name="rc_settings[administrator_message]" type="text" value="<?php echo isset( $rc_options['administrator_message'] ) ? esc_html( $rc_options['administrator_message'] ) : '';?>" /><br/> |
| 46 |
<label class="description" for="rc_settings[administrator_message]"><?php _e( 'Message displayed when a user does not have permission to view Adminstrator restricted content', 'restrict-content' ); ?></label><br/> |
| 47 |
</td> |
| 48 |
</tr> |
| 49 |
<tr valign="top"> |
| 50 |
<th><?php _e('Editors', 'restrict-content'); ?></th> |
| 51 |
<td> |
| 52 |
<input id="rc_settings[editor_message]" class="large-text" name="rc_settings[editor_message]" type="text" value="<?php echo isset( $rc_options['editor_message'] ) ? esc_html( $rc_options['editor_message'] ) : '';?>" /><br/> |
| 53 |
<label class="description" for="rc_settings[editor_message]"><?php _e( 'Message displayed when a user does not have permission to view Editor restricted content', 'restrict-content' ); ?></label><br/> |
| 54 |
</td> |
| 55 |
</tr> |
| 56 |
<tr valign="top"> |
| 57 |
<th><?php _e('Authors', 'restrict-content'); ?></th> |
| 58 |
<td> |
| 59 |
<input id="rc_settings[author_message]" class="large-text" name="rc_settings[author_message]" type="text" value="<?php echo isset( $rc_options['author_message'] ) ? esc_html( $rc_options['author_message'] ) : '';?>" /><br/> |
| 60 |
<label class="description" for="rc_settings[author_message]"><?php _e( 'Message displayed when a user does not have permission to view Author restricted content', 'restrict-content' ); ?></label><br/> |
| 61 |
</td> |
| 62 |
</tr> |
| 63 |
<tr valign="top"> |
| 64 |
<th><?php _e('Contributors', 'restrict-content'); ?></th> |
| 65 |
<td> |
| 66 |
<input id="rc_settings[contributor_message]" class="large-text" name="rc_settings[contributor_message]" type="text" value="<?php echo isset( $rc_options['contributor_message'] ) ? esc_html( $rc_options['contributor_message'] ) : '';?>" /><br/> |
| 67 |
<label class="description" for="rc_settings[contributor_message]"><?php _e( 'Message displayed when a user does not have permission to view Contributor restricted content', 'restrict-content' ); ?></label><br/> |
| 68 |
</td> |
| 69 |
</tr> |
| 70 |
<tr valign="top"> |
| 71 |
<th><?php _e('Subscribers', 'restrict-content'); ?></th> |
| 72 |
<td> |
| 73 |
<input id="rc_settings[subscriber_message]" class="large-text" name="rc_settings[subscriber_message]" type="text" value="<?php echo isset( $rc_options['subscriber_message'] ) ? esc_html( $rc_options['subscriber_message'] ) : '';?>" /><br/> |
| 74 |
<label class="description" for="rc_settings[subscriber_message]"><?php _e( 'Message displayed when a user does not have permission to view Subscriber restricted content', 'restrict-content' ); ?></label><br/> |
| 75 |
</td> |
| 76 |
</tr> |
| 77 |
</table> |
| 78 |
|
| 79 |
<!-- save the options --> |
| 80 |
<p class="submit"> |
| 81 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Options', 'restrict-content' ); ?>" /> |
| 82 |
</p> |
| 83 |
|
| 84 |
|
| 85 |
</form> |
| 86 |
</div><!--end sf-wrap--> |
| 87 |
</div><!--end wrap--> |
| 88 |
|
| 89 |
<?php |
| 90 |
} |
| 91 |
|
| 92 |
// register the plugin settings |
| 93 |
function rc_register_settings() { |
| 94 |
|
| 95 |
// create whitelist of options |
| 96 |
register_setting( 'rc_settings_group', 'rc_settings' ); |
| 97 |
} |
| 98 |
//call register settings function |
| 99 |
add_action( 'admin_init', 'rc_register_settings' ); |
| 100 |
|
| 101 |
|
| 102 |
function rc_settings_menu() { |
| 103 |
|
| 104 |
// add settings page |
| 105 |
add_submenu_page('options-general.php', __('Restrict Content Settings', 'restrict-content'), __('Restrict Content', 'restrict-content'), 'manage_options', 'restrict-content-settings', 'rc_settings_page'); |
| 106 |
} |
| 107 |
add_action('admin_menu', 'rc_settings_menu'); |
| 108 |
|
| 109 |
|
| 110 |
function rc_contextual_help($contextual_help, $screen_id, $screen) { |
| 111 |
|
| 112 |
ob_start(); ?> |
| 113 |
|
| 114 |
<h3>HTML Class Names</h3> |
| 115 |
<p>The selectors below can be used in your CSS to customize the look of your bookmark links, the add / remove bookmark links, and more.</p> |
| 116 |
<p><strong>User Bookmark List Selectors</strong></p> |
| 117 |
<ul> |
| 118 |
<li><em>ul.upb-bookmarks-list</em> - this is the unordered list wrapper that contains a user's bookmark links</li> |
| 119 |
<li><em>li.rc_bookmark</em> - this wraps each bookmark link</li> |
| 120 |
<li><em>a.rc_bookmark_link</em> - this is the bookmark's anchor link</li> |
| 121 |
<li><em>a.rc_del_bookmark</em> - this is the delete link next to each bookmark in the user's list</li> |
| 122 |
</ul> |
| 123 |
|
| 124 |
<p><strong>Add / Remove Bookmark Controls</strong></p> |
| 125 |
<ul> |
| 126 |
<li><em>div.rc_add_remove_links</em> - this is the DIV tag that wraps the add / remove links, if enabled</li> |
| 127 |
<li><em>a.rc_bookmark_control</em> - this is the generic class given to both add and remove bookmark links</li> |
| 128 |
<li><em>a.rc_del_bookmark</em> - this is the remove bookmark link class</li> |
| 129 |
<li><em>a.rc_add_bookmark</em> - this is the add bookmark link class</li> |
| 130 |
</ul> |
| 131 |
|
| 132 |
<p><strong>Most Popular Bookmarks List</strong></p> |
| 133 |
<ul> |
| 134 |
<li><em>ul.rc_most_popular_bookmarks</em> - this is the UL that wraps the most popular bookmarks list</li> |
| 135 |
<li><em>li.popular_bookmark</em> - this is LI tag that wraps each popular bookmark link</li> |
| 136 |
<li><em>a.popular_bookmark_link</em> - this is anchor tag for each popular bookmark link</li> |
| 137 |
</ul> |
| 138 |
|
| 139 |
<?php |
| 140 |
return ob_get_clean(); |
| 141 |
} |
| 142 |
if (isset($_GET['page']) && $_GET['page'] == 'bookmarks-settings') |
| 143 |
{ |
| 144 |
add_action('contextual_help', 'rc_contextual_help', 10, 3); |
| 145 |
} |