Changeset 12389
- Timestamp:
- Oct 8, 2011, 8:30:16 PM (13 years ago)
- Location:
- extensions/reply_to
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/reply_to/main.inc.php
r11416 r12389 20 20 21 21 add_event_handler('render_comment_content', 'replyto_parse', 60, 2); 22 // add_event_handler('init', 'replyto_add_link');// for comments page (section_init.inc is not called on this page)23 add_event_handler('loc_end_section_init', 'replyto_add_link'); // for all the rest 22 if (script_basename() == 'comments') add_event_handler('init', 'replyto_add_link'); // for comments page (section_init.inc is not called on this page) 23 else add_event_handler('loc_end_section_init', 'replyto_add_link'); // for all other pages (we need section infos) 24 24 25 25 ?> -
extensions/reply_to/reply_to.inc.php
r11416 r12389 9 9 function replyto_add_link() 10 10 { 11 global $pwg_loaded_plugins, $template, $page, $conf ;11 global $pwg_loaded_plugins, $template, $page, $conf, $lang; 12 12 $template->assign('REPLYTO_PATH', REPLYTO_PATH); 13 13 … … 25 25 } 26 26 27 // must check our location + some additional tests 28 // if (script_basename() == 'comments') 29 // { 30 // if ( !is_a_guest() OR $conf['comments_forall'] ) 31 // { 32 // $template->set_prefilter('comments', 'replyto_add_link_prefilter'); 33 // } 34 // } 35 // else 36 if (script_basename() == 'picture') 27 // must check our location 28 if (script_basename() == 'comments') /* COMMENTS page */ 29 { 30 if ( !is_a_guest() OR $conf['comments_forall'] ) 31 { 32 $template->set_prefilter('comments', 'replyto_add_link_comments_prefilter'); 33 } 34 } 35 else if (script_basename() == 'picture') /* PICTURE page */ 37 36 { 38 37 add_event_handler('user_comment_insertion', 'replyto_parse_picture_mail'); … … 43 42 } 44 43 } 45 else if 44 else if /* ALBUM page */ 46 45 ( 47 46 script_basename() == 'index' AND isset($page['section']) AND … … 57 56 } 58 57 } 59 } 60 58 59 /* we come from comments.php page */ 60 if ( !empty($_GET['reply_to']) and !empty($_GET['reply_to_a']) ) 61 { 62 $lang['Comment'].= ' 63 <script type="text/javascript"> 64 $(document).ready(function(){ 65 jQuery("#'.$template->get_template_vars('replyto_form_name').' textarea").insertAtCaret("[reply='.$_GET['reply_to'].']'.$_GET['reply_to_a'].'[/reply] "); 66 }); 67 </script>'; 68 } 69 } 70 71 /** 72 * links to commentform on comments.php page 73 */ 74 function replyto_add_link_comments_prefilter($content, &$smarty) 75 { 76 global $template; 77 $comments = $template->get_template_vars('comments'); 78 79 foreach ($comments as $tpl_var) 80 { 81 $replyto_links[ $tpl_var['ID'] ] = get_absolute_root_url().$tpl_var['U_PICTURE'].'&reply_to='.$tpl_var['ID'].'&reply_to_a='.$tpl_var['AUTHOR'].'#commentform'; 82 } 83 84 $template->assign('replyto_links', $replyto_links); 85 86 // style 87 $search[0] = '<ul class="thumbnailCategories">'; 88 $replace[0] = ' 89 {html_head} 90 <style type="text/css"> 91 .replyTo {ldelim} 92 display:inline-block; 93 width:16px; 94 height:16px; 95 background:url({$REPLYTO_PATH}reply.png) center top no-repeat; 96 } 97 .replyTo:hover {ldelim} 98 background-position:center -16px; 99 } 100 </style> 101 {/html_head}' 102 .$search[0]; 103 104 // button 105 $search[1] = '<span class="author">'; 106 $replace[1] = ' 107 {if not isset($comment.IN_EDIT)} 108 <div class="actions" style="float:right;"> 109 <a href="{$replyto_links[$comment.ID]}" title="{\'reply to this comment\'|@translate}" class="replyTo"> </a> 110 </div> 111 {/if}' 112 .$search[1]; 113 114 return str_replace($search, $replace, $content); 115 } 116 117 /** 118 * links to commentform on picture.php (and index.php) page(s) 119 */ 61 120 function replyto_add_link_prefilter($content, &$smarty) 62 121 { 63 // script 122 // script & style 64 123 $search[0] = '<ul class="thumbnailCategories">'; 65 124 $replace[0] = ' … … 168 227 } 169 228 /* try to parse a ReplyTo tag link for an album */ 170 else 229 else if ( $in_album == 'album') 171 230 { 172 231 // retrieving category informations
Note: See TracChangeset
for help on using the changeset viewer.