Changeset 26075


Ignore:
Timestamp:
Dec 21, 2013, 11:02:21 PM (10 years ago)
Author:
mistic100
Message:

update for Piwigo 2.6 + many code and logical cleaning

Location:
extensions/SmiliesSupport
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • extensions/SmiliesSupport/admin.php

    r23236 r26075  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     2defined('SMILIES_ID') or die('Hacking attempt!');
    33
    44include_once(SMILIES_PATH.'include/functions.inc.php');
     
    99$sets = array();
    1010$handle = opendir(SMILIES_DIR);
    11 while (false !== ($folder = readdir($handle)))
     11while ($folder = readdir($handle))
    1212{
    13   if ( $folder != '.' && $folder != '..' && is_dir(SMILIES_DIR.$folder) )
     13  if ($folder != '.' && $folder != '..' && is_dir(SMILIES_DIR.$folder))
    1414  {
    15     if (file_exists(SMILIES_DIR.$folder.'/representant.txt'))
     15    if (file_exists(SMILIES_DIR . $folder . '/representant.txt'))
    1616    {
    17       $sets[$folder] = file_get_contents(SMILIES_DIR.$folder.'/representant.txt');
     17      $sets[$folder] = file_get_contents(SMILIES_DIR . $folder . '/representant.txt');
    1818    }
    1919    else
    2020    {
    21       $sets[$folder] = get_first_file(SMILIES_DIR.$folder, $conf['smiliessupport']['ext']);
     21      $sets[$folder] = get_first_file(SMILIES_DIR . $folder, $conf['smiliessupport_ext']);
    2222    }
    2323  }
     
    3737 
    3838  conf_update_param('smiliessupport', serialize($conf['smiliessupport']));
    39   array_push($page['infos'], l10n('Information data registered in database'));
     39  $page['infos'][] = l10n('Information data registered in database');
    4040 
    4141  // shortcuts file
     
    5252      if (array_key_exists($short, $used))
    5353      {
    54         $page['errors'][] = sprintf(
    55                               l10n('<i>%s</i>, shortcut &laquo; %s &raquo; already used for <i>%s</i>'),
    56                               get_filename_wo_extension($file),
    57                               $short,
    58                               get_filename_wo_extension($used[ $short ])
    59                               );
     54        $page['errors'][] = l10n(
     55          '<i>%s</i>, shortcut &laquo; %s &raquo; already used for <i>%s</i>',
     56          get_filename_wo_extension($file),
     57          $short,
     58          get_filename_wo_extension($used[ $short ])
     59          );
    6060      }
    6161      else
     
    8080  'SETS' =>         $sets,
    8181  'SMILIES_PATH' => SMILIES_PATH,
    82 ));
     82  ));
    8383
    8484
    85 $template->set_filename('smiliessupport_conf', dirname(__FILE__).'/template/smiliessupport_admin.tpl');
     85$template->set_filename('smiliessupport_conf', realpath(SMILIES_PATH . 'template/smiliessupport_admin.tpl'));
    8686$template->assign_var_from_handle('ADMIN_CONTENT', 'smiliessupport_conf');
    87 
    88 ?>
  • extensions/SmiliesSupport/include/events.inc.php

    r24342 r26075  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     2defined('SMILIES_ID') or die('Hacking attempt!');
    33
    4 // add smilies button to the comment field
    5 function set_smiliessupport($prefilter='picture', $textarea_id='contentid')
     4function smiliessupport_admin_menu($menu)
    65{
    7   global $conf, $template;
     6  $menu[] = array(
     7    'NAME' => 'Smilies Support',
     8    'URL' => SMILIES_ADMIN,
     9    );
     10  return $menu;
     11}
     12
     13function add_smiliessupport()
     14{
     15  global $page, $pwg_loaded_plugins, $template, $conf;
     16 
     17  if (script_basename() == 'picture')
     18  {
     19    $prefilter = 'picture';
     20    $textarea_id = 'contentid';
     21  }
     22  else if (isset($page['section']))
     23  {
     24    if (
     25      script_basename() == 'index' and isset($pwg_loaded_plugins['Comments_on_Albums'])
     26      and $page['section'] == 'categories' and isset($page['category'])
     27      )
     28    {
     29      $prefilter = 'comments_on_albums';
     30      $textarea_id = 'contentid';
     31    }
     32    else if ($page['section'] == 'guestbook')
     33    {
     34      $prefilter = 'guestbook';
     35      $textarea_id = 'contentid';
     36    }
     37    else if ($page['section'] == 'contact')
     38    {
     39      $prefilter = 'contactform';
     40      $textarea_id = 'cf_content';
     41    }
     42  }
     43 
     44  if (!isset($prefilter))
     45  {
     46    return;
     47  }
    848
    949  $template->assign(array(
    1050    'SMILIES_PATH' => SMILIES_PATH,
    11     'SMILIES_ID' =>   $textarea_id,
    12     'REPRESENTANT' => SMILIES_DIR.$conf['smiliessupport']['folder'].'/'.$conf['smiliessupport']['representant'],
    13     'smiliesfiles' => get_smilies(),
    14   ));
    15  
    16   $template->set_prefilter($prefilter, 'set_smiliessupport_prefilter'); 
    17 }
    18 
    19 function set_smiliessupport_prefilter($content, &$smarty)
    20 {
    21   $search = '#(<div id="guestbookAdd">|<div id="commentAdd">|<div class="contact">)#';
    22   $replace = file_get_contents(SMILIES_PATH.'/template/smiliessupport_page.tpl').'$1';
    23   return preg_replace($search, $replace, $content);
    24 }
    25 
    26 // return an array with available smilies (name and path)
    27 function get_smilies()
    28 {
    29   global $conf;
    30  
    31   if ($handle = opendir(SMILIES_DIR.$conf['smiliessupport']['folder']))
    32   {
    33     $i = 1;
    34     while (false !== ($file = readdir($handle)))
    35     {
    36       if ($file != '.' and $file != '..' and in_array(get_extension($file), $conf['smiliessupport']['ext']))
    37       {
    38         $smilies[] = array(
    39           'PATH' => SMILIES_DIR.$conf['smiliessupport']['folder'].'/'.$file,
    40           'TITLE' => ':'.get_filename_wo_extension($file).':',
    41           'TR' => ($i>0 and $i%$conf['smiliessupport']['cols'] == 0) ? '</tr><tr>' : null,
    42         );
    43         $i++;
    44       }
    45     }
     51    'SMILIES' => array(
     52      'textarea_id' => $textarea_id,
     53      'representant' => SMILIES_DIR . $conf['smiliessupport']['folder'] . '/' . $conf['smiliessupport']['representant'],
     54      'files' => get_smilies(),
     55      ),
     56    ));
    4657   
    47     closedir($handle);
    48     return $smilies;
    49   }
    50   else
    51   {
    52     return false;
    53   }
     58  $template->set_filename('smiliessupport', realpath(SMILIES_PATH . 'template/smiliessupport_page.tpl'));
     59  $template->parse('smiliessupport');
    5460}
    5561
     
    6773    while (false !== ($file = readdir($handle)))
    6874    {
    69       if ($file != "." && $file != ".." && in_array(get_extension($file), $conf['smiliessupport']['ext']))
     75      if ($file != "." && $file != ".." && in_array(get_extension($file), $conf['smiliessupport_ext']))
    7076      {
    7177        $filename = get_filename_wo_extension($file);
     
    105111}
    106112
    107 ?>
     113function smiliessupport_action()
     114{
     115  if (!isset($_GET['action'])) return;
     116  if (strpos($_GET['action'], 'ss_') !== 0) return;
     117 
     118  global $conf;
     119 
     120  $folder = SMILIES_DIR . ltrim($_GET['folder'], '/') . '/';
     121 
     122  if ($_GET['action'] == 'ss_reset')
     123  {
     124    @unlink($folder.'smilies-custom.txt');
     125    $_GET['action'] = 'ss_list';
     126  }
     127  else if ($_GET['action'] == 'ss_list')
     128  {
     129    $short = array();
     130    if (file_exists($folder.'smilies-custom.txt'))
     131    {
     132      $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES);
     133    }
     134    else if (file_exists($folder.'smilies.txt'))
     135    {
     136      $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES);
     137    }
     138    if (!empty($file))
     139    {
     140      foreach ($file as $v)
     141      {
     142        if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches))
     143        {
     144          $short[ $matches[2] ][] = $matches[1];
     145        }
     146      }
     147    }
     148
     149    $smilies = array();
     150    $handle = opendir($folder);
     151    while (false !== ($file = readdir($handle)))
     152    {
     153      if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport_ext']) )
     154      {
     155        $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]);
     156      }
     157    }
     158    closedir($handle);
     159   
     160    echo json_encode(array('path'=>$folder, 'smilies'=>$smilies));
     161  }
     162 
     163  exit;
     164}
  • extensions/SmiliesSupport/include/functions.inc.php

    r23236 r26075  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     2defined('SMILIES_ID') or die('Hacking attempt!');
     3
     4// return an array with available smilies (name and path)
     5function get_smilies()
     6{
     7  global $conf;
     8 
     9  if ($handle = opendir(SMILIES_DIR.$conf['smiliessupport']['folder']))
     10  {
     11    $i = 1;
     12    while (false !== ($file = readdir($handle)))
     13    {
     14      if ($file != '.' and $file != '..' and
     15          in_array(get_extension($file), $conf['smiliessupport_ext'])
     16        )
     17      {
     18        $smilies[] = array(
     19          'PATH' => SMILIES_DIR.$conf['smiliessupport']['folder'].'/'.$file,
     20          'TITLE' => ':'.get_filename_wo_extension($file).':',
     21          'TR' => ($i>0 and $i%$conf['smiliessupport']['cols'] == 0) ? '</tr><tr>' : null,
     22        );
     23        $i++;
     24      }
     25    }
     26   
     27    closedir($handle);
     28    return $smilies;
     29  }
     30  else
     31  {
     32    return false;
     33  }
     34}
    335
    436function get_first_file($path, $ext=null)
     
    739  $handle = opendir($path);
    840 
    9   while ( false !== ($file=readdir($handle)) )
     41  while (false !== ($file=readdir($handle)))
    1042  {
    11     if ( $file!='.' && $file!='..' && is_file($path.$file) && (!is_array($ext) || in_array(get_extension($file), $ext)) )
     43    if ($file!='.' and $file!='..' and is_file($path.$file) and
     44        (!is_array($ext) or in_array(get_extension($file), $ext))
     45      )
    1246    {
    1347      closedir($handle);
     
    1953  return null;
    2054}
    21 
    22 function smiliessupport_action()
    23 {
    24   if (!isset($_GET['action'])) return;
    25   if (strpos($_GET['action'], 'ss_') !== 0) return;
    26  
    27   global $conf;
    28  
    29   $folder = SMILIES_DIR . ltrim($_GET['folder'], '/') . '/';
    30  
    31   if ($_GET['action'] == 'ss_reset')
    32   {
    33     @unlink($folder.'smilies-custom.txt');
    34     $_GET['action'] = 'ss_list';
    35   }
    36  
    37   if ($_GET['action'] == 'ss_list')
    38   {
    39     $short = array();
    40     if (file_exists($folder.'smilies-custom.txt'))
    41     {
    42       $file = file($folder.'smilies-custom.txt', FILE_IGNORE_NEW_LINES);
    43     }
    44     else if (file_exists($folder.'smilies.txt'))
    45     {
    46       $file = file($folder.'smilies.txt', FILE_IGNORE_NEW_LINES);
    47     }
    48     if (!empty($file))
    49     {
    50       foreach ($file as $v)
    51       {
    52         if (preg_match('#^([^\s]+)[\s]+(.+)$#', trim($v), $matches))
    53         {
    54           $short[ $matches[2] ][] = $matches[1];
    55         }
    56       }
    57     }
    58 
    59     $smilies = array();
    60     $handle = opendir($folder);
    61     while (false !== ($file = readdir($handle)))
    62     {
    63       if ( $file != '.' && $file != '..' && in_array(get_extension($file), $conf['smiliessupport']['ext']) )
    64       {
    65         $smilies[$file] = array('title'=>':'.get_filename_wo_extension($file).':', 'file'=>$file, 'short'=>@$short[$file]);
    66       }
    67     }
    68     closedir($handle);
    69    
    70     echo json_encode(array('path'=>$folder, 'smilies'=>$smilies));
    71   }
    72  
    73   exit;
    74 }
    75 
    76 ?>
  • extensions/SmiliesSupport/main.inc.php

    r23236 r26075  
    88*/
    99
    10 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     10defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    1111
    12 define('SMILIES_ID',   basename(dirname(__FILE__)));
    13 define('SMILIES_PATH', PHPWG_PLUGINS_PATH . SMILIES_ID . '/');
    14 define('SMILIES_DIR',  SMILIES_PATH . 'smilies/');
     12define('SMILIES_ID',      basename(dirname(__FILE__)));
     13define('SMILIES_PATH',    PHPWG_PLUGINS_PATH . SMILIES_ID . '/');
     14define('SMILIES_DIR',     SMILIES_PATH . 'smilies/');
     15define('SMILIES_ADMIN',   get_root_url() . 'admin.php?page=plugin-' . SMILIES_ID);
     16define('SMILIES_VERSION', 'auto');
     17
    1518
    1619include_once(SMILIES_PATH.'include/functions.inc.php');
    17 include_once(SMILIES_PATH.'include/smiliessupport.inc.php');
     20include_once(SMILIES_PATH.'include/events.inc.php');
     21
    1822
    1923add_event_handler('init', 'init_smiliessupport');
    20 add_event_handler('render_comment_content', 'SmiliesParse', 60);
     24
     25if (defined('IN_ADMIN'))
     26{
     27  add_event_handler('init', 'smiliessupport_action');
     28  add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu');
     29}
     30else
     31{
     32  add_event_handler('loc_after_page_header', 'add_smiliessupport', EVENT_HANDLER_PRIORITY_NEUTRAL+2);
     33}
     34
     35add_event_handler('render_comment_content', 'SmiliesParse', EVENT_HANDLER_PRIORITY_NEUTRAL+10);
    2136add_event_handler('render_contact_content', 'SmiliesParse');
    22 add_event_handler('loc_after_page_header', 'add_smiliessupport');
    2337
    2438
     
    2741  global $conf;
    2842 
     43  include_once(SMILIES_PATH . 'maintain.inc.php');
     44  $maintain = new SmiliesSupport_maintain(SMILIES_ID);
     45  $maintain->autoUpdate(SMILIES_VERSION, 'install');
     46 
    2947  $conf['smiliessupport'] = unserialize($conf['smiliessupport']);
    30   $conf['smiliessupport']['ext'] = array('gif', 'jpg', 'png', 'GIF', 'JPG', 'PNG');
     48  $conf['smiliessupport_ext'] = array('gif', 'jpg', 'png', 'GIF', 'JPG', 'PNG');
    3149 
    3250  load_language('plugin.lang', SMILIES_PATH);
    3351}
    34 
    35 function add_smiliessupport()
    36 {
    37   global $page, $pwg_loaded_plugins;
    38  
    39   // if BBCodeBar is installed let him manage smilies
    40   if (isset($pwg_loaded_plugins['bbcode_bar'])) return;
    41  
    42   if (isset($page['body_id']) AND $page['body_id'] == 'thePicturePage')
    43   {
    44     $prefilter = 'picture';
    45     $textarea_id = 'contentid';
    46   }
    47   else if (
    48     script_basename() == 'index' and isset($pwg_loaded_plugins['Comments_on_Albums'])
    49     and isset($page['section']) and $page['section'] == 'categories' and isset($page['category'])
    50     )
    51   {
    52     $prefilter = 'comments_on_albums';
    53     $textarea_id = 'contentid';
    54   }
    55   else if (isset($page['section']) and $page['section'] == 'guestbook')
    56   {
    57     $prefilter = 'index';
    58     $textarea_id = 'contentid';
    59   }
    60   else if (isset($page['section']) and $page['section'] == 'contact')
    61   {
    62     $prefilter = 'index';
    63     $textarea_id = 'cf_content';
    64   }
    65  
    66   if (isset($prefilter))
    67   {
    68     set_smiliessupport($prefilter, $textarea_id);
    69   }
    70 }
    71 
    72 if (script_basename() == 'admin')
    73 {
    74   add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu');
    75   add_event_handler('init', 'smiliessupport_action');
    76  
    77   function smiliessupport_admin_menu($menu)
    78   {
    79     array_push($menu, array(
    80       'NAME' => 'Smilies Support',
    81       'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_ID
    82     ));
    83     return $menu;
    84   }
    85 }
    86 
    87 ?>
  • extensions/SmiliesSupport/maintain.inc.php

    r23234 r26075  
    11<?php
    2 if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
     2defined('PHPWG_ROOT_PATH') or die('Hacking attempt!');
    33
    4 function plugin_install()
     4class SmiliesSupport_maintain extends PluginMaintain
    55{
    6   $new_smiliessupport =  array(
     6  private $installed = false;
     7 
     8  private $default_conf = array(
    79    'folder'       => 'crystal',
    810    'cols'         => '6',
    911    'representant' => 'smile.png',
    10   );
    11  
    12   conf_update_param('smiliessupport', serialize($new_smiliessupport));
    13 }
     12    );
    1413
    15 function plugin_activate()
    16 {
    17   global $conf;
    18  
    19   if (strpos($conf['smiliessupport'],',') !== false)
     14  function install($plugin_version, &$errors=array())
    2015  {
    21     $conf_smiliessupport = explode(',', $conf['smiliessupport']);
     16    global $conf;
    2217   
    23     switch ($conf_smiliessupport[0])
     18    if (isset($conf['smiliessupport']))
    2419    {
    25       case 'plugins/SmiliesSupport/smilies': $conf_smiliessupport[0] = 'ipb'; break;
    26       case 'plugins/SmiliesSupport/smilies_2': $conf_smiliessupport[0] = 'sylvia'; break;
    27       default: $conf_smiliessupport[0] = 'crystal'; break;
     20      $conf['smiliessupport'] = serialize($this->default_conf);
     21
     22      conf_update_param('smiliessupport', $conf['smiliessupport']);
    2823    }
    2924   
    30     $new_smiliessupport =  array(
    31       'folder'       => $conf_smiliessupport[0],
    32       'cols'         => $conf_smiliessupport[1],
    33       'representant' => $conf_smiliessupport[2],
    34     );
    35    
    36     conf_update_param('smiliessupport', serialize($new_smiliessupport));
     25    $this->installed = true;
     26  }
     27
     28  function activate($plugin_version, &$errors=array())
     29  {
     30    if (!$this->installed)
     31    {
     32      $this->install($plugin_version, $errors);
     33    }
     34  }
     35
     36  function deactivate()
     37  {
     38  }
     39
     40  function uninstall()
     41  {
     42    conf_delete_param('smiliessupport');
    3743  }
    3844}
    39 
    40 function plugin_uninstall()
    41 {
    42   pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="smiliessupport" LIMIT 1;');
    43 }
    44 
    45 ?>
  • extensions/SmiliesSupport/template/smiliessupport_admin.tpl

    r23252 r26075  
     1{combine_css path='themes/default/js/plugins/jquery.tokeninput.css'}
    12{combine_script id='jquery.tokeninput' load='footer' path='themes/default/js/plugins/jquery.tokeninput.js'}
     3
    24{combine_css path=$SMILIES_PATH|cat:'template/style.css'}
    35
    46
    5 {footer_script}{literal}
    6 var data = {};
    7 var edit = false;
    8 var edited = false;
     7{footer_script}
     8(function(){
     9var data = {ldelim}},
     10    edit = false,
     11    edited = false;
    912
    1013// set changed
    11 jQuery("select[name='folder']").change(function() {
     14jQuery('select[name="folder"]').change(function() {
    1215    if (edited) {
    13         var ok = confirm("{/literal}{'If you change current set you will lost every shortcuts changes.'|@translate}{literal}");
     16        var ok = confirm('{'If you change current set you will lost every shortcuts changes.'|translate|escape:javascript}');
    1417        if (!ok) {
    15             jQuery(this).val(jQuery(this).data("selected"));
     18            jQuery(this).val(jQuery(this).data('selected'));
    1619            return false;
    1720        }
    1821    }
    1922   
    20     var image = jQuery(this).find(":selected").css("background-image");
    21     jQuery(this).css("background-image", image);
    22     jQuery(this).data("selected", jQuery(this).val());
     23    var image = jQuery(this).find(':selected').css('background-image');
     24    jQuery(this).css('background-image', image);
     25    jQuery(this).data('selected', jQuery(this).val());
    2326   
    2427    fetch();
     
    2629
    2730// size changed
    28 jQuery("input[name='cols']").change(function() {
     31jQuery('input[name="cols"]').change(function() {
    2932    update();
    3033});
    3134
    3235// switch preview/edit
    33 jQuery(".edit").click(function() {
     36jQuery('.edit').click(function() {
    3437    if (edit) {
    35         $(this).html("{/literal}{'Edit shorcuts'|@translate}{literal}");
     38        $(this).html('{'Edit shorcuts'|translate|escape:javascript}');
    3639    }
    3740    else {
    38         $(this).html("{/literal}{'Preview'|@translate}{literal}");
     41        $(this).html('{'Preview'|translate|escape:javascript}');
    3942    }
    4043   
     
    4548
    4649// reset defaults
    47 jQuery(".reset").click(function() {
    48     var ok = confirm("{/literal}{'Are you sure?'|@translate}{literal}");
    49     if (!ok) return false;
     50jQuery('.reset').click(function() {
     51    if (!confirm('{'Are you sure?'|translate|escape:javascript}')) {
     52        return false;
     53    }
    5054   
    5155    jQuery.ajax({
     
    5559        data: {
    5660            action: 'ss_reset',
    57             folder: jQuery("select[name='folder']").val(),
     61            folder: jQuery('select[name="folder"]').val(),
    5862        },
    5963        success: function(result) {
     
    6872
    6973// display edit form before submit
    70 jQuery("#smiliesupport").submit(function() {
    71     if (!edit) jQuery(".edit").click();
     74jQuery('#smiliesupport').submit(function() {
     75    if (!edit) {
     76        jQuery('.edit').click();
     77    }
    7278    return true;
    7379});
     
    8187        data: {
    8288            action: 'ss_list',
    83             folder: jQuery("select[name='folder']").val(),
     89            folder: jQuery('select[name="folder"]').val(),
    8490        },
    8591        success: function(result) {
     
    9399/* update preview/edit table */
    94100function update() {
    95     var html = '';
     101    var html = '', i=0;
    96102   
    97103    if (!edit) {
    98104        html+= '<tr>';
    99105       
    100         var cols = parseInt(jQuery("input[name='cols']").val());
    101         var i=0;
     106        var cols = parseInt(jQuery('input[name="cols"]').val());
    102107       
    103108        for (var file in data.smilies) {
     
    110115        html+= '</tr>';
    111116       
    112         jQuery(".reset").hide();
     117        jQuery('.reset').hide();
    113118    }
    114119    else {
    115     {/literal}
    116120        html+= '<tr>'
    117121            +'<th></th>'
    118             +'<th>{'Name'|@translate}</th>'
    119             +'<th>{'Shortcuts'|@translate}</th>'
     122            +'<th>{'Name'|translate}</th>'
     123            +'<th>{'Shortcuts'|translate}</th>'
    120124            +'<th class="spacer"></th>'
    121125            +'<th></th>'
    122             +'<th>{'Name'|@translate}</th>'
    123             +'<th>{'Shortcuts'|@translate}</th>'
     126            +'<th>{'Name'|translate}</th>'
     127            +'<th>{'Shortcuts'|translate}</th>'
    124128          +'</tr>'
    125129         
    126130          +'<tr>';
    127      {literal}
    128      
    129         var i=0;
    130131     
    131132        for (var file in data.smilies) {
     
    152153        html+= '</tr>';
    153154       
    154         jQuery(".reset").show();
    155     }
    156    
    157     jQuery("#preview").html(html);
     155        jQuery('.reset').show();
     156    }
     157   
     158    jQuery('#preview').html(html);
    158159   
    159160    // init tokeninput
    160     jQuery(".shortcuts").tokenInput([], {
    161         hintText: '{/literal}{'Type in a new shortcut'|@translate}{literal}',
     161    jQuery('.shortcuts').tokenInput([], {
     162        hintText: '{'Type in a new shortcut'|translate|escape:javascript}',
    162163        newText: '',
    163164        animateDropdown: false,
    164165        preventDuplicates: true,
    165         caseSensitive: true,
    166         allowCreation: true,
     166        allowFreeTagging: true,
    167167        minChars: 2,
    168168        searchDelay: 10,
     
    170170        onAdd: function(item) {
    171171            edited = true;
    172             var file = $(this).parent("td").data("file");
     172            var file = $(this).parent('td').data("file");
    173173           
    174174            if (data.smilies[file].short == null) {
     
    181181        onDelete: function(item) {
    182182          edited = true;
    183           var file = $(this).parent("td").data("file");
     183          var file = $(this).parent('td').data("file");
    184184         
    185185          for (var i in data.smilies[file].short) {
     
    192192   
    193193    // prevent spaces
    194     jQuery(".token-input-input-token input").keydown(function(e) {
     194    jQuery('.token-input-input-token input').keydown(function(e) {
    195195        if (e.keyCode == 32) {
    196196            return false;
     
    201201// init
    202202fetch();
    203 {/literal}{/footer_script}
     203}());{/footer_script}
    204204
    205205
     
    211211
    212212<fieldset>
    213   <legend>{'Configuration'|@translate}</legend> 
     213  <legend>{'Configuration'|translate}</legend> 
    214214 
    215215  <ul>     
    216216    <li>
    217       <b>{'Smilies set'|@translate}</b>
     217      <b>{'Smilies set'|translate}</b>
    218218      <select name="folder" style="background-image:url('{$SMILIES_PATH}smilies/{$FOLDER}/{$SETS[$FOLDER]}');" data-selected="{$FOLDER}">
    219219      {foreach from=$SETS item=rep key=set}
     
    223223    </li>
    224224    <li>
    225       <b>{'Columns'|@translate}</b>
     225      <b>{'Columns'|translate}</b>
    226226      <input type="text" size="2" name="cols" value="{$COLS}">
    227227    </li>
     
    230230
    231231<fieldset>
    232   <legend>{'Preview'|@translate}</legend> 
    233   <a href="#" class="edit buttonLike">{'Edit shortcuts'|@translate}</a>
     232  <legend>{'Preview'|translate}</legend> 
     233  <a href="#" class="edit buttonLike">{'Edit shortcuts'|translate}</a>
    234234  <table id="preview"></table>
    235   <a href="#" class="reset buttonLike" style="display:none;">{'Reset defaults'|@translate}</a>
     235  <a href="#" class="reset buttonLike" style="display:none;">{'Reset defaults'|translate}</a>
    236236</fieldset>
    237237 
    238 <p class="formButtons"><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p>
     238<p class="formButtons"><input class="submit" type="submit" value="{'Submit'|translate}" name="submit" /></p>
    239239
    240240</form>
  • extensions/SmiliesSupport/template/smiliessupport_page.tpl

    r23279 r26075  
    1 {if not isset($BBCODE_PATH)}
    2 {combine_script id="markitup" require='jquery' path=$SMILIES_PATH|@cat:"template/markitup/jquery.markitup.js"}
    3 {combine_css path=$SMILIES_PATH|@cat:"template/markitup/style.markitup.css"}
    4 {/if}
     1{combine_script id='markitup' require='jquery' load='footer' path=$SMILIES_PATH|cat:'template/markitup/jquery.markitup.js'}
     2{combine_css id='markitup' order=10 path=$SMILIES_PATH|cat:'template/markitup/style.markitup.css'}
    53
    6 {footer_script require='jquery'}{literal}
     4{footer_script require='markitup'}
    75if (jQuery('.markItUp').length == 0) {
    8   jQuery('#{/literal}{$SMILIES_ID}{literal}').markItUp({markupSet: []});
     6  jQuery('#{$SMILIES.textarea_id}').markItUp({
     7    markupSet: []
     8  });
    99  jQuery('.markItUpHeader>ul').css('width', '22');
    1010}
     
    1616
    1717jQuery('#allsmilies').hover(function(){
    18   jQuery('#{/literal}{$SMILIES_ID}{literal}').focus();
    19   jQuery('#smiliesdiv').css('display','');
     18  jQuery('#{$SMILIES.textarea_id}').focus();
     19  jQuery('#smiliesdiv').css('display', '');
    2020});
    2121
    2222jQuery('#smiliesdiv img').click(function() {
    23   emoticon = jQuery(this).attr("title");
    24   jQuery.markItUp({ replaceWith:emoticon });
    25   jQuery('#smiliesdiv').css('display','none');
     23  var emoticon = jQuery(this).attr('title');
     24  jQuery.markItUp({
     25    replaceWith: emoticon
     26  });
     27  jQuery('#smiliesdiv').css('display', 'none');
    2628  return false;
    2729});
    28 {/literal}{/footer_script}
     30{/footer_script}
    2931
    30 {html_style}{literal}
     32{html_style}
    3133#SmiliesSupport table img:hover {
    3234  border:1px solid #08e;
     
    3537  cursor:pointer;
    3638}
    37 #allsmilies { background-size:contain;
    38 {/literal}
    39 background-image:url('{$ROOT_URL}{$REPRESENTANT}'); }
     39#allsmilies {
     40  background-size:contain;
     41  background-image:url('{$ROOT_URL}{$SMILIES.representant}');
     42}
    4043{/html_style}
    4144
    4245<ul style="display:none;">
    4346<li id="SmiliesSupport" class="markItUpButton markItUpDropMenu">
    44   <a id="allsmilies" title="{'Smilies'|@translate}"></a>
     47  <a id="allsmilies" title="{'Smilies'|translate}"></a>
    4548
    46   <ul id="smiliesdiv">
    47     <li><table><tr>{strip}
    48     {foreach from=$smiliesfiles item=smileyfile}
     49  <ul id="smiliesdiv"><li>
     50    <table><tr>{strip}
     51    {foreach from=$SMILIES.files item=smileyfile}
    4952      <td><img src="{$ROOT_URL}{$smileyfile.PATH}" title="{$smileyfile.TITLE}"/></td>
    5053      {$smileyfile.TR}
    5154    {/foreach}
    52     {/strip}</tr></table></li>
    53   </ul>
     55    {/strip}</tr></table>
     56  </li></ul>
    5457</li>
    5558</ul>
Note: See TracChangeset for help on using the changeset viewer.