Permalink
Browse files

Prepare for english language extension

Refactoring; Overall optimization
  • Loading branch information...
1 parent 6652907 commit 2de7d85ca290b36b9dd2cbfa6153e8b3aeafce79 @simonewebdesign committed Mar 19, 2013
View
@@ -1 +1 @@
-<form method=POST> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($l->id) ? $l->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($l->name) ? $l->name : ''?>"> </p> <p> <label for="email_addresses"><?=EMAIL_ADDRESSES?></label> <?php $email_addresses_plain_text = ''; if (isset($l->id)) { $email_addresses = User::all_where("list_id = {$l->id}"); foreach ($email_addresses as $em) { $email_addresses_plain_text .= "$em->email\r\n"; } } ?> <textarea id="email_addresses" name="email_addresses" rows=15><?=$email_addresses_plain_text?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE_LIST : CREATE_LIST?>"> </p> </fieldset></form>
+<form method=POST> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($l->id) ? $l->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($l->name) ? $l->name : ''?>"> </p> <p> <label for="email_addresses"><?=EMAIL_ADDRESSES?></label> <?php $email_addresses_plain_text = ''; if (isset($l->id)) { $email_addresses = User::all_where("list_id = {$l->id}"); foreach ($email_addresses as $em) { $email_addresses_plain_text .= "$em->email\r\n"; } } ?> <textarea id="email_addresses" name="email_addresses" rows=15><?=$email_addresses_plain_text?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
View
@@ -1 +1 @@
-<form method=POST enctype="multipart/form-data"> <fieldset> <legend><?=NEWSLETTERS?></legend> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($n->id) ? $n->id : NOT_SET?>" disabled> </p> <p> <label for="subject"><?=SUBJECT?></label> <input id="subject" name="subject" type="text" value="<?=isset($n->subject) ? $n->subject : ''?>" required> </p> <p> <label for="resource"><?=RESOURCE?></label> <input name="resource" type="file"> <small>La larghezza ottimale dell'immagine è di 525px.</small> </p> <?php include_once '_template_select.php' ?> <p> <input id="submit" name="submit" type="submit" value="<?=CREATE_NEWSLETTER?>"> </p> </fieldset></form>
+<form method=POST enctype="multipart/form-data"> <fieldset> <legend><?=NEWSLETTERS?></legend> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($n->id) ? $n->id : NOT_SET?>" disabled> </p> <p> <label for="subject"><?=SUBJECT?></label> <input id="subject" name="subject" type="text" value="<?=isset($n->subject) ? $n->subject : ''?>" required> </p> <p> <label for="resource"><?=RESOURCE?></label> <input name="resource" type="file"> <small>La larghezza ottimale dell'immagine è di 525px.</small> </p> <?php include_once '_template_select.php' ?> <p> <input id="submit" name="submit" type="submit" value="<?=CREATE?>"> </p> </fieldset></form>
View
@@ -1 +1 @@
-<script src=CodeMirror/lib/codemirror.js></script><script src=CodeMirror/mode/xml/xml.js></script><script src=CodeMirror/mode/javascript/javascript.js></script><script src=CodeMirror/mode/css/css.js></script><script src=CodeMirror/mode/htmlmixed/htmlmixed.js></script><link rel=stylesheet href=CodeMirror/lib/codemirror.css><link rel=stylesheet href=CodeMirror/doc/docs.css><style> iframe { width: 800px; height: 600px; border: 1px solid #ddd; } .codeMirror { width:49%; }</style><form method=POST> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($t->id) ? $t->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($t->name) ? $t->name : ''?>" required placeholder="Nome del template"> </p> <p> <label for="body"><?=BODY?></label> <?php $default_template_body = '<!doctype html><html lang="it"><head> <meta charset="UTF-8"> <title>My Newsletter</title> <style> body { background: #eef; font-family: Arial, sans-serif; font-size:24px; } h1 { color: #448; } </style></head><body> <h1>My Newsletter</h1> <p>This is just a <em>paragraph</em>.</p> <img src="assets/images/header.jpg" alt="My Logo" /></body></html>'; ?> <textarea id="body" name="body" type="text"><?=isset($t->body) ? $t->body : $default_template_body?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE_TEMPLATE : CREATE_TEMPLATE ?>"> </p> </fieldset></form><h2>Anteprima</h2><iframe id="preview"></iframe> <script> var delay; // Initialize CodeMirror editor with the content of the textarea#body. var editor = CodeMirror.fromTextArea(document.getElementById('body'), { mode: 'text/html', tabMode: 'indent' }); editor.on("change", function() { clearTimeout(delay); delay = setTimeout(updatePreview, 300); }); function updatePreview() { var previewFrame = document.getElementById('preview'); var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; preview.open(); preview.write(editor.getValue()); preview.close(); } setTimeout(updatePreview, 300);</script><h3>Note</h3><p>All'interno del template e' possibile usare dei <em>placeholder</em>, che verranno poi valorizzati nella fase finale di rendering. Ecco l'elenco completo:</p><dl> <dt>:from</dt> <dd>Email del mittente.</dd> <dt>:site_name</dt> <dd>Nome del sito.</dd> <dt>:logo</dt> <dd>Path assoluto del logo.</dd> <dt>:address</dt> <dd>Indirizzo geografico della propria azienda.</dd> <dt>:reply_to</dt> <dd>Email a cui rispondere.</dd> <dt>:site_url</dt> <dd>Path relativo al sito.</dd> <dt>:site_full_url</dt> <dd>Path assoluto al sito.</dd> <dt>:unsubscribe_url</dt> <dd>URL per cancellare l'iscrizione alla newsletter.</dd> <dt>:creation_date</dt> <dd>Data di creazione della newsletter.</dd> <dt>:online_version_url</dt> <dd>URL alla versione online della newsletter.</dd> <dt>:root</dt> <dd>La root di questa applicazione.</dd> <dt>:image_path</dt> <dd>Path relativo all'immagine allegata alla newsletter.</dd> <dt>:user_id</dt> <dd>ID univoco dell'utente che aprira' la newsletter.</dd> <dt>:newsletter_id</dt> <dd>ID univoco di questa newsletter.</dd> </dl>
+<!-- begin of codemirror stuff --><script src=CodeMirror/lib/codemirror.js></script><script src=CodeMirror/mode/xml/xml.js></script><script src=CodeMirror/mode/javascript/javascript.js></script><script src=CodeMirror/mode/css/css.js></script><script src=CodeMirror/mode/htmlmixed/htmlmixed.js></script><link rel=stylesheet href=CodeMirror/lib/codemirror.css><link rel=stylesheet href=CodeMirror/doc/docs.css><style> iframe { width: 800px; height: 600px; border: 1px solid #ddd; } .codeMirror { width:49%; }</style><!-- end of codemirror stuff --><form method="POST"> <fieldset> <p> <label for="id">ID</label> <input id="id" name="id" type="text" value="<?=isset($t->id) ? $t->id : NOT_SET?>" disabled> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($t->name) ? $t->name : ''?>" required placeholder="Nome del template"> </p> <p> <label for="body"><?=BODY?></label> <?php $default_template_body = '<!doctype html><html lang="it"><head> <meta charset="UTF-8"> <title>My Newsletter</title> <style> body { background: #eef; font-family: Arial, sans-serif; font-size:24px; } h1 { color: #448; } </style></head><body> <h1>My Newsletter</h1> <p>This is just a <em>paragraph</em>.</p> <img src="assets/images/header.jpg" alt="My Logo" /></body></html>'; ?> <textarea id="body" name="body" type="text"><?=isset($t->body) ? $t->body : $default_template_body?></textarea> </p> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE_TEMPLATE : CREATE_TEMPLATE ?>"> </p> </fieldset></form><h2><?=PREVIEW?></h2><iframe id="preview"></iframe> <script> var delay; // Initialize CodeMirror editor with the content of the textarea#body. var editor = CodeMirror.fromTextArea(document.getElementById('body'), { mode: 'text/html', tabMode: 'indent' }); editor.on("change", function() { clearTimeout(delay); delay = setTimeout(updatePreview, 300); }); function updatePreview() { var previewFrame = document.getElementById('preview'); var preview = previewFrame.contentDocument || previewFrame.contentWindow.document; preview.open(); preview.write(editor.getValue()); preview.close(); } setTimeout(updatePreview, 300);</script><h3>Note</h3><p>All'interno del template e' possibile usare dei <em>placeholder</em>, che verranno poi valorizzati nella fase finale di rendering. Ecco l'elenco completo:</p><dl> <dt>:from</dt> <dd>Email del mittente.</dd> <dt>:site_name</dt> <dd>Nome del sito.</dd> <dt>:logo</dt> <dd>Path assoluto del logo.</dd> <dt>:address</dt> <dd>Indirizzo geografico della propria azienda.</dd> <dt>:reply_to</dt> <dd>Email a cui rispondere.</dd> <dt>:site_url</dt> <dd>Path relativo al sito.</dd> <dt>:site_full_url</dt> <dd>Path assoluto al sito.</dd> <dt>:unsubscribe_url</dt> <dd>URL per cancellare l'iscrizione alla newsletter.</dd> <dt>:creation_date</dt> <dd>Data di creazione della newsletter.</dd> <dt>:online_version_url</dt> <dd>URL alla versione online della newsletter.</dd> <dt>:root</dt> <dd>La root di questa applicazione.</dd> <dt>:image_path</dt> <dd>Path relativo all'immagine allegata alla newsletter.</dd> <dt>:user_id</dt> <dd>ID univoco dell'utente che aprira' la newsletter.</dd> <dt>:newsletter_id</dt> <dd>ID univoco di questa newsletter.</dd> </dl>
View
@@ -1 +1 @@
-<form method=POST> <fieldset> <legend><?=USERS?></legend> <p> <label for="id"><?=ID?></label> <input id="id" name="id" type="text" value="<?=isset($u->id) ? $u->id : NOT_SET?>" disabled> </p> <p> <label for="email"><?=EMAIL?></label> <input id="email" name="email" type="email" value="<?=isset($u->email) ? $u->email : ''?>" required> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($u->name) ? $u->name : ''?>"> </p> <?php include_once '_list_select.php'; ?> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE_USER : CREATE_USER?>"> </p> </fieldset></form>
+<form method=POST> <fieldset> <legend><?=USERS?></legend> <p> <label for="id"><?=ID?></label> <input id="id" name="id" type="text" value="<?=isset($u->id) ? $u->id : NOT_SET?>" disabled> </p> <p> <label for="email"><?=EMAIL?></label> <input id="email" name="email" type="email" value="<?=isset($u->email) ? $u->email : ''?>" required> </p> <p> <label for="name"><?=NAME?></label> <input id="name" name="name" type="text" value="<?=isset($u->name) ? $u->name : ''?>"> </p> <?php include_once '_list_select.php'; ?> <p> <input id="submit" name="submit" type="submit" value="<?=(isset($_GET['id'])) ? UPDATE : CREATE?>"> </p> </fieldset></form>
View
@@ -47,9 +47,9 @@
<td><?=date(PHP_DATE, strtotime($u->last_seen_at))?></td>
<?php } ?>
- <td><a href="<?=$cfg['root']?>user_read.php?id=<?=$u->id?>"><?=READ_USER?></a></td>
- <td><a href="<?=$cfg['root']?>user_update.php?id=<?=$u->id?>"><?=UPDATE_USER?></a></td>
- <td><a href="<?=$cfg['root']?>user_delete.php?id=<?=$u->id?>" class="delete"><?=DELETE_USER?></a></td>
+ <td><a href="<?=$cfg['root']?>user_read.php?id=<?=$u->id?>"><?=READ?></a></td>
+ <td><a href="<?=$cfg['root']?>user_update.php?id=<?=$u->id?>"><?=UPDATE?></a></td>
+ <td><a href="<?=$cfg['root']?>user_delete.php?id=<?=$u->id?>" class="delete"><?=DELETE?></a></td>
</tr>
<?php } ?>
</tbody>
View
@@ -1,8 +1,8 @@
<?php
$cfg = array(
# site settings
- 'site_name' => 'Your Website Name',
- 'address' => 'Your geographic address',
+ 'site_name' => 'My Website',
+ 'address' => 'My geographic address, 45/bis',
# paths
'site_url' => 'www.example.com',
@@ -39,9 +39,9 @@
//*/
# miscellaneous
- 'language' => 'it',
+ 'language' => 'it', # set to 'it' for italian language
'regex' => '^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$^',
- 'limit' => 300, # limit of emails to send before refreshing the send.php page
+ 'limit' => 300, # emails to send before refreshing the send.php page
'word_wrap' => 50,
'timeout' => 10000, # refresh timeout, in milliseconds.
'debug_mode' => 0, # enables SMTP debug information (2 for testing)
View
@@ -1,5 +1,5 @@
<footer>
- <small>Copyright &copy; 2012 - <?=date('Y') . " " . $cfg['site_name']?>. All rights reserved.</small>
+ <small>Copyright &copy; 2012 - <?=date('Y') ." ". $cfg['site_name']?>. All rights reserved.</small>
</footer>
<script>
View
@@ -1,7 +1,7 @@
<!doctype html>
<html>
<head>
- <title>Newsletter <?=$cfg['site_name']?></title>
+ <title><?=$cfg['site_name']?></title>
<link rel="stylesheet" href="<?=$cfg['root']?>style.css" media="screen">
<meta name="robots" content="noindex, nofollow">
</head>
View
@@ -1,72 +1,68 @@
<?php
-define('MYSQL_DATE_FORMAT', '%d/%m/%Y %H:%i');
-define('PHP_DATE', 'd/m/Y H:i');
-
-# newsletter form
-define('SUBJECT', 'Oggetto');
-define('DESCRIPTION', 'Descrizione');
-define('RESOURCES', 'Immagini');
-define('RESOURCE', 'Immagine');
+# actions
+define('ACTIONS', 'Azioni');
+define('CHOOSE', 'Scegli');
+define('CREATE', 'Crea nuovo/a');
+define('DELETE', 'Elimina');
+define('READ', 'Visualizza');
+define('UPDATE', 'Aggiorna');
+define('SEND', 'Invia');
+define('SUBMIT', 'Invio');
+define('SELECT', 'Seleziona');
# newsletter
+define('NEWSLETTER', 'Newsletter');
define('NEWSLETTERS', 'Newsletter');
-define('CREATE_NEWSLETTER', 'Crea nuova newsletter');
-define('READ_NEWSLETTER', 'Anteprima newsletter');
-define('UPDATE_NEWSLETTER', 'Aggiorna newsletter');
-define('DELETE_NEWSLETTER', 'Elimina newsletter');
-define('SEND_NEWSLETTER', 'Spedisci newsletter');
-define('NO_NEWSLETTERS', 'Non ci sono newsletter.');
# template
+define('TEMPLATE', 'Template');
define('TEMPLATES', 'Template');
-define('CREATE_TEMPLATE', 'Crea nuovo template');
-define('READ_TEMPLATE', 'Visualizza template');
-define('UPDATE_TEMPLATE', 'Aggiorna template');
-define('DELETE_TEMPLATE', 'Elimina template');
-define('NO_TEMPLATES', 'Non ci sono template.');
# user
+define('USER', 'Utente');
define('USERS', 'Utenti');
define('USERS_COUNT', 'Numero utenti');
define('CREATE_USER', 'Crea nuovo utente');
define('READ_USER', 'Statistiche utente');
define('UPDATE_USER', 'Aggiorna dati utente');
define('DELETE_USER', 'Elimina utente');
-define('NO_USERS', 'Non ci sono utenti.');
# list
+define('LISTA', 'Mailing List');
define('LISTS', 'Liste');
-define('CREATE_LIST', 'Crea nuova lista');
-define('READ_LIST', 'Leggi lista');
-define('UPDATE_LIST', 'Aggiorna lista');
-define('DELETE_LIST', 'Elimina lista');
-define('NO_LISTS', 'Non ci sono mailing lists.');
-define('SELECT_LIST', 'Seleziona la mailing list');
-# "at"
+# "at" (date and time)
define('CREATED_AT', 'Creato/a il');
define('UPDATED_AT', 'Aggiornato/a il');
define('SENT_AT', 'Inviata il');
define('LAST_SEEN_AT', 'Visto il');
-# "is"
+# "is" (booleans)
define('IS_ACTIVE', 'Attivo');
define('IS_SUBSCRIBED', 'Iscritto');
# miscellaneous
-define('ACTIONS', 'Azioni');
-define('SUCCESS', 'Azione eseguita con successo.');
-define('FAIL', 'Errore.');
-define('YES', '');
-define('NO', 'No');
-define('NEVER', 'Mai');
-define('NOT_SET', 'Non settato');
define('BACK', 'Torna indietro');
-define('SUBMIT', 'Invio');
+define('BODY', 'Corpo');
+define('DESCRIPTION', 'Descrizione');
define('EMAIL', 'Email');
define('EMAIL_ADDRESSES', 'Indirizzi email');
-define('STATISTICS', 'Statistiche');
-define('QUICK_SEND', 'Invio veloce');
+define('FAIL', 'Errore.');
define('NAME', 'Nome');
-define('BODY', 'Corpo');
+define('NEVER', 'Mai');
+define('NO', 'No');
+define('NO_DATA', 'Non ci sono dati.');
+define('NOT_SET', 'Non settato');
+define('PREVIEW', 'Anteprima');
+define('RESOURCE', 'Immagine');
+define('RESOURCES', 'Immagini');
+define('STATISTICS', 'Statistiche');
+define('SUBJECT', 'Oggetto');
+define('SUCCESS', 'Azione eseguita con successo.');
+define('QUICK_SEND', 'Invio veloce!');
+define('YES', '');
+
+# system
+define('MYSQL_DATE_FORMAT', '%d/%m/%Y %H:%i');
+define('PHP_DATE', 'd/m/Y H:i');
View
@@ -6,7 +6,7 @@
################################
-?><h1><?=CREATE_LIST?></h1><?php
+?><h1><?=CREATE ." ". LISTA?></h1><?php
include_once '_list_form.php';
View
@@ -5,7 +5,7 @@
################################
-?><h1><?=DELETE_LIST?></h1><?php
+?><h1><?=DELETE ." ". LISTA?></h1><?php
if ( Lista::delete($_GET['id']) ) {
echo SUCCESS;
View
@@ -6,7 +6,7 @@
################################
-?><h1><?=READ_LIST?></h1><?php
+?><h1><?=READ ." ". LISTA?></h1><?php
$lista = Lista::read($_GET['id']);
$users = User::all_where("list_id={$lista->id}");
View
@@ -6,7 +6,7 @@
################################
-?><h1><?=UPDATE_LIST?></h1><?php
+?><h1><?=UPDATE ." ". LISTA?></h1><?php
$l = Lista::read($_GET['id']);
Oops, something went wrong.

0 comments on commit 2de7d85

Please sign in to comment.