Changeset 11294


Ignore:
Timestamp:
Jun 10, 2011, 9:02:29 PM (13 years ago)
Author:
mistic100
Message:

parsing bug fixed, works with theme 'Simple'

Location:
extensions/SmiliesSupport
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmiliesSupport/main.inc.php

    r10986 r11294  
    1818add_event_handler('loc_after_page_header', 'add_smiliessupport');
    1919
    20 function add_smiliessupport() {
     20function add_smiliessupport()
     21{
    2122  global $page, $pwg_loaded_plugins;
    2223 
    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  ) {
    2628    set_smiliessupport();
    2729  }
     
    3537    array_push($menu, array(
    3638      '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    ));
    3841    return $menu;
    3942  }
  • extensions/SmiliesSupport/smiliessupport.inc.php

    r10986 r11294  
    55function set_smiliessupport()
    66{
    7   global $conf, $lang;
     7  global $conf, $template, $page;
     8 
     9  load_language('plugin.lang', SMILIES_PATH);
    810  $conf_smiliessupport = explode(',' , $conf['smiliessupport']);
    911 
    1012  $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
     34function 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);
    1239}
    1340
     
    3461   
    3562    return $smilies;
    36   } else {
     63  }
     64  else
     65  {
    3766    return false;
    3867  }
    39 }
    40 
    41 // get the smilies button ## must received the unserialized configuration array AND the smilies array
    42 function SmiliesTable($conf_smiliessupport, $smilies)
    43 {
    44   global $template;
    45   load_language('plugin.lang', SMILIES_PATH);
    46 
    47   // edit field has different id
    48   // 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);
    6668}
    6769
     
    7476  $def_path = $conf_smiliessupport[0].'/smilies.txt';
    7577  $accepted_ext = array('gif', 'jpg', 'png');
     78  $str = ' '.$str;
    7679 
    7780  if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0]))
     
    7982    while (false !== ($file = readdir($handle)))
    8083    {
    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.':"/>';
    8489        $str = str_replace($v, $s, $str);
    8590      }
     
    9398    {
    9499      $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);
    99106      }
    100107    }
    101108  }
    102109 
    103   return $str;
     110  return trim($str);
    104111}
    105112
  • extensions/SmiliesSupport/template/markitup/style.markitup.css

    r10025 r11294  
    11/* common */
    22.markItUp {
    3         display:inline-block;
     3  display:inline-block;
    44}
    55.markItUp * {
    6         margin:0px; padding:0px;
    7         outline:none;
     6  margin:0px; padding:0px;
     7  outline:none;
    88}
    99.markItUp a:link,
    1010.markItUp a:visited {
    11         color:#000;
    12         text-decoration:none;
     11  color:#000;
     12  text-decoration:none;
    1313}
    1414.markItUp textarea {
    15         display:block;
     15  display:block;
    1616}
    1717.markItUpContainer  {
    18         font:11px Verdana, Arial, Helvetica, sans-serif;
     18  font:11px Verdana, Arial, Helvetica, sans-serif;
    1919}
    2020.markItUpEditor {
    21         font:12px 'Courier New', Courier, monospace;
    22         padding:5px;
    23         clear:both;
    24         overflow:auto;
     21  font:12px 'Courier New', Courier, monospace;
     22  padding:5px;
     23  clear:both;
     24  overflow:auto;
    2525}
    2626.markItUpFooter {
    27         display:none;
     27  display:none;
    2828}
    2929
    3030/* first row of buttons */
    31 .markItUpHeader ul li   {
    32         list-style:none;
    33         float:left;
    34         position:relative;
     31.markItUpHeader ul li  {
     32  list-style:none;
     33  float:left;
     34  position:relative;
    3535}
    3636.markItUpHeader ul li:hover > ul{
    37         display:block;
     37  display:block;
    3838}
    3939/* next rows of buttons */
    4040.markItUpHeader ul ul {
    41         display:none;
    42         position:absolute;
    43         top:22px; left:0px;     
    44         background:#FFF;
    45         border:1px solid #444;
    46         border-radius:5px;
     41  display:none;
     42  position:absolute;
     43  top:22px; left:0px; 
     44  background:#FFF;
     45  border:1px solid #444;
     46  border-radius:5px;
    4747}
    4848.markItUpHeader ul ul li {
    49         float:none;
    50         margin:0px;
     49  float:none;
     50  margin:0px;
    5151}
    5252/* links */
    5353.markItUpHeader ul a {
    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;
     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;
    6161}
    6262.markItUpHeader ul a:hover {
    63         border-color:#08e;
     63  border-color:#08e;
    6464}
    6565.markItUpHeader ul ul a {
    66         display:block;
    67         text-indent:0;
    68         border:0;
     66  display:block;
     67  text-indent:0;
     68  border:0;
    6969}
    7070
    7171/* smiliessupport */
    7272#smiliesdiv a {
    73         width:auto;     height:auto;
    74         border:0;
     73  width:auto;  height:auto;
     74  border:0;
    7575  padding:0;
    7676}
    7777#smiliesdiv img {
    78         border:1px solid transparent;
     78  border:1px solid transparent;
    7979}
    8080#smiliesdiv img:hover {
    81         border-color:#08e;
     81  border-color:#08e;
    8282}
  • extensions/SmiliesSupport/template/smiliessupport_page.tpl

    r10986 r11294  
    66jQuery(document).ready(function() {
    77  if (jQuery('.markItUp').length == 0) {
    8     jQuery('#{/literal}{$form_name}{literal} textarea').markItUp({markupSet: []});
     8    jQuery('#{/literal}{$smilies_textarea}{literal}').markItUp({markupSet: []});
    99  }
    1010  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();
    1313    jQuery('#smiliesdiv').css('display','');
    1414  });
Note: See TracChangeset for help on using the changeset viewer.