if (@txpinterface == 'admin') { register_callback("smd_article_info", "article"); } // Client-side info function smd_article_stats($atts, $thing=NULL) { global $thisarticle; assert_article(); extract(lAtts(array( 'wraptag' => '', 'class' => __FUNCTION__, 'break' => '', 'label' => '', 'labeltag' => '', 'item' => '', ), $atts)); $out = array(); $item = do_list($item); $out[] = smd_article_info_count($item, $thisarticle['body'], $thisarticle['excerpt'], $thisarticle['title']); return doLabel($label, $labeltag).doWrap($out, $wraptag, $break, $class); } // Admin-side info -- auto-updated via jQuery function smd_article_info($event, $step) { extract(gpsa(array('view'))); include_once txpath.'/publish/taghandlers.php'; if(!$view || gps('save') || gps('publish')) { $view = 'text'; } if ($view == 'text') { $screen_locs = array( 'none' => '', 'excerpt_below' => 'da|article-main', 'status_above' => 'jq|#write-status|before', 'title_above' => 'jq|#article-main|prepend', 'textile_help_above' => 'jq|#article-col-1|prepend', 'textile_help_below' => 'jq|#textile_help|after', ); // Check hidden pref and sanitize $posn = get_pref('smd_article_stats_pos', 'status_above'); $posn = (array_key_exists($posn, $screen_locs)) ? $posn : 'status_above'; $placer = explode('|', $screen_locs[$posn]); $id = (empty($GLOBALS['ID']) ? gps('ID') : $GLOBALS['ID']); $item = array('excerpt', 'body'); if (empty($id)) { $rs = array('Body' => '', 'Excerpt' => '', 'Status' => ''); } else { $rs = safe_row('Body, Excerpt, Status', 'textpattern', 'ID='.doSlash($id)); } $bwc = smd_article_info_count($item, $rs['Body'], '', ''); $ewc = smd_article_info_count($item, '', $rs['Excerpt'], ''); $words = $bwc + $ewc; $idlink = ($id && in_array($rs['Status'], array(4,5))) ? '' .$id. '' : $id; $out1 = '
'; $out2 = <<