Plugin Directory

Changeset 529313


Ignore:
Timestamp:
04/10/2012 01:35:04 AM (14 years ago)
Author:
vancoder
Message:

Update to version 1.1

Location:
rehabtabs
Files:
60 added
3 edited

Legend:

Unmodified
Added
Removed
  • rehabtabs/trunk/options.php

    r460035 r529313  
    1414    add_settings_field( 'rehabtabs_collapsible', 'Make tabs collapsible', 'rehabtabs_collapsible_callback', 'plugin', 'rehabtabs_section' );
    1515    add_settings_field( 'rehabtabs_cookie', 'Use cookie to remember tab state', 'rehabtabs_cookie_callback', 'plugin', 'rehabtabs_section' );
     16    add_settings_field( 'rehabtabs_spinner', 'Ajax loading message', 'rehabtabs_spinner_callback', 'plugin', 'rehabtabs_section' );
    1617}
    1718
     
    3334    $options = get_option( 'rehabtabs_options' );
    3435    $themes_directory = plugin_dir_path( __FILE__ ) . 'themes';
    35     if ( class_exists( FilesystemIterator ) ) {
     36    if ( class_exists( 'FilesystemIterator' ) ) {
    3637        $themes = new DirectoryIterator( $themes_directory );
    3738        foreach ( $themes as $theme ) {
     
    6364        }
    6465    }
    65 
    6666}
    6767
    6868function rehabtabs_fx_callback() {
    6969    $options = get_option( 'rehabtabs_options' );
    70     echo '<label for="fx"><p class="description"></p><input type="checkbox" name="rehabtabs_options[fx]" id="fx" value="1" ' . checked( $options['fx'], 1, false ) . ' /></label>';
     70    echo '<label for="fx"><input type="checkbox" name="rehabtabs_options[fx]" id="fx" value="1" ' . checked( isset( $options['fx'] ) ? $options['fx'] : 0, 1, false ) . ' /></label>';
    7171}
    7272
    7373function rehabtabs_collapsible_callback() {
    7474    $options = get_option( 'rehabtabs_options' );
    75     echo '<label for="collapsible"><input type="checkbox" name="rehabtabs_options[collapsible]" id="collapsible" value="1" ' . checked( $options['collapsible'], 1, false ) . ' /></label>';
     75    echo '<label for="collapsible"><input type="checkbox" name="rehabtabs_options[collapsible]" id="collapsible" value="1" ' . checked( isset( $options['collapsible'] ) ? $options['collapsible'] : 0, 1, false ) . ' /></label>';
    7676}
    7777
    7878function rehabtabs_cookie_callback() {
    7979    $options = get_option( 'rehabtabs_options' );
    80     echo '<label for="cookie"><input type="checkbox" name="rehabtabs_options[cookie]" id="cookie" value="1" ' . checked( $options['cookie'], 1, false ) . ' /></label>';
     80    echo '<label for="cookie"><input type="checkbox" name="rehabtabs_options[cookie]" id="cookie" value="1" ' . checked( isset( $options['cookie'] ) ? $options['cookie'] : 0, 1, false ) . ' /></label>';
     81}
     82
     83function rehabtabs_spinner_callback() {
     84    $options = get_option( 'rehabtabs_options' );
     85    echo '<input type="text" name="rehabtabs_options[spinner]" id="spinner" value="' . (isset( $options['spinner'] ) ? $options['spinner'] : '') . '" />';
    8186}
    8287
     
    8590        wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
    8691    }
     92    $tabs = array( 'options' => 'Rehabtabs Options', 'usage' => 'Rehabtabs Usage' );
     93    $current = isset( $_GET['tab'] ) ? $_GET['tab'] : 'options';
    8794    echo '<div class="wrap">';
    8895    screen_icon();
    89     echo '<h2>Rehabtabs</h2>';
    90     echo '<form method="post" action="options.php">';
    91     settings_fields( 'rehabtabs_settings_group' );
    92     do_settings_sections( 'plugin' );
    93     echo '<p class="submit"><input name="Submit" type="submit" class="button-primary" value="Save Changes" /></p>';
    94     echo '</form>';
     96    echo '<h2 class="nav-tab-wrapper">';
     97    foreach ( $tabs as $tab => $name ) {
     98        $class = ( $tab == $current ) ? ' nav-tab-active' : '';
     99        echo "<a class='nav-tab$class' href='?page=rehabtabs&tab=$tab'>$name</a>";
     100    }
     101    echo '</h2>';
     102
     103    switch ( $current ) {
     104        case 'options' :
     105            echo '<form method="post" action="options.php">';
     106            settings_fields( 'rehabtabs_settings_group' );
     107            do_settings_sections( 'plugin' );
     108            echo '<p class="submit"><input name="Submit" type="submit" class="button-primary" value="Save Changes" /></p>';
     109            echo '</form>';
     110            break;
     111        case 'usage' :
     112            ?>
     113            <h3>Basic usage</h3>
     114            <pre>
     115[rehabtabs]
     116[rehabtab title="Tab 1"]Content of tab 1[/rehabtab]
     117[rehabtab title="Tab 2"]Content of tab 2[/rehabtab]
     118[rehabtab title="Tab 3"]Content of tab 3[/rehabtab]
     119[/rehabtabs]
     120            </pre>
     121
     122            <h3>Ajax usage</h3>
     123            <p>To load tab contents via ajax, set the shortcode's <em>ajax</em> attribute to <em>true</em>. Then, between the tags, enter the URL to.....</p>
     124            <pre>
     125[rehabtab title="Ajax tab" ajax="true"]plugins/rehabtabs/demo[/rehabtab]
     126            </pre>
     127
     128            <h3>Themes</h3>
     129            <p>Rehabtabs comes loaded with a few themes, but here’s how to install more.</p>
     130            <ol>
     131                <li>Go to the jQuery ThemeRoller</li>
     132                <li>Choose your theme and click the download button</li>
     133                <li>Deselect all components, then reselect Tabs (under Widgets)</li>
     134                <li>Download, giving you a directory called jquery-ui-x.x.xx.custom</li>
     135                <li>Open the subdirectory called css, and copy your chosen theme folder</li>
     136                <li>Paste this folder into plugins/rehabtabs/themes</li>
     137                <li>Your theme should now be available on the Settings page</li>
     138            </ol>
     139            <?php
     140            break;
     141    }
    95142    echo '</div>';
    96143}
    97 
    98144?>
  • rehabtabs/trunk/readme.txt

    r528690 r529313  
    4646== Changelog ==
    4747
     48= 1.1 =
     49* Added usage section to settings.
     50* Added jQuery UI spinner option to settings.
     51* Fixed some notices.
     52
    4853= 1.0 =
    4954* Modified to accommodate older PHP versions.
    5055
    5156= 0.1 =
    52 * Initial Release.
     57* Initial release.
  • rehabtabs/trunk/rehabtabs.php

    r460035 r529313  
    8080    $data['collapsible'] = isset( $options['collapsible'] );
    8181    $data['cookie'] = isset( $options['cookie'] );
     82    $data['spinner'] = $options['spinner'];
    8283    wp_enqueue_script( 'jquery-ui-tabs' );
    8384    if ( $data['cookie'] ) {
Note: See TracChangeset for help on using the changeset viewer.