Example #1
0
/**
 * Makes a settings page for the plugin
 * 
 * @uses bb_option_form_element() to generate the page
 */
function em_options()
{
    global $em_plugopts;
    if ($_POST['em_opts_submit'] == 1) {
        /* Settings have been received, now save them! */
        bb_check_admin_referer('em-save-chk');
        /* Security Check */
        /* Checks on options, and then save them */
        $em_plugopts['link-tags'] = intval($_POST['link-tags']) == 1 ? 1 : 0;
        $em_plugopts['link-users'] = intval($_POST['link-users']) == 1 ? 1 : 0;
        $em_plugopts['link-user-to'] = $_POST['link-user-to'] == 'website' ? 'website' : 'profile';
        $em_plugopts['reply-link'] = intval($_POST['reply-link']) == 1 ? 1 : 0;
        $em_plugopts['reply-text'] = esc_attr($_POST['reply-text']);
        bb_update_option(EM_OPTIONS, $em_plugopts);
        bb_admin_notice(__('The options were successfully saved!', 'easy-mentions'));
    }
    if ($ver = em_update_check()) {
        /* Check for Updates and if available, then notify */
        bb_admin_notice(sprintf(__('New version (%1$s) of Easy Mentions is available! Please download the latest version from <a href="%2$s">here</a>.', 'easy-mentions'), $ver, 'http://bbpress.org/plugins/topic/easy-mentions/'));
    }
    /* Options in an array to be printed */
    $options = array('link-tags' => array('title' => __('Link the Tags?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-tags'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the tags to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>#tag</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-users' => array('title' => __('Link the Users?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['link-users'] == 1 ? '1' : '0', 'note' => sprintf(__('Check this option if you want the users to be linked (by using %s) in the posts.', 'easy-mentions'), '<code>@user</code>'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'link-user-to' => array('title' => __('Link the user to profile or website?', 'easy-mentions'), 'type' => 'radio', 'value' => $em_plugopts['link-user-to'] == 'website' ? 'website' : 'profile', 'note' => __('If you selected the website option and the user\'s website does not exist, then the user will be linked to his or her profile page.', 'easy-mentions'), 'options' => array('profile' => __('Profile', 'easy-mentions'), 'website' => __('Website', 'easy-mentions'))), 'reply-link' => array('title' => __('Add a reply link below each post?', 'easy-mentions'), 'type' => 'checkbox', 'value' => $em_plugopts['reply-link'] == 1 ? '1' : '0', 'note' => sprintf(__('Before checking this option, please verify that there is a post form below the topic on each page. (<a href="%s">Help</a>)', 'easy-mentions'), 'http://bbpress.org/plugins/topic/easy-mentions/faq/'), 'options' => array('1' => __('Yes', 'easy-mentions'))), 'reply-text' => array('title' => __('Reply Text', 'easy-mentions'), 'class' => array('long'), 'value' => $em_plugopts['reply-text'] ? stripslashes($em_plugopts['reply-text']) : '<em>Replying to @%%USERNAME%%\'s <a href="%%POSTLINK%%">post</a>:</em>', 'after' => '<div style="clear:both;"></div>' . sprintf(__('Some HTML is allowed. The following keys can also be used:%1$s - Post\'s author\'s name%2$s - Post\'s link', 'after-the-deadline'), '<br /><strong>%%USERNAME%%</strong>', '<br /><strong>%%POSTLINK%%</strong>') . '<br />'));
    if ($em_plugopts['link-users'] != 1) {
        $options['link-user-to']['attributes'] = array('disabled' => 'disabled');
    }
    if ($em_plugopts['reply-link'] != 1) {
        $options['reply-text']['attributes'] = array('disabled' => 'disabled');
    }
    ?>
	
	<h2><?php 
    _e('Easy Mentions', 'easy-mentions');
    ?>
</h2>
	<?php 
    do_action('bb_admin_notices');
    ?>
	<form method="post" class="settings options">
		<fieldset>
			<?php 
    foreach ($options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		</fieldset>
		<fieldset class="submit">
			<?php 
    bb_nonce_field('em-save-chk');
    ?>
			<input type="hidden" name="em_opts_submit" value="1"></input>
			<input class="submit" type="submit" name="submit" value="Save Changes" />
		</fieldset>
		<p><?php 
    printf(__('Happy with the plugin? Why not <a href="%1$s">buy the author a cup of coffee or two</a> or get him something from his <a href="%2$s">wishlist</a>?', 'easy-mentions'), 'http://gaut.am/donate/EM/', 'http://gaut.am/wishlist/');
    ?>
</p>
	</form>
<?php 
}
Example #2
0
function bb_ksd_configuration_page()
{
    ?>
<h2><?php 
    _e('Akismet Settings');
    ?>
</h2>
<?php 
    do_action('bb_admin_notices');
    ?>

<form class="settings" method="post" action="<?php 
    bb_uri('bb-admin/admin-base.php', array('plugin' => 'bb_ksd_configuration_page'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
    ?>
">
	<fieldset>
		<p><?php 
    printf(__('For many people, <a href="%s">Akismet</a> will greatly reduce or even completely eliminate the spam you get on your site. If one does happen to get through, simply mark it as "spam" and Akismet will learn from the mistakes.'), 'http://akismet.com/');
    ?>
</p>

<?php 
    $after = '';
    if (false !== ($key = bb_get_option('akismet_key'))) {
        if (bb_akismet_verify_key($key)) {
            $after = __('This key is valid');
        } else {
            bb_delete_option('akismet_key');
        }
    }
    bb_option_form_element('akismet_key', array('title' => __('WordPress.com API Key'), 'attributes' => array('maxlength' => 12), 'after' => $after, 'note' => sprintf(__('If you don\'t have a WordPress.com API Key, you can get one at <a href="%s">WordPress.com</a>'), 'http://wordpress.com/api-keys/')));
    bb_option_form_element('akismet_stats', array('title' => __('Enable stats page'), 'type' => 'checkbox', 'options' => array(1 => __('Create a page that shows spam statistics.')), 'note' => __('This page will be viewable by moderators or higher.')));
    ?>

	</fieldset>
	<fieldset class="submit">
		<?php 
    bb_nonce_field('options-akismet-update');
    ?>
		<input type="hidden" name="action" value="update-akismet-settings" />
		<input class="submit" type="submit" name="submit" value="<?php 
    _e('Save Changes');
    ?>
" />
	</fieldset>
</form>
<?php 
}
function bb_forum_form($forum_id = 0)
{
    $forum_id = (int) $forum_id;
    if ($forum_id && !($forum = bb_get_forum($forum_id))) {
        return;
    }
    $forum_name = '';
    $forum_slug = '';
    $forum_description = '';
    $forum_position = '';
    if ($forum_id) {
        $forum_name = get_forum_name($forum_id);
        $forum_slug = apply_filters('editable_slug', $forum->forum_slug);
        $forum_description = get_forum_description($forum_id);
        $forum_position = get_forum_position($forum_id);
        $legend = __('Edit Forum');
        $submit = __('Save Changes');
        $action = 'update';
    } else {
        $legend = __('Add Forum');
        $submit = __('Add Forum');
        $action = 'add';
    }
    $forum_options = array('forum_name' => array('title' => __('Name'), 'value' => $forum_name), 'forum_slug' => array('title' => __('Slug'), 'value' => $forum_slug), 'forum_desc' => array('title' => __('Description'), 'value' => $forum_description, 'class' => 'long'), 'forum_parent' => array('title' => __('Parent'), 'type' => 'select', 'options' => bb_get_forum_dropdown(array('cut_branch' => $forum_id, 'id' => 'forum_parent', 'none' => true, 'selected' => $forum_id ? get_forum_parent($forum_id) : 0, 'disable_categories' => 0, 'options_only' => true))), 'forum_order' => array('title' => __('Position'), 'value' => $forum_position, 'class' => 'short'), 'forum_is_category' => array('title' => __('Category'), 'type' => 'checkbox', 'options' => array(1 => array('label' => __('Make this forum a category'), 'value' => bb_get_forum_is_category($forum_id))), 'note' => __('Categories are forums where new topics cannot be created. Categories usually contain a group of sub-forums.')));
    if (!$forum_id) {
        unset($forum_options['forum_slug']);
        unset($forum_options['forum_order']);
    }
    ?>
<form class="settings" method="post" id="<?php 
    echo $action;
    ?>
-forum" action="<?php 
    bb_uri('bb-admin/bb-forum.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
    ?>
" class="add:forum-list: forum-form">
	<fieldset>
		<legend><?php 
    echo $legend;
    ?>
</legend>
<?php 
    foreach ($forum_options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
		<fieldset class="submit">
<?php 
    if ($forum_id) {
        ?>
			<input type="hidden" name="forum_id" value="<?php 
        echo $forum_id;
        ?>
" />
<?php 
    }
    ?>
			<?php 
    bb_nonce_field('order-forums', 'order-nonce');
    ?>
			<?php 
    bb_nonce_field($action . '-forum');
    ?>
			<input type="hidden" name="action" value="<?php 
    echo $action;
    ?>
" />
			<input class="submit" type="submit" name="submit" value="<?php 
    echo $submit;
    ?>
" />
		</fieldset>
	</fieldset>
</form>
<?php 
}
Example #4
0
<div class="wrap">
	<h2><?php 
_e('Add a new user');
?>
</h2>

	<?php 
do_action('bb_admin_notices');
?>

	<form class="settings" method="post" action="">
		<fieldset>
			<?php 
foreach ($user_fields as $field => $args) {
    bb_option_form_element($field, $args);
}
?>
			<noscript>
				<?php 
_e('Disabled (requires JavaScript)');
?>
			</noscript>
			<script type="text/javascript" charset="utf-8">
				if (typeof jQuery != 'undefined') {
					jQuery('#user-login').attr( 'id', 'user_login' );
					var meter = ('<div id="pass-strength-result">' + pwsL10n.short + '</div>');
					jQuery('#option-pass-strength-fake-input div.inputs input').before( meter );
				} else {
					document.writeln('<?php 
echo str_replace("'", "\\'", __('Disabled.'));
Example #5
0
	</fieldset>
	<fieldset id="advanced2" style="display:<?php 
echo $advanced_display;
?>
">
		<legend><?php 
_e('Custom user tables');
?>
</legend>
		<p><?php 
_e('Only set these values if your user tables differ from the default NXTClass naming convention.');
?>
</p>
	<?php 
foreach ($custom_table_options as $option => $args) {
    bb_option_form_element($option, $args);
}
?>
	</fieldset>
	<fieldset class="submit">
		<?php 
bb_nonce_field('options-nxtclass-update-options');
?>
		<input type="hidden" name="action" value="update-options" />
		<input class="submit" type="submit" name="submit" value="<?php 
_e('Save Changes');
?>
" />
	</fieldset>
</form>
Example #6
0
<?php
$forum_options=gf_forum_prepare_fields(gf_get_current_forum_id());
?>
<form class="standard-form" method="post" id="edit-forum" action="">
	<fieldset>
            <legend><?php echo $legend; ?></legend>
<?php
    foreach ($forum_options as $option => $args ) {
	bb_option_form_element( $option, $args );
    }
?>
   </fieldset>
<fieldset class="submit">
    <?php if ( $forum_id ) : ?>
		<input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" />
    <?php endif; ?>
		
	<?php wp_nonce_field( 'gf_edit_forum' ); ?>
	<input type="hidden" name="action" value="<?php echo $action; ?>" />
	<input class="submit" type="submit" name="save-forum" value="<?php _e('Save Forum','gf');?>" />
	</fieldset>
</form>
Example #7
0
function li_configuration_page()
{
    ?>
<h2><?php 
    _e('Linkedin Connect Settings');
    ?>
</h2>
<?php 
    do_action('bb_admin_notices');
    ?>
<form class="settings" method="post" action="<?php 
    bb_uri('bb-admin/admin-base.php', array('plugin' => 'li_configuration_page'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
    ?>
">
	<p>A LinkedIn Application ID and Secret Key are needed. These can be obtained from <a href="https://www.linkedin.com/secure/developer">Linkedin developer pages</a>.</p>
	<p>Remember to check that OAuth 2.0 support is enabled. This setting is located under Advanced-tab of your LinkedIn application page.</p>
	<fieldset class="submit">
<?php 
    bb_option_form_element('li_app_id', array('title' => __('LinkedIn Application ID'), 'attributes' => array('maxlength' => 20), 'after' => '[Alphanumeric] Example: aQw3728er2'));
    bb_option_form_element('li_secret', array('title' => __('Linkedin Application Secret'), 'attributes' => array('maxlength' => 40), 'after' => "[Alphanumeric] Example: abcdef123456abcdef123456abcdef123456"));
    bb_option_form_element('li_displayname_from', array('title' => __('Set as Display Name'), 'type' => 'select', 'options' => array(0 => __('Full Name'), 1 => __('First Name'), 2 => __('Last Name')), 'after' => "The users Display Name will be set to this value as provided by LinkedIn"));
    bb_option_form_element('li_allow_useredit', array('title' => __('Allow User Edit'), 'type' => 'checkbox', 'options' => array(1 => __('Allow users to edit their own profile information, such as first name, last name and display name'))));
    bb_option_form_element('li_request_email', array('title' => __('Request Real Email'), 'type' => 'checkbox', 'options' => array(1 => __('Request users real email address from LinkedIn (user must accept this). A dummy email is set to new users if this is disabled.'))));
    bb_option_form_element('li_hide_post_login', array('title' => __('Hide login in post form'), 'type' => 'checkbox', 'options' => array(1 => __('Hide the "You must login to reply" in post-form for non-logged in users. This links to the traditional login page otherwise, which LinkedIn Connected users cannot use.'))));
    bb_option_form_element('li_get_jquery', array('title' => __('Include jQuery (require version 1.6+)'), 'type' => 'checkbox', 'options' => array(1 => __('Includes latest jQuery API from Google APIs.'))));
    ?>
		<?php 
    bb_nonce_field('options-liconnect-update');
    ?>
		<input type="hidden" name="action" value="update-li-settings" />
		<input class="submit" type="submit" name="submit" value="<?php 
    _e('Save Changes');
    ?>
" />
	</fieldset>
</form>
<?php 
}
Example #8
0
function nospamuser_admin()
{
    $settings = bb_get_option('nospamuser-settings');
    $options = array('days' => array('title' => __('Maximum days', 'nospamuser'), 'note' => __('Any possible spammer that was last active over this many days ago will be allowed through.', 'nospamuser'), 'class' => 'short', 'value' => $settings['days']), 'min_occur' => array('title' => __('Minimum frequency', 'nospamuser'), 'note' => __('Any possible spammer that do not have at least this many reports will be allowed through.', 'nospamuser'), 'class' => 'short', 'value' => $settings['min_occur']), 'max_occur' => array('title' => __('Maximum frequency', 'nospamuser'), 'note' => __('Possible spammers that have at least this many reports will be disallowed in adaptive mode. This also affects agressive mode, where spammers with at least this many reports will be blocked even if the maximum days prerequisite is not met.', 'nospamuser'), 'class' => 'short', 'value' => $settings['max_occur']), 'api_key' => array('title' => __('Stop Forum Spam API key', 'nospamuser'), 'note' => __('Required to submit spammers to Stop Forum Spam. <a href="http://www.stopforumspam.com/signup">Get a Stop Forum Spam API key here</a>.', 'nospamuser'), 'class' => array('code', 'long'), 'value' => $settings['api_key']), 'recaptcha_mode' => array('title' => __('reCAPTCHA mode', 'nospamuser'), 'note' => __('All modes except aggressive require reCAPTCHA public and private keys.', 'nospamuser'), 'type' => 'radio', 'options' => array('aggressive' => __('<strong>Aggressive:</strong> Never allow possible spammers to override blocks.', 'nospamuser'), 'adaptive' => __('<strong>Adaptive:</strong> Allow possible spammers between the minimum and maximum frequency to override blocks.', 'nospamuser'), 'friendly' => __('<strong>Friendly:</strong> Allow all possible spammers to override blocks.', 'nospamuser')), 'value' => $settings['recaptcha_mode']), 'recaptcha_pub' => array('title' => __('reCAPTCHA public key', 'nospamuser'), 'note' => sprintf(__('<a href="%s">Get it here</a>.', 'nospamuser'), 'http://recaptcha.net/api/getkey?domain=' . urlencode($_SERVER['SERVER_NAME']) . '&app=bb-NoSpamUser'), 'class' => array('code', 'long'), 'value' => $settings['recaptcha_pub']), 'recaptcha_priv' => array('title' => __('reCAPTCHA private key', 'nospamuser'), 'note' => sprintf(__('<a href="%s">Get it here</a>.', 'nospamuser'), 'http://recaptcha.net/api/getkey?domain=' . urlencode($_SERVER['SERVER_NAME']) . '&app=bb-NoSpamUser'), 'class' => array('code', 'long'), 'value' => $settings['recaptcha_priv']), 'stats-public' => array('title' => __('Public statistics', 'nospamuser'), 'type' => 'radio', 'options' => array(0 => __('Keep all statistics private', 'nospamuser'), 1 => sprintf(__('Display the number of caught spammers on the <a href="%s">statistics page</a>.', 'nospamuser'), bb_get_uri('statistics.php'))), 'value' => $settings['stats-public'] ? $settings['stats-public'] : 0));
    ?>
<h2><?php 
    _e('bb-NoSpamUser', 'nospamuser');
    ?>
</h2>
<?php 
    do_action('bb_admin_notices');
    ?>
<form class="settings" method="post" action="<?php 
    bb_uri('bb-admin/admin-base.php', array('plugin' => 'nospamuser_admin'), BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN);
    ?>
">
	<fieldset>
<?php 
    foreach ($options as $option => $args) {
        bb_option_form_element($option, $args);
    }
    ?>
	</fieldset>
	<fieldset class="submit">
		<?php 
    bb_nonce_field('nospamuser-admin');
    ?>
		<input class="submit" type="submit" name="submit" value="<?php 
    _e('Save Changes');
    ?>
" />
	</fieldset>
</form>
<?php 
    if ($blocks = (int) bb_get_option('nospamuser-blocks')) {
        ?>
<div style="font-size: .75em; position: absolute; bottom: 50px; right: 5px"><?php 
        printf(_n('%s spammer blocked by bb-NoSpamUser', '%s spammers blocked by bb-NoSpamUser', $blocks, 'nospamuser'), bb_number_format_i18n($blocks));
        ?>
</div>
<?php 
    }
}
Example #9
0
<?php
    $forum_options=gf_forum_prepare_fields();
?>
<h2><?php _e("Create New Forum","gf");?></h2>
<form class="standard-form" method="post" id="create-forum" action="<?php echo gf_get_forum_create_link();?>">
<fieldset>
            <legend><?php echo $legend; ?></legend>
<?php
    foreach ($forum_options as $option => $args ) {
	bb_option_form_element( $option, $args );
}
?>
 </fieldset>
<fieldset class="submit">
    <?php if ( $forum_id ) : ?>
		<input type="hidden" name="forum_id" value="<?php echo $forum_id; ?>" />
    <?php endif; ?>
		<?php wp_nonce_field( 'gf_create_forum' ); ?>
		<input type="hidden" name="action" value="<?php echo $action; ?>" />
		<input class="submit" type="submit" name="save-forum" value="<?php _e('Create Forum','gf');?>" />
	</fieldset>
</form>