Changeset 821261
- Timestamp:
- 12/13/2013 05:51:25 PM (12 years ago)
- Location:
- word-statistics-plugin/trunk
- Files:
-
- 2 edited
-
fdwordstats.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
word-statistics-plugin/trunk/fdwordstats.php
r79046 r821261 6 6 Author: John Watson 7 7 Author URI: http://flagrantdisregard.com/ 8 Version: 1. 28 Version: 1.3 9 9 */ 10 10 … … 302 302 */ 303 303 304 function wordstats_add_meta_box() { 305 add_meta_box('wordstats', 'Writing analysis', 'wordstats_meta_box', 'post'); 306 add_meta_box('wordstats', 'Writing analysis', 'wordstats_meta_box', 'page'); 307 } 308 304 309 // Draw the readability statistics for the post 305 310 // being edited and the help rollovers. 306 function wordstats_ draw_admin_footer() {311 function wordstats_meta_box() { 307 312 global $wpdb; 308 313 global $post; … … 310 315 311 316 if ($post->post_content != '') { 312 $stat = new WordStats ;317 $stat = new WordStats(); 313 318 $stat->set_text($post->post_content); 314 $template = ''; 315 if (version_compare($wp_version, "2.7", ">=")) { 316 $template = '<div id="wordstats">' 317 .'<span>Sentences: %d</span> ' 318 .'<span title="Score indicates number of years of education required for comprehension.">Fog: %2.1f</span> ' 319 .'<span title="Score indicates number of years of education required for comprehension.">Kincaid: %2.1f</span> ' 320 .'<span title="Readability score between 0 (worst) and 100 (best).">Flesch: %3.0f</span> ' 321 .'</div>'; 322 $pluginHTML = sprintf($template, 323 $stat->get_sentences(), 324 $stat->get_fog(), 325 $stat->get_flesch_kincaid(), 326 $stat->get_flesch() 327 ); 328 printf('<script language="javascript" type="text/javascript"> 329 var div = document.getElementById("post-status-info"); 330 if (div != undefined) { 331 div.innerHTML = div.innerHTML + \'%s\'; 332 } 333 </script>', str_replace("'", "\'", $pluginHTML) 334 ); 335 } else { 336 $template = '<div id="wordstats">' 337 .'<span>Words:</strong> %d</span> ' 338 .'<span>Sentences: %d</span> ' 339 .'<span title="Score indicates number of years of education required for comprehension.">Fog: %2.1f</span> ' 340 .'<span title="Score indicates number of years of education required for comprehension.">Kincaid: %2.1f</span> ' 341 .'<span title="Readability score between 0 (worst) and 100 (best).">Flesch: %3.0f</span> ' 342 .'</div>'; 343 $pluginHTML = sprintf($template, 344 $stat->get_words(), 345 $stat->get_sentences(), 346 $stat->get_fog(), 347 $stat->get_flesch_kincaid(), 348 $stat->get_flesch() 349 ); 350 printf('<script language="javascript" type="text/javascript"> 351 var div = document.getElementById("titlediv"); 352 if (div != undefined) { 353 div.innerHTML = \'%s\' + div.innerHTML; 354 } 355 </script>', str_replace("'", "\'", $pluginHTML) 356 ); 357 } 358 } 359 } 360 361 // Inject some CSS into the header for displaying 362 // the readability stats of the post being edited. 363 function wordstats_draw_admin_header() { 364 echo ' 365 <style type="text/css"> 366 #wordstats span { 367 padding-right: 15px; 368 } 369 </style> 370 '; 319 $template = 320 '<table width="100%%"><tr>' 321 .'<td align="left" width="35%%">Sentences<br>%d</td> ' 322 .'<td align="left" width="20%%" title="Score indicates number of years of education required for comprehension.">Fog<br>%2.1f</td> ' 323 .'<td align="left" width="25%%" title="Score indicates number of years of education required for comprehension.">Kincaid<br>%2.1f</td> ' 324 .'<td align="left" width="20%%" title="Readability score between 0 (worst) and 100 (best).">Flesch<br>%3.0f</td> ' 325 .'</tr></table>'; 326 printf($template, 327 $stat->get_sentences(), 328 $stat->get_fog(), 329 $stat->get_flesch_kincaid(), 330 $stat->get_flesch() 331 ); 332 } 371 333 } 372 334 … … 452 414 ================================================== 453 415 */ 454 add_action('admin_head', 'wordstats_draw_admin_header'); 455 add_action('admin_footer', 'wordstats_draw_admin_footer'); 456 ?> 416 add_action('add_meta_boxes', 'wordstats_add_meta_box'); -
word-statistics-plugin/trunk/readme.txt
r634071 r821261 3 3 Donate link: http://flagrantdisregard.com/wordstats/ 4 4 Tags: posts, writing, editing, readability, analysis, word count, sentence count, statistics 5 Requires at least: 2.06 Tested up to: 3. 4.25 Requires at least: 3.0 6 Tested up to: 3.8 7 7 Stable tag: trunk 8 8 … … 49 49 == Changelog == 50 50 51 = 1.2 = 52 * This is a placeholder for the next release. 51 = 1.3 = 52 * Moved information into a meta box titled "Writing analysis" 53 * Requires version 3.0 or higher
Note: See TracChangeset
for help on using the changeset viewer.