Tarea #997 -> Indicadores rojos en las pestañas git-svn-id: https://192.168.0.254/svn/Proyectos.ASong2U_Web/trunk@118 cd1a4ea2-8c7f-e448-aada-19d1fee9e1d6
140 lines
6.3 KiB
PHP
140 lines
6.3 KiB
PHP
<?php
|
|
|
|
// this file contains all settings pages and options
|
|
|
|
function mar_settings_page()
|
|
{
|
|
global $mar_options;
|
|
?>
|
|
<div class="wrap">
|
|
<div id="upb-wrap" class="upb-help">
|
|
<h2>Mark as Read Settings</h2>
|
|
<?php
|
|
if ( ! isset( $_REQUEST['updated'] ) )
|
|
$_REQUEST['updated'] = false;
|
|
?>
|
|
<?php if ( false !== $_REQUEST['updated'] ) : ?>
|
|
<div class="updated fade"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
|
|
<?php endif; ?>
|
|
<form method="post" action="options.php">
|
|
|
|
<?php settings_fields( 'mar_settings_group' ); ?>
|
|
|
|
<h4>Mark as Read Automatically</h4>
|
|
<p>
|
|
<input id="mar_settings[auto]" name="mar_settings[auto]" type="checkbox" value="1" <?php checked( '1', $mar_options['auto'] ); ?>/>
|
|
<label class="description" for="mar_settings[auto]"><?php _e( 'Automatically mark posts as read after the reader has been on the page for a desginated amount of time?' ); ?></label>
|
|
</p>
|
|
<p>
|
|
<input id="mar_settings[auto_time]" name="mar_settings[auto_time]" type="text" value="<?php echo $mar_options['auto_time'];?>" />
|
|
<label class="description" for="mar_settings[auto_time]"><?php _e( 'Length of time in seconds before a post should be considered "read"' ); ?></label><br/>
|
|
</p>
|
|
|
|
<h4>Mark as Read / Unread Links</h4>
|
|
<p>
|
|
<input id="mar_settings[show_links]" name="mar_settings[show_links]" type="checkbox" value="1" <?php checked( '1', $mar_options['show_links'] ); ?>/>
|
|
<label class="description" for="mar_settings[show_links]"><?php _e( 'Display the Mark as Read / Unread links on posts automatically?' ); ?></label>
|
|
</p>
|
|
<p>
|
|
<?php $positions = array('Top', 'Bottom'); ?>
|
|
<select name="mar_settings[post_position]">
|
|
<?php foreach ($positions as $option) { ?>
|
|
<option <?php if ($mar_options['post_position'] == $option ){ echo 'selected="selected"'; } ?>><?php echo htmlentities($option); ?></option>
|
|
<?php } ?>
|
|
</select>
|
|
<label class="description" for="mar_settings[style]"><?php _e( 'Display Mark as Read/Unread links at top or bottom of the post/page content?' ); ?></label>
|
|
</p>
|
|
<p>
|
|
<input id="mar_settings[read_text]" name="mar_settings[read_text]" type="text" value="<?php echo $mar_options['read_text'];?>" />
|
|
<label class="description" for="mar_settings[read_text]"><?php _e( 'Enter the text you\'d like to use for the Mark as Read text' ); ?></label><br/>
|
|
</p>
|
|
<p>
|
|
<input id="mar_settings[unread_text]" name="mar_settings[unread_text]" type="text" value="<?php echo $mar_options['unread_text'];?>" />
|
|
<label class="description" for="mar_settings[unread_text]"><?php _e( 'Enter the text you\'d like to use for the mark as Unread text' ); ?></label><br/>
|
|
</p>
|
|
|
|
<h4>Alert Messages</h4>
|
|
<p>
|
|
<input id="mar_settings[alerts]" name="mar_settings[alerts]" type="checkbox" value="1" <?php checked( '1', $mar_options['alerts'] ); ?>/>
|
|
<label class="description" for="mar_settings[alerts]"><?php _e( 'Show alert messages when posts are marked as read/unread?' ); ?></label>
|
|
</p>
|
|
<p>
|
|
<input id="mar_settings[alert_read]" name="mar_settings[alert_read]" type="text" value="<?php echo $mar_options['alert_read'];?>" />
|
|
<label class="description" for="mar_settings[alert_read]"><?php _e( 'Enter the text you\'d like to be shown in the alert when a post is marked as read' ); ?></label><br/>
|
|
</p>
|
|
<p>
|
|
<input id="mar_settings[alert_unread]" name="mar_settings[alert_unread]" type="text" value="<?php echo $mar_options['alert_unread'];?>" />
|
|
<label class="description" for="mar_settings[alert_unread]"><?php _e( 'Enter the text you\'d like to be shown in the alert when a post is marked as unread' ); ?></label><br/>
|
|
</p>
|
|
|
|
<h4>Custom CSS</h4>
|
|
<p>
|
|
<label class="description" for="mar_settings[mar_css]"><?php _e( 'Enter custom CSS here to customize the appearance of this plugin. To assist you, a list of available class names are available in the Help tab in the top right.' ); ?></label><br/>
|
|
<textarea id="mar_settings[mar_css]" style="width: 400px; height: 150px;" name="mar_settings[mar_css]" type="text"><?php echo $mar_options['mar_css'];?></textarea>
|
|
</p>
|
|
|
|
<!-- save the options -->
|
|
<p class="submit">
|
|
<input type="submit" class="button-primary" value="<?php _e( 'Save Options' ); ?>" />
|
|
</p>
|
|
|
|
|
|
</form>
|
|
</div><!--end sf-wrap-->
|
|
</div><!--end wrap-->
|
|
|
|
<?php
|
|
}
|
|
|
|
// register the plugin settings
|
|
function mar_register_settings() {
|
|
|
|
// create whitelist of options
|
|
register_setting( 'mar_settings_group', 'mar_settings' );
|
|
}
|
|
//call register settings function
|
|
add_action( 'admin_init', 'mar_register_settings' );
|
|
|
|
|
|
function mar_settings_menu() {
|
|
|
|
// add settings page
|
|
add_submenu_page('options-general.php', 'Mark as Read Settings', 'Mark as Read','manage_options', 'mar-settings', 'mar_settings_page');
|
|
}
|
|
add_action('admin_menu', 'mar_settings_menu');
|
|
|
|
|
|
function mar_contextual_help($contextual_help, $screen_id, $screen) {
|
|
|
|
ob_start(); ?>
|
|
|
|
<h3>HTML Class Names</h3>
|
|
<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>
|
|
|
|
<p><strong>Mark as Read / Unread Controls</strong></p>
|
|
<ul>
|
|
<li><em>div.mar_links</em> - this is the DIV tag that wraps the mark as read / unread links, if enabled</li>
|
|
<li><em>a.mar_read_control</em> - this is the generic class given to both mark as read and unread links</li>
|
|
<li><em>a.mar_mark_as_read</em> - this is the mark as read link class</li>
|
|
<li><em>a.mar_mark_as_unread</em> - this is the mark as unread link class</li>
|
|
</ul>
|
|
|
|
<p><strong>Most Read Posts List</strong></p>
|
|
<ul>
|
|
<li><em>ul.mar_most_read_posts</em> - this is the UL that wraps the most read posts list</li>
|
|
<li><em>li.popular_post</em> - this is LI tag that wraps each popular post link</li>
|
|
</ul>
|
|
|
|
<p><strong>User Report</strong></p>
|
|
<ul>
|
|
<li><em>ul.mar_user_report</em> - this is the UL that wraps the user's report</li>
|
|
<li><em>ul.mar_user_report li</em> - this is LI tag that wraps each user report item</li>
|
|
</ul>
|
|
|
|
<?php
|
|
return ob_get_clean();
|
|
}
|
|
if (isset($_GET['page']) && $_GET['page'] == 'mar-settings')
|
|
{
|
|
add_action('contextual_help', 'mar_contextual_help', 10, 3);
|
|
}
|