Changeset 10986
- Timestamp:
- May 22, 2011, 12:48:18 PM (13 years ago)
- Location:
- extensions/SmiliesSupport
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/SmiliesSupport/admin.php
r9966 r10986 9 9 if (isset($_POST['submit'])) 10 10 { 11 // the smilies.txt file is not saved if the directory is changed 12 if (isset($_POST['text1']) AND $_POST['text1'] != $conf_smiliessupport[0]) 13 { 14 $not_save_file = true; 15 } 16 17 // new configuration 18 $conf_smiliessupport = array( 19 isset($_POST['text1']) ? $_POST['text1'] : 'plugins/SmiliesSupport/smilies_1', 20 isset($_POST['text2']) ? $_POST['text2'] : '6', 21 isset($_POST['text3']) ? $_POST['text3'] : 'smile.png', 22 ); 23 if (empty($_POST['text'])) $_POST['text'] = ':) smile.png'; 24 25 $new_value_smiliessupport = implode(",", $conf_smiliessupport); 26 $query = "UPDATE " . CONFIG_TABLE . " 27 SET value='" . $new_value_smiliessupport . "' 28 WHERE param='smiliessupport'"; 29 pwg_query($query); 30 31 // new definitions file 32 if (!isset($not_save_file)) 33 { 34 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 11 // the smilies.txt file is not saved if the directory is changed 12 if (isset($_POST['text1']) AND $_POST['text1'] != $conf_smiliessupport[0]) 13 { 14 $not_save_file = true; 15 } 16 17 // new configuration 18 $conf_smiliessupport = array( 19 isset($_POST['text1']) ? $_POST['text1'] : 'plugins/SmiliesSupport/smilies_1', 20 isset($_POST['text2']) ? $_POST['text2'] : '6', 21 isset($_POST['text3']) ? $_POST['text3'] : 'smile.png', 22 ); 23 if (empty($_POST['text'])) $_POST['text'] = ':) smile.png'; 24 25 conf_update_param('smiliessupport', implode(",", $conf_smiliessupport)); 26 array_push($page['infos'], l10n('Information data registered in database')); 27 28 // new definitions file 29 if (!isset($not_save_file)) 30 { 31 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 35 32 36 if (file_exists($smilies_file)) { 37 @copy($smilies_file, get_filename_wo_extension($smilies_file).'.bak'); 38 } 39 40 if (@file_put_contents($smilies_file, stripslashes($_POST['text']))) { 41 $page['infos'][] = l10n('Information data registered in database'); 42 } else { 43 $page['errors'][] = l10n('File/directory read error').' : '.$smilies_file; 44 } 45 } 33 if (file_exists($smilies_file)) { 34 @copy($smilies_file, get_filename_wo_extension($smilies_file).'.bak'); 35 } 36 37 if (@!file_put_contents($smilies_file, stripslashes($_POST['text']))) { 38 array_push($page['errors'], l10n('File/directory read error').' : '.$smilies_file); 39 } 40 } 46 41 } 47 42 48 43 // check if the representant exists 49 44 if (!file_exists(PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2])) { 50 $page['errors'][] = l10n('File/directory read error').' : '.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2];45 array_push($page['errors'], l10n('File/directory read error').' : '.$conf_smiliessupport[0].'/'.$conf_smiliessupport[2]); 51 46 } 52 47 53 48 $template->assign(array( 54 55 56 49 'TEXT1_VALUE' => $conf_smiliessupport[0], 50 'TEXT2_VALUE' => $conf_smiliessupport[1], 51 'TEXT3_VALUE' => $conf_smiliessupport[2], 57 52 )); 58 53 … … 64 59 $smilies_file = PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/smilies.txt'; 65 60 if (file_exists($smilies_file)) { 66 67 61 $content_file = file_get_contents($smilies_file); 62 $template->assign(array('CONTENT_FILE' => $content_file)); 68 63 } 69 64 70 65 $template->assign('SMILIES_PATH', SMILIES_PATH); 71 66 $template->set_filename('smiliessupport_conf', dirname(__FILE__).'/template/smiliessupport_admin.tpl'); -
extensions/SmiliesSupport/language/ar_SA/plugin.lang.php
r10265 r10986 6 6 $lang['All Smilies'] = "كل الوجوه التعبيرية"; 7 7 $lang['smilies_file_help'] = "افتراضيا عندما ينقر المستخدم على الوجوه التعبيرية، دعم الوجوه التعبيرية يضيف مطابقة الكلمات لاسم الملف (smile.png -> :smile:).<br> 8 8 ولكن هنا يمكنك تكوين كلمات أخرى لتحل محلها. كل الوجوه التعبيرية في مجلد لها خاصيتها<i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/cs_CZ/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "All Smilies"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/de_DE/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "Alle Smilies"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/en_UK/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "All Smilies"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/fr_FR/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "Tous les smileys"; 7 7 $lang['smilies_file_help'] = "Par défaut quand l'utilisateur clique sur un smiley, Smilies Support ajoute un mot clef correspondant au nom du fichier (smile.png -> :smile:).<br> 8 8 Mais vous pouvez configurer ici d'autres chaînes de caractères qui seront remplacées. Chaque dossier de smileys a son propre fichier <i>smilies.txt</i>."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/hu_HU/plugin.lang.php
r9777 r10986 6 6 $lang['All Smilies'] = "Összes hangulatjel"; 7 7 $lang['smilies_file_help'] = "Alapértelmezésben, amikor egy felhasználó rákattint egy hangulatjelre, a Smilies Support hozzáad egy kulcsszóegyezőséget a fájl nevéhez. (smile.png -> :smile:).<br> 8 8 Lehetőség van beállítani másik stringet a kicseréléséhez. Minden egyes hangulatjel könyvtár rendelkezik egy saját <i>smilies.txt</i> fájllal."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/it_IT/plugin.lang.php
r10622 r10986 6 6 $lang['All Smilies'] = 'Tutti gli smiley'; 7 7 $lang['smilies_file_help'] = 'Di default, quando un utente clicca su un smiley, SmiliesSupport aggiunge una keyword corrispondente al nome del fine (smile.png -> :smile:).<br> 8 8 Ma potete configurare qui altre serie di caratteri che saranno rimpiazzate. Ogni cartella di smileys ha il suo file <i>smilies.txt</i>'; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/lv_LV/plugin.lang.php
r10103 r10986 5 5 $lang['representant'] = "Parstavošs"; 6 6 $lang['All Smilies'] = "Visi Smailini"; 7 $lang['smilies_file_help'] = "Pēc noklusēšanas, ja klikšķiniet uz smaidiņa, Smaidiņu Atbalsts (Smilies Support) pievieno ar faila (smile.png -> :smile:) nosaukumu sakrītošu atslēgvārdu.<br> Ir iespējams nokonfigurēt arī citus variantus. Katrai smailiju mapei ir pašai savs <i>smilies.txt</i> fails."; 7 $lang['smilies_file_help'] = "Pēc noklusēšanas, ja klikšķiniet uz smaidiņa, Smaidiņu Atbalsts (Smilies Support) pievieno ar faila (smile.png -> :smile:) nosaukumu sakrītošu atslēgvārdu.<br> 8 Ir iespējams nokonfigurēt arī citus variantus. Katrai smailiju mapei ir pašai savs <i>smilies.txt</i> fails."; 8 9 9 10 ?> -
extensions/SmiliesSupport/language/nl_NL/description.txt
r10733 r10986 1 Laat smileys toe voor reacties en beschrijvingen.1 Allow add Smilies for comments and descriptions. -
extensions/SmiliesSupport/language/nl_NL/plugin.lang.php
r10695 r10986 6 6 $lang['All Smilies'] = 'Alle Smileys'; 7 7 $lang['smilies_file_help'] = 'Als een gebruiker op een smiley klikt, voegt de Smilies Support standaard een trefwoord toe die overeenkomt met de naam van het bestand (smile.png -> :smile:). <br> 8 Maar hier kan je andere trefwoorden instellen. Elke smiley map heeft zijn eigen <i>smilies.txt</i> bestand.';8 Maar hier kan je andere trefwoorden instellen. Elke smiley map heeft zijn eigen <i>smilies.txt</i> bestand.'; 9 9 ?> -
extensions/SmiliesSupport/language/no_NO/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "All Smilies"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/pl_PL/plugin.lang.php
r10794 r10986 6 6 $lang['All Smilies'] = 'Wszystkie emotikony'; 7 7 $lang['smilies_file_help'] = 'Domyślnie, gdy użytkownik kliknie w emotikon, Smilies Support doda słowo kluczowe odpowiadające nazwie danego pliku z emotikonem (smile.png -> :smile:). <br> 8 8 Jednak w tym miejscu możesz także skonfigurować inne ciągi znaków. Każdy folder z emotikonami ma swój własny <i>smilies.txt</i> plik '; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/ru_RU/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "All Smilies"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/sk_SK/plugin.lang.php
r10462 r10986 6 6 $lang['All Smilies'] = "Všetky smajlíky"; 7 7 $lang['smilies_file_help'] = 'Predvolene, ak používateľ klikne na smajlíka, podpora smajlíkov pridá kľúčové slovo spárované s menom súboru (smile.png -> :smile:).<br> 8 9 8 Ale môžete konfigurovať iné reťazce na prepísanie. Každý adresár smajlíka má vlastný <i>smilies.txt</i> súbor.'; 9 10 10 ?> -
extensions/SmiliesSupport/language/sv_SE/plugin.lang.php
r9816 r10986 6 6 $lang['All Smilies'] = "Alla Smilies"; 7 7 $lang['smilies_file_help'] = "Som standard när en användare klickar på en smiley, tillägger Smilies Stödja ett sökord som matchar namnet på filen (smile.png -> :smile:).<br> 8 8 Men här kan du konfigurera andra strängar som ska ersättas. Varje smilies mapp har sin egen <i>smilies.txt</i> fil."; 9 9 10 10 ?> -
extensions/SmiliesSupport/language/tr_TR/plugin.lang.php
r9764 r10986 6 6 $lang['All Smilies'] = "Tüm İfadeler"; 7 7 $lang['smilies_file_help'] = "By default when a user clicks on a smiley, Smilies Support adds a keyword matching the name of the file (smile.png -> :smile:).<br> 8 8 But here you can configure other strings to be replaced. Each smilies folder has its own <i>smilies.txt</i> file."; 9 9 10 10 ?> -
extensions/SmiliesSupport/main.inc.php
r9966 r10986 2 2 /* 3 3 Plugin Name: Smilies Support 4 Version: 2.2.a4 Version: auto 5 5 Description: Allow add Smilies for comments and descriptions. 6 6 Plugin URI: http://piwigo.org/ext/extension_view.php?eid=159 … … 19 19 20 20 function add_smiliessupport() { 21 22 23 24 25 26 27 21 global $page, $pwg_loaded_plugins; 22 23 if (!isset($pwg_loaded_plugins['bbcode_bar']) 24 AND isset($page['body_id']) AND $page['body_id'] == 'thePicturePage') 25 { 26 set_smiliessupport(); 27 } 28 28 } 29 29 30 30 if (script_basename() == 'admin') 31 31 { 32 33 34 35 36 37 38 39 32 add_event_handler('get_admin_plugin_menu_links', 'smiliessupport_admin_menu'); 33 function smiliessupport_admin_menu($menu) 34 { 35 array_push($menu, array( 36 'NAME' => 'Smilies Support', 37 'URL' => get_root_url().'admin.php?page=plugin-' . SMILIES_DIR)); 38 return $menu; 39 } 40 40 } 41 41 ?> -
extensions/SmiliesSupport/maintain.inc.php
r9764 r10986 4 4 function plugin_install() 5 5 { 6 6 global $conf; 7 7 8 9 10 11 12 8 if (!isset($conf['smiliessupport'])) { 9 $q = 'INSERT INTO ' . CONFIG_TABLE . ' (param,value,comment) 10 VALUES ("smiliessupport","plugins/SmiliesSupport/smilies_1,6,smile.png","Parametres SmiliesSupport");'; 11 pwg_query($q); 12 } 13 13 } 14 14 15 15 function plugin_uninstall() 16 16 { 17 17 global $conf; 18 18 19 20 21 19 if (isset($conf['smiliessupport'])) { 20 pwg_query('DELETE FROM ' . CONFIG_TABLE . ' WHERE param="smiliessupport" LIMIT 1;'); 21 } 22 22 } 23 23 -
extensions/SmiliesSupport/smiliessupport.inc.php
r9966 r10986 5 5 function set_smiliessupport() 6 6 { 7 8 9 10 11 $lang['Comment'] .= SmiliesTable($conf_smiliessupport, $smilies); 7 global $conf, $lang; 8 $conf_smiliessupport = explode(',' , $conf['smiliessupport']); 9 10 $smilies = get_smilies($conf_smiliessupport); 11 $lang['Comment'] .= SmiliesTable($conf_smiliessupport, $smilies); 12 12 } 13 13 … … 15 15 function get_smilies($conf_smiliessupport) 16 16 { 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 17 $accepted_ext = array('gif', 'jpg', 'png'); 18 19 if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0])) 20 { 21 $i = 1; 22 while (false !== ($file = readdir($handle))) 23 { 24 if ($file != '.' AND $file != '..' AND in_array(get_extension($file), $accepted_ext)) 25 { 26 $smilies[] = array( 27 'PATH' => PHPWG_ROOT_PATH.$conf_smiliessupport[0].'/'.$file, 28 'TITLE' => ':'.get_filename_wo_extension($file).':', 29 'TR' => ($i>0 AND $i%$conf_smiliessupport[1] == 0) ? '</tr><tr>' : null, 30 ); 31 $i++; 32 } 33 } 34 35 return $smilies; 36 } else { 37 return false; 38 } 39 39 } 40 40 … … 42 42 function SmiliesTable($conf_smiliessupport, $smilies) 43 43 { 44 45 44 global $template; 45 load_language('plugin.lang', SMILIES_PATH); 46 46 47 48 49 50 51 52 53 54 55 56 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 57 58 59 60 61 62 63 64 65 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 66 } 67 67 … … 69 69 function SmiliesParse($str) 70 70 { 71 71 global $conf; 72 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 if (preg_match('|^([^\t]*)[\t]+(.*)$|',$v,$matches)) { 96 $r = '#'.preg_quote($matches[1],'/').'#'; 97 98 99 100 101 102 103 73 $conf_smiliessupport = explode("," , $conf['smiliessupport']); 74 $def_path = $conf_smiliessupport[0].'/smilies.txt'; 75 $accepted_ext = array('gif', 'jpg', 'png'); 76 77 if ($handle = opendir(PHPWG_ROOT_PATH.$conf_smiliessupport[0])) 78 { 79 while (false !== ($file = readdir($handle))) 80 { 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 $str = str_replace($v, $s, $str); 85 } 86 } 87 } 88 89 if (file_exists($def_path)) 90 { 91 $def = file($def_path); 92 foreach($def as $v) 93 { 94 $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); 99 } 100 } 101 } 102 103 return $str; 104 104 } 105 105 -
extensions/SmiliesSupport/template/smiliessupport_admin.tpl
r9966 r10986 4 4 {footer_script require="jquery.cluetip"} 5 5 {literal} 6 7 8 9 10 11 12 6 jQuery().ready(function(){ 7 // Cluetip 8 jQuery('.cluetip').cluetip({ 9 width: 550, 10 splitTitle: '|' 11 }); 12 }); 13 13 {/literal} 14 14 {/footer_script} … … 16 16 {html_head} 17 17 <style type="text/css"> 18 19 20 21 22 23 24 25 26 27 28 29 30 31 18 legend .cluetip {ldelim} 19 text-align:center; 20 margin:20px 0 -10px 0; 21 font-size:1.2em; 22 } 23 .cluetip:after {ldelim} 24 margin-left:5px; 25 vertical-align:top; 26 content:url('{$themeconf.admin_icon_dir}/help.png'); 27 } 28 .properties textarea {ldelim} 29 width:60%; 30 margin:0 20%; 31 } 32 32 </style> 33 33 {/html_head} 34 34 35 35 <div class="titrePage"> 36 36 <h2>Smilies Support</h2> 37 37 </div> 38 38 39 39 <form method="post" action="" class="properties" ENCTYPE="multipart/form-data"> 40 41 <legend>{'Configuration'|@translate}</legend> 42 <ul> 43 44 45 46 47 48 49 50 </li> 51 52 53 54 55 56 57 58 59 60 61 62 40 <fieldset> 41 <legend>{'Configuration'|@translate}</legend> 42 <ul> 43 <li> 44 <span class="property">{'smilies_dir'|@translate}</span> 45 <input type="text" size="40" name="text1" value="{$TEXT1_VALUE}" /> 46 </li> 47 <li> 48 <span class="property">{'nb_columns'|@translate}</span> 49 <input type="text" size="3" name="text2" value="{$TEXT2_VALUE}" /> 50 </li> 51 <li> 52 <span class="property">{'representant'|@translate}</span> 53 <input type="text" size="20" name="text3" value="{$TEXT3_VALUE}" /> 54 </li> 55 <li> 56 <table><tr> 57 {foreach from=$smiliesfiles item=smileyfile} 58 <td><a href="#" title="{$smileyfile.TITLE}"><img src="{$smileyfile.PATH}"/></a></td> 59 {$smileyfile.TR} 60 {/foreach} 61 </tr></table> 62 </li> 63 63 </ul> 64 65 66 67 68 69 </fieldset> 70 71 64 </fieldset> 65 66 <fieldset> 67 <legend><span class="cluetip" title="smilies.txt|{'smilies_file_help'|@translate}">smilies.txt</legend> 68 <textarea rows="5" name="text">{$CONTENT_FILE}</textarea> 69 </fieldset> 70 71 <p><input class="submit" type="submit" value="{'Submit'|@translate}" name="submit" /></p> 72 72 </form> -
extensions/SmiliesSupport/template/smiliessupport_page.tpl
r10025 r10986 5 5 {literal} 6 6 jQuery(document).ready(function() { 7 8 9 10 11 12 13 14 15 16 17 18 19 20 7 if (jQuery('.markItUp').length == 0) { 8 jQuery('#{/literal}{$form_name}{literal} textarea').markItUp({markupSet: []}); 9 } 10 jQuery('#SmiliesSupport').appendTo('.markItUpHeader ul:first-child'); 11 jQuery('#allsmilies').mouseover(function(){ 12 jQuery("#{/literal}{$form_name}{literal} textarea").focus(); 13 jQuery('#smiliesdiv').css('display',''); 14 }); 15 jQuery('#smiliesdiv a').click(function() { 16 emoticon = jQuery(this).attr("href"); 17 jQuery.markItUp({ replaceWith:emoticon }); 18 jQuery('#smiliesdiv').css('display','none'); 19 return false; 20 }); 21 21 }); 22 22 {/literal} … … 25 25 <ul style="display:none;"> 26 26 <li id="SmiliesSupport" class="markItUpButton markItUpDropMenu"> 27 27 <a id="allsmilies" style="background-image:url({$REPRESENTANT});" title="{'All Smilies'|@translate}"></a> 28 28 29 30 31 32 33 34 35 36 29 <ul id="smiliesdiv"> 30 <li><table><tr> 31 {foreach from=$smiliesfiles item=smileyfile} 32 <td><a href="{$smileyfile.TITLE}"><img src="{$smileyfile.PATH}"/></a></td> 33 {$smileyfile.TR} 34 {/foreach} 35 </tr></table></li> 36 </ul> 37 37 </li> 38 38 </ul>
Note: See TracChangeset
for help on using the changeset viewer.