Plugin Directory

Changeset 390868


Ignore:
Timestamp:
05/30/2011 05:06:09 PM (15 years ago)
Author:
sproject
Message:

0.1 release

Location:
readability/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • readability/trunk/readability.php

    r355486 r390868  
    44Plugin URI: http://www.sproject.name/download/wp-readability/
    55Description: Plugin which lets you to show posts in stylish, legible pop-up window, like in Safari.
    6 Version: 0.1-beta9
     6Version: 0.1
    77Author: Piotr Sochalewski
    88Author URI: http://www.sproject.name/
     
    3030else return;
    3131
     32$readability_settings = array();
     33
     34function readability_register_settings() {
     35    register_setting('readability_settings', 'readability_link_title');
     36    register_setting('readability_settings', 'readability_word_count');
     37}
     38
    3239function readability_init() {
     40    global $readability_settings;
     41
     42    if ( is_admin() )
     43        add_action( 'admin_init', 'readability_register_settings' );
     44
    3345    // 'Link' to plugin feature and some other stuff!
    3446    add_filter('the_content', 'readability_button');
    35     //add_filter('admin_menu', 'readability_settings');
     47    add_filter('admin_menu', 'readability_isadmin_settings');
    3648
    3749    // jQuery has to be there instead of reader_js(). Codex says that…
     
    4153    // Nice const. Probably I don't need this now.
    4254    // $locale = defined(WPLANG) ? WPLANG : 'en_US';
     55   
     56    add_option('readability_link_title', 'Readability');
     57    add_option('readability_word_count', '100');
     58   
     59    $readability_settings['readability_link_title'] = get_option('readability_link_title');
     60    $readability_settings['readability_word_count'] = get_option('readability_word_count');
    4361}
    4462
     
    7290
    7391function readability_return_reader() {
     92    global $readability_settings;
     93   
    7494    // Get post ID.
    7595    global $post;
     
    81101   
    82102    // Return only if word count isn't low.
    83     if(str_word_count($content) > 100) {
     103    if($readability_settings['readability_word_count'] == 0 || str_word_count($content) > $readability_settings['readability_word_count']) {
    84104        // Great typography by PHP Typography.
    85105        // Only if wp-Typography is not activated.
     
    93113        }
    94114
    95         return '<small><a href="#readability" id="areadability">Readability</a></small><div style="width: 650px; display:none;"><div id="readability"><h1>'.$title.'</h1>'.$content.'</div></div>';
     115        return '<small><a href="#readability" id="areadability">'.$readability_settings['readability_link_title'].'</a></small><div style="width: 650px; display:none;"><div id="readability"><h1>'.$title.'</h1>'.$content.'</div></div>';
    96116
    97117    }
    98118}
    99119
    100 /*
    101 function readability_settings() {
     120function readability_isadmin_settings() {
    102121    add_options_page('Readability Options', 'Readability', 8, __FILE__, 'readability_settings_page');
    103 }*/
     122}
     123
     124function readability_settings_page() {
     125    global $readability_settings;
     126?>
     127   
     128    <div class="wrap">
     129    <h2>Readability <small>by <a href="http://www.sproject.name/" target="_blank">Piotr Sochalewski</a></small></h2>
     130
     131    <form method="post" action="options.php">
     132
     133    <?php settings_fields('readability_settings'); ?>
     134   
     135    <table class="form-table">
     136        <tr valign="top">
     137            <th scope="row"><h3>Main settings</h3></th>
     138        </tr>
     139   
     140        <tr valign="top">
     141            <th scope="row">Link title:</th>
     142            <td style="line-height: 100%;"><input size="21" type="text" name="readability_link_title" value="<?php echo get_option('readability_link_title'); ?>" /></td>
     143        </tr>
     144       
     145        <tr valign="top">
     146            <th scope="row">Min word count to activate:</th>
     147            <td style="line-height: 100%;"><input size="10" type="number" name="readability_word_count" value="<?php echo get_option('readability_word_count'); ?>" /><br /><small>0 to always on.</small></td>
     148        </tr>
     149       
     150        <tr valign="top">
     151            <th scope="row"><h3>Help & Support</h3></th>
     152        </tr>
     153       
     154        <tr valign="top">
     155            <th scope="row" colspan="2"><strong><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sproject%40sproject%2ename&lc=PL&item_name=Readability%20WordPress%20plugin&item_number=readability%2ddonate&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted" target="_blank" style="color: rgb(255,0,0)">Donate to this plugin</a></strong></th>
     156        </tr>
     157        <tr valign="top">
     158            <th scope="row" colspan="2"><a href="http://www.sproject.name/download/wp-readability/" target="_blank">Read the plugin homepage and its comments</a></th>
     159        </tr>
     160    </table>
     161   
     162    <p class="submit">
     163        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
     164    </p>
     165   
     166    </form>
     167    </div>
     168
     169<?php   
     170}
    104171
    105172readability_init();
  • readability/trunk/readme.txt

    r355486 r390868  
    11=== Readability ===
    22Contributors: sproject
    3 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sproject%40sproject%2ename&lc=PL&item_name=Readability&item_number=readability%2ddonate&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
     3Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=sproject%40sproject%2ename&lc=PL&item_name=Readability%20WordPress%20plugin&item_number=readability%2ddonate&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted
    44Tags: reader, reader, legible, elegant, clear, safari
    55Requires at least: 2.9
    6 Tested up to: 3.1
    7 Stable tag: 0.1-beta9
     6Tested up to: 3.1.3
     7Stable tag: 0.1
    88
    99== Description ==
     
    2424
    2525== Changelog ==
     26
     27= 0.1 =
     28* First stable release with implemented settings.
    2629
    2730= 0.1-beta9 =
Note: See TracChangeset for help on using the changeset viewer.