Dotclear

source: plugins/newsletter/trunk/inc/class.newsletter.settings.php @ 2643

Revision 2643, 34.8 KB checked in by kwon, 13 years ago (diff)

Newsletter 3.7.9 :

' closes #538 : ajoute une date unique de dernier envoi
' correction dans l'utilisation du tri des dates
' corrections dans les styles

Line 
1<?php
2# -- BEGIN LICENSE BLOCK ----------------------------------
3# This file is part of Newsletter, a plugin for Dotclear.
4#
5# Copyright (c) 2009-2010 Benoit de Marne.
6# benoit.de.marne@gmail.com
7# Many thanks to Association Dotclear and special thanks to Olivier Le Bris
8#
9# Licensed under the GPL version 2.0 license.
10# A copy of this license is available in LICENSE file or at
11# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
12# -- END LICENSE BLOCK ------------------------------------
13
14class newsletterSettings
15{
16     protected $core;
17     protected $blog;
18     protected $blogname;
19     protected $parameters;
20     protected $blog_settings;
21     protected $system_settings;
22     
23     /**
24      * Class constructor
25      *
26      * @param:     $core     dcCore
27      */
28     public function __construct($core)
29     {
30          $this->core = &$core;
31          $this->blog = &$core->blog;
32          $this->blogname = $this->blog->name;
33
34          # Settings compatibility test
35          if (version_compare(DC_VERSION,'2.2-alpha','>=')) {
36               $this->blog_settings =& $core->blog->settings->newsletter;
37               $this->system_settings = $core->blog->settings->system;
38          } else {
39               $this->blog_settings =& $core->blog->settings;
40               $this->system_settings =& $core->blog->settings;
41          }   
42         
43          $this->parameters = $this->blog_settings->newsletter_parameters != '' ? unserialize($this->blog_settings->newsletter_parameters) : array();
44     }
45
46     /**
47      * Retrieves all parameters
48      *
49      * @return:    array
50      */
51     public function getParameters()
52     {
53          return $this->parameters;
54     }
55
56     /**
57      * Retrieves one parameter
58      *
59      * @return:    $parameter
60      */
61     public function getParameter($parameter)
62     {
63          return array_key_exists($parameter,$this->parameters) ? $this->parameters[$parameter] : false;
64     }
65
66     /**
67      * Add one parameter
68      *
69      * @return:    $parameter
70      */
71     public function setParameter($parameter,$value)
72     {
73          $this->parameters[$parameter] = $value;
74     }
75
76     /**
77      * Saves parameters array on blog settings
78      */
79     public function save()
80     {
81          $this->blog_settings->put('newsletter_parameters',serialize($this->parameters),'string','Newsletter settings');
82          $this->blog->triggerBlog();
83     }
84
85     /**
86     * renvoi le nom de l'éditeur du blog
87     */
88     public function getEditorName() 
89     { 
90          return (string)$this->getParameter('editorName'); 
91     }
92
93     /**
94     * renseigne le nom de l'éditeur
95     */
96     public function setEditorName($value) 
97     { 
98          $this->setParameter('editorName',(string)$value);
99     }
100
101     /**
102     * efface/initialise le nom de l'éditeur
103     */
104     public function clearEditorName() 
105     { 
106          $this->setEditorName(''); 
107     }
108
109     /**
110     * renvoi l'email de l'éditeur du blog
111     */
112     public function getEditorEmail() 
113     { 
114          return (string)$this->getParameter('editorEmail');
115     }
116     
117     /**
118     * renseigne l'email de l'éditeur
119     */
120     public function setEditorEmail($value) 
121     {
122          $this->setParameter('editorEmail',(string)$value);
123     }
124     
125     /**
126     * efface/initialise l'email de l'éditeur
127     */
128     public function clearEditorEmail() 
129     { 
130          $this->setEditorEmail('');
131     }
132
133     /**
134     * renvoi le mode d'envoi de la newsletter
135     */
136     public function getSendMode() 
137     { 
138          return (string)$this->getParameter('mode');
139     }
140     
141     /**
142     * renseigne le mode d'envoi de la newsletter
143     */
144     public function setSendMode($value) 
145     { 
146          $this->setParameter('mode',(string)$value);
147     }
148     
149     /**
150     * efface/initialise le mode d'envoi de la newsletter
151     */
152     public function clearSendMode() 
153     { 
154          $this->setSendMode('html');
155     }
156
157     /**
158     * utilisation du format d'envoi par utilisateur ou défaut
159     */
160     public function getUseDefaultFormat() 
161     { 
162          return (boolean)$this->getParameter('use_default_format'); 
163     }
164     
165     public function setUseDefaultFormat($value) 
166     {
167          $this->setParameter('use_default_format',(boolean)$value);
168     }
169     
170     public function clearUseDefaultFormat() 
171     { 
172          $this->setUseDefaultFormat(false); 
173     }   
174     
175     /**
176     * nombre maximal de billet retournés
177     */
178     public function getMaxPosts() 
179     { 
180          return (integer)$this->getParameter('maxposts'); 
181     }
182     
183     /**
184     * renseigne le nombre maximal de billet retournés
185     */
186     public function setMaxPosts($value) 
187     { 
188          $minPosts=(integer)$this->getParameter('minposts');
189          if( $minPosts < (integer)$value) {
190               $this->setParameter('maxposts',(integer)$value);
191          } else {
192               $this->setParameter('maxposts',(integer)$minPosts);
193          }
194     }
195     
196     /**
197     * efface/initialise le nombre maximal de billet retournés
198     */
199     public function clearMaxPosts() 
200     { 
201          $this->setMaxPosts(1); 
202     }
203     
204     /*
205     * nombre minimum de billet retournés
206     */
207     public function getMinPosts() 
208     { 
209          return (integer)$this->getParameter('minposts'); 
210     }
211     
212     /**
213     * renseigne le nombre minimal de billet retournés
214     */
215     public function setMinPosts($value) 
216     { 
217          $this->setParameter('minposts',(integer)$value);
218     }
219     
220     /**
221     * efface/initialise le nombre maximal de billet retournés
222     */
223     public function clearMinPosts() 
224     { 
225          $this->setMinPosts(1); 
226     }   
227
228     /**
229     * envoi automatique
230     */
231     public function getAutosend() 
232     { 
233          return (boolean)$this->getParameter('autosend'); 
234     }
235     
236     /**
237     * indique si on doit envoyer automatiquement
238     */
239     public function setAutosend($value) 
240     { 
241          $this->setParameter('autosend',(boolean)$value);
242     }
243     
244     /**
245     * réinitialise l'indicateur d'envoi automatique
246     */
247     public function clearAutosend() 
248     { 
249          $this->setAutosend(false); 
250     }
251
252     /**
253     * utilisation d'un captcha
254     */
255     public function getCaptcha() 
256     { 
257          return (boolean)$this->getParameter('captcha'); 
258     }
259     
260     /**
261     * indique si on doit utiliser un captcha
262     */
263     public function setCaptcha($value) 
264     {
265          $this->setParameter('captcha',(boolean)$value);
266     }
267     
268     /**
269     * réinitialise l'indicateur d'utilisation de captcha
270     */
271     public function clearCaptcha() 
272     { 
273          $this->setCaptcha(false); 
274     }
275
276     /**
277     * retourne le flag Restreindre l'aperçu uniquement à l'extrait des billets
278     */
279     public function getExcerptRestriction() 
280     { 
281          return (boolean)$this->getParameter('excerpt_restriction');
282     }
283     
284     /**
285     * positionne le flag Restreindre l'aperçu uniquement à l'extrait des billets
286     */
287     public function setExcerptRestriction($value) 
288     {
289          $this->setParameter('excerpt_restriction',(boolean)$value);
290     }
291     
292     /**
293     * initialise le flag Restreindre l'aperçu uniquement à l'extrait des billets
294     */
295     public function clearExcerptRestriction() 
296     { 
297          $this->setExcerptRestriction(false);
298     }
299         
300     /**
301     * Affichage du contenu du post dans la newsletter
302     */
303     public function getViewContentPost() 
304     { 
305          return (boolean)$this->getParameter('view_content_post');
306     }
307     
308     /**
309     * indique si on doit afficher le contenu du post
310     */
311     public function setViewContentPost($value) 
312     {
313          $this->setParameter('view_content_post',(boolean)$value);
314     }
315     
316     /**
317     * réinitialise l'indicateur d'affichage du contenu du post
318     */
319     public function clearViewContentPost() 
320     { 
321          $this->setViewContentPost(false);
322     }
323
324     /**
325     * retourne la taille maximale du contenu du billet
326     */
327     public function getSizeContentPost() 
328     { 
329          return (integer)$this->getParameter('size_content_post'); 
330     }
331     
332     /**
333     * renseigne la taille maximale du contenu du billet
334     */
335     public function setSizeContentPost($value) 
336     {
337          $this->setParameter('size_content_post',(integer)$value);
338     }
339     
340    /**
341     * efface/initialise la taille maximale du contenu du billet
342     */
343     public function clearSizeContentPost() 
344     { 
345          $this->setSizeContentPost(100); 
346     }
347
348     /**
349     * retourne le message d'introduction de la newsletter
350     */
351     public function getIntroductoryMsg() 
352     { 
353          return (string)$this->getParameter('introductory_msg'); 
354     }
355     
356     /**
357     * renseigne le message d'introduction de la newsletter
358     */
359     public function setIntroductoryMsg($value) 
360     {
361          $this->setParameter('introductory_msg',(string)$value);
362     }
363     
364     /**
365     * efface/initialise le message d'introduction de la newsletter
366     */
367     public function clearIntroductoryMsg() 
368     { 
369          $this->setIntroductoryMsg(''); 
370     }
371
372     /**
373     * retourne le message de conclusion
374     */
375     public function getConcludingMsg()
376     { 
377          return (string)$this->getParameter('concluding_msg');
378     }
379     
380     /**
381     * renseigne le message de conclusion
382     */
383     public function setConcludingMsg($value) 
384     { 
385          $this->setParameter('concluding_msg',(string)$value);
386     }
387     
388     /**
389     * efface/initialise le message de conclusion
390     */
391     public function clearConcludingMsg()
392     { 
393          $this->setConcludingMsg(__('Thanks you for reading.')); 
394     }
395
396     /**
397     * retourne le message de présentation du formulaire d'inscription
398     */
399     public function getMsgPresentationForm() 
400     { 
401          return (string)$this->getParameter('msg_presentation_form'); 
402     }
403     
404     /**
405     * renseigne le message de présentation du formulaire d'inscription
406     */
407     public function setMsgPresentationForm($value) 
408     { 
409          $this->setParameter('msg_presentation_form',(string)$value);
410     }
411     
412     /**
413     * efface/initialise le message de présentation du formulaire d'inscription
414     */
415     public function clearMsgPresentationForm() 
416     { 
417          $this->setMsgPresentationForm(''); 
418     }
419
420     /**
421     * retourne le message de présentation
422     */
423     public function getPresentationMsg()
424     { 
425          return (string)$this->getParameter('presentation_msg');
426     }
427     
428     /**
429     * renseigne le message de présentation
430     */
431     public function setPresentationMsg($value) 
432     { 
433          $this->setParameter('presentation_msg',(string)$value);
434     }
435     
436     /**
437     * efface/initialise le message de présentation
438     */
439     public function clearPresentationMsg() 
440     { 
441          $this->setPresentationMsg(__('This is the newsletter for')); 
442     }
443
444     /**
445     * retourne le message de présentation des billets
446     */
447     public function getPresentationPostsMsg()
448     { 
449          return (string)$this->getParameter('presentation_posts_msg');
450     }
451     
452     /**
453     * renseigne le message de présentation des billets
454     */
455     public function setPresentationPostsMsg($value) 
456     { 
457          $this->setParameter('presentation_posts_msg',(string)$value);
458     }
459     
460     /**
461     * efface/initialise le message de présentation des billets
462     */
463     public function clearPresentationPostsMsg() 
464     { 
465          $this->setPresentationPostsMsg(__('Here are the last post:')); 
466     }
467
468     /**
469     * retourne le message d'introduction pour la confirmation
470     */
471     public function getTxtIntroConfirm()
472     { 
473          return (string)$this->getParameter('txt_intro_confirm');
474     }
475
476     public function setTxtIntroConfirm($value) 
477     { 
478          $this->setParameter('txt_intro_confirm',(string)$value);
479     }
480
481     public function clearTxtIntroConfirm() 
482     { 
483          $this->setTxtIntroConfirm(__('To confirm your subscription')); 
484     }   
485     
486     /**
487     * retourne le titre du lien de confirmation
488     */
489     public function getTxtConfirm()
490     { 
491          return (string)$this->getParameter('txtConfirm');
492     }
493     
494     public function setTxtConfirm($value) 
495     { 
496          $this->setParameter('txtConfirm',(string)$value);
497     }
498     
499     public function clearTxtConfirm() 
500     { 
501          $this->setTxtConfirm(__('Click here')); 
502     }   
503     
504     /**
505     * retourne le message d'introduction pour la suppression
506     */
507     public function getTxtIntroDisable()
508     { 
509          return (string)$this->getParameter('txt_intro_disable');
510     }
511     
512     public function setTxtIntroDisable($value) 
513     { 
514          $this->setParameter('txt_intro_disable',(string)$value);
515     }
516     
517     public function clearTxtIntroDisable() 
518     { 
519          $this->setTxtIntroDisable(__('To cancel your account')); 
520     }   
521     
522     /**
523     * retourne le titre du lien de suppression
524     */
525     public function getTxtDisable()
526     { 
527          return (string)$this->getParameter('txtDisable');
528     }
529     
530     public function setTxtDisable($value) 
531     { 
532          $this->setParameter('txtDisable',(string)$value);
533     }
534     
535     public function clearTxtDisable() 
536     { 
537          $this->setTxtDisable(__('Click here')); 
538     }   
539     
540     /**
541     * retourne le message d'introduction pour l'activation
542     */
543     public function getTxtIntroEnable()
544     { 
545          return (string)$this->getParameter('txt_intro_enable');
546     }
547     
548     public function setTxtIntroEnable($value) 
549     { 
550          $this->setParameter('txt_intro_enable',(string)$value);
551     }
552     
553     public function clearTxtIntroEnable() 
554     { 
555          $this->setTxtIntroEnable(__('To enable your account')); 
556     }   
557     
558     /**
559     * retourne le titre du lien de confirmation
560     */
561     public function getTxtEnable()
562     { 
563          return (string)$this->getParameter('txtEnable');
564     }
565     
566     public function setTxtEnable($value) 
567     { 
568          $this->setParameter('txtEnable',(string)$value);
569     }
570     
571     public function clearTxtEnable() 
572     { 
573          $this->setTxtEnable(__('Click here')); 
574     }   
575     
576     /**
577     * retourne le message d'introduction pour la suspension
578     */
579     public function getTxtIntroSuspend()
580     { 
581          return (string)$this->getParameter('txt_intro_suspend');
582     }
583     
584     public function setTxtIntroSuspend($value) 
585     { 
586          $this->setParameter('txt_intro_suspend',(string)$value);
587     }
588     
589     public function clearTxtIntroSuspend() 
590     { 
591          $this->setTxtIntroSuspend(__('To suspend your account')); 
592     }   
593     
594     /**
595     * retourne le titre du lien de suspension
596     */
597     public function getTxtSuspend()
598     { 
599          return (string)$this->getParameter('txtSuspend');
600     }
601     
602     public function setTxtSuspend($value) 
603     { 
604          $this->setParameter('txtSuspend',(string)$value);
605     }
606     
607     public function clearTxtSuspend() 
608     { 
609          $this->setTxtSuspend(__('Click here')); 
610     }
611
612     /**
613     * retourne le texte de la suspension
614     */
615     public function getTxtSuspendedMsg()
616     {
617          return (string)$this->getParameter('txt_suspended_msg');
618     }
619     
620     public function setTxtSuspendedMsg($value)
621     {
622          $this->setParameter('txt_suspended_msg',(string)$value);
623     }
624     
625     public function clearTxtSuspendedMsg()
626     {
627          $this->setTxtSuspendedMsg(__('Newsletter account suspend for'));
628     }
629
630     /**
631     * retourne le filtre sur la catégorie
632     */
633     public function getCategory() 
634     { 
635          return (integer)$this->getParameter('category'); 
636     }
637     
638     /**
639     * renseigne le filtre sur la catégorie
640     */
641     public function setCategory($value) 
642     { 
643          $this->setParameter('category',(integer)$value);
644     }
645     
646     /**
647     * efface/initialise le filtre sur la catégorie
648     */
649     public function clearCategory() 
650     { 
651          $this->setCategory(null);
652     }
653
654     /**
655     * retourne si on inclut les billets des sous catégories
656     */
657     public function getCheckSubCategories() 
658     { 
659          return (boolean)$this->getParameter('check_subcategories');
660     }
661     
662     /**
663     * indique si on inclut les billets des sous catégories
664     */
665     public function setCheckSubCategories($value) 
666     { 
667          $this->setParameter('check_subcategories',(boolean)$value);
668     }
669     
670     /**
671     * réinitialise l'indicateur des sous-catégories
672     */
673     public function clearCheckSubCategories() 
674     { 
675          $this->setCheckSubCategories(false);
676     }   
677     
678
679     /**
680     * retourne l'état de la planification
681     */
682     public function getCheckSchedule() 
683     { 
684          return (boolean)$this->getParameter('check_schedule');
685     }
686     
687     /**
688     * indique si on doit utiliser la planification
689     */
690     public function setCheckSchedule($value) 
691     { 
692          $this->setParameter('check_schedule',(boolean)$value);
693     }
694     
695     /**
696     * réinitialise l'indicateur de planification
697     */
698     public function clearCheckSchedule() 
699     { 
700          $this->setCheckSchedule(false);
701     }
702
703     /**
704     * retourne l'état de la notification
705     */
706     public function getCheckNotification() 
707     { 
708          return (boolean)$this->getParameter('check_notification');
709     }
710     
711     /**
712     * indique si on doit utiliser la notification
713     */
714     public function setCheckNotification($value) 
715     { 
716          $this->setParameter('check_notification',(boolean)$value);
717     }
718     
719     /**
720     * réinitialise l'indicateur de notification
721     */
722     public function clearCheckNotification()
723     { 
724          $this->setCheckNotification(false);
725     }
726
727     /**
728     * retourne le titre de la newsletter
729     */
730     public function getNewsletterSubjectWithDate()
731     {
732          $time = time() + dt::getTimeOffset($this->system_settings->blog_timezone);
733          $format = $this->system_settings->date_format;
734          $date_sent = dt::str(
735               $format,
736               $time
737          );
738          return (string)$this->getParameter('newsletter_subject').' du '.$date_sent;
739     }
740     
741     /**
742     * retourne le titre de la newsletter
743     */
744     public function getNewsletterSubject()
745     {
746          return (string)$this->getParameter('newsletter_subject');
747     }
748     
749     public function setNewsletterSubject($value) 
750     { 
751          $this->setParameter('newsletter_subject',(string)$value);
752     }
753     
754     public function clearNewsletterSubject() 
755     { 
756          $this->setNewsletterSubject(__('Newsletter for').' '.$this->blogname); 
757     }
758
759     /**
760     * retourne le titre du mail de confirmation
761     */
762     public function getConfirmSubject()
763     { 
764          return (string)$this->getParameter('confirm_subject');
765     }
766     
767     public function setConfirmSubject($value) 
768     { 
769          $this->setParameter('confirm_subject',(string)$value);
770     }
771     
772     public function clearConfirmSubject() 
773     { 
774          $this->setConfirmSubject(__('Newsletter subscription confirmation for').' '.$this->blogname); 
775     }
776
777     /**
778     * retourne le titre du mail de suspension
779     */
780     public function getSuspendSubject()
781     { 
782          return (string)$this->getParameter('suspend_subject');
783     }
784     
785     public function setSuspendSubject($value) 
786     { 
787          $this->setParameter('suspend_subject',(string)$value);
788     }
789     
790     public function clearSuspendSubject() 
791     { 
792          $this->setSuspendSubject(__('Newsletter account suspend for').' '.$this->blogname); 
793     }
794
795     /**
796     * retourne le titre du mail d'activation
797     */
798     public function getEnableSubject()
799     { 
800          return (string)$this->getParameter('enable_subject');
801     }
802     
803     public function setEnableSubject($value) 
804     { 
805          $this->setParameter('enable_subject',(string)$value);
806     }
807     
808     public function clearEnableSubject() 
809     { 
810          $this->setEnableSubject(__('Newsletter account activation for').' '.$this->blogname);
811     }
812
813     /**
814     * retourne le titre du mail de désactivation
815     */
816     public function getDisableSubject()
817     { 
818          return (string)$this->getParameter('disable_subject');
819     }
820     
821     public function setDisableSubject($value) 
822     { 
823          $this->setParameter('disable_subject',(string)$value);
824     }
825     
826     public function clearDisableSubject() 
827     { 
828          $this->setDisableSubject(__('Newsletter account removal for').' '.$this->blogname);
829     }
830
831     /**
832     * retourne le titre du mail de résumé
833     */
834     public function getResumeSubject()
835     { 
836          return (string)$this->getParameter('resume_subject');
837     }
838     
839     public function setResumeSubject($value) 
840     { 
841          $this->setParameter('resume_subject',(string)$value);
842     }
843     
844     public function clearResumeSubject() 
845     { 
846          $this->setResumeSubject(__('Newsletter account resume for').' '.$this->blogname);
847     }
848
849     /**
850     * retourne le titre du mail de changement de mode d'envoi
851     */
852     public function getChangeModeSubject()
853     { 
854          return (string)$this->getParameter('change_mode_subject');
855     }
856     
857     public function setChangeModeSubject($value) 
858     { 
859          $this->setParameter('change_mode_subject',(string)$value);
860     }
861     
862     public function clearChangeModeSubject() 
863     { 
864          $this->setChangeModeSubject(__('Newsletter account change format for').' '.$this->blogname);
865     }
866
867     /**
868     * Utilisation de l'option Suspend
869     */
870     public function getCheckUseSuspend() 
871     { 
872          return (boolean)$this->getParameter('check_use_suspend');
873     }
874     
875     /**
876     * indique si on doit utiliser la notification
877     */
878     public function setCheckUseSuspend($value) 
879     { 
880          $this->setParameter('check_use_suspend',(boolean)$value);
881     }
882     
883     /**
884     * réinitialise l'indicateur de notification
885     */
886     public function clearCheckUseSuspend()
887     { 
888          $this->setCheckUseSuspend(false);
889     }
890
891     /**
892     * retourne le titre de la page du formulaire
893     */
894     public function getFormTitlePage()
895     {
896          return (string)$this->getParameter('form_title_page');
897     }
898     
899     public function setFormTitlePage($value)
900     {
901          $this->setParameter('form_title_page',(string)$value);
902     }
903     
904     public function clearFormTitlePage()
905     {
906          $this->setFormTitlePage(__('Newsletter'));
907     }
908
909     /**
910     * retourne le message de confirmation
911     */
912     public function getConfirmMsg()
913     {
914          return (string)$this->getParameter('confirm_msg');
915     }
916     
917     public function setConfirmMsg($value)
918     {
919          $this->setParameter('confirm_msg',(string)$value);
920     }
921     
922     public function clearConfirmMsg()
923     {
924          $this->setConfirmMsg(__('Newsletter subscription confirmation for'));
925     }
926
927     /**
928     * retourne le message de conclusion de la confirmation
929     */
930     public function getConcludingConfirmMsg()
931     {
932          return (string)$this->getParameter('concluding_confirm_msg');
933     }
934     
935     public function setConcludingConfirmMsg($value)
936     {
937          $this->setParameter('concluding_confirm_msg',(string)$value);
938     }
939     
940     public function clearConcludingConfirmMsg()
941     {
942          $this->setConcludingConfirmMsg(__('Thanks you for subscribing.'));
943     }
944
945     /**
946     * retourne le message de suspension
947     */
948     public function getSuspendMsg()
949     {
950          return (string)$this->getParameter('suspend_msg');
951     }
952     
953     public function setSuspendMsg($value)
954     {
955          $this->setParameter('suspend_msg',(string)$value);
956     }
957     
958     public function clearSuspendMsg()
959     {
960          $this->setSuspendMsg(__('Newsletter account suspend for'));
961     }
962     
963     /**
964     * retourne le titre de la page du formulaire
965     */
966     public function getConcludingSuspendMsg()
967     {
968          return (string)$this->getParameter('concluding_suspend_msg');
969     }
970     
971     public function setConcludingSuspendMsg($value)
972     {
973          $this->setParameter('concluding_suspend_msg',(string)$value);
974     }
975     
976     public function clearConcludingSuspendMsg()
977     {
978          $this->setConcludingSuspendMsg(__('Have a nice day!'));
979     }
980
981     /**
982     * retourne le message d'activation
983     */
984     public function getEnableMsg()
985     {
986          return (string)$this->getParameter('enable_msg');
987     }
988     
989     public function setEnableMsg($value)
990     {
991          $this->setParameter('enable_msg',(string)$value);
992     }
993     
994     public function clearEnableMsg()
995     {
996          $this->setEnableMsg(__('Newsletter account activation for'));
997     }
998
999     /**
1000     * retourne la conclusion du message d'activation
1001     */
1002     public function getConcludingEnableMsg()
1003     {
1004          return (string)$this->getParameter('concluding_enable_msg');
1005     }
1006     
1007     public function setConcludingEnableMsg($value)
1008     {
1009          $this->setParameter('concluding_enable_msg',(string)$value);
1010     }
1011     
1012     public function clearConcludingEnableMsg()
1013     {
1014          $this->setConcludingEnableMsg(__('Thank you for subscribing.'));
1015     }
1016
1017     /**
1018     * retourne le message d'activation
1019     */
1020     public function getTxtEnabledMsg()
1021     {
1022          return (string)$this->getParameter('txt_enabled_msg');
1023     }
1024     
1025     public function setTxtEnabledMsg($value)
1026     {
1027          $this->setParameter('txt_enabled_msg',(string)$value);
1028     }
1029     
1030     public function clearTxtEnabledMsg()
1031     {
1032          $this->setTxtEnabledMsg(__('Your account has been validated.'));
1033     }
1034
1035     /**
1036     * retourne le message de désactivation
1037     */
1038     public function getDisableMsg()
1039     {
1040          return (string)$this->getParameter('disable_msg');
1041     }
1042     
1043     public function setDisableMsg($value)
1044     {
1045          $this->setParameter('disable_msg',(string)$value);
1046     }
1047     
1048     public function clearDisableMsg()
1049     {
1050          $this->setDisableMsg(__('Newsletter account removal for'));
1051     }
1052
1053     /**
1054     * retourne la conclusion du message de désactivation
1055     */
1056     public function getConcludingDisableMsg()
1057     {
1058          return (string)$this->getParameter('concluding_disable_msg');
1059     }
1060     
1061     public function setConcludingDisableMsg($value)
1062     {
1063          $this->setParameter('concluding_disable_msg',(string)$value);
1064     }
1065     
1066     public function clearConcludingDisableMsg()
1067     {
1068          $this->setConcludingDisableMsg(__('Have a nice day!'));
1069     }
1070
1071     /**
1072     * retourne le texte de la désactivation
1073     */
1074     public function getTxtDisabledMsg()
1075     {
1076          return (string)$this->getParameter('txt_disabled_msg');
1077     }
1078     
1079     public function setTxtDisabledMsg($value)
1080     {
1081          $this->setParameter('txt_disabled_msg',(string)$value);
1082     }
1083     
1084     public function clearTxtDisabledMsg()
1085     {
1086          $this->setTxtDisabledMsg(__('Your account has been canceled.'));
1087     }
1088     
1089     /**
1090     * retourne le texte
1091     */
1092     public function getHeaderChangeModeMsg()
1093     {
1094          return (string)$this->getParameter('header_changemode_msg');
1095     }
1096     
1097     public function setHeaderChangeModeMsg($value)
1098     {
1099          $this->setParameter('header_changemode_msg',(string)$value);
1100     }
1101     
1102     public function clearHeaderChangeModeMsg()
1103     {
1104          $this->setHeaderChangeModeMsg(__('Newsletter account change format for'));
1105     }
1106
1107     /**
1108     * retourne le texte
1109     */
1110     public function getFooterChangeModeMsg()
1111     {
1112          return (string)$this->getParameter('footer_changemode_msg');
1113     }
1114     
1115     public function setFooterChangeModeMsg($value)
1116     {
1117          $this->setParameter('footer_changemode_msg',(string)$value);
1118     }
1119     
1120     public function clearFooterChangeModeMsg()
1121     {
1122          $this->setFooterChangeModeMsg(__('Have a nice day!'));
1123     }
1124     
1125     /**
1126     * retourne le texte
1127     */
1128     public function getChangeModeMsg()
1129     {
1130          return (string)$this->getParameter('changemode_msg');
1131     }
1132     
1133     public function setChangeModeMsg($value)
1134     {
1135          $this->setParameter('changemode_msg',(string)$value);
1136     }
1137     
1138     public function clearChangeModeMsg()
1139     {
1140          $this->setChangeModeMsg(__('Your sending format has been updated.'));
1141     }
1142     
1143     /**
1144     * retourne le texte
1145     */
1146     public function getHeaderResumeMsg()
1147     {
1148          return (string)$this->getParameter('header_resume_msg');
1149     }
1150     
1151     public function setHeaderResumeMsg($value)
1152     {
1153          $this->setParameter('header_resume_msg',(string)$value);
1154     }
1155     
1156     public function clearHeaderResumeMsg()
1157     {
1158          $this->setHeaderResumeMsg(__('Newsletter account resume for'));
1159     }
1160
1161     /**
1162     * retourne le texte
1163     */
1164     public function getFooterResumeMsg()
1165     {
1166          return (string)$this->getParameter('footer_resume_msg');
1167     }
1168     
1169     public function setFooterResumeMsg($value)
1170     {
1171          $this->setParameter('footer_resume_msg',(string)$value);
1172     }
1173     
1174     public function clearFooterResumeMsg()
1175     {
1176          $this->setFooterResumeMsg(__('Have a nice day!'));
1177     }
1178
1179     /**
1180     * retourne le texte
1181     */
1182     public function getTxtSubscribedMsg()
1183     {
1184          return (string)$this->getParameter('txt_subscribed_msg');
1185     }
1186     
1187     public function setTxtSubscribedMsg($value)
1188     {
1189          $this->setParameter('txt_subscribed_msg',(string)$value);
1190     }
1191     
1192     public function clearTxtSubscribedMsg()
1193     {
1194          $this->setTxtSubscribedMsg(__('Thank you for your subscription.'));
1195     }
1196     
1197     /**
1198     * Sélection du type de date pour le tri des billets
1199     */
1200     public function getOrderDate() 
1201     { 
1202          return (string)$this->getParameter('order_date');
1203     }
1204     
1205     /**
1206     * renseigne du type de date pour le tri des billets
1207     */
1208     public function setOrderDate($value) 
1209     { 
1210          $this->setParameter('order_date',(string)$value);
1211     }
1212     
1213     /**
1214     * initialise le type de date pour le tri des billets
1215     */
1216     public function clearOrderDate() 
1217     { 
1218          $this->setOrderDate('post_upddt');
1219     }
1220
1221     /**
1222     * indique si on doit envoyer la newsletter lors d'un update
1223     */
1224     public function getSendUpdatePost() 
1225     { 
1226          return (boolean)$this->getParameter('send_update_post');
1227     }
1228     
1229     /**
1230     * indique si on doit envoyer la newsletter lors d'un update
1231     */
1232     public function setSendUpdatePost($value) 
1233     {
1234          $this->setParameter('send_update_post',(boolean)$value);
1235     }
1236     
1237     /**
1238     * réinitialise l'indicateur si on doit envoyer la newsletter lors d'un update
1239     */
1240     public function clearSendUpdatePost() 
1241     { 
1242          $this->setSendUpdatePost(false);
1243     }
1244
1245     /**
1246     * retourne le flag d'affichage du contenu des posts au format texte
1247     */
1248     public function getViewContentInTextFormat() 
1249     { 
1250          return (boolean)$this->getParameter('view_content_in_text_format');
1251     }
1252     
1253     /**
1254     * positionne le flag d'affichage du contenu des posts au format texte
1255     */
1256     public function setViewContentInTextFormat($value) 
1257     {
1258          $this->setParameter('view_content_in_text_format',(boolean)$value);
1259     }
1260     
1261     /**
1262     * initialise le flag d'affichage du contenu des posts au format texte
1263     */
1264     public function clearViewContentInTextFormat() 
1265     { 
1266          $this->setViewContentInTextFormat(false);
1267     }   
1268     
1269     /**
1270     * retourne le flag d'affichage des miniatures dans la newsletter
1271     */
1272     public function getViewThumbnails() 
1273     { 
1274          return (boolean)$this->getParameter('view_thumbnails');
1275     }
1276     
1277     /**
1278     * positionne le flag d'affichage des miniatures dans la newsletter
1279     */
1280     public function setViewThumbnails($value) 
1281     {
1282          $this->setParameter('view_thumbnails',(boolean)$value);
1283     }
1284     
1285     /**
1286     * initialise le flag d'affichage des miniatures dans la newsletter
1287     */
1288     public function clearViewThumbnails() 
1289     { 
1290          $this->setViewThumbnails(false);
1291     }
1292     
1293     /**
1294     * retourne la taille d'affichage des miniatures dans la newsletter
1295     */
1296     public function getSizeThumbnails() 
1297     { 
1298          return (string)$this->getParameter('size_thumbnails');
1299     }
1300     
1301     /**
1302     * positionne la taille d'affichage des miniatures dans la newsletter
1303     */
1304     public function setSizeThumbnails($value) 
1305     { 
1306          $this->setParameter('size_thumbnails',(string)$value);
1307     }
1308     
1309     /**
1310     * initialise la taille d'affichage des miniatures dans la newsletter
1311     */
1312     public function clearSizeThumbnails() 
1313     { 
1314          $this->setSizeThumbnails('m');
1315     }
1316
1317     /**
1318     * retourne le texte du lien pour la visualisation online
1319     */
1320     public function getTxtLinkVisuOnline()
1321     {
1322          return (string)$this->getParameter('txt_link_visu_online');
1323     }
1324
1325     /**
1326     * positionne le texte du lien pour la visualisation online
1327     */
1328     public function setTxtLinkVisuOnline($value)
1329     {
1330          $this->setParameter('txt_link_visu_online',(string)$value);
1331     }
1332     
1333     /**
1334     * initialise le texte du lien pour la visualisation online
1335     */   
1336     public function clearTxtLinkVisuOnline()
1337     {
1338          $this->setTxtLinkVisuOnline(__('If you have problems viewing this message, go to the online version.'));
1339     }   
1340
1341     /**
1342     * retourne la date de l'envoi precedent
1343     */
1344     public function getDatePreviousSend() 
1345     { 
1346          return (string)$this->getParameter('date_previous_send'); 
1347     }
1348     
1349     /**
1350     * positionne la date de l'envoi precedent
1351     */
1352     public function setDatePreviousSend($value=null) 
1353     { 
1354          if($value===null) {
1355               //$date_previous_send = time() + dt::getTimeOffset($this->system_settings->blog_timezone);
1356               // on ajoute 5s pour eviter de recuperer 2 fois le même post               
1357               //$date_previous_send = time()+5;
1358               $date_previous_send = time()+5;
1359          } else {
1360               $date_previous_send = strtotime(html::escapeHTML($value)) - dt::getTimeOffset($this->system_settings->blog_timezone) + 5;
1361          }
1362         
1363          $this->setParameter('date_previous_send',(string)$date_previous_send);
1364     }
1365     
1366     /**
1367     * initialize settings
1368     */
1369     public function defaultsSettings()
1370     {
1371          // parameters
1372          if(!$this->getEditorName()) $this->clearEditorName();
1373          if(!$this->getEditorEmail()) $this->clearEditorEmail();
1374          if(!$this->getSendMode()) $this->clearSendMode();
1375          if(!$this->getUseDefaultFormat()) $this->clearUseDefaultFormat();
1376          if(!$this->getMaxPosts()) $this->clearMaxPosts();
1377          if(!$this->getMinPosts()) $this->clearMinPosts();
1378          if(!$this->getAutosend()) $this->clearAutosend();
1379          if(!$this->getCaptcha()) $this->clearCaptcha();
1380          if(!$this->getExcerptRestriction()) $this->clearExcerptRestriction();
1381          if(!$this->getViewContentPost()) $this->clearViewContentPost();
1382          if(!$this->getSizeContentPost()) $this->clearSizeContentPost();
1383          if(!$this->getViewContentInTextFormat()) $this->setViewContentInTextFormat(true);
1384          if(!$this->getViewThumbnails()) $this->clearViewThumbnails();
1385          if(!$this->getSizeThumbnails()) $this->clearSizeThumbnails();
1386          if(!$this->getCategory()) $this->clearCategory();
1387          if(!$this->getCheckSubCategories()) $this->clearCheckSubCategories();
1388          if(!$this->getCheckSchedule()) $this->clearCheckSchedule();
1389          if(!$this->getCheckNotification()) $this->clearCheckNotification();
1390          if(!$this->getCheckUseSuspend()) $this->clearCheckUseSuspend();
1391          if(!$this->getOrderDate()) $this->clearOrderDate();
1392          if(!$this->getSendUpdatePost()) $this->clearSendUpdatePost();
1393          if(!$this->getDatePreviousSend()) $this->setDatePreviousSend();
1394         
1395          // en vrac
1396          if(!$this->getTxtLinkVisuOnline()) $this->clearTxtLinkVisuOnline();
1397         
1398          // newsletter
1399          if(!$this->getNewsletterSubject()) $this->clearNewsletterSubject();
1400          if(!$this->getIntroductoryMsg()) $this->clearIntroductoryMsg();
1401          if(!$this->getConcludingMsg()) $this->clearConcludingMsg();
1402          if(!$this->getMsgPresentationForm()) $this->clearMsgPresentationForm();
1403          if(!$this->getPresentationMsg()) $this->clearPresentationMsg();
1404          if(!$this->getPresentationPostsMsg()) $this->clearPresentationPostsMsg();
1405                   
1406          // confirm
1407          if(!$this->getConfirmSubject()) $this->clearConfirmSubject();
1408          if(!$this->getTxtIntroConfirm()) $this->clearTxtIntroConfirm();
1409          if(!$this->getTxtConfirm()) $this->clearTxtConfirm();
1410          if(!$this->getConfirmMsg()) $this->clearConfirmMsg();
1411          if(!$this->getConcludingConfirmMsg()) $this->clearConcludingConfirmMsg();
1412
1413          // disable
1414          if(!$this->getDisableSubject()) $this->clearDisableSubject();
1415          if(!$this->getTxtIntroDisable()) $this->clearTxtIntroDisable();
1416          if(!$this->getTxtDisable()) $this->clearTxtDisable();
1417          if(!$this->getDisableMsg()) $this->clearDisableMsg();
1418          if(!$this->getConcludingDisableMsg()) $this->clearConcludingDisableMsg();
1419          if(!$this->getTxtDisabledMsg()) $this->clearTxtDisabledMsg();
1420
1421          // enable
1422          if(!$this->getTxtIntroEnable()) $this->clearTxtIntroEnable();
1423          if(!$this->getTxtEnable()) $this->clearTxtEnable();
1424          if(!$this->getEnableSubject()) $this->clearEnableSubject();
1425          if(!$this->getEnableMsg()) $this->clearEnableMsg();
1426          if(!$this->getConcludingEnableMsg()) $this->clearConcludingEnableMsg();
1427          if(!$this->getTxtEnabledMsg()) $this->clearTxtEnabledMsg();
1428
1429          // suspend
1430          if(!$this->getSuspendSubject()) $this->clearSuspendSubject();
1431          if(!$this->getSuspendMsg()) $this->clearSuspendMsg();
1432          if(!$this->getTxtSuspendedMsg()) $this->clearTxtSuspendedMsg();
1433          if(!$this->getConcludingSuspendMsg()) $this->clearConcludingSuspendMsg();
1434          if(!$this->getTxtIntroSuspend()) $this->clearTxtIntroSuspend();
1435          if(!$this->getTxtSuspend()) $this->clearTxtSuspend();
1436
1437          // changemode
1438          if(!$this->getChangeModeSubject()) $this->clearChangeModeSubject();
1439          if(!$this->getHeaderChangeModeMsg()) $this->clearHeaderChangeModeMsg();
1440          if(!$this->getFooterChangeModeMsg()) $this->clearFooterChangeModeMsg();
1441          if(!$this->getChangeModeMsg()) $this->clearChangeModeMsg();
1442
1443          // resume
1444          if(!$this->getResumeSubject()) $this->clearResumeSubject();
1445          if(!$this->getHeaderResumeMsg()) $this->clearHeaderResumeMsg();
1446          if(!$this->getFooterResumeMsg()) $this->clearFooterResumeMsg();
1447
1448          // subscribe
1449          if(!$this->getFormTitlePage()) $this->clearFormTitlePage();
1450          if(!$this->getTxtSubscribedMsg()) $this->clearTxtSubscribedMsg();
1451
1452          $this->save();
1453     }
1454
1455     /**
1456     * recover old settings
1457     */
1458     public function repriseSettings()
1459     {
1460          global $core;
1461         
1462          # Settings compatibility test
1463          if (version_compare(DC_VERSION,'2.2-alpha','>=')) {
1464               $this->blog_settings =& $core->blog->settings->newsletter;
1465               $this->system_settings = $core->blog->settings->system;
1466          } else {
1467               $this->blog_settings =& $core->blog->settings;
1468               $this->system_settings =& $core->blog->settings;
1469          }
1470         
1471          $old_parameters = array(
1472                              // parameters
1473                              'editorName',
1474                              'editorEmail',
1475                              'maxposts',
1476                              'minposts',
1477                              'autosend',
1478                              'captcha',               
1479                              'view_content_post',
1480                              'size_content_post',
1481                              'category',
1482                              'check_schedule',
1483                              'check_notification',
1484                              'mode',
1485                              'check_use_suspend',
1486                              'use_default_format',
1487                              'send_update_post',
1488                              'view_content_in_text_format',
1489                              'view_thumbnails',
1490                              'size_thumbnails',
1491                              'excerpt_restriction',
1492                              'txt_link_visu_online',
1493                              // newsletter 
1494                              'newsletter_subject',
1495                              'introductory_msg',
1496                              'concluding_msg',
1497                              'msg_presentation_form',
1498                              'presentation_msg',
1499                              'presentation_posts_msg',
1500                              // confirm
1501                              'txt_intro_confirm',
1502                              'txtConfirm',
1503                              'confirm_subject',
1504                              'confirm_msg',
1505                              'concluding_confirm_msg',         
1506                              // disable
1507                              'txt_intro_disable',
1508                              'txtDisable',
1509                              'disable_subject',
1510                              'disable_msg',
1511                              'concluding_disable_msg',
1512                              'txt_disabled_msg',
1513                              // enable
1514                              'txt_intro_enable',
1515                              'txtEnable',
1516                              'enable_subject',
1517                              'enable_msg',
1518                              'concluding_enable_msg',
1519                              'txt_enabled_msg',
1520                              // suspend
1521                              'txt_intro_suspend',
1522                              'txtSuspend',
1523                              'suspend_subject',
1524                              'suspend_msg',
1525                              'concluding_suspend_msg',
1526                              'txt_suspended_msg',                             
1527                              // changemode
1528                              'change_mode_subject',
1529                              'header_changemode_msg',
1530                              'footer_changemode_msg',
1531                              'changemode_msg',
1532                              // resume
1533                              'resume_subject',
1534                              'header_resume_msg',
1535                              'footer_resume_msg',         
1536                              // subscribe
1537                              'form_title_page',
1538                              'txt_subscribed_msg',
1539                              'date_previous_send'
1540                              );
1541
1542          // reprise des paramètres
1543          foreach ($old_parameters as $v) {
1544               // récupération de l'ancien paramètre
1545               $value = $this->blog_settings->get('newsletter_'.$v);
1546               
1547               if($value) {
1548                    $this->setParameter($v,$value);
1549                    $this->core->error->add('maj param : v='.$v.', value='.$value);
1550               }
1551               
1552               // suppression de l'ancien paramètre
1553               $this->blog_settings->drop('newsletter_'.$v);
1554          }
1555          unset($v);
1556
1557          $this->clearCheckSubCategories();
1558          $this->clearOrderDate();
1559
1560          $this->save();
1561     }
1562}
1563
1564?>
Note: See TracBrowser for help on using the repository browser.

Sites map