Changeset 390868
- Timestamp:
- 05/30/2011 05:06:09 PM (15 years ago)
- Location:
- readability/trunk
- Files:
-
- 2 edited
-
readability.php (modified) (6 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
readability/trunk/readability.php
r355486 r390868 4 4 Plugin URI: http://www.sproject.name/download/wp-readability/ 5 5 Description: Plugin which lets you to show posts in stylish, legible pop-up window, like in Safari. 6 Version: 0.1 -beta96 Version: 0.1 7 7 Author: Piotr Sochalewski 8 8 Author URI: http://www.sproject.name/ … … 30 30 else return; 31 31 32 $readability_settings = array(); 33 34 function readability_register_settings() { 35 register_setting('readability_settings', 'readability_link_title'); 36 register_setting('readability_settings', 'readability_word_count'); 37 } 38 32 39 function readability_init() { 40 global $readability_settings; 41 42 if ( is_admin() ) 43 add_action( 'admin_init', 'readability_register_settings' ); 44 33 45 // 'Link' to plugin feature and some other stuff! 34 46 add_filter('the_content', 'readability_button'); 35 //add_filter('admin_menu', 'readability_settings');47 add_filter('admin_menu', 'readability_isadmin_settings'); 36 48 37 49 // jQuery has to be there instead of reader_js(). Codex says that… … … 41 53 // Nice const. Probably I don't need this now. 42 54 // $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'); 43 61 } 44 62 … … 72 90 73 91 function readability_return_reader() { 92 global $readability_settings; 93 74 94 // Get post ID. 75 95 global $post; … … 81 101 82 102 // 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']) { 84 104 // Great typography by PHP Typography. 85 105 // Only if wp-Typography is not activated. … … 93 113 } 94 114 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>'; 96 116 97 117 } 98 118 } 99 119 100 /* 101 function readability_settings() { 120 function readability_isadmin_settings() { 102 121 add_options_page('Readability Options', 'Readability', 8, __FILE__, 'readability_settings_page'); 103 }*/ 122 } 123 124 function 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¤cy_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 } 104 171 105 172 readability_init(); -
readability/trunk/readme.txt
r355486 r390868 1 1 === Readability === 2 2 Contributors: 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¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted3 Donate 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¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donate_SM%2egif%3aNonHosted 4 4 Tags: reader, reader, legible, elegant, clear, safari 5 5 Requires at least: 2.9 6 Tested up to: 3.1 7 Stable tag: 0.1 -beta96 Tested up to: 3.1.3 7 Stable tag: 0.1 8 8 9 9 == Description == … … 24 24 25 25 == Changelog == 26 27 = 0.1 = 28 * First stable release with implemented settings. 26 29 27 30 = 0.1-beta9 =
Note: See TracChangeset
for help on using the changeset viewer.