Changeset 11294
- Timestamp:
- Jun 10, 2011, 9:02:29 PM (13 years ago)
- Location:
- extensions/SmiliesSupport
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/main.inc.php
r10986 r11294 18 18 add_event_handler('loc_after_page_header', 'add_smiliessupport'); 19 19 20 function add_smiliessupport() { 20 function add_smiliessupport() 21 { 21 22 global $page, $pwg_loaded_plugins; 22 23 23 if (!isset($pwg_loaded_plugins['bbcode_bar']) 24 AND isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') 25 { 24 if ( 25 !isset($pwg_loaded_plugins['bbcode_bar']) 26 AND isset($page['body_id']) AND $page['body_id'] == 'thePicturePage' 27 ) { 26 28 set_smiliessupport(); 27 29 } … … 35 37 array_push($menu, array( 36 38 'NAME' => 'Smilies Support', 37 'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR)); 39 'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR 40 )); 38 41 return $menu; 39 42 } -
extensions/SmiliesSupport/smiliessupport.inc.php
r10986 r11294 5 5 function set_smiliessupport() 6 6 { 7 global $conf, $lang; 7 global $conf, $template, $page; 8 9 load_language('plugin.lang', SMILIES_PATH); 8 10 $conf_smiliessupport = explode(',' , $conf['smiliessupport']); 9 11 10 12 $smilies = get_smilies($conf_smiliessupport); 11 $lang['Comment'] .= SmiliesTable($conf_smiliessupport, $smilies); 13 14 // edit field has different id 15 // if ( 16 // (isset($_GET['action']) AND $_GET['action'] == 'edit_comment') 17 // OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage') 18 // ) { 19 // $template->assign('smilies_textarea', 'contenteditid'); 20 // } else { 21 // $template->assign('smilies_textarea', 'contentid'); 22 // } 23 $template->assign('smilies_textarea', 'contentid'); 24 25 $template->assign(array( 26 'SMILIES_PATH' => SMILIES_PATH, 27 'REPRESENTANT' => PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2], 28 'smiliesfiles' => $smilies, 29 )); 30 31 $template->set_prefilter('picture', 'set_smiliessupport_prefilter'); 32 } 33 34 function set_smiliessupport_prefilter($content, &$smarty) 35 { 36 $search = "<label>{'Comment'|@translate}"; 37 $replace = file_get_contents(SMILIES_PATH.'/template/smiliessupport_page.tpl').$search; 38 return str_replace($search, $replace, $content); 12 39 } 13 40 … … 34 61 35 62 return $smilies; 36 } else { 63 } 64 else 65 { 37 66 return false; 38 67 } 39 }40 41 // get the smilies button ## must received the unserialized configuration array AND the smilies array42 function SmiliesTable($conf_smiliessupport, $smilies)43 {44 global $template;45 load_language('plugin.lang', SMILIES_PATH);46 47 // edit field has different id48 // if (49 // (isset($_GET['action']) AND $_GET['action'] == 'edit_comment')50 // OR (isset($page['body_id']) AND $page['body_id'] == 'theCommentsPage')51 // ) {52 // $template->assign('form_name', 'editComment');53 // } else {54 // $template->assign('form_name', 'addComment');55 // }56 $template->assign('form_name', 'addComment');57 58 $template->assign(array(59 'SMILIES_PATH' => SMILIES_PATH,60 'REPRESENTANT' => PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2],61 'smiliesfiles' => $smilies,62 ));63 64 $template->set_filename('smiliessupport_page', dirname(__FILE__).'/template/smiliessupport_page.tpl');65 return $template->parse('smiliessupport_page', true);66 68 } 67 69 … … 74 76 $def_path = $conf_smiliessupport[0].'/smilies.txt'; 75 77 $accepted_ext = array('gif', 'jpg', 'png'); 78 $str = ' '.$str; 76 79 77 80 if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0])) … … 79 82 while (false !== ($file = readdir($handle))) 80 83 { 81 if ($file != "." && $file != ".." && in_array(get_extension($file), $accepted_ext)) { 82 $v = ':'.get_filename_wo_extension($file).':'; 83 $s = '<img src="'.$conf_smiliessupport[0].'/'.$file.'" alt=":'.get_filename_wo_extension($file).':" title=":'.get_filename_wo_extension($file).':"/>'; 84 if ($file != "." && $file != ".." && in_array(get_extension($file), $accepted_ext)) 85 { 86 $filename = get_filename_wo_extension($file); 87 $v = ':'.$filename.':'; 88 $s = '<img src="'.$conf_smiliessupport[0].'/'.$file.'" alt=":'.$filename.':"/>'; 84 89 $str = str_replace($v, $s, $str); 85 90 } … … 93 98 { 94 99 $v = trim($v); 95 if (preg_match('|^([^\t]*)[\t]+(.*)$|',$v,$matches)) { 96 $r = '#'.preg_quote($matches[1],'/').'#'; 97 $t = '<img src="'.$conf_smiliessupport[0].'/'.$matches[2].'" alt=":'.get_filename_wo_extension($matches[2]).':" title=":'.get_filename_wo_extension($matches[2]).':"/>'; 98 $str = preg_replace($r, $t, $str); 100 if (preg_match('#^([^\t]+)[ \t]+(.+)$#', $v, $matches)) 101 { 102 $filename = get_filename_wo_extension($matches[2]); 103 $v = '#[^"]'.preg_quote($matches[1],'/').'#'; 104 $t = '<img src="'.$conf_smiliessupport[0].'/'.$matches[2].'" alt=":'.$filename.':"/>'; 105 $str = preg_replace($v, $t, $str); 99 106 } 100 107 } 101 108 } 102 109 103 return $str;110 return trim($str); 104 111 } 105 112 -
extensions/SmiliesSupport/template/markitup/style.markitup.css
r10025 r11294 1 1 /* common */ 2 2 .markItUp { 3 3 display:inline-block; 4 4 } 5 5 .markItUp * { 6 7 6 margin:0px; padding:0px; 7 outline:none; 8 8 } 9 9 .markItUp a:link, 10 10 .markItUp a:visited { 11 12 11 color:#000; 12 text-decoration:none; 13 13 } 14 14 .markItUp textarea { 15 15 display:block; 16 16 } 17 17 .markItUpContainer { 18 18 font:11px Verdana, Arial, Helvetica, sans-serif; 19 19 } 20 20 .markItUpEditor { 21 22 23 24 21 font:12px 'Courier New', Courier, monospace; 22 padding:5px; 23 clear:both; 24 overflow:auto; 25 25 } 26 26 .markItUpFooter { 27 27 display:none; 28 28 } 29 29 30 30 /* first row of buttons */ 31 .markItUpHeader ul li 32 33 34 31 .markItUpHeader ul li { 32 list-style:none; 33 float:left; 34 position:relative; 35 35 } 36 36 .markItUpHeader ul li:hover > ul{ 37 37 display:block; 38 38 } 39 39 /* next rows of buttons */ 40 40 .markItUpHeader ul ul { 41 42 43 top:22px; left:0px; 44 45 46 41 display:none; 42 position:absolute; 43 top:22px; left:0px; 44 background:#FFF; 45 border:1px solid #444; 46 border-radius:5px; 47 47 } 48 48 .markItUpHeader ul ul li { 49 50 49 float:none; 50 margin:0px; 51 51 } 52 52 /* links */ 53 53 .markItUpHeader ul a { 54 55 56 57 58 59 60 54 display:block; 55 width:16px; height:16px; 56 text-indent:-10000px; 57 background-position:center center; 58 background-repeat:no-repeat; 59 padding:2px; 60 border:1px solid transparent; 61 61 } 62 62 .markItUpHeader ul a:hover { 63 63 border-color:#08e; 64 64 } 65 65 .markItUpHeader ul ul a { 66 67 68 66 display:block; 67 text-indent:0; 68 border:0; 69 69 } 70 70 71 71 /* smiliessupport */ 72 72 #smiliesdiv a { 73 width:auto;height:auto;74 73 width:auto; height:auto; 74 border:0; 75 75 padding:0; 76 76 } 77 77 #smiliesdiv img { 78 78 border:1px solid transparent; 79 79 } 80 80 #smiliesdiv img:hover { 81 81 border-color:#08e; 82 82 } -
extensions/SmiliesSupport/template/smiliessupport_page.tpl
r10986 r11294 6 6 jQuery(document).ready(function() { 7 7 if (jQuery('.markItUp').length == 0) { 8 jQuery('#{/literal}{$ form_name}{literal} textarea').markItUp({markupSet: []});8 jQuery('#{/literal}{$smilies_textarea}{literal}').markItUp({markupSet: []}); 9 9 } 10 10 jQuery('#SmiliesSupport').appendTo('.markItUpHeader ul:first-child'); 11 jQuery('#allsmilies'). mouseover(function(){12 jQuery("#{/literal}{$ form_name}{literal} textarea").focus();11 jQuery('#allsmilies').hover(function(){ 12 jQuery("#{/literal}{$smilies_textarea}{literal}").focus(); 13 13 jQuery('#smiliesdiv').css('display',''); 14 14 });
Note: See TracChangeset
for help on using the changeset viewer.