|
From: Jon O. <jon...@us...> - 2008-05-22 21:08:35
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv14228 Modified Files: mx_functions_tools.php Log Message: Update to generic comments class Index: mx_functions_tools.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/mx_functions_tools.php,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** mx_functions_tools.php 27 Apr 2008 18:42:57 -0000 1.27 --- mx_functions_tools.php 22 May 2008 21:08:30 -0000 1.28 *************** *** 1605,1608 **** --- 1605,1639 ---- return $mytext; } + + /** + * Enter description here... + * + * @param unknown_type $mytext + * @param unknown_type $length + * @param unknown_type $add_dots + * @return unknown + */ + function split_text( $mytext, $length = 200, $add_dots = true, $key = '<!-- split -->' ) + { + $do_trunc = false; + $split_pos = strrpos($mytext, $key) > $length ? strrpos($mytext, $key) : $length; + if ( strlen( $mytext ) > $split_pos ) + { + $do_trunc = true; + + $shortstring = substr($mytext, 0, $split_pos); + $lastdot = strrpos($shortstring, "."); + $lastspace = strrpos($shortstring, " "); + $shortstring = substr($shortstring, 0, ($lastdot > $lastspace? $lastdot : $lastspace)); + $shortstring = str_replace('<br/>', '<br />', $shortstring); + + if ( $add_dots ) + { + $shortstring .= '...'; + } + return $shortstring; + } + return $mytext; + } } *************** *** 3628,3631 **** --- 3659,3663 ---- var $max_comment_subject_chars = '50'; var $max_comment_chars = '400'; + var $split_key = '<!-- split -->'; var $formatting_comment_truncate_links = false; *************** *** 3638,3641 **** --- 3670,3674 ---- var $u_delete = ''; var $u_edit = ''; + var $u_more = ''; var $u_pagination = ''; *************** *** 3717,3720 **** --- 3750,3766 ---- * Enter description here... * + * @param unknown_type $cid + * @return unknown + */ + function u_more($cid) + { + global $mx_request_vars; + $more = $mx_request_vars->is_request('virtual') ? '&virtual=' . $mx_request_vars->request('virtual', MX_TYPE_INT, 0) : ''; + return mx_append_sid($this->u_more . '&cid='.$cid .$more); + } + + /** + * Enter description here... + * * @param unknown_type $page_num * @return unknown *************** *** 3885,3889 **** if ( $this->max_comment_chars > 0 ) { ! $comments_text = $mx_text_formatting->truncate_text( $comments_text, $this->max_comment_chars, true ); } --- 3931,3936 ---- if ( $this->max_comment_chars > 0 ) { ! //$comments_text = $mx_text_formatting->truncate_text( $comments_text, $this->max_comment_chars, true ); ! $comments_text = $mx_text_formatting->split_text( $comments_text, $this->max_comment_chars, true, $this->split_key ); } *************** *** 3929,3932 **** --- 3976,3987 ---- } + if ( !empty($this->u_more) ) + { + $template->assign_block_vars( 'use_comments.text.more', array( + 'L_COMMENT_MORE' => $lang['Comment_more'], + 'U_COMMENT_MORE' => $this->u_more($this->comments_row['comments_id']), + )); + } + } *************** *** 3942,3946 **** $num_of_replies = intval( $this->total_comments ); ! $pagination = phpBB2::generate_pagination( $this->u_pagination($page_num), $num_of_replies, $this->pagination_num, $this->start ) . ' '; if ($num_of_replies > 0) { --- 3997,4002 ---- $num_of_replies = intval( $this->total_comments ); ! //$pagination = phpBB2::generate_pagination( $this->u_pagination($page_num), $num_of_replies, $this->pagination_num, $this->start ) . ' '; ! $pagination = mx_generate_pagination( $this->u_pagination($page_num), $num_of_replies, $this->pagination_num, $this->start, true, true, true, false ) . ' '; if ($num_of_replies > 0) { |