|
From: Jon O. <jon...@us...> - 2008-05-22 21:08:04
|
Update of /cvsroot/mxbb/core/includes In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13772 Modified Files: Tag: core28x 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.15.2.7 retrieving revision 1.15.2.8 diff -C2 -d -r1.15.2.7 -r1.15.2.8 *** mx_functions_tools.php 21 Mar 2008 20:05:17 -0000 1.15.2.7 --- mx_functions_tools.php 22 May 2008 21:08:00 -0000 1.15.2.8 *************** *** 1577,1580 **** --- 1577,1611 ---- 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; + } } *************** *** 3597,3600 **** --- 3628,3632 ---- var $max_comment_subject_chars = '50'; var $max_comment_chars = '400'; + var $split_key = '<!-- split -->'; var $formatting_comment_truncate_links = false; *************** *** 3606,3609 **** --- 3638,3642 ---- var $u_delete = ''; var $u_edit = ''; + var $u_more = ''; var $u_pagination = ''; *************** *** 3679,3682 **** --- 3712,3728 ---- * 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 *************** *** 3844,3848 **** if ( $this->max_comment_chars > 0 ) { ! $comments_text = $mx_text_formatting->truncate_text( $comments_text, $this->max_comment_chars, true ); } --- 3890,3895 ---- 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 ); } *************** *** 3886,3889 **** --- 3933,3943 ---- } + 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']), + )); + } } *************** *** 3898,3902 **** $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) { --- 3952,3957 ---- $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) { |