<?php

# via http://www.smashingmagazine.com/2011/10/20/create-tabs-wordpress-settings-pages/
?>
<div class="wrap">
	<h2><?php 
_e('PressForward Preferences', 'pf');
?>
</h2>
	<div class="metabox-holder" id="pf-settings-box">
		<div class="meta-box-sortables ui-sortable">
			<form action="<?php 
pf_admin_url();
?>
" method="post">
				
				<?php 
wp_nonce_field('pf_settings');
?>
				<h2 class="nav-tab-wrapper" id="pf-settings-tabs">
				<?php 
$tabs = pressforward()->form_of->permitted_tabs();
foreach ($tabs as $tab => $tab_meta) {
    if (current_user_can($tab_meta['cap'])) {
        $title = $tab_meta['title'];
        $class = $tab == $current ? 'nav-tab-active' : '';
        echo "<a class='nav-tab {$class}' id='{$tab}-tab' href='#top#{$tab}' data-tab-target='#{$tab}'>{$title}</a>";
    }
}
?>
				</h2>
Пример #2
0
    /**
     * Display function for the Options panel
     */
    function display_options_builder()
    {
        ?>
		<form action="<?php 
        pf_admin_url();
        ?>
" method="post">
			<div class="wrap">
				<?php 
        echo 'Options';
        ?>
				
					<h3><?php 
        _e('Modules', 'pf');
        ?>
</h3>

					<p class="description"><?php 
        _e('<strong>PressForward Modules</strong> are addons to alter or improve the functionality of the plugin.', 'pf');
        ?>
</p>
				<?php 
        do_action('pf_admin_op_page');
        wp_nonce_field('pf_settings');
        ?>
					<br />
					
					<p><?php 
        $default_pf_link_value = get_option('pf_link_to_source', 0);
        echo '<input id="pf_link_to_source" name="pf_link_to_source" type="number" class="pf_link_to_source_class" value="' . $default_pf_link_value . '" />';
        echo '<label class="description" for="pf_link_to_source"> ' . __('Seconds to redirect user to source. (0 means no redirect)', 'pf') . ' </label>';
        ?>
</p>

					<p><?php 
        $default_pf_present_author_value = get_option('pf_present_author_as_primary', 'yes');
        ?>
						<select id="pf_present_author_as_primary" name="pf_present_author_as_primary">
							<option value="yes" <?php 
        if ($default_pf_present_author_value == 'yes') {
            echo 'selected="selected"';
        }
        ?>
>Yes</option>
							<option value="no" <?php 
        if ($default_pf_present_author_value == 'no') {
            echo 'selected="selected"';
        }
        ?>
>No</option>
						</select>					
					<?php 
        echo '<label class="description" for="pf_present_author_as_primary"> ' . __('Show item author as source.', 'pf') . ' </label>';
        ?>
</p>
					
					<input type="submit" name="submit" class="button-primary" value="<?php 
        _e("Save Changes", 'pf');
        ?>
" />
					<br />					
					
					<h3><?php 
        _e('User Control', 'pf');
        ?>
</h3>

				<?php 
        $arrayedAdminRights = array('pf_menu_group_access' => array('default' => 'contributor', 'title' => __('PressForward Menu Group', 'pf')), 'pf_menu_all_content_access' => array('default' => 'contributor', 'title' => __('All Content Menu', 'pf')), 'pf_menu_under_review_access' => array('default' => 'contributor', 'title' => __('Under Review Menu', 'pf')), 'pf_menu_preferences_access' => array('default' => 'administrator', 'title' => __('Preferences Menu', 'pf')), 'pf_menu_feeder_access' => array('default' => 'editor', 'title' => __('Feeder Menu', 'pf')), 'pf_menu_add_nomination_access' => array('default' => 'contributor', 'title' => __('Add Nomination Menu', 'pf')));
        $arrayedAdminRights = apply_filters('pf_setup_admin_rights', $arrayedAdminRights);
        foreach ($arrayedAdminRights as $right => $parts) {
            ?>
					<table class="form-table">
						<tr>
							<th scope="row">
								<label for="<?php 
            echo $right;
            ?>
-enable"><?php 
            echo $parts['title'];
            ?>
</label>
							</th>

							<td>
								<select id="<?php 
            echo $right;
            ?>
" name="<?php 
            echo $right;
            ?>
">
									<?php 
            $this->pf_get_user_role_select($right, pf_get_defining_capability_by_role($parts['default']));
            ?>
								</select>
							</td>
						</tr>
					</table>			
			
				<br />		
			
			<?php 
        }
        ?>
<input type="submit" name="submit" class="button-primary" value="<?php 
        _e("Save Changes", 'pf');
        ?>
" /><?php 
        do_action('pf_admin_user_settings');
        ?>
						
			</div>
		</form>
		<?php 
    }