Ticket #8759: character_count.diff
File character_count.diff, 5.7 KB (added by , 16 years ago) |
---|
-
wp-admin/includes/schema.php
301 301 add_option('widget_rss', array()); 302 302 add_option('update_core', array()); 303 303 add_option('dismissed_update_core', array()); 304 305 if ( defined( 'WPLANG' ) && preg_match( '/^(bo|dz|ii|ja|km|my|th|zh)/', WPLANG ) ) { 306 add_option('counting_method', 'character'); 307 } else { 308 add_option('counting_method', 'word'); 309 } 304 310 305 311 // Delete unused options 306 312 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins'); -
wp-admin/js/word-count.js
24 24 25 25 setTimeout( function() { 26 26 if ( tx ) { 27 tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( / /gi, ' ' ); 28 tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' ); 29 tx.replace( /\S\s+/g, function(){tc++;} ); 27 if ( wordCountL10n.method == 'character' ) { 28 tx = tx.replace( /<.[^<>]*?>/g, '' ); 29 tx = tx.replace( /&(nbsp|#160|#x00a0);/gi, '' ); 30 tx = tx.replace( /[ \s]/g, '' ); 31 tx = tx.replace( /&(#[\d]{2,5}|#x[a-fA-F\d]{1,4}|[a-zA-Z]{2,8}[1-4]{0,2});/g, ' ' ); 32 tc = tx.length; 33 } else { 34 tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( /&(nbsp|#160|#x00a0);/gi, ' ' ); 35 tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' ); 36 tx.replace( /\S\s+/g, function(){tc++;} ); 37 } 30 38 } 31 39 w.html(tc.toString()); 32 40 -
wp-admin/options-writing.php
53 53 ?> 54 54 </td> 55 55 </tr> 56 <tr valign="top"> 57 <th scope="row"><?php _e('Counting method') ?></th> 58 <td><fieldset><legend class="hidden"><?php _e('Counting method') ?></legend> 59 60 <input name="counting_method" type="radio" id="word_count" value="word" <?php checked('word', get_option('counting_method')); ?> /> 61 <label for="word_count"><?php _e('Word Count') ?></label><br /> 62 <input name="counting_method" type="radio" id="character_count" value="character" <?php checked('character', get_option('counting_method')); ?> /> 63 <label for="character_count"><?php _e('Character Count') ?></label> 64 </fieldset></td> 65 </tr> 56 66 <?php do_settings_fields('writing', 'default'); ?> 57 67 </table> 58 68 -
wp-admin/options.php
28 28 'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ), 29 29 'privacy' => array( 'blog_public' ), 30 30 'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'blog_charset', 'show_on_front', 'page_on_front', 'page_for_posts' ), 31 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc' ),31 'writing' => array( 'default_post_edit_rows', 'use_smilies', 'ping_sites', 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass', 'default_category', 'default_email_category', 'use_balanceTags', 'default_link_category', 'enable_app', 'enable_xmlrpc', 'counting_method' ), 32 32 'options' => array( '' ) ); 33 33 if ( !defined( 'WP_SITEURL' ) ) $whitelist_options['general'][] = 'siteurl'; 34 34 if ( !defined( 'WP_HOME' ) ) $whitelist_options['general'][] = 'home'; -
wp-includes/script-loader.php
247 247 'l10n_print_after' => 'try{convertEntities(widgetsL10n);}catch(e){};' 248 248 )); 249 249 250 if ('character' == get_option('counting_method') ) { 251 $counting_method = __('Character count: %d'); 252 } else { 253 $counting_method = __('Word count: %d'); 254 } 250 255 $scripts->add( 'word-count', '/wp-admin/js/word-count.js', array( 'jquery' ), '20081210' ); 251 256 $scripts->localize( 'word-count', 'wordCountL10n', array( 252 'count' => __('Word count: %d'), 257 'count' => $counting_method, 258 'method' => get_option('counting_method'), 253 259 'l10n_print_after' => 'try{convertEntities(wordCountL10n);}catch(e){};' 254 260 )); 255 261