Пример #1
0
/**
 * Create the function to output the contents of our Dashboard Widget.
 */
function mailusers_dashboard_widget_function()
{
    ?>
    <div class="table table_content">
    <p class="sub"><?php 
    _e('Default User Settings', MAILUSERS_I18N_DOMAIN);
    ?>
</p>
    <table style="text-align: left; width: 90%;">
   	<tr>
    <th><?php 
    _e('Receive post or page notification emails:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_notifications() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Receive emails sent to multiple recipients:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_mass_email() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Allow Users to control their own Email Users settings:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_user_control() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Filter Users with no role from Recipient List:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_no_role_filter() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
	</table>
    </div>
<?php 
    //  Report the number of users who accept notifications and mass emails
    $massemails = mailusers_get_users('', MAILUSERS_ACCEPT_MASS_EMAIL_USER_META);
    $notifications = mailusers_get_users('', MAILUSERS_ACCEPT_NOTIFICATION_USER_META);
    ?>
    <div class="table table_content">
    <p class="sub"><?php 
    _e('User Statistics', MAILUSERS_I18N_DOMAIN);
    ?>
</p>
    <table style="text-align: left; width: 90%;">
   	<tr>
    <th><?php 
    _e('Number of Users who accept post or page notification emails:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td<?php 
    if (count($notifications) == 0) {
        echo ' style="color: red;"';
    }
    ?>
><?php 
    echo count($notifications);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Number of Users who accept emails sent to multiple recipients:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td<?php 
    if (count($massemails) == 0) {
        echo ' style="color: red;"';
    }
    ?>
><?php 
    echo count($massemails);
    ?>
</td>
	</tr>
	</table>
    </div>
<?php 
    return;
    /**  The remainder of the filter information isn't finished yet.  **/
    ?>
    <div class="table table_content">
    <p class="sub"><?php 
    _e('Content Filters', MAILUSERS_I18N_DOMAIN);
    ?>
</p>
    <table style="text-align: left; width: 90%;">
<?php 
    global $wp_filter;
    $filters = array('the_content' => 'http://codex.wordpress.org/Function_Reference/the_content', 'the_excerpt' => 'http://codex.wordpress.org/Function_Reference/the_excerpt', 'tiny_mce_before_init' => 'http://codex.wordpress.org/Plugin_API/Filter_Reference/tiny_mce_before_init');
    $hooks = array('wpautop' => 'http://codex.wordpress.org/Function_Reference/wpautop', 'wptexturize' => 'http://codex.wordpress.org/Function_Reference/wptexturize', 'shortcode_unautop' => 'https://developer.wordpress.org/reference/functions/shortcode_unautop/');
    //  Loop through filters and hooks checking for anything missing
    foreach ($filters as $fkey => $fvalue) {
        if (has_filter($fkey)) {
            $f = array();
            foreach (array_keys($wp_filter[$fkey]) as $key => $value) {
                $f = array_merge($f, array_keys($wp_filter[$fkey][$value]));
            }
            foreach ($hooks as $key => $value) {
                ?>
   	<tr>
    <th><a href="<?php 
                echo $fvalue;
                ?>
"><?php 
                echo $fkey;
                ?>
</a> / <a href="<?php 
                echo $value;
                ?>
"><?php 
                echo $key;
                ?>
</a></th>
	  <td<?php 
                if (!in_array($key, $f)) {
                    echo ' style="color: red;"';
                }
                ?>
><?php 
                echo in_array($key, $f) ? __('Present', MAILUSERS_I18N_DOMAIN) : __('Missing', MAILUSERS_I18N_DOMAIN);
                ?>
</td>
	</tr>
<?php 
            }
        }
    }
    ?>
	</table>
    </div>
<?php 
}
			<input 	type="checkbox"
					name="mailusers_default_mass_email" id="mailusers_default_mass_email" value="true"
					<?php 
if (mailusers_get_default_mass_email() == 'true') {
    echo 'checked="checked"';
}
?>
 ></input>
			<?php 
_e('Receive emails sent to multiple recipients.', MAILUSERS_I18N_DOMAIN);
?>
<br/>
			<input 	type="checkbox"
					name="mailusers_default_user_control" id="mailusers_default_user_control" value="true"
					<?php 
if (mailusers_get_default_user_control() == 'true') {
    echo 'checked="checked"';
}
?>
 ></input>
			<?php 
_e('Allow Users to control their own Email Users settings.', MAILUSERS_I18N_DOMAIN);
?>
<br />
			<input 	type="checkbox"
					name="mailusers_no_role_filter" id="mailusers_no_role_filter" value="true"
					<?php 
if (mailusers_get_no_role_filter() == 'true') {
    echo 'checked="checked"';
}
?>
Пример #3
0
/**
 * Create the function to output the contents of our Dashboard Widget.
 */
function mailusers_dashboard_widget_function()
{
    ?>
    <div class="table table_content">
    <p class="sub"><?php 
    _e('Default User Settings', MAILUSERS_I18N_DOMAIN);
    ?>
</p>
    <table style="text-align: left; width: 90%;">
   	<tr>
    <th><?php 
    _e('Receive post or page notification emails:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_notifications() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Receive emails sent to multiple recipients:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_mass_email() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Allow Users to control their own Email Users settings:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_default_user_control() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Filter Users with no role from Recipient List:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td><?php 
    echo mailusers_get_no_role_filter() == 'true' ? __('On', MAILUSERS_I18N_DOMAIN) : __('Off', MAILUSERS_I18N_DOMAIN);
    ?>
</td>
	</tr>
	</table>
    </div>
<?php 
    //  Report the number of users who accept notifications and mass emails
    $massemails = mailusers_get_users('', MAILUSERS_ACCEPT_MASS_EMAIL_USER_META);
    $notifications = mailusers_get_users('', MAILUSERS_ACCEPT_NOTIFICATION_USER_META);
    ?>
    <div class="table table_content">
    <p class="sub"><?php 
    _e('User Statistics', MAILUSERS_I18N_DOMAIN);
    ?>
</p>
    <table style="text-align: left; width: 90%;">
   	<tr>
    <th><?php 
    _e('Number of Users who accept post or page notification emails:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td<?php 
    if (count($notifications) == 0) {
        echo ' style="color: red;"';
    }
    ?>
><?php 
    echo count($notifications);
    ?>
</td>
	</tr>
   	<tr>
    <th><?php 
    _e('Number of Users who accept emails sent to multiple recipients:', MAILUSERS_I18N_DOMAIN);
    ?>
</th>
	<td<?php 
    if (count($massemails) == 0) {
        echo ' style="color: red;"';
    }
    ?>
><?php 
    echo count($massemails);
    ?>
</td>
	</tr>
	</table>
    </div>
<?php 
}